Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

Commit

Permalink
path_resolve separation
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Nov 5, 2018
1 parent 669dfcb commit a9dadb8
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,10 @@ The algorithm to resolve an ES module specifier is provided through _ESM_RESOLVE
**ESM_RESOLVE**(_specifier_, _parentURL_)
> 1. If _specifier_ is a valid URL then,
> 1. Let _resolvedURL_ be the result of parsing and reserializing _specifier_ as a URL.
> 1. If the file at _resolvedURL_ exists then,
> 1. Return _resolvedURL_.
> 1. Let _packageMainURL_ be the result of **PACKAGE_MAIN_RESOLVE**(_resolvedURL_).
> 1. If _packageMainURL_ is not _undefined_ then,
> 1. Return _packageMainURL_.
> 1. Throw a _Module Not Found_ error.
> 1. Return the result of **PATH_RESOLVE**(_resolvedURL_).
> 1. If _specifier_ starts with _"/"_, _"./"_ or _"../"_ then,
> 1. Return the URL resolution of _specifier_ to _parentURL_.
> 1. Let _resolvedURL_ be the URL resolution of _specifier_ to _parentURL_.
> 1. Return the result of **PATH_RESOLVE**(_resolvedURL_).
> 1. Note: _specifier_ is now a bare specifier.
> 1. Let _packageName_ be _undefined_.
> 1. Let _packagePath_ be _undefined_.
Expand All @@ -217,6 +213,14 @@ The algorithm to resolve an ES module specifier is provided through _ESM_RESOLVE
> 1. Let _packagePath_ be the substring of _specifier_ from the position at the length of _packageName_ plus one, if any.
> 1. Return the result of **PACKAGE_RESOLVE**(_packageName_, _packagePath_, _parentURL_), or propagating any errors thrown.
**PATH_RESOLVE**(_resolvedURL_)
> 1. If the file at _resolvedURL_ exists then,
> 1. Return _resolvedURL_.
> 1. Let _packageMainURL_ be the result of **PACKAGE_MAIN_RESOLVE**(_resolvedURL_).
> 1. If _packageMainURL_ is not _undefined_ then,
> 1. Return _packageMainURL_.
> 1. Throw a _Module Not Found_ error.
**PACKAGE_RESOLVE**(_packageName_, _packagePath_, _parentURL_)
> 1. Assert: _packagePath_ is either empty, or a path without a leading separator.
> 1. Assert: _packageName_ is a valid package name or scoped package name.
Expand Down

0 comments on commit a9dadb8

Please sign in to comment.