Affected URL(s)
https://nodejs.org/dist/latest-v20.x/docs/api/esm.html#resolution-algorithm-specification
Description of the problem
PACKAGE_RESOLVE function step 11.1 should contains:
Let packageURL be the URL resolution of "node_modules/" concatenated with packageName, relative to parentURL.
The original PACKAGE_EXPORTS_RESOLVE is wrong if subpath is "./xyz" and the keys of exports are not starting with "." (conditions) the step 4 is executed. The suggestion how PACKAGE_EXPORTS_RESOLVE should be implemented.
PACKAGE_EXPORTS_RESOLVE(packageURL, subpath, exports, conditions)
- If exports is an Object with both a key starting with "." and a key not starting with ".", throw an Invalid Package Configuration error.
- Let mainExport be undefined.
- Let resolved be undefined.
- If subpath is equal to "." and exports is an Object containing a key equal to ".", then
1. Let mainExport be exports["."].
- Otherwise if exports is a String or Array, or an Object containing no keys starting with ".", then
1. Let mainExport be exports.
- If mainExport is not undefined, then
1. Let resolved be the result of PACKAGE_TARGET_RESOLVE(packageURL, mainExport, null, false, conditions).
- Otherwise, if exports is an Object and all keys of exports start with ".", then
1. Let resolved be the result of PACKAGE_IMPORTS_EXPORTS_RESOLVE(subpath, exports, packageURL, false, conditions).
- If resolved is not null or undefined, then return resolved.
- Throw a Package Path Not Exported error.
Affected URL(s)
https://nodejs.org/dist/latest-v20.x/docs/api/esm.html#resolution-algorithm-specification
Description of the problem
PACKAGE_RESOLVE function step 11.1 should contains:
Let packageURL be the URL resolution of "node_modules/" concatenated with packageName, relative to parentURL.
The original PACKAGE_EXPORTS_RESOLVE is wrong if subpath is "./xyz" and the keys of exports are not starting with "." (conditions) the step 4 is executed. The suggestion how PACKAGE_EXPORTS_RESOLVE should be implemented.
PACKAGE_EXPORTS_RESOLVE(packageURL, subpath, exports, conditions)
1. Let mainExport be exports["."].
1. Let mainExport be exports.
1. Let resolved be the result of PACKAGE_TARGET_RESOLVE(packageURL, mainExport, null, false, conditions).
1. Let resolved be the result of PACKAGE_IMPORTS_EXPORTS_RESOLVE(subpath, exports, packageURL, false, conditions).