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