New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement stdin input #3312
Implement stdin input #3312
Conversation
Also TODO: Fix tests on Windows. |
Codecov Report
@@ Coverage Diff @@
## master #3312 +/- ##
==========================================
+ Coverage 93.13% 93.17% +0.04%
==========================================
Files 172 172
Lines 6062 6041 -21
Branches 1809 1801 -8
==========================================
- Hits 5646 5629 -17
Misses 221 221
+ Partials 195 191 -4
Continue to review full report at Codecov.
|
Ready to be merged now |
LGTM. All my command line stdin scenarios continue to work. Overriding all file inputs in the rollup config with How might one enable stdin functionality from the API if they wanted to? Is the stdin plugin exported or accessible somehow? Users will likely want to know how to process typescript or other input formats from stdin. Probably not possible unless one would have the ability to specify an implied stdin filename suffix somehow. |
I was wondering about this but I could not come up with a reasonable scenario where the API user should not rather collect and handle stdin themselves. stdin is a singleton and should IMO be the responsibility of the parent application and not the framework, which is why I moved it to the CLI part.
Interesting question. Maybe we should extend it to allow any suffix with '-' |
I suspect that API users requiring stdin input would end up copying
As long as the default CLI stdin user experience remains the same and assumes ECMAScript, sure. But neither of these issues is a showstopper and could be implemented in future PRs. |
Agreed, this could all be added in non-breaking PRs.
It is, but the longer I think about it, it also makes the |
Good call. The |
Should you ever decide to expose the stdin plugin used in this PR, be aware that it has a data race if there are multiple callers of |
Upon further examination of the stdin plugin I now see that |
77694f4
to
ae7e61c
Compare
* Only allow '-' to use stdin with the JS API * Use locally installed shx * Add test for stdin read error
* Move stdin logic to CLI * Only use stdin as input by default when there is no config file
* Override input with stdin with --stdin CLI flag
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Closes #1440
Closes #3276
Closes #3290
Description
This continues #3290 by @kzc. Unfortunately, the original repository was removed, which is why I moved it to the main Rollup repo.
Changes:
--stdin
flag. This will replace all inputs in a config file.-
as module name will read this module from stdin.-
a regular module name by passing the--no-stdin
CLI flagDocumentation is still missing, otherwise it should be fully functional.