MCPcopy Index your code
hub / github.com/nodejs/node / registerImportModuleDynamically

Function registerImportModuleDynamically

lib/internal/vm.js:97–112  ·  view source on GitHub ↗

* Registers a dynamically imported module for customization. * @param {string} referrer - The path of the referrer module. * @param {VmImportModuleDynamicallyCallback} importModuleDynamically - The * dynamically imported module function to be registered.

(referrer, importModuleDynamically)

Source from the content-addressed store, hash-verified

95 * dynamically imported module function to be registered.
96 */
97function registerImportModuleDynamically(referrer, importModuleDynamically) {
98 // If it's undefined or certain known symbol, there's no customization so
99 // no need to register anything.
100 if (importModuleDynamically === undefined ||
101 importModuleDynamically === vm_dynamic_import_main_context_default ||
102 importModuleDynamically === vm_dynamic_import_default_internal) {
103 return;
104 }
105 const { importModuleDynamicallyWrap } = require('internal/vm/module');
106 const { registerModule } = require('internal/modules/esm/utils');
107 registerModule(referrer, {
108 __proto__: null,
109 importModuleDynamically:
110 importModuleDynamicallyWrap(importModuleDynamically),
111 });
112}
113
114/**
115 * Compiles a function from the given code string.

Callers 4

constructorMethod · 0.85
createContextFunction · 0.85
internalCompileFunctionFunction · 0.85
makeContextifyScriptFunction · 0.85

Calls 3

registerModuleFunction · 0.85
requireFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…