Skip to content

Commit d814ac3

Browse files
committed
Use the node: URL scheme for Node.js builtin module imports.
1 parent 8878a8d commit d814ac3

13 files changed

+28
-27
lines changed

CliError.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @ts-check
22

3-
import { strictEqual, throws } from "assert";
3+
import { strictEqual, throws } from "node:assert";
44

55
import CliError from "./CliError.mjs";
66

analyseCoverage.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// @ts-check
22

33
import v8Coverage from "@bcoe/v8-coverage";
4-
import { readdir, readFile } from "fs/promises";
5-
import { join } from "path";
6-
import { fileURLToPath } from "url";
4+
import { readdir, readFile } from "node:fs/promises";
5+
import { join } from "node:path";
6+
import { fileURLToPath } from "node:url";
77

88
import sourceRange from "./sourceRange.mjs";
99

analyseCoverage.test.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// @ts-check
22

3-
import { deepStrictEqual, rejects } from "assert";
4-
import { spawn } from "child_process";
53
import disposableDirectory from "disposable-directory";
6-
import { mkdir, writeFile } from "fs/promises";
7-
import { join } from "path";
4+
import { deepStrictEqual, rejects } from "node:assert";
5+
import { spawn } from "node:child_process";
6+
import { mkdir, writeFile } from "node:fs/promises";
7+
import { join } from "node:path";
88

99
import analyseCoverage from "./analyseCoverage.mjs";
1010
import childProcessPromise from "./childProcessPromise.mjs";

changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
### Major
66

7-
- Migrated from the Node.js builtin module `fs` to `fs/promises`.
7+
- Use the `node:` URL scheme for Node.js builtin module imports.
8+
- Migrated from the Node.js builtin module `fs` to `node:fs/promises`.
89

910
### Patch
1011

childProcessPromise.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @ts-check
22

3-
import { ChildProcess } from "child_process";
3+
import { ChildProcess } from "node:child_process";
44

55
/**
66
* Promisifies a Node.js child process.

childProcessPromise.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @ts-check
22

3-
import { rejects } from "assert";
3+
import { rejects } from "node:assert";
44

55
import childProcessPromise from "./childProcessPromise.mjs";
66

coverage-node.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env node
22
// @ts-check
33

4-
import { spawn } from "child_process";
54
import disposableDirectory from "disposable-directory";
5+
import { spawn } from "node:child_process";
66

77
import analyseCoverage from "./analyseCoverage.mjs";
88
import childProcessPromise from "./childProcessPromise.mjs";

coverage-node.test.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// @ts-check
22

3-
import { strictEqual } from "assert";
4-
import { spawnSync } from "child_process";
53
import disposableDirectory from "disposable-directory";
6-
import { writeFile } from "fs/promises";
7-
import { join, relative } from "path";
4+
import { strictEqual } from "node:assert";
5+
import { spawnSync } from "node:child_process";
6+
import { writeFile } from "node:fs/promises";
7+
import { join, relative } from "node:path";
8+
import { fileURLToPath } from "node:url";
89
import replaceStackTraces from "replace-stack-traces";
910
import snapshot from "snapshot-assertion";
10-
import { fileURLToPath } from "url";
1111

1212
const COVERAGE_NODE_CLI_PATH = fileURLToPath(
1313
new URL("./coverage-node.mjs", import.meta.url)
@@ -333,7 +333,7 @@ import "${fileFPath}";
333333

334334
await writeFile(
335335
filePath,
336-
`import { deprecate } from "util";
336+
`import { deprecate } from "node:util";
337337
338338
const deprecated = deprecate(() => {}, "Deprecated!");
339339
deprecated();

errorConsole.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @ts-check
22

3-
import { Console } from "console";
3+
import { Console } from "node:console";
44

55
/**
66
* The `console` API, but all output is to `stderr`. This allows `console.group`

reportCliError.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @ts-check
22

33
import { bold, red } from "kleur/colors";
4-
import { inspect } from "util";
4+
import { inspect } from "node:util";
55

66
import CliError from "./CliError.mjs";
77
import errorConsole from "./errorConsole.mjs";

reportCliError.test.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// @ts-check
22

3-
import { strictEqual, throws } from "assert";
4-
import { spawnSync } from "child_process";
53
import disposableDirectory from "disposable-directory";
6-
import { writeFile } from "fs/promises";
7-
import { join } from "path";
4+
import { strictEqual, throws } from "node:assert";
5+
import { spawnSync } from "node:child_process";
6+
import { writeFile } from "node:fs/promises";
7+
import { join } from "node:path";
8+
import { fileURLToPath } from "node:url";
89
import replaceStackTraces from "replace-stack-traces";
910
import snapshot from "snapshot-assertion";
10-
import { fileURLToPath } from "url";
1111

1212
import reportCliError from "./reportCliError.mjs";
1313

reportCoverage.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @ts-check
22

33
import { bold, green, red, yellow } from "kleur/colors";
4-
import { relative } from "path";
4+
import { relative } from "node:path";
55

66
import errorConsole from "./errorConsole.mjs";
77

sourceRange.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @ts-check
22

3-
import { deepStrictEqual, throws } from "assert";
3+
import { deepStrictEqual, throws } from "node:assert";
44

55
import sourceRange from "./sourceRange.mjs";
66

0 commit comments

Comments
 (0)