parcel-bundler / parcel

The zero configuration build tool for the web. 📦🚀
https://parceljs.org
MIT License
43.38k stars 2.27k forks source link

Accept stdin #3189

Open fregante opened 5 years ago

fregante commented 5 years ago

🙋 Feature request

cat 'require("foo")("foo this")' | parcel-bundler build -

Like browserify does, accept stdin as if it was a file in the current directory (for the module resolution cwd)

🤔 Expected Behavior

Exactly like this:

cat 'require("foo")("foo this")' > index.js && parcel-bundler build index.js

🔦 Context

This would let me create easy bundles without having to go through files that have to be deleted and/or gitignored.

💻 Examples

echo 'console.log("Hello!");' | browserify - 
mischnic commented 5 years ago

How would parcel know in this example that you passed Javascript and not HTML or CSS? With a --stdin-type flag?

fregante commented 5 years ago

That's a good point. I see three options:

Probably only the last one is sane.

Edit: prior art in node https://nodejs.org/api/esm.html#esm_code_input_type_code_flag