Skip to content

Commit

Permalink
fixup! module: unflag import assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Sep 5, 2021
1 parent 74cbfed commit 239f3ed
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion lib/internal/process/esm_loader.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
'use strict';

const {
ObjectCreate,
} = primordials;

const {
ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING,
} = require('internal/errors').codes;
Expand Down Expand Up @@ -55,7 +59,8 @@ async function initializeLoader() {
emitExperimentalWarning('--experimental-loader');
return (async () => {
const hooks =
await ESMLoader.import(userLoader, pathToFileURL(cwd).href, ObjectCreate(null));
await ESMLoader.import(userLoader, pathToFileURL(cwd).href,
ObjectCreate(null));
ESMLoader = new Loader();
ESMLoader.hook(hooks);
ESMLoader.runGlobalPreloadCode();
Expand Down
8 changes: 4 additions & 4 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,9 @@ function REPLServer(prompt,
vm.createScript(fallbackCode, {
filename: file,
displayErrors: true,
importModuleDynamically: async (specifier, _, import_assertions) => {
importModuleDynamically: async (specifier, _, import_assert) => {
return asyncESM.ESMLoader.import(specifier, parentURL,
import_assertions);
import_assert);
}
});
} catch (fallbackError) {
Expand Down Expand Up @@ -497,9 +497,9 @@ function REPLServer(prompt,
script = vm.createScript(code, {
filename: file,
displayErrors: true,
importModuleDynamically: async (specifier, _, import_asssertions) => {
importModuleDynamically: async (specifier, _, import_assert) => {
return asyncESM.ESMLoader.import(specifier, parentURL,
import_asssertions);
import_assert);
}
});
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion test/message/esm_import_assertion_failing.out
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ TypeError [ERR_FAILED_IMPORT_ASSERTION]: Failed to load module "data:text/javasc
at new NodeError (node:internal/errors:*:*)
at Loader.getModuleJob (node:internal/modules/esm/loader:*:*)
at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:*:*)
at async Promise.all (index 0)
at async Promise.all (index 1)
at async link (node:internal/modules/esm/module_job:*:*) {
code: 'ERR_FAILED_IMPORT_ASSERTION'
}

0 comments on commit 239f3ed

Please sign in to comment.