-
Notifications
You must be signed in to change notification settings - Fork 18
Specify import file specifier resolution proposal #19
Conversation
I'll start with some of my own concerns (and suggestions welcome for the best way to have these discussions too):
|
I agree with both of those points. |
> 1. Set _resolvedURL_ to the result of parsing and reserializing | ||
> _specifier_ as a URL. | ||
> 1. Otherwise, if _specifier_ starts with _"/"_, _"./"_ or _"../"_ then, | ||
> 1. Otherwise, if _specifier_ starts with _"/"_, then | ||
> 1. Throw an _Invalid Specifier_ error. |
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.
I get why people wanna flag these since the behavior on node isn't what one may expect coming from a browser, but.... paths are paths? And while the unix root (/
) feels somewhat ambiguous thanks to webservers, a windows root c:/
is completely unambiguous (and usually gets lumped into having the same behavior as a unixy root). Paths simply require context to be resolved correctly - that's just how paths work, IMO. (Also: I know the cjs modules pages doesn't do this, but talking about rooted and unrooted would be better than using the exact string fragments here, to make the algorithm description read more cross-plat - as written, c:/foo.js
is technically a c:
package specifier, which I don't think is desirable or intended)
I don't think blanket-forbidding absolute module paths is necessarily something we should do - not that I've ever once used an absolute path to a module in any real scenario, it just feels strange to forbid them, since cjs resolution handles them fine.
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.
@weswigham I am fairly certain that it is just a stepping stone, ironing out the more critical aspects first since "/" is obviously a resolvable matter but the extra work to get it right for everyone needs bandwidth which is currently spent elsewhere 👍
The idea behind prohibiting leading
|
d473041
to
7bf886a
Compare
modules-lkgr had a conflict against master 😅. I've gone ahead and rebased this |
The extension is how you determine the parse goal of a package. It would make no sense to have a CJS module in an .mjs file, so maybe I’m unclear on the issue. |
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.
the only way .mjs
should point to anything except esm is with very explicit overrides by the application. the default behaviour (even if the package.json doesn't have "esm properties") should be to resolve .mjs
as esm.
Rather than discuss the proposal here, with all concerns intermixed, can we use the issues on the proposal’s repo? https://github.com/GeoffreyBooth/node-import-file-specifier-resolution-proposal/issues (I know, I started it, but I’m trying to rectify my mistake.) I migrated the “ |
Let’s discuss in GeoffreyBooth/node-import-file-specifier-resolution-proposal#5 please. I’m going to dismiss the review because this proposal always interprets |
This PR throws when loading ".mjs" from a package that does not have "ESM properties" in its package.json. That is, a CommonJS boundary package with an ".mjs" file. |
7bf886a
to
a1f967e
Compare
59f606f
to
7f791e9
Compare
a1f967e
to
35d5393
Compare
d622667
to
d128205
Compare
127e0d5
to
bf69a15
Compare
bf69a15
to
519ea5d
Compare
Refs: nodejs/modules#180 PR-URL: nodejs#6 Reviewed-By: Myles Borins <MylesBorins@google.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Refs: nodejs/modules#180 PR-URL: nodejs#6 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Refs: nodejs/modules#180 PR-URL: nodejs#6 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Refs: nodejs/modules#180 PR-URL: nodejs#6 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
PR-URL: nodejs#6 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
PR-URL: nodejs#6 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Myles Borins <mylesborins@google.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
PR-URL: nodejs#6 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Myles Borins <mylesborins@google.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
519ea5d
to
046cec6
Compare
046cec6
to
a806a61
Compare
@@ -527,6 +515,8 @@ evaluated, in which case it will do one of the following two things: | |||
|
|||
This method cannot be called while the module is being evaluated | |||
(`module.status` is `'evaluating'`) to prevent infinite recursion. | |||
======= |
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.
...merge conflict marker? 😄
a806a61
to
576efa4
Compare
014cd60
to
acdf4e9
Compare
Replaced by #28. |
This PR provides a specification for the node-import-file-specifier-resolution-proposal.
Further to last meeting where some of the properties of this proposal were discussed, hopefully this can allow for a more concrete discussion about the interactions at work.
I think what would help is perhaps using this spec to try to understand some concrete use cases, and then fleshing out those discussions further.
This PR does not yet implement ES modules mains or subpaths as this is currently delegated to the package exports proposal.
Hopefully we can continue to discuss that proposal too in order to work towards a refinement of a complete specification here.