This repository has been archived by the owner on Apr 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Warn about --type
with shebang
#37
Closed
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
91bfcce
esm: remove .json support
guybedford a36048c
esm: remove .node support
MylesBorins 5f0de42
esm: remove .js support
MylesBorins 52f316a
esm: remove node specifier resolution algorithm
MylesBorins 35461ad
doc: document minimal kernel
MylesBorins ed6814e
esm: Remove --loader.
jdalton 12f1e8d
esm: minimal resolver spec and implementation refinements
guybedford 7d5e258
specify import file specifier resolution proposal
guybedford 0fb0529
irp type implementation
guybedford 557490b
esm: top-level --type, -m flags, spec updates
guybedford 968c8f1
esm: implement top-level --type flag, type:esm -> type:module
guybedford 12905b0
Warn about `--type` with shebang
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
should perhaps (like
io.js
provided bothiojs
andnode
binaries) node provide anode-esm
or similar binary, so they can use that in the shebang instead?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.
Yeah, I assume that'll be where it's heading. The question would be: Would this make a better general command / should it replace
node
as the "default" binary people would run?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.
Only if they're invoking node on an extensionless ESM file - if the file has an extension, or if it's CJS, then
node
would still be preferred.Since package.json bins can have extensions, this really only affects executable one-off ESM scripts, which won't be the majority (but are still an important use case)
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.
Right, but if
node-esm
always works (after porting your code to ESM) andnode
works most of the time - why would you ever tempt fate and usenode
?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 wouldn't bet on another binary for this --mode option, given opposition to the design of the option, and the weight of an extra binary for very little configuration.
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.
@jkrems it wouldn't work on CJS files, and i'd expect it to throw if you tried to run with
--type=esm
on a file that had a non-esm file extension - the better question would be why would you tempt fate and use the alternative :-)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.
How about something like:
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.
it'd be anything that respects exec(3), so most POSIX platforms
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.
Sure, updated to posix.
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.
Feel free to update the commit directly. This PR is just me suggesting a fix to an earlier PR, I don't have any personal attachment to the exact wording. :)