-
Notifications
You must be signed in to change notification settings - Fork 4
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
Spec draft #4
Comments
Some notes:
|
I think new terms should only be brought in when absolutely necessary to describe concepts. I see the conceptual distinction you're making, but I don't think this is a necessary conceptual distinction to make. While the Node and v8 loaders have resolve providing interpretation, resolving a specifier is clearly a well-defined location operation, and to call it locate is to bring in new confusions I think. To avoid this terminology problem entirely I've gone ahead and just combined the resolve and locate algorithms into a single algorithm while leaving the subroutine for ESM_FORMAT.
Thanks, I've done this.
I updated this with your earlier feedback
The mainURL here is exactly and only the CommonJS main.
As mentioned the goal is to have separate specs that can be merged independently. To define terms is to lock down those property names, and thus lock the discussion of those property names to this PR, which was what I was trying to avoid. I exactly do link to the package exports proposal in the notes under HAS_ESM_PROPERTIES though. Note that I can do a PR for the exports proposal and add everything all together, as I know you'd prefer. The point though was to break it down into reviewable subfeatures in the name of consensus. The more there is to discuss the more there is to block on.
So an existing version of something like GraphQL that already ships ".mjs" files can never be loaded? That seems sub-optimal. |
But it's in the section where ESM is true?
It needs to define |
Ahh, that's a bug then! Thanks it should be false not true. I've pushed that change.
The package scope was always considered a MIME lookup, changing the ".js" interpretation, but which can still allow ".mjs" to correspond to the ESM format. It's definitely worth discussing further. To be honest I don't personally mind, but I get the feeling users will get very confused. |
Well it's in the proposal:
I think it needs to be this way to avoid some of the issues @bmeck was bringing up and that were being discussed in #1. If that's not the case then sure, let it work. But I think it's better to throw an error for now and potentially enable it later. |
".mjs" is perfectly deterministic - it provides a unique way to indicate the format. CommonJS packages are already published that contain ".mjs" files. To say that none of those ".mjs" can ever run is very prescriptive, for what gain? There is no determinism issue here. I'm not sure what more I can say on this. I've pushed the change anyway. |
Not the deterministic issue, the “loading the same asset in two modes” issue. Though that would seem to not be a possibility for Regardless, if you want to suggest a change in the proposal I think you should open an issue and we can discuss it there, then the proposal gets updated and the spec gets updated. We shouldn’t change things in the spec document (or even later, in the implementation). One thing that does occur to me, and maybe this is just a UX concern and not a technical one, is that allowing importing |
The important file mode property is that of having a convention that allows all tools to know with 100% certainty whether a given file on the file system is CommonJS or ESM. |
Closing as this has been merged into the upstream repo now. |
I've put some spec work together here implementing the proposal - nodejs/ecmascript-modules@modules-lkgr...guybedford:irp.
Feedback welcome.
The text was updated successfully, but these errors were encountered: