e.g browserify main.js | prepack | uglify
Expected: pull from standard input, push to standard output.
Actual:
Missing input file.
Does anyone have a suggestion on how they would like this implemented? Pass it in as --pipe, or default the output to not have the surrounding text:
console.log("+++++++++++++++++ Prepacked source code");
console.log(code);
console.log("=================");
+1 to not having surrounding text by default. imo, CLI should be:
prepack file.js
# print prepacked file as stdout
cat file.js | prepack
# print prepacked file as stdout
You could then implement the currently default behavior in user-land as:
prepack file.js > file.js
@cblappert or @NTillmann any suggestion on how you would like it to be approached? I just don't want to submit something that's way off base.
@sebmarkbage did a rewrite of the APIs before launch and might have an opinion on this. He's been trying to model the structure off of Babel.
I think the above proposal sounds good. Given that most people will want source maps I don't know how practical it is to just pipe but it does makes it easier to get started.
For large files I think we should just print them to stdout too. It's a little scary that it silently writes a file now.
Where should warnings go? Like the warning that a source map wasn't found? stderr I guess.
@sebmarkbage I think an API like this is acceptable if you want to throw in source maps:
cat file.js | prepack --source-map foo.js.map > foo.js
You could go further and add an --output option (which redirects output to a file instead of stdout) for consistency:
cat file.js | prepack \
--output foo.js \
--source-map foo.js.map
This seems done. When should we release it?
Sorry for the late response, the code for this is merged and should be included in the latest npm package.
Most helpful comment
@sebmarkbage I think an API like this is acceptable if you want to throw in source maps:
You could go further and add an
--outputoption (which redirects output to a file instead of stdout) for consistency: