@@ -162,9 +162,7 @@ extended in future updates.
162
162
In the following algorithms, all subroutine errors are propogated as errors
163
163
of these top-level routines.
164
164
165
- _isMain_ is **true** when resolving the Node.js application entry point.
166
-
167
- #### ESM_RESOLVE(_specifier_, _parentURL_, _isMain_)
165
+ **ESM_RESOLVE(_specifier_, _parentURL_)**
168
166
> 1. Let _resolvedURL_ be **undefined**.
169
167
> 1. If _specifier_ is a valid URL, then
170
168
> 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.
180
178
> **PACKAGE_RESOLVE**(_specifier_, _parentURL_).
181
179
> 1. If the file at _resolvedURL_ does not exist, then
182
180
> 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_).
184
182
> 1. Load _resolvedURL_ as module format, _format_.
185
183
186
184
PACKAGE_RESOLVE(_packageSpecifier_, _parentURL_)
@@ -229,8 +227,6 @@ PACKAGE_RESOLVE(_packageSpecifier_, _parentURL_)
229
227
> 1. Throw a _Module Not Found_ error.
230
228
231
229
PACKAGE_MAIN_RESOLVE(_packageURL_, _pjson_)
232
- > 1. If _pjson_ is **null**, then
233
- > 1. Return **null**.
234
230
> 1. Let _pjsonURL_ be the URL of the file _"package.json"_ within the parent
235
231
> path _packageURL_.
236
232
> 1. If **HAS_ESM_PROPERTIES**(_pjson_) is **false**, then
@@ -241,17 +237,18 @@ PACKAGE_MAIN_RESOLVE(_packageURL_, _pjson_)
241
237
> 1. TODO: ESM main handling.
242
238
> 1. Return **null**.
243
239
244
- #### ESM_FORMAT(_url_, _isMain_)
240
+ ** ESM_FORMAT(_url_)**
245
241
> 1. Assert: _url_ corresponds to an existing file.
246
242
> 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
249
245
> 1. Throw an _Unsupported File Extension_ error.
250
246
> 1. Return _"esm"_.
251
247
> 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"_.
255
252
256
253
READ_PACKAGE_BOUNDARY(_url_)
257
254
> 1. Let _boundaryURL_ be the URL resolution of _"package.json"_ relative to
0 commit comments