Skip to content

Commit

Permalink
fixup: apply code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bmeck committed Mar 2, 2022
1 parent e0da1a3 commit d6e8326
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
});
Expand All @@ -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);
},
});
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/modules/esm/initialize_import_meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/modules/esm/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class ESMLoader {
callbackMap.set(module, {
importModuleDynamically: (specifier, { url }, importAssertions) => {
return this.import(specifier,
this.baseURL(url),
this.getBaseURL(url),
importAssertions);
}
});
Expand Down Expand Up @@ -252,7 +252,7 @@ class ESMLoader {
* @param {string} url
* @returns {string}
*/
baseURL(url) {
getBaseURL(url) {
if (
StringPrototypeStartsWith(url, 'http:') ||
StringPrototypeStartsWith(url, 'https:')
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/modules/esm/module_job.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/modules/esm/translators.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit d6e8326

Please sign in to comment.