From d6e832692c33688ab379f056a4a3a596f8701894 Mon Sep 17 00:00:00 2001 From: Bradley Farias Date: Wed, 2 Mar 2022 15:06:32 -0600 Subject: [PATCH] fixup: apply code review changes --- lib/internal/modules/cjs/loader.js | 6 +++--- lib/internal/modules/esm/initialize_import_meta.js | 2 +- lib/internal/modules/esm/loader.js | 4 ++-- lib/internal/modules/esm/module_job.js | 2 +- lib/internal/modules/esm/translators.js | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 841f0ad3b580da..9e4229af9faaf8 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -1015,10 +1015,10 @@ function wrapSafe(filename, content, cjsModuleInstance) { filename, lineOffset: 0, displayErrors: true, - importModuleDynamically: (specifier, _, importAssertions) => { + importModuleDynamically: async (specifier, _, importAssertions) => { const loader = asyncESM.esmLoader; return loader.import(specifier, - loader.baseURL(normalizeReferrerURL(filename)), + loader.getBaseURL(normalizeReferrerURL(filename)), importAssertions); }, }); @@ -1035,7 +1035,7 @@ function wrapSafe(filename, content, cjsModuleInstance) { importModuleDynamically(specifier, _, importAssertions) { const loader = asyncESM.esmLoader; return loader.import(specifier, - loader.baseURL(normalizeReferrerURL(filename)), + loader.getBaseURL(normalizeReferrerURL(filename)), importAssertions); }, }); diff --git a/lib/internal/modules/esm/initialize_import_meta.js b/lib/internal/modules/esm/initialize_import_meta.js index f9a2c0570244bb..f1daabbb6425aa 100644 --- a/lib/internal/modules/esm/initialize_import_meta.js +++ b/lib/internal/modules/esm/initialize_import_meta.js @@ -33,7 +33,7 @@ function initializeImportMeta(meta, context) { meta.resolve = createImportMetaResolve(url); } - url = asyncESM.esmLoader.baseURL(url); + url = asyncESM.esmLoader.getBaseURL(url); meta.url = url; } diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js index b5d28b5d57780e..16b832527f7c64 100644 --- a/lib/internal/modules/esm/loader.js +++ b/lib/internal/modules/esm/loader.js @@ -215,7 +215,7 @@ class ESMLoader { callbackMap.set(module, { importModuleDynamically: (specifier, { url }, importAssertions) => { return this.import(specifier, - this.baseURL(url), + this.getBaseURL(url), importAssertions); } }); @@ -252,7 +252,7 @@ class ESMLoader { * @param {string} url * @returns {string} */ - baseURL(url) { + getBaseURL(url) { if ( StringPrototypeStartsWith(url, 'http:') || StringPrototypeStartsWith(url, 'https:') diff --git a/lib/internal/modules/esm/module_job.js b/lib/internal/modules/esm/module_job.js index 524272664e2a0d..e012eebc4ac971 100644 --- a/lib/internal/modules/esm/module_job.js +++ b/lib/internal/modules/esm/module_job.js @@ -76,7 +76,7 @@ class ModuleJob { // these `link` callbacks depending on each other. const dependencyJobs = []; const promises = this.module.link(async (specifier, assertions) => { - const baseURL = this.loader.baseURL(url); + const baseURL = this.loader.getBaseURL(url); const jobPromise = this.loader.getModuleJob(specifier, baseURL, assertions); ArrayPrototypePush(dependencyJobs, jobPromise); const job = await jobPromise; diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index 93fd1dbb57874b..d7f4c7edec63d3 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -104,7 +104,7 @@ function errPath(url) { async function importModuleDynamically(specifier, { url }, assertions) { return asyncESM.esmLoader.import(specifier, - asyncESM.esmLoader.baseURL(url), + asyncESM.esmLoader.getBaseURL(url), assertions); }