Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06a31c419a | ||
|
|
da566110c0 | ||
|
|
c12c4a5c39 | ||
|
|
d114349890 | ||
|
|
8d6ae0e1eb | ||
|
|
cb8b47ee2f | ||
|
|
daf24c5c59 | ||
|
|
cdb2784e75 | ||
|
|
93feabb82e | ||
|
|
982c142bf6 | ||
|
|
de5520a94f | ||
|
|
c239d06f10 | ||
|
|
a5fed376d8 | ||
|
|
e99fd77d89 | ||
|
|
1374863b9c | ||
|
|
e88c28f88b | ||
|
|
7a0fd26f56 | ||
|
|
17583e4807 | ||
|
|
37dd5137ff | ||
|
|
24fced406e | ||
|
|
0ab1362893 | ||
|
|
96506f4249 | ||
|
|
ed747f88bd | ||
|
|
3987545b4f | ||
|
|
148aa3f96d | ||
|
|
0cb5a7c91e | ||
|
|
fc34d5a9b0 | ||
|
|
f8d56d9612 | ||
|
|
737be0e95e | ||
|
|
26e2b392e8 |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -13,6 +13,20 @@ _Note: Gaps between patch versions are faulty/broken releases._
|
||||
|
||||
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
|
||||
|
||||
## 5.0.12
|
||||
|
||||
* **Bug Fix**
|
||||
* Fix incorrect remapping of module references inside of a function id redirection container.
|
||||
|
||||
## 5.0.11
|
||||
|
||||
* **Bug Fix**
|
||||
* Fix new `for...of` loops not properly inheriting their original loop.
|
||||
* **Internal**
|
||||
* Disable scope instance cache.
|
||||
* **Polish**
|
||||
* Allow comments in `.babelrc` JSON.
|
||||
|
||||
## 5.0.9
|
||||
|
||||
* **Polish**
|
||||
|
||||
@@ -35,13 +35,13 @@ This is mostly overkill and you can limit the tests to a select few by directly
|
||||
running them with `mocha`:
|
||||
|
||||
```sh
|
||||
$ mocha test/transformation.js
|
||||
$ mocha test/core/transformation.js
|
||||
```
|
||||
|
||||
Use mocha's `--grep` option to run a subset of tests by name:
|
||||
|
||||
```sh
|
||||
$ mocha test/transformation.js --grep es7
|
||||
$ mocha test/core/transformation.js --grep es7
|
||||
```
|
||||
|
||||
#### Workflow
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel-core",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "5.0.9",
|
||||
"version": "5.0.12",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"repository": "babel/babel",
|
||||
@@ -53,6 +53,7 @@
|
||||
"slash": "^1.0.0",
|
||||
"source-map": "^0.4.0",
|
||||
"source-map-support": "^0.2.9",
|
||||
"strip-json-comments": "^1.0.2",
|
||||
"to-fast-properties": "^1.0.0",
|
||||
"trim-right": "^1.0.0"
|
||||
},
|
||||
@@ -65,7 +66,7 @@
|
||||
"esvalid": "^1.1.0",
|
||||
"istanbul": "^0.3.5",
|
||||
"matcha": "^0.6.0",
|
||||
"mocha": "^2.1.0",
|
||||
"mocha": "2.1.0",
|
||||
"rimraf": "^2.2.8",
|
||||
"uglify-js": "^2.4.16"
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "babel",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "5.0.8",
|
||||
"version": "5.0.11",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"repository": "babel/babel",
|
||||
"preferGlobal": true,
|
||||
"dependencies": {
|
||||
"chokidar": "^0.12.6",
|
||||
"babel-core": "^5.0.8",
|
||||
"babel-core": "^5.0.11",
|
||||
"commander": "^2.6.0",
|
||||
"fs-readdir-recursive": "^0.1.0",
|
||||
"output-file-sync": "^1.1.0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel-runtime",
|
||||
"description": "babel selfContained runtime",
|
||||
"version": "5.0.8",
|
||||
"version": "5.0.11",
|
||||
"repository": "babel/babel",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"dependencies": {
|
||||
|
||||
@@ -169,4 +169,8 @@ export function MemberExpression(node, print) {
|
||||
}
|
||||
}
|
||||
|
||||
export { MemberExpression as MetaProperty };
|
||||
export function MetaProperty(node, print) {
|
||||
print(node.meta);
|
||||
this.push(".");
|
||||
print(node.property);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import stripJsonComments from "strip-json-comments";
|
||||
import merge from "lodash/object/merge";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
@@ -24,7 +25,7 @@ export default function (loc, opts = {}) {
|
||||
var json;
|
||||
|
||||
try {
|
||||
json = jsons[content] ||= JSON.parse(content);
|
||||
json = jsons[content] ||= JSON.parse(stripJsonComments(content));
|
||||
} catch (err) {
|
||||
err.message = `${file}: ${err.message}`;
|
||||
throw err;
|
||||
|
||||
@@ -27,6 +27,7 @@ var wrap = function (state, method, id, scope) {
|
||||
FUNCTION_ID: id,
|
||||
FUNCTION_KEY: scope.generateUidIdentifier(id.name)
|
||||
});
|
||||
template.callee._skipModulesRemap = true;
|
||||
|
||||
// shim in dummy params to retain function arity, if you try to read the
|
||||
// source then you'll get the original since it's proxied so it's all good
|
||||
|
||||
@@ -46,7 +46,11 @@ var remapVisitor = {
|
||||
}
|
||||
}
|
||||
|
||||
if (t.isAssignmentExpression(node)) {
|
||||
if (node._skipModulesRemap) {
|
||||
return this.skip();
|
||||
}
|
||||
|
||||
if (t.isAssignmentExpression(node) && !node._ignoreModulesRemap) {
|
||||
var exported = formatter.getExport(node.left, scope);
|
||||
if (exported) {
|
||||
this.skip();
|
||||
|
||||
@@ -30,7 +30,7 @@ var collectPropertyReferencesVisitor = {
|
||||
}
|
||||
|
||||
if (this.isReferenced() && scope.getBinding(node.name) === state.scope.getBinding(node.name)) {
|
||||
state.references[node.name] = true;;
|
||||
state.references[node.name] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,21 +170,36 @@ class ClassTransformer {
|
||||
|
||||
this.buildBody();
|
||||
|
||||
var decorators = this.node.decorators;
|
||||
var classCheckRef = classRef;
|
||||
|
||||
if (decorators) {
|
||||
classCheckRef = this.scope.generateUidIdentifier(classRef);
|
||||
}
|
||||
|
||||
constructorBody.body.unshift(t.expressionStatement(t.callExpression(file.addHelper("class-call-check"), [
|
||||
t.thisExpression(),
|
||||
classRef
|
||||
classCheckRef
|
||||
])));
|
||||
|
||||
//
|
||||
|
||||
var decorators = this.node.decorators;
|
||||
if (decorators) {
|
||||
if (this.className) {
|
||||
body.push(t.variableDeclaration("var", [
|
||||
t.variableDeclarator(classCheckRef, classRef)
|
||||
]));
|
||||
}
|
||||
|
||||
for (var i = 0; i < decorators.length; i++) {
|
||||
var decorator = decorators[i];
|
||||
body.push(util.template("class-decorator", {
|
||||
|
||||
var decoratorNode = util.template("class-decorator", {
|
||||
DECORATOR: decorator.expression,
|
||||
CLASS_REF: classRef
|
||||
}, true));
|
||||
}, true);
|
||||
decoratorNode.expression._ignoreModulesRemap = true;
|
||||
body.push(decoratorNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,6 @@ export function ForOfStatement(node, parent, scope, file) {
|
||||
var loop = build.loop;
|
||||
var block = loop.body;
|
||||
|
||||
// inherit comments from the original loop
|
||||
t.inheritsComments(loop, node);
|
||||
|
||||
// ensure that it's a block so we can take all its statements
|
||||
t.ensureBlock(node);
|
||||
|
||||
@@ -32,6 +29,7 @@ export function ForOfStatement(node, parent, scope, file) {
|
||||
block.body = block.body.concat(node.body.body);
|
||||
|
||||
t.inherits(loop, node);
|
||||
t.inherits(loop.body, node.body);
|
||||
|
||||
if (build.replaceParent) {
|
||||
this.parentPath.replaceWithMultiple(build.node);
|
||||
|
||||
@@ -80,7 +80,7 @@ export default class Scope {
|
||||
if (cached && cached.parent === parent) {
|
||||
return cached;
|
||||
} else {
|
||||
path.setData("scope", this);
|
||||
//path.setData("scope", this);
|
||||
}
|
||||
|
||||
this.parent = parent;
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"CallExpression": ["callee", "arguments"],
|
||||
"CatchClause": ["param", "body"],
|
||||
"ClassBody": ["body"],
|
||||
"ClassDeclaration": ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements"],
|
||||
"ClassExpression": ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements"],
|
||||
"ClassDeclaration": ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements", "decorators"],
|
||||
"ClassExpression": ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements", "decorators"],
|
||||
"ComprehensionBlock": ["left", "right", "body"],
|
||||
"ComprehensionExpression": ["filter", "blocks", "body"],
|
||||
"ConditionalExpression": ["test", "consequent", "alternate"],
|
||||
@@ -40,12 +40,12 @@
|
||||
"LogicalExpression": ["left", "right"],
|
||||
"MemberExpression": ["object", "property"],
|
||||
"MetaProperty": ["meta", "property"],
|
||||
"MethodDefinition": ["key", "value"],
|
||||
"MethodDefinition": ["key", "value", "decorators"],
|
||||
"NewExpression": ["callee", "arguments"],
|
||||
"ObjectExpression": ["properties"],
|
||||
"ObjectPattern": ["properties", "typeAnnotation"],
|
||||
"Program": ["body"],
|
||||
"Property": ["key", "value"],
|
||||
"Property": ["key", "value", "decorators"],
|
||||
"RestElement": ["argument", "typeAnnotation"],
|
||||
"ReturnStatement": ["argument"],
|
||||
"SequenceExpression": ["expressions"],
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import foo from "foo";
|
||||
|
||||
@foo
|
||||
export default class Foo {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _foo = require("foo");
|
||||
|
||||
var _foo2 = babelHelpers.interopRequireWildcard(_foo);
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, _Foo);
|
||||
}
|
||||
|
||||
var _Foo = Foo;
|
||||
Foo = _foo2["default"](Foo) || Foo;
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
exports["default"] = Foo;
|
||||
module.exports = exports["default"];
|
||||
@@ -12,3 +12,10 @@ var Foo2 = @bar class Foo {
|
||||
var Bar2 = @foo @bar class Bar {
|
||||
|
||||
};
|
||||
|
||||
@foo
|
||||
class Baz{
|
||||
constructor(baz) {
|
||||
this.baz = baz;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,18 +2,20 @@
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
babelHelpers.classCallCheck(this, _Foo);
|
||||
}
|
||||
|
||||
var _Foo = Foo;
|
||||
Foo = foo(Foo) || Foo;
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
var Bar = (function () {
|
||||
function Bar() {
|
||||
babelHelpers.classCallCheck(this, Bar);
|
||||
babelHelpers.classCallCheck(this, _Bar);
|
||||
}
|
||||
|
||||
var _Bar = Bar;
|
||||
Bar = foo(Bar) || Bar;
|
||||
Bar = bar(Bar) || Bar;
|
||||
return Bar;
|
||||
@@ -21,19 +23,33 @@ var Bar = (function () {
|
||||
|
||||
var Foo2 = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
babelHelpers.classCallCheck(this, _Foo2);
|
||||
}
|
||||
|
||||
var _Foo2 = Foo;
|
||||
Foo = bar(Foo) || Foo;
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
var Bar2 = (function () {
|
||||
function Bar() {
|
||||
babelHelpers.classCallCheck(this, Bar);
|
||||
babelHelpers.classCallCheck(this, _Bar2);
|
||||
}
|
||||
|
||||
var _Bar2 = Bar;
|
||||
Bar = foo(Bar) || Bar;
|
||||
Bar = bar(Bar) || Bar;
|
||||
return Bar;
|
||||
})();
|
||||
})();
|
||||
|
||||
var Baz = (function () {
|
||||
function Baz(baz) {
|
||||
babelHelpers.classCallCheck(this, _Baz);
|
||||
|
||||
this.baz = baz;
|
||||
}
|
||||
|
||||
var _Baz = Baz;
|
||||
Baz = foo(Baz) || Baz;
|
||||
return Baz;
|
||||
})();
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
function foo() {
|
||||
let input = ['a', 'b', 'c']
|
||||
let output = {}
|
||||
|
||||
for (let c of input) {
|
||||
let name = c
|
||||
output[name] = name
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
function foo() {
|
||||
var input = ['a', 'b', 'c'];
|
||||
var output = {};
|
||||
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var c = _step.value;
|
||||
|
||||
var _name = c;
|
||||
output[_name] = _name;
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator['return']) {
|
||||
_iterator['return']();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
const bug = 1;
|
||||
|
||||
function foo() {}
|
||||
|
||||
function bar() {
|
||||
var bug;
|
||||
bug = 2;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
var bug = 1;
|
||||
|
||||
function foo() {}
|
||||
|
||||
function bar() {
|
||||
var bug;
|
||||
bug = 2;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import last from "lodash/array/last"
|
||||
|
||||
export default class Container {
|
||||
last(key) {
|
||||
if (!this.has(key)) return
|
||||
return last(this.tokens.get(key))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _last2 = require("lodash/array/last");
|
||||
|
||||
var _last3 = babelHelpers.interopRequireWildcard(_last2);
|
||||
|
||||
var Container = (function () {
|
||||
function Container() {
|
||||
babelHelpers.classCallCheck(this, Container);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Container, [{
|
||||
key: "last",
|
||||
value: (function (_last) {
|
||||
function last(_x) {
|
||||
return _last.apply(this, arguments);
|
||||
}
|
||||
|
||||
last.toString = function () {
|
||||
return _last.toString();
|
||||
};
|
||||
|
||||
return last;
|
||||
})(function (key) {
|
||||
if (!this.has(key)) return;
|
||||
return _last3["default"](this.tokens.get(key));
|
||||
})
|
||||
}]);
|
||||
return Container;
|
||||
})();
|
||||
|
||||
exports["default"] = Container;
|
||||
module.exports = exports["default"];
|
||||
@@ -0,0 +1,7 @@
|
||||
import {getForm} from "./store"
|
||||
|
||||
export default class Login extends React.Component {
|
||||
getForm() {
|
||||
return getForm().toJS()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _getForm2 = require("./store");
|
||||
|
||||
var Login = (function (_React$Component) {
|
||||
function Login() {
|
||||
babelHelpers.classCallCheck(this, Login);
|
||||
|
||||
if (_React$Component != null) {
|
||||
_React$Component.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Login, _React$Component);
|
||||
babelHelpers.createClass(Login, [{
|
||||
key: "getForm",
|
||||
value: (function (_getForm) {
|
||||
function getForm() {
|
||||
return _getForm.apply(this, arguments);
|
||||
}
|
||||
|
||||
getForm.toString = function () {
|
||||
return _getForm.toString();
|
||||
};
|
||||
|
||||
return getForm;
|
||||
})(function () {
|
||||
return _getForm2.getForm().toJS();
|
||||
})
|
||||
}]);
|
||||
return Login;
|
||||
})(React.Component);
|
||||
|
||||
exports["default"] = Login;
|
||||
module.exports = exports["default"];
|
||||
@@ -0,0 +1,9 @@
|
||||
import events from "events";
|
||||
|
||||
class Template {
|
||||
events() {
|
||||
return events;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(new Template().events());
|
||||
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
var _events2 = require("events");
|
||||
|
||||
var _events3 = babelHelpers.interopRequireWildcard(_events2);
|
||||
|
||||
var Template = (function () {
|
||||
function Template() {
|
||||
babelHelpers.classCallCheck(this, Template);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Template, [{
|
||||
key: "events",
|
||||
value: (function (_events) {
|
||||
function events() {
|
||||
return _events.apply(this, arguments);
|
||||
}
|
||||
|
||||
events.toString = function () {
|
||||
return _events.toString();
|
||||
};
|
||||
|
||||
return events;
|
||||
})(function () {
|
||||
return _events3["default"];
|
||||
})
|
||||
}]);
|
||||
return Template;
|
||||
})();
|
||||
|
||||
console.log(new Template().events());
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"externalHelpers": true
|
||||
}
|
||||
Reference in New Issue
Block a user