-
Notifications
You must be signed in to change notification settings - Fork 30.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PATTERN_KEY_COMPARE algorithm should be updated #46050
Comments
I'm not sure I understand what you mean, how is it not correct?
Do you have example of valid patterns that break the assertion? |
AFAIK this is used to sort the keys in the PACKAGE_IMPORTS_EXPORTS_RESOLVE() And you can see many of the keys in https://nodejs.org/api/packages.html#package-entry-points does not satisfy this assertion. e.g.:
|
Also, maybe the wording is a bit ambiguous:
Does it mean:
I can understand it is probably the prior, but you can see that popular package resolve.exports got the wrong idea. |
Reading this again, seems like the first assertion is not even needed, as the PATTERN_KEY_COMPARE is only used there in the whole algorithm. Maybe historical? |
I'm not a native English speaker, so maybe there are nuances I don't get, but I don't think "ends with contains only a single
This was added in #39635 by @guybedford, maybe he can help here? |
@unional I believe you're correct - the |
Sounds good. thx @guybedford. I can open a PR and also update the respective code. |
Version
19.3.1
Platform
all
Subsystem
No response
What steps will reproduce the bug?
https://nodejs.org/api/esm.html#resolver-algorithm-specification
The assertions:
Assert: keyA ends with "/" or contains only a single "*".
is no longer correct as ESM supports file extensions, e.g.:
#a/b.js
./foo/*.js
I have released pattern-key-compare for resolve.imports.
How often does it reproduce? Is there a required condition?
N/A
What is the expected behavior?
The spec should be adjusted.
Also, should expect only single
*
instead of allowing multiple*
. But that's a breaking change.What do you see instead?
N/A
Additional information
No response
The text was updated successfully, but these errors were encountered: