add includeRegenerator option
This commit is contained in:
parent
f97bd584f7
commit
49cdacbcb4
@ -25,6 +25,7 @@ commander.option("-I, --indent [width]", "Indent width [2]", 2);
|
|||||||
commander.option("-a, --amd-module-ids", "Insert module id in AMD modules", false); // todo: remove in 3.0.0
|
commander.option("-a, --amd-module-ids", "Insert module id in AMD modules", false); // todo: remove in 3.0.0
|
||||||
commander.option("-m, --module-ids", "Insert module id in modules", false);
|
commander.option("-m, --module-ids", "Insert module id in modules", false);
|
||||||
commander.option("-R, --react-compat", "Makes the react transformer produce pre-v0.12 code");
|
commander.option("-R, --react-compat", "Makes the react transformer produce pre-v0.12 code");
|
||||||
|
commander.option("-E, --include-regenerator", "Include the regenerator runtime if necessary", false);
|
||||||
|
|
||||||
commander.on("--help", function(){
|
commander.on("--help", function(){
|
||||||
var outKeys = function (title, obj) {
|
var outKeys = function (title, obj) {
|
||||||
@ -100,8 +101,10 @@ if (errors.length) {
|
|||||||
//
|
//
|
||||||
|
|
||||||
exports.opts = {
|
exports.opts = {
|
||||||
|
includeRegenerator: commander.includeRegenerator,
|
||||||
sourceMapName: commander.outFile,
|
sourceMapName: commander.outFile,
|
||||||
experimental: commander.experimental,
|
experimental: commander.experimental,
|
||||||
|
reactCompat: commander.reactCompat,
|
||||||
playground: commander.playground,
|
playground: commander.playground,
|
||||||
moduleIds: commander.amdModuleIds || commander.moduleIds,
|
moduleIds: commander.amdModuleIds || commander.moduleIds,
|
||||||
blacklist: commander.blacklist,
|
blacklist: commander.blacklist,
|
||||||
@ -111,7 +114,6 @@ exports.opts = {
|
|||||||
comments: !commander.removeComments,
|
comments: !commander.removeComments,
|
||||||
runtime: commander.runtime,
|
runtime: commander.runtime,
|
||||||
modules: commander.modules,
|
modules: commander.modules,
|
||||||
reactCompat: commander.reactCompat,
|
|
||||||
format: {
|
format: {
|
||||||
indent: {
|
indent: {
|
||||||
style: util.repeat(parseInt(commander.indent))
|
style: util.repeat(parseInt(commander.indent))
|
||||||
|
|||||||
@ -48,6 +48,7 @@ File.normaliseOptions = function (opts) {
|
|||||||
opts = _.cloneDeep(opts || {});
|
opts = _.cloneDeep(opts || {});
|
||||||
|
|
||||||
_.defaults(opts, {
|
_.defaults(opts, {
|
||||||
|
includeRegenerator: false,
|
||||||
experimental: false,
|
experimental: false,
|
||||||
reactCompat: false,
|
reactCompat: false,
|
||||||
playground: false,
|
playground: false,
|
||||||
|
|||||||
@ -1,3 +1,9 @@
|
|||||||
|
var regenerator = require("regenerator");
|
||||||
|
|
||||||
exports.ast = {
|
exports.ast = {
|
||||||
before: require("regenerator").transform
|
before: function (ast, file) {
|
||||||
|
regenerator.transform(ast, {
|
||||||
|
includeRuntime: file.opts.includeRegenerator && "if used"
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user