| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 606df7c commit ee9e3e7
10 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1003,7 +1003,7 @@ The resolver can throw the following errors: | |||
| 1003 | 1003 | > 1. If _selfUrl_ is not **undefined**, return _selfUrl_. | |
| 1004 | 1004 | > 1. If _packageSubpath_ is _"."_ and _packageName_ is a Node.js builtin | |
| 1005 | 1005 | > module, then | |
| 1006 | - > 1. Return the string _"nodejs:"_ concatenated with _packageSpecifier_. | ||
| 1006 | + > 1. Return the string _"node:"_ concatenated with _packageSpecifier_. | ||
| 1007 | 1007 | > 1. While _parentURL_ is not the file system root, | |
| 1008 | 1008 | > 1. Let _packageURL_ be the URL resolution of _"node_modules/"_ | |
| 1009 | 1009 | > concatenated with _packageSpecifier_, relative to _parentURL_. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,7 +34,7 @@ if (experimentalJsonModules) | |||
| 34 | 34 | extensionFormatMap['.json'] = legacyExtensionFormatMap['.json'] = 'json'; | |
| 35 | 35 | ||
| 36 | 36 | function defaultGetFormat(url, context, defaultGetFormatUnused) { | |
| 37 | - if (StringPrototypeStartsWith(url, 'nodejs:')) { | ||
| 37 | + if (StringPrototypeStartsWith(url, 'node:')) { | ||
| 38 | 38 | return { format: 'builtin' }; | |
| 39 | 39 | } | |
| 40 | 40 | const parsed = new URL(url); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -776,13 +776,13 @@ function defaultResolve(specifier, context = {}, defaultResolveUnused) { | |||
| 776 | 776 | }; | |
| 777 | 777 | } | |
| 778 | 778 | } catch {} | |
| 779 | - if (parsed && parsed.protocol === 'nodejs:') | ||
| 779 | + if (parsed && parsed.protocol === 'node:') | ||
| 780 | 780 | return { url: specifier }; | |
| 781 | 781 | if (parsed && parsed.protocol !== 'file:' && parsed.protocol !== 'data:') | |
| 782 | 782 | throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed); | |
| 783 | 783 | if (NativeModule.canBeRequiredByUsers(specifier)) { | |
| 784 | 784 | return { | |
| 785 | - url: 'nodejs:' + specifier | ||
| 785 | + url: 'node:' + specifier | ||
| 786 | 786 | }; | |
| 787 | 787 | } | |
| 788 | 788 | if (parentURL && StringPrototypeStartsWith(parentURL, 'data:')) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -223,11 +223,11 @@ function cjsPreparseModuleExports(filename) { | |||
| 223 | 223 | // through normal resolution | |
| 224 | 224 | translators.set('builtin', async function builtinStrategy(url) { | |
| 225 | 225 | debug(`Translating BuiltinModule ${url}`); | |
| 226 | - // Slice 'nodejs:' scheme | ||
| 227 | - const id = url.slice(7); | ||
| 226 | + // Slice 'node:' scheme | ||
| 227 | + const id = url.slice(5); | ||
| 228 | 228 | const module = loadNativeModule(id, url, true); | |
| 229 | - if (!url.startsWith('nodejs:') || !module) { | ||
| 230 | - throw new ERR_UNKNOWN_BUILTIN_MODULE(id); | ||
| 229 | + if (!url.startsWith('node:') || !module) { | ||
| 230 | + throw new ERR_UNKNOWN_BUILTIN_MODULE(url); | ||
| 231 | 231 | } | |
| 232 | 232 | debug(`Loading BuiltinModule ${url}`); | |
| 233 | 233 | return module.getESMFacade(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,9 +48,9 @@ function expectFsNamespace(result) { | |||
| 48 | 48 | expectFsNamespace(import('fs')); | |
| 49 | 49 | expectFsNamespace(eval('import("fs")')); | |
| 50 | 50 | expectFsNamespace(eval('import("fs")')); | |
| 51 | - expectFsNamespace(import('nodejs:fs')); | ||
| 51 | + expectFsNamespace(import('node:fs')); | ||
| 52 | 52 | ||
| 53 | - expectModuleError(import('nodejs:unknown'), | ||
| 53 | + expectModuleError(import('node:unknown'), | ||
| 54 | 54 | 'ERR_UNKNOWN_BUILTIN_MODULE'); | |
| 55 | 55 | expectModuleError(import('./not-an-existing-module.mjs'), | |
| 56 | 56 | 'ERR_MODULE_NOT_FOUND'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ export function getGlobalPreloadCode() { | |||
| 15 | 15 | ||
| 16 | 16 | export function resolve(specifier, context, defaultResolve) { | |
| 17 | 17 | const def = defaultResolve(specifier, context); | |
| 18 | - if (def.url.startsWith('nodejs:')) { | ||
| 18 | + if (def.url.startsWith('node:')) { | ||
| 19 | 19 | return { | |
| 20 | 20 | url: `custom-${def.url}`, | |
| 21 | 21 | }; | |
@@ -24,7 +24,7 @@ export function resolve(specifier, context, defaultResolve) { | |||
| 24 | 24 | } | |
| 25 | 25 | ||
| 26 | 26 | export function getSource(url, context, defaultGetSource) { | |
| 27 | - if (url.startsWith('custom-nodejs:')) { | ||
| 27 | + if (url.startsWith('custom-node:')) { | ||
| 28 | 28 | const urlObj = new URL(url); | |
| 29 | 29 | return { | |
| 30 | 30 | source: generateBuiltinModule(urlObj.pathname), | |
@@ -35,7 +35,7 @@ export function getSource(url, context, defaultGetSource) { | |||
| 35 | 35 | } | |
| 36 | 36 | ||
| 37 | 37 | export function getFormat(url, context, defaultGetFormat) { | |
| 38 | - if (url.startsWith('custom-nodejs:')) { | ||
| 38 | + if (url.startsWith('custom-node:')) { | ||
| 39 | 39 | return { format: 'module' }; | |
| 40 | 40 | } | |
| 41 | 41 | return defaultGetFormat(url, context, defaultGetFormat); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ baseURL.pathname = process.cwd() + '/'; | |||
| 11 | 11 | export function resolve(specifier, { parentURL = baseURL }, defaultResolve) { | |
| 12 | 12 | if (builtinModules.includes(specifier)) { | |
| 13 | 13 | return { | |
| 14 | - url: 'nodejs:' + specifier | ||
| 14 | + url: 'node:' + specifier | ||
| 15 | 15 | }; | |
| 16 | 16 | } | |
| 17 | 17 | if (/^\.{1,2}[/]/.test(specifier) !== true && !specifier.startsWith('file:')) { | |
@@ -27,7 +27,7 @@ export function resolve(specifier, { parentURL = baseURL }, defaultResolve) { | |||
| 27 | 27 | } | |
| 28 | 28 | ||
| 29 | 29 | export function getFormat(url, context, defaultGetFormat) { | |
| 30 | - if (url.startsWith('nodejs:') && builtinModules.includes(url.slice(7))) { | ||
| 30 | + if (url.startsWith('node:') && builtinModules.includes(url.slice(5))) { | ||
| 31 | 31 | return { | |
| 32 | 32 | format: 'builtin' | |
| 33 | 33 | }; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,14 +1,14 @@ | |||
| 1 | 1 | export async function resolve(specifier, { parentURL }, defaultResolve) { | |
| 2 | 2 | if (specifier === 'unknown-builtin-module') { | |
| 3 | 3 | return { | |
| 4 | - url: 'nodejs:unknown-builtin-module' | ||
| 4 | + url: 'node:unknown-builtin-module' | ||
| 5 | 5 | }; | |
| 6 | 6 | } | |
| 7 | 7 | return defaultResolve(specifier, {parentURL}, defaultResolve); | |
| 8 | 8 | } | |
| 9 | 9 | ||
| 10 | 10 | export async function getFormat(url, context, defaultGetFormat) { | |
| 11 | - if (url === 'nodejs:unknown-builtin-module') { | ||
| 11 | + if (url === 'node:unknown-builtin-module') { | ||
| 12 | 12 | return { | |
| 13 | 13 | format: 'builtin' | |
| 14 | 14 | }; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,7 +14,7 @@ export async function resolve(specifier, { parentURL }, defaultResolve) { | |||
| 14 | 14 | catch (e) { | |
| 15 | 15 | assert.strictEqual(e.code, 'ERR_MODULE_NOT_FOUND'); | |
| 16 | 16 | return { | |
| 17 | - url: 'nodejs:fs' | ||
| 17 | + url: 'node:fs' | ||
| 18 | 18 | }; | |
| 19 | 19 | } | |
| 20 | 20 | assert.fail(`Module resolution for ${specifier} should be throw ERR_MODULE_NOT_FOUND`); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,7 @@ | |||
| 2 | 2 | import { expectsError, mustCall } from '../common/index.mjs'; | |
| 3 | 3 | import assert from 'assert'; | |
| 4 | 4 | ||
| 5 | - const unknownBuiltinModule = 'unknown-builtin-module'; | ||
| 5 | + const unknownBuiltinModule = 'node:unknown-builtin-module'; | ||
| 6 | 6 | ||
| 7 | 7 | import(unknownBuiltinModule) | |
| 8 | 8 | .then(assert.fail, expectsError({ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments