-
Notifications
You must be signed in to change notification settings - Fork 44
Conversation
FWIW, I am for Do nothing, enabling migration through bundlers and loaders. Regardless, I think whatever decision will be taken, any new default should consider defaulting to the future of the language, instead of defaulting to the legacy behavior that will otherwise never go away. |
Small code examples for each proposal (if appropriated) would be a nice to have (imho) |
I think the problem is pretty well defined in #149 and #151. The request is to find a way for Node to treat |
I mean, the ways that present an alternative are basically:
The first seems a given; the second seems not worth it; the third might work but doesn’t really support cases without package.json. |
Yes, but
Yep
What do you precisely mean by that ? I mean neither const bare = require('specifier') nor import bare from 'specifier' would currently work without some kind of resolution algo providing the URL full somehow. Being it a |
@michael-ciniawsky I’m talking about one-off scripts in node, which need nothing more than node’s default resolution - having nothing to do with browsers. |
What is a one-off script :) ? Could you to provide an example please ? |
@michael-ciniawsky any single javascript file |
Responded in a comment. The review doesn’t request any particular revisions to this PR.
I think today’s agenda is already pretty full, but can we add a mention to this? To invite the group to visit this page and comment if they haven’t already, and then at the next meeting we can discuss this. |
This PR isn’t meant to ever be merged in. I’m just using the PR structure to organize comment threads. |
I guess “do nothing” needs qualification, as in what it’s relative to. I was assuming it was relative to the
This is a strong argument for why |
The future of the language is ESM supporting everything, which includes commonJS. |
aea4058
to
a4f15c5
Compare
Added |
I think this is a good way to frame the options. We could also add “a file extension” as a group of solutions to cover both
So either “something in-file,” whether that’s I could group the options into these categories, and then the effort will be finding consensus on which solution(s) within each category we want to pursue. |
I see a lot of personal attacks and snide comments on this thread. Frankly it’s making me less inclined to participate, and I’m probably not the only one. Can we please tone it down? Also can we please also keep the discussion on this thread focused on the PR here? I know a lot of these comments are at least somewhat related because they discuss implementations, but this thread is already over 100 comments and it’s getting impossible to follow the discussion of this actual PR. Could these alternate implementations you all are discussing please get their own threads? This one’s mine! 😉 Getting back to my comment from only 21 hours and 89 comments ago, can someone (like @bmeck) please explain whether unambiguous grammar can or can’t work? If it can work, it seems like the silver bullet solution that solves all (?) use cases. So I’m assuming it can’t work. But I’d like to understand why. Maybe that explanation can get its own thread too, in case there’s any dispute over whether it can or can’t work. Aside from that, I don’t think there’s much reason to argue: it seems like we can agree that there’s at least desire, perhaps even a need, for Node to ship support for both ESM via What I would like us to discuss on this thread (and please feel free to continue the other discussions in other issues) is which of the proposals in the PR people find most promising and would like to pursue, for how to tell Node to treat
People have raised general objections about creating an alternate API like So that leaves us with
That’s my take on things, anyone else want to propose a different set of solutions? |
👎 on No transparent interop via
👍 👎
👎 (Not needed)
👎 ("
👍
👍 Removal of file extension and directory resolving for ESM I apologize in advance in case any of my comments attacked someone personally, which was never intended. Since I'm not a member of the node modules group I will try to refrain from further commenting on any threads to reduce the noise |
Apologies @GeoffreyBooth, I agree this went out of hands but at the same time I couldn't stand reading always the same answers to what should've been a MUST HAVE since day one. I'll try to not interfere but since it's somehow too late, I'd like at least to clarify one bit that everyone apparently understood, except for @devsnek:
@devsnek my proposal is all about disambiguation with the My proposal was in topic: how to load My proposal has nothing to do with After all, the reality for JS as language is that ESM is the module system and So please let's not force things over my proposal, thanks. Best Regards Edit I have updated the proposal explicitly putting |
@GeoffreyBooth
Unambiguous grammar solves many cases, but when it does not work it's a dangerous footgun. |
@demurgos is there any real-world example of a file considered ambiguous that could have side effects if loaded as ESM instead of CJS ? The only ambiguous thing that comes to my mind is the potentially It's also worth noticing that polyfills are always to patch older environments so they all use TL;DR I don't think polyfills are a valid argument 'cause I wrote dozen of them and all of them would work in any environments, strict or not, ESM or CJS or Browser => aka: if there's no need to disambiguate it's because the code would run just fine no matter where. |
I avoid polyfills so I am not aware if one of them exhibits this behavior. I assume that most popular polyfills will be written by skilled people and effectively behave the same (regardless of the host or parse goal), just as your polyfills. I listed polyfills as an example, but @bmeck's comment had a larger list of use cases where issues may arise:
If someone has an example of script with differing behavior (not necessarily polyfill), please post it. Besides, my other points remain valid. |
I have summarized my proposal, the history behind, and what it solves and how in this gist: Quickly back to @demurgos, my proposal has only a single point of potential ambiguity, the initial file, in case it's not an In a generic An entry point won't ever be a polyfill, it makes no sense, neither any of the other kind of files in that list. A CLI can use the At that point, if interop is dropped and there is an initial parsing goal, everything else is covered by my proposal, and better explained in the gist.
I hope my point, and my proposal, is now clear. Please comment in there to avoid keep polluting this thread. Thank you. |
Im gonna take a few days after seeing this rather personal post
https://gist.github.com/WebReflection/a4e026e78af45ede8d0f7498cab44f91
It really just slows things down to point fingers and it seems like a lot
of that is going on, and I feel it is in part being used to silence members
by emotional means. I'll be back on this issue later, but don't feel up to
engaging in this group immediately.
…On Fri, Jul 20, 2018, 6:14 AM Andrea Giammarchi ***@***.***> wrote:
I have summarized my proposal, the history behind, and what it solves and
how in this gist:
https://gist.github.com/WebReflection/a4e026e78af45ede8d0f7498cab44f91
Quickly back to @demurgos <https://github.com/demurgos>, my proposal has
only a single point of potential ambiguity, the initial file, in case it's
not an .mjs one, and in case the --module flag, or --type=module
web-like, hasn't been specified.
In a generic node file.js as entry point, we could default to CJS but we
could also parse that only file once in search of the usage of the static
import which, if found, would automatically set the entry point parse
goal as ESM.
An entry point won't ever be a polyfill, it makes no sense, neither any of
the other kind of files in that list.
A CLI can use the --module flag, .mjs or again, use the parsing goal
resolution only *once* and only for the entry point which will default to
CJS.
At that point, if interop is dropped and there is an initial parsing goal,
everything else is covered by my proposal, and better explained in the gist.
- authors are able to define the parsing goal
- users are forced to know authors parsing goal (requiring an ESM only
module would fail, as well as importing a CJS only one)
- dual packages are allowed and straight forward
- tools can easily update (most of them won't need to do anything)
- everyone can migrate to a better future of ESM only
I hope my point, and my proposal, is now clear.
Please comment in there to avoid keep polluting this thread.
Thank you.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#150 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAOUo-aldxWPCPu8T6GyeSbTPoydd1Q7ks5uIbusgaJpZM4VKg-I>
.
|
Getting back to this PR, I’m realizing from @michael-ciniawsky’s comment above that the options I’ve listed in this PR take What @michael-ciniawsky seems to be saying, if I understand his comment correctly, is that an alternate implementation could use a different mix of strategies for handling CommonJS and ESM interoperability. Which is also fine; I’m sure that @michael-ciniawsky and @WebReflection would argue that an alternate implementation would be better, and that’s also a fine debate to have (though please, not in this thread! 😄). Getting back to this PR though, and improvements to So I think we can boil this down to just two additions to
Is this something we can find consensus on, at least with regard to |
@GeoffreyBooth
edit: pr to core was for mode in package.json, not a flag sorry for confusion |
Great! Can you find a link? I can’t seem to find it.
I think this is an implementation discussion. We could open a new thread for “okay, so how should we let users tell Node what parse goals to use for particular file extensions?” and debate the various methods. @bmeck also did some work sketching out a |
My personal preference would be a mapping from extension to extension (ie, from Regardless of the specifics, this does seem like something we'll probably be able to come to a consensus on - as long as we don't derail it by trying to discuss changing the defaults. Thanks for the concise summary and attempt to get the thread back on track <3 |
without derailing this conversation, the fact an experimental flag has shipped without consensus, and NodeJS is now stuck around that experiment, should hopefully mark a "mistake to learn from" in the history of NodeJS. I personally wouldn't call a flag "experimental" without the will to change it later on 'cause I already worked on it too much. Regards. |
@WebReflection it absolutely had consensus, from prior to the module group being formed. |
@ljharb then at this point I don't even know what's the purpose of this group if nothing behind that experimental flag could change. Anyway, I've written my proposal, I have nothing else to add in here. |
I'm going to remove this from the agenda until we can reach consensus on a minimal kernel / approach for the fork. Please feel free to re add or let me know if this should be on today's agenda |
Superseded by #160 |
Potential solutions for #149 and #151. Most take the approach of providing a way for the user to signal to Node that
.js
files should be parsed as ESM.Readable view: https://github.com/GeoffreyBooth/modules/blob/esm-in-js-files/proposals/esm-in-js-files.md
To discuss particular proposals, please add comments as PR notes after those proposals. Add general comments to suggest new proposals or broader changes.