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

Commit 770f566

Browse files
committed
mjs, esm default updates
1 parent d5671a2 commit 770f566

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

doc/api/esm.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,7 @@ extended in future updates.
162162
In the following algorithms, all subroutine errors are propogated as errors
163163
of these top-level routines.
164164
165-
_isMain_ is **true** when resolving the Node.js application entry point.
166-
167-
#### ESM_RESOLVE(_specifier_, _parentURL_, _isMain_)
165+
**ESM_RESOLVE(_specifier_, _parentURL_)**
168166
> 1. Let _resolvedURL_ be **undefined**.
169167
> 1. If _specifier_ is a valid URL, then
170168
> 1. Set _resolvedURL_ to the result of parsing and reserializing
@@ -180,7 +178,7 @@ _isMain_ is **true** when resolving the Node.js application entry point.
180178
> **PACKAGE_RESOLVE**(_specifier_, _parentURL_).
181179
> 1. If the file at _resolvedURL_ does not exist, then
182180
> 1. Throw a _Module Not Found_ error.
183-
> 1. Let _format_ be the result of **ESM_FORMAT**(_url_, _isMain_).
181+
> 1. Let _format_ be the result of **ESM_FORMAT**(_url_).
184182
> 1. Load _resolvedURL_ as module format, _format_.
185183
186184
PACKAGE_RESOLVE(_packageSpecifier_, _parentURL_)
@@ -229,8 +227,6 @@ PACKAGE_RESOLVE(_packageSpecifier_, _parentURL_)
229227
> 1. Throw a _Module Not Found_ error.
230228
231229
PACKAGE_MAIN_RESOLVE(_packageURL_, _pjson_)
232-
> 1. If _pjson_ is **null**, then
233-
> 1. Return **null**.
234230
> 1. Let _pjsonURL_ be the URL of the file _"package.json"_ within the parent
235231
> path _packageURL_.
236232
> 1. If **HAS_ESM_PROPERTIES**(_pjson_) is **false**, then
@@ -241,17 +237,18 @@ PACKAGE_MAIN_RESOLVE(_packageURL_, _pjson_)
241237
> 1. TODO: ESM main handling.
242238
> 1. Return **null**.
243239
244-
#### ESM_FORMAT(_url_, _isMain_)
240+
**ESM_FORMAT(_url_)**
245241
> 1. Assert: _url_ corresponds to an existing file.
246242
> 1. Let _pjson_ be the result of **READ_PACKAGE_BOUNDARY**(_url_).
247-
> 1. If _pjson_ is **null** or **HAS_ESM_PROPERTIES**(_pjson_) is **true**, then
248-
> 1. If _url_ does not end in _".js"_ or _".mjs"_ then,
243+
> 1. If **HAS_ESM_PROPERTIES**(_pjson_) is **true**, then
244+
> 1. If _url_ does not end in _".js"_ or _".mjs"_, then
249245
> 1. Throw an _Unsupported File Extension_ error.
250246
> 1. Return _"esm"_.
251247
> 1. Otherwise,
252-
> 1. If _url_ ends with _".mjs"_, then
253-
> 1. Throw an _Unsupported File Extension_ error.
254-
> 1. Return _"legacy"_.
248+
> 1. If _url_ ends in _".mjs"_, then
249+
> 1. Return _"esm"_.
250+
> 1. Otherwise,
251+
> 1. Return _"legacy"_.
255252
256253
READ_PACKAGE_BOUNDARY(_url_)
257254
> 1. Let _boundaryURL_ be the URL resolution of _"package.json"_ relative to

0 commit comments

Comments
 (0)