Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2053610429 | ||
|
|
cd4f83b299 | ||
|
|
ec29ba19a9 | ||
|
|
9dc03e0978 | ||
|
|
bc4258eca9 | ||
|
|
b0e58f9770 | ||
|
|
a1e2641c91 | ||
|
|
9108422f99 | ||
|
|
9e8f4b25ca | ||
|
|
1cecd24823 | ||
|
|
97f6e1469b | ||
|
|
ec46eaf224 | ||
|
|
a102692103 | ||
|
|
0376ec8ff0 | ||
|
|
5932a07610 |
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.
|
||||
|
||||
## 5.5.3
|
||||
|
||||
* **Bug Fix**
|
||||
* Fix weird state bug when traversing overa `node` `ClassProperty` instead of `path` in the `es6.classes` transformer.
|
||||
|
||||
## 5.5.2
|
||||
|
||||
* **Bug Fix**
|
||||
* Fix `NodePath#isPure` on `Property` nodes.
|
||||
* Use cwd instead of entry file directory when working out relative directory for `babel/register`.
|
||||
* **Internal**
|
||||
* Add scary warning for those few who choose to use the WIP experimental transformers.
|
||||
|
||||
## 5.5.1
|
||||
|
||||
* **Bug Fix**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel-core",
|
||||
"description": "A compiler for writing next generation JavaScript",
|
||||
"version": "5.5.1",
|
||||
"version": "5.5.3",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "babel",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "5.5.0",
|
||||
"version": "5.5.2",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"repository": "babel/babel",
|
||||
"preferGlobal": true,
|
||||
"dependencies": {
|
||||
"babel-core": "^5.5.0",
|
||||
"babel-core": "^5.5.2",
|
||||
"chokidar": "^1.0.0",
|
||||
"commander": "^2.6.0",
|
||||
"convert-source-map": "^1.1.0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel-runtime",
|
||||
"description": "babel selfContained runtime",
|
||||
"version": "5.5.0",
|
||||
"version": "5.5.2",
|
||||
"license": "MIT",
|
||||
"repository": "babel/babel",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
|
||||
@@ -38,7 +38,7 @@ var only;
|
||||
var oldHandlers = {};
|
||||
var maps = {};
|
||||
|
||||
var cwd = require.main ? require.main.filename : process.cwd();
|
||||
var cwd = process.cwd();
|
||||
|
||||
var getRelativePath = function (filename){
|
||||
return path.relative(cwd, filename);
|
||||
|
||||
@@ -16,6 +16,10 @@ export default class Logger {
|
||||
return parts;
|
||||
}
|
||||
|
||||
warn(msg) {
|
||||
console.warn(this._buildMessage(msg));
|
||||
}
|
||||
|
||||
error(msg: string, Constructor = Error) {
|
||||
throw new Constructor(this._buildMessage(msg));
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@
|
||||
},
|
||||
|
||||
"experimental": {
|
||||
"deprecated": "use `--stage 0`/`{ stage: 0 }` instead"
|
||||
"description": "allow use of experimental transformers",
|
||||
"default": false
|
||||
},
|
||||
|
||||
"highlightCode": {
|
||||
|
||||
@@ -13,6 +13,12 @@ export default class TransformerPass {
|
||||
this.handlers = transformer.handlers;
|
||||
this.file = file;
|
||||
this.key = transformer.key;
|
||||
|
||||
if (this.canTransform() && transformer.metadata.experimental && !file.opts.experimental) {
|
||||
file.log.warn(`THE TRANSFORMER ${this.key} HAS BEEN MARKED AS EXPERIMENTAL AND IS WIP. USE AT YOUR OWN RISK. ` +
|
||||
"THIS WILL HIGHLY LIKELY BREAK YOUR CODE SO USE WITH **EXTREME** CAUTION. ENABLE THE " +
|
||||
"`experimental` OPTION TO IGNORE THIS WARNING.");
|
||||
}
|
||||
}
|
||||
|
||||
canTransform(): boolean {
|
||||
|
||||
@@ -293,7 +293,7 @@ class ClassTransformer {
|
||||
this.pushMethod(node, path);
|
||||
}
|
||||
} else if (t.isClassProperty(node)) {
|
||||
this.pushProperty(node);
|
||||
this.pushProperty(node, path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,8 +478,8 @@ class ClassTransformer {
|
||||
* Description
|
||||
*/
|
||||
|
||||
pushProperty(node: { type: "ClassProperty" }) {
|
||||
this.scope.traverse(node, collectPropertyReferencesVisitor, {
|
||||
pushProperty(node: { type: "ClassProperty" }, path: NodePath) {
|
||||
path.traverse(collectPropertyReferencesVisitor, {
|
||||
references: this.instancePropRefs,
|
||||
scope: this.scope
|
||||
});
|
||||
|
||||
@@ -2,7 +2,8 @@ import * as t from "../../../types";
|
||||
|
||||
export var metadata = {
|
||||
optional: true,
|
||||
group: "builtin-prepass"
|
||||
group: "builtin-prepass",
|
||||
experimental: true
|
||||
};
|
||||
|
||||
export function AssignmentExpression() {
|
||||
|
||||
@@ -19,7 +19,8 @@ function toStatements(node) {
|
||||
|
||||
export var metadata = {
|
||||
optional: true,
|
||||
group: "builtin-pre"
|
||||
group: "builtin-pre",
|
||||
experimental: true
|
||||
};
|
||||
|
||||
export function ReferencedIdentifier(node, parent, scope) {
|
||||
|
||||
@@ -190,6 +190,10 @@ export function _inferTypeAnnotation(force?: boolean): ?Object {
|
||||
return t.genericTypeAnnotation(t.identifier("Function"));
|
||||
}
|
||||
|
||||
if (path.isTemplateLiteral()) {
|
||||
return t.stringTypeAnnotation();
|
||||
}
|
||||
|
||||
if (path.isUnaryExpression()) {
|
||||
let operator = node.operator;
|
||||
|
||||
@@ -273,8 +277,11 @@ export function _inferTypeAnnotation(force?: boolean): ?Object {
|
||||
if (node.regex) return t.genericTypeAnnotation(t.identifier("RegExp"));
|
||||
}
|
||||
|
||||
if (path.isCallExpression()) {
|
||||
var callee = path.get("callee").resolve();
|
||||
var callPath;
|
||||
if (path.isCallExpression()) callPath = path.get("callee");
|
||||
if (path.isTaggedTemplateExpression()) callPath = path.get("tag");
|
||||
if (callPath) {
|
||||
var callee = callPath.resolve();
|
||||
// todo: read typescript/flow interfaces
|
||||
if (callee.isNodeType("Function")) return callee.node.returnType;
|
||||
}
|
||||
|
||||
@@ -585,8 +585,8 @@ export default class Scope {
|
||||
}
|
||||
return true;
|
||||
} else if (t.isProperty(node)) {
|
||||
if (node.computed && !t.isPure(node.key, constantsOnly)) return false;
|
||||
return t.isPure(node.value, constantsOnly);
|
||||
if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
|
||||
return this.isPure(node.value, constantsOnly);
|
||||
} else {
|
||||
return t.isPure(node);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
for (var key in foo) {
|
||||
break;
|
||||
foo();
|
||||
}
|
||||
|
||||
function bar() {
|
||||
yes();
|
||||
bar();
|
||||
return "wow";
|
||||
nomore();
|
||||
}
|
||||
|
||||
bar();
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
for (var key in foo) {
|
||||
break;
|
||||
}
|
||||
|
||||
function bar() {
|
||||
yes();
|
||||
bar();
|
||||
return "wow";
|
||||
}
|
||||
|
||||
bar();
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"experimental": true,
|
||||
"externalHelpers": true,
|
||||
"noCheckAst": true,
|
||||
"blacklist": ["regenerator"],
|
||||
|
||||
Reference in New Issue
Block a user