add whitelist and blacklist options to 6to5-node - closes #588

This commit is contained in:
Sebastian McKenzie 2015-01-25 17:26:51 +11:00
parent a46f4f7873
commit 585e21a734

View File

@ -14,9 +14,11 @@ var program = new commander.Command("6to5-node");
program.option("-e, --eval [script]", "Evaluate script");
program.option("-p, --print", "Evaluate script and print result");
program.option("-i, --ignore [regex]", "Ignore all files that match this regex when using the require hook");
program.option("-x, --extensions [extensions]", "List of extensions to hook into [.es6,.js]");
program.option("-x, --extensions [extensions]", "List of extensions to hook into [.es6,.js,.es,.jsx]");
program.option("-r, --experimental", "Enable experimental support for proposed ES7 features");
program.option("-g, --playground", "Enable playground support");
program.option("-l, --whitelist [whitelist]", "Whitelist of transformers to ONLY use", util.list);
program.option("-b, --blacklist [blacklist]", "Blacklist of transformers to NOT use", util.list);
var pkg = require("../package.json");
program.version(pkg.version);
@ -29,6 +31,8 @@ to5.register({
experimental: program.experimental,
extensions: program.extensions,
playground: program.playground,
blacklist: program.blacklist,
whitelist: program.whitelist,
ignore: program.ignore
});
@ -37,7 +41,8 @@ to5.register({
var _eval = function (code, filename) {
code = to5.transform(code, {
filename: filename,
blacklist: ["useStrict"],
blacklist: ["useStrict"].concat(opts.blacklist),
whitelist: program.whitelist,
experimental: program.experimental,
playground: program.playground
}).code;