diff --git a/spec.html b/spec.html index 4b3f04c202..feab4a0f1a 100644 --- a/spec.html +++ b/spec.html @@ -3232,6 +3232,16 @@

Well-Known Intrinsic Objects

ECMAScript Language Association + + + %AbstractModuleSource% + + + + + The %AbstractModuleSource% constructor () + + %AggregateError% @@ -18754,6 +18764,7 @@

Syntax

ImportCall[Yield, Await] : `import` `(` AssignmentExpression[+In, ?Yield, ?Await] `)` + `import` `.` `source` `(` AssignmentExpression[+In, ?Yield, ?Await] `)` Arguments[Yield, Await] : `(` `)` @@ -19316,21 +19327,42 @@

Runtime Semantics: Evaluation

ImportCall : `import` `(` AssignmentExpression `)` - 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 _promiseCapability_ be ! NewPromiseCapability(%Promise%). - 1. Let _specifierString_ be Completion(ToString(_specifier_)). - 1. IfAbruptRejectPromise(_specifierString_, _promiseCapability_). - 1. Perform HostLoadImportedModule(_referrer_, _specifierString_, ~empty~, _promiseCapability_). - 1. Return _promiseCapability_.[[Promise]]. + 1. Return ? EvaluateImportCall(|AssignmentExpression|, ~evaluation~). + + + ImportCall : `import` `.` `source` `(` AssignmentExpression `)` + + 1. Return ? EvaluateImportCall(|AssignmentExpression|, ~source~). + +

+ EvaluateImportCall ( + _specifierExpression_: a Parse Node, + _phase_: ~source~ or ~evaluation~, + ): 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 _specifierRef_ be ? Evaluation of _specifierExpression_. + 1. Let _specifier_ be ? GetValue(_specifierRef_). + 1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%). + 1. Let _specifierString_ be Completion(ToString(_specifier_)). + 1. IfAbruptRejectPromise(_specifierString_, _promiseCapability_). + 1. Let _moduleRequest_ be a new ModuleRequest Record { [[Specifier]]: _specifierString_, [[Phase]]: _phase_ }. + 1. Perform HostLoadImportedModule(_referrer_, _moduleRequest_, ~empty~, _promiseCapability_). + 1. Return _promiseCapability_.[[Promise]]. + +
+

ContinueDynamicImport ( _promiseCapability_: a PromiseCapability Record, + _phase_: ~source~ or ~evaluation~, _moduleCompletion_: either a normal completion containing a Module Record or a throw completion, ): ~unused~

@@ -19343,6 +19375,13 @@

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 _moduleSourceCompletion_ be Completion(_module_.GetModuleSource()). + 1. If _moduleSourceCompletion_ is an abrupt completion, then + 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _moduleSourceCompletion_.[[Value]] »). + 1. Else, + 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « _moduleSourceCompletion_.[[Value]] »). + 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_ »). @@ -25895,8 +25934,52 @@

+ +

ModuleRequest Records

+

A ModuleRequest Record represents a request to import a module up to a given phase. It consists of the following fields:

+ + + + + + + + + + + + + + + + + +
+ Field Name + + Value Type + + Meaning +
+ [[Specifier]] + + String + + The module specifier +
+ [[Phase]] + + ~source~ or ~evaluation~ + + The target import phase +
+
+ + In general, this proposal replaces places where module specifiers are passed around with ModuleRequest Records. For example, several syntax-directed operations, such as ModuleRequests produce Lists of ModuleRequest Records rather than Lists of Strings which are interpreted as module specifiers. Some algorithms like ImportEntries and ImportEntriesForModule pass around ModuleRequest Records rather than Strings, in a way which doesn't require any particular textual change. Additionally, record fields in Cyclic Module Records and Source Text Module Records which contained Lists of Strings are replaced by Lists of ModuleRequest Records, as indicated above. +
+ -

Static Semantics: ModuleRequests ( ): a List of Strings

+

Static Semantics: ModuleRequests ( ): a List of ModuleRequest Records

Module : [empty] @@ -25909,12 +25992,17 @@

Static Semantics: ModuleRequests ( ): a List of Strings

ModuleItemList : ModuleItemList ModuleItem - 1. Let _moduleNames_ be ModuleRequests of |ModuleItemList|. - 1. Let _additionalNames_ be ModuleRequests of |ModuleItem|. - 1. For each String _name_ of _additionalNames_, do - 1. If _moduleNames_ does not contain _name_, then - 1. Append _name_ to _moduleNames_. - 1. Return _moduleNames_. + 1. Let _requests_ be ModuleRequests of |ModuleItemList|. + 1. Let _additionalRequests_ be ModuleRequests of |ModuleItem|. + 1. For each ModuleRequest Record _mr_ of _additionalRequests_, do + 1. Let _found_ be *false*. + 1. For each ModuleRequest Record _mr2_ of _requests_, do + 1. If _mr_.[[Specifier]] is _mr2_.[[Specifier]] and _mr_.[[Phase]] is _mr2_.[[Phase]], then + 1. Assert: _found_ is *false*. + 1. Set _found_ to *true*. + 1. If _found_ is *false*, then + 1. Append _mr_ to _requests_. + 1. Return _requests_. ModuleItem : StatementListItem @@ -25922,17 +26010,20 @@

Static Semantics: ModuleRequests ( ): a List of Strings

ImportDeclaration : `import` ImportClause FromClause `;` - 1. Return ModuleRequests of |FromClause|. + 1. Let _specifier_ be SV of |FromClause|. + 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Phase]]: ~evaluation~ }. - ModuleSpecifier : StringLiteral + ImportDeclaration : `import` `source` ImportedBinding FromClause `;` - 1. Return a List whose sole element is the SV of |StringLiteral|. + 1. Let _specifier_ be SV of |FromClause|. + 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Phase]]: ~source~ }. ExportDeclaration : `export` ExportFromClause FromClause `;` - 1. Return the ModuleRequests of |FromClause|. + 1. Let _specifier_ be SV of |FromClause|. + 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Phase]]: ~evaluation~ }. ExportDeclaration : @@ -26024,6 +26115,17 @@

Abstract Module Records

Purpose + + + GetModuleSource() + + +

It returns either a normal completion containing the Module Source Object corresponding to this source Module Record's source phase (), or a throw completion.

+

When called multiple times on the same Module Record, if GetModuleSource() returns a normal completion it must always return a normal completion containing the same object.

+

The returned object should be an instance of a subclass of %AbstractModuleSource%, and it must have an internal slot [[ModuleSourceClassName]].

+

For Module Records that do not have a source representation, GetModuleSource() must always return a throw completion whose [[Value]] is a *ReferenceError*.

+ + LoadRequestedModules( [ _hostDefined_ ] ) @@ -26139,10 +26241,10 @@

Cyclic Module Records

[[RequestedModules]] - a List of Strings + a List of ModuleRequest Records - A List of all the |ModuleSpecifier| strings used by the module represented by this record to request the importation of a module. The List is in source text occurrence order. + A List of all the |ModuleSpecifier| strings used by the module represented by this record to request the importation of a module, along with their associated phase (~source~ or ~evaluation~). The List is in source text occurrence order. @@ -26344,7 +26446,7 @@

1. If _hostDefined_ is not present, let _hostDefined_ be ~empty~. 1. Let _pc_ be ! NewPromiseCapability(%Promise%). 1. Let _state_ be the GraphLoadingState Record { [[IsLoading]]: *true*, [[PendingModulesCount]]: 1, [[Visited]]: « », [[PromiseCapability]]: _pc_, [[HostDefined]]: _hostDefined_ }. - 1. Perform InnerModuleLoading(_state_, _module_). + 1. Perform InnerModuleLoading(_state_, _module_, ~recursive-load~). 1. Return _pc_.[[Promise]]. @@ -26358,6 +26460,7 @@

InnerModuleLoading ( _state_: a GraphLoadingState Record, _module_: a Module Record, + _loadType_: ~single~ or ~recursive-load~, ): ~unused~

@@ -26367,14 +26470,15 @@

1. Assert: _state_.[[IsLoading]] is *true*. - 1. If _module_ is a Cyclic Module Record, _module_.[[Status]] is ~new~, and _state_.[[Visited]] does not contain _module_, then + 1. If _loadType_ is ~recursive-load~, _module_ is a Cyclic Module Record, _module_.[[Status]] is ~new~, and _state_.[[Visited]] does not contain _module_, then 1. Append _module_ to _state_.[[Visited]]. 1. Let _requestedModulesCount_ be the number of elements in _module_.[[RequestedModules]]. 1. Set _state_.[[PendingModulesCount]] to _state_.[[PendingModulesCount]] + _requestedModulesCount_. - 1. For each String _required_ of _module_.[[RequestedModules]], do - 1. If _module_.[[LoadedModules]] contains a Record whose [[Specifier]] is _required_, then + 1. For each ModuleRequest Record _required_ of _module_.[[RequestedModules]], do + 1. If _module_.[[LoadedModules]] contains a Record whose [[Specifier]] is _required_.[[Specifier]], then 1. Let _record_ be that Record. - 1. Perform InnerModuleLoading(_state_, _record_.[[Module]]). + 1. If _required_.[[Phase]] is ~source~, let _innerLoadType_ be ~single~; otherwise let _innerLoadType_ be ~recursive-load~. + 1. Perform InnerModuleLoading(_state_, _record_.[[Module]], _innerLoadType_). 1. Else, 1. Perform HostLoadImportedModule(_module_, _required_, _state_.[[HostDefined]], _state_). 1. NOTE: HostLoadImportedModule will call FinishLoadingImportedModule, which re-enters the graph loading process through ContinueModuleLoading. @@ -26394,6 +26498,7 @@

ContinueModuleLoading ( _state_: a GraphLoadingState Record, + _phase_: ~source~ or ~evaluation~, _moduleCompletion_: either a normal completion containing a Module Record or a throw completion, ): ~unused~

@@ -26405,7 +26510,8 @@

1. If _state_.[[IsLoading]] is *false*, return ~unused~. 1. If _moduleCompletion_ is a normal completion, then - 1. Perform InnerModuleLoading(_state_, _moduleCompletion_.[[Value]]). + 1. If _phase_ is ~source~, let _loadType_ be ~single~; otherwise let _loadType_ be ~recursive-load~. + 1. Perform InnerModuleLoading(_state_, _moduleCompletion_.[[Value]], _loadType_). 1. Else, 1. Set _state_.[[IsLoading]] to *false*. 1. Perform ! Call(_state_.[[PromiseCapability]].[[Reject]], *undefined*, « _moduleCompletion_.[[Value]] »). @@ -26464,14 +26570,15 @@

1. Set _module_.[[DFSAncestorIndex]] to _index_. 1. Set _index_ to _index_ + 1. 1. Append _module_ to _stack_. - 1. For each String _required_ of _module_.[[RequestedModules]], do - 1. Let _requiredModule_ be GetImportedModule(_module_, _required_). - 1. Set _index_ to ? InnerModuleLinking(_requiredModule_, _stack_, _index_). - 1. If _requiredModule_ is a Cyclic Module Record, then - 1. Assert: _requiredModule_.[[Status]] is one of ~linking~, ~linked~, ~evaluating-async~, or ~evaluated~. - 1. Assert: _requiredModule_.[[Status]] is ~linking~ if and only if _stack_ contains _requiredModule_. - 1. If _requiredModule_.[[Status]] is ~linking~, then - 1. Set _module_.[[DFSAncestorIndex]] to min(_module_.[[DFSAncestorIndex]], _requiredModule_.[[DFSAncestorIndex]]). + 1. For each ModuleRequest Record _required_ of _module_.[[RequestedModules]], do + 1. If _required_.[[Phase]] is ~evaluation~, then + 1. Let _requiredModule_ be GetImportedModule(_module_, _required_.[[Specifier]]). + 1. Set _index_ to ? InnerModuleLinking(_requiredModule_, _stack_, _index_). + 1. If _requiredModule_ is a Cyclic Module Record, then + 1. Assert: _requiredModule_.[[Status]] is one of ~linking~, ~linked~, ~evaluating-async~, or ~evaluated~. + 1. Assert: _requiredModule_.[[Status]] is ~linking~ if and only if _stack_ contains _requiredModule_. + 1. If _requiredModule_.[[Status]] is ~linking~, then + 1. Set _module_.[[DFSAncestorIndex]] to min(_module_.[[DFSAncestorIndex]], _requiredModule_.[[DFSAncestorIndex]]). 1. Perform ? _module_.InitializeEnvironment(). 1. Assert: _module_ occurs exactly once in _stack_. 1. Assert: _module_.[[DFSAncestorIndex]] ≤ _module_.[[DFSIndex]]. @@ -26557,21 +26664,22 @@

1. Set _module_.[[PendingAsyncDependencies]] to 0. 1. Set _index_ to _index_ + 1. 1. Append _module_ to _stack_. - 1. For each String _required_ of _module_.[[RequestedModules]], do - 1. Let _requiredModule_ be GetImportedModule(_module_, _required_). - 1. Set _index_ to ? InnerModuleEvaluation(_requiredModule_, _stack_, _index_). - 1. If _requiredModule_ is a Cyclic Module Record, then - 1. Assert: _requiredModule_.[[Status]] is one of ~evaluating~, ~evaluating-async~, or ~evaluated~. - 1. Assert: _requiredModule_.[[Status]] is ~evaluating~ if and only if _stack_ contains _requiredModule_. - 1. If _requiredModule_.[[Status]] is ~evaluating~, then - 1. Set _module_.[[DFSAncestorIndex]] to min(_module_.[[DFSAncestorIndex]], _requiredModule_.[[DFSAncestorIndex]]). - 1. Else, - 1. Set _requiredModule_ to _requiredModule_.[[CycleRoot]]. - 1. Assert: _requiredModule_.[[Status]] is either ~evaluating-async~ or ~evaluated~. - 1. If _requiredModule_.[[EvaluationError]] is not ~empty~, return ? _requiredModule_.[[EvaluationError]]. - 1. If _requiredModule_.[[AsyncEvaluation]] is *true*, then - 1. Set _module_.[[PendingAsyncDependencies]] to _module_.[[PendingAsyncDependencies]] + 1. - 1. Append _module_ to _requiredModule_.[[AsyncParentModules]]. + 1. For each ModuleRequest Record _required_ of _module_.[[RequestedModules]], do + 1. Let _requiredModule_ be GetImportedModule(_module_, _required_.[[Specifier]]). + 1. If _required_.[[Phase]] is ~evaluation~, then + 1. Set _index_ to ? InnerModuleEvaluation(_requiredModule_, _stack_, _index_). + 1. If _requiredModule_ is a Cyclic Module Record, then + 1. Assert: _requiredModule_.[[Status]] is one of ~evaluating~, ~evaluating-async~, or ~evaluated~. + 1. Assert: _requiredModule_.[[Status]] is ~evaluating~ if and only if _stack_ contains _requiredModule_. + 1. If _requiredModule_.[[Status]] is ~evaluating~, then + 1. Set _module_.[[DFSAncestorIndex]] to min(_module_.[[DFSAncestorIndex]], _requiredModule_.[[DFSAncestorIndex]]). + 1. Else, + 1. Set _requiredModule_ to _requiredModule_.[[CycleRoot]]. + 1. Assert: _requiredModule_.[[Status]] is either ~evaluating-async~ or ~evaluated~. + 1. If _requiredModule_.[[EvaluationError]] is not ~empty~, return ? _requiredModule_.[[EvaluationError]]. + 1. If _requiredModule_.[[AsyncEvaluation]] is *true*, then + 1. Set _module_.[[PendingAsyncDependencies]] to _module_.[[PendingAsyncDependencies]] + 1. + 1. Append _module_ to _requiredModule_.[[AsyncParentModules]]. 1. If _module_.[[PendingAsyncDependencies]] > 0 or _module_.[[HasTLA]] is *true*, then 1. Assert: _module_.[[AsyncEvaluation]] is *false* and was never previously set to *true*. 1. Set _module_.[[AsyncEvaluation]] to *true*. @@ -27261,10 +27369,10 @@

Source Text Module Records

[[ImportName]] - a String or ~namespace-object~ + a String, ~source~, or ~namespace-object~ - The name under which the desired binding is exported by the module identified by [[ModuleRequest]]. The value ~namespace-object~ indicates that the import request is for the target module's namespace object. + The name under which the desired binding is exported by the module identified by [[ModuleRequest]]. The value ~namespace-object~ indicates that the import request is for the target module's namespace object. The value ~source~ represents an import at the source phase. @@ -27668,6 +27776,22 @@

+ +

GetModuleSource ( ): either a normal completion containing an Object or a throw completion

+
+
for
+
a Source Text Module Record _module_
+ +
description
+
+

Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.

+
+
+ + 1. Throw a *ReferenceError* exception. + +
+

GetExportedNames ( @@ -27790,6 +27914,10 @@

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_.GetModuleSource(). + 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. @@ -27893,7 +28021,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~ @@ -27914,24 +28042,31 @@

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_, _moduleRequest_.[[Specifier]]) pair 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.
  • - 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. + 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]]) 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.

+ + +

Implementations may provide unobservable module loading optimizations, such as speculative preloading of modules that are likely to be requested next. When doing so, they must 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~ @@ -27942,14 +28077,14 @@

1. If _result_ is a normal completion, then - 1. If _referrer_.[[LoadedModules]] contains a Record whose [[Specifier]] is _specifier_, then + 1. If _referrer_.[[LoadedModules]] contains a Record whose [[Specifier]] is _moduleRequest_.[[Specifier]], then 1. Assert: That Record's [[Module]] is _result_.[[Value]]. 1. Else, - 1. Append the Record { [[Specifier]]: _specifier_, [[Module]]: _result_.[[Value]] } to _referrer_.[[LoadedModules]]. + 1. Append the Record { [[Specifier]]: _moduleRequest_.[[Specifier]], [[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~.
@@ -28018,6 +28153,7 @@

Syntax

ImportDeclaration : `import` ImportClause FromClause `;` `import` ModuleSpecifier `;` + `import` `source` ImportedBinding FromClause `;` ImportClause : ImportedDefaultBinding @@ -28089,13 +28225,20 @@

Static Semantics: ImportEntries ( ): a List of ImportEntry Records

ImportDeclaration : `import` ImportClause FromClause `;` - 1. Let _module_ be the sole element of ModuleRequests of |FromClause|. + 1. Let _module_ be the SV of |FromClause|. 1. Return ImportEntriesForModule of |ImportClause| with argument _module_. ImportDeclaration : `import` ModuleSpecifier `;` 1. Return a new empty List. + ImportDeclaration : `import` `source` ImportedBinding FromClause `;` + + 1. Let _module_ be the SV of |FromClause|. + 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_ ». +
@@ -46724,6 +46867,80 @@

Proxy.revocable ( _target_, _handler_ )

+ +

Module Source Objects

+

Module Source Objects represent modules in their source import phase, which are not linked, instantiated or executed.

+

All Module Source Objects must define a [[ModuleSourceClassName]] internal slot.

+

All Module Source Objects should have a prototype of %AbstractModuleSource%.prototype.

+

Hosts may define their own %AbstractModuleSource% subclasses for custom module types.

+ + +

The %AbstractModuleSource% Constructor

+

The %AbstractModuleSource% constructor:

+ + + +

%AbstractModuleSource% ( )

+

This function performs the following steps when called:

+ + 1. Throw a *TypeError* exception. + +
+
+ + +

Properties of the %AbstractModuleSource% Intrinsic Object

+

The %AbstractModuleSource% intrinsic object:

+ + + +

%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:

+ + + +

%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. If _O_ does not have a [[ModuleSourceClassName]] internal slot, return *undefined*. + 1. Let _name_ be _O_.[[ModuleSourceClassName]]. + 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]"*.

+
+
+
+

Module Namespace Objects

A Module Namespace Object is a module namespace exotic object that provides runtime property-based access to a module's exported bindings. There is no constructor function for Module Namespace Objects. Instead, such an object is created for each module that is imported by an |ImportDeclaration| that contains a |NameSpaceImport|.