Skip to content

Commit

Permalink
fixup! test_runner: do not expose internal loader
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Jul 31, 2024
1 parent f96c3d3 commit 1605d49
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/internal/modules/esm/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const {
ReflectSet,
SafeSet,
StringPrototypeSlice,
StringPrototypeStartsWith,
StringPrototypeToUpperCase,
globalThis,
} = primordials;
Expand Down Expand Up @@ -147,11 +148,13 @@ class Hooks {
*/
async register(urlOrSpecifier, parentURL, data) {
const cascadedLoader = require('internal/modules/esm/loader').getOrInitializeCascadedLoader();
const keyedExports = await cascadedLoader.import(
urlOrSpecifier,
parentURL,
kEmptyObject,
);
const keyedExports = StringPrototypeStartsWith(urlOrSpecifier, 'node:internal/') ?
require(StringPrototypeSlice(urlOrSpecifier, 5)) :
await cascadedLoader.import(
urlOrSpecifier,
parentURL,
kEmptyObject,
);
await this.addCustomLoader(urlOrSpecifier, keyedExports, data);
}

Expand Down

0 comments on commit 1605d49

Please sign in to comment.