diff --git a/lib/babel/transformation/file.js b/lib/babel/transformation/file.js index 37b5e4e1e3..7e41151dc1 100644 --- a/lib/babel/transformation/file.js +++ b/lib/babel/transformation/file.js @@ -176,7 +176,7 @@ File.prototype.normalizeOptions = function (opts) { } if (opts.externalHelpers) { - this.set("runtimeIdentifier", t.identifier("babelHelpers")); + this.set("helpersNamespace", t.identifier("babelHelpers")); } opts.blacklist = transform._ensureTransformerNames("blacklist", opts.blacklist); @@ -333,7 +333,7 @@ File.prototype.addHelper = function (name) { var declar = program._declarations && program._declarations[name]; if (declar) return declar.id; - var runtime = this.get("runtimeIdentifier"); + var runtime = this.get("helpersNamespace"); if (runtime) { name = t.identifier(t.toIdentifier(name)); return t.memberExpression(runtime, name); diff --git a/lib/babel/transformation/transformers/deprecated.json b/lib/babel/transformation/transformers/deprecated.json index 0967ef424b..734567bd8f 100644 --- a/lib/babel/transformation/transformers/deprecated.json +++ b/lib/babel/transformation/transformers/deprecated.json @@ -1 +1,3 @@ -{} +{ + "selfContained": "runtime" +} diff --git a/lib/babel/transformation/transformers/index.js b/lib/babel/transformation/transformers/index.js index ae429df0e3..f8c9d20e60 100644 --- a/lib/babel/transformation/transformers/index.js +++ b/lib/babel/transformation/transformers/index.js @@ -79,7 +79,7 @@ module.exports = { // needs to be after `regenerator` due to needing `regeneratorRuntime` references // needs to be after `es6.forOf` due to needing `Symbol.iterator` references // needs to be before `es6.modules` due to dynamic imports - selfContained: require("./other/self-contained"), + runtime: require("./other/runtime"), // needs to be before `_blockHoist` due to function hoisting etc "es6.modules": require("./es6/modules"), diff --git a/lib/babel/transformation/transformers/other/self-contained.js b/lib/babel/transformation/transformers/other/runtime.js similarity index 98% rename from lib/babel/transformation/transformers/other/self-contained.js rename to lib/babel/transformation/transformers/other/runtime.js index eee7e94c77..6cb9f39421 100644 --- a/lib/babel/transformation/transformers/other/self-contained.js +++ b/lib/babel/transformation/transformers/other/runtime.js @@ -82,7 +82,7 @@ exports.Program = function (node, parent, scope, file) { }; exports.pre = function (file) { - file.setDynamic("runtimeIdentifier", function () { + file.setDynamic("helpersNamespace", function () { return file.addImport("babel-runtime/helpers", "babelHelpers"); }); diff --git a/test/fixtures/transformation/self-contained/aliased-constructors/actual.js b/test/fixtures/transformation/runtime/aliased-constructors/actual.js similarity index 100% rename from test/fixtures/transformation/self-contained/aliased-constructors/actual.js rename to test/fixtures/transformation/runtime/aliased-constructors/actual.js diff --git a/test/fixtures/transformation/self-contained/aliased-constructors/expected.js b/test/fixtures/transformation/runtime/aliased-constructors/expected.js similarity index 100% rename from test/fixtures/transformation/self-contained/aliased-constructors/expected.js rename to test/fixtures/transformation/runtime/aliased-constructors/expected.js diff --git a/test/fixtures/transformation/self-contained/es6-for-of/actual.js b/test/fixtures/transformation/runtime/es6-for-of/actual.js similarity index 100% rename from test/fixtures/transformation/self-contained/es6-for-of/actual.js rename to test/fixtures/transformation/runtime/es6-for-of/actual.js diff --git a/test/fixtures/transformation/self-contained/es6-for-of/expected.js b/test/fixtures/transformation/runtime/es6-for-of/expected.js similarity index 100% rename from test/fixtures/transformation/self-contained/es6-for-of/expected.js rename to test/fixtures/transformation/runtime/es6-for-of/expected.js diff --git a/test/fixtures/transformation/self-contained/es7-array-comprehensions/actual.js b/test/fixtures/transformation/runtime/es7-array-comprehensions/actual.js similarity index 100% rename from test/fixtures/transformation/self-contained/es7-array-comprehensions/actual.js rename to test/fixtures/transformation/runtime/es7-array-comprehensions/actual.js diff --git a/test/fixtures/transformation/self-contained/es7-array-comprehensions/expected.js b/test/fixtures/transformation/runtime/es7-array-comprehensions/expected.js similarity index 100% rename from test/fixtures/transformation/self-contained/es7-array-comprehensions/expected.js rename to test/fixtures/transformation/runtime/es7-array-comprehensions/expected.js diff --git a/test/fixtures/transformation/self-contained/full/actual.js b/test/fixtures/transformation/runtime/full/actual.js similarity index 100% rename from test/fixtures/transformation/self-contained/full/actual.js rename to test/fixtures/transformation/runtime/full/actual.js diff --git a/test/fixtures/transformation/self-contained/full/expected.js b/test/fixtures/transformation/runtime/full/expected.js similarity index 100% rename from test/fixtures/transformation/self-contained/full/expected.js rename to test/fixtures/transformation/runtime/full/expected.js diff --git a/test/fixtures/transformation/self-contained/modules-amd/actual.js b/test/fixtures/transformation/runtime/modules-amd/actual.js similarity index 100% rename from test/fixtures/transformation/self-contained/modules-amd/actual.js rename to test/fixtures/transformation/runtime/modules-amd/actual.js diff --git a/test/fixtures/transformation/self-contained/modules-amd/expected.js b/test/fixtures/transformation/runtime/modules-amd/expected.js similarity index 100% rename from test/fixtures/transformation/self-contained/modules-amd/expected.js rename to test/fixtures/transformation/runtime/modules-amd/expected.js diff --git a/test/fixtures/transformation/self-contained/modules-amd/options.json b/test/fixtures/transformation/runtime/modules-amd/options.json similarity index 100% rename from test/fixtures/transformation/self-contained/modules-amd/options.json rename to test/fixtures/transformation/runtime/modules-amd/options.json diff --git a/test/fixtures/transformation/self-contained/modules-common/actual.js b/test/fixtures/transformation/runtime/modules-common/actual.js similarity index 100% rename from test/fixtures/transformation/self-contained/modules-common/actual.js rename to test/fixtures/transformation/runtime/modules-common/actual.js diff --git a/test/fixtures/transformation/self-contained/modules-common/expected.js b/test/fixtures/transformation/runtime/modules-common/expected.js similarity index 100% rename from test/fixtures/transformation/self-contained/modules-common/expected.js rename to test/fixtures/transformation/runtime/modules-common/expected.js diff --git a/test/fixtures/transformation/self-contained/modules-system/actual.js b/test/fixtures/transformation/runtime/modules-system/actual.js similarity index 100% rename from test/fixtures/transformation/self-contained/modules-system/actual.js rename to test/fixtures/transformation/runtime/modules-system/actual.js diff --git a/test/fixtures/transformation/self-contained/modules-system/expected.js b/test/fixtures/transformation/runtime/modules-system/expected.js similarity index 100% rename from test/fixtures/transformation/self-contained/modules-system/expected.js rename to test/fixtures/transformation/runtime/modules-system/expected.js diff --git a/test/fixtures/transformation/self-contained/modules-system/options.json b/test/fixtures/transformation/runtime/modules-system/options.json similarity index 100% rename from test/fixtures/transformation/self-contained/modules-system/options.json rename to test/fixtures/transformation/runtime/modules-system/options.json diff --git a/test/fixtures/transformation/self-contained/modules-umd/actual.js b/test/fixtures/transformation/runtime/modules-umd/actual.js similarity index 100% rename from test/fixtures/transformation/self-contained/modules-umd/actual.js rename to test/fixtures/transformation/runtime/modules-umd/actual.js diff --git a/test/fixtures/transformation/self-contained/modules-umd/expected.js b/test/fixtures/transformation/runtime/modules-umd/expected.js similarity index 100% rename from test/fixtures/transformation/self-contained/modules-umd/expected.js rename to test/fixtures/transformation/runtime/modules-umd/expected.js diff --git a/test/fixtures/transformation/self-contained/modules-umd/options.json b/test/fixtures/transformation/runtime/modules-umd/options.json similarity index 100% rename from test/fixtures/transformation/self-contained/modules-umd/options.json rename to test/fixtures/transformation/runtime/modules-umd/options.json diff --git a/test/fixtures/transformation/runtime/options.json b/test/fixtures/transformation/runtime/options.json new file mode 100644 index 0000000000..d660db05c2 --- /dev/null +++ b/test/fixtures/transformation/runtime/options.json @@ -0,0 +1,4 @@ +{ + "optional": ["runtime"], + "experimental": true +} diff --git a/test/fixtures/transformation/self-contained/regenerator-runtime/actual.js b/test/fixtures/transformation/runtime/regenerator-runtime/actual.js similarity index 100% rename from test/fixtures/transformation/self-contained/regenerator-runtime/actual.js rename to test/fixtures/transformation/runtime/regenerator-runtime/actual.js diff --git a/test/fixtures/transformation/self-contained/regenerator-runtime/expected.js b/test/fixtures/transformation/runtime/regenerator-runtime/expected.js similarity index 100% rename from test/fixtures/transformation/self-contained/regenerator-runtime/expected.js rename to test/fixtures/transformation/runtime/regenerator-runtime/expected.js diff --git a/test/fixtures/transformation/self-contained/symbol-iterator-in/actual.js b/test/fixtures/transformation/runtime/symbol-iterator-in/actual.js similarity index 100% rename from test/fixtures/transformation/self-contained/symbol-iterator-in/actual.js rename to test/fixtures/transformation/runtime/symbol-iterator-in/actual.js diff --git a/test/fixtures/transformation/self-contained/symbol-iterator-in/expected.js b/test/fixtures/transformation/runtime/symbol-iterator-in/expected.js similarity index 100% rename from test/fixtures/transformation/self-contained/symbol-iterator-in/expected.js rename to test/fixtures/transformation/runtime/symbol-iterator-in/expected.js diff --git a/test/fixtures/transformation/self-contained/options.json b/test/fixtures/transformation/self-contained/options.json deleted file mode 100644 index 079cf304ad..0000000000 --- a/test/fixtures/transformation/self-contained/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "optional": ["selfContained"], - "experimental": true -}