-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
doc: fix some errors in esm resolution algorithms #50898
Conversation
Review requested:
|
We've been meaning to expose this logic in a helper function. Is that something you'd be interested in implementing? |
@GeoffreyBooth, I don't know if I'd have the time to maintain a pure reference implementation, but my implementation here might be a good starting point for someone. Aside from using paths instead of URLs, it follows the documented algorithms as closely as possible. |
Force pushed another typo I forgot about. Section 3.3 of the same function also has confusing wording (I had to check the node.js code to implement it properly). I need to consider how to reword it though. |
I just meant exposing ours, like |
Commit Queue failed- Loading data for nodejs/node/pull/50898 ✔ Done loading data for nodejs/node/pull/50898 ----------------------------------- PR info ------------------------------------ Title doc: fix some errors in esm resolution algorithms (#50898) Author Christopher Jeffrey (JJ) (@chjj) Branch chjj:fix-esm-docs -> nodejs:main Labels doc, esm, author ready Commits 1 - doc: fix some errors in esm resolution algorithms Committers 1 - Christopher Jeffrey PR-URL: https://github.com/nodejs/node/pull/50898 Reviewed-By: Guy Bedford Reviewed-By: Geoffrey Booth Reviewed-By: Luigi Pinca Reviewed-By: Antoine du Hamel ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/50898 Reviewed-By: Guy Bedford Reviewed-By: Geoffrey Booth Reviewed-By: Luigi Pinca Reviewed-By: Antoine du Hamel -------------------------------------------------------------------------------- ⚠ Commits were pushed since the last approving review: ⚠ - doc: fix some errors in esm resolution algorithms ℹ This PR was created on Fri, 24 Nov 2023 17:13:06 GMT ✔ Approvals: 4 ✔ - Guy Bedford (@guybedford): https://github.com/nodejs/node/pull/50898#pullrequestreview-1748266109 ✔ - Geoffrey Booth (@GeoffreyBooth) (TSC): https://github.com/nodejs/node/pull/50898#pullrequestreview-1748269208 ✔ - Luigi Pinca (@lpinca): https://github.com/nodejs/node/pull/50898#pullrequestreview-1748269330 ✔ - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/50898#pullrequestreview-1748269950 ✔ Last GitHub CI successful ℹ Green GitHub CI is sufficient -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/6996996694 |
@GeoffreyBooth, isn't this already going to be more-or-less exposed once I suppose CJS modules could access it if it were part of |
Landed in 59f57d2 |
PR-URL: #50898 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: #50898 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Two errors I discovered when implementing the ESM resolution algorithm from scratch.
PACKAGE_EXPORTS_RESOLVE
-subpath
is already prefixed with./
due to the calling functions ensuring this.PACKAGE_TARGET_RESOLVE
- A simple typo here. Order should be reversed.