Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b046a6ecb | ||
|
|
3b8ed0d401 | ||
|
|
d4c98d7738 | ||
|
|
4e44af819f | ||
|
|
a65acd73ca | ||
|
|
b7cb2bcb7b | ||
|
|
5ac4dc0541 | ||
|
|
99ddd02b0a | ||
|
|
19cfee14fd |
13
CHANGELOG.md
13
CHANGELOG.md
@@ -13,6 +13,19 @@ _Note: Gaps between patch versions are faulty/broken releases._
|
||||
|
||||
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
|
||||
|
||||
## 4.6.5
|
||||
|
||||
* **Internal**
|
||||
* `useStrict` transformer has been renamed to `strict`.
|
||||
|
||||
## 4.6.4
|
||||
|
||||
* **Bug Fix**
|
||||
* Fix `ForOfStatement` not proplery inheriting labels.
|
||||
* When in closure mode in block scoping transformer, properly check for variable shadowing.
|
||||
* **New Feature**
|
||||
* New `utility.inlineEnvironmentVariables` and `utility.inlineExpression` transformers.
|
||||
|
||||
## 4.6.3
|
||||
|
||||
* **Bug Fix**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "4.6.4",
|
||||
"version": "4.6.5",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"repository": "babel/babel",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel-runtime",
|
||||
"description": "babel selfContained runtime",
|
||||
"version": "4.6.3",
|
||||
"version": "4.6.4",
|
||||
"repository": "babel/babel",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>"
|
||||
}
|
||||
@@ -388,7 +388,7 @@ export default class File {
|
||||
var opts = this.opts;
|
||||
|
||||
opts.allowImportExportEverywhere = this.isLoose("es6.modules");
|
||||
opts.strictMode = this.transformers.useStrict.canRun();
|
||||
opts.strictMode = this.transformers.strict.canRun();
|
||||
|
||||
return parse(opts, code, (tree) => {
|
||||
this.transform(tree);
|
||||
|
||||
@@ -25,7 +25,10 @@ transform._ensureTransformerNames = function (type, rawKeys) {
|
||||
var key = rawKeys[i];
|
||||
|
||||
var deprecatedKey = transform.deprecatedTransformerMap[key];
|
||||
if (deprecatedKey) {
|
||||
var aliasKey = transform.aliasTransformerMap[key];
|
||||
if (aliasKey) {
|
||||
keys.push(aliasKey);
|
||||
} else if (deprecatedKey) {
|
||||
// deprecated key, remap it to the new one
|
||||
console.error("The transformer " + key + " has been renamed to " + deprecatedKey);
|
||||
rawKeys.push(deprecatedKey);
|
||||
@@ -49,6 +52,7 @@ transform.transformers = object();
|
||||
transform.namespaces = object();
|
||||
|
||||
transform.deprecatedTransformerMap = require("./transformers/deprecated");
|
||||
transform.aliasTransformerMap = require("./transformers/aliases");
|
||||
transform.moduleFormatters = require("./modules");
|
||||
|
||||
import rawTransformers from "./transformers";
|
||||
|
||||
3
src/babel/transformation/transformers/aliases.json
Normal file
3
src/babel/transformation/transformers/aliases.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"useStrict": "strict"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
export default {
|
||||
useStrict: require("./other/use-strict"),
|
||||
strict: require("./other/strict"),
|
||||
|
||||
"validation.undeclaredVariableCheck": require("./validation/undeclared-variable-check"),
|
||||
"validation.noForInOfAssignment": require("./validation/no-for-in-of-assignment"),
|
||||
@@ -97,7 +97,7 @@ export default {
|
||||
"spec.typeofSymbol": require("./spec/typeof-symbol"),
|
||||
"spec.undefinedToVoid": require("./spec/undefined-to-void"),
|
||||
|
||||
_useStrict: require("./internal/use-strict"),
|
||||
_strict: require("./internal/strict"),
|
||||
_moduleFormatter: require("./internal/module-formatter"),
|
||||
|
||||
"es3.propertyLiterals": require("./es3/property-literals"),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as useStrict from "../../helpers/use-strict";
|
||||
import * as strict from "../../helpers/strict";
|
||||
import t from "../../../types";
|
||||
|
||||
export var secondPass = true;
|
||||
@@ -6,7 +6,7 @@ export var secondPass = true;
|
||||
export function BlockStatement(node, parent, scope, file) {
|
||||
if (!node._declarations) return;
|
||||
|
||||
useStrict.wrap(node, function () {
|
||||
strict.wrap(node, function () {
|
||||
var kinds = {};
|
||||
var kind;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import * as useStrict from "../../helpers/use-strict";
|
||||
import * as strict from "../../helpers/strict";
|
||||
|
||||
export function Program(program, parent, scope, file) {
|
||||
if (!file.transformers["es6.modules"].canRun()) return;
|
||||
|
||||
useStrict.wrap(program, function () {
|
||||
strict.wrap(program, function () {
|
||||
program.body = file.dynamicImports.concat(program.body);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import t from "../../../types";
|
||||
|
||||
export function Program(program, parent, scope, file) {
|
||||
if (file.transformers.useStrict.canRun()) {
|
||||
if (file.transformers.strict.canRun()) {
|
||||
program.body.unshift(t.expressionStatement(t.literal("use strict")));
|
||||
}
|
||||
}
|
||||
@@ -13,12 +13,12 @@ export function Class(node) {
|
||||
node.implements = null;
|
||||
}
|
||||
|
||||
export function Function(node) {
|
||||
exports.Function = function (node) {
|
||||
for (var i = 0; i < node.params.length; i++) {
|
||||
var param = node.params[i];
|
||||
param.optional = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export function TypeCastExpression(node) {
|
||||
return node.expression;
|
||||
|
||||
@@ -887,25 +887,17 @@ t.evaluate = function (node) {
|
||||
}
|
||||
|
||||
if (t.isUnaryExpression(node, { prefix: true })) {
|
||||
var arg = evaluate(node.argument);
|
||||
switch (node.operator) {
|
||||
case "void": return undefined;
|
||||
case "!": return !evaluate(node.argument);
|
||||
case "+": return +evaluate(node.argument);
|
||||
case "-": return -evaluate(node.argument);
|
||||
case "!": return !arg;
|
||||
case "+": return +arg;
|
||||
case "-": return -arg;
|
||||
}
|
||||
}
|
||||
|
||||
if (t.isArrayExpression(node)) {
|
||||
// possible perf issues - could deopt on X elements
|
||||
var values = [];
|
||||
for (var i = 0; i < node.elements.length; i++) {
|
||||
values.push(evaluate(node.elements[i]));
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
if (t.isObjectExpression(node)) {
|
||||
// todo: deopt on mutable computed property keys etc
|
||||
if (t.isArrayExpression(node) || t.isObjectExpression(node)) {
|
||||
// we could evaluate these but it's probably impractical and not very useful
|
||||
}
|
||||
|
||||
if (t.isLogicalExpression(node)) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"blacklist": "useStrict",
|
||||
"blacklist": "strict",
|
||||
"optional": "reactCompat"
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"blacklist": ["useStrict", "es6.tailCall"]
|
||||
"blacklist": ["strict", "es6.tailCall"]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"blacklist": ["useStrict"]
|
||||
"blacklist": ["strict"]
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ suite("kangax/compat-table", function () {
|
||||
test(key, function () {
|
||||
code = transform(code, {
|
||||
filename: key,
|
||||
blacklist: ["useStrict"],
|
||||
blacklist: ["strict"],
|
||||
optional: ["spec.typeofSymbol", "es6.blockScopingTDZ"]
|
||||
}).code;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ var regeneratorLoc = __dirname + "/../vendor/regenerator";
|
||||
suite("regenerator", function () {
|
||||
setup(function () {
|
||||
require("../register")({
|
||||
blacklist: ["useStrict"],
|
||||
blacklist: ["strict"],
|
||||
experimental: true
|
||||
});
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ var check = function (loc) {
|
||||
|
||||
transform(file, {
|
||||
filename: loc,
|
||||
blacklist: ["useStrict"],
|
||||
blacklist: ["strict"],
|
||||
_anal: true
|
||||
});
|
||||
} catch (err) {
|
||||
|
||||
@@ -86,6 +86,6 @@ require("./_transformation-helper")({
|
||||
experimental: true
|
||||
}, function (opts, task) {
|
||||
if (!_.contains(task.exec.loc, "module.js")) {
|
||||
opts.blacklist = ["useStrict"];
|
||||
opts.blacklist = ["strict"];
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user