File tree Expand file tree Collapse file tree 6 files changed +14
-9
lines changed Expand file tree Collapse file tree 6 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -815,11 +815,11 @@ normally.
815815
816816` ` ` js
817817/**
818- * This example causes
818+ * This example causes
819819 * @param {object} utilities
820820 * @param {MessagePort} utilities.port
821821 */
822- export function getGlobalPreloadCode ({port}) {
822+ export function getGlobalPreloadCode ({ port }) {
823823 port .onmessage = (evt ) => {
824824 // ...
825825 };
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
13const { getOptionValue } = require ( 'internal/options' ) ;
24const experimentalImportMetaResolve =
35getOptionValue ( '--experimental-import-meta-resolve' ) ;
6+ const { PromisePrototypeThen, PromiseReject } = primordials ;
7+ const asyncESM = require ( 'internal/process/esm_loader' ) ;
48
59function createImportMetaResolve ( defaultParentUrl ) {
610 return async function resolve ( specifier , parentUrl = defaultParentUrl ) {
7- return PromisePrototypeCatch (
8- asyncESM . ESMLoader . resolve ( specifier , parentUrl ) ,
11+ return PromisePrototypeThen (
12+ asyncESM . esmLoader . resolve ( specifier , parentUrl ) ,
13+ ( { url } ) => url ,
914 ( error ) => (
1015 error . code === 'ERR_UNSUPPORTED_DIR_IMPORT' ?
1116 error . url : PromiseReject ( error ) )
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ const {
1818 SafeWeakMap,
1919 globalThis,
2020} = primordials ;
21+ const { MessageChannel } = require ( 'internal/worker/io' ) ;
2122
2223const {
2324 ERR_INVALID_ARG_TYPE ,
@@ -403,7 +404,7 @@ class ESMLoader {
403404 throw new ERR_INVALID_ARG_VALUE ( 'builtinName' , builtinName ) ;
404405 } , insidePreload , ( fn ) => {
405406 if ( finished || typeof fn !== 'function' ) {
406- throw new ERR_INVALID_ARG_TYPE ( 'fn' , fn )
407+ throw new ERR_INVALID_ARG_TYPE ( 'fn' , fn ) ;
407408 }
408409 replacedImportMetaInitializer = true ;
409410 const parent = next ;
Original file line number Diff line number Diff line change @@ -50,7 +50,6 @@ const {
5050const { maybeCacheSourceMap } = require ( 'internal/source_map/source_map_cache' ) ;
5151const moduleWrap = internalBinding ( 'module_wrap' ) ;
5252const { ModuleWrap } = moduleWrap ;
53- const { getOptionValue } = require ( 'internal/options' ) ;
5453const asyncESM = require ( 'internal/process/esm_loader' ) ;
5554const { emitWarningSync } = require ( 'internal/process/warning' ) ;
5655const { TextDecoder } = require ( 'internal/encoding' ) ;
Original file line number Diff line number Diff line change 1- // Flags: --experimental-loader
2- // ./test/fixtures/es-module-loaders/mock-loader.mjs
1+ // Flags: --loader ./test/fixtures/es-module-loaders/mock-loader.mjs
32import '../common/index.mjs' ;
43import assert from 'assert/strict' ;
54import mock from 'node:mock' ;
@@ -8,7 +7,7 @@ mock('node:events', {
87 EventEmitter : 'This is mocked!'
98} ) ;
109
11- // this resolves to node:events
10+ // This resolves to node:events
1211assert . deepStrictEqual ( await import ( 'events' ) , Object . defineProperty ( {
1312 __proto__ : null ,
1413 EventEmitter : 'This is mocked!'
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ const expectedModules = new Set([
7676 'NativeModule internal/modules/esm/module_job' ,
7777 'NativeModule internal/modules/esm/module_map' ,
7878 'NativeModule internal/modules/esm/resolve' ,
79+ 'NativeModule internal/modules/esm/initialize_import_meta' ,
7980 'NativeModule internal/modules/esm/translators' ,
8081 'NativeModule internal/process/esm_loader' ,
8182 'NativeModule internal/options' ,
You can’t perform that action at this time.
0 commit comments