@diffci.com/diffci 0.3.64 → 0.3.66

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 (110) hide show
  1. package/dist-client/src/client/isolated-worktree.d.ts +16 -0
  2. package/dist-client/src/client/isolated-worktree.js +67 -1
  3. package/dist-client/src/client/mcp.js +14 -0
  4. package/dist-client/src/client/telemetry.d.ts +1 -1
  5. package/dist-client/src/client/telemetry.js +2 -1
  6. package/dist-client/src/client/usage-signal.d.ts +10 -2
  7. package/dist-client/src/client/usage-signal.js +11 -0
  8. package/node_modules/@babel/helper-string-parser/lib/index.js +15 -6
  9. package/node_modules/@babel/helper-string-parser/lib/index.js.map +1 -1
  10. package/node_modules/@babel/helper-string-parser/package.json +1 -1
  11. package/node_modules/@babel/parser/lib/index.js +326 -93
  12. package/node_modules/@babel/parser/lib/index.js.map +1 -1
  13. package/node_modules/@babel/parser/package.json +3 -3
  14. package/node_modules/@babel/parser/typings/babel-parser.d.ts +23 -25
  15. package/node_modules/@babel/types/lib/ast-types/generated/index.js.map +1 -1
  16. package/node_modules/@babel/types/lib/clone/cloneNode.js.map +1 -1
  17. package/node_modules/@babel/types/lib/definitions/core.js +4 -0
  18. package/node_modules/@babel/types/lib/definitions/core.js.map +1 -1
  19. package/node_modules/@babel/types/lib/index-legacy.d.ts +1 -0
  20. package/node_modules/@babel/types/lib/index.d.ts +5 -5
  21. package/node_modules/@babel/types/lib/index.js.flow +1 -0
  22. package/node_modules/@babel/types/lib/validators/is.js.map +1 -1
  23. package/node_modules/@babel/types/lib/validators/isSpecifierDefault.js +5 -1
  24. package/node_modules/@babel/types/lib/validators/isSpecifierDefault.js.map +1 -1
  25. package/node_modules/@babel/types/package.json +4 -4
  26. package/node_modules/@diffci.com/core/README.md +1 -1
  27. package/node_modules/@diffci.com/core/dist/git/git-diff.js +7 -4
  28. package/node_modules/@diffci.com/core/dist/git/git-diff.js.map +1 -1
  29. package/node_modules/@diffci.com/core/dist/git/types.d.ts +4 -0
  30. package/node_modules/@diffci.com/core/dist/repo/adapters/maven.js +16 -10
  31. package/node_modules/@diffci.com/core/dist/repo/adapters/maven.js.map +1 -1
  32. package/node_modules/@diffci.com/core/dist/repo/graph.js +8 -3
  33. package/node_modules/@diffci.com/core/dist/repo/graph.js.map +1 -1
  34. package/node_modules/@diffci.com/core/dist/repo/impact.js +4 -1
  35. package/node_modules/@diffci.com/core/dist/repo/impact.js.map +1 -1
  36. package/node_modules/@diffci.com/core/dist/repo/npm-lockfile.d.ts +11 -0
  37. package/node_modules/@diffci.com/core/dist/repo/npm-lockfile.js +45 -0
  38. package/node_modules/@diffci.com/core/dist/repo/npm-lockfile.js.map +1 -1
  39. package/node_modules/@diffci.com/core/package.json +1 -1
  40. package/node_modules/@diffci.com/core/src/git/git-diff.ts +6 -4
  41. package/node_modules/@diffci.com/core/src/git/types.ts +4 -0
  42. package/node_modules/@diffci.com/core/src/repo/adapters/maven.ts +16 -9
  43. package/node_modules/@diffci.com/core/src/repo/graph.ts +8 -3
  44. package/node_modules/@diffci.com/core/src/repo/impact.ts +4 -1
  45. package/node_modules/@diffci.com/core/src/repo/npm-lockfile.ts +39 -0
  46. package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +115 -71
  47. package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +2 -2
  48. package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js +115 -71
  49. package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map +2 -2
  50. package/node_modules/@jridgewell/sourcemap-codec/package.json +2 -1
  51. package/node_modules/@jridgewell/sourcemap-codec/src/range-mappings.ts +47 -0
  52. package/node_modules/@jridgewell/sourcemap-codec/src/scopes.ts +66 -46
  53. package/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts +27 -11
  54. package/node_modules/@jridgewell/sourcemap-codec/src/vlq.ts +13 -17
  55. package/node_modules/@jridgewell/sourcemap-codec/types/range-mappings.d.cts +5 -0
  56. package/node_modules/@jridgewell/sourcemap-codec/types/range-mappings.d.cts.map +1 -0
  57. package/node_modules/@jridgewell/sourcemap-codec/types/range-mappings.d.mts +5 -0
  58. package/node_modules/@jridgewell/sourcemap-codec/types/range-mappings.d.mts.map +1 -0
  59. package/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts.map +1 -1
  60. package/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts.map +1 -1
  61. package/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts +2 -0
  62. package/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts.map +1 -1
  63. package/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts +2 -0
  64. package/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts.map +1 -1
  65. package/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts +4 -2
  66. package/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts.map +1 -1
  67. package/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts +4 -2
  68. package/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts.map +1 -1
  69. package/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js +6 -2
  70. package/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6 -2
  71. package/node_modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js +6 -2
  72. package/node_modules/@vue/compiler-core/package.json +4 -4
  73. package/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js +8 -8
  74. package/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +8 -8
  75. package/node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +14 -14
  76. package/node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +2 -2
  77. package/node_modules/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +1 -1
  78. package/node_modules/@vue/compiler-dom/dist/compiler-dom.global.js +14 -14
  79. package/node_modules/@vue/compiler-dom/dist/compiler-dom.global.prod.js +2 -2
  80. package/node_modules/@vue/compiler-dom/package.json +3 -3
  81. package/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +1847 -1370
  82. package/node_modules/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +6462 -6187
  83. package/node_modules/@vue/compiler-sfc/package.json +11 -11
  84. package/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +32 -9
  85. package/node_modules/@vue/compiler-ssr/package.json +3 -3
  86. package/node_modules/@vue/shared/dist/shared.cjs.js +11 -15
  87. package/node_modules/@vue/shared/dist/shared.cjs.prod.js +11 -15
  88. package/node_modules/@vue/shared/dist/shared.esm-bundler.js +11 -15
  89. package/node_modules/@vue/shared/package.json +1 -1
  90. package/node_modules/postcss/lib/css-syntax-error.js +6 -4
  91. package/node_modules/postcss/lib/declaration.d.ts +2 -2
  92. package/node_modules/postcss/lib/map-generator.js +12 -2
  93. package/node_modules/postcss/lib/processor.js +1 -1
  94. package/node_modules/postcss/lib/tokenize.js +6 -13
  95. package/node_modules/postcss/package.json +1 -1
  96. package/node_modules/source-map-js/README.md +192 -176
  97. package/node_modules/source-map-js/lib/array-set.js +5 -3
  98. package/node_modules/source-map-js/lib/base64-vlq.js +5 -9
  99. package/node_modules/source-map-js/lib/base64.js +13 -12
  100. package/node_modules/source-map-js/lib/binary-search.js +10 -6
  101. package/node_modules/source-map-js/lib/mapping-list.js +12 -7
  102. package/node_modules/source-map-js/lib/quick-sort.js +93 -23
  103. package/node_modules/source-map-js/lib/source-map-consumer.js +272 -194
  104. package/node_modules/source-map-js/lib/source-map-generator.js +146 -106
  105. package/node_modules/source-map-js/lib/source-node.js +144 -118
  106. package/node_modules/source-map-js/lib/util.js +56 -37
  107. package/node_modules/source-map-js/package.json +14 -7
  108. package/node_modules/source-map-js/source-map.d.ts +177 -63
  109. package/node_modules/source-map-js/source-map.js +4 -2
  110. package/package.json +3 -3
@@ -30,9 +30,9 @@ function SourceMapConsumer(aSourceMap, aSourceMapURL) {
30
30
  : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
31
31
  }
32
32
 
33
- SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {
33
+ SourceMapConsumer.fromSourceMap = function (aSourceMap, aSourceMapURL) {
34
34
  return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
35
- }
35
+ };
36
36
 
37
37
  /**
38
38
  * The version of the source mapping spec that we are consuming.
@@ -79,7 +79,7 @@ Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
79
79
  }
80
80
 
81
81
  return this.__generatedMappings;
82
- }
82
+ },
83
83
  });
84
84
 
85
85
  SourceMapConsumer.prototype.__originalMappings = null;
@@ -92,13 +92,13 @@ Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
92
92
  }
93
93
 
94
94
  return this.__originalMappings;
95
- }
95
+ },
96
96
  });
97
97
 
98
98
  SourceMapConsumer.prototype._charIsMappingSeparator =
99
99
  function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
100
100
  var c = aStr.charAt(index);
101
- return c === ";" || c === ",";
101
+ return c === ';' || c === ',';
102
102
  };
103
103
 
104
104
  /**
@@ -108,7 +108,7 @@ SourceMapConsumer.prototype._charIsMappingSeparator =
108
108
  */
109
109
  SourceMapConsumer.prototype._parseMappings =
110
110
  function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
111
- throw new Error("Subclasses must implement _parseMappings");
111
+ throw new Error('Subclasses must implement _parseMappings');
112
112
  };
113
113
 
114
114
  SourceMapConsumer.GENERATED_ORDER = 1;
@@ -140,14 +140,14 @@ SourceMapConsumer.prototype.eachMapping =
140
140
 
141
141
  var mappings;
142
142
  switch (order) {
143
- case SourceMapConsumer.GENERATED_ORDER:
144
- mappings = this._generatedMappings;
145
- break;
146
- case SourceMapConsumer.ORIGINAL_ORDER:
147
- mappings = this._originalMappings;
148
- break;
149
- default:
150
- throw new Error("Unknown order of iteration.");
143
+ case SourceMapConsumer.GENERATED_ORDER:
144
+ mappings = this._generatedMappings;
145
+ break;
146
+ case SourceMapConsumer.ORIGINAL_ORDER:
147
+ mappings = this._originalMappings;
148
+ break;
149
+ default:
150
+ throw new Error('Unknown order of iteration.');
151
151
  }
152
152
 
153
153
  var sourceRoot = this.sourceRoot;
@@ -159,7 +159,7 @@ SourceMapConsumer.prototype.eachMapping =
159
159
  for (var i = 0, n = mappings.length; i < n; i++) {
160
160
  var mapping = mappings[i];
161
161
  var source = mapping.source === null ? null : sources.at(mapping.source);
162
- if(source !== null) {
162
+ if (source !== null) {
163
163
  source = util.computeSourceURL(sourceRoot, source, sourceMapURL);
164
164
  }
165
165
  boundCallback({
@@ -168,7 +168,7 @@ SourceMapConsumer.prototype.eachMapping =
168
168
  generatedColumn: mapping.generatedColumn,
169
169
  originalLine: mapping.originalLine,
170
170
  originalColumn: mapping.originalColumn,
171
- name: mapping.name === null ? null : names.at(mapping.name)
171
+ name: mapping.name === null ? null : names.at(mapping.name),
172
172
  });
173
173
  }
174
174
  };
@@ -206,7 +206,7 @@ SourceMapConsumer.prototype.allGeneratedPositionsFor =
206
206
  var needle = {
207
207
  source: util.getArg(aArgs, 'source'),
208
208
  originalLine: line,
209
- originalColumn: util.getArg(aArgs, 'column', 0)
209
+ originalColumn: util.getArg(aArgs, 'column', 0),
210
210
  };
211
211
 
212
212
  needle.source = this._findSourceIndex(needle.source);
@@ -216,12 +216,14 @@ SourceMapConsumer.prototype.allGeneratedPositionsFor =
216
216
 
217
217
  var mappings = [];
218
218
 
219
- var index = this._findMapping(needle,
220
- this._originalMappings,
221
- "originalLine",
222
- "originalColumn",
223
- util.compareByOriginalPositions,
224
- binarySearch.LEAST_UPPER_BOUND);
219
+ var index = this._findMapping(
220
+ needle,
221
+ this._originalMappings,
222
+ 'originalLine',
223
+ 'originalColumn',
224
+ util.compareByOriginalPositions,
225
+ binarySearch.LEAST_UPPER_BOUND
226
+ );
225
227
  if (index >= 0) {
226
228
  var mapping = this._originalMappings[index];
227
229
 
@@ -229,14 +231,20 @@ SourceMapConsumer.prototype.allGeneratedPositionsFor =
229
231
  var originalLine = mapping.originalLine;
230
232
 
231
233
  // Iterate until either we run out of mappings, or we run into
232
- // a mapping for a different line than the one we found. Since
233
- // mappings are sorted, this is guaranteed to find all mappings for
234
- // the line we found.
235
- while (mapping && mapping.originalLine === originalLine) {
234
+ // a mapping for a different source or line than the one we found.
235
+ // Since mappings are sorted, this is guaranteed to find all mappings
236
+ // for the line we found. The source check also stops the search from
237
+ // continuing into the next source's mappings when this source has
238
+ // none at or after the requested line.
239
+ while (
240
+ mapping &&
241
+ mapping.source === needle.source &&
242
+ mapping.originalLine === originalLine
243
+ ) {
236
244
  mappings.push({
237
245
  line: util.getArg(mapping, 'generatedLine', null),
238
246
  column: util.getArg(mapping, 'generatedColumn', null),
239
- lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
247
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null),
240
248
  });
241
249
 
242
250
  mapping = this._originalMappings[++index];
@@ -245,16 +253,19 @@ SourceMapConsumer.prototype.allGeneratedPositionsFor =
245
253
  var originalColumn = mapping.originalColumn;
246
254
 
247
255
  // Iterate until either we run out of mappings, or we run into
248
- // a mapping for a different line than the one we were searching for.
249
- // Since mappings are sorted, this is guaranteed to find all mappings for
250
- // the line we are searching for.
251
- while (mapping &&
252
- mapping.originalLine === line &&
253
- mapping.originalColumn == originalColumn) {
256
+ // a mapping for a different source or line than the one we were
257
+ // searching for. Since mappings are sorted, this is guaranteed to find
258
+ // all mappings for the line we are searching for.
259
+ while (
260
+ mapping &&
261
+ mapping.source === needle.source &&
262
+ mapping.originalLine === line &&
263
+ mapping.originalColumn == originalColumn
264
+ ) {
254
265
  mappings.push({
255
266
  line: util.getArg(mapping, 'generatedLine', null),
256
267
  column: util.getArg(mapping, 'generatedColumn', null),
257
- lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
268
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null),
258
269
  });
259
270
 
260
271
  mapping = this._originalMappings[++index];
@@ -338,7 +349,9 @@ function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
338
349
  // be particularly problematic when the source root is a prefix of the
339
350
  // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
340
351
  .map(function (source) {
341
- return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
352
+ return sourceRoot &&
353
+ util.isAbsolute(sourceRoot) &&
354
+ util.isAbsolute(source)
342
355
  ? util.relative(sourceRoot, source)
343
356
  : source;
344
357
  });
@@ -368,7 +381,7 @@ BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
368
381
  * Utility function to find the index of a source. Returns -1 if not
369
382
  * found.
370
383
  */
371
- BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
384
+ BasicSourceMapConsumer.prototype._findSourceIndex = function (aSource) {
372
385
  var relativeSource = aSource;
373
386
  if (this.sourceRoot != null) {
374
387
  relativeSource = util.relative(this.sourceRoot, relativeSource);
@@ -399,55 +412,65 @@ BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
399
412
  * The URL at which the source map can be found (optional)
400
413
  * @returns BasicSourceMapConsumer
401
414
  */
402
- BasicSourceMapConsumer.fromSourceMap =
403
- function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
404
- var smc = Object.create(BasicSourceMapConsumer.prototype);
405
-
406
- var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
407
- var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
408
- smc.sourceRoot = aSourceMap._sourceRoot;
409
- smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
410
- smc.sourceRoot);
411
- smc.file = aSourceMap._file;
412
- smc._sourceMapURL = aSourceMapURL;
413
- smc._absoluteSources = smc._sources.toArray().map(function (s) {
414
- return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
415
- });
415
+ BasicSourceMapConsumer.fromSourceMap = function SourceMapConsumer_fromSourceMap(
416
+ aSourceMap,
417
+ aSourceMapURL
418
+ ) {
419
+ var smc = Object.create(BasicSourceMapConsumer.prototype);
420
+
421
+ var names = (smc._names = ArraySet.fromArray(
422
+ aSourceMap._names.toArray(),
423
+ true
424
+ ));
425
+ var sources = (smc._sources = ArraySet.fromArray(
426
+ aSourceMap._sources.toArray(),
427
+ true
428
+ ));
429
+ smc.sourceRoot = aSourceMap._sourceRoot;
430
+ smc.sourcesContent = aSourceMap._generateSourcesContent(
431
+ smc._sources.toArray(),
432
+ smc.sourceRoot
433
+ );
434
+ smc.file = aSourceMap._file;
435
+ smc._sourceMapURL = aSourceMapURL;
436
+ smc._absoluteSources = smc._sources.toArray().map(function (s) {
437
+ return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
438
+ });
416
439
 
417
- // Because we are modifying the entries (by converting string sources and
418
- // names to indices into the sources and names ArraySets), we have to make
419
- // a copy of the entry or else bad things happen. Shared mutable state
420
- // strikes again! See github issue #191.
440
+ // Because we are modifying the entries (by converting string sources and
441
+ // names to indices into the sources and names ArraySets), we have to make
442
+ // a copy of the entry or else bad things happen. Shared mutable state
443
+ // strikes again! See github issue #191.
421
444
 
422
- var generatedMappings = aSourceMap._mappings.toArray().slice();
423
- var destGeneratedMappings = smc.__generatedMappings = [];
424
- var destOriginalMappings = smc.__originalMappings = [];
445
+ var generatedMappings = aSourceMap._mappings.toArray().slice();
446
+ var destGeneratedMappings = (smc.__generatedMappings = []);
447
+ var destOriginalMappings = (smc.__originalMappings = []);
425
448
 
426
- for (var i = 0, length = generatedMappings.length; i < length; i++) {
427
- var srcMapping = generatedMappings[i];
428
- var destMapping = new Mapping;
429
- destMapping.generatedLine = srcMapping.generatedLine;
430
- destMapping.generatedColumn = srcMapping.generatedColumn;
449
+ for (var i = 0, length = generatedMappings.length; i < length; i++) {
450
+ var srcMapping = generatedMappings[i];
451
+ var destMapping = new Mapping();
452
+ destMapping.generatedLine = srcMapping.generatedLine;
453
+ destMapping.generatedColumn = srcMapping.generatedColumn;
431
454
 
432
- if (srcMapping.source) {
433
- destMapping.source = sources.indexOf(srcMapping.source);
434
- destMapping.originalLine = srcMapping.originalLine;
435
- destMapping.originalColumn = srcMapping.originalColumn;
455
+ if (srcMapping.source) {
456
+ destMapping.source = sources.indexOf(srcMapping.source);
457
+ destMapping.originalLine = srcMapping.originalLine;
458
+ destMapping.originalColumn = srcMapping.originalColumn;
436
459
 
437
- if (srcMapping.name) {
438
- destMapping.name = names.indexOf(srcMapping.name);
439
- }
440
-
441
- destOriginalMappings.push(destMapping);
460
+ if (srcMapping.name) {
461
+ destMapping.name = names.indexOf(srcMapping.name);
442
462
  }
443
463
 
444
- destGeneratedMappings.push(destMapping);
464
+ destOriginalMappings.push(destMapping);
445
465
  }
446
466
 
447
- quickSort(smc.__originalMappings, util.compareByOriginalPositions);
467
+ destGeneratedMappings.push(destMapping);
468
+ }
448
469
 
449
- return smc;
450
- };
470
+ quickSort(smc.__originalMappings, util.compareByOriginalPositions);
471
+
472
+ return smc;
473
+ };
451
474
 
452
475
  /**
453
476
  * The version of the source mapping spec that we are consuming.
@@ -460,7 +483,7 @@ BasicSourceMapConsumer.prototype._version = 3;
460
483
  Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
461
484
  get: function () {
462
485
  return this._absoluteSources.slice();
463
- }
486
+ },
464
487
  });
465
488
 
466
489
  /**
@@ -535,11 +558,9 @@ BasicSourceMapConsumer.prototype._parseMappings =
535
558
 
536
559
  sortGenerated(generatedMappings, subarrayStart);
537
560
  subarrayStart = generatedMappings.length;
538
- }
539
- else if (aStr.charAt(index) === ',') {
561
+ } else if (aStr.charAt(index) === ',') {
540
562
  index++;
541
- }
542
- else {
563
+ } else {
543
564
  mapping = new Mapping();
544
565
  mapping.generatedLine = generatedLine;
545
566
 
@@ -609,12 +630,26 @@ BasicSourceMapConsumer.prototype._parseMappings =
609
630
  sortGenerated(generatedMappings, subarrayStart);
610
631
  this.__generatedMappings = generatedMappings;
611
632
 
633
+ // Sources without mappings have a null bucket. Leave those out, or the
634
+ // nulls end up in __originalMappings.
635
+ var sourceBuckets = [];
612
636
  for (var i = 0; i < originalMappings.length; i++) {
613
637
  if (originalMappings[i] != null) {
614
638
  quickSort(originalMappings[i], util.compareByOriginalPositionsNoSource);
639
+ sourceBuckets.push(originalMappings[i]);
615
640
  }
616
641
  }
617
- this.__originalMappings = [].concat(...originalMappings);
642
+
643
+ // Spreading every bucket into a single concat call overflows the stack
644
+ // once a few hundred thousand sources have mappings, so concat at most
645
+ // 4096 buckets at a time. Most maps have fewer, and need a single call.
646
+ var sortedOriginalMappings = [];
647
+ for (var b = 0; b < sourceBuckets.length; b += 4096) {
648
+ sortedOriginalMappings = sortedOriginalMappings.concat(
649
+ ...sourceBuckets.slice(b, b + 4096)
650
+ );
651
+ }
652
+ this.__originalMappings = sortedOriginalMappings;
618
653
  };
619
654
 
620
655
  /**
@@ -622,20 +657,28 @@ BasicSourceMapConsumer.prototype._parseMappings =
622
657
  * we are searching for in the given "haystack" of mappings.
623
658
  */
624
659
  BasicSourceMapConsumer.prototype._findMapping =
625
- function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
626
- aColumnName, aComparator, aBias) {
660
+ function SourceMapConsumer_findMapping(
661
+ aNeedle,
662
+ aMappings,
663
+ aLineName,
664
+ aColumnName,
665
+ aComparator,
666
+ aBias
667
+ ) {
627
668
  // To return the position we are searching for, we must first find the
628
669
  // mapping for the given position and then return the opposite position it
629
670
  // points to. Because the mappings are sorted, we can use binary search to
630
671
  // find the best mapping.
631
672
 
632
673
  if (aNeedle[aLineName] <= 0) {
633
- throw new TypeError('Line must be greater than or equal to 1, got '
634
- + aNeedle[aLineName]);
674
+ throw new TypeError(
675
+ 'Line must be greater than or equal to 1, got ' + aNeedle[aLineName]
676
+ );
635
677
  }
636
678
  if (aNeedle[aColumnName] < 0) {
637
- throw new TypeError('Column must be greater than or equal to 0, got '
638
- + aNeedle[aColumnName]);
679
+ throw new TypeError(
680
+ 'Column must be greater than or equal to 0, got ' + aNeedle[aColumnName]
681
+ );
639
682
  }
640
683
 
641
684
  return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
@@ -696,14 +739,14 @@ BasicSourceMapConsumer.prototype.originalPositionFor =
696
739
  function SourceMapConsumer_originalPositionFor(aArgs) {
697
740
  var needle = {
698
741
  generatedLine: util.getArg(aArgs, 'line'),
699
- generatedColumn: util.getArg(aArgs, 'column')
742
+ generatedColumn: util.getArg(aArgs, 'column'),
700
743
  };
701
744
 
702
745
  var index = this._findMapping(
703
746
  needle,
704
747
  this._generatedMappings,
705
- "generatedLine",
706
- "generatedColumn",
748
+ 'generatedLine',
749
+ 'generatedColumn',
707
750
  util.compareByGeneratedPositionsDeflated,
708
751
  util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
709
752
  );
@@ -715,7 +758,11 @@ BasicSourceMapConsumer.prototype.originalPositionFor =
715
758
  var source = util.getArg(mapping, 'source', null);
716
759
  if (source !== null) {
717
760
  source = this._sources.at(source);
718
- source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
761
+ source = util.computeSourceURL(
762
+ this.sourceRoot,
763
+ source,
764
+ this._sourceMapURL
765
+ );
719
766
  }
720
767
  var name = util.getArg(mapping, 'name', null);
721
768
  if (name !== null) {
@@ -725,7 +772,7 @@ BasicSourceMapConsumer.prototype.originalPositionFor =
725
772
  source: source,
726
773
  line: util.getArg(mapping, 'originalLine', null),
727
774
  column: util.getArg(mapping, 'originalColumn', null),
728
- name: name
775
+ name: name,
729
776
  };
730
777
  }
731
778
  }
@@ -734,7 +781,7 @@ BasicSourceMapConsumer.prototype.originalPositionFor =
734
781
  source: null,
735
782
  line: null,
736
783
  column: null,
737
- name: null
784
+ name: null,
738
785
  };
739
786
  };
740
787
 
@@ -747,8 +794,12 @@ BasicSourceMapConsumer.prototype.hasContentsOfAllSources =
747
794
  if (!this.sourcesContent) {
748
795
  return false;
749
796
  }
750
- return this.sourcesContent.length >= this._sources.size() &&
751
- !this.sourcesContent.some(function (sc) { return sc == null; });
797
+ return (
798
+ this.sourcesContent.length >= this._sources.size() &&
799
+ !this.sourcesContent.some(function (sc) {
800
+ return sc == null;
801
+ })
802
+ );
752
803
  };
753
804
 
754
805
  /**
@@ -773,21 +824,21 @@ BasicSourceMapConsumer.prototype.sourceContentFor =
773
824
  }
774
825
 
775
826
  var url;
776
- if (this.sourceRoot != null
777
- && (url = util.urlParse(this.sourceRoot))) {
827
+ if (this.sourceRoot != null && (url = util.urlParse(this.sourceRoot))) {
778
828
  // XXX: file:// URIs and absolute paths lead to unexpected behavior for
779
829
  // many users. We can help them out when they expect file:// URIs to
780
830
  // behave like it would if they were running a local HTTP server. See
781
831
  // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
782
- var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
783
- if (url.scheme == "file"
784
- && this._sources.has(fileUriAbsPath)) {
785
- return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
832
+ var fileUriAbsPath = relativeSource.replace(/^file:\/\//, '');
833
+ if (url.scheme == 'file' && this._sources.has(fileUriAbsPath)) {
834
+ return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
786
835
  }
787
836
 
788
- if ((!url.path || url.path == "/")
789
- && this._sources.has("/" + relativeSource)) {
790
- return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
837
+ if (
838
+ (!url.path || url.path == '/') &&
839
+ this._sources.has('/' + relativeSource)
840
+ ) {
841
+ return this.sourcesContent[this._sources.indexOf('/' + relativeSource)];
791
842
  }
792
843
  }
793
844
 
@@ -797,8 +848,7 @@ BasicSourceMapConsumer.prototype.sourceContentFor =
797
848
  // return null, so we provide a flag to exit gracefully.
798
849
  if (nullOnMissing) {
799
850
  return null;
800
- }
801
- else {
851
+ } else {
802
852
  throw new Error('"' + relativeSource + '" is not in the SourceMap.');
803
853
  }
804
854
  };
@@ -834,21 +884,21 @@ BasicSourceMapConsumer.prototype.generatedPositionFor =
834
884
  return {
835
885
  line: null,
836
886
  column: null,
837
- lastColumn: null
887
+ lastColumn: null,
838
888
  };
839
889
  }
840
890
 
841
891
  var needle = {
842
892
  source: source,
843
893
  originalLine: util.getArg(aArgs, 'line'),
844
- originalColumn: util.getArg(aArgs, 'column')
894
+ originalColumn: util.getArg(aArgs, 'column'),
845
895
  };
846
896
 
847
897
  var index = this._findMapping(
848
898
  needle,
849
899
  this._originalMappings,
850
- "originalLine",
851
- "originalColumn",
900
+ 'originalLine',
901
+ 'originalColumn',
852
902
  util.compareByOriginalPositions,
853
903
  util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
854
904
  );
@@ -860,7 +910,7 @@ BasicSourceMapConsumer.prototype.generatedPositionFor =
860
910
  return {
861
911
  line: util.getArg(mapping, 'generatedLine', null),
862
912
  column: util.getArg(mapping, 'generatedColumn', null),
863
- lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
913
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null),
864
914
  };
865
915
  }
866
916
  }
@@ -868,7 +918,7 @@ BasicSourceMapConsumer.prototype.generatedPositionFor =
868
918
  return {
869
919
  line: null,
870
920
  column: null,
871
- lastColumn: null
921
+ lastColumn: null,
872
922
  };
873
923
  };
874
924
 
@@ -941,7 +991,7 @@ function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
941
991
 
942
992
  var lastOffset = {
943
993
  line: -1,
944
- column: 0
994
+ column: 0,
945
995
  };
946
996
  var maxOffsetLine = 0;
947
997
  this._sections = sections.map(function (s) {
@@ -955,14 +1005,20 @@ function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
955
1005
  var offsetColumn = util.getArg(offset, 'column');
956
1006
 
957
1007
  if (!isValidOffset(offsetLine) || !isValidOffset(offsetColumn)) {
958
- throw new Error('Section offset line and column must be non-negative integers.');
1008
+ throw new Error(
1009
+ 'Section offset line and column must be non-negative integers.'
1010
+ );
959
1011
  }
960
1012
  if (offsetLine > MAX_SECTION_OFFSET_LINE) {
961
- throw new Error('Section offset line must not exceed ' + MAX_SECTION_OFFSET_LINE + '.');
1013
+ throw new Error(
1014
+ 'Section offset line must not exceed ' + MAX_SECTION_OFFSET_LINE + '.'
1015
+ );
962
1016
  }
963
1017
 
964
- if (offsetLine < lastOffset.line ||
965
- (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
1018
+ if (
1019
+ offsetLine < lastOffset.line ||
1020
+ (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)
1021
+ ) {
966
1022
  throw new Error('Section offsets must be ordered and non-overlapping.');
967
1023
  }
968
1024
  lastOffset = offset;
@@ -973,8 +1029,11 @@ function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
973
1029
  // bound to the total.
974
1030
  var totalOffsetLine = offsetLine + (consumer._maxOffsetLine || 0);
975
1031
  if (totalOffsetLine > MAX_SECTION_OFFSET_LINE) {
976
- throw new Error('Section offset line must not exceed ' + MAX_SECTION_OFFSET_LINE +
977
- ', including offsets of nested sections.');
1032
+ throw new Error(
1033
+ 'Section offset line must not exceed ' +
1034
+ MAX_SECTION_OFFSET_LINE +
1035
+ ', including offsets of nested sections.'
1036
+ );
978
1037
  }
979
1038
  if (totalOffsetLine > maxOffsetLine) {
980
1039
  maxOffsetLine = totalOffsetLine;
@@ -985,10 +1044,10 @@ function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
985
1044
  // The offset fields are 0-based, but we use 1-based indices when
986
1045
  // encoding/decoding from VLQ.
987
1046
  generatedLine: offsetLine + 1,
988
- generatedColumn: offsetColumn + 1
1047
+ generatedColumn: offsetColumn + 1,
989
1048
  },
990
- consumer: consumer
991
- }
1049
+ consumer: consumer,
1050
+ };
992
1051
  });
993
1052
 
994
1053
  // The largest offset.line of any section, including nested sections.
@@ -1001,10 +1060,12 @@ function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
1001
1060
  * strings, fractions, etc).
1002
1061
  */
1003
1062
  function isValidOffset(aValue) {
1004
- return typeof aValue === 'number' &&
1063
+ return (
1064
+ typeof aValue === 'number' &&
1005
1065
  aValue >= 0 &&
1006
1066
  aValue <= 9007199254740991 && // Number.MAX_SAFE_INTEGER
1007
- Math.floor(aValue) === aValue;
1067
+ Math.floor(aValue) === aValue
1068
+ );
1008
1069
  }
1009
1070
 
1010
1071
  IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
@@ -1031,7 +1092,7 @@ Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
1031
1092
  }
1032
1093
  }
1033
1094
  return sources;
1034
- }
1095
+ },
1035
1096
  });
1036
1097
 
1037
1098
  /**
@@ -1057,21 +1118,27 @@ IndexedSourceMapConsumer.prototype.originalPositionFor =
1057
1118
  function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
1058
1119
  var needle = {
1059
1120
  generatedLine: util.getArg(aArgs, 'line'),
1060
- generatedColumn: util.getArg(aArgs, 'column')
1121
+ generatedColumn: util.getArg(aArgs, 'column'),
1061
1122
  };
1062
1123
 
1063
1124
  // Find the section containing the generated position we're trying to map
1064
1125
  // to an original position.
1065
- var sectionIndex = binarySearch.search(needle, this._sections,
1066
- function(needle, section) {
1126
+ var sectionIndex = binarySearch.search(
1127
+ needle,
1128
+ this._sections,
1129
+ function (needle, section) {
1067
1130
  var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
1068
1131
  if (cmp) {
1069
1132
  return cmp;
1070
1133
  }
1071
1134
 
1072
- return (needle.generatedColumn -
1073
- section.generatedOffset.generatedColumn);
1074
- });
1135
+ // The needle's column is 0-based, generatedOffset.generatedColumn is
1136
+ // 1-based.
1137
+ return (
1138
+ needle.generatedColumn - (section.generatedOffset.generatedColumn - 1)
1139
+ );
1140
+ }
1141
+ );
1075
1142
  var section = this._sections[sectionIndex];
1076
1143
 
1077
1144
  if (!section) {
@@ -1079,18 +1146,18 @@ IndexedSourceMapConsumer.prototype.originalPositionFor =
1079
1146
  source: null,
1080
1147
  line: null,
1081
1148
  column: null,
1082
- name: null
1149
+ name: null,
1083
1150
  };
1084
1151
  }
1085
1152
 
1086
1153
  return section.consumer.originalPositionFor({
1087
- line: needle.generatedLine -
1088
- (section.generatedOffset.generatedLine - 1),
1089
- column: needle.generatedColumn -
1154
+ line: needle.generatedLine - (section.generatedOffset.generatedLine - 1),
1155
+ column:
1156
+ needle.generatedColumn -
1090
1157
  (section.generatedOffset.generatedLine === needle.generatedLine
1091
- ? section.generatedOffset.generatedColumn - 1
1092
- : 0),
1093
- bias: aArgs.bias
1158
+ ? section.generatedOffset.generatedColumn - 1
1159
+ : 0),
1160
+ bias: aArgs.bias,
1094
1161
  });
1095
1162
  };
1096
1163
 
@@ -1122,59 +1189,61 @@ IndexedSourceMapConsumer.prototype.sourceContentFor =
1122
1189
  }
1123
1190
  if (nullOnMissing) {
1124
1191
  return null;
1125
- }
1126
- else {
1192
+ } else {
1127
1193
  throw new Error('"' + aSource + '" is not in the SourceMap.');
1128
1194
  }
1129
1195
  };
1130
1196
 
1197
+ // SourceMapConsumer.prototype.allGeneratedPositionsFor and
1198
+ // BasicSourceMapConsumer.prototype.generatedPositionFor search
1199
+ // this._originalMappings, which holds the mappings of every section with
1200
+ // their generated positions already shifted by the section offset. They need
1201
+ // these two methods.
1202
+
1131
1203
  /**
1132
- * Returns the generated line and column information for the original source,
1133
- * line, and column positions provided. The only argument is an object with
1134
- * the following properties:
1135
- *
1136
- * - source: The filename of the original source.
1137
- * - line: The line number in the original source. The line number
1138
- * is 1-based.
1139
- * - column: The column number in the original source. The column
1140
- * number is 0-based.
1141
- *
1142
- * and an object is returned with the following properties:
1143
- *
1144
- * - line: The line number in the generated source, or null. The
1145
- * line number is 1-based.
1146
- * - column: The column number in the generated source, or null.
1147
- * The column number is 0-based.
1204
+ * Returns the index of a source in this._sources, which holds the URLs of
1205
+ * the sources that have mappings, or -1. Accepts any name a section
1206
+ * accepts: relative to the section's sourceRoot or a URL from `sources`.
1148
1207
  */
1149
- IndexedSourceMapConsumer.prototype.generatedPositionFor =
1150
- function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
1151
- for (var i = 0; i < this._sections.length; i++) {
1152
- var section = this._sections[i];
1208
+ IndexedSourceMapConsumer.prototype._findSourceIndex = function (aSource) {
1209
+ // this._sources is filled in by _parseMappings, which runs on first access
1210
+ // to the mappings.
1211
+ this._generatedMappings;
1212
+
1213
+ for (var i = 0; i < this._sections.length; i++) {
1214
+ var consumer = this._sections[i].consumer;
1215
+ var index = consumer._findSourceIndex(aSource);
1216
+ if (index === -1) {
1217
+ continue;
1218
+ }
1153
1219
 
1154
- // Only consider this section if the requested source is in the list of
1155
- // sources of the consumer.
1156
- if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {
1157
- continue;
1158
- }
1159
- var generatedPosition = section.consumer.generatedPositionFor(aArgs);
1160
- if (generatedPosition) {
1161
- var ret = {
1162
- line: generatedPosition.line +
1163
- (section.generatedOffset.generatedLine - 1),
1164
- column: generatedPosition.column +
1165
- (section.generatedOffset.generatedLine === generatedPosition.line
1166
- ? section.generatedOffset.generatedColumn - 1
1167
- : 0)
1168
- };
1169
- return ret;
1170
- }
1220
+ // The same URL _parseMappings stores the source under.
1221
+ var url = util.computeSourceURL(
1222
+ consumer.sourceRoot,
1223
+ consumer._sources.at(index),
1224
+ this._sourceMapURL
1225
+ );
1226
+ if (this._sources.has(url)) {
1227
+ return this._sources.indexOf(url);
1171
1228
  }
1229
+ }
1172
1230
 
1173
- return {
1174
- line: null,
1175
- column: null
1176
- };
1177
- };
1231
+ return -1;
1232
+ };
1233
+
1234
+ IndexedSourceMapConsumer.prototype._findMapping =
1235
+ BasicSourceMapConsumer.prototype._findMapping;
1236
+
1237
+ // Searching the mappings of all sections at once finds the closest mapping
1238
+ // across sections, the same as for the map without sections.
1239
+ IndexedSourceMapConsumer.prototype.generatedPositionFor =
1240
+ BasicSourceMapConsumer.prototype.generatedPositionFor;
1241
+
1242
+ // Computes the spans on this._generatedMappings, the offset-shifted mappings
1243
+ // of all sections, which the lookups above return. A mapping's span ends
1244
+ // where the next mapping starts, even if that one is in the next section.
1245
+ IndexedSourceMapConsumer.prototype.computeColumnSpans =
1246
+ BasicSourceMapConsumer.prototype.computeColumnSpans;
1178
1247
 
1179
1248
  /**
1180
1249
  * Parse the mappings in a string in to a data structure which we can easily
@@ -1192,8 +1261,12 @@ IndexedSourceMapConsumer.prototype._parseMappings =
1192
1261
  var mapping = sectionMappings[j];
1193
1262
 
1194
1263
  var source = section.consumer._sources.at(mapping.source);
1195
- if(source !== null) {
1196
- source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
1264
+ if (source !== null) {
1265
+ source = util.computeSourceURL(
1266
+ section.consumer.sourceRoot,
1267
+ source,
1268
+ this._sourceMapURL
1269
+ );
1197
1270
  }
1198
1271
  this._sources.add(source);
1199
1272
  source = this._sources.indexOf(source);
@@ -1208,18 +1281,20 @@ IndexedSourceMapConsumer.prototype._parseMappings =
1208
1281
  // The mappings coming from the consumer for the section have
1209
1282
  // generated positions relative to the start of the section, so we
1210
1283
  // need to offset them to be relative to the start of the concatenated
1211
- // generated file.
1284
+ // generated file. The column offset only applies to the section's
1285
+ // first line.
1212
1286
  var adjustedMapping = {
1213
1287
  source: source,
1214
- generatedLine: mapping.generatedLine +
1215
- (section.generatedOffset.generatedLine - 1),
1216
- generatedColumn: mapping.generatedColumn +
1217
- (section.generatedOffset.generatedLine === mapping.generatedLine
1218
- ? section.generatedOffset.generatedColumn - 1
1219
- : 0),
1288
+ generatedLine:
1289
+ mapping.generatedLine + (section.generatedOffset.generatedLine - 1),
1290
+ generatedColumn:
1291
+ mapping.generatedColumn +
1292
+ (mapping.generatedLine === 1
1293
+ ? section.generatedOffset.generatedColumn - 1
1294
+ : 0),
1220
1295
  originalLine: mapping.originalLine,
1221
1296
  originalColumn: mapping.originalColumn,
1222
- name: name
1297
+ name: name,
1223
1298
  };
1224
1299
 
1225
1300
  this.__generatedMappings.push(adjustedMapping);
@@ -1229,7 +1304,10 @@ IndexedSourceMapConsumer.prototype._parseMappings =
1229
1304
  }
1230
1305
  }
1231
1306
 
1232
- quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
1307
+ quickSort(
1308
+ this.__generatedMappings,
1309
+ util.compareByGeneratedPositionsDeflated
1310
+ );
1233
1311
  quickSort(this.__originalMappings, util.compareByOriginalPositions);
1234
1312
  };
1235
1313