@vitest/coverage-istanbul 4.0.16 → 4.0.18

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 (2) hide show
  1. package/dist/provider.js +2069 -4
  2. package/package.json +4 -4
package/dist/provider.js CHANGED
@@ -1,11 +1,16 @@
1
1
  import { existsSync, promises } from 'node:fs';
2
2
  import { defaults } from '@istanbuljs/schema';
3
3
  import { GenMapping, addMapping, toEncodedMap } from '@jridgewell/gen-mapping';
4
+ import * as traceMapping from '@jridgewell/trace-mapping';
4
5
  import { eachMapping, TraceMap } from '@jridgewell/trace-mapping';
5
- import libCoverage from 'istanbul-lib-coverage';
6
+ import require$$0$2 from 'istanbul-lib-coverage';
6
7
  import { createInstrumenter } from 'istanbul-lib-instrument';
7
8
  import libReport from 'istanbul-lib-report';
8
- import libSourceMaps from 'istanbul-lib-source-maps';
9
+ import require$$0$1 from 'path';
10
+ import require$$1$2 from 'fs';
11
+ import require$$1 from 'tty';
12
+ import require$$1$1 from 'util';
13
+ import require$$0 from 'os';
9
14
  import reports from 'istanbul-reports';
10
15
  import { parseModule } from 'magicast';
11
16
  import { createDebug } from 'obug';
@@ -14,7 +19,2067 @@ import { BaseCoverageProvider } from 'vitest/coverage';
14
19
  import { isCSSRequest } from 'vitest/node';
15
20
  import { C as COVERAGE_STORE_KEY } from './constants-BCJfMgEg.js';
16
21
 
17
- var version = "4.0.16";
22
+ function getDefaultExportFromCjs(x) {
23
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
24
+ }
25
+ function getAugmentedNamespace(n) {
26
+ if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n;
27
+ var f = n.default;
28
+ if (typeof f == "function") {
29
+ var a = function a() {
30
+ var isInstance = false;
31
+ try {
32
+ isInstance = this instanceof a;
33
+ } catch {}
34
+ if (isInstance) {
35
+ return Reflect.construct(f, arguments, this.constructor);
36
+ }
37
+ return f.apply(this, arguments);
38
+ };
39
+ a.prototype = f.prototype;
40
+ } else a = {};
41
+ Object.defineProperty(a, "__esModule", { value: true });
42
+ Object.keys(n).forEach(function(k) {
43
+ var d = Object.getOwnPropertyDescriptor(n, k);
44
+ Object.defineProperty(a, k, d.get ? d : {
45
+ enumerable: true,
46
+ get: function() {
47
+ return n[k];
48
+ }
49
+ });
50
+ });
51
+ return a;
52
+ }
53
+
54
+ var src = {exports: {}};
55
+
56
+ var browser = {exports: {}};
57
+
58
+ /**
59
+ * Helpers.
60
+ */
61
+
62
+ var ms;
63
+ var hasRequiredMs;
64
+
65
+ function requireMs () {
66
+ if (hasRequiredMs) return ms;
67
+ hasRequiredMs = 1;
68
+ var s = 1000;
69
+ var m = s * 60;
70
+ var h = m * 60;
71
+ var d = h * 24;
72
+ var w = d * 7;
73
+ var y = d * 365.25;
74
+
75
+ /**
76
+ * Parse or format the given `val`.
77
+ *
78
+ * Options:
79
+ *
80
+ * - `long` verbose formatting [false]
81
+ *
82
+ * @param {String|Number} val
83
+ * @param {Object} [options]
84
+ * @throws {Error} throw an error if val is not a non-empty string or a number
85
+ * @return {String|Number}
86
+ * @api public
87
+ */
88
+
89
+ ms = function (val, options) {
90
+ options = options || {};
91
+ var type = typeof val;
92
+ if (type === 'string' && val.length > 0) {
93
+ return parse(val);
94
+ } else if (type === 'number' && isFinite(val)) {
95
+ return options.long ? fmtLong(val) : fmtShort(val);
96
+ }
97
+ throw new Error(
98
+ 'val is not a non-empty string or a valid number. val=' +
99
+ JSON.stringify(val)
100
+ );
101
+ };
102
+
103
+ /**
104
+ * Parse the given `str` and return milliseconds.
105
+ *
106
+ * @param {String} str
107
+ * @return {Number}
108
+ * @api private
109
+ */
110
+
111
+ function parse(str) {
112
+ str = String(str);
113
+ if (str.length > 100) {
114
+ return;
115
+ }
116
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
117
+ str
118
+ );
119
+ if (!match) {
120
+ return;
121
+ }
122
+ var n = parseFloat(match[1]);
123
+ var type = (match[2] || 'ms').toLowerCase();
124
+ switch (type) {
125
+ case 'years':
126
+ case 'year':
127
+ case 'yrs':
128
+ case 'yr':
129
+ case 'y':
130
+ return n * y;
131
+ case 'weeks':
132
+ case 'week':
133
+ case 'w':
134
+ return n * w;
135
+ case 'days':
136
+ case 'day':
137
+ case 'd':
138
+ return n * d;
139
+ case 'hours':
140
+ case 'hour':
141
+ case 'hrs':
142
+ case 'hr':
143
+ case 'h':
144
+ return n * h;
145
+ case 'minutes':
146
+ case 'minute':
147
+ case 'mins':
148
+ case 'min':
149
+ case 'm':
150
+ return n * m;
151
+ case 'seconds':
152
+ case 'second':
153
+ case 'secs':
154
+ case 'sec':
155
+ case 's':
156
+ return n * s;
157
+ case 'milliseconds':
158
+ case 'millisecond':
159
+ case 'msecs':
160
+ case 'msec':
161
+ case 'ms':
162
+ return n;
163
+ default:
164
+ return undefined;
165
+ }
166
+ }
167
+
168
+ /**
169
+ * Short format for `ms`.
170
+ *
171
+ * @param {Number} ms
172
+ * @return {String}
173
+ * @api private
174
+ */
175
+
176
+ function fmtShort(ms) {
177
+ var msAbs = Math.abs(ms);
178
+ if (msAbs >= d) {
179
+ return Math.round(ms / d) + 'd';
180
+ }
181
+ if (msAbs >= h) {
182
+ return Math.round(ms / h) + 'h';
183
+ }
184
+ if (msAbs >= m) {
185
+ return Math.round(ms / m) + 'm';
186
+ }
187
+ if (msAbs >= s) {
188
+ return Math.round(ms / s) + 's';
189
+ }
190
+ return ms + 'ms';
191
+ }
192
+
193
+ /**
194
+ * Long format for `ms`.
195
+ *
196
+ * @param {Number} ms
197
+ * @return {String}
198
+ * @api private
199
+ */
200
+
201
+ function fmtLong(ms) {
202
+ var msAbs = Math.abs(ms);
203
+ if (msAbs >= d) {
204
+ return plural(ms, msAbs, d, 'day');
205
+ }
206
+ if (msAbs >= h) {
207
+ return plural(ms, msAbs, h, 'hour');
208
+ }
209
+ if (msAbs >= m) {
210
+ return plural(ms, msAbs, m, 'minute');
211
+ }
212
+ if (msAbs >= s) {
213
+ return plural(ms, msAbs, s, 'second');
214
+ }
215
+ return ms + ' ms';
216
+ }
217
+
218
+ /**
219
+ * Pluralization helper.
220
+ */
221
+
222
+ function plural(ms, msAbs, n, name) {
223
+ var isPlural = msAbs >= n * 1.5;
224
+ return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
225
+ }
226
+ return ms;
227
+ }
228
+
229
+ var common;
230
+ var hasRequiredCommon;
231
+
232
+ function requireCommon () {
233
+ if (hasRequiredCommon) return common;
234
+ hasRequiredCommon = 1;
235
+ /**
236
+ * This is the common logic for both the Node.js and web browser
237
+ * implementations of `debug()`.
238
+ */
239
+
240
+ function setup(env) {
241
+ createDebug.debug = createDebug;
242
+ createDebug.default = createDebug;
243
+ createDebug.coerce = coerce;
244
+ createDebug.disable = disable;
245
+ createDebug.enable = enable;
246
+ createDebug.enabled = enabled;
247
+ createDebug.humanize = requireMs();
248
+ createDebug.destroy = destroy;
249
+
250
+ Object.keys(env).forEach(key => {
251
+ createDebug[key] = env[key];
252
+ });
253
+
254
+ /**
255
+ * The currently active debug mode names, and names to skip.
256
+ */
257
+
258
+ createDebug.names = [];
259
+ createDebug.skips = [];
260
+
261
+ /**
262
+ * Map of special "%n" handling functions, for the debug "format" argument.
263
+ *
264
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
265
+ */
266
+ createDebug.formatters = {};
267
+
268
+ /**
269
+ * Selects a color for a debug namespace
270
+ * @param {String} namespace The namespace string for the debug instance to be colored
271
+ * @return {Number|String} An ANSI color code for the given namespace
272
+ * @api private
273
+ */
274
+ function selectColor(namespace) {
275
+ let hash = 0;
276
+
277
+ for (let i = 0; i < namespace.length; i++) {
278
+ hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
279
+ hash |= 0; // Convert to 32bit integer
280
+ }
281
+
282
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
283
+ }
284
+ createDebug.selectColor = selectColor;
285
+
286
+ /**
287
+ * Create a debugger with the given `namespace`.
288
+ *
289
+ * @param {String} namespace
290
+ * @return {Function}
291
+ * @api public
292
+ */
293
+ function createDebug(namespace) {
294
+ let prevTime;
295
+ let enableOverride = null;
296
+ let namespacesCache;
297
+ let enabledCache;
298
+
299
+ function debug(...args) {
300
+ // Disabled?
301
+ if (!debug.enabled) {
302
+ return;
303
+ }
304
+
305
+ const self = debug;
306
+
307
+ // Set `diff` timestamp
308
+ const curr = Number(new Date());
309
+ const ms = curr - (prevTime || curr);
310
+ self.diff = ms;
311
+ self.prev = prevTime;
312
+ self.curr = curr;
313
+ prevTime = curr;
314
+
315
+ args[0] = createDebug.coerce(args[0]);
316
+
317
+ if (typeof args[0] !== 'string') {
318
+ // Anything else let's inspect with %O
319
+ args.unshift('%O');
320
+ }
321
+
322
+ // Apply any `formatters` transformations
323
+ let index = 0;
324
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
325
+ // If we encounter an escaped % then don't increase the array index
326
+ if (match === '%%') {
327
+ return '%';
328
+ }
329
+ index++;
330
+ const formatter = createDebug.formatters[format];
331
+ if (typeof formatter === 'function') {
332
+ const val = args[index];
333
+ match = formatter.call(self, val);
334
+
335
+ // Now we need to remove `args[index]` since it's inlined in the `format`
336
+ args.splice(index, 1);
337
+ index--;
338
+ }
339
+ return match;
340
+ });
341
+
342
+ // Apply env-specific formatting (colors, etc.)
343
+ createDebug.formatArgs.call(self, args);
344
+
345
+ const logFn = self.log || createDebug.log;
346
+ logFn.apply(self, args);
347
+ }
348
+
349
+ debug.namespace = namespace;
350
+ debug.useColors = createDebug.useColors();
351
+ debug.color = createDebug.selectColor(namespace);
352
+ debug.extend = extend;
353
+ debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
354
+
355
+ Object.defineProperty(debug, 'enabled', {
356
+ enumerable: true,
357
+ configurable: false,
358
+ get: () => {
359
+ if (enableOverride !== null) {
360
+ return enableOverride;
361
+ }
362
+ if (namespacesCache !== createDebug.namespaces) {
363
+ namespacesCache = createDebug.namespaces;
364
+ enabledCache = createDebug.enabled(namespace);
365
+ }
366
+
367
+ return enabledCache;
368
+ },
369
+ set: v => {
370
+ enableOverride = v;
371
+ }
372
+ });
373
+
374
+ // Env-specific initialization logic for debug instances
375
+ if (typeof createDebug.init === 'function') {
376
+ createDebug.init(debug);
377
+ }
378
+
379
+ return debug;
380
+ }
381
+
382
+ function extend(namespace, delimiter) {
383
+ const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
384
+ newDebug.log = this.log;
385
+ return newDebug;
386
+ }
387
+
388
+ /**
389
+ * Enables a debug mode by namespaces. This can include modes
390
+ * separated by a colon and wildcards.
391
+ *
392
+ * @param {String} namespaces
393
+ * @api public
394
+ */
395
+ function enable(namespaces) {
396
+ createDebug.save(namespaces);
397
+ createDebug.namespaces = namespaces;
398
+
399
+ createDebug.names = [];
400
+ createDebug.skips = [];
401
+
402
+ const split = (typeof namespaces === 'string' ? namespaces : '')
403
+ .trim()
404
+ .replace(/\s+/g, ',')
405
+ .split(',')
406
+ .filter(Boolean);
407
+
408
+ for (const ns of split) {
409
+ if (ns[0] === '-') {
410
+ createDebug.skips.push(ns.slice(1));
411
+ } else {
412
+ createDebug.names.push(ns);
413
+ }
414
+ }
415
+ }
416
+
417
+ /**
418
+ * Checks if the given string matches a namespace template, honoring
419
+ * asterisks as wildcards.
420
+ *
421
+ * @param {String} search
422
+ * @param {String} template
423
+ * @return {Boolean}
424
+ */
425
+ function matchesTemplate(search, template) {
426
+ let searchIndex = 0;
427
+ let templateIndex = 0;
428
+ let starIndex = -1;
429
+ let matchIndex = 0;
430
+
431
+ while (searchIndex < search.length) {
432
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
433
+ // Match character or proceed with wildcard
434
+ if (template[templateIndex] === '*') {
435
+ starIndex = templateIndex;
436
+ matchIndex = searchIndex;
437
+ templateIndex++; // Skip the '*'
438
+ } else {
439
+ searchIndex++;
440
+ templateIndex++;
441
+ }
442
+ } else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
443
+ // Backtrack to the last '*' and try to match more characters
444
+ templateIndex = starIndex + 1;
445
+ matchIndex++;
446
+ searchIndex = matchIndex;
447
+ } else {
448
+ return false; // No match
449
+ }
450
+ }
451
+
452
+ // Handle trailing '*' in template
453
+ while (templateIndex < template.length && template[templateIndex] === '*') {
454
+ templateIndex++;
455
+ }
456
+
457
+ return templateIndex === template.length;
458
+ }
459
+
460
+ /**
461
+ * Disable debug output.
462
+ *
463
+ * @return {String} namespaces
464
+ * @api public
465
+ */
466
+ function disable() {
467
+ const namespaces = [
468
+ ...createDebug.names,
469
+ ...createDebug.skips.map(namespace => '-' + namespace)
470
+ ].join(',');
471
+ createDebug.enable('');
472
+ return namespaces;
473
+ }
474
+
475
+ /**
476
+ * Returns true if the given mode name is enabled, false otherwise.
477
+ *
478
+ * @param {String} name
479
+ * @return {Boolean}
480
+ * @api public
481
+ */
482
+ function enabled(name) {
483
+ for (const skip of createDebug.skips) {
484
+ if (matchesTemplate(name, skip)) {
485
+ return false;
486
+ }
487
+ }
488
+
489
+ for (const ns of createDebug.names) {
490
+ if (matchesTemplate(name, ns)) {
491
+ return true;
492
+ }
493
+ }
494
+
495
+ return false;
496
+ }
497
+
498
+ /**
499
+ * Coerce `val`.
500
+ *
501
+ * @param {Mixed} val
502
+ * @return {Mixed}
503
+ * @api private
504
+ */
505
+ function coerce(val) {
506
+ if (val instanceof Error) {
507
+ return val.stack || val.message;
508
+ }
509
+ return val;
510
+ }
511
+
512
+ /**
513
+ * XXX DO NOT USE. This is a temporary stub function.
514
+ * XXX It WILL be removed in the next major release.
515
+ */
516
+ function destroy() {
517
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
518
+ }
519
+
520
+ createDebug.enable(createDebug.load());
521
+
522
+ return createDebug;
523
+ }
524
+
525
+ common = setup;
526
+ return common;
527
+ }
528
+
529
+ /* eslint-env browser */
530
+
531
+ var hasRequiredBrowser;
532
+
533
+ function requireBrowser () {
534
+ if (hasRequiredBrowser) return browser.exports;
535
+ hasRequiredBrowser = 1;
536
+ (function (module, exports$1) {
537
+ /**
538
+ * This is the web browser implementation of `debug()`.
539
+ */
540
+
541
+ exports$1.formatArgs = formatArgs;
542
+ exports$1.save = save;
543
+ exports$1.load = load;
544
+ exports$1.useColors = useColors;
545
+ exports$1.storage = localstorage();
546
+ exports$1.destroy = (() => {
547
+ let warned = false;
548
+
549
+ return () => {
550
+ if (!warned) {
551
+ warned = true;
552
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
553
+ }
554
+ };
555
+ })();
556
+
557
+ /**
558
+ * Colors.
559
+ */
560
+
561
+ exports$1.colors = [
562
+ '#0000CC',
563
+ '#0000FF',
564
+ '#0033CC',
565
+ '#0033FF',
566
+ '#0066CC',
567
+ '#0066FF',
568
+ '#0099CC',
569
+ '#0099FF',
570
+ '#00CC00',
571
+ '#00CC33',
572
+ '#00CC66',
573
+ '#00CC99',
574
+ '#00CCCC',
575
+ '#00CCFF',
576
+ '#3300CC',
577
+ '#3300FF',
578
+ '#3333CC',
579
+ '#3333FF',
580
+ '#3366CC',
581
+ '#3366FF',
582
+ '#3399CC',
583
+ '#3399FF',
584
+ '#33CC00',
585
+ '#33CC33',
586
+ '#33CC66',
587
+ '#33CC99',
588
+ '#33CCCC',
589
+ '#33CCFF',
590
+ '#6600CC',
591
+ '#6600FF',
592
+ '#6633CC',
593
+ '#6633FF',
594
+ '#66CC00',
595
+ '#66CC33',
596
+ '#9900CC',
597
+ '#9900FF',
598
+ '#9933CC',
599
+ '#9933FF',
600
+ '#99CC00',
601
+ '#99CC33',
602
+ '#CC0000',
603
+ '#CC0033',
604
+ '#CC0066',
605
+ '#CC0099',
606
+ '#CC00CC',
607
+ '#CC00FF',
608
+ '#CC3300',
609
+ '#CC3333',
610
+ '#CC3366',
611
+ '#CC3399',
612
+ '#CC33CC',
613
+ '#CC33FF',
614
+ '#CC6600',
615
+ '#CC6633',
616
+ '#CC9900',
617
+ '#CC9933',
618
+ '#CCCC00',
619
+ '#CCCC33',
620
+ '#FF0000',
621
+ '#FF0033',
622
+ '#FF0066',
623
+ '#FF0099',
624
+ '#FF00CC',
625
+ '#FF00FF',
626
+ '#FF3300',
627
+ '#FF3333',
628
+ '#FF3366',
629
+ '#FF3399',
630
+ '#FF33CC',
631
+ '#FF33FF',
632
+ '#FF6600',
633
+ '#FF6633',
634
+ '#FF9900',
635
+ '#FF9933',
636
+ '#FFCC00',
637
+ '#FFCC33'
638
+ ];
639
+
640
+ /**
641
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
642
+ * and the Firebug extension (any Firefox version) are known
643
+ * to support "%c" CSS customizations.
644
+ *
645
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
646
+ */
647
+
648
+ // eslint-disable-next-line complexity
649
+ function useColors() {
650
+ // NB: In an Electron preload script, document will be defined but not fully
651
+ // initialized. Since we know we're in Chrome, we'll just detect this case
652
+ // explicitly
653
+ if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
654
+ return true;
655
+ }
656
+
657
+ // Internet Explorer and Edge do not support colors.
658
+ if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
659
+ return false;
660
+ }
661
+
662
+ let m;
663
+
664
+ // Is webkit? http://stackoverflow.com/a/16459606/376773
665
+ // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
666
+ // eslint-disable-next-line no-return-assign
667
+ return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
668
+ // Is firebug? http://stackoverflow.com/a/398120/376773
669
+ (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
670
+ // Is firefox >= v31?
671
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
672
+ (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
673
+ // Double check webkit in userAgent just in case we are in a worker
674
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
675
+ }
676
+
677
+ /**
678
+ * Colorize log arguments if enabled.
679
+ *
680
+ * @api public
681
+ */
682
+
683
+ function formatArgs(args) {
684
+ args[0] = (this.useColors ? '%c' : '') +
685
+ this.namespace +
686
+ (this.useColors ? ' %c' : ' ') +
687
+ args[0] +
688
+ (this.useColors ? '%c ' : ' ') +
689
+ '+' + module.exports.humanize(this.diff);
690
+
691
+ if (!this.useColors) {
692
+ return;
693
+ }
694
+
695
+ const c = 'color: ' + this.color;
696
+ args.splice(1, 0, c, 'color: inherit');
697
+
698
+ // The final "%c" is somewhat tricky, because there could be other
699
+ // arguments passed either before or after the %c, so we need to
700
+ // figure out the correct index to insert the CSS into
701
+ let index = 0;
702
+ let lastC = 0;
703
+ args[0].replace(/%[a-zA-Z%]/g, match => {
704
+ if (match === '%%') {
705
+ return;
706
+ }
707
+ index++;
708
+ if (match === '%c') {
709
+ // We only are interested in the *last* %c
710
+ // (the user may have provided their own)
711
+ lastC = index;
712
+ }
713
+ });
714
+
715
+ args.splice(lastC, 0, c);
716
+ }
717
+
718
+ /**
719
+ * Invokes `console.debug()` when available.
720
+ * No-op when `console.debug` is not a "function".
721
+ * If `console.debug` is not available, falls back
722
+ * to `console.log`.
723
+ *
724
+ * @api public
725
+ */
726
+ exports$1.log = console.debug || console.log || (() => {});
727
+
728
+ /**
729
+ * Save `namespaces`.
730
+ *
731
+ * @param {String} namespaces
732
+ * @api private
733
+ */
734
+ function save(namespaces) {
735
+ try {
736
+ if (namespaces) {
737
+ exports$1.storage.setItem('debug', namespaces);
738
+ } else {
739
+ exports$1.storage.removeItem('debug');
740
+ }
741
+ } catch (error) {
742
+ // Swallow
743
+ // XXX (@Qix-) should we be logging these?
744
+ }
745
+ }
746
+
747
+ /**
748
+ * Load `namespaces`.
749
+ *
750
+ * @return {String} returns the previously persisted debug modes
751
+ * @api private
752
+ */
753
+ function load() {
754
+ let r;
755
+ try {
756
+ r = exports$1.storage.getItem('debug') || exports$1.storage.getItem('DEBUG') ;
757
+ } catch (error) {
758
+ // Swallow
759
+ // XXX (@Qix-) should we be logging these?
760
+ }
761
+
762
+ // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
763
+ if (!r && typeof process !== 'undefined' && 'env' in process) {
764
+ r = process.env.DEBUG;
765
+ }
766
+
767
+ return r;
768
+ }
769
+
770
+ /**
771
+ * Localstorage attempts to return the localstorage.
772
+ *
773
+ * This is necessary because safari throws
774
+ * when a user disables cookies/localstorage
775
+ * and you attempt to access it.
776
+ *
777
+ * @return {LocalStorage}
778
+ * @api private
779
+ */
780
+
781
+ function localstorage() {
782
+ try {
783
+ // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
784
+ // The Browser also has localStorage in the global context.
785
+ return localStorage;
786
+ } catch (error) {
787
+ // Swallow
788
+ // XXX (@Qix-) should we be logging these?
789
+ }
790
+ }
791
+
792
+ module.exports = requireCommon()(exports$1);
793
+
794
+ const {formatters} = module.exports;
795
+
796
+ /**
797
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
798
+ */
799
+
800
+ formatters.j = function (v) {
801
+ try {
802
+ return JSON.stringify(v);
803
+ } catch (error) {
804
+ return '[UnexpectedJSONParseError]: ' + error.message;
805
+ }
806
+ };
807
+ } (browser, browser.exports));
808
+ return browser.exports;
809
+ }
810
+
811
+ var node = {exports: {}};
812
+
813
+ var hasFlag;
814
+ var hasRequiredHasFlag;
815
+
816
+ function requireHasFlag () {
817
+ if (hasRequiredHasFlag) return hasFlag;
818
+ hasRequiredHasFlag = 1;
819
+
820
+ hasFlag = (flag, argv = process.argv) => {
821
+ const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
822
+ const position = argv.indexOf(prefix + flag);
823
+ const terminatorPosition = argv.indexOf('--');
824
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
825
+ };
826
+ return hasFlag;
827
+ }
828
+
829
+ var supportsColor_1;
830
+ var hasRequiredSupportsColor;
831
+
832
+ function requireSupportsColor () {
833
+ if (hasRequiredSupportsColor) return supportsColor_1;
834
+ hasRequiredSupportsColor = 1;
835
+ const os = require$$0;
836
+ const tty = require$$1;
837
+ const hasFlag = requireHasFlag();
838
+
839
+ const {env} = process;
840
+
841
+ let forceColor;
842
+ if (hasFlag('no-color') ||
843
+ hasFlag('no-colors') ||
844
+ hasFlag('color=false') ||
845
+ hasFlag('color=never')) {
846
+ forceColor = 0;
847
+ } else if (hasFlag('color') ||
848
+ hasFlag('colors') ||
849
+ hasFlag('color=true') ||
850
+ hasFlag('color=always')) {
851
+ forceColor = 1;
852
+ }
853
+
854
+ if ('FORCE_COLOR' in env) {
855
+ if (env.FORCE_COLOR === 'true') {
856
+ forceColor = 1;
857
+ } else if (env.FORCE_COLOR === 'false') {
858
+ forceColor = 0;
859
+ } else {
860
+ forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
861
+ }
862
+ }
863
+
864
+ function translateLevel(level) {
865
+ if (level === 0) {
866
+ return false;
867
+ }
868
+
869
+ return {
870
+ level,
871
+ hasBasic: true,
872
+ has256: level >= 2,
873
+ has16m: level >= 3
874
+ };
875
+ }
876
+
877
+ function supportsColor(haveStream, streamIsTTY) {
878
+ if (forceColor === 0) {
879
+ return 0;
880
+ }
881
+
882
+ if (hasFlag('color=16m') ||
883
+ hasFlag('color=full') ||
884
+ hasFlag('color=truecolor')) {
885
+ return 3;
886
+ }
887
+
888
+ if (hasFlag('color=256')) {
889
+ return 2;
890
+ }
891
+
892
+ if (haveStream && !streamIsTTY && forceColor === undefined) {
893
+ return 0;
894
+ }
895
+
896
+ const min = forceColor || 0;
897
+
898
+ if (env.TERM === 'dumb') {
899
+ return min;
900
+ }
901
+
902
+ if (process.platform === 'win32') {
903
+ // Windows 10 build 10586 is the first Windows release that supports 256 colors.
904
+ // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
905
+ const osRelease = os.release().split('.');
906
+ if (
907
+ Number(osRelease[0]) >= 10 &&
908
+ Number(osRelease[2]) >= 10586
909
+ ) {
910
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
911
+ }
912
+
913
+ return 1;
914
+ }
915
+
916
+ if ('CI' in env) {
917
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
918
+ return 1;
919
+ }
920
+
921
+ return min;
922
+ }
923
+
924
+ if ('TEAMCITY_VERSION' in env) {
925
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
926
+ }
927
+
928
+ if (env.COLORTERM === 'truecolor') {
929
+ return 3;
930
+ }
931
+
932
+ if ('TERM_PROGRAM' in env) {
933
+ const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
934
+
935
+ switch (env.TERM_PROGRAM) {
936
+ case 'iTerm.app':
937
+ return version >= 3 ? 3 : 2;
938
+ case 'Apple_Terminal':
939
+ return 2;
940
+ // No default
941
+ }
942
+ }
943
+
944
+ if (/-256(color)?$/i.test(env.TERM)) {
945
+ return 2;
946
+ }
947
+
948
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
949
+ return 1;
950
+ }
951
+
952
+ if ('COLORTERM' in env) {
953
+ return 1;
954
+ }
955
+
956
+ return min;
957
+ }
958
+
959
+ function getSupportLevel(stream) {
960
+ const level = supportsColor(stream, stream && stream.isTTY);
961
+ return translateLevel(level);
962
+ }
963
+
964
+ supportsColor_1 = {
965
+ supportsColor: getSupportLevel,
966
+ stdout: translateLevel(supportsColor(true, tty.isatty(1))),
967
+ stderr: translateLevel(supportsColor(true, tty.isatty(2)))
968
+ };
969
+ return supportsColor_1;
970
+ }
971
+
972
+ /**
973
+ * Module dependencies.
974
+ */
975
+
976
+ var hasRequiredNode;
977
+
978
+ function requireNode () {
979
+ if (hasRequiredNode) return node.exports;
980
+ hasRequiredNode = 1;
981
+ (function (module, exports$1) {
982
+ const tty = require$$1;
983
+ const util = require$$1$1;
984
+
985
+ /**
986
+ * This is the Node.js implementation of `debug()`.
987
+ */
988
+
989
+ exports$1.init = init;
990
+ exports$1.log = log;
991
+ exports$1.formatArgs = formatArgs;
992
+ exports$1.save = save;
993
+ exports$1.load = load;
994
+ exports$1.useColors = useColors;
995
+ exports$1.destroy = util.deprecate(
996
+ () => {},
997
+ 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
998
+ );
999
+
1000
+ /**
1001
+ * Colors.
1002
+ */
1003
+
1004
+ exports$1.colors = [6, 2, 3, 4, 5, 1];
1005
+
1006
+ try {
1007
+ // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
1008
+ // eslint-disable-next-line import/no-extraneous-dependencies
1009
+ const supportsColor = requireSupportsColor();
1010
+
1011
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
1012
+ exports$1.colors = [
1013
+ 20,
1014
+ 21,
1015
+ 26,
1016
+ 27,
1017
+ 32,
1018
+ 33,
1019
+ 38,
1020
+ 39,
1021
+ 40,
1022
+ 41,
1023
+ 42,
1024
+ 43,
1025
+ 44,
1026
+ 45,
1027
+ 56,
1028
+ 57,
1029
+ 62,
1030
+ 63,
1031
+ 68,
1032
+ 69,
1033
+ 74,
1034
+ 75,
1035
+ 76,
1036
+ 77,
1037
+ 78,
1038
+ 79,
1039
+ 80,
1040
+ 81,
1041
+ 92,
1042
+ 93,
1043
+ 98,
1044
+ 99,
1045
+ 112,
1046
+ 113,
1047
+ 128,
1048
+ 129,
1049
+ 134,
1050
+ 135,
1051
+ 148,
1052
+ 149,
1053
+ 160,
1054
+ 161,
1055
+ 162,
1056
+ 163,
1057
+ 164,
1058
+ 165,
1059
+ 166,
1060
+ 167,
1061
+ 168,
1062
+ 169,
1063
+ 170,
1064
+ 171,
1065
+ 172,
1066
+ 173,
1067
+ 178,
1068
+ 179,
1069
+ 184,
1070
+ 185,
1071
+ 196,
1072
+ 197,
1073
+ 198,
1074
+ 199,
1075
+ 200,
1076
+ 201,
1077
+ 202,
1078
+ 203,
1079
+ 204,
1080
+ 205,
1081
+ 206,
1082
+ 207,
1083
+ 208,
1084
+ 209,
1085
+ 214,
1086
+ 215,
1087
+ 220,
1088
+ 221
1089
+ ];
1090
+ }
1091
+ } catch (error) {
1092
+ // Swallow - we only care if `supports-color` is available; it doesn't have to be.
1093
+ }
1094
+
1095
+ /**
1096
+ * Build up the default `inspectOpts` object from the environment variables.
1097
+ *
1098
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
1099
+ */
1100
+
1101
+ exports$1.inspectOpts = Object.keys(process.env).filter(key => {
1102
+ return /^debug_/i.test(key);
1103
+ }).reduce((obj, key) => {
1104
+ // Camel-case
1105
+ const prop = key
1106
+ .substring(6)
1107
+ .toLowerCase()
1108
+ .replace(/_([a-z])/g, (_, k) => {
1109
+ return k.toUpperCase();
1110
+ });
1111
+
1112
+ // Coerce string value into JS value
1113
+ let val = process.env[key];
1114
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
1115
+ val = true;
1116
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
1117
+ val = false;
1118
+ } else if (val === 'null') {
1119
+ val = null;
1120
+ } else {
1121
+ val = Number(val);
1122
+ }
1123
+
1124
+ obj[prop] = val;
1125
+ return obj;
1126
+ }, {});
1127
+
1128
+ /**
1129
+ * Is stdout a TTY? Colored output is enabled when `true`.
1130
+ */
1131
+
1132
+ function useColors() {
1133
+ return 'colors' in exports$1.inspectOpts ?
1134
+ Boolean(exports$1.inspectOpts.colors) :
1135
+ tty.isatty(process.stderr.fd);
1136
+ }
1137
+
1138
+ /**
1139
+ * Adds ANSI color escape codes if enabled.
1140
+ *
1141
+ * @api public
1142
+ */
1143
+
1144
+ function formatArgs(args) {
1145
+ const {namespace: name, useColors} = this;
1146
+
1147
+ if (useColors) {
1148
+ const c = this.color;
1149
+ const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
1150
+ const prefix = ` ${colorCode};1m${name} \u001B[0m`;
1151
+
1152
+ args[0] = prefix + args[0].split('\n').join('\n' + prefix);
1153
+ args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
1154
+ } else {
1155
+ args[0] = getDate() + name + ' ' + args[0];
1156
+ }
1157
+ }
1158
+
1159
+ function getDate() {
1160
+ if (exports$1.inspectOpts.hideDate) {
1161
+ return '';
1162
+ }
1163
+ return new Date().toISOString() + ' ';
1164
+ }
1165
+
1166
+ /**
1167
+ * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
1168
+ */
1169
+
1170
+ function log(...args) {
1171
+ return process.stderr.write(util.formatWithOptions(exports$1.inspectOpts, ...args) + '\n');
1172
+ }
1173
+
1174
+ /**
1175
+ * Save `namespaces`.
1176
+ *
1177
+ * @param {String} namespaces
1178
+ * @api private
1179
+ */
1180
+ function save(namespaces) {
1181
+ if (namespaces) {
1182
+ process.env.DEBUG = namespaces;
1183
+ } else {
1184
+ // If you set a process.env field to null or undefined, it gets cast to the
1185
+ // string 'null' or 'undefined'. Just delete instead.
1186
+ delete process.env.DEBUG;
1187
+ }
1188
+ }
1189
+
1190
+ /**
1191
+ * Load `namespaces`.
1192
+ *
1193
+ * @return {String} returns the previously persisted debug modes
1194
+ * @api private
1195
+ */
1196
+
1197
+ function load() {
1198
+ return process.env.DEBUG;
1199
+ }
1200
+
1201
+ /**
1202
+ * Init logic for `debug` instances.
1203
+ *
1204
+ * Create a new `inspectOpts` object in case `useColors` is set
1205
+ * differently for a particular `debug` instance.
1206
+ */
1207
+
1208
+ function init(debug) {
1209
+ debug.inspectOpts = {};
1210
+
1211
+ const keys = Object.keys(exports$1.inspectOpts);
1212
+ for (let i = 0; i < keys.length; i++) {
1213
+ debug.inspectOpts[keys[i]] = exports$1.inspectOpts[keys[i]];
1214
+ }
1215
+ }
1216
+
1217
+ module.exports = requireCommon()(exports$1);
1218
+
1219
+ const {formatters} = module.exports;
1220
+
1221
+ /**
1222
+ * Map %o to `util.inspect()`, all on a single line.
1223
+ */
1224
+
1225
+ formatters.o = function (v) {
1226
+ this.inspectOpts.colors = this.useColors;
1227
+ return util.inspect(v, this.inspectOpts)
1228
+ .split('\n')
1229
+ .map(str => str.trim())
1230
+ .join(' ');
1231
+ };
1232
+
1233
+ /**
1234
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
1235
+ */
1236
+
1237
+ formatters.O = function (v) {
1238
+ this.inspectOpts.colors = this.useColors;
1239
+ return util.inspect(v, this.inspectOpts);
1240
+ };
1241
+ } (node, node.exports));
1242
+ return node.exports;
1243
+ }
1244
+
1245
+ /**
1246
+ * Detect Electron renderer / nwjs process, which is node, but we should
1247
+ * treat as a browser.
1248
+ */
1249
+
1250
+ var hasRequiredSrc;
1251
+
1252
+ function requireSrc () {
1253
+ if (hasRequiredSrc) return src.exports;
1254
+ hasRequiredSrc = 1;
1255
+ if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
1256
+ src.exports = requireBrowser();
1257
+ } else {
1258
+ src.exports = requireNode();
1259
+ }
1260
+ return src.exports;
1261
+ }
1262
+
1263
+ var require$$3 = /*@__PURE__*/getAugmentedNamespace(traceMapping);
1264
+
1265
+ /*
1266
+ Copyright 2015, Yahoo Inc.
1267
+ Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
1268
+ */
1269
+
1270
+ var pathutils;
1271
+ var hasRequiredPathutils;
1272
+
1273
+ function requirePathutils () {
1274
+ if (hasRequiredPathutils) return pathutils;
1275
+ hasRequiredPathutils = 1;
1276
+
1277
+ const path = require$$0$1;
1278
+
1279
+ pathutils = {
1280
+ isAbsolute: path.isAbsolute,
1281
+ asAbsolute(file, baseDir) {
1282
+ return path.isAbsolute(file)
1283
+ ? file
1284
+ : path.resolve(baseDir || process.cwd(), file);
1285
+ },
1286
+ relativeTo(file, origFile) {
1287
+ return path.isAbsolute(file)
1288
+ ? file
1289
+ : path.resolve(path.dirname(origFile), file);
1290
+ }
1291
+ };
1292
+ return pathutils;
1293
+ }
1294
+
1295
+ /*
1296
+ Copyright 2015, Yahoo Inc.
1297
+ Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
1298
+ */
1299
+
1300
+ var mapped;
1301
+ var hasRequiredMapped;
1302
+
1303
+ function requireMapped () {
1304
+ if (hasRequiredMapped) return mapped;
1305
+ hasRequiredMapped = 1;
1306
+
1307
+ const { FileCoverage } = require$$0$2.classes;
1308
+
1309
+ function locString(loc) {
1310
+ return [
1311
+ loc.start.line,
1312
+ loc.start.column,
1313
+ loc.end.line,
1314
+ loc.end.column
1315
+ ].join(':');
1316
+ }
1317
+
1318
+ class MappedCoverage extends FileCoverage {
1319
+ constructor(pathOrObj) {
1320
+ super(pathOrObj);
1321
+
1322
+ this.meta = {
1323
+ last: {
1324
+ s: 0,
1325
+ f: 0,
1326
+ b: 0
1327
+ },
1328
+ seen: {}
1329
+ };
1330
+ }
1331
+
1332
+ addStatement(loc, hits) {
1333
+ const key = 's:' + locString(loc);
1334
+ const { meta } = this;
1335
+ let index = meta.seen[key];
1336
+
1337
+ if (index === undefined) {
1338
+ index = meta.last.s;
1339
+ meta.last.s += 1;
1340
+ meta.seen[key] = index;
1341
+ this.statementMap[index] = this.cloneLocation(loc);
1342
+ }
1343
+
1344
+ this.s[index] = this.s[index] || 0;
1345
+ this.s[index] += hits;
1346
+ return index;
1347
+ }
1348
+
1349
+ addFunction(name, decl, loc, hits) {
1350
+ const key = 'f:' + locString(decl);
1351
+ const { meta } = this;
1352
+ let index = meta.seen[key];
1353
+
1354
+ if (index === undefined) {
1355
+ index = meta.last.f;
1356
+ meta.last.f += 1;
1357
+ meta.seen[key] = index;
1358
+ name = name || `(unknown_${index})`;
1359
+ this.fnMap[index] = {
1360
+ name,
1361
+ decl: this.cloneLocation(decl),
1362
+ loc: this.cloneLocation(loc)
1363
+ };
1364
+ }
1365
+
1366
+ this.f[index] = this.f[index] || 0;
1367
+ this.f[index] += hits;
1368
+ return index;
1369
+ }
1370
+
1371
+ addBranch(type, loc, branchLocations, hits) {
1372
+ const key = ['b', ...branchLocations.map(l => locString(l))].join(':');
1373
+ const { meta } = this;
1374
+ let index = meta.seen[key];
1375
+ if (index === undefined) {
1376
+ index = meta.last.b;
1377
+ meta.last.b += 1;
1378
+ meta.seen[key] = index;
1379
+ this.branchMap[index] = {
1380
+ loc,
1381
+ type,
1382
+ locations: branchLocations.map(l => this.cloneLocation(l))
1383
+ };
1384
+ }
1385
+
1386
+ if (!this.b[index]) {
1387
+ this.b[index] = branchLocations.map(() => 0);
1388
+ }
1389
+
1390
+ hits.forEach((hit, i) => {
1391
+ this.b[index][i] += hit;
1392
+ });
1393
+ return index;
1394
+ }
1395
+
1396
+ /* Returns a clone of the location object with only the attributes of interest */
1397
+ cloneLocation(loc) {
1398
+ return {
1399
+ start: {
1400
+ line: loc.start.line,
1401
+ column: loc.start.column
1402
+ },
1403
+ end: {
1404
+ line: loc.end.line,
1405
+ column: loc.end.column
1406
+ }
1407
+ };
1408
+ }
1409
+ }
1410
+
1411
+ mapped = {
1412
+ MappedCoverage
1413
+ };
1414
+ return mapped;
1415
+ }
1416
+
1417
+ var getMapping_1;
1418
+ var hasRequiredGetMapping;
1419
+
1420
+ function requireGetMapping () {
1421
+ if (hasRequiredGetMapping) return getMapping_1;
1422
+ hasRequiredGetMapping = 1;
1423
+
1424
+ const pathutils = requirePathutils();
1425
+ const {
1426
+ originalPositionFor,
1427
+ allGeneratedPositionsFor,
1428
+ GREATEST_LOWER_BOUND,
1429
+ LEAST_UPPER_BOUND
1430
+ } = require$$3;
1431
+
1432
+ /**
1433
+ * AST ranges are inclusive for start positions and exclusive for end positions.
1434
+ * Source maps are also logically ranges over text, though interacting with
1435
+ * them is generally achieved by working with explicit positions.
1436
+ *
1437
+ * When finding the _end_ location of an AST item, the range behavior is
1438
+ * important because what we're asking for is the _end_ of whatever range
1439
+ * corresponds to the end location we seek.
1440
+ *
1441
+ * This boils down to the following steps, conceptually, though the source-map
1442
+ * library doesn't expose primitives to do this nicely:
1443
+ *
1444
+ * 1. Find the range on the generated file that ends at, or exclusively
1445
+ * contains the end position of the AST node.
1446
+ * 2. Find the range on the original file that corresponds to
1447
+ * that generated range.
1448
+ * 3. Find the _end_ location of that original range.
1449
+ */
1450
+ function originalEndPositionFor(sourceMap, generatedEnd) {
1451
+ // Given the generated location, find the original location of the mapping
1452
+ // that corresponds to a range on the generated file that overlaps the
1453
+ // generated file end location. Note however that this position on its
1454
+ // own is not useful because it is the position of the _start_ of the range
1455
+ // on the original file, and we want the _end_ of the range.
1456
+ let beforeEndMapping = originalPositionTryBoth(
1457
+ sourceMap,
1458
+ generatedEnd.line,
1459
+ generatedEnd.column - 1
1460
+ );
1461
+ if (beforeEndMapping.source === null) {
1462
+ // search the previous lines as the mapping was not found on the same line
1463
+ for (
1464
+ let line = generatedEnd.line;
1465
+ line > 0 && beforeEndMapping.source === null;
1466
+ line--
1467
+ ) {
1468
+ beforeEndMapping = originalPositionTryBoth(
1469
+ sourceMap,
1470
+ line,
1471
+ Infinity
1472
+ );
1473
+ }
1474
+ if (beforeEndMapping.source === null) {
1475
+ return null;
1476
+ }
1477
+ }
1478
+
1479
+ // Convert that original position back to a generated one, with a bump
1480
+ // to the right, and a rightward bias. Since 'generatedPositionFor' searches
1481
+ // for mappings in the original-order sorted list, this will find the
1482
+ // mapping that corresponds to the one immediately after the
1483
+ // beforeEndMapping mapping.
1484
+ const afterEndMappings = allGeneratedPositionsFor(sourceMap, {
1485
+ source: beforeEndMapping.source,
1486
+ line: beforeEndMapping.line,
1487
+ column: beforeEndMapping.column + 1,
1488
+ bias: LEAST_UPPER_BOUND
1489
+ });
1490
+
1491
+ for (let i = 0; i < afterEndMappings.length; i++) {
1492
+ const afterEndMapping = afterEndMappings[i];
1493
+ if (afterEndMapping.line === null) continue;
1494
+
1495
+ const original = originalPositionFor(sourceMap, afterEndMapping);
1496
+ // If the lines match, it means that something comes after our mapping,
1497
+ // so it must end where this one begins.
1498
+ if (original.line === beforeEndMapping.line) return original;
1499
+ }
1500
+
1501
+ // If a generated mapping wasn't found (or all that were found were not on
1502
+ // the same line), then there's nothing after this range and we can
1503
+ // consider it to extend to infinity.
1504
+ return {
1505
+ source: beforeEndMapping.source,
1506
+ line: beforeEndMapping.line,
1507
+ column: Infinity
1508
+ };
1509
+ }
1510
+
1511
+ /**
1512
+ * Attempts to determine the original source position, first
1513
+ * returning the closest element to the left (GREATEST_LOWER_BOUND),
1514
+ * and next returning the closest element to the right (LEAST_UPPER_BOUND).
1515
+ */
1516
+ function originalPositionTryBoth(sourceMap, line, column) {
1517
+ const mapping = originalPositionFor(sourceMap, {
1518
+ line,
1519
+ column,
1520
+ bias: GREATEST_LOWER_BOUND
1521
+ });
1522
+ if (mapping.source === null) {
1523
+ return originalPositionFor(sourceMap, {
1524
+ line,
1525
+ column,
1526
+ bias: LEAST_UPPER_BOUND
1527
+ });
1528
+ } else {
1529
+ return mapping;
1530
+ }
1531
+ }
1532
+
1533
+ function isInvalidPosition(pos) {
1534
+ return (
1535
+ !pos ||
1536
+ typeof pos.line !== 'number' ||
1537
+ typeof pos.column !== 'number' ||
1538
+ pos.line < 0 ||
1539
+ pos.column < 0
1540
+ );
1541
+ }
1542
+
1543
+ /**
1544
+ * determines the original position for a given location
1545
+ * @param {SourceMapConsumer} sourceMap the source map
1546
+ * @param {Object} generatedLocation the original location Object
1547
+ * @returns {Object} the remapped location Object
1548
+ */
1549
+ function getMapping(sourceMap, generatedLocation, origFile) {
1550
+ if (!generatedLocation) {
1551
+ return null;
1552
+ }
1553
+
1554
+ if (
1555
+ isInvalidPosition(generatedLocation.start) ||
1556
+ isInvalidPosition(generatedLocation.end)
1557
+ ) {
1558
+ return null;
1559
+ }
1560
+
1561
+ const start = originalPositionTryBoth(
1562
+ sourceMap,
1563
+ generatedLocation.start.line,
1564
+ generatedLocation.start.column
1565
+ );
1566
+ let end = originalEndPositionFor(sourceMap, generatedLocation.end);
1567
+
1568
+ /* istanbul ignore if: edge case too hard to test for */
1569
+ if (!(start && end)) {
1570
+ return null;
1571
+ }
1572
+
1573
+ if (!(start.source && end.source)) {
1574
+ return null;
1575
+ }
1576
+
1577
+ if (start.source !== end.source) {
1578
+ return null;
1579
+ }
1580
+
1581
+ /* istanbul ignore if: edge case too hard to test for */
1582
+ if (start.line === null || start.column === null) {
1583
+ return null;
1584
+ }
1585
+
1586
+ /* istanbul ignore if: edge case too hard to test for */
1587
+ if (end.line === null || end.column === null) {
1588
+ return null;
1589
+ }
1590
+
1591
+ if (start.line === end.line && start.column === end.column) {
1592
+ end = originalPositionFor(sourceMap, {
1593
+ line: generatedLocation.end.line,
1594
+ column: generatedLocation.end.column,
1595
+ bias: LEAST_UPPER_BOUND
1596
+ });
1597
+ end.column -= 1;
1598
+ }
1599
+
1600
+ return {
1601
+ source: pathutils.relativeTo(start.source, origFile),
1602
+ loc: {
1603
+ start: {
1604
+ line: start.line,
1605
+ column: start.column
1606
+ },
1607
+ end: {
1608
+ line: end.line,
1609
+ column: end.column
1610
+ }
1611
+ }
1612
+ };
1613
+ }
1614
+
1615
+ getMapping_1 = getMapping;
1616
+ return getMapping_1;
1617
+ }
1618
+
1619
+ /*
1620
+ Copyright 2015, Yahoo Inc.
1621
+ Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
1622
+ */
1623
+
1624
+ var transformUtils;
1625
+ var hasRequiredTransformUtils;
1626
+
1627
+ function requireTransformUtils () {
1628
+ if (hasRequiredTransformUtils) return transformUtils;
1629
+ hasRequiredTransformUtils = 1;
1630
+
1631
+ function getUniqueKey(pathname) {
1632
+ return pathname.replace(/[\\/]/g, '_');
1633
+ }
1634
+
1635
+ function getOutput(cache) {
1636
+ return Object.values(cache).reduce(
1637
+ (output, { file, mappedCoverage }) => ({
1638
+ ...output,
1639
+ [file]: mappedCoverage
1640
+ }),
1641
+ {}
1642
+ );
1643
+ }
1644
+
1645
+ transformUtils = { getUniqueKey, getOutput };
1646
+ return transformUtils;
1647
+ }
1648
+
1649
+ /*
1650
+ Copyright 2015, Yahoo Inc.
1651
+ Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
1652
+ */
1653
+
1654
+ var transformer;
1655
+ var hasRequiredTransformer;
1656
+
1657
+ function requireTransformer () {
1658
+ if (hasRequiredTransformer) return transformer;
1659
+ hasRequiredTransformer = 1;
1660
+
1661
+ const debug = requireSrc()('istanbuljs');
1662
+ const libCoverage = require$$0$2;
1663
+ const { MappedCoverage } = requireMapped();
1664
+ const getMapping = requireGetMapping();
1665
+ const { getUniqueKey, getOutput } = requireTransformUtils();
1666
+
1667
+ class SourceMapTransformer {
1668
+ constructor(finder, opts = {}) {
1669
+ this.finder = finder;
1670
+ this.baseDir = opts.baseDir || process.cwd();
1671
+ this.resolveMapping = opts.getMapping || getMapping;
1672
+ }
1673
+
1674
+ processFile(fc, sourceMap, coverageMapper) {
1675
+ let changes = 0;
1676
+
1677
+ Object.entries(fc.statementMap).forEach(([s, loc]) => {
1678
+ const hits = fc.s[s];
1679
+ const mapping = this.resolveMapping(sourceMap, loc, fc.path);
1680
+
1681
+ if (mapping) {
1682
+ changes += 1;
1683
+ const mappedCoverage = coverageMapper(mapping.source);
1684
+ mappedCoverage.addStatement(mapping.loc, hits);
1685
+ }
1686
+ });
1687
+
1688
+ Object.entries(fc.fnMap).forEach(([f, fnMeta]) => {
1689
+ const hits = fc.f[f];
1690
+ const mapping = this.resolveMapping(
1691
+ sourceMap,
1692
+ fnMeta.decl,
1693
+ fc.path
1694
+ );
1695
+
1696
+ const spanMapping = this.resolveMapping(
1697
+ sourceMap,
1698
+ fnMeta.loc,
1699
+ fc.path
1700
+ );
1701
+
1702
+ if (
1703
+ mapping &&
1704
+ spanMapping &&
1705
+ mapping.source === spanMapping.source
1706
+ ) {
1707
+ changes += 1;
1708
+ const mappedCoverage = coverageMapper(mapping.source);
1709
+ mappedCoverage.addFunction(
1710
+ fnMeta.name,
1711
+ mapping.loc,
1712
+ spanMapping.loc,
1713
+ hits
1714
+ );
1715
+ }
1716
+ });
1717
+
1718
+ Object.entries(fc.branchMap).forEach(([b, branchMeta]) => {
1719
+ const hits = fc.b[b];
1720
+ const locs = [];
1721
+ const mappedHits = [];
1722
+ let source;
1723
+ let skip;
1724
+
1725
+ branchMeta.locations.forEach((loc, i) => {
1726
+ const mapping = this.resolveMapping(sourceMap, loc, fc.path);
1727
+ if (mapping) {
1728
+ if (!source) {
1729
+ source = mapping.source;
1730
+ }
1731
+
1732
+ if (mapping.source !== source) {
1733
+ skip = true;
1734
+ }
1735
+
1736
+ locs.push(mapping.loc);
1737
+ mappedHits.push(hits[i]);
1738
+ }
1739
+ // Check if this is an implicit else
1740
+ else if (
1741
+ source &&
1742
+ branchMeta.type === 'if' &&
1743
+ i > 0 &&
1744
+ loc.start.line === undefined &&
1745
+ loc.start.end === undefined &&
1746
+ loc.end.line === undefined &&
1747
+ loc.end.end === undefined
1748
+ ) {
1749
+ locs.push(loc);
1750
+ mappedHits.push(hits[i]);
1751
+ }
1752
+ });
1753
+
1754
+ const locMapping = branchMeta.loc
1755
+ ? this.resolveMapping(sourceMap, branchMeta.loc, fc.path)
1756
+ : null;
1757
+
1758
+ if (!skip && locs.length > 0) {
1759
+ changes += 1;
1760
+ const mappedCoverage = coverageMapper(source);
1761
+ mappedCoverage.addBranch(
1762
+ branchMeta.type,
1763
+ locMapping ? locMapping.loc : locs[0],
1764
+ locs,
1765
+ mappedHits
1766
+ );
1767
+ }
1768
+ });
1769
+
1770
+ return changes > 0;
1771
+ }
1772
+
1773
+ async transform(coverageMap) {
1774
+ const uniqueFiles = {};
1775
+ const getMappedCoverage = file => {
1776
+ const key = getUniqueKey(file);
1777
+ if (!uniqueFiles[key]) {
1778
+ uniqueFiles[key] = {
1779
+ file,
1780
+ mappedCoverage: new MappedCoverage(file)
1781
+ };
1782
+ }
1783
+
1784
+ return uniqueFiles[key].mappedCoverage;
1785
+ };
1786
+
1787
+ for (const file of coverageMap.files()) {
1788
+ const fc = coverageMap.fileCoverageFor(file);
1789
+ const sourceMap = await this.finder(file, fc);
1790
+
1791
+ if (sourceMap) {
1792
+ const changed = this.processFile(
1793
+ fc,
1794
+ sourceMap,
1795
+ getMappedCoverage
1796
+ );
1797
+ if (!changed) {
1798
+ debug(`File [${file}] ignored, nothing could be mapped`);
1799
+ }
1800
+ } else {
1801
+ uniqueFiles[getUniqueKey(file)] = {
1802
+ file,
1803
+ mappedCoverage: new MappedCoverage(fc)
1804
+ };
1805
+ }
1806
+ }
1807
+
1808
+ return libCoverage.createCoverageMap(getOutput(uniqueFiles));
1809
+ }
1810
+ }
1811
+
1812
+ transformer = {
1813
+ SourceMapTransformer
1814
+ };
1815
+ return transformer;
1816
+ }
1817
+
1818
+ /*
1819
+ Copyright 2015, Yahoo Inc.
1820
+ Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
1821
+ */
1822
+
1823
+ var mapStore;
1824
+ var hasRequiredMapStore;
1825
+
1826
+ function requireMapStore () {
1827
+ if (hasRequiredMapStore) return mapStore;
1828
+ hasRequiredMapStore = 1;
1829
+
1830
+ const path = require$$0$1;
1831
+ const fs = require$$1$2;
1832
+ const debug = requireSrc()('istanbuljs');
1833
+ const { TraceMap, sourceContentFor } = require$$3;
1834
+ const pathutils = requirePathutils();
1835
+ const { SourceMapTransformer } = requireTransformer();
1836
+
1837
+ /**
1838
+ * Tracks source maps for registered files
1839
+ */
1840
+ class MapStore {
1841
+ /**
1842
+ * @param {Object} opts [opts=undefined] options.
1843
+ * @param {Boolean} opts.verbose [opts.verbose=false] verbose mode
1844
+ * @param {String} opts.baseDir [opts.baseDir=null] alternate base directory
1845
+ * to resolve sourcemap files
1846
+ * @param {Class} opts.SourceStore [opts.SourceStore=Map] class to use for
1847
+ * SourceStore. Must support `get`, `set` and `clear` methods.
1848
+ * @param {Array} opts.sourceStoreOpts [opts.sourceStoreOpts=[]] arguments
1849
+ * to use in the SourceStore constructor.
1850
+ * @constructor
1851
+ */
1852
+ constructor(opts) {
1853
+ opts = {
1854
+ baseDir: null,
1855
+ verbose: false,
1856
+ SourceStore: Map,
1857
+ sourceStoreOpts: [],
1858
+ ...opts
1859
+ };
1860
+ this.baseDir = opts.baseDir;
1861
+ this.verbose = opts.verbose;
1862
+ this.sourceStore = new opts.SourceStore(...opts.sourceStoreOpts);
1863
+ this.data = Object.create(null);
1864
+ this.sourceFinder = this.sourceFinder.bind(this);
1865
+ }
1866
+
1867
+ /**
1868
+ * Registers a source map URL with this store. It makes some input sanity checks
1869
+ * and silently fails on malformed input.
1870
+ * @param transformedFilePath - the file path for which the source map is valid.
1871
+ * This must *exactly* match the path stashed for the coverage object to be
1872
+ * useful.
1873
+ * @param sourceMapUrl - the source map URL, **not** a comment
1874
+ */
1875
+ registerURL(transformedFilePath, sourceMapUrl) {
1876
+ const d = 'data:';
1877
+
1878
+ if (
1879
+ sourceMapUrl.length > d.length &&
1880
+ sourceMapUrl.substring(0, d.length) === d
1881
+ ) {
1882
+ const b64 = 'base64,';
1883
+ const pos = sourceMapUrl.indexOf(b64);
1884
+ if (pos > 0) {
1885
+ this.data[transformedFilePath] = {
1886
+ type: 'encoded',
1887
+ data: sourceMapUrl.substring(pos + b64.length)
1888
+ };
1889
+ } else {
1890
+ debug(`Unable to interpret source map URL: ${sourceMapUrl}`);
1891
+ }
1892
+
1893
+ return;
1894
+ }
1895
+
1896
+ const dir = path.dirname(path.resolve(transformedFilePath));
1897
+ const file = path.resolve(dir, sourceMapUrl);
1898
+ this.data[transformedFilePath] = { type: 'file', data: file };
1899
+ }
1900
+
1901
+ /**
1902
+ * Registers a source map object with this store. Makes some basic sanity checks
1903
+ * and silently fails on malformed input.
1904
+ * @param transformedFilePath - the file path for which the source map is valid
1905
+ * @param sourceMap - the source map object
1906
+ */
1907
+ registerMap(transformedFilePath, sourceMap) {
1908
+ if (sourceMap && sourceMap.version) {
1909
+ this.data[transformedFilePath] = {
1910
+ type: 'object',
1911
+ data: sourceMap
1912
+ };
1913
+ } else {
1914
+ debug(
1915
+ 'Invalid source map object: ' +
1916
+ JSON.stringify(sourceMap, null, 2)
1917
+ );
1918
+ }
1919
+ }
1920
+
1921
+ /**
1922
+ * Retrieve a source map object from this store.
1923
+ * @param filePath - the file path for which the source map is valid
1924
+ * @returns {Object} a parsed source map object
1925
+ */
1926
+ getSourceMapSync(filePath) {
1927
+ try {
1928
+ if (!this.data[filePath]) {
1929
+ return;
1930
+ }
1931
+
1932
+ const d = this.data[filePath];
1933
+ if (d.type === 'file') {
1934
+ return JSON.parse(fs.readFileSync(d.data, 'utf8'));
1935
+ }
1936
+
1937
+ if (d.type === 'encoded') {
1938
+ return JSON.parse(Buffer.from(d.data, 'base64').toString());
1939
+ }
1940
+
1941
+ /* The caller might delete properties */
1942
+ return {
1943
+ ...d.data
1944
+ };
1945
+ } catch (error) {
1946
+ debug('Error returning source map for ' + filePath);
1947
+ debug(error.stack);
1948
+
1949
+ return;
1950
+ }
1951
+ }
1952
+
1953
+ /**
1954
+ * Add inputSourceMap property to coverage data
1955
+ * @param coverageData - the __coverage__ object
1956
+ * @returns {Object} a parsed source map object
1957
+ */
1958
+ addInputSourceMapsSync(coverageData) {
1959
+ Object.entries(coverageData).forEach(([filePath, data]) => {
1960
+ if (data.inputSourceMap) {
1961
+ return;
1962
+ }
1963
+
1964
+ const sourceMap = this.getSourceMapSync(filePath);
1965
+ if (sourceMap) {
1966
+ data.inputSourceMap = sourceMap;
1967
+ /* This huge property is not needed. */
1968
+ delete data.inputSourceMap.sourcesContent;
1969
+ }
1970
+ });
1971
+ }
1972
+
1973
+ sourceFinder(filePath) {
1974
+ const content = this.sourceStore.get(filePath);
1975
+ if (content !== undefined) {
1976
+ return content;
1977
+ }
1978
+
1979
+ if (path.isAbsolute(filePath)) {
1980
+ return fs.readFileSync(filePath, 'utf8');
1981
+ }
1982
+
1983
+ return fs.readFileSync(
1984
+ pathutils.asAbsolute(filePath, this.baseDir),
1985
+ 'utf8'
1986
+ );
1987
+ }
1988
+
1989
+ /**
1990
+ * Transforms the coverage map provided into one that refers to original
1991
+ * sources when valid mappings have been registered with this store.
1992
+ * @param {CoverageMap} coverageMap - the coverage map to transform
1993
+ * @returns {Promise<CoverageMap>} the transformed coverage map
1994
+ */
1995
+ async transformCoverage(coverageMap) {
1996
+ const hasInputSourceMaps = coverageMap
1997
+ .files()
1998
+ .some(
1999
+ file => coverageMap.fileCoverageFor(file).data.inputSourceMap
2000
+ );
2001
+
2002
+ if (!hasInputSourceMaps && Object.keys(this.data).length === 0) {
2003
+ return coverageMap;
2004
+ }
2005
+
2006
+ const transformer = new SourceMapTransformer(
2007
+ async (filePath, coverage) => {
2008
+ try {
2009
+ const obj =
2010
+ coverage.data.inputSourceMap ||
2011
+ this.getSourceMapSync(filePath);
2012
+ if (!obj) {
2013
+ return null;
2014
+ }
2015
+
2016
+ const smc = new TraceMap(obj);
2017
+ smc.sources.forEach(s => {
2018
+ if (s) {
2019
+ const content = sourceContentFor(smc, s);
2020
+ if (content) {
2021
+ const sourceFilePath = pathutils.relativeTo(
2022
+ s,
2023
+ filePath
2024
+ );
2025
+ this.sourceStore.set(sourceFilePath, content);
2026
+ }
2027
+ }
2028
+ });
2029
+
2030
+ return smc;
2031
+ } catch (error) {
2032
+ debug('Error returning source map for ' + filePath);
2033
+ debug(error.stack);
2034
+
2035
+ return null;
2036
+ }
2037
+ }
2038
+ );
2039
+
2040
+ return await transformer.transform(coverageMap);
2041
+ }
2042
+
2043
+ /**
2044
+ * Disposes temporary resources allocated by this map store
2045
+ */
2046
+ dispose() {
2047
+ this.sourceStore.clear();
2048
+ }
2049
+ }
2050
+
2051
+ mapStore = { MapStore };
2052
+ return mapStore;
2053
+ }
2054
+
2055
+ /*
2056
+ Copyright 2012-2015, Yahoo Inc.
2057
+ Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
2058
+ */
2059
+
2060
+ var istanbulLibSourceMaps;
2061
+ var hasRequiredIstanbulLibSourceMaps;
2062
+
2063
+ function requireIstanbulLibSourceMaps () {
2064
+ if (hasRequiredIstanbulLibSourceMaps) return istanbulLibSourceMaps;
2065
+ hasRequiredIstanbulLibSourceMaps = 1;
2066
+
2067
+ const { MapStore } = requireMapStore();
2068
+ /**
2069
+ * @module Exports
2070
+ */
2071
+ istanbulLibSourceMaps = {
2072
+ createSourceMapStore(opts) {
2073
+ return new MapStore(opts);
2074
+ }
2075
+ };
2076
+ return istanbulLibSourceMaps;
2077
+ }
2078
+
2079
+ var istanbulLibSourceMapsExports = requireIstanbulLibSourceMaps();
2080
+ var libSourceMaps = /*@__PURE__*/getDefaultExportFromCjs(istanbulLibSourceMapsExports);
2081
+
2082
+ var version = "4.0.18";
18
2083
 
19
2084
  const debug = createDebug("vitest:coverage");
20
2085
  class IstanbulCoverageProvider extends BaseCoverageProvider {
@@ -88,7 +2153,7 @@ class IstanbulCoverageProvider extends BaseCoverageProvider {
88
2153
  };
89
2154
  }
90
2155
  createCoverageMap() {
91
- return libCoverage.createCoverageMap({});
2156
+ return require$$0$2.createCoverageMap({});
92
2157
  }
93
2158
  async generateCoverage({ allTestsRun }) {
94
2159
  const start = debug.enabled ? performance.now() : 0;