diff --git a/lib/6to5/transformation/transform.js b/lib/6to5/transformation/transform.js index b64d31094a..c192ed6a1c 100644 --- a/lib/6to5/transformation/transform.js +++ b/lib/6to5/transformation/transform.js @@ -44,66 +44,65 @@ transform.moduleFormatters = { }; _.each({ - specNoForInOfAssignment: require("./transformers/spec/no-for-in-of-assignment"), - specSetters: require("./transformers/spec/setters"), - specBlockScopedFunctions: require("./transformers/spec/block-scoped-functions"), + "spec.noForInOfAssignment": require("./transformers/spec/no-for-in-of-assignment"), + "spec.setters": require("./transformers/spec/setters"), + "spec.blockScopedFunctions": require("./transformers/spec/block-scoped-functions"), - malletOperator: require("./transformers/playground/mallet-operator"), - methodBinding: require("./transformers/playground/method-binding"), - memoizationOperator: require("./transformers/playground/memoization-operator"), - objectGetterMemoization: require("./transformers/playground/object-getter-memoization"), + "playground.malletOperator": require("./transformers/playground/mallet-operator"), + "playground.methodBinding": require("./transformers/playground/method-binding"), + "playground.memoizationOperator": require("./transformers/playground/memoization-operator"), + "playground.objectGetterMemoization": require("./transformers/playground/object-getter-memoization"), - asyncToGenerator: require("./transformers/optional/async-to-generator"), - bluebirdCoroutines: require("./transformers/optional/bluebird-coroutines"), + "optional.asyncToGenerator": require("./transformers/optional/async-to-generator"), + "optional.bluebirdCoroutines": require("./transformers/optional/bluebird-coroutines"), - react: require("./transformers/other/react"), - modules: require("./transformers/es6/modules"), - comprehensions: require("./transformers/es7/comprehensions"), - arrowFunctions: require("./transformers/es6/arrow-functions"), - classes: require("./transformers/es6/classes"), + react: require("./transformers/other/react"), - objectSpread: require("./transformers/es7/object-spread"), - exponentiationOperator: require("./transformers/es7/exponentiation-operator"), - spread: require("./transformers/es6/spread"), - templateLiterals: require("./transformers/es6/template-literals"), + "es6.modules": require("./transformers/es6/modules"), + "es7.comprehensions": require("./transformers/es7/comprehensions"), + "es6.arrowFunctions": require("./transformers/es6/arrow-functions"), + "es6.classes": require("./transformers/es6/classes"), - "properties.mutators": require("./transformers/es5/properties.mutators"), - "properties.shorthand": require("./transformers/es6/properties.shorthand"), - "properties.computed": require("./transformers/es6/properties.computed"), + "es7.objectSpread": require("./transformers/es7/object-spread"), + "es7.exponentiationOperator": require("./transformers/es7/exponentiation-operator"), + "es6.spread": require("./transformers/es6/spread"), + "es6.templateLiterals": require("./transformers/es6/template-literals"), - "parameters.default": require("./transformers/es6/parameters.default"), - "parameters.rest": require("./transformers/es6/parameters.rest"), + "es5.properties.mutators": require("./transformers/es5/properties.mutators"), + "es6.properties.shorthand": require("./transformers/es6/properties.shorthand"), + "es6.properties.computed": require("./transformers/es6/properties.computed"), - destructuring: require("./transformers/es6/destructuring"), - forOf: require("./transformers/es6/for-of"), - unicodeRegex: require("./transformers/es6/unicode-regex"), - abstractReferences: require("./transformers/es7/abstract-references"), + "es6.parameters.default": require("./transformers/es6/parameters.default"), + "es6.parameters.rest": require("./transformers/es6/parameters.rest"), - constants: require("./transformers/es6/constants"), - blockScoping: require("./transformers/es6/block-scoping"), - blockScopingTDZ: require("./transformers/optional/block-scoping-tdz"), + "es6.destructuring": require("./transformers/es6/destructuring"), + "es6.forOf": require("./transformers/es6/for-of"), + "es6.unicodeRegex": require("./transformers/es6/unicode-regex"), + "es7.abstractReferences": require("./transformers/es7/abstract-references"), - _blockHoist: require("./transformers/_block-hoist"), + "es6.constants": require("./transformers/es6/constants"), + "es6.blockScoping": require("./transformers/es6/block-scoping"), + "optional.blockScopingTDZ": require("./transformers/optional/block-scoping-tdz"), - generators: require("./transformers/es6/generators"), + _blockHoist: require("./transformers/_block-hoist"), - protoToAssign: require("./transformers/optional/proto-to-assign"), + "es6.generators": require("./transformers/es6/generators"), + "optional.protoToAssign": require("./transformers/optional/proto-to-assign"), - _declarations: require("./transformers/_declarations"), + _declarations: require("./transformers/_declarations"), - // wrap up - useStrict: require("./transformers/other/use-strict"), - _aliasFunctions: require("./transformers/_alias-functions"), - _moduleFormatter: require("./transformers/_module-formatter"), + useStrict: require("./transformers/other/use-strict"), - typeofSymbol: require("./transformers/optional/typeof-symbol"), - selfContained: require("./transformers/optional/self-contained"), - undefinedToVoid: require("./transformers/optional/undefined-to-void"), - undeclaredVariableCheck: require("./transformers/optional/undeclared-variable-check"), + _aliasFunctions: require("./transformers/_alias-functions"), + _moduleFormatter: require("./transformers/_module-formatter"), - // spec - specPropertyLiterals: require("./transformers/spec/property-literals"), - specMemberExpressionLiterals: require("./transformers/spec/member-expression-literals") + "optional.typeofSymbol": require("./transformers/optional/typeof-symbol"), + "optional.selfContained": require("./transformers/optional/self-contained"), + "optional.undefinedToVoid": require("./transformers/optional/undefined-to-void"), + "optional.undeclaredVariableCheck": require("./transformers/optional/undeclared-variable-check"), + + "spec.propertyLiterals": require("./transformers/spec/property-literals"), + "spec.memberExpressionLiterals": require("./transformers/spec/member-expression-literals") }, function (transformer, key) { transform.transformers[key] = new Transformer(key, transformer); }); diff --git a/lib/6to5/transformation/transformers/_module-formatter.js b/lib/6to5/transformation/transformers/_module-formatter.js index 503543171e..4dcbe1c27f 100644 --- a/lib/6to5/transformation/transformers/_module-formatter.js +++ b/lib/6to5/transformation/transformers/_module-formatter.js @@ -4,7 +4,7 @@ var transform = require("../transform"); exports.ast = { exit: function (ast, file) { - if (!transform.transformers.modules.canRun(file)) return; + if (!transform.transformers["es6.modules"].canRun(file)) return; if (file.moduleFormatter.transform) { file.moduleFormatter.transform(ast); diff --git a/lib/6to5/transformation/transformers/es6/classes.js b/lib/6to5/transformation/transformers/es6/classes.js index 6c1b10f5b3..807be19474 100644 --- a/lib/6to5/transformation/transformers/es6/classes.js +++ b/lib/6to5/transformation/transformers/es6/classes.js @@ -48,7 +48,7 @@ function Class(node, file, scope, isStatement) { this.hasConstructor = false; this.className = node.id || file.generateUidIdentifier("class", scope); this.superName = node.superClass; - this.isLoose = file.isLoose("classes"); + this.isLoose = file.isLoose("es6.classes"); } /** diff --git a/lib/6to5/transformation/transformers/es6/for-of.js b/lib/6to5/transformation/transformers/es6/for-of.js index f7d409241e..abe0edd853 100644 --- a/lib/6to5/transformation/transformers/es6/for-of.js +++ b/lib/6to5/transformation/transformers/es6/for-of.js @@ -5,7 +5,7 @@ var t = require("../../../types"); exports.ForOfStatement = function (node, parent, scope, context, file) { var callback = spec; - if (file.isLoose("forOf")) callback = loose; + if (file.isLoose("es6.forOf")) callback = loose; var build = callback(node, parent, scope, context, file); var declar = build.declar; diff --git a/lib/6to5/transformation/transformers/es6/properties.computed.js b/lib/6to5/transformation/transformers/es6/properties.computed.js index 20fbcf6e50..e69916018f 100644 --- a/lib/6to5/transformation/transformers/es6/properties.computed.js +++ b/lib/6to5/transformation/transformers/es6/properties.computed.js @@ -24,7 +24,7 @@ exports.ObjectExpression = function (node, parent, scope, context, file) { // var callback = spec; - if (file.isLoose("properties.computed")) callback = loose; + if (file.isLoose("es6.properties.computed")) callback = loose; var result = callback(node, body, objId, initProps, file); if (result) return result; diff --git a/lib/6to5/transformation/transformers/es6/template-literals.js b/lib/6to5/transformation/transformers/es6/template-literals.js index b9a6f43150..1f5cd55014 100644 --- a/lib/6to5/transformation/transformers/es6/template-literals.js +++ b/lib/6to5/transformation/transformers/es6/template-literals.js @@ -23,7 +23,7 @@ exports.TaggedTemplateExpression = function (node, parent, scope, context, file) raw = t.arrayExpression(raw); var templateName = "tagged-template-literal"; - if (file.isLoose("templateLiterals")) templateName += "-loose"; + if (file.isLoose("es6.templateLiterals")) templateName += "-loose"; args.push(t.callExpression(file.addHelper(templateName), [strings, raw])); args = args.concat(quasi.expressions); diff --git a/lib/6to5/transformation/transformers/optional/bluebird-coroutines.js b/lib/6to5/transformation/transformers/optional/bluebird-coroutines.js index 9608c5ec9a..2057ce0b7d 100644 --- a/lib/6to5/transformation/transformers/optional/bluebird-coroutines.js +++ b/lib/6to5/transformation/transformers/optional/bluebird-coroutines.js @@ -5,7 +5,7 @@ var t = require("../../../types"); exports.manipulateOptions = function (opts) { opts.experimental = true; - opts.blacklist.push("generators"); + opts.blacklist.push("es6.generators"); }; exports.optional = true; diff --git a/test/fixtures/bin/6to5/--whitelist/options.json b/test/fixtures/bin/6to5/--whitelist/options.json index 9528c05503..a8ea889a1c 100644 --- a/test/fixtures/bin/6to5/--whitelist/options.json +++ b/test/fixtures/bin/6to5/--whitelist/options.json @@ -1,3 +1,3 @@ { - "args": ["--whitelist", "arrowFunctions"] + "args": ["--whitelist", "es6.arrowFunctions"] } diff --git a/test/fixtures/transformation/api/blacklist/options.json b/test/fixtures/transformation/api/blacklist/options.json index df04cd7c22..a0670c8dfc 100644 --- a/test/fixtures/transformation/api/blacklist/options.json +++ b/test/fixtures/transformation/api/blacklist/options.json @@ -1,3 +1,3 @@ { - "blacklist": ["arrowFunctions"] + "blacklist": ["es6.arrowFunctions"] } diff --git a/test/fixtures/transformation/api/whitelist/options.json b/test/fixtures/transformation/api/whitelist/options.json index 5c3b4e3e54..50e8ead9b1 100644 --- a/test/fixtures/transformation/api/whitelist/options.json +++ b/test/fixtures/transformation/api/whitelist/options.json @@ -1,3 +1,3 @@ { - "whitelist": ["arrowFunctions"] + "whitelist": ["es6.arrowFunctions"] } diff --git a/test/fixtures/transformation/es6-classes-loose/options.json b/test/fixtures/transformation/es6-classes-loose/options.json index b928f940e6..d4a7c9a51e 100644 --- a/test/fixtures/transformation/es6-classes-loose/options.json +++ b/test/fixtures/transformation/es6-classes-loose/options.json @@ -1,3 +1,3 @@ { - "loose": ["classes"] + "loose": ["es6.classes"] } diff --git a/test/fixtures/transformation/es6-for-of-loose/options.json b/test/fixtures/transformation/es6-for-of-loose/options.json index c2821829bf..9a6e850bce 100644 --- a/test/fixtures/transformation/es6-for-of-loose/options.json +++ b/test/fixtures/transformation/es6-for-of-loose/options.json @@ -1,3 +1,3 @@ { - "loose": ["forOf"] + "loose": ["es6.forOf"] } diff --git a/test/fixtures/transformation/es6-properties.computed-loose/options.json b/test/fixtures/transformation/es6-properties.computed-loose/options.json index 13af75f699..79da122a18 100644 --- a/test/fixtures/transformation/es6-properties.computed-loose/options.json +++ b/test/fixtures/transformation/es6-properties.computed-loose/options.json @@ -1,3 +1,3 @@ { - "loose": ["properties.computed"] + "loose": ["es6.properties.computed"] } diff --git a/test/fixtures/transformation/es6-template-literals/tag-loose/options.json b/test/fixtures/transformation/es6-template-literals/tag-loose/options.json index fe669cb1d4..8b5e72ecbe 100644 --- a/test/fixtures/transformation/es6-template-literals/tag-loose/options.json +++ b/test/fixtures/transformation/es6-template-literals/tag-loose/options.json @@ -1,3 +1,3 @@ { - "loose": ["templateLiterals"] + "loose": ["es6.templateLiterals"] }