-
- Notifications
You must be signed in to change notification settings - Fork 19
--es-module-specifier-resolution flag #48
Conversation
f94cc2c to b36bf08 Compare | What does For example if you have the following node_module pkg structure: Assuming both import {h} from 'pkg' import {render} from 'pkg/server'Under That is can you still archive "pretty paths" like |
b36bf08 to 2168312 Compare | I've rebased this to the CI fixes branch, and also added an adjustment to ensure the legacy resolution applies to package subpath resolution paths as well. |
| @MylesBorins just for the sake of avoiding confusion, can this be named --searching-resolution or something? "legacy" already refers to a bunch of behaviour in the cjs loader that the one you copied here doesn't have. |
| Also “legacy” implies it’s legacy, which at the moment it is certainly not, and we have no consensus that it will be. Please rename. Re a boolean flag; that’s fine if it follows the convention that |
15daf0a to 03fb3b1 Compare 2de50e3 to d6a3b09 Compare This comment has been minimized.
This comment has been minimized.
d6a3b09 to 6d32f24 Compare a17b130 to 3e3bb27 Compare | Updated based on all notes and added extensive tests PTAL |
test/fixtures/es-module-specifiers/node_modules/explicit-main/package.json Show resolved Hide resolved
6864e68 to 7a3b64e Compare | assert.strictEqual(success, 'success'); | ||
| assert.strictEqual(explicit, 'esm'); | ||
| assert.strictEqual(implicit, 'cjs'); | ||
| assert.strictEqual(implicit, 'esm'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So with this change, from the prior loader, .mjs would be resolved before .js? would .cjs resolve before .mjs?
dcee790 to a7b4b27 Compare Looks good to me, as long as if dual-mode is possible we leave it undocumented.
| This has been open for 4 days and there are no more objections. If CI is green I plan to land this. |
There are currently two supported values "none" and "node"
a7b4b27 to 1cb5cea Compare | landed in bec588f |
BUGFIXES * [`27cccfbda`](npm/cli@27cccfb) [#223](npm/cli#223) vulns → vulnerabilities in npm audit output ([@sapegin](https://github.com/sapegin)) * [`d5e865eb7`](npm/cli@d5e865e) [#222](npm/cli#222) [#226](npm/cli#226) install, doctor: don't crash if registry unset ([@dmitrydvorkin](https://github.com/dmitrydvorkin), [@isaacs](https://github.com/isaacs)) * [`5b3890226`](npm/cli@5b38902) [#227](npm/cli#227) [npm.community#9167](https://npm.community/t/npm-err-cb-never-called-permission-denied/9167/5) Handle unhandledRejections, tell user what to do when encountering an `EACCES` error in the cache. ([@isaacs](https://github.com/isaacs)) DEPENDENCIES * [`77516df6e`](npm/cli@77516df) `licensee@7.0.3` ([@isaacs](https://github.com/isaacs)) * [`ceb993590`](npm/cli@ceb9935) `query-string@6.8.2` ([@isaacs](https://github.com/isaacs)) * [`4050b9189`](npm/cli@4050b91) `hosted-git-info@2.8.2` * [#46](npm/hosted-git-info#46) [#43](npm/hosted-git-info#43) [#47](npm/hosted-git-info#47) [#44](npm/hosted-git-info#44) Add support for GitLab subgroups ([@mterrel](https://github.com/mterrel), [@isaacs](https://github.com/isaacs), [@ybiquitous](https://github.com/ybiquitous)) * [`3b1d629`](npm/hosted-git-info@3b1d629) [#48](npm/hosted-git-info#48) fix http protocol using sshurl by default ([@fengmk2](https://github.com/fengmk2)) * [`5d4a8d7`](npm/hosted-git-info@5d4a8d7) ignore noCommittish on tarball url generation ([@isaacs](https://github.com/isaacs)) * [`1692435`](npm/hosted-git-info@1692435) use gist tarball url that works for anonymous gists ([@isaacs](https://github.com/isaacs)) * [`d5cf830`](npm/hosted-git-info@d5cf830) Do not allow invalid gist urls ([@isaacs](https://github.com/isaacs)) * [`e518222`](npm/hosted-git-info@e518222) Use LRU cache to prevent unbounded memory consumption ([@iarna](https://github.com/iarna)) PR-URL: nodejs/node#29023 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This is a super naive copy / paste of the resolution algorithm from upstream, slightly tweaked to work with the internals of the new loader. There is some duplication here, but I've kept it to a minimum.
@ljharb the flag right now is a boolean flag... either the flag is included or isn't. Happy to work on something better, e.g. a no-op flag for other mode or different input type for this flag... but this was enough to get things stared
If anyone wants to make changes to this please feel free to push to the branch. Hopefully this gets us 90% of the way there