?
u
/
p
1-9
0
`
NOTE: The diff markers are on top of https://tc39.es/proposal-defer-import-eval/.
This specification defines several kinds of built-in
A export *
export items. Each String-valued own
An object is a module namespace exotic object if its [[GetPrototypeOf]], [[SetPrototypeOf]], [[IsExtensible]], [[PreventExtensions]], [[GetOwnProperty]], [[DefineOwnProperty]], [[HasProperty]], [[Get]], [[Set]], [[Delete]], and [[OwnPropertyKeys]] internal methods use the definitions in this section, and its other essential internal methods use the definitions found in
The [[Get]] internal method of a
import defer * as x from "..."; export { x }
, binding.[[BindingName]] is ResolveExport is side-effect free. Each time this operation is called with a specific exportName, resolveSet pair as arguments it must return the same result. An implementation might choose to pre-compute or cache the ResolveExport results for the [[Exports]] of each
The abstract operation EvaluateImportCall takes arguments arguments (a
The abstract operation ContinueDynamicImport takes arguments promiseCapability (a import()
The
A Cyclic Module Record is used to represent information about a module that can participate in dependency cycles with other modules that are subclasses of the
In addition to the fields defined in
Field Name | Value Type | Meaning |
---|---|---|
[[Status]] |
|
Initially |
[[EvaluationError]] |
a |
A |
[[DFSAncestorIndex]] |
an |
Auxiliary field used during Link and Evaluate only. If [[Status]] is either |
[[RequestedModules]] |
a |
A |
[[LoadedModules]] |
a |
A map from the specifier strings used by the module represented by this record to request the importation of a module with the relative import attributes to the resolved |
[[OptionalIndirectExportEntries]] |
a |
A list of all the bindings re-exported through export defer { ... } from "..." . The |
[[CycleRoot]] |
a |
The first visited module of the cycle, the root DFS ancestor of the strongly connected component. For a module not in a cycle, this would be the module itself. Once Evaluate has completed, a module's [[DFSAncestorIndex]] is the depth-first traversal index of its [[CycleRoot]]. |
[[HasTLA]] | a Boolean |
Whether this module is individually asynchronous (for example, if it's a |
[[AsyncEvaluationOrder]] |
|
This field is initially set to |
[[TopLevelCapability]] |
a |
If this module is the [[CycleRoot]] of some cycle, and Evaluate() was called on some module in that cycle, this field contains the |
[[AsyncParentModules]] |
a |
If this module or a dependency has [[HasTLA]] |
[[PendingAsyncDependencies]] |
an |
If this module has any asynchronous dependencies, this tracks the number of asynchronous dependency modules remaining to execute for this module. A module with asynchronous dependencies will be executed when this field reaches 0 and there are no execution errors. |
In addition to the methods defined in
Method | Purpose |
---|---|
InitializeEnvironment() |
Initialize the |
ExecuteModule( [ promiseCapability ] ) |
Evaluate the module's code within its |
A GraphLoadingState Record is a
Field Name | Value Type | Meaning |
---|---|---|
[[PromiseCapability]] |
a |
The promise to resolve when the loading process finishes. |
[[IsLoading]] | a Boolean | It is true if the loading process has not finished yet, neither successfully nor with an error. |
[[PendingModulesCount]] |
a non-negative |
It tracks the number of pending |
[[ContinuationData]] |
a |
It stores data to be used for |
[[Visited]] |
a |
It is a list of the |
[[HostDefined]] |
anything (default value is |
It contains |
The LoadRequestedModules concrete method of a
<script type="module" src="./file.js">
tags, the <link rel="preload" as="...">
tags.
import()
expressions never set the hostDefined parameter.
The abstract operation InnerModuleLoading takes arguments state (a
The abstract operation ContinueModuleLoading takes arguments state (a
The Link concrete method of a
TODO: Either we add an importedNames parameter, or dynamic import will have to be responsible for linking all the defrred reexports.
If we add that parameter, we must be careful because the used deferred re-exports of a module should be linked after calling InitializeEnvironment on the module itself.
It performs the following steps when called:
The abstract operation InnerModuleLinking takes arguments module (a
The abstract operation LinkRequestedModules takes arguments referrer (a
export defer
from each other.
The Evaluate concrete method of a
It performs the following steps when called:
The abstract operation InnerModuleEvaluation takes arguments module (a
A module is
Any modules depending on a module of an asynchronous cycle when that cycle is not
The abstract operation EvaluateRequestedModules takes arguments referrer (a
export defer
from each other.
The abstract operation GatherAsynchronousTransitiveDependencies takes argument module (a
export defer
semantics, to know where to recourseIt performs the following steps when called:
The abstract operation ParseModule takes arguments sourceText (
await
.The abstract operation GetOptionalIndirectExportsModuleRequests takes arguments module (a
The abstract operation MergeImportedNames takes arguments a (
The above rule means that each
*
.
The
ExportedNames are the externally visible names that a
It is defined piecewise over the following productions:
The
The
© 2025 Nicolò Ribaudo
All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT https://ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.