Make `--print` respect --input-type=module
未关闭
还没有人认领这个 Issue。
feature request
never-stale
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.4k
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 272
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用 node -p 'await Promise.resolve(123)' --input-type=module 重现该问题,然后比较针对 issue #45924 对 --eval 路径所做的更改。跟踪 --print 和 --input-type=module 的命令行处理;当示例能够成功求值并输出预期结果时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- cli
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100