From f5661b004ec1db98e5489701f5e1f39b39a87d9e Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 2 Aug 2023 22:27:39 +0200 Subject: [PATCH] esm: fix typo `parentUrl` -> `parentURL` PR-URL: https://github.com/nodejs/node/pull/48999 Reviewed-By: Jacob Smith Reviewed-By: Geoffrey Booth Reviewed-By: Chemi Atlow --- lib/internal/modules/esm/initialize_import_meta.js | 10 +++++----- lib/internal/modules/esm/loader.js | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/internal/modules/esm/initialize_import_meta.js b/lib/internal/modules/esm/initialize_import_meta.js index 631231dd9ba7d5..010f4d1a858690 100644 --- a/lib/internal/modules/esm/initialize_import_meta.js +++ b/lib/internal/modules/esm/initialize_import_meta.js @@ -5,16 +5,16 @@ const experimentalImportMetaResolve = getOptionValue('--experimental-import-meta /** * Generate a function to be used as import.meta.resolve for a particular module. - * @param {string} defaultParentUrl The default base to use for resolution + * @param {string} defaultParentURL The default base to use for resolution * @param {typeof import('./loader.js').ModuleLoader} loader Reference to the current module loader - * @returns {(specifier: string, parentUrl?: string) => string} Function to assign to import.meta.resolve + * @returns {(specifier: string, parentURL?: string) => string} Function to assign to import.meta.resolve */ -function createImportMetaResolve(defaultParentUrl, loader) { - return function resolve(specifier, parentUrl = defaultParentUrl) { +function createImportMetaResolve(defaultParentURL, loader) { + return function resolve(specifier, parentURL = defaultParentURL) { let url; try { - ({ url } = loader.resolveSync(specifier, parentUrl)); + ({ url } = loader.resolveSync(specifier, parentURL)); } catch (error) { if (error?.code === 'ERR_UNSUPPORTED_DIR_IMPORT') { ({ url } = error); diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js index 794b3c5999d8d1..cae0bb93a58669 100644 --- a/lib/internal/modules/esm/loader.js +++ b/lib/internal/modules/esm/loader.js @@ -164,7 +164,7 @@ class ModuleLoader { * string, parentURL: string, * importAssertions: Record * ) ResolveResult; - * register(specifier: string, parentUrl: string): any; + * register(specifier: string, parentURL: string): any; * forceLoadHooks(): void; * } * ``` @@ -318,7 +318,7 @@ class ModuleLoader { return module.getNamespace(); } - register(specifier, parentUrl) { + register(specifier, parentURL) { if (!this.#customizations) { // `CustomizedModuleLoader` is defined at the bottom of this file and // available well before this line is ever invoked. This is here in @@ -326,7 +326,7 @@ class ModuleLoader { // eslint-disable-next-line no-use-before-define this.setCustomizations(new CustomizedModuleLoader()); } - return this.#customizations.register(specifier, parentUrl); + return this.#customizations.register(specifier, parentURL); } /**