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

Method linkRequests

lib/internal/vm/module.js:379–400  ·  view source on GitHub ↗
(modules)

Source from the content-addressed store, hash-verified

377 }
378
379 linkRequests(modules) {
380 validateThisInternalField(this, kWrap, 'SourceTextModule');
381 if (this.status !== 'unlinked') {
382 throw new ERR_VM_MODULE_STATUS('must be unlinked');
383 }
384 validateArray(modules, 'modules');
385 if (modules.length !== this.#moduleRequests.length) {
386 throw new ERR_MODULE_LINK_MISMATCH(
387 `Expected ${this.#moduleRequests.length} modules, got ${modules.length}`,
388 );
389 }
390 const moduleWraps = ArrayPrototypeMap(modules, (module) => {
391 if (!isModule(module)) {
392 throw new ERR_VM_MODULE_NOT_MODULE();
393 }
394 if (module.context !== this.context) {
395 throw new ERR_VM_MODULE_DIFFERENT_CONTEXT();
396 }
397 return module[kWrap];
398 });
399 this[kWrap].link(moduleWraps);
400 }
401
402 instantiate() {
403 validateThisInternalField(this, kWrap, 'SourceTextModule');

Calls 2

isModuleFunction · 0.85
linkMethod · 0.45

Tested by

no test coverage detected