Repository: karen-irc/option-t
Pull request #1127 (2021-10-18 09:10:58)

Use `node:` prefixed path to import Node.js' builtin modules
- Depend on https://github.com/karen-irc/option-t/pull/1126


Patch:
diff --git a/tools/cp_files.mjs b/tools/cp_files.mjs
index 5efb77ae..33b5a43d 100644
--- a/tools/cp_files.mjs
+++ b/tools/cp_files.mjs
@@ -1,5 +1,5 @@
-import fs from 'fs/promises';
-import path from 'path';
+import fs from 'node:fs/promises';
+import path from 'node:path';
 
 import { getAllGlobMatchedFiles } from './glob.mjs';
 import { parseArgs } from './parse_argv.mjs';
diff --git a/tools/extension_renamer.mjs b/tools/extension_renamer.mjs
index 8154b5a0..afb5ed05 100644
--- a/tools/extension_renamer.mjs
+++ b/tools/extension_renamer.mjs
@@ -1,7 +1,7 @@
-import * as assert from 'assert';
-import { promises as fs } from 'fs';
-import * as path from 'path';
-import { fileURLToPath } from 'url';
+import * as assert from 'node:assert/strict';
+import { promises as fs } from 'node:fs';
+import * as path from 'node:path';
+import { fileURLToPath } from 'node:url';
 
 const FROM_EXTENSION = 'js';
 const TO_EXTENSION = 'mjs';
diff --git a/tools/generate_import_path_list_markdown.mjs b/tools/generate_import_path_list_markdown.mjs
index 4a64720d..bc386bc4 100644
--- a/tools/generate_import_path_list_markdown.mjs
+++ b/tools/generate_import_path_list_markdown.mjs
@@ -1,7 +1,7 @@
-import * as assert from 'assert';
-import { promises as fs } from 'fs';
-import * as path from 'path';
-import { fileURLToPath } from 'url';
+import * as assert from 'node:assert/strict';
+import { promises as fs } from 'node:fs';
+import * as path from 'node:path';
+import { fileURLToPath } from 'node:url';
 
 import {
     generateExposedPathSequence,
diff --git a/tools/glob.mjs b/tools/glob.mjs
index ab46f6bd..76d2fa2e 100644
--- a/tools/glob.mjs
+++ b/tools/glob.mjs
@@ -1,5 +1,5 @@
-import * as fs from 'fs/promises';
-import * as path from 'path';
+import * as fs from 'node:fs/promises';
+import * as path from 'node:path';
 
 import picomatch from 'picomatch';
 
diff --git a/tools/package_json_rewriter/json.mjs b/tools/package_json_rewriter/json.mjs
index 5a7cd603..4f120712 100644
--- a/tools/package_json_rewriter/json.mjs
+++ b/tools/package_json_rewriter/json.mjs
@@ -1,5 +1,5 @@
-import { promises as fs } from 'fs';
-import * as path from 'path';
+import { promises as fs } from 'node:fs';
+import * as path from 'node:path';
 
 async function loadFileAsText(baseDir, filepath) {
     const p = path.resolve(baseDir, filepath);
diff --git a/tools/package_json_rewriter/main.mjs b/tools/package_json_rewriter/main.mjs
index 4859aebf..98980192 100644
--- a/tools/package_json_rewriter/main.mjs
+++ b/tools/package_json_rewriter/main.mjs
@@ -1,7 +1,7 @@
-import * as assert from 'assert';
-import { promises as fs } from 'fs';
-import * as path from 'path';
-import { fileURLToPath } from 'url';
+import * as assert from 'node:assert/strict';
+import { promises as fs } from 'node:fs';
+import * as path from 'node:path';
+import { fileURLToPath } from 'node:url';
 
 import { addExportsFields } from './transformer/add_exports_field/main.mjs';
 import { loadJSON } from './json.mjs';
diff --git a/tools/package_json_rewriter/transformer/add_exports_field/ExportEntry.mjs b/tools/package_json_rewriter/transformer/add_exports_field/ExportEntry.mjs
index 0b335aa4..a382d970 100644
--- a/tools/package_json_rewriter/transformer/add_exports_field/ExportEntry.mjs
+++ b/tools/package_json_rewriter/transformer/add_exports_field/ExportEntry.mjs
@@ -1,4 +1,4 @@
-import * as assert from 'assert';
+import * as assert from 'node:assert/strict';
 
 import {
     QuirksLegacyExposedPath
diff --git a/tools/package_json_rewriter/transformer/add_exports_field/compatibility.mjs b/tools/package_json_rewriter/transformer/add_exports_field/compatibility.mjs
index bc3fdb43..0521b2d0 100644
--- a/tools/package_json_rewriter/transformer/add_exports_field/compatibility.mjs
+++ b/tools/package_json_rewriter/transformer/add_exports_field/compatibility.mjs
@@ -1,4 +1,4 @@
-import * as assert from 'assert';
+import * as assert from 'node:assert/strict';
 
 import {
     CompatExportEntry,
diff --git a/tools/package_json_rewriter/transformer/add_exports_field/public_api.mjs b/tools/package_json_rewriter/transformer/add_exports_field/public_api.mjs
index c36a65cb..ad784113 100644
--- a/tools/package_json_rewriter/transformer/add_exports_field/public_api.mjs
+++ b/tools/package_json_rewriter/transformer/add_exports_field/public_api.mjs
@@ -1,4 +1,4 @@
-import * as assert from 'assert';
+import * as assert from 'node:assert/strict';
 
 import { ExportEntry } from './ExportEntry.mjs';
 
diff --git a/tools/parse_argv.mjs b/tools/parse_argv.mjs
index 01c8e80f..61261f7b 100644
--- a/tools/parse_argv.mjs
+++ b/tools/parse_argv.mjs
@@ -1,4 +1,4 @@
-import * as assert from 'assert';
+import * as assert from 'node:assert/strict';
 
 function isFlagKey(str) {
     return str.startsWith('--');


Test patch:
diff --git a/tools/test_esmodule_path_rewrite.mjs b/tools/test_esmodule_path_rewrite.mjs
index 74e61baf..7ee320a5 100644
--- a/tools/test_esmodule_path_rewrite.mjs
+++ b/tools/test_esmodule_path_rewrite.mjs
@@ -1,7 +1,7 @@
-import * as assert from 'assert';
-import { promises as fs } from 'fs';
-import * as path from 'path';
-import { fileURLToPath } from 'url';
+import * as assert from 'node:assert/strict';
+import { promises as fs } from 'node:fs';
+import * as path from 'node:path';
+import { fileURLToPath } from 'node:url';
 
 const THIS_FILENAME = fileURLToPath(import.meta.url);
 const THIS_DIRNAME = path.dirname(THIS_FILENAME);
diff --git a/tools/test_package_contains_expected_all.mjs b/tools/test_package_contains_expected_all.mjs
index cb954bb7..7da662aa 100644
--- a/tools/test_package_contains_expected_all.mjs
+++ b/tools/test_package_contains_expected_all.mjs
@@ -1,7 +1,7 @@
-import * as assert from 'assert';
-import { promises as fs } from 'fs';
-import * as path from 'path';
-import { fileURLToPath } from 'url';
+import * as assert from 'node:assert/strict';
+import { promises as fs } from 'node:fs';
+import * as path from 'node:path';
+import { fileURLToPath } from 'node:url';
 
 const THIS_FILENAME = fileURLToPath(import.meta.url);
 const THIS_DIRNAME = path.dirname(THIS_FILENAME);
diff --git a/tools/test_package_exports.mjs b/tools/test_package_exports.mjs
index 10f5b855..ebc10838 100644
--- a/tools/test_package_exports.mjs
+++ b/tools/test_package_exports.mjs
@@ -1,5 +1,5 @@
-import * as assert from 'assert';
-import { createRequire } from 'module';
+import * as assert from 'node:assert/strict';
+import { createRequire } from 'node:module';
 
 import {
     generateAllExposedPathSequence,