MCPcopy Create free account
hub / github.com/ICBNetwork/web3-Wallet / makeModuleInstance

Function makeModuleInstance

ses.cjs:8556–8924  ·  view source on GitHub ↗
(
  privateFields,
  moduleAliases,
  moduleRecord,
  importedInstances)

Source from the content-addressed store, hash-verified

8554// The module exports namespace is a proxy to the proxied exports namespace
8555// that the execution of the module instance populates.
8556$h‍_once.makeThirdPartyModuleInstance(makeThirdPartyModuleInstance);const makeModuleInstance=(
8557 privateFields,
8558 moduleAliases,
8559 moduleRecord,
8560 importedInstances)=>
8561 {
8562 const {
8563 compartment,
8564 moduleSpecifier,
8565 staticModuleRecord,
8566 importMeta: moduleRecordMeta}=
8567 moduleRecord;
8568 const {
8569 reexports: exportAlls= [],
8570 __syncModuleProgram__: functorSource,
8571 __fixedExportMap__: fixedExportMap= {},
8572 __liveExportMap__: liveExportMap= {},
8573 __reexportMap__: reexportMap= {},
8574 __needsImportMeta__: needsImportMeta= false,
8575 __syncModuleFunctor__}=
8576 staticModuleRecord;
8577
8578 const compartmentFields= weakmapGet(privateFields, compartment);
8579
8580 const { __shimTransforms__, importMetaHook}= compartmentFields;
8581
8582 const { exportsProxy, exportsTarget, activate}= getDeferredExports(
8583 compartment,
8584 compartmentFields,
8585 moduleAliases,
8586 moduleSpecifier);
8587
8588
8589 // {_exportName_: getter} module exports namespace
8590 // object (eventually proxied).
8591 const exportsProps= create(null);
8592
8593 // {_localName_: accessor} proxy traps for moduleLexicals and live bindings.
8594 // The moduleLexicals object is frozen and the corresponding properties of
8595 // moduleLexicals must be immutable, so we copy the descriptors.
8596 const moduleLexicals= create(null);
8597
8598 // {_localName_: init(initValue) -> initValue} used by the
8599 // rewritten code to initialize exported fixed bindings.
8600 const onceVar= create(null);
8601
8602 // {_localName_: update(newValue)} used by the rewritten code to
8603 // both initialize and update live bindings.
8604 const liveVar= create(null);
8605
8606 const importMeta= create(null);
8607 if( moduleRecordMeta) {
8608 assign(importMeta, moduleRecordMeta);
8609 }
8610 if( needsImportMeta&& importMetaHook) {
8611 importMetaHook(moduleSpecifier, importMeta);
8612 }
8613

Callers 1

instantiateFunction · 0.85

Calls 3

getDeferredExportsFunction · 0.85
definePropertyFunction · 0.85
compartmentEvaluateFunction · 0.85

Tested by

no test coverage detected