diff --git a/spec.html b/spec.html
index 3dc99bc2c3..3744976bdc 100644
--- a/spec.html
+++ b/spec.html
@@ -3280,6 +3280,17 @@
%AggregateError%
@@ -7418,11 +7429,11 @@ Static Semantics: BoundNames ( ): a List of Strings
1. Let _head_ be the |AsyncArrowHead| that is covered by |CoverCallExpressionAndAsyncArrowHead|.
1. Return the BoundNames of _head_.
- ImportDeclaration : `import` ImportClause FromClause `;`
+ ImportDeclaration : `import` ImportClause FromClause WithClause? `;`
1. Return the BoundNames of |ImportClause|.
- ImportDeclaration : `import` ModuleSpecifier `;`
+ ImportDeclaration : `import` ModuleSpecifier WithClause? `;`
1. Return a new empty List.
@@ -7454,7 +7465,7 @@ Static Semantics: BoundNames ( ): a List of Strings
ExportDeclaration :
- `export` ExportFromClause FromClause `;`
+ `export` ExportFromClause FromClause WithClause? `;`
`export` NamedExports `;`
@@ -7812,7 +7823,7 @@ Static Semantics: LexicallyScopedDeclarations ( ): a List of Parse Nodes
ExportDeclaration :
- `export` ExportFromClause FromClause `;`
+ `export` ExportFromClause FromClause WithClause? `;`
`export` NamedExports `;`
`export` VariableStatement
@@ -9915,11 +9926,19 @@ Static Semantics: PropName ( ): a String or ~empty~
1. Return the PropName of |PropertyName|.
- LiteralPropertyName : IdentifierName
+
+ LiteralPropertyName : IdentifierName
+
+ AttributeKey : IdentifierName
+
1. Return the StringValue of |IdentifierName|.
- LiteralPropertyName : StringLiteral
+
+ LiteralPropertyName : StringLiteral
+
+ AttributeKey : StringLiteral
+
1. Return the SV of |StringLiteral|.
@@ -11667,10 +11686,10 @@ Realms
[[LoadedModules]]
|
- a List of Records with fields [[Specifier]] (a String) and [[Module]] (a Module Record)
+ a List of LoadedModuleRequest Records
|
- A map from the specifier strings imported by this realm to the resolved Module Record. The list does not contain two different Records with the same [[Specifier]].
+ A map from the specifier strings imported by this realm to the resolved Module Record. The list does not contain two different Records _r1_ and _r2_ such that ModuleRequestsEqual(_r1_, _r2_) is *true*.
As mentioned in HostLoadImportedModule (), [[LoadedModules]] in Realm Records is only used when running an `import()` expression in a context where there is no active script or module.
@@ -19047,7 +19066,10 @@ Syntax
`super` Arguments[?Yield, ?Await]
ImportCall[Yield, Await] :
- `import` `(` AssignmentExpression[+In, ?Yield, ?Await] `)`
+ `import` `(` AssignmentExpression[+In, ?Yield, ?Await] `,`? `)`
+ `import` `(` AssignmentExpression[+In, ?Yield, ?Await] `,` AssignmentExpression[+In, ?Yield, ?Await] `,`? `)`
+ `import` `.` `source` `(` AssignmentExpression[+In, ?Yield, ?Await] `,`? `)`
+ `import` `.` `source` `(` AssignmentExpression[+In, ?Yield, ?Await] `,` AssignmentExpression[+In, ?Yield, ?Await] `,`? `)`
Arguments[Yield, Await] :
`(` `)`
@@ -19606,58 +19628,127 @@ Import Calls
Runtime Semantics: Evaluation
- ImportCall : `import` `(` AssignmentExpression `)`
+ ImportCall : `import` `(` AssignmentExpression `,`? `)`
+
+ 1. Return ? EvaluateImportCall(|AssignmentExpression|, ~evaluation~).
+
+
+ ImportCall : `import` `(` AssignmentExpression `,` AssignmentExpression `,`? `)`
+
+ 1. Return ? EvaluateImportCall(the first |AssignmentExpression|, ~evaluation~, the second |AssignmentExpression|).
+
+
+ ImportCall : `import` `.` `source` `(` AssignmentExpression `,` AssignmentExpression `,`? `)`
+
+ 1. Return ? EvaluateImportCall(|AssignmentExpression|, ~source~).
+
+
+ ImportCall : `import` `.` `source` `(` AssignmentExpression `,` AssignmentExpression `,`? `)`
+
+ 1. Return ? EvaluateImportCall(the first |AssignmentExpression|, ~source~, the second |AssignmentExpression|).
+
+
+
+
+
+ EvaluateImportCall (
+ _specifierExpression_: a Parse Node,
+ _phase_: ~source~ or ~evaluation~,
+ optional _optionsExpression_: a Parse Node,
+ ): either a normal completion containing a Promise or a throw completion
+
+
1. Let _referrer_ be GetActiveScriptOrModule().
1. If _referrer_ is *null*, set _referrer_ to the current Realm Record.
- 1. Let _argRef_ be ? Evaluation of |AssignmentExpression|.
- 1. Let _specifier_ be ? GetValue(_argRef_).
+ 1. Let _specifierRef_ be ? Evaluation of _specifierExpression_.
+ 1. Let _specifier_ be ? GetValue(_specifierRef_).
+ 1. If _optionsExpression_ is present, then
+ 1. Let _optionsRef_ be ? Evaluation of _optionsExpression_.
+ 1. Let _options_ be ? GetValue(_optionsRef_).
+ 1. Else,
+ 1. Let _options_ be *undefined*.
1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%).
1. Let _specifierString_ be Completion(ToString(_specifier_)).
1. IfAbruptRejectPromise(_specifierString_, _promiseCapability_).
- 1. Perform HostLoadImportedModule(_referrer_, _specifierString_, ~empty~, _promiseCapability_).
+ 1. Let _attributes_ be a new empty List.
+ 1. If _options_ is not *undefined*, then
+ 1. If _options_ is not an Object, then
+ 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »).
+ 1. Return _promiseCapability_.[[Promise]].
+ 1. Let _attributesObj_ be Completion(Get(_options_, *"with"*)).
+ 1. IfAbruptRejectPromise(_attributesObj_, _promiseCapability_).
+ 1. If _attributesObj_ is not *undefined*, then
+ 1. If _attributesObj_ is not an Object, then
+ 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »).
+ 1. Return _promiseCapability_.[[Promise]].
+ 1. Let _entries_ be Completion(EnumerableOwnProperties(_attributesObj_, ~key+value~)).
+ 1. IfAbruptRejectPromise(_entries_, _promiseCapability_).
+ 1. For each element _entry_ of _entries_, do
+ 1. Let _key_ be ! Get(_entry_, *"0"*).
+ 1. Let _value_ be ! Get(_entry_, *"1"*).
+ 1. If _key_ is a String, then
+ 1. If _value_ is not a String, then
+ 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »).
+ 1. Return _promiseCapability_.[[Promise]].
+ 1. Append the ImportAttribute Record { [[Key]]: _key_, [[Value]]: _value_ } to _attributes_.
+ 1. If AllImportAttributesSupported(_attributes_) is *false*, then
+ 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »).
+ 1. Return _promiseCapability_.[[Promise]].
+ 1. Sort _attributes_ according to the lexicographic order of their [[Key]] fields, treating the value of each such field as a sequence of UTF-16 code unit values. NOTE: This sorting is observable only in that hosts are prohibited from changing behaviour based on the order in which attributes are enumerated.
+ 1. Let _moduleRequest_ be a new ModuleRequest Record { [[Specifier]]: _specifierString_, [[Phase]]: _phase_, [[Attributes]]: _attributes_ }.
+ 1. Perform HostLoadImportedModule(_referrer_, _moduleRequest_, ~empty~, _promiseCapability_).
1. Return _promiseCapability_.[[Promise]].
+
-
-
- ContinueDynamicImport (
- _promiseCapability_: a PromiseCapability Record,
- _moduleCompletion_: either a normal completion containing a Module Record or a throw completion,
- ): ~unused~
-
-
-
- 1. If _moduleCompletion_ is an abrupt completion, then
- 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _moduleCompletion_.[[Value]] »).
- 1. Return ~unused~.
- 1. Let _module_ be _moduleCompletion_.[[Value]].
- 1. Let _loadPromise_ be _module_.LoadRequestedModules().
- 1. Let _rejectedClosure_ be a new Abstract Closure with parameters (_reason_) that captures _promiseCapability_ and performs the following steps when called:
- 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _reason_ »).
+
+
+ ContinueDynamicImport (
+ _promiseCapability_: a PromiseCapability Record,
+ _phase_: ~source~ or ~evaluation~,
+ _moduleCompletion_: either a normal completion containing a Module Record or a throw completion,
+ ): ~unused~
+
+
+
+ 1. If _moduleCompletion_ is an abrupt completion, then
+ 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _moduleCompletion_.[[Value]] »).
+ 1. Return ~unused~.
+ 1. Let _module_ be _moduleCompletion_.[[Value]].
+ 1. If _phase_ is ~source~, then
+ 1. Let _moduleSource_ be _module_.[[ModuleSource]].
+ 1. If _moduleSource_ is ~empty~, then
+ 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a new *SyntaxError* »).
+ 1. Else,
+ 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « _moduleSource_ »).
+ 1. Return ~unused~.
+ 1. Let _loadPromise_ be _module_.LoadRequestedModules().
+ 1. Let _rejectedClosure_ be a new Abstract Closure with parameters (_reason_) that captures _promiseCapability_ and performs the following steps when called:
+ 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _reason_ »).
+ 1. Return ~unused~.
+ 1. Let _onRejected_ be CreateBuiltinFunction(_rejectedClosure_, 1, *""*, « »).
+ 1. Let _linkAndEvaluateClosure_ be a new Abstract Closure with no parameters that captures _module_, _promiseCapability_, and _onRejected_ and performs the following steps when called:
+ 1. Let _link_ be Completion(_module_.Link()).
+ 1. If _link_ is an abrupt completion, then
+ 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _link_.[[Value]] »).
1. Return ~unused~.
- 1. Let _onRejected_ be CreateBuiltinFunction(_rejectedClosure_, 1, *""*, « »).
- 1. Let _linkAndEvaluateClosure_ be a new Abstract Closure with no parameters that captures _module_, _promiseCapability_, and _onRejected_ and performs the following steps when called:
- 1. Let _link_ be Completion(_module_.Link()).
- 1. If _link_ is an abrupt completion, then
- 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _link_.[[Value]] »).
- 1. Return ~unused~.
- 1. Let _evaluatePromise_ be _module_.Evaluate().
- 1. Let _fulfilledClosure_ be a new Abstract Closure with no parameters that captures _module_ and _promiseCapability_ and performs the following steps when called:
- 1. Let _namespace_ be GetModuleNamespace(_module_).
- 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « _namespace_ »).
- 1. Return ~unused~.
- 1. Let _onFulfilled_ be CreateBuiltinFunction(_fulfilledClosure_, 0, *""*, « »).
- 1. Perform PerformPromiseThen(_evaluatePromise_, _onFulfilled_, _onRejected_).
+ 1. Let _evaluatePromise_ be _module_.Evaluate().
+ 1. Let _fulfilledClosure_ be a new Abstract Closure with no parameters that captures _module_ and _promiseCapability_ and performs the following steps when called:
+ 1. Let _namespace_ be GetModuleNamespace(_module_).
+ 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « _namespace_ »).
1. Return ~unused~.
- 1. Let _linkAndEvaluate_ be CreateBuiltinFunction(_linkAndEvaluateClosure_, 0, *""*, « »).
- 1. Perform PerformPromiseThen(_loadPromise_, _linkAndEvaluate_, _onRejected_).
+ 1. Let _onFulfilled_ be CreateBuiltinFunction(_fulfilledClosure_, 0, *""*, « »).
+ 1. Perform PerformPromiseThen(_evaluatePromise_, _onFulfilled_, _onRejected_).
1. Return ~unused~.
-
-
+ 1. Let _linkAndEvaluate_ be CreateBuiltinFunction(_linkAndEvaluateClosure_, 0, *""*, « »).
+ 1. Perform PerformPromiseThen(_loadPromise_, _linkAndEvaluate_, _onRejected_).
+ 1. Return ~unused~.
+
@@ -25929,10 +26020,10 @@ Script Records
[[LoadedModules]]
|
- a List of Records with fields [[Specifier]] (a String) and [[Module]] (a Module Record)
+ a List of LoadedModuleRequest Records
|
- A map from the specifier strings imported by this script to the resolved Module Record. The list does not contain two different Records with the same [[Specifier]].
+ A map from the specifier strings imported by this script to the resolved Module Record. The list does not contain two different Records _r1_ and _r2_ such that ModuleRequestsEqual(_r1_, _r2_) is *true*.
|
@@ -28175,6 +28495,11 @@ InitializeEnvironment ( ): either a normal completion containing ~unused~ or
1. Let _namespace_ be GetModuleNamespace(_importedModule_).
1. Perform ! _env_.CreateImmutableBinding(_in_.[[LocalName]], *true*).
1. Perform ! _env_.InitializeBinding(_in_.[[LocalName]], _namespace_).
+ 1. Else if _in_.[[ImportName]] is ~source~, then
+ 1. Let _moduleSourceObject_ be _importedModule_.[[ModuleSource]].
+ 1. If _moduleSourceObject_ is ~empty~, throw a *SyntaxError* exception.
+ 1. Perform ! _env_.CreateImmutableBinding(_in_.[[LocalName]], *true*).
+ 1. Perform ! _env_.InitializeBinding(_in_.[[LocalName]], _moduleSourceObject_).
1. Else,
1. Let _resolution_ be _importedModule_.ResolveExport(_in_.[[ImportName]]).
1. If _resolution_ is either *null* or ~ambiguous~, throw a *SyntaxError* exception.
@@ -28259,7 +28584,7 @@
GetImportedModule (
_referrer_: a Cyclic Module Record,
- _specifier_: a String,
+ _request_: a ModuleRequest Record,
): a Module Record
- 1. Assert: Exactly one element of _referrer_.[[LoadedModules]] is a Record whose [[Specifier]] is _specifier_, since LoadRequestedModules has completed successfully on _referrer_ prior to invoking this abstract operation.
- 1. Let _record_ be the Record in _referrer_.[[LoadedModules]] whose [[Specifier]] is _specifier_.
+ 1. [declared="r"] Let _records_ be a List consisting of each LoadedModuleRequest Record _r_ of _referrer_.[[LoadedModules]] such that ModuleRequestsEqual(_r_, _request_) is *true*.
+ 1. Assert: _records_ has exactly one element, since LoadRequestedModules has completed successfully on _referrer_ prior to invoking this abstract operation.
+ 1. Let _record_ be the sole element of _records_.
1. Return _record_.[[Module]].
@@ -28278,7 +28604,7 @@
HostLoadImportedModule (
_referrer_: a Script Record, a Cyclic Module Record, or a Realm Record,
- _specifier_: a String,
+ _moduleRequest_: a ModuleRequest Record,
_hostDefined_: anything,
_payload_: a GraphLoadingState Record or a PromiseCapability Record,
): ~unused~
@@ -28299,24 +28625,36 @@
An implementation of HostLoadImportedModule must conform to the following requirements:
-
- The host environment must perform FinishLoadingImportedModule(_referrer_, _specifier_, _payload_, _result_), where _result_ is either a normal completion containing the loaded Module Record or a throw completion, either synchronously or asynchronously.
+ The host environment must perform FinishLoadingImportedModule(_referrer_, _moduleRequest_, _payload_, _result_), where _result_ is either a normal completion containing the loaded Module Record or a throw completion, either synchronously or asynchronously.
-
- If this operation is called multiple times with the same (_referrer_, _specifier_) pair and it performs FinishLoadingImportedModule(_referrer_, _specifier_, _payload_, _result_) where _result_ is a normal completion, then it must perform FinishLoadingImportedModule(_referrer_, _specifier_, _payload_, _result_) with the same _result_ each time.
+
If this operation is called multiple times with two (_referrer_, _moduleRequest_) pairs such that:
+
+ - the first _referrer_ is the same as the second _referrer_;
+ - ModuleRequestsEqual(the first _moduleRequest_, the second _moduleRequest_) is *true*;
+
+ and it performs FinishLoadingImportedModule(_referrer_, _moduleRequest_, _payload_, _result_) where _result_ is a normal completion, then it must perform FinishLoadingImportedModule(_referrer_, _moduleRequest_, _payload_, _result_) with the same _result_ each time.
+
+ -
+ The completion record returned by this operation must not be affected by _moduleRequest_.[[Phase]].
-
The operation must treat _payload_ as an opaque value to be passed through to FinishLoadingImportedModule.
- The actual process performed is host-defined, but typically consists of performing whatever I/O operations are necessary to load the appropriate Module Record. Multiple different (_referrer_, _specifier_) pairs may map to the same Module Record instance. The actual mapping semantics is host-defined but typically a normalization process is applied to _specifier_ as part of the mapping process. A typical normalization process would include actions such as expansion of relative and abbreviated path specifiers.
+ The actual process performed is host-defined, but typically consists of performing whatever I/O operations are necessary to load the appropriate Module Record. Multiple different (_referrer_, _moduleRequest_.[[Specifier]], _moduleRequest_.[[Attributes]]) triples may map to the same Module Record instance. The actual mapping semantics is host-defined but typically a normalization process is applied to _specifier_ as part of the mapping process. A typical normalization process would include actions such as expansion of relative and abbreviated path specifiers.
+
+
+ Implementations may provide unobservable module loading optimizations, such as speculative preloading of modules that are likely to be requested next. When doing so, they should consider whether the module is being imported for its ~source~ phase, which won't cause calls to the HostLoadImportedModule hook for its transitive dependencies, or for its ~evaluation~ phase, which will.
+
FinishLoadingImportedModule (
_referrer_: a Script Record, a Cyclic Module Record, or a Realm Record,
- _specifier_: a String,
+ _moduleRequest_: a ModuleRequest Record,
_payload_: a GraphLoadingState Record or a PromiseCapability Record,
_result_: either a normal completion containing a Module Record or a throw completion,
): ~unused~
@@ -28327,18 +28665,78 @@
1. If _result_ is a normal completion, then
- 1. If _referrer_.[[LoadedModules]] contains a Record whose [[Specifier]] is _specifier_, then
- 1. Assert: That Record's [[Module]] is _result_.[[Value]].
+ 1. If _referrer_.[[LoadedModules]] contains a LoadedModuleRequest Record _record_ such that ModuleRequestsEqual(_record_, _moduleRequest_) is *true*, then
+ 1. Assert: _record_.[[Module]] and _result_.[[Value]] are the same Module Record.
1. Else,
- 1. Append the Record { [[Specifier]]: _specifier_, [[Module]]: _result_.[[Value]] } to _referrer_.[[LoadedModules]].
+ 1. Append the LoadedModuleRequest Record { [[Specifier]]: _moduleRequest_.[[Specifier]], [[Attributes]]: _moduleRequest_.[[Attributes]], [[Module]]: _result_.[[Value]] } to _referrer_.[[LoadedModules]].
1. If _payload_ is a GraphLoadingState Record, then
- 1. Perform ContinueModuleLoading(_payload_, _result_).
+ 1. Perform ContinueModuleLoading(_payload_, _moduleRequest_.[[Phase]], _result_).
1. Else,
- 1. Perform ContinueDynamicImport(_payload_, _result_).
+ 1. Perform ContinueDynamicImport(_payload_, _moduleRequest_.[[Phase]], _result_).
1. Return ~unused~.
+
+
+ HostGetModuleSourceName (
+ _moduleSource_: an Object,
+ ): either a normal completion containing a String or a throw completion
+
+
+
+ An implementation of HostGetModuleSourceName must conform to the following requirements:
+
+ -
+ For any object that is a Module Source Object, returns a normal completion for a String corresponding to the source record type to be used as the strongly branded return value of the @@toStringTag getter on %AbstractModuleSource%.
+
+ -
+ For any object which is not a Module Source Object, returns a throw completion.
+
+
+
+
+
+
+ AllImportAttributesSupported (
+ _attributes_: a List of ImportAttribute Records,
+ ): a Boolean
+
+
+
+ 1. Let _supported_ be HostGetSupportedImportAttributes().
+ 1. For each ImportAttribute Record _attribute_ of _attributes_, do
+ 1. If _supported_ does not contain _attribute_.[[Key]], return *false*.
+ 1. Return *true*.
+
+
+
+ HostGetSupportedImportAttributes ( ): a List of Strings
+
+
+ An implementation of HostGetSupportedImportAttributes must conform to the following requrements:
+
+
+ - It must return a List of Strings, each indicating a supported attribute.
+
+ - Each time this operation is called, it must return the same List with the same contents in the same order.
+
+
+ The default implementation of HostGetSupportedImportAttributes is to return a new empty List.
+
+ The purpose of requiring the host to specify its supported import attributes, rather than passing all attributes to the host and letting it then choose which ones it wants to handle, is to ensure that unsupported attributes are handled in a consistent way across different hosts.
+
+
+
GetModuleNamespace (
@@ -28401,8 +28799,9 @@ Imports
Syntax
ImportDeclaration :
- `import` ImportClause FromClause `;`
- `import` ModuleSpecifier `;`
+ `import` ImportClause FromClause WithClause? `;`
+ `import` ModuleSpecifier WithClause? `;`
+ `import` `source` ImportedBinding FromClause WithClause? `;`
ImportClause :
ImportedDefaultBinding
@@ -28438,6 +28837,18 @@ Syntax
ImportedBinding :
BindingIdentifier[~Yield, +Await]
+
+ WithClause :
+ `with` `{` `}`
+ `with` `{` WithEntries `,`? `}`
+
+ WithEntries :
+ AttributeKey `:` StringLiteral
+ AttributeKey `:` StringLiteral `,` WithEntries
+
+ AttributeKey :
+ IdentifierName
+ StringLiteral
@@ -28448,6 +28859,13 @@ Static Semantics: Early Errors
It is a Syntax Error if the BoundNames of |ImportDeclaration| contains any duplicate entries.
+
+ WithClause : `with` `{` WithEntries `,`? `}`
+
+ -
+ It is a Syntax Error if WithClauseToAttributes of |WithClause| has two different entries _a_ and _b_ such that _a_.[[Key]] is _b_.[[Key]].
+
+
@@ -28472,21 +28890,28 @@ Static Semantics: ImportEntries ( ): a List of ImportEntry Records
1. Return a new empty List.
- ImportDeclaration : `import` ImportClause FromClause `;`
+ ImportDeclaration : `import` ImportClause FromClause WithClause? `;`
- 1. Let _module_ be the sole element of the ModuleRequests of |FromClause|.
+ 1. Let _module_ be the sole element of the ModuleRequests of |ImportDeclaration|.
1. Return the ImportEntriesForModule of |ImportClause| with argument _module_.
- ImportDeclaration : `import` ModuleSpecifier `;`
+ ImportDeclaration : `import` ModuleSpecifier WithClause? `;`
1. Return a new empty List.
+ ImportDeclaration : `import` `source` ImportedBinding FromClause WithClause? `;`
+
+ 1. Let _module_ be the sole element of the ModuleRequests of |ImportDeclaration|.
+ 1. Let _localName_ be the sole element of BoundNames of |ImportedBinding|.
+ 1. Let _entry_ be the ImportEntry Record { [[ModuleRequest]]: _module_, [[ImportName]]: ~source~, [[LocalName]]: _localName_ }.
+ 1. Return « _entry_ ».
+
Static Semantics: ImportEntriesForModule (
- _module_: a String,
+ _module_: a ModuleRequest Record,
): a List of ImportEntry Records
+
+
+ Static Semantics: WithClauseToAttributes ( ): a List of ImportAttribute Records
+
+
+
+ WithClause : `with` `{` `}`
+
+
+ 1. Return a new empty List.
+
+
+
+ WithClause : `with` `{` WithEntries `,`? `}`
+
+
+ 1. Let _attributes_ be WithClauseToAttributes of |WithEntries|.
+ 1. Sort _attributes_ according to the lexicographic order of their [[Key]] fields, treating the value of each such field as a sequence of UTF-16 code unit values. NOTE: This sorting is observable only in that hosts are prohibited from changing behaviour based on the order in which attributes are enumerated.
+ 1. Return _attributes_.
+
+
+ WithEntries : AttributeKey `:` StringLiteral
+
+ 1. Let _key_ be the PropName of |AttributeKey|.
+ 1. Let _entry_ be the ImportAttribute Record { [[Key]]: _key_, [[Value]]: the SV of |StringLiteral| }.
+ 1. Return « _entry_ ».
+
+
+ WithEntries : AttributeKey `:` StringLiteral `,` WithEntries
+
+ 1. Let _key_ be the PropName of |AttributeKey|.
+ 1. Let _entry_ be the ImportAttribute Record { [[Key]]: _key_, [[Value]]: the SV of |StringLiteral| }.
+ 1. Let _rest_ be WithClauseToAttributes of |WithEntries|.
+ 1. Return the list-concatenation of « _entry_ » and _rest_.
+
+
@@ -28546,7 +29008,7 @@ Exports
Syntax
ExportDeclaration :
- `export` ExportFromClause FromClause `;`
+ `export` ExportFromClause FromClause WithClause? `;`
`export` NamedExports `;`
`export` VariableStatement[~Yield, +Await]
`export` Declaration[~Yield, +Await]
@@ -28610,10 +29072,7 @@ Static Semantics: ExportedBindings ( ): a List of Strings
1. Return a new empty List.
-
- ExportDeclaration :
- `export` ExportFromClause FromClause `;`
-
+ ExportDeclaration : `export` ExportFromClause FromClause WithClause? `;`
1. Return a new empty List.
@@ -28683,7 +29142,7 @@ Static Semantics: ExportedNames ( ): a List of Strings
1. Return a new empty List.
- ExportDeclaration : `export` ExportFromClause FromClause `;`
+ ExportDeclaration : `export` ExportFromClause FromClause WithClause? `;`
1. Return the ExportedNames of |ExportFromClause|.
@@ -28758,9 +29217,9 @@ Static Semantics: ExportEntries ( ): a List of ExportEntry Records
1. Return a new empty List.
- ExportDeclaration : `export` ExportFromClause FromClause `;`
+ ExportDeclaration : `export` ExportFromClause FromClause WithClause? `;`
- 1. Let _module_ be the sole element of the ModuleRequests of |FromClause|.
+ 1. Let _module_ be the sole element of the ModuleRequests of |ExportDeclaration|.
1. Return the ExportEntriesForModule of |ExportFromClause| with argument _module_.
ExportDeclaration : `export` NamedExports `;`
@@ -28808,7 +29267,7 @@ Static Semantics: ExportEntries ( ): a List of ExportEntry Records
Static Semantics: ExportEntriesForModule (
- _module_: a String or *null*,
+ _module_: a ModuleRequest Record or *null*,
): a List of ExportEntry Records
+
+
+ Module Source Objects
+ Module Source Objects represent modules in their source import phase, which are not linked, instantiated or executed.
+ A Module Source Object is an object for which HostGetModuleSourceName returns a normal completion.
+ All Module Source Objects must be initialized with a prototype of %AbstractModuleSource%.prototype.
+ Hosts may define their own %AbstractModuleSource% subclasses for custom module types.
+
+
+ The AbstractModuleSource Constructor
+ The AbstractModuleSource constructor:
+
+ - is %AbstractModuleSource%.
+ - along with its corresponding prototype object, provides common properties that are inherited by Module Source constructors and their instances.
+ - does not have a global name or appear as a property of the global object.
+ - acts as a common superclass of the constructors of Module Source Objects.
+ - will throw an error when invoked, because it is an abstract class constructor. The module source constructors do not perform a `super` call to it.
+
+
+
+ AbstractModuleSource ( )
+ This function performs the following steps when called:
+
+ 1. Throw a *TypeError* exception.
+
+
+
+
+
+ Properties of the %AbstractModuleSource% Intrinsic Object
+ The %AbstractModuleSource% intrinsic object:
+
+ - has a [[Prototype]] internal slot whose value is %Function.prototype%.
+ - has a *"name"* property whose value is *"AbstractModuleSource"*.
+ - has the following properties:
+
+
+
+ %AbstractModuleSource%.prototype
+ The initial value of %AbstractModuleSource%`.prototype` is the %AbstractModuleSource% prototype object.
+ This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }.
+
+
+
+
+ Properties of the %AbstractModuleSource% Prototype Object
+ The %AbstractModuleSource% prototype object:
+
+ - has a [[Prototype]] internal slot whose value is %Object.prototype%.
+ - is %AbstractModuleSource.prototype%.
+ - is an ordinary object.
+ - has the following properties:
+
+
+
+ %AbstractModuleSource%.prototype.constructor
+ The initial value of %AbstractModuleSource%`.prototype.constructor` is %AbstractModuleSource%.
+
+
+
+ get %AbstractModuleSource%.prototype [ @@toStringTag ]
+ %AbstractModuleSource%.prototype `[@@toStringTag]` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps when called:
+
+ 1. Let _O_ be the *this* value.
+ 1. If _O_ is not an Object, return *undefined*.
+ 1. Let _sourceNameResult_ be Completion(HostGetModuleSourceName(_O_)).
+ 1. If _sourceNameResult_ is an abrupt completion, return *undefined*.
+ 1. Let _name_ be ! _sourceNameResult_.
+ 1. Assert: _name_ is a String.
+ 1. Return _name_.
+
+ This property has the attributes { [[Enumerable]]: *false*, [[Configurable]]: *true* }.
+ The initial value of the *"name"* property of this function is *"get [Symbol.toStringTag]"*.
+
+
+
@@ -50192,6 +50727,9 @@ Scripts and Modules
+
+
+
@@ -51445,9 +51983,11 @@ Host Hooks
HostEnsureCanCompileStrings(...)
HostFinalizeImportMeta(...)
HostGetImportMetaProperties(...)
+ HostGetModuleSourceName(...)
HostGrowSharedArrayBuffer(...)
HostHasSourceTextAvailable(...)
HostLoadImportedModule(...)
+ HostGetSupportedImportAttributes(...)
HostMakeJobCallback(...)
HostPromiseRejectionTracker(...)
HostResizeArrayBuffer(...)