rollup 0.51.4 → 0.51.8
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.
- package/CHANGELOG.md +17 -0
- package/bin/rollup +67 -54
- package/dist/rollup.browser.js +2604 -374
- package/dist/rollup.es.js +2608 -398
- package/dist/rollup.js +2608 -398
- package/package.json +17 -17
package/dist/rollup.browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Rollup.js v0.51.
|
|
3
|
-
|
|
2
|
+
Rollup.js v0.51.8
|
|
3
|
+
Sun Nov 19 2017 18:23:51 GMT+0100 (CET) - commit ab8d67fe622bcf868543a7100a34810d7e98c49d
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
@@ -439,11 +439,9 @@ function encode$$1 ( decoded ) {
|
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
|
|
442
|
-
var charToInteger$1 = {};
|
|
443
442
|
var integerToChar$1 = {};
|
|
444
443
|
|
|
445
444
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split( '' ).forEach( function ( char, i ) {
|
|
446
|
-
charToInteger$1[ char ] = i;
|
|
447
445
|
integerToChar$1[ i ] = char;
|
|
448
446
|
});
|
|
449
447
|
|
|
@@ -881,23 +879,6 @@ function Mappings ( hires ) {
|
|
|
881
879
|
};
|
|
882
880
|
}
|
|
883
881
|
|
|
884
|
-
var Stats = function Stats () {
|
|
885
|
-
Object.defineProperties( this, {
|
|
886
|
-
startTimes: { value: {} }
|
|
887
|
-
});
|
|
888
|
-
};
|
|
889
|
-
|
|
890
|
-
Stats.prototype.time = function time ( label ) {
|
|
891
|
-
this.startTimes[ label ] = process.hrtime();
|
|
892
|
-
};
|
|
893
|
-
|
|
894
|
-
Stats.prototype.timeEnd = function timeEnd ( label ) {
|
|
895
|
-
var elapsed = process.hrtime( this.startTimes[ label ] );
|
|
896
|
-
|
|
897
|
-
if ( !this[ label ] ) { this[ label ] = 0; }
|
|
898
|
-
this[ label ] += elapsed[0] * 1e3 + elapsed[1] * 1e-6;
|
|
899
|
-
};
|
|
900
|
-
|
|
901
882
|
var warned = {
|
|
902
883
|
insertLeft: false,
|
|
903
884
|
insertRight: false,
|
|
@@ -2487,6 +2468,7 @@ pp$1.parseTopLevel = function(node) {
|
|
|
2487
2468
|
var stmt = this$1.parseStatement(true, true, exports);
|
|
2488
2469
|
node.body.push(stmt);
|
|
2489
2470
|
}
|
|
2471
|
+
this.adaptDirectivePrologue(node.body);
|
|
2490
2472
|
this.next();
|
|
2491
2473
|
if (this.options.ecmaVersion >= 6) {
|
|
2492
2474
|
node.sourceType = this.options.sourceType;
|
|
@@ -3267,6 +3249,22 @@ pp$1.parseImportSpecifiers = function() {
|
|
|
3267
3249
|
return nodes
|
|
3268
3250
|
};
|
|
3269
3251
|
|
|
3252
|
+
// Set `ExpressionStatement#directive` property for directive prologues.
|
|
3253
|
+
pp$1.adaptDirectivePrologue = function(statements) {
|
|
3254
|
+
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
|
|
3255
|
+
statements[i].directive = statements[i].expression.raw.slice(1, -1);
|
|
3256
|
+
}
|
|
3257
|
+
};
|
|
3258
|
+
pp$1.isDirectiveCandidate = function(statement) {
|
|
3259
|
+
return (
|
|
3260
|
+
statement.type === "ExpressionStatement" &&
|
|
3261
|
+
statement.expression.type === "Literal" &&
|
|
3262
|
+
typeof statement.expression.value === "string" &&
|
|
3263
|
+
// Reject parenthesized strings.
|
|
3264
|
+
(this.input[statement.start] === "\"" || this.input[statement.start] === "'")
|
|
3265
|
+
)
|
|
3266
|
+
};
|
|
3267
|
+
|
|
3270
3268
|
var pp$2 = Parser.prototype;
|
|
3271
3269
|
|
|
3272
3270
|
// Convert existing expression atom to assignable pattern
|
|
@@ -3381,23 +3379,19 @@ pp$2.parseRestBinding = function() {
|
|
|
3381
3379
|
// Parses lvalue (assignable) atom.
|
|
3382
3380
|
|
|
3383
3381
|
pp$2.parseBindingAtom = function() {
|
|
3384
|
-
if (this.options.ecmaVersion
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
this.next();
|
|
3392
|
-
node.elements = this.parseBindingList(types.bracketR, true, true);
|
|
3393
|
-
return this.finishNode(node, "ArrayPattern")
|
|
3394
|
-
|
|
3395
|
-
case types.braceL:
|
|
3396
|
-
return this.parseObj(true)
|
|
3382
|
+
if (this.options.ecmaVersion >= 6) {
|
|
3383
|
+
switch (this.type) {
|
|
3384
|
+
case types.bracketL:
|
|
3385
|
+
var node = this.startNode();
|
|
3386
|
+
this.next();
|
|
3387
|
+
node.elements = this.parseBindingList(types.bracketR, true, true);
|
|
3388
|
+
return this.finishNode(node, "ArrayPattern")
|
|
3397
3389
|
|
|
3398
|
-
|
|
3399
|
-
|
|
3390
|
+
case types.braceL:
|
|
3391
|
+
return this.parseObj(true)
|
|
3392
|
+
}
|
|
3400
3393
|
}
|
|
3394
|
+
return this.parseIdent()
|
|
3401
3395
|
};
|
|
3402
3396
|
|
|
3403
3397
|
pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
@@ -3710,7 +3704,7 @@ pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
|
|
|
3710
3704
|
|
|
3711
3705
|
var startPos = this.start, startLoc = this.startLoc, expr;
|
|
3712
3706
|
if (this.inAsync && this.isContextual("await")) {
|
|
3713
|
-
expr = this.parseAwait(
|
|
3707
|
+
expr = this.parseAwait();
|
|
3714
3708
|
sawUnary = true;
|
|
3715
3709
|
} else if (this.type.prefix) {
|
|
3716
3710
|
var node = this.startNode(), update = this.type === types.incDec;
|
|
@@ -3814,12 +3808,22 @@ pp$3.parseExprAtom = function(refDestructuringErrors) {
|
|
|
3814
3808
|
case types._super:
|
|
3815
3809
|
if (!this.inFunction)
|
|
3816
3810
|
{ this.raise(this.start, "'super' outside of function or class"); }
|
|
3811
|
+
node = this.startNode();
|
|
3812
|
+
this.next();
|
|
3813
|
+
// The `super` keyword can appear at below:
|
|
3814
|
+
// SuperProperty:
|
|
3815
|
+
// super [ Expression ]
|
|
3816
|
+
// super . IdentifierName
|
|
3817
|
+
// SuperCall:
|
|
3818
|
+
// super Arguments
|
|
3819
|
+
if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)
|
|
3820
|
+
{ this.unexpected(); }
|
|
3821
|
+
return this.finishNode(node, "Super")
|
|
3817
3822
|
|
|
3818
3823
|
case types._this:
|
|
3819
|
-
var type = this.type === types._this ? "ThisExpression" : "Super";
|
|
3820
3824
|
node = this.startNode();
|
|
3821
3825
|
this.next();
|
|
3822
|
-
return this.finishNode(node,
|
|
3826
|
+
return this.finishNode(node, "ThisExpression")
|
|
3823
3827
|
|
|
3824
3828
|
case types.name:
|
|
3825
3829
|
var startPos = this.start, startLoc = this.startLoc;
|
|
@@ -4054,14 +4058,14 @@ pp$3.parseTemplate = function(ref) {
|
|
|
4054
4058
|
return this.finishNode(node, "TemplateLiteral")
|
|
4055
4059
|
};
|
|
4056
4060
|
|
|
4057
|
-
// Parse an object literal or binding pattern.
|
|
4058
|
-
|
|
4059
4061
|
pp$3.isAsyncProp = function(prop) {
|
|
4060
4062
|
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
|
|
4061
4063
|
(this.type === types.name || this.type === types.num || this.type === types.string || this.type === types.bracketL || this.type.keyword) &&
|
|
4062
4064
|
!lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
4063
4065
|
};
|
|
4064
4066
|
|
|
4067
|
+
// Parse an object literal or binding pattern.
|
|
4068
|
+
|
|
4065
4069
|
pp$3.parseObj = function(isPattern, refDestructuringErrors) {
|
|
4066
4070
|
var this$1 = this;
|
|
4067
4071
|
|
|
@@ -4074,31 +4078,36 @@ pp$3.parseObj = function(isPattern, refDestructuringErrors) {
|
|
|
4074
4078
|
if (this$1.afterTrailingComma(types.braceR)) { break }
|
|
4075
4079
|
} else { first = false; }
|
|
4076
4080
|
|
|
4077
|
-
var prop = this$1.
|
|
4078
|
-
if (this$1.options.ecmaVersion >= 6) {
|
|
4079
|
-
prop.method = false;
|
|
4080
|
-
prop.shorthand = false;
|
|
4081
|
-
if (isPattern || refDestructuringErrors) {
|
|
4082
|
-
startPos = this$1.start;
|
|
4083
|
-
startLoc = this$1.startLoc;
|
|
4084
|
-
}
|
|
4085
|
-
if (!isPattern)
|
|
4086
|
-
{ isGenerator = this$1.eat(types.star); }
|
|
4087
|
-
}
|
|
4088
|
-
this$1.parsePropertyName(prop);
|
|
4089
|
-
if (!isPattern && this$1.options.ecmaVersion >= 8 && !isGenerator && this$1.isAsyncProp(prop)) {
|
|
4090
|
-
isAsync = true;
|
|
4091
|
-
this$1.parsePropertyName(prop, refDestructuringErrors);
|
|
4092
|
-
} else {
|
|
4093
|
-
isAsync = false;
|
|
4094
|
-
}
|
|
4095
|
-
this$1.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors);
|
|
4081
|
+
var prop = this$1.parseProperty(isPattern, refDestructuringErrors);
|
|
4096
4082
|
this$1.checkPropClash(prop, propHash);
|
|
4097
|
-
node.properties.push(
|
|
4083
|
+
node.properties.push(prop);
|
|
4098
4084
|
}
|
|
4099
4085
|
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
|
|
4100
4086
|
};
|
|
4101
4087
|
|
|
4088
|
+
pp$3.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
4089
|
+
var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
|
|
4090
|
+
if (this.options.ecmaVersion >= 6) {
|
|
4091
|
+
prop.method = false;
|
|
4092
|
+
prop.shorthand = false;
|
|
4093
|
+
if (isPattern || refDestructuringErrors) {
|
|
4094
|
+
startPos = this.start;
|
|
4095
|
+
startLoc = this.startLoc;
|
|
4096
|
+
}
|
|
4097
|
+
if (!isPattern)
|
|
4098
|
+
{ isGenerator = this.eat(types.star); }
|
|
4099
|
+
}
|
|
4100
|
+
this.parsePropertyName(prop);
|
|
4101
|
+
if (!isPattern && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
|
|
4102
|
+
isAsync = true;
|
|
4103
|
+
this.parsePropertyName(prop, refDestructuringErrors);
|
|
4104
|
+
} else {
|
|
4105
|
+
isAsync = false;
|
|
4106
|
+
}
|
|
4107
|
+
this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors);
|
|
4108
|
+
return this.finishNode(prop, "Property")
|
|
4109
|
+
};
|
|
4110
|
+
|
|
4102
4111
|
pp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors) {
|
|
4103
4112
|
if ((isGenerator || isAsync) && this.type === types.colon)
|
|
4104
4113
|
{ this.unexpected(); }
|
|
@@ -4111,10 +4120,11 @@ pp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
4111
4120
|
prop.kind = "init";
|
|
4112
4121
|
prop.method = true;
|
|
4113
4122
|
prop.value = this.parseMethod(isGenerator, isAsync);
|
|
4114
|
-
} else if (
|
|
4123
|
+
} else if (!isPattern &&
|
|
4124
|
+
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
|
|
4115
4125
|
(prop.key.name === "get" || prop.key.name === "set") &&
|
|
4116
4126
|
(this.type != types.comma && this.type != types.braceR)) {
|
|
4117
|
-
if (isGenerator || isAsync
|
|
4127
|
+
if (isGenerator || isAsync) { this.unexpected(); }
|
|
4118
4128
|
prop.kind = prop.key.name;
|
|
4119
4129
|
this.parsePropertyName(prop);
|
|
4120
4130
|
prop.value = this.parseMethod(false);
|
|
@@ -4262,6 +4272,7 @@ pp$3.parseFunctionBody = function(node, isArrowFunction) {
|
|
|
4262
4272
|
this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && this.isSimpleParamList(node.params));
|
|
4263
4273
|
node.body = this.parseBlock(false);
|
|
4264
4274
|
node.expression = false;
|
|
4275
|
+
this.adaptDirectivePrologue(node.body.body);
|
|
4265
4276
|
this.labels = oldLabels;
|
|
4266
4277
|
}
|
|
4267
4278
|
this.exitFunctionScope();
|
|
@@ -4329,10 +4340,6 @@ pp$3.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestruct
|
|
|
4329
4340
|
return elts
|
|
4330
4341
|
};
|
|
4331
4342
|
|
|
4332
|
-
// Parse the next token as an identifier. If `liberal` is true (used
|
|
4333
|
-
// when parsing properties), it will also convert keywords into
|
|
4334
|
-
// identifiers.
|
|
4335
|
-
|
|
4336
4343
|
pp$3.checkUnreserved = function(ref) {
|
|
4337
4344
|
var start = ref.start;
|
|
4338
4345
|
var end = ref.end;
|
|
@@ -4351,6 +4358,10 @@ pp$3.checkUnreserved = function(ref) {
|
|
|
4351
4358
|
{ this.raiseRecoverable(start, ("The keyword '" + name + "' is reserved")); }
|
|
4352
4359
|
};
|
|
4353
4360
|
|
|
4361
|
+
// Parse the next token as an identifier. If `liberal` is true (used
|
|
4362
|
+
// when parsing properties), it will also convert keywords into
|
|
4363
|
+
// identifiers.
|
|
4364
|
+
|
|
4354
4365
|
pp$3.parseIdent = function(liberal, isBinding) {
|
|
4355
4366
|
var node = this.startNode();
|
|
4356
4367
|
if (liberal && this.options.allowReserved == "never") { liberal = false; }
|
|
@@ -4358,6 +4369,15 @@ pp$3.parseIdent = function(liberal, isBinding) {
|
|
|
4358
4369
|
node.name = this.value;
|
|
4359
4370
|
} else if (this.type.keyword) {
|
|
4360
4371
|
node.name = this.type.keyword;
|
|
4372
|
+
|
|
4373
|
+
// To fix https://github.com/ternjs/acorn/issues/575
|
|
4374
|
+
// `class` and `function` keywords push new context into this.context.
|
|
4375
|
+
// But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
|
|
4376
|
+
// If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
|
|
4377
|
+
if ((node.name === "class" || node.name === "function") &&
|
|
4378
|
+
(this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
|
|
4379
|
+
this.context.pop();
|
|
4380
|
+
}
|
|
4361
4381
|
} else {
|
|
4362
4382
|
this.unexpected();
|
|
4363
4383
|
}
|
|
@@ -4908,7 +4928,7 @@ pp$8.readToken_mult_modulo_exp = function(code) { // '%*'
|
|
|
4908
4928
|
var tokentype = code === 42 ? types.star : types.modulo;
|
|
4909
4929
|
|
|
4910
4930
|
// exponentiation operator ** and **=
|
|
4911
|
-
if (this.options.ecmaVersion >= 7 && next === 42) {
|
|
4931
|
+
if (this.options.ecmaVersion >= 7 && code == 42 && next === 42) {
|
|
4912
4932
|
++size;
|
|
4913
4933
|
tokentype = types.starstar;
|
|
4914
4934
|
next = this.input.charCodeAt(this.pos + 2);
|
|
@@ -5566,7 +5586,7 @@ const UNKNOWN_VALUE = { toString: () => '[[UNKNOWN]]' };
|
|
|
5566
5586
|
|
|
5567
5587
|
const UNKNOWN_ASSIGNMENT = {
|
|
5568
5588
|
type: 'UNKNOWN',
|
|
5569
|
-
|
|
5589
|
+
reassignPath: () => {},
|
|
5570
5590
|
forEachReturnExpressionWhenCalledAtPath: () => {},
|
|
5571
5591
|
hasEffectsWhenAccessedAtPath: path => path.length > 0,
|
|
5572
5592
|
hasEffectsWhenAssignedAtPath: path => path.length > 0,
|
|
@@ -5577,7 +5597,7 @@ const UNKNOWN_ASSIGNMENT = {
|
|
|
5577
5597
|
|
|
5578
5598
|
const UNDEFINED_ASSIGNMENT = {
|
|
5579
5599
|
type: 'UNDEFINED',
|
|
5580
|
-
|
|
5600
|
+
reassignPath: () => {},
|
|
5581
5601
|
forEachReturnExpressionWhenCalledAtPath: () => {},
|
|
5582
5602
|
hasEffectsWhenAccessedAtPath: path => path.length > 0,
|
|
5583
5603
|
hasEffectsWhenAssignedAtPath: path => path.length > 0,
|
|
@@ -5601,13 +5621,10 @@ class Variable {
|
|
|
5601
5621
|
addReference ( identifier ) {}
|
|
5602
5622
|
|
|
5603
5623
|
/**
|
|
5604
|
-
* This enables variables to know which nodes need to be checked for side-effects when
|
|
5605
|
-
* e.g. an object path is called or mutated.
|
|
5606
5624
|
* @param {String[]} path
|
|
5607
|
-
* @param {Node} expression
|
|
5608
5625
|
* @param {ExecutionPathOptions} options
|
|
5609
5626
|
*/
|
|
5610
|
-
|
|
5627
|
+
reassignPath ( path, options ) {}
|
|
5611
5628
|
|
|
5612
5629
|
/**
|
|
5613
5630
|
* @param {String[]} path
|
|
@@ -5766,17 +5783,15 @@ function createCommonjsModule(fn, module) {
|
|
|
5766
5783
|
|
|
5767
5784
|
var immutable = createCommonjsModule(function (module, exports) {
|
|
5768
5785
|
/**
|
|
5769
|
-
*
|
|
5770
|
-
* All rights reserved.
|
|
5786
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
5771
5787
|
*
|
|
5772
|
-
*
|
|
5773
|
-
*
|
|
5774
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
5788
|
+
* This source code is licensed under the MIT license found in the
|
|
5789
|
+
* LICENSE file in the root directory of this source tree.
|
|
5775
5790
|
*/
|
|
5776
5791
|
|
|
5777
5792
|
(function (global, factory) {
|
|
5778
5793
|
module.exports = factory();
|
|
5779
|
-
}(commonjsGlobal, function () {
|
|
5794
|
+
}(commonjsGlobal, function () { var SLICE$0 = Array.prototype.slice;
|
|
5780
5795
|
|
|
5781
5796
|
function createClass(ctor, superClass) {
|
|
5782
5797
|
if (superClass) {
|
|
@@ -7636,7 +7651,7 @@ var immutable = createCommonjsModule(function (module, exports) {
|
|
|
7636
7651
|
var newNode;
|
|
7637
7652
|
var nodes = idx1 === idx2 ?
|
|
7638
7653
|
[mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] :
|
|
7639
|
-
(
|
|
7654
|
+
(newNode = new ValueNode(ownerID, keyHash, entry), idx1 < idx2 ? [node, newNode] : [newNode, node]);
|
|
7640
7655
|
|
|
7641
7656
|
return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);
|
|
7642
7657
|
}
|
|
@@ -8597,8 +8612,7 @@ var immutable = createCommonjsModule(function (module, exports) {
|
|
|
8597
8612
|
return this._iter.__iterate(
|
|
8598
8613
|
this._useKeys ?
|
|
8599
8614
|
function(v, k) {return fn(v, k, this$0)} :
|
|
8600
|
-
(
|
|
8601
|
-
function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}),
|
|
8615
|
+
(ii = reverse ? resolveSize(this) : 0, function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}),
|
|
8602
8616
|
reverse
|
|
8603
8617
|
);
|
|
8604
8618
|
};
|
|
@@ -11033,8 +11047,8 @@ class Node$1 {
|
|
|
11033
11047
|
}
|
|
11034
11048
|
|
|
11035
11049
|
/**
|
|
11036
|
-
*
|
|
11037
|
-
* E.g., node.
|
|
11050
|
+
* Reassign a given path of an object.
|
|
11051
|
+
* E.g., node.reassignPath(['x', 'y']) is called when something
|
|
11038
11052
|
* is assigned to node.x.y.
|
|
11039
11053
|
* The default noop implementation is ok as long as hasEffectsWhenAssignedAtPath
|
|
11040
11054
|
* always returns true for this node. Otherwise it should be overridden.
|
|
@@ -11042,7 +11056,7 @@ class Node$1 {
|
|
|
11042
11056
|
* @param {Node} expression
|
|
11043
11057
|
* @param {ExecutionPathOptions} options
|
|
11044
11058
|
*/
|
|
11045
|
-
|
|
11059
|
+
reassignPath ( path, options ) {}
|
|
11046
11060
|
|
|
11047
11061
|
/**
|
|
11048
11062
|
* Override to control on which children "bind" is called.
|
|
@@ -11267,9 +11281,9 @@ class ArrayExpression extends Node$1 {
|
|
|
11267
11281
|
}
|
|
11268
11282
|
|
|
11269
11283
|
class ArrayPattern extends Node$1 {
|
|
11270
|
-
|
|
11284
|
+
reassignPath ( path, options ) {
|
|
11271
11285
|
path.length === 0
|
|
11272
|
-
&& this.eachChild( child => child.
|
|
11286
|
+
&& this.eachChild( child => child.reassignPath( [], options ) );
|
|
11273
11287
|
}
|
|
11274
11288
|
|
|
11275
11289
|
hasEffectsWhenAssignedAtPath ( path, options ) {
|
|
@@ -11283,119 +11297,89 @@ class ArrayPattern extends Node$1 {
|
|
|
11283
11297
|
}
|
|
11284
11298
|
}
|
|
11285
11299
|
|
|
11286
|
-
const SET_KEY = { type: 'SET_KEY' };
|
|
11287
11300
|
const UNKNOWN_KEY = { type: 'UNKNOWN_KEY' };
|
|
11288
11301
|
|
|
11289
|
-
|
|
11290
|
-
const UNKNOWN_KEY_ASSIGNMENT = [ UNKNOWN_KEY, { toString: ( path ) => {
|
|
11291
|
-
if ( path === void 0 ) path = '';
|
|
11292
|
-
|
|
11293
|
-
return path + '[[UNKNOWN_KEY]]';
|
|
11294
|
-
} } ];
|
|
11295
|
-
|
|
11296
|
-
class VariableShapeTracker {
|
|
11302
|
+
class ReassignedPathTracker {
|
|
11297
11303
|
constructor () {
|
|
11298
|
-
this.
|
|
11299
|
-
|
|
11300
|
-
|
|
11301
|
-
addAtPath ( path, assignment ) {
|
|
11302
|
-
if ( this._assignments === UNKNOWN_ASSIGNMENTS
|
|
11303
|
-
|| (path.length > 0 && this._assignments.has( UNKNOWN_KEY ) ) ) { return; }
|
|
11304
|
-
if ( path.length === 0 && assignment === UNKNOWN_ASSIGNMENT ) {
|
|
11305
|
-
this._assignments = UNKNOWN_ASSIGNMENTS;
|
|
11306
|
-
} else if ( path[ 0 ] === UNKNOWN_KEY ) {
|
|
11307
|
-
this._assignments = new Map( [ [ SET_KEY, this._assignments.get( SET_KEY ) ], UNKNOWN_KEY_ASSIGNMENT ] );
|
|
11308
|
-
} else if ( path.length === 0 ) {
|
|
11309
|
-
this._assignments.get( SET_KEY ).add( assignment );
|
|
11310
|
-
} else {
|
|
11311
|
-
var nextPath = path[0];
|
|
11312
|
-
var remainingPath = path.slice(1);
|
|
11313
|
-
if ( !this._assignments.has( nextPath ) ) {
|
|
11314
|
-
this._assignments.set( nextPath, new VariableShapeTracker() );
|
|
11315
|
-
}
|
|
11316
|
-
this._assignments.get( nextPath ).addAtPath( remainingPath, assignment );
|
|
11317
|
-
}
|
|
11304
|
+
this._reassigned = false;
|
|
11305
|
+
this._unknownReassignedSubPath = false;
|
|
11306
|
+
this._subPaths = new Map();
|
|
11318
11307
|
}
|
|
11319
11308
|
|
|
11320
|
-
|
|
11321
|
-
|
|
11322
|
-
|
|
11323
|
-
this._assignments.get( SET_KEY ).forEach( assignment => callback( path, assignment ) );
|
|
11324
|
-
if ( path.length > 0
|
|
11325
|
-
&& nextPath !== UNKNOWN_KEY
|
|
11326
|
-
&& !this._assignments.has( UNKNOWN_KEY )
|
|
11327
|
-
&& this._assignments.has( nextPath ) ) {
|
|
11328
|
-
this._assignments.get( nextPath ).forEachAtPath( remainingPath, callback );
|
|
11309
|
+
isReassigned ( path ) {
|
|
11310
|
+
if ( path.length === 0 ) {
|
|
11311
|
+
return this._reassigned;
|
|
11329
11312
|
}
|
|
11313
|
+
var subPath = path[0];
|
|
11314
|
+
var remainingPath = path.slice(1);
|
|
11315
|
+
return this._unknownReassignedSubPath || (
|
|
11316
|
+
this._subPaths.has( subPath ) && this._subPaths.get( subPath ).isReassigned( remainingPath )
|
|
11317
|
+
);
|
|
11330
11318
|
}
|
|
11331
11319
|
|
|
11332
|
-
|
|
11333
|
-
if ( this.
|
|
11334
|
-
if ( path.length
|
|
11335
|
-
|
|
11336
|
-
var remainingPath = path.slice(1);
|
|
11337
|
-
if ( nextPath === UNKNOWN_KEY || this._assignments.has( UNKNOWN_KEY ) ) { return; }
|
|
11338
|
-
if ( this._assignments.has( nextPath ) ) {
|
|
11339
|
-
this._assignments.get( nextPath ).forEachAssignedToPath( remainingPath, callback );
|
|
11340
|
-
}
|
|
11320
|
+
reassignPath ( path ) {
|
|
11321
|
+
if ( this._reassigned ) { return; }
|
|
11322
|
+
if ( path.length === 0 ) {
|
|
11323
|
+
this._reassigned = true;
|
|
11341
11324
|
} else {
|
|
11342
|
-
this.
|
|
11343
|
-
this._assignments.forEach( ( assignment, subPath ) => {
|
|
11344
|
-
if ( subPath !== SET_KEY ) {
|
|
11345
|
-
assignment.forEachAssignedToPath( [],
|
|
11346
|
-
( relativePath, assignment ) => callback( [ subPath ].concat( relativePath ), assignment ) );
|
|
11347
|
-
}
|
|
11348
|
-
} );
|
|
11325
|
+
this._reassignSubPath( path );
|
|
11349
11326
|
}
|
|
11350
11327
|
}
|
|
11351
11328
|
|
|
11352
|
-
|
|
11353
|
-
if ( this.
|
|
11354
|
-
|
|
11355
|
-
|
|
11329
|
+
_reassignSubPath ( path ) {
|
|
11330
|
+
if ( this._unknownReassignedSubPath ) { return; }
|
|
11331
|
+
var subPath = path[0];
|
|
11332
|
+
var remainingPath = path.slice(1);
|
|
11333
|
+
if ( subPath === UNKNOWN_KEY ) {
|
|
11334
|
+
this._unknownReassignedSubPath = true;
|
|
11356
11335
|
} else {
|
|
11357
|
-
if ( this.
|
|
11358
|
-
|
|
11359
|
-
var remainingPath = path.slice(1);
|
|
11360
|
-
if ( !this._assignments.has( nextPath ) ) {
|
|
11361
|
-
return false;
|
|
11336
|
+
if ( !this._subPaths.has( subPath ) ) {
|
|
11337
|
+
this._subPaths.set( subPath, new ReassignedPathTracker() );
|
|
11362
11338
|
}
|
|
11363
|
-
|
|
11339
|
+
this._subPaths.get( subPath ).reassignPath( remainingPath );
|
|
11364
11340
|
}
|
|
11365
11341
|
}
|
|
11366
11342
|
|
|
11367
|
-
|
|
11368
|
-
|
|
11343
|
+
someReassignedPath ( path, callback ) {
|
|
11344
|
+
return this._reassigned
|
|
11345
|
+
? callback( path, UNKNOWN_ASSIGNMENT )
|
|
11346
|
+
: path.length >= 1 && this._onSubPathIfReassigned( path, callback );
|
|
11347
|
+
}
|
|
11348
|
+
|
|
11349
|
+
_onSubPathIfReassigned ( path, callback ) {
|
|
11350
|
+
var subPath = path[0];
|
|
11369
11351
|
var remainingPath = path.slice(1);
|
|
11370
|
-
return
|
|
11371
|
-
|
|
11372
|
-
|
|
11373
|
-
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11377
|
-
|
|
11378
|
-
|
|
11379
|
-
|
|
11352
|
+
return this._unknownReassignedSubPath || subPath === UNKNOWN_KEY
|
|
11353
|
+
? callback( remainingPath, UNKNOWN_ASSIGNMENT )
|
|
11354
|
+
: this._subPaths.has( subPath ) && this._subPaths.get( subPath ).someReassignedPath( remainingPath, callback );
|
|
11355
|
+
}
|
|
11356
|
+
}
|
|
11357
|
+
|
|
11358
|
+
class VariableReassignmentTracker {
|
|
11359
|
+
constructor ( initialExpression ) {
|
|
11360
|
+
this._initialExpression = initialExpression;
|
|
11361
|
+
this._reassignedPathTracker = new ReassignedPathTracker();
|
|
11380
11362
|
}
|
|
11381
11363
|
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
|
|
11364
|
+
reassignPath ( path, options ) {
|
|
11365
|
+
if ( path.length > 0 ) {
|
|
11366
|
+
this._initialExpression && this._initialExpression.reassignPath( path, options );
|
|
11367
|
+
}
|
|
11368
|
+
this._reassignedPathTracker.reassignPath( path, options );
|
|
11369
|
+
}
|
|
11385
11370
|
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
|
|
11371
|
+
forEachAtPath ( path, callback ) {
|
|
11372
|
+
this._initialExpression && callback( path, this._initialExpression );
|
|
11373
|
+
}
|
|
11389
11374
|
|
|
11390
|
-
|
|
11391
|
-
|
|
11392
|
-
|
|
11393
|
-
} ).join( '\n' );
|
|
11375
|
+
someAtPath ( path, predicateFunction ) {
|
|
11376
|
+
return this._reassignedPathTracker.someReassignedPath( path, predicateFunction )
|
|
11377
|
+
|| (this._initialExpression && predicateFunction( path, this._initialExpression ));
|
|
11394
11378
|
}
|
|
11395
11379
|
}
|
|
11396
11380
|
|
|
11397
|
-
// To avoid
|
|
11398
|
-
const
|
|
11381
|
+
// To avoid infinite recursions
|
|
11382
|
+
const MAX_PATH_DEPTH = 7;
|
|
11399
11383
|
|
|
11400
11384
|
class LocalVariable extends Variable {
|
|
11401
11385
|
constructor ( name, declarator, init ) {
|
|
@@ -11403,34 +11387,25 @@ class LocalVariable extends Variable {
|
|
|
11403
11387
|
this.isReassigned = false;
|
|
11404
11388
|
this.exportName = null;
|
|
11405
11389
|
this.declarations = new Set( declarator ? [ declarator ] : null );
|
|
11406
|
-
this.boundExpressions = new
|
|
11407
|
-
init && this.boundExpressions.addAtPath( [], init );
|
|
11390
|
+
this.boundExpressions = new VariableReassignmentTracker( init );
|
|
11408
11391
|
}
|
|
11409
11392
|
|
|
11410
11393
|
addDeclaration ( identifier ) {
|
|
11411
11394
|
this.declarations.add( identifier );
|
|
11412
11395
|
}
|
|
11413
11396
|
|
|
11414
|
-
|
|
11415
|
-
if (
|
|
11416
|
-
|
|
11417
|
-
}
|
|
11418
|
-
if ( path.length > MAX_PATH_LENGTH || expression === this || this.boundExpressions.hasAtPath( path, expression ) ) { return; }
|
|
11419
|
-
this.boundExpressions.addAtPath( path, expression );
|
|
11420
|
-
this.boundExpressions.forEachAssignedToPath( path, ( subPath, node ) => {
|
|
11421
|
-
subPath.length > 0
|
|
11422
|
-
&& expression.bindAssignmentAtPath( subPath, node, options );
|
|
11423
|
-
} );
|
|
11424
|
-
if ( path.length > 0 ) {
|
|
11425
|
-
this.boundExpressions.forEachAtPath( path.slice( 0, -1 ), ( relativePath, node ) =>
|
|
11426
|
-
node.bindAssignmentAtPath( relativePath.concat( path.slice( -1 ) ), expression, options ) );
|
|
11427
|
-
} else {
|
|
11397
|
+
reassignPath ( path, options ) {
|
|
11398
|
+
if ( path.length > MAX_PATH_DEPTH ) { return; }
|
|
11399
|
+
if ( path.length === 0 ) {
|
|
11428
11400
|
this.isReassigned = true;
|
|
11429
11401
|
}
|
|
11402
|
+
if ( !options.hasNodeBeenAssignedAtPath( path, this ) ) {
|
|
11403
|
+
this.boundExpressions.reassignPath( path, options.addAssignedNodeAtPath( path, this ) );
|
|
11404
|
+
}
|
|
11430
11405
|
}
|
|
11431
11406
|
|
|
11432
11407
|
forEachReturnExpressionWhenCalledAtPath ( path, callOptions, callback, options ) {
|
|
11433
|
-
if ( path.length >
|
|
11408
|
+
if ( path.length > MAX_PATH_DEPTH ) { return; }
|
|
11434
11409
|
this.boundExpressions.forEachAtPath( path, ( relativePath, node ) =>
|
|
11435
11410
|
!options.hasNodeBeenCalledAtPathWithOptions( relativePath, node, callOptions ) && node
|
|
11436
11411
|
.forEachReturnExpressionWhenCalledAtPath( relativePath, callOptions, callback,
|
|
@@ -11445,7 +11420,7 @@ class LocalVariable extends Variable {
|
|
|
11445
11420
|
}
|
|
11446
11421
|
|
|
11447
11422
|
hasEffectsWhenAccessedAtPath ( path, options ) {
|
|
11448
|
-
return path.length >
|
|
11423
|
+
return path.length > MAX_PATH_DEPTH
|
|
11449
11424
|
|| this.boundExpressions.someAtPath( path, ( relativePath, node ) =>
|
|
11450
11425
|
relativePath.length > 0
|
|
11451
11426
|
&& !options.hasNodeBeenAccessedAtPath( relativePath, node )
|
|
@@ -11454,7 +11429,7 @@ class LocalVariable extends Variable {
|
|
|
11454
11429
|
|
|
11455
11430
|
hasEffectsWhenAssignedAtPath ( path, options ) {
|
|
11456
11431
|
return this.included
|
|
11457
|
-
|| path.length >
|
|
11432
|
+
|| path.length > MAX_PATH_DEPTH
|
|
11458
11433
|
|| this.boundExpressions.someAtPath( path, ( relativePath, node ) =>
|
|
11459
11434
|
relativePath.length > 0
|
|
11460
11435
|
&& !options.hasNodeBeenAssignedAtPath( relativePath, node ) && node
|
|
@@ -11463,7 +11438,7 @@ class LocalVariable extends Variable {
|
|
|
11463
11438
|
}
|
|
11464
11439
|
|
|
11465
11440
|
hasEffectsWhenCalledAtPath ( path, callOptions, options ) {
|
|
11466
|
-
return path.length >
|
|
11441
|
+
return path.length > MAX_PATH_DEPTH
|
|
11467
11442
|
|| (this.included && path.length > 0)
|
|
11468
11443
|
|| this.boundExpressions.someAtPath( path, ( relativePath, node ) =>
|
|
11469
11444
|
!options.hasNodeBeenCalledAtPathWithOptions( relativePath, node, callOptions ) && node
|
|
@@ -11479,7 +11454,7 @@ class LocalVariable extends Variable {
|
|
|
11479
11454
|
}
|
|
11480
11455
|
|
|
11481
11456
|
someReturnExpressionWhenCalledAtPath ( path, callOptions, predicateFunction, options ) {
|
|
11482
|
-
return path.length >
|
|
11457
|
+
return path.length > MAX_PATH_DEPTH
|
|
11483
11458
|
|| (this.included && path.length > 0)
|
|
11484
11459
|
|| this.boundExpressions.someAtPath( path, ( relativePath, node ) =>
|
|
11485
11460
|
!options.hasNodeBeenCalledAtPathWithOptions( relativePath, node, callOptions ) && node
|
|
@@ -11557,7 +11532,7 @@ class Scope {
|
|
|
11557
11532
|
if ( this.variables[ name ] ) {
|
|
11558
11533
|
const variable = this.variables[ name ];
|
|
11559
11534
|
variable.addDeclaration( identifier );
|
|
11560
|
-
|
|
11535
|
+
variable.reassignPath( [], ExecutionPathOptions.create() );
|
|
11561
11536
|
} else {
|
|
11562
11537
|
this.variables[ name ] = new LocalVariable( identifier.name, identifier, options.init || UNDEFINED_ASSIGNMENT );
|
|
11563
11538
|
}
|
|
@@ -11777,7 +11752,7 @@ function disallowIllegalReassignment ( scope, node ) {
|
|
|
11777
11752
|
class AssignmentExpression extends Node$1 {
|
|
11778
11753
|
bindNode () {
|
|
11779
11754
|
disallowIllegalReassignment( this.scope, this.left );
|
|
11780
|
-
this.left.
|
|
11755
|
+
this.left.reassignPath( [], ExecutionPathOptions.create() );
|
|
11781
11756
|
}
|
|
11782
11757
|
|
|
11783
11758
|
hasEffects ( options ) {
|
|
@@ -11792,12 +11767,12 @@ class AssignmentExpression extends Node$1 {
|
|
|
11792
11767
|
|
|
11793
11768
|
class AssignmentPattern extends Node$1 {
|
|
11794
11769
|
bindNode () {
|
|
11795
|
-
this.left.
|
|
11770
|
+
this.left.reassignPath( [], ExecutionPathOptions.create() );
|
|
11796
11771
|
}
|
|
11797
11772
|
|
|
11798
|
-
|
|
11773
|
+
reassignPath ( path, options ) {
|
|
11799
11774
|
path.length === 0
|
|
11800
|
-
&& this.left.
|
|
11775
|
+
&& this.left.reassignPath( path, options );
|
|
11801
11776
|
}
|
|
11802
11777
|
|
|
11803
11778
|
hasEffectsWhenAssignedAtPath ( path, options ) {
|
|
@@ -11970,10 +11945,10 @@ class CallOptions {
|
|
|
11970
11945
|
}
|
|
11971
11946
|
|
|
11972
11947
|
class CallExpression extends Node$1 {
|
|
11973
|
-
|
|
11948
|
+
reassignPath ( path, options ) {
|
|
11974
11949
|
!options.hasReturnExpressionBeenAssignedAtPath( path, this )
|
|
11975
11950
|
&& this.callee.forEachReturnExpressionWhenCalledAtPath( [], this._callOptions, innerOptions => node =>
|
|
11976
|
-
node.
|
|
11951
|
+
node.reassignPath( path, innerOptions.addAssignedReturnExpressionAtPath( path, this ) ), options );
|
|
11977
11952
|
}
|
|
11978
11953
|
|
|
11979
11954
|
bindNode () {
|
|
@@ -12123,9 +12098,9 @@ class ClassExpression extends ClassNode {
|
|
|
12123
12098
|
}
|
|
12124
12099
|
|
|
12125
12100
|
class ConditionalExpression extends Node$1 {
|
|
12126
|
-
|
|
12101
|
+
reassignPath ( path, options ) {
|
|
12127
12102
|
path.length > 0
|
|
12128
|
-
&& this._forEachRelevantBranch( node => node.
|
|
12103
|
+
&& this._forEachRelevantBranch( node => node.reassignPath( path, options ) );
|
|
12129
12104
|
}
|
|
12130
12105
|
|
|
12131
12106
|
forEachReturnExpressionWhenCalledAtPath ( path, callOptions, callback, options ) {
|
|
@@ -12161,20 +12136,17 @@ class ConditionalExpression extends Node$1 {
|
|
|
12161
12136
|
}
|
|
12162
12137
|
|
|
12163
12138
|
initialiseChildren ( parentScope ) {
|
|
12139
|
+
super.initialiseChildren( parentScope );
|
|
12164
12140
|
if ( this.module.bundle.treeshake ) {
|
|
12165
12141
|
this.testValue = this.test.getValue();
|
|
12166
12142
|
|
|
12167
12143
|
if ( this.testValue === UNKNOWN_VALUE ) {
|
|
12168
|
-
|
|
12144
|
+
return;
|
|
12169
12145
|
} else if ( this.testValue ) {
|
|
12170
|
-
this.consequent.initialise( this.scope );
|
|
12171
12146
|
this.alternate = null;
|
|
12172
12147
|
} else if ( this.alternate ) {
|
|
12173
|
-
this.alternate.initialise( this.scope );
|
|
12174
12148
|
this.consequent = null;
|
|
12175
12149
|
}
|
|
12176
|
-
} else {
|
|
12177
|
-
super.initialiseChildren( parentScope );
|
|
12178
12150
|
}
|
|
12179
12151
|
}
|
|
12180
12152
|
|
|
@@ -12441,7 +12413,7 @@ class ForInStatement extends Statement {
|
|
|
12441
12413
|
|
|
12442
12414
|
class ForOfStatement extends Statement {
|
|
12443
12415
|
bindNode () {
|
|
12444
|
-
this.left.
|
|
12416
|
+
this.left.reassignPath( [], ExecutionPathOptions.create() );
|
|
12445
12417
|
}
|
|
12446
12418
|
|
|
12447
12419
|
hasEffects ( options ) {
|
|
@@ -12481,10 +12453,10 @@ class ArgumentsVariable extends LocalVariable {
|
|
|
12481
12453
|
this._parameters = parameters;
|
|
12482
12454
|
}
|
|
12483
12455
|
|
|
12484
|
-
|
|
12456
|
+
reassignPath ( path, options ) {
|
|
12485
12457
|
if ( path.length > 0 ) {
|
|
12486
12458
|
if ( path[ 0 ] >= 0 && this._parameters[ path[ 0 ] ] ) {
|
|
12487
|
-
this._parameters[ path[ 0 ] ].
|
|
12459
|
+
this._parameters[ path[ 0 ] ].reassignPath( path.slice( 1 ), options );
|
|
12488
12460
|
}
|
|
12489
12461
|
}
|
|
12490
12462
|
}
|
|
@@ -12680,10 +12652,10 @@ function isReference (node, parent) {
|
|
|
12680
12652
|
}
|
|
12681
12653
|
|
|
12682
12654
|
class Identifier extends Node$1 {
|
|
12683
|
-
|
|
12655
|
+
reassignPath ( path, options ) {
|
|
12684
12656
|
this._bindVariableIfMissing();
|
|
12685
12657
|
this.variable
|
|
12686
|
-
&& this.variable.
|
|
12658
|
+
&& this.variable.reassignPath( path, options );
|
|
12687
12659
|
}
|
|
12688
12660
|
|
|
12689
12661
|
bindNode () {
|
|
@@ -12923,9 +12895,9 @@ class Literal extends Node$1 {
|
|
|
12923
12895
|
}
|
|
12924
12896
|
|
|
12925
12897
|
class LogicalExpression extends Node$1 {
|
|
12926
|
-
|
|
12898
|
+
reassignPath ( path, options ) {
|
|
12927
12899
|
path.length > 0
|
|
12928
|
-
&& this._forEachRelevantBranch( node => node.
|
|
12900
|
+
&& this._forEachRelevantBranch( node => node.reassignPath( path, options ) );
|
|
12929
12901
|
}
|
|
12930
12902
|
|
|
12931
12903
|
forEachReturnExpressionWhenCalledAtPath ( path, callOptions, callback, options ) {
|
|
@@ -13071,12 +13043,12 @@ class MemberExpression extends Node$1 {
|
|
|
13071
13043
|
}
|
|
13072
13044
|
}
|
|
13073
13045
|
|
|
13074
|
-
|
|
13046
|
+
reassignPath ( path, options ) {
|
|
13075
13047
|
if ( !this._bound ) { this.bind(); }
|
|
13076
13048
|
if ( this.variable ) {
|
|
13077
|
-
this.variable.
|
|
13049
|
+
this.variable.reassignPath( path, options );
|
|
13078
13050
|
} else {
|
|
13079
|
-
this.object.
|
|
13051
|
+
this.object.reassignPath( [ this._getPathSegment() ].concat( path ), options );
|
|
13080
13052
|
}
|
|
13081
13053
|
}
|
|
13082
13054
|
|
|
@@ -13188,7 +13160,7 @@ const PROPERTY_KINDS_READ = [ 'init', 'get' ];
|
|
|
13188
13160
|
const PROPERTY_KINDS_WRITE = [ 'init', 'set' ];
|
|
13189
13161
|
|
|
13190
13162
|
class ObjectExpression extends Node$1 {
|
|
13191
|
-
|
|
13163
|
+
reassignPath ( path, options ) {
|
|
13192
13164
|
if ( path.length === 0 ) { return; }
|
|
13193
13165
|
|
|
13194
13166
|
var ref = this._getPossiblePropertiesWithName(
|
|
@@ -13197,7 +13169,7 @@ class ObjectExpression extends Node$1 {
|
|
|
13197
13169
|
var hasCertainHit = ref.hasCertainHit;
|
|
13198
13170
|
(path.length === 1 || hasCertainHit)
|
|
13199
13171
|
&& properties.forEach( property => (path.length > 1 || property.kind === 'set')
|
|
13200
|
-
&& property.
|
|
13172
|
+
&& property.reassignPath( path.slice( 1 ), options ) );
|
|
13201
13173
|
}
|
|
13202
13174
|
|
|
13203
13175
|
forEachReturnExpressionWhenCalledAtPath ( path, callOptions, callback, options ) {
|
|
@@ -13275,9 +13247,9 @@ class ObjectExpression extends Node$1 {
|
|
|
13275
13247
|
}
|
|
13276
13248
|
|
|
13277
13249
|
class ObjectPattern extends Node$1 {
|
|
13278
|
-
|
|
13250
|
+
reassignPath ( path, options ) {
|
|
13279
13251
|
path.length === 0
|
|
13280
|
-
&& this.properties.forEach( child => child.
|
|
13252
|
+
&& this.properties.forEach( child => child.reassignPath( path, options ) );
|
|
13281
13253
|
}
|
|
13282
13254
|
|
|
13283
13255
|
hasEffectsWhenAssignedAtPath ( path, options ) {
|
|
@@ -13292,13 +13264,13 @@ class ObjectPattern extends Node$1 {
|
|
|
13292
13264
|
}
|
|
13293
13265
|
|
|
13294
13266
|
class Property extends Node$1 {
|
|
13295
|
-
|
|
13267
|
+
reassignPath ( path, options ) {
|
|
13296
13268
|
if ( this.kind === 'get' ) {
|
|
13297
13269
|
path.length > 0
|
|
13298
13270
|
&& this.value.forEachReturnExpressionWhenCalledAtPath( [], this._accessorCallOptions, innerOptions => node =>
|
|
13299
|
-
node.
|
|
13271
|
+
node.reassignPath( path, innerOptions.addAssignedReturnExpressionAtPath( path, this ) ), options );
|
|
13300
13272
|
} else if ( this.kind !== 'set' ) {
|
|
13301
|
-
this.value.
|
|
13273
|
+
this.value.reassignPath( path, options );
|
|
13302
13274
|
}
|
|
13303
13275
|
}
|
|
13304
13276
|
|
|
@@ -13378,9 +13350,9 @@ class Property extends Node$1 {
|
|
|
13378
13350
|
}
|
|
13379
13351
|
|
|
13380
13352
|
class RestElement extends Node$1 {
|
|
13381
|
-
|
|
13353
|
+
reassignPath ( path, options ) {
|
|
13382
13354
|
path.length === 0
|
|
13383
|
-
&& this.argument.
|
|
13355
|
+
&& this.argument.reassignPath( [], options );
|
|
13384
13356
|
}
|
|
13385
13357
|
|
|
13386
13358
|
hasEffectsWhenAssignedAtPath ( path, options ) {
|
|
@@ -13439,6 +13411,10 @@ class SequenceExpression extends Node$1 {
|
|
|
13439
13411
|
const last = this.expressions[ this.expressions.length - 1 ];
|
|
13440
13412
|
last.render( code, es );
|
|
13441
13413
|
|
|
13414
|
+
if ( this.parent.type === 'CallExpression' && last.type === 'MemberExpression' && this.expressions.length > 1 ) {
|
|
13415
|
+
this.expressions[0].included = true;
|
|
13416
|
+
}
|
|
13417
|
+
|
|
13442
13418
|
const included = this.expressions.slice( 0, this.expressions.length - 1 ).filter( expression => expression.included );
|
|
13443
13419
|
if ( included.length === 0 ) {
|
|
13444
13420
|
code.remove( this.start, last.start );
|
|
@@ -13587,7 +13563,7 @@ const operators$1 = {
|
|
|
13587
13563
|
class UnaryExpression extends Node$1 {
|
|
13588
13564
|
bindNode () {
|
|
13589
13565
|
if ( this.operator === 'delete' ) {
|
|
13590
|
-
this.argument.
|
|
13566
|
+
this.argument.reassignPath( [], ExecutionPathOptions.create() );
|
|
13591
13567
|
}
|
|
13592
13568
|
}
|
|
13593
13569
|
|
|
@@ -13615,24 +13591,10 @@ class UnaryExpression extends Node$1 {
|
|
|
13615
13591
|
}
|
|
13616
13592
|
}
|
|
13617
13593
|
|
|
13618
|
-
class VirtualNumberLiteral extends Node$1 {
|
|
13619
|
-
hasEffectsWhenAccessedAtPath ( path ) {
|
|
13620
|
-
return path.length > 1;
|
|
13621
|
-
}
|
|
13622
|
-
|
|
13623
|
-
hasEffectsWhenAssignedAtPath ( path ) {
|
|
13624
|
-
return path.length > 1;
|
|
13625
|
-
}
|
|
13626
|
-
|
|
13627
|
-
toString () {
|
|
13628
|
-
return '[[VIRTUAL NUMBER]]';
|
|
13629
|
-
}
|
|
13630
|
-
}
|
|
13631
|
-
|
|
13632
13594
|
class UpdateExpression extends Node$1 {
|
|
13633
13595
|
bindNode () {
|
|
13634
13596
|
disallowIllegalReassignment( this.scope, this.argument );
|
|
13635
|
-
this.argument.
|
|
13597
|
+
this.argument.reassignPath( [], ExecutionPathOptions.create() );
|
|
13636
13598
|
if ( this.argument.type === 'Identifier' ) {
|
|
13637
13599
|
const variable = this.scope.findVariable( this.argument.name );
|
|
13638
13600
|
variable.isReassigned = true;
|
|
@@ -13650,8 +13612,8 @@ class UpdateExpression extends Node$1 {
|
|
|
13650
13612
|
}
|
|
13651
13613
|
|
|
13652
13614
|
class VariableDeclarator extends Node$1 {
|
|
13653
|
-
|
|
13654
|
-
this.id.
|
|
13615
|
+
reassignPath ( path, options ) {
|
|
13616
|
+
this.id.reassignPath( path, options );
|
|
13655
13617
|
}
|
|
13656
13618
|
|
|
13657
13619
|
initialiseDeclarator ( parentScope, kind ) {
|
|
@@ -13694,8 +13656,8 @@ function getSeparator ( code, start ) {
|
|
|
13694
13656
|
const forStatement = /^For(?:Of|In)?Statement/;
|
|
13695
13657
|
|
|
13696
13658
|
class VariableDeclaration extends Node$1 {
|
|
13697
|
-
|
|
13698
|
-
this.eachChild( child => child.
|
|
13659
|
+
reassignPath () {
|
|
13660
|
+
this.eachChild( child => child.reassignPath( [], ExecutionPathOptions.create() ) );
|
|
13699
13661
|
}
|
|
13700
13662
|
|
|
13701
13663
|
hasEffectsWhenAssignedAtPath () {
|
|
@@ -14045,149 +14007,2391 @@ class ModuleScope extends Scope {
|
|
|
14045
14007
|
}
|
|
14046
14008
|
}
|
|
14047
14009
|
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
-
|
|
14054
|
-
preserveParens: false
|
|
14055
|
-
}, acornOptions ) );
|
|
14056
|
-
} catch ( err ) {
|
|
14057
|
-
module.error( {
|
|
14058
|
-
code: 'PARSE_ERROR',
|
|
14059
|
-
message: err.message.replace( / \(\d+:\d+\)$/, '' )
|
|
14060
|
-
}, err.pos );
|
|
14061
|
-
}
|
|
14062
|
-
}
|
|
14010
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
14011
|
+
/*
|
|
14012
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
14013
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
14014
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
14015
|
+
*/
|
|
14063
14016
|
|
|
14064
|
-
|
|
14065
|
-
node.included = true;
|
|
14066
|
-
if ( node.variable && !node.variable.included ) {
|
|
14067
|
-
node.variable.includeVariable();
|
|
14068
|
-
}
|
|
14069
|
-
node.eachChild( includeFully );
|
|
14070
|
-
}
|
|
14017
|
+
var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
|
|
14071
14018
|
|
|
14072
|
-
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
var resolvedExternalIds = ref.resolvedExternalIds;
|
|
14082
|
-
var bundle = ref.bundle;
|
|
14019
|
+
/**
|
|
14020
|
+
* Encode an integer in the range of 0 to 63 to a single base 64 digit.
|
|
14021
|
+
*/
|
|
14022
|
+
var encode$2 = function (number) {
|
|
14023
|
+
if (0 <= number && number < intToCharMap.length) {
|
|
14024
|
+
return intToCharMap[number];
|
|
14025
|
+
}
|
|
14026
|
+
throw new TypeError("Must be between 0 and 63: " + number);
|
|
14027
|
+
};
|
|
14083
14028
|
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14029
|
+
/**
|
|
14030
|
+
* Decode a single base 64 character code digit to an integer. Returns -1 on
|
|
14031
|
+
* failure.
|
|
14032
|
+
*/
|
|
14033
|
+
var decode$2 = function (charCode) {
|
|
14034
|
+
var bigA = 65; // 'A'
|
|
14035
|
+
var bigZ = 90; // 'Z'
|
|
14090
14036
|
|
|
14091
|
-
|
|
14037
|
+
var littleA = 97; // 'a'
|
|
14038
|
+
var littleZ = 122; // 'z'
|
|
14092
14039
|
|
|
14093
|
-
|
|
14040
|
+
var zero = 48; // '0'
|
|
14041
|
+
var nine = 57; // '9'
|
|
14094
14042
|
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
// subsequent incremental rebuilds
|
|
14098
|
-
this.ast = clone( ast );
|
|
14099
|
-
this.astClone = ast;
|
|
14100
|
-
} else {
|
|
14101
|
-
this.ast = tryParse( this, bundle.acornOptions ); // TODO what happens to comments if AST is provided?
|
|
14102
|
-
this.astClone = clone( this.ast );
|
|
14103
|
-
}
|
|
14043
|
+
var plus = 43; // '+'
|
|
14044
|
+
var slash = 47; // '/'
|
|
14104
14045
|
|
|
14105
|
-
|
|
14046
|
+
var littleOffset = 26;
|
|
14047
|
+
var numberOffset = 52;
|
|
14106
14048
|
|
|
14107
|
-
|
|
14108
|
-
|
|
14049
|
+
// 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
|
14050
|
+
if (bigA <= charCode && charCode <= bigZ) {
|
|
14051
|
+
return (charCode - bigA);
|
|
14052
|
+
}
|
|
14109
14053
|
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
this.resolvedExternalIds = resolvedExternalIds || blank();
|
|
14054
|
+
// 26 - 51: abcdefghijklmnopqrstuvwxyz
|
|
14055
|
+
if (littleA <= charCode && charCode <= littleZ) {
|
|
14056
|
+
return (charCode - littleA + littleOffset);
|
|
14057
|
+
}
|
|
14115
14058
|
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
this.reexports = blank();
|
|
14059
|
+
// 52 - 61: 0123456789
|
|
14060
|
+
if (zero <= charCode && charCode <= nine) {
|
|
14061
|
+
return (charCode - zero + numberOffset);
|
|
14062
|
+
}
|
|
14121
14063
|
|
|
14122
|
-
|
|
14123
|
-
|
|
14064
|
+
// 62: +
|
|
14065
|
+
if (charCode == plus) {
|
|
14066
|
+
return 62;
|
|
14067
|
+
}
|
|
14124
14068
|
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
indentExclusionRanges: []
|
|
14130
|
-
} );
|
|
14069
|
+
// 63: /
|
|
14070
|
+
if (charCode == slash) {
|
|
14071
|
+
return 63;
|
|
14072
|
+
}
|
|
14131
14073
|
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
const isSourceMapComment = !comment.block && SOURCEMAPPING_URL_RE.test( comment.text );
|
|
14136
|
-
if ( isSourceMapComment ) {
|
|
14137
|
-
this.magicString.remove( comment.start, comment.end );
|
|
14138
|
-
}
|
|
14139
|
-
return !isSourceMapComment;
|
|
14140
|
-
} );
|
|
14074
|
+
// Invalid base64 digit.
|
|
14075
|
+
return -1;
|
|
14076
|
+
};
|
|
14141
14077
|
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14078
|
+
var base64 = {
|
|
14079
|
+
encode: encode$2,
|
|
14080
|
+
decode: decode$2
|
|
14081
|
+
};
|
|
14145
14082
|
|
|
14146
|
-
|
|
14083
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
14084
|
+
/*
|
|
14085
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
14086
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
14087
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
14088
|
+
*
|
|
14089
|
+
* Based on the Base 64 VLQ implementation in Closure Compiler:
|
|
14090
|
+
* https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
|
|
14091
|
+
*
|
|
14092
|
+
* Copyright 2011 The Closure Compiler Authors. All rights reserved.
|
|
14093
|
+
* Redistribution and use in source and binary forms, with or without
|
|
14094
|
+
* modification, are permitted provided that the following conditions are
|
|
14095
|
+
* met:
|
|
14096
|
+
*
|
|
14097
|
+
* * Redistributions of source code must retain the above copyright
|
|
14098
|
+
* notice, this list of conditions and the following disclaimer.
|
|
14099
|
+
* * Redistributions in binary form must reproduce the above
|
|
14100
|
+
* copyright notice, this list of conditions and the following
|
|
14101
|
+
* disclaimer in the documentation and/or other materials provided
|
|
14102
|
+
* with the distribution.
|
|
14103
|
+
* * Neither the name of Google Inc. nor the names of its
|
|
14104
|
+
* contributors may be used to endorse or promote products derived
|
|
14105
|
+
* from this software without specific prior written permission.
|
|
14106
|
+
*
|
|
14107
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
14108
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
14109
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
14110
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
14111
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
14112
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
14113
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
14114
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
14115
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
14116
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
14117
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
14118
|
+
*/
|
|
14147
14119
|
|
|
14148
|
-
this.analyse();
|
|
14149
14120
|
|
|
14150
|
-
timeEnd( 'analyse' );
|
|
14151
14121
|
|
|
14152
|
-
|
|
14153
|
-
|
|
14122
|
+
// A single base 64 digit can contain 6 bits of data. For the base 64 variable
|
|
14123
|
+
// length quantities we use in the source map spec, the first bit is the sign,
|
|
14124
|
+
// the next four bits are the actual value, and the 6th bit is the
|
|
14125
|
+
// continuation bit. The continuation bit tells us whether there are more
|
|
14126
|
+
// digits in this value following this digit.
|
|
14127
|
+
//
|
|
14128
|
+
// Continuation
|
|
14129
|
+
// | Sign
|
|
14130
|
+
// | |
|
|
14131
|
+
// V V
|
|
14132
|
+
// 101011
|
|
14154
14133
|
|
|
14155
|
-
|
|
14156
|
-
const source = node.source && node.source.value;
|
|
14134
|
+
var VLQ_BASE_SHIFT = 5;
|
|
14157
14135
|
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
if ( !~this.sources.indexOf( source ) ) { this.sources.push( source ); }
|
|
14136
|
+
// binary: 100000
|
|
14137
|
+
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
|
|
14161
14138
|
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
// When an unknown import is encountered, we see if one of them can satisfy it.
|
|
14165
|
-
this.exportAllSources.push( source );
|
|
14166
|
-
}
|
|
14139
|
+
// binary: 011111
|
|
14140
|
+
var VLQ_BASE_MASK = VLQ_BASE - 1;
|
|
14167
14141
|
|
|
14168
|
-
|
|
14169
|
-
|
|
14170
|
-
const name = specifier.exported.name;
|
|
14142
|
+
// binary: 100000
|
|
14143
|
+
var VLQ_CONTINUATION_BIT = VLQ_BASE;
|
|
14171
14144
|
|
|
14172
|
-
|
|
14173
|
-
|
|
14174
|
-
|
|
14175
|
-
|
|
14176
|
-
|
|
14177
|
-
|
|
14145
|
+
/**
|
|
14146
|
+
* Converts from a two-complement value to a value where the sign bit is
|
|
14147
|
+
* placed in the least significant bit. For example, as decimals:
|
|
14148
|
+
* 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
|
|
14149
|
+
* 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
|
|
14150
|
+
*/
|
|
14151
|
+
function toVLQSigned(aValue) {
|
|
14152
|
+
return aValue < 0
|
|
14153
|
+
? ((-aValue) << 1) + 1
|
|
14154
|
+
: (aValue << 1) + 0;
|
|
14155
|
+
}
|
|
14178
14156
|
|
|
14179
|
-
|
|
14180
|
-
|
|
14181
|
-
|
|
14182
|
-
|
|
14183
|
-
|
|
14184
|
-
|
|
14185
|
-
|
|
14186
|
-
|
|
14187
|
-
|
|
14157
|
+
/**
|
|
14158
|
+
* Converts to a two-complement value from a value where the sign bit is
|
|
14159
|
+
* placed in the least significant bit. For example, as decimals:
|
|
14160
|
+
* 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
|
|
14161
|
+
* 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
|
|
14162
|
+
*/
|
|
14163
|
+
function fromVLQSigned(aValue) {
|
|
14164
|
+
var isNegative = (aValue & 1) === 1;
|
|
14165
|
+
var shifted = aValue >> 1;
|
|
14166
|
+
return isNegative
|
|
14167
|
+
? -shifted
|
|
14168
|
+
: shifted;
|
|
14169
|
+
}
|
|
14188
14170
|
|
|
14189
|
-
|
|
14190
|
-
|
|
14171
|
+
/**
|
|
14172
|
+
* Returns the base 64 VLQ encoded value.
|
|
14173
|
+
*/
|
|
14174
|
+
var encode$1$1 = function base64VLQ_encode(aValue) {
|
|
14175
|
+
var encoded = "";
|
|
14176
|
+
var digit;
|
|
14177
|
+
|
|
14178
|
+
var vlq = toVLQSigned(aValue);
|
|
14179
|
+
|
|
14180
|
+
do {
|
|
14181
|
+
digit = vlq & VLQ_BASE_MASK;
|
|
14182
|
+
vlq >>>= VLQ_BASE_SHIFT;
|
|
14183
|
+
if (vlq > 0) {
|
|
14184
|
+
// There are still more digits in this value, so we must make sure the
|
|
14185
|
+
// continuation bit is marked.
|
|
14186
|
+
digit |= VLQ_CONTINUATION_BIT;
|
|
14187
|
+
}
|
|
14188
|
+
encoded += base64.encode(digit);
|
|
14189
|
+
} while (vlq > 0);
|
|
14190
|
+
|
|
14191
|
+
return encoded;
|
|
14192
|
+
};
|
|
14193
|
+
|
|
14194
|
+
/**
|
|
14195
|
+
* Decodes the next base 64 VLQ value from the given string and returns the
|
|
14196
|
+
* value and the rest of the string via the out parameter.
|
|
14197
|
+
*/
|
|
14198
|
+
var decode$1$1 = function base64VLQ_decode(aStr, aIndex, aOutParam) {
|
|
14199
|
+
var strLen = aStr.length;
|
|
14200
|
+
var result = 0;
|
|
14201
|
+
var shift = 0;
|
|
14202
|
+
var continuation, digit;
|
|
14203
|
+
|
|
14204
|
+
do {
|
|
14205
|
+
if (aIndex >= strLen) {
|
|
14206
|
+
throw new Error("Expected more digits in base 64 VLQ value.");
|
|
14207
|
+
}
|
|
14208
|
+
|
|
14209
|
+
digit = base64.decode(aStr.charCodeAt(aIndex++));
|
|
14210
|
+
if (digit === -1) {
|
|
14211
|
+
throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
|
|
14212
|
+
}
|
|
14213
|
+
|
|
14214
|
+
continuation = !!(digit & VLQ_CONTINUATION_BIT);
|
|
14215
|
+
digit &= VLQ_BASE_MASK;
|
|
14216
|
+
result = result + (digit << shift);
|
|
14217
|
+
shift += VLQ_BASE_SHIFT;
|
|
14218
|
+
} while (continuation);
|
|
14219
|
+
|
|
14220
|
+
aOutParam.value = fromVLQSigned(result);
|
|
14221
|
+
aOutParam.rest = aIndex;
|
|
14222
|
+
};
|
|
14223
|
+
|
|
14224
|
+
var base64Vlq = {
|
|
14225
|
+
encode: encode$1$1,
|
|
14226
|
+
decode: decode$1$1
|
|
14227
|
+
};
|
|
14228
|
+
|
|
14229
|
+
var util = createCommonjsModule(function (module, exports) {
|
|
14230
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
14231
|
+
/*
|
|
14232
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
14233
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
14234
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
14235
|
+
*/
|
|
14236
|
+
|
|
14237
|
+
/**
|
|
14238
|
+
* This is a helper function for getting values from parameter/options
|
|
14239
|
+
* objects.
|
|
14240
|
+
*
|
|
14241
|
+
* @param args The object we are extracting values from
|
|
14242
|
+
* @param name The name of the property we are getting.
|
|
14243
|
+
* @param defaultValue An optional value to return if the property is missing
|
|
14244
|
+
* from the object. If this is not specified and the property is missing, an
|
|
14245
|
+
* error will be thrown.
|
|
14246
|
+
*/
|
|
14247
|
+
function getArg(aArgs, aName, aDefaultValue) {
|
|
14248
|
+
if (aName in aArgs) {
|
|
14249
|
+
return aArgs[aName];
|
|
14250
|
+
} else if (arguments.length === 3) {
|
|
14251
|
+
return aDefaultValue;
|
|
14252
|
+
} else {
|
|
14253
|
+
throw new Error('"' + aName + '" is a required argument.');
|
|
14254
|
+
}
|
|
14255
|
+
}
|
|
14256
|
+
exports.getArg = getArg;
|
|
14257
|
+
|
|
14258
|
+
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
|
|
14259
|
+
var dataUrlRegexp = /^data:.+\,.+$/;
|
|
14260
|
+
|
|
14261
|
+
function urlParse(aUrl) {
|
|
14262
|
+
var match = aUrl.match(urlRegexp);
|
|
14263
|
+
if (!match) {
|
|
14264
|
+
return null;
|
|
14265
|
+
}
|
|
14266
|
+
return {
|
|
14267
|
+
scheme: match[1],
|
|
14268
|
+
auth: match[2],
|
|
14269
|
+
host: match[3],
|
|
14270
|
+
port: match[4],
|
|
14271
|
+
path: match[5]
|
|
14272
|
+
};
|
|
14273
|
+
}
|
|
14274
|
+
exports.urlParse = urlParse;
|
|
14275
|
+
|
|
14276
|
+
function urlGenerate(aParsedUrl) {
|
|
14277
|
+
var url = '';
|
|
14278
|
+
if (aParsedUrl.scheme) {
|
|
14279
|
+
url += aParsedUrl.scheme + ':';
|
|
14280
|
+
}
|
|
14281
|
+
url += '//';
|
|
14282
|
+
if (aParsedUrl.auth) {
|
|
14283
|
+
url += aParsedUrl.auth + '@';
|
|
14284
|
+
}
|
|
14285
|
+
if (aParsedUrl.host) {
|
|
14286
|
+
url += aParsedUrl.host;
|
|
14287
|
+
}
|
|
14288
|
+
if (aParsedUrl.port) {
|
|
14289
|
+
url += ":" + aParsedUrl.port;
|
|
14290
|
+
}
|
|
14291
|
+
if (aParsedUrl.path) {
|
|
14292
|
+
url += aParsedUrl.path;
|
|
14293
|
+
}
|
|
14294
|
+
return url;
|
|
14295
|
+
}
|
|
14296
|
+
exports.urlGenerate = urlGenerate;
|
|
14297
|
+
|
|
14298
|
+
/**
|
|
14299
|
+
* Normalizes a path, or the path portion of a URL:
|
|
14300
|
+
*
|
|
14301
|
+
* - Replaces consecutive slashes with one slash.
|
|
14302
|
+
* - Removes unnecessary '.' parts.
|
|
14303
|
+
* - Removes unnecessary '<dir>/..' parts.
|
|
14304
|
+
*
|
|
14305
|
+
* Based on code in the Node.js 'path' core module.
|
|
14306
|
+
*
|
|
14307
|
+
* @param aPath The path or url to normalize.
|
|
14308
|
+
*/
|
|
14309
|
+
function normalize(aPath) {
|
|
14310
|
+
var path = aPath;
|
|
14311
|
+
var url = urlParse(aPath);
|
|
14312
|
+
if (url) {
|
|
14313
|
+
if (!url.path) {
|
|
14314
|
+
return aPath;
|
|
14315
|
+
}
|
|
14316
|
+
path = url.path;
|
|
14317
|
+
}
|
|
14318
|
+
var isAbsolute = exports.isAbsolute(path);
|
|
14319
|
+
|
|
14320
|
+
var parts = path.split(/\/+/);
|
|
14321
|
+
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
|
|
14322
|
+
part = parts[i];
|
|
14323
|
+
if (part === '.') {
|
|
14324
|
+
parts.splice(i, 1);
|
|
14325
|
+
} else if (part === '..') {
|
|
14326
|
+
up++;
|
|
14327
|
+
} else if (up > 0) {
|
|
14328
|
+
if (part === '') {
|
|
14329
|
+
// The first part is blank if the path is absolute. Trying to go
|
|
14330
|
+
// above the root is a no-op. Therefore we can remove all '..' parts
|
|
14331
|
+
// directly after the root.
|
|
14332
|
+
parts.splice(i + 1, up);
|
|
14333
|
+
up = 0;
|
|
14334
|
+
} else {
|
|
14335
|
+
parts.splice(i, 2);
|
|
14336
|
+
up--;
|
|
14337
|
+
}
|
|
14338
|
+
}
|
|
14339
|
+
}
|
|
14340
|
+
path = parts.join('/');
|
|
14341
|
+
|
|
14342
|
+
if (path === '') {
|
|
14343
|
+
path = isAbsolute ? '/' : '.';
|
|
14344
|
+
}
|
|
14345
|
+
|
|
14346
|
+
if (url) {
|
|
14347
|
+
url.path = path;
|
|
14348
|
+
return urlGenerate(url);
|
|
14349
|
+
}
|
|
14350
|
+
return path;
|
|
14351
|
+
}
|
|
14352
|
+
exports.normalize = normalize;
|
|
14353
|
+
|
|
14354
|
+
/**
|
|
14355
|
+
* Joins two paths/URLs.
|
|
14356
|
+
*
|
|
14357
|
+
* @param aRoot The root path or URL.
|
|
14358
|
+
* @param aPath The path or URL to be joined with the root.
|
|
14359
|
+
*
|
|
14360
|
+
* - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
|
|
14361
|
+
* scheme-relative URL: Then the scheme of aRoot, if any, is prepended
|
|
14362
|
+
* first.
|
|
14363
|
+
* - Otherwise aPath is a path. If aRoot is a URL, then its path portion
|
|
14364
|
+
* is updated with the result and aRoot is returned. Otherwise the result
|
|
14365
|
+
* is returned.
|
|
14366
|
+
* - If aPath is absolute, the result is aPath.
|
|
14367
|
+
* - Otherwise the two paths are joined with a slash.
|
|
14368
|
+
* - Joining for example 'http://' and 'www.example.com' is also supported.
|
|
14369
|
+
*/
|
|
14370
|
+
function join(aRoot, aPath) {
|
|
14371
|
+
if (aRoot === "") {
|
|
14372
|
+
aRoot = ".";
|
|
14373
|
+
}
|
|
14374
|
+
if (aPath === "") {
|
|
14375
|
+
aPath = ".";
|
|
14376
|
+
}
|
|
14377
|
+
var aPathUrl = urlParse(aPath);
|
|
14378
|
+
var aRootUrl = urlParse(aRoot);
|
|
14379
|
+
if (aRootUrl) {
|
|
14380
|
+
aRoot = aRootUrl.path || '/';
|
|
14381
|
+
}
|
|
14382
|
+
|
|
14383
|
+
// `join(foo, '//www.example.org')`
|
|
14384
|
+
if (aPathUrl && !aPathUrl.scheme) {
|
|
14385
|
+
if (aRootUrl) {
|
|
14386
|
+
aPathUrl.scheme = aRootUrl.scheme;
|
|
14387
|
+
}
|
|
14388
|
+
return urlGenerate(aPathUrl);
|
|
14389
|
+
}
|
|
14390
|
+
|
|
14391
|
+
if (aPathUrl || aPath.match(dataUrlRegexp)) {
|
|
14392
|
+
return aPath;
|
|
14393
|
+
}
|
|
14394
|
+
|
|
14395
|
+
// `join('http://', 'www.example.com')`
|
|
14396
|
+
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
|
|
14397
|
+
aRootUrl.host = aPath;
|
|
14398
|
+
return urlGenerate(aRootUrl);
|
|
14399
|
+
}
|
|
14400
|
+
|
|
14401
|
+
var joined = aPath.charAt(0) === '/'
|
|
14402
|
+
? aPath
|
|
14403
|
+
: normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
|
|
14404
|
+
|
|
14405
|
+
if (aRootUrl) {
|
|
14406
|
+
aRootUrl.path = joined;
|
|
14407
|
+
return urlGenerate(aRootUrl);
|
|
14408
|
+
}
|
|
14409
|
+
return joined;
|
|
14410
|
+
}
|
|
14411
|
+
exports.join = join;
|
|
14412
|
+
|
|
14413
|
+
exports.isAbsolute = function (aPath) {
|
|
14414
|
+
return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
|
|
14415
|
+
};
|
|
14416
|
+
|
|
14417
|
+
/**
|
|
14418
|
+
* Make a path relative to a URL or another path.
|
|
14419
|
+
*
|
|
14420
|
+
* @param aRoot The root path or URL.
|
|
14421
|
+
* @param aPath The path or URL to be made relative to aRoot.
|
|
14422
|
+
*/
|
|
14423
|
+
function relative(aRoot, aPath) {
|
|
14424
|
+
if (aRoot === "") {
|
|
14425
|
+
aRoot = ".";
|
|
14426
|
+
}
|
|
14427
|
+
|
|
14428
|
+
aRoot = aRoot.replace(/\/$/, '');
|
|
14429
|
+
|
|
14430
|
+
// It is possible for the path to be above the root. In this case, simply
|
|
14431
|
+
// checking whether the root is a prefix of the path won't work. Instead, we
|
|
14432
|
+
// need to remove components from the root one by one, until either we find
|
|
14433
|
+
// a prefix that fits, or we run out of components to remove.
|
|
14434
|
+
var level = 0;
|
|
14435
|
+
while (aPath.indexOf(aRoot + '/') !== 0) {
|
|
14436
|
+
var index = aRoot.lastIndexOf("/");
|
|
14437
|
+
if (index < 0) {
|
|
14438
|
+
return aPath;
|
|
14439
|
+
}
|
|
14440
|
+
|
|
14441
|
+
// If the only part of the root that is left is the scheme (i.e. http://,
|
|
14442
|
+
// file:///, etc.), one or more slashes (/), or simply nothing at all, we
|
|
14443
|
+
// have exhausted all components, so the path is not relative to the root.
|
|
14444
|
+
aRoot = aRoot.slice(0, index);
|
|
14445
|
+
if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
|
|
14446
|
+
return aPath;
|
|
14447
|
+
}
|
|
14448
|
+
|
|
14449
|
+
++level;
|
|
14450
|
+
}
|
|
14451
|
+
|
|
14452
|
+
// Make sure we add a "../" for each component we removed from the root.
|
|
14453
|
+
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
|
14454
|
+
}
|
|
14455
|
+
exports.relative = relative;
|
|
14456
|
+
|
|
14457
|
+
var supportsNullProto = (function () {
|
|
14458
|
+
var obj = Object.create(null);
|
|
14459
|
+
return !('__proto__' in obj);
|
|
14460
|
+
}());
|
|
14461
|
+
|
|
14462
|
+
function identity (s) {
|
|
14463
|
+
return s;
|
|
14464
|
+
}
|
|
14465
|
+
|
|
14466
|
+
/**
|
|
14467
|
+
* Because behavior goes wacky when you set `__proto__` on objects, we
|
|
14468
|
+
* have to prefix all the strings in our set with an arbitrary character.
|
|
14469
|
+
*
|
|
14470
|
+
* See https://github.com/mozilla/source-map/pull/31 and
|
|
14471
|
+
* https://github.com/mozilla/source-map/issues/30
|
|
14472
|
+
*
|
|
14473
|
+
* @param String aStr
|
|
14474
|
+
*/
|
|
14475
|
+
function toSetString(aStr) {
|
|
14476
|
+
if (isProtoString(aStr)) {
|
|
14477
|
+
return '$' + aStr;
|
|
14478
|
+
}
|
|
14479
|
+
|
|
14480
|
+
return aStr;
|
|
14481
|
+
}
|
|
14482
|
+
exports.toSetString = supportsNullProto ? identity : toSetString;
|
|
14483
|
+
|
|
14484
|
+
function fromSetString(aStr) {
|
|
14485
|
+
if (isProtoString(aStr)) {
|
|
14486
|
+
return aStr.slice(1);
|
|
14487
|
+
}
|
|
14488
|
+
|
|
14489
|
+
return aStr;
|
|
14490
|
+
}
|
|
14491
|
+
exports.fromSetString = supportsNullProto ? identity : fromSetString;
|
|
14492
|
+
|
|
14493
|
+
function isProtoString(s) {
|
|
14494
|
+
if (!s) {
|
|
14495
|
+
return false;
|
|
14496
|
+
}
|
|
14497
|
+
|
|
14498
|
+
var length = s.length;
|
|
14499
|
+
|
|
14500
|
+
if (length < 9 /* "__proto__".length */) {
|
|
14501
|
+
return false;
|
|
14502
|
+
}
|
|
14503
|
+
|
|
14504
|
+
if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
|
|
14505
|
+
s.charCodeAt(length - 2) !== 95 /* '_' */ ||
|
|
14506
|
+
s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
|
|
14507
|
+
s.charCodeAt(length - 4) !== 116 /* 't' */ ||
|
|
14508
|
+
s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
|
|
14509
|
+
s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
|
|
14510
|
+
s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
|
|
14511
|
+
s.charCodeAt(length - 8) !== 95 /* '_' */ ||
|
|
14512
|
+
s.charCodeAt(length - 9) !== 95 /* '_' */) {
|
|
14513
|
+
return false;
|
|
14514
|
+
}
|
|
14515
|
+
|
|
14516
|
+
for (var i = length - 10; i >= 0; i--) {
|
|
14517
|
+
if (s.charCodeAt(i) !== 36 /* '$' */) {
|
|
14518
|
+
return false;
|
|
14519
|
+
}
|
|
14520
|
+
}
|
|
14521
|
+
|
|
14522
|
+
return true;
|
|
14523
|
+
}
|
|
14524
|
+
|
|
14525
|
+
/**
|
|
14526
|
+
* Comparator between two mappings where the original positions are compared.
|
|
14527
|
+
*
|
|
14528
|
+
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
|
|
14529
|
+
* mappings with the same original source/line/column, but different generated
|
|
14530
|
+
* line and column the same. Useful when searching for a mapping with a
|
|
14531
|
+
* stubbed out mapping.
|
|
14532
|
+
*/
|
|
14533
|
+
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
|
|
14534
|
+
var cmp = strcmp(mappingA.source, mappingB.source);
|
|
14535
|
+
if (cmp !== 0) {
|
|
14536
|
+
return cmp;
|
|
14537
|
+
}
|
|
14538
|
+
|
|
14539
|
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
|
14540
|
+
if (cmp !== 0) {
|
|
14541
|
+
return cmp;
|
|
14542
|
+
}
|
|
14543
|
+
|
|
14544
|
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
|
14545
|
+
if (cmp !== 0 || onlyCompareOriginal) {
|
|
14546
|
+
return cmp;
|
|
14547
|
+
}
|
|
14548
|
+
|
|
14549
|
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
|
14550
|
+
if (cmp !== 0) {
|
|
14551
|
+
return cmp;
|
|
14552
|
+
}
|
|
14553
|
+
|
|
14554
|
+
cmp = mappingA.generatedLine - mappingB.generatedLine;
|
|
14555
|
+
if (cmp !== 0) {
|
|
14556
|
+
return cmp;
|
|
14557
|
+
}
|
|
14558
|
+
|
|
14559
|
+
return strcmp(mappingA.name, mappingB.name);
|
|
14560
|
+
}
|
|
14561
|
+
exports.compareByOriginalPositions = compareByOriginalPositions;
|
|
14562
|
+
|
|
14563
|
+
/**
|
|
14564
|
+
* Comparator between two mappings with deflated source and name indices where
|
|
14565
|
+
* the generated positions are compared.
|
|
14566
|
+
*
|
|
14567
|
+
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
|
|
14568
|
+
* mappings with the same generated line and column, but different
|
|
14569
|
+
* source/name/original line and column the same. Useful when searching for a
|
|
14570
|
+
* mapping with a stubbed out mapping.
|
|
14571
|
+
*/
|
|
14572
|
+
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
|
|
14573
|
+
var cmp = mappingA.generatedLine - mappingB.generatedLine;
|
|
14574
|
+
if (cmp !== 0) {
|
|
14575
|
+
return cmp;
|
|
14576
|
+
}
|
|
14577
|
+
|
|
14578
|
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
|
14579
|
+
if (cmp !== 0 || onlyCompareGenerated) {
|
|
14580
|
+
return cmp;
|
|
14581
|
+
}
|
|
14582
|
+
|
|
14583
|
+
cmp = strcmp(mappingA.source, mappingB.source);
|
|
14584
|
+
if (cmp !== 0) {
|
|
14585
|
+
return cmp;
|
|
14586
|
+
}
|
|
14587
|
+
|
|
14588
|
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
|
14589
|
+
if (cmp !== 0) {
|
|
14590
|
+
return cmp;
|
|
14591
|
+
}
|
|
14592
|
+
|
|
14593
|
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
|
14594
|
+
if (cmp !== 0) {
|
|
14595
|
+
return cmp;
|
|
14596
|
+
}
|
|
14597
|
+
|
|
14598
|
+
return strcmp(mappingA.name, mappingB.name);
|
|
14599
|
+
}
|
|
14600
|
+
exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
|
|
14601
|
+
|
|
14602
|
+
function strcmp(aStr1, aStr2) {
|
|
14603
|
+
if (aStr1 === aStr2) {
|
|
14604
|
+
return 0;
|
|
14605
|
+
}
|
|
14606
|
+
|
|
14607
|
+
if (aStr1 === null) {
|
|
14608
|
+
return 1; // aStr2 !== null
|
|
14609
|
+
}
|
|
14610
|
+
|
|
14611
|
+
if (aStr2 === null) {
|
|
14612
|
+
return -1; // aStr1 !== null
|
|
14613
|
+
}
|
|
14614
|
+
|
|
14615
|
+
if (aStr1 > aStr2) {
|
|
14616
|
+
return 1;
|
|
14617
|
+
}
|
|
14618
|
+
|
|
14619
|
+
return -1;
|
|
14620
|
+
}
|
|
14621
|
+
|
|
14622
|
+
/**
|
|
14623
|
+
* Comparator between two mappings with inflated source and name strings where
|
|
14624
|
+
* the generated positions are compared.
|
|
14625
|
+
*/
|
|
14626
|
+
function compareByGeneratedPositionsInflated(mappingA, mappingB) {
|
|
14627
|
+
var cmp = mappingA.generatedLine - mappingB.generatedLine;
|
|
14628
|
+
if (cmp !== 0) {
|
|
14629
|
+
return cmp;
|
|
14630
|
+
}
|
|
14631
|
+
|
|
14632
|
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
|
14633
|
+
if (cmp !== 0) {
|
|
14634
|
+
return cmp;
|
|
14635
|
+
}
|
|
14636
|
+
|
|
14637
|
+
cmp = strcmp(mappingA.source, mappingB.source);
|
|
14638
|
+
if (cmp !== 0) {
|
|
14639
|
+
return cmp;
|
|
14640
|
+
}
|
|
14641
|
+
|
|
14642
|
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
|
14643
|
+
if (cmp !== 0) {
|
|
14644
|
+
return cmp;
|
|
14645
|
+
}
|
|
14646
|
+
|
|
14647
|
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
|
14648
|
+
if (cmp !== 0) {
|
|
14649
|
+
return cmp;
|
|
14650
|
+
}
|
|
14651
|
+
|
|
14652
|
+
return strcmp(mappingA.name, mappingB.name);
|
|
14653
|
+
}
|
|
14654
|
+
exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
|
|
14655
|
+
|
|
14656
|
+
/**
|
|
14657
|
+
* Strip any JSON XSSI avoidance prefix from the string (as documented
|
|
14658
|
+
* in the source maps specification), and then parse the string as
|
|
14659
|
+
* JSON.
|
|
14660
|
+
*/
|
|
14661
|
+
function parseSourceMapInput(str) {
|
|
14662
|
+
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
|
|
14663
|
+
}
|
|
14664
|
+
exports.parseSourceMapInput = parseSourceMapInput;
|
|
14665
|
+
|
|
14666
|
+
/**
|
|
14667
|
+
* Compute the URL of a source given the the source root, the source's
|
|
14668
|
+
* URL, and the source map's URL.
|
|
14669
|
+
*/
|
|
14670
|
+
function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
|
|
14671
|
+
sourceURL = sourceURL || '';
|
|
14672
|
+
|
|
14673
|
+
if (sourceRoot) {
|
|
14674
|
+
// This follows what Chrome does.
|
|
14675
|
+
if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
|
|
14676
|
+
sourceRoot += '/';
|
|
14677
|
+
}
|
|
14678
|
+
// The spec says:
|
|
14679
|
+
// Line 4: An optional source root, useful for relocating source
|
|
14680
|
+
// files on a server or removing repeated values in the
|
|
14681
|
+
// “sources” entry. This value is prepended to the individual
|
|
14682
|
+
// entries in the “source” field.
|
|
14683
|
+
sourceURL = sourceRoot + sourceURL;
|
|
14684
|
+
}
|
|
14685
|
+
|
|
14686
|
+
// Historically, SourceMapConsumer did not take the sourceMapURL as
|
|
14687
|
+
// a parameter. This mode is still somewhat supported, which is why
|
|
14688
|
+
// this code block is conditional. However, it's preferable to pass
|
|
14689
|
+
// the source map URL to SourceMapConsumer, so that this function
|
|
14690
|
+
// can implement the source URL resolution algorithm as outlined in
|
|
14691
|
+
// the spec. This block is basically the equivalent of:
|
|
14692
|
+
// new URL(sourceURL, sourceMapURL).toString()
|
|
14693
|
+
// ... except it avoids using URL, which wasn't available in the
|
|
14694
|
+
// older releases of node still supported by this library.
|
|
14695
|
+
//
|
|
14696
|
+
// The spec says:
|
|
14697
|
+
// If the sources are not absolute URLs after prepending of the
|
|
14698
|
+
// “sourceRoot”, the sources are resolved relative to the
|
|
14699
|
+
// SourceMap (like resolving script src in a html document).
|
|
14700
|
+
if (sourceMapURL) {
|
|
14701
|
+
var parsed = urlParse(sourceMapURL);
|
|
14702
|
+
if (!parsed) {
|
|
14703
|
+
throw new Error("sourceMapURL could not be parsed");
|
|
14704
|
+
}
|
|
14705
|
+
if (parsed.path) {
|
|
14706
|
+
// Strip the last path component, but keep the "/".
|
|
14707
|
+
var index = parsed.path.lastIndexOf('/');
|
|
14708
|
+
if (index >= 0) {
|
|
14709
|
+
parsed.path = parsed.path.substring(0, index + 1);
|
|
14710
|
+
}
|
|
14711
|
+
}
|
|
14712
|
+
sourceURL = join(urlGenerate(parsed), sourceURL);
|
|
14713
|
+
}
|
|
14714
|
+
|
|
14715
|
+
return normalize(sourceURL);
|
|
14716
|
+
}
|
|
14717
|
+
exports.computeSourceURL = computeSourceURL;
|
|
14718
|
+
});
|
|
14719
|
+
|
|
14720
|
+
var util_1 = util.getArg;
|
|
14721
|
+
var util_2 = util.urlParse;
|
|
14722
|
+
var util_3 = util.urlGenerate;
|
|
14723
|
+
var util_4 = util.normalize;
|
|
14724
|
+
var util_5 = util.join;
|
|
14725
|
+
var util_6 = util.isAbsolute;
|
|
14726
|
+
var util_7 = util.relative;
|
|
14727
|
+
var util_8 = util.toSetString;
|
|
14728
|
+
var util_9 = util.fromSetString;
|
|
14729
|
+
var util_10 = util.compareByOriginalPositions;
|
|
14730
|
+
var util_11 = util.compareByGeneratedPositionsDeflated;
|
|
14731
|
+
var util_12 = util.compareByGeneratedPositionsInflated;
|
|
14732
|
+
var util_13 = util.parseSourceMapInput;
|
|
14733
|
+
var util_14 = util.computeSourceURL;
|
|
14734
|
+
|
|
14735
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
14736
|
+
/*
|
|
14737
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
14738
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
14739
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
14740
|
+
*/
|
|
14741
|
+
|
|
14742
|
+
|
|
14743
|
+
var has$1 = Object.prototype.hasOwnProperty;
|
|
14744
|
+
var hasNativeMap = typeof Map !== "undefined";
|
|
14745
|
+
|
|
14746
|
+
/**
|
|
14747
|
+
* A data structure which is a combination of an array and a set. Adding a new
|
|
14748
|
+
* member is O(1), testing for membership is O(1), and finding the index of an
|
|
14749
|
+
* element is O(1). Removing elements from the set is not supported. Only
|
|
14750
|
+
* strings are supported for membership.
|
|
14751
|
+
*/
|
|
14752
|
+
function ArraySet$1() {
|
|
14753
|
+
this._array = [];
|
|
14754
|
+
this._set = hasNativeMap ? new Map() : Object.create(null);
|
|
14755
|
+
}
|
|
14756
|
+
|
|
14757
|
+
/**
|
|
14758
|
+
* Static method for creating ArraySet instances from an existing array.
|
|
14759
|
+
*/
|
|
14760
|
+
ArraySet$1.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
|
|
14761
|
+
var set = new ArraySet$1();
|
|
14762
|
+
for (var i = 0, len = aArray.length; i < len; i++) {
|
|
14763
|
+
set.add(aArray[i], aAllowDuplicates);
|
|
14764
|
+
}
|
|
14765
|
+
return set;
|
|
14766
|
+
};
|
|
14767
|
+
|
|
14768
|
+
/**
|
|
14769
|
+
* Return how many unique items are in this ArraySet. If duplicates have been
|
|
14770
|
+
* added, than those do not count towards the size.
|
|
14771
|
+
*
|
|
14772
|
+
* @returns Number
|
|
14773
|
+
*/
|
|
14774
|
+
ArraySet$1.prototype.size = function ArraySet_size() {
|
|
14775
|
+
return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
|
|
14776
|
+
};
|
|
14777
|
+
|
|
14778
|
+
/**
|
|
14779
|
+
* Add the given string to this set.
|
|
14780
|
+
*
|
|
14781
|
+
* @param String aStr
|
|
14782
|
+
*/
|
|
14783
|
+
ArraySet$1.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
|
|
14784
|
+
var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
|
|
14785
|
+
var isDuplicate = hasNativeMap ? this.has(aStr) : has$1.call(this._set, sStr);
|
|
14786
|
+
var idx = this._array.length;
|
|
14787
|
+
if (!isDuplicate || aAllowDuplicates) {
|
|
14788
|
+
this._array.push(aStr);
|
|
14789
|
+
}
|
|
14790
|
+
if (!isDuplicate) {
|
|
14791
|
+
if (hasNativeMap) {
|
|
14792
|
+
this._set.set(aStr, idx);
|
|
14793
|
+
} else {
|
|
14794
|
+
this._set[sStr] = idx;
|
|
14795
|
+
}
|
|
14796
|
+
}
|
|
14797
|
+
};
|
|
14798
|
+
|
|
14799
|
+
/**
|
|
14800
|
+
* Is the given string a member of this set?
|
|
14801
|
+
*
|
|
14802
|
+
* @param String aStr
|
|
14803
|
+
*/
|
|
14804
|
+
ArraySet$1.prototype.has = function ArraySet_has(aStr) {
|
|
14805
|
+
if (hasNativeMap) {
|
|
14806
|
+
return this._set.has(aStr);
|
|
14807
|
+
} else {
|
|
14808
|
+
var sStr = util.toSetString(aStr);
|
|
14809
|
+
return has$1.call(this._set, sStr);
|
|
14810
|
+
}
|
|
14811
|
+
};
|
|
14812
|
+
|
|
14813
|
+
/**
|
|
14814
|
+
* What is the index of the given string in the array?
|
|
14815
|
+
*
|
|
14816
|
+
* @param String aStr
|
|
14817
|
+
*/
|
|
14818
|
+
ArraySet$1.prototype.indexOf = function ArraySet_indexOf(aStr) {
|
|
14819
|
+
if (hasNativeMap) {
|
|
14820
|
+
var idx = this._set.get(aStr);
|
|
14821
|
+
if (idx >= 0) {
|
|
14822
|
+
return idx;
|
|
14823
|
+
}
|
|
14824
|
+
} else {
|
|
14825
|
+
var sStr = util.toSetString(aStr);
|
|
14826
|
+
if (has$1.call(this._set, sStr)) {
|
|
14827
|
+
return this._set[sStr];
|
|
14828
|
+
}
|
|
14829
|
+
}
|
|
14830
|
+
|
|
14831
|
+
throw new Error('"' + aStr + '" is not in the set.');
|
|
14832
|
+
};
|
|
14833
|
+
|
|
14834
|
+
/**
|
|
14835
|
+
* What is the element at the given index?
|
|
14836
|
+
*
|
|
14837
|
+
* @param Number aIdx
|
|
14838
|
+
*/
|
|
14839
|
+
ArraySet$1.prototype.at = function ArraySet_at(aIdx) {
|
|
14840
|
+
if (aIdx >= 0 && aIdx < this._array.length) {
|
|
14841
|
+
return this._array[aIdx];
|
|
14842
|
+
}
|
|
14843
|
+
throw new Error('No element indexed by ' + aIdx);
|
|
14844
|
+
};
|
|
14845
|
+
|
|
14846
|
+
/**
|
|
14847
|
+
* Returns the array representation of this set (which has the proper indices
|
|
14848
|
+
* indicated by indexOf). Note that this is a copy of the internal array used
|
|
14849
|
+
* for storing the members so that no one can mess with internal state.
|
|
14850
|
+
*/
|
|
14851
|
+
ArraySet$1.prototype.toArray = function ArraySet_toArray() {
|
|
14852
|
+
return this._array.slice();
|
|
14853
|
+
};
|
|
14854
|
+
|
|
14855
|
+
var ArraySet_1 = ArraySet$1;
|
|
14856
|
+
|
|
14857
|
+
var arraySet = {
|
|
14858
|
+
ArraySet: ArraySet_1
|
|
14859
|
+
};
|
|
14860
|
+
|
|
14861
|
+
var binarySearch = createCommonjsModule(function (module, exports) {
|
|
14862
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
14863
|
+
/*
|
|
14864
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
14865
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
14866
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
14867
|
+
*/
|
|
14868
|
+
|
|
14869
|
+
exports.GREATEST_LOWER_BOUND = 1;
|
|
14870
|
+
exports.LEAST_UPPER_BOUND = 2;
|
|
14871
|
+
|
|
14872
|
+
/**
|
|
14873
|
+
* Recursive implementation of binary search.
|
|
14874
|
+
*
|
|
14875
|
+
* @param aLow Indices here and lower do not contain the needle.
|
|
14876
|
+
* @param aHigh Indices here and higher do not contain the needle.
|
|
14877
|
+
* @param aNeedle The element being searched for.
|
|
14878
|
+
* @param aHaystack The non-empty array being searched.
|
|
14879
|
+
* @param aCompare Function which takes two elements and returns -1, 0, or 1.
|
|
14880
|
+
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
|
|
14881
|
+
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
|
|
14882
|
+
* closest element that is smaller than or greater than the one we are
|
|
14883
|
+
* searching for, respectively, if the exact element cannot be found.
|
|
14884
|
+
*/
|
|
14885
|
+
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
|
|
14886
|
+
// This function terminates when one of the following is true:
|
|
14887
|
+
//
|
|
14888
|
+
// 1. We find the exact element we are looking for.
|
|
14889
|
+
//
|
|
14890
|
+
// 2. We did not find the exact element, but we can return the index of
|
|
14891
|
+
// the next-closest element.
|
|
14892
|
+
//
|
|
14893
|
+
// 3. We did not find the exact element, and there is no next-closest
|
|
14894
|
+
// element than the one we are searching for, so we return -1.
|
|
14895
|
+
var mid = Math.floor((aHigh - aLow) / 2) + aLow;
|
|
14896
|
+
var cmp = aCompare(aNeedle, aHaystack[mid], true);
|
|
14897
|
+
if (cmp === 0) {
|
|
14898
|
+
// Found the element we are looking for.
|
|
14899
|
+
return mid;
|
|
14900
|
+
}
|
|
14901
|
+
else if (cmp > 0) {
|
|
14902
|
+
// Our needle is greater than aHaystack[mid].
|
|
14903
|
+
if (aHigh - mid > 1) {
|
|
14904
|
+
// The element is in the upper half.
|
|
14905
|
+
return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
|
|
14906
|
+
}
|
|
14907
|
+
|
|
14908
|
+
// The exact needle element was not found in this haystack. Determine if
|
|
14909
|
+
// we are in termination case (3) or (2) and return the appropriate thing.
|
|
14910
|
+
if (aBias == exports.LEAST_UPPER_BOUND) {
|
|
14911
|
+
return aHigh < aHaystack.length ? aHigh : -1;
|
|
14912
|
+
} else {
|
|
14913
|
+
return mid;
|
|
14914
|
+
}
|
|
14915
|
+
}
|
|
14916
|
+
else {
|
|
14917
|
+
// Our needle is less than aHaystack[mid].
|
|
14918
|
+
if (mid - aLow > 1) {
|
|
14919
|
+
// The element is in the lower half.
|
|
14920
|
+
return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
|
|
14921
|
+
}
|
|
14922
|
+
|
|
14923
|
+
// we are in termination case (3) or (2) and return the appropriate thing.
|
|
14924
|
+
if (aBias == exports.LEAST_UPPER_BOUND) {
|
|
14925
|
+
return mid;
|
|
14926
|
+
} else {
|
|
14927
|
+
return aLow < 0 ? -1 : aLow;
|
|
14928
|
+
}
|
|
14929
|
+
}
|
|
14930
|
+
}
|
|
14931
|
+
|
|
14932
|
+
/**
|
|
14933
|
+
* This is an implementation of binary search which will always try and return
|
|
14934
|
+
* the index of the closest element if there is no exact hit. This is because
|
|
14935
|
+
* mappings between original and generated line/col pairs are single points,
|
|
14936
|
+
* and there is an implicit region between each of them, so a miss just means
|
|
14937
|
+
* that you aren't on the very start of a region.
|
|
14938
|
+
*
|
|
14939
|
+
* @param aNeedle The element you are looking for.
|
|
14940
|
+
* @param aHaystack The array that is being searched.
|
|
14941
|
+
* @param aCompare A function which takes the needle and an element in the
|
|
14942
|
+
* array and returns -1, 0, or 1 depending on whether the needle is less
|
|
14943
|
+
* than, equal to, or greater than the element, respectively.
|
|
14944
|
+
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
|
|
14945
|
+
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
|
|
14946
|
+
* closest element that is smaller than or greater than the one we are
|
|
14947
|
+
* searching for, respectively, if the exact element cannot be found.
|
|
14948
|
+
* Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
|
|
14949
|
+
*/
|
|
14950
|
+
exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
|
|
14951
|
+
if (aHaystack.length === 0) {
|
|
14952
|
+
return -1;
|
|
14953
|
+
}
|
|
14954
|
+
|
|
14955
|
+
var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
|
|
14956
|
+
aCompare, aBias || exports.GREATEST_LOWER_BOUND);
|
|
14957
|
+
if (index < 0) {
|
|
14958
|
+
return -1;
|
|
14959
|
+
}
|
|
14960
|
+
|
|
14961
|
+
// We have found either the exact element, or the next-closest element than
|
|
14962
|
+
// the one we are searching for. However, there may be more than one such
|
|
14963
|
+
// element. Make sure we always return the smallest of these.
|
|
14964
|
+
while (index - 1 >= 0) {
|
|
14965
|
+
if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
|
|
14966
|
+
break;
|
|
14967
|
+
}
|
|
14968
|
+
--index;
|
|
14969
|
+
}
|
|
14970
|
+
|
|
14971
|
+
return index;
|
|
14972
|
+
};
|
|
14973
|
+
});
|
|
14974
|
+
|
|
14975
|
+
var binarySearch_1 = binarySearch.GREATEST_LOWER_BOUND;
|
|
14976
|
+
var binarySearch_2 = binarySearch.LEAST_UPPER_BOUND;
|
|
14977
|
+
var binarySearch_3 = binarySearch.search;
|
|
14978
|
+
|
|
14979
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
14980
|
+
/*
|
|
14981
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
14982
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
14983
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
14984
|
+
*/
|
|
14985
|
+
|
|
14986
|
+
// It turns out that some (most?) JavaScript engines don't self-host
|
|
14987
|
+
// `Array.prototype.sort`. This makes sense because C++ will likely remain
|
|
14988
|
+
// faster than JS when doing raw CPU-intensive sorting. However, when using a
|
|
14989
|
+
// custom comparator function, calling back and forth between the VM's C++ and
|
|
14990
|
+
// JIT'd JS is rather slow *and* loses JIT type information, resulting in
|
|
14991
|
+
// worse generated code for the comparator function than would be optimal. In
|
|
14992
|
+
// fact, when sorting with a comparator, these costs outweigh the benefits of
|
|
14993
|
+
// sorting in C++. By using our own JS-implemented Quick Sort (below), we get
|
|
14994
|
+
// a ~3500ms mean speed-up in `bench/bench.html`.
|
|
14995
|
+
|
|
14996
|
+
/**
|
|
14997
|
+
* Swap the elements indexed by `x` and `y` in the array `ary`.
|
|
14998
|
+
*
|
|
14999
|
+
* @param {Array} ary
|
|
15000
|
+
* The array.
|
|
15001
|
+
* @param {Number} x
|
|
15002
|
+
* The index of the first item.
|
|
15003
|
+
* @param {Number} y
|
|
15004
|
+
* The index of the second item.
|
|
15005
|
+
*/
|
|
15006
|
+
function swap(ary, x, y) {
|
|
15007
|
+
var temp = ary[x];
|
|
15008
|
+
ary[x] = ary[y];
|
|
15009
|
+
ary[y] = temp;
|
|
15010
|
+
}
|
|
15011
|
+
|
|
15012
|
+
/**
|
|
15013
|
+
* Returns a random integer within the range `low .. high` inclusive.
|
|
15014
|
+
*
|
|
15015
|
+
* @param {Number} low
|
|
15016
|
+
* The lower bound on the range.
|
|
15017
|
+
* @param {Number} high
|
|
15018
|
+
* The upper bound on the range.
|
|
15019
|
+
*/
|
|
15020
|
+
function randomIntInRange(low, high) {
|
|
15021
|
+
return Math.round(low + (Math.random() * (high - low)));
|
|
15022
|
+
}
|
|
15023
|
+
|
|
15024
|
+
/**
|
|
15025
|
+
* The Quick Sort algorithm.
|
|
15026
|
+
*
|
|
15027
|
+
* @param {Array} ary
|
|
15028
|
+
* An array to sort.
|
|
15029
|
+
* @param {function} comparator
|
|
15030
|
+
* Function to use to compare two items.
|
|
15031
|
+
* @param {Number} p
|
|
15032
|
+
* Start index of the array
|
|
15033
|
+
* @param {Number} r
|
|
15034
|
+
* End index of the array
|
|
15035
|
+
*/
|
|
15036
|
+
function doQuickSort(ary, comparator, p, r) {
|
|
15037
|
+
// If our lower bound is less than our upper bound, we (1) partition the
|
|
15038
|
+
// array into two pieces and (2) recurse on each half. If it is not, this is
|
|
15039
|
+
// the empty array and our base case.
|
|
15040
|
+
|
|
15041
|
+
if (p < r) {
|
|
15042
|
+
// (1) Partitioning.
|
|
15043
|
+
//
|
|
15044
|
+
// The partitioning chooses a pivot between `p` and `r` and moves all
|
|
15045
|
+
// elements that are less than or equal to the pivot to the before it, and
|
|
15046
|
+
// all the elements that are greater than it after it. The effect is that
|
|
15047
|
+
// once partition is done, the pivot is in the exact place it will be when
|
|
15048
|
+
// the array is put in sorted order, and it will not need to be moved
|
|
15049
|
+
// again. This runs in O(n) time.
|
|
15050
|
+
|
|
15051
|
+
// Always choose a random pivot so that an input array which is reverse
|
|
15052
|
+
// sorted does not cause O(n^2) running time.
|
|
15053
|
+
var pivotIndex = randomIntInRange(p, r);
|
|
15054
|
+
var i = p - 1;
|
|
15055
|
+
|
|
15056
|
+
swap(ary, pivotIndex, r);
|
|
15057
|
+
var pivot = ary[r];
|
|
15058
|
+
|
|
15059
|
+
// Immediately after `j` is incremented in this loop, the following hold
|
|
15060
|
+
// true:
|
|
15061
|
+
//
|
|
15062
|
+
// * Every element in `ary[p .. i]` is less than or equal to the pivot.
|
|
15063
|
+
//
|
|
15064
|
+
// * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
|
|
15065
|
+
for (var j = p; j < r; j++) {
|
|
15066
|
+
if (comparator(ary[j], pivot) <= 0) {
|
|
15067
|
+
i += 1;
|
|
15068
|
+
swap(ary, i, j);
|
|
15069
|
+
}
|
|
15070
|
+
}
|
|
15071
|
+
|
|
15072
|
+
swap(ary, i + 1, j);
|
|
15073
|
+
var q = i + 1;
|
|
15074
|
+
|
|
15075
|
+
// (2) Recurse on each half.
|
|
15076
|
+
|
|
15077
|
+
doQuickSort(ary, comparator, p, q - 1);
|
|
15078
|
+
doQuickSort(ary, comparator, q + 1, r);
|
|
15079
|
+
}
|
|
15080
|
+
}
|
|
15081
|
+
|
|
15082
|
+
/**
|
|
15083
|
+
* Sort the given array in-place with the given comparator function.
|
|
15084
|
+
*
|
|
15085
|
+
* @param {Array} ary
|
|
15086
|
+
* An array to sort.
|
|
15087
|
+
* @param {function} comparator
|
|
15088
|
+
* Function to use to compare two items.
|
|
15089
|
+
*/
|
|
15090
|
+
var quickSort_1 = function (ary, comparator) {
|
|
15091
|
+
doQuickSort(ary, comparator, 0, ary.length - 1);
|
|
15092
|
+
};
|
|
15093
|
+
|
|
15094
|
+
var quickSort$1 = {
|
|
15095
|
+
quickSort: quickSort_1
|
|
15096
|
+
};
|
|
15097
|
+
|
|
15098
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
15099
|
+
/*
|
|
15100
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
15101
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
15102
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
15103
|
+
*/
|
|
15104
|
+
|
|
15105
|
+
|
|
15106
|
+
|
|
15107
|
+
var ArraySet$2 = arraySet.ArraySet;
|
|
15108
|
+
|
|
15109
|
+
var quickSort = quickSort$1.quickSort;
|
|
15110
|
+
|
|
15111
|
+
function SourceMapConsumer$1(aSourceMap, aSourceMapURL) {
|
|
15112
|
+
var sourceMap = aSourceMap;
|
|
15113
|
+
if (typeof aSourceMap === 'string') {
|
|
15114
|
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
15115
|
+
}
|
|
15116
|
+
|
|
15117
|
+
return sourceMap.sections != null
|
|
15118
|
+
? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)
|
|
15119
|
+
: new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
|
|
15120
|
+
}
|
|
15121
|
+
|
|
15122
|
+
SourceMapConsumer$1.fromSourceMap = function(aSourceMap, aSourceMapURL) {
|
|
15123
|
+
return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
|
|
15124
|
+
};
|
|
15125
|
+
|
|
15126
|
+
/**
|
|
15127
|
+
* The version of the source mapping spec that we are consuming.
|
|
15128
|
+
*/
|
|
15129
|
+
SourceMapConsumer$1.prototype._version = 3;
|
|
15130
|
+
|
|
15131
|
+
// `__generatedMappings` and `__originalMappings` are arrays that hold the
|
|
15132
|
+
// parsed mapping coordinates from the source map's "mappings" attribute. They
|
|
15133
|
+
// are lazily instantiated, accessed via the `_generatedMappings` and
|
|
15134
|
+
// `_originalMappings` getters respectively, and we only parse the mappings
|
|
15135
|
+
// and create these arrays once queried for a source location. We jump through
|
|
15136
|
+
// these hoops because there can be many thousands of mappings, and parsing
|
|
15137
|
+
// them is expensive, so we only want to do it if we must.
|
|
15138
|
+
//
|
|
15139
|
+
// Each object in the arrays is of the form:
|
|
15140
|
+
//
|
|
15141
|
+
// {
|
|
15142
|
+
// generatedLine: The line number in the generated code,
|
|
15143
|
+
// generatedColumn: The column number in the generated code,
|
|
15144
|
+
// source: The path to the original source file that generated this
|
|
15145
|
+
// chunk of code,
|
|
15146
|
+
// originalLine: The line number in the original source that
|
|
15147
|
+
// corresponds to this chunk of generated code,
|
|
15148
|
+
// originalColumn: The column number in the original source that
|
|
15149
|
+
// corresponds to this chunk of generated code,
|
|
15150
|
+
// name: The name of the original symbol which generated this chunk of
|
|
15151
|
+
// code.
|
|
15152
|
+
// }
|
|
15153
|
+
//
|
|
15154
|
+
// All properties except for `generatedLine` and `generatedColumn` can be
|
|
15155
|
+
// `null`.
|
|
15156
|
+
//
|
|
15157
|
+
// `_generatedMappings` is ordered by the generated positions.
|
|
15158
|
+
//
|
|
15159
|
+
// `_originalMappings` is ordered by the original positions.
|
|
15160
|
+
|
|
15161
|
+
SourceMapConsumer$1.prototype.__generatedMappings = null;
|
|
15162
|
+
Object.defineProperty(SourceMapConsumer$1.prototype, '_generatedMappings', {
|
|
15163
|
+
configurable: true,
|
|
15164
|
+
enumerable: true,
|
|
15165
|
+
get: function () {
|
|
15166
|
+
if (!this.__generatedMappings) {
|
|
15167
|
+
this._parseMappings(this._mappings, this.sourceRoot);
|
|
15168
|
+
}
|
|
15169
|
+
|
|
15170
|
+
return this.__generatedMappings;
|
|
15171
|
+
}
|
|
15172
|
+
});
|
|
15173
|
+
|
|
15174
|
+
SourceMapConsumer$1.prototype.__originalMappings = null;
|
|
15175
|
+
Object.defineProperty(SourceMapConsumer$1.prototype, '_originalMappings', {
|
|
15176
|
+
configurable: true,
|
|
15177
|
+
enumerable: true,
|
|
15178
|
+
get: function () {
|
|
15179
|
+
if (!this.__originalMappings) {
|
|
15180
|
+
this._parseMappings(this._mappings, this.sourceRoot);
|
|
15181
|
+
}
|
|
15182
|
+
|
|
15183
|
+
return this.__originalMappings;
|
|
15184
|
+
}
|
|
15185
|
+
});
|
|
15186
|
+
|
|
15187
|
+
SourceMapConsumer$1.prototype._charIsMappingSeparator =
|
|
15188
|
+
function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
|
|
15189
|
+
var c = aStr.charAt(index);
|
|
15190
|
+
return c === ";" || c === ",";
|
|
15191
|
+
};
|
|
15192
|
+
|
|
15193
|
+
/**
|
|
15194
|
+
* Parse the mappings in a string in to a data structure which we can easily
|
|
15195
|
+
* query (the ordered arrays in the `this.__generatedMappings` and
|
|
15196
|
+
* `this.__originalMappings` properties).
|
|
15197
|
+
*/
|
|
15198
|
+
SourceMapConsumer$1.prototype._parseMappings =
|
|
15199
|
+
function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
|
|
15200
|
+
throw new Error("Subclasses must implement _parseMappings");
|
|
15201
|
+
};
|
|
15202
|
+
|
|
15203
|
+
SourceMapConsumer$1.GENERATED_ORDER = 1;
|
|
15204
|
+
SourceMapConsumer$1.ORIGINAL_ORDER = 2;
|
|
15205
|
+
|
|
15206
|
+
SourceMapConsumer$1.GREATEST_LOWER_BOUND = 1;
|
|
15207
|
+
SourceMapConsumer$1.LEAST_UPPER_BOUND = 2;
|
|
15208
|
+
|
|
15209
|
+
/**
|
|
15210
|
+
* Iterate over each mapping between an original source/line/column and a
|
|
15211
|
+
* generated line/column in this source map.
|
|
15212
|
+
*
|
|
15213
|
+
* @param Function aCallback
|
|
15214
|
+
* The function that is called with each mapping.
|
|
15215
|
+
* @param Object aContext
|
|
15216
|
+
* Optional. If specified, this object will be the value of `this` every
|
|
15217
|
+
* time that `aCallback` is called.
|
|
15218
|
+
* @param aOrder
|
|
15219
|
+
* Either `SourceMapConsumer.GENERATED_ORDER` or
|
|
15220
|
+
* `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
|
|
15221
|
+
* iterate over the mappings sorted by the generated file's line/column
|
|
15222
|
+
* order or the original's source/line/column order, respectively. Defaults to
|
|
15223
|
+
* `SourceMapConsumer.GENERATED_ORDER`.
|
|
15224
|
+
*/
|
|
15225
|
+
SourceMapConsumer$1.prototype.eachMapping =
|
|
15226
|
+
function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
|
|
15227
|
+
var context = aContext || null;
|
|
15228
|
+
var order = aOrder || SourceMapConsumer$1.GENERATED_ORDER;
|
|
15229
|
+
|
|
15230
|
+
var mappings;
|
|
15231
|
+
switch (order) {
|
|
15232
|
+
case SourceMapConsumer$1.GENERATED_ORDER:
|
|
15233
|
+
mappings = this._generatedMappings;
|
|
15234
|
+
break;
|
|
15235
|
+
case SourceMapConsumer$1.ORIGINAL_ORDER:
|
|
15236
|
+
mappings = this._originalMappings;
|
|
15237
|
+
break;
|
|
15238
|
+
default:
|
|
15239
|
+
throw new Error("Unknown order of iteration.");
|
|
15240
|
+
}
|
|
15241
|
+
|
|
15242
|
+
var sourceRoot = this.sourceRoot;
|
|
15243
|
+
mappings.map(function (mapping) {
|
|
15244
|
+
var source = mapping.source === null ? null : this._sources.at(mapping.source);
|
|
15245
|
+
source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);
|
|
15246
|
+
return {
|
|
15247
|
+
source: source,
|
|
15248
|
+
generatedLine: mapping.generatedLine,
|
|
15249
|
+
generatedColumn: mapping.generatedColumn,
|
|
15250
|
+
originalLine: mapping.originalLine,
|
|
15251
|
+
originalColumn: mapping.originalColumn,
|
|
15252
|
+
name: mapping.name === null ? null : this._names.at(mapping.name)
|
|
15253
|
+
};
|
|
15254
|
+
}, this).forEach(aCallback, context);
|
|
15255
|
+
};
|
|
15256
|
+
|
|
15257
|
+
/**
|
|
15258
|
+
* Returns all generated line and column information for the original source,
|
|
15259
|
+
* line, and column provided. If no column is provided, returns all mappings
|
|
15260
|
+
* corresponding to a either the line we are searching for or the next
|
|
15261
|
+
* closest line that has any mappings. Otherwise, returns all mappings
|
|
15262
|
+
* corresponding to the given line and either the column we are searching for
|
|
15263
|
+
* or the next closest column that has any offsets.
|
|
15264
|
+
*
|
|
15265
|
+
* The only argument is an object with the following properties:
|
|
15266
|
+
*
|
|
15267
|
+
* - source: The filename of the original source.
|
|
15268
|
+
* - line: The line number in the original source. The line number is 1-based.
|
|
15269
|
+
* - column: Optional. the column number in the original source.
|
|
15270
|
+
* The column number is 0-based.
|
|
15271
|
+
*
|
|
15272
|
+
* and an array of objects is returned, each with the following properties:
|
|
15273
|
+
*
|
|
15274
|
+
* - line: The line number in the generated source, or null. The
|
|
15275
|
+
* line number is 1-based.
|
|
15276
|
+
* - column: The column number in the generated source, or null.
|
|
15277
|
+
* The column number is 0-based.
|
|
15278
|
+
*/
|
|
15279
|
+
SourceMapConsumer$1.prototype.allGeneratedPositionsFor =
|
|
15280
|
+
function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
|
|
15281
|
+
var line = util.getArg(aArgs, 'line');
|
|
15282
|
+
|
|
15283
|
+
// When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
|
|
15284
|
+
// returns the index of the closest mapping less than the needle. By
|
|
15285
|
+
// setting needle.originalColumn to 0, we thus find the last mapping for
|
|
15286
|
+
// the given line, provided such a mapping exists.
|
|
15287
|
+
var needle = {
|
|
15288
|
+
source: util.getArg(aArgs, 'source'),
|
|
15289
|
+
originalLine: line,
|
|
15290
|
+
originalColumn: util.getArg(aArgs, 'column', 0)
|
|
15291
|
+
};
|
|
15292
|
+
|
|
15293
|
+
needle.source = this._findSourceIndex(needle.source);
|
|
15294
|
+
if (needle.source < 0) {
|
|
15295
|
+
return [];
|
|
15296
|
+
}
|
|
15297
|
+
|
|
15298
|
+
var mappings = [];
|
|
15299
|
+
|
|
15300
|
+
var index = this._findMapping(needle,
|
|
15301
|
+
this._originalMappings,
|
|
15302
|
+
"originalLine",
|
|
15303
|
+
"originalColumn",
|
|
15304
|
+
util.compareByOriginalPositions,
|
|
15305
|
+
binarySearch.LEAST_UPPER_BOUND);
|
|
15306
|
+
if (index >= 0) {
|
|
15307
|
+
var mapping = this._originalMappings[index];
|
|
15308
|
+
|
|
15309
|
+
if (aArgs.column === undefined) {
|
|
15310
|
+
var originalLine = mapping.originalLine;
|
|
15311
|
+
|
|
15312
|
+
// Iterate until either we run out of mappings, or we run into
|
|
15313
|
+
// a mapping for a different line than the one we found. Since
|
|
15314
|
+
// mappings are sorted, this is guaranteed to find all mappings for
|
|
15315
|
+
// the line we found.
|
|
15316
|
+
while (mapping && mapping.originalLine === originalLine) {
|
|
15317
|
+
mappings.push({
|
|
15318
|
+
line: util.getArg(mapping, 'generatedLine', null),
|
|
15319
|
+
column: util.getArg(mapping, 'generatedColumn', null),
|
|
15320
|
+
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
|
|
15321
|
+
});
|
|
15322
|
+
|
|
15323
|
+
mapping = this._originalMappings[++index];
|
|
15324
|
+
}
|
|
15325
|
+
} else {
|
|
15326
|
+
var originalColumn = mapping.originalColumn;
|
|
15327
|
+
|
|
15328
|
+
// Iterate until either we run out of mappings, or we run into
|
|
15329
|
+
// a mapping for a different line than the one we were searching for.
|
|
15330
|
+
// Since mappings are sorted, this is guaranteed to find all mappings for
|
|
15331
|
+
// the line we are searching for.
|
|
15332
|
+
while (mapping &&
|
|
15333
|
+
mapping.originalLine === line &&
|
|
15334
|
+
mapping.originalColumn == originalColumn) {
|
|
15335
|
+
mappings.push({
|
|
15336
|
+
line: util.getArg(mapping, 'generatedLine', null),
|
|
15337
|
+
column: util.getArg(mapping, 'generatedColumn', null),
|
|
15338
|
+
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
|
|
15339
|
+
});
|
|
15340
|
+
|
|
15341
|
+
mapping = this._originalMappings[++index];
|
|
15342
|
+
}
|
|
15343
|
+
}
|
|
15344
|
+
}
|
|
15345
|
+
|
|
15346
|
+
return mappings;
|
|
15347
|
+
};
|
|
15348
|
+
|
|
15349
|
+
var SourceMapConsumer_1 = SourceMapConsumer$1;
|
|
15350
|
+
|
|
15351
|
+
/**
|
|
15352
|
+
* A BasicSourceMapConsumer instance represents a parsed source map which we can
|
|
15353
|
+
* query for information about the original file positions by giving it a file
|
|
15354
|
+
* position in the generated source.
|
|
15355
|
+
*
|
|
15356
|
+
* The first parameter is the raw source map (either as a JSON string, or
|
|
15357
|
+
* already parsed to an object). According to the spec, source maps have the
|
|
15358
|
+
* following attributes:
|
|
15359
|
+
*
|
|
15360
|
+
* - version: Which version of the source map spec this map is following.
|
|
15361
|
+
* - sources: An array of URLs to the original source files.
|
|
15362
|
+
* - names: An array of identifiers which can be referrenced by individual mappings.
|
|
15363
|
+
* - sourceRoot: Optional. The URL root from which all sources are relative.
|
|
15364
|
+
* - sourcesContent: Optional. An array of contents of the original source files.
|
|
15365
|
+
* - mappings: A string of base64 VLQs which contain the actual mappings.
|
|
15366
|
+
* - file: Optional. The generated file this source map is associated with.
|
|
15367
|
+
*
|
|
15368
|
+
* Here is an example source map, taken from the source map spec[0]:
|
|
15369
|
+
*
|
|
15370
|
+
* {
|
|
15371
|
+
* version : 3,
|
|
15372
|
+
* file: "out.js",
|
|
15373
|
+
* sourceRoot : "",
|
|
15374
|
+
* sources: ["foo.js", "bar.js"],
|
|
15375
|
+
* names: ["src", "maps", "are", "fun"],
|
|
15376
|
+
* mappings: "AA,AB;;ABCDE;"
|
|
15377
|
+
* }
|
|
15378
|
+
*
|
|
15379
|
+
* The second parameter, if given, is a string whose value is the URL
|
|
15380
|
+
* at which the source map was found. This URL is used to compute the
|
|
15381
|
+
* sources array.
|
|
15382
|
+
*
|
|
15383
|
+
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
|
|
15384
|
+
*/
|
|
15385
|
+
function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
|
|
15386
|
+
var sourceMap = aSourceMap;
|
|
15387
|
+
if (typeof aSourceMap === 'string') {
|
|
15388
|
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
15389
|
+
}
|
|
15390
|
+
|
|
15391
|
+
var version = util.getArg(sourceMap, 'version');
|
|
15392
|
+
var sources = util.getArg(sourceMap, 'sources');
|
|
15393
|
+
// Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
|
|
15394
|
+
// requires the array) to play nice here.
|
|
15395
|
+
var names = util.getArg(sourceMap, 'names', []);
|
|
15396
|
+
var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
|
|
15397
|
+
var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
|
|
15398
|
+
var mappings = util.getArg(sourceMap, 'mappings');
|
|
15399
|
+
var file = util.getArg(sourceMap, 'file', null);
|
|
15400
|
+
|
|
15401
|
+
// Once again, Sass deviates from the spec and supplies the version as a
|
|
15402
|
+
// string rather than a number, so we use loose equality checking here.
|
|
15403
|
+
if (version != this._version) {
|
|
15404
|
+
throw new Error('Unsupported version: ' + version);
|
|
15405
|
+
}
|
|
15406
|
+
|
|
15407
|
+
if (sourceRoot) {
|
|
15408
|
+
sourceRoot = util.normalize(sourceRoot);
|
|
15409
|
+
}
|
|
15410
|
+
|
|
15411
|
+
sources = sources
|
|
15412
|
+
.map(String)
|
|
15413
|
+
// Some source maps produce relative source paths like "./foo.js" instead of
|
|
15414
|
+
// "foo.js". Normalize these first so that future comparisons will succeed.
|
|
15415
|
+
// See bugzil.la/1090768.
|
|
15416
|
+
.map(util.normalize)
|
|
15417
|
+
// Always ensure that absolute sources are internally stored relative to
|
|
15418
|
+
// the source root, if the source root is absolute. Not doing this would
|
|
15419
|
+
// be particularly problematic when the source root is a prefix of the
|
|
15420
|
+
// source (valid, but why??). See github issue #199 and bugzil.la/1188982.
|
|
15421
|
+
.map(function (source) {
|
|
15422
|
+
return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
|
|
15423
|
+
? util.relative(sourceRoot, source)
|
|
15424
|
+
: source;
|
|
15425
|
+
});
|
|
15426
|
+
|
|
15427
|
+
// Pass `true` below to allow duplicate names and sources. While source maps
|
|
15428
|
+
// are intended to be compressed and deduplicated, the TypeScript compiler
|
|
15429
|
+
// sometimes generates source maps with duplicates in them. See Github issue
|
|
15430
|
+
// #72 and bugzil.la/889492.
|
|
15431
|
+
this._names = ArraySet$2.fromArray(names.map(String), true);
|
|
15432
|
+
this._sources = ArraySet$2.fromArray(sources, true);
|
|
15433
|
+
|
|
15434
|
+
this._absoluteSources = this._sources.toArray().map(function (s) {
|
|
15435
|
+
return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
|
|
15436
|
+
});
|
|
15437
|
+
|
|
15438
|
+
this.sourceRoot = sourceRoot;
|
|
15439
|
+
this.sourcesContent = sourcesContent;
|
|
15440
|
+
this._mappings = mappings;
|
|
15441
|
+
this._sourceMapURL = aSourceMapURL;
|
|
15442
|
+
this.file = file;
|
|
15443
|
+
}
|
|
15444
|
+
|
|
15445
|
+
BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer$1.prototype);
|
|
15446
|
+
BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer$1;
|
|
15447
|
+
|
|
15448
|
+
/**
|
|
15449
|
+
* Utility function to find the index of a source. Returns -1 if not
|
|
15450
|
+
* found.
|
|
15451
|
+
*/
|
|
15452
|
+
BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
|
|
15453
|
+
var relativeSource = aSource;
|
|
15454
|
+
if (this.sourceRoot != null) {
|
|
15455
|
+
relativeSource = util.relative(this.sourceRoot, relativeSource);
|
|
15456
|
+
}
|
|
15457
|
+
|
|
15458
|
+
if (this._sources.has(relativeSource)) {
|
|
15459
|
+
return this._sources.indexOf(relativeSource);
|
|
15460
|
+
}
|
|
15461
|
+
|
|
15462
|
+
// Maybe aSource is an absolute URL as returned by |sources|. In
|
|
15463
|
+
// this case we can't simply undo the transform.
|
|
15464
|
+
var i;
|
|
15465
|
+
for (i = 0; i < this._absoluteSources.length; ++i) {
|
|
15466
|
+
if (this._absoluteSources[i] == aSource) {
|
|
15467
|
+
return i;
|
|
15468
|
+
}
|
|
15469
|
+
}
|
|
15470
|
+
|
|
15471
|
+
return -1;
|
|
15472
|
+
};
|
|
15473
|
+
|
|
15474
|
+
/**
|
|
15475
|
+
* Create a BasicSourceMapConsumer from a SourceMapGenerator.
|
|
15476
|
+
*
|
|
15477
|
+
* @param SourceMapGenerator aSourceMap
|
|
15478
|
+
* The source map that will be consumed.
|
|
15479
|
+
* @param String aSourceMapURL
|
|
15480
|
+
* The URL at which the source map can be found (optional)
|
|
15481
|
+
* @returns BasicSourceMapConsumer
|
|
15482
|
+
*/
|
|
15483
|
+
BasicSourceMapConsumer.fromSourceMap =
|
|
15484
|
+
function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
|
|
15485
|
+
var smc = Object.create(BasicSourceMapConsumer.prototype);
|
|
15486
|
+
|
|
15487
|
+
var names = smc._names = ArraySet$2.fromArray(aSourceMap._names.toArray(), true);
|
|
15488
|
+
var sources = smc._sources = ArraySet$2.fromArray(aSourceMap._sources.toArray(), true);
|
|
15489
|
+
smc.sourceRoot = aSourceMap._sourceRoot;
|
|
15490
|
+
smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
|
|
15491
|
+
smc.sourceRoot);
|
|
15492
|
+
smc.file = aSourceMap._file;
|
|
15493
|
+
smc._sourceMapURL = aSourceMapURL;
|
|
15494
|
+
smc._absoluteSources = smc._sources.toArray().map(function (s) {
|
|
15495
|
+
return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
|
|
15496
|
+
});
|
|
15497
|
+
|
|
15498
|
+
// Because we are modifying the entries (by converting string sources and
|
|
15499
|
+
// names to indices into the sources and names ArraySets), we have to make
|
|
15500
|
+
// a copy of the entry or else bad things happen. Shared mutable state
|
|
15501
|
+
// strikes again! See github issue #191.
|
|
15502
|
+
|
|
15503
|
+
var generatedMappings = aSourceMap._mappings.toArray().slice();
|
|
15504
|
+
var destGeneratedMappings = smc.__generatedMappings = [];
|
|
15505
|
+
var destOriginalMappings = smc.__originalMappings = [];
|
|
15506
|
+
|
|
15507
|
+
for (var i = 0, length = generatedMappings.length; i < length; i++) {
|
|
15508
|
+
var srcMapping = generatedMappings[i];
|
|
15509
|
+
var destMapping = new Mapping;
|
|
15510
|
+
destMapping.generatedLine = srcMapping.generatedLine;
|
|
15511
|
+
destMapping.generatedColumn = srcMapping.generatedColumn;
|
|
15512
|
+
|
|
15513
|
+
if (srcMapping.source) {
|
|
15514
|
+
destMapping.source = sources.indexOf(srcMapping.source);
|
|
15515
|
+
destMapping.originalLine = srcMapping.originalLine;
|
|
15516
|
+
destMapping.originalColumn = srcMapping.originalColumn;
|
|
15517
|
+
|
|
15518
|
+
if (srcMapping.name) {
|
|
15519
|
+
destMapping.name = names.indexOf(srcMapping.name);
|
|
15520
|
+
}
|
|
15521
|
+
|
|
15522
|
+
destOriginalMappings.push(destMapping);
|
|
15523
|
+
}
|
|
15524
|
+
|
|
15525
|
+
destGeneratedMappings.push(destMapping);
|
|
15526
|
+
}
|
|
15527
|
+
|
|
15528
|
+
quickSort(smc.__originalMappings, util.compareByOriginalPositions);
|
|
15529
|
+
|
|
15530
|
+
return smc;
|
|
15531
|
+
};
|
|
15532
|
+
|
|
15533
|
+
/**
|
|
15534
|
+
* The version of the source mapping spec that we are consuming.
|
|
15535
|
+
*/
|
|
15536
|
+
BasicSourceMapConsumer.prototype._version = 3;
|
|
15537
|
+
|
|
15538
|
+
/**
|
|
15539
|
+
* The list of original sources.
|
|
15540
|
+
*/
|
|
15541
|
+
Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
|
|
15542
|
+
get: function () {
|
|
15543
|
+
return this._absoluteSources.slice();
|
|
15544
|
+
}
|
|
15545
|
+
});
|
|
15546
|
+
|
|
15547
|
+
/**
|
|
15548
|
+
* Provide the JIT with a nice shape / hidden class.
|
|
15549
|
+
*/
|
|
15550
|
+
function Mapping() {
|
|
15551
|
+
this.generatedLine = 0;
|
|
15552
|
+
this.generatedColumn = 0;
|
|
15553
|
+
this.source = null;
|
|
15554
|
+
this.originalLine = null;
|
|
15555
|
+
this.originalColumn = null;
|
|
15556
|
+
this.name = null;
|
|
15557
|
+
}
|
|
15558
|
+
|
|
15559
|
+
/**
|
|
15560
|
+
* Parse the mappings in a string in to a data structure which we can easily
|
|
15561
|
+
* query (the ordered arrays in the `this.__generatedMappings` and
|
|
15562
|
+
* `this.__originalMappings` properties).
|
|
15563
|
+
*/
|
|
15564
|
+
BasicSourceMapConsumer.prototype._parseMappings =
|
|
15565
|
+
function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
|
|
15566
|
+
var generatedLine = 1;
|
|
15567
|
+
var previousGeneratedColumn = 0;
|
|
15568
|
+
var previousOriginalLine = 0;
|
|
15569
|
+
var previousOriginalColumn = 0;
|
|
15570
|
+
var previousSource = 0;
|
|
15571
|
+
var previousName = 0;
|
|
15572
|
+
var length = aStr.length;
|
|
15573
|
+
var index = 0;
|
|
15574
|
+
var cachedSegments = {};
|
|
15575
|
+
var temp = {};
|
|
15576
|
+
var originalMappings = [];
|
|
15577
|
+
var generatedMappings = [];
|
|
15578
|
+
var mapping, str, segment, end, value;
|
|
15579
|
+
|
|
15580
|
+
while (index < length) {
|
|
15581
|
+
if (aStr.charAt(index) === ';') {
|
|
15582
|
+
generatedLine++;
|
|
15583
|
+
index++;
|
|
15584
|
+
previousGeneratedColumn = 0;
|
|
15585
|
+
}
|
|
15586
|
+
else if (aStr.charAt(index) === ',') {
|
|
15587
|
+
index++;
|
|
15588
|
+
}
|
|
15589
|
+
else {
|
|
15590
|
+
mapping = new Mapping();
|
|
15591
|
+
mapping.generatedLine = generatedLine;
|
|
15592
|
+
|
|
15593
|
+
// Because each offset is encoded relative to the previous one,
|
|
15594
|
+
// many segments often have the same encoding. We can exploit this
|
|
15595
|
+
// fact by caching the parsed variable length fields of each segment,
|
|
15596
|
+
// allowing us to avoid a second parse if we encounter the same
|
|
15597
|
+
// segment again.
|
|
15598
|
+
for (end = index; end < length; end++) {
|
|
15599
|
+
if (this._charIsMappingSeparator(aStr, end)) {
|
|
15600
|
+
break;
|
|
15601
|
+
}
|
|
15602
|
+
}
|
|
15603
|
+
str = aStr.slice(index, end);
|
|
15604
|
+
|
|
15605
|
+
segment = cachedSegments[str];
|
|
15606
|
+
if (segment) {
|
|
15607
|
+
index += str.length;
|
|
15608
|
+
} else {
|
|
15609
|
+
segment = [];
|
|
15610
|
+
while (index < end) {
|
|
15611
|
+
base64Vlq.decode(aStr, index, temp);
|
|
15612
|
+
value = temp.value;
|
|
15613
|
+
index = temp.rest;
|
|
15614
|
+
segment.push(value);
|
|
15615
|
+
}
|
|
15616
|
+
|
|
15617
|
+
if (segment.length === 2) {
|
|
15618
|
+
throw new Error('Found a source, but no line and column');
|
|
15619
|
+
}
|
|
15620
|
+
|
|
15621
|
+
if (segment.length === 3) {
|
|
15622
|
+
throw new Error('Found a source and line, but no column');
|
|
15623
|
+
}
|
|
15624
|
+
|
|
15625
|
+
cachedSegments[str] = segment;
|
|
15626
|
+
}
|
|
15627
|
+
|
|
15628
|
+
// Generated column.
|
|
15629
|
+
mapping.generatedColumn = previousGeneratedColumn + segment[0];
|
|
15630
|
+
previousGeneratedColumn = mapping.generatedColumn;
|
|
15631
|
+
|
|
15632
|
+
if (segment.length > 1) {
|
|
15633
|
+
// Original source.
|
|
15634
|
+
mapping.source = previousSource + segment[1];
|
|
15635
|
+
previousSource += segment[1];
|
|
15636
|
+
|
|
15637
|
+
// Original line.
|
|
15638
|
+
mapping.originalLine = previousOriginalLine + segment[2];
|
|
15639
|
+
previousOriginalLine = mapping.originalLine;
|
|
15640
|
+
// Lines are stored 0-based
|
|
15641
|
+
mapping.originalLine += 1;
|
|
15642
|
+
|
|
15643
|
+
// Original column.
|
|
15644
|
+
mapping.originalColumn = previousOriginalColumn + segment[3];
|
|
15645
|
+
previousOriginalColumn = mapping.originalColumn;
|
|
15646
|
+
|
|
15647
|
+
if (segment.length > 4) {
|
|
15648
|
+
// Original name.
|
|
15649
|
+
mapping.name = previousName + segment[4];
|
|
15650
|
+
previousName += segment[4];
|
|
15651
|
+
}
|
|
15652
|
+
}
|
|
15653
|
+
|
|
15654
|
+
generatedMappings.push(mapping);
|
|
15655
|
+
if (typeof mapping.originalLine === 'number') {
|
|
15656
|
+
originalMappings.push(mapping);
|
|
15657
|
+
}
|
|
15658
|
+
}
|
|
15659
|
+
}
|
|
15660
|
+
|
|
15661
|
+
quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
|
|
15662
|
+
this.__generatedMappings = generatedMappings;
|
|
15663
|
+
|
|
15664
|
+
quickSort(originalMappings, util.compareByOriginalPositions);
|
|
15665
|
+
this.__originalMappings = originalMappings;
|
|
15666
|
+
};
|
|
15667
|
+
|
|
15668
|
+
/**
|
|
15669
|
+
* Find the mapping that best matches the hypothetical "needle" mapping that
|
|
15670
|
+
* we are searching for in the given "haystack" of mappings.
|
|
15671
|
+
*/
|
|
15672
|
+
BasicSourceMapConsumer.prototype._findMapping =
|
|
15673
|
+
function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
|
|
15674
|
+
aColumnName, aComparator, aBias) {
|
|
15675
|
+
// To return the position we are searching for, we must first find the
|
|
15676
|
+
// mapping for the given position and then return the opposite position it
|
|
15677
|
+
// points to. Because the mappings are sorted, we can use binary search to
|
|
15678
|
+
// find the best mapping.
|
|
15679
|
+
|
|
15680
|
+
if (aNeedle[aLineName] <= 0) {
|
|
15681
|
+
throw new TypeError('Line must be greater than or equal to 1, got '
|
|
15682
|
+
+ aNeedle[aLineName]);
|
|
15683
|
+
}
|
|
15684
|
+
if (aNeedle[aColumnName] < 0) {
|
|
15685
|
+
throw new TypeError('Column must be greater than or equal to 0, got '
|
|
15686
|
+
+ aNeedle[aColumnName]);
|
|
15687
|
+
}
|
|
15688
|
+
|
|
15689
|
+
return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
|
|
15690
|
+
};
|
|
15691
|
+
|
|
15692
|
+
/**
|
|
15693
|
+
* Compute the last column for each generated mapping. The last column is
|
|
15694
|
+
* inclusive.
|
|
15695
|
+
*/
|
|
15696
|
+
BasicSourceMapConsumer.prototype.computeColumnSpans =
|
|
15697
|
+
function SourceMapConsumer_computeColumnSpans() {
|
|
15698
|
+
for (var index = 0; index < this._generatedMappings.length; ++index) {
|
|
15699
|
+
var mapping = this._generatedMappings[index];
|
|
15700
|
+
|
|
15701
|
+
// Mappings do not contain a field for the last generated columnt. We
|
|
15702
|
+
// can come up with an optimistic estimate, however, by assuming that
|
|
15703
|
+
// mappings are contiguous (i.e. given two consecutive mappings, the
|
|
15704
|
+
// first mapping ends where the second one starts).
|
|
15705
|
+
if (index + 1 < this._generatedMappings.length) {
|
|
15706
|
+
var nextMapping = this._generatedMappings[index + 1];
|
|
15707
|
+
|
|
15708
|
+
if (mapping.generatedLine === nextMapping.generatedLine) {
|
|
15709
|
+
mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
|
|
15710
|
+
continue;
|
|
15711
|
+
}
|
|
15712
|
+
}
|
|
15713
|
+
|
|
15714
|
+
// The last mapping for each line spans the entire line.
|
|
15715
|
+
mapping.lastGeneratedColumn = Infinity;
|
|
15716
|
+
}
|
|
15717
|
+
};
|
|
15718
|
+
|
|
15719
|
+
/**
|
|
15720
|
+
* Returns the original source, line, and column information for the generated
|
|
15721
|
+
* source's line and column positions provided. The only argument is an object
|
|
15722
|
+
* with the following properties:
|
|
15723
|
+
*
|
|
15724
|
+
* - line: The line number in the generated source. The line number
|
|
15725
|
+
* is 1-based.
|
|
15726
|
+
* - column: The column number in the generated source. The column
|
|
15727
|
+
* number is 0-based.
|
|
15728
|
+
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
|
|
15729
|
+
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
|
|
15730
|
+
* closest element that is smaller than or greater than the one we are
|
|
15731
|
+
* searching for, respectively, if the exact element cannot be found.
|
|
15732
|
+
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
|
|
15733
|
+
*
|
|
15734
|
+
* and an object is returned with the following properties:
|
|
15735
|
+
*
|
|
15736
|
+
* - source: The original source file, or null.
|
|
15737
|
+
* - line: The line number in the original source, or null. The
|
|
15738
|
+
* line number is 1-based.
|
|
15739
|
+
* - column: The column number in the original source, or null. The
|
|
15740
|
+
* column number is 0-based.
|
|
15741
|
+
* - name: The original identifier, or null.
|
|
15742
|
+
*/
|
|
15743
|
+
BasicSourceMapConsumer.prototype.originalPositionFor =
|
|
15744
|
+
function SourceMapConsumer_originalPositionFor(aArgs) {
|
|
15745
|
+
var needle = {
|
|
15746
|
+
generatedLine: util.getArg(aArgs, 'line'),
|
|
15747
|
+
generatedColumn: util.getArg(aArgs, 'column')
|
|
15748
|
+
};
|
|
15749
|
+
|
|
15750
|
+
var index = this._findMapping(
|
|
15751
|
+
needle,
|
|
15752
|
+
this._generatedMappings,
|
|
15753
|
+
"generatedLine",
|
|
15754
|
+
"generatedColumn",
|
|
15755
|
+
util.compareByGeneratedPositionsDeflated,
|
|
15756
|
+
util.getArg(aArgs, 'bias', SourceMapConsumer$1.GREATEST_LOWER_BOUND)
|
|
15757
|
+
);
|
|
15758
|
+
|
|
15759
|
+
if (index >= 0) {
|
|
15760
|
+
var mapping = this._generatedMappings[index];
|
|
15761
|
+
|
|
15762
|
+
if (mapping.generatedLine === needle.generatedLine) {
|
|
15763
|
+
var source = util.getArg(mapping, 'source', null);
|
|
15764
|
+
if (source !== null) {
|
|
15765
|
+
source = this._sources.at(source);
|
|
15766
|
+
source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
|
|
15767
|
+
}
|
|
15768
|
+
var name = util.getArg(mapping, 'name', null);
|
|
15769
|
+
if (name !== null) {
|
|
15770
|
+
name = this._names.at(name);
|
|
15771
|
+
}
|
|
15772
|
+
return {
|
|
15773
|
+
source: source,
|
|
15774
|
+
line: util.getArg(mapping, 'originalLine', null),
|
|
15775
|
+
column: util.getArg(mapping, 'originalColumn', null),
|
|
15776
|
+
name: name
|
|
15777
|
+
};
|
|
15778
|
+
}
|
|
15779
|
+
}
|
|
15780
|
+
|
|
15781
|
+
return {
|
|
15782
|
+
source: null,
|
|
15783
|
+
line: null,
|
|
15784
|
+
column: null,
|
|
15785
|
+
name: null
|
|
15786
|
+
};
|
|
15787
|
+
};
|
|
15788
|
+
|
|
15789
|
+
/**
|
|
15790
|
+
* Return true if we have the source content for every source in the source
|
|
15791
|
+
* map, false otherwise.
|
|
15792
|
+
*/
|
|
15793
|
+
BasicSourceMapConsumer.prototype.hasContentsOfAllSources =
|
|
15794
|
+
function BasicSourceMapConsumer_hasContentsOfAllSources() {
|
|
15795
|
+
if (!this.sourcesContent) {
|
|
15796
|
+
return false;
|
|
15797
|
+
}
|
|
15798
|
+
return this.sourcesContent.length >= this._sources.size() &&
|
|
15799
|
+
!this.sourcesContent.some(function (sc) { return sc == null; });
|
|
15800
|
+
};
|
|
15801
|
+
|
|
15802
|
+
/**
|
|
15803
|
+
* Returns the original source content. The only argument is the url of the
|
|
15804
|
+
* original source file. Returns null if no original source content is
|
|
15805
|
+
* available.
|
|
15806
|
+
*/
|
|
15807
|
+
BasicSourceMapConsumer.prototype.sourceContentFor =
|
|
15808
|
+
function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
|
|
15809
|
+
if (!this.sourcesContent) {
|
|
15810
|
+
return null;
|
|
15811
|
+
}
|
|
15812
|
+
|
|
15813
|
+
var index = this._findSourceIndex(aSource);
|
|
15814
|
+
if (index >= 0) {
|
|
15815
|
+
return this.sourcesContent[index];
|
|
15816
|
+
}
|
|
15817
|
+
|
|
15818
|
+
var relativeSource = aSource;
|
|
15819
|
+
if (this.sourceRoot != null) {
|
|
15820
|
+
relativeSource = util.relative(this.sourceRoot, relativeSource);
|
|
15821
|
+
}
|
|
15822
|
+
|
|
15823
|
+
var url;
|
|
15824
|
+
if (this.sourceRoot != null
|
|
15825
|
+
&& (url = util.urlParse(this.sourceRoot))) {
|
|
15826
|
+
// XXX: file:// URIs and absolute paths lead to unexpected behavior for
|
|
15827
|
+
// many users. We can help them out when they expect file:// URIs to
|
|
15828
|
+
// behave like it would if they were running a local HTTP server. See
|
|
15829
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
|
|
15830
|
+
var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
|
|
15831
|
+
if (url.scheme == "file"
|
|
15832
|
+
&& this._sources.has(fileUriAbsPath)) {
|
|
15833
|
+
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
|
|
15834
|
+
}
|
|
15835
|
+
|
|
15836
|
+
if ((!url.path || url.path == "/")
|
|
15837
|
+
&& this._sources.has("/" + relativeSource)) {
|
|
15838
|
+
return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
|
|
15839
|
+
}
|
|
15840
|
+
}
|
|
15841
|
+
|
|
15842
|
+
// This function is used recursively from
|
|
15843
|
+
// IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
|
|
15844
|
+
// don't want to throw if we can't find the source - we just want to
|
|
15845
|
+
// return null, so we provide a flag to exit gracefully.
|
|
15846
|
+
if (nullOnMissing) {
|
|
15847
|
+
return null;
|
|
15848
|
+
}
|
|
15849
|
+
else {
|
|
15850
|
+
throw new Error('"' + relativeSource + '" is not in the SourceMap.');
|
|
15851
|
+
}
|
|
15852
|
+
};
|
|
15853
|
+
|
|
15854
|
+
/**
|
|
15855
|
+
* Returns the generated line and column information for the original source,
|
|
15856
|
+
* line, and column positions provided. The only argument is an object with
|
|
15857
|
+
* the following properties:
|
|
15858
|
+
*
|
|
15859
|
+
* - source: The filename of the original source.
|
|
15860
|
+
* - line: The line number in the original source. The line number
|
|
15861
|
+
* is 1-based.
|
|
15862
|
+
* - column: The column number in the original source. The column
|
|
15863
|
+
* number is 0-based.
|
|
15864
|
+
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
|
|
15865
|
+
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
|
|
15866
|
+
* closest element that is smaller than or greater than the one we are
|
|
15867
|
+
* searching for, respectively, if the exact element cannot be found.
|
|
15868
|
+
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
|
|
15869
|
+
*
|
|
15870
|
+
* and an object is returned with the following properties:
|
|
15871
|
+
*
|
|
15872
|
+
* - line: The line number in the generated source, or null. The
|
|
15873
|
+
* line number is 1-based.
|
|
15874
|
+
* - column: The column number in the generated source, or null.
|
|
15875
|
+
* The column number is 0-based.
|
|
15876
|
+
*/
|
|
15877
|
+
BasicSourceMapConsumer.prototype.generatedPositionFor =
|
|
15878
|
+
function SourceMapConsumer_generatedPositionFor(aArgs) {
|
|
15879
|
+
var source = util.getArg(aArgs, 'source');
|
|
15880
|
+
source = this._findSourceIndex(source);
|
|
15881
|
+
if (source < 0) {
|
|
15882
|
+
return {
|
|
15883
|
+
line: null,
|
|
15884
|
+
column: null,
|
|
15885
|
+
lastColumn: null
|
|
15886
|
+
};
|
|
15887
|
+
}
|
|
15888
|
+
|
|
15889
|
+
var needle = {
|
|
15890
|
+
source: source,
|
|
15891
|
+
originalLine: util.getArg(aArgs, 'line'),
|
|
15892
|
+
originalColumn: util.getArg(aArgs, 'column')
|
|
15893
|
+
};
|
|
15894
|
+
|
|
15895
|
+
var index = this._findMapping(
|
|
15896
|
+
needle,
|
|
15897
|
+
this._originalMappings,
|
|
15898
|
+
"originalLine",
|
|
15899
|
+
"originalColumn",
|
|
15900
|
+
util.compareByOriginalPositions,
|
|
15901
|
+
util.getArg(aArgs, 'bias', SourceMapConsumer$1.GREATEST_LOWER_BOUND)
|
|
15902
|
+
);
|
|
15903
|
+
|
|
15904
|
+
if (index >= 0) {
|
|
15905
|
+
var mapping = this._originalMappings[index];
|
|
15906
|
+
|
|
15907
|
+
if (mapping.source === needle.source) {
|
|
15908
|
+
return {
|
|
15909
|
+
line: util.getArg(mapping, 'generatedLine', null),
|
|
15910
|
+
column: util.getArg(mapping, 'generatedColumn', null),
|
|
15911
|
+
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
|
|
15912
|
+
};
|
|
15913
|
+
}
|
|
15914
|
+
}
|
|
15915
|
+
|
|
15916
|
+
return {
|
|
15917
|
+
line: null,
|
|
15918
|
+
column: null,
|
|
15919
|
+
lastColumn: null
|
|
15920
|
+
};
|
|
15921
|
+
};
|
|
15922
|
+
|
|
15923
|
+
var BasicSourceMapConsumer_1 = BasicSourceMapConsumer;
|
|
15924
|
+
|
|
15925
|
+
/**
|
|
15926
|
+
* An IndexedSourceMapConsumer instance represents a parsed source map which
|
|
15927
|
+
* we can query for information. It differs from BasicSourceMapConsumer in
|
|
15928
|
+
* that it takes "indexed" source maps (i.e. ones with a "sections" field) as
|
|
15929
|
+
* input.
|
|
15930
|
+
*
|
|
15931
|
+
* The first parameter is a raw source map (either as a JSON string, or already
|
|
15932
|
+
* parsed to an object). According to the spec for indexed source maps, they
|
|
15933
|
+
* have the following attributes:
|
|
15934
|
+
*
|
|
15935
|
+
* - version: Which version of the source map spec this map is following.
|
|
15936
|
+
* - file: Optional. The generated file this source map is associated with.
|
|
15937
|
+
* - sections: A list of section definitions.
|
|
15938
|
+
*
|
|
15939
|
+
* Each value under the "sections" field has two fields:
|
|
15940
|
+
* - offset: The offset into the original specified at which this section
|
|
15941
|
+
* begins to apply, defined as an object with a "line" and "column"
|
|
15942
|
+
* field.
|
|
15943
|
+
* - map: A source map definition. This source map could also be indexed,
|
|
15944
|
+
* but doesn't have to be.
|
|
15945
|
+
*
|
|
15946
|
+
* Instead of the "map" field, it's also possible to have a "url" field
|
|
15947
|
+
* specifying a URL to retrieve a source map from, but that's currently
|
|
15948
|
+
* unsupported.
|
|
15949
|
+
*
|
|
15950
|
+
* Here's an example source map, taken from the source map spec[0], but
|
|
15951
|
+
* modified to omit a section which uses the "url" field.
|
|
15952
|
+
*
|
|
15953
|
+
* {
|
|
15954
|
+
* version : 3,
|
|
15955
|
+
* file: "app.js",
|
|
15956
|
+
* sections: [{
|
|
15957
|
+
* offset: {line:100, column:10},
|
|
15958
|
+
* map: {
|
|
15959
|
+
* version : 3,
|
|
15960
|
+
* file: "section.js",
|
|
15961
|
+
* sources: ["foo.js", "bar.js"],
|
|
15962
|
+
* names: ["src", "maps", "are", "fun"],
|
|
15963
|
+
* mappings: "AAAA,E;;ABCDE;"
|
|
15964
|
+
* }
|
|
15965
|
+
* }],
|
|
15966
|
+
* }
|
|
15967
|
+
*
|
|
15968
|
+
* The second parameter, if given, is a string whose value is the URL
|
|
15969
|
+
* at which the source map was found. This URL is used to compute the
|
|
15970
|
+
* sources array.
|
|
15971
|
+
*
|
|
15972
|
+
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
|
|
15973
|
+
*/
|
|
15974
|
+
function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
|
|
15975
|
+
var sourceMap = aSourceMap;
|
|
15976
|
+
if (typeof aSourceMap === 'string') {
|
|
15977
|
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
15978
|
+
}
|
|
15979
|
+
|
|
15980
|
+
var version = util.getArg(sourceMap, 'version');
|
|
15981
|
+
var sections = util.getArg(sourceMap, 'sections');
|
|
15982
|
+
|
|
15983
|
+
if (version != this._version) {
|
|
15984
|
+
throw new Error('Unsupported version: ' + version);
|
|
15985
|
+
}
|
|
15986
|
+
|
|
15987
|
+
this._sources = new ArraySet$2();
|
|
15988
|
+
this._names = new ArraySet$2();
|
|
15989
|
+
|
|
15990
|
+
var lastOffset = {
|
|
15991
|
+
line: -1,
|
|
15992
|
+
column: 0
|
|
15993
|
+
};
|
|
15994
|
+
this._sections = sections.map(function (s) {
|
|
15995
|
+
if (s.url) {
|
|
15996
|
+
// The url field will require support for asynchronicity.
|
|
15997
|
+
// See https://github.com/mozilla/source-map/issues/16
|
|
15998
|
+
throw new Error('Support for url field in sections not implemented.');
|
|
15999
|
+
}
|
|
16000
|
+
var offset = util.getArg(s, 'offset');
|
|
16001
|
+
var offsetLine = util.getArg(offset, 'line');
|
|
16002
|
+
var offsetColumn = util.getArg(offset, 'column');
|
|
16003
|
+
|
|
16004
|
+
if (offsetLine < lastOffset.line ||
|
|
16005
|
+
(offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
|
|
16006
|
+
throw new Error('Section offsets must be ordered and non-overlapping.');
|
|
16007
|
+
}
|
|
16008
|
+
lastOffset = offset;
|
|
16009
|
+
|
|
16010
|
+
return {
|
|
16011
|
+
generatedOffset: {
|
|
16012
|
+
// The offset fields are 0-based, but we use 1-based indices when
|
|
16013
|
+
// encoding/decoding from VLQ.
|
|
16014
|
+
generatedLine: offsetLine + 1,
|
|
16015
|
+
generatedColumn: offsetColumn + 1
|
|
16016
|
+
},
|
|
16017
|
+
consumer: new SourceMapConsumer$1(util.getArg(s, 'map'), aSourceMapURL)
|
|
16018
|
+
}
|
|
16019
|
+
});
|
|
16020
|
+
}
|
|
16021
|
+
|
|
16022
|
+
IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer$1.prototype);
|
|
16023
|
+
IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer$1;
|
|
16024
|
+
|
|
16025
|
+
/**
|
|
16026
|
+
* The version of the source mapping spec that we are consuming.
|
|
16027
|
+
*/
|
|
16028
|
+
IndexedSourceMapConsumer.prototype._version = 3;
|
|
16029
|
+
|
|
16030
|
+
/**
|
|
16031
|
+
* The list of original sources.
|
|
16032
|
+
*/
|
|
16033
|
+
Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
|
|
16034
|
+
get: function () {
|
|
16035
|
+
var sources = [];
|
|
16036
|
+
for (var i = 0; i < this._sections.length; i++) {
|
|
16037
|
+
for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
|
|
16038
|
+
sources.push(this._sections[i].consumer.sources[j]);
|
|
16039
|
+
}
|
|
16040
|
+
}
|
|
16041
|
+
return sources;
|
|
16042
|
+
}
|
|
16043
|
+
});
|
|
16044
|
+
|
|
16045
|
+
/**
|
|
16046
|
+
* Returns the original source, line, and column information for the generated
|
|
16047
|
+
* source's line and column positions provided. The only argument is an object
|
|
16048
|
+
* with the following properties:
|
|
16049
|
+
*
|
|
16050
|
+
* - line: The line number in the generated source. The line number
|
|
16051
|
+
* is 1-based.
|
|
16052
|
+
* - column: The column number in the generated source. The column
|
|
16053
|
+
* number is 0-based.
|
|
16054
|
+
*
|
|
16055
|
+
* and an object is returned with the following properties:
|
|
16056
|
+
*
|
|
16057
|
+
* - source: The original source file, or null.
|
|
16058
|
+
* - line: The line number in the original source, or null. The
|
|
16059
|
+
* line number is 1-based.
|
|
16060
|
+
* - column: The column number in the original source, or null. The
|
|
16061
|
+
* column number is 0-based.
|
|
16062
|
+
* - name: The original identifier, or null.
|
|
16063
|
+
*/
|
|
16064
|
+
IndexedSourceMapConsumer.prototype.originalPositionFor =
|
|
16065
|
+
function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
|
|
16066
|
+
var needle = {
|
|
16067
|
+
generatedLine: util.getArg(aArgs, 'line'),
|
|
16068
|
+
generatedColumn: util.getArg(aArgs, 'column')
|
|
16069
|
+
};
|
|
16070
|
+
|
|
16071
|
+
// Find the section containing the generated position we're trying to map
|
|
16072
|
+
// to an original position.
|
|
16073
|
+
var sectionIndex = binarySearch.search(needle, this._sections,
|
|
16074
|
+
function(needle, section) {
|
|
16075
|
+
var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
|
|
16076
|
+
if (cmp) {
|
|
16077
|
+
return cmp;
|
|
16078
|
+
}
|
|
16079
|
+
|
|
16080
|
+
return (needle.generatedColumn -
|
|
16081
|
+
section.generatedOffset.generatedColumn);
|
|
16082
|
+
});
|
|
16083
|
+
var section = this._sections[sectionIndex];
|
|
16084
|
+
|
|
16085
|
+
if (!section) {
|
|
16086
|
+
return {
|
|
16087
|
+
source: null,
|
|
16088
|
+
line: null,
|
|
16089
|
+
column: null,
|
|
16090
|
+
name: null
|
|
16091
|
+
};
|
|
16092
|
+
}
|
|
16093
|
+
|
|
16094
|
+
return section.consumer.originalPositionFor({
|
|
16095
|
+
line: needle.generatedLine -
|
|
16096
|
+
(section.generatedOffset.generatedLine - 1),
|
|
16097
|
+
column: needle.generatedColumn -
|
|
16098
|
+
(section.generatedOffset.generatedLine === needle.generatedLine
|
|
16099
|
+
? section.generatedOffset.generatedColumn - 1
|
|
16100
|
+
: 0),
|
|
16101
|
+
bias: aArgs.bias
|
|
16102
|
+
});
|
|
16103
|
+
};
|
|
16104
|
+
|
|
16105
|
+
/**
|
|
16106
|
+
* Return true if we have the source content for every source in the source
|
|
16107
|
+
* map, false otherwise.
|
|
16108
|
+
*/
|
|
16109
|
+
IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =
|
|
16110
|
+
function IndexedSourceMapConsumer_hasContentsOfAllSources() {
|
|
16111
|
+
return this._sections.every(function (s) {
|
|
16112
|
+
return s.consumer.hasContentsOfAllSources();
|
|
16113
|
+
});
|
|
16114
|
+
};
|
|
16115
|
+
|
|
16116
|
+
/**
|
|
16117
|
+
* Returns the original source content. The only argument is the url of the
|
|
16118
|
+
* original source file. Returns null if no original source content is
|
|
16119
|
+
* available.
|
|
16120
|
+
*/
|
|
16121
|
+
IndexedSourceMapConsumer.prototype.sourceContentFor =
|
|
16122
|
+
function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
|
|
16123
|
+
for (var i = 0; i < this._sections.length; i++) {
|
|
16124
|
+
var section = this._sections[i];
|
|
16125
|
+
|
|
16126
|
+
var content = section.consumer.sourceContentFor(aSource, true);
|
|
16127
|
+
if (content) {
|
|
16128
|
+
return content;
|
|
16129
|
+
}
|
|
16130
|
+
}
|
|
16131
|
+
if (nullOnMissing) {
|
|
16132
|
+
return null;
|
|
16133
|
+
}
|
|
16134
|
+
else {
|
|
16135
|
+
throw new Error('"' + aSource + '" is not in the SourceMap.');
|
|
16136
|
+
}
|
|
16137
|
+
};
|
|
16138
|
+
|
|
16139
|
+
/**
|
|
16140
|
+
* Returns the generated line and column information for the original source,
|
|
16141
|
+
* line, and column positions provided. The only argument is an object with
|
|
16142
|
+
* the following properties:
|
|
16143
|
+
*
|
|
16144
|
+
* - source: The filename of the original source.
|
|
16145
|
+
* - line: The line number in the original source. The line number
|
|
16146
|
+
* is 1-based.
|
|
16147
|
+
* - column: The column number in the original source. The column
|
|
16148
|
+
* number is 0-based.
|
|
16149
|
+
*
|
|
16150
|
+
* and an object is returned with the following properties:
|
|
16151
|
+
*
|
|
16152
|
+
* - line: The line number in the generated source, or null. The
|
|
16153
|
+
* line number is 1-based.
|
|
16154
|
+
* - column: The column number in the generated source, or null.
|
|
16155
|
+
* The column number is 0-based.
|
|
16156
|
+
*/
|
|
16157
|
+
IndexedSourceMapConsumer.prototype.generatedPositionFor =
|
|
16158
|
+
function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
|
|
16159
|
+
for (var i = 0; i < this._sections.length; i++) {
|
|
16160
|
+
var section = this._sections[i];
|
|
16161
|
+
|
|
16162
|
+
// Only consider this section if the requested source is in the list of
|
|
16163
|
+
// sources of the consumer.
|
|
16164
|
+
if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {
|
|
16165
|
+
continue;
|
|
16166
|
+
}
|
|
16167
|
+
var generatedPosition = section.consumer.generatedPositionFor(aArgs);
|
|
16168
|
+
if (generatedPosition) {
|
|
16169
|
+
var ret = {
|
|
16170
|
+
line: generatedPosition.line +
|
|
16171
|
+
(section.generatedOffset.generatedLine - 1),
|
|
16172
|
+
column: generatedPosition.column +
|
|
16173
|
+
(section.generatedOffset.generatedLine === generatedPosition.line
|
|
16174
|
+
? section.generatedOffset.generatedColumn - 1
|
|
16175
|
+
: 0)
|
|
16176
|
+
};
|
|
16177
|
+
return ret;
|
|
16178
|
+
}
|
|
16179
|
+
}
|
|
16180
|
+
|
|
16181
|
+
return {
|
|
16182
|
+
line: null,
|
|
16183
|
+
column: null
|
|
16184
|
+
};
|
|
16185
|
+
};
|
|
16186
|
+
|
|
16187
|
+
/**
|
|
16188
|
+
* Parse the mappings in a string in to a data structure which we can easily
|
|
16189
|
+
* query (the ordered arrays in the `this.__generatedMappings` and
|
|
16190
|
+
* `this.__originalMappings` properties).
|
|
16191
|
+
*/
|
|
16192
|
+
IndexedSourceMapConsumer.prototype._parseMappings =
|
|
16193
|
+
function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
|
|
16194
|
+
this.__generatedMappings = [];
|
|
16195
|
+
this.__originalMappings = [];
|
|
16196
|
+
for (var i = 0; i < this._sections.length; i++) {
|
|
16197
|
+
var section = this._sections[i];
|
|
16198
|
+
var sectionMappings = section.consumer._generatedMappings;
|
|
16199
|
+
for (var j = 0; j < sectionMappings.length; j++) {
|
|
16200
|
+
var mapping = sectionMappings[j];
|
|
16201
|
+
|
|
16202
|
+
var source = section.consumer._sources.at(mapping.source);
|
|
16203
|
+
source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
|
|
16204
|
+
this._sources.add(source);
|
|
16205
|
+
source = this._sources.indexOf(source);
|
|
16206
|
+
|
|
16207
|
+
var name = null;
|
|
16208
|
+
if (mapping.name) {
|
|
16209
|
+
name = section.consumer._names.at(mapping.name);
|
|
16210
|
+
this._names.add(name);
|
|
16211
|
+
name = this._names.indexOf(name);
|
|
16212
|
+
}
|
|
16213
|
+
|
|
16214
|
+
// The mappings coming from the consumer for the section have
|
|
16215
|
+
// generated positions relative to the start of the section, so we
|
|
16216
|
+
// need to offset them to be relative to the start of the concatenated
|
|
16217
|
+
// generated file.
|
|
16218
|
+
var adjustedMapping = {
|
|
16219
|
+
source: source,
|
|
16220
|
+
generatedLine: mapping.generatedLine +
|
|
16221
|
+
(section.generatedOffset.generatedLine - 1),
|
|
16222
|
+
generatedColumn: mapping.generatedColumn +
|
|
16223
|
+
(section.generatedOffset.generatedLine === mapping.generatedLine
|
|
16224
|
+
? section.generatedOffset.generatedColumn - 1
|
|
16225
|
+
: 0),
|
|
16226
|
+
originalLine: mapping.originalLine,
|
|
16227
|
+
originalColumn: mapping.originalColumn,
|
|
16228
|
+
name: name
|
|
16229
|
+
};
|
|
16230
|
+
|
|
16231
|
+
this.__generatedMappings.push(adjustedMapping);
|
|
16232
|
+
if (typeof adjustedMapping.originalLine === 'number') {
|
|
16233
|
+
this.__originalMappings.push(adjustedMapping);
|
|
16234
|
+
}
|
|
16235
|
+
}
|
|
16236
|
+
}
|
|
16237
|
+
|
|
16238
|
+
quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
|
|
16239
|
+
quickSort(this.__originalMappings, util.compareByOriginalPositions);
|
|
16240
|
+
};
|
|
16241
|
+
|
|
16242
|
+
var IndexedSourceMapConsumer_1 = IndexedSourceMapConsumer;
|
|
16243
|
+
|
|
16244
|
+
var sourceMapConsumer = {
|
|
16245
|
+
SourceMapConsumer: SourceMapConsumer_1,
|
|
16246
|
+
BasicSourceMapConsumer: BasicSourceMapConsumer_1,
|
|
16247
|
+
IndexedSourceMapConsumer: IndexedSourceMapConsumer_1
|
|
16248
|
+
};
|
|
16249
|
+
|
|
16250
|
+
var SourceMapConsumer = sourceMapConsumer.SourceMapConsumer;
|
|
16251
|
+
|
|
16252
|
+
function tryParse ( module, acornOptions ) {
|
|
16253
|
+
try {
|
|
16254
|
+
return parse( module.code, assign( {
|
|
16255
|
+
ecmaVersion: 8,
|
|
16256
|
+
sourceType: 'module',
|
|
16257
|
+
onComment: ( block, text, start, end ) => module.comments.push( { block, text, start, end } ),
|
|
16258
|
+
preserveParens: false
|
|
16259
|
+
}, acornOptions ) );
|
|
16260
|
+
} catch ( err ) {
|
|
16261
|
+
module.error( {
|
|
16262
|
+
code: 'PARSE_ERROR',
|
|
16263
|
+
message: err.message.replace( / \(\d+:\d+\)$/, '' )
|
|
16264
|
+
}, err.pos );
|
|
16265
|
+
}
|
|
16266
|
+
}
|
|
16267
|
+
|
|
16268
|
+
function includeFully ( node ) {
|
|
16269
|
+
node.included = true;
|
|
16270
|
+
if ( node.variable && !node.variable.included ) {
|
|
16271
|
+
node.variable.includeVariable();
|
|
16272
|
+
}
|
|
16273
|
+
node.eachChild( includeFully );
|
|
16274
|
+
}
|
|
16275
|
+
|
|
16276
|
+
class Module {
|
|
16277
|
+
constructor ( ref ) {
|
|
16278
|
+
var id = ref.id;
|
|
16279
|
+
var code = ref.code;
|
|
16280
|
+
var originalCode = ref.originalCode;
|
|
16281
|
+
var originalSourcemap = ref.originalSourcemap;
|
|
16282
|
+
var ast = ref.ast;
|
|
16283
|
+
var sourcemapChain = ref.sourcemapChain;
|
|
16284
|
+
var resolvedIds = ref.resolvedIds;
|
|
16285
|
+
var resolvedExternalIds = ref.resolvedExternalIds;
|
|
16286
|
+
var bundle = ref.bundle;
|
|
16287
|
+
|
|
16288
|
+
this.code = code;
|
|
16289
|
+
this.id = id;
|
|
16290
|
+
this.bundle = bundle;
|
|
16291
|
+
this.originalCode = originalCode;
|
|
16292
|
+
this.originalSourcemap = originalSourcemap;
|
|
16293
|
+
this.sourcemapChain = sourcemapChain;
|
|
16294
|
+
|
|
16295
|
+
this.comments = [];
|
|
16296
|
+
|
|
16297
|
+
timeStart( 'ast' );
|
|
16298
|
+
|
|
16299
|
+
if ( ast ) {
|
|
16300
|
+
// prevent mutating the provided AST, as it may be reused on
|
|
16301
|
+
// subsequent incremental rebuilds
|
|
16302
|
+
this.ast = clone( ast );
|
|
16303
|
+
this.astClone = ast;
|
|
16304
|
+
} else {
|
|
16305
|
+
this.ast = tryParse( this, bundle.acornOptions ); // TODO what happens to comments if AST is provided?
|
|
16306
|
+
this.astClone = clone( this.ast );
|
|
16307
|
+
}
|
|
16308
|
+
|
|
16309
|
+
timeEnd( 'ast' );
|
|
16310
|
+
|
|
16311
|
+
this.excludeFromSourcemap = /\0/.test( id );
|
|
16312
|
+
this.context = bundle.getModuleContext( id );
|
|
16313
|
+
|
|
16314
|
+
// all dependencies
|
|
16315
|
+
this.sources = [];
|
|
16316
|
+
this.dependencies = [];
|
|
16317
|
+
this.resolvedIds = resolvedIds || blank();
|
|
16318
|
+
this.resolvedExternalIds = resolvedExternalIds || blank();
|
|
16319
|
+
|
|
16320
|
+
// imports and exports, indexed by local name
|
|
16321
|
+
this.imports = blank();
|
|
16322
|
+
this.exports = blank();
|
|
16323
|
+
this.exportsAll = blank();
|
|
16324
|
+
this.reexports = blank();
|
|
16325
|
+
|
|
16326
|
+
this.exportAllSources = [];
|
|
16327
|
+
this.exportAllModules = null;
|
|
16328
|
+
|
|
16329
|
+
// By default, `id` is the filename. Custom resolvers and loaders
|
|
16330
|
+
// can change that, but it makes sense to use it for the source filename
|
|
16331
|
+
this.magicString = new MagicString$1( code, {
|
|
16332
|
+
filename: this.excludeFromSourcemap ? null : id, // don't include plugin helpers in sourcemap
|
|
16333
|
+
indentExclusionRanges: []
|
|
16334
|
+
} );
|
|
16335
|
+
|
|
16336
|
+
// remove existing sourceMappingURL comments
|
|
16337
|
+
this.comments = this.comments.filter( comment => {
|
|
16338
|
+
//only one line comment can contain source maps
|
|
16339
|
+
const isSourceMapComment = !comment.block && SOURCEMAPPING_URL_RE.test( comment.text );
|
|
16340
|
+
if ( isSourceMapComment ) {
|
|
16341
|
+
this.magicString.remove( comment.start, comment.end );
|
|
16342
|
+
}
|
|
16343
|
+
return !isSourceMapComment;
|
|
16344
|
+
} );
|
|
16345
|
+
|
|
16346
|
+
this.declarations = blank();
|
|
16347
|
+
this.type = 'Module'; // TODO only necessary so that Scope knows this should be treated as a function scope... messy
|
|
16348
|
+
this.scope = new ModuleScope( this );
|
|
16349
|
+
|
|
16350
|
+
timeStart( 'analyse' );
|
|
16351
|
+
|
|
16352
|
+
this.analyse();
|
|
16353
|
+
|
|
16354
|
+
timeEnd( 'analyse' );
|
|
16355
|
+
|
|
16356
|
+
this.strongDependencies = [];
|
|
16357
|
+
}
|
|
16358
|
+
|
|
16359
|
+
addExport ( node ) {
|
|
16360
|
+
const source = node.source && node.source.value;
|
|
16361
|
+
|
|
16362
|
+
// export { name } from './other.js'
|
|
16363
|
+
if ( source ) {
|
|
16364
|
+
if ( !~this.sources.indexOf( source ) ) { this.sources.push( source ); }
|
|
16365
|
+
|
|
16366
|
+
if ( node.type === 'ExportAllDeclaration' ) {
|
|
16367
|
+
// Store `export * from '...'` statements in an array of delegates.
|
|
16368
|
+
// When an unknown import is encountered, we see if one of them can satisfy it.
|
|
16369
|
+
this.exportAllSources.push( source );
|
|
16370
|
+
}
|
|
16371
|
+
|
|
16372
|
+
else {
|
|
16373
|
+
node.specifiers.forEach( specifier => {
|
|
16374
|
+
const name = specifier.exported.name;
|
|
16375
|
+
|
|
16376
|
+
if ( this.exports[ name ] || this.reexports[ name ] ) {
|
|
16377
|
+
this.error( {
|
|
16378
|
+
code: 'DUPLICATE_EXPORT',
|
|
16379
|
+
message: `A module cannot have multiple exports with the same name ('${name}')`
|
|
16380
|
+
}, specifier.start );
|
|
16381
|
+
}
|
|
16382
|
+
|
|
16383
|
+
this.reexports[ name ] = {
|
|
16384
|
+
start: specifier.start,
|
|
16385
|
+
source,
|
|
16386
|
+
localName: specifier.local.name,
|
|
16387
|
+
module: null // filled in later
|
|
16388
|
+
};
|
|
16389
|
+
} );
|
|
16390
|
+
}
|
|
16391
|
+
}
|
|
16392
|
+
|
|
16393
|
+
// export default function foo () {}
|
|
16394
|
+
// export default foo;
|
|
14191
16395
|
// export default 42;
|
|
14192
16396
|
else if ( node.type === 'ExportDefaultDeclaration' ) {
|
|
14193
16397
|
const identifier = ( node.declaration.id && node.declaration.id.name ) || node.declaration.name;
|
|
@@ -14322,6 +16526,30 @@ class Module {
|
|
|
14322
16526
|
}
|
|
14323
16527
|
}
|
|
14324
16528
|
|
|
16529
|
+
getOriginalLocation (sourcemapChain, line, column) {
|
|
16530
|
+
let location = {
|
|
16531
|
+
line,
|
|
16532
|
+
column
|
|
16533
|
+
};
|
|
16534
|
+
const filteredSourcemapChain =
|
|
16535
|
+
sourcemapChain.filter(sourcemap => sourcemap.mappings).map(sourcemap => {
|
|
16536
|
+
const encodedSourcemap = sourcemap;
|
|
16537
|
+
if (sourcemap.mappings) {
|
|
16538
|
+
encodedSourcemap.mappings = encode$$1(encodedSourcemap.mappings);
|
|
16539
|
+
}
|
|
16540
|
+
return encodedSourcemap;
|
|
16541
|
+
});
|
|
16542
|
+
while (filteredSourcemapChain.length > 0) {
|
|
16543
|
+
const sourcemap = filteredSourcemapChain.pop();
|
|
16544
|
+
const smc = new SourceMapConsumer(sourcemap);
|
|
16545
|
+
location = smc.originalPositionFor({
|
|
16546
|
+
line: location.line,
|
|
16547
|
+
column: location.column
|
|
16548
|
+
});
|
|
16549
|
+
}
|
|
16550
|
+
return location;
|
|
16551
|
+
}
|
|
16552
|
+
|
|
14325
16553
|
error ( props, pos ) {
|
|
14326
16554
|
if ( pos !== undefined ) {
|
|
14327
16555
|
props.pos = pos;
|
|
@@ -14330,8 +16558,10 @@ class Module {
|
|
|
14330
16558
|
var line = ref.line;
|
|
14331
16559
|
var column = ref.column; // TODO trace sourcemaps
|
|
14332
16560
|
|
|
14333
|
-
|
|
14334
|
-
|
|
16561
|
+
const location = this.getOriginalLocation(this.sourcemapChain, line, column);
|
|
16562
|
+
|
|
16563
|
+
props.loc = { file: this.id, line: location.line, column: location.column };
|
|
16564
|
+
props.frame = getCodeFrame( this.originalCode, location.line, location.column );
|
|
14335
16565
|
}
|
|
14336
16566
|
|
|
14337
16567
|
error( props );
|
|
@@ -14964,7 +17194,7 @@ function setupNamespace ( keypath$$1 ) {
|
|
|
14964
17194
|
let acc = 'this';
|
|
14965
17195
|
|
|
14966
17196
|
return parts
|
|
14967
|
-
.map( part => ( acc += property( part ), `${acc} = ${acc} || {};`
|
|
17197
|
+
.map( part => ( acc += property( part ), `${acc} = ${acc} || {};`) )
|
|
14968
17198
|
.join( '\n' ) + '\n';
|
|
14969
17199
|
}
|
|
14970
17200
|
|
|
@@ -15056,7 +17286,7 @@ function setupNamespace$1 ( name ) {
|
|
|
15056
17286
|
|
|
15057
17287
|
let acc = 'global';
|
|
15058
17288
|
return parts
|
|
15059
|
-
.map( part => ( acc += property( part ), `${acc} = ${acc} || {}`
|
|
17289
|
+
.map( part => ( acc += property( part ), `${acc} = ${acc} || {}`) )
|
|
15060
17290
|
.concat( `${acc}${last}` )
|
|
15061
17291
|
.join( ', ' );
|
|
15062
17292
|
}
|
|
@@ -15066,7 +17296,7 @@ function safeAccess ( name ) {
|
|
|
15066
17296
|
|
|
15067
17297
|
let acc = 'global';
|
|
15068
17298
|
return parts
|
|
15069
|
-
.map( part => ( acc += property( part ), acc
|
|
17299
|
+
.map( part => ( acc += property( part ), acc) )
|
|
15070
17300
|
.join( ` && ` );
|
|
15071
17301
|
}
|
|
15072
17302
|
|
|
@@ -16567,7 +18797,7 @@ function rollup ( options ) {
|
|
|
16567
18797
|
}
|
|
16568
18798
|
}
|
|
16569
18799
|
|
|
16570
|
-
var version$1 = "0.51.
|
|
18800
|
+
var version$1 = "0.51.8";
|
|
16571
18801
|
|
|
16572
18802
|
exports.rollup = rollup;
|
|
16573
18803
|
exports.VERSION = version$1;
|