Make `--print` respect --input-type=module
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 122k
- Forks
- 37.3k
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 283
Description
What is the problem this feature will solve?
This doesn't work, but it should:
node -p 'await Promise.resolve(123)' --input-type=module
Related to https://github.com/nodejs/node/issues/45924#issuecomment-2751207324 - but that was about --print and --eval. It seems to be fixed for --eval but not for --print
Note: bun -p 'await Promise.resolve(123)' works
What is the feature you are proposing to solve the problem?
Make a similar change to whatever fixed #45924
What alternatives have you considered?
bun
Note: node -e 'console.log(await Promise.resolve(123))' --input-type=module does work, but it's not always possible to use a console.log, especially when using node -p in a piped bash expression
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with node -p 'await Promise.resolve(123)' --input-type=module, then compare how the --eval path was changed for issue #45924. Trace the command-line handling for --print and --input-type=module; done means the example evaluates successfully with the expected printed result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100