@validate.qa/runner 1.0.86 → 1.0.87
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/dist/cli.js +178 -2296
- package/dist/cli.mjs +178 -2296
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -83734,6 +83734,9 @@ ${statePacket}`, redactionCredentials) },
|
|
|
83734
83734
|
if (isContentActionScenario(scenario)) {
|
|
83735
83735
|
return false;
|
|
83736
83736
|
}
|
|
83737
|
+
if (isFormValidationScenario(scenario)) {
|
|
83738
|
+
return false;
|
|
83739
|
+
}
|
|
83737
83740
|
const text = scenarioText(scenario);
|
|
83738
83741
|
const visibilityOnlyGoal = (/\b(entry\s+points?|providers?|provider\s+buttons?|sign[- ]?in\s+options|auth(?:entication)?\s+options|available\s+options)\b/.test(text) || /\b(show|display)\s+(all\s+)?(the\s+)?(providers?|options|buttons?|links?|entry\s+points?)\b/.test(text) || /\b(all\s+(three\s+)?providers?)\b/.test(text)) && !/\b(change|update|create|save|send|register|edit|with\s+valid|successful\s+(sign|log)|complete\s+(the\s+)?(login|sign[- ]?in)|submit\s+(the\s+)?(form|credentials)|enter\s+(an?\s+)?(email|password))\b/.test(text);
|
|
83739
83742
|
if (visibilityOnlyGoal) {
|
|
@@ -83899,8 +83902,8 @@ ${statePacket}`, redactionCredentials) },
|
|
|
83899
83902
|
if (isNavChromeThrashTrace(actions)) {
|
|
83900
83903
|
return "content-action scenario only recorded tab thrash / swipes \u2014 no product action";
|
|
83901
83904
|
}
|
|
83902
|
-
const
|
|
83903
|
-
if (
|
|
83905
|
+
const asserts2 = actions.filter((a) => a.type === "ASSERT_VISIBLE" || a.type === "ASSERT_TEXT");
|
|
83906
|
+
if (asserts2.length > 0 && asserts2.every((a) => VOLATILE_BADGE_ASSERT_RE.test(actionText(a)) || NAV_CHROME_TAP_RE.test(actionText(a)) && !CONTENT_ACTION_VERB_RE.test(actionText(a)))) {
|
|
83904
83907
|
return "content-action scenario only asserted tab chrome or a volatile badge count \u2014 assert the action outcome instead";
|
|
83905
83908
|
}
|
|
83906
83909
|
return null;
|
|
@@ -83937,12 +83940,15 @@ ${statePacket}`, redactionCredentials) },
|
|
|
83937
83940
|
const hasValidationAssert = actions.some((a) => {
|
|
83938
83941
|
if (a.type !== "ASSERT_VISIBLE" && a.type !== "ASSERT_TEXT")
|
|
83939
83942
|
return false;
|
|
83940
|
-
return /\b(error|required|invalid|empty|missing|incorrect|wrong|try again|mismatch|does not match|must match)\b/.test(actionText(a));
|
|
83943
|
+
return /\b(error|required|invalid|empty|missing|incorrect|wrong|try again|mismatch|does not match|must match|cannot be empty|please enter|fill out|is required)\b/.test(actionText(a));
|
|
83941
83944
|
});
|
|
83942
83945
|
const emptyFieldIntent = /\b(empty|required|missing|blank)\b/.test(text);
|
|
83943
83946
|
const invalidValueIntent = /\b(wrong|incorrect|invalid|mismatch|reject)\b/.test(text);
|
|
83947
|
+
if (!hasValidationAssert) {
|
|
83948
|
+
return "validation scenario did not assert a validation/error outcome (commit alone is not proof)";
|
|
83949
|
+
}
|
|
83944
83950
|
if (emptyFieldIntent && !invalidValueIntent) {
|
|
83945
|
-
if (!hasCommit
|
|
83951
|
+
if (!hasCommit) {
|
|
83946
83952
|
return "validation scenario did not record a form commit or validation outcome";
|
|
83947
83953
|
}
|
|
83948
83954
|
return null;
|
|
@@ -83950,7 +83956,7 @@ ${statePacket}`, redactionCredentials) },
|
|
|
83950
83956
|
if (typedFields && !hasCommit) {
|
|
83951
83957
|
return "validation scenario filled fields but never committed the form";
|
|
83952
83958
|
}
|
|
83953
|
-
if (!hasCommit
|
|
83959
|
+
if (!hasCommit) {
|
|
83954
83960
|
return "validation scenario did not record a form commit or validation outcome";
|
|
83955
83961
|
}
|
|
83956
83962
|
return null;
|
|
@@ -83964,6 +83970,10 @@ ${statePacket}`, redactionCredentials) },
|
|
|
83964
83970
|
if (!hasCommit) {
|
|
83965
83971
|
return "form-mutation happy path did not record a form commit";
|
|
83966
83972
|
}
|
|
83973
|
+
const asserts2 = actions.filter((a) => a.type === "ASSERT_VISIBLE" || a.type === "ASSERT_TEXT");
|
|
83974
|
+
if (asserts2.length > 0 && asserts2.every((a) => NAV_CHROME_TAP_RE.test(actionText(a)) || VOLATILE_BADGE_ASSERT_RE.test(actionText(a)) || isStructuralOnlyAssert(a) || isEphemeralContentAssertText(assertIdentityText(a)))) {
|
|
83975
|
+
return "form-mutation happy path only asserted tab chrome or ephemeral content \u2014 assert the saved/updated product outcome";
|
|
83976
|
+
}
|
|
83967
83977
|
}
|
|
83968
83978
|
const isCredentialSignIn = /\b(sign\s*in|log\s*in|login|authenticate|auth)\b/.test(text) && /\b(email|e-mail|password|credential|valid credentials?)\b/.test(text) && !/\b(reset|forgot|recover|logout|log\s*out|sign\s*out|change\s+password|update\s+password)\b/.test(text);
|
|
83969
83979
|
const typedEmailIndexes = [];
|
|
@@ -84056,13 +84066,70 @@ ${statePacket}`, redactionCredentials) },
|
|
|
84056
84066
|
if (!actions.some((a) => isProductiveScenarioAction(a, text))) {
|
|
84057
84067
|
return "happy-path / user-journey scenario did not record a productive product action (only chrome, gestures, or empty work)";
|
|
84058
84068
|
}
|
|
84059
|
-
const
|
|
84060
|
-
if (
|
|
84069
|
+
const asserts2 = actions.filter((a) => a.type === "ASSERT_VISIBLE" || a.type === "ASSERT_TEXT");
|
|
84070
|
+
if (asserts2.length > 0 && asserts2.every((a) => VOLATILE_BADGE_ASSERT_RE.test(actionText(a)) || isStructuralOnlyAssert(a))) {
|
|
84061
84071
|
return "happy-path / user-journey scenario only asserted volatile badges or structural roots \u2014 assert a durable feature outcome";
|
|
84062
84072
|
}
|
|
84063
84073
|
}
|
|
84074
|
+
const goalFidelity = scenarioGoalActionFidelityReason(text, actions);
|
|
84075
|
+
if (goalFidelity)
|
|
84076
|
+
return goalFidelity;
|
|
84077
|
+
if (actions.some((a) => isBareHierarchyFieldAction(a))) {
|
|
84078
|
+
return "typed or tapped a bare hierarchy/container target with no accessible label \u2014 use a labeled field/control";
|
|
84079
|
+
}
|
|
84080
|
+
const asserts = actions.filter((a) => a.type === "ASSERT_VISIBLE" || a.type === "ASSERT_TEXT");
|
|
84081
|
+
if (asserts.length > 0 && asserts.every((a) => isEphemeralContentAssertText(assertIdentityText(a)))) {
|
|
84082
|
+
return "only asserted ephemeral feed/catalog content (session-specific titles/ids) \u2014 assert durable product chrome or stable outcome";
|
|
84083
|
+
}
|
|
84084
|
+
return null;
|
|
84085
|
+
}
|
|
84086
|
+
function scenarioGoalActionFidelityReason(scenarioTextLower, actions) {
|
|
84087
|
+
const actionBlob = actions.map((a) => actionText(a)).join(" ").toLowerCase();
|
|
84088
|
+
if (/\b(pick|choose|select)\b.*\b(library|gallery|photos?|camera\s*roll|device)\b|\bfrom\s+(the\s+)?(library|gallery|photos?)\b/.test(scenarioTextLower)) {
|
|
84089
|
+
if (!/\b(library|gallery|photos?|camera\s*roll|pick\s+a\s+video|choose\s+(a\s+)?(video|photo|file)|from\s+library|document\s*picker|media\s*picker)\b/i.test(actionBlob)) {
|
|
84090
|
+
return "scenario claims pick-from-library but recording never tapped a library/gallery/picker control";
|
|
84091
|
+
}
|
|
84092
|
+
}
|
|
84093
|
+
if (/\b(style|styles)\b/.test(scenarioTextLower) && /\b(format|aspect|ratio|quality|reels?|9:16|16:9)\b/.test(scenarioTextLower)) {
|
|
84094
|
+
const pickedStyle = /\b(style|cinematic|anime|realistic|no\s*style|cartoon|oil\s*paint)\b/i.test(actionBlob);
|
|
84095
|
+
const pickedFormat = /\b(9:16|16:9|1:1|reels?|aspect|quality|format|720|1080)\b/i.test(actionBlob);
|
|
84096
|
+
if (!pickedStyle || !pickedFormat) {
|
|
84097
|
+
return "scenario claims style+format selection but recording did not select both a style and a format/aspect control";
|
|
84098
|
+
}
|
|
84099
|
+
}
|
|
84100
|
+
if (/\b(open|launch|start)\b.*\b(camera|recording)\b|\brecord\s+a\s+video\b/.test(scenarioTextLower)) {
|
|
84101
|
+
if (!/\b(camera|record|recording|flash|flip\s+camera|capture|shutter)\b/i.test(actionBlob)) {
|
|
84102
|
+
return "scenario claims open/record camera but recording never reached camera controls";
|
|
84103
|
+
}
|
|
84104
|
+
}
|
|
84064
84105
|
return null;
|
|
84065
84106
|
}
|
|
84107
|
+
function isBareHierarchyFieldAction(action) {
|
|
84108
|
+
if (action.type !== "TYPE" && action.type !== "CLEAR")
|
|
84109
|
+
return false;
|
|
84110
|
+
const sel = (action.selector ?? "").trim();
|
|
84111
|
+
if (!/^\/hierarchy/i.test(sel))
|
|
84112
|
+
return false;
|
|
84113
|
+
const bundle = action.metadata.locatorBundle;
|
|
84114
|
+
const label = (action.metadata.targetLabel ?? "").trim();
|
|
84115
|
+
if (label && !/^element$/i.test(label))
|
|
84116
|
+
return false;
|
|
84117
|
+
const inner = nonEmpty3(action.innerText);
|
|
84118
|
+
if (inner && !/^element$/i.test(inner))
|
|
84119
|
+
return false;
|
|
84120
|
+
if (nonEmpty3(bundle?.text) || nonEmpty3(bundle?.contentDesc) || nonEmpty3(bundle?.accessibilityId)) {
|
|
84121
|
+
return false;
|
|
84122
|
+
}
|
|
84123
|
+
if (nonEmpty3(bundle?.resourceId) && !isStructuralAssertionIdentity(bundle?.resourceId)) {
|
|
84124
|
+
return false;
|
|
84125
|
+
}
|
|
84126
|
+
if (action.type === "TYPE") {
|
|
84127
|
+
const v = (action.value ?? "").replace(/\s+/g, "");
|
|
84128
|
+
if (v.length > 0)
|
|
84129
|
+
return false;
|
|
84130
|
+
}
|
|
84131
|
+
return true;
|
|
84132
|
+
}
|
|
84066
84133
|
function actionCycleKey(action) {
|
|
84067
84134
|
return `${action.type}|${action.selector}|${action.value ?? ""}`;
|
|
84068
84135
|
}
|
|
@@ -84332,6 +84399,15 @@ ${statePacket}`, redactionCredentials) },
|
|
|
84332
84399
|
if (t.length >= 40 && /\b(error\s+\d{3,}|generation failed|rate limit|quota exceeded)\b/i.test(t)) {
|
|
84333
84400
|
return true;
|
|
84334
84401
|
}
|
|
84402
|
+
if (/\b(harness|seed|fixture|demo\s*data|test\s*artist|qa\s*published)\b/i.test(t) && /\d{6,}/.test(t)) {
|
|
84403
|
+
return true;
|
|
84404
|
+
}
|
|
84405
|
+
if (/\bplay\b.+\bby\b.+/i.test(t) && (t.length >= 40 || /\d{6,}/.test(t))) {
|
|
84406
|
+
return true;
|
|
84407
|
+
}
|
|
84408
|
+
if (/^play\s+/i.test(t) && t.length >= 35 && !/\b(home|search|settings|profile|library|playlist|sign\s*in|log\s*in)\b/i.test(t)) {
|
|
84409
|
+
return true;
|
|
84410
|
+
}
|
|
84335
84411
|
return false;
|
|
84336
84412
|
}
|
|
84337
84413
|
function assertIdentityText(action) {
|
|
@@ -101455,2285 +101531,6 @@ var require_rate_limit_detector = __commonJS({
|
|
|
101455
101531
|
}
|
|
101456
101532
|
});
|
|
101457
101533
|
|
|
101458
|
-
// ../../node_modules/source-map-support/node_modules/source-map/lib/base64.js
|
|
101459
|
-
var require_base64 = __commonJS({
|
|
101460
|
-
"../../node_modules/source-map-support/node_modules/source-map/lib/base64.js"(exports2) {
|
|
101461
|
-
"use strict";
|
|
101462
|
-
var intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
|
|
101463
|
-
exports2.encode = function(number) {
|
|
101464
|
-
if (0 <= number && number < intToCharMap.length) {
|
|
101465
|
-
return intToCharMap[number];
|
|
101466
|
-
}
|
|
101467
|
-
throw new TypeError("Must be between 0 and 63: " + number);
|
|
101468
|
-
};
|
|
101469
|
-
exports2.decode = function(charCode) {
|
|
101470
|
-
var bigA = 65;
|
|
101471
|
-
var bigZ = 90;
|
|
101472
|
-
var littleA = 97;
|
|
101473
|
-
var littleZ = 122;
|
|
101474
|
-
var zero = 48;
|
|
101475
|
-
var nine = 57;
|
|
101476
|
-
var plus = 43;
|
|
101477
|
-
var slash = 47;
|
|
101478
|
-
var littleOffset = 26;
|
|
101479
|
-
var numberOffset = 52;
|
|
101480
|
-
if (bigA <= charCode && charCode <= bigZ) {
|
|
101481
|
-
return charCode - bigA;
|
|
101482
|
-
}
|
|
101483
|
-
if (littleA <= charCode && charCode <= littleZ) {
|
|
101484
|
-
return charCode - littleA + littleOffset;
|
|
101485
|
-
}
|
|
101486
|
-
if (zero <= charCode && charCode <= nine) {
|
|
101487
|
-
return charCode - zero + numberOffset;
|
|
101488
|
-
}
|
|
101489
|
-
if (charCode == plus) {
|
|
101490
|
-
return 62;
|
|
101491
|
-
}
|
|
101492
|
-
if (charCode == slash) {
|
|
101493
|
-
return 63;
|
|
101494
|
-
}
|
|
101495
|
-
return -1;
|
|
101496
|
-
};
|
|
101497
|
-
}
|
|
101498
|
-
});
|
|
101499
|
-
|
|
101500
|
-
// ../../node_modules/source-map-support/node_modules/source-map/lib/base64-vlq.js
|
|
101501
|
-
var require_base64_vlq = __commonJS({
|
|
101502
|
-
"../../node_modules/source-map-support/node_modules/source-map/lib/base64-vlq.js"(exports2) {
|
|
101503
|
-
"use strict";
|
|
101504
|
-
var base64 = require_base64();
|
|
101505
|
-
var VLQ_BASE_SHIFT = 5;
|
|
101506
|
-
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
|
|
101507
|
-
var VLQ_BASE_MASK = VLQ_BASE - 1;
|
|
101508
|
-
var VLQ_CONTINUATION_BIT = VLQ_BASE;
|
|
101509
|
-
function toVLQSigned(aValue) {
|
|
101510
|
-
return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0;
|
|
101511
|
-
}
|
|
101512
|
-
function fromVLQSigned(aValue) {
|
|
101513
|
-
var isNegative = (aValue & 1) === 1;
|
|
101514
|
-
var shifted = aValue >> 1;
|
|
101515
|
-
return isNegative ? -shifted : shifted;
|
|
101516
|
-
}
|
|
101517
|
-
exports2.encode = function base64VLQ_encode(aValue) {
|
|
101518
|
-
var encoded = "";
|
|
101519
|
-
var digit;
|
|
101520
|
-
var vlq = toVLQSigned(aValue);
|
|
101521
|
-
do {
|
|
101522
|
-
digit = vlq & VLQ_BASE_MASK;
|
|
101523
|
-
vlq >>>= VLQ_BASE_SHIFT;
|
|
101524
|
-
if (vlq > 0) {
|
|
101525
|
-
digit |= VLQ_CONTINUATION_BIT;
|
|
101526
|
-
}
|
|
101527
|
-
encoded += base64.encode(digit);
|
|
101528
|
-
} while (vlq > 0);
|
|
101529
|
-
return encoded;
|
|
101530
|
-
};
|
|
101531
|
-
exports2.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
|
|
101532
|
-
var strLen = aStr.length;
|
|
101533
|
-
var result = 0;
|
|
101534
|
-
var shift = 0;
|
|
101535
|
-
var continuation, digit;
|
|
101536
|
-
do {
|
|
101537
|
-
if (aIndex >= strLen) {
|
|
101538
|
-
throw new Error("Expected more digits in base 64 VLQ value.");
|
|
101539
|
-
}
|
|
101540
|
-
digit = base64.decode(aStr.charCodeAt(aIndex++));
|
|
101541
|
-
if (digit === -1) {
|
|
101542
|
-
throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
|
|
101543
|
-
}
|
|
101544
|
-
continuation = !!(digit & VLQ_CONTINUATION_BIT);
|
|
101545
|
-
digit &= VLQ_BASE_MASK;
|
|
101546
|
-
result = result + (digit << shift);
|
|
101547
|
-
shift += VLQ_BASE_SHIFT;
|
|
101548
|
-
} while (continuation);
|
|
101549
|
-
aOutParam.value = fromVLQSigned(result);
|
|
101550
|
-
aOutParam.rest = aIndex;
|
|
101551
|
-
};
|
|
101552
|
-
}
|
|
101553
|
-
});
|
|
101554
|
-
|
|
101555
|
-
// ../../node_modules/source-map-support/node_modules/source-map/lib/util.js
|
|
101556
|
-
var require_util4 = __commonJS({
|
|
101557
|
-
"../../node_modules/source-map-support/node_modules/source-map/lib/util.js"(exports2) {
|
|
101558
|
-
"use strict";
|
|
101559
|
-
function getArg(aArgs, aName, aDefaultValue) {
|
|
101560
|
-
if (aName in aArgs) {
|
|
101561
|
-
return aArgs[aName];
|
|
101562
|
-
} else if (arguments.length === 3) {
|
|
101563
|
-
return aDefaultValue;
|
|
101564
|
-
} else {
|
|
101565
|
-
throw new Error('"' + aName + '" is a required argument.');
|
|
101566
|
-
}
|
|
101567
|
-
}
|
|
101568
|
-
exports2.getArg = getArg;
|
|
101569
|
-
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
|
|
101570
|
-
var dataUrlRegexp = /^data:.+\,.+$/;
|
|
101571
|
-
function urlParse(aUrl) {
|
|
101572
|
-
var match = aUrl.match(urlRegexp);
|
|
101573
|
-
if (!match) {
|
|
101574
|
-
return null;
|
|
101575
|
-
}
|
|
101576
|
-
return {
|
|
101577
|
-
scheme: match[1],
|
|
101578
|
-
auth: match[2],
|
|
101579
|
-
host: match[3],
|
|
101580
|
-
port: match[4],
|
|
101581
|
-
path: match[5]
|
|
101582
|
-
};
|
|
101583
|
-
}
|
|
101584
|
-
exports2.urlParse = urlParse;
|
|
101585
|
-
function urlGenerate(aParsedUrl) {
|
|
101586
|
-
var url = "";
|
|
101587
|
-
if (aParsedUrl.scheme) {
|
|
101588
|
-
url += aParsedUrl.scheme + ":";
|
|
101589
|
-
}
|
|
101590
|
-
url += "//";
|
|
101591
|
-
if (aParsedUrl.auth) {
|
|
101592
|
-
url += aParsedUrl.auth + "@";
|
|
101593
|
-
}
|
|
101594
|
-
if (aParsedUrl.host) {
|
|
101595
|
-
url += aParsedUrl.host;
|
|
101596
|
-
}
|
|
101597
|
-
if (aParsedUrl.port) {
|
|
101598
|
-
url += ":" + aParsedUrl.port;
|
|
101599
|
-
}
|
|
101600
|
-
if (aParsedUrl.path) {
|
|
101601
|
-
url += aParsedUrl.path;
|
|
101602
|
-
}
|
|
101603
|
-
return url;
|
|
101604
|
-
}
|
|
101605
|
-
exports2.urlGenerate = urlGenerate;
|
|
101606
|
-
function normalize(aPath) {
|
|
101607
|
-
var path = aPath;
|
|
101608
|
-
var url = urlParse(aPath);
|
|
101609
|
-
if (url) {
|
|
101610
|
-
if (!url.path) {
|
|
101611
|
-
return aPath;
|
|
101612
|
-
}
|
|
101613
|
-
path = url.path;
|
|
101614
|
-
}
|
|
101615
|
-
var isAbsolute2 = exports2.isAbsolute(path);
|
|
101616
|
-
var parts = path.split(/\/+/);
|
|
101617
|
-
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
|
|
101618
|
-
part = parts[i];
|
|
101619
|
-
if (part === ".") {
|
|
101620
|
-
parts.splice(i, 1);
|
|
101621
|
-
} else if (part === "..") {
|
|
101622
|
-
up++;
|
|
101623
|
-
} else if (up > 0) {
|
|
101624
|
-
if (part === "") {
|
|
101625
|
-
parts.splice(i + 1, up);
|
|
101626
|
-
up = 0;
|
|
101627
|
-
} else {
|
|
101628
|
-
parts.splice(i, 2);
|
|
101629
|
-
up--;
|
|
101630
|
-
}
|
|
101631
|
-
}
|
|
101632
|
-
}
|
|
101633
|
-
path = parts.join("/");
|
|
101634
|
-
if (path === "") {
|
|
101635
|
-
path = isAbsolute2 ? "/" : ".";
|
|
101636
|
-
}
|
|
101637
|
-
if (url) {
|
|
101638
|
-
url.path = path;
|
|
101639
|
-
return urlGenerate(url);
|
|
101640
|
-
}
|
|
101641
|
-
return path;
|
|
101642
|
-
}
|
|
101643
|
-
exports2.normalize = normalize;
|
|
101644
|
-
function join8(aRoot, aPath) {
|
|
101645
|
-
if (aRoot === "") {
|
|
101646
|
-
aRoot = ".";
|
|
101647
|
-
}
|
|
101648
|
-
if (aPath === "") {
|
|
101649
|
-
aPath = ".";
|
|
101650
|
-
}
|
|
101651
|
-
var aPathUrl = urlParse(aPath);
|
|
101652
|
-
var aRootUrl = urlParse(aRoot);
|
|
101653
|
-
if (aRootUrl) {
|
|
101654
|
-
aRoot = aRootUrl.path || "/";
|
|
101655
|
-
}
|
|
101656
|
-
if (aPathUrl && !aPathUrl.scheme) {
|
|
101657
|
-
if (aRootUrl) {
|
|
101658
|
-
aPathUrl.scheme = aRootUrl.scheme;
|
|
101659
|
-
}
|
|
101660
|
-
return urlGenerate(aPathUrl);
|
|
101661
|
-
}
|
|
101662
|
-
if (aPathUrl || aPath.match(dataUrlRegexp)) {
|
|
101663
|
-
return aPath;
|
|
101664
|
-
}
|
|
101665
|
-
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
|
|
101666
|
-
aRootUrl.host = aPath;
|
|
101667
|
-
return urlGenerate(aRootUrl);
|
|
101668
|
-
}
|
|
101669
|
-
var joined = aPath.charAt(0) === "/" ? aPath : normalize(aRoot.replace(/\/+$/, "") + "/" + aPath);
|
|
101670
|
-
if (aRootUrl) {
|
|
101671
|
-
aRootUrl.path = joined;
|
|
101672
|
-
return urlGenerate(aRootUrl);
|
|
101673
|
-
}
|
|
101674
|
-
return joined;
|
|
101675
|
-
}
|
|
101676
|
-
exports2.join = join8;
|
|
101677
|
-
exports2.isAbsolute = function(aPath) {
|
|
101678
|
-
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
101679
|
-
};
|
|
101680
|
-
function relative(aRoot, aPath) {
|
|
101681
|
-
if (aRoot === "") {
|
|
101682
|
-
aRoot = ".";
|
|
101683
|
-
}
|
|
101684
|
-
aRoot = aRoot.replace(/\/$/, "");
|
|
101685
|
-
var level = 0;
|
|
101686
|
-
while (aPath.indexOf(aRoot + "/") !== 0) {
|
|
101687
|
-
var index = aRoot.lastIndexOf("/");
|
|
101688
|
-
if (index < 0) {
|
|
101689
|
-
return aPath;
|
|
101690
|
-
}
|
|
101691
|
-
aRoot = aRoot.slice(0, index);
|
|
101692
|
-
if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
|
|
101693
|
-
return aPath;
|
|
101694
|
-
}
|
|
101695
|
-
++level;
|
|
101696
|
-
}
|
|
101697
|
-
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
|
101698
|
-
}
|
|
101699
|
-
exports2.relative = relative;
|
|
101700
|
-
var supportsNullProto = (function() {
|
|
101701
|
-
var obj = /* @__PURE__ */ Object.create(null);
|
|
101702
|
-
return !("__proto__" in obj);
|
|
101703
|
-
})();
|
|
101704
|
-
function identity(s) {
|
|
101705
|
-
return s;
|
|
101706
|
-
}
|
|
101707
|
-
function toSetString(aStr) {
|
|
101708
|
-
if (isProtoString(aStr)) {
|
|
101709
|
-
return "$" + aStr;
|
|
101710
|
-
}
|
|
101711
|
-
return aStr;
|
|
101712
|
-
}
|
|
101713
|
-
exports2.toSetString = supportsNullProto ? identity : toSetString;
|
|
101714
|
-
function fromSetString(aStr) {
|
|
101715
|
-
if (isProtoString(aStr)) {
|
|
101716
|
-
return aStr.slice(1);
|
|
101717
|
-
}
|
|
101718
|
-
return aStr;
|
|
101719
|
-
}
|
|
101720
|
-
exports2.fromSetString = supportsNullProto ? identity : fromSetString;
|
|
101721
|
-
function isProtoString(s) {
|
|
101722
|
-
if (!s) {
|
|
101723
|
-
return false;
|
|
101724
|
-
}
|
|
101725
|
-
var length = s.length;
|
|
101726
|
-
if (length < 9) {
|
|
101727
|
-
return false;
|
|
101728
|
-
}
|
|
101729
|
-
if (s.charCodeAt(length - 1) !== 95 || s.charCodeAt(length - 2) !== 95 || s.charCodeAt(length - 3) !== 111 || s.charCodeAt(length - 4) !== 116 || s.charCodeAt(length - 5) !== 111 || s.charCodeAt(length - 6) !== 114 || s.charCodeAt(length - 7) !== 112 || s.charCodeAt(length - 8) !== 95 || s.charCodeAt(length - 9) !== 95) {
|
|
101730
|
-
return false;
|
|
101731
|
-
}
|
|
101732
|
-
for (var i = length - 10; i >= 0; i--) {
|
|
101733
|
-
if (s.charCodeAt(i) !== 36) {
|
|
101734
|
-
return false;
|
|
101735
|
-
}
|
|
101736
|
-
}
|
|
101737
|
-
return true;
|
|
101738
|
-
}
|
|
101739
|
-
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
|
|
101740
|
-
var cmp = strcmp(mappingA.source, mappingB.source);
|
|
101741
|
-
if (cmp !== 0) {
|
|
101742
|
-
return cmp;
|
|
101743
|
-
}
|
|
101744
|
-
cmp = mappingA.originalLine - mappingB.originalLine;
|
|
101745
|
-
if (cmp !== 0) {
|
|
101746
|
-
return cmp;
|
|
101747
|
-
}
|
|
101748
|
-
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
|
101749
|
-
if (cmp !== 0 || onlyCompareOriginal) {
|
|
101750
|
-
return cmp;
|
|
101751
|
-
}
|
|
101752
|
-
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
|
101753
|
-
if (cmp !== 0) {
|
|
101754
|
-
return cmp;
|
|
101755
|
-
}
|
|
101756
|
-
cmp = mappingA.generatedLine - mappingB.generatedLine;
|
|
101757
|
-
if (cmp !== 0) {
|
|
101758
|
-
return cmp;
|
|
101759
|
-
}
|
|
101760
|
-
return strcmp(mappingA.name, mappingB.name);
|
|
101761
|
-
}
|
|
101762
|
-
exports2.compareByOriginalPositions = compareByOriginalPositions;
|
|
101763
|
-
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
|
|
101764
|
-
var cmp = mappingA.generatedLine - mappingB.generatedLine;
|
|
101765
|
-
if (cmp !== 0) {
|
|
101766
|
-
return cmp;
|
|
101767
|
-
}
|
|
101768
|
-
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
|
101769
|
-
if (cmp !== 0 || onlyCompareGenerated) {
|
|
101770
|
-
return cmp;
|
|
101771
|
-
}
|
|
101772
|
-
cmp = strcmp(mappingA.source, mappingB.source);
|
|
101773
|
-
if (cmp !== 0) {
|
|
101774
|
-
return cmp;
|
|
101775
|
-
}
|
|
101776
|
-
cmp = mappingA.originalLine - mappingB.originalLine;
|
|
101777
|
-
if (cmp !== 0) {
|
|
101778
|
-
return cmp;
|
|
101779
|
-
}
|
|
101780
|
-
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
|
101781
|
-
if (cmp !== 0) {
|
|
101782
|
-
return cmp;
|
|
101783
|
-
}
|
|
101784
|
-
return strcmp(mappingA.name, mappingB.name);
|
|
101785
|
-
}
|
|
101786
|
-
exports2.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
|
|
101787
|
-
function strcmp(aStr1, aStr2) {
|
|
101788
|
-
if (aStr1 === aStr2) {
|
|
101789
|
-
return 0;
|
|
101790
|
-
}
|
|
101791
|
-
if (aStr1 === null) {
|
|
101792
|
-
return 1;
|
|
101793
|
-
}
|
|
101794
|
-
if (aStr2 === null) {
|
|
101795
|
-
return -1;
|
|
101796
|
-
}
|
|
101797
|
-
if (aStr1 > aStr2) {
|
|
101798
|
-
return 1;
|
|
101799
|
-
}
|
|
101800
|
-
return -1;
|
|
101801
|
-
}
|
|
101802
|
-
function compareByGeneratedPositionsInflated(mappingA, mappingB) {
|
|
101803
|
-
var cmp = mappingA.generatedLine - mappingB.generatedLine;
|
|
101804
|
-
if (cmp !== 0) {
|
|
101805
|
-
return cmp;
|
|
101806
|
-
}
|
|
101807
|
-
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
|
101808
|
-
if (cmp !== 0) {
|
|
101809
|
-
return cmp;
|
|
101810
|
-
}
|
|
101811
|
-
cmp = strcmp(mappingA.source, mappingB.source);
|
|
101812
|
-
if (cmp !== 0) {
|
|
101813
|
-
return cmp;
|
|
101814
|
-
}
|
|
101815
|
-
cmp = mappingA.originalLine - mappingB.originalLine;
|
|
101816
|
-
if (cmp !== 0) {
|
|
101817
|
-
return cmp;
|
|
101818
|
-
}
|
|
101819
|
-
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
|
101820
|
-
if (cmp !== 0) {
|
|
101821
|
-
return cmp;
|
|
101822
|
-
}
|
|
101823
|
-
return strcmp(mappingA.name, mappingB.name);
|
|
101824
|
-
}
|
|
101825
|
-
exports2.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
|
|
101826
|
-
function parseSourceMapInput(str) {
|
|
101827
|
-
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
|
|
101828
|
-
}
|
|
101829
|
-
exports2.parseSourceMapInput = parseSourceMapInput;
|
|
101830
|
-
function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
|
|
101831
|
-
sourceURL = sourceURL || "";
|
|
101832
|
-
if (sourceRoot) {
|
|
101833
|
-
if (sourceRoot[sourceRoot.length - 1] !== "/" && sourceURL[0] !== "/") {
|
|
101834
|
-
sourceRoot += "/";
|
|
101835
|
-
}
|
|
101836
|
-
sourceURL = sourceRoot + sourceURL;
|
|
101837
|
-
}
|
|
101838
|
-
if (sourceMapURL) {
|
|
101839
|
-
var parsed = urlParse(sourceMapURL);
|
|
101840
|
-
if (!parsed) {
|
|
101841
|
-
throw new Error("sourceMapURL could not be parsed");
|
|
101842
|
-
}
|
|
101843
|
-
if (parsed.path) {
|
|
101844
|
-
var index = parsed.path.lastIndexOf("/");
|
|
101845
|
-
if (index >= 0) {
|
|
101846
|
-
parsed.path = parsed.path.substring(0, index + 1);
|
|
101847
|
-
}
|
|
101848
|
-
}
|
|
101849
|
-
sourceURL = join8(urlGenerate(parsed), sourceURL);
|
|
101850
|
-
}
|
|
101851
|
-
return normalize(sourceURL);
|
|
101852
|
-
}
|
|
101853
|
-
exports2.computeSourceURL = computeSourceURL;
|
|
101854
|
-
}
|
|
101855
|
-
});
|
|
101856
|
-
|
|
101857
|
-
// ../../node_modules/source-map-support/node_modules/source-map/lib/array-set.js
|
|
101858
|
-
var require_array_set = __commonJS({
|
|
101859
|
-
"../../node_modules/source-map-support/node_modules/source-map/lib/array-set.js"(exports2) {
|
|
101860
|
-
"use strict";
|
|
101861
|
-
var util = require_util4();
|
|
101862
|
-
var has = Object.prototype.hasOwnProperty;
|
|
101863
|
-
var hasNativeMap = typeof Map !== "undefined";
|
|
101864
|
-
function ArraySet() {
|
|
101865
|
-
this._array = [];
|
|
101866
|
-
this._set = hasNativeMap ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null);
|
|
101867
|
-
}
|
|
101868
|
-
ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
|
|
101869
|
-
var set = new ArraySet();
|
|
101870
|
-
for (var i = 0, len = aArray.length; i < len; i++) {
|
|
101871
|
-
set.add(aArray[i], aAllowDuplicates);
|
|
101872
|
-
}
|
|
101873
|
-
return set;
|
|
101874
|
-
};
|
|
101875
|
-
ArraySet.prototype.size = function ArraySet_size() {
|
|
101876
|
-
return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
|
|
101877
|
-
};
|
|
101878
|
-
ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
|
|
101879
|
-
var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
|
|
101880
|
-
var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
|
|
101881
|
-
var idx = this._array.length;
|
|
101882
|
-
if (!isDuplicate || aAllowDuplicates) {
|
|
101883
|
-
this._array.push(aStr);
|
|
101884
|
-
}
|
|
101885
|
-
if (!isDuplicate) {
|
|
101886
|
-
if (hasNativeMap) {
|
|
101887
|
-
this._set.set(aStr, idx);
|
|
101888
|
-
} else {
|
|
101889
|
-
this._set[sStr] = idx;
|
|
101890
|
-
}
|
|
101891
|
-
}
|
|
101892
|
-
};
|
|
101893
|
-
ArraySet.prototype.has = function ArraySet_has(aStr) {
|
|
101894
|
-
if (hasNativeMap) {
|
|
101895
|
-
return this._set.has(aStr);
|
|
101896
|
-
} else {
|
|
101897
|
-
var sStr = util.toSetString(aStr);
|
|
101898
|
-
return has.call(this._set, sStr);
|
|
101899
|
-
}
|
|
101900
|
-
};
|
|
101901
|
-
ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
|
|
101902
|
-
if (hasNativeMap) {
|
|
101903
|
-
var idx = this._set.get(aStr);
|
|
101904
|
-
if (idx >= 0) {
|
|
101905
|
-
return idx;
|
|
101906
|
-
}
|
|
101907
|
-
} else {
|
|
101908
|
-
var sStr = util.toSetString(aStr);
|
|
101909
|
-
if (has.call(this._set, sStr)) {
|
|
101910
|
-
return this._set[sStr];
|
|
101911
|
-
}
|
|
101912
|
-
}
|
|
101913
|
-
throw new Error('"' + aStr + '" is not in the set.');
|
|
101914
|
-
};
|
|
101915
|
-
ArraySet.prototype.at = function ArraySet_at(aIdx) {
|
|
101916
|
-
if (aIdx >= 0 && aIdx < this._array.length) {
|
|
101917
|
-
return this._array[aIdx];
|
|
101918
|
-
}
|
|
101919
|
-
throw new Error("No element indexed by " + aIdx);
|
|
101920
|
-
};
|
|
101921
|
-
ArraySet.prototype.toArray = function ArraySet_toArray() {
|
|
101922
|
-
return this._array.slice();
|
|
101923
|
-
};
|
|
101924
|
-
exports2.ArraySet = ArraySet;
|
|
101925
|
-
}
|
|
101926
|
-
});
|
|
101927
|
-
|
|
101928
|
-
// ../../node_modules/source-map-support/node_modules/source-map/lib/mapping-list.js
|
|
101929
|
-
var require_mapping_list = __commonJS({
|
|
101930
|
-
"../../node_modules/source-map-support/node_modules/source-map/lib/mapping-list.js"(exports2) {
|
|
101931
|
-
"use strict";
|
|
101932
|
-
var util = require_util4();
|
|
101933
|
-
function generatedPositionAfter(mappingA, mappingB) {
|
|
101934
|
-
var lineA = mappingA.generatedLine;
|
|
101935
|
-
var lineB = mappingB.generatedLine;
|
|
101936
|
-
var columnA = mappingA.generatedColumn;
|
|
101937
|
-
var columnB = mappingB.generatedColumn;
|
|
101938
|
-
return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
|
|
101939
|
-
}
|
|
101940
|
-
function MappingList() {
|
|
101941
|
-
this._array = [];
|
|
101942
|
-
this._sorted = true;
|
|
101943
|
-
this._last = { generatedLine: -1, generatedColumn: 0 };
|
|
101944
|
-
}
|
|
101945
|
-
MappingList.prototype.unsortedForEach = function MappingList_forEach(aCallback, aThisArg) {
|
|
101946
|
-
this._array.forEach(aCallback, aThisArg);
|
|
101947
|
-
};
|
|
101948
|
-
MappingList.prototype.add = function MappingList_add(aMapping) {
|
|
101949
|
-
if (generatedPositionAfter(this._last, aMapping)) {
|
|
101950
|
-
this._last = aMapping;
|
|
101951
|
-
this._array.push(aMapping);
|
|
101952
|
-
} else {
|
|
101953
|
-
this._sorted = false;
|
|
101954
|
-
this._array.push(aMapping);
|
|
101955
|
-
}
|
|
101956
|
-
};
|
|
101957
|
-
MappingList.prototype.toArray = function MappingList_toArray() {
|
|
101958
|
-
if (!this._sorted) {
|
|
101959
|
-
this._array.sort(util.compareByGeneratedPositionsInflated);
|
|
101960
|
-
this._sorted = true;
|
|
101961
|
-
}
|
|
101962
|
-
return this._array;
|
|
101963
|
-
};
|
|
101964
|
-
exports2.MappingList = MappingList;
|
|
101965
|
-
}
|
|
101966
|
-
});
|
|
101967
|
-
|
|
101968
|
-
// ../../node_modules/source-map-support/node_modules/source-map/lib/source-map-generator.js
|
|
101969
|
-
var require_source_map_generator = __commonJS({
|
|
101970
|
-
"../../node_modules/source-map-support/node_modules/source-map/lib/source-map-generator.js"(exports2) {
|
|
101971
|
-
"use strict";
|
|
101972
|
-
var base64VLQ = require_base64_vlq();
|
|
101973
|
-
var util = require_util4();
|
|
101974
|
-
var ArraySet = require_array_set().ArraySet;
|
|
101975
|
-
var MappingList = require_mapping_list().MappingList;
|
|
101976
|
-
function SourceMapGenerator(aArgs) {
|
|
101977
|
-
if (!aArgs) {
|
|
101978
|
-
aArgs = {};
|
|
101979
|
-
}
|
|
101980
|
-
this._file = util.getArg(aArgs, "file", null);
|
|
101981
|
-
this._sourceRoot = util.getArg(aArgs, "sourceRoot", null);
|
|
101982
|
-
this._skipValidation = util.getArg(aArgs, "skipValidation", false);
|
|
101983
|
-
this._sources = new ArraySet();
|
|
101984
|
-
this._names = new ArraySet();
|
|
101985
|
-
this._mappings = new MappingList();
|
|
101986
|
-
this._sourcesContents = null;
|
|
101987
|
-
}
|
|
101988
|
-
SourceMapGenerator.prototype._version = 3;
|
|
101989
|
-
SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
|
|
101990
|
-
var sourceRoot = aSourceMapConsumer.sourceRoot;
|
|
101991
|
-
var generator = new SourceMapGenerator({
|
|
101992
|
-
file: aSourceMapConsumer.file,
|
|
101993
|
-
sourceRoot
|
|
101994
|
-
});
|
|
101995
|
-
aSourceMapConsumer.eachMapping(function(mapping) {
|
|
101996
|
-
var newMapping = {
|
|
101997
|
-
generated: {
|
|
101998
|
-
line: mapping.generatedLine,
|
|
101999
|
-
column: mapping.generatedColumn
|
|
102000
|
-
}
|
|
102001
|
-
};
|
|
102002
|
-
if (mapping.source != null) {
|
|
102003
|
-
newMapping.source = mapping.source;
|
|
102004
|
-
if (sourceRoot != null) {
|
|
102005
|
-
newMapping.source = util.relative(sourceRoot, newMapping.source);
|
|
102006
|
-
}
|
|
102007
|
-
newMapping.original = {
|
|
102008
|
-
line: mapping.originalLine,
|
|
102009
|
-
column: mapping.originalColumn
|
|
102010
|
-
};
|
|
102011
|
-
if (mapping.name != null) {
|
|
102012
|
-
newMapping.name = mapping.name;
|
|
102013
|
-
}
|
|
102014
|
-
}
|
|
102015
|
-
generator.addMapping(newMapping);
|
|
102016
|
-
});
|
|
102017
|
-
aSourceMapConsumer.sources.forEach(function(sourceFile) {
|
|
102018
|
-
var sourceRelative = sourceFile;
|
|
102019
|
-
if (sourceRoot !== null) {
|
|
102020
|
-
sourceRelative = util.relative(sourceRoot, sourceFile);
|
|
102021
|
-
}
|
|
102022
|
-
if (!generator._sources.has(sourceRelative)) {
|
|
102023
|
-
generator._sources.add(sourceRelative);
|
|
102024
|
-
}
|
|
102025
|
-
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
|
102026
|
-
if (content != null) {
|
|
102027
|
-
generator.setSourceContent(sourceFile, content);
|
|
102028
|
-
}
|
|
102029
|
-
});
|
|
102030
|
-
return generator;
|
|
102031
|
-
};
|
|
102032
|
-
SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
|
|
102033
|
-
var generated = util.getArg(aArgs, "generated");
|
|
102034
|
-
var original = util.getArg(aArgs, "original", null);
|
|
102035
|
-
var source = util.getArg(aArgs, "source", null);
|
|
102036
|
-
var name = util.getArg(aArgs, "name", null);
|
|
102037
|
-
if (!this._skipValidation) {
|
|
102038
|
-
this._validateMapping(generated, original, source, name);
|
|
102039
|
-
}
|
|
102040
|
-
if (source != null) {
|
|
102041
|
-
source = String(source);
|
|
102042
|
-
if (!this._sources.has(source)) {
|
|
102043
|
-
this._sources.add(source);
|
|
102044
|
-
}
|
|
102045
|
-
}
|
|
102046
|
-
if (name != null) {
|
|
102047
|
-
name = String(name);
|
|
102048
|
-
if (!this._names.has(name)) {
|
|
102049
|
-
this._names.add(name);
|
|
102050
|
-
}
|
|
102051
|
-
}
|
|
102052
|
-
this._mappings.add({
|
|
102053
|
-
generatedLine: generated.line,
|
|
102054
|
-
generatedColumn: generated.column,
|
|
102055
|
-
originalLine: original != null && original.line,
|
|
102056
|
-
originalColumn: original != null && original.column,
|
|
102057
|
-
source,
|
|
102058
|
-
name
|
|
102059
|
-
});
|
|
102060
|
-
};
|
|
102061
|
-
SourceMapGenerator.prototype.setSourceContent = function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
|
|
102062
|
-
var source = aSourceFile;
|
|
102063
|
-
if (this._sourceRoot != null) {
|
|
102064
|
-
source = util.relative(this._sourceRoot, source);
|
|
102065
|
-
}
|
|
102066
|
-
if (aSourceContent != null) {
|
|
102067
|
-
if (!this._sourcesContents) {
|
|
102068
|
-
this._sourcesContents = /* @__PURE__ */ Object.create(null);
|
|
102069
|
-
}
|
|
102070
|
-
this._sourcesContents[util.toSetString(source)] = aSourceContent;
|
|
102071
|
-
} else if (this._sourcesContents) {
|
|
102072
|
-
delete this._sourcesContents[util.toSetString(source)];
|
|
102073
|
-
if (Object.keys(this._sourcesContents).length === 0) {
|
|
102074
|
-
this._sourcesContents = null;
|
|
102075
|
-
}
|
|
102076
|
-
}
|
|
102077
|
-
};
|
|
102078
|
-
SourceMapGenerator.prototype.applySourceMap = function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
|
|
102079
|
-
var sourceFile = aSourceFile;
|
|
102080
|
-
if (aSourceFile == null) {
|
|
102081
|
-
if (aSourceMapConsumer.file == null) {
|
|
102082
|
-
throw new Error(
|
|
102083
|
-
`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`
|
|
102084
|
-
);
|
|
102085
|
-
}
|
|
102086
|
-
sourceFile = aSourceMapConsumer.file;
|
|
102087
|
-
}
|
|
102088
|
-
var sourceRoot = this._sourceRoot;
|
|
102089
|
-
if (sourceRoot != null) {
|
|
102090
|
-
sourceFile = util.relative(sourceRoot, sourceFile);
|
|
102091
|
-
}
|
|
102092
|
-
var newSources = new ArraySet();
|
|
102093
|
-
var newNames = new ArraySet();
|
|
102094
|
-
this._mappings.unsortedForEach(function(mapping) {
|
|
102095
|
-
if (mapping.source === sourceFile && mapping.originalLine != null) {
|
|
102096
|
-
var original = aSourceMapConsumer.originalPositionFor({
|
|
102097
|
-
line: mapping.originalLine,
|
|
102098
|
-
column: mapping.originalColumn
|
|
102099
|
-
});
|
|
102100
|
-
if (original.source != null) {
|
|
102101
|
-
mapping.source = original.source;
|
|
102102
|
-
if (aSourceMapPath != null) {
|
|
102103
|
-
mapping.source = util.join(aSourceMapPath, mapping.source);
|
|
102104
|
-
}
|
|
102105
|
-
if (sourceRoot != null) {
|
|
102106
|
-
mapping.source = util.relative(sourceRoot, mapping.source);
|
|
102107
|
-
}
|
|
102108
|
-
mapping.originalLine = original.line;
|
|
102109
|
-
mapping.originalColumn = original.column;
|
|
102110
|
-
if (original.name != null) {
|
|
102111
|
-
mapping.name = original.name;
|
|
102112
|
-
}
|
|
102113
|
-
}
|
|
102114
|
-
}
|
|
102115
|
-
var source = mapping.source;
|
|
102116
|
-
if (source != null && !newSources.has(source)) {
|
|
102117
|
-
newSources.add(source);
|
|
102118
|
-
}
|
|
102119
|
-
var name = mapping.name;
|
|
102120
|
-
if (name != null && !newNames.has(name)) {
|
|
102121
|
-
newNames.add(name);
|
|
102122
|
-
}
|
|
102123
|
-
}, this);
|
|
102124
|
-
this._sources = newSources;
|
|
102125
|
-
this._names = newNames;
|
|
102126
|
-
aSourceMapConsumer.sources.forEach(function(sourceFile2) {
|
|
102127
|
-
var content = aSourceMapConsumer.sourceContentFor(sourceFile2);
|
|
102128
|
-
if (content != null) {
|
|
102129
|
-
if (aSourceMapPath != null) {
|
|
102130
|
-
sourceFile2 = util.join(aSourceMapPath, sourceFile2);
|
|
102131
|
-
}
|
|
102132
|
-
if (sourceRoot != null) {
|
|
102133
|
-
sourceFile2 = util.relative(sourceRoot, sourceFile2);
|
|
102134
|
-
}
|
|
102135
|
-
this.setSourceContent(sourceFile2, content);
|
|
102136
|
-
}
|
|
102137
|
-
}, this);
|
|
102138
|
-
};
|
|
102139
|
-
SourceMapGenerator.prototype._validateMapping = function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, aName) {
|
|
102140
|
-
if (aOriginal && typeof aOriginal.line !== "number" && typeof aOriginal.column !== "number") {
|
|
102141
|
-
throw new Error(
|
|
102142
|
-
"original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values."
|
|
102143
|
-
);
|
|
102144
|
-
}
|
|
102145
|
-
if (aGenerated && "line" in aGenerated && "column" in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) {
|
|
102146
|
-
return;
|
|
102147
|
-
} else if (aGenerated && "line" in aGenerated && "column" in aGenerated && aOriginal && "line" in aOriginal && "column" in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) {
|
|
102148
|
-
return;
|
|
102149
|
-
} else {
|
|
102150
|
-
throw new Error("Invalid mapping: " + JSON.stringify({
|
|
102151
|
-
generated: aGenerated,
|
|
102152
|
-
source: aSource,
|
|
102153
|
-
original: aOriginal,
|
|
102154
|
-
name: aName
|
|
102155
|
-
}));
|
|
102156
|
-
}
|
|
102157
|
-
};
|
|
102158
|
-
SourceMapGenerator.prototype._serializeMappings = function SourceMapGenerator_serializeMappings() {
|
|
102159
|
-
var previousGeneratedColumn = 0;
|
|
102160
|
-
var previousGeneratedLine = 1;
|
|
102161
|
-
var previousOriginalColumn = 0;
|
|
102162
|
-
var previousOriginalLine = 0;
|
|
102163
|
-
var previousName = 0;
|
|
102164
|
-
var previousSource = 0;
|
|
102165
|
-
var result = "";
|
|
102166
|
-
var next;
|
|
102167
|
-
var mapping;
|
|
102168
|
-
var nameIdx;
|
|
102169
|
-
var sourceIdx;
|
|
102170
|
-
var mappings = this._mappings.toArray();
|
|
102171
|
-
for (var i = 0, len = mappings.length; i < len; i++) {
|
|
102172
|
-
mapping = mappings[i];
|
|
102173
|
-
next = "";
|
|
102174
|
-
if (mapping.generatedLine !== previousGeneratedLine) {
|
|
102175
|
-
previousGeneratedColumn = 0;
|
|
102176
|
-
while (mapping.generatedLine !== previousGeneratedLine) {
|
|
102177
|
-
next += ";";
|
|
102178
|
-
previousGeneratedLine++;
|
|
102179
|
-
}
|
|
102180
|
-
} else {
|
|
102181
|
-
if (i > 0) {
|
|
102182
|
-
if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
|
|
102183
|
-
continue;
|
|
102184
|
-
}
|
|
102185
|
-
next += ",";
|
|
102186
|
-
}
|
|
102187
|
-
}
|
|
102188
|
-
next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn);
|
|
102189
|
-
previousGeneratedColumn = mapping.generatedColumn;
|
|
102190
|
-
if (mapping.source != null) {
|
|
102191
|
-
sourceIdx = this._sources.indexOf(mapping.source);
|
|
102192
|
-
next += base64VLQ.encode(sourceIdx - previousSource);
|
|
102193
|
-
previousSource = sourceIdx;
|
|
102194
|
-
next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine);
|
|
102195
|
-
previousOriginalLine = mapping.originalLine - 1;
|
|
102196
|
-
next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn);
|
|
102197
|
-
previousOriginalColumn = mapping.originalColumn;
|
|
102198
|
-
if (mapping.name != null) {
|
|
102199
|
-
nameIdx = this._names.indexOf(mapping.name);
|
|
102200
|
-
next += base64VLQ.encode(nameIdx - previousName);
|
|
102201
|
-
previousName = nameIdx;
|
|
102202
|
-
}
|
|
102203
|
-
}
|
|
102204
|
-
result += next;
|
|
102205
|
-
}
|
|
102206
|
-
return result;
|
|
102207
|
-
};
|
|
102208
|
-
SourceMapGenerator.prototype._generateSourcesContent = function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
|
|
102209
|
-
return aSources.map(function(source) {
|
|
102210
|
-
if (!this._sourcesContents) {
|
|
102211
|
-
return null;
|
|
102212
|
-
}
|
|
102213
|
-
if (aSourceRoot != null) {
|
|
102214
|
-
source = util.relative(aSourceRoot, source);
|
|
102215
|
-
}
|
|
102216
|
-
var key = util.toSetString(source);
|
|
102217
|
-
return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) ? this._sourcesContents[key] : null;
|
|
102218
|
-
}, this);
|
|
102219
|
-
};
|
|
102220
|
-
SourceMapGenerator.prototype.toJSON = function SourceMapGenerator_toJSON() {
|
|
102221
|
-
var map2 = {
|
|
102222
|
-
version: this._version,
|
|
102223
|
-
sources: this._sources.toArray(),
|
|
102224
|
-
names: this._names.toArray(),
|
|
102225
|
-
mappings: this._serializeMappings()
|
|
102226
|
-
};
|
|
102227
|
-
if (this._file != null) {
|
|
102228
|
-
map2.file = this._file;
|
|
102229
|
-
}
|
|
102230
|
-
if (this._sourceRoot != null) {
|
|
102231
|
-
map2.sourceRoot = this._sourceRoot;
|
|
102232
|
-
}
|
|
102233
|
-
if (this._sourcesContents) {
|
|
102234
|
-
map2.sourcesContent = this._generateSourcesContent(map2.sources, map2.sourceRoot);
|
|
102235
|
-
}
|
|
102236
|
-
return map2;
|
|
102237
|
-
};
|
|
102238
|
-
SourceMapGenerator.prototype.toString = function SourceMapGenerator_toString() {
|
|
102239
|
-
return JSON.stringify(this.toJSON());
|
|
102240
|
-
};
|
|
102241
|
-
exports2.SourceMapGenerator = SourceMapGenerator;
|
|
102242
|
-
}
|
|
102243
|
-
});
|
|
102244
|
-
|
|
102245
|
-
// ../../node_modules/source-map-support/node_modules/source-map/lib/binary-search.js
|
|
102246
|
-
var require_binary_search = __commonJS({
|
|
102247
|
-
"../../node_modules/source-map-support/node_modules/source-map/lib/binary-search.js"(exports2) {
|
|
102248
|
-
"use strict";
|
|
102249
|
-
exports2.GREATEST_LOWER_BOUND = 1;
|
|
102250
|
-
exports2.LEAST_UPPER_BOUND = 2;
|
|
102251
|
-
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
|
|
102252
|
-
var mid = Math.floor((aHigh - aLow) / 2) + aLow;
|
|
102253
|
-
var cmp = aCompare(aNeedle, aHaystack[mid], true);
|
|
102254
|
-
if (cmp === 0) {
|
|
102255
|
-
return mid;
|
|
102256
|
-
} else if (cmp > 0) {
|
|
102257
|
-
if (aHigh - mid > 1) {
|
|
102258
|
-
return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
|
|
102259
|
-
}
|
|
102260
|
-
if (aBias == exports2.LEAST_UPPER_BOUND) {
|
|
102261
|
-
return aHigh < aHaystack.length ? aHigh : -1;
|
|
102262
|
-
} else {
|
|
102263
|
-
return mid;
|
|
102264
|
-
}
|
|
102265
|
-
} else {
|
|
102266
|
-
if (mid - aLow > 1) {
|
|
102267
|
-
return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
|
|
102268
|
-
}
|
|
102269
|
-
if (aBias == exports2.LEAST_UPPER_BOUND) {
|
|
102270
|
-
return mid;
|
|
102271
|
-
} else {
|
|
102272
|
-
return aLow < 0 ? -1 : aLow;
|
|
102273
|
-
}
|
|
102274
|
-
}
|
|
102275
|
-
}
|
|
102276
|
-
exports2.search = function search(aNeedle, aHaystack, aCompare, aBias) {
|
|
102277
|
-
if (aHaystack.length === 0) {
|
|
102278
|
-
return -1;
|
|
102279
|
-
}
|
|
102280
|
-
var index = recursiveSearch(
|
|
102281
|
-
-1,
|
|
102282
|
-
aHaystack.length,
|
|
102283
|
-
aNeedle,
|
|
102284
|
-
aHaystack,
|
|
102285
|
-
aCompare,
|
|
102286
|
-
aBias || exports2.GREATEST_LOWER_BOUND
|
|
102287
|
-
);
|
|
102288
|
-
if (index < 0) {
|
|
102289
|
-
return -1;
|
|
102290
|
-
}
|
|
102291
|
-
while (index - 1 >= 0) {
|
|
102292
|
-
if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
|
|
102293
|
-
break;
|
|
102294
|
-
}
|
|
102295
|
-
--index;
|
|
102296
|
-
}
|
|
102297
|
-
return index;
|
|
102298
|
-
};
|
|
102299
|
-
}
|
|
102300
|
-
});
|
|
102301
|
-
|
|
102302
|
-
// ../../node_modules/source-map-support/node_modules/source-map/lib/quick-sort.js
|
|
102303
|
-
var require_quick_sort = __commonJS({
|
|
102304
|
-
"../../node_modules/source-map-support/node_modules/source-map/lib/quick-sort.js"(exports2) {
|
|
102305
|
-
"use strict";
|
|
102306
|
-
function swap(ary, x, y) {
|
|
102307
|
-
var temp = ary[x];
|
|
102308
|
-
ary[x] = ary[y];
|
|
102309
|
-
ary[y] = temp;
|
|
102310
|
-
}
|
|
102311
|
-
function randomIntInRange(low, high) {
|
|
102312
|
-
return Math.round(low + Math.random() * (high - low));
|
|
102313
|
-
}
|
|
102314
|
-
function doQuickSort(ary, comparator, p, r) {
|
|
102315
|
-
if (p < r) {
|
|
102316
|
-
var pivotIndex = randomIntInRange(p, r);
|
|
102317
|
-
var i = p - 1;
|
|
102318
|
-
swap(ary, pivotIndex, r);
|
|
102319
|
-
var pivot = ary[r];
|
|
102320
|
-
for (var j = p; j < r; j++) {
|
|
102321
|
-
if (comparator(ary[j], pivot) <= 0) {
|
|
102322
|
-
i += 1;
|
|
102323
|
-
swap(ary, i, j);
|
|
102324
|
-
}
|
|
102325
|
-
}
|
|
102326
|
-
swap(ary, i + 1, j);
|
|
102327
|
-
var q = i + 1;
|
|
102328
|
-
doQuickSort(ary, comparator, p, q - 1);
|
|
102329
|
-
doQuickSort(ary, comparator, q + 1, r);
|
|
102330
|
-
}
|
|
102331
|
-
}
|
|
102332
|
-
exports2.quickSort = function(ary, comparator) {
|
|
102333
|
-
doQuickSort(ary, comparator, 0, ary.length - 1);
|
|
102334
|
-
};
|
|
102335
|
-
}
|
|
102336
|
-
});
|
|
102337
|
-
|
|
102338
|
-
// ../../node_modules/source-map-support/node_modules/source-map/lib/source-map-consumer.js
|
|
102339
|
-
var require_source_map_consumer = __commonJS({
|
|
102340
|
-
"../../node_modules/source-map-support/node_modules/source-map/lib/source-map-consumer.js"(exports2) {
|
|
102341
|
-
"use strict";
|
|
102342
|
-
var util = require_util4();
|
|
102343
|
-
var binarySearch = require_binary_search();
|
|
102344
|
-
var ArraySet = require_array_set().ArraySet;
|
|
102345
|
-
var base64VLQ = require_base64_vlq();
|
|
102346
|
-
var quickSort = require_quick_sort().quickSort;
|
|
102347
|
-
function SourceMapConsumer(aSourceMap, aSourceMapURL) {
|
|
102348
|
-
var sourceMap = aSourceMap;
|
|
102349
|
-
if (typeof aSourceMap === "string") {
|
|
102350
|
-
sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
102351
|
-
}
|
|
102352
|
-
return sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
|
|
102353
|
-
}
|
|
102354
|
-
SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {
|
|
102355
|
-
return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
|
|
102356
|
-
};
|
|
102357
|
-
SourceMapConsumer.prototype._version = 3;
|
|
102358
|
-
SourceMapConsumer.prototype.__generatedMappings = null;
|
|
102359
|
-
Object.defineProperty(SourceMapConsumer.prototype, "_generatedMappings", {
|
|
102360
|
-
configurable: true,
|
|
102361
|
-
enumerable: true,
|
|
102362
|
-
get: function() {
|
|
102363
|
-
if (!this.__generatedMappings) {
|
|
102364
|
-
this._parseMappings(this._mappings, this.sourceRoot);
|
|
102365
|
-
}
|
|
102366
|
-
return this.__generatedMappings;
|
|
102367
|
-
}
|
|
102368
|
-
});
|
|
102369
|
-
SourceMapConsumer.prototype.__originalMappings = null;
|
|
102370
|
-
Object.defineProperty(SourceMapConsumer.prototype, "_originalMappings", {
|
|
102371
|
-
configurable: true,
|
|
102372
|
-
enumerable: true,
|
|
102373
|
-
get: function() {
|
|
102374
|
-
if (!this.__originalMappings) {
|
|
102375
|
-
this._parseMappings(this._mappings, this.sourceRoot);
|
|
102376
|
-
}
|
|
102377
|
-
return this.__originalMappings;
|
|
102378
|
-
}
|
|
102379
|
-
});
|
|
102380
|
-
SourceMapConsumer.prototype._charIsMappingSeparator = function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
|
|
102381
|
-
var c = aStr.charAt(index);
|
|
102382
|
-
return c === ";" || c === ",";
|
|
102383
|
-
};
|
|
102384
|
-
SourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
|
|
102385
|
-
throw new Error("Subclasses must implement _parseMappings");
|
|
102386
|
-
};
|
|
102387
|
-
SourceMapConsumer.GENERATED_ORDER = 1;
|
|
102388
|
-
SourceMapConsumer.ORIGINAL_ORDER = 2;
|
|
102389
|
-
SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
|
|
102390
|
-
SourceMapConsumer.LEAST_UPPER_BOUND = 2;
|
|
102391
|
-
SourceMapConsumer.prototype.eachMapping = function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
|
|
102392
|
-
var context = aContext || null;
|
|
102393
|
-
var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
|
|
102394
|
-
var mappings;
|
|
102395
|
-
switch (order) {
|
|
102396
|
-
case SourceMapConsumer.GENERATED_ORDER:
|
|
102397
|
-
mappings = this._generatedMappings;
|
|
102398
|
-
break;
|
|
102399
|
-
case SourceMapConsumer.ORIGINAL_ORDER:
|
|
102400
|
-
mappings = this._originalMappings;
|
|
102401
|
-
break;
|
|
102402
|
-
default:
|
|
102403
|
-
throw new Error("Unknown order of iteration.");
|
|
102404
|
-
}
|
|
102405
|
-
var sourceRoot = this.sourceRoot;
|
|
102406
|
-
mappings.map(function(mapping) {
|
|
102407
|
-
var source = mapping.source === null ? null : this._sources.at(mapping.source);
|
|
102408
|
-
source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);
|
|
102409
|
-
return {
|
|
102410
|
-
source,
|
|
102411
|
-
generatedLine: mapping.generatedLine,
|
|
102412
|
-
generatedColumn: mapping.generatedColumn,
|
|
102413
|
-
originalLine: mapping.originalLine,
|
|
102414
|
-
originalColumn: mapping.originalColumn,
|
|
102415
|
-
name: mapping.name === null ? null : this._names.at(mapping.name)
|
|
102416
|
-
};
|
|
102417
|
-
}, this).forEach(aCallback, context);
|
|
102418
|
-
};
|
|
102419
|
-
SourceMapConsumer.prototype.allGeneratedPositionsFor = function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
|
|
102420
|
-
var line = util.getArg(aArgs, "line");
|
|
102421
|
-
var needle = {
|
|
102422
|
-
source: util.getArg(aArgs, "source"),
|
|
102423
|
-
originalLine: line,
|
|
102424
|
-
originalColumn: util.getArg(aArgs, "column", 0)
|
|
102425
|
-
};
|
|
102426
|
-
needle.source = this._findSourceIndex(needle.source);
|
|
102427
|
-
if (needle.source < 0) {
|
|
102428
|
-
return [];
|
|
102429
|
-
}
|
|
102430
|
-
var mappings = [];
|
|
102431
|
-
var index = this._findMapping(
|
|
102432
|
-
needle,
|
|
102433
|
-
this._originalMappings,
|
|
102434
|
-
"originalLine",
|
|
102435
|
-
"originalColumn",
|
|
102436
|
-
util.compareByOriginalPositions,
|
|
102437
|
-
binarySearch.LEAST_UPPER_BOUND
|
|
102438
|
-
);
|
|
102439
|
-
if (index >= 0) {
|
|
102440
|
-
var mapping = this._originalMappings[index];
|
|
102441
|
-
if (aArgs.column === void 0) {
|
|
102442
|
-
var originalLine = mapping.originalLine;
|
|
102443
|
-
while (mapping && mapping.originalLine === originalLine) {
|
|
102444
|
-
mappings.push({
|
|
102445
|
-
line: util.getArg(mapping, "generatedLine", null),
|
|
102446
|
-
column: util.getArg(mapping, "generatedColumn", null),
|
|
102447
|
-
lastColumn: util.getArg(mapping, "lastGeneratedColumn", null)
|
|
102448
|
-
});
|
|
102449
|
-
mapping = this._originalMappings[++index];
|
|
102450
|
-
}
|
|
102451
|
-
} else {
|
|
102452
|
-
var originalColumn = mapping.originalColumn;
|
|
102453
|
-
while (mapping && mapping.originalLine === line && mapping.originalColumn == originalColumn) {
|
|
102454
|
-
mappings.push({
|
|
102455
|
-
line: util.getArg(mapping, "generatedLine", null),
|
|
102456
|
-
column: util.getArg(mapping, "generatedColumn", null),
|
|
102457
|
-
lastColumn: util.getArg(mapping, "lastGeneratedColumn", null)
|
|
102458
|
-
});
|
|
102459
|
-
mapping = this._originalMappings[++index];
|
|
102460
|
-
}
|
|
102461
|
-
}
|
|
102462
|
-
}
|
|
102463
|
-
return mappings;
|
|
102464
|
-
};
|
|
102465
|
-
exports2.SourceMapConsumer = SourceMapConsumer;
|
|
102466
|
-
function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
|
|
102467
|
-
var sourceMap = aSourceMap;
|
|
102468
|
-
if (typeof aSourceMap === "string") {
|
|
102469
|
-
sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
102470
|
-
}
|
|
102471
|
-
var version = util.getArg(sourceMap, "version");
|
|
102472
|
-
var sources = util.getArg(sourceMap, "sources");
|
|
102473
|
-
var names = util.getArg(sourceMap, "names", []);
|
|
102474
|
-
var sourceRoot = util.getArg(sourceMap, "sourceRoot", null);
|
|
102475
|
-
var sourcesContent = util.getArg(sourceMap, "sourcesContent", null);
|
|
102476
|
-
var mappings = util.getArg(sourceMap, "mappings");
|
|
102477
|
-
var file = util.getArg(sourceMap, "file", null);
|
|
102478
|
-
if (version != this._version) {
|
|
102479
|
-
throw new Error("Unsupported version: " + version);
|
|
102480
|
-
}
|
|
102481
|
-
if (sourceRoot) {
|
|
102482
|
-
sourceRoot = util.normalize(sourceRoot);
|
|
102483
|
-
}
|
|
102484
|
-
sources = sources.map(String).map(util.normalize).map(function(source) {
|
|
102485
|
-
return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) ? util.relative(sourceRoot, source) : source;
|
|
102486
|
-
});
|
|
102487
|
-
this._names = ArraySet.fromArray(names.map(String), true);
|
|
102488
|
-
this._sources = ArraySet.fromArray(sources, true);
|
|
102489
|
-
this._absoluteSources = this._sources.toArray().map(function(s) {
|
|
102490
|
-
return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
|
|
102491
|
-
});
|
|
102492
|
-
this.sourceRoot = sourceRoot;
|
|
102493
|
-
this.sourcesContent = sourcesContent;
|
|
102494
|
-
this._mappings = mappings;
|
|
102495
|
-
this._sourceMapURL = aSourceMapURL;
|
|
102496
|
-
this.file = file;
|
|
102497
|
-
}
|
|
102498
|
-
BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
|
|
102499
|
-
BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
|
|
102500
|
-
BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
|
|
102501
|
-
var relativeSource = aSource;
|
|
102502
|
-
if (this.sourceRoot != null) {
|
|
102503
|
-
relativeSource = util.relative(this.sourceRoot, relativeSource);
|
|
102504
|
-
}
|
|
102505
|
-
if (this._sources.has(relativeSource)) {
|
|
102506
|
-
return this._sources.indexOf(relativeSource);
|
|
102507
|
-
}
|
|
102508
|
-
var i;
|
|
102509
|
-
for (i = 0; i < this._absoluteSources.length; ++i) {
|
|
102510
|
-
if (this._absoluteSources[i] == aSource) {
|
|
102511
|
-
return i;
|
|
102512
|
-
}
|
|
102513
|
-
}
|
|
102514
|
-
return -1;
|
|
102515
|
-
};
|
|
102516
|
-
BasicSourceMapConsumer.fromSourceMap = function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
|
|
102517
|
-
var smc = Object.create(BasicSourceMapConsumer.prototype);
|
|
102518
|
-
var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
|
|
102519
|
-
var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
|
|
102520
|
-
smc.sourceRoot = aSourceMap._sourceRoot;
|
|
102521
|
-
smc.sourcesContent = aSourceMap._generateSourcesContent(
|
|
102522
|
-
smc._sources.toArray(),
|
|
102523
|
-
smc.sourceRoot
|
|
102524
|
-
);
|
|
102525
|
-
smc.file = aSourceMap._file;
|
|
102526
|
-
smc._sourceMapURL = aSourceMapURL;
|
|
102527
|
-
smc._absoluteSources = smc._sources.toArray().map(function(s) {
|
|
102528
|
-
return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
|
|
102529
|
-
});
|
|
102530
|
-
var generatedMappings = aSourceMap._mappings.toArray().slice();
|
|
102531
|
-
var destGeneratedMappings = smc.__generatedMappings = [];
|
|
102532
|
-
var destOriginalMappings = smc.__originalMappings = [];
|
|
102533
|
-
for (var i = 0, length = generatedMappings.length; i < length; i++) {
|
|
102534
|
-
var srcMapping = generatedMappings[i];
|
|
102535
|
-
var destMapping = new Mapping();
|
|
102536
|
-
destMapping.generatedLine = srcMapping.generatedLine;
|
|
102537
|
-
destMapping.generatedColumn = srcMapping.generatedColumn;
|
|
102538
|
-
if (srcMapping.source) {
|
|
102539
|
-
destMapping.source = sources.indexOf(srcMapping.source);
|
|
102540
|
-
destMapping.originalLine = srcMapping.originalLine;
|
|
102541
|
-
destMapping.originalColumn = srcMapping.originalColumn;
|
|
102542
|
-
if (srcMapping.name) {
|
|
102543
|
-
destMapping.name = names.indexOf(srcMapping.name);
|
|
102544
|
-
}
|
|
102545
|
-
destOriginalMappings.push(destMapping);
|
|
102546
|
-
}
|
|
102547
|
-
destGeneratedMappings.push(destMapping);
|
|
102548
|
-
}
|
|
102549
|
-
quickSort(smc.__originalMappings, util.compareByOriginalPositions);
|
|
102550
|
-
return smc;
|
|
102551
|
-
};
|
|
102552
|
-
BasicSourceMapConsumer.prototype._version = 3;
|
|
102553
|
-
Object.defineProperty(BasicSourceMapConsumer.prototype, "sources", {
|
|
102554
|
-
get: function() {
|
|
102555
|
-
return this._absoluteSources.slice();
|
|
102556
|
-
}
|
|
102557
|
-
});
|
|
102558
|
-
function Mapping() {
|
|
102559
|
-
this.generatedLine = 0;
|
|
102560
|
-
this.generatedColumn = 0;
|
|
102561
|
-
this.source = null;
|
|
102562
|
-
this.originalLine = null;
|
|
102563
|
-
this.originalColumn = null;
|
|
102564
|
-
this.name = null;
|
|
102565
|
-
}
|
|
102566
|
-
BasicSourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
|
|
102567
|
-
var generatedLine = 1;
|
|
102568
|
-
var previousGeneratedColumn = 0;
|
|
102569
|
-
var previousOriginalLine = 0;
|
|
102570
|
-
var previousOriginalColumn = 0;
|
|
102571
|
-
var previousSource = 0;
|
|
102572
|
-
var previousName = 0;
|
|
102573
|
-
var length = aStr.length;
|
|
102574
|
-
var index = 0;
|
|
102575
|
-
var cachedSegments = {};
|
|
102576
|
-
var temp = {};
|
|
102577
|
-
var originalMappings = [];
|
|
102578
|
-
var generatedMappings = [];
|
|
102579
|
-
var mapping, str, segment, end, value;
|
|
102580
|
-
while (index < length) {
|
|
102581
|
-
if (aStr.charAt(index) === ";") {
|
|
102582
|
-
generatedLine++;
|
|
102583
|
-
index++;
|
|
102584
|
-
previousGeneratedColumn = 0;
|
|
102585
|
-
} else if (aStr.charAt(index) === ",") {
|
|
102586
|
-
index++;
|
|
102587
|
-
} else {
|
|
102588
|
-
mapping = new Mapping();
|
|
102589
|
-
mapping.generatedLine = generatedLine;
|
|
102590
|
-
for (end = index; end < length; end++) {
|
|
102591
|
-
if (this._charIsMappingSeparator(aStr, end)) {
|
|
102592
|
-
break;
|
|
102593
|
-
}
|
|
102594
|
-
}
|
|
102595
|
-
str = aStr.slice(index, end);
|
|
102596
|
-
segment = cachedSegments[str];
|
|
102597
|
-
if (segment) {
|
|
102598
|
-
index += str.length;
|
|
102599
|
-
} else {
|
|
102600
|
-
segment = [];
|
|
102601
|
-
while (index < end) {
|
|
102602
|
-
base64VLQ.decode(aStr, index, temp);
|
|
102603
|
-
value = temp.value;
|
|
102604
|
-
index = temp.rest;
|
|
102605
|
-
segment.push(value);
|
|
102606
|
-
}
|
|
102607
|
-
if (segment.length === 2) {
|
|
102608
|
-
throw new Error("Found a source, but no line and column");
|
|
102609
|
-
}
|
|
102610
|
-
if (segment.length === 3) {
|
|
102611
|
-
throw new Error("Found a source and line, but no column");
|
|
102612
|
-
}
|
|
102613
|
-
cachedSegments[str] = segment;
|
|
102614
|
-
}
|
|
102615
|
-
mapping.generatedColumn = previousGeneratedColumn + segment[0];
|
|
102616
|
-
previousGeneratedColumn = mapping.generatedColumn;
|
|
102617
|
-
if (segment.length > 1) {
|
|
102618
|
-
mapping.source = previousSource + segment[1];
|
|
102619
|
-
previousSource += segment[1];
|
|
102620
|
-
mapping.originalLine = previousOriginalLine + segment[2];
|
|
102621
|
-
previousOriginalLine = mapping.originalLine;
|
|
102622
|
-
mapping.originalLine += 1;
|
|
102623
|
-
mapping.originalColumn = previousOriginalColumn + segment[3];
|
|
102624
|
-
previousOriginalColumn = mapping.originalColumn;
|
|
102625
|
-
if (segment.length > 4) {
|
|
102626
|
-
mapping.name = previousName + segment[4];
|
|
102627
|
-
previousName += segment[4];
|
|
102628
|
-
}
|
|
102629
|
-
}
|
|
102630
|
-
generatedMappings.push(mapping);
|
|
102631
|
-
if (typeof mapping.originalLine === "number") {
|
|
102632
|
-
originalMappings.push(mapping);
|
|
102633
|
-
}
|
|
102634
|
-
}
|
|
102635
|
-
}
|
|
102636
|
-
quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
|
|
102637
|
-
this.__generatedMappings = generatedMappings;
|
|
102638
|
-
quickSort(originalMappings, util.compareByOriginalPositions);
|
|
102639
|
-
this.__originalMappings = originalMappings;
|
|
102640
|
-
};
|
|
102641
|
-
BasicSourceMapConsumer.prototype._findMapping = function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, aColumnName, aComparator, aBias) {
|
|
102642
|
-
if (aNeedle[aLineName] <= 0) {
|
|
102643
|
-
throw new TypeError("Line must be greater than or equal to 1, got " + aNeedle[aLineName]);
|
|
102644
|
-
}
|
|
102645
|
-
if (aNeedle[aColumnName] < 0) {
|
|
102646
|
-
throw new TypeError("Column must be greater than or equal to 0, got " + aNeedle[aColumnName]);
|
|
102647
|
-
}
|
|
102648
|
-
return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
|
|
102649
|
-
};
|
|
102650
|
-
BasicSourceMapConsumer.prototype.computeColumnSpans = function SourceMapConsumer_computeColumnSpans() {
|
|
102651
|
-
for (var index = 0; index < this._generatedMappings.length; ++index) {
|
|
102652
|
-
var mapping = this._generatedMappings[index];
|
|
102653
|
-
if (index + 1 < this._generatedMappings.length) {
|
|
102654
|
-
var nextMapping = this._generatedMappings[index + 1];
|
|
102655
|
-
if (mapping.generatedLine === nextMapping.generatedLine) {
|
|
102656
|
-
mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
|
|
102657
|
-
continue;
|
|
102658
|
-
}
|
|
102659
|
-
}
|
|
102660
|
-
mapping.lastGeneratedColumn = Infinity;
|
|
102661
|
-
}
|
|
102662
|
-
};
|
|
102663
|
-
BasicSourceMapConsumer.prototype.originalPositionFor = function SourceMapConsumer_originalPositionFor(aArgs) {
|
|
102664
|
-
var needle = {
|
|
102665
|
-
generatedLine: util.getArg(aArgs, "line"),
|
|
102666
|
-
generatedColumn: util.getArg(aArgs, "column")
|
|
102667
|
-
};
|
|
102668
|
-
var index = this._findMapping(
|
|
102669
|
-
needle,
|
|
102670
|
-
this._generatedMappings,
|
|
102671
|
-
"generatedLine",
|
|
102672
|
-
"generatedColumn",
|
|
102673
|
-
util.compareByGeneratedPositionsDeflated,
|
|
102674
|
-
util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND)
|
|
102675
|
-
);
|
|
102676
|
-
if (index >= 0) {
|
|
102677
|
-
var mapping = this._generatedMappings[index];
|
|
102678
|
-
if (mapping.generatedLine === needle.generatedLine) {
|
|
102679
|
-
var source = util.getArg(mapping, "source", null);
|
|
102680
|
-
if (source !== null) {
|
|
102681
|
-
source = this._sources.at(source);
|
|
102682
|
-
source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
|
|
102683
|
-
}
|
|
102684
|
-
var name = util.getArg(mapping, "name", null);
|
|
102685
|
-
if (name !== null) {
|
|
102686
|
-
name = this._names.at(name);
|
|
102687
|
-
}
|
|
102688
|
-
return {
|
|
102689
|
-
source,
|
|
102690
|
-
line: util.getArg(mapping, "originalLine", null),
|
|
102691
|
-
column: util.getArg(mapping, "originalColumn", null),
|
|
102692
|
-
name
|
|
102693
|
-
};
|
|
102694
|
-
}
|
|
102695
|
-
}
|
|
102696
|
-
return {
|
|
102697
|
-
source: null,
|
|
102698
|
-
line: null,
|
|
102699
|
-
column: null,
|
|
102700
|
-
name: null
|
|
102701
|
-
};
|
|
102702
|
-
};
|
|
102703
|
-
BasicSourceMapConsumer.prototype.hasContentsOfAllSources = function BasicSourceMapConsumer_hasContentsOfAllSources() {
|
|
102704
|
-
if (!this.sourcesContent) {
|
|
102705
|
-
return false;
|
|
102706
|
-
}
|
|
102707
|
-
return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function(sc) {
|
|
102708
|
-
return sc == null;
|
|
102709
|
-
});
|
|
102710
|
-
};
|
|
102711
|
-
BasicSourceMapConsumer.prototype.sourceContentFor = function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
|
|
102712
|
-
if (!this.sourcesContent) {
|
|
102713
|
-
return null;
|
|
102714
|
-
}
|
|
102715
|
-
var index = this._findSourceIndex(aSource);
|
|
102716
|
-
if (index >= 0) {
|
|
102717
|
-
return this.sourcesContent[index];
|
|
102718
|
-
}
|
|
102719
|
-
var relativeSource = aSource;
|
|
102720
|
-
if (this.sourceRoot != null) {
|
|
102721
|
-
relativeSource = util.relative(this.sourceRoot, relativeSource);
|
|
102722
|
-
}
|
|
102723
|
-
var url;
|
|
102724
|
-
if (this.sourceRoot != null && (url = util.urlParse(this.sourceRoot))) {
|
|
102725
|
-
var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
|
|
102726
|
-
if (url.scheme == "file" && this._sources.has(fileUriAbsPath)) {
|
|
102727
|
-
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
|
|
102728
|
-
}
|
|
102729
|
-
if ((!url.path || url.path == "/") && this._sources.has("/" + relativeSource)) {
|
|
102730
|
-
return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
|
|
102731
|
-
}
|
|
102732
|
-
}
|
|
102733
|
-
if (nullOnMissing) {
|
|
102734
|
-
return null;
|
|
102735
|
-
} else {
|
|
102736
|
-
throw new Error('"' + relativeSource + '" is not in the SourceMap.');
|
|
102737
|
-
}
|
|
102738
|
-
};
|
|
102739
|
-
BasicSourceMapConsumer.prototype.generatedPositionFor = function SourceMapConsumer_generatedPositionFor(aArgs) {
|
|
102740
|
-
var source = util.getArg(aArgs, "source");
|
|
102741
|
-
source = this._findSourceIndex(source);
|
|
102742
|
-
if (source < 0) {
|
|
102743
|
-
return {
|
|
102744
|
-
line: null,
|
|
102745
|
-
column: null,
|
|
102746
|
-
lastColumn: null
|
|
102747
|
-
};
|
|
102748
|
-
}
|
|
102749
|
-
var needle = {
|
|
102750
|
-
source,
|
|
102751
|
-
originalLine: util.getArg(aArgs, "line"),
|
|
102752
|
-
originalColumn: util.getArg(aArgs, "column")
|
|
102753
|
-
};
|
|
102754
|
-
var index = this._findMapping(
|
|
102755
|
-
needle,
|
|
102756
|
-
this._originalMappings,
|
|
102757
|
-
"originalLine",
|
|
102758
|
-
"originalColumn",
|
|
102759
|
-
util.compareByOriginalPositions,
|
|
102760
|
-
util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND)
|
|
102761
|
-
);
|
|
102762
|
-
if (index >= 0) {
|
|
102763
|
-
var mapping = this._originalMappings[index];
|
|
102764
|
-
if (mapping.source === needle.source) {
|
|
102765
|
-
return {
|
|
102766
|
-
line: util.getArg(mapping, "generatedLine", null),
|
|
102767
|
-
column: util.getArg(mapping, "generatedColumn", null),
|
|
102768
|
-
lastColumn: util.getArg(mapping, "lastGeneratedColumn", null)
|
|
102769
|
-
};
|
|
102770
|
-
}
|
|
102771
|
-
}
|
|
102772
|
-
return {
|
|
102773
|
-
line: null,
|
|
102774
|
-
column: null,
|
|
102775
|
-
lastColumn: null
|
|
102776
|
-
};
|
|
102777
|
-
};
|
|
102778
|
-
exports2.BasicSourceMapConsumer = BasicSourceMapConsumer;
|
|
102779
|
-
function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
|
|
102780
|
-
var sourceMap = aSourceMap;
|
|
102781
|
-
if (typeof aSourceMap === "string") {
|
|
102782
|
-
sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
102783
|
-
}
|
|
102784
|
-
var version = util.getArg(sourceMap, "version");
|
|
102785
|
-
var sections = util.getArg(sourceMap, "sections");
|
|
102786
|
-
if (version != this._version) {
|
|
102787
|
-
throw new Error("Unsupported version: " + version);
|
|
102788
|
-
}
|
|
102789
|
-
this._sources = new ArraySet();
|
|
102790
|
-
this._names = new ArraySet();
|
|
102791
|
-
var lastOffset = {
|
|
102792
|
-
line: -1,
|
|
102793
|
-
column: 0
|
|
102794
|
-
};
|
|
102795
|
-
this._sections = sections.map(function(s) {
|
|
102796
|
-
if (s.url) {
|
|
102797
|
-
throw new Error("Support for url field in sections not implemented.");
|
|
102798
|
-
}
|
|
102799
|
-
var offset = util.getArg(s, "offset");
|
|
102800
|
-
var offsetLine = util.getArg(offset, "line");
|
|
102801
|
-
var offsetColumn = util.getArg(offset, "column");
|
|
102802
|
-
if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) {
|
|
102803
|
-
throw new Error("Section offsets must be ordered and non-overlapping.");
|
|
102804
|
-
}
|
|
102805
|
-
lastOffset = offset;
|
|
102806
|
-
return {
|
|
102807
|
-
generatedOffset: {
|
|
102808
|
-
// The offset fields are 0-based, but we use 1-based indices when
|
|
102809
|
-
// encoding/decoding from VLQ.
|
|
102810
|
-
generatedLine: offsetLine + 1,
|
|
102811
|
-
generatedColumn: offsetColumn + 1
|
|
102812
|
-
},
|
|
102813
|
-
consumer: new SourceMapConsumer(util.getArg(s, "map"), aSourceMapURL)
|
|
102814
|
-
};
|
|
102815
|
-
});
|
|
102816
|
-
}
|
|
102817
|
-
IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
|
|
102818
|
-
IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
|
|
102819
|
-
IndexedSourceMapConsumer.prototype._version = 3;
|
|
102820
|
-
Object.defineProperty(IndexedSourceMapConsumer.prototype, "sources", {
|
|
102821
|
-
get: function() {
|
|
102822
|
-
var sources = [];
|
|
102823
|
-
for (var i = 0; i < this._sections.length; i++) {
|
|
102824
|
-
for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
|
|
102825
|
-
sources.push(this._sections[i].consumer.sources[j]);
|
|
102826
|
-
}
|
|
102827
|
-
}
|
|
102828
|
-
return sources;
|
|
102829
|
-
}
|
|
102830
|
-
});
|
|
102831
|
-
IndexedSourceMapConsumer.prototype.originalPositionFor = function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
|
|
102832
|
-
var needle = {
|
|
102833
|
-
generatedLine: util.getArg(aArgs, "line"),
|
|
102834
|
-
generatedColumn: util.getArg(aArgs, "column")
|
|
102835
|
-
};
|
|
102836
|
-
var sectionIndex = binarySearch.search(
|
|
102837
|
-
needle,
|
|
102838
|
-
this._sections,
|
|
102839
|
-
function(needle2, section2) {
|
|
102840
|
-
var cmp = needle2.generatedLine - section2.generatedOffset.generatedLine;
|
|
102841
|
-
if (cmp) {
|
|
102842
|
-
return cmp;
|
|
102843
|
-
}
|
|
102844
|
-
return needle2.generatedColumn - section2.generatedOffset.generatedColumn;
|
|
102845
|
-
}
|
|
102846
|
-
);
|
|
102847
|
-
var section = this._sections[sectionIndex];
|
|
102848
|
-
if (!section) {
|
|
102849
|
-
return {
|
|
102850
|
-
source: null,
|
|
102851
|
-
line: null,
|
|
102852
|
-
column: null,
|
|
102853
|
-
name: null
|
|
102854
|
-
};
|
|
102855
|
-
}
|
|
102856
|
-
return section.consumer.originalPositionFor({
|
|
102857
|
-
line: needle.generatedLine - (section.generatedOffset.generatedLine - 1),
|
|
102858
|
-
column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
|
|
102859
|
-
bias: aArgs.bias
|
|
102860
|
-
});
|
|
102861
|
-
};
|
|
102862
|
-
IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = function IndexedSourceMapConsumer_hasContentsOfAllSources() {
|
|
102863
|
-
return this._sections.every(function(s) {
|
|
102864
|
-
return s.consumer.hasContentsOfAllSources();
|
|
102865
|
-
});
|
|
102866
|
-
};
|
|
102867
|
-
IndexedSourceMapConsumer.prototype.sourceContentFor = function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
|
|
102868
|
-
for (var i = 0; i < this._sections.length; i++) {
|
|
102869
|
-
var section = this._sections[i];
|
|
102870
|
-
var content = section.consumer.sourceContentFor(aSource, true);
|
|
102871
|
-
if (content) {
|
|
102872
|
-
return content;
|
|
102873
|
-
}
|
|
102874
|
-
}
|
|
102875
|
-
if (nullOnMissing) {
|
|
102876
|
-
return null;
|
|
102877
|
-
} else {
|
|
102878
|
-
throw new Error('"' + aSource + '" is not in the SourceMap.');
|
|
102879
|
-
}
|
|
102880
|
-
};
|
|
102881
|
-
IndexedSourceMapConsumer.prototype.generatedPositionFor = function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
|
|
102882
|
-
for (var i = 0; i < this._sections.length; i++) {
|
|
102883
|
-
var section = this._sections[i];
|
|
102884
|
-
if (section.consumer._findSourceIndex(util.getArg(aArgs, "source")) === -1) {
|
|
102885
|
-
continue;
|
|
102886
|
-
}
|
|
102887
|
-
var generatedPosition = section.consumer.generatedPositionFor(aArgs);
|
|
102888
|
-
if (generatedPosition) {
|
|
102889
|
-
var ret = {
|
|
102890
|
-
line: generatedPosition.line + (section.generatedOffset.generatedLine - 1),
|
|
102891
|
-
column: generatedPosition.column + (section.generatedOffset.generatedLine === generatedPosition.line ? section.generatedOffset.generatedColumn - 1 : 0)
|
|
102892
|
-
};
|
|
102893
|
-
return ret;
|
|
102894
|
-
}
|
|
102895
|
-
}
|
|
102896
|
-
return {
|
|
102897
|
-
line: null,
|
|
102898
|
-
column: null
|
|
102899
|
-
};
|
|
102900
|
-
};
|
|
102901
|
-
IndexedSourceMapConsumer.prototype._parseMappings = function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
|
|
102902
|
-
this.__generatedMappings = [];
|
|
102903
|
-
this.__originalMappings = [];
|
|
102904
|
-
for (var i = 0; i < this._sections.length; i++) {
|
|
102905
|
-
var section = this._sections[i];
|
|
102906
|
-
var sectionMappings = section.consumer._generatedMappings;
|
|
102907
|
-
for (var j = 0; j < sectionMappings.length; j++) {
|
|
102908
|
-
var mapping = sectionMappings[j];
|
|
102909
|
-
var source = section.consumer._sources.at(mapping.source);
|
|
102910
|
-
source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
|
|
102911
|
-
this._sources.add(source);
|
|
102912
|
-
source = this._sources.indexOf(source);
|
|
102913
|
-
var name = null;
|
|
102914
|
-
if (mapping.name) {
|
|
102915
|
-
name = section.consumer._names.at(mapping.name);
|
|
102916
|
-
this._names.add(name);
|
|
102917
|
-
name = this._names.indexOf(name);
|
|
102918
|
-
}
|
|
102919
|
-
var adjustedMapping = {
|
|
102920
|
-
source,
|
|
102921
|
-
generatedLine: mapping.generatedLine + (section.generatedOffset.generatedLine - 1),
|
|
102922
|
-
generatedColumn: mapping.generatedColumn + (section.generatedOffset.generatedLine === mapping.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
|
|
102923
|
-
originalLine: mapping.originalLine,
|
|
102924
|
-
originalColumn: mapping.originalColumn,
|
|
102925
|
-
name
|
|
102926
|
-
};
|
|
102927
|
-
this.__generatedMappings.push(adjustedMapping);
|
|
102928
|
-
if (typeof adjustedMapping.originalLine === "number") {
|
|
102929
|
-
this.__originalMappings.push(adjustedMapping);
|
|
102930
|
-
}
|
|
102931
|
-
}
|
|
102932
|
-
}
|
|
102933
|
-
quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
|
|
102934
|
-
quickSort(this.__originalMappings, util.compareByOriginalPositions);
|
|
102935
|
-
};
|
|
102936
|
-
exports2.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
|
|
102937
|
-
}
|
|
102938
|
-
});
|
|
102939
|
-
|
|
102940
|
-
// ../../node_modules/source-map-support/node_modules/source-map/lib/source-node.js
|
|
102941
|
-
var require_source_node = __commonJS({
|
|
102942
|
-
"../../node_modules/source-map-support/node_modules/source-map/lib/source-node.js"(exports2) {
|
|
102943
|
-
"use strict";
|
|
102944
|
-
var SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
|
|
102945
|
-
var util = require_util4();
|
|
102946
|
-
var REGEX_NEWLINE = /(\r?\n)/;
|
|
102947
|
-
var NEWLINE_CODE = 10;
|
|
102948
|
-
var isSourceNode = "$$$isSourceNode$$$";
|
|
102949
|
-
function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
|
|
102950
|
-
this.children = [];
|
|
102951
|
-
this.sourceContents = {};
|
|
102952
|
-
this.line = aLine == null ? null : aLine;
|
|
102953
|
-
this.column = aColumn == null ? null : aColumn;
|
|
102954
|
-
this.source = aSource == null ? null : aSource;
|
|
102955
|
-
this.name = aName == null ? null : aName;
|
|
102956
|
-
this[isSourceNode] = true;
|
|
102957
|
-
if (aChunks != null) this.add(aChunks);
|
|
102958
|
-
}
|
|
102959
|
-
SourceNode.fromStringWithSourceMap = function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
|
|
102960
|
-
var node = new SourceNode();
|
|
102961
|
-
var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
|
|
102962
|
-
var remainingLinesIndex = 0;
|
|
102963
|
-
var shiftNextLine = function() {
|
|
102964
|
-
var lineContents = getNextLine();
|
|
102965
|
-
var newLine = getNextLine() || "";
|
|
102966
|
-
return lineContents + newLine;
|
|
102967
|
-
function getNextLine() {
|
|
102968
|
-
return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : void 0;
|
|
102969
|
-
}
|
|
102970
|
-
};
|
|
102971
|
-
var lastGeneratedLine = 1, lastGeneratedColumn = 0;
|
|
102972
|
-
var lastMapping = null;
|
|
102973
|
-
aSourceMapConsumer.eachMapping(function(mapping) {
|
|
102974
|
-
if (lastMapping !== null) {
|
|
102975
|
-
if (lastGeneratedLine < mapping.generatedLine) {
|
|
102976
|
-
addMappingWithCode(lastMapping, shiftNextLine());
|
|
102977
|
-
lastGeneratedLine++;
|
|
102978
|
-
lastGeneratedColumn = 0;
|
|
102979
|
-
} else {
|
|
102980
|
-
var nextLine = remainingLines[remainingLinesIndex] || "";
|
|
102981
|
-
var code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn);
|
|
102982
|
-
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn);
|
|
102983
|
-
lastGeneratedColumn = mapping.generatedColumn;
|
|
102984
|
-
addMappingWithCode(lastMapping, code);
|
|
102985
|
-
lastMapping = mapping;
|
|
102986
|
-
return;
|
|
102987
|
-
}
|
|
102988
|
-
}
|
|
102989
|
-
while (lastGeneratedLine < mapping.generatedLine) {
|
|
102990
|
-
node.add(shiftNextLine());
|
|
102991
|
-
lastGeneratedLine++;
|
|
102992
|
-
}
|
|
102993
|
-
if (lastGeneratedColumn < mapping.generatedColumn) {
|
|
102994
|
-
var nextLine = remainingLines[remainingLinesIndex] || "";
|
|
102995
|
-
node.add(nextLine.substr(0, mapping.generatedColumn));
|
|
102996
|
-
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
|
|
102997
|
-
lastGeneratedColumn = mapping.generatedColumn;
|
|
102998
|
-
}
|
|
102999
|
-
lastMapping = mapping;
|
|
103000
|
-
}, this);
|
|
103001
|
-
if (remainingLinesIndex < remainingLines.length) {
|
|
103002
|
-
if (lastMapping) {
|
|
103003
|
-
addMappingWithCode(lastMapping, shiftNextLine());
|
|
103004
|
-
}
|
|
103005
|
-
node.add(remainingLines.splice(remainingLinesIndex).join(""));
|
|
103006
|
-
}
|
|
103007
|
-
aSourceMapConsumer.sources.forEach(function(sourceFile) {
|
|
103008
|
-
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
|
103009
|
-
if (content != null) {
|
|
103010
|
-
if (aRelativePath != null) {
|
|
103011
|
-
sourceFile = util.join(aRelativePath, sourceFile);
|
|
103012
|
-
}
|
|
103013
|
-
node.setSourceContent(sourceFile, content);
|
|
103014
|
-
}
|
|
103015
|
-
});
|
|
103016
|
-
return node;
|
|
103017
|
-
function addMappingWithCode(mapping, code) {
|
|
103018
|
-
if (mapping === null || mapping.source === void 0) {
|
|
103019
|
-
node.add(code);
|
|
103020
|
-
} else {
|
|
103021
|
-
var source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source;
|
|
103022
|
-
node.add(new SourceNode(
|
|
103023
|
-
mapping.originalLine,
|
|
103024
|
-
mapping.originalColumn,
|
|
103025
|
-
source,
|
|
103026
|
-
code,
|
|
103027
|
-
mapping.name
|
|
103028
|
-
));
|
|
103029
|
-
}
|
|
103030
|
-
}
|
|
103031
|
-
};
|
|
103032
|
-
SourceNode.prototype.add = function SourceNode_add(aChunk) {
|
|
103033
|
-
if (Array.isArray(aChunk)) {
|
|
103034
|
-
aChunk.forEach(function(chunk) {
|
|
103035
|
-
this.add(chunk);
|
|
103036
|
-
}, this);
|
|
103037
|
-
} else if (aChunk[isSourceNode] || typeof aChunk === "string") {
|
|
103038
|
-
if (aChunk) {
|
|
103039
|
-
this.children.push(aChunk);
|
|
103040
|
-
}
|
|
103041
|
-
} else {
|
|
103042
|
-
throw new TypeError(
|
|
103043
|
-
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
|
|
103044
|
-
);
|
|
103045
|
-
}
|
|
103046
|
-
return this;
|
|
103047
|
-
};
|
|
103048
|
-
SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
|
|
103049
|
-
if (Array.isArray(aChunk)) {
|
|
103050
|
-
for (var i = aChunk.length - 1; i >= 0; i--) {
|
|
103051
|
-
this.prepend(aChunk[i]);
|
|
103052
|
-
}
|
|
103053
|
-
} else if (aChunk[isSourceNode] || typeof aChunk === "string") {
|
|
103054
|
-
this.children.unshift(aChunk);
|
|
103055
|
-
} else {
|
|
103056
|
-
throw new TypeError(
|
|
103057
|
-
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
|
|
103058
|
-
);
|
|
103059
|
-
}
|
|
103060
|
-
return this;
|
|
103061
|
-
};
|
|
103062
|
-
SourceNode.prototype.walk = function SourceNode_walk(aFn) {
|
|
103063
|
-
var chunk;
|
|
103064
|
-
for (var i = 0, len = this.children.length; i < len; i++) {
|
|
103065
|
-
chunk = this.children[i];
|
|
103066
|
-
if (chunk[isSourceNode]) {
|
|
103067
|
-
chunk.walk(aFn);
|
|
103068
|
-
} else {
|
|
103069
|
-
if (chunk !== "") {
|
|
103070
|
-
aFn(chunk, {
|
|
103071
|
-
source: this.source,
|
|
103072
|
-
line: this.line,
|
|
103073
|
-
column: this.column,
|
|
103074
|
-
name: this.name
|
|
103075
|
-
});
|
|
103076
|
-
}
|
|
103077
|
-
}
|
|
103078
|
-
}
|
|
103079
|
-
};
|
|
103080
|
-
SourceNode.prototype.join = function SourceNode_join(aSep) {
|
|
103081
|
-
var newChildren;
|
|
103082
|
-
var i;
|
|
103083
|
-
var len = this.children.length;
|
|
103084
|
-
if (len > 0) {
|
|
103085
|
-
newChildren = [];
|
|
103086
|
-
for (i = 0; i < len - 1; i++) {
|
|
103087
|
-
newChildren.push(this.children[i]);
|
|
103088
|
-
newChildren.push(aSep);
|
|
103089
|
-
}
|
|
103090
|
-
newChildren.push(this.children[i]);
|
|
103091
|
-
this.children = newChildren;
|
|
103092
|
-
}
|
|
103093
|
-
return this;
|
|
103094
|
-
};
|
|
103095
|
-
SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
|
|
103096
|
-
var lastChild = this.children[this.children.length - 1];
|
|
103097
|
-
if (lastChild[isSourceNode]) {
|
|
103098
|
-
lastChild.replaceRight(aPattern, aReplacement);
|
|
103099
|
-
} else if (typeof lastChild === "string") {
|
|
103100
|
-
this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
|
|
103101
|
-
} else {
|
|
103102
|
-
this.children.push("".replace(aPattern, aReplacement));
|
|
103103
|
-
}
|
|
103104
|
-
return this;
|
|
103105
|
-
};
|
|
103106
|
-
SourceNode.prototype.setSourceContent = function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
|
|
103107
|
-
this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
|
|
103108
|
-
};
|
|
103109
|
-
SourceNode.prototype.walkSourceContents = function SourceNode_walkSourceContents(aFn) {
|
|
103110
|
-
for (var i = 0, len = this.children.length; i < len; i++) {
|
|
103111
|
-
if (this.children[i][isSourceNode]) {
|
|
103112
|
-
this.children[i].walkSourceContents(aFn);
|
|
103113
|
-
}
|
|
103114
|
-
}
|
|
103115
|
-
var sources = Object.keys(this.sourceContents);
|
|
103116
|
-
for (var i = 0, len = sources.length; i < len; i++) {
|
|
103117
|
-
aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
|
|
103118
|
-
}
|
|
103119
|
-
};
|
|
103120
|
-
SourceNode.prototype.toString = function SourceNode_toString() {
|
|
103121
|
-
var str = "";
|
|
103122
|
-
this.walk(function(chunk) {
|
|
103123
|
-
str += chunk;
|
|
103124
|
-
});
|
|
103125
|
-
return str;
|
|
103126
|
-
};
|
|
103127
|
-
SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
|
|
103128
|
-
var generated = {
|
|
103129
|
-
code: "",
|
|
103130
|
-
line: 1,
|
|
103131
|
-
column: 0
|
|
103132
|
-
};
|
|
103133
|
-
var map2 = new SourceMapGenerator(aArgs);
|
|
103134
|
-
var sourceMappingActive = false;
|
|
103135
|
-
var lastOriginalSource = null;
|
|
103136
|
-
var lastOriginalLine = null;
|
|
103137
|
-
var lastOriginalColumn = null;
|
|
103138
|
-
var lastOriginalName = null;
|
|
103139
|
-
this.walk(function(chunk, original) {
|
|
103140
|
-
generated.code += chunk;
|
|
103141
|
-
if (original.source !== null && original.line !== null && original.column !== null) {
|
|
103142
|
-
if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) {
|
|
103143
|
-
map2.addMapping({
|
|
103144
|
-
source: original.source,
|
|
103145
|
-
original: {
|
|
103146
|
-
line: original.line,
|
|
103147
|
-
column: original.column
|
|
103148
|
-
},
|
|
103149
|
-
generated: {
|
|
103150
|
-
line: generated.line,
|
|
103151
|
-
column: generated.column
|
|
103152
|
-
},
|
|
103153
|
-
name: original.name
|
|
103154
|
-
});
|
|
103155
|
-
}
|
|
103156
|
-
lastOriginalSource = original.source;
|
|
103157
|
-
lastOriginalLine = original.line;
|
|
103158
|
-
lastOriginalColumn = original.column;
|
|
103159
|
-
lastOriginalName = original.name;
|
|
103160
|
-
sourceMappingActive = true;
|
|
103161
|
-
} else if (sourceMappingActive) {
|
|
103162
|
-
map2.addMapping({
|
|
103163
|
-
generated: {
|
|
103164
|
-
line: generated.line,
|
|
103165
|
-
column: generated.column
|
|
103166
|
-
}
|
|
103167
|
-
});
|
|
103168
|
-
lastOriginalSource = null;
|
|
103169
|
-
sourceMappingActive = false;
|
|
103170
|
-
}
|
|
103171
|
-
for (var idx = 0, length = chunk.length; idx < length; idx++) {
|
|
103172
|
-
if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
|
|
103173
|
-
generated.line++;
|
|
103174
|
-
generated.column = 0;
|
|
103175
|
-
if (idx + 1 === length) {
|
|
103176
|
-
lastOriginalSource = null;
|
|
103177
|
-
sourceMappingActive = false;
|
|
103178
|
-
} else if (sourceMappingActive) {
|
|
103179
|
-
map2.addMapping({
|
|
103180
|
-
source: original.source,
|
|
103181
|
-
original: {
|
|
103182
|
-
line: original.line,
|
|
103183
|
-
column: original.column
|
|
103184
|
-
},
|
|
103185
|
-
generated: {
|
|
103186
|
-
line: generated.line,
|
|
103187
|
-
column: generated.column
|
|
103188
|
-
},
|
|
103189
|
-
name: original.name
|
|
103190
|
-
});
|
|
103191
|
-
}
|
|
103192
|
-
} else {
|
|
103193
|
-
generated.column++;
|
|
103194
|
-
}
|
|
103195
|
-
}
|
|
103196
|
-
});
|
|
103197
|
-
this.walkSourceContents(function(sourceFile, sourceContent) {
|
|
103198
|
-
map2.setSourceContent(sourceFile, sourceContent);
|
|
103199
|
-
});
|
|
103200
|
-
return { code: generated.code, map: map2 };
|
|
103201
|
-
};
|
|
103202
|
-
exports2.SourceNode = SourceNode;
|
|
103203
|
-
}
|
|
103204
|
-
});
|
|
103205
|
-
|
|
103206
|
-
// ../../node_modules/source-map-support/node_modules/source-map/source-map.js
|
|
103207
|
-
var require_source_map = __commonJS({
|
|
103208
|
-
"../../node_modules/source-map-support/node_modules/source-map/source-map.js"(exports2) {
|
|
103209
|
-
"use strict";
|
|
103210
|
-
exports2.SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
|
|
103211
|
-
exports2.SourceMapConsumer = require_source_map_consumer().SourceMapConsumer;
|
|
103212
|
-
exports2.SourceNode = require_source_node().SourceNode;
|
|
103213
|
-
}
|
|
103214
|
-
});
|
|
103215
|
-
|
|
103216
|
-
// ../../node_modules/buffer-from/index.js
|
|
103217
|
-
var require_buffer_from = __commonJS({
|
|
103218
|
-
"../../node_modules/buffer-from/index.js"(exports2, module2) {
|
|
103219
|
-
"use strict";
|
|
103220
|
-
var toString = Object.prototype.toString;
|
|
103221
|
-
var isModern = typeof Buffer !== "undefined" && typeof Buffer.alloc === "function" && typeof Buffer.allocUnsafe === "function" && typeof Buffer.from === "function";
|
|
103222
|
-
function isArrayBuffer(input) {
|
|
103223
|
-
return toString.call(input).slice(8, -1) === "ArrayBuffer";
|
|
103224
|
-
}
|
|
103225
|
-
function fromArrayBuffer(obj, byteOffset, length) {
|
|
103226
|
-
byteOffset >>>= 0;
|
|
103227
|
-
var maxLength = obj.byteLength - byteOffset;
|
|
103228
|
-
if (maxLength < 0) {
|
|
103229
|
-
throw new RangeError("'offset' is out of bounds");
|
|
103230
|
-
}
|
|
103231
|
-
if (length === void 0) {
|
|
103232
|
-
length = maxLength;
|
|
103233
|
-
} else {
|
|
103234
|
-
length >>>= 0;
|
|
103235
|
-
if (length > maxLength) {
|
|
103236
|
-
throw new RangeError("'length' is out of bounds");
|
|
103237
|
-
}
|
|
103238
|
-
}
|
|
103239
|
-
return isModern ? Buffer.from(obj.slice(byteOffset, byteOffset + length)) : new Buffer(new Uint8Array(obj.slice(byteOffset, byteOffset + length)));
|
|
103240
|
-
}
|
|
103241
|
-
function fromString(string, encoding) {
|
|
103242
|
-
if (typeof encoding !== "string" || encoding === "") {
|
|
103243
|
-
encoding = "utf8";
|
|
103244
|
-
}
|
|
103245
|
-
if (!Buffer.isEncoding(encoding)) {
|
|
103246
|
-
throw new TypeError('"encoding" must be a valid string encoding');
|
|
103247
|
-
}
|
|
103248
|
-
return isModern ? Buffer.from(string, encoding) : new Buffer(string, encoding);
|
|
103249
|
-
}
|
|
103250
|
-
function bufferFrom(value, encodingOrOffset, length) {
|
|
103251
|
-
if (typeof value === "number") {
|
|
103252
|
-
throw new TypeError('"value" argument must not be a number');
|
|
103253
|
-
}
|
|
103254
|
-
if (isArrayBuffer(value)) {
|
|
103255
|
-
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
103256
|
-
}
|
|
103257
|
-
if (typeof value === "string") {
|
|
103258
|
-
return fromString(value, encodingOrOffset);
|
|
103259
|
-
}
|
|
103260
|
-
return isModern ? Buffer.from(value) : new Buffer(value);
|
|
103261
|
-
}
|
|
103262
|
-
module2.exports = bufferFrom;
|
|
103263
|
-
}
|
|
103264
|
-
});
|
|
103265
|
-
|
|
103266
|
-
// ../../node_modules/source-map-support/source-map-support.js
|
|
103267
|
-
var require_source_map_support = __commonJS({
|
|
103268
|
-
"../../node_modules/source-map-support/source-map-support.js"(exports2, module2) {
|
|
103269
|
-
"use strict";
|
|
103270
|
-
var SourceMapConsumer = require_source_map().SourceMapConsumer;
|
|
103271
|
-
var path = require("path");
|
|
103272
|
-
var fs;
|
|
103273
|
-
try {
|
|
103274
|
-
fs = require("fs");
|
|
103275
|
-
if (!fs.existsSync || !fs.readFileSync) {
|
|
103276
|
-
fs = null;
|
|
103277
|
-
}
|
|
103278
|
-
} catch (err) {
|
|
103279
|
-
}
|
|
103280
|
-
var bufferFrom = require_buffer_from();
|
|
103281
|
-
function dynamicRequire(mod, request) {
|
|
103282
|
-
return mod.require(request);
|
|
103283
|
-
}
|
|
103284
|
-
var errorFormatterInstalled = false;
|
|
103285
|
-
var uncaughtShimInstalled = false;
|
|
103286
|
-
var emptyCacheBetweenOperations = false;
|
|
103287
|
-
var environment = "auto";
|
|
103288
|
-
var fileContentsCache = {};
|
|
103289
|
-
var sourceMapCache = {};
|
|
103290
|
-
var reSourceMap = /^data:application\/json[^,]+base64,/;
|
|
103291
|
-
var retrieveFileHandlers = [];
|
|
103292
|
-
var retrieveMapHandlers = [];
|
|
103293
|
-
function isInBrowser() {
|
|
103294
|
-
if (environment === "browser")
|
|
103295
|
-
return true;
|
|
103296
|
-
if (environment === "node")
|
|
103297
|
-
return false;
|
|
103298
|
-
return typeof window !== "undefined" && typeof XMLHttpRequest === "function" && !(window.require && window.module && window.process && window.process.type === "renderer");
|
|
103299
|
-
}
|
|
103300
|
-
function hasGlobalProcessEventEmitter() {
|
|
103301
|
-
return typeof process === "object" && process !== null && typeof process.on === "function";
|
|
103302
|
-
}
|
|
103303
|
-
function globalProcessVersion() {
|
|
103304
|
-
if (typeof process === "object" && process !== null) {
|
|
103305
|
-
return process.version;
|
|
103306
|
-
} else {
|
|
103307
|
-
return "";
|
|
103308
|
-
}
|
|
103309
|
-
}
|
|
103310
|
-
function globalProcessStderr() {
|
|
103311
|
-
if (typeof process === "object" && process !== null) {
|
|
103312
|
-
return process.stderr;
|
|
103313
|
-
}
|
|
103314
|
-
}
|
|
103315
|
-
function globalProcessExit(code) {
|
|
103316
|
-
if (typeof process === "object" && process !== null && typeof process.exit === "function") {
|
|
103317
|
-
return process.exit(code);
|
|
103318
|
-
}
|
|
103319
|
-
}
|
|
103320
|
-
function handlerExec(list) {
|
|
103321
|
-
return function(arg) {
|
|
103322
|
-
for (var i = 0; i < list.length; i++) {
|
|
103323
|
-
var ret = list[i](arg);
|
|
103324
|
-
if (ret) {
|
|
103325
|
-
return ret;
|
|
103326
|
-
}
|
|
103327
|
-
}
|
|
103328
|
-
return null;
|
|
103329
|
-
};
|
|
103330
|
-
}
|
|
103331
|
-
var retrieveFile = handlerExec(retrieveFileHandlers);
|
|
103332
|
-
retrieveFileHandlers.push(function(path2) {
|
|
103333
|
-
path2 = path2.trim();
|
|
103334
|
-
if (/^file:/.test(path2)) {
|
|
103335
|
-
path2 = path2.replace(/file:\/\/\/(\w:)?/, function(protocol, drive) {
|
|
103336
|
-
return drive ? "" : (
|
|
103337
|
-
// file:///C:/dir/file -> C:/dir/file
|
|
103338
|
-
"/"
|
|
103339
|
-
);
|
|
103340
|
-
});
|
|
103341
|
-
}
|
|
103342
|
-
if (path2 in fileContentsCache) {
|
|
103343
|
-
return fileContentsCache[path2];
|
|
103344
|
-
}
|
|
103345
|
-
var contents = "";
|
|
103346
|
-
try {
|
|
103347
|
-
if (!fs) {
|
|
103348
|
-
var xhr = new XMLHttpRequest();
|
|
103349
|
-
xhr.open(
|
|
103350
|
-
"GET",
|
|
103351
|
-
path2,
|
|
103352
|
-
/** async */
|
|
103353
|
-
false
|
|
103354
|
-
);
|
|
103355
|
-
xhr.send(null);
|
|
103356
|
-
if (xhr.readyState === 4 && xhr.status === 200) {
|
|
103357
|
-
contents = xhr.responseText;
|
|
103358
|
-
}
|
|
103359
|
-
} else if (fs.existsSync(path2)) {
|
|
103360
|
-
contents = fs.readFileSync(path2, "utf8");
|
|
103361
|
-
}
|
|
103362
|
-
} catch (er) {
|
|
103363
|
-
}
|
|
103364
|
-
return fileContentsCache[path2] = contents;
|
|
103365
|
-
});
|
|
103366
|
-
function supportRelativeURL(file, url) {
|
|
103367
|
-
if (!file) return url;
|
|
103368
|
-
var dir = path.dirname(file);
|
|
103369
|
-
var match = /^\w+:\/\/[^\/]*/.exec(dir);
|
|
103370
|
-
var protocol = match ? match[0] : "";
|
|
103371
|
-
var startPath = dir.slice(protocol.length);
|
|
103372
|
-
if (protocol && /^\/\w\:/.test(startPath)) {
|
|
103373
|
-
protocol += "/";
|
|
103374
|
-
return protocol + path.resolve(dir.slice(protocol.length), url).replace(/\\/g, "/");
|
|
103375
|
-
}
|
|
103376
|
-
return protocol + path.resolve(dir.slice(protocol.length), url);
|
|
103377
|
-
}
|
|
103378
|
-
function retrieveSourceMapURL(source) {
|
|
103379
|
-
var fileData;
|
|
103380
|
-
if (isInBrowser()) {
|
|
103381
|
-
try {
|
|
103382
|
-
var xhr = new XMLHttpRequest();
|
|
103383
|
-
xhr.open("GET", source, false);
|
|
103384
|
-
xhr.send(null);
|
|
103385
|
-
fileData = xhr.readyState === 4 ? xhr.responseText : null;
|
|
103386
|
-
var sourceMapHeader = xhr.getResponseHeader("SourceMap") || xhr.getResponseHeader("X-SourceMap");
|
|
103387
|
-
if (sourceMapHeader) {
|
|
103388
|
-
return sourceMapHeader;
|
|
103389
|
-
}
|
|
103390
|
-
} catch (e) {
|
|
103391
|
-
}
|
|
103392
|
-
}
|
|
103393
|
-
fileData = retrieveFile(source);
|
|
103394
|
-
var re = /(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg;
|
|
103395
|
-
var lastMatch, match;
|
|
103396
|
-
while (match = re.exec(fileData)) lastMatch = match;
|
|
103397
|
-
if (!lastMatch) return null;
|
|
103398
|
-
return lastMatch[1];
|
|
103399
|
-
}
|
|
103400
|
-
var retrieveSourceMap = handlerExec(retrieveMapHandlers);
|
|
103401
|
-
retrieveMapHandlers.push(function(source) {
|
|
103402
|
-
var sourceMappingURL = retrieveSourceMapURL(source);
|
|
103403
|
-
if (!sourceMappingURL) return null;
|
|
103404
|
-
var sourceMapData;
|
|
103405
|
-
if (reSourceMap.test(sourceMappingURL)) {
|
|
103406
|
-
var rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(",") + 1);
|
|
103407
|
-
sourceMapData = bufferFrom(rawData, "base64").toString();
|
|
103408
|
-
sourceMappingURL = source;
|
|
103409
|
-
} else {
|
|
103410
|
-
sourceMappingURL = supportRelativeURL(source, sourceMappingURL);
|
|
103411
|
-
sourceMapData = retrieveFile(sourceMappingURL);
|
|
103412
|
-
}
|
|
103413
|
-
if (!sourceMapData) {
|
|
103414
|
-
return null;
|
|
103415
|
-
}
|
|
103416
|
-
return {
|
|
103417
|
-
url: sourceMappingURL,
|
|
103418
|
-
map: sourceMapData
|
|
103419
|
-
};
|
|
103420
|
-
});
|
|
103421
|
-
function mapSourcePosition(position) {
|
|
103422
|
-
var sourceMap = sourceMapCache[position.source];
|
|
103423
|
-
if (!sourceMap) {
|
|
103424
|
-
var urlAndMap = retrieveSourceMap(position.source);
|
|
103425
|
-
if (urlAndMap) {
|
|
103426
|
-
sourceMap = sourceMapCache[position.source] = {
|
|
103427
|
-
url: urlAndMap.url,
|
|
103428
|
-
map: new SourceMapConsumer(urlAndMap.map)
|
|
103429
|
-
};
|
|
103430
|
-
if (sourceMap.map.sourcesContent) {
|
|
103431
|
-
sourceMap.map.sources.forEach(function(source, i) {
|
|
103432
|
-
var contents = sourceMap.map.sourcesContent[i];
|
|
103433
|
-
if (contents) {
|
|
103434
|
-
var url = supportRelativeURL(sourceMap.url, source);
|
|
103435
|
-
fileContentsCache[url] = contents;
|
|
103436
|
-
}
|
|
103437
|
-
});
|
|
103438
|
-
}
|
|
103439
|
-
} else {
|
|
103440
|
-
sourceMap = sourceMapCache[position.source] = {
|
|
103441
|
-
url: null,
|
|
103442
|
-
map: null
|
|
103443
|
-
};
|
|
103444
|
-
}
|
|
103445
|
-
}
|
|
103446
|
-
if (sourceMap && sourceMap.map && typeof sourceMap.map.originalPositionFor === "function") {
|
|
103447
|
-
var originalPosition = sourceMap.map.originalPositionFor(position);
|
|
103448
|
-
if (originalPosition.source !== null) {
|
|
103449
|
-
originalPosition.source = supportRelativeURL(
|
|
103450
|
-
sourceMap.url,
|
|
103451
|
-
originalPosition.source
|
|
103452
|
-
);
|
|
103453
|
-
return originalPosition;
|
|
103454
|
-
}
|
|
103455
|
-
}
|
|
103456
|
-
return position;
|
|
103457
|
-
}
|
|
103458
|
-
function mapEvalOrigin(origin) {
|
|
103459
|
-
var match = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(origin);
|
|
103460
|
-
if (match) {
|
|
103461
|
-
var position = mapSourcePosition({
|
|
103462
|
-
source: match[2],
|
|
103463
|
-
line: +match[3],
|
|
103464
|
-
column: match[4] - 1
|
|
103465
|
-
});
|
|
103466
|
-
return "eval at " + match[1] + " (" + position.source + ":" + position.line + ":" + (position.column + 1) + ")";
|
|
103467
|
-
}
|
|
103468
|
-
match = /^eval at ([^(]+) \((.+)\)$/.exec(origin);
|
|
103469
|
-
if (match) {
|
|
103470
|
-
return "eval at " + match[1] + " (" + mapEvalOrigin(match[2]) + ")";
|
|
103471
|
-
}
|
|
103472
|
-
return origin;
|
|
103473
|
-
}
|
|
103474
|
-
function CallSiteToString() {
|
|
103475
|
-
var fileName;
|
|
103476
|
-
var fileLocation = "";
|
|
103477
|
-
if (this.isNative()) {
|
|
103478
|
-
fileLocation = "native";
|
|
103479
|
-
} else {
|
|
103480
|
-
fileName = this.getScriptNameOrSourceURL();
|
|
103481
|
-
if (!fileName && this.isEval()) {
|
|
103482
|
-
fileLocation = this.getEvalOrigin();
|
|
103483
|
-
fileLocation += ", ";
|
|
103484
|
-
}
|
|
103485
|
-
if (fileName) {
|
|
103486
|
-
fileLocation += fileName;
|
|
103487
|
-
} else {
|
|
103488
|
-
fileLocation += "<anonymous>";
|
|
103489
|
-
}
|
|
103490
|
-
var lineNumber = this.getLineNumber();
|
|
103491
|
-
if (lineNumber != null) {
|
|
103492
|
-
fileLocation += ":" + lineNumber;
|
|
103493
|
-
var columnNumber = this.getColumnNumber();
|
|
103494
|
-
if (columnNumber) {
|
|
103495
|
-
fileLocation += ":" + columnNumber;
|
|
103496
|
-
}
|
|
103497
|
-
}
|
|
103498
|
-
}
|
|
103499
|
-
var line = "";
|
|
103500
|
-
var functionName = this.getFunctionName();
|
|
103501
|
-
var addSuffix = true;
|
|
103502
|
-
var isConstructor = this.isConstructor();
|
|
103503
|
-
var isMethodCall = !(this.isToplevel() || isConstructor);
|
|
103504
|
-
if (isMethodCall) {
|
|
103505
|
-
var typeName = this.getTypeName();
|
|
103506
|
-
if (typeName === "[object Object]") {
|
|
103507
|
-
typeName = "null";
|
|
103508
|
-
}
|
|
103509
|
-
var methodName = this.getMethodName();
|
|
103510
|
-
if (functionName) {
|
|
103511
|
-
if (typeName && functionName.indexOf(typeName) != 0) {
|
|
103512
|
-
line += typeName + ".";
|
|
103513
|
-
}
|
|
103514
|
-
line += functionName;
|
|
103515
|
-
if (methodName && functionName.indexOf("." + methodName) != functionName.length - methodName.length - 1) {
|
|
103516
|
-
line += " [as " + methodName + "]";
|
|
103517
|
-
}
|
|
103518
|
-
} else {
|
|
103519
|
-
line += typeName + "." + (methodName || "<anonymous>");
|
|
103520
|
-
}
|
|
103521
|
-
} else if (isConstructor) {
|
|
103522
|
-
line += "new " + (functionName || "<anonymous>");
|
|
103523
|
-
} else if (functionName) {
|
|
103524
|
-
line += functionName;
|
|
103525
|
-
} else {
|
|
103526
|
-
line += fileLocation;
|
|
103527
|
-
addSuffix = false;
|
|
103528
|
-
}
|
|
103529
|
-
if (addSuffix) {
|
|
103530
|
-
line += " (" + fileLocation + ")";
|
|
103531
|
-
}
|
|
103532
|
-
return line;
|
|
103533
|
-
}
|
|
103534
|
-
function cloneCallSite(frame) {
|
|
103535
|
-
var object = {};
|
|
103536
|
-
Object.getOwnPropertyNames(Object.getPrototypeOf(frame)).forEach(function(name) {
|
|
103537
|
-
object[name] = /^(?:is|get)/.test(name) ? function() {
|
|
103538
|
-
return frame[name].call(frame);
|
|
103539
|
-
} : frame[name];
|
|
103540
|
-
});
|
|
103541
|
-
object.toString = CallSiteToString;
|
|
103542
|
-
return object;
|
|
103543
|
-
}
|
|
103544
|
-
function wrapCallSite(frame, state2) {
|
|
103545
|
-
if (state2 === void 0) {
|
|
103546
|
-
state2 = { nextPosition: null, curPosition: null };
|
|
103547
|
-
}
|
|
103548
|
-
if (frame.isNative()) {
|
|
103549
|
-
state2.curPosition = null;
|
|
103550
|
-
return frame;
|
|
103551
|
-
}
|
|
103552
|
-
var source = frame.getFileName() || frame.getScriptNameOrSourceURL();
|
|
103553
|
-
if (source) {
|
|
103554
|
-
var line = frame.getLineNumber();
|
|
103555
|
-
var column = frame.getColumnNumber() - 1;
|
|
103556
|
-
var noHeader = /^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/;
|
|
103557
|
-
var headerLength = noHeader.test(globalProcessVersion()) ? 0 : 62;
|
|
103558
|
-
if (line === 1 && column > headerLength && !isInBrowser() && !frame.isEval()) {
|
|
103559
|
-
column -= headerLength;
|
|
103560
|
-
}
|
|
103561
|
-
var position = mapSourcePosition({
|
|
103562
|
-
source,
|
|
103563
|
-
line,
|
|
103564
|
-
column
|
|
103565
|
-
});
|
|
103566
|
-
state2.curPosition = position;
|
|
103567
|
-
frame = cloneCallSite(frame);
|
|
103568
|
-
var originalFunctionName = frame.getFunctionName;
|
|
103569
|
-
frame.getFunctionName = function() {
|
|
103570
|
-
if (state2.nextPosition == null) {
|
|
103571
|
-
return originalFunctionName();
|
|
103572
|
-
}
|
|
103573
|
-
return state2.nextPosition.name || originalFunctionName();
|
|
103574
|
-
};
|
|
103575
|
-
frame.getFileName = function() {
|
|
103576
|
-
return position.source;
|
|
103577
|
-
};
|
|
103578
|
-
frame.getLineNumber = function() {
|
|
103579
|
-
return position.line;
|
|
103580
|
-
};
|
|
103581
|
-
frame.getColumnNumber = function() {
|
|
103582
|
-
return position.column + 1;
|
|
103583
|
-
};
|
|
103584
|
-
frame.getScriptNameOrSourceURL = function() {
|
|
103585
|
-
return position.source;
|
|
103586
|
-
};
|
|
103587
|
-
return frame;
|
|
103588
|
-
}
|
|
103589
|
-
var origin = frame.isEval() && frame.getEvalOrigin();
|
|
103590
|
-
if (origin) {
|
|
103591
|
-
origin = mapEvalOrigin(origin);
|
|
103592
|
-
frame = cloneCallSite(frame);
|
|
103593
|
-
frame.getEvalOrigin = function() {
|
|
103594
|
-
return origin;
|
|
103595
|
-
};
|
|
103596
|
-
return frame;
|
|
103597
|
-
}
|
|
103598
|
-
return frame;
|
|
103599
|
-
}
|
|
103600
|
-
function prepareStackTrace(error2, stack) {
|
|
103601
|
-
if (emptyCacheBetweenOperations) {
|
|
103602
|
-
fileContentsCache = {};
|
|
103603
|
-
sourceMapCache = {};
|
|
103604
|
-
}
|
|
103605
|
-
var name = error2.name || "Error";
|
|
103606
|
-
var message = error2.message || "";
|
|
103607
|
-
var errorString = name + ": " + message;
|
|
103608
|
-
var state2 = { nextPosition: null, curPosition: null };
|
|
103609
|
-
var processedStack = [];
|
|
103610
|
-
for (var i = stack.length - 1; i >= 0; i--) {
|
|
103611
|
-
processedStack.push("\n at " + wrapCallSite(stack[i], state2));
|
|
103612
|
-
state2.nextPosition = state2.curPosition;
|
|
103613
|
-
}
|
|
103614
|
-
state2.curPosition = state2.nextPosition = null;
|
|
103615
|
-
return errorString + processedStack.reverse().join("");
|
|
103616
|
-
}
|
|
103617
|
-
function getErrorSource(error2) {
|
|
103618
|
-
var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error2.stack);
|
|
103619
|
-
if (match) {
|
|
103620
|
-
var source = match[1];
|
|
103621
|
-
var line = +match[2];
|
|
103622
|
-
var column = +match[3];
|
|
103623
|
-
var contents = fileContentsCache[source];
|
|
103624
|
-
if (!contents && fs && fs.existsSync(source)) {
|
|
103625
|
-
try {
|
|
103626
|
-
contents = fs.readFileSync(source, "utf8");
|
|
103627
|
-
} catch (er) {
|
|
103628
|
-
contents = "";
|
|
103629
|
-
}
|
|
103630
|
-
}
|
|
103631
|
-
if (contents) {
|
|
103632
|
-
var code = contents.split(/(?:\r\n|\r|\n)/)[line - 1];
|
|
103633
|
-
if (code) {
|
|
103634
|
-
return source + ":" + line + "\n" + code + "\n" + new Array(column).join(" ") + "^";
|
|
103635
|
-
}
|
|
103636
|
-
}
|
|
103637
|
-
}
|
|
103638
|
-
return null;
|
|
103639
|
-
}
|
|
103640
|
-
function printErrorAndExit(error2) {
|
|
103641
|
-
var source = getErrorSource(error2);
|
|
103642
|
-
var stderr = globalProcessStderr();
|
|
103643
|
-
if (stderr && stderr._handle && stderr._handle.setBlocking) {
|
|
103644
|
-
stderr._handle.setBlocking(true);
|
|
103645
|
-
}
|
|
103646
|
-
if (source) {
|
|
103647
|
-
console.error();
|
|
103648
|
-
console.error(source);
|
|
103649
|
-
}
|
|
103650
|
-
console.error(error2.stack);
|
|
103651
|
-
globalProcessExit(1);
|
|
103652
|
-
}
|
|
103653
|
-
function shimEmitUncaughtException() {
|
|
103654
|
-
var origEmit = process.emit;
|
|
103655
|
-
process.emit = function(type) {
|
|
103656
|
-
if (type === "uncaughtException") {
|
|
103657
|
-
var hasStack = arguments[1] && arguments[1].stack;
|
|
103658
|
-
var hasListeners = this.listeners(type).length > 0;
|
|
103659
|
-
if (hasStack && !hasListeners) {
|
|
103660
|
-
return printErrorAndExit(arguments[1]);
|
|
103661
|
-
}
|
|
103662
|
-
}
|
|
103663
|
-
return origEmit.apply(this, arguments);
|
|
103664
|
-
};
|
|
103665
|
-
}
|
|
103666
|
-
var originalRetrieveFileHandlers = retrieveFileHandlers.slice(0);
|
|
103667
|
-
var originalRetrieveMapHandlers = retrieveMapHandlers.slice(0);
|
|
103668
|
-
exports2.wrapCallSite = wrapCallSite;
|
|
103669
|
-
exports2.getErrorSource = getErrorSource;
|
|
103670
|
-
exports2.mapSourcePosition = mapSourcePosition;
|
|
103671
|
-
exports2.retrieveSourceMap = retrieveSourceMap;
|
|
103672
|
-
exports2.install = function(options) {
|
|
103673
|
-
options = options || {};
|
|
103674
|
-
if (options.environment) {
|
|
103675
|
-
environment = options.environment;
|
|
103676
|
-
if (["node", "browser", "auto"].indexOf(environment) === -1) {
|
|
103677
|
-
throw new Error("environment " + environment + " was unknown. Available options are {auto, browser, node}");
|
|
103678
|
-
}
|
|
103679
|
-
}
|
|
103680
|
-
if (options.retrieveFile) {
|
|
103681
|
-
if (options.overrideRetrieveFile) {
|
|
103682
|
-
retrieveFileHandlers.length = 0;
|
|
103683
|
-
}
|
|
103684
|
-
retrieveFileHandlers.unshift(options.retrieveFile);
|
|
103685
|
-
}
|
|
103686
|
-
if (options.retrieveSourceMap) {
|
|
103687
|
-
if (options.overrideRetrieveSourceMap) {
|
|
103688
|
-
retrieveMapHandlers.length = 0;
|
|
103689
|
-
}
|
|
103690
|
-
retrieveMapHandlers.unshift(options.retrieveSourceMap);
|
|
103691
|
-
}
|
|
103692
|
-
if (options.hookRequire && !isInBrowser()) {
|
|
103693
|
-
var Module = dynamicRequire(module2, "module");
|
|
103694
|
-
var $compile = Module.prototype._compile;
|
|
103695
|
-
if (!$compile.__sourceMapSupport) {
|
|
103696
|
-
Module.prototype._compile = function(content, filename) {
|
|
103697
|
-
fileContentsCache[filename] = content;
|
|
103698
|
-
sourceMapCache[filename] = void 0;
|
|
103699
|
-
return $compile.call(this, content, filename);
|
|
103700
|
-
};
|
|
103701
|
-
Module.prototype._compile.__sourceMapSupport = true;
|
|
103702
|
-
}
|
|
103703
|
-
}
|
|
103704
|
-
if (!emptyCacheBetweenOperations) {
|
|
103705
|
-
emptyCacheBetweenOperations = "emptyCacheBetweenOperations" in options ? options.emptyCacheBetweenOperations : false;
|
|
103706
|
-
}
|
|
103707
|
-
if (!errorFormatterInstalled) {
|
|
103708
|
-
errorFormatterInstalled = true;
|
|
103709
|
-
Error.prepareStackTrace = prepareStackTrace;
|
|
103710
|
-
}
|
|
103711
|
-
if (!uncaughtShimInstalled) {
|
|
103712
|
-
var installHandler = "handleUncaughtExceptions" in options ? options.handleUncaughtExceptions : true;
|
|
103713
|
-
try {
|
|
103714
|
-
var worker_threads = dynamicRequire(module2, "worker_threads");
|
|
103715
|
-
if (worker_threads.isMainThread === false) {
|
|
103716
|
-
installHandler = false;
|
|
103717
|
-
}
|
|
103718
|
-
} catch (e) {
|
|
103719
|
-
}
|
|
103720
|
-
if (installHandler && hasGlobalProcessEventEmitter()) {
|
|
103721
|
-
uncaughtShimInstalled = true;
|
|
103722
|
-
shimEmitUncaughtException();
|
|
103723
|
-
}
|
|
103724
|
-
}
|
|
103725
|
-
};
|
|
103726
|
-
exports2.resetRetrieveHandlers = function() {
|
|
103727
|
-
retrieveFileHandlers.length = 0;
|
|
103728
|
-
retrieveMapHandlers.length = 0;
|
|
103729
|
-
retrieveFileHandlers = originalRetrieveFileHandlers.slice(0);
|
|
103730
|
-
retrieveMapHandlers = originalRetrieveMapHandlers.slice(0);
|
|
103731
|
-
retrieveSourceMap = handlerExec(retrieveMapHandlers);
|
|
103732
|
-
retrieveFile = handlerExec(retrieveFileHandlers);
|
|
103733
|
-
};
|
|
103734
|
-
}
|
|
103735
|
-
});
|
|
103736
|
-
|
|
103737
101534
|
// ../../node_modules/typescript/lib/typescript.js
|
|
103738
101535
|
var require_typescript = __commonJS({
|
|
103739
101536
|
"../../node_modules/typescript/lib/typescript.js"(exports2, module2) {
|
|
@@ -112390,7 +110187,7 @@ ${lanes.join("\n")}
|
|
|
112390
110187
|
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(?:inspect|debug)(?:-brk)?(?:=\d+)?$/i.test(arg)) || !!process.recordreplay,
|
|
112391
110188
|
tryEnableSourceMapsForHost() {
|
|
112392
110189
|
try {
|
|
112393
|
-
|
|
110190
|
+
require("source-map-support").install();
|
|
112394
110191
|
} catch {
|
|
112395
110192
|
}
|
|
112396
110193
|
},
|
|
@@ -340925,7 +338722,7 @@ var require_decoder = __commonJS({
|
|
|
340925
338722
|
});
|
|
340926
338723
|
|
|
340927
338724
|
// ../../node_modules/adm-zip/util/index.js
|
|
340928
|
-
var
|
|
338725
|
+
var require_util4 = __commonJS({
|
|
340929
338726
|
"../../node_modules/adm-zip/util/index.js"(exports2, module2) {
|
|
340930
338727
|
"use strict";
|
|
340931
338728
|
module2.exports = require_utils2();
|
|
@@ -340940,7 +338737,7 @@ var require_util5 = __commonJS({
|
|
|
340940
338737
|
var require_entryHeader = __commonJS({
|
|
340941
338738
|
"../../node_modules/adm-zip/headers/entryHeader.js"(exports2, module2) {
|
|
340942
338739
|
"use strict";
|
|
340943
|
-
var Utils =
|
|
338740
|
+
var Utils = require_util4();
|
|
340944
338741
|
var Constants = Utils.Constants;
|
|
340945
338742
|
module2.exports = function() {
|
|
340946
338743
|
var _verMade = 20, _version = 10, _flags = 0, _method = 0, _time = 0, _crc = 0, _compressedSize = 0, _size = 0, _fnameLen = 0, _extraLen = 0, _comLen = 0, _diskStart = 0, _inattr = 0, _attr = 0, _offset = 0;
|
|
@@ -341211,7 +339008,7 @@ var require_entryHeader = __commonJS({
|
|
|
341211
339008
|
var require_mainHeader = __commonJS({
|
|
341212
339009
|
"../../node_modules/adm-zip/headers/mainHeader.js"(exports2, module2) {
|
|
341213
339010
|
"use strict";
|
|
341214
|
-
var Utils =
|
|
339011
|
+
var Utils = require_util4();
|
|
341215
339012
|
var Constants = Utils.Constants;
|
|
341216
339013
|
module2.exports = function() {
|
|
341217
339014
|
var _volumeEntries = 0, _totalEntries = 0, _size = 0, _offset = 0, _commentLength = 0;
|
|
@@ -341509,7 +339306,7 @@ var require_methods = __commonJS({
|
|
|
341509
339306
|
var require_zipEntry = __commonJS({
|
|
341510
339307
|
"../../node_modules/adm-zip/zipEntry.js"(exports2, module2) {
|
|
341511
339308
|
"use strict";
|
|
341512
|
-
var Utils =
|
|
339309
|
+
var Utils = require_util4();
|
|
341513
339310
|
var Headers = require_headers3();
|
|
341514
339311
|
var Constants = Utils.Constants;
|
|
341515
339312
|
var Methods = require_methods();
|
|
@@ -341843,7 +339640,7 @@ var require_zipFile = __commonJS({
|
|
|
341843
339640
|
"use strict";
|
|
341844
339641
|
var ZipEntry = require_zipEntry();
|
|
341845
339642
|
var Headers = require_headers3();
|
|
341846
|
-
var Utils =
|
|
339643
|
+
var Utils = require_util4();
|
|
341847
339644
|
module2.exports = function(inBuffer, options) {
|
|
341848
339645
|
var entryList = [], entryTable = {}, _comment = Buffer.alloc(0), mainHeader = new Headers.MainHeader(), loadedEntries = false;
|
|
341849
339646
|
var password = null;
|
|
@@ -342188,7 +339985,7 @@ var require_zipFile = __commonJS({
|
|
|
342188
339985
|
var require_adm_zip = __commonJS({
|
|
342189
339986
|
"../../node_modules/adm-zip/adm-zip.js"(exports2, module2) {
|
|
342190
339987
|
"use strict";
|
|
342191
|
-
var Utils =
|
|
339988
|
+
var Utils = require_util4();
|
|
342192
339989
|
var pth = require("path");
|
|
342193
339990
|
var ZipEntry = require_zipEntry();
|
|
342194
339991
|
var ZipFile = require_zipFile();
|
|
@@ -353821,7 +351618,7 @@ var require_package4 = __commonJS({
|
|
|
353821
351618
|
"package.json"(exports2, module2) {
|
|
353822
351619
|
module2.exports = {
|
|
353823
351620
|
name: "@validate.qa/runner",
|
|
353824
|
-
version: "1.0.
|
|
351621
|
+
version: "1.0.87",
|
|
353825
351622
|
description: "validate local test runner - execute Playwright tests on your machine, connected to validate.qa cloud.",
|
|
353826
351623
|
bin: {
|
|
353827
351624
|
"validate-runner": "dist/cli.js"
|
|
@@ -362164,8 +359961,13 @@ var RunnerUpgradeRequiredError = class extends Error {
|
|
|
362164
359961
|
this.latestVersion = latestVersion;
|
|
362165
359962
|
}
|
|
362166
359963
|
};
|
|
359964
|
+
var PENDING_POLL_TIMEOUT_MS = Math.max(15e3, envInt("VALIDATE_RUNNER_PENDING_TIMEOUT_MS", 9e4));
|
|
359965
|
+
var POLL_STUCK_RECYCLE_MS = Math.max(6e4, envInt("VALIDATE_RUNNER_POLL_STUCK_MS", 5 * 6e4));
|
|
362167
359966
|
async function fetchPendingRuns(serverUrl, headers) {
|
|
362168
|
-
const res = await fetch(`${serverUrl}/api/runner/pending`, {
|
|
359967
|
+
const res = await fetch(`${serverUrl}/api/runner/pending`, {
|
|
359968
|
+
headers,
|
|
359969
|
+
signal: AbortSignal.timeout(PENDING_POLL_TIMEOUT_MS)
|
|
359970
|
+
});
|
|
362169
359971
|
if (!res.ok) {
|
|
362170
359972
|
if (res.status === 401) throw new Error("Runner token is invalid or expired. Run: validate.qa-runner login");
|
|
362171
359973
|
if (res.status === 426) {
|
|
@@ -365578,10 +363380,12 @@ async function startRunner(opts) {
|
|
|
365578
363380
|
log.dim(line);
|
|
365579
363381
|
};
|
|
365580
363382
|
let lastPendingSummary = "";
|
|
363383
|
+
let lastSuccessfulPollAt = Date.now();
|
|
365581
363384
|
while (!shuttingDown) {
|
|
365582
363385
|
try {
|
|
365583
363386
|
if (activeRuns < MAX_CONCURRENT) {
|
|
365584
363387
|
const pending = await fetchPendingRuns(serverUrl, headers);
|
|
363388
|
+
lastSuccessfulPollAt = Date.now();
|
|
365585
363389
|
{
|
|
365586
363390
|
const pendingIds = new Set(pending.map((r) => r.runId));
|
|
365587
363391
|
for (const id of [...deferralLogged.keys()]) {
|
|
@@ -365786,6 +363590,8 @@ async function startRunner(opts) {
|
|
|
365786
363590
|
}
|
|
365787
363591
|
}
|
|
365788
363592
|
consecutivePollErrors = 0;
|
|
363593
|
+
} else {
|
|
363594
|
+
lastSuccessfulPollAt = Date.now();
|
|
365789
363595
|
}
|
|
365790
363596
|
} catch (err) {
|
|
365791
363597
|
if (err instanceof RunnerUpgradeRequiredError) {
|
|
@@ -365794,6 +363600,13 @@ async function startRunner(opts) {
|
|
|
365794
363600
|
}
|
|
365795
363601
|
const message = err instanceof Error ? err.message : String(err);
|
|
365796
363602
|
consecutivePollErrors++;
|
|
363603
|
+
const stuckForMs = Date.now() - lastSuccessfulPollAt;
|
|
363604
|
+
if (stuckForMs >= POLL_STUCK_RECYCLE_MS) {
|
|
363605
|
+
log.warn(
|
|
363606
|
+
`Poll stuck for ${Math.round(stuckForMs / 1e3)}s (>= ${Math.round(POLL_STUCK_RECYCLE_MS / 1e3)}s) after error: ${message}. Recycling runner process so the supervisor can restart with a clean loop; orphaned work is re-queued server-side.`
|
|
363607
|
+
);
|
|
363608
|
+
process.exit(78);
|
|
363609
|
+
}
|
|
365797
363610
|
const backoffMs = Math.min(pollIntervalMs * Math.pow(2, consecutivePollErrors - 1), MAX_BACKOFF_MS);
|
|
365798
363611
|
if (consecutivePollErrors > 1) {
|
|
365799
363612
|
log.warn(`Poll error #${consecutivePollErrors} (${message}) - backing off for ${(backoffMs / 1e3).toFixed(1)}s`);
|
|
@@ -365846,7 +363659,76 @@ program.command("login").description("Save runner credentials for future use").r
|
|
|
365846
363659
|
console.log("");
|
|
365847
363660
|
console.log("Run: validate-runner start");
|
|
365848
363661
|
});
|
|
365849
|
-
|
|
363662
|
+
async function superviseRunnerStart(argv) {
|
|
363663
|
+
const { spawn: spawn2 } = await import("child_process");
|
|
363664
|
+
const minBackoffMs = 2e3;
|
|
363665
|
+
const maxBackoffMs = 6e4;
|
|
363666
|
+
let backoffMs = minBackoffMs;
|
|
363667
|
+
let restarts = 0;
|
|
363668
|
+
const windowStart = Date.now();
|
|
363669
|
+
const maxRestartsPerHour = Math.max(1, Number(process.env.VALIDATE_RUNNER_MAX_RESTARTS_PER_HOUR || 30));
|
|
363670
|
+
const childEnv = { ...process.env, VALIDATE_RUNNER_SUPERVISED_CHILD: "1" };
|
|
363671
|
+
const runOnce = () => new Promise((resolve2) => {
|
|
363672
|
+
const child = spawn2(process.execPath, argv, {
|
|
363673
|
+
stdio: "inherit",
|
|
363674
|
+
env: childEnv
|
|
363675
|
+
});
|
|
363676
|
+
const onSignal = (sig) => {
|
|
363677
|
+
try {
|
|
363678
|
+
child.kill(sig);
|
|
363679
|
+
} catch {
|
|
363680
|
+
}
|
|
363681
|
+
};
|
|
363682
|
+
process.once("SIGINT", onSignal);
|
|
363683
|
+
process.once("SIGTERM", onSignal);
|
|
363684
|
+
child.on("exit", (code, signal) => {
|
|
363685
|
+
process.removeListener("SIGINT", onSignal);
|
|
363686
|
+
process.removeListener("SIGTERM", onSignal);
|
|
363687
|
+
if (signal === "SIGINT" || signal === "SIGTERM") {
|
|
363688
|
+
resolve2(0);
|
|
363689
|
+
return;
|
|
363690
|
+
}
|
|
363691
|
+
resolve2(code ?? 1);
|
|
363692
|
+
});
|
|
363693
|
+
});
|
|
363694
|
+
const childArgv = argv.filter((a) => a !== "--supervise" && a !== "--no-supervise");
|
|
363695
|
+
console.log("\u{1F6E1} Runner supervisor enabled \u2014 will auto-restart on crash/stuck exit");
|
|
363696
|
+
console.log(" (disable with --no-supervise or VALIDATE_RUNNER_SUPERVISE=0)");
|
|
363697
|
+
for (; ; ) {
|
|
363698
|
+
const code = await runOnce();
|
|
363699
|
+
if (code === 0) {
|
|
363700
|
+
process.exit(0);
|
|
363701
|
+
}
|
|
363702
|
+
restarts += 1;
|
|
363703
|
+
const elapsedH = (Date.now() - windowStart) / 36e5;
|
|
363704
|
+
if (elapsedH < 1 && restarts > maxRestartsPerHour) {
|
|
363705
|
+
console.error(
|
|
363706
|
+
`\u2717 Supervisor: ${restarts} restarts in under 1h (cap ${maxRestartsPerHour}). Stopping to avoid a crash loop. Fix the underlying issue and re-run start.`
|
|
363707
|
+
);
|
|
363708
|
+
process.exit(1);
|
|
363709
|
+
}
|
|
363710
|
+
console.warn(
|
|
363711
|
+
`\u26A0 Runner exited with code ${code} \u2014 restarting in ${(backoffMs / 1e3).toFixed(1)}s (restart #${restarts}). Server will re-queue orphaned work; pending jobs resume automatically.`
|
|
363712
|
+
);
|
|
363713
|
+
await new Promise((r) => setTimeout(r, backoffMs));
|
|
363714
|
+
backoffMs = Math.min(maxBackoffMs, Math.round(backoffMs * 1.5));
|
|
363715
|
+
}
|
|
363716
|
+
}
|
|
363717
|
+
function shouldSupervise(opts) {
|
|
363718
|
+
if (opts.supervise === false) return false;
|
|
363719
|
+
if (opts.supervise === true) return true;
|
|
363720
|
+
if (process.env.VALIDATE_RUNNER_SUPERVISED_CHILD === "1") return false;
|
|
363721
|
+
if (process.env.RUNNER_CLOUD === "true") return false;
|
|
363722
|
+
const env = (process.env.VALIDATE_RUNNER_SUPERVISE ?? "1").trim().toLowerCase();
|
|
363723
|
+
return env !== "0" && env !== "false" && env !== "off" && env !== "no";
|
|
363724
|
+
}
|
|
363725
|
+
program.command("start").description("Start the local test runner").option("--token <token>", "Runner token (overrides saved credentials)").option("--server <url>", "Server URL (overrides saved credentials)").option("--project <id>", "Project ID (overrides saved credentials)").option("--mode <mode>", "Runner mode: playwright-native (default)", "playwright-native").option("--poll-interval <ms>", "Poll interval in milliseconds", "2000").option("--mobile", "Enable mobile testing (Appium + mobile bridge server)").option("--tunnel", "Enable ngrok tunnel for mobile bridge (allows HTTPS dashboard to connect)").option("--supervise", "Auto-restart the runner if it crashes or self-recycles (default for local)").option("--no-supervise", "Disable auto-restart supervisor").action(async (opts) => {
|
|
363726
|
+
if (shouldSupervise(opts)) {
|
|
363727
|
+
const argv = [...process.argv.slice(1)];
|
|
363728
|
+
if (!argv.includes("--no-supervise")) argv.push("--no-supervise");
|
|
363729
|
+
await superviseRunnerStart(argv);
|
|
363730
|
+
return;
|
|
363731
|
+
}
|
|
365850
363732
|
await requireLatestRunner();
|
|
365851
363733
|
const saved = loadCredentials();
|
|
365852
363734
|
const authToken = opts.token || process.env.AUTH_TOKEN || saved?.token;
|