Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: use node:moduleName as builtin module filename #35498

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! src: use node:moduleName as builtin module filename
  • Loading branch information
targos committed Oct 6, 2020
commit 50815b8ca40561ce1ef5fab7f1a565f7605c77c3
6 changes: 4 additions & 2 deletions lib/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const {
NumberIsNaN,
RegExpPrototypeTest,
String,
StringPrototypeSlice,
StringPrototypeStartsWith,
} = primordials;

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

// Skip Node.js modules!
if (filename.startsWith('node:') &&
NativeModule.exists(filename.slice(5))) {
if (StringPrototypeStartsWith(filename, 'node:') &&
NativeModule.exists(StringPrototypeSlice(filename, 5))) {
errorCache.set(identifier, undefined);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/util/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ const strEscapeSequencesReplacerSingle = /[\x00-\x1f\x5c\x7f-\x9f]/g;
const keyStrRegExp = /^[a-zA-Z_][a-zA-Z_0-9]*$/;
const numberRegExp = /^(0|[1-9][0-9]*)$/;

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

const classRegExp = /^(\s+[^(]*?)\s*{/;
Expand Down