babel-core
Advanced tools
Comparing version 5.1.2 to 5.1.3
@@ -16,2 +16,11 @@ # Changelog | ||
## 5.1.3 | ||
* **Internal** | ||
* Switch entirely to vanilla regenerator. | ||
* Clean up and make the parsing of decorators stateless. | ||
* **Bug Fix** | ||
* Don't do TCO on generators and async functions. | ||
* Add missing `core-js` runtime definitions. | ||
## 5.1.2 | ||
@@ -18,0 +27,0 @@ |
@@ -522,2 +522,3 @@ // A recursive descent parser operates by defining functions for all | ||
node.properties = []; | ||
var decorators = []; | ||
this.next(); | ||
@@ -529,7 +530,5 @@ while (!this.eat(tt.braceR)) { | ||
} else first = false; | ||
while (this.type === tt.at) { | ||
this.decorators.push(this.parseDecorator()); | ||
decorators.push(this.parseDecorator()); | ||
} | ||
var prop = this.startNode(), | ||
@@ -539,6 +538,9 @@ isGenerator = false, | ||
start = undefined; | ||
if (decorators.length) { | ||
prop.decorators = decorators; | ||
decorators = []; | ||
} | ||
if (this.options.features["es7.objectRestSpread"] && this.type === tt.ellipsis) { | ||
prop = this.parseSpread(); | ||
prop.type = "SpreadProperty"; | ||
this.takeDecorators(prop); | ||
node.properties.push(prop); | ||
@@ -567,6 +569,5 @@ continue; | ||
this.checkPropClash(prop, propHash); | ||
this.takeDecorators(prop); | ||
node.properties.push(this.finishNode(prop, "Property")); | ||
} | ||
if (this.decorators.length) { | ||
if (decorators.length) { | ||
this.raise(this.start, "You have trailing decorators with no property"); | ||
@@ -573,0 +574,0 @@ } |
@@ -484,10 +484,14 @@ "use strict"; | ||
this.expect(tt.braceL); | ||
var decorators = []; | ||
while (!this.eat(tt.braceR)) { | ||
if (this.eat(tt.semi)) continue; | ||
if (this.type === tt.at) { | ||
this.decorators.push(this.parseDecorator()); | ||
decorators.push(this.parseDecorator()); | ||
continue; | ||
} | ||
var method = this.startNode(); | ||
this.takeDecorators(method); | ||
if (decorators.length) { | ||
method.decorators = decorators; | ||
decorators = []; | ||
} | ||
var isGenerator = this.eat(tt.star), | ||
@@ -530,3 +534,3 @@ isAsync = false; | ||
} | ||
if (this.decorators.length) { | ||
if (decorators.length) { | ||
this.raise(this.start, "You have trailing decorators with no method"); | ||
@@ -533,0 +537,0 @@ } |
@@ -22,2 +22,3 @@ "use strict"; | ||
exports.Function = function (node, parent, scope, file) { | ||
if (node.generator || node.async) return; | ||
var tailCall = new TailCallTransformer(this, scope, file); | ||
@@ -24,0 +25,0 @@ tailCall.run(); |
@@ -84,2 +84,3 @@ { | ||
"fround": "math/fround", | ||
"hypot": "math/hypot", | ||
"pot": "math/pot", | ||
@@ -114,4 +115,28 @@ "imul": "math/imul", | ||
"unscopables": "symbol/unscopables" | ||
}, | ||
"String": { | ||
"at": "string/at", | ||
"codePointAt": "string/code-point-at", | ||
"endsWith": "string/ends-with", | ||
"escapeHTML": "string/escape-html", | ||
"fromCodePoint": "string/from-code-point", | ||
"includes": "string/includes", | ||
"raw": "string/raw", | ||
"repeat": "string/repeat", | ||
"startsWith": "string/starts-with", | ||
"unescapeHTML": "string/unescape-html" | ||
}, | ||
"Number": { | ||
"epsilon": "number/epsilon", | ||
"isFinite": "number/is-finite", | ||
"isInteger": "number/is-integer", | ||
"isNaN": "number/is-nan", | ||
"isSafeInteger": "number/is-safe-integer", | ||
"MAX_SAFE_INTEGER": "number/max-safe-integer", | ||
"MIN_SAFE_INTEGER": "number/min-safe-integer", | ||
"parseFloat": "number/parse-float", | ||
"parseInt": "number/parse-int", | ||
"random": "number/random" | ||
} | ||
} | ||
} |
@@ -9,2 +9,4 @@ "use strict"; | ||
var traverse = _interopRequire(require("../../../../traversal")); | ||
var util = _interopRequireWildcard(require("../../../../util")); | ||
@@ -22,10 +24,48 @@ | ||
var astVisitor = { | ||
enter: function enter(node, parent, scope, file) { | ||
var prop; | ||
var astVisitor = traverse.explode({ | ||
Identifier: function Identifier(node, parent, scope, file) { | ||
if (!this.isReferenced()) return; | ||
if (t.isMemberExpression(parent)) return; | ||
if (!has(definitions.builtins, node.name)) return; | ||
if (scope.getBindingIdentifier(node.name)) return; | ||
if (this.isMemberExpression() && this.isReferenced()) { | ||
// Symbol() -> _core.Symbol(); new Promise -> new _core.Promise | ||
var modulePath = definitions.builtins[node.name]; | ||
return file.addImport("" + RUNTIME_MODULE_NAME + "/core-js/" + modulePath, node.name, true); | ||
}, | ||
CallExpression: function CallExpression(node, parent, scope, file) { | ||
// arr[Symbol.iterator]() -> _core.$for.getIterator(arr) | ||
var callee = node.callee; | ||
if (node.arguments.length) return; | ||
if (!t.isMemberExpression(callee)) return; | ||
if (!callee.computed) return; | ||
var prop = callee.property; | ||
if (!isSymbolIterator(prop)) return; | ||
return t.callExpression(file.addImport("" + RUNTIME_MODULE_NAME + "/core-js/get-iterator", "getIterator", true), [callee.object]); | ||
}, | ||
BinaryExpression: function BinaryExpression(node, parent, scope, file) { | ||
// Symbol.iterator in arr -> core.$for.isIterable(arr) | ||
if (node.operator !== "in") return; | ||
var left = node.left; | ||
if (!isSymbolIterator(left)) return; | ||
return t.callExpression(file.addImport("" + RUNTIME_MODULE_NAME + "/core-js/is-iterable", "isIterable", true), [node.right]); | ||
}, | ||
MemberExpression: { | ||
enter: function enter(node, parent, scope, file) { | ||
// Array.from -> _core.Array.from | ||
if (!this.isReferenced()) return; | ||
var obj = node.object; | ||
prop = node.property; | ||
var prop = node.property; | ||
@@ -35,37 +75,27 @@ if (!t.isReferenced(obj, node)) return; | ||
if (node.computed) return; | ||
if (!has(definitions.methods, obj.name)) return; | ||
if (!has(definitions.methods[obj.name], prop.name)) return; | ||
var methods = definitions.methods[obj.name]; | ||
if (!has(methods, prop.name)) return; | ||
if (scope.getBindingIdentifier(obj.name)) return; | ||
var modulePath = definitions.methods[obj.name][prop.name]; | ||
var modulePath = methods[prop.name]; | ||
return file.addImport("" + RUNTIME_MODULE_NAME + "/core-js/" + modulePath, "" + obj.name + "$" + prop.name, true); | ||
} else if (this.isReferencedIdentifier() && !t.isMemberExpression(parent) && has(definitions.builtins, node.name) && !scope.getBindingIdentifier(node.name)) { | ||
// Symbol() -> _core.Symbol(); new Promise -> new _core.Promise | ||
var modulePath = definitions.builtins[node.name]; | ||
return file.addImport("" + RUNTIME_MODULE_NAME + "/core-js/" + modulePath, node.name, true); | ||
} else if (this.isCallExpression()) { | ||
// arr[Symbol.iterator]() -> _core.$for.getIterator(arr) | ||
}, | ||
var callee = node.callee; | ||
if (node.arguments.length) return false; | ||
exit: function exit(node, parent, scope, file) { | ||
if (!this.isReferenced()) return; | ||
if (!t.isMemberExpression(callee)) return false; | ||
if (!callee.computed) return false; | ||
var prop = node.property; | ||
var obj = node.object; | ||
prop = callee.property; | ||
if (!isSymbolIterator(prop)) return false; | ||
if (!has(definitions.builtins, obj.name)) return; | ||
return t.callExpression(file.addImport("" + RUNTIME_MODULE_NAME + "/core-js/get-iterator", "getIterator", true), [callee.object]); | ||
} else if (this.isBinaryExpression()) { | ||
// Symbol.iterator in arr -> core.$for.isIterable(arr) | ||
if (node.operator !== "in") return; | ||
var left = node.left; | ||
if (!isSymbolIterator(left)) return; | ||
return t.callExpression(file.addImport("" + RUNTIME_MODULE_NAME + "/core-js/is-iterable", "isIterable", true), [node.right]); | ||
var modulePath = definitions.builtins[obj.name]; | ||
return t.memberExpression(file.addImport("" + RUNTIME_MODULE_NAME + "/core-js/" + modulePath, "" + obj.name, true), prop); | ||
} | ||
} | ||
}; | ||
}); | ||
@@ -72,0 +102,0 @@ exports.metadata = { |
@@ -87,2 +87,5 @@ "use strict"; | ||
var fns = obj[type]; | ||
if (typeof fns === "function") { | ||
obj[type] = fns = { enter: fns }; | ||
} | ||
@@ -89,0 +92,0 @@ var aliases = t.FLIPPED_ALIAS_KEYS[type]; |
{ | ||
"name": "babel-core", | ||
"description": "Turn ES6 code into readable vanilla ES5 with source maps", | ||
"version": "5.1.2", | ||
"version": "5.1.3", | ||
"author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
@@ -49,3 +49,3 @@ "homepage": "https://babeljs.io/", | ||
"private": "^0.1.6", | ||
"regenerator": "https://github.com/sebmck/regenerator/archive/block-hoist.tar.gz", | ||
"regenerator": "^0.8.20", | ||
"regexpu": "^1.1.2", | ||
@@ -52,0 +52,0 @@ "repeating": "^1.1.2", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
2525517
22990
0
+ Addedacorn@5.7.4(transitive)
+ Addedalign-text@0.1.4(transitive)
+ Addedalter@0.2.0(transitive)
+ Addedast-traverse@0.1.1(transitive)
+ Addedast-types@0.8.120.9.6(transitive)
+ Addedbreakable@1.0.0(transitive)
+ Addedcamelcase@1.2.1(transitive)
+ Addedcenter-align@0.1.3(transitive)
+ Addedcliui@2.1.0(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcommoner@0.10.8(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addeddefined@1.0.1(transitive)
+ Addeddefs@1.1.1(transitive)
+ Addeddetective@4.7.1(transitive)
+ Addedesprima@3.1.3(transitive)
+ Addedglob@5.0.15(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedinvert-kv@1.0.0(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedkind-of@3.2.2(transitive)
+ Addedlazy-cache@1.0.4(transitive)
+ Addedlcid@1.0.0(transitive)
+ Addedlongest@1.0.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedos-locale@1.4.0(transitive)
+ Addedq@1.5.1(transitive)
+ Addedrecast@0.10.330.11.23(transitive)
+ Addedregenerator@0.8.46(transitive)
+ Addedregenerator-runtime@0.9.6(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedright-align@0.1.3(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsimple-fmt@0.1.0(transitive)
+ Addedsimple-is@0.2.0(transitive)
+ Addedstable@0.1.8(transitive)
+ Addedstringmap@0.2.2(transitive)
+ Addedstringset@0.2.1(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedtryor@0.1.2(transitive)
+ Addedwindow-size@0.1.4(transitive)
+ Addedwordwrap@0.0.2(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedy18n@3.2.2(transitive)
+ Addedyargs@3.27.0(transitive)
- Removedast-types@0.8.15(transitive)
- Removedrecast@0.10.43(transitive)
Updatedregenerator@^0.8.20