?um/p1-90`super이면, super를 contain하는 source text가 super에 대한 additional The
Script Record는 evaluating되고 있는 script에 대한 information을 encapsulate합니다. 각 script record는
| Field Name | Value Type | Meaning |
|---|---|---|
| [[Realm]] |
a |
이 script가 created된 |
| [[ECMAScriptCode]] |
a |
이 script의 source text를 parsing한 result입니다. |
| [[LoadedModules]] |
a |
이 script에 의해 imported된 specifier string에서 resolved |
| [[HostDefined]] |
anything (default value is |
script와 additional information을 associate해야 하는 |
The abstract operation ParseScript takes arguments sourceText (a String or a sequence of Unicode code points), realm (a
implementation은 해당 script source text에 대해 ParseScript를 evaluation하기 전에 script source text를 parse하고 Early Error condition에 대해 analyse할 수 있습니다. 그러나 any error의 reporting은 이 specification이 실제로 해당 source text에 대해 ParseScript를 수행하는 point까지 deferred되어야 합니다.
The abstract operation ScriptEvaluation takes argument scriptRecord (a
The abstract operation GlobalDeclarationInstantiation takes arguments script (a
script를 evaluating하기 위해
called될 때 다음 step을 수행합니다:
var 및 function 바인딩은 non-strict explicit var 또는 function declaration과 달리,
super이면 Syntax Error입니다.
duplicate export default
The abstract operation ImportedLocalNames takes argument importEntries (a
ModuleRequest Record는 given import attribute와 함께 module을 import하려는 request를 represent합니다. 이는 다음 field로 구성됩니다:
| Field Name | Value Type | Meaning |
|---|---|---|
| [[Specifier]] | a String | module specifier입니다. |
| [[Attributes]] |
a |
import attribute입니다. |
LoadedModuleRequest Record는 resulting
| Field Name | Value Type | Meaning |
|---|---|---|
| [[Specifier]] | a String | module specifier입니다. |
| [[Attributes]] |
a |
import attribute입니다. |
| [[Module]] |
a |
이 module request에 corresponding하는 loaded module입니다. |
ImportAttribute Record는 다음 field로 구성됩니다:
| Field Name | Value Type | Meaning |
|---|---|---|
| [[Key]] | a String | attribute key입니다. |
| [[Value]] | a String | attribute value입니다. |
The abstract operation ModuleRequestsEqual takes arguments x (a
The
Module Record는 single module의 import와 export에 대한 structural information을 encapsulate합니다. 이 information은 connected module의 set의 import와 export를 link하는 데 사용됩니다. Module Record는 module을 evaluating할 때만 사용되는 네 개의 field를 include합니다.
specification 목적상 Module Record value는
Module Record는
| Field Name | Value Type | Meaning |
|---|---|---|
| [[Realm]] |
a |
이 module이 created된 |
| [[Environment]] |
a |
이 module의 top level binding을 contain하는 |
| [[Namespace]] |
an Object or |
이 module에 대해 created된 경우의 Module Namespace Object( |
| [[HostDefined]] |
anything (default value is |
module과 additional information을 associate해야 하는 |
| Method | Purpose | Definitions |
|---|---|---|
| LoadRequestedModules ( [ hostDefined ] ) | The abstract method LoadRequestedModules takes optional argument hostDefined (anything) and returns a Promise. 모든 dependency를 recursively loading하여 linking을 위해 module을 prepare합니다. |
이 specification 안에서는 다음 type에 definition이 있습니다; |
| GetExportedNames ( [ exportStarSet ] ) | The abstract method GetExportedNames takes optional argument exportStarSet (a 이 module에서 directly 또는 indirectly exported되는 모든 name의 list를 반환합니다. 이 method를 invoking하기 전에 |
이 specification 안에서는 다음 type에 definition이 있습니다; |
| ResolveExport ( exportName [ , resolveSet ] ) | The abstract method ResolveExport takes argument exportName (a String) and optional argument resolveSet (a 이 module이 exported한 name의 binding을 반환합니다. Binding은 { [[Module]]: 이 operation이 specific exportName, resolveSet pair를 argument로 하여 called될 때마다 same result를 반환해야 합니다. 이 method를 invoking하기 전에 |
이 specification 안에서는 다음 type에 definition이 있습니다; |
| Link ( ) | The abstract method Link takes no arguments and returns either a 모든 module dependency를 transitively resolving하고 이 method를 invoking하기 전에 |
이 specification 안에서는 다음 type에 definition이 있습니다; |
| Evaluate ( ) | The abstract method Evaluate takes no arguments and returns a Promise. 이 module 및 그 dependency의 evaluation을 위한 promise를 반환하며, successful evaluation 또는 이미 successfully evaluated된 경우 resolve하고, evaluation error 또는 이미 unsuccessfully evaluated된 경우 reject합니다. promise가 rejected되면, 이 method를 invoking하기 전에 |
이 specification 안에서는 다음 type에 definition이 있습니다; |
The abstract operation EvaluateModuleSync takes argument module (a
Cyclic Module Record는
| Field Name | Value Type | Meaning |
|---|---|---|
| [[Status]] |
|
Initially |
| [[EvaluationError]] |
a |
evaluation 중에 occurred한 exception을 represent하는 |
| [[DFSAncestorIndex]] |
an |
|
| [[RequestedModules]] |
a |
이 module 안의 import와 associated된 |
| [[LoadedModules]] |
a |
이 record가 represented하는 module이 relative import attribute와 함께 module importation을 request하기 위해 사용한 specifier string에서 resolved |
| [[CycleRoot]] |
a |
cycle의 first visited module, strongly connected component의 root DFS ancestor입니다. cycle 안에 있지 않은 module의 경우, 이는 module 자체일 것입니다. |
| [[HasTLA]] | a Boolean |
이 module이 individually asynchronous인지 여부입니다(예를 들어 top-level await를 contain하는 |
| [[AsyncEvaluationOrder]] |
|
이 field는 initially |
| [[TopLevelCapability]] |
a |
이 module이 어떤 cycle의 [[CycleRoot]]이고, |
| [[AsyncParentModules]] |
a |
이 module 또는 dependency가 [[HasTLA]] |
| [[PendingAsyncDependencies]] |
an |
이 module이 asynchronous dependency를 가진 경우, 이 module을 위해 execute될 remaining asynchronous dependency module의 수를 track합니다. asynchronous dependency를 가진 module은 이 field가 0에 reach하고 execution error가 없을 때 executed됩니다. |
| Method | Purpose | Definitions |
|---|---|---|
| InitializeEnvironment ( ) | The abstract method InitializeEnvironment takes no arguments and returns either a |
이 specification 안에서는 다음 type에 definition이 있습니다; |
| ExecuteModule ( [ capability ] ) | The abstract method ExecuteModule takes optional argument capability (a |
이 specification 안에서는 다음 type에 definition이 있습니다; |
GraphLoadingState Record는 module graph의 loading process에 대한 information을 contain하는
| Field Name | Value Type | Meaning |
|---|---|---|
| [[PromiseCapability]] |
a |
loading process가 finish될 때 resolve할 promise입니다. |
| [[IsLoading]] | a Boolean | loading process가 아직 successfully도 error로도 finish되지 않은 경우 true입니다. |
| [[PendingModulesCount]] |
a non-negative |
pending |
| [[Visited]] |
a |
circular dependency로 인한 infinite loop를 avoid하기 위해, current loading process에 의해 already loaded된 |
| [[HostDefined]] |
anything (default value is |
|
다음은
The
<link rel="preload" as="..."> tag에 대한 correct fetch destination을 set하는 데 사용됩니다.
import() expression은 hostDefined parameter를 never set하지 않습니다.
The abstract operation InnerModuleLoading takes arguments state (a
The abstract operation ContinueModuleLoading takes arguments state (a
The
The abstract operation InnerModuleLinking takes arguments module (a
The
The abstract operation InnerModuleEvaluation takes arguments module (a
module은 InnerModuleEvaluation에 의해 traversed되는 동안
asynchronous cycle의 module에 depending하는 any module은 that cycle이
The abstract operation ExecuteAsyncModule takes argument module (a
The abstract operation GatherAvailableAncestors takes arguments module (a
root module에 대한 asynchronous execution이 fulfilled될 때, 이 function은 이 completion에서 synchronously execute together할 수 있는 module의 list를 determine하여 execList에 populate합니다.
The abstract operation AsyncModuleExecutionFulfilled takes argument module (a
The abstract operation AsyncModuleExecutionRejected takes arguments module (a
이 non-normative section은 몇 가지 common module graph의 linking 및 evaluation 예제를, error가 어떻게 occur할 수 있는지에 specific focus를 두고 제공합니다.
먼저 다음 simple module graph를 consider하십시오:
먼저 error condition이 없다고 assume합시다.
그 다음 A.
Finally,
이제 다른 type의 error condition을 consider하십시오:
이 scenario에서 module A는 어떤 다른 module에 대한 dependency를 declare하지만, 그 module에 대한
여기서 loading, linking 및 evaluation error 사이의 difference는 다음 characteristic 때문입니다:
이제 cycle을 가진 module graph를 consider하십시오:
여기서는 entry point가 module A라고 assume하므로,
Then
cyclic module graph의 evaluation phase에 대해서도 success case에서는 analogous story가 occur합니다.
이제 A에 linking error가 있는 case를 consider하십시오; 예를 들어, it tries to import a binding from C that does not exist. 이 경우, above step은 still occur하며,
Alternatively, A에 evaluation error가 있는 case를 consider하십시오; 예를 들어, 그 source code가 exception을 throw합니다. 이 경우, evaluation-time analogue of the above step은 still occur하며, await를 contain하거나 depend하는 module을 위해 whole dependency graph를 통해 chain을 form하는 [[AsyncParentModules]]를 통해서도 record합니다. 이는
마지막으로, 모든 module이 asynchronously complete하는 cycle을 가진 module graph를 consider하십시오:
Loading 및 linking은 before와 같이 happen하며, 모든 module은 [[Status]]가
A.
|
Field
|
A | B | C | D | E |
|---|---|---|---|---|---|
| [[DFSAncestorIndex]] | 0 | 0 | 0 | 0 | 4 |
| [[Status]] | |||||
| [[AsyncEvaluationOrder]] | 4 | 1 | 3 | 0 | 2 |
| [[AsyncParentModules]] | « » | « A » | « A » | « B, C » | « C » |
| [[PendingAsyncDependencies]] | 2 (B and C) | 1 (D) | 2 (D and E) | 0 | 0 |
E가 first로 executing을 finish한다고 assume합시다. 그것이 happen하면,
|
Field
|
C | E |
|---|---|---|
| [[DFSAncestorIndex]] | 0 | 4 |
| [[Status]] | ||
| [[AsyncEvaluationOrder]] | 3 | |
| [[AsyncParentModules]] | « A » | « C » |
| [[PendingAsyncDependencies]] | 1 (D) | 0 |
D가 next로 finish합니다(아직 executing 중인 only module이었으므로). 그것이 happen하면, await를 contain하면 potentially in parallel to B). updated module의 field는
|
Field
|
B | C | D |
|---|---|---|---|
| [[DFSAncestorIndex]] | 0 | 0 | 0 |
| [[Status]] | |||
| [[AsyncEvaluationOrder]] | 1 | 3 | |
| [[AsyncParentModules]] | « A » | « A » | « B, C » |
| [[PendingAsyncDependencies]] | 0 | 0 | 0 |
C가 next로 executing을 finish한다고 assume합시다. 그것이 happen하면,
|
Field
|
A | C |
|---|---|---|
| [[DFSAncestorIndex]] | 0 | 0 |
| [[Status]] | ||
| [[AsyncEvaluationOrder]] | 4 | |
| [[AsyncParentModules]] | « » | « A » |
| [[PendingAsyncDependencies]] | 1 (B) | 0 |
Then, B가 executing을 finish합니다. 그것이 happen하면,
|
Field
|
A | B |
|---|---|---|
| [[DFSAncestorIndex]] | 0 | 0 |
| [[Status]] | ||
| [[AsyncEvaluationOrder]] | 4 | |
| [[AsyncParentModules]] | « » | « A » |
| [[PendingAsyncDependencies]] | 0 | 0 |
Finally, A가 executing을 finish합니다. 그것이 happen하면,
|
Field
|
A |
|---|---|
| [[DFSAncestorIndex]] | 0 |
| [[Status]] | |
| [[AsyncEvaluationOrder]] | |
| [[AsyncParentModules]] | « » |
| [[PendingAsyncDependencies]] | 0 |
Alternatively, C가 B가 executing을 finished하기 전에 execution에 fail하고 error를 return하는 failure case를 consider하십시오. 그것이 happen하면,
|
Field
|
A | C |
|---|---|---|
| [[DFSAncestorIndex]] | 0 | 0 |
| [[Status]] | ||
| [[AsyncEvaluationOrder]] | ||
| [[AsyncParentModules]] | « » | « A » |
| [[PendingAsyncDependencies]] | 1 (B) | 0 |
| [[EvaluationError]] | C의 evaluation error |
C가 C의 error와 함께 A에 대해
|
Field
|
A |
|---|---|
| [[DFSAncestorIndex]] | 0 |
| [[Status]] | |
| [[AsyncEvaluationOrder]] | |
| [[AsyncParentModules]] | « » |
| [[PendingAsyncDependencies]] | 0 |
| [[EvaluationError]] | C의 |
Then, B가 error 없이 executing을 finish합니다. 그것이 happen하면,
|
Field
|
A | B |
|---|---|---|
| [[DFSAncestorIndex]] | 0 | 0 |
| [[Status]] | ||
| [[AsyncEvaluationOrder]] | 4 | 1 |
| [[AsyncParentModules]] | « » | « A » |
| [[PendingAsyncDependencies]] | 0 | 0 |
| [[EvaluationError]] | C의 |
Source Text Module Record는
| Field Name | Value Type | Meaning |
|---|---|---|
| [[ECMAScriptCode]] |
a |
|
| [[Context]] |
an |
이 module과 associated된 |
| [[ImportMeta]] |
an Object or |
import.meta meta property를 통해 exposed되는 object입니다. ECMAScript code에 의해 accessed될 때까지 |
| [[ImportEntries]] |
a |
이 module의 code에서 derived된 ImportEntry record의 |
| [[LocalExportEntries]] |
a |
module 안에서 occur하는 declaration에 corresponding하는, 이 module의 code에서 derived된 ExportEntry record의 |
| [[IndirectExportEntries]] |
a |
module 안에서 occur하는 reexported import 또는 export * as namespace declaration에서의 export에 corresponding하는, 이 module의 code에서 derived된 ExportEntry record의 |
| [[StarExportEntries]] |
a |
module 안에서 occur하는 export * declaration에 corresponding하는, 이 module의 code에서 derived된 ExportEntry record의 export * as namespace declaration은 include하지 않습니다.
|
ImportEntry Record는 single declarative import에 대한 information을 digest하는
| Field Name | Value Type | Meaning |
|---|---|---|
| [[ModuleRequest]] |
a |
|
| [[ImportName]] |
a String or |
[[ModuleRequest]]가 identified하는 module에 의해 desired binding이 exported되는 name입니다. value |
| [[LocalName]] | a String | importing module 안에서 imported value에 locally access하는 데 사용되는 name입니다. |
| Import Statement Form | [[ModuleRequest]] | [[ImportName]] | [[LocalName]] |
|---|---|---|---|
import v from "mod";
|
|
|
|
import * as ns from "mod";
|
|
|
|
import {x} from "mod";
|
|
|
|
import {x as v} from "mod";
|
|
|
|
import "mod";
|
|
||
ExportEntry Record는 single declarative export에 대한 information을 digest하는
| Field Name | Value Type | Meaning |
|---|---|---|
| [[ExportName]] |
a String or |
이 module이 이 binding을 export하는 데 사용하는 name입니다. |
| [[ModuleRequest]] |
a |
|
| [[ImportName]] |
a String, |
[[ModuleRequest]]가 identified하는 module에 의해 desired binding이 exported되는 name입니다. export * as ns from "mod" declaration에 사용됩니다. export * from "mod" declaration에 사용됩니다.
|
| [[LocalName]] |
a String or |
importing module 안에서 exported value에 locally access하는 데 사용되는 name입니다. exported value가 module 안에서 locally accessible하지 않으면 |
| Export Statement Form | [[ExportName]] | [[ModuleRequest]] | [[ImportName]] | [[LocalName]] |
|---|---|---|---|---|
export var v;
|
|
|
|
|
export default function f() {}
|
|
|
|
|
export default function () {}
|
|
|
|
|
export default 42;
|
|
|
|
|
export {x};
|
|
|
|
|
export {v as x};
|
|
|
|
|
export {x} from "mod";
|
|
|
|
|
export {v as x} from "mod";
|
|
|
|
|
export * from "mod";
|
|
|
|
|
export * as ns from "mod";
|
|
|
|
|
다음 definition은
The abstract operation ParseModule takes arguments sourceText (a String or a sequence of Unicode code points), realm (a
export * from을 통해 같은 이름으로 같은 바인딩 또는 namespace를 두 번 내보내면서 발생하는 충돌이 await라고 하자.implementation은 해당 module source text에 대한 ParseModule의 evaluation 전에 module source text를 parse하고 Early Error condition에 대해 analyse할 수 있습니다. 그러나 any error의 reporting은 이 specification이 실제로 해당 source text에 대해 ParseModule을 수행하는 point까지 deferred되어야 합니다.
다음은
The
The
defining module이 found되면,
It performs the following steps when called:
* export가 둘 이상 있다.다음은
The
The
Synthetic Module Record는 specification에 의해 defined된 module에 대한 information을 represent하는 데 사용됩니다. 그 exported name은 creation 시 statically defined되며, 그 corresponding value는
| Field Name | Value Type | Meaning |
|---|---|---|
| [[ExportNames]] | a |
module의 export name입니다. 이 list는 duplicate를 contain하지 않습니다. |
| [[EvaluationSteps]] | an |
module의 evaluation 시 수행할 initialization logic이며, |
The abstract operation CreateDefaultExportSyntheticModule takes argument defaultExport (an
The abstract operation ParseJSONModule takes argument source (a String) and returns either a
The abstract operation SetSyntheticModuleExport takes arguments module (a
다음은
The
The
The
The
The
The abstract operation GetImportedModule takes arguments referrer (a
The
referrer가
<button type="button" onclick="import('./foo.mjs')">Click me</button>
import()
HostLoadImportedModule의 implementation은 다음 requirements에 conform해야 합니다:
이 operation이 다음을 만족하는 두 (referrer, moduleRequest) pair로 multiple times called되면:
그리고 result가
moduleRequest.[[Attributes]]가 entry.[[Key]]가
performed되는 actual process는
The abstract operation FinishLoadingImportedModule takes arguments referrer (a
The abstract operation AllImportAttributesSupported takes argument attrs (a
The
HostGetSupportedImportAttributes의 implementation은 다음 requirements에 conform해야 합니다:
HostGetSupportedImportAttributes의 default implementation은 새 empty
The abstract operation GetModuleNamespace takes argument module (an instance of a concrete subclass of
GetModuleNamespace는 never throws. 대신 unresolvable name은 이 point에서 simply namespace에서 excluded됩니다. 그것들이 explicitly requested되지 않는 ambiguous star export뿐인 경우가 아니면, later에 real linking error로 이어질 것입니다.
The
The
The
above rule은
The
ExportedBindings는
It is defined piecewise over the following productions:
The
ExportedNames는
It is defined piecewise over the following productions:
The
The
The