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

Method constructor

lib/internal/modules/esm/module_job.js:226–251  ·  view source on GitHub ↗

* @param {ModuleLoader} loader The ESM loader. * @param {string} url URL of the module to be wrapped in ModuleJob. * @param {ImportAttributes} importAttributes Import attributes from the import statement. * @param {ModuleWrap|Promise } moduleOrModulePromise Translated ModuleWrap

(loader, url, importAttributes = { __proto__: null }, moduleOrModulePromise,
              phase = kEvaluationPhase, isMain, inspectBrk, requestType)

Source from the content-addressed store, hash-verified

224 * @param {ModuleRequestType} requestType Type of the module request.
225 */
226 constructor(loader, url, importAttributes = { __proto__: null }, moduleOrModulePromise,
227 phase = kEvaluationPhase, isMain, inspectBrk, requestType) {
228 super(loader, url, importAttributes, phase, isMain, inspectBrk);
229
230 // Expose the promise to the ModuleWrap directly for linking below.
231 if (isPromise(moduleOrModulePromise)) {
232 this.modulePromise = moduleOrModulePromise;
233 } else {
234 this.module = moduleOrModulePromise;
235 this.modulePromise = PromiseResolve(moduleOrModulePromise);
236 }
237
238 if (this.shouldLinkModule(this.phase)) {
239 // Promise for the list of all dependencyJobs.
240 this.linked = this.link(requestType);
241 // This promise is awaited later anyway, so silence
242 // 'unhandled rejection' warnings.
243 if (isPromise(this.linked)) {
244 PromisePrototypeThen(this.linked, undefined, noop);
245 }
246 }
247
248 // instantiated == deep dependency jobs wrappers are instantiated,
249 // and module wrapper is instantiated.
250 this.instantiated = undefined;
251 }
252
253 /**
254 * @param {ModuleRequestType} requestType Type of the module request.

Callers

nothing calls this directly

Calls 2

linkMethod · 0.95
shouldLinkModuleMethod · 0.80

Tested by

no test coverage detected