Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2178227

Browse filesBrowse files
committed
src: use node:moduleName as builtin module filename
This change allows for easier recognition of builtin modules in stack traces. Refs: #11893 PR-URL: #35498 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com>
1 parent 19f1451 commit 2178227
Copy full SHA for 2178227

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

47 files changed

+306
-304
lines changed
Open diff view settings
Collapse file

‎lib/assert.js‎

Copy file name to clipboardExpand all lines: lib/assert.js
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ const {
3030
NumberIsNaN,
3131
RegExpPrototypeTest,
3232
String,
33+
StringPrototypeSlice,
34+
StringPrototypeStartsWith,
3335
} = primordials;
3436

3537
const { Buffer } = require('buffer');
@@ -289,8 +291,8 @@ function getErrMessage(message, fn) {
289291
identifier = `${filename}${line}${column}`;
290292

291293
// Skip Node.js modules!
292-
if (filename.endsWith('.js') &&
293-
NativeModule.exists(filename.slice(0, -3))) {
294+
if (StringPrototypeStartsWith(filename, 'node:') &&
295+
NativeModule.exists(StringPrototypeSlice(filename, 5))) {
294296
errorCache.set(identifier, undefined);
295297
return;
296298
}
Collapse file

‎lib/internal/util/inspect.js‎

Copy file name to clipboardExpand all lines: lib/internal/util/inspect.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ const strEscapeSequencesReplacerSingle = /[\x00-\x1f\x5c\x7f-\x9f]/g;
183183
const keyStrRegExp = /^[a-zA-Z_][a-zA-Z_0-9]*$/;
184184
const numberRegExp = /^(0|[1-9][0-9]*)$/;
185185

186-
const coreModuleRegExp = /^ at (?:[^/\\(]+ \(|)((?<![/\\]).+)\.js:\d+:\d+\)?$/;
186+
const coreModuleRegExp = /^ at (?:[^/\\(]+ \(|)node:(.+):\d+:\d+\)?$/;
187187
const nodeModulesRegExp = /[/\\]node_modules[/\\](.+?)(?=[/\\])/g;
188188

189189
const classRegExp = /^(\s+[^(]*?)\s*{/;
Collapse file

‎src/node_native_module.cc‎

Copy file name to clipboardExpand all lines: src/node_native_module.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ MaybeLocal<Function> NativeModuleLoader::LookupAndCompile(
260260
return {};
261261
}
262262

263-
std::string filename_s = id + std::string(".js");
263+
std::string filename_s = std::string("node:") + id;
264264
Local<String> filename =
265265
OneByteString(isolate, filename_s.c_str(), filename_s.size());
266266
Local<Integer> line_offset = Integer::New(isolate, 0);
Collapse file

‎test/message/assert_throws_stack.out‎

Copy file name to clipboardExpand all lines: test/message/assert_throws_stack.out
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
assert.js:*
1+
node:assert:*
22
throw err;
33
^
44

@@ -20,8 +20,8 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
2020
code: 'ERR_ASSERTION',
2121
actual: Error: foo
2222
at assert.throws.bar (*assert_throws_stack.js:*)
23-
at getActual (assert.js:*)
24-
at Function.throws (assert.js:*)
23+
at getActual (node:assert:*)
24+
at Function.throws (node:assert:*)
2525
at Object.<anonymous> (*assert_throws_stack.js:*:*)
2626
at *
2727
at *
Collapse file
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Error: test
22
at one (*fixtures*async-error.js:4:9)
33
at two (*fixtures*async-error.js:17:9)
4-
at processTicksAndRejections (internal/process/task_queues.js:*:*)
4+
at processTicksAndRejections (node:internal/process/task_queues:*:*)
55
at async three (*fixtures*async-error.js:20:3)
66
at async four (*fixtures*async-error.js:24:3)
77
at async main (*message*async_error_nexttick_main.js:7:5)
Collapse file

‎test/message/core_line_numbers.out‎

Copy file name to clipboard
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
punycode.js:42
1+
node:punycode:42
22
throw new RangeError(errors[type]);
33
^
44

55
RangeError: Invalid input
6-
at error (punycode.js:42:8)
7-
at Object.decode (punycode.js:*:*)
6+
at error (node:punycode:42:8)
7+
at Object.decode (node:punycode:*:*)
88
at Object.<anonymous> (*test*message*core_line_numbers.js:*:*)
9-
at Module._compile (internal/modules/cjs/loader.js:*:*)
10-
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
11-
at Module.load (internal/modules/cjs/loader.js:*:*)
12-
at Function.Module._load (internal/modules/cjs/loader.js:*:*)
13-
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:*:*)
14-
at internal/main/run_main_module.js:*:*
9+
at Module._compile (node:internal/modules/cjs/loader:*:*)
10+
at Object.Module._extensions..js (node:internal/modules/cjs/loader:*:*)
11+
at Module.load (node:internal/modules/cjs/loader:*:*)
12+
at Function.Module._load (node:internal/modules/cjs/loader:*:*)
13+
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
14+
at node:internal/main/run_main_module:*:*
Collapse file

‎test/message/error_exit.out‎

Copy file name to clipboardExpand all lines: test/message/error_exit.out
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Exiting with code=1
2-
assert.js:*
2+
node:assert:*
33
throw new AssertionError(obj);
44
^
55

@@ -8,12 +8,12 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
88
1 !== 2
99

1010
at Object.<anonymous> (*test*message*error_exit.js:*:*)
11-
at Module._compile (internal/modules/cjs/loader.js:*:*)
12-
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
13-
at Module.load (internal/modules/cjs/loader.js:*:*)
14-
at Function.Module._load (internal/modules/cjs/loader.js:*:*)
15-
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:*:*)
16-
at internal/main/run_main_module.js:*:* {
11+
at Module._compile (node:internal/modules/cjs/loader:*:*)
12+
at Object.Module._extensions..js (node:internal/modules/cjs/loader:*:*)
13+
at Module.load (node:internal/modules/cjs/loader:*:*)
14+
at Function.Module._load (node:internal/modules/cjs/loader:*:*)
15+
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
16+
at node:internal/main/run_main_module:*:* {
1717
generatedMessage: true,
1818
code: 'ERR_ASSERTION',
1919
actual: 1,
Collapse file

‎test/message/error_with_nul.out‎

Copy file name to clipboard
12 Bytes
Binary file not shown.
Collapse file

‎test/message/esm_display_syntax_error.out‎

Copy file name to clipboardExpand all lines: test/message/esm_display_syntax_error.out
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ await async () => 0;
33
^^^^^
44

55
SyntaxError: Unexpected reserved word
6-
at Loader.moduleStrategy (internal/modules/esm/translators.js:*:*)
7-
at async link (internal/modules/esm/module_job.js:*:*)
6+
at Loader.moduleStrategy (node:internal/modules/esm/translators:*:*)
7+
at async link (node:internal/modules/esm/module_job:*:*)
Collapse file

‎test/message/esm_display_syntax_error_import.out‎

Copy file name to clipboardExpand all lines: test/message/esm_display_syntax_error_import.out
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ file:///*/test/message/esm_display_syntax_error_import.mjs:5
22
notfound
33
^^^^^^^^
44
SyntaxError: The requested module '../fixtures/es-module-loaders/module-named-exports.mjs' does not provide an export named 'notfound'
5-
at ModuleJob._instantiate (internal/modules/esm/module_job.js:*:*)
6-
at async ModuleJob.run (internal/modules/esm/module_job.js:*:*)
7-
at async Loader.import (internal/modules/esm/loader.js:*:*)
8-
at async Object.loadESM (internal/process/esm_loader.js:*:*)
5+
at ModuleJob._instantiate (node:internal/modules/esm/module_job:*:*)
6+
at async ModuleJob.run (node:internal/modules/esm/module_job:*:*)
7+
at async Loader.import (node:internal/modules/esm/loader:*:*)
8+
at async Object.loadESM (node:internal/process/esm_loader:*:*)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.