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

Method constructor

lib/internal/vm/module.js:462–491  ·  view source on GitHub ↗
(exportNames, evaluateCallback, options = kEmptyObject)

Source from the content-addressed store, hash-verified

460
461class SyntheticModule extends Module {
462 constructor(exportNames, evaluateCallback, options = kEmptyObject) {
463 if (!ArrayIsArray(exportNames) ||
464 ArrayPrototypeSome(exportNames, (e) => typeof e !== 'string')) {
465 throw new ERR_INVALID_ARG_TYPE('exportNames',
466 'Array of unique strings',
467 exportNames);
468 } else {
469 ArrayPrototypeForEach(exportNames, (name, i) => {
470 if (ArrayPrototypeIndexOf(exportNames, name, i + 1) !== -1) {
471 throw new ERR_INVALID_ARG_VALUE(`exportNames.${name}`,
472 name,
473 'is duplicated');
474 }
475 });
476 }
477 validateFunction(evaluateCallback, 'evaluateCallback');
478
479 validateObject(options, 'options');
480
481 const { context, identifier } = options;
482
483 super({
484 syntheticExportNames: exportNames,
485 syntheticEvaluationSteps: evaluateCallback,
486 context,
487 identifier,
488 });
489 // A synthetic module does not have dependencies.
490 this[kWrap].instantiate();
491 }
492
493 link() {
494 validateThisInternalField(this, kWrap, 'SyntheticModule');

Callers

nothing calls this directly

Calls 1

instantiateMethod · 0.45

Tested by

no test coverage detected