-
Notifications
You must be signed in to change notification settings - Fork 44
upstream objection to --type #296
Comments
So we still have the issue raised in nodejs/ecmascript-modules#57 that basically, a flag that sets the module format of only the entry point introduces an issue where I propose we rename the flag to |
I'd like to suggest the following behavior
|
At the moment, we only have consensus for a flag for the entry point - I agree that if it were a mode, and matched the type field, |
@ljharb I believe that we would have had consensus for this in the last meeting if you didn't object. Are you +1 with moving forward for now? We can implement and have one more meeting for the team to review and +1 final implementation before landing |
with extending the scope of the flag to be a mode? no, I'm still not convinced a mode like that (especially settable via a NODE_OPTIONS environment variable) is a good idea for the larger ecosystem. |
i thought we voted and package scoped won |
As I recall, the one thing we voted on was whether |
@ljharb can you expand on why please? I'd like to see this objection combined with a more in depth reason to object aside from "not a good idea". I personally find the current behavior to be confusing and the ecosystem response to the current flag seems very much to be in line with the expected behavior that has been voice by multiple members of this team. Up until this point we've been pretty good about respecting any objection, but now that we are moving upstream I think that objections need to come with a very strong and solid reasoning. In core, people cannot just "object" they need to have a strong case or that objection will be overruled, generally by the TSC. Lone objections being unwilling to compromise will block our ability as a group to be chartered, the TSC will not want to charter a group that consistently requires their intervention. edit: and I am unwilling to charter a group that consistently requires voting to handle objections |
As previously mentioned, I believe However, if --package-typeThis is super semantic and a no-brainer, but only if you think about the Example: node --package-type=module standalone I guess we agree there is no competition against --entry-typeSemantically speaking, If the About -mEven if this shortcut is limited to the Expanding on entry-type opportunityWhat I see as a missed opportunity with the current MR/state, is the ability to publish dual modules, as it's been done for the last couple of years. The community already adopted the Various packages in npm are indeed published as such: {
"main": "cjs/index.js",
"module": "esm/index.js",
"unpkg": "min.js", // or "cdn" or others ...
...
} If the current proposal is to use However, if we ask npm developers, AFAIK still part of this group too, if it'd be OK to have an Example: {
"main": "cjs/index.js",
"module": "esm/index.js",
"entry-type": {
"module": "esm/index.js",
"commonjs": "cjs/index.js"
}
} Shortcutting as type (less ugly alternative)If the previous idea would make people unhappy, or even better, if we keep the {
"main": "cjs/index.js",
"module": "esm/index.js",
"unpkg": "min.js", // or "cdn" or others ...
"commonjs": "cjs/index.js"
} The As example, let's imagine a import module from 'package'; Now, there are three ways to run such file # run standalone as commonjs
node --type=commonjs standalone
# run standalone as module
node --type=module standalone
# just run standalone
node standalone The following algorithm, assuming the imported package has a related [ edited few times, sorry ]
Above flow would always be able to disambiguate imports of any kind, keeping the ability to publish dual modules as it's been done until now, and as already managed by pretty much all bundlers. Example of fully future/backward compatible package: {
"main": "cjs/index.js",
"module": "esm/index.js",
"unpkg": "min.js", // or "cdn" or others ...
"commonjs": "cjs/index.js",
"type": "module" // or "commonjs"
} Above package would work in all current bundlers, providing entry points for both ESM and CommonJS, it would work in Node < 10 (or whatever version won't receive the Please note, I'm not saying people should produce dual bundles from now on, I'm saying these kind of packages has already landed in npm, and while things settle down with the new ESM module system, it might be handy to have a migration pattern that won't break the current ecosystem. As SummaryI personally think keeping --type is the right thing to do, but I also would like to see such type reflected, and overruling, when appropriate, the Hope something I've written here could be considered, happy to answer questions, if any 👋 |
Reading through the comments on the upstream PR, it seems that everyone assumes that setting the type of the entry point therefore tells the project to operate in that mode. As in, they get that So even if we rename the current feature I can’t think of a use case for when a user might want to set the entry point type and not have that affect all the files in that scope. I can think of a use case where a package author might want an ESM entry point (to define named exports) for an otherwise CommonJS package, but a) packages aren’t run via flags, and b) there wouldn’t be a reason for a user to use a flag to override such a package/project. Absent a use case for the current behavior, I see no reason not to change it to the proposed package scope behavior and make the flag conform to user expectations (and use cases). |
Some names, please emoji vote
|
@MylesBorins given the way all the things that are in the upstream PR were sold to me and the working group, moving the bar for objections now seems highly deceptive. Many parts of the implementation were landed with "we can just revert them later!". Again, we do not have consensus for a mode, but we can certainly add that to the next meeting's agenda. While it's not a mode, |
@ljharb it was clearly stated from the get go that upstream may object to changes and we would need to adjust. Calling this deceptive is imho disingenuous. I would like us to try and work through as much of this as possible in advance of the meeting. You mentioned you have objections to the mode, and afaict right now are the only objector, can you please expand on what your issues are? Keep in mind, the modules team is not chartered. The TSC and the project has been kind enough to respect our request for a moratorium, but we have no explicit say on things... we can only make suggestions. There are no guarantees about what can and can't land and we are in no place to do anything but make recommendations. If we have to wait 2 weeks in between each set of objections or feedback from upstream we will not get things done in time. There is no other team or working-group within the foundation that works on that cadence, we need to be able to iterate faster. |
Since we are upstreaming, I really think we all should do our best to give priority to focusing our efforts on concerns addressed to us as a team — and while we all have things we object(ed) on all the time, it really only ever matters to bring those up when they are in the teams best interest (ie during times where not raising them would result in subpar implementation work. I ask everyone on the team to appreciate that our differences make us deliver our best efforts, but not to forget that some among us have put a lot of hard work to meet upstream obligations on behalf of the team, and aside from me (mostly) when this upstream pans out (even if we need to address things moving forward) it is only credit that reflects the lengthy involvement and dedication to respond to demands from the community on one of the most fundamental aspects of almost every single package out there. If concerns need to be voice, please use doodle, get us together and talk it out. If concerns need to be addressed, please find a good way to represent our team, and appreciate that the team respects your opinions and want to find ways to work towards making them happen. |
To elaborate on We already have very verbose flags in core, and most of our flags are pretty verbose up until this point. The existing non-experimental short flags are pretty old and they are in the minority - those can't really be changed now out of compatibility concerns. The recently added flags are all pretty verbose (e.g. the
|
@joyeecheung most of the users won't probably ever write Short flags are simply handy, in the history of software, and I consider If the shortcut
what would be the meaning of When you enter into ESM on the Web there's no way to unstrict from it, unless explicitly hooking yourself into If I don't see any useful, real-world, use case neither, and it'd be absolutely unexpected if once forced ESM, an import would consider If that's meant/needed, then |
@WebReflection "most of the users won't probably ever write Please don't make baseless assertions. we have absolutely no idea how often usage any of these flags are actually used (although we do already know that node-report and friends are super popular for debugging). |
@joyeecheung Thanks for articulating the specifics, which helps us better frame the right questions to get us in the right direction. a. Certainly, verbose flags are essential for things that are ambiguously problematic, ie if more than one aspect (or subsystem) have overlapping configurable parameters. Q where else would we consider b. Utility and priority always take center stage from a UX perspective. From the command line, all things are flags and then you have the entrypoint. From a utility perspective, you need to affect the entrypoint and so you will use a flag and you have |
@devsnek I'm making assertions based on the team I've worked with, where these flags where either ignored, or written in bash files from ops, not from developers using node for either tooling or backend. But if there is a type to switch mode, same way every dev at some point wrote, or understood, the Having short names for flags is easier to both type and remember, as already mentioned by @joyeecheung too ( I know |
Why? Aren't Separately, even if we are going with single-worded names, the flag |
@joyeecheung I think the idea was that there may eventually be multiple modes e.g. wasm. So if you wanted to use a wasm entry point without a file extension we would need |
this all hinges on |
@joyeecheung @devsnek fyi, there is a lot more to it than being too many --package-type=module |
@devsnek I think it might be more about it being a PITA, and that people may want to type it semi-regularly.... although that might be much more an argument for |
On a Web document, the Accordingly, |
@joyeecheung thanks for the added clarity, I think that these finer points of discussion are ultimately what it takes for us to find the most reasonable path out of "experimental" for the community at large. Would it be reasonable to consider that with this being |
Separately for a design standpoint, we need to also worry about one possible future scenario where one may have some 2018 Node.js projects that they want to use and now they will need to use So, our priorities:
So at this point, all our best arguments cannot concretely address anything beyond the first point. My opinion would be to get a small representative sample for the second one and do our best to make the best call on the third. |
how so? If I understand correctly |
This mental models seems a bit hard to follow to me - in a Web document, the code in a |
@joyeecheung the point is the context of execution ... where |
This could be a totally bad idea but...since this is going to be an experimental flag, can we display a warning for |
@MylesBorins can we consider the calculus on us having a feedback structure baked in from the get-go? |
We absolutely could. Currently every time the
That could easily display more text, including a URL, if the Node core team approves. We could also limit the additional text to appear only when |
@GeoffreyBooth so how about the means for which we would set it up so that this URL provides a well controlled way for reliable feedback (ie both UX and sampling validity considerations) — thoughts? |
i don't believe a poll is the correct way to design features in node (or really anything). a user of node has no obligation or intensive to think about node's design choices and probably is not well versed in our roadmap and intentions. that's why we have groups of people who are invested in understanding and driving node's forward movement. |
The question to be had is if it would be reasonable UX wise, and that is where the user tells us, the flip side is what aligns, and this is a separate consideration per comments. @devsnek please review my earlier comment — Also, re point (1) this was what the focus of everything we did as a team leading up to last week's meeting. |
In my notes from our last meeting, the only reasoning given by @ljharb as to why he objected to a package scoped Can I suggest that maybe this desire be amended slightly to be “wanting users who publish to the npm registry to need to change their files”? Because if this is acceptable, then either the current or the proposed package scoped |
A package scoped |
This is more true of a flag that affects only the entry point, because then these loaders you’re describing need to check if the entry point is incongruent with the Whereas if the flag is just a proxy for The bottom line is that we need |
Before I write anything at all, can anyone please describe what does Assuming I understand that means the scope is ESM so that files with a |
@WebReflection The new docs explain it pretty well. |
Let me clarify: The above isn't meant to block upstream progress because I'm assuming we can always iterate after getting it upstream. But I would vastly prefer renaming the flag to extending its scope. It's especially useful when there is no |
To clarify further: For me the first priority is to land upstream. From then on we can keep iterating and have further discussions. It's all still malleable (even if we need to stop bikeshedding eventually). :) |
@GeoffreyBooth thanks. Accordingly, if this flag is supposed to mimic exactly the same behavior, I'd go for Any other behavior or name that won't mimic that |
I meant in the far future, where one possibility would be that in 2018 the default and only js thing in Node.js was |
specifically that the name of the flag
--type
is too generic. I've renamed it --entry-type. There is also the question regarding if it should be scope to entry point or be an alias to override package.type... basically the exact conversation from the last meetingLatest comment nodejs/node#26745 (comment)
Implementation nodejs/node@59a4ef8
The text was updated successfully, but these errors were encountered: