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

Function importModuleDynamicallyWrapper

lib/internal/vm/module.js:523–539  ·  view source on GitHub ↗
(specifier, referrer, attributes, phase)

Source from the content-addressed store, hash-verified

521 */
522function importModuleDynamicallyWrap(importModuleDynamically) {
523 const importModuleDynamicallyWrapper = async (specifier, referrer, attributes, phase) => {
524 const phaseName = phaseEnumToPhaseName(phase);
525 const m = await FunctionPrototypeCall(importModuleDynamically, this, specifier, referrer, attributes, phaseName);
526 if (isModuleNamespaceObject(m)) {
527 if (phase === kSourcePhase) throw new ERR_VM_MODULE_NOT_MODULE();
528 return m;
529 }
530 if (!isModule(m)) {
531 throw new ERR_VM_MODULE_NOT_MODULE();
532 }
533 if (m.status === 'errored') {
534 throw m.error;
535 }
536 if (phase === kSourcePhase)
537 return m[kWrap].getModuleSourceObject();
538 return m.namespace;
539 };
540 return importModuleDynamicallyWrapper;
541}
542

Callers

nothing calls this directly

Calls 2

phaseEnumToPhaseNameFunction · 0.85
isModuleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…