?
u
/
See the explainer for information.
The relevant syntax changes are in the Import Calls and Imports sections.
This document might be out of date. Please refer to the tc39/ecma262#3057 preview for the latest version.
The abstract operation EvaluateImportCall takes argument specifierExpression (a ParseNode) and optional argument optionsExpression (a ParseNode) and returns either a
A ModuleRequest Record represents the request to import a module with given import attributes. It consists of the following fields:
Field Name | Value Type | Meaning |
---|---|---|
[[Specifier]] | String | The module specifier |
[[Attributes]] |
a |
The import attributes |
A LoadedModuleRequest Record represents the request to import a module together with the resulting
Field Name | Value Type | Meaning |
---|---|---|
[[Specifier]] | a String | The module specifier |
[[Attributes]] |
a |
The import attributes |
[[Module]] |
a |
The loaded module corresponding to this module request |
An ImportAttribute Record consists of the following fields:
Field Name | Value Type | Meaning |
---|---|---|
[[Key]] | String | The attribute key |
[[Value]] | String | The attribute value |
The abstract operation ModuleRequestsEqual takes arguments left (a
The Strings
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]] | ||
[[EvaluationError]] | ||
[[DFSIndex]] | ||
[[DFSAncestorIndex]] | ||
[[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 attributes to the resolved |
[[CycleRoot]] | ||
[[HasTLA]] | ||
[[AsyncEvaluation]] | ||
[[TopLevelCapability]] | ||
[[AsyncParentModules]] | ||
[[PendingAsyncDependencies]] |
The LoadRequestedModules concrete method of a
The abstract operation InnerModuleLoading takes arguments state (a
An ImportEntry Record is a
Field Name | Value Type | Meaning |
---|---|---|
[[ModuleRequest]] |
|
|
[[ImportName]] | ||
[[LocalName]] |
The specifier (a String), moduleRequest (a
An example of when referrer can be a
<button type="button" onclick="import('./foo.mjs')">Click me</button>
there will be no import()
An implementation of HostLoadImportedModule must conform to the following requirements:
If this operation is called multiple times with the sametwo (referrer, specifiermoduleRequest) pairs such that:
then it must perform specifiermoduleRequest, payload, result) with the same result each time.
The actual process performed is (referrer, specifier) pairs(referrer, moduleRequest.[[Specifer]], moduleRequest.[[Attributes]]) triples may map to the same
The abstract operation FinishLoadingImportedModule takes arguments referrer (a specifier (a String), moduleRequest (a
The description of the [[LoadedModules]] field of
The abstract operation AllImportAttributesSupported takes argument attributes (a
The
An implementation of HostGetSupportedImportAttributes must conform to the following requrements:
The default implementation of HostGetSupportedImportAttributes is to return a new empty
The
The import attributes proposal is intended to give key information about how modules are interpreted to
In the Web embedding, the following changes would be made to the HTML specification for import attributes:
The module map is keyed by the absolute URL and the type. Initially no other import attributes are supported, so they are not present.