rename selfContained transformer to runtime
This commit is contained in:
parent
5deaeba3a0
commit
55357a331d
@ -176,7 +176,7 @@ File.prototype.normalizeOptions = function (opts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opts.externalHelpers) {
|
if (opts.externalHelpers) {
|
||||||
this.set("runtimeIdentifier", t.identifier("babelHelpers"));
|
this.set("helpersNamespace", t.identifier("babelHelpers"));
|
||||||
}
|
}
|
||||||
|
|
||||||
opts.blacklist = transform._ensureTransformerNames("blacklist", opts.blacklist);
|
opts.blacklist = transform._ensureTransformerNames("blacklist", opts.blacklist);
|
||||||
@ -333,7 +333,7 @@ File.prototype.addHelper = function (name) {
|
|||||||
var declar = program._declarations && program._declarations[name];
|
var declar = program._declarations && program._declarations[name];
|
||||||
if (declar) return declar.id;
|
if (declar) return declar.id;
|
||||||
|
|
||||||
var runtime = this.get("runtimeIdentifier");
|
var runtime = this.get("helpersNamespace");
|
||||||
if (runtime) {
|
if (runtime) {
|
||||||
name = t.identifier(t.toIdentifier(name));
|
name = t.identifier(t.toIdentifier(name));
|
||||||
return t.memberExpression(runtime, name);
|
return t.memberExpression(runtime, name);
|
||||||
|
|||||||
@ -1 +1,3 @@
|
|||||||
{}
|
{
|
||||||
|
"selfContained": "runtime"
|
||||||
|
}
|
||||||
|
|||||||
@ -79,7 +79,7 @@ module.exports = {
|
|||||||
// needs to be after `regenerator` due to needing `regeneratorRuntime` references
|
// 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 after `es6.forOf` due to needing `Symbol.iterator` references
|
||||||
// needs to be before `es6.modules` due to dynamic imports
|
// 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
|
// needs to be before `_blockHoist` due to function hoisting etc
|
||||||
"es6.modules": require("./es6/modules"),
|
"es6.modules": require("./es6/modules"),
|
||||||
|
|||||||
@ -82,7 +82,7 @@ exports.Program = function (node, parent, scope, file) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.pre = function (file) {
|
exports.pre = function (file) {
|
||||||
file.setDynamic("runtimeIdentifier", function () {
|
file.setDynamic("helpersNamespace", function () {
|
||||||
return file.addImport("babel-runtime/helpers", "babelHelpers");
|
return file.addImport("babel-runtime/helpers", "babelHelpers");
|
||||||
});
|
});
|
||||||
|
|
||||||
4
test/fixtures/transformation/runtime/options.json
vendored
Normal file
4
test/fixtures/transformation/runtime/options.json
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"optional": ["runtime"],
|
||||||
|
"experimental": true
|
||||||
|
}
|
||||||
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"optional": ["selfContained"],
|
|
||||||
"experimental": true
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user