add --cache option to 6to5-node
This commit is contained in:
parent
e8f0c8e8a4
commit
c290a008b2
@ -1,13 +1,14 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
var commander = require("commander");
|
var roadrunner = require("roadrunner");
|
||||||
var Module = require("module");
|
var commander = require("commander");
|
||||||
var path = require("path");
|
var Module = require("module");
|
||||||
var repl = require("repl");
|
var path = require("path");
|
||||||
var to5 = require("../lib/6to5");
|
var repl = require("repl");
|
||||||
var util = require("../lib/6to5/util");
|
var to5 = require("../lib/6to5");
|
||||||
var vm = require("vm");
|
var util = require("../lib/6to5/util");
|
||||||
var _ = require("lodash");
|
var vm = require("vm");
|
||||||
|
var _ = require("lodash");
|
||||||
|
|
||||||
commander.option("-e, --eval [script]", "Evaluate script");
|
commander.option("-e, --eval [script]", "Evaluate script");
|
||||||
commander.option("-p, --print", "Evaluate script and print result");
|
commander.option("-p, --print", "Evaluate script and print result");
|
||||||
@ -15,19 +16,23 @@ commander.option("-i, --ignore [regex]", "Ignore all files that match this regex
|
|||||||
commander.option("-x, --extensions [extensions]", "List of extensions to hook into [.es6,.js]");
|
commander.option("-x, --extensions [extensions]", "List of extensions to hook into [.es6,.js]");
|
||||||
commander.option("-r, --experimental", "Enable experimental support for proposed ES7 features");
|
commander.option("-r, --experimental", "Enable experimental support for proposed ES7 features");
|
||||||
commander.option("-g, --playground", "Enable playground support");
|
commander.option("-g, --playground", "Enable playground support");
|
||||||
|
commander.option("-c, --cache", "Cache compiled files and require paths");
|
||||||
|
|
||||||
var pkg = require("../package.json");
|
var pkg = require("../package.json");
|
||||||
commander.version(pkg.version);
|
commander.version(pkg.version);
|
||||||
commander.usage("[options] [ -e script | script.js ] [arguments]");
|
commander.usage("[options] [ -e script | script.js ] [arguments]");
|
||||||
commander.parse(process.argv);
|
commander.parse(process.argv);
|
||||||
|
|
||||||
|
if (commander.cache) roadrunner.load();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
to5.register({
|
to5.register({
|
||||||
experimental: commander.experimental,
|
experimental: commander.experimental,
|
||||||
extensions: commander.extensions,
|
extensions: commander.extensions,
|
||||||
playground: commander.playground,
|
playground: commander.playground,
|
||||||
ignore: commander.ignore
|
ignore: commander.ignore,
|
||||||
|
cache: commander.cache && roadrunner.get("6to5")
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -72,6 +77,8 @@ if (commander.eval) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (commander.cache) roadrunner.save();
|
||||||
|
|
||||||
function replStart() {
|
function replStart() {
|
||||||
repl.start({
|
repl.start({
|
||||||
prompt: "> ",
|
prompt: "> ",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user