Socket
Socket
Sign inDemoInstall

babel-core

Package Overview
Dependencies
Maintainers
1
Versions
257
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-core - npm Package Compare versions

Comparing version 5.1.2 to 5.1.3

9

CHANGELOG.md

@@ -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 @@

13

lib/acorn/src/expression.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc