babel-source 5.1.2 → 5.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/babel.js +120 -48
- data/lib/babel/polyfill.js +2 -2
- data/lib/babel/source.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjQ4MGEwMTdkOTk1YzBlNWJmZDYzMzFiNGJjZjEwYTAwZGJiNGNiYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODI2YzM2MGUxMTMxZTZkYzg2ODdkNmI0NzNhZTllODAxY2UwNGRkNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDdmYmE1NzE5Njc1Njg4ZTgzNDQ0NzBmMzEyMTljYzg4NGY4MTg1NDFkNTNm
|
10
|
+
MWE3MjI4MGYzNDUzMTk3MWNiYzA2YzdkMGJkMTM0ZWJlMzJkMjY0NDk1MTE3
|
11
|
+
ZjA0YzdiOTAzM2E1OTA3NmU1MGQ4ZmVmOTQwOWVmZDdkODIxNjE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWM2OWI3NDQwMDFiNjVhNjdlODhiNDhhNzRhN2Y0YjZiZDc3Njg1MDlhZWVj
|
14
|
+
ZDljNjg5Mjc5M2E3ODBmZTcxYmI3MDU0NWU3MGY2YjAxNTM3NTYyZGZlMTc2
|
15
|
+
MmMwOWFjZjVhOWMxNDdmZWI0Mjg3NzQxZDM1Y2I2N2YzNzFkNmY=
|
data/lib/babel.js
CHANGED
@@ -1985,25 +1985,27 @@ pp.parseObj = function (isPattern, refShorthandDefaultPos) {
|
|
1985
1985
|
first = true,
|
1986
1986
|
propHash = {};
|
1987
1987
|
node.properties = [];
|
1988
|
+
var decorators = [];
|
1988
1989
|
this.next();
|
1989
1990
|
while (!this.eat(tt.braceR)) {
|
1990
1991
|
if (!first) {
|
1991
1992
|
this.expect(tt.comma);
|
1992
1993
|
if (this.afterTrailingComma(tt.braceR)) break;
|
1993
1994
|
} else first = false;
|
1994
|
-
|
1995
1995
|
while (this.type === tt.at) {
|
1996
|
-
|
1996
|
+
decorators.push(this.parseDecorator());
|
1997
1997
|
}
|
1998
|
-
|
1999
1998
|
var prop = this.startNode(),
|
2000
1999
|
isGenerator = false,
|
2001
2000
|
isAsync = false,
|
2002
2001
|
start = undefined;
|
2002
|
+
if (decorators.length) {
|
2003
|
+
prop.decorators = decorators;
|
2004
|
+
decorators = [];
|
2005
|
+
}
|
2003
2006
|
if (this.options.features["es7.objectRestSpread"] && this.type === tt.ellipsis) {
|
2004
2007
|
prop = this.parseSpread();
|
2005
2008
|
prop.type = "SpreadProperty";
|
2006
|
-
this.takeDecorators(prop);
|
2007
2009
|
node.properties.push(prop);
|
2008
2010
|
continue;
|
2009
2011
|
}
|
@@ -2027,10 +2029,9 @@ pp.parseObj = function (isPattern, refShorthandDefaultPos) {
|
|
2027
2029
|
}
|
2028
2030
|
this.parseObjPropValue(prop, start, isGenerator, isAsync, isPattern, refShorthandDefaultPos);
|
2029
2031
|
this.checkPropClash(prop, propHash);
|
2030
|
-
this.takeDecorators(prop);
|
2031
2032
|
node.properties.push(this.finishNode(prop, "Property"));
|
2032
2033
|
}
|
2033
|
-
if (
|
2034
|
+
if (decorators.length) {
|
2034
2035
|
this.raise(this.start, "You have trailing decorators with no property");
|
2035
2036
|
}
|
2036
2037
|
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");
|
@@ -3679,14 +3680,18 @@ pp.parseClass = function (node, isStatement) {
|
|
3679
3680
|
var classBody = this.startNode();
|
3680
3681
|
classBody.body = [];
|
3681
3682
|
this.expect(tt.braceL);
|
3683
|
+
var decorators = [];
|
3682
3684
|
while (!this.eat(tt.braceR)) {
|
3683
3685
|
if (this.eat(tt.semi)) continue;
|
3684
3686
|
if (this.type === tt.at) {
|
3685
|
-
|
3687
|
+
decorators.push(this.parseDecorator());
|
3686
3688
|
continue;
|
3687
3689
|
}
|
3688
3690
|
var method = this.startNode();
|
3689
|
-
|
3691
|
+
if (decorators.length) {
|
3692
|
+
method.decorators = decorators;
|
3693
|
+
decorators = [];
|
3694
|
+
}
|
3690
3695
|
var isGenerator = this.eat(tt.star),
|
3691
3696
|
isAsync = false;
|
3692
3697
|
this.parsePropertyName(method);
|
@@ -3724,7 +3729,7 @@ pp.parseClass = function (node, isStatement) {
|
|
3724
3729
|
}
|
3725
3730
|
this.parseClassMethod(classBody, method, isGenerator, isAsync);
|
3726
3731
|
}
|
3727
|
-
if (
|
3732
|
+
if (decorators.length) {
|
3728
3733
|
this.raise(this.start, "You have trailing decorators with no method");
|
3729
3734
|
}
|
3730
3735
|
node.body = this.finishNode(classBody, "ClassBody");
|
@@ -14668,6 +14673,7 @@ var map = _interopRequire(require("lodash/collection/map"));
|
|
14668
14673
|
var t = _interopRequireWildcard(require("../../../types"));
|
14669
14674
|
|
14670
14675
|
exports.Function = function (node, parent, scope, file) {
|
14676
|
+
if (node.generator || node.async) return;
|
14671
14677
|
var tailCall = new TailCallTransformer(this, scope, file);
|
14672
14678
|
tailCall.run();
|
14673
14679
|
};
|
@@ -16497,6 +16503,7 @@ module.exports={
|
|
16497
16503
|
"cosh": "math/cosh",
|
16498
16504
|
"expm1": "math/expm1",
|
16499
16505
|
"fround": "math/fround",
|
16506
|
+
"hypot": "math/hypot",
|
16500
16507
|
"pot": "math/pot",
|
16501
16508
|
"imul": "math/imul",
|
16502
16509
|
"log10": "math/log10",
|
@@ -16526,6 +16533,30 @@ module.exports={
|
|
16526
16533
|
"toPrimitive": "symbol/to-primitive",
|
16527
16534
|
"toStringTag": "symbol/to-string-tag",
|
16528
16535
|
"unscopables": "symbol/unscopables"
|
16536
|
+
},
|
16537
|
+
"String": {
|
16538
|
+
"at": "string/at",
|
16539
|
+
"codePointAt": "string/code-point-at",
|
16540
|
+
"endsWith": "string/ends-with",
|
16541
|
+
"escapeHTML": "string/escape-html",
|
16542
|
+
"fromCodePoint": "string/from-code-point",
|
16543
|
+
"includes": "string/includes",
|
16544
|
+
"raw": "string/raw",
|
16545
|
+
"repeat": "string/repeat",
|
16546
|
+
"startsWith": "string/starts-with",
|
16547
|
+
"unescapeHTML": "string/unescape-html"
|
16548
|
+
},
|
16549
|
+
"Number": {
|
16550
|
+
"epsilon": "number/epsilon",
|
16551
|
+
"isFinite": "number/is-finite",
|
16552
|
+
"isInteger": "number/is-integer",
|
16553
|
+
"isNaN": "number/is-nan",
|
16554
|
+
"isSafeInteger": "number/is-safe-integer",
|
16555
|
+
"MAX_SAFE_INTEGER": "number/max-safe-integer",
|
16556
|
+
"MIN_SAFE_INTEGER": "number/min-safe-integer",
|
16557
|
+
"parseFloat": "number/parse-float",
|
16558
|
+
"parseInt": "number/parse-int",
|
16559
|
+
"random": "number/random"
|
16529
16560
|
}
|
16530
16561
|
}
|
16531
16562
|
}
|
@@ -16539,6 +16570,8 @@ var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["defau
|
|
16539
16570
|
|
16540
16571
|
var includes = _interopRequire(require("lodash/collection/includes"));
|
16541
16572
|
|
16573
|
+
var traverse = _interopRequire(require("../../../../traversal"));
|
16574
|
+
|
16542
16575
|
var util = _interopRequireWildcard(require("../../../../util"));
|
16543
16576
|
|
16544
16577
|
var has = _interopRequire(require("lodash/object/has"));
|
@@ -16551,53 +16584,81 @@ var isSymbolIterator = t.buildMatchMemberExpression("Symbol.iterator");
|
|
16551
16584
|
|
16552
16585
|
var RUNTIME_MODULE_NAME = "babel-runtime";
|
16553
16586
|
|
16554
|
-
var astVisitor = {
|
16555
|
-
|
16556
|
-
|
16587
|
+
var astVisitor = traverse.explode({
|
16588
|
+
Identifier: function Identifier(node, parent, scope, file) {
|
16589
|
+
if (!this.isReferenced()) return;
|
16590
|
+
if (t.isMemberExpression(parent)) return;
|
16591
|
+
if (!has(definitions.builtins, node.name)) return;
|
16592
|
+
if (scope.getBindingIdentifier(node.name)) return;
|
16593
|
+
|
16594
|
+
// Symbol() -> _core.Symbol(); new Promise -> new _core.Promise
|
16595
|
+
var modulePath = definitions.builtins[node.name];
|
16596
|
+
return file.addImport("" + RUNTIME_MODULE_NAME + "/core-js/" + modulePath, node.name, true);
|
16597
|
+
},
|
16598
|
+
|
16599
|
+
CallExpression: function CallExpression(node, parent, scope, file) {
|
16600
|
+
// arr[Symbol.iterator]() -> _core.$for.getIterator(arr)
|
16601
|
+
|
16602
|
+
var callee = node.callee;
|
16603
|
+
if (node.arguments.length) return;
|
16604
|
+
|
16605
|
+
if (!t.isMemberExpression(callee)) return;
|
16606
|
+
if (!callee.computed) return;
|
16607
|
+
|
16608
|
+
var prop = callee.property;
|
16609
|
+
if (!isSymbolIterator(prop)) return;
|
16610
|
+
|
16611
|
+
return t.callExpression(file.addImport("" + RUNTIME_MODULE_NAME + "/core-js/get-iterator", "getIterator", true), [callee.object]);
|
16612
|
+
},
|
16557
16613
|
|
16558
|
-
|
16614
|
+
BinaryExpression: function BinaryExpression(node, parent, scope, file) {
|
16615
|
+
// Symbol.iterator in arr -> core.$for.isIterable(arr)
|
16616
|
+
|
16617
|
+
if (node.operator !== "in") return;
|
16618
|
+
|
16619
|
+
var left = node.left;
|
16620
|
+
if (!isSymbolIterator(left)) return;
|
16621
|
+
|
16622
|
+
return t.callExpression(file.addImport("" + RUNTIME_MODULE_NAME + "/core-js/is-iterable", "isIterable", true), [node.right]);
|
16623
|
+
},
|
16624
|
+
|
16625
|
+
MemberExpression: {
|
16626
|
+
enter: function enter(node, parent, scope, file) {
|
16559
16627
|
// Array.from -> _core.Array.from
|
16628
|
+
|
16629
|
+
if (!this.isReferenced()) return;
|
16630
|
+
|
16560
16631
|
var obj = node.object;
|
16561
|
-
prop = node.property;
|
16632
|
+
var prop = node.property;
|
16562
16633
|
|
16563
16634
|
if (!t.isReferenced(obj, node)) return;
|
16564
16635
|
|
16565
16636
|
if (node.computed) return;
|
16566
|
-
if (!has(definitions.methods, obj.name)) return;
|
16567
|
-
if (!has(definitions.methods[obj.name], prop.name)) return;
|
16568
|
-
if (scope.getBindingIdentifier(obj.name)) return;
|
16569
16637
|
|
16570
|
-
|
16571
|
-
return file.addImport("" + RUNTIME_MODULE_NAME + "/core-js/" + modulePath, "" + obj.name + "$" + prop.name, true);
|
16572
|
-
} else if (this.isReferencedIdentifier() && !t.isMemberExpression(parent) && has(definitions.builtins, node.name) && !scope.getBindingIdentifier(node.name)) {
|
16573
|
-
// Symbol() -> _core.Symbol(); new Promise -> new _core.Promise
|
16574
|
-
var modulePath = definitions.builtins[node.name];
|
16575
|
-
return file.addImport("" + RUNTIME_MODULE_NAME + "/core-js/" + modulePath, node.name, true);
|
16576
|
-
} else if (this.isCallExpression()) {
|
16577
|
-
// arr[Symbol.iterator]() -> _core.$for.getIterator(arr)
|
16638
|
+
if (!has(definitions.methods, obj.name)) return;
|
16578
16639
|
|
16579
|
-
var
|
16580
|
-
if (
|
16640
|
+
var methods = definitions.methods[obj.name];
|
16641
|
+
if (!has(methods, prop.name)) return;
|
16581
16642
|
|
16582
|
-
if (
|
16583
|
-
if (!callee.computed) return false;
|
16643
|
+
if (scope.getBindingIdentifier(obj.name)) return;
|
16584
16644
|
|
16585
|
-
|
16586
|
-
|
16645
|
+
var modulePath = methods[prop.name];
|
16646
|
+
return file.addImport("" + RUNTIME_MODULE_NAME + "/core-js/" + modulePath, "" + obj.name + "$" + prop.name, true);
|
16647
|
+
},
|
16587
16648
|
|
16588
|
-
|
16589
|
-
|
16590
|
-
// Symbol.iterator in arr -> core.$for.isIterable(arr)
|
16649
|
+
exit: function exit(node, parent, scope, file) {
|
16650
|
+
if (!this.isReferenced()) return;
|
16591
16651
|
|
16592
|
-
|
16652
|
+
var prop = node.property;
|
16653
|
+
var obj = node.object;
|
16593
16654
|
|
16594
|
-
|
16595
|
-
if (!isSymbolIterator(left)) return;
|
16655
|
+
if (!has(definitions.builtins, obj.name)) return;
|
16596
16656
|
|
16597
|
-
|
16657
|
+
var modulePath = definitions.builtins[obj.name];
|
16658
|
+
return t.memberExpression(file.addImport("" + RUNTIME_MODULE_NAME + "/core-js/" + modulePath, "" + obj.name, true), prop);
|
16598
16659
|
}
|
16599
16660
|
}
|
16600
|
-
};
|
16661
|
+
});
|
16601
16662
|
|
16602
16663
|
exports.metadata = {
|
16603
16664
|
optional: true
|
@@ -16622,7 +16683,7 @@ exports.Identifier = function (node, parent, scope, file) {
|
|
16622
16683
|
return file.get("regeneratorIdentifier");
|
16623
16684
|
}
|
16624
16685
|
};
|
16625
|
-
},{"../../../../types":155,"../../../../util":159,"./definitions":130,"lodash/collection/includes":239,"lodash/object/has":327}],132:[function(require,module,exports){
|
16686
|
+
},{"../../../../traversal":146,"../../../../types":155,"../../../../util":159,"./definitions":130,"lodash/collection/includes":239,"lodash/object/has":327}],132:[function(require,module,exports){
|
16626
16687
|
"use strict";
|
16627
16688
|
|
16628
16689
|
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
@@ -17350,6 +17411,9 @@ traverse.removeProperties = function (tree) {
|
|
17350
17411
|
traverse.explode = function (obj) {
|
17351
17412
|
for (var type in obj) {
|
17352
17413
|
var fns = obj[type];
|
17414
|
+
if (typeof fns === "function") {
|
17415
|
+
obj[type] = fns = { enter: fns };
|
17416
|
+
}
|
17353
17417
|
|
17354
17418
|
var aliases = t.FLIPPED_ALIAS_KEYS[type];
|
17355
17419
|
if (aliases) {
|
@@ -40378,16 +40442,24 @@ var visitor = types.PathVisitor.fromMethodsObject({
|
|
40378
40442
|
}
|
40379
40443
|
|
40380
40444
|
var outerBody = [];
|
40381
|
-
var
|
40382
|
-
|
40445
|
+
var innerBody = [];
|
40446
|
+
var bodyPath = path.get("body", "body");
|
40447
|
+
|
40448
|
+
bodyPath.each(function(childPath) {
|
40449
|
+
var node = childPath.value;
|
40383
40450
|
if (node && node._blockHoist != null) {
|
40384
40451
|
outerBody.push(node);
|
40385
|
-
return false;
|
40386
40452
|
} else {
|
40387
|
-
|
40453
|
+
innerBody.push(node);
|
40388
40454
|
}
|
40389
40455
|
});
|
40390
40456
|
|
40457
|
+
if (outerBody.length > 0) {
|
40458
|
+
// Only replace the inner body if we actually hoisted any statements
|
40459
|
+
// to the outer body.
|
40460
|
+
bodyPath.replace(innerBody);
|
40461
|
+
}
|
40462
|
+
|
40391
40463
|
var outerFnExpr = getOuterFnExpr(path);
|
40392
40464
|
// Note that getOuterFnExpr has the side-effect of ensuring that the
|
40393
40465
|
// function has a name (so node.id will always be an Identifier), even
|
@@ -70811,14 +70883,14 @@ function through (write, end, opts) {
|
|
70811
70883
|
var delegate = context.delegate;
|
70812
70884
|
if (delegate) {
|
70813
70885
|
if (method === "return" ||
|
70814
|
-
(method === "throw" && delegate.iterator
|
70886
|
+
(method === "throw" && delegate.iterator[method] === undefined)) {
|
70815
70887
|
// A return or throw (when the delegate iterator has no throw
|
70816
70888
|
// method) always terminates the yield* loop.
|
70817
70889
|
context.delegate = null;
|
70818
70890
|
|
70819
70891
|
// If the delegate iterator has a return method, give it a
|
70820
70892
|
// chance to clean up.
|
70821
|
-
var returnMethod = delegate.iterator
|
70893
|
+
var returnMethod = delegate.iterator["return"];
|
70822
70894
|
if (returnMethod) {
|
70823
70895
|
var record = tryCatch(returnMethod, delegate.iterator, arg);
|
70824
70896
|
if (record.type === "throw") {
|
@@ -77290,7 +77362,7 @@ module.exports = function (str) {
|
|
77290
77362
|
module.exports={
|
77291
77363
|
"name": "babel-core",
|
77292
77364
|
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
77293
|
-
"version": "5.1.
|
77365
|
+
"version": "5.1.3",
|
77294
77366
|
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
77295
77367
|
"homepage": "https://babeljs.io/",
|
77296
77368
|
"repository": "babel/babel",
|
@@ -77335,7 +77407,7 @@ module.exports={
|
|
77335
77407
|
"output-file-sync": "^1.1.0",
|
77336
77408
|
"path-is-absolute": "^1.0.0",
|
77337
77409
|
"private": "^0.1.6",
|
77338
|
-
"regenerator": "
|
77410
|
+
"regenerator": "^0.8.20",
|
77339
77411
|
"regexpu": "^1.1.2",
|
77340
77412
|
"repeating": "^1.1.2",
|
77341
77413
|
"shebang-regex": "^1.0.0",
|
data/lib/babel/polyfill.js
CHANGED
@@ -2656,14 +2656,14 @@ module.exports = require('./modules/$').core;
|
|
2656
2656
|
var delegate = context.delegate;
|
2657
2657
|
if (delegate) {
|
2658
2658
|
if (method === "return" ||
|
2659
|
-
(method === "throw" && delegate.iterator
|
2659
|
+
(method === "throw" && delegate.iterator[method] === undefined)) {
|
2660
2660
|
// A return or throw (when the delegate iterator has no throw
|
2661
2661
|
// method) always terminates the yield* loop.
|
2662
2662
|
context.delegate = null;
|
2663
2663
|
|
2664
2664
|
// If the delegate iterator has a return method, give it a
|
2665
2665
|
// chance to clean up.
|
2666
|
-
var returnMethod = delegate.iterator
|
2666
|
+
var returnMethod = delegate.iterator["return"];
|
2667
2667
|
if (returnMethod) {
|
2668
2668
|
var record = tryCatch(returnMethod, delegate.iterator, arg);
|
2669
2669
|
if (record.type === "throw") {
|
data/lib/babel/source.rb
CHANGED