Skip to content

Commit 0a40695

Browse files
committed
doc: esm resolver spec refactoring for deprecations
1 parent 7f2cb44 commit 0a40695

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

doc/api/esm.md

+5-10
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,8 @@ The resolver can throw the following errors:
11071107
> 1. Throw an _Invalid Module Specifier_ error.
11081108
> 1. Let _packageSubpath_ be _"."_ concatenated with the substring of
11091109
> _packageSpecifier_ from the position at the length of _packageName_.
1110+
> 1. If _packageSubpath_ ends in _"/"_, then
1111+
> 1. Throw an _Invalid Module Specifier_ error.
11101112
> 1. Let _selfUrl_ be the result of
11111113
> **PACKAGE_SELF_RESOLVE**(_packageName_, _packageSubpath_, _parentURL_).
11121114
> 1. If _selfUrl_ is not **undefined**, return _selfUrl_.
@@ -1118,18 +1120,15 @@ The resolver can throw the following errors:
11181120
> concatenated with _packageSpecifier_, relative to _parentURL_.
11191121
> 1. Set _parentURL_ to the parent folder URL of _parentURL_.
11201122
> 1. If the folder at _packageURL_ does not exist, then
1121-
> 1. Set _parentURL_ to the parent URL path of _parentURL_.
11221123
> 1. Continue the next loop iteration.
11231124
> 1. Let _pjson_ be the result of **READ_PACKAGE_JSON**(_packageURL_).
11241125
> 1. If _pjson_ is not **null** and _pjson_._exports_ is not **null** or
11251126
> **undefined**, then
1126-
> 1. Let _exports_ be _pjson.exports_.
11271127
> 1. Return the result of **PACKAGE_EXPORTS_RESOLVE**(_packageURL_,
11281128
> _packageSubpath_, _pjson.exports_, _defaultConditions_).
11291129
> 1. Otherwise, if _packageSubpath_ is equal to _"."_, then
1130-
> 1. Return the result of applying the legacy **LOAD_AS_DIRECTORY**
1131-
> CommonJS resolver to _packageURL_, throwing a _Module Not Found_
1132-
> error for no resolution.
1130+
> 1. If _pjson.main_ is a string, then
1131+
> 1. Return the URL resolution of _main_ in _packageURL_.
11331132
> 1. Otherwise,
11341133
> 1. Return the URL resolution of _packageSubpath_ in _packageURL_.
11351134
> 1. Throw a _Module Not Found_ error.
@@ -1150,8 +1149,6 @@ The resolver can throw the following errors:
11501149

11511150
**PACKAGE_EXPORTS_RESOLVE**(_packageURL_, _subpath_, _exports_, _conditions_)
11521151

1153-
> 1. If _subpath_ ends in _"/"_, then
1154-
> 1. Throw an _Invalid Module Specifier_ error.
11551152
> 1. If _exports_ is an Object with both a key starting with _"."_ and a key not
11561153
> starting with _"."_, throw an _Invalid Package Configuration_ error.
11571154
> 1. If _subpath_ is equal to _"."_, then
@@ -1177,8 +1174,7 @@ The resolver can throw the following errors:
11771174
**PACKAGE_IMPORTS_RESOLVE**(_specifier_, _parentURL_, _conditions_)
11781175

11791176
> 1. Assert: _specifier_ begins with _"#"_.
1180-
> 1. If _specifier_ is exactly equal to _"#"_, starts with _"#/"_, or ends in
1181-
> _"/"_, then
1177+
> 1. If _specifier_ is exactly equal to _"#"_ or starts with _"#/"_, then
11821178
> 1. Throw an _Invalid Module Specifier_ error.
11831179
> 1. Let _packageURL_ be the result of **READ_PACKAGE_SCOPE**(_parentURL_).
11841180
> 1. If _packageURL_ is not **null**, then
@@ -1192,7 +1188,6 @@ The resolver can throw the following errors:
11921188
**PACKAGE_IMPORTS_EXPORTS_RESOLVE**(_matchKey_, _matchObj_, _packageURL_,
11931189
_isImports_, _conditions_)
11941190

1195-
> 1. Assert: _matchKey_ does not end in _"/"_.
11961191
> 1. If _matchKey_ is a key of _matchObj_ and does not contain _"*"_, then
11971192
> 1. Let _target_ be the value of _matchObj_\[_matchKey_\].
11981193
> 1. Return the result of **PACKAGE_TARGET_RESOLVE**(_packageURL_, _target_,

0 commit comments

Comments
 (0)