pub struct ModuleInner {Show 13 fields
pub name: String,
pub url: String,
pub code: Option<Gc<CompiledCode>>,
pub meta: ModuleMeta,
pub cells: Vec<Gc<Cell>>,
pub dependencies: Vec<Option<Gc<ModuleRecord>>>,
pub status: ModuleStatus,
pub evaluation_error: Option<Value>,
pub kind: ModuleKind,
pub namespace: Option<Gc<JsObject>>,
pub deferred_namespace: Option<Gc<JsObject>>,
pub import_meta: Option<Gc<JsObject>>,
pub star_cells: BTreeMap<String, Gc<Cell>>,
}Expand description
Everything a module record holds; see ModuleRecord.
Fields§
§name: StringCanonical identity: the cache key, and what a cycle compares.
url: StringWhat import.meta.url reports.
code: Option<Gc<CompiledCode>>The compiled body, or None for a JSON/text/bytes module.
meta: ModuleMetaThe tables the compiler produced.
cells: Vec<Gc<Cell>>One cell per closure variable of the body; the body reads its bindings here.
dependencies: Vec<Option<Gc<ModuleRecord>>>Resolved dependencies, parallel to meta.requests.
status: ModuleStatusWhere it is in its lifetime.
evaluation_error: Option<Value>The completion of a body that threw, rethrown on every later attempt.
§16.2.1.5.3.1 stores the abrupt completion on the record. Without it a second
read through a deferred namespace ran the body again and produced a second, equal,
but not identical error object — which import-defer/errors/module-throws compares
by identity.
kind: ModuleKindWhat kind of module it is.
namespace: Option<Gc<JsObject>>The namespace object, built on first use.
deferred_namespace: Option<Gc<JsObject>>The deferred namespace object, built on first use.
A second object rather than a flag on the first: the deferred namespace’s whole
point is that reading it evaluates the module, and the eager one must stay usable on
a module that is still Linked. It is cached here so two import defer clauses for
one module hand back the same object, which the proposal requires.
import_meta: Option<Gc<JsObject>>import.meta, built at load time.
star_cells: BTreeMap<String, Gc<Cell>>The wrapper cell behind each export * as ns from "m", keyed by ns.
§16.2.1.6.3 ResolveExport identifies a binding by (module, name), and the
ambiguity test compares those identities. A namespace re-export needs a cell in the
export table, and building a fresh one per lookup gave the same export two different
identities — so a name reached through two export * that both pass through one
export * as ns looked ambiguous. Caching makes the identity stable, which is what
namespace-unambiguous-if-export-star-as-from checks.