babel-source 4.7.3 → 4.7.4
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 +355 -333
- data/lib/babel/source.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
M2U4NDlkNzg0YTA0NjdmMTdmZTVmYTllMGFlMWRhZTNkNjc2YTJmZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjM2M2U5ZjkwNTU3NmNhOWQyNWE4YWNmMzNjZGFkMmViMmRlMjQ3NQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmJlZDY4ZmZlMTU1NmQ2MDA5ODZiY2RiMmRjMWVlZDgyM2E3ZGFmZjEyOGRi
|
10
|
+
MDg0ZjJkNjc4N2M3MjY1NTBmNWMxYzE2NDJiNzFiMmNmNjM3M2Y3MDFjN2Jm
|
11
|
+
NzY5NTAwYWFhMDUzNzI4OWI3Nzc1MWMxZDFjM2VmMjhmMGQ2MWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTMxNWI0YmFiYWNkY2E3ZWUwY2U2YzU5N2RkYmYxZjJjYTUzNzYyNDIwZWQ4
|
14
|
+
NjYwOGUwY2U5NTEyMjBiNmRmMWJkNzI2MWNiYTVmM2NiZjVmZWNmYmMyNTk1
|
15
|
+
NDEyYjNiOTE4MTg4YjMwNWI5MjQ3MTEyNDNjZTNjOWU4YjQyODQ=
|
data/lib/babel.js
CHANGED
@@ -2888,13 +2888,13 @@ var messages = exports.messages = {
|
|
2888
2888
|
};
|
2889
2889
|
|
2890
2890
|
function get(key) {
|
2891
|
+
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
2892
|
+
args[_key - 1] = arguments[_key];
|
2893
|
+
}
|
2894
|
+
|
2891
2895
|
var msg = messages[key];
|
2892
2896
|
if (!msg) throw new ReferenceError("Unknown message " + JSON.stringify(key));
|
2893
2897
|
|
2894
|
-
var args = [];
|
2895
|
-
for (var i = 1; i < arguments.length; i++) {
|
2896
|
-
args.push(arguments[i]);
|
2897
|
-
}
|
2898
2898
|
args = parseArgs(args);
|
2899
2899
|
|
2900
2900
|
return msg.replace(/\$(\d+)/g, function (str, i) {
|
@@ -4319,8 +4319,8 @@ var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["defau
|
|
4319
4319
|
|
4320
4320
|
var t = _interopRequire(require("../../types"));
|
4321
4321
|
|
4322
|
-
var
|
4323
|
-
enter: function enter(node) {
|
4322
|
+
var awaitVisitor = {
|
4323
|
+
enter: function enter(node, parent, scope, state) {
|
4324
4324
|
if (t.isFunction(node)) this.skip();
|
4325
4325
|
|
4326
4326
|
if (t.isAwaitExpression(node)) {
|
@@ -4335,13 +4335,25 @@ var visitor = {
|
|
4335
4335
|
}
|
4336
4336
|
};
|
4337
4337
|
|
4338
|
+
var referenceVisitor = {
|
4339
|
+
enter: function enter(node, parent, scope, state) {
|
4340
|
+
var name = state.id.name;
|
4341
|
+
if (t.isReferencedIdentifier(node, parent, { name: name }) && scope.bindingIdentifierEquals(name, state.id)) {
|
4342
|
+
var _state;
|
4343
|
+
|
4344
|
+
return (_state = state, !_state.ref && (_state.ref = scope.generateUidIdentifier(name)), _state.ref);
|
4345
|
+
}
|
4346
|
+
}
|
4347
|
+
};
|
4348
|
+
|
4338
4349
|
module.exports = function (node, callId, scope) {
|
4339
4350
|
node.async = false;
|
4340
4351
|
node.generator = true;
|
4341
4352
|
|
4342
|
-
scope.traverse(node,
|
4353
|
+
scope.traverse(node, awaitVisitor, state);
|
4343
4354
|
|
4344
4355
|
var call = t.callExpression(callId, [node]);
|
4356
|
+
|
4345
4357
|
var id = node.id;
|
4346
4358
|
node.id = null;
|
4347
4359
|
|
@@ -4350,6 +4362,16 @@ module.exports = function (node, callId, scope) {
|
|
4350
4362
|
declar._blockHoist = true;
|
4351
4363
|
return declar;
|
4352
4364
|
} else {
|
4365
|
+
if (id) {
|
4366
|
+
var state = { id: id };
|
4367
|
+
scope.traverse(node, referenceVisitor, state);
|
4368
|
+
|
4369
|
+
if (state.ref) {
|
4370
|
+
scope.parent.push({ id: state.ref });
|
4371
|
+
return t.assignmentExpression("=", state.ref, call);
|
4372
|
+
}
|
4373
|
+
}
|
4374
|
+
|
4353
4375
|
return call;
|
4354
4376
|
}
|
4355
4377
|
};
|
@@ -4413,12 +4435,11 @@ var ReplaceSupers = (function () {
|
|
4413
4435
|
|
4414
4436
|
/**
|
4415
4437
|
* Description
|
4416
|
-
*
|
4417
|
-
* @param {Object} opts
|
4418
|
-
* @param {Boolean} [inClass]
|
4419
4438
|
*/
|
4420
4439
|
|
4421
|
-
function ReplaceSupers(opts
|
4440
|
+
function ReplaceSupers(opts) {
|
4441
|
+
var inClass = arguments[1] === undefined ? false : arguments[1];
|
4442
|
+
|
4422
4443
|
_classCallCheck(this, ReplaceSupers);
|
4423
4444
|
|
4424
4445
|
this.topLevelThisReference = opts.topLevelThisReference;
|
@@ -4444,12 +4465,6 @@ var ReplaceSupers = (function () {
|
|
4444
4465
|
*
|
4445
4466
|
* _set(Object.getPrototypeOf(CLASS.prototype), "METHOD", "VALUE", this)
|
4446
4467
|
*
|
4447
|
-
* @param {Node} property
|
4448
|
-
* @param {Node} value
|
4449
|
-
* @param {Boolean} isComputed
|
4450
|
-
* @param {Node} thisExpression
|
4451
|
-
*
|
4452
|
-
* @returns {Node}
|
4453
4468
|
*/
|
4454
4469
|
|
4455
4470
|
ReplaceSupers.prototype.setSuperProperty = function setSuperProperty(property, value, isComputed, thisExpression) {
|
@@ -4463,11 +4478,6 @@ var ReplaceSupers = (function () {
|
|
4463
4478
|
*
|
4464
4479
|
* _get(Object.getPrototypeOf(CLASS.prototype), "METHOD", this)
|
4465
4480
|
*
|
4466
|
-
* @param {Node} property
|
4467
|
-
* @param {Boolean} isComputed
|
4468
|
-
* @param {Node} thisExpression
|
4469
|
-
*
|
4470
|
-
* @returns {Node}
|
4471
4481
|
*/
|
4472
4482
|
|
4473
4483
|
ReplaceSupers.prototype.getSuperProperty = function getSuperProperty(property, isComputed, thisExpression) {
|
@@ -4484,9 +4494,6 @@ var ReplaceSupers = (function () {
|
|
4484
4494
|
|
4485
4495
|
/**
|
4486
4496
|
* Description
|
4487
|
-
*
|
4488
|
-
* @param {Object} node
|
4489
|
-
* @param {Boolean} topLevel
|
4490
4497
|
*/
|
4491
4498
|
|
4492
4499
|
ReplaceSupers.prototype.traverseLevel = function traverseLevel(node, topLevel) {
|
@@ -4510,11 +4517,6 @@ var ReplaceSupers = (function () {
|
|
4510
4517
|
|
4511
4518
|
/**
|
4512
4519
|
* Description
|
4513
|
-
*
|
4514
|
-
* @param {Object} node
|
4515
|
-
* @param {Object} id
|
4516
|
-
* @param {Object} parent
|
4517
|
-
* @returns {Object}
|
4518
4520
|
*/
|
4519
4521
|
|
4520
4522
|
ReplaceSupers.prototype.getLooseSuperProperty = function getLooseSuperProperty(id, parent) {
|
@@ -4552,10 +4554,6 @@ var ReplaceSupers = (function () {
|
|
4552
4554
|
|
4553
4555
|
/**
|
4554
4556
|
* Description
|
4555
|
-
*
|
4556
|
-
* @param {Function} getThisReference
|
4557
|
-
* @param {Object} node
|
4558
|
-
* @param {Object} parent
|
4559
4557
|
*/
|
4560
4558
|
|
4561
4559
|
ReplaceSupers.prototype.looseHandle = function looseHandle(getThisReference, node, parent) {
|
@@ -4576,10 +4574,6 @@ var ReplaceSupers = (function () {
|
|
4576
4574
|
|
4577
4575
|
/**
|
4578
4576
|
* Description
|
4579
|
-
*
|
4580
|
-
* @param {Function} getThisReference
|
4581
|
-
* @param {Object} node
|
4582
|
-
* @param {Object} parent
|
4583
4577
|
*/
|
4584
4578
|
|
4585
4579
|
ReplaceSupers.prototype.specHandle = function specHandle(getThisReference, node, parent) {
|
@@ -4757,7 +4751,7 @@ each(rawTransformers, function (transformer, key) {
|
|
4757
4751
|
|
4758
4752
|
transform.transformers[key] = new Transformer(key, transformer);
|
4759
4753
|
});
|
4760
|
-
},{"../helpers/normalize-ast":23,"../helpers/object":24,"./file":28,"./modules":50,"./transformer":55,"./transformers":
|
4754
|
+
},{"../helpers/normalize-ast":23,"../helpers/object":24,"./file":28,"./modules":50,"./transformer":55,"./transformers":84,"./transformers/aliases":56,"./transformers/deprecated":57,"lodash/collection/each":202}],43:[function(require,module,exports){
|
4761
4755
|
"use strict";
|
4762
4756
|
|
4763
4757
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -5860,6 +5854,7 @@ module.exports={
|
|
5860
5854
|
module.exports={
|
5861
5855
|
"selfContained": "runtime",
|
5862
5856
|
"unicode-regex": "regex.unicode",
|
5857
|
+
"spec.typeofSymbol": "es6.symbols",
|
5863
5858
|
|
5864
5859
|
"minification.deadCodeElimination": "utility.deadCodeElimination",
|
5865
5860
|
"minification.removeConsoleCalls": "utility.removeConsole",
|
@@ -6115,7 +6110,7 @@ function Loop(node, parent, scope, file) {
|
|
6115
6110
|
|
6116
6111
|
function BlockStatement(block, parent, scope, file) {
|
6117
6112
|
if (!t.isLoop(parent)) {
|
6118
|
-
var blockScoping = new BlockScoping(
|
6113
|
+
var blockScoping = new BlockScoping(null, block, parent, scope, file);
|
6119
6114
|
blockScoping.run();
|
6120
6115
|
}
|
6121
6116
|
}
|
@@ -6260,12 +6255,6 @@ var BlockScoping = (function () {
|
|
6260
6255
|
|
6261
6256
|
/**
|
6262
6257
|
* Description
|
6263
|
-
*
|
6264
|
-
* @param {Boolean|Node} loopParent
|
6265
|
-
* @param {Node} block
|
6266
|
-
* @param {Node} parent
|
6267
|
-
* @param {Scope} scope
|
6268
|
-
* @param {File} file
|
6269
6258
|
*/
|
6270
6259
|
|
6271
6260
|
function BlockScoping(loopParent, block, parent, scope, file) {
|
@@ -6506,9 +6495,6 @@ var BlockScoping = (function () {
|
|
6506
6495
|
/**
|
6507
6496
|
* Turn a `VariableDeclaration` into an array of `AssignmentExpressions` with
|
6508
6497
|
* their declarations hoisted to before the closure wrapper.
|
6509
|
-
*
|
6510
|
-
* @param {Node} node VariableDeclaration
|
6511
|
-
* @returns {Array}
|
6512
6498
|
*/
|
6513
6499
|
|
6514
6500
|
BlockScoping.prototype.pushDeclar = function pushDeclar(node) {
|
@@ -6531,9 +6517,6 @@ var BlockScoping = (function () {
|
|
6531
6517
|
|
6532
6518
|
/**
|
6533
6519
|
* Push the closure to the body.
|
6534
|
-
*
|
6535
|
-
* @param {Node} ret Identifier
|
6536
|
-
* @param {Node} call CallExpression
|
6537
6520
|
*/
|
6538
6521
|
|
6539
6522
|
BlockScoping.prototype.build = function build(ret, call) {
|
@@ -6547,9 +6530,6 @@ var BlockScoping = (function () {
|
|
6547
6530
|
|
6548
6531
|
/**
|
6549
6532
|
* Description
|
6550
|
-
*
|
6551
|
-
* @param {Node} ret Identifier
|
6552
|
-
* @param {Node} call CallExpression
|
6553
6533
|
*/
|
6554
6534
|
|
6555
6535
|
BlockScoping.prototype.buildHas = function buildHas(ret, call) {
|
@@ -6673,11 +6653,6 @@ var ClassTransformer = (function () {
|
|
6673
6653
|
|
6674
6654
|
/**
|
6675
6655
|
* Description
|
6676
|
-
*
|
6677
|
-
* @param {Node} node
|
6678
|
-
* @param {Node} parent
|
6679
|
-
* @param {Scope} scope
|
6680
|
-
* @param {File} file
|
6681
6656
|
*/
|
6682
6657
|
|
6683
6658
|
function ClassTransformer(node, parent, scope, file) {
|
@@ -6851,8 +6826,6 @@ var ClassTransformer = (function () {
|
|
6851
6826
|
|
6852
6827
|
/**
|
6853
6828
|
* Description
|
6854
|
-
*
|
6855
|
-
* @param {Node} node
|
6856
6829
|
*/
|
6857
6830
|
|
6858
6831
|
ClassTransformer.prototype.verifyConstructor = function verifyConstructor(node) {
|
@@ -6873,8 +6846,6 @@ var ClassTransformer = (function () {
|
|
6873
6846
|
|
6874
6847
|
/**
|
6875
6848
|
* Push a method to its respective mutatorMap.
|
6876
|
-
*
|
6877
|
-
* @param {Node} node MethodDefinition
|
6878
6849
|
*/
|
6879
6850
|
|
6880
6851
|
ClassTransformer.prototype.pushMethod = function pushMethod(node) {
|
@@ -6914,8 +6885,6 @@ var ClassTransformer = (function () {
|
|
6914
6885
|
|
6915
6886
|
/**
|
6916
6887
|
* Description
|
6917
|
-
*
|
6918
|
-
* @param {Node} node
|
6919
6888
|
*/
|
6920
6889
|
|
6921
6890
|
ClassTransformer.prototype.pushProperty = function pushProperty(node) {
|
@@ -6934,8 +6903,6 @@ var ClassTransformer = (function () {
|
|
6934
6903
|
|
6935
6904
|
/**
|
6936
6905
|
* Replace the constructor body of our class.
|
6937
|
-
*
|
6938
|
-
* @param {Node} method MethodDefinition
|
6939
6906
|
*/
|
6940
6907
|
|
6941
6908
|
ClassTransformer.prototype.pushConstructor = function pushConstructor(method) {
|
@@ -7762,7 +7729,7 @@ function ExportDeclaration(node, parent, scope, file) {
|
|
7762
7729
|
}
|
7763
7730
|
|
7764
7731
|
exports.__esModule = true;
|
7765
|
-
},{"../../../types":122,"../internal/modules":
|
7732
|
+
},{"../../../types":122,"../internal/modules":90}],69:[function(require,module,exports){
|
7766
7733
|
"use strict";
|
7767
7734
|
|
7768
7735
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -8422,6 +8389,32 @@ exports.__esModule = true;
|
|
8422
8389
|
},{"../../../types":122,"lodash/collection/includes":205}],77:[function(require,module,exports){
|
8423
8390
|
"use strict";
|
8424
8391
|
|
8392
|
+
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
8393
|
+
|
8394
|
+
exports.UnaryExpression = UnaryExpression;
|
8395
|
+
|
8396
|
+
var t = _interopRequire(require("../../../types"));
|
8397
|
+
|
8398
|
+
var optional = exports.optional = true;
|
8399
|
+
|
8400
|
+
function UnaryExpression(node, parent, scope, file) {
|
8401
|
+
this.skip();
|
8402
|
+
|
8403
|
+
if (node.operator === "typeof") {
|
8404
|
+
var call = t.callExpression(file.addHelper("typeof"), [node.argument]);
|
8405
|
+
if (t.isIdentifier(node.argument)) {
|
8406
|
+
var undefLiteral = t.literal("undefined");
|
8407
|
+
return t.conditionalExpression(t.binaryExpression("===", t.unaryExpression("typeof", node.argument), undefLiteral), undefLiteral, call);
|
8408
|
+
} else {
|
8409
|
+
return call;
|
8410
|
+
}
|
8411
|
+
}
|
8412
|
+
}
|
8413
|
+
|
8414
|
+
exports.__esModule = true;
|
8415
|
+
},{"../../../types":122}],78:[function(require,module,exports){
|
8416
|
+
"use strict";
|
8417
|
+
|
8425
8418
|
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
8426
8419
|
|
8427
8420
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -8803,7 +8796,7 @@ var TailCallTransformer = (function () {
|
|
8803
8796
|
|
8804
8797
|
return TailCallTransformer;
|
8805
8798
|
})();
|
8806
|
-
},{"../../../messages":26,"../../../types":122,"../../../util":124,"lodash/array/flatten":197,"lodash/collection/map":206,"lodash/collection/reduceRight":207}],
|
8799
|
+
},{"../../../messages":26,"../../../types":122,"../../../util":124,"lodash/array/flatten":197,"lodash/collection/map":206,"lodash/collection/reduceRight":207}],79:[function(require,module,exports){
|
8807
8800
|
"use strict";
|
8808
8801
|
|
8809
8802
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -8878,7 +8871,7 @@ function TemplateLiteral(node) {
|
|
8878
8871
|
}
|
8879
8872
|
|
8880
8873
|
exports.__esModule = true;
|
8881
|
-
},{"../../../types":122}],
|
8874
|
+
},{"../../../types":122}],80:[function(require,module,exports){
|
8882
8875
|
"use strict";
|
8883
8876
|
|
8884
8877
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -8994,7 +8987,7 @@ function PrivateDeclaration(node) {
|
|
8994
8987
|
}
|
8995
8988
|
|
8996
8989
|
exports.__esModule = true;
|
8997
|
-
},{"../../../types":122,"../../../util":124}],
|
8990
|
+
},{"../../../types":122,"../../../util":124}],81:[function(require,module,exports){
|
8998
8991
|
"use strict";
|
8999
8992
|
|
9000
8993
|
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
@@ -9060,7 +9053,7 @@ function array(node, parent, scope, file) {
|
|
9060
9053
|
return container;
|
9061
9054
|
}
|
9062
9055
|
exports.__esModule = true;
|
9063
|
-
},{"../../../traversal":117,"../../../types":122,"../../../util":124,"../../helpers/build-comprehension":30}],
|
9056
|
+
},{"../../../traversal":117,"../../../types":122,"../../../util":124,"../../helpers/build-comprehension":30}],82:[function(require,module,exports){
|
9064
9057
|
"use strict";
|
9065
9058
|
|
9066
9059
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -9083,7 +9076,7 @@ build(exports, {
|
|
9083
9076
|
}
|
9084
9077
|
});
|
9085
9078
|
exports.__esModule = true;
|
9086
|
-
},{"../../../types":122,"../../helpers/build-binary-assignment-operator-transformer":29}],
|
9079
|
+
},{"../../../types":122,"../../helpers/build-binary-assignment-operator-transformer":29}],83:[function(require,module,exports){
|
9087
9080
|
"use strict";
|
9088
9081
|
|
9089
9082
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -9141,7 +9134,7 @@ function ObjectExpression(node, parent, scope, file) {
|
|
9141
9134
|
}
|
9142
9135
|
|
9143
9136
|
exports.__esModule = true;
|
9144
|
-
},{"../../../types":122}],
|
9137
|
+
},{"../../../types":122}],84:[function(require,module,exports){
|
9145
9138
|
"use strict";
|
9146
9139
|
|
9147
9140
|
module.exports = {
|
@@ -9240,7 +9233,7 @@ module.exports = {
|
|
9240
9233
|
|
9241
9234
|
_aliasFunctions: require("./internal/alias-functions"),
|
9242
9235
|
|
9243
|
-
"
|
9236
|
+
"es6.symbols": require("./es6/symbols"),
|
9244
9237
|
"spec.undefinedToVoid": require("./spec/undefined-to-void"),
|
9245
9238
|
|
9246
9239
|
_strict: require("./internal/strict"),
|
@@ -9258,7 +9251,7 @@ module.exports = {
|
|
9258
9251
|
|
9259
9252
|
_cleanUp: require("./internal/cleanup")
|
9260
9253
|
};
|
9261
|
-
},{"./es3/member-expression-literals":58,"./es3/property-literals":59,"./es5/properties.mutators":60,"./es6/arrow-functions":61,"./es6/block-scoping":63,"./es6/block-scoping-tdz":62,"./es6/classes":64,"./es6/constants":65,"./es6/destructuring":66,"./es6/for-of":67,"./es6/modules":68,"./es6/object-super":69,"./es6/parameters.default":70,"./es6/parameters.rest":71,"./es6/properties.computed":72,"./es6/properties.shorthand":73,"./es6/regex.sticky":74,"./es6/regex.unicode":75,"./es6/spread":76,"./es6/tail-call":
|
9254
|
+
},{"./es3/member-expression-literals":58,"./es3/property-literals":59,"./es5/properties.mutators":60,"./es6/arrow-functions":61,"./es6/block-scoping":63,"./es6/block-scoping-tdz":62,"./es6/classes":64,"./es6/constants":65,"./es6/destructuring":66,"./es6/for-of":67,"./es6/modules":68,"./es6/object-super":69,"./es6/parameters.default":70,"./es6/parameters.rest":71,"./es6/properties.computed":72,"./es6/properties.shorthand":73,"./es6/regex.sticky":74,"./es6/regex.unicode":75,"./es6/spread":76,"./es6/symbols":77,"./es6/tail-call":78,"./es6/template-literals":79,"./es7/abstract-references":80,"./es7/comprehensions":81,"./es7/exponentiation-operator":82,"./es7/object-rest-spread":83,"./internal/alias-functions":85,"./internal/block-hoist":86,"./internal/cleanup":87,"./internal/declarations":88,"./internal/module-formatter":89,"./internal/modules":90,"./internal/strict":91,"./internal/validation":92,"./other/async-to-generator":93,"./other/bluebird-coroutines":94,"./other/flow":95,"./other/react":97,"./other/react-compat":96,"./other/regenerator":98,"./other/runtime":99,"./other/strict":100,"./playground/mallet-operator":101,"./playground/memoization-operator":102,"./playground/method-binding":103,"./playground/object-getter-memoization":104,"./spec/block-scoped-functions":105,"./spec/function-name":106,"./spec/proto-to-assign":107,"./spec/undefined-to-void":108,"./utility/dead-code-elimination":109,"./utility/inline-environment-variables":110,"./utility/inline-expressions":111,"./utility/remove-console":112,"./utility/remove-debugger":113,"./validation/react":114,"./validation/undeclared-variable-check":115}],85:[function(require,module,exports){
|
9262
9255
|
"use strict";
|
9263
9256
|
|
9264
9257
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -9360,7 +9353,7 @@ function FunctionDeclaration(node, parent, scope) {
|
|
9360
9353
|
|
9361
9354
|
exports.FunctionExpression = FunctionDeclaration;
|
9362
9355
|
exports.__esModule = true;
|
9363
|
-
},{"../../../types":122}],
|
9356
|
+
},{"../../../types":122}],86:[function(require,module,exports){
|
9364
9357
|
"use strict";
|
9365
9358
|
|
9366
9359
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -9400,7 +9393,7 @@ var BlockStatement = exports.BlockStatement = {
|
|
9400
9393
|
|
9401
9394
|
exports.Program = BlockStatement;
|
9402
9395
|
exports.__esModule = true;
|
9403
|
-
},{"lodash/array/flatten":197,"lodash/collection/groupBy":204,"lodash/object/values":307}],
|
9396
|
+
},{"lodash/array/flatten":197,"lodash/collection/groupBy":204,"lodash/object/values":307}],87:[function(require,module,exports){
|
9404
9397
|
"use strict";
|
9405
9398
|
|
9406
9399
|
var SequenceExpression = exports.SequenceExpression = {
|
@@ -9418,8 +9411,23 @@ var ExpressionStatement = exports.ExpressionStatement = {
|
|
9418
9411
|
if (!node.expression) this.remove();
|
9419
9412
|
}
|
9420
9413
|
};
|
9414
|
+
|
9415
|
+
var Binary = exports.Binary = {
|
9416
|
+
exit: function exit(node) {
|
9417
|
+
var right = node.right;
|
9418
|
+
var left = node.left;
|
9419
|
+
|
9420
|
+
if (!left && !right) {
|
9421
|
+
this.remove();
|
9422
|
+
} else if (!left) {
|
9423
|
+
return right;
|
9424
|
+
} else if (!right) {
|
9425
|
+
return left;
|
9426
|
+
}
|
9427
|
+
}
|
9428
|
+
};
|
9421
9429
|
exports.__esModule = true;
|
9422
|
-
},{}],
|
9430
|
+
},{}],88:[function(require,module,exports){
|
9423
9431
|
"use strict";
|
9424
9432
|
|
9425
9433
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -9468,7 +9476,7 @@ function BlockStatement(node, parent, scope, file) {
|
|
9468
9476
|
|
9469
9477
|
exports.Program = BlockStatement;
|
9470
9478
|
exports.__esModule = true;
|
9471
|
-
},{"../../../types":122,"../../helpers/strict":41}],
|
9479
|
+
},{"../../../types":122,"../../helpers/strict":41}],89:[function(require,module,exports){
|
9472
9480
|
"use strict";
|
9473
9481
|
|
9474
9482
|
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
@@ -9490,7 +9498,7 @@ function Program(program, parent, scope, file) {
|
|
9490
9498
|
}
|
9491
9499
|
|
9492
9500
|
exports.__esModule = true;
|
9493
|
-
},{"../../helpers/strict":41}],
|
9501
|
+
},{"../../helpers/strict":41}],90:[function(require,module,exports){
|
9494
9502
|
"use strict";
|
9495
9503
|
|
9496
9504
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -9532,40 +9540,43 @@ function ExportDeclaration(node, parent, scope) {
|
|
9532
9540
|
|
9533
9541
|
if (node["default"]) {
|
9534
9542
|
if (t.isClassDeclaration(declar)) {
|
9543
|
+
// export default class Foo {};
|
9544
|
+
this.node = [getDeclar(), node];
|
9535
9545
|
node.declaration = declar.id;
|
9536
|
-
return [getDeclar(), node];
|
9537
9546
|
} else if (t.isClassExpression(declar)) {
|
9547
|
+
// export default class {};
|
9538
9548
|
var temp = scope.generateUidIdentifier("default");
|
9539
9549
|
declar = t.variableDeclaration("var", [t.variableDeclarator(temp, declar)]);
|
9540
9550
|
node.declaration = temp;
|
9541
9551
|
return [getDeclar(), node];
|
9542
9552
|
} else if (t.isFunctionDeclaration(declar)) {
|
9553
|
+
// export default function Foo() {}
|
9543
9554
|
node._blockHoist = 2;
|
9544
9555
|
node.declaration = declar.id;
|
9545
9556
|
return [getDeclar(), node];
|
9546
9557
|
}
|
9547
9558
|
} else {
|
9548
9559
|
if (t.isFunctionDeclaration(declar)) {
|
9560
|
+
// export function Foo() {}
|
9549
9561
|
node.specifiers = [t.importSpecifier(declar.id, declar.id)];
|
9550
9562
|
node.declaration = null;
|
9551
9563
|
node._blockHoist = 2;
|
9552
9564
|
return [getDeclar(), node];
|
9553
9565
|
} else if (t.isVariableDeclaration(declar)) {
|
9566
|
+
// export var foo = "bar";
|
9554
9567
|
var specifiers = [];
|
9555
|
-
|
9556
9568
|
var bindings = t.getBindingIdentifiers(declar);
|
9557
9569
|
for (var key in bindings) {
|
9558
9570
|
var id = bindings[key];
|
9559
9571
|
specifiers.push(t.exportSpecifier(id, id));
|
9560
9572
|
}
|
9561
|
-
|
9562
9573
|
return [declar, t.exportDeclaration(null, specifiers)];
|
9563
9574
|
}
|
9564
9575
|
}
|
9565
9576
|
}
|
9566
9577
|
|
9567
9578
|
exports.__esModule = true;
|
9568
|
-
},{"../../../types":122}],
|
9579
|
+
},{"../../../types":122}],91:[function(require,module,exports){
|
9569
9580
|
"use strict";
|
9570
9581
|
|
9571
9582
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -9581,7 +9592,7 @@ function Program(program, parent, scope, file) {
|
|
9581
9592
|
}
|
9582
9593
|
|
9583
9594
|
exports.__esModule = true;
|
9584
|
-
},{"../../../types":122}],
|
9595
|
+
},{"../../../types":122}],92:[function(require,module,exports){
|
9585
9596
|
"use strict";
|
9586
9597
|
|
9587
9598
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -9590,6 +9601,7 @@ var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? ob
|
|
9590
9601
|
|
9591
9602
|
exports.ForOfStatement = ForOfStatement;
|
9592
9603
|
exports.Property = Property;
|
9604
|
+
exports.BlockStatement = BlockStatement;
|
9593
9605
|
|
9594
9606
|
var messages = _interopRequireWildcard(require("../../../messages"));
|
9595
9607
|
|
@@ -9619,8 +9631,21 @@ function Property(node, parent, scope, file) {
|
|
9619
9631
|
}
|
9620
9632
|
|
9621
9633
|
exports.MethodDefinition = Property;
|
9634
|
+
|
9635
|
+
function BlockStatement(node) {
|
9636
|
+
for (var i = 0; i < node.body.length; i++) {
|
9637
|
+
var bodyNode = node.body[i];
|
9638
|
+
if (t.isExpressionStatement(bodyNode) && t.isLiteral(bodyNode.expression)) {
|
9639
|
+
bodyNode._blockHoist = Infinity;
|
9640
|
+
} else {
|
9641
|
+
return;
|
9642
|
+
}
|
9643
|
+
}
|
9644
|
+
}
|
9645
|
+
|
9646
|
+
exports.Program = BlockStatement;
|
9622
9647
|
exports.__esModule = true;
|
9623
|
-
},{"../../../messages":26,"../../../types":122}],
|
9648
|
+
},{"../../../messages":26,"../../../types":122}],93:[function(require,module,exports){
|
9624
9649
|
"use strict";
|
9625
9650
|
|
9626
9651
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -9636,7 +9661,7 @@ exports.Function = function (node, parent, scope, file) {
|
|
9636
9661
|
return remapAsyncToGenerator(node, file.addHelper("async-to-generator"), scope);
|
9637
9662
|
};
|
9638
9663
|
exports.__esModule = true;
|
9639
|
-
},{"../../helpers/remap-async-to-generator":39,"./bluebird-coroutines":
|
9664
|
+
},{"../../helpers/remap-async-to-generator":39,"./bluebird-coroutines":94}],94:[function(require,module,exports){
|
9640
9665
|
"use strict";
|
9641
9666
|
|
9642
9667
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -9660,7 +9685,7 @@ exports.Function = function (node, parent, scope, file) {
|
|
9660
9685
|
return remapAsyncToGenerator(node, t.memberExpression(file.addImport("bluebird", null, true), t.identifier("coroutine")), scope);
|
9661
9686
|
};
|
9662
9687
|
exports.__esModule = true;
|
9663
|
-
},{"../../../types":122,"../../helpers/remap-async-to-generator":39}],
|
9688
|
+
},{"../../../types":122,"../../helpers/remap-async-to-generator":39}],95:[function(require,module,exports){
|
9664
9689
|
"use strict";
|
9665
9690
|
|
9666
9691
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -9707,7 +9732,7 @@ function ExportDeclaration(node) {
|
|
9707
9732
|
}
|
9708
9733
|
|
9709
9734
|
exports.__esModule = true;
|
9710
|
-
},{"../../../types":122}],
|
9735
|
+
},{"../../../types":122}],96:[function(require,module,exports){
|
9711
9736
|
"use strict";
|
9712
9737
|
|
9713
9738
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -9738,7 +9763,7 @@ require("../../helpers/build-react-transformer")(exports, {
|
|
9738
9763
|
}
|
9739
9764
|
});
|
9740
9765
|
exports.__esModule = true;
|
9741
|
-
},{"../../../types":122,"../../helpers/build-react-transformer":32,"../../helpers/react":37}],
|
9766
|
+
},{"../../../types":122,"../../helpers/build-react-transformer":32,"../../helpers/react":37}],97:[function(require,module,exports){
|
9742
9767
|
"use strict";
|
9743
9768
|
|
9744
9769
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -9790,7 +9815,7 @@ require("../../helpers/build-react-transformer")(exports, {
|
|
9790
9815
|
}
|
9791
9816
|
});
|
9792
9817
|
exports.__esModule = true;
|
9793
|
-
},{"../../../types":122,"../../helpers/build-react-transformer":32,"../../helpers/react":37}],
|
9818
|
+
},{"../../../types":122,"../../helpers/build-react-transformer":32,"../../helpers/react":37}],98:[function(require,module,exports){
|
9794
9819
|
"use strict";
|
9795
9820
|
|
9796
9821
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -9812,7 +9837,7 @@ var Program = exports.Program = {
|
|
9812
9837
|
}
|
9813
9838
|
};
|
9814
9839
|
exports.__esModule = true;
|
9815
|
-
},{"../../../types":122,"regenerator-babel":320}],
|
9840
|
+
},{"../../../types":122,"regenerator-babel":320}],99:[function(require,module,exports){
|
9816
9841
|
"use strict";
|
9817
9842
|
|
9818
9843
|
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
@@ -9840,7 +9865,7 @@ var coreHas = function coreHas(node) {
|
|
9840
9865
|
return node.name !== "_" && has(core, node.name);
|
9841
9866
|
};
|
9842
9867
|
|
9843
|
-
var ALIASABLE_CONSTRUCTORS = ["Symbol", "Promise", "Map", "WeakMap", "Set", "WeakSet"
|
9868
|
+
var ALIASABLE_CONSTRUCTORS = ["Symbol", "Promise", "Map", "WeakMap", "Set", "WeakSet"];
|
9844
9869
|
|
9845
9870
|
var astVisitor = {
|
9846
9871
|
enter: function enter(node, parent, scope, file) {
|
@@ -9923,7 +9948,7 @@ function Identifier(node, parent, scope, file) {
|
|
9923
9948
|
}
|
9924
9949
|
|
9925
9950
|
exports.__esModule = true;
|
9926
|
-
},{"../../../types":122,"../../../util":124,"core-js/library":177,"lodash/collection/includes":205,"lodash/object/has":304}],
|
9951
|
+
},{"../../../types":122,"../../../util":124,"core-js/library":177,"lodash/collection/includes":205,"lodash/object/has":304}],100:[function(require,module,exports){
|
9927
9952
|
"use strict";
|
9928
9953
|
|
9929
9954
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -9963,7 +9988,7 @@ function CallExpression(node, parent, scope, file) {
|
|
9963
9988
|
}
|
9964
9989
|
|
9965
9990
|
exports.__esModule = true;
|
9966
|
-
},{"../../../messages":26,"../../../types":122}],
|
9991
|
+
},{"../../../messages":26,"../../../types":122}],101:[function(require,module,exports){
|
9967
9992
|
"use strict";
|
9968
9993
|
|
9969
9994
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -9994,7 +10019,7 @@ build(exports, {
|
|
9994
10019
|
}
|
9995
10020
|
});
|
9996
10021
|
exports.__esModule = true;
|
9997
|
-
},{"../../../messages":26,"../../../types":122,"../../helpers/build-conditional-assignment-operator-transformer":31}],
|
10022
|
+
},{"../../../messages":26,"../../../types":122,"../../helpers/build-conditional-assignment-operator-transformer":31}],102:[function(require,module,exports){
|
9998
10023
|
"use strict";
|
9999
10024
|
|
10000
10025
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -10027,7 +10052,7 @@ build(exports, {
|
|
10027
10052
|
}
|
10028
10053
|
});
|
10029
10054
|
exports.__esModule = true;
|
10030
|
-
},{"../../../types":122,"../../helpers/build-conditional-assignment-operator-transformer":31}],
|
10055
|
+
},{"../../../types":122,"../../helpers/build-conditional-assignment-operator-transformer":31}],103:[function(require,module,exports){
|
10031
10056
|
"use strict";
|
10032
10057
|
|
10033
10058
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -10071,7 +10096,7 @@ function BindFunctionExpression(node, parent, scope) {
|
|
10071
10096
|
}
|
10072
10097
|
|
10073
10098
|
exports.__esModule = true;
|
10074
|
-
},{"../../../types":122}],
|
10099
|
+
},{"../../../types":122}],104:[function(require,module,exports){
|
10075
10100
|
"use strict";
|
10076
10101
|
|
10077
10102
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -10117,7 +10142,7 @@ function MethodDefinition(node, parent, scope, file) {
|
|
10117
10142
|
|
10118
10143
|
exports.Property = MethodDefinition;
|
10119
10144
|
exports.__esModule = true;
|
10120
|
-
},{"../../../types":122}],
|
10145
|
+
},{"../../../types":122}],105:[function(require,module,exports){
|
10121
10146
|
"use strict";
|
10122
10147
|
|
10123
10148
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -10150,12 +10175,12 @@ function BlockStatement(node, parent, scope, file) {
|
|
10150
10175
|
}
|
10151
10176
|
|
10152
10177
|
exports.__esModule = true;
|
10153
|
-
},{"../../../types":122}],
|
10178
|
+
},{"../../../types":122}],106:[function(require,module,exports){
|
10154
10179
|
"use strict";
|
10155
10180
|
|
10156
10181
|
exports.FunctionExpression = require("../../helpers/name-method").bare;
|
10157
10182
|
exports.__esModule = true;
|
10158
|
-
},{"../../helpers/name-method":36}],
|
10183
|
+
},{"../../helpers/name-method":36}],107:[function(require,module,exports){
|
10159
10184
|
"use strict";
|
10160
10185
|
|
10161
10186
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -10227,33 +10252,7 @@ function ObjectExpression(node, parent, scope, file) {
|
|
10227
10252
|
}
|
10228
10253
|
|
10229
10254
|
exports.__esModule = true;
|
10230
|
-
},{"../../../types":122,"lodash/array/pull":199}],
|
10231
|
-
"use strict";
|
10232
|
-
|
10233
|
-
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
10234
|
-
|
10235
|
-
exports.UnaryExpression = UnaryExpression;
|
10236
|
-
|
10237
|
-
var t = _interopRequire(require("../../../types"));
|
10238
|
-
|
10239
|
-
var optional = exports.optional = true;
|
10240
|
-
|
10241
|
-
function UnaryExpression(node, parent, scope, file) {
|
10242
|
-
this.skip();
|
10243
|
-
|
10244
|
-
if (node.operator === "typeof") {
|
10245
|
-
var call = t.callExpression(file.addHelper("typeof"), [node.argument]);
|
10246
|
-
if (t.isIdentifier(node.argument)) {
|
10247
|
-
var undefLiteral = t.literal("undefined");
|
10248
|
-
return t.conditionalExpression(t.binaryExpression("===", t.unaryExpression("typeof", node.argument), undefLiteral), undefLiteral, call);
|
10249
|
-
} else {
|
10250
|
-
return call;
|
10251
|
-
}
|
10252
|
-
}
|
10253
|
-
}
|
10254
|
-
|
10255
|
-
exports.__esModule = true;
|
10256
|
-
},{"../../../types":122}],108:[function(require,module,exports){
|
10255
|
+
},{"../../../types":122,"lodash/array/pull":199}],108:[function(require,module,exports){
|
10257
10256
|
"use strict";
|
10258
10257
|
|
10259
10258
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -10553,6 +10552,8 @@ var flatten = _interopRequire(require("lodash/array/flatten"));
|
|
10553
10552
|
|
10554
10553
|
var compact = _interopRequire(require("lodash/array/compact"));
|
10555
10554
|
|
10555
|
+
var t = _interopRequire(require("../types"));
|
10556
|
+
|
10556
10557
|
var TraversalContext = (function () {
|
10557
10558
|
function TraversalContext(scope, opts, state, parentPath) {
|
10558
10559
|
_classCallCheck(this, TraversalContext);
|
@@ -10595,7 +10596,7 @@ var TraversalContext = (function () {
|
|
10595
10596
|
if (this.shouldFlatten) {
|
10596
10597
|
node[key] = flatten(node[key]);
|
10597
10598
|
|
10598
|
-
if (key
|
10599
|
+
if (t.FLATTENABLE_KEYS.indexOf(key) >= 0) {
|
10599
10600
|
// we can safely compact this
|
10600
10601
|
node[key] = compact(node[key]);
|
10601
10602
|
}
|
@@ -10606,7 +10607,7 @@ var TraversalContext = (function () {
|
|
10606
10607
|
})();
|
10607
10608
|
|
10608
10609
|
module.exports = TraversalContext;
|
10609
|
-
},{"./path":118,"lodash/array/compact":196,"lodash/array/flatten":197}],117:[function(require,module,exports){
|
10610
|
+
},{"../types":122,"./path":118,"lodash/array/compact":196,"lodash/array/flatten":197}],117:[function(require,module,exports){
|
10610
10611
|
"use strict";
|
10611
10612
|
|
10612
10613
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
@@ -10817,7 +10818,6 @@ var TraversalPath = (function () {
|
|
10817
10818
|
};
|
10818
10819
|
|
10819
10820
|
TraversalPath.prototype.setContext = function setContext(parentPath, context, key) {
|
10820
|
-
this.shouldRemove = false;
|
10821
10821
|
this.shouldSkip = false;
|
10822
10822
|
this.shouldStop = false;
|
10823
10823
|
|
@@ -10831,8 +10831,9 @@ var TraversalPath = (function () {
|
|
10831
10831
|
};
|
10832
10832
|
|
10833
10833
|
TraversalPath.prototype.remove = function remove() {
|
10834
|
-
this.
|
10835
|
-
this.
|
10834
|
+
this._refresh(this.node, []);
|
10835
|
+
this.container[this.key] = null;
|
10836
|
+
this.flatten();
|
10836
10837
|
};
|
10837
10838
|
|
10838
10839
|
TraversalPath.prototype.skip = function skip() {
|
@@ -10848,6 +10849,13 @@ var TraversalPath = (function () {
|
|
10848
10849
|
this.context.flatten();
|
10849
10850
|
};
|
10850
10851
|
|
10852
|
+
TraversalPath.prototype._refresh = function _refresh(oldNode, newNodes) {};
|
10853
|
+
|
10854
|
+
TraversalPath.prototype.refresh = function refresh() {
|
10855
|
+
var node = this.node;
|
10856
|
+
this._refresh(node, [node]);
|
10857
|
+
};
|
10858
|
+
|
10851
10859
|
TraversalPath.prototype.call = function call(key) {
|
10852
10860
|
var node = this.node;
|
10853
10861
|
if (!node) return;
|
@@ -10861,11 +10869,6 @@ var TraversalPath = (function () {
|
|
10861
10869
|
if (replacement) {
|
10862
10870
|
this.node = replacement;
|
10863
10871
|
}
|
10864
|
-
|
10865
|
-
if (this.shouldRemove) {
|
10866
|
-
this.container[this.key] = null;
|
10867
|
-
this.flatten();
|
10868
|
-
}
|
10869
10872
|
};
|
10870
10873
|
|
10871
10874
|
TraversalPath.prototype.isBlacklisted = function isBlacklisted() {
|
@@ -10885,16 +10888,17 @@ var TraversalPath = (function () {
|
|
10885
10888
|
var node = this.node;
|
10886
10889
|
var opts = this.opts;
|
10887
10890
|
|
10888
|
-
if (
|
10889
|
-
|
10890
|
-
|
10891
|
-
|
10892
|
-
|
10891
|
+
if (node) {
|
10892
|
+
if (Array.isArray(node)) {
|
10893
|
+
// traverse over these replacement nodes we purposely don't call exitNode
|
10894
|
+
// as the original node has been destroyed
|
10895
|
+
for (var i = 0; i < node.length; i++) {
|
10896
|
+
traverse.node(node[i], opts, this.scope, this.state, this);
|
10897
|
+
}
|
10898
|
+
} else {
|
10899
|
+
traverse.node(node, opts, this.scope, this.state, this);
|
10900
|
+
this.call("exit");
|
10893
10901
|
}
|
10894
|
-
} else {
|
10895
|
-
traverse.node(node, opts, this.scope, this.state, this);
|
10896
|
-
|
10897
|
-
this.call("exit");
|
10898
10902
|
}
|
10899
10903
|
|
10900
10904
|
return this.shouldStop;
|
@@ -10926,25 +10930,29 @@ var TraversalPath = (function () {
|
|
10926
10930
|
return this.container[this.key];
|
10927
10931
|
},
|
10928
10932
|
set: function (replacement) {
|
10933
|
+
if (!replacement) return this.remove();
|
10934
|
+
|
10935
|
+
var oldNode = this.node;
|
10929
10936
|
var isArray = Array.isArray(replacement);
|
10937
|
+
var replacements = isArray ? replacement : [replacement];
|
10930
10938
|
|
10931
10939
|
// inherit comments from original node to the first replacement node
|
10932
|
-
var inheritTo =
|
10933
|
-
if (
|
10934
|
-
if (inheritTo) t.inheritsComments(inheritTo, this.node);
|
10940
|
+
var inheritTo = replacements[0];
|
10941
|
+
if (inheritTo) t.inheritsComments(inheritTo, oldNode);
|
10935
10942
|
|
10936
10943
|
// replace the node
|
10937
10944
|
this.container[this.key] = replacement;
|
10945
|
+
|
10946
|
+
// potentially create new scope
|
10938
10947
|
this.setScope();
|
10939
10948
|
|
10949
|
+
// refresh scope with new/removed bindings
|
10950
|
+
this._refresh(oldNode, replacements);
|
10951
|
+
|
10940
10952
|
var file = this.scope && this.scope.file;
|
10941
10953
|
if (file) {
|
10942
|
-
|
10943
|
-
|
10944
|
-
file.checkNode(replacement[i], this.scope);
|
10945
|
-
}
|
10946
|
-
} else {
|
10947
|
-
file.checkNode(replacement, this.scope);
|
10954
|
+
for (var i = 0; i < replacements.length; i++) {
|
10955
|
+
file.checkNode(replacements[i], this.scope);
|
10948
10956
|
}
|
10949
10957
|
}
|
10950
10958
|
|
@@ -10956,6 +10964,7 @@ var TraversalPath = (function () {
|
|
10956
10964
|
}
|
10957
10965
|
|
10958
10966
|
this.flatten();
|
10967
|
+
// TODO: duplicate internal path metadata across the new node paths
|
10959
10968
|
}
|
10960
10969
|
},
|
10961
10970
|
configurable: true
|
@@ -10976,6 +10985,8 @@ for (var i = 0; i < t.TYPES.length; i++) {
|
|
10976
10985
|
};
|
10977
10986
|
})();
|
10978
10987
|
}
|
10988
|
+
|
10989
|
+
// todo
|
10979
10990
|
},{"../types":122,"./index":117,"./scope":119,"lodash/collection/includes":205}],119:[function(require,module,exports){
|
10980
10991
|
"use strict";
|
10981
10992
|
|
@@ -11059,11 +11070,6 @@ var Scope = (function () {
|
|
11059
11070
|
/**
|
11060
11071
|
* This searches the current "scope" and collects all references/bindings
|
11061
11072
|
* within.
|
11062
|
-
*
|
11063
|
-
* @param {Node} block
|
11064
|
-
* @param {Node} parentBlock
|
11065
|
-
* @param {Scope} [parent]
|
11066
|
-
* @param {File} [file]
|
11067
11073
|
*/
|
11068
11074
|
|
11069
11075
|
function Scope(block, parentBlock, parent, file) {
|
@@ -11079,14 +11085,10 @@ var Scope = (function () {
|
|
11079
11085
|
}
|
11080
11086
|
|
11081
11087
|
Scope.globals = flatten([globals.builtin, globals.browser, globals.node].map(Object.keys));
|
11082
|
-
Scope.contextVariables = ["this", "arguments"];
|
11088
|
+
Scope.contextVariables = ["this", "arguments", "super"];
|
11083
11089
|
|
11084
11090
|
/**
|
11085
11091
|
* Description
|
11086
|
-
*
|
11087
|
-
* @param {Object} node
|
11088
|
-
* @param {Object} opts
|
11089
|
-
* @param [state]
|
11090
11092
|
*/
|
11091
11093
|
|
11092
11094
|
Scope.prototype.traverse = (function (_traverse) {
|
@@ -11105,12 +11107,12 @@ var Scope = (function () {
|
|
11105
11107
|
|
11106
11108
|
/**
|
11107
11109
|
* Description
|
11108
|
-
*
|
11109
|
-
* @param {String} [name="temp"]
|
11110
11110
|
*/
|
11111
11111
|
|
11112
|
-
Scope.prototype.generateTemp = function generateTemp(
|
11113
|
-
var
|
11112
|
+
Scope.prototype.generateTemp = function generateTemp() {
|
11113
|
+
var name = arguments[0] === undefined ? "temp" : arguments[0];
|
11114
|
+
|
11115
|
+
var id = this.generateUidIdentifier(name);
|
11114
11116
|
this.push({
|
11115
11117
|
key: id.name,
|
11116
11118
|
id: id
|
@@ -11120,8 +11122,6 @@ var Scope = (function () {
|
|
11120
11122
|
|
11121
11123
|
/**
|
11122
11124
|
* Description
|
11123
|
-
*
|
11124
|
-
* @param {String} name
|
11125
11125
|
*/
|
11126
11126
|
|
11127
11127
|
Scope.prototype.generateUidIdentifier = function generateUidIdentifier(name) {
|
@@ -11132,8 +11132,6 @@ var Scope = (function () {
|
|
11132
11132
|
|
11133
11133
|
/**
|
11134
11134
|
* Description
|
11135
|
-
*
|
11136
|
-
* @param {String} name
|
11137
11135
|
*/
|
11138
11136
|
|
11139
11137
|
Scope.prototype.generateUid = function generateUid(name) {
|
@@ -11156,9 +11154,6 @@ var Scope = (function () {
|
|
11156
11154
|
|
11157
11155
|
/*
|
11158
11156
|
* Description
|
11159
|
-
*
|
11160
|
-
* @param {Object} parent
|
11161
|
-
* @returns {Object}
|
11162
11157
|
*/
|
11163
11158
|
|
11164
11159
|
Scope.prototype.generateUidBasedOnNode = function generateUidBasedOnNode(parent) {
|
@@ -11207,9 +11202,6 @@ var Scope = (function () {
|
|
11207
11202
|
|
11208
11203
|
/**
|
11209
11204
|
* Description
|
11210
|
-
*
|
11211
|
-
* @param {Object} node
|
11212
|
-
* @returns {Object}
|
11213
11205
|
*/
|
11214
11206
|
|
11215
11207
|
Scope.prototype.generateTempBasedOnNode = function generateTempBasedOnNode(node) {
|
@@ -11225,6 +11217,10 @@ var Scope = (function () {
|
|
11225
11217
|
return id;
|
11226
11218
|
};
|
11227
11219
|
|
11220
|
+
/**
|
11221
|
+
* Description
|
11222
|
+
*/
|
11223
|
+
|
11228
11224
|
Scope.prototype.checkBlockScopedCollisions = function checkBlockScopedCollisions(kind, name, id) {
|
11229
11225
|
var local = this.getOwnBindingInfo(name);
|
11230
11226
|
if (!local) return;
|
@@ -11237,6 +11233,10 @@ var Scope = (function () {
|
|
11237
11233
|
}
|
11238
11234
|
};
|
11239
11235
|
|
11236
|
+
/**
|
11237
|
+
* Description
|
11238
|
+
*/
|
11239
|
+
|
11240
11240
|
Scope.prototype.rename = function rename(oldName, newName) {
|
11241
11241
|
if (!newName) newName = this.generateUidIdentifier(oldName).name;
|
11242
11242
|
|
@@ -11263,12 +11263,16 @@ var Scope = (function () {
|
|
11263
11263
|
}
|
11264
11264
|
});
|
11265
11265
|
|
11266
|
-
|
11266
|
+
scope.removeOwnBinding(oldName);
|
11267
11267
|
scope.bindings[newName] = info;
|
11268
11268
|
|
11269
11269
|
binding.name = newName;
|
11270
11270
|
};
|
11271
11271
|
|
11272
|
+
/**
|
11273
|
+
* Description
|
11274
|
+
*/
|
11275
|
+
|
11272
11276
|
Scope.prototype.inferType = function inferType(node) {
|
11273
11277
|
var target;
|
11274
11278
|
|
@@ -11301,6 +11305,10 @@ var Scope = (function () {
|
|
11301
11305
|
}
|
11302
11306
|
};
|
11303
11307
|
|
11308
|
+
/**
|
11309
|
+
* Description
|
11310
|
+
*/
|
11311
|
+
|
11304
11312
|
Scope.prototype.isTypeGeneric = function isTypeGeneric(name, genericName) {
|
11305
11313
|
var info = this.getBindingInfo(name);
|
11306
11314
|
if (!info) return false;
|
@@ -11309,10 +11317,18 @@ var Scope = (function () {
|
|
11309
11317
|
return t.isGenericTypeAnnotation(type) && t.isIdentifier(type.id, { name: genericName });
|
11310
11318
|
};
|
11311
11319
|
|
11320
|
+
/**
|
11321
|
+
* Description
|
11322
|
+
*/
|
11323
|
+
|
11312
11324
|
Scope.prototype.assignTypeGeneric = function assignTypeGeneric(name, type) {
|
11313
11325
|
this.assignType(name, t.genericTypeAnnotation(t.identifier(type)));
|
11314
11326
|
};
|
11315
11327
|
|
11328
|
+
/**
|
11329
|
+
* Description
|
11330
|
+
*/
|
11331
|
+
|
11316
11332
|
Scope.prototype.assignType = function assignType(name, type) {
|
11317
11333
|
var info = this.getBindingInfo(name);
|
11318
11334
|
if (!info) return;
|
@@ -11320,7 +11336,11 @@ var Scope = (function () {
|
|
11320
11336
|
info.typeAnnotation = type;
|
11321
11337
|
};
|
11322
11338
|
|
11323
|
-
|
11339
|
+
/**
|
11340
|
+
* Description
|
11341
|
+
*/
|
11342
|
+
|
11343
|
+
Scope.prototype.getTypeAnnotation = function getTypeAnnotation(id, node) {
|
11324
11344
|
var info = {
|
11325
11345
|
annotation: null,
|
11326
11346
|
inferred: false
|
@@ -11345,6 +11365,10 @@ var Scope = (function () {
|
|
11345
11365
|
return info;
|
11346
11366
|
};
|
11347
11367
|
|
11368
|
+
/**
|
11369
|
+
* Description
|
11370
|
+
*/
|
11371
|
+
|
11348
11372
|
Scope.prototype.toArray = function toArray(node, i) {
|
11349
11373
|
var file = this.file;
|
11350
11374
|
|
@@ -11371,10 +11395,24 @@ var Scope = (function () {
|
|
11371
11395
|
return t.callExpression(file.addHelper(helperName), args);
|
11372
11396
|
};
|
11373
11397
|
|
11374
|
-
|
11375
|
-
|
11398
|
+
/**
|
11399
|
+
* Description
|
11400
|
+
*/
|
11401
|
+
|
11402
|
+
Scope.prototype.refreshDeclaration = function refreshDeclaration(node) {
|
11403
|
+
if (t.isBlockScoped(node)) {
|
11404
|
+
this.getBlockParent().registerDeclaration(node);
|
11405
|
+
} else if (t.isVariableDeclaration(node, { kind: "var" })) {
|
11406
|
+
this.getFunctionParent().registerDeclaration(node);
|
11407
|
+
} else if (node === this.block) {
|
11408
|
+
this.recrawl();
|
11409
|
+
}
|
11376
11410
|
};
|
11377
11411
|
|
11412
|
+
/**
|
11413
|
+
* Description
|
11414
|
+
*/
|
11415
|
+
|
11378
11416
|
Scope.prototype.registerDeclaration = function registerDeclaration(node) {
|
11379
11417
|
if (t.isFunctionDeclaration(node)) {
|
11380
11418
|
this.registerBinding("hoisted", node);
|
@@ -11391,6 +11429,10 @@ var Scope = (function () {
|
|
11391
11429
|
}
|
11392
11430
|
};
|
11393
11431
|
|
11432
|
+
/**
|
11433
|
+
* Description
|
11434
|
+
*/
|
11435
|
+
|
11394
11436
|
Scope.prototype.registerBindingReassignment = function registerBindingReassignment(node) {
|
11395
11437
|
var ids = t.getBindingIdentifiers(node);
|
11396
11438
|
for (var name in ids) {
|
@@ -11406,6 +11448,10 @@ var Scope = (function () {
|
|
11406
11448
|
}
|
11407
11449
|
};
|
11408
11450
|
|
11451
|
+
/**
|
11452
|
+
* Description
|
11453
|
+
*/
|
11454
|
+
|
11409
11455
|
Scope.prototype.registerBinding = function registerBinding(kind, node) {
|
11410
11456
|
if (!kind) throw new ReferenceError("no `kind`");
|
11411
11457
|
|
@@ -11416,7 +11462,7 @@ var Scope = (function () {
|
|
11416
11462
|
|
11417
11463
|
this.checkBlockScopedCollisions(kind, name, id);
|
11418
11464
|
|
11419
|
-
var typeInfo = this.getTypeAnnotation(
|
11465
|
+
var typeInfo = this.getTypeAnnotation(id, node);
|
11420
11466
|
|
11421
11467
|
this.bindings[name] = {
|
11422
11468
|
typeAnnotationInferred: typeInfo.inferred,
|
@@ -11430,17 +11476,18 @@ var Scope = (function () {
|
|
11430
11476
|
}
|
11431
11477
|
};
|
11432
11478
|
|
11433
|
-
|
11434
|
-
|
11435
|
-
|
11436
|
-
this.registerBinding(declar.kind, declars[i]);
|
11437
|
-
}
|
11438
|
-
};
|
11479
|
+
/**
|
11480
|
+
* Description
|
11481
|
+
*/
|
11439
11482
|
|
11440
11483
|
Scope.prototype.addGlobal = function addGlobal(node) {
|
11441
11484
|
this.globals[node.name] = node;
|
11442
11485
|
};
|
11443
11486
|
|
11487
|
+
/**
|
11488
|
+
* Description
|
11489
|
+
*/
|
11490
|
+
|
11444
11491
|
Scope.prototype.hasGlobal = function hasGlobal(name) {
|
11445
11492
|
var scope = this;
|
11446
11493
|
|
@@ -11451,6 +11498,19 @@ var Scope = (function () {
|
|
11451
11498
|
return false;
|
11452
11499
|
};
|
11453
11500
|
|
11501
|
+
/**
|
11502
|
+
* Description
|
11503
|
+
*/
|
11504
|
+
|
11505
|
+
Scope.prototype.recrawl = function recrawl() {
|
11506
|
+
this.block._scopeInfo = null;
|
11507
|
+
this.crawl();
|
11508
|
+
};
|
11509
|
+
|
11510
|
+
/**
|
11511
|
+
* Description
|
11512
|
+
*/
|
11513
|
+
|
11454
11514
|
Scope.prototype.crawl = function crawl() {
|
11455
11515
|
var block = this.block;
|
11456
11516
|
var i;
|
@@ -11491,6 +11551,12 @@ var Scope = (function () {
|
|
11491
11551
|
}
|
11492
11552
|
}
|
11493
11553
|
|
11554
|
+
// Class
|
11555
|
+
|
11556
|
+
if (t.isClass(block) && block.id) {
|
11557
|
+
this.registerBinding("var", block.id);
|
11558
|
+
}
|
11559
|
+
|
11494
11560
|
// Function - params, rest
|
11495
11561
|
|
11496
11562
|
if (t.isFunction(block)) {
|
@@ -11536,8 +11602,6 @@ var Scope = (function () {
|
|
11536
11602
|
|
11537
11603
|
/**
|
11538
11604
|
* Description
|
11539
|
-
*
|
11540
|
-
* @param {Object} opts
|
11541
11605
|
*/
|
11542
11606
|
|
11543
11607
|
Scope.prototype.push = function push(opts) {
|
@@ -11552,7 +11616,7 @@ var Scope = (function () {
|
|
11552
11616
|
var _block = block;
|
11553
11617
|
if (!_block._declarations) _block._declarations = {};
|
11554
11618
|
|
11555
|
-
block._declarations[opts.key] = {
|
11619
|
+
block._declarations[opts.key || opts.id.name] = {
|
11556
11620
|
kind: opts.kind || "var",
|
11557
11621
|
id: opts.id,
|
11558
11622
|
init: opts.init
|
@@ -11575,10 +11639,21 @@ var Scope = (function () {
|
|
11575
11639
|
return scope;
|
11576
11640
|
};
|
11577
11641
|
|
11642
|
+
/**
|
11643
|
+
* Walk up the scope tree until we hit either a BlockStatement/Loop or reach the
|
11644
|
+
* very top and hit Program.
|
11645
|
+
*/
|
11646
|
+
|
11647
|
+
Scope.prototype.getBlockParent = function getBlockParent() {
|
11648
|
+
var scope = this;
|
11649
|
+
while (scope.parent && !t.isFunction(scope.block) && !t.isLoop(scope.block) && !t.isFunction(scope.block)) {
|
11650
|
+
scope = scope.parent;
|
11651
|
+
}
|
11652
|
+
return scope;
|
11653
|
+
};
|
11654
|
+
|
11578
11655
|
/**
|
11579
11656
|
* Walks the scope tree and gathers **all** bindings.
|
11580
|
-
*
|
11581
|
-
* @returns {Object}
|
11582
11657
|
*/
|
11583
11658
|
|
11584
11659
|
Scope.prototype.getAllBindings = function getAllBindings() {
|
@@ -11595,9 +11670,6 @@ var Scope = (function () {
|
|
11595
11670
|
|
11596
11671
|
/**
|
11597
11672
|
* Walks the scope tree and gathers all declarations of `kind`.
|
11598
|
-
*
|
11599
|
-
* @param {String} kind
|
11600
|
-
* @returns {Object}
|
11601
11673
|
*/
|
11602
11674
|
|
11603
11675
|
Scope.prototype.getAllBindingsOfKind = function getAllBindingsOfKind(kind) {
|
@@ -11615,13 +11687,17 @@ var Scope = (function () {
|
|
11615
11687
|
return ids;
|
11616
11688
|
};
|
11617
11689
|
|
11618
|
-
|
11690
|
+
/**
|
11691
|
+
* Description
|
11692
|
+
*/
|
11619
11693
|
|
11620
11694
|
Scope.prototype.bindingIdentifierEquals = function bindingIdentifierEquals(name, node) {
|
11621
11695
|
return this.getBindingIdentifier(name) === node;
|
11622
11696
|
};
|
11623
11697
|
|
11624
|
-
|
11698
|
+
/**
|
11699
|
+
* Description
|
11700
|
+
*/
|
11625
11701
|
|
11626
11702
|
Scope.prototype.getBindingInfo = function getBindingInfo(name) {
|
11627
11703
|
var scope = this;
|
@@ -11632,24 +11708,44 @@ var Scope = (function () {
|
|
11632
11708
|
} while (scope = scope.parent);
|
11633
11709
|
};
|
11634
11710
|
|
11711
|
+
/**
|
11712
|
+
* Description
|
11713
|
+
*/
|
11714
|
+
|
11635
11715
|
Scope.prototype.getOwnBindingInfo = function getOwnBindingInfo(name) {
|
11636
11716
|
return this.bindings[name];
|
11637
11717
|
};
|
11638
11718
|
|
11719
|
+
/**
|
11720
|
+
* Description
|
11721
|
+
*/
|
11722
|
+
|
11639
11723
|
Scope.prototype.getBindingIdentifier = function getBindingIdentifier(name) {
|
11640
11724
|
var info = this.getBindingInfo(name);
|
11641
11725
|
return info && info.identifier;
|
11642
11726
|
};
|
11643
11727
|
|
11728
|
+
/**
|
11729
|
+
* Description
|
11730
|
+
*/
|
11731
|
+
|
11644
11732
|
Scope.prototype.getOwnBindingIdentifier = function getOwnBindingIdentifier(name) {
|
11645
11733
|
var binding = this.bindings[name];
|
11646
11734
|
return binding && binding.identifier;
|
11647
11735
|
};
|
11648
11736
|
|
11737
|
+
/**
|
11738
|
+
* Description
|
11739
|
+
*/
|
11740
|
+
|
11649
11741
|
Scope.prototype.getOwnImmutableBindingValue = function getOwnImmutableBindingValue(name) {
|
11650
11742
|
return this._immutableBindingInfoToValue(this.getOwnBindingInfo(name));
|
11651
11743
|
};
|
11652
11744
|
|
11745
|
+
/**
|
11746
|
+
* Description
|
11747
|
+
*/
|
11748
|
+
|
11653
11749
|
Scope.prototype.getImmutableBindingValue = function getImmutableBindingValue(name) {
|
11654
11750
|
return this._immutableBindingInfoToValue(this.getBindingInfo(name));
|
11655
11751
|
};
|
@@ -11676,12 +11772,18 @@ var Scope = (function () {
|
|
11676
11772
|
}
|
11677
11773
|
};
|
11678
11774
|
|
11679
|
-
|
11775
|
+
/**
|
11776
|
+
* Description
|
11777
|
+
*/
|
11680
11778
|
|
11681
11779
|
Scope.prototype.hasOwnBinding = function hasOwnBinding(name) {
|
11682
11780
|
return !!this.getOwnBindingInfo(name);
|
11683
11781
|
};
|
11684
11782
|
|
11783
|
+
/**
|
11784
|
+
* Description
|
11785
|
+
*/
|
11786
|
+
|
11685
11787
|
Scope.prototype.hasBinding = function hasBinding(name) {
|
11686
11788
|
if (!name) return false;
|
11687
11789
|
if (this.hasOwnBinding(name)) return true;
|
@@ -11691,10 +11793,31 @@ var Scope = (function () {
|
|
11691
11793
|
return false;
|
11692
11794
|
};
|
11693
11795
|
|
11796
|
+
/**
|
11797
|
+
* Description
|
11798
|
+
*/
|
11799
|
+
|
11694
11800
|
Scope.prototype.parentHasBinding = function parentHasBinding(name) {
|
11695
11801
|
return this.parent && this.parent.hasBinding(name);
|
11696
11802
|
};
|
11697
11803
|
|
11804
|
+
/**
|
11805
|
+
* Description
|
11806
|
+
*/
|
11807
|
+
|
11808
|
+
Scope.prototype.removeOwnBinding = function removeOwnBinding(name) {
|
11809
|
+
this.bindings[name] = null;
|
11810
|
+
};
|
11811
|
+
|
11812
|
+
/**
|
11813
|
+
* Description
|
11814
|
+
*/
|
11815
|
+
|
11816
|
+
Scope.prototype.removeBinding = function removeBinding(name) {
|
11817
|
+
var info = this.getBindingInfo(name);
|
11818
|
+
if (info) info.scope.removeOwnBinding(name);
|
11819
|
+
};
|
11820
|
+
|
11698
11821
|
return Scope;
|
11699
11822
|
})();
|
11700
11823
|
|
@@ -11727,7 +11850,7 @@ module.exports={
|
|
11727
11850
|
"ImportSpecifier": ["ModuleSpecifier"],
|
11728
11851
|
"ExportSpecifier": ["ModuleSpecifier"],
|
11729
11852
|
|
11730
|
-
"BlockStatement": ["
|
11853
|
+
"BlockStatement": ["Scopable", "Statement"],
|
11731
11854
|
"Program": ["Scopable"],
|
11732
11855
|
"CatchClause": ["Scopable"],
|
11733
11856
|
|
@@ -11738,8 +11861,8 @@ module.exports={
|
|
11738
11861
|
"SpreadProperty": ["UnaryLike"],
|
11739
11862
|
"SpreadElement": ["UnaryLike"],
|
11740
11863
|
|
11741
|
-
"ClassDeclaration": ["
|
11742
|
-
"ClassExpression": ["Class", "Expression"],
|
11864
|
+
"ClassDeclaration": ["Scopable", "Class", "Statement", "Declaration"],
|
11865
|
+
"ClassExpression": ["Scopable", "Class", "Expression"],
|
11743
11866
|
|
11744
11867
|
"ForOfStatement": ["Scopable", "Statement", "For", "Loop"],
|
11745
11868
|
"ForInStatement": ["Scopable", "Statement", "For", "Loop"],
|
@@ -12031,9 +12154,6 @@ module.exports = t;
|
|
12031
12154
|
/**
|
12032
12155
|
* Registers `is[Type]` and `assert[Type]` generated functions for a given `type`.
|
12033
12156
|
* Pass `skipAliasCheck` to force it to directly compare `node.type` with `type`.
|
12034
|
-
*
|
12035
|
-
* @param {String} type
|
12036
|
-
* @param {Boolean?} skipAliasCheck
|
12037
12157
|
*/
|
12038
12158
|
|
12039
12159
|
function registerType(type, skipAliasCheck) {
|
@@ -12052,6 +12172,7 @@ function registerType(type, skipAliasCheck) {
|
|
12052
12172
|
|
12053
12173
|
t.STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"];
|
12054
12174
|
t.NATIVE_TYPE_NAMES = ["Array", "Object", "Number", "Boolean", "Date", "Array", "String"];
|
12175
|
+
t.FLATTENABLE_KEYS = ["body", "expressions"];
|
12055
12176
|
t.FOR_INIT_KEYS = ["left", "init"];
|
12056
12177
|
|
12057
12178
|
t.VISITOR_KEYS = require("./visitor-keys");
|
@@ -12084,12 +12205,6 @@ t.TYPES = Object.keys(t.VISITOR_KEYS).concat(Object.keys(t.FLIPPED_ALIAS_KEYS));
|
|
12084
12205
|
*
|
12085
12206
|
* For better performance, use this instead of `is[Type]` when `type` is unknown.
|
12086
12207
|
* Optionally, pass `skipAliasCheck` to directly compare `node.type` with `type`.
|
12087
|
-
*
|
12088
|
-
* @param {String} type
|
12089
|
-
* @param {Node} node
|
12090
|
-
* @param {Object?} opts
|
12091
|
-
* @param {Boolean?} skipAliasCheck
|
12092
|
-
* @returns {Boolean} isOfType
|
12093
12208
|
*/
|
12094
12209
|
|
12095
12210
|
t.is = function (type, node, opts, skipAliasCheck) {
|
@@ -12150,9 +12265,6 @@ each(t.BUILDER_KEYS, function (keys, type) {
|
|
12150
12265
|
|
12151
12266
|
/**
|
12152
12267
|
* Description
|
12153
|
-
*
|
12154
|
-
* @param {Object} node
|
12155
|
-
* @returns {Object}
|
12156
12268
|
*/
|
12157
12269
|
|
12158
12270
|
t.toComputedKey = function (node, key) {
|
@@ -12169,9 +12281,6 @@ t.toComputedKey = function (node, key) {
|
|
12169
12281
|
* declarations hoisted to the top of the current scope.
|
12170
12282
|
*
|
12171
12283
|
* Expression statements are just resolved to their standard expression.
|
12172
|
-
*
|
12173
|
-
* @param {Array} nodes
|
12174
|
-
* @param {Scope} scope
|
12175
12284
|
*/
|
12176
12285
|
|
12177
12286
|
t.toSequenceExpression = function (nodes, scope) {
|
@@ -12203,10 +12312,6 @@ t.toSequenceExpression = function (nodes, scope) {
|
|
12203
12312
|
|
12204
12313
|
/*
|
12205
12314
|
* Description
|
12206
|
-
*
|
12207
|
-
* @param {Object} actual
|
12208
|
-
* @param {Object} expected
|
12209
|
-
* @returns {Boolean}
|
12210
12315
|
*/
|
12211
12316
|
|
12212
12317
|
t.shallowEqual = function (actual, expected) {
|
@@ -12225,11 +12330,6 @@ t.shallowEqual = function (actual, expected) {
|
|
12225
12330
|
|
12226
12331
|
/**
|
12227
12332
|
* Description
|
12228
|
-
*
|
12229
|
-
* @param {Object} member
|
12230
|
-
* @param {Object} append
|
12231
|
-
* @param {Boolean} [computed]
|
12232
|
-
* @returns {Object} member
|
12233
12333
|
*/
|
12234
12334
|
|
12235
12335
|
t.appendToMemberExpression = function (member, append, computed) {
|
@@ -12241,10 +12341,6 @@ t.appendToMemberExpression = function (member, append, computed) {
|
|
12241
12341
|
|
12242
12342
|
/**
|
12243
12343
|
* Description
|
12244
|
-
*
|
12245
|
-
* @param {Object} member
|
12246
|
-
* @param {Object} append
|
12247
|
-
* @returns {Object} member
|
12248
12344
|
*/
|
12249
12345
|
|
12250
12346
|
t.prependToMemberExpression = function (member, append) {
|
@@ -12254,10 +12350,6 @@ t.prependToMemberExpression = function (member, append) {
|
|
12254
12350
|
|
12255
12351
|
/**
|
12256
12352
|
* Check if the input `node` is a reference to a bound variable.
|
12257
|
-
*
|
12258
|
-
* @param {Object} node
|
12259
|
-
* @param {Object} parent
|
12260
|
-
* @returns {Boolean}
|
12261
12353
|
*/
|
12262
12354
|
|
12263
12355
|
t.isReferenced = function (node, parent) {
|
@@ -12364,10 +12456,6 @@ t.isReferenced = function (node, parent) {
|
|
12364
12456
|
|
12365
12457
|
/**
|
12366
12458
|
* Check if the input `node` is an `Identifier` and `isReferenced`.
|
12367
|
-
*
|
12368
|
-
* @param {Node} node
|
12369
|
-
* @parma {Node} parent
|
12370
|
-
* @returns {Boolean}
|
12371
12459
|
*/
|
12372
12460
|
|
12373
12461
|
t.isReferencedIdentifier = function (node, parent, opts) {
|
@@ -12377,9 +12465,6 @@ t.isReferencedIdentifier = function (node, parent, opts) {
|
|
12377
12465
|
/**
|
12378
12466
|
* Check if the input `name` is a valid identifier name
|
12379
12467
|
* and isn't a reserved word.
|
12380
|
-
*
|
12381
|
-
* @param {String} name
|
12382
|
-
* @returns {Boolean}
|
12383
12468
|
*/
|
12384
12469
|
|
12385
12470
|
t.isValidIdentifier = function (name) {
|
@@ -12388,9 +12473,6 @@ t.isValidIdentifier = function (name) {
|
|
12388
12473
|
|
12389
12474
|
/*
|
12390
12475
|
* Description
|
12391
|
-
*
|
12392
|
-
* @param {String} name
|
12393
|
-
* @returns {String}
|
12394
12476
|
*/
|
12395
12477
|
|
12396
12478
|
t.toIdentifier = function (name) {
|
@@ -12418,22 +12500,16 @@ t.toIdentifier = function (name) {
|
|
12418
12500
|
|
12419
12501
|
/**
|
12420
12502
|
* Description
|
12421
|
-
*
|
12422
|
-
* @param {Object} node
|
12423
|
-
* @param {String=} key
|
12424
12503
|
*/
|
12425
12504
|
|
12426
|
-
t.ensureBlock = function (node
|
12427
|
-
|
12505
|
+
t.ensureBlock = function (node) {
|
12506
|
+
var key = arguments[1] === undefined ? "body" : arguments[1];
|
12428
12507
|
|
12429
12508
|
return node[key] = t.toBlock(node[key], node);
|
12430
12509
|
};
|
12431
12510
|
|
12432
12511
|
/**
|
12433
12512
|
* Description
|
12434
|
-
*
|
12435
|
-
* @param {Object} node
|
12436
|
-
* @returns {Object}
|
12437
12513
|
*/
|
12438
12514
|
|
12439
12515
|
t.clone = function (node) {
|
@@ -12447,9 +12523,6 @@ t.clone = function (node) {
|
|
12447
12523
|
|
12448
12524
|
/**
|
12449
12525
|
* Description
|
12450
|
-
*
|
12451
|
-
* @param {Object} node
|
12452
|
-
* @returns {Object}
|
12453
12526
|
*/
|
12454
12527
|
|
12455
12528
|
t.cloneDeep = function (node) {
|
@@ -12480,10 +12553,6 @@ t.cloneDeep = function (node) {
|
|
12480
12553
|
*
|
12481
12554
|
* For example, given the match `React.createClass` it would match the
|
12482
12555
|
* parsed nodes of `React.createClass` and `React["createClass"]`.
|
12483
|
-
*
|
12484
|
-
* @param {String} match Dot-delimited string
|
12485
|
-
* @param {Boolean} [allowPartial] Allow a partial match
|
12486
|
-
* @returns {Function}
|
12487
12556
|
*/
|
12488
12557
|
|
12489
12558
|
t.buildMatchMemberExpression = function (match, allowPartial) {
|
@@ -12536,8 +12605,6 @@ t.buildMatchMemberExpression = function (match, allowPartial) {
|
|
12536
12605
|
/**
|
12537
12606
|
* Description
|
12538
12607
|
*
|
12539
|
-
* @param {Object} node
|
12540
|
-
* @param {Boolean} [ignore]
|
12541
12608
|
* @returns {Object|Boolean}
|
12542
12609
|
*/
|
12543
12610
|
|
@@ -12578,9 +12645,6 @@ t.toStatement = function (node, ignore) {
|
|
12578
12645
|
|
12579
12646
|
/**
|
12580
12647
|
* Description
|
12581
|
-
*
|
12582
|
-
* @param {Object} node
|
12583
|
-
* @returns {Object}
|
12584
12648
|
*/
|
12585
12649
|
|
12586
12650
|
t.toExpression = function (node) {
|
@@ -12603,10 +12667,6 @@ t.toExpression = function (node) {
|
|
12603
12667
|
|
12604
12668
|
/**
|
12605
12669
|
* Description
|
12606
|
-
*
|
12607
|
-
* @param {Object} node
|
12608
|
-
* @param {Object} parent
|
12609
|
-
* @returns {Object}
|
12610
12670
|
*/
|
12611
12671
|
|
12612
12672
|
t.toBlock = function (node, parent) {
|
@@ -12636,9 +12696,6 @@ t.toBlock = function (node, parent) {
|
|
12636
12696
|
/**
|
12637
12697
|
* Return a list of binding identifiers associated with
|
12638
12698
|
* the input `node`.
|
12639
|
-
*
|
12640
|
-
* @param {Object} node
|
12641
|
-
* @returns {Array|Object}
|
12642
12699
|
*/
|
12643
12700
|
|
12644
12701
|
t.getBindingIdentifiers = function (node) {
|
@@ -12676,7 +12733,9 @@ t.getBindingIdentifiers.keys = {
|
|
12676
12733
|
ImportBatchSpecifier: ["name"],
|
12677
12734
|
VariableDeclarator: ["id"],
|
12678
12735
|
FunctionDeclaration: ["id"],
|
12736
|
+
FunctionExpression: ["id"],
|
12679
12737
|
ClassDeclaration: ["id"],
|
12738
|
+
ClassExpression: ["id"],
|
12680
12739
|
SpreadElement: ["argument"],
|
12681
12740
|
RestElement: ["argument"],
|
12682
12741
|
UpdateExpression: ["argument"],
|
@@ -12694,9 +12753,6 @@ t.getBindingIdentifiers.keys = {
|
|
12694
12753
|
|
12695
12754
|
/**
|
12696
12755
|
* Description
|
12697
|
-
*
|
12698
|
-
* @param {Object} node
|
12699
|
-
* @returns {Boolean}
|
12700
12756
|
*/
|
12701
12757
|
|
12702
12758
|
t.isLet = function (node) {
|
@@ -12705,9 +12761,6 @@ t.isLet = function (node) {
|
|
12705
12761
|
|
12706
12762
|
/**
|
12707
12763
|
* Description
|
12708
|
-
*
|
12709
|
-
* @param {Object} node
|
12710
|
-
* @returns {Boolean}
|
12711
12764
|
*/
|
12712
12765
|
|
12713
12766
|
t.isBlockScoped = function (node) {
|
@@ -12716,9 +12769,6 @@ t.isBlockScoped = function (node) {
|
|
12716
12769
|
|
12717
12770
|
/**
|
12718
12771
|
* Description
|
12719
|
-
*
|
12720
|
-
* @param {Object} node
|
12721
|
-
* @returns {Boolean}
|
12722
12772
|
*/
|
12723
12773
|
|
12724
12774
|
t.isVar = function (node) {
|
@@ -12731,9 +12781,6 @@ t.COMMENT_KEYS = ["leadingComments", "trailingComments"];
|
|
12731
12781
|
|
12732
12782
|
/**
|
12733
12783
|
* Description
|
12734
|
-
*
|
12735
|
-
* @param {Object} child
|
12736
|
-
* @returns {Object} child
|
12737
12784
|
*/
|
12738
12785
|
|
12739
12786
|
t.removeComments = function (child) {
|
@@ -12745,10 +12792,6 @@ t.removeComments = function (child) {
|
|
12745
12792
|
|
12746
12793
|
/**
|
12747
12794
|
* Description
|
12748
|
-
*
|
12749
|
-
* @param {Object} child
|
12750
|
-
* @param {Object} parent
|
12751
|
-
* @returns {Object} child
|
12752
12795
|
*/
|
12753
12796
|
|
12754
12797
|
t.inheritsComments = function (child, parent) {
|
@@ -12760,10 +12803,6 @@ t.inheritsComments = function (child, parent) {
|
|
12760
12803
|
|
12761
12804
|
/**
|
12762
12805
|
* Description
|
12763
|
-
*
|
12764
|
-
* @param {Object} child
|
12765
|
-
* @param {Object} parent
|
12766
|
-
* @returns {Object} child
|
12767
12806
|
*/
|
12768
12807
|
|
12769
12808
|
t.inherits = function (child, parent) {
|
@@ -12783,9 +12822,6 @@ t.inherits = function (child, parent) {
|
|
12783
12822
|
|
12784
12823
|
/**
|
12785
12824
|
* Description
|
12786
|
-
*
|
12787
|
-
* @param {Object} node
|
12788
|
-
* @returns {Array}
|
12789
12825
|
*/
|
12790
12826
|
|
12791
12827
|
t.getLastStatements = function (node) {
|
@@ -12811,9 +12847,6 @@ t.getLastStatements = function (node) {
|
|
12811
12847
|
|
12812
12848
|
/**
|
12813
12849
|
* Description
|
12814
|
-
*
|
12815
|
-
* @param {Object} specifier
|
12816
|
-
* @returns {String}
|
12817
12850
|
*/
|
12818
12851
|
|
12819
12852
|
t.getSpecifierName = function (specifier) {
|
@@ -12822,9 +12855,6 @@ t.getSpecifierName = function (specifier) {
|
|
12822
12855
|
|
12823
12856
|
/**
|
12824
12857
|
* Description
|
12825
|
-
*
|
12826
|
-
* @param {Object} specifier
|
12827
|
-
* @returns {String}
|
12828
12858
|
*/
|
12829
12859
|
|
12830
12860
|
t.getSpecifierId = function (specifier) {
|
@@ -12837,9 +12867,6 @@ t.getSpecifierId = function (specifier) {
|
|
12837
12867
|
|
12838
12868
|
/**
|
12839
12869
|
* Description
|
12840
|
-
*
|
12841
|
-
* @param {Object} specifier
|
12842
|
-
* @returns {Boolean}
|
12843
12870
|
*/
|
12844
12871
|
|
12845
12872
|
t.isSpecifierDefault = function (specifier) {
|
@@ -12848,10 +12875,6 @@ t.isSpecifierDefault = function (specifier) {
|
|
12848
12875
|
|
12849
12876
|
/**
|
12850
12877
|
* Description
|
12851
|
-
*
|
12852
|
-
* @param {Node} node
|
12853
|
-
* @param {Node} parent
|
12854
|
-
* @returns {Boolean}
|
12855
12878
|
*/
|
12856
12879
|
|
12857
12880
|
t.isScope = function (node, parent) {
|
@@ -12870,9 +12893,6 @@ t.isScope = function (node, parent) {
|
|
12870
12893
|
|
12871
12894
|
/**
|
12872
12895
|
* Description
|
12873
|
-
*
|
12874
|
-
* @param {Node} node
|
12875
|
-
* @returns {Boolean}
|
12876
12896
|
*/
|
12877
12897
|
|
12878
12898
|
t.isImmutable = function (node) {
|
@@ -12913,9 +12933,6 @@ t.isImmutable = function (node) {
|
|
12913
12933
|
*
|
12914
12934
|
* if (!t.evaluateTruthy(node)) falsyLogic();
|
12915
12935
|
*
|
12916
|
-
* @param {Node} node
|
12917
|
-
* @param {Scope} scope
|
12918
|
-
* @returns {Boolean}
|
12919
12936
|
*/
|
12920
12937
|
|
12921
12938
|
t.evaluateTruthy = function (node, scope) {
|
@@ -12936,9 +12953,6 @@ t.evaluateTruthy = function (node, scope) {
|
|
12936
12953
|
* t.evaluate(parse("!true")) // { confident: true, value: false }
|
12937
12954
|
* t.evaluate(parse("foo + foo")) // { confident: false, value: undefined }
|
12938
12955
|
*
|
12939
|
-
* @param {Node} node
|
12940
|
-
* @param {Scope} scope
|
12941
|
-
* @returns {Object}
|
12942
12956
|
*/
|
12943
12957
|
|
12944
12958
|
t.evaluate = function (node, scope) {
|
@@ -13048,9 +13062,6 @@ t.evaluate = function (node, scope) {
|
|
13048
13062
|
|
13049
13063
|
/**
|
13050
13064
|
* Description
|
13051
|
-
*
|
13052
|
-
* @param value
|
13053
|
-
* @returns {Node}
|
13054
13065
|
*/
|
13055
13066
|
|
13056
13067
|
t.valueToNode = function (value) {
|
@@ -33596,7 +33607,7 @@ function baseAssign(object, source, customizer) {
|
|
33596
33607
|
value = object[key],
|
33597
33608
|
result = customizer(value, source[key], key, object, source);
|
33598
33609
|
|
33599
|
-
if ((result === result ? result !== value : value === value) ||
|
33610
|
+
if ((result === result ? (result !== value) : (value === value)) ||
|
33600
33611
|
(typeof value == 'undefined' && !(key in object))) {
|
33601
33612
|
object[key] = result;
|
33602
33613
|
}
|
@@ -34958,6 +34969,7 @@ function createAssigner(assigner) {
|
|
34958
34969
|
module.exports = createAssigner;
|
34959
34970
|
|
34960
34971
|
},{"./bindCallback":249,"./isIterateeCall":274}],258:[function(require,module,exports){
|
34972
|
+
(function (global){
|
34961
34973
|
var createCtorWrapper = require('./createCtorWrapper');
|
34962
34974
|
|
34963
34975
|
/**
|
@@ -34973,13 +34985,15 @@ function createBindWrapper(func, thisArg) {
|
|
34973
34985
|
var Ctor = createCtorWrapper(func);
|
34974
34986
|
|
34975
34987
|
function wrapper() {
|
34976
|
-
|
34988
|
+
var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func;
|
34989
|
+
return fn.apply(thisArg, arguments);
|
34977
34990
|
}
|
34978
34991
|
return wrapper;
|
34979
34992
|
}
|
34980
34993
|
|
34981
34994
|
module.exports = createBindWrapper;
|
34982
34995
|
|
34996
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
34983
34997
|
},{"./createCtorWrapper":260}],259:[function(require,module,exports){
|
34984
34998
|
(function (global){
|
34985
34999
|
var SetCache = require('./SetCache'),
|
@@ -35032,6 +35046,7 @@ function createCtorWrapper(Ctor) {
|
|
35032
35046
|
module.exports = createCtorWrapper;
|
35033
35047
|
|
35034
35048
|
},{"../lang/isObject":296,"./baseCreate":224}],261:[function(require,module,exports){
|
35049
|
+
(function (global){
|
35035
35050
|
var arrayCopy = require('./arrayCopy'),
|
35036
35051
|
composeArgs = require('./composeArgs'),
|
35037
35052
|
composeArgsRight = require('./composeArgsRight'),
|
@@ -35130,14 +35145,17 @@ function createHybridWrapper(func, bitmask, thisArg, partials, holders, partials
|
|
35130
35145
|
if (isAry && ary < args.length) {
|
35131
35146
|
args.length = ary;
|
35132
35147
|
}
|
35133
|
-
|
35148
|
+
var fn = (this && this !== global && this instanceof wrapper) ? (Ctor || createCtorWrapper(func)) : func;
|
35149
|
+
return fn.apply(thisBinding, args);
|
35134
35150
|
}
|
35135
35151
|
return wrapper;
|
35136
35152
|
}
|
35137
35153
|
|
35138
35154
|
module.exports = createHybridWrapper;
|
35139
35155
|
|
35156
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
35140
35157
|
},{"./arrayCopy":213,"./composeArgs":254,"./composeArgsRight":255,"./createCtorWrapper":260,"./reorder":280,"./replaceHolders":281}],262:[function(require,module,exports){
|
35158
|
+
(function (global){
|
35141
35159
|
var createCtorWrapper = require('./createCtorWrapper');
|
35142
35160
|
|
35143
35161
|
/** Used to compose bitmasks for wrapper metadata. */
|
@@ -35174,13 +35192,15 @@ function createPartialWrapper(func, bitmask, thisArg, partials) {
|
|
35174
35192
|
while (argsLength--) {
|
35175
35193
|
args[leftIndex++] = arguments[++argsIndex];
|
35176
35194
|
}
|
35177
|
-
|
35195
|
+
var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func;
|
35196
|
+
return fn.apply(isBind ? thisArg : this, args);
|
35178
35197
|
}
|
35179
35198
|
return wrapper;
|
35180
35199
|
}
|
35181
35200
|
|
35182
35201
|
module.exports = createPartialWrapper;
|
35183
35202
|
|
35203
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
35184
35204
|
},{"./createCtorWrapper":260}],263:[function(require,module,exports){
|
35185
35205
|
var baseSetData = require('./baseSetData'),
|
35186
35206
|
createBindWrapper = require('./createBindWrapper'),
|
@@ -35440,8 +35460,10 @@ function equalObjects(object, other, equalFunc, customizer, isWhere, stackA, sta
|
|
35440
35460
|
othCtor = other.constructor;
|
35441
35461
|
|
35442
35462
|
// Non `Object` object instances with different constructors are not equal.
|
35443
|
-
if (objCtor != othCtor &&
|
35444
|
-
|
35463
|
+
if (objCtor != othCtor &&
|
35464
|
+
('constructor' in object && 'constructor' in other) &&
|
35465
|
+
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
35466
|
+
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
35445
35467
|
return false;
|
35446
35468
|
}
|
35447
35469
|
}
|
@@ -35696,7 +35718,7 @@ function isIterateeCall(value, index, object) {
|
|
35696
35718
|
}
|
35697
35719
|
if (prereq) {
|
35698
35720
|
var other = object[index];
|
35699
|
-
return value === value ? value === other : other !== other;
|
35721
|
+
return value === value ? (value === other) : (other !== other);
|
35700
35722
|
}
|
35701
35723
|
return false;
|
35702
35724
|
}
|
@@ -36960,7 +36982,7 @@ var keys = !nativeKeys ? shimKeys : function(object) {
|
|
36960
36982
|
length = object.length;
|
36961
36983
|
}
|
36962
36984
|
if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
|
36963
|
-
|
36985
|
+
(typeof object != 'function' && (length && isLength(length)))) {
|
36964
36986
|
return shimKeys(object);
|
36965
36987
|
}
|
36966
36988
|
return isObject(object) ? nativeKeys(object) : [];
|
@@ -46062,7 +46084,7 @@ module.exports = function (str) {
|
|
46062
46084
|
module.exports={
|
46063
46085
|
"name": "babel",
|
46064
46086
|
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
46065
|
-
"version": "4.7.
|
46087
|
+
"version": "4.7.4",
|
46066
46088
|
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
46067
46089
|
"homepage": "https://babeljs.io/",
|
46068
46090
|
"repository": "babel/babel",
|