@@ -207,50 +207,16 @@ _ESM_RESOLVE_:
207
207
208
208
**PACKAGE_RESOLVE**(_packageSpecifier_, _parentURL_)
209
209
> 1. Assert: _packageSpecifier_ is a bare specifier.
210
- > 1. Let _packageName_ be _undefined_.
211
- > 1. Let _packagePath_ be _undefined_.
212
- > 1. If _packageSpecifier_ does not start with _"@"_ then,
213
- > 1. If _packageSpecifier_ is an empty string then,
214
- > 1. Throw a _Invalid Package Name_ error.
215
- > 1. Set _packageName_ to the substring of _packageSpecifier_ until the
216
- > first _"/"_ separator or the end of the string.
217
- > 1. If _packageSpecifier_ starts with _"@"_ then,
218
- > 1. If _packageSpecifier_ does not contain a _"/"_ separator then,
219
- > 1. Throw a _Invalid Package Name_ error.
220
- > 1. Set _packageName_ to the substring of _packageSpecifier_
221
- > until the second _"/"_ separator or the end of the string.
222
- > 1. Let _packagePath_ be the substring of _packageSpecifier_ from the
223
- > position at the length of _packageName_ plus one, if any.
224
- > 1. Assert: _packageName_ is a valid package name or scoped package name.
225
- > 1. Assert: _packagePath_ is either empty, or a path without a leading
226
- > separator.
227
- > 1. Note: Further package name validations can be added here.
228
- > 1. If _packagePath_ is empty and _packageName_ is a Node.js builtin
229
- > module then,
210
+ > 1. If _packageSpecifier_ is a Node.js builtin module then,
230
211
> 1. Return _"node:${ packageName} "_.
231
212
> 1. Set _parentURL_ to the parent folder URL of _parentURL_.
232
213
> 1. While _parentURL_ contains a non-empty _pathname_,
233
214
> 1. Let _packageURL_ be the URL resolution of
234
- > _"${ parentURL} /node_modules/${ packageName} "_.
235
- > 1. If the folder at _packageURL_ does not exist then,
236
- > 1. Note: This check can be optimized out where possible in
237
- > implementation.
238
- > 1. Set _parentURL_ to the parent URL path of _parentURL_.
239
- > 1. Continue the next loop iteration.
240
- > 1. If _packagePath_ is empty then,
241
- > 1. Let _url_ be the result of **PACKAGE_MAIN_RESOLVE**(_packageURL_).
242
- > 1. If _url_ is _undefined_ then,
243
- > 1. Throw a _Module Not Found_ error.
244
- > 1. Return _url_.
245
- > 1. Otherwise,
246
- > 1. Return the URL resolution of _packagePath_ in _packageURL_.
215
+ > _"${ parentURL} /node_modules/${ packageSpecifier} "_.
216
+ > 1. If the file at _packageURL_ exists then,
217
+ > 1. Return _packageURL_.
247
218
> 1. Throw a _Module Not Found_ error.
248
219
249
- **PACKAGE_MAIN_RESOLVE**(_packageURL_)
250
- > 1. Note: Main resolution to be implemented here.
251
- > 1. Return _undefined_.
252
-
253
-
254
220
[Node.js EP for ES Modules]: https://github.com/nodejs/node-eps/blob/master/002-es-modules.md
255
221
[` module .createRequireFromPath ()` ]: modules.html#modules_module_createrequirefrompath_filename
256
222
[ESM Minimal Kernel]: https://github.com/nodejs/modules/blob/master/doc/plan-for-new-modules-implementation.md
0 commit comments