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

Method getESMFacade

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

Source from the content-addressed store, hash-verified

354 }
355
356 getESMFacade() {
357 if (this.module) return this.module;
358 const url = `node:${this.id}`;
359 const builtin = this;
360 const exportsKeys = ArrayPrototypeSlice(this.exportKeys);
361 if (!ArrayPrototypeIncludes(exportsKeys, 'default')) {
362 ArrayPrototypePush(exportsKeys, 'default');
363 }
364 this.module = new ModuleWrap(
365 url, undefined, exportsKeys,
366 function() {
367 builtin.syncExports();
368 this.setExport('default', builtin.exports);
369 });
370 // Ensure immediate sync execution to capture exports now
371 this.module.instantiate();
372 this.module.evaluate(-1, false);
373 return this.module;
374 }
375
376 // Provide named exports for all builtin libraries so that the libraries
377 // may be imported in a nicer way for ESM users. The default export is left

Callers 2

translators.jsFile · 0.80

Calls 4

syncExportsMethod · 0.80
setExportMethod · 0.80
instantiateMethod · 0.45
evaluateMethod · 0.45

Tested by

no test coverage detected