Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fs_unstable_readDir
Browse files Browse the repository at this point in the history
kt3k authored Jan 14, 2025
2 parents 715f401 + 3c1b8e9 commit 97a5c5b
Showing 34 changed files with 822 additions and 132 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -97,9 +97,6 @@ jobs:
with:
node-version: ${{ matrix.node }}

- run: npm install
working-directory: _tools/node_test_runner

- name: Run tests
run: deno task test:node

55 changes: 54 additions & 1 deletion Releases.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
### 2025.01.10

#### @std/cbor 0.1.5 (patch)

- perf(cbor): improve decodeCbor & decodeCborSequence performance (#6323)
- perf(cbor): encodeCbor & encodeCborSequence (#6311)

#### @std/cli 1.0.10 (patch)

- docs(cli): add examples of parseArgs (#6283)

#### @std/data-structures 1.0.6 (patch)

- fix(data-structures): ensure size consistency in RedBlackTree.from (#6307)

#### @std/datetime 0.225.3 (patch)

- fix(datetime): correct parsing of day period (#6313)
- docs(datetime): remove outdated mention of `utc` option (#6301)

#### @std/expect 1.0.11 (patch)

- fix(expect): consistent `toBeCloseTo` assertion messages (#6291)
- docs(expect,text): remove no-eval directives that appear to be unnecessary
(#6333)
- docs(expect): correct minor typo (#6329)
- docs(expect): clarify the tolerance in `toBeCloseTo` (#6292)

#### @std/fmt 1.0.4 (patch)

- fix(fmt): add correct pluralization to fmt/duration when using style: full
(#6295)
- refactor(fmt): cleanup duration `format()` and utils (#6309)
- test(fmt): add invalid duration `style` option test (#6310)

#### @std/fs 1.0.9 (patch)

- feat(fs/unstable): add statSync and lstatSync (#6300)
- test(fs): do not write files in source tree during test (#6236)

#### @std/log 0.224.13 (patch)

- test(log): re-enable doc tests for `FileHandler` (#6321)

#### @std/testing 1.0.9 (patch)

- docs(testing): clarify beforeAll in describe vs. outside (#6294)

#### @std/text 1.0.10 (patch)

- docs(expect,text): remove no-eval directives that appear to be unnecessary
(#6333)

### 2024.12.20

#### @std/fs 1.0.8 (patch)
@@ -115,7 +168,7 @@

### 2024.11.22

### @std/archive
#### @std/archive

- BREAKING(archive): remove std/archive package (#6185)

3 changes: 3 additions & 0 deletions _tools/check_docs.ts
Original file line number Diff line number Diff line change
@@ -62,6 +62,9 @@ const ENTRY_POINTS = [
"../front_matter/mod.ts",
"../front_matter/unstable_yaml.ts",
"../fs/mod.ts",
"../fs/unstable_lstat.ts",
"../fs/unstable_stat.ts",
"../fs/unstable_types.ts",
"../html/mod.ts",
"../html/unstable_is_valid_custom_element_name.ts",
"../http/mod.ts",
2 changes: 1 addition & 1 deletion _tools/check_mod_exports.ts
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ for await (
const { path: modFilePath } of walk(ROOT, {
includeDirs: true,
exts: ["ts"],
match: [/mod\.ts$/],
match: [/(\/|\\)mod\.ts$/],
maxDepth: 2,
})
) {
30 changes: 0 additions & 30 deletions _tools/node_test_runner/deno_compat_hooks.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright 2018-2025 the Deno authors. MIT license.

import { transform } from "sucrase";
import { readFile } from "node:fs/promises";
import * as path from "node:path";
import { pathToFileURL } from "node:url";
@@ -21,32 +20,3 @@ export async function resolve(specifier, context, nextResolve) {

return await nextResolve(specifier, context);
}

export async function load(specifier, context, nextLoad) {
const { format, source } = await nextLoad(specifier, context).catch(
async (error) => {
if (
error.code === "ERR_UNKNOWN_FILE_EXTENSION" &&
specifier.endsWith(".ts")
) {
return await nextLoad(specifier, {
...context,
format: "module",
});
} else {
throw error;
}
},
);

if (source && specifier.endsWith(".ts")) {
return {
format,
source: encoder.encode(
transform(decoder.decode(source), { transforms: ["typescript"] }).code,
),
};
}

return { format, source };
}
6 changes: 4 additions & 2 deletions _tools/node_test_runner/package.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,9 @@
"name": "node_test_runner",
"private": true,
"dependencies": {
"@deno/shim-deno-test": "^0.5.0",
"sucrase": "^3.35.0"
"@deno/shim-deno-test": "^0.5.0"
},
"engines": {
"node": ">=23.6.0"
}
}
2 changes: 1 addition & 1 deletion cbor/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@std/cbor",
"version": "0.1.4",
"version": "0.1.5",
"exports": {
".": "./mod.ts",
"./array-encoder-stream": "./array_encoder_stream.ts",
2 changes: 1 addition & 1 deletion cli/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@std/cli",
"version": "1.0.9",
"version": "1.0.10",
"exports": {
".": "./mod.ts",
"./parse-args": "./parse_args.ts",
34 changes: 32 additions & 2 deletions cli/prompt_secret.ts
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ const CR = "\r".charCodeAt(0); // ^M - Enter on macOS and Windows (CRLF)
const BS = "\b".charCodeAt(0); // ^H - Backspace on Linux and Windows
const DEL = 0x7f; // ^? - Backspace on macOS
const CLR = encoder.encode("\r\u001b[K"); // Clear the current line
const MOVE_LINE_UP = encoder.encode("\r\u001b[1F"); // Move to previous line

// The `cbreak` option is not supported on Windows
const setRawOptions = Deno.build.os === "windows"
@@ -52,12 +53,41 @@ export function promptSecret(
return null;
}

const { columns } = Deno.consoleSize();
let previousLength = 0;
// Make the output consistent with the built-in prompt()
message += " ";
const callback = !mask ? undefined : (n: number) => {
output.writeSync(CLR);
output.writeSync(encoder.encode(`${message}${mask.repeat(n)}`));
let line = `${message}${mask.repeat(n)}`;
const currentLength = line.length;
const charsPastLineLength = line.length % columns;

if (line.length > columns) {
line = line.slice(
-1 * (charsPastLineLength === 0 ? columns : charsPastLineLength),
);
}

// If the user has deleted a character
if (currentLength < previousLength) {
// Then clear the current line.
output.writeSync(CLR);
if (charsPastLineLength === 0) {
// And if there's no characters on the current line, return to previous line.
output.writeSync(MOVE_LINE_UP);
}
} else {
// Always jump the cursor back to the beginning of the line unless it's the first character.
if (charsPastLineLength !== 1) {
output.writeSync(CLR);
}
}

output.writeSync(encoder.encode(line));

previousLength = currentLength;
};

output.writeSync(encoder.encode(message));

Deno.stdin.setRaw(true, setRawOptions);
Loading

0 comments on commit 97a5c5b

Please sign in to comment.