Skip to content

Commit 4305537

Browse files
committed
doc: Further resolver tweaks
1 parent d885678 commit 4305537

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

doc/api/esm.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -869,12 +869,10 @@ The resolver can throw the following errors:
869869
> 1. Throw an _Invalid Module Specifier_ error.
870870
> 7. Let _packageSubpath_ be _"."_ concatenated with the substring of
871871
> _packageSpecifier_ from the position at the length of _packageName_.
872-
> 8. If _packageSubpath_ ends in _"/"_, then
873-
> 1. Throw an _Invalid Module Specifier_ error.
874-
> 9. Let _selfUrl_ be the result of
872+
> 8. Let _selfUrl_ be the result of
875873
> **PACKAGE\_SELF\_RESOLVE**(_packageName_, _packageSubpath_, _parentURL_).
876-
> 10. If _selfUrl_ is not **undefined**, return _selfUrl_.
877-
> 11. While _parentURL_ is not the file system root,
874+
> 9. If _selfUrl_ is not **undefined**, return _selfUrl_.
875+
> 10. While _parentURL_ is not the file system root,
878876
> 1. Let _packageURL_ be the URL resolution of _"node\_modules/"_
879877
> concatenated with _packageName_, relative to _parentURL_.
880878
> 2. Set _parentURL_ to the parent folder URL of _parentURL_.
@@ -890,7 +888,7 @@ The resolver can throw the following errors:
890888
> 1. Return the URL resolution of _main_ in _packageURL_.
891889
> 7. Otherwise,
892890
> 1. Return the URL resolution of _packageSubpath_ in _packageURL_.
893-
> 12. Throw a _Module Not Found_ error.
891+
> 11. Throw a _Module Not Found_ error.
894892
895893
**PACKAGE\_SELF\_RESOLVE**(_packageName_, _packageSubpath_, _parentURL_)
896894
@@ -908,6 +906,8 @@ The resolver can throw the following errors:
908906
909907
**PACKAGE\_EXPORTS\_RESOLVE**(_packageURL_, _subpath_, _exports_, _conditions_)
910908
909+
Note: This function is directly invoked by the CommonJS resolution algorithm.
910+
911911
> 1. If _exports_ is an Object with both a key starting with _"."_ and a key not
912912
> starting with _"."_, throw an _Invalid Package Configuration_ error.
913913
> 2. If _subpath_ is equal to _"."_, then
@@ -931,6 +931,8 @@ The resolver can throw the following errors:
931931
932932
**PACKAGE\_IMPORTS\_RESOLVE**(_specifier_, _parentURL_, _conditions_)
933933
934+
Note: This function is directly invoked by the CommonJS resolution algorithm.
935+
934936
> 1. Assert: _specifier_ begins with _"#"_.
935937
> 2. If _specifier_ is exactly equal to _"#"_ or starts with _"#/"_, then
936938
> 1. Throw an _Invalid Module Specifier_ error.
@@ -947,15 +949,16 @@ The resolver can throw the following errors:
947949
**PACKAGE\_IMPORTS\_EXPORTS\_RESOLVE**(_matchKey_, _matchObj_, _packageURL_,
948950
_isImports_, _conditions_)
949951
950-
> 1. If _matchKey_ is a key of _matchObj_, does not contain _"\*"_, and does not
951-
> end with _"/"_ then
952+
> 1. If _matchKey_ ends in _"/"_, then
953+
> 1. Throw an _Invalid Module Specifier_ error.
954+
> 2. If _matchKey_ is a key of _matchObj_ and does not contain _"\*"_, then
952955
> 1. Let _target_ be the value of _matchObj_\[_matchKey_].
953956
> 2. Return the result of **PACKAGE\_TARGET\_RESOLVE**(_packageURL_,
954957
> _target_, **null**, _isImports_, _conditions_).
955-
> 2. Let _expansionKeys_ be the list of keys of _matchObj_ containing only a
958+
> 3. Let _expansionKeys_ be the list of keys of _matchObj_ containing only a
956959
> single _"\*"_, sorted by the sorting function **PATTERN\_KEY\_COMPARE**
957960
> which orders in descending order of specificity.
958-
> 3. For each key _expansionKey_ in _expansionKeys_, do
961+
> 4. For each key _expansionKey_ in _expansionKeys_, do
959962
> 1. Let _patternBase_ be the substring of _expansionKey_ up to but excluding
960963
> the first _"\*"_ character.
961964
> 2. If _matchKey_ starts with but is not equal to _patternBase_, then
@@ -970,7 +973,7 @@ _isImports_, _conditions_)
970973
> _matchKey_ minus the length of _patternTrailer_.
971974
> 3. Return the result of **PACKAGE\_TARGET\_RESOLVE**(_packageURL_,
972975
> _target_, _patternMatch_, _isImports_, _conditions_).
973-
> 4. Return **null**.
976+
> 5. Return **null**.
974977
975978
**PATTERN\_KEY\_COMPARE**(_keyA_, _keyB_)
976979

0 commit comments

Comments
 (0)