Skip to content

Commit b5aaeaf

Browse files
committed
fixup packageSubpath validations
1 parent 7bbe466 commit b5aaeaf

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

doc/api/esm.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -702,15 +702,15 @@ _isMain_ is **true** when resolving the Node.js application entry point.
702702
> until the second _"/"_ separator or the end of the string.
703703
> 1. If _packageName_ starts with _"."_ or contains _"\\"_ or _"%"_, then
704704
> 1. Throw an _Invalid Specifier_ error.
705-
> 1. Let _packageSubpath_ be the substring of _packageSpecifier_ from the
706-
> position at the length of _packageName_ plus one, if any.
707-
> 1. Assert: _packageName_ is a valid package name or scoped package name.
708-
> 1. Assert: _packageSubpath_ is either empty, or a path without a leading
709-
> separator.
705+
> 1. Let _packageSubpath_ be _undefined_.
706+
> 1. If the length of _packageSpecifier_ is greater than the length of
707+
> _packageName_, then
708+
> 1. Set _packageSubpath_ to _"."_ concatenated with the substring of
709+
> _packageSpecifier_ from the position at the length of _packageName_.
710710
> 1. If _packageSubpath_ contains any _"."_ or _".."_ segments or percent
711711
> encoded strings for _"/"_ or _"\\"_ then,
712712
> 1. Throw an _Invalid Specifier_ error.
713-
> 1. If _packageSubpath_ is empty and _packageName_ is a Node.js builtin
713+
> 1. If _packageSubpath_ is _undefined_ and _packageName_ is a Node.js builtin
714714
> module, then
715715
> 1. Return the string _"node:"_ concatenated with _packageSpecifier_.
716716
> 1. While _parentURL_ is not the file system root,
@@ -721,16 +721,16 @@ _isMain_ is **true** when resolving the Node.js application entry point.
721721
> 1. Set _parentURL_ to the parent URL path of _parentURL_.
722722
> 1. Continue the next loop iteration.
723723
> 1. Let _pjson_ be the result of **READ_PACKAGE_JSON**(_packageURL_).
724-
> 1. If _packageSubpath_ is empty, then
724+
> 1. If _packageSubpath_ is _undefined__, then
725725
> 1. Return the result of **PACKAGE_MAIN_RESOLVE**(_packageURL_,
726726
> _pjson_).
727727
> 1. Otherwise,
728728
> 1. If _pjson_ is not **null** and _pjson_ has an _"exports"_ key, then
729729
> 1. Let _exports_ be _pjson.exports_.
730730
> 1. If _exports_ is not **null** or **undefined**, then
731731
> 1. Return **PACKAGE_EXPORTS_RESOLVE**(_packageURL_,
732-
> _packagePath_, _pjson.exports_).
733-
> 1. Return the URL resolution of _packagePath_ in _packageURL_.
732+
> _packageSubpath_, _pjson.exports_).
733+
> 1. Return the URL resolution of _packageSubpath_ in _packageURL_.
734734
> 1. Throw a _Module Not Found_ error.
735735
736736
**PACKAGE_MAIN_RESOLVE**(_packageURL_, _pjson_)

0 commit comments

Comments
 (0)