Skip to content

Commit

Permalink
Use the node: URL scheme for Node.js builtin module imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydenseric committed Aug 18, 2022
1 parent 8878a8d commit d814ac3
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion CliError.test.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check

import { strictEqual, throws } from "assert";
import { strictEqual, throws } from "node:assert";

import CliError from "./CliError.mjs";

Expand Down
6 changes: 3 additions & 3 deletions analyseCoverage.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @ts-check

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

import sourceRange from "./sourceRange.mjs";

Expand Down
8 changes: 4 additions & 4 deletions analyseCoverage.test.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// @ts-check

import { deepStrictEqual, rejects } from "assert";
import { spawn } from "child_process";
import disposableDirectory from "disposable-directory";
import { mkdir, writeFile } from "fs/promises";
import { join } from "path";
import { deepStrictEqual, rejects } from "node:assert";
import { spawn } from "node:child_process";
import { mkdir, writeFile } from "node:fs/promises";
import { join } from "node:path";

import analyseCoverage from "./analyseCoverage.mjs";
import childProcessPromise from "./childProcessPromise.mjs";
Expand Down
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

### Major

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

### Patch

Expand Down
2 changes: 1 addition & 1 deletion childProcessPromise.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check

import { ChildProcess } from "child_process";
import { ChildProcess } from "node:child_process";

/**
* Promisifies a Node.js child process.
Expand Down
2 changes: 1 addition & 1 deletion childProcessPromise.test.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check

import { rejects } from "assert";
import { rejects } from "node:assert";

import childProcessPromise from "./childProcessPromise.mjs";

Expand Down
2 changes: 1 addition & 1 deletion coverage-node.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env node
// @ts-check

import { spawn } from "child_process";
import disposableDirectory from "disposable-directory";
import { spawn } from "node:child_process";

import analyseCoverage from "./analyseCoverage.mjs";
import childProcessPromise from "./childProcessPromise.mjs";
Expand Down
12 changes: 6 additions & 6 deletions coverage-node.test.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// @ts-check

import { strictEqual } from "assert";
import { spawnSync } from "child_process";
import disposableDirectory from "disposable-directory";
import { writeFile } from "fs/promises";
import { join, relative } from "path";
import { strictEqual } from "node:assert";
import { spawnSync } from "node:child_process";
import { writeFile } from "node:fs/promises";
import { join, relative } from "node:path";
import { fileURLToPath } from "node:url";
import replaceStackTraces from "replace-stack-traces";
import snapshot from "snapshot-assertion";
import { fileURLToPath } from "url";

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

await writeFile(
filePath,
`import { deprecate } from "util";
`import { deprecate } from "node:util";
const deprecated = deprecate(() => {}, "Deprecated!");
deprecated();
Expand Down
2 changes: 1 addition & 1 deletion errorConsole.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check

import { Console } from "console";
import { Console } from "node:console";

/**
* The `console` API, but all output is to `stderr`. This allows `console.group`
Expand Down
2 changes: 1 addition & 1 deletion reportCliError.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check

import { bold, red } from "kleur/colors";
import { inspect } from "util";
import { inspect } from "node:util";

import CliError from "./CliError.mjs";
import errorConsole from "./errorConsole.mjs";
Expand Down
10 changes: 5 additions & 5 deletions reportCliError.test.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// @ts-check

import { strictEqual, throws } from "assert";
import { spawnSync } from "child_process";
import disposableDirectory from "disposable-directory";
import { writeFile } from "fs/promises";
import { join } from "path";
import { strictEqual, throws } from "node:assert";
import { spawnSync } from "node:child_process";
import { writeFile } from "node:fs/promises";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
import replaceStackTraces from "replace-stack-traces";
import snapshot from "snapshot-assertion";
import { fileURLToPath } from "url";

import reportCliError from "./reportCliError.mjs";

Expand Down
2 changes: 1 addition & 1 deletion reportCoverage.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check

import { bold, green, red, yellow } from "kleur/colors";
import { relative } from "path";
import { relative } from "node:path";

import errorConsole from "./errorConsole.mjs";

Expand Down
2 changes: 1 addition & 1 deletion sourceRange.test.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check

import { deepStrictEqual, throws } from "assert";
import { deepStrictEqual, throws } from "node:assert";

import sourceRange from "./sourceRange.mjs";

Expand Down

0 comments on commit d814ac3

Please sign in to comment.