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

Method compileForInternalLoader

lib/internal/bootstrap/realm.js:392–418  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

390 }
391
392 compileForInternalLoader() {
393 if (this.loaded || this.loading) {
394 return this.exports;
395 }
396
397 const id = this.id;
398 this.loading = true;
399
400 try {
401 const requireFn = StringPrototypeStartsWith(this.id, 'internal/deps/') ?
402 requireWithFallbackInDeps : requireBuiltin;
403
404 const fn = compileFunction(id);
405 // Arguments must match the parameters specified in
406 // BuiltinLoader::LookupAndCompile().
407 fn(this.exports, requireFn, this, process, internalBinding, primordials);
408
409 this.loaded = true;
410 } finally {
411 this.loading = false;
412 }
413
414 // "NativeModule" is a legacy name of "BuiltinModule". We keep it
415 // here to avoid breaking users who parse process.moduleLoadList.
416 ArrayPrototypePush(moduleLoadList, `NativeModule ${id}`);
417 return this.exports;
418 }
419}
420
421// Think of this as module.exports in this file even though it is not

Callers 2

requireBuiltinFunction · 0.80

Calls 2

compileFunctionFunction · 0.85
fnFunction · 0.50

Tested by

no test coverage detected