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.es.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
|
|
@@ -391,11 +391,9 @@ function encode$$1 ( decoded ) {
|
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
-
var charToInteger$1 = {};
|
|
395
394
|
var integerToChar$1 = {};
|
|
396
395
|
|
|
397
396
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split( '' ).forEach( function ( char, i ) {
|
|
398
|
-
charToInteger$1[ char ] = i;
|
|
399
397
|
integerToChar$1[ i ] = char;
|
|
400
398
|
});
|
|
401
399
|
|
|
@@ -833,23 +831,6 @@ function Mappings ( hires ) {
|
|
|
833
831
|
};
|
|
834
832
|
}
|
|
835
833
|
|
|
836
|
-
var Stats = function Stats () {
|
|
837
|
-
Object.defineProperties( this, {
|
|
838
|
-
startTimes: { value: {} }
|
|
839
|
-
});
|
|
840
|
-
};
|
|
841
|
-
|
|
842
|
-
Stats.prototype.time = function time ( label ) {
|
|
843
|
-
this.startTimes[ label ] = process.hrtime();
|
|
844
|
-
};
|
|
845
|
-
|
|
846
|
-
Stats.prototype.timeEnd = function timeEnd ( label ) {
|
|
847
|
-
var elapsed = process.hrtime( this.startTimes[ label ] );
|
|
848
|
-
|
|
849
|
-
if ( !this[ label ] ) { this[ label ] = 0; }
|
|
850
|
-
this[ label ] += elapsed[0] * 1e3 + elapsed[1] * 1e-6;
|
|
851
|
-
};
|
|
852
|
-
|
|
853
834
|
var warned = {
|
|
854
835
|
insertLeft: false,
|
|
855
836
|
insertRight: false,
|
|
@@ -2439,6 +2420,7 @@ pp$1.parseTopLevel = function(node) {
|
|
|
2439
2420
|
var stmt = this$1.parseStatement(true, true, exports);
|
|
2440
2421
|
node.body.push(stmt);
|
|
2441
2422
|
}
|
|
2423
|
+
this.adaptDirectivePrologue(node.body);
|
|
2442
2424
|
this.next();
|
|
2443
2425
|
if (this.options.ecmaVersion >= 6) {
|
|
2444
2426
|
node.sourceType = this.options.sourceType;
|
|
@@ -3219,6 +3201,22 @@ pp$1.parseImportSpecifiers = function() {
|
|
|
3219
3201
|
return nodes
|
|
3220
3202
|
};
|
|
3221
3203
|
|
|
3204
|
+
// Set `ExpressionStatement#directive` property for directive prologues.
|
|
3205
|
+
pp$1.adaptDirectivePrologue = function(statements) {
|
|
3206
|
+
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
|
|
3207
|
+
statements[i].directive = statements[i].expression.raw.slice(1, -1);
|
|
3208
|
+
}
|
|
3209
|
+
};
|
|
3210
|
+
pp$1.isDirectiveCandidate = function(statement) {
|
|
3211
|
+
return (
|
|
3212
|
+
statement.type === "ExpressionStatement" &&
|
|
3213
|
+
statement.expression.type === "Literal" &&
|
|
3214
|
+
typeof statement.expression.value === "string" &&
|
|
3215
|
+
// Reject parenthesized strings.
|
|
3216
|
+
(this.input[statement.start] === "\"" || this.input[statement.start] === "'")
|
|
3217
|
+
)
|
|
3218
|
+
};
|
|
3219
|
+
|
|
3222
3220
|
var pp$2 = Parser.prototype;
|
|
3223
3221
|
|
|
3224
3222
|
// Convert existing expression atom to assignable pattern
|
|
@@ -3333,23 +3331,19 @@ pp$2.parseRestBinding = function() {
|
|
|
3333
3331
|
// Parses lvalue (assignable) atom.
|
|
3334
3332
|
|
|
3335
3333
|
pp$2.parseBindingAtom = function() {
|
|
3336
|
-
if (this.options.ecmaVersion
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
this.next();
|
|
3344
|
-
node.elements = this.parseBindingList(types.bracketR, true, true);
|
|
3345
|
-
return this.finishNode(node, "ArrayPattern")
|
|
3346
|
-
|
|
3347
|
-
case types.braceL:
|
|
3348
|
-
return this.parseObj(true)
|
|
3334
|
+
if (this.options.ecmaVersion >= 6) {
|
|
3335
|
+
switch (this.type) {
|
|
3336
|
+
case types.bracketL:
|
|
3337
|
+
var node = this.startNode();
|
|
3338
|
+
this.next();
|
|
3339
|
+
node.elements = this.parseBindingList(types.bracketR, true, true);
|
|
3340
|
+
return this.finishNode(node, "ArrayPattern")
|
|
3349
3341
|
|
|
3350
|
-
|
|
3351
|
-
|
|
3342
|
+
case types.braceL:
|
|
3343
|
+
return this.parseObj(true)
|
|
3344
|
+
}
|
|
3352
3345
|
}
|
|
3346
|
+
return this.parseIdent()
|
|
3353
3347
|
};
|
|
3354
3348
|
|
|
3355
3349
|
pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
@@ -3662,7 +3656,7 @@ pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
|
|
|
3662
3656
|
|
|
3663
3657
|
var startPos = this.start, startLoc = this.startLoc, expr;
|
|
3664
3658
|
if (this.inAsync && this.isContextual("await")) {
|
|
3665
|
-
expr = this.parseAwait(
|
|
3659
|
+
expr = this.parseAwait();
|
|
3666
3660
|
sawUnary = true;
|
|
3667
3661
|
} else if (this.type.prefix) {
|
|
3668
3662
|
var node = this.startNode(), update = this.type === types.incDec;
|
|
@@ -3766,12 +3760,22 @@ pp$3.parseExprAtom = function(refDestructuringErrors) {
|
|
|
3766
3760
|
case types._super:
|
|
3767
3761
|
if (!this.inFunction)
|
|
3768
3762
|
{ this.raise(this.start, "'super' outside of function or class"); }
|
|
3763
|
+
node = this.startNode();
|
|
3764
|
+
this.next();
|
|
3765
|
+
// The `super` keyword can appear at below:
|
|
3766
|
+
// SuperProperty:
|
|
3767
|
+
// super [ Expression ]
|
|
3768
|
+
// super . IdentifierName
|
|
3769
|
+
// SuperCall:
|
|
3770
|
+
// super Arguments
|
|
3771
|
+
if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)
|
|
3772
|
+
{ this.unexpected(); }
|
|
3773
|
+
return this.finishNode(node, "Super")
|
|
3769
3774
|
|
|
3770
3775
|
case types._this:
|
|
3771
|
-
var type = this.type === types._this ? "ThisExpression" : "Super";
|
|
3772
3776
|
node = this.startNode();
|
|
3773
3777
|
this.next();
|
|
3774
|
-
return this.finishNode(node,
|
|
3778
|
+
return this.finishNode(node, "ThisExpression")
|
|
3775
3779
|
|
|
3776
3780
|
case types.name:
|
|
3777
3781
|
var startPos = this.start, startLoc = this.startLoc;
|
|
@@ -4006,14 +4010,14 @@ pp$3.parseTemplate = function(ref) {
|
|
|
4006
4010
|
return this.finishNode(node, "TemplateLiteral")
|
|
4007
4011
|
};
|
|
4008
4012
|
|
|
4009
|
-
// Parse an object literal or binding pattern.
|
|
4010
|
-
|
|
4011
4013
|
pp$3.isAsyncProp = function(prop) {
|
|
4012
4014
|
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
|
|
4013
4015
|
(this.type === types.name || this.type === types.num || this.type === types.string || this.type === types.bracketL || this.type.keyword) &&
|
|
4014
4016
|
!lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
4015
4017
|
};
|
|
4016
4018
|
|
|
4019
|
+
// Parse an object literal or binding pattern.
|
|
4020
|
+
|
|
4017
4021
|
pp$3.parseObj = function(isPattern, refDestructuringErrors) {
|
|
4018
4022
|
var this$1 = this;
|
|
4019
4023
|
|
|
@@ -4026,31 +4030,36 @@ pp$3.parseObj = function(isPattern, refDestructuringErrors) {
|
|
|
4026
4030
|
if (this$1.afterTrailingComma(types.braceR)) { break }
|
|
4027
4031
|
} else { first = false; }
|
|
4028
4032
|
|
|
4029
|
-
var prop = this$1.
|
|
4030
|
-
if (this$1.options.ecmaVersion >= 6) {
|
|
4031
|
-
prop.method = false;
|
|
4032
|
-
prop.shorthand = false;
|
|
4033
|
-
if (isPattern || refDestructuringErrors) {
|
|
4034
|
-
startPos = this$1.start;
|
|
4035
|
-
startLoc = this$1.startLoc;
|
|
4036
|
-
}
|
|
4037
|
-
if (!isPattern)
|
|
4038
|
-
{ isGenerator = this$1.eat(types.star); }
|
|
4039
|
-
}
|
|
4040
|
-
this$1.parsePropertyName(prop);
|
|
4041
|
-
if (!isPattern && this$1.options.ecmaVersion >= 8 && !isGenerator && this$1.isAsyncProp(prop)) {
|
|
4042
|
-
isAsync = true;
|
|
4043
|
-
this$1.parsePropertyName(prop, refDestructuringErrors);
|
|
4044
|
-
} else {
|
|
4045
|
-
isAsync = false;
|
|
4046
|
-
}
|
|
4047
|
-
this$1.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors);
|
|
4033
|
+
var prop = this$1.parseProperty(isPattern, refDestructuringErrors);
|
|
4048
4034
|
this$1.checkPropClash(prop, propHash);
|
|
4049
|
-
node.properties.push(
|
|
4035
|
+
node.properties.push(prop);
|
|
4050
4036
|
}
|
|
4051
4037
|
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
|
|
4052
4038
|
};
|
|
4053
4039
|
|
|
4040
|
+
pp$3.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
4041
|
+
var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
|
|
4042
|
+
if (this.options.ecmaVersion >= 6) {
|
|
4043
|
+
prop.method = false;
|
|
4044
|
+
prop.shorthand = false;
|
|
4045
|
+
if (isPattern || refDestructuringErrors) {
|
|
4046
|
+
startPos = this.start;
|
|
4047
|
+
startLoc = this.startLoc;
|
|
4048
|
+
}
|
|
4049
|
+
if (!isPattern)
|
|
4050
|
+
{ isGenerator = this.eat(types.star); }
|
|
4051
|
+
}
|
|
4052
|
+
this.parsePropertyName(prop);
|
|
4053
|
+
if (!isPattern && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
|
|
4054
|
+
isAsync = true;
|
|
4055
|
+
this.parsePropertyName(prop, refDestructuringErrors);
|
|
4056
|
+
} else {
|
|
4057
|
+
isAsync = false;
|
|
4058
|
+
}
|
|
4059
|
+
this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors);
|
|
4060
|
+
return this.finishNode(prop, "Property")
|
|
4061
|
+
};
|
|
4062
|
+
|
|
4054
4063
|
pp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors) {
|
|
4055
4064
|
if ((isGenerator || isAsync) && this.type === types.colon)
|
|
4056
4065
|
{ this.unexpected(); }
|
|
@@ -4063,10 +4072,11 @@ pp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
4063
4072
|
prop.kind = "init";
|
|
4064
4073
|
prop.method = true;
|
|
4065
4074
|
prop.value = this.parseMethod(isGenerator, isAsync);
|
|
4066
|
-
} else if (
|
|
4075
|
+
} else if (!isPattern &&
|
|
4076
|
+
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
|
|
4067
4077
|
(prop.key.name === "get" || prop.key.name === "set") &&
|
|
4068
4078
|
(this.type != types.comma && this.type != types.braceR)) {
|
|
4069
|
-
if (isGenerator || isAsync
|
|
4079
|
+
if (isGenerator || isAsync) { this.unexpected(); }
|
|
4070
4080
|
prop.kind = prop.key.name;
|
|
4071
4081
|
this.parsePropertyName(prop);
|
|
4072
4082
|
prop.value = this.parseMethod(false);
|
|
@@ -4214,6 +4224,7 @@ pp$3.parseFunctionBody = function(node, isArrowFunction) {
|
|
|
4214
4224
|
this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && this.isSimpleParamList(node.params));
|
|
4215
4225
|
node.body = this.parseBlock(false);
|
|
4216
4226
|
node.expression = false;
|
|
4227
|
+
this.adaptDirectivePrologue(node.body.body);
|
|
4217
4228
|
this.labels = oldLabels;
|
|
4218
4229
|
}
|
|
4219
4230
|
this.exitFunctionScope();
|
|
@@ -4281,10 +4292,6 @@ pp$3.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestruct
|
|
|
4281
4292
|
return elts
|
|
4282
4293
|
};
|
|
4283
4294
|
|
|
4284
|
-
// Parse the next token as an identifier. If `liberal` is true (used
|
|
4285
|
-
// when parsing properties), it will also convert keywords into
|
|
4286
|
-
// identifiers.
|
|
4287
|
-
|
|
4288
4295
|
pp$3.checkUnreserved = function(ref) {
|
|
4289
4296
|
var start = ref.start;
|
|
4290
4297
|
var end = ref.end;
|
|
@@ -4303,6 +4310,10 @@ pp$3.checkUnreserved = function(ref) {
|
|
|
4303
4310
|
{ this.raiseRecoverable(start, ("The keyword '" + name + "' is reserved")); }
|
|
4304
4311
|
};
|
|
4305
4312
|
|
|
4313
|
+
// Parse the next token as an identifier. If `liberal` is true (used
|
|
4314
|
+
// when parsing properties), it will also convert keywords into
|
|
4315
|
+
// identifiers.
|
|
4316
|
+
|
|
4306
4317
|
pp$3.parseIdent = function(liberal, isBinding) {
|
|
4307
4318
|
var node = this.startNode();
|
|
4308
4319
|
if (liberal && this.options.allowReserved == "never") { liberal = false; }
|
|
@@ -4310,6 +4321,15 @@ pp$3.parseIdent = function(liberal, isBinding) {
|
|
|
4310
4321
|
node.name = this.value;
|
|
4311
4322
|
} else if (this.type.keyword) {
|
|
4312
4323
|
node.name = this.type.keyword;
|
|
4324
|
+
|
|
4325
|
+
// To fix https://github.com/ternjs/acorn/issues/575
|
|
4326
|
+
// `class` and `function` keywords push new context into this.context.
|
|
4327
|
+
// But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
|
|
4328
|
+
// If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
|
|
4329
|
+
if ((node.name === "class" || node.name === "function") &&
|
|
4330
|
+
(this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
|
|
4331
|
+
this.context.pop();
|
|
4332
|
+
}
|
|
4313
4333
|
} else {
|
|
4314
4334
|
this.unexpected();
|
|
4315
4335
|
}
|
|
@@ -4860,7 +4880,7 @@ pp$8.readToken_mult_modulo_exp = function(code) { // '%*'
|
|
|
4860
4880
|
var tokentype = code === 42 ? types.star : types.modulo;
|
|
4861
4881
|
|
|
4862
4882
|
// exponentiation operator ** and **=
|
|
4863
|
-
if (this.options.ecmaVersion >= 7 && next === 42) {
|
|
4883
|
+
if (this.options.ecmaVersion >= 7 && code == 42 && next === 42) {
|
|
4864
4884
|
++size;
|
|
4865
4885
|
tokentype = types.starstar;
|
|
4866
4886
|
next = this.input.charCodeAt(this.pos + 2);
|
|
@@ -5518,7 +5538,7 @@ const UNKNOWN_VALUE = { toString: () => '[[UNKNOWN]]' };
|
|
|
5518
5538
|
|
|
5519
5539
|
const UNKNOWN_ASSIGNMENT = {
|
|
5520
5540
|
type: 'UNKNOWN',
|
|
5521
|
-
|
|
5541
|
+
reassignPath: () => {},
|
|
5522
5542
|
forEachReturnExpressionWhenCalledAtPath: () => {},
|
|
5523
5543
|
hasEffectsWhenAccessedAtPath: path$$1 => path$$1.length > 0,
|
|
5524
5544
|
hasEffectsWhenAssignedAtPath: path$$1 => path$$1.length > 0,
|
|
@@ -5529,7 +5549,7 @@ const UNKNOWN_ASSIGNMENT = {
|
|
|
5529
5549
|
|
|
5530
5550
|
const UNDEFINED_ASSIGNMENT = {
|
|
5531
5551
|
type: 'UNDEFINED',
|
|
5532
|
-
|
|
5552
|
+
reassignPath: () => {},
|
|
5533
5553
|
forEachReturnExpressionWhenCalledAtPath: () => {},
|
|
5534
5554
|
hasEffectsWhenAccessedAtPath: path$$1 => path$$1.length > 0,
|
|
5535
5555
|
hasEffectsWhenAssignedAtPath: path$$1 => path$$1.length > 0,
|
|
@@ -5553,13 +5573,10 @@ class Variable {
|
|
|
5553
5573
|
addReference ( identifier ) {}
|
|
5554
5574
|
|
|
5555
5575
|
/**
|
|
5556
|
-
* This enables variables to know which nodes need to be checked for side-effects when
|
|
5557
|
-
* e.g. an object path is called or mutated.
|
|
5558
5576
|
* @param {String[]} path
|
|
5559
|
-
* @param {Node} expression
|
|
5560
5577
|
* @param {ExecutionPathOptions} options
|
|
5561
5578
|
*/
|
|
5562
|
-
|
|
5579
|
+
reassignPath ( path$$1, options ) {}
|
|
5563
5580
|
|
|
5564
5581
|
/**
|
|
5565
5582
|
* @param {String[]} path
|
|
@@ -5718,17 +5735,15 @@ function createCommonjsModule(fn, module) {
|
|
|
5718
5735
|
|
|
5719
5736
|
var immutable = createCommonjsModule(function (module, exports) {
|
|
5720
5737
|
/**
|
|
5721
|
-
*
|
|
5722
|
-
* All rights reserved.
|
|
5738
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
5723
5739
|
*
|
|
5724
|
-
*
|
|
5725
|
-
*
|
|
5726
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
5740
|
+
* This source code is licensed under the MIT license found in the
|
|
5741
|
+
* LICENSE file in the root directory of this source tree.
|
|
5727
5742
|
*/
|
|
5728
5743
|
|
|
5729
5744
|
(function (global, factory) {
|
|
5730
5745
|
module.exports = factory();
|
|
5731
|
-
}(commonjsGlobal, function () {
|
|
5746
|
+
}(commonjsGlobal, function () { var SLICE$0 = Array.prototype.slice;
|
|
5732
5747
|
|
|
5733
5748
|
function createClass(ctor, superClass) {
|
|
5734
5749
|
if (superClass) {
|
|
@@ -7588,7 +7603,7 @@ var immutable = createCommonjsModule(function (module, exports) {
|
|
|
7588
7603
|
var newNode;
|
|
7589
7604
|
var nodes = idx1 === idx2 ?
|
|
7590
7605
|
[mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] :
|
|
7591
|
-
(
|
|
7606
|
+
(newNode = new ValueNode(ownerID, keyHash, entry), idx1 < idx2 ? [node, newNode] : [newNode, node]);
|
|
7592
7607
|
|
|
7593
7608
|
return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);
|
|
7594
7609
|
}
|
|
@@ -8549,8 +8564,7 @@ var immutable = createCommonjsModule(function (module, exports) {
|
|
|
8549
8564
|
return this._iter.__iterate(
|
|
8550
8565
|
this._useKeys ?
|
|
8551
8566
|
function(v, k) {return fn(v, k, this$0)} :
|
|
8552
|
-
(
|
|
8553
|
-
function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}),
|
|
8567
|
+
(ii = reverse ? resolveSize(this) : 0, function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}),
|
|
8554
8568
|
reverse
|
|
8555
8569
|
);
|
|
8556
8570
|
};
|
|
@@ -10985,8 +10999,8 @@ class Node$1 {
|
|
|
10985
10999
|
}
|
|
10986
11000
|
|
|
10987
11001
|
/**
|
|
10988
|
-
*
|
|
10989
|
-
* E.g., node.
|
|
11002
|
+
* Reassign a given path of an object.
|
|
11003
|
+
* E.g., node.reassignPath(['x', 'y']) is called when something
|
|
10990
11004
|
* is assigned to node.x.y.
|
|
10991
11005
|
* The default noop implementation is ok as long as hasEffectsWhenAssignedAtPath
|
|
10992
11006
|
* always returns true for this node. Otherwise it should be overridden.
|
|
@@ -10994,7 +11008,7 @@ class Node$1 {
|
|
|
10994
11008
|
* @param {Node} expression
|
|
10995
11009
|
* @param {ExecutionPathOptions} options
|
|
10996
11010
|
*/
|
|
10997
|
-
|
|
11011
|
+
reassignPath ( path$$1, options ) {}
|
|
10998
11012
|
|
|
10999
11013
|
/**
|
|
11000
11014
|
* Override to control on which children "bind" is called.
|
|
@@ -11219,9 +11233,9 @@ class ArrayExpression extends Node$1 {
|
|
|
11219
11233
|
}
|
|
11220
11234
|
|
|
11221
11235
|
class ArrayPattern extends Node$1 {
|
|
11222
|
-
|
|
11236
|
+
reassignPath ( path$$1, options ) {
|
|
11223
11237
|
path$$1.length === 0
|
|
11224
|
-
&& this.eachChild( child => child.
|
|
11238
|
+
&& this.eachChild( child => child.reassignPath( [], options ) );
|
|
11225
11239
|
}
|
|
11226
11240
|
|
|
11227
11241
|
hasEffectsWhenAssignedAtPath ( path$$1, options ) {
|
|
@@ -11235,119 +11249,89 @@ class ArrayPattern extends Node$1 {
|
|
|
11235
11249
|
}
|
|
11236
11250
|
}
|
|
11237
11251
|
|
|
11238
|
-
const SET_KEY = { type: 'SET_KEY' };
|
|
11239
11252
|
const UNKNOWN_KEY = { type: 'UNKNOWN_KEY' };
|
|
11240
11253
|
|
|
11241
|
-
|
|
11242
|
-
const UNKNOWN_KEY_ASSIGNMENT = [ UNKNOWN_KEY, { toString: ( path$$1 ) => {
|
|
11243
|
-
if ( path$$1 === void 0 ) path$$1 = '';
|
|
11244
|
-
|
|
11245
|
-
return path$$1 + '[[UNKNOWN_KEY]]';
|
|
11246
|
-
} } ];
|
|
11247
|
-
|
|
11248
|
-
class VariableShapeTracker {
|
|
11254
|
+
class ReassignedPathTracker {
|
|
11249
11255
|
constructor () {
|
|
11250
|
-
this.
|
|
11251
|
-
|
|
11252
|
-
|
|
11253
|
-
addAtPath ( path$$1, assignment ) {
|
|
11254
|
-
if ( this._assignments === UNKNOWN_ASSIGNMENTS
|
|
11255
|
-
|| (path$$1.length > 0 && this._assignments.has( UNKNOWN_KEY ) ) ) { return; }
|
|
11256
|
-
if ( path$$1.length === 0 && assignment === UNKNOWN_ASSIGNMENT ) {
|
|
11257
|
-
this._assignments = UNKNOWN_ASSIGNMENTS;
|
|
11258
|
-
} else if ( path$$1[ 0 ] === UNKNOWN_KEY ) {
|
|
11259
|
-
this._assignments = new Map( [ [ SET_KEY, this._assignments.get( SET_KEY ) ], UNKNOWN_KEY_ASSIGNMENT ] );
|
|
11260
|
-
} else if ( path$$1.length === 0 ) {
|
|
11261
|
-
this._assignments.get( SET_KEY ).add( assignment );
|
|
11262
|
-
} else {
|
|
11263
|
-
var nextPath = path$$1[0];
|
|
11264
|
-
var remainingPath = path$$1.slice(1);
|
|
11265
|
-
if ( !this._assignments.has( nextPath ) ) {
|
|
11266
|
-
this._assignments.set( nextPath, new VariableShapeTracker() );
|
|
11267
|
-
}
|
|
11268
|
-
this._assignments.get( nextPath ).addAtPath( remainingPath, assignment );
|
|
11269
|
-
}
|
|
11256
|
+
this._reassigned = false;
|
|
11257
|
+
this._unknownReassignedSubPath = false;
|
|
11258
|
+
this._subPaths = new Map();
|
|
11270
11259
|
}
|
|
11271
11260
|
|
|
11272
|
-
|
|
11273
|
-
|
|
11274
|
-
|
|
11275
|
-
this._assignments.get( SET_KEY ).forEach( assignment => callback( path$$1, assignment ) );
|
|
11276
|
-
if ( path$$1.length > 0
|
|
11277
|
-
&& nextPath !== UNKNOWN_KEY
|
|
11278
|
-
&& !this._assignments.has( UNKNOWN_KEY )
|
|
11279
|
-
&& this._assignments.has( nextPath ) ) {
|
|
11280
|
-
this._assignments.get( nextPath ).forEachAtPath( remainingPath, callback );
|
|
11261
|
+
isReassigned ( path$$1 ) {
|
|
11262
|
+
if ( path$$1.length === 0 ) {
|
|
11263
|
+
return this._reassigned;
|
|
11281
11264
|
}
|
|
11265
|
+
var subPath = path$$1[0];
|
|
11266
|
+
var remainingPath = path$$1.slice(1);
|
|
11267
|
+
return this._unknownReassignedSubPath || (
|
|
11268
|
+
this._subPaths.has( subPath ) && this._subPaths.get( subPath ).isReassigned( remainingPath )
|
|
11269
|
+
);
|
|
11282
11270
|
}
|
|
11283
11271
|
|
|
11284
|
-
|
|
11285
|
-
if ( this.
|
|
11286
|
-
if ( path$$1.length
|
|
11287
|
-
|
|
11288
|
-
var remainingPath = path$$1.slice(1);
|
|
11289
|
-
if ( nextPath === UNKNOWN_KEY || this._assignments.has( UNKNOWN_KEY ) ) { return; }
|
|
11290
|
-
if ( this._assignments.has( nextPath ) ) {
|
|
11291
|
-
this._assignments.get( nextPath ).forEachAssignedToPath( remainingPath, callback );
|
|
11292
|
-
}
|
|
11272
|
+
reassignPath ( path$$1 ) {
|
|
11273
|
+
if ( this._reassigned ) { return; }
|
|
11274
|
+
if ( path$$1.length === 0 ) {
|
|
11275
|
+
this._reassigned = true;
|
|
11293
11276
|
} else {
|
|
11294
|
-
this.
|
|
11295
|
-
this._assignments.forEach( ( assignment, subPath ) => {
|
|
11296
|
-
if ( subPath !== SET_KEY ) {
|
|
11297
|
-
assignment.forEachAssignedToPath( [],
|
|
11298
|
-
( relativePath, assignment ) => callback( [ subPath ].concat( relativePath ), assignment ) );
|
|
11299
|
-
}
|
|
11300
|
-
} );
|
|
11277
|
+
this._reassignSubPath( path$$1 );
|
|
11301
11278
|
}
|
|
11302
11279
|
}
|
|
11303
11280
|
|
|
11304
|
-
|
|
11305
|
-
if ( this.
|
|
11306
|
-
|
|
11307
|
-
|
|
11281
|
+
_reassignSubPath ( path$$1 ) {
|
|
11282
|
+
if ( this._unknownReassignedSubPath ) { return; }
|
|
11283
|
+
var subPath = path$$1[0];
|
|
11284
|
+
var remainingPath = path$$1.slice(1);
|
|
11285
|
+
if ( subPath === UNKNOWN_KEY ) {
|
|
11286
|
+
this._unknownReassignedSubPath = true;
|
|
11308
11287
|
} else {
|
|
11309
|
-
if ( this.
|
|
11310
|
-
|
|
11311
|
-
var remainingPath = path$$1.slice(1);
|
|
11312
|
-
if ( !this._assignments.has( nextPath ) ) {
|
|
11313
|
-
return false;
|
|
11288
|
+
if ( !this._subPaths.has( subPath ) ) {
|
|
11289
|
+
this._subPaths.set( subPath, new ReassignedPathTracker() );
|
|
11314
11290
|
}
|
|
11315
|
-
|
|
11291
|
+
this._subPaths.get( subPath ).reassignPath( remainingPath );
|
|
11316
11292
|
}
|
|
11317
11293
|
}
|
|
11318
11294
|
|
|
11319
|
-
|
|
11320
|
-
|
|
11295
|
+
someReassignedPath ( path$$1, callback ) {
|
|
11296
|
+
return this._reassigned
|
|
11297
|
+
? callback( path$$1, UNKNOWN_ASSIGNMENT )
|
|
11298
|
+
: path$$1.length >= 1 && this._onSubPathIfReassigned( path$$1, callback );
|
|
11299
|
+
}
|
|
11300
|
+
|
|
11301
|
+
_onSubPathIfReassigned ( path$$1, callback ) {
|
|
11302
|
+
var subPath = path$$1[0];
|
|
11321
11303
|
var remainingPath = path$$1.slice(1);
|
|
11322
|
-
return
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
|
|
11327
|
-
|
|
11328
|
-
|
|
11329
|
-
|
|
11330
|
-
|
|
11331
|
-
|
|
11304
|
+
return this._unknownReassignedSubPath || subPath === UNKNOWN_KEY
|
|
11305
|
+
? callback( remainingPath, UNKNOWN_ASSIGNMENT )
|
|
11306
|
+
: this._subPaths.has( subPath ) && this._subPaths.get( subPath ).someReassignedPath( remainingPath, callback );
|
|
11307
|
+
}
|
|
11308
|
+
}
|
|
11309
|
+
|
|
11310
|
+
class VariableReassignmentTracker {
|
|
11311
|
+
constructor ( initialExpression ) {
|
|
11312
|
+
this._initialExpression = initialExpression;
|
|
11313
|
+
this._reassignedPathTracker = new ReassignedPathTracker();
|
|
11332
11314
|
}
|
|
11333
11315
|
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11316
|
+
reassignPath ( path$$1, options ) {
|
|
11317
|
+
if ( path$$1.length > 0 ) {
|
|
11318
|
+
this._initialExpression && this._initialExpression.reassignPath( path$$1, options );
|
|
11319
|
+
}
|
|
11320
|
+
this._reassignedPathTracker.reassignPath( path$$1, options );
|
|
11321
|
+
}
|
|
11337
11322
|
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11323
|
+
forEachAtPath ( path$$1, callback ) {
|
|
11324
|
+
this._initialExpression && callback( path$$1, this._initialExpression );
|
|
11325
|
+
}
|
|
11341
11326
|
|
|
11342
|
-
|
|
11343
|
-
|
|
11344
|
-
|
|
11345
|
-
} ).join( '\n' );
|
|
11327
|
+
someAtPath ( path$$1, predicateFunction ) {
|
|
11328
|
+
return this._reassignedPathTracker.someReassignedPath( path$$1, predicateFunction )
|
|
11329
|
+
|| (this._initialExpression && predicateFunction( path$$1, this._initialExpression ));
|
|
11346
11330
|
}
|
|
11347
11331
|
}
|
|
11348
11332
|
|
|
11349
|
-
// To avoid
|
|
11350
|
-
const
|
|
11333
|
+
// To avoid infinite recursions
|
|
11334
|
+
const MAX_PATH_DEPTH = 7;
|
|
11351
11335
|
|
|
11352
11336
|
class LocalVariable extends Variable {
|
|
11353
11337
|
constructor ( name, declarator, init ) {
|
|
@@ -11355,34 +11339,25 @@ class LocalVariable extends Variable {
|
|
|
11355
11339
|
this.isReassigned = false;
|
|
11356
11340
|
this.exportName = null;
|
|
11357
11341
|
this.declarations = new Set( declarator ? [ declarator ] : null );
|
|
11358
|
-
this.boundExpressions = new
|
|
11359
|
-
init && this.boundExpressions.addAtPath( [], init );
|
|
11342
|
+
this.boundExpressions = new VariableReassignmentTracker( init );
|
|
11360
11343
|
}
|
|
11361
11344
|
|
|
11362
11345
|
addDeclaration ( identifier ) {
|
|
11363
11346
|
this.declarations.add( identifier );
|
|
11364
11347
|
}
|
|
11365
11348
|
|
|
11366
|
-
|
|
11367
|
-
if (
|
|
11368
|
-
|
|
11369
|
-
}
|
|
11370
|
-
if ( path$$1.length > MAX_PATH_LENGTH || expression === this || this.boundExpressions.hasAtPath( path$$1, expression ) ) { return; }
|
|
11371
|
-
this.boundExpressions.addAtPath( path$$1, expression );
|
|
11372
|
-
this.boundExpressions.forEachAssignedToPath( path$$1, ( subPath, node ) => {
|
|
11373
|
-
subPath.length > 0
|
|
11374
|
-
&& expression.bindAssignmentAtPath( subPath, node, options );
|
|
11375
|
-
} );
|
|
11376
|
-
if ( path$$1.length > 0 ) {
|
|
11377
|
-
this.boundExpressions.forEachAtPath( path$$1.slice( 0, -1 ), ( relativePath, node ) =>
|
|
11378
|
-
node.bindAssignmentAtPath( relativePath.concat( path$$1.slice( -1 ) ), expression, options ) );
|
|
11379
|
-
} else {
|
|
11349
|
+
reassignPath ( path$$1, options ) {
|
|
11350
|
+
if ( path$$1.length > MAX_PATH_DEPTH ) { return; }
|
|
11351
|
+
if ( path$$1.length === 0 ) {
|
|
11380
11352
|
this.isReassigned = true;
|
|
11381
11353
|
}
|
|
11354
|
+
if ( !options.hasNodeBeenAssignedAtPath( path$$1, this ) ) {
|
|
11355
|
+
this.boundExpressions.reassignPath( path$$1, options.addAssignedNodeAtPath( path$$1, this ) );
|
|
11356
|
+
}
|
|
11382
11357
|
}
|
|
11383
11358
|
|
|
11384
11359
|
forEachReturnExpressionWhenCalledAtPath ( path$$1, callOptions, callback, options ) {
|
|
11385
|
-
if ( path$$1.length >
|
|
11360
|
+
if ( path$$1.length > MAX_PATH_DEPTH ) { return; }
|
|
11386
11361
|
this.boundExpressions.forEachAtPath( path$$1, ( relativePath, node ) =>
|
|
11387
11362
|
!options.hasNodeBeenCalledAtPathWithOptions( relativePath, node, callOptions ) && node
|
|
11388
11363
|
.forEachReturnExpressionWhenCalledAtPath( relativePath, callOptions, callback,
|
|
@@ -11397,7 +11372,7 @@ class LocalVariable extends Variable {
|
|
|
11397
11372
|
}
|
|
11398
11373
|
|
|
11399
11374
|
hasEffectsWhenAccessedAtPath ( path$$1, options ) {
|
|
11400
|
-
return path$$1.length >
|
|
11375
|
+
return path$$1.length > MAX_PATH_DEPTH
|
|
11401
11376
|
|| this.boundExpressions.someAtPath( path$$1, ( relativePath, node ) =>
|
|
11402
11377
|
relativePath.length > 0
|
|
11403
11378
|
&& !options.hasNodeBeenAccessedAtPath( relativePath, node )
|
|
@@ -11406,7 +11381,7 @@ class LocalVariable extends Variable {
|
|
|
11406
11381
|
|
|
11407
11382
|
hasEffectsWhenAssignedAtPath ( path$$1, options ) {
|
|
11408
11383
|
return this.included
|
|
11409
|
-
|| path$$1.length >
|
|
11384
|
+
|| path$$1.length > MAX_PATH_DEPTH
|
|
11410
11385
|
|| this.boundExpressions.someAtPath( path$$1, ( relativePath, node ) =>
|
|
11411
11386
|
relativePath.length > 0
|
|
11412
11387
|
&& !options.hasNodeBeenAssignedAtPath( relativePath, node ) && node
|
|
@@ -11415,7 +11390,7 @@ class LocalVariable extends Variable {
|
|
|
11415
11390
|
}
|
|
11416
11391
|
|
|
11417
11392
|
hasEffectsWhenCalledAtPath ( path$$1, callOptions, options ) {
|
|
11418
|
-
return path$$1.length >
|
|
11393
|
+
return path$$1.length > MAX_PATH_DEPTH
|
|
11419
11394
|
|| (this.included && path$$1.length > 0)
|
|
11420
11395
|
|| this.boundExpressions.someAtPath( path$$1, ( relativePath, node ) =>
|
|
11421
11396
|
!options.hasNodeBeenCalledAtPathWithOptions( relativePath, node, callOptions ) && node
|
|
@@ -11431,7 +11406,7 @@ class LocalVariable extends Variable {
|
|
|
11431
11406
|
}
|
|
11432
11407
|
|
|
11433
11408
|
someReturnExpressionWhenCalledAtPath ( path$$1, callOptions, predicateFunction, options ) {
|
|
11434
|
-
return path$$1.length >
|
|
11409
|
+
return path$$1.length > MAX_PATH_DEPTH
|
|
11435
11410
|
|| (this.included && path$$1.length > 0)
|
|
11436
11411
|
|| this.boundExpressions.someAtPath( path$$1, ( relativePath, node ) =>
|
|
11437
11412
|
!options.hasNodeBeenCalledAtPathWithOptions( relativePath, node, callOptions ) && node
|
|
@@ -11509,7 +11484,7 @@ class Scope {
|
|
|
11509
11484
|
if ( this.variables[ name ] ) {
|
|
11510
11485
|
const variable = this.variables[ name ];
|
|
11511
11486
|
variable.addDeclaration( identifier );
|
|
11512
|
-
|
|
11487
|
+
variable.reassignPath( [], ExecutionPathOptions.create() );
|
|
11513
11488
|
} else {
|
|
11514
11489
|
this.variables[ name ] = new LocalVariable( identifier.name, identifier, options.init || UNDEFINED_ASSIGNMENT );
|
|
11515
11490
|
}
|
|
@@ -11729,7 +11704,7 @@ function disallowIllegalReassignment ( scope, node ) {
|
|
|
11729
11704
|
class AssignmentExpression extends Node$1 {
|
|
11730
11705
|
bindNode () {
|
|
11731
11706
|
disallowIllegalReassignment( this.scope, this.left );
|
|
11732
|
-
this.left.
|
|
11707
|
+
this.left.reassignPath( [], ExecutionPathOptions.create() );
|
|
11733
11708
|
}
|
|
11734
11709
|
|
|
11735
11710
|
hasEffects ( options ) {
|
|
@@ -11744,12 +11719,12 @@ class AssignmentExpression extends Node$1 {
|
|
|
11744
11719
|
|
|
11745
11720
|
class AssignmentPattern extends Node$1 {
|
|
11746
11721
|
bindNode () {
|
|
11747
|
-
this.left.
|
|
11722
|
+
this.left.reassignPath( [], ExecutionPathOptions.create() );
|
|
11748
11723
|
}
|
|
11749
11724
|
|
|
11750
|
-
|
|
11725
|
+
reassignPath ( path$$1, options ) {
|
|
11751
11726
|
path$$1.length === 0
|
|
11752
|
-
&& this.left.
|
|
11727
|
+
&& this.left.reassignPath( path$$1, options );
|
|
11753
11728
|
}
|
|
11754
11729
|
|
|
11755
11730
|
hasEffectsWhenAssignedAtPath ( path$$1, options ) {
|
|
@@ -11922,10 +11897,10 @@ class CallOptions {
|
|
|
11922
11897
|
}
|
|
11923
11898
|
|
|
11924
11899
|
class CallExpression extends Node$1 {
|
|
11925
|
-
|
|
11900
|
+
reassignPath ( path$$1, options ) {
|
|
11926
11901
|
!options.hasReturnExpressionBeenAssignedAtPath( path$$1, this )
|
|
11927
11902
|
&& this.callee.forEachReturnExpressionWhenCalledAtPath( [], this._callOptions, innerOptions => node =>
|
|
11928
|
-
node.
|
|
11903
|
+
node.reassignPath( path$$1, innerOptions.addAssignedReturnExpressionAtPath( path$$1, this ) ), options );
|
|
11929
11904
|
}
|
|
11930
11905
|
|
|
11931
11906
|
bindNode () {
|
|
@@ -12075,9 +12050,9 @@ class ClassExpression extends ClassNode {
|
|
|
12075
12050
|
}
|
|
12076
12051
|
|
|
12077
12052
|
class ConditionalExpression extends Node$1 {
|
|
12078
|
-
|
|
12053
|
+
reassignPath ( path$$1, options ) {
|
|
12079
12054
|
path$$1.length > 0
|
|
12080
|
-
&& this._forEachRelevantBranch( node => node.
|
|
12055
|
+
&& this._forEachRelevantBranch( node => node.reassignPath( path$$1, options ) );
|
|
12081
12056
|
}
|
|
12082
12057
|
|
|
12083
12058
|
forEachReturnExpressionWhenCalledAtPath ( path$$1, callOptions, callback, options ) {
|
|
@@ -12113,20 +12088,17 @@ class ConditionalExpression extends Node$1 {
|
|
|
12113
12088
|
}
|
|
12114
12089
|
|
|
12115
12090
|
initialiseChildren ( parentScope ) {
|
|
12091
|
+
super.initialiseChildren( parentScope );
|
|
12116
12092
|
if ( this.module.bundle.treeshake ) {
|
|
12117
12093
|
this.testValue = this.test.getValue();
|
|
12118
12094
|
|
|
12119
12095
|
if ( this.testValue === UNKNOWN_VALUE ) {
|
|
12120
|
-
|
|
12096
|
+
return;
|
|
12121
12097
|
} else if ( this.testValue ) {
|
|
12122
|
-
this.consequent.initialise( this.scope );
|
|
12123
12098
|
this.alternate = null;
|
|
12124
12099
|
} else if ( this.alternate ) {
|
|
12125
|
-
this.alternate.initialise( this.scope );
|
|
12126
12100
|
this.consequent = null;
|
|
12127
12101
|
}
|
|
12128
|
-
} else {
|
|
12129
|
-
super.initialiseChildren( parentScope );
|
|
12130
12102
|
}
|
|
12131
12103
|
}
|
|
12132
12104
|
|
|
@@ -12393,7 +12365,7 @@ class ForInStatement extends Statement {
|
|
|
12393
12365
|
|
|
12394
12366
|
class ForOfStatement extends Statement {
|
|
12395
12367
|
bindNode () {
|
|
12396
|
-
this.left.
|
|
12368
|
+
this.left.reassignPath( [], ExecutionPathOptions.create() );
|
|
12397
12369
|
}
|
|
12398
12370
|
|
|
12399
12371
|
hasEffects ( options ) {
|
|
@@ -12433,10 +12405,10 @@ class ArgumentsVariable extends LocalVariable {
|
|
|
12433
12405
|
this._parameters = parameters;
|
|
12434
12406
|
}
|
|
12435
12407
|
|
|
12436
|
-
|
|
12408
|
+
reassignPath ( path$$1, options ) {
|
|
12437
12409
|
if ( path$$1.length > 0 ) {
|
|
12438
12410
|
if ( path$$1[ 0 ] >= 0 && this._parameters[ path$$1[ 0 ] ] ) {
|
|
12439
|
-
this._parameters[ path$$1[ 0 ] ].
|
|
12411
|
+
this._parameters[ path$$1[ 0 ] ].reassignPath( path$$1.slice( 1 ), options );
|
|
12440
12412
|
}
|
|
12441
12413
|
}
|
|
12442
12414
|
}
|
|
@@ -12632,10 +12604,10 @@ function isReference (node, parent) {
|
|
|
12632
12604
|
}
|
|
12633
12605
|
|
|
12634
12606
|
class Identifier extends Node$1 {
|
|
12635
|
-
|
|
12607
|
+
reassignPath ( path$$1, options ) {
|
|
12636
12608
|
this._bindVariableIfMissing();
|
|
12637
12609
|
this.variable
|
|
12638
|
-
&& this.variable.
|
|
12610
|
+
&& this.variable.reassignPath( path$$1, options );
|
|
12639
12611
|
}
|
|
12640
12612
|
|
|
12641
12613
|
bindNode () {
|
|
@@ -12875,9 +12847,9 @@ class Literal extends Node$1 {
|
|
|
12875
12847
|
}
|
|
12876
12848
|
|
|
12877
12849
|
class LogicalExpression extends Node$1 {
|
|
12878
|
-
|
|
12850
|
+
reassignPath ( path$$1, options ) {
|
|
12879
12851
|
path$$1.length > 0
|
|
12880
|
-
&& this._forEachRelevantBranch( node => node.
|
|
12852
|
+
&& this._forEachRelevantBranch( node => node.reassignPath( path$$1, options ) );
|
|
12881
12853
|
}
|
|
12882
12854
|
|
|
12883
12855
|
forEachReturnExpressionWhenCalledAtPath ( path$$1, callOptions, callback, options ) {
|
|
@@ -13023,12 +12995,12 @@ class MemberExpression extends Node$1 {
|
|
|
13023
12995
|
}
|
|
13024
12996
|
}
|
|
13025
12997
|
|
|
13026
|
-
|
|
12998
|
+
reassignPath ( path$$1, options ) {
|
|
13027
12999
|
if ( !this._bound ) { this.bind(); }
|
|
13028
13000
|
if ( this.variable ) {
|
|
13029
|
-
this.variable.
|
|
13001
|
+
this.variable.reassignPath( path$$1, options );
|
|
13030
13002
|
} else {
|
|
13031
|
-
this.object.
|
|
13003
|
+
this.object.reassignPath( [ this._getPathSegment() ].concat( path$$1 ), options );
|
|
13032
13004
|
}
|
|
13033
13005
|
}
|
|
13034
13006
|
|
|
@@ -13140,7 +13112,7 @@ const PROPERTY_KINDS_READ = [ 'init', 'get' ];
|
|
|
13140
13112
|
const PROPERTY_KINDS_WRITE = [ 'init', 'set' ];
|
|
13141
13113
|
|
|
13142
13114
|
class ObjectExpression extends Node$1 {
|
|
13143
|
-
|
|
13115
|
+
reassignPath ( path$$1, options ) {
|
|
13144
13116
|
if ( path$$1.length === 0 ) { return; }
|
|
13145
13117
|
|
|
13146
13118
|
var ref = this._getPossiblePropertiesWithName(
|
|
@@ -13149,7 +13121,7 @@ class ObjectExpression extends Node$1 {
|
|
|
13149
13121
|
var hasCertainHit = ref.hasCertainHit;
|
|
13150
13122
|
(path$$1.length === 1 || hasCertainHit)
|
|
13151
13123
|
&& properties.forEach( property => (path$$1.length > 1 || property.kind === 'set')
|
|
13152
|
-
&& property.
|
|
13124
|
+
&& property.reassignPath( path$$1.slice( 1 ), options ) );
|
|
13153
13125
|
}
|
|
13154
13126
|
|
|
13155
13127
|
forEachReturnExpressionWhenCalledAtPath ( path$$1, callOptions, callback, options ) {
|
|
@@ -13227,9 +13199,9 @@ class ObjectExpression extends Node$1 {
|
|
|
13227
13199
|
}
|
|
13228
13200
|
|
|
13229
13201
|
class ObjectPattern extends Node$1 {
|
|
13230
|
-
|
|
13202
|
+
reassignPath ( path$$1, options ) {
|
|
13231
13203
|
path$$1.length === 0
|
|
13232
|
-
&& this.properties.forEach( child => child.
|
|
13204
|
+
&& this.properties.forEach( child => child.reassignPath( path$$1, options ) );
|
|
13233
13205
|
}
|
|
13234
13206
|
|
|
13235
13207
|
hasEffectsWhenAssignedAtPath ( path$$1, options ) {
|
|
@@ -13244,13 +13216,13 @@ class ObjectPattern extends Node$1 {
|
|
|
13244
13216
|
}
|
|
13245
13217
|
|
|
13246
13218
|
class Property extends Node$1 {
|
|
13247
|
-
|
|
13219
|
+
reassignPath ( path$$1, options ) {
|
|
13248
13220
|
if ( this.kind === 'get' ) {
|
|
13249
13221
|
path$$1.length > 0
|
|
13250
13222
|
&& this.value.forEachReturnExpressionWhenCalledAtPath( [], this._accessorCallOptions, innerOptions => node =>
|
|
13251
|
-
node.
|
|
13223
|
+
node.reassignPath( path$$1, innerOptions.addAssignedReturnExpressionAtPath( path$$1, this ) ), options );
|
|
13252
13224
|
} else if ( this.kind !== 'set' ) {
|
|
13253
|
-
this.value.
|
|
13225
|
+
this.value.reassignPath( path$$1, options );
|
|
13254
13226
|
}
|
|
13255
13227
|
}
|
|
13256
13228
|
|
|
@@ -13330,9 +13302,9 @@ class Property extends Node$1 {
|
|
|
13330
13302
|
}
|
|
13331
13303
|
|
|
13332
13304
|
class RestElement extends Node$1 {
|
|
13333
|
-
|
|
13305
|
+
reassignPath ( path$$1, options ) {
|
|
13334
13306
|
path$$1.length === 0
|
|
13335
|
-
&& this.argument.
|
|
13307
|
+
&& this.argument.reassignPath( [], options );
|
|
13336
13308
|
}
|
|
13337
13309
|
|
|
13338
13310
|
hasEffectsWhenAssignedAtPath ( path$$1, options ) {
|
|
@@ -13391,6 +13363,10 @@ class SequenceExpression extends Node$1 {
|
|
|
13391
13363
|
const last = this.expressions[ this.expressions.length - 1 ];
|
|
13392
13364
|
last.render( code, es );
|
|
13393
13365
|
|
|
13366
|
+
if ( this.parent.type === 'CallExpression' && last.type === 'MemberExpression' && this.expressions.length > 1 ) {
|
|
13367
|
+
this.expressions[0].included = true;
|
|
13368
|
+
}
|
|
13369
|
+
|
|
13394
13370
|
const included = this.expressions.slice( 0, this.expressions.length - 1 ).filter( expression => expression.included );
|
|
13395
13371
|
if ( included.length === 0 ) {
|
|
13396
13372
|
code.remove( this.start, last.start );
|
|
@@ -13539,7 +13515,7 @@ const operators$1 = {
|
|
|
13539
13515
|
class UnaryExpression extends Node$1 {
|
|
13540
13516
|
bindNode () {
|
|
13541
13517
|
if ( this.operator === 'delete' ) {
|
|
13542
|
-
this.argument.
|
|
13518
|
+
this.argument.reassignPath( [], ExecutionPathOptions.create() );
|
|
13543
13519
|
}
|
|
13544
13520
|
}
|
|
13545
13521
|
|
|
@@ -13567,24 +13543,10 @@ class UnaryExpression extends Node$1 {
|
|
|
13567
13543
|
}
|
|
13568
13544
|
}
|
|
13569
13545
|
|
|
13570
|
-
class VirtualNumberLiteral extends Node$1 {
|
|
13571
|
-
hasEffectsWhenAccessedAtPath ( path$$1 ) {
|
|
13572
|
-
return path$$1.length > 1;
|
|
13573
|
-
}
|
|
13574
|
-
|
|
13575
|
-
hasEffectsWhenAssignedAtPath ( path$$1 ) {
|
|
13576
|
-
return path$$1.length > 1;
|
|
13577
|
-
}
|
|
13578
|
-
|
|
13579
|
-
toString () {
|
|
13580
|
-
return '[[VIRTUAL NUMBER]]';
|
|
13581
|
-
}
|
|
13582
|
-
}
|
|
13583
|
-
|
|
13584
13546
|
class UpdateExpression extends Node$1 {
|
|
13585
13547
|
bindNode () {
|
|
13586
13548
|
disallowIllegalReassignment( this.scope, this.argument );
|
|
13587
|
-
this.argument.
|
|
13549
|
+
this.argument.reassignPath( [], ExecutionPathOptions.create() );
|
|
13588
13550
|
if ( this.argument.type === 'Identifier' ) {
|
|
13589
13551
|
const variable = this.scope.findVariable( this.argument.name );
|
|
13590
13552
|
variable.isReassigned = true;
|
|
@@ -13602,8 +13564,8 @@ class UpdateExpression extends Node$1 {
|
|
|
13602
13564
|
}
|
|
13603
13565
|
|
|
13604
13566
|
class VariableDeclarator extends Node$1 {
|
|
13605
|
-
|
|
13606
|
-
this.id.
|
|
13567
|
+
reassignPath ( path$$1, options ) {
|
|
13568
|
+
this.id.reassignPath( path$$1, options );
|
|
13607
13569
|
}
|
|
13608
13570
|
|
|
13609
13571
|
initialiseDeclarator ( parentScope, kind ) {
|
|
@@ -13646,8 +13608,8 @@ function getSeparator ( code, start ) {
|
|
|
13646
13608
|
const forStatement = /^For(?:Of|In)?Statement/;
|
|
13647
13609
|
|
|
13648
13610
|
class VariableDeclaration extends Node$1 {
|
|
13649
|
-
|
|
13650
|
-
this.eachChild( child => child.
|
|
13611
|
+
reassignPath () {
|
|
13612
|
+
this.eachChild( child => child.reassignPath( [], ExecutionPathOptions.create() ) );
|
|
13651
13613
|
}
|
|
13652
13614
|
|
|
13653
13615
|
hasEffectsWhenAssignedAtPath () {
|
|
@@ -13997,149 +13959,2391 @@ class ModuleScope extends Scope {
|
|
|
13997
13959
|
}
|
|
13998
13960
|
}
|
|
13999
13961
|
|
|
14000
|
-
|
|
14001
|
-
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
preserveParens: false
|
|
14007
|
-
}, acornOptions ) );
|
|
14008
|
-
} catch ( err ) {
|
|
14009
|
-
module.error( {
|
|
14010
|
-
code: 'PARSE_ERROR',
|
|
14011
|
-
message: err.message.replace( / \(\d+:\d+\)$/, '' )
|
|
14012
|
-
}, err.pos );
|
|
14013
|
-
}
|
|
14014
|
-
}
|
|
13962
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
13963
|
+
/*
|
|
13964
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
13965
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
13966
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
13967
|
+
*/
|
|
14015
13968
|
|
|
14016
|
-
|
|
14017
|
-
node.included = true;
|
|
14018
|
-
if ( node.variable && !node.variable.included ) {
|
|
14019
|
-
node.variable.includeVariable();
|
|
14020
|
-
}
|
|
14021
|
-
node.eachChild( includeFully );
|
|
14022
|
-
}
|
|
13969
|
+
var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
|
|
14023
13970
|
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
|
|
14030
|
-
|
|
14031
|
-
|
|
14032
|
-
|
|
14033
|
-
var resolvedExternalIds = ref.resolvedExternalIds;
|
|
14034
|
-
var bundle = ref.bundle;
|
|
13971
|
+
/**
|
|
13972
|
+
* Encode an integer in the range of 0 to 63 to a single base 64 digit.
|
|
13973
|
+
*/
|
|
13974
|
+
var encode$2 = function (number) {
|
|
13975
|
+
if (0 <= number && number < intToCharMap.length) {
|
|
13976
|
+
return intToCharMap[number];
|
|
13977
|
+
}
|
|
13978
|
+
throw new TypeError("Must be between 0 and 63: " + number);
|
|
13979
|
+
};
|
|
14035
13980
|
|
|
14036
|
-
|
|
14037
|
-
|
|
14038
|
-
|
|
14039
|
-
|
|
14040
|
-
|
|
14041
|
-
|
|
13981
|
+
/**
|
|
13982
|
+
* Decode a single base 64 character code digit to an integer. Returns -1 on
|
|
13983
|
+
* failure.
|
|
13984
|
+
*/
|
|
13985
|
+
var decode$2 = function (charCode) {
|
|
13986
|
+
var bigA = 65; // 'A'
|
|
13987
|
+
var bigZ = 90; // 'Z'
|
|
14042
13988
|
|
|
14043
|
-
|
|
13989
|
+
var littleA = 97; // 'a'
|
|
13990
|
+
var littleZ = 122; // 'z'
|
|
14044
13991
|
|
|
14045
|
-
|
|
13992
|
+
var zero = 48; // '0'
|
|
13993
|
+
var nine = 57; // '9'
|
|
14046
13994
|
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
// subsequent incremental rebuilds
|
|
14050
|
-
this.ast = clone( ast );
|
|
14051
|
-
this.astClone = ast;
|
|
14052
|
-
} else {
|
|
14053
|
-
this.ast = tryParse( this, bundle.acornOptions ); // TODO what happens to comments if AST is provided?
|
|
14054
|
-
this.astClone = clone( this.ast );
|
|
14055
|
-
}
|
|
13995
|
+
var plus = 43; // '+'
|
|
13996
|
+
var slash = 47; // '/'
|
|
14056
13997
|
|
|
14057
|
-
|
|
13998
|
+
var littleOffset = 26;
|
|
13999
|
+
var numberOffset = 52;
|
|
14058
14000
|
|
|
14059
|
-
|
|
14060
|
-
|
|
14001
|
+
// 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
|
14002
|
+
if (bigA <= charCode && charCode <= bigZ) {
|
|
14003
|
+
return (charCode - bigA);
|
|
14004
|
+
}
|
|
14061
14005
|
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
this.resolvedExternalIds = resolvedExternalIds || blank();
|
|
14006
|
+
// 26 - 51: abcdefghijklmnopqrstuvwxyz
|
|
14007
|
+
if (littleA <= charCode && charCode <= littleZ) {
|
|
14008
|
+
return (charCode - littleA + littleOffset);
|
|
14009
|
+
}
|
|
14067
14010
|
|
|
14068
|
-
|
|
14069
|
-
|
|
14070
|
-
|
|
14071
|
-
|
|
14072
|
-
this.reexports = blank();
|
|
14011
|
+
// 52 - 61: 0123456789
|
|
14012
|
+
if (zero <= charCode && charCode <= nine) {
|
|
14013
|
+
return (charCode - zero + numberOffset);
|
|
14014
|
+
}
|
|
14073
14015
|
|
|
14074
|
-
|
|
14075
|
-
|
|
14016
|
+
// 62: +
|
|
14017
|
+
if (charCode == plus) {
|
|
14018
|
+
return 62;
|
|
14019
|
+
}
|
|
14076
14020
|
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
indentExclusionRanges: []
|
|
14082
|
-
} );
|
|
14021
|
+
// 63: /
|
|
14022
|
+
if (charCode == slash) {
|
|
14023
|
+
return 63;
|
|
14024
|
+
}
|
|
14083
14025
|
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
const isSourceMapComment = !comment.block && SOURCEMAPPING_URL_RE.test( comment.text );
|
|
14088
|
-
if ( isSourceMapComment ) {
|
|
14089
|
-
this.magicString.remove( comment.start, comment.end );
|
|
14090
|
-
}
|
|
14091
|
-
return !isSourceMapComment;
|
|
14092
|
-
} );
|
|
14026
|
+
// Invalid base64 digit.
|
|
14027
|
+
return -1;
|
|
14028
|
+
};
|
|
14093
14029
|
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14030
|
+
var base64 = {
|
|
14031
|
+
encode: encode$2,
|
|
14032
|
+
decode: decode$2
|
|
14033
|
+
};
|
|
14097
14034
|
|
|
14098
|
-
|
|
14035
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
14036
|
+
/*
|
|
14037
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
14038
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
14039
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
14040
|
+
*
|
|
14041
|
+
* Based on the Base 64 VLQ implementation in Closure Compiler:
|
|
14042
|
+
* https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
|
|
14043
|
+
*
|
|
14044
|
+
* Copyright 2011 The Closure Compiler Authors. All rights reserved.
|
|
14045
|
+
* Redistribution and use in source and binary forms, with or without
|
|
14046
|
+
* modification, are permitted provided that the following conditions are
|
|
14047
|
+
* met:
|
|
14048
|
+
*
|
|
14049
|
+
* * Redistributions of source code must retain the above copyright
|
|
14050
|
+
* notice, this list of conditions and the following disclaimer.
|
|
14051
|
+
* * Redistributions in binary form must reproduce the above
|
|
14052
|
+
* copyright notice, this list of conditions and the following
|
|
14053
|
+
* disclaimer in the documentation and/or other materials provided
|
|
14054
|
+
* with the distribution.
|
|
14055
|
+
* * Neither the name of Google Inc. nor the names of its
|
|
14056
|
+
* contributors may be used to endorse or promote products derived
|
|
14057
|
+
* from this software without specific prior written permission.
|
|
14058
|
+
*
|
|
14059
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
14060
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
14061
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
14062
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
14063
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
14064
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
14065
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
14066
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
14067
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
14068
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
14069
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
14070
|
+
*/
|
|
14099
14071
|
|
|
14100
|
-
this.analyse();
|
|
14101
14072
|
|
|
14102
|
-
timeEnd( 'analyse' );
|
|
14103
14073
|
|
|
14104
|
-
|
|
14105
|
-
|
|
14074
|
+
// A single base 64 digit can contain 6 bits of data. For the base 64 variable
|
|
14075
|
+
// length quantities we use in the source map spec, the first bit is the sign,
|
|
14076
|
+
// the next four bits are the actual value, and the 6th bit is the
|
|
14077
|
+
// continuation bit. The continuation bit tells us whether there are more
|
|
14078
|
+
// digits in this value following this digit.
|
|
14079
|
+
//
|
|
14080
|
+
// Continuation
|
|
14081
|
+
// | Sign
|
|
14082
|
+
// | |
|
|
14083
|
+
// V V
|
|
14084
|
+
// 101011
|
|
14106
14085
|
|
|
14107
|
-
|
|
14108
|
-
const source = node.source && node.source.value;
|
|
14086
|
+
var VLQ_BASE_SHIFT = 5;
|
|
14109
14087
|
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
if ( !~this.sources.indexOf( source ) ) { this.sources.push( source ); }
|
|
14088
|
+
// binary: 100000
|
|
14089
|
+
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
|
|
14113
14090
|
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
// When an unknown import is encountered, we see if one of them can satisfy it.
|
|
14117
|
-
this.exportAllSources.push( source );
|
|
14118
|
-
}
|
|
14091
|
+
// binary: 011111
|
|
14092
|
+
var VLQ_BASE_MASK = VLQ_BASE - 1;
|
|
14119
14093
|
|
|
14120
|
-
|
|
14121
|
-
|
|
14122
|
-
const name = specifier.exported.name;
|
|
14094
|
+
// binary: 100000
|
|
14095
|
+
var VLQ_CONTINUATION_BIT = VLQ_BASE;
|
|
14123
14096
|
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14097
|
+
/**
|
|
14098
|
+
* Converts from a two-complement value to a value where the sign bit is
|
|
14099
|
+
* placed in the least significant bit. For example, as decimals:
|
|
14100
|
+
* 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
|
|
14101
|
+
* 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
|
|
14102
|
+
*/
|
|
14103
|
+
function toVLQSigned(aValue) {
|
|
14104
|
+
return aValue < 0
|
|
14105
|
+
? ((-aValue) << 1) + 1
|
|
14106
|
+
: (aValue << 1) + 0;
|
|
14107
|
+
}
|
|
14130
14108
|
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14109
|
+
/**
|
|
14110
|
+
* Converts to a two-complement value from a value where the sign bit is
|
|
14111
|
+
* placed in the least significant bit. For example, as decimals:
|
|
14112
|
+
* 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
|
|
14113
|
+
* 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
|
|
14114
|
+
*/
|
|
14115
|
+
function fromVLQSigned(aValue) {
|
|
14116
|
+
var isNegative = (aValue & 1) === 1;
|
|
14117
|
+
var shifted = aValue >> 1;
|
|
14118
|
+
return isNegative
|
|
14119
|
+
? -shifted
|
|
14120
|
+
: shifted;
|
|
14121
|
+
}
|
|
14140
14122
|
|
|
14141
|
-
|
|
14142
|
-
|
|
14123
|
+
/**
|
|
14124
|
+
* Returns the base 64 VLQ encoded value.
|
|
14125
|
+
*/
|
|
14126
|
+
var encode$1$1 = function base64VLQ_encode(aValue) {
|
|
14127
|
+
var encoded = "";
|
|
14128
|
+
var digit;
|
|
14129
|
+
|
|
14130
|
+
var vlq = toVLQSigned(aValue);
|
|
14131
|
+
|
|
14132
|
+
do {
|
|
14133
|
+
digit = vlq & VLQ_BASE_MASK;
|
|
14134
|
+
vlq >>>= VLQ_BASE_SHIFT;
|
|
14135
|
+
if (vlq > 0) {
|
|
14136
|
+
// There are still more digits in this value, so we must make sure the
|
|
14137
|
+
// continuation bit is marked.
|
|
14138
|
+
digit |= VLQ_CONTINUATION_BIT;
|
|
14139
|
+
}
|
|
14140
|
+
encoded += base64.encode(digit);
|
|
14141
|
+
} while (vlq > 0);
|
|
14142
|
+
|
|
14143
|
+
return encoded;
|
|
14144
|
+
};
|
|
14145
|
+
|
|
14146
|
+
/**
|
|
14147
|
+
* Decodes the next base 64 VLQ value from the given string and returns the
|
|
14148
|
+
* value and the rest of the string via the out parameter.
|
|
14149
|
+
*/
|
|
14150
|
+
var decode$1$1 = function base64VLQ_decode(aStr, aIndex, aOutParam) {
|
|
14151
|
+
var strLen = aStr.length;
|
|
14152
|
+
var result = 0;
|
|
14153
|
+
var shift = 0;
|
|
14154
|
+
var continuation, digit;
|
|
14155
|
+
|
|
14156
|
+
do {
|
|
14157
|
+
if (aIndex >= strLen) {
|
|
14158
|
+
throw new Error("Expected more digits in base 64 VLQ value.");
|
|
14159
|
+
}
|
|
14160
|
+
|
|
14161
|
+
digit = base64.decode(aStr.charCodeAt(aIndex++));
|
|
14162
|
+
if (digit === -1) {
|
|
14163
|
+
throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
|
|
14164
|
+
}
|
|
14165
|
+
|
|
14166
|
+
continuation = !!(digit & VLQ_CONTINUATION_BIT);
|
|
14167
|
+
digit &= VLQ_BASE_MASK;
|
|
14168
|
+
result = result + (digit << shift);
|
|
14169
|
+
shift += VLQ_BASE_SHIFT;
|
|
14170
|
+
} while (continuation);
|
|
14171
|
+
|
|
14172
|
+
aOutParam.value = fromVLQSigned(result);
|
|
14173
|
+
aOutParam.rest = aIndex;
|
|
14174
|
+
};
|
|
14175
|
+
|
|
14176
|
+
var base64Vlq = {
|
|
14177
|
+
encode: encode$1$1,
|
|
14178
|
+
decode: decode$1$1
|
|
14179
|
+
};
|
|
14180
|
+
|
|
14181
|
+
var util = createCommonjsModule(function (module, exports) {
|
|
14182
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
14183
|
+
/*
|
|
14184
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
14185
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
14186
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
14187
|
+
*/
|
|
14188
|
+
|
|
14189
|
+
/**
|
|
14190
|
+
* This is a helper function for getting values from parameter/options
|
|
14191
|
+
* objects.
|
|
14192
|
+
*
|
|
14193
|
+
* @param args The object we are extracting values from
|
|
14194
|
+
* @param name The name of the property we are getting.
|
|
14195
|
+
* @param defaultValue An optional value to return if the property is missing
|
|
14196
|
+
* from the object. If this is not specified and the property is missing, an
|
|
14197
|
+
* error will be thrown.
|
|
14198
|
+
*/
|
|
14199
|
+
function getArg(aArgs, aName, aDefaultValue) {
|
|
14200
|
+
if (aName in aArgs) {
|
|
14201
|
+
return aArgs[aName];
|
|
14202
|
+
} else if (arguments.length === 3) {
|
|
14203
|
+
return aDefaultValue;
|
|
14204
|
+
} else {
|
|
14205
|
+
throw new Error('"' + aName + '" is a required argument.');
|
|
14206
|
+
}
|
|
14207
|
+
}
|
|
14208
|
+
exports.getArg = getArg;
|
|
14209
|
+
|
|
14210
|
+
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
|
|
14211
|
+
var dataUrlRegexp = /^data:.+\,.+$/;
|
|
14212
|
+
|
|
14213
|
+
function urlParse(aUrl) {
|
|
14214
|
+
var match = aUrl.match(urlRegexp);
|
|
14215
|
+
if (!match) {
|
|
14216
|
+
return null;
|
|
14217
|
+
}
|
|
14218
|
+
return {
|
|
14219
|
+
scheme: match[1],
|
|
14220
|
+
auth: match[2],
|
|
14221
|
+
host: match[3],
|
|
14222
|
+
port: match[4],
|
|
14223
|
+
path: match[5]
|
|
14224
|
+
};
|
|
14225
|
+
}
|
|
14226
|
+
exports.urlParse = urlParse;
|
|
14227
|
+
|
|
14228
|
+
function urlGenerate(aParsedUrl) {
|
|
14229
|
+
var url = '';
|
|
14230
|
+
if (aParsedUrl.scheme) {
|
|
14231
|
+
url += aParsedUrl.scheme + ':';
|
|
14232
|
+
}
|
|
14233
|
+
url += '//';
|
|
14234
|
+
if (aParsedUrl.auth) {
|
|
14235
|
+
url += aParsedUrl.auth + '@';
|
|
14236
|
+
}
|
|
14237
|
+
if (aParsedUrl.host) {
|
|
14238
|
+
url += aParsedUrl.host;
|
|
14239
|
+
}
|
|
14240
|
+
if (aParsedUrl.port) {
|
|
14241
|
+
url += ":" + aParsedUrl.port;
|
|
14242
|
+
}
|
|
14243
|
+
if (aParsedUrl.path) {
|
|
14244
|
+
url += aParsedUrl.path;
|
|
14245
|
+
}
|
|
14246
|
+
return url;
|
|
14247
|
+
}
|
|
14248
|
+
exports.urlGenerate = urlGenerate;
|
|
14249
|
+
|
|
14250
|
+
/**
|
|
14251
|
+
* Normalizes a path, or the path portion of a URL:
|
|
14252
|
+
*
|
|
14253
|
+
* - Replaces consecutive slashes with one slash.
|
|
14254
|
+
* - Removes unnecessary '.' parts.
|
|
14255
|
+
* - Removes unnecessary '<dir>/..' parts.
|
|
14256
|
+
*
|
|
14257
|
+
* Based on code in the Node.js 'path' core module.
|
|
14258
|
+
*
|
|
14259
|
+
* @param aPath The path or url to normalize.
|
|
14260
|
+
*/
|
|
14261
|
+
function normalize(aPath) {
|
|
14262
|
+
var path$$1 = aPath;
|
|
14263
|
+
var url = urlParse(aPath);
|
|
14264
|
+
if (url) {
|
|
14265
|
+
if (!url.path) {
|
|
14266
|
+
return aPath;
|
|
14267
|
+
}
|
|
14268
|
+
path$$1 = url.path;
|
|
14269
|
+
}
|
|
14270
|
+
var isAbsolute = exports.isAbsolute(path$$1);
|
|
14271
|
+
|
|
14272
|
+
var parts = path$$1.split(/\/+/);
|
|
14273
|
+
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
|
|
14274
|
+
part = parts[i];
|
|
14275
|
+
if (part === '.') {
|
|
14276
|
+
parts.splice(i, 1);
|
|
14277
|
+
} else if (part === '..') {
|
|
14278
|
+
up++;
|
|
14279
|
+
} else if (up > 0) {
|
|
14280
|
+
if (part === '') {
|
|
14281
|
+
// The first part is blank if the path is absolute. Trying to go
|
|
14282
|
+
// above the root is a no-op. Therefore we can remove all '..' parts
|
|
14283
|
+
// directly after the root.
|
|
14284
|
+
parts.splice(i + 1, up);
|
|
14285
|
+
up = 0;
|
|
14286
|
+
} else {
|
|
14287
|
+
parts.splice(i, 2);
|
|
14288
|
+
up--;
|
|
14289
|
+
}
|
|
14290
|
+
}
|
|
14291
|
+
}
|
|
14292
|
+
path$$1 = parts.join('/');
|
|
14293
|
+
|
|
14294
|
+
if (path$$1 === '') {
|
|
14295
|
+
path$$1 = isAbsolute ? '/' : '.';
|
|
14296
|
+
}
|
|
14297
|
+
|
|
14298
|
+
if (url) {
|
|
14299
|
+
url.path = path$$1;
|
|
14300
|
+
return urlGenerate(url);
|
|
14301
|
+
}
|
|
14302
|
+
return path$$1;
|
|
14303
|
+
}
|
|
14304
|
+
exports.normalize = normalize;
|
|
14305
|
+
|
|
14306
|
+
/**
|
|
14307
|
+
* Joins two paths/URLs.
|
|
14308
|
+
*
|
|
14309
|
+
* @param aRoot The root path or URL.
|
|
14310
|
+
* @param aPath The path or URL to be joined with the root.
|
|
14311
|
+
*
|
|
14312
|
+
* - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
|
|
14313
|
+
* scheme-relative URL: Then the scheme of aRoot, if any, is prepended
|
|
14314
|
+
* first.
|
|
14315
|
+
* - Otherwise aPath is a path. If aRoot is a URL, then its path portion
|
|
14316
|
+
* is updated with the result and aRoot is returned. Otherwise the result
|
|
14317
|
+
* is returned.
|
|
14318
|
+
* - If aPath is absolute, the result is aPath.
|
|
14319
|
+
* - Otherwise the two paths are joined with a slash.
|
|
14320
|
+
* - Joining for example 'http://' and 'www.example.com' is also supported.
|
|
14321
|
+
*/
|
|
14322
|
+
function join(aRoot, aPath) {
|
|
14323
|
+
if (aRoot === "") {
|
|
14324
|
+
aRoot = ".";
|
|
14325
|
+
}
|
|
14326
|
+
if (aPath === "") {
|
|
14327
|
+
aPath = ".";
|
|
14328
|
+
}
|
|
14329
|
+
var aPathUrl = urlParse(aPath);
|
|
14330
|
+
var aRootUrl = urlParse(aRoot);
|
|
14331
|
+
if (aRootUrl) {
|
|
14332
|
+
aRoot = aRootUrl.path || '/';
|
|
14333
|
+
}
|
|
14334
|
+
|
|
14335
|
+
// `join(foo, '//www.example.org')`
|
|
14336
|
+
if (aPathUrl && !aPathUrl.scheme) {
|
|
14337
|
+
if (aRootUrl) {
|
|
14338
|
+
aPathUrl.scheme = aRootUrl.scheme;
|
|
14339
|
+
}
|
|
14340
|
+
return urlGenerate(aPathUrl);
|
|
14341
|
+
}
|
|
14342
|
+
|
|
14343
|
+
if (aPathUrl || aPath.match(dataUrlRegexp)) {
|
|
14344
|
+
return aPath;
|
|
14345
|
+
}
|
|
14346
|
+
|
|
14347
|
+
// `join('http://', 'www.example.com')`
|
|
14348
|
+
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
|
|
14349
|
+
aRootUrl.host = aPath;
|
|
14350
|
+
return urlGenerate(aRootUrl);
|
|
14351
|
+
}
|
|
14352
|
+
|
|
14353
|
+
var joined = aPath.charAt(0) === '/'
|
|
14354
|
+
? aPath
|
|
14355
|
+
: normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
|
|
14356
|
+
|
|
14357
|
+
if (aRootUrl) {
|
|
14358
|
+
aRootUrl.path = joined;
|
|
14359
|
+
return urlGenerate(aRootUrl);
|
|
14360
|
+
}
|
|
14361
|
+
return joined;
|
|
14362
|
+
}
|
|
14363
|
+
exports.join = join;
|
|
14364
|
+
|
|
14365
|
+
exports.isAbsolute = function (aPath) {
|
|
14366
|
+
return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
|
|
14367
|
+
};
|
|
14368
|
+
|
|
14369
|
+
/**
|
|
14370
|
+
* Make a path relative to a URL or another path.
|
|
14371
|
+
*
|
|
14372
|
+
* @param aRoot The root path or URL.
|
|
14373
|
+
* @param aPath The path or URL to be made relative to aRoot.
|
|
14374
|
+
*/
|
|
14375
|
+
function relative$$1(aRoot, aPath) {
|
|
14376
|
+
if (aRoot === "") {
|
|
14377
|
+
aRoot = ".";
|
|
14378
|
+
}
|
|
14379
|
+
|
|
14380
|
+
aRoot = aRoot.replace(/\/$/, '');
|
|
14381
|
+
|
|
14382
|
+
// It is possible for the path to be above the root. In this case, simply
|
|
14383
|
+
// checking whether the root is a prefix of the path won't work. Instead, we
|
|
14384
|
+
// need to remove components from the root one by one, until either we find
|
|
14385
|
+
// a prefix that fits, or we run out of components to remove.
|
|
14386
|
+
var level = 0;
|
|
14387
|
+
while (aPath.indexOf(aRoot + '/') !== 0) {
|
|
14388
|
+
var index = aRoot.lastIndexOf("/");
|
|
14389
|
+
if (index < 0) {
|
|
14390
|
+
return aPath;
|
|
14391
|
+
}
|
|
14392
|
+
|
|
14393
|
+
// If the only part of the root that is left is the scheme (i.e. http://,
|
|
14394
|
+
// file:///, etc.), one or more slashes (/), or simply nothing at all, we
|
|
14395
|
+
// have exhausted all components, so the path is not relative to the root.
|
|
14396
|
+
aRoot = aRoot.slice(0, index);
|
|
14397
|
+
if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
|
|
14398
|
+
return aPath;
|
|
14399
|
+
}
|
|
14400
|
+
|
|
14401
|
+
++level;
|
|
14402
|
+
}
|
|
14403
|
+
|
|
14404
|
+
// Make sure we add a "../" for each component we removed from the root.
|
|
14405
|
+
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
|
14406
|
+
}
|
|
14407
|
+
exports.relative = relative$$1;
|
|
14408
|
+
|
|
14409
|
+
var supportsNullProto = (function () {
|
|
14410
|
+
var obj = Object.create(null);
|
|
14411
|
+
return !('__proto__' in obj);
|
|
14412
|
+
}());
|
|
14413
|
+
|
|
14414
|
+
function identity (s) {
|
|
14415
|
+
return s;
|
|
14416
|
+
}
|
|
14417
|
+
|
|
14418
|
+
/**
|
|
14419
|
+
* Because behavior goes wacky when you set `__proto__` on objects, we
|
|
14420
|
+
* have to prefix all the strings in our set with an arbitrary character.
|
|
14421
|
+
*
|
|
14422
|
+
* See https://github.com/mozilla/source-map/pull/31 and
|
|
14423
|
+
* https://github.com/mozilla/source-map/issues/30
|
|
14424
|
+
*
|
|
14425
|
+
* @param String aStr
|
|
14426
|
+
*/
|
|
14427
|
+
function toSetString(aStr) {
|
|
14428
|
+
if (isProtoString(aStr)) {
|
|
14429
|
+
return '$' + aStr;
|
|
14430
|
+
}
|
|
14431
|
+
|
|
14432
|
+
return aStr;
|
|
14433
|
+
}
|
|
14434
|
+
exports.toSetString = supportsNullProto ? identity : toSetString;
|
|
14435
|
+
|
|
14436
|
+
function fromSetString(aStr) {
|
|
14437
|
+
if (isProtoString(aStr)) {
|
|
14438
|
+
return aStr.slice(1);
|
|
14439
|
+
}
|
|
14440
|
+
|
|
14441
|
+
return aStr;
|
|
14442
|
+
}
|
|
14443
|
+
exports.fromSetString = supportsNullProto ? identity : fromSetString;
|
|
14444
|
+
|
|
14445
|
+
function isProtoString(s) {
|
|
14446
|
+
if (!s) {
|
|
14447
|
+
return false;
|
|
14448
|
+
}
|
|
14449
|
+
|
|
14450
|
+
var length = s.length;
|
|
14451
|
+
|
|
14452
|
+
if (length < 9 /* "__proto__".length */) {
|
|
14453
|
+
return false;
|
|
14454
|
+
}
|
|
14455
|
+
|
|
14456
|
+
if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
|
|
14457
|
+
s.charCodeAt(length - 2) !== 95 /* '_' */ ||
|
|
14458
|
+
s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
|
|
14459
|
+
s.charCodeAt(length - 4) !== 116 /* 't' */ ||
|
|
14460
|
+
s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
|
|
14461
|
+
s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
|
|
14462
|
+
s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
|
|
14463
|
+
s.charCodeAt(length - 8) !== 95 /* '_' */ ||
|
|
14464
|
+
s.charCodeAt(length - 9) !== 95 /* '_' */) {
|
|
14465
|
+
return false;
|
|
14466
|
+
}
|
|
14467
|
+
|
|
14468
|
+
for (var i = length - 10; i >= 0; i--) {
|
|
14469
|
+
if (s.charCodeAt(i) !== 36 /* '$' */) {
|
|
14470
|
+
return false;
|
|
14471
|
+
}
|
|
14472
|
+
}
|
|
14473
|
+
|
|
14474
|
+
return true;
|
|
14475
|
+
}
|
|
14476
|
+
|
|
14477
|
+
/**
|
|
14478
|
+
* Comparator between two mappings where the original positions are compared.
|
|
14479
|
+
*
|
|
14480
|
+
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
|
|
14481
|
+
* mappings with the same original source/line/column, but different generated
|
|
14482
|
+
* line and column the same. Useful when searching for a mapping with a
|
|
14483
|
+
* stubbed out mapping.
|
|
14484
|
+
*/
|
|
14485
|
+
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
|
|
14486
|
+
var cmp = strcmp(mappingA.source, mappingB.source);
|
|
14487
|
+
if (cmp !== 0) {
|
|
14488
|
+
return cmp;
|
|
14489
|
+
}
|
|
14490
|
+
|
|
14491
|
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
|
14492
|
+
if (cmp !== 0) {
|
|
14493
|
+
return cmp;
|
|
14494
|
+
}
|
|
14495
|
+
|
|
14496
|
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
|
14497
|
+
if (cmp !== 0 || onlyCompareOriginal) {
|
|
14498
|
+
return cmp;
|
|
14499
|
+
}
|
|
14500
|
+
|
|
14501
|
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
|
14502
|
+
if (cmp !== 0) {
|
|
14503
|
+
return cmp;
|
|
14504
|
+
}
|
|
14505
|
+
|
|
14506
|
+
cmp = mappingA.generatedLine - mappingB.generatedLine;
|
|
14507
|
+
if (cmp !== 0) {
|
|
14508
|
+
return cmp;
|
|
14509
|
+
}
|
|
14510
|
+
|
|
14511
|
+
return strcmp(mappingA.name, mappingB.name);
|
|
14512
|
+
}
|
|
14513
|
+
exports.compareByOriginalPositions = compareByOriginalPositions;
|
|
14514
|
+
|
|
14515
|
+
/**
|
|
14516
|
+
* Comparator between two mappings with deflated source and name indices where
|
|
14517
|
+
* the generated positions are compared.
|
|
14518
|
+
*
|
|
14519
|
+
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
|
|
14520
|
+
* mappings with the same generated line and column, but different
|
|
14521
|
+
* source/name/original line and column the same. Useful when searching for a
|
|
14522
|
+
* mapping with a stubbed out mapping.
|
|
14523
|
+
*/
|
|
14524
|
+
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
|
|
14525
|
+
var cmp = mappingA.generatedLine - mappingB.generatedLine;
|
|
14526
|
+
if (cmp !== 0) {
|
|
14527
|
+
return cmp;
|
|
14528
|
+
}
|
|
14529
|
+
|
|
14530
|
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
|
14531
|
+
if (cmp !== 0 || onlyCompareGenerated) {
|
|
14532
|
+
return cmp;
|
|
14533
|
+
}
|
|
14534
|
+
|
|
14535
|
+
cmp = strcmp(mappingA.source, mappingB.source);
|
|
14536
|
+
if (cmp !== 0) {
|
|
14537
|
+
return cmp;
|
|
14538
|
+
}
|
|
14539
|
+
|
|
14540
|
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
|
14541
|
+
if (cmp !== 0) {
|
|
14542
|
+
return cmp;
|
|
14543
|
+
}
|
|
14544
|
+
|
|
14545
|
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
|
14546
|
+
if (cmp !== 0) {
|
|
14547
|
+
return cmp;
|
|
14548
|
+
}
|
|
14549
|
+
|
|
14550
|
+
return strcmp(mappingA.name, mappingB.name);
|
|
14551
|
+
}
|
|
14552
|
+
exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
|
|
14553
|
+
|
|
14554
|
+
function strcmp(aStr1, aStr2) {
|
|
14555
|
+
if (aStr1 === aStr2) {
|
|
14556
|
+
return 0;
|
|
14557
|
+
}
|
|
14558
|
+
|
|
14559
|
+
if (aStr1 === null) {
|
|
14560
|
+
return 1; // aStr2 !== null
|
|
14561
|
+
}
|
|
14562
|
+
|
|
14563
|
+
if (aStr2 === null) {
|
|
14564
|
+
return -1; // aStr1 !== null
|
|
14565
|
+
}
|
|
14566
|
+
|
|
14567
|
+
if (aStr1 > aStr2) {
|
|
14568
|
+
return 1;
|
|
14569
|
+
}
|
|
14570
|
+
|
|
14571
|
+
return -1;
|
|
14572
|
+
}
|
|
14573
|
+
|
|
14574
|
+
/**
|
|
14575
|
+
* Comparator between two mappings with inflated source and name strings where
|
|
14576
|
+
* the generated positions are compared.
|
|
14577
|
+
*/
|
|
14578
|
+
function compareByGeneratedPositionsInflated(mappingA, mappingB) {
|
|
14579
|
+
var cmp = mappingA.generatedLine - mappingB.generatedLine;
|
|
14580
|
+
if (cmp !== 0) {
|
|
14581
|
+
return cmp;
|
|
14582
|
+
}
|
|
14583
|
+
|
|
14584
|
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
|
14585
|
+
if (cmp !== 0) {
|
|
14586
|
+
return cmp;
|
|
14587
|
+
}
|
|
14588
|
+
|
|
14589
|
+
cmp = strcmp(mappingA.source, mappingB.source);
|
|
14590
|
+
if (cmp !== 0) {
|
|
14591
|
+
return cmp;
|
|
14592
|
+
}
|
|
14593
|
+
|
|
14594
|
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
|
14595
|
+
if (cmp !== 0) {
|
|
14596
|
+
return cmp;
|
|
14597
|
+
}
|
|
14598
|
+
|
|
14599
|
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
|
14600
|
+
if (cmp !== 0) {
|
|
14601
|
+
return cmp;
|
|
14602
|
+
}
|
|
14603
|
+
|
|
14604
|
+
return strcmp(mappingA.name, mappingB.name);
|
|
14605
|
+
}
|
|
14606
|
+
exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
|
|
14607
|
+
|
|
14608
|
+
/**
|
|
14609
|
+
* Strip any JSON XSSI avoidance prefix from the string (as documented
|
|
14610
|
+
* in the source maps specification), and then parse the string as
|
|
14611
|
+
* JSON.
|
|
14612
|
+
*/
|
|
14613
|
+
function parseSourceMapInput(str) {
|
|
14614
|
+
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
|
|
14615
|
+
}
|
|
14616
|
+
exports.parseSourceMapInput = parseSourceMapInput;
|
|
14617
|
+
|
|
14618
|
+
/**
|
|
14619
|
+
* Compute the URL of a source given the the source root, the source's
|
|
14620
|
+
* URL, and the source map's URL.
|
|
14621
|
+
*/
|
|
14622
|
+
function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
|
|
14623
|
+
sourceURL = sourceURL || '';
|
|
14624
|
+
|
|
14625
|
+
if (sourceRoot) {
|
|
14626
|
+
// This follows what Chrome does.
|
|
14627
|
+
if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
|
|
14628
|
+
sourceRoot += '/';
|
|
14629
|
+
}
|
|
14630
|
+
// The spec says:
|
|
14631
|
+
// Line 4: An optional source root, useful for relocating source
|
|
14632
|
+
// files on a server or removing repeated values in the
|
|
14633
|
+
// “sources” entry. This value is prepended to the individual
|
|
14634
|
+
// entries in the “source” field.
|
|
14635
|
+
sourceURL = sourceRoot + sourceURL;
|
|
14636
|
+
}
|
|
14637
|
+
|
|
14638
|
+
// Historically, SourceMapConsumer did not take the sourceMapURL as
|
|
14639
|
+
// a parameter. This mode is still somewhat supported, which is why
|
|
14640
|
+
// this code block is conditional. However, it's preferable to pass
|
|
14641
|
+
// the source map URL to SourceMapConsumer, so that this function
|
|
14642
|
+
// can implement the source URL resolution algorithm as outlined in
|
|
14643
|
+
// the spec. This block is basically the equivalent of:
|
|
14644
|
+
// new URL(sourceURL, sourceMapURL).toString()
|
|
14645
|
+
// ... except it avoids using URL, which wasn't available in the
|
|
14646
|
+
// older releases of node still supported by this library.
|
|
14647
|
+
//
|
|
14648
|
+
// The spec says:
|
|
14649
|
+
// If the sources are not absolute URLs after prepending of the
|
|
14650
|
+
// “sourceRoot”, the sources are resolved relative to the
|
|
14651
|
+
// SourceMap (like resolving script src in a html document).
|
|
14652
|
+
if (sourceMapURL) {
|
|
14653
|
+
var parsed = urlParse(sourceMapURL);
|
|
14654
|
+
if (!parsed) {
|
|
14655
|
+
throw new Error("sourceMapURL could not be parsed");
|
|
14656
|
+
}
|
|
14657
|
+
if (parsed.path) {
|
|
14658
|
+
// Strip the last path component, but keep the "/".
|
|
14659
|
+
var index = parsed.path.lastIndexOf('/');
|
|
14660
|
+
if (index >= 0) {
|
|
14661
|
+
parsed.path = parsed.path.substring(0, index + 1);
|
|
14662
|
+
}
|
|
14663
|
+
}
|
|
14664
|
+
sourceURL = join(urlGenerate(parsed), sourceURL);
|
|
14665
|
+
}
|
|
14666
|
+
|
|
14667
|
+
return normalize(sourceURL);
|
|
14668
|
+
}
|
|
14669
|
+
exports.computeSourceURL = computeSourceURL;
|
|
14670
|
+
});
|
|
14671
|
+
|
|
14672
|
+
var util_1 = util.getArg;
|
|
14673
|
+
var util_2 = util.urlParse;
|
|
14674
|
+
var util_3 = util.urlGenerate;
|
|
14675
|
+
var util_4 = util.normalize;
|
|
14676
|
+
var util_5 = util.join;
|
|
14677
|
+
var util_6 = util.isAbsolute;
|
|
14678
|
+
var util_7 = util.relative;
|
|
14679
|
+
var util_8 = util.toSetString;
|
|
14680
|
+
var util_9 = util.fromSetString;
|
|
14681
|
+
var util_10 = util.compareByOriginalPositions;
|
|
14682
|
+
var util_11 = util.compareByGeneratedPositionsDeflated;
|
|
14683
|
+
var util_12 = util.compareByGeneratedPositionsInflated;
|
|
14684
|
+
var util_13 = util.parseSourceMapInput;
|
|
14685
|
+
var util_14 = util.computeSourceURL;
|
|
14686
|
+
|
|
14687
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
14688
|
+
/*
|
|
14689
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
14690
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
14691
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
14692
|
+
*/
|
|
14693
|
+
|
|
14694
|
+
|
|
14695
|
+
var has$1 = Object.prototype.hasOwnProperty;
|
|
14696
|
+
var hasNativeMap = typeof Map !== "undefined";
|
|
14697
|
+
|
|
14698
|
+
/**
|
|
14699
|
+
* A data structure which is a combination of an array and a set. Adding a new
|
|
14700
|
+
* member is O(1), testing for membership is O(1), and finding the index of an
|
|
14701
|
+
* element is O(1). Removing elements from the set is not supported. Only
|
|
14702
|
+
* strings are supported for membership.
|
|
14703
|
+
*/
|
|
14704
|
+
function ArraySet$1() {
|
|
14705
|
+
this._array = [];
|
|
14706
|
+
this._set = hasNativeMap ? new Map() : Object.create(null);
|
|
14707
|
+
}
|
|
14708
|
+
|
|
14709
|
+
/**
|
|
14710
|
+
* Static method for creating ArraySet instances from an existing array.
|
|
14711
|
+
*/
|
|
14712
|
+
ArraySet$1.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
|
|
14713
|
+
var set = new ArraySet$1();
|
|
14714
|
+
for (var i = 0, len = aArray.length; i < len; i++) {
|
|
14715
|
+
set.add(aArray[i], aAllowDuplicates);
|
|
14716
|
+
}
|
|
14717
|
+
return set;
|
|
14718
|
+
};
|
|
14719
|
+
|
|
14720
|
+
/**
|
|
14721
|
+
* Return how many unique items are in this ArraySet. If duplicates have been
|
|
14722
|
+
* added, than those do not count towards the size.
|
|
14723
|
+
*
|
|
14724
|
+
* @returns Number
|
|
14725
|
+
*/
|
|
14726
|
+
ArraySet$1.prototype.size = function ArraySet_size() {
|
|
14727
|
+
return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
|
|
14728
|
+
};
|
|
14729
|
+
|
|
14730
|
+
/**
|
|
14731
|
+
* Add the given string to this set.
|
|
14732
|
+
*
|
|
14733
|
+
* @param String aStr
|
|
14734
|
+
*/
|
|
14735
|
+
ArraySet$1.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
|
|
14736
|
+
var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
|
|
14737
|
+
var isDuplicate = hasNativeMap ? this.has(aStr) : has$1.call(this._set, sStr);
|
|
14738
|
+
var idx = this._array.length;
|
|
14739
|
+
if (!isDuplicate || aAllowDuplicates) {
|
|
14740
|
+
this._array.push(aStr);
|
|
14741
|
+
}
|
|
14742
|
+
if (!isDuplicate) {
|
|
14743
|
+
if (hasNativeMap) {
|
|
14744
|
+
this._set.set(aStr, idx);
|
|
14745
|
+
} else {
|
|
14746
|
+
this._set[sStr] = idx;
|
|
14747
|
+
}
|
|
14748
|
+
}
|
|
14749
|
+
};
|
|
14750
|
+
|
|
14751
|
+
/**
|
|
14752
|
+
* Is the given string a member of this set?
|
|
14753
|
+
*
|
|
14754
|
+
* @param String aStr
|
|
14755
|
+
*/
|
|
14756
|
+
ArraySet$1.prototype.has = function ArraySet_has(aStr) {
|
|
14757
|
+
if (hasNativeMap) {
|
|
14758
|
+
return this._set.has(aStr);
|
|
14759
|
+
} else {
|
|
14760
|
+
var sStr = util.toSetString(aStr);
|
|
14761
|
+
return has$1.call(this._set, sStr);
|
|
14762
|
+
}
|
|
14763
|
+
};
|
|
14764
|
+
|
|
14765
|
+
/**
|
|
14766
|
+
* What is the index of the given string in the array?
|
|
14767
|
+
*
|
|
14768
|
+
* @param String aStr
|
|
14769
|
+
*/
|
|
14770
|
+
ArraySet$1.prototype.indexOf = function ArraySet_indexOf(aStr) {
|
|
14771
|
+
if (hasNativeMap) {
|
|
14772
|
+
var idx = this._set.get(aStr);
|
|
14773
|
+
if (idx >= 0) {
|
|
14774
|
+
return idx;
|
|
14775
|
+
}
|
|
14776
|
+
} else {
|
|
14777
|
+
var sStr = util.toSetString(aStr);
|
|
14778
|
+
if (has$1.call(this._set, sStr)) {
|
|
14779
|
+
return this._set[sStr];
|
|
14780
|
+
}
|
|
14781
|
+
}
|
|
14782
|
+
|
|
14783
|
+
throw new Error('"' + aStr + '" is not in the set.');
|
|
14784
|
+
};
|
|
14785
|
+
|
|
14786
|
+
/**
|
|
14787
|
+
* What is the element at the given index?
|
|
14788
|
+
*
|
|
14789
|
+
* @param Number aIdx
|
|
14790
|
+
*/
|
|
14791
|
+
ArraySet$1.prototype.at = function ArraySet_at(aIdx) {
|
|
14792
|
+
if (aIdx >= 0 && aIdx < this._array.length) {
|
|
14793
|
+
return this._array[aIdx];
|
|
14794
|
+
}
|
|
14795
|
+
throw new Error('No element indexed by ' + aIdx);
|
|
14796
|
+
};
|
|
14797
|
+
|
|
14798
|
+
/**
|
|
14799
|
+
* Returns the array representation of this set (which has the proper indices
|
|
14800
|
+
* indicated by indexOf). Note that this is a copy of the internal array used
|
|
14801
|
+
* for storing the members so that no one can mess with internal state.
|
|
14802
|
+
*/
|
|
14803
|
+
ArraySet$1.prototype.toArray = function ArraySet_toArray() {
|
|
14804
|
+
return this._array.slice();
|
|
14805
|
+
};
|
|
14806
|
+
|
|
14807
|
+
var ArraySet_1 = ArraySet$1;
|
|
14808
|
+
|
|
14809
|
+
var arraySet = {
|
|
14810
|
+
ArraySet: ArraySet_1
|
|
14811
|
+
};
|
|
14812
|
+
|
|
14813
|
+
var binarySearch = createCommonjsModule(function (module, exports) {
|
|
14814
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
14815
|
+
/*
|
|
14816
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
14817
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
14818
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
14819
|
+
*/
|
|
14820
|
+
|
|
14821
|
+
exports.GREATEST_LOWER_BOUND = 1;
|
|
14822
|
+
exports.LEAST_UPPER_BOUND = 2;
|
|
14823
|
+
|
|
14824
|
+
/**
|
|
14825
|
+
* Recursive implementation of binary search.
|
|
14826
|
+
*
|
|
14827
|
+
* @param aLow Indices here and lower do not contain the needle.
|
|
14828
|
+
* @param aHigh Indices here and higher do not contain the needle.
|
|
14829
|
+
* @param aNeedle The element being searched for.
|
|
14830
|
+
* @param aHaystack The non-empty array being searched.
|
|
14831
|
+
* @param aCompare Function which takes two elements and returns -1, 0, or 1.
|
|
14832
|
+
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
|
|
14833
|
+
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
|
|
14834
|
+
* closest element that is smaller than or greater than the one we are
|
|
14835
|
+
* searching for, respectively, if the exact element cannot be found.
|
|
14836
|
+
*/
|
|
14837
|
+
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
|
|
14838
|
+
// This function terminates when one of the following is true:
|
|
14839
|
+
//
|
|
14840
|
+
// 1. We find the exact element we are looking for.
|
|
14841
|
+
//
|
|
14842
|
+
// 2. We did not find the exact element, but we can return the index of
|
|
14843
|
+
// the next-closest element.
|
|
14844
|
+
//
|
|
14845
|
+
// 3. We did not find the exact element, and there is no next-closest
|
|
14846
|
+
// element than the one we are searching for, so we return -1.
|
|
14847
|
+
var mid = Math.floor((aHigh - aLow) / 2) + aLow;
|
|
14848
|
+
var cmp = aCompare(aNeedle, aHaystack[mid], true);
|
|
14849
|
+
if (cmp === 0) {
|
|
14850
|
+
// Found the element we are looking for.
|
|
14851
|
+
return mid;
|
|
14852
|
+
}
|
|
14853
|
+
else if (cmp > 0) {
|
|
14854
|
+
// Our needle is greater than aHaystack[mid].
|
|
14855
|
+
if (aHigh - mid > 1) {
|
|
14856
|
+
// The element is in the upper half.
|
|
14857
|
+
return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
|
|
14858
|
+
}
|
|
14859
|
+
|
|
14860
|
+
// The exact needle element was not found in this haystack. Determine if
|
|
14861
|
+
// we are in termination case (3) or (2) and return the appropriate thing.
|
|
14862
|
+
if (aBias == exports.LEAST_UPPER_BOUND) {
|
|
14863
|
+
return aHigh < aHaystack.length ? aHigh : -1;
|
|
14864
|
+
} else {
|
|
14865
|
+
return mid;
|
|
14866
|
+
}
|
|
14867
|
+
}
|
|
14868
|
+
else {
|
|
14869
|
+
// Our needle is less than aHaystack[mid].
|
|
14870
|
+
if (mid - aLow > 1) {
|
|
14871
|
+
// The element is in the lower half.
|
|
14872
|
+
return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
|
|
14873
|
+
}
|
|
14874
|
+
|
|
14875
|
+
// we are in termination case (3) or (2) and return the appropriate thing.
|
|
14876
|
+
if (aBias == exports.LEAST_UPPER_BOUND) {
|
|
14877
|
+
return mid;
|
|
14878
|
+
} else {
|
|
14879
|
+
return aLow < 0 ? -1 : aLow;
|
|
14880
|
+
}
|
|
14881
|
+
}
|
|
14882
|
+
}
|
|
14883
|
+
|
|
14884
|
+
/**
|
|
14885
|
+
* This is an implementation of binary search which will always try and return
|
|
14886
|
+
* the index of the closest element if there is no exact hit. This is because
|
|
14887
|
+
* mappings between original and generated line/col pairs are single points,
|
|
14888
|
+
* and there is an implicit region between each of them, so a miss just means
|
|
14889
|
+
* that you aren't on the very start of a region.
|
|
14890
|
+
*
|
|
14891
|
+
* @param aNeedle The element you are looking for.
|
|
14892
|
+
* @param aHaystack The array that is being searched.
|
|
14893
|
+
* @param aCompare A function which takes the needle and an element in the
|
|
14894
|
+
* array and returns -1, 0, or 1 depending on whether the needle is less
|
|
14895
|
+
* than, equal to, or greater than the element, respectively.
|
|
14896
|
+
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
|
|
14897
|
+
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
|
|
14898
|
+
* closest element that is smaller than or greater than the one we are
|
|
14899
|
+
* searching for, respectively, if the exact element cannot be found.
|
|
14900
|
+
* Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
|
|
14901
|
+
*/
|
|
14902
|
+
exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
|
|
14903
|
+
if (aHaystack.length === 0) {
|
|
14904
|
+
return -1;
|
|
14905
|
+
}
|
|
14906
|
+
|
|
14907
|
+
var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
|
|
14908
|
+
aCompare, aBias || exports.GREATEST_LOWER_BOUND);
|
|
14909
|
+
if (index < 0) {
|
|
14910
|
+
return -1;
|
|
14911
|
+
}
|
|
14912
|
+
|
|
14913
|
+
// We have found either the exact element, or the next-closest element than
|
|
14914
|
+
// the one we are searching for. However, there may be more than one such
|
|
14915
|
+
// element. Make sure we always return the smallest of these.
|
|
14916
|
+
while (index - 1 >= 0) {
|
|
14917
|
+
if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
|
|
14918
|
+
break;
|
|
14919
|
+
}
|
|
14920
|
+
--index;
|
|
14921
|
+
}
|
|
14922
|
+
|
|
14923
|
+
return index;
|
|
14924
|
+
};
|
|
14925
|
+
});
|
|
14926
|
+
|
|
14927
|
+
var binarySearch_1 = binarySearch.GREATEST_LOWER_BOUND;
|
|
14928
|
+
var binarySearch_2 = binarySearch.LEAST_UPPER_BOUND;
|
|
14929
|
+
var binarySearch_3 = binarySearch.search;
|
|
14930
|
+
|
|
14931
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
14932
|
+
/*
|
|
14933
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
14934
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
14935
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
14936
|
+
*/
|
|
14937
|
+
|
|
14938
|
+
// It turns out that some (most?) JavaScript engines don't self-host
|
|
14939
|
+
// `Array.prototype.sort`. This makes sense because C++ will likely remain
|
|
14940
|
+
// faster than JS when doing raw CPU-intensive sorting. However, when using a
|
|
14941
|
+
// custom comparator function, calling back and forth between the VM's C++ and
|
|
14942
|
+
// JIT'd JS is rather slow *and* loses JIT type information, resulting in
|
|
14943
|
+
// worse generated code for the comparator function than would be optimal. In
|
|
14944
|
+
// fact, when sorting with a comparator, these costs outweigh the benefits of
|
|
14945
|
+
// sorting in C++. By using our own JS-implemented Quick Sort (below), we get
|
|
14946
|
+
// a ~3500ms mean speed-up in `bench/bench.html`.
|
|
14947
|
+
|
|
14948
|
+
/**
|
|
14949
|
+
* Swap the elements indexed by `x` and `y` in the array `ary`.
|
|
14950
|
+
*
|
|
14951
|
+
* @param {Array} ary
|
|
14952
|
+
* The array.
|
|
14953
|
+
* @param {Number} x
|
|
14954
|
+
* The index of the first item.
|
|
14955
|
+
* @param {Number} y
|
|
14956
|
+
* The index of the second item.
|
|
14957
|
+
*/
|
|
14958
|
+
function swap(ary, x, y) {
|
|
14959
|
+
var temp = ary[x];
|
|
14960
|
+
ary[x] = ary[y];
|
|
14961
|
+
ary[y] = temp;
|
|
14962
|
+
}
|
|
14963
|
+
|
|
14964
|
+
/**
|
|
14965
|
+
* Returns a random integer within the range `low .. high` inclusive.
|
|
14966
|
+
*
|
|
14967
|
+
* @param {Number} low
|
|
14968
|
+
* The lower bound on the range.
|
|
14969
|
+
* @param {Number} high
|
|
14970
|
+
* The upper bound on the range.
|
|
14971
|
+
*/
|
|
14972
|
+
function randomIntInRange(low, high) {
|
|
14973
|
+
return Math.round(low + (Math.random() * (high - low)));
|
|
14974
|
+
}
|
|
14975
|
+
|
|
14976
|
+
/**
|
|
14977
|
+
* The Quick Sort algorithm.
|
|
14978
|
+
*
|
|
14979
|
+
* @param {Array} ary
|
|
14980
|
+
* An array to sort.
|
|
14981
|
+
* @param {function} comparator
|
|
14982
|
+
* Function to use to compare two items.
|
|
14983
|
+
* @param {Number} p
|
|
14984
|
+
* Start index of the array
|
|
14985
|
+
* @param {Number} r
|
|
14986
|
+
* End index of the array
|
|
14987
|
+
*/
|
|
14988
|
+
function doQuickSort(ary, comparator, p, r) {
|
|
14989
|
+
// If our lower bound is less than our upper bound, we (1) partition the
|
|
14990
|
+
// array into two pieces and (2) recurse on each half. If it is not, this is
|
|
14991
|
+
// the empty array and our base case.
|
|
14992
|
+
|
|
14993
|
+
if (p < r) {
|
|
14994
|
+
// (1) Partitioning.
|
|
14995
|
+
//
|
|
14996
|
+
// The partitioning chooses a pivot between `p` and `r` and moves all
|
|
14997
|
+
// elements that are less than or equal to the pivot to the before it, and
|
|
14998
|
+
// all the elements that are greater than it after it. The effect is that
|
|
14999
|
+
// once partition is done, the pivot is in the exact place it will be when
|
|
15000
|
+
// the array is put in sorted order, and it will not need to be moved
|
|
15001
|
+
// again. This runs in O(n) time.
|
|
15002
|
+
|
|
15003
|
+
// Always choose a random pivot so that an input array which is reverse
|
|
15004
|
+
// sorted does not cause O(n^2) running time.
|
|
15005
|
+
var pivotIndex = randomIntInRange(p, r);
|
|
15006
|
+
var i = p - 1;
|
|
15007
|
+
|
|
15008
|
+
swap(ary, pivotIndex, r);
|
|
15009
|
+
var pivot = ary[r];
|
|
15010
|
+
|
|
15011
|
+
// Immediately after `j` is incremented in this loop, the following hold
|
|
15012
|
+
// true:
|
|
15013
|
+
//
|
|
15014
|
+
// * Every element in `ary[p .. i]` is less than or equal to the pivot.
|
|
15015
|
+
//
|
|
15016
|
+
// * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
|
|
15017
|
+
for (var j = p; j < r; j++) {
|
|
15018
|
+
if (comparator(ary[j], pivot) <= 0) {
|
|
15019
|
+
i += 1;
|
|
15020
|
+
swap(ary, i, j);
|
|
15021
|
+
}
|
|
15022
|
+
}
|
|
15023
|
+
|
|
15024
|
+
swap(ary, i + 1, j);
|
|
15025
|
+
var q = i + 1;
|
|
15026
|
+
|
|
15027
|
+
// (2) Recurse on each half.
|
|
15028
|
+
|
|
15029
|
+
doQuickSort(ary, comparator, p, q - 1);
|
|
15030
|
+
doQuickSort(ary, comparator, q + 1, r);
|
|
15031
|
+
}
|
|
15032
|
+
}
|
|
15033
|
+
|
|
15034
|
+
/**
|
|
15035
|
+
* Sort the given array in-place with the given comparator function.
|
|
15036
|
+
*
|
|
15037
|
+
* @param {Array} ary
|
|
15038
|
+
* An array to sort.
|
|
15039
|
+
* @param {function} comparator
|
|
15040
|
+
* Function to use to compare two items.
|
|
15041
|
+
*/
|
|
15042
|
+
var quickSort_1 = function (ary, comparator) {
|
|
15043
|
+
doQuickSort(ary, comparator, 0, ary.length - 1);
|
|
15044
|
+
};
|
|
15045
|
+
|
|
15046
|
+
var quickSort$1 = {
|
|
15047
|
+
quickSort: quickSort_1
|
|
15048
|
+
};
|
|
15049
|
+
|
|
15050
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
15051
|
+
/*
|
|
15052
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
15053
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
15054
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
15055
|
+
*/
|
|
15056
|
+
|
|
15057
|
+
|
|
15058
|
+
|
|
15059
|
+
var ArraySet$2 = arraySet.ArraySet;
|
|
15060
|
+
|
|
15061
|
+
var quickSort = quickSort$1.quickSort;
|
|
15062
|
+
|
|
15063
|
+
function SourceMapConsumer$1(aSourceMap, aSourceMapURL) {
|
|
15064
|
+
var sourceMap = aSourceMap;
|
|
15065
|
+
if (typeof aSourceMap === 'string') {
|
|
15066
|
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
15067
|
+
}
|
|
15068
|
+
|
|
15069
|
+
return sourceMap.sections != null
|
|
15070
|
+
? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)
|
|
15071
|
+
: new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
|
|
15072
|
+
}
|
|
15073
|
+
|
|
15074
|
+
SourceMapConsumer$1.fromSourceMap = function(aSourceMap, aSourceMapURL) {
|
|
15075
|
+
return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
|
|
15076
|
+
};
|
|
15077
|
+
|
|
15078
|
+
/**
|
|
15079
|
+
* The version of the source mapping spec that we are consuming.
|
|
15080
|
+
*/
|
|
15081
|
+
SourceMapConsumer$1.prototype._version = 3;
|
|
15082
|
+
|
|
15083
|
+
// `__generatedMappings` and `__originalMappings` are arrays that hold the
|
|
15084
|
+
// parsed mapping coordinates from the source map's "mappings" attribute. They
|
|
15085
|
+
// are lazily instantiated, accessed via the `_generatedMappings` and
|
|
15086
|
+
// `_originalMappings` getters respectively, and we only parse the mappings
|
|
15087
|
+
// and create these arrays once queried for a source location. We jump through
|
|
15088
|
+
// these hoops because there can be many thousands of mappings, and parsing
|
|
15089
|
+
// them is expensive, so we only want to do it if we must.
|
|
15090
|
+
//
|
|
15091
|
+
// Each object in the arrays is of the form:
|
|
15092
|
+
//
|
|
15093
|
+
// {
|
|
15094
|
+
// generatedLine: The line number in the generated code,
|
|
15095
|
+
// generatedColumn: The column number in the generated code,
|
|
15096
|
+
// source: The path to the original source file that generated this
|
|
15097
|
+
// chunk of code,
|
|
15098
|
+
// originalLine: The line number in the original source that
|
|
15099
|
+
// corresponds to this chunk of generated code,
|
|
15100
|
+
// originalColumn: The column number in the original source that
|
|
15101
|
+
// corresponds to this chunk of generated code,
|
|
15102
|
+
// name: The name of the original symbol which generated this chunk of
|
|
15103
|
+
// code.
|
|
15104
|
+
// }
|
|
15105
|
+
//
|
|
15106
|
+
// All properties except for `generatedLine` and `generatedColumn` can be
|
|
15107
|
+
// `null`.
|
|
15108
|
+
//
|
|
15109
|
+
// `_generatedMappings` is ordered by the generated positions.
|
|
15110
|
+
//
|
|
15111
|
+
// `_originalMappings` is ordered by the original positions.
|
|
15112
|
+
|
|
15113
|
+
SourceMapConsumer$1.prototype.__generatedMappings = null;
|
|
15114
|
+
Object.defineProperty(SourceMapConsumer$1.prototype, '_generatedMappings', {
|
|
15115
|
+
configurable: true,
|
|
15116
|
+
enumerable: true,
|
|
15117
|
+
get: function () {
|
|
15118
|
+
if (!this.__generatedMappings) {
|
|
15119
|
+
this._parseMappings(this._mappings, this.sourceRoot);
|
|
15120
|
+
}
|
|
15121
|
+
|
|
15122
|
+
return this.__generatedMappings;
|
|
15123
|
+
}
|
|
15124
|
+
});
|
|
15125
|
+
|
|
15126
|
+
SourceMapConsumer$1.prototype.__originalMappings = null;
|
|
15127
|
+
Object.defineProperty(SourceMapConsumer$1.prototype, '_originalMappings', {
|
|
15128
|
+
configurable: true,
|
|
15129
|
+
enumerable: true,
|
|
15130
|
+
get: function () {
|
|
15131
|
+
if (!this.__originalMappings) {
|
|
15132
|
+
this._parseMappings(this._mappings, this.sourceRoot);
|
|
15133
|
+
}
|
|
15134
|
+
|
|
15135
|
+
return this.__originalMappings;
|
|
15136
|
+
}
|
|
15137
|
+
});
|
|
15138
|
+
|
|
15139
|
+
SourceMapConsumer$1.prototype._charIsMappingSeparator =
|
|
15140
|
+
function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
|
|
15141
|
+
var c = aStr.charAt(index);
|
|
15142
|
+
return c === ";" || c === ",";
|
|
15143
|
+
};
|
|
15144
|
+
|
|
15145
|
+
/**
|
|
15146
|
+
* Parse the mappings in a string in to a data structure which we can easily
|
|
15147
|
+
* query (the ordered arrays in the `this.__generatedMappings` and
|
|
15148
|
+
* `this.__originalMappings` properties).
|
|
15149
|
+
*/
|
|
15150
|
+
SourceMapConsumer$1.prototype._parseMappings =
|
|
15151
|
+
function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
|
|
15152
|
+
throw new Error("Subclasses must implement _parseMappings");
|
|
15153
|
+
};
|
|
15154
|
+
|
|
15155
|
+
SourceMapConsumer$1.GENERATED_ORDER = 1;
|
|
15156
|
+
SourceMapConsumer$1.ORIGINAL_ORDER = 2;
|
|
15157
|
+
|
|
15158
|
+
SourceMapConsumer$1.GREATEST_LOWER_BOUND = 1;
|
|
15159
|
+
SourceMapConsumer$1.LEAST_UPPER_BOUND = 2;
|
|
15160
|
+
|
|
15161
|
+
/**
|
|
15162
|
+
* Iterate over each mapping between an original source/line/column and a
|
|
15163
|
+
* generated line/column in this source map.
|
|
15164
|
+
*
|
|
15165
|
+
* @param Function aCallback
|
|
15166
|
+
* The function that is called with each mapping.
|
|
15167
|
+
* @param Object aContext
|
|
15168
|
+
* Optional. If specified, this object will be the value of `this` every
|
|
15169
|
+
* time that `aCallback` is called.
|
|
15170
|
+
* @param aOrder
|
|
15171
|
+
* Either `SourceMapConsumer.GENERATED_ORDER` or
|
|
15172
|
+
* `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
|
|
15173
|
+
* iterate over the mappings sorted by the generated file's line/column
|
|
15174
|
+
* order or the original's source/line/column order, respectively. Defaults to
|
|
15175
|
+
* `SourceMapConsumer.GENERATED_ORDER`.
|
|
15176
|
+
*/
|
|
15177
|
+
SourceMapConsumer$1.prototype.eachMapping =
|
|
15178
|
+
function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
|
|
15179
|
+
var context = aContext || null;
|
|
15180
|
+
var order = aOrder || SourceMapConsumer$1.GENERATED_ORDER;
|
|
15181
|
+
|
|
15182
|
+
var mappings;
|
|
15183
|
+
switch (order) {
|
|
15184
|
+
case SourceMapConsumer$1.GENERATED_ORDER:
|
|
15185
|
+
mappings = this._generatedMappings;
|
|
15186
|
+
break;
|
|
15187
|
+
case SourceMapConsumer$1.ORIGINAL_ORDER:
|
|
15188
|
+
mappings = this._originalMappings;
|
|
15189
|
+
break;
|
|
15190
|
+
default:
|
|
15191
|
+
throw new Error("Unknown order of iteration.");
|
|
15192
|
+
}
|
|
15193
|
+
|
|
15194
|
+
var sourceRoot = this.sourceRoot;
|
|
15195
|
+
mappings.map(function (mapping) {
|
|
15196
|
+
var source = mapping.source === null ? null : this._sources.at(mapping.source);
|
|
15197
|
+
source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);
|
|
15198
|
+
return {
|
|
15199
|
+
source: source,
|
|
15200
|
+
generatedLine: mapping.generatedLine,
|
|
15201
|
+
generatedColumn: mapping.generatedColumn,
|
|
15202
|
+
originalLine: mapping.originalLine,
|
|
15203
|
+
originalColumn: mapping.originalColumn,
|
|
15204
|
+
name: mapping.name === null ? null : this._names.at(mapping.name)
|
|
15205
|
+
};
|
|
15206
|
+
}, this).forEach(aCallback, context);
|
|
15207
|
+
};
|
|
15208
|
+
|
|
15209
|
+
/**
|
|
15210
|
+
* Returns all generated line and column information for the original source,
|
|
15211
|
+
* line, and column provided. If no column is provided, returns all mappings
|
|
15212
|
+
* corresponding to a either the line we are searching for or the next
|
|
15213
|
+
* closest line that has any mappings. Otherwise, returns all mappings
|
|
15214
|
+
* corresponding to the given line and either the column we are searching for
|
|
15215
|
+
* or the next closest column that has any offsets.
|
|
15216
|
+
*
|
|
15217
|
+
* The only argument is an object with the following properties:
|
|
15218
|
+
*
|
|
15219
|
+
* - source: The filename of the original source.
|
|
15220
|
+
* - line: The line number in the original source. The line number is 1-based.
|
|
15221
|
+
* - column: Optional. the column number in the original source.
|
|
15222
|
+
* The column number is 0-based.
|
|
15223
|
+
*
|
|
15224
|
+
* and an array of objects is returned, each with the following properties:
|
|
15225
|
+
*
|
|
15226
|
+
* - line: The line number in the generated source, or null. The
|
|
15227
|
+
* line number is 1-based.
|
|
15228
|
+
* - column: The column number in the generated source, or null.
|
|
15229
|
+
* The column number is 0-based.
|
|
15230
|
+
*/
|
|
15231
|
+
SourceMapConsumer$1.prototype.allGeneratedPositionsFor =
|
|
15232
|
+
function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
|
|
15233
|
+
var line = util.getArg(aArgs, 'line');
|
|
15234
|
+
|
|
15235
|
+
// When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
|
|
15236
|
+
// returns the index of the closest mapping less than the needle. By
|
|
15237
|
+
// setting needle.originalColumn to 0, we thus find the last mapping for
|
|
15238
|
+
// the given line, provided such a mapping exists.
|
|
15239
|
+
var needle = {
|
|
15240
|
+
source: util.getArg(aArgs, 'source'),
|
|
15241
|
+
originalLine: line,
|
|
15242
|
+
originalColumn: util.getArg(aArgs, 'column', 0)
|
|
15243
|
+
};
|
|
15244
|
+
|
|
15245
|
+
needle.source = this._findSourceIndex(needle.source);
|
|
15246
|
+
if (needle.source < 0) {
|
|
15247
|
+
return [];
|
|
15248
|
+
}
|
|
15249
|
+
|
|
15250
|
+
var mappings = [];
|
|
15251
|
+
|
|
15252
|
+
var index = this._findMapping(needle,
|
|
15253
|
+
this._originalMappings,
|
|
15254
|
+
"originalLine",
|
|
15255
|
+
"originalColumn",
|
|
15256
|
+
util.compareByOriginalPositions,
|
|
15257
|
+
binarySearch.LEAST_UPPER_BOUND);
|
|
15258
|
+
if (index >= 0) {
|
|
15259
|
+
var mapping = this._originalMappings[index];
|
|
15260
|
+
|
|
15261
|
+
if (aArgs.column === undefined) {
|
|
15262
|
+
var originalLine = mapping.originalLine;
|
|
15263
|
+
|
|
15264
|
+
// Iterate until either we run out of mappings, or we run into
|
|
15265
|
+
// a mapping for a different line than the one we found. Since
|
|
15266
|
+
// mappings are sorted, this is guaranteed to find all mappings for
|
|
15267
|
+
// the line we found.
|
|
15268
|
+
while (mapping && mapping.originalLine === originalLine) {
|
|
15269
|
+
mappings.push({
|
|
15270
|
+
line: util.getArg(mapping, 'generatedLine', null),
|
|
15271
|
+
column: util.getArg(mapping, 'generatedColumn', null),
|
|
15272
|
+
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
|
|
15273
|
+
});
|
|
15274
|
+
|
|
15275
|
+
mapping = this._originalMappings[++index];
|
|
15276
|
+
}
|
|
15277
|
+
} else {
|
|
15278
|
+
var originalColumn = mapping.originalColumn;
|
|
15279
|
+
|
|
15280
|
+
// Iterate until either we run out of mappings, or we run into
|
|
15281
|
+
// a mapping for a different line than the one we were searching for.
|
|
15282
|
+
// Since mappings are sorted, this is guaranteed to find all mappings for
|
|
15283
|
+
// the line we are searching for.
|
|
15284
|
+
while (mapping &&
|
|
15285
|
+
mapping.originalLine === line &&
|
|
15286
|
+
mapping.originalColumn == originalColumn) {
|
|
15287
|
+
mappings.push({
|
|
15288
|
+
line: util.getArg(mapping, 'generatedLine', null),
|
|
15289
|
+
column: util.getArg(mapping, 'generatedColumn', null),
|
|
15290
|
+
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
|
|
15291
|
+
});
|
|
15292
|
+
|
|
15293
|
+
mapping = this._originalMappings[++index];
|
|
15294
|
+
}
|
|
15295
|
+
}
|
|
15296
|
+
}
|
|
15297
|
+
|
|
15298
|
+
return mappings;
|
|
15299
|
+
};
|
|
15300
|
+
|
|
15301
|
+
var SourceMapConsumer_1 = SourceMapConsumer$1;
|
|
15302
|
+
|
|
15303
|
+
/**
|
|
15304
|
+
* A BasicSourceMapConsumer instance represents a parsed source map which we can
|
|
15305
|
+
* query for information about the original file positions by giving it a file
|
|
15306
|
+
* position in the generated source.
|
|
15307
|
+
*
|
|
15308
|
+
* The first parameter is the raw source map (either as a JSON string, or
|
|
15309
|
+
* already parsed to an object). According to the spec, source maps have the
|
|
15310
|
+
* following attributes:
|
|
15311
|
+
*
|
|
15312
|
+
* - version: Which version of the source map spec this map is following.
|
|
15313
|
+
* - sources: An array of URLs to the original source files.
|
|
15314
|
+
* - names: An array of identifiers which can be referrenced by individual mappings.
|
|
15315
|
+
* - sourceRoot: Optional. The URL root from which all sources are relative.
|
|
15316
|
+
* - sourcesContent: Optional. An array of contents of the original source files.
|
|
15317
|
+
* - mappings: A string of base64 VLQs which contain the actual mappings.
|
|
15318
|
+
* - file: Optional. The generated file this source map is associated with.
|
|
15319
|
+
*
|
|
15320
|
+
* Here is an example source map, taken from the source map spec[0]:
|
|
15321
|
+
*
|
|
15322
|
+
* {
|
|
15323
|
+
* version : 3,
|
|
15324
|
+
* file: "out.js",
|
|
15325
|
+
* sourceRoot : "",
|
|
15326
|
+
* sources: ["foo.js", "bar.js"],
|
|
15327
|
+
* names: ["src", "maps", "are", "fun"],
|
|
15328
|
+
* mappings: "AA,AB;;ABCDE;"
|
|
15329
|
+
* }
|
|
15330
|
+
*
|
|
15331
|
+
* The second parameter, if given, is a string whose value is the URL
|
|
15332
|
+
* at which the source map was found. This URL is used to compute the
|
|
15333
|
+
* sources array.
|
|
15334
|
+
*
|
|
15335
|
+
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
|
|
15336
|
+
*/
|
|
15337
|
+
function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
|
|
15338
|
+
var sourceMap = aSourceMap;
|
|
15339
|
+
if (typeof aSourceMap === 'string') {
|
|
15340
|
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
15341
|
+
}
|
|
15342
|
+
|
|
15343
|
+
var version = util.getArg(sourceMap, 'version');
|
|
15344
|
+
var sources = util.getArg(sourceMap, 'sources');
|
|
15345
|
+
// Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
|
|
15346
|
+
// requires the array) to play nice here.
|
|
15347
|
+
var names = util.getArg(sourceMap, 'names', []);
|
|
15348
|
+
var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
|
|
15349
|
+
var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
|
|
15350
|
+
var mappings = util.getArg(sourceMap, 'mappings');
|
|
15351
|
+
var file = util.getArg(sourceMap, 'file', null);
|
|
15352
|
+
|
|
15353
|
+
// Once again, Sass deviates from the spec and supplies the version as a
|
|
15354
|
+
// string rather than a number, so we use loose equality checking here.
|
|
15355
|
+
if (version != this._version) {
|
|
15356
|
+
throw new Error('Unsupported version: ' + version);
|
|
15357
|
+
}
|
|
15358
|
+
|
|
15359
|
+
if (sourceRoot) {
|
|
15360
|
+
sourceRoot = util.normalize(sourceRoot);
|
|
15361
|
+
}
|
|
15362
|
+
|
|
15363
|
+
sources = sources
|
|
15364
|
+
.map(String)
|
|
15365
|
+
// Some source maps produce relative source paths like "./foo.js" instead of
|
|
15366
|
+
// "foo.js". Normalize these first so that future comparisons will succeed.
|
|
15367
|
+
// See bugzil.la/1090768.
|
|
15368
|
+
.map(util.normalize)
|
|
15369
|
+
// Always ensure that absolute sources are internally stored relative to
|
|
15370
|
+
// the source root, if the source root is absolute. Not doing this would
|
|
15371
|
+
// be particularly problematic when the source root is a prefix of the
|
|
15372
|
+
// source (valid, but why??). See github issue #199 and bugzil.la/1188982.
|
|
15373
|
+
.map(function (source) {
|
|
15374
|
+
return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
|
|
15375
|
+
? util.relative(sourceRoot, source)
|
|
15376
|
+
: source;
|
|
15377
|
+
});
|
|
15378
|
+
|
|
15379
|
+
// Pass `true` below to allow duplicate names and sources. While source maps
|
|
15380
|
+
// are intended to be compressed and deduplicated, the TypeScript compiler
|
|
15381
|
+
// sometimes generates source maps with duplicates in them. See Github issue
|
|
15382
|
+
// #72 and bugzil.la/889492.
|
|
15383
|
+
this._names = ArraySet$2.fromArray(names.map(String), true);
|
|
15384
|
+
this._sources = ArraySet$2.fromArray(sources, true);
|
|
15385
|
+
|
|
15386
|
+
this._absoluteSources = this._sources.toArray().map(function (s) {
|
|
15387
|
+
return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
|
|
15388
|
+
});
|
|
15389
|
+
|
|
15390
|
+
this.sourceRoot = sourceRoot;
|
|
15391
|
+
this.sourcesContent = sourcesContent;
|
|
15392
|
+
this._mappings = mappings;
|
|
15393
|
+
this._sourceMapURL = aSourceMapURL;
|
|
15394
|
+
this.file = file;
|
|
15395
|
+
}
|
|
15396
|
+
|
|
15397
|
+
BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer$1.prototype);
|
|
15398
|
+
BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer$1;
|
|
15399
|
+
|
|
15400
|
+
/**
|
|
15401
|
+
* Utility function to find the index of a source. Returns -1 if not
|
|
15402
|
+
* found.
|
|
15403
|
+
*/
|
|
15404
|
+
BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
|
|
15405
|
+
var relativeSource = aSource;
|
|
15406
|
+
if (this.sourceRoot != null) {
|
|
15407
|
+
relativeSource = util.relative(this.sourceRoot, relativeSource);
|
|
15408
|
+
}
|
|
15409
|
+
|
|
15410
|
+
if (this._sources.has(relativeSource)) {
|
|
15411
|
+
return this._sources.indexOf(relativeSource);
|
|
15412
|
+
}
|
|
15413
|
+
|
|
15414
|
+
// Maybe aSource is an absolute URL as returned by |sources|. In
|
|
15415
|
+
// this case we can't simply undo the transform.
|
|
15416
|
+
var i;
|
|
15417
|
+
for (i = 0; i < this._absoluteSources.length; ++i) {
|
|
15418
|
+
if (this._absoluteSources[i] == aSource) {
|
|
15419
|
+
return i;
|
|
15420
|
+
}
|
|
15421
|
+
}
|
|
15422
|
+
|
|
15423
|
+
return -1;
|
|
15424
|
+
};
|
|
15425
|
+
|
|
15426
|
+
/**
|
|
15427
|
+
* Create a BasicSourceMapConsumer from a SourceMapGenerator.
|
|
15428
|
+
*
|
|
15429
|
+
* @param SourceMapGenerator aSourceMap
|
|
15430
|
+
* The source map that will be consumed.
|
|
15431
|
+
* @param String aSourceMapURL
|
|
15432
|
+
* The URL at which the source map can be found (optional)
|
|
15433
|
+
* @returns BasicSourceMapConsumer
|
|
15434
|
+
*/
|
|
15435
|
+
BasicSourceMapConsumer.fromSourceMap =
|
|
15436
|
+
function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
|
|
15437
|
+
var smc = Object.create(BasicSourceMapConsumer.prototype);
|
|
15438
|
+
|
|
15439
|
+
var names = smc._names = ArraySet$2.fromArray(aSourceMap._names.toArray(), true);
|
|
15440
|
+
var sources = smc._sources = ArraySet$2.fromArray(aSourceMap._sources.toArray(), true);
|
|
15441
|
+
smc.sourceRoot = aSourceMap._sourceRoot;
|
|
15442
|
+
smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
|
|
15443
|
+
smc.sourceRoot);
|
|
15444
|
+
smc.file = aSourceMap._file;
|
|
15445
|
+
smc._sourceMapURL = aSourceMapURL;
|
|
15446
|
+
smc._absoluteSources = smc._sources.toArray().map(function (s) {
|
|
15447
|
+
return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
|
|
15448
|
+
});
|
|
15449
|
+
|
|
15450
|
+
// Because we are modifying the entries (by converting string sources and
|
|
15451
|
+
// names to indices into the sources and names ArraySets), we have to make
|
|
15452
|
+
// a copy of the entry or else bad things happen. Shared mutable state
|
|
15453
|
+
// strikes again! See github issue #191.
|
|
15454
|
+
|
|
15455
|
+
var generatedMappings = aSourceMap._mappings.toArray().slice();
|
|
15456
|
+
var destGeneratedMappings = smc.__generatedMappings = [];
|
|
15457
|
+
var destOriginalMappings = smc.__originalMappings = [];
|
|
15458
|
+
|
|
15459
|
+
for (var i = 0, length = generatedMappings.length; i < length; i++) {
|
|
15460
|
+
var srcMapping = generatedMappings[i];
|
|
15461
|
+
var destMapping = new Mapping;
|
|
15462
|
+
destMapping.generatedLine = srcMapping.generatedLine;
|
|
15463
|
+
destMapping.generatedColumn = srcMapping.generatedColumn;
|
|
15464
|
+
|
|
15465
|
+
if (srcMapping.source) {
|
|
15466
|
+
destMapping.source = sources.indexOf(srcMapping.source);
|
|
15467
|
+
destMapping.originalLine = srcMapping.originalLine;
|
|
15468
|
+
destMapping.originalColumn = srcMapping.originalColumn;
|
|
15469
|
+
|
|
15470
|
+
if (srcMapping.name) {
|
|
15471
|
+
destMapping.name = names.indexOf(srcMapping.name);
|
|
15472
|
+
}
|
|
15473
|
+
|
|
15474
|
+
destOriginalMappings.push(destMapping);
|
|
15475
|
+
}
|
|
15476
|
+
|
|
15477
|
+
destGeneratedMappings.push(destMapping);
|
|
15478
|
+
}
|
|
15479
|
+
|
|
15480
|
+
quickSort(smc.__originalMappings, util.compareByOriginalPositions);
|
|
15481
|
+
|
|
15482
|
+
return smc;
|
|
15483
|
+
};
|
|
15484
|
+
|
|
15485
|
+
/**
|
|
15486
|
+
* The version of the source mapping spec that we are consuming.
|
|
15487
|
+
*/
|
|
15488
|
+
BasicSourceMapConsumer.prototype._version = 3;
|
|
15489
|
+
|
|
15490
|
+
/**
|
|
15491
|
+
* The list of original sources.
|
|
15492
|
+
*/
|
|
15493
|
+
Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
|
|
15494
|
+
get: function () {
|
|
15495
|
+
return this._absoluteSources.slice();
|
|
15496
|
+
}
|
|
15497
|
+
});
|
|
15498
|
+
|
|
15499
|
+
/**
|
|
15500
|
+
* Provide the JIT with a nice shape / hidden class.
|
|
15501
|
+
*/
|
|
15502
|
+
function Mapping() {
|
|
15503
|
+
this.generatedLine = 0;
|
|
15504
|
+
this.generatedColumn = 0;
|
|
15505
|
+
this.source = null;
|
|
15506
|
+
this.originalLine = null;
|
|
15507
|
+
this.originalColumn = null;
|
|
15508
|
+
this.name = null;
|
|
15509
|
+
}
|
|
15510
|
+
|
|
15511
|
+
/**
|
|
15512
|
+
* Parse the mappings in a string in to a data structure which we can easily
|
|
15513
|
+
* query (the ordered arrays in the `this.__generatedMappings` and
|
|
15514
|
+
* `this.__originalMappings` properties).
|
|
15515
|
+
*/
|
|
15516
|
+
BasicSourceMapConsumer.prototype._parseMappings =
|
|
15517
|
+
function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
|
|
15518
|
+
var generatedLine = 1;
|
|
15519
|
+
var previousGeneratedColumn = 0;
|
|
15520
|
+
var previousOriginalLine = 0;
|
|
15521
|
+
var previousOriginalColumn = 0;
|
|
15522
|
+
var previousSource = 0;
|
|
15523
|
+
var previousName = 0;
|
|
15524
|
+
var length = aStr.length;
|
|
15525
|
+
var index = 0;
|
|
15526
|
+
var cachedSegments = {};
|
|
15527
|
+
var temp = {};
|
|
15528
|
+
var originalMappings = [];
|
|
15529
|
+
var generatedMappings = [];
|
|
15530
|
+
var mapping, str, segment, end, value;
|
|
15531
|
+
|
|
15532
|
+
while (index < length) {
|
|
15533
|
+
if (aStr.charAt(index) === ';') {
|
|
15534
|
+
generatedLine++;
|
|
15535
|
+
index++;
|
|
15536
|
+
previousGeneratedColumn = 0;
|
|
15537
|
+
}
|
|
15538
|
+
else if (aStr.charAt(index) === ',') {
|
|
15539
|
+
index++;
|
|
15540
|
+
}
|
|
15541
|
+
else {
|
|
15542
|
+
mapping = new Mapping();
|
|
15543
|
+
mapping.generatedLine = generatedLine;
|
|
15544
|
+
|
|
15545
|
+
// Because each offset is encoded relative to the previous one,
|
|
15546
|
+
// many segments often have the same encoding. We can exploit this
|
|
15547
|
+
// fact by caching the parsed variable length fields of each segment,
|
|
15548
|
+
// allowing us to avoid a second parse if we encounter the same
|
|
15549
|
+
// segment again.
|
|
15550
|
+
for (end = index; end < length; end++) {
|
|
15551
|
+
if (this._charIsMappingSeparator(aStr, end)) {
|
|
15552
|
+
break;
|
|
15553
|
+
}
|
|
15554
|
+
}
|
|
15555
|
+
str = aStr.slice(index, end);
|
|
15556
|
+
|
|
15557
|
+
segment = cachedSegments[str];
|
|
15558
|
+
if (segment) {
|
|
15559
|
+
index += str.length;
|
|
15560
|
+
} else {
|
|
15561
|
+
segment = [];
|
|
15562
|
+
while (index < end) {
|
|
15563
|
+
base64Vlq.decode(aStr, index, temp);
|
|
15564
|
+
value = temp.value;
|
|
15565
|
+
index = temp.rest;
|
|
15566
|
+
segment.push(value);
|
|
15567
|
+
}
|
|
15568
|
+
|
|
15569
|
+
if (segment.length === 2) {
|
|
15570
|
+
throw new Error('Found a source, but no line and column');
|
|
15571
|
+
}
|
|
15572
|
+
|
|
15573
|
+
if (segment.length === 3) {
|
|
15574
|
+
throw new Error('Found a source and line, but no column');
|
|
15575
|
+
}
|
|
15576
|
+
|
|
15577
|
+
cachedSegments[str] = segment;
|
|
15578
|
+
}
|
|
15579
|
+
|
|
15580
|
+
// Generated column.
|
|
15581
|
+
mapping.generatedColumn = previousGeneratedColumn + segment[0];
|
|
15582
|
+
previousGeneratedColumn = mapping.generatedColumn;
|
|
15583
|
+
|
|
15584
|
+
if (segment.length > 1) {
|
|
15585
|
+
// Original source.
|
|
15586
|
+
mapping.source = previousSource + segment[1];
|
|
15587
|
+
previousSource += segment[1];
|
|
15588
|
+
|
|
15589
|
+
// Original line.
|
|
15590
|
+
mapping.originalLine = previousOriginalLine + segment[2];
|
|
15591
|
+
previousOriginalLine = mapping.originalLine;
|
|
15592
|
+
// Lines are stored 0-based
|
|
15593
|
+
mapping.originalLine += 1;
|
|
15594
|
+
|
|
15595
|
+
// Original column.
|
|
15596
|
+
mapping.originalColumn = previousOriginalColumn + segment[3];
|
|
15597
|
+
previousOriginalColumn = mapping.originalColumn;
|
|
15598
|
+
|
|
15599
|
+
if (segment.length > 4) {
|
|
15600
|
+
// Original name.
|
|
15601
|
+
mapping.name = previousName + segment[4];
|
|
15602
|
+
previousName += segment[4];
|
|
15603
|
+
}
|
|
15604
|
+
}
|
|
15605
|
+
|
|
15606
|
+
generatedMappings.push(mapping);
|
|
15607
|
+
if (typeof mapping.originalLine === 'number') {
|
|
15608
|
+
originalMappings.push(mapping);
|
|
15609
|
+
}
|
|
15610
|
+
}
|
|
15611
|
+
}
|
|
15612
|
+
|
|
15613
|
+
quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
|
|
15614
|
+
this.__generatedMappings = generatedMappings;
|
|
15615
|
+
|
|
15616
|
+
quickSort(originalMappings, util.compareByOriginalPositions);
|
|
15617
|
+
this.__originalMappings = originalMappings;
|
|
15618
|
+
};
|
|
15619
|
+
|
|
15620
|
+
/**
|
|
15621
|
+
* Find the mapping that best matches the hypothetical "needle" mapping that
|
|
15622
|
+
* we are searching for in the given "haystack" of mappings.
|
|
15623
|
+
*/
|
|
15624
|
+
BasicSourceMapConsumer.prototype._findMapping =
|
|
15625
|
+
function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
|
|
15626
|
+
aColumnName, aComparator, aBias) {
|
|
15627
|
+
// To return the position we are searching for, we must first find the
|
|
15628
|
+
// mapping for the given position and then return the opposite position it
|
|
15629
|
+
// points to. Because the mappings are sorted, we can use binary search to
|
|
15630
|
+
// find the best mapping.
|
|
15631
|
+
|
|
15632
|
+
if (aNeedle[aLineName] <= 0) {
|
|
15633
|
+
throw new TypeError('Line must be greater than or equal to 1, got '
|
|
15634
|
+
+ aNeedle[aLineName]);
|
|
15635
|
+
}
|
|
15636
|
+
if (aNeedle[aColumnName] < 0) {
|
|
15637
|
+
throw new TypeError('Column must be greater than or equal to 0, got '
|
|
15638
|
+
+ aNeedle[aColumnName]);
|
|
15639
|
+
}
|
|
15640
|
+
|
|
15641
|
+
return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
|
|
15642
|
+
};
|
|
15643
|
+
|
|
15644
|
+
/**
|
|
15645
|
+
* Compute the last column for each generated mapping. The last column is
|
|
15646
|
+
* inclusive.
|
|
15647
|
+
*/
|
|
15648
|
+
BasicSourceMapConsumer.prototype.computeColumnSpans =
|
|
15649
|
+
function SourceMapConsumer_computeColumnSpans() {
|
|
15650
|
+
for (var index = 0; index < this._generatedMappings.length; ++index) {
|
|
15651
|
+
var mapping = this._generatedMappings[index];
|
|
15652
|
+
|
|
15653
|
+
// Mappings do not contain a field for the last generated columnt. We
|
|
15654
|
+
// can come up with an optimistic estimate, however, by assuming that
|
|
15655
|
+
// mappings are contiguous (i.e. given two consecutive mappings, the
|
|
15656
|
+
// first mapping ends where the second one starts).
|
|
15657
|
+
if (index + 1 < this._generatedMappings.length) {
|
|
15658
|
+
var nextMapping = this._generatedMappings[index + 1];
|
|
15659
|
+
|
|
15660
|
+
if (mapping.generatedLine === nextMapping.generatedLine) {
|
|
15661
|
+
mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
|
|
15662
|
+
continue;
|
|
15663
|
+
}
|
|
15664
|
+
}
|
|
15665
|
+
|
|
15666
|
+
// The last mapping for each line spans the entire line.
|
|
15667
|
+
mapping.lastGeneratedColumn = Infinity;
|
|
15668
|
+
}
|
|
15669
|
+
};
|
|
15670
|
+
|
|
15671
|
+
/**
|
|
15672
|
+
* Returns the original source, line, and column information for the generated
|
|
15673
|
+
* source's line and column positions provided. The only argument is an object
|
|
15674
|
+
* with the following properties:
|
|
15675
|
+
*
|
|
15676
|
+
* - line: The line number in the generated source. The line number
|
|
15677
|
+
* is 1-based.
|
|
15678
|
+
* - column: The column number in the generated source. The column
|
|
15679
|
+
* number is 0-based.
|
|
15680
|
+
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
|
|
15681
|
+
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
|
|
15682
|
+
* closest element that is smaller than or greater than the one we are
|
|
15683
|
+
* searching for, respectively, if the exact element cannot be found.
|
|
15684
|
+
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
|
|
15685
|
+
*
|
|
15686
|
+
* and an object is returned with the following properties:
|
|
15687
|
+
*
|
|
15688
|
+
* - source: The original source file, or null.
|
|
15689
|
+
* - line: The line number in the original source, or null. The
|
|
15690
|
+
* line number is 1-based.
|
|
15691
|
+
* - column: The column number in the original source, or null. The
|
|
15692
|
+
* column number is 0-based.
|
|
15693
|
+
* - name: The original identifier, or null.
|
|
15694
|
+
*/
|
|
15695
|
+
BasicSourceMapConsumer.prototype.originalPositionFor =
|
|
15696
|
+
function SourceMapConsumer_originalPositionFor(aArgs) {
|
|
15697
|
+
var needle = {
|
|
15698
|
+
generatedLine: util.getArg(aArgs, 'line'),
|
|
15699
|
+
generatedColumn: util.getArg(aArgs, 'column')
|
|
15700
|
+
};
|
|
15701
|
+
|
|
15702
|
+
var index = this._findMapping(
|
|
15703
|
+
needle,
|
|
15704
|
+
this._generatedMappings,
|
|
15705
|
+
"generatedLine",
|
|
15706
|
+
"generatedColumn",
|
|
15707
|
+
util.compareByGeneratedPositionsDeflated,
|
|
15708
|
+
util.getArg(aArgs, 'bias', SourceMapConsumer$1.GREATEST_LOWER_BOUND)
|
|
15709
|
+
);
|
|
15710
|
+
|
|
15711
|
+
if (index >= 0) {
|
|
15712
|
+
var mapping = this._generatedMappings[index];
|
|
15713
|
+
|
|
15714
|
+
if (mapping.generatedLine === needle.generatedLine) {
|
|
15715
|
+
var source = util.getArg(mapping, 'source', null);
|
|
15716
|
+
if (source !== null) {
|
|
15717
|
+
source = this._sources.at(source);
|
|
15718
|
+
source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
|
|
15719
|
+
}
|
|
15720
|
+
var name = util.getArg(mapping, 'name', null);
|
|
15721
|
+
if (name !== null) {
|
|
15722
|
+
name = this._names.at(name);
|
|
15723
|
+
}
|
|
15724
|
+
return {
|
|
15725
|
+
source: source,
|
|
15726
|
+
line: util.getArg(mapping, 'originalLine', null),
|
|
15727
|
+
column: util.getArg(mapping, 'originalColumn', null),
|
|
15728
|
+
name: name
|
|
15729
|
+
};
|
|
15730
|
+
}
|
|
15731
|
+
}
|
|
15732
|
+
|
|
15733
|
+
return {
|
|
15734
|
+
source: null,
|
|
15735
|
+
line: null,
|
|
15736
|
+
column: null,
|
|
15737
|
+
name: null
|
|
15738
|
+
};
|
|
15739
|
+
};
|
|
15740
|
+
|
|
15741
|
+
/**
|
|
15742
|
+
* Return true if we have the source content for every source in the source
|
|
15743
|
+
* map, false otherwise.
|
|
15744
|
+
*/
|
|
15745
|
+
BasicSourceMapConsumer.prototype.hasContentsOfAllSources =
|
|
15746
|
+
function BasicSourceMapConsumer_hasContentsOfAllSources() {
|
|
15747
|
+
if (!this.sourcesContent) {
|
|
15748
|
+
return false;
|
|
15749
|
+
}
|
|
15750
|
+
return this.sourcesContent.length >= this._sources.size() &&
|
|
15751
|
+
!this.sourcesContent.some(function (sc) { return sc == null; });
|
|
15752
|
+
};
|
|
15753
|
+
|
|
15754
|
+
/**
|
|
15755
|
+
* Returns the original source content. The only argument is the url of the
|
|
15756
|
+
* original source file. Returns null if no original source content is
|
|
15757
|
+
* available.
|
|
15758
|
+
*/
|
|
15759
|
+
BasicSourceMapConsumer.prototype.sourceContentFor =
|
|
15760
|
+
function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
|
|
15761
|
+
if (!this.sourcesContent) {
|
|
15762
|
+
return null;
|
|
15763
|
+
}
|
|
15764
|
+
|
|
15765
|
+
var index = this._findSourceIndex(aSource);
|
|
15766
|
+
if (index >= 0) {
|
|
15767
|
+
return this.sourcesContent[index];
|
|
15768
|
+
}
|
|
15769
|
+
|
|
15770
|
+
var relativeSource = aSource;
|
|
15771
|
+
if (this.sourceRoot != null) {
|
|
15772
|
+
relativeSource = util.relative(this.sourceRoot, relativeSource);
|
|
15773
|
+
}
|
|
15774
|
+
|
|
15775
|
+
var url;
|
|
15776
|
+
if (this.sourceRoot != null
|
|
15777
|
+
&& (url = util.urlParse(this.sourceRoot))) {
|
|
15778
|
+
// XXX: file:// URIs and absolute paths lead to unexpected behavior for
|
|
15779
|
+
// many users. We can help them out when they expect file:// URIs to
|
|
15780
|
+
// behave like it would if they were running a local HTTP server. See
|
|
15781
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
|
|
15782
|
+
var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
|
|
15783
|
+
if (url.scheme == "file"
|
|
15784
|
+
&& this._sources.has(fileUriAbsPath)) {
|
|
15785
|
+
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
|
|
15786
|
+
}
|
|
15787
|
+
|
|
15788
|
+
if ((!url.path || url.path == "/")
|
|
15789
|
+
&& this._sources.has("/" + relativeSource)) {
|
|
15790
|
+
return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
|
|
15791
|
+
}
|
|
15792
|
+
}
|
|
15793
|
+
|
|
15794
|
+
// This function is used recursively from
|
|
15795
|
+
// IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
|
|
15796
|
+
// don't want to throw if we can't find the source - we just want to
|
|
15797
|
+
// return null, so we provide a flag to exit gracefully.
|
|
15798
|
+
if (nullOnMissing) {
|
|
15799
|
+
return null;
|
|
15800
|
+
}
|
|
15801
|
+
else {
|
|
15802
|
+
throw new Error('"' + relativeSource + '" is not in the SourceMap.');
|
|
15803
|
+
}
|
|
15804
|
+
};
|
|
15805
|
+
|
|
15806
|
+
/**
|
|
15807
|
+
* Returns the generated line and column information for the original source,
|
|
15808
|
+
* line, and column positions provided. The only argument is an object with
|
|
15809
|
+
* the following properties:
|
|
15810
|
+
*
|
|
15811
|
+
* - source: The filename of the original source.
|
|
15812
|
+
* - line: The line number in the original source. The line number
|
|
15813
|
+
* is 1-based.
|
|
15814
|
+
* - column: The column number in the original source. The column
|
|
15815
|
+
* number is 0-based.
|
|
15816
|
+
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
|
|
15817
|
+
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
|
|
15818
|
+
* closest element that is smaller than or greater than the one we are
|
|
15819
|
+
* searching for, respectively, if the exact element cannot be found.
|
|
15820
|
+
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
|
|
15821
|
+
*
|
|
15822
|
+
* and an object is returned with the following properties:
|
|
15823
|
+
*
|
|
15824
|
+
* - line: The line number in the generated source, or null. The
|
|
15825
|
+
* line number is 1-based.
|
|
15826
|
+
* - column: The column number in the generated source, or null.
|
|
15827
|
+
* The column number is 0-based.
|
|
15828
|
+
*/
|
|
15829
|
+
BasicSourceMapConsumer.prototype.generatedPositionFor =
|
|
15830
|
+
function SourceMapConsumer_generatedPositionFor(aArgs) {
|
|
15831
|
+
var source = util.getArg(aArgs, 'source');
|
|
15832
|
+
source = this._findSourceIndex(source);
|
|
15833
|
+
if (source < 0) {
|
|
15834
|
+
return {
|
|
15835
|
+
line: null,
|
|
15836
|
+
column: null,
|
|
15837
|
+
lastColumn: null
|
|
15838
|
+
};
|
|
15839
|
+
}
|
|
15840
|
+
|
|
15841
|
+
var needle = {
|
|
15842
|
+
source: source,
|
|
15843
|
+
originalLine: util.getArg(aArgs, 'line'),
|
|
15844
|
+
originalColumn: util.getArg(aArgs, 'column')
|
|
15845
|
+
};
|
|
15846
|
+
|
|
15847
|
+
var index = this._findMapping(
|
|
15848
|
+
needle,
|
|
15849
|
+
this._originalMappings,
|
|
15850
|
+
"originalLine",
|
|
15851
|
+
"originalColumn",
|
|
15852
|
+
util.compareByOriginalPositions,
|
|
15853
|
+
util.getArg(aArgs, 'bias', SourceMapConsumer$1.GREATEST_LOWER_BOUND)
|
|
15854
|
+
);
|
|
15855
|
+
|
|
15856
|
+
if (index >= 0) {
|
|
15857
|
+
var mapping = this._originalMappings[index];
|
|
15858
|
+
|
|
15859
|
+
if (mapping.source === needle.source) {
|
|
15860
|
+
return {
|
|
15861
|
+
line: util.getArg(mapping, 'generatedLine', null),
|
|
15862
|
+
column: util.getArg(mapping, 'generatedColumn', null),
|
|
15863
|
+
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
|
|
15864
|
+
};
|
|
15865
|
+
}
|
|
15866
|
+
}
|
|
15867
|
+
|
|
15868
|
+
return {
|
|
15869
|
+
line: null,
|
|
15870
|
+
column: null,
|
|
15871
|
+
lastColumn: null
|
|
15872
|
+
};
|
|
15873
|
+
};
|
|
15874
|
+
|
|
15875
|
+
var BasicSourceMapConsumer_1 = BasicSourceMapConsumer;
|
|
15876
|
+
|
|
15877
|
+
/**
|
|
15878
|
+
* An IndexedSourceMapConsumer instance represents a parsed source map which
|
|
15879
|
+
* we can query for information. It differs from BasicSourceMapConsumer in
|
|
15880
|
+
* that it takes "indexed" source maps (i.e. ones with a "sections" field) as
|
|
15881
|
+
* input.
|
|
15882
|
+
*
|
|
15883
|
+
* The first parameter is a raw source map (either as a JSON string, or already
|
|
15884
|
+
* parsed to an object). According to the spec for indexed source maps, they
|
|
15885
|
+
* have the following attributes:
|
|
15886
|
+
*
|
|
15887
|
+
* - version: Which version of the source map spec this map is following.
|
|
15888
|
+
* - file: Optional. The generated file this source map is associated with.
|
|
15889
|
+
* - sections: A list of section definitions.
|
|
15890
|
+
*
|
|
15891
|
+
* Each value under the "sections" field has two fields:
|
|
15892
|
+
* - offset: The offset into the original specified at which this section
|
|
15893
|
+
* begins to apply, defined as an object with a "line" and "column"
|
|
15894
|
+
* field.
|
|
15895
|
+
* - map: A source map definition. This source map could also be indexed,
|
|
15896
|
+
* but doesn't have to be.
|
|
15897
|
+
*
|
|
15898
|
+
* Instead of the "map" field, it's also possible to have a "url" field
|
|
15899
|
+
* specifying a URL to retrieve a source map from, but that's currently
|
|
15900
|
+
* unsupported.
|
|
15901
|
+
*
|
|
15902
|
+
* Here's an example source map, taken from the source map spec[0], but
|
|
15903
|
+
* modified to omit a section which uses the "url" field.
|
|
15904
|
+
*
|
|
15905
|
+
* {
|
|
15906
|
+
* version : 3,
|
|
15907
|
+
* file: "app.js",
|
|
15908
|
+
* sections: [{
|
|
15909
|
+
* offset: {line:100, column:10},
|
|
15910
|
+
* map: {
|
|
15911
|
+
* version : 3,
|
|
15912
|
+
* file: "section.js",
|
|
15913
|
+
* sources: ["foo.js", "bar.js"],
|
|
15914
|
+
* names: ["src", "maps", "are", "fun"],
|
|
15915
|
+
* mappings: "AAAA,E;;ABCDE;"
|
|
15916
|
+
* }
|
|
15917
|
+
* }],
|
|
15918
|
+
* }
|
|
15919
|
+
*
|
|
15920
|
+
* The second parameter, if given, is a string whose value is the URL
|
|
15921
|
+
* at which the source map was found. This URL is used to compute the
|
|
15922
|
+
* sources array.
|
|
15923
|
+
*
|
|
15924
|
+
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
|
|
15925
|
+
*/
|
|
15926
|
+
function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
|
|
15927
|
+
var sourceMap = aSourceMap;
|
|
15928
|
+
if (typeof aSourceMap === 'string') {
|
|
15929
|
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
15930
|
+
}
|
|
15931
|
+
|
|
15932
|
+
var version = util.getArg(sourceMap, 'version');
|
|
15933
|
+
var sections = util.getArg(sourceMap, 'sections');
|
|
15934
|
+
|
|
15935
|
+
if (version != this._version) {
|
|
15936
|
+
throw new Error('Unsupported version: ' + version);
|
|
15937
|
+
}
|
|
15938
|
+
|
|
15939
|
+
this._sources = new ArraySet$2();
|
|
15940
|
+
this._names = new ArraySet$2();
|
|
15941
|
+
|
|
15942
|
+
var lastOffset = {
|
|
15943
|
+
line: -1,
|
|
15944
|
+
column: 0
|
|
15945
|
+
};
|
|
15946
|
+
this._sections = sections.map(function (s) {
|
|
15947
|
+
if (s.url) {
|
|
15948
|
+
// The url field will require support for asynchronicity.
|
|
15949
|
+
// See https://github.com/mozilla/source-map/issues/16
|
|
15950
|
+
throw new Error('Support for url field in sections not implemented.');
|
|
15951
|
+
}
|
|
15952
|
+
var offset = util.getArg(s, 'offset');
|
|
15953
|
+
var offsetLine = util.getArg(offset, 'line');
|
|
15954
|
+
var offsetColumn = util.getArg(offset, 'column');
|
|
15955
|
+
|
|
15956
|
+
if (offsetLine < lastOffset.line ||
|
|
15957
|
+
(offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
|
|
15958
|
+
throw new Error('Section offsets must be ordered and non-overlapping.');
|
|
15959
|
+
}
|
|
15960
|
+
lastOffset = offset;
|
|
15961
|
+
|
|
15962
|
+
return {
|
|
15963
|
+
generatedOffset: {
|
|
15964
|
+
// The offset fields are 0-based, but we use 1-based indices when
|
|
15965
|
+
// encoding/decoding from VLQ.
|
|
15966
|
+
generatedLine: offsetLine + 1,
|
|
15967
|
+
generatedColumn: offsetColumn + 1
|
|
15968
|
+
},
|
|
15969
|
+
consumer: new SourceMapConsumer$1(util.getArg(s, 'map'), aSourceMapURL)
|
|
15970
|
+
}
|
|
15971
|
+
});
|
|
15972
|
+
}
|
|
15973
|
+
|
|
15974
|
+
IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer$1.prototype);
|
|
15975
|
+
IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer$1;
|
|
15976
|
+
|
|
15977
|
+
/**
|
|
15978
|
+
* The version of the source mapping spec that we are consuming.
|
|
15979
|
+
*/
|
|
15980
|
+
IndexedSourceMapConsumer.prototype._version = 3;
|
|
15981
|
+
|
|
15982
|
+
/**
|
|
15983
|
+
* The list of original sources.
|
|
15984
|
+
*/
|
|
15985
|
+
Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
|
|
15986
|
+
get: function () {
|
|
15987
|
+
var sources = [];
|
|
15988
|
+
for (var i = 0; i < this._sections.length; i++) {
|
|
15989
|
+
for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
|
|
15990
|
+
sources.push(this._sections[i].consumer.sources[j]);
|
|
15991
|
+
}
|
|
15992
|
+
}
|
|
15993
|
+
return sources;
|
|
15994
|
+
}
|
|
15995
|
+
});
|
|
15996
|
+
|
|
15997
|
+
/**
|
|
15998
|
+
* Returns the original source, line, and column information for the generated
|
|
15999
|
+
* source's line and column positions provided. The only argument is an object
|
|
16000
|
+
* with the following properties:
|
|
16001
|
+
*
|
|
16002
|
+
* - line: The line number in the generated source. The line number
|
|
16003
|
+
* is 1-based.
|
|
16004
|
+
* - column: The column number in the generated source. The column
|
|
16005
|
+
* number is 0-based.
|
|
16006
|
+
*
|
|
16007
|
+
* and an object is returned with the following properties:
|
|
16008
|
+
*
|
|
16009
|
+
* - source: The original source file, or null.
|
|
16010
|
+
* - line: The line number in the original source, or null. The
|
|
16011
|
+
* line number is 1-based.
|
|
16012
|
+
* - column: The column number in the original source, or null. The
|
|
16013
|
+
* column number is 0-based.
|
|
16014
|
+
* - name: The original identifier, or null.
|
|
16015
|
+
*/
|
|
16016
|
+
IndexedSourceMapConsumer.prototype.originalPositionFor =
|
|
16017
|
+
function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
|
|
16018
|
+
var needle = {
|
|
16019
|
+
generatedLine: util.getArg(aArgs, 'line'),
|
|
16020
|
+
generatedColumn: util.getArg(aArgs, 'column')
|
|
16021
|
+
};
|
|
16022
|
+
|
|
16023
|
+
// Find the section containing the generated position we're trying to map
|
|
16024
|
+
// to an original position.
|
|
16025
|
+
var sectionIndex = binarySearch.search(needle, this._sections,
|
|
16026
|
+
function(needle, section) {
|
|
16027
|
+
var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
|
|
16028
|
+
if (cmp) {
|
|
16029
|
+
return cmp;
|
|
16030
|
+
}
|
|
16031
|
+
|
|
16032
|
+
return (needle.generatedColumn -
|
|
16033
|
+
section.generatedOffset.generatedColumn);
|
|
16034
|
+
});
|
|
16035
|
+
var section = this._sections[sectionIndex];
|
|
16036
|
+
|
|
16037
|
+
if (!section) {
|
|
16038
|
+
return {
|
|
16039
|
+
source: null,
|
|
16040
|
+
line: null,
|
|
16041
|
+
column: null,
|
|
16042
|
+
name: null
|
|
16043
|
+
};
|
|
16044
|
+
}
|
|
16045
|
+
|
|
16046
|
+
return section.consumer.originalPositionFor({
|
|
16047
|
+
line: needle.generatedLine -
|
|
16048
|
+
(section.generatedOffset.generatedLine - 1),
|
|
16049
|
+
column: needle.generatedColumn -
|
|
16050
|
+
(section.generatedOffset.generatedLine === needle.generatedLine
|
|
16051
|
+
? section.generatedOffset.generatedColumn - 1
|
|
16052
|
+
: 0),
|
|
16053
|
+
bias: aArgs.bias
|
|
16054
|
+
});
|
|
16055
|
+
};
|
|
16056
|
+
|
|
16057
|
+
/**
|
|
16058
|
+
* Return true if we have the source content for every source in the source
|
|
16059
|
+
* map, false otherwise.
|
|
16060
|
+
*/
|
|
16061
|
+
IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =
|
|
16062
|
+
function IndexedSourceMapConsumer_hasContentsOfAllSources() {
|
|
16063
|
+
return this._sections.every(function (s) {
|
|
16064
|
+
return s.consumer.hasContentsOfAllSources();
|
|
16065
|
+
});
|
|
16066
|
+
};
|
|
16067
|
+
|
|
16068
|
+
/**
|
|
16069
|
+
* Returns the original source content. The only argument is the url of the
|
|
16070
|
+
* original source file. Returns null if no original source content is
|
|
16071
|
+
* available.
|
|
16072
|
+
*/
|
|
16073
|
+
IndexedSourceMapConsumer.prototype.sourceContentFor =
|
|
16074
|
+
function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
|
|
16075
|
+
for (var i = 0; i < this._sections.length; i++) {
|
|
16076
|
+
var section = this._sections[i];
|
|
16077
|
+
|
|
16078
|
+
var content = section.consumer.sourceContentFor(aSource, true);
|
|
16079
|
+
if (content) {
|
|
16080
|
+
return content;
|
|
16081
|
+
}
|
|
16082
|
+
}
|
|
16083
|
+
if (nullOnMissing) {
|
|
16084
|
+
return null;
|
|
16085
|
+
}
|
|
16086
|
+
else {
|
|
16087
|
+
throw new Error('"' + aSource + '" is not in the SourceMap.');
|
|
16088
|
+
}
|
|
16089
|
+
};
|
|
16090
|
+
|
|
16091
|
+
/**
|
|
16092
|
+
* Returns the generated line and column information for the original source,
|
|
16093
|
+
* line, and column positions provided. The only argument is an object with
|
|
16094
|
+
* the following properties:
|
|
16095
|
+
*
|
|
16096
|
+
* - source: The filename of the original source.
|
|
16097
|
+
* - line: The line number in the original source. The line number
|
|
16098
|
+
* is 1-based.
|
|
16099
|
+
* - column: The column number in the original source. The column
|
|
16100
|
+
* number is 0-based.
|
|
16101
|
+
*
|
|
16102
|
+
* and an object is returned with the following properties:
|
|
16103
|
+
*
|
|
16104
|
+
* - line: The line number in the generated source, or null. The
|
|
16105
|
+
* line number is 1-based.
|
|
16106
|
+
* - column: The column number in the generated source, or null.
|
|
16107
|
+
* The column number is 0-based.
|
|
16108
|
+
*/
|
|
16109
|
+
IndexedSourceMapConsumer.prototype.generatedPositionFor =
|
|
16110
|
+
function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
|
|
16111
|
+
for (var i = 0; i < this._sections.length; i++) {
|
|
16112
|
+
var section = this._sections[i];
|
|
16113
|
+
|
|
16114
|
+
// Only consider this section if the requested source is in the list of
|
|
16115
|
+
// sources of the consumer.
|
|
16116
|
+
if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {
|
|
16117
|
+
continue;
|
|
16118
|
+
}
|
|
16119
|
+
var generatedPosition = section.consumer.generatedPositionFor(aArgs);
|
|
16120
|
+
if (generatedPosition) {
|
|
16121
|
+
var ret = {
|
|
16122
|
+
line: generatedPosition.line +
|
|
16123
|
+
(section.generatedOffset.generatedLine - 1),
|
|
16124
|
+
column: generatedPosition.column +
|
|
16125
|
+
(section.generatedOffset.generatedLine === generatedPosition.line
|
|
16126
|
+
? section.generatedOffset.generatedColumn - 1
|
|
16127
|
+
: 0)
|
|
16128
|
+
};
|
|
16129
|
+
return ret;
|
|
16130
|
+
}
|
|
16131
|
+
}
|
|
16132
|
+
|
|
16133
|
+
return {
|
|
16134
|
+
line: null,
|
|
16135
|
+
column: null
|
|
16136
|
+
};
|
|
16137
|
+
};
|
|
16138
|
+
|
|
16139
|
+
/**
|
|
16140
|
+
* Parse the mappings in a string in to a data structure which we can easily
|
|
16141
|
+
* query (the ordered arrays in the `this.__generatedMappings` and
|
|
16142
|
+
* `this.__originalMappings` properties).
|
|
16143
|
+
*/
|
|
16144
|
+
IndexedSourceMapConsumer.prototype._parseMappings =
|
|
16145
|
+
function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
|
|
16146
|
+
this.__generatedMappings = [];
|
|
16147
|
+
this.__originalMappings = [];
|
|
16148
|
+
for (var i = 0; i < this._sections.length; i++) {
|
|
16149
|
+
var section = this._sections[i];
|
|
16150
|
+
var sectionMappings = section.consumer._generatedMappings;
|
|
16151
|
+
for (var j = 0; j < sectionMappings.length; j++) {
|
|
16152
|
+
var mapping = sectionMappings[j];
|
|
16153
|
+
|
|
16154
|
+
var source = section.consumer._sources.at(mapping.source);
|
|
16155
|
+
source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
|
|
16156
|
+
this._sources.add(source);
|
|
16157
|
+
source = this._sources.indexOf(source);
|
|
16158
|
+
|
|
16159
|
+
var name = null;
|
|
16160
|
+
if (mapping.name) {
|
|
16161
|
+
name = section.consumer._names.at(mapping.name);
|
|
16162
|
+
this._names.add(name);
|
|
16163
|
+
name = this._names.indexOf(name);
|
|
16164
|
+
}
|
|
16165
|
+
|
|
16166
|
+
// The mappings coming from the consumer for the section have
|
|
16167
|
+
// generated positions relative to the start of the section, so we
|
|
16168
|
+
// need to offset them to be relative to the start of the concatenated
|
|
16169
|
+
// generated file.
|
|
16170
|
+
var adjustedMapping = {
|
|
16171
|
+
source: source,
|
|
16172
|
+
generatedLine: mapping.generatedLine +
|
|
16173
|
+
(section.generatedOffset.generatedLine - 1),
|
|
16174
|
+
generatedColumn: mapping.generatedColumn +
|
|
16175
|
+
(section.generatedOffset.generatedLine === mapping.generatedLine
|
|
16176
|
+
? section.generatedOffset.generatedColumn - 1
|
|
16177
|
+
: 0),
|
|
16178
|
+
originalLine: mapping.originalLine,
|
|
16179
|
+
originalColumn: mapping.originalColumn,
|
|
16180
|
+
name: name
|
|
16181
|
+
};
|
|
16182
|
+
|
|
16183
|
+
this.__generatedMappings.push(adjustedMapping);
|
|
16184
|
+
if (typeof adjustedMapping.originalLine === 'number') {
|
|
16185
|
+
this.__originalMappings.push(adjustedMapping);
|
|
16186
|
+
}
|
|
16187
|
+
}
|
|
16188
|
+
}
|
|
16189
|
+
|
|
16190
|
+
quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
|
|
16191
|
+
quickSort(this.__originalMappings, util.compareByOriginalPositions);
|
|
16192
|
+
};
|
|
16193
|
+
|
|
16194
|
+
var IndexedSourceMapConsumer_1 = IndexedSourceMapConsumer;
|
|
16195
|
+
|
|
16196
|
+
var sourceMapConsumer = {
|
|
16197
|
+
SourceMapConsumer: SourceMapConsumer_1,
|
|
16198
|
+
BasicSourceMapConsumer: BasicSourceMapConsumer_1,
|
|
16199
|
+
IndexedSourceMapConsumer: IndexedSourceMapConsumer_1
|
|
16200
|
+
};
|
|
16201
|
+
|
|
16202
|
+
var SourceMapConsumer = sourceMapConsumer.SourceMapConsumer;
|
|
16203
|
+
|
|
16204
|
+
function tryParse ( module, acornOptions ) {
|
|
16205
|
+
try {
|
|
16206
|
+
return parse( module.code, assign( {
|
|
16207
|
+
ecmaVersion: 8,
|
|
16208
|
+
sourceType: 'module',
|
|
16209
|
+
onComment: ( block, text, start, end ) => module.comments.push( { block, text, start, end } ),
|
|
16210
|
+
preserveParens: false
|
|
16211
|
+
}, acornOptions ) );
|
|
16212
|
+
} catch ( err ) {
|
|
16213
|
+
module.error( {
|
|
16214
|
+
code: 'PARSE_ERROR',
|
|
16215
|
+
message: err.message.replace( / \(\d+:\d+\)$/, '' )
|
|
16216
|
+
}, err.pos );
|
|
16217
|
+
}
|
|
16218
|
+
}
|
|
16219
|
+
|
|
16220
|
+
function includeFully ( node ) {
|
|
16221
|
+
node.included = true;
|
|
16222
|
+
if ( node.variable && !node.variable.included ) {
|
|
16223
|
+
node.variable.includeVariable();
|
|
16224
|
+
}
|
|
16225
|
+
node.eachChild( includeFully );
|
|
16226
|
+
}
|
|
16227
|
+
|
|
16228
|
+
class Module {
|
|
16229
|
+
constructor ( ref ) {
|
|
16230
|
+
var id = ref.id;
|
|
16231
|
+
var code = ref.code;
|
|
16232
|
+
var originalCode = ref.originalCode;
|
|
16233
|
+
var originalSourcemap = ref.originalSourcemap;
|
|
16234
|
+
var ast = ref.ast;
|
|
16235
|
+
var sourcemapChain = ref.sourcemapChain;
|
|
16236
|
+
var resolvedIds = ref.resolvedIds;
|
|
16237
|
+
var resolvedExternalIds = ref.resolvedExternalIds;
|
|
16238
|
+
var bundle = ref.bundle;
|
|
16239
|
+
|
|
16240
|
+
this.code = code;
|
|
16241
|
+
this.id = id;
|
|
16242
|
+
this.bundle = bundle;
|
|
16243
|
+
this.originalCode = originalCode;
|
|
16244
|
+
this.originalSourcemap = originalSourcemap;
|
|
16245
|
+
this.sourcemapChain = sourcemapChain;
|
|
16246
|
+
|
|
16247
|
+
this.comments = [];
|
|
16248
|
+
|
|
16249
|
+
timeStart( 'ast' );
|
|
16250
|
+
|
|
16251
|
+
if ( ast ) {
|
|
16252
|
+
// prevent mutating the provided AST, as it may be reused on
|
|
16253
|
+
// subsequent incremental rebuilds
|
|
16254
|
+
this.ast = clone( ast );
|
|
16255
|
+
this.astClone = ast;
|
|
16256
|
+
} else {
|
|
16257
|
+
this.ast = tryParse( this, bundle.acornOptions ); // TODO what happens to comments if AST is provided?
|
|
16258
|
+
this.astClone = clone( this.ast );
|
|
16259
|
+
}
|
|
16260
|
+
|
|
16261
|
+
timeEnd( 'ast' );
|
|
16262
|
+
|
|
16263
|
+
this.excludeFromSourcemap = /\0/.test( id );
|
|
16264
|
+
this.context = bundle.getModuleContext( id );
|
|
16265
|
+
|
|
16266
|
+
// all dependencies
|
|
16267
|
+
this.sources = [];
|
|
16268
|
+
this.dependencies = [];
|
|
16269
|
+
this.resolvedIds = resolvedIds || blank();
|
|
16270
|
+
this.resolvedExternalIds = resolvedExternalIds || blank();
|
|
16271
|
+
|
|
16272
|
+
// imports and exports, indexed by local name
|
|
16273
|
+
this.imports = blank();
|
|
16274
|
+
this.exports = blank();
|
|
16275
|
+
this.exportsAll = blank();
|
|
16276
|
+
this.reexports = blank();
|
|
16277
|
+
|
|
16278
|
+
this.exportAllSources = [];
|
|
16279
|
+
this.exportAllModules = null;
|
|
16280
|
+
|
|
16281
|
+
// By default, `id` is the filename. Custom resolvers and loaders
|
|
16282
|
+
// can change that, but it makes sense to use it for the source filename
|
|
16283
|
+
this.magicString = new MagicString$1( code, {
|
|
16284
|
+
filename: this.excludeFromSourcemap ? null : id, // don't include plugin helpers in sourcemap
|
|
16285
|
+
indentExclusionRanges: []
|
|
16286
|
+
} );
|
|
16287
|
+
|
|
16288
|
+
// remove existing sourceMappingURL comments
|
|
16289
|
+
this.comments = this.comments.filter( comment => {
|
|
16290
|
+
//only one line comment can contain source maps
|
|
16291
|
+
const isSourceMapComment = !comment.block && SOURCEMAPPING_URL_RE.test( comment.text );
|
|
16292
|
+
if ( isSourceMapComment ) {
|
|
16293
|
+
this.magicString.remove( comment.start, comment.end );
|
|
16294
|
+
}
|
|
16295
|
+
return !isSourceMapComment;
|
|
16296
|
+
} );
|
|
16297
|
+
|
|
16298
|
+
this.declarations = blank();
|
|
16299
|
+
this.type = 'Module'; // TODO only necessary so that Scope knows this should be treated as a function scope... messy
|
|
16300
|
+
this.scope = new ModuleScope( this );
|
|
16301
|
+
|
|
16302
|
+
timeStart( 'analyse' );
|
|
16303
|
+
|
|
16304
|
+
this.analyse();
|
|
16305
|
+
|
|
16306
|
+
timeEnd( 'analyse' );
|
|
16307
|
+
|
|
16308
|
+
this.strongDependencies = [];
|
|
16309
|
+
}
|
|
16310
|
+
|
|
16311
|
+
addExport ( node ) {
|
|
16312
|
+
const source = node.source && node.source.value;
|
|
16313
|
+
|
|
16314
|
+
// export { name } from './other.js'
|
|
16315
|
+
if ( source ) {
|
|
16316
|
+
if ( !~this.sources.indexOf( source ) ) { this.sources.push( source ); }
|
|
16317
|
+
|
|
16318
|
+
if ( node.type === 'ExportAllDeclaration' ) {
|
|
16319
|
+
// Store `export * from '...'` statements in an array of delegates.
|
|
16320
|
+
// When an unknown import is encountered, we see if one of them can satisfy it.
|
|
16321
|
+
this.exportAllSources.push( source );
|
|
16322
|
+
}
|
|
16323
|
+
|
|
16324
|
+
else {
|
|
16325
|
+
node.specifiers.forEach( specifier => {
|
|
16326
|
+
const name = specifier.exported.name;
|
|
16327
|
+
|
|
16328
|
+
if ( this.exports[ name ] || this.reexports[ name ] ) {
|
|
16329
|
+
this.error( {
|
|
16330
|
+
code: 'DUPLICATE_EXPORT',
|
|
16331
|
+
message: `A module cannot have multiple exports with the same name ('${name}')`
|
|
16332
|
+
}, specifier.start );
|
|
16333
|
+
}
|
|
16334
|
+
|
|
16335
|
+
this.reexports[ name ] = {
|
|
16336
|
+
start: specifier.start,
|
|
16337
|
+
source,
|
|
16338
|
+
localName: specifier.local.name,
|
|
16339
|
+
module: null // filled in later
|
|
16340
|
+
};
|
|
16341
|
+
} );
|
|
16342
|
+
}
|
|
16343
|
+
}
|
|
16344
|
+
|
|
16345
|
+
// export default function foo () {}
|
|
16346
|
+
// export default foo;
|
|
14143
16347
|
// export default 42;
|
|
14144
16348
|
else if ( node.type === 'ExportDefaultDeclaration' ) {
|
|
14145
16349
|
const identifier = ( node.declaration.id && node.declaration.id.name ) || node.declaration.name;
|
|
@@ -14274,6 +16478,30 @@ class Module {
|
|
|
14274
16478
|
}
|
|
14275
16479
|
}
|
|
14276
16480
|
|
|
16481
|
+
getOriginalLocation (sourcemapChain, line, column) {
|
|
16482
|
+
let location = {
|
|
16483
|
+
line,
|
|
16484
|
+
column
|
|
16485
|
+
};
|
|
16486
|
+
const filteredSourcemapChain =
|
|
16487
|
+
sourcemapChain.filter(sourcemap => sourcemap.mappings).map(sourcemap => {
|
|
16488
|
+
const encodedSourcemap = sourcemap;
|
|
16489
|
+
if (sourcemap.mappings) {
|
|
16490
|
+
encodedSourcemap.mappings = encode$$1(encodedSourcemap.mappings);
|
|
16491
|
+
}
|
|
16492
|
+
return encodedSourcemap;
|
|
16493
|
+
});
|
|
16494
|
+
while (filteredSourcemapChain.length > 0) {
|
|
16495
|
+
const sourcemap = filteredSourcemapChain.pop();
|
|
16496
|
+
const smc = new SourceMapConsumer(sourcemap);
|
|
16497
|
+
location = smc.originalPositionFor({
|
|
16498
|
+
line: location.line,
|
|
16499
|
+
column: location.column
|
|
16500
|
+
});
|
|
16501
|
+
}
|
|
16502
|
+
return location;
|
|
16503
|
+
}
|
|
16504
|
+
|
|
14277
16505
|
error ( props, pos ) {
|
|
14278
16506
|
if ( pos !== undefined ) {
|
|
14279
16507
|
props.pos = pos;
|
|
@@ -14282,8 +16510,10 @@ class Module {
|
|
|
14282
16510
|
var line = ref.line;
|
|
14283
16511
|
var column = ref.column; // TODO trace sourcemaps
|
|
14284
16512
|
|
|
14285
|
-
|
|
14286
|
-
|
|
16513
|
+
const location = this.getOriginalLocation(this.sourcemapChain, line, column);
|
|
16514
|
+
|
|
16515
|
+
props.loc = { file: this.id, line: location.line, column: location.column };
|
|
16516
|
+
props.frame = getCodeFrame( this.originalCode, location.line, location.column );
|
|
14287
16517
|
}
|
|
14288
16518
|
|
|
14289
16519
|
error( props );
|
|
@@ -14916,7 +17146,7 @@ function setupNamespace ( keypath$$1 ) {
|
|
|
14916
17146
|
let acc = 'this';
|
|
14917
17147
|
|
|
14918
17148
|
return parts
|
|
14919
|
-
.map( part => ( acc += property( part ), `${acc} = ${acc} || {};`
|
|
17149
|
+
.map( part => ( acc += property( part ), `${acc} = ${acc} || {};`) )
|
|
14920
17150
|
.join( '\n' ) + '\n';
|
|
14921
17151
|
}
|
|
14922
17152
|
|
|
@@ -15008,7 +17238,7 @@ function setupNamespace$1 ( name ) {
|
|
|
15008
17238
|
|
|
15009
17239
|
let acc = 'global';
|
|
15010
17240
|
return parts
|
|
15011
|
-
.map( part => ( acc += property( part ), `${acc} = ${acc} || {}`
|
|
17241
|
+
.map( part => ( acc += property( part ), `${acc} = ${acc} || {}`) )
|
|
15012
17242
|
.concat( `${acc}${last}` )
|
|
15013
17243
|
.join( ', ' );
|
|
15014
17244
|
}
|
|
@@ -15018,7 +17248,7 @@ function safeAccess ( name ) {
|
|
|
15018
17248
|
|
|
15019
17249
|
let acc = 'global';
|
|
15020
17250
|
return parts
|
|
15021
|
-
.map( part => ( acc += property( part ), acc
|
|
17251
|
+
.map( part => ( acc += property( part ), acc) )
|
|
15022
17252
|
.join( ` && ` );
|
|
15023
17253
|
}
|
|
15024
17254
|
|
|
@@ -18598,17 +20828,6 @@ var parseGlob = createCommonjsModule(function (module) {
|
|
|
18598
20828
|
* Licensed under the MIT License.
|
|
18599
20829
|
*/
|
|
18600
20830
|
|
|
18601
|
-
'use strict';
|
|
18602
|
-
|
|
18603
|
-
|
|
18604
|
-
|
|
18605
|
-
|
|
18606
|
-
|
|
18607
|
-
|
|
18608
|
-
/**
|
|
18609
|
-
* Expose `cache`
|
|
18610
|
-
*/
|
|
18611
|
-
|
|
18612
20831
|
var cache = module.exports.cache = {};
|
|
18613
20832
|
|
|
18614
20833
|
/**
|
|
@@ -18749,6 +20968,8 @@ function unescape(str) {
|
|
|
18749
20968
|
}
|
|
18750
20969
|
});
|
|
18751
20970
|
|
|
20971
|
+
var parseGlob_1 = parseGlob.cache;
|
|
20972
|
+
|
|
18752
20973
|
/*!
|
|
18753
20974
|
* is-primitive <https://github.com/jonschlinkert/is-primitive>
|
|
18754
20975
|
*
|
|
@@ -18841,8 +21062,6 @@ regexCache_1.cache = cache_1;
|
|
|
18841
21062
|
regexCache_1.basic = basic_1;
|
|
18842
21063
|
|
|
18843
21064
|
var utils_1 = createCommonjsModule(function (module) {
|
|
18844
|
-
'use strict';
|
|
18845
|
-
|
|
18846
21065
|
var win32 = process && process.platform === 'win32';
|
|
18847
21066
|
|
|
18848
21067
|
|
|
@@ -19061,15 +21280,6 @@ chars.TEMP = temp || (temp = reverse(chars.ESC_TEMP));
|
|
|
19061
21280
|
var chars_1 = chars;
|
|
19062
21281
|
|
|
19063
21282
|
var glob = createCommonjsModule(function (module) {
|
|
19064
|
-
'use strict';
|
|
19065
|
-
|
|
19066
|
-
|
|
19067
|
-
|
|
19068
|
-
|
|
19069
|
-
/**
|
|
19070
|
-
* Expose `Glob`
|
|
19071
|
-
*/
|
|
19072
|
-
|
|
19073
21283
|
var Glob = module.exports = function Glob(pattern, options) {
|
|
19074
21284
|
if (!(this instanceof Glob)) {
|
|
19075
21285
|
return new Glob(pattern, options);
|
|
@@ -20030,12 +22240,12 @@ requireRelative.resolve = function(requested, relativeTo) {
|
|
|
20030
22240
|
return module$1._resolveFilename(requested, root);
|
|
20031
22241
|
};
|
|
20032
22242
|
|
|
20033
|
-
var requireRelative_1
|
|
22243
|
+
var requireRelative_1 = requireRelative;
|
|
20034
22244
|
|
|
20035
22245
|
let chokidar;
|
|
20036
22246
|
|
|
20037
22247
|
try {
|
|
20038
|
-
chokidar = requireRelative_1
|
|
22248
|
+
chokidar = requireRelative_1( 'chokidar', process.cwd() );
|
|
20039
22249
|
} catch (err) {
|
|
20040
22250
|
chokidar = null;
|
|
20041
22251
|
}
|
|
@@ -20371,7 +22581,7 @@ function watch$1(configs) {
|
|
|
20371
22581
|
return new Watcher(configs);
|
|
20372
22582
|
}
|
|
20373
22583
|
|
|
20374
|
-
var version$1 = "0.51.
|
|
22584
|
+
var version$1 = "0.51.8";
|
|
20375
22585
|
|
|
20376
22586
|
export { rollup, watch$1 as watch, version$1 as VERSION };
|
|
20377
22587
|
//# sourceMappingURL=rollup.es.js.map
|