?
u
/
See the explainer for information.
The relevant syntax changes are in the Import Calls and Imports sections.
This feature would ideally use the with
assert
assert
marked as
A conforming implementation of ECMAScript should not implement Deprecated subclauses or algorithm steps, unless necessary for compatibility with existing applications that already run in such implementation before the deprecation of the given language feature. All of the language features and behaviours specified within Deprecated subclauses or algorithm steps have one or more undesirable characteristics. However, their use in existing applications currently prevents their removal from this specification. These features are not considered part of the core ECMAScript language. Programmers should not use or assume the existence of these features and behaviours when writing new ECMAScript code.
Example clause contents.
The abstract operation EvaluateImportCall takes argument specifierExpression (a ParseNode) and optional argument optionsExpression (a ParseNode) and returns either a
assert
keyword for import attributesassert
fallback when options's with
property is 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 |
An ImportAttribute Record consists of the following fields:
Field Name | Value Type | Meaning |
---|---|---|
[[Key]] | String | The attribute key |
[[Value]] | String | The attribute value |
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]] |
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
There are three possible ways to handle multiple imports of the same module with different valid attributes:
It's possible that one of these three options may make sense for a module load, on a case-by-case basis by attribute, but it's worth careful thought before making this choice.
The abstract operation FinishLoadingImportedModule takes arguments referrer (a specifier (a String), moduleRequest (a
The description of the [[LoadedModules]] field of
The abstract operation ImportAttributesEqual takes arguments left (a
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
This section is extended by
This section is extended by
The
The
This section is extended by
assert
keyword for Import AttributesImport Attributes are denoted using the with
assert
assert
This deprecated feature includes the assert
fallback for import attributes in import calls (step
The following augments the
The
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.