@vitest/snapshot 4.0.0-beta.10 → 4.0.0-beta.11

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/index.js +158 -960
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1,131 +1,106 @@
1
- import { resolve as resolve$1 } from 'pathe';
1
+ import { resolve } from 'pathe';
2
2
  import { plugins, format } from '@vitest/pretty-format';
3
3
 
4
- const comma = ','.charCodeAt(0);
5
- const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
6
- const intToChar = new Uint8Array(64); // 64 possible chars.
7
- const charToInt = new Uint8Array(128); // z is 122 in ASCII
4
+ // src/vlq.ts
5
+ var comma = ",".charCodeAt(0);
6
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
7
+ var intToChar = new Uint8Array(64);
8
+ var charToInt = new Uint8Array(128);
8
9
  for (let i = 0; i < chars.length; i++) {
9
- const c = chars.charCodeAt(i);
10
- intToChar[i] = c;
11
- charToInt[c] = i;
10
+ const c = chars.charCodeAt(i);
11
+ intToChar[i] = c;
12
+ charToInt[c] = i;
12
13
  }
13
14
  function decodeInteger(reader, relative) {
14
- let value = 0;
15
- let shift = 0;
16
- let integer = 0;
17
- do {
18
- const c = reader.next();
19
- integer = charToInt[c];
20
- value |= (integer & 31) << shift;
21
- shift += 5;
22
- } while (integer & 32);
23
- const shouldNegate = value & 1;
24
- value >>>= 1;
25
- if (shouldNegate) {
26
- value = -2147483648 | -value;
27
- }
28
- return relative + value;
15
+ let value = 0;
16
+ let shift = 0;
17
+ let integer = 0;
18
+ do {
19
+ const c = reader.next();
20
+ integer = charToInt[c];
21
+ value |= (integer & 31) << shift;
22
+ shift += 5;
23
+ } while (integer & 32);
24
+ const shouldNegate = value & 1;
25
+ value >>>= 1;
26
+ if (shouldNegate) {
27
+ value = -2147483648 | -value;
28
+ }
29
+ return relative + value;
29
30
  }
30
31
  function hasMoreVlq(reader, max) {
31
- if (reader.pos >= max)
32
- return false;
33
- return reader.peek() !== comma;
34
- }
35
- class StringReader {
36
- constructor(buffer) {
37
- this.pos = 0;
38
- this.buffer = buffer;
39
- }
40
- next() {
41
- return this.buffer.charCodeAt(this.pos++);
42
- }
43
- peek() {
44
- return this.buffer.charCodeAt(this.pos);
45
- }
46
- indexOf(char) {
47
- const { buffer, pos } = this;
48
- const idx = buffer.indexOf(char, pos);
49
- return idx === -1 ? buffer.length : idx;
50
- }
32
+ if (reader.pos >= max) return false;
33
+ return reader.peek() !== comma;
51
34
  }
35
+ var StringReader = class {
36
+ constructor(buffer) {
37
+ this.pos = 0;
38
+ this.buffer = buffer;
39
+ }
40
+ next() {
41
+ return this.buffer.charCodeAt(this.pos++);
42
+ }
43
+ peek() {
44
+ return this.buffer.charCodeAt(this.pos);
45
+ }
46
+ indexOf(char) {
47
+ const { buffer, pos } = this;
48
+ const idx = buffer.indexOf(char, pos);
49
+ return idx === -1 ? buffer.length : idx;
50
+ }
51
+ };
52
52
 
53
+ // src/sourcemap-codec.ts
53
54
  function decode(mappings) {
54
- const { length } = mappings;
55
- const reader = new StringReader(mappings);
56
- const decoded = [];
57
- let genColumn = 0;
58
- let sourcesIndex = 0;
59
- let sourceLine = 0;
60
- let sourceColumn = 0;
61
- let namesIndex = 0;
62
- do {
63
- const semi = reader.indexOf(';');
64
- const line = [];
65
- let sorted = true;
66
- let lastCol = 0;
67
- genColumn = 0;
68
- while (reader.pos < semi) {
69
- let seg;
70
- genColumn = decodeInteger(reader, genColumn);
71
- if (genColumn < lastCol)
72
- sorted = false;
73
- lastCol = genColumn;
74
- if (hasMoreVlq(reader, semi)) {
75
- sourcesIndex = decodeInteger(reader, sourcesIndex);
76
- sourceLine = decodeInteger(reader, sourceLine);
77
- sourceColumn = decodeInteger(reader, sourceColumn);
78
- if (hasMoreVlq(reader, semi)) {
79
- namesIndex = decodeInteger(reader, namesIndex);
80
- seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
81
- }
82
- else {
83
- seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
84
- }
85
- }
86
- else {
87
- seg = [genColumn];
88
- }
89
- line.push(seg);
90
- reader.pos++;
55
+ const { length } = mappings;
56
+ const reader = new StringReader(mappings);
57
+ const decoded = [];
58
+ let genColumn = 0;
59
+ let sourcesIndex = 0;
60
+ let sourceLine = 0;
61
+ let sourceColumn = 0;
62
+ let namesIndex = 0;
63
+ do {
64
+ const semi = reader.indexOf(";");
65
+ const line = [];
66
+ let sorted = true;
67
+ let lastCol = 0;
68
+ genColumn = 0;
69
+ while (reader.pos < semi) {
70
+ let seg;
71
+ genColumn = decodeInteger(reader, genColumn);
72
+ if (genColumn < lastCol) sorted = false;
73
+ lastCol = genColumn;
74
+ if (hasMoreVlq(reader, semi)) {
75
+ sourcesIndex = decodeInteger(reader, sourcesIndex);
76
+ sourceLine = decodeInteger(reader, sourceLine);
77
+ sourceColumn = decodeInteger(reader, sourceColumn);
78
+ if (hasMoreVlq(reader, semi)) {
79
+ namesIndex = decodeInteger(reader, namesIndex);
80
+ seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
81
+ } else {
82
+ seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
91
83
  }
92
- if (!sorted)
93
- sort(line);
94
- decoded.push(line);
95
- reader.pos = semi + 1;
96
- } while (reader.pos <= length);
97
- return decoded;
84
+ } else {
85
+ seg = [genColumn];
86
+ }
87
+ line.push(seg);
88
+ reader.pos++;
89
+ }
90
+ if (!sorted) sort(line);
91
+ decoded.push(line);
92
+ reader.pos = semi + 1;
93
+ } while (reader.pos <= length);
94
+ return decoded;
98
95
  }
99
96
  function sort(line) {
100
- line.sort(sortComparator$1);
97
+ line.sort(sortComparator);
101
98
  }
102
- function sortComparator$1(a, b) {
103
- return a[0] - b[0];
99
+ function sortComparator(a, b) {
100
+ return a[0] - b[0];
104
101
  }
105
102
 
106
103
  // Matches the scheme of a URL, eg "http://"
107
- const schemeRegex = /^[\w+.-]+:\/\//;
108
- /**
109
- * Matches the parts of a URL:
110
- * 1. Scheme, including ":", guaranteed.
111
- * 2. User/password, including "@", optional.
112
- * 3. Host, guaranteed.
113
- * 4. Port, including ":", optional.
114
- * 5. Path, including "/", optional.
115
- * 6. Query, including "?", optional.
116
- * 7. Hash, including "#", optional.
117
- */
118
- const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
119
- /**
120
- * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
121
- * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
122
- *
123
- * 1. Host, optional.
124
- * 2. Path, which may include "/", guaranteed.
125
- * 3. Query, including "?", optional.
126
- * 4. Hash, including "#", optional.
127
- */
128
- const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
129
104
  var UrlType;
130
105
  (function (UrlType) {
131
106
  UrlType[UrlType["Empty"] = 1] = "Empty";
@@ -136,229 +111,9 @@ var UrlType;
136
111
  UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative";
137
112
  UrlType[UrlType["Absolute"] = 7] = "Absolute";
138
113
  })(UrlType || (UrlType = {}));
139
- function isAbsoluteUrl(input) {
140
- return schemeRegex.test(input);
141
- }
142
- function isSchemeRelativeUrl(input) {
143
- return input.startsWith('//');
144
- }
145
- function isAbsolutePath(input) {
146
- return input.startsWith('/');
147
- }
148
- function isFileUrl(input) {
149
- return input.startsWith('file:');
150
- }
151
- function isRelative(input) {
152
- return /^[.?#]/.test(input);
153
- }
154
- function parseAbsoluteUrl(input) {
155
- const match = urlRegex.exec(input);
156
- return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');
157
- }
158
- function parseFileUrl(input) {
159
- const match = fileRegex.exec(input);
160
- const path = match[2];
161
- return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');
162
- }
163
- function makeUrl(scheme, user, host, port, path, query, hash) {
164
- return {
165
- scheme,
166
- user,
167
- host,
168
- port,
169
- path,
170
- query,
171
- hash,
172
- type: UrlType.Absolute,
173
- };
174
- }
175
- function parseUrl(input) {
176
- if (isSchemeRelativeUrl(input)) {
177
- const url = parseAbsoluteUrl('http:' + input);
178
- url.scheme = '';
179
- url.type = UrlType.SchemeRelative;
180
- return url;
181
- }
182
- if (isAbsolutePath(input)) {
183
- const url = parseAbsoluteUrl('http://foo.com' + input);
184
- url.scheme = '';
185
- url.host = '';
186
- url.type = UrlType.AbsolutePath;
187
- return url;
188
- }
189
- if (isFileUrl(input))
190
- return parseFileUrl(input);
191
- if (isAbsoluteUrl(input))
192
- return parseAbsoluteUrl(input);
193
- const url = parseAbsoluteUrl('http://foo.com/' + input);
194
- url.scheme = '';
195
- url.host = '';
196
- url.type = input
197
- ? input.startsWith('?')
198
- ? UrlType.Query
199
- : input.startsWith('#')
200
- ? UrlType.Hash
201
- : UrlType.RelativePath
202
- : UrlType.Empty;
203
- return url;
204
- }
205
- function stripPathFilename(path) {
206
- // If a path ends with a parent directory "..", then it's a relative path with excess parent
207
- // paths. It's not a file, so we can't strip it.
208
- if (path.endsWith('/..'))
209
- return path;
210
- const index = path.lastIndexOf('/');
211
- return path.slice(0, index + 1);
212
- }
213
- function mergePaths(url, base) {
214
- normalizePath(base, base.type);
215
- // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative
216
- // path).
217
- if (url.path === '/') {
218
- url.path = base.path;
219
- }
220
- else {
221
- // Resolution happens relative to the base path's directory, not the file.
222
- url.path = stripPathFilename(base.path) + url.path;
223
- }
224
- }
225
- /**
226
- * The path can have empty directories "//", unneeded parents "foo/..", or current directory
227
- * "foo/.". We need to normalize to a standard representation.
228
- */
229
- function normalizePath(url, type) {
230
- const rel = type <= UrlType.RelativePath;
231
- const pieces = url.path.split('/');
232
- // We need to preserve the first piece always, so that we output a leading slash. The item at
233
- // pieces[0] is an empty string.
234
- let pointer = 1;
235
- // Positive is the number of real directories we've output, used for popping a parent directory.
236
- // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo".
237
- let positive = 0;
238
- // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will
239
- // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a
240
- // real directory, we won't need to append, unless the other conditions happen again.
241
- let addTrailingSlash = false;
242
- for (let i = 1; i < pieces.length; i++) {
243
- const piece = pieces[i];
244
- // An empty directory, could be a trailing slash, or just a double "//" in the path.
245
- if (!piece) {
246
- addTrailingSlash = true;
247
- continue;
248
- }
249
- // If we encounter a real directory, then we don't need to append anymore.
250
- addTrailingSlash = false;
251
- // A current directory, which we can always drop.
252
- if (piece === '.')
253
- continue;
254
- // A parent directory, we need to see if there are any real directories we can pop. Else, we
255
- // have an excess of parents, and we'll need to keep the "..".
256
- if (piece === '..') {
257
- if (positive) {
258
- addTrailingSlash = true;
259
- positive--;
260
- pointer--;
261
- }
262
- else if (rel) {
263
- // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute
264
- // URL, protocol relative URL, or an absolute path, we don't need to keep excess.
265
- pieces[pointer++] = piece;
266
- }
267
- continue;
268
- }
269
- // We've encountered a real directory. Move it to the next insertion pointer, which accounts for
270
- // any popped or dropped directories.
271
- pieces[pointer++] = piece;
272
- positive++;
273
- }
274
- let path = '';
275
- for (let i = 1; i < pointer; i++) {
276
- path += '/' + pieces[i];
277
- }
278
- if (!path || (addTrailingSlash && !path.endsWith('/..'))) {
279
- path += '/';
280
- }
281
- url.path = path;
282
- }
283
- /**
284
- * Attempts to resolve `input` URL/path relative to `base`.
285
- */
286
- function resolve(input, base) {
287
- if (!input && !base)
288
- return '';
289
- const url = parseUrl(input);
290
- let inputType = url.type;
291
- if (base && inputType !== UrlType.Absolute) {
292
- const baseUrl = parseUrl(base);
293
- const baseType = baseUrl.type;
294
- switch (inputType) {
295
- case UrlType.Empty:
296
- url.hash = baseUrl.hash;
297
- // fall through
298
- case UrlType.Hash:
299
- url.query = baseUrl.query;
300
- // fall through
301
- case UrlType.Query:
302
- case UrlType.RelativePath:
303
- mergePaths(url, baseUrl);
304
- // fall through
305
- case UrlType.AbsolutePath:
306
- // The host, user, and port are joined, you can't copy one without the others.
307
- url.user = baseUrl.user;
308
- url.host = baseUrl.host;
309
- url.port = baseUrl.port;
310
- // fall through
311
- case UrlType.SchemeRelative:
312
- // The input doesn't have a schema at least, so we need to copy at least that over.
313
- url.scheme = baseUrl.scheme;
314
- }
315
- if (baseType > inputType)
316
- inputType = baseType;
317
- }
318
- normalizePath(url, inputType);
319
- const queryHash = url.query + url.hash;
320
- switch (inputType) {
321
- // This is impossible, because of the empty checks at the start of the function.
322
- // case UrlType.Empty:
323
- case UrlType.Hash:
324
- case UrlType.Query:
325
- return queryHash;
326
- case UrlType.RelativePath: {
327
- // The first char is always a "/", and we need it to be relative.
328
- const path = url.path.slice(1);
329
- if (!path)
330
- return queryHash || '.';
331
- if (isRelative(base || input) && !isRelative(path)) {
332
- // If base started with a leading ".", or there is no base and input started with a ".",
333
- // then we need to ensure that the relative path starts with a ".". We don't know if
334
- // relative starts with a "..", though, so check before prepending.
335
- return './' + path + queryHash;
336
- }
337
- return path + queryHash;
338
- }
339
- case UrlType.AbsolutePath:
340
- return url.path + queryHash;
341
- default:
342
- return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
343
- }
344
- }
345
114
 
346
115
  // src/trace-mapping.ts
347
116
 
348
- // src/strip-filename.ts
349
- function stripFilename(path) {
350
- if (!path) return "";
351
- const index = path.lastIndexOf("/");
352
- return path.slice(0, index + 1);
353
- }
354
-
355
- // src/resolve.ts
356
- function resolver(mapUrl, sourceRoot) {
357
- const from = stripFilename(mapUrl);
358
- const prefix = sourceRoot ? sourceRoot + "/" : "";
359
- return (source) => resolve(prefix + (source || ""), from);
360
- }
361
-
362
117
  // src/sourcemap-segment.ts
363
118
  var COLUMN = 0;
364
119
  var SOURCES_INDEX = 1;
@@ -366,38 +121,6 @@ var SOURCE_LINE = 2;
366
121
  var SOURCE_COLUMN = 3;
367
122
  var NAMES_INDEX = 4;
368
123
 
369
- // src/sort.ts
370
- function maybeSort(mappings, owned) {
371
- const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
372
- if (unsortedIndex === mappings.length) return mappings;
373
- if (!owned) mappings = mappings.slice();
374
- for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
375
- mappings[i] = sortSegments(mappings[i], owned);
376
- }
377
- return mappings;
378
- }
379
- function nextUnsortedSegmentLine(mappings, start) {
380
- for (let i = start; i < mappings.length; i++) {
381
- if (!isSorted(mappings[i])) return i;
382
- }
383
- return mappings.length;
384
- }
385
- function isSorted(line) {
386
- for (let j = 1; j < line.length; j++) {
387
- if (line[j][COLUMN] < line[j - 1][COLUMN]) {
388
- return false;
389
- }
390
- }
391
- return true;
392
- }
393
- function sortSegments(line, owned) {
394
- if (!owned) line = line.slice();
395
- return line.sort(sortComparator);
396
- }
397
- function sortComparator(a, b) {
398
- return a[COLUMN] - b[COLUMN];
399
- }
400
-
401
124
  // src/binary-search.ts
402
125
  var found = false;
403
126
  function binarySearch(haystack, needle, low, high) {
@@ -429,13 +152,6 @@ function lowerBound(haystack, needle, index) {
429
152
  }
430
153
  return index;
431
154
  }
432
- function memoizedState() {
433
- return {
434
- lastKey: -1,
435
- lastNeedle: -1,
436
- lastIndex: -1
437
- };
438
- }
439
155
  function memoizedBinarySearch(haystack, needle, state, key) {
440
156
  const { lastKey, lastNeedle, lastIndex } = state;
441
157
  let low = 0;
@@ -456,48 +172,11 @@ function memoizedBinarySearch(haystack, needle, state, key) {
456
172
  return state.lastIndex = binarySearch(haystack, needle, low, high);
457
173
  }
458
174
 
459
- // src/types.ts
460
- function parse(map) {
461
- return typeof map === "string" ? JSON.parse(map) : map;
462
- }
463
-
464
175
  // src/trace-mapping.ts
465
176
  var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
466
177
  var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
467
178
  var LEAST_UPPER_BOUND = -1;
468
179
  var GREATEST_LOWER_BOUND = 1;
469
- var TraceMap = class {
470
- constructor(map, mapUrl) {
471
- const isString = typeof map === "string";
472
- if (!isString && map._decodedMemo) return map;
473
- const parsed = parse(map);
474
- const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
475
- this.version = version;
476
- this.file = file;
477
- this.names = names || [];
478
- this.sourceRoot = sourceRoot;
479
- this.sources = sources;
480
- this.sourcesContent = sourcesContent;
481
- this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
482
- const resolve = resolver(mapUrl, sourceRoot);
483
- this.resolvedSources = sources.map(resolve);
484
- const { mappings } = parsed;
485
- if (typeof mappings === "string") {
486
- this._encoded = mappings;
487
- this._decoded = void 0;
488
- } else if (Array.isArray(mappings)) {
489
- this._encoded = void 0;
490
- this._decoded = maybeSort(mappings, isString);
491
- } else if (parsed.sections) {
492
- throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
493
- } else {
494
- throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
495
- }
496
- this._decodedMemo = memoizedState();
497
- this._bySources = void 0;
498
- this._bySourceMemos = void 0;
499
- }
500
- };
501
180
  function cast(map) {
502
181
  return map;
503
182
  }
@@ -656,14 +335,35 @@ function parseSingleFFOrSafariStack(raw) {
656
335
  if (line.includes(" > eval")) {
657
336
  line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
658
337
  }
659
- if (!line.includes("@") && !line.includes(":")) {
338
+ // Early return for lines that don't look like Firefox/Safari stack traces
339
+ // Firefox/Safari stack traces must contain '@' and should have location info after it
340
+ if (!line.includes("@")) {
660
341
  return null;
661
342
  }
662
- // eslint-disable-next-line regexp/no-super-linear-backtracking, regexp/optimal-quantifier-concatenation
663
- const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(@)/;
664
- const matches = line.match(functionNameRegex);
665
- const functionName = matches && matches[1] ? matches[1] : undefined;
666
- const [url, lineNumber, columnNumber] = extractLocation(line.replace(functionNameRegex, ""));
343
+ // Find the correct @ that separates function name from location
344
+ // For cases like '@https://@fs/path' or 'functionName@https://@fs/path'
345
+ // we need to find the first @ that precedes a valid location (containing :)
346
+ let atIndex = -1;
347
+ let locationPart = "";
348
+ let functionName;
349
+ // Try each @ from left to right to find the one that gives us a valid location
350
+ for (let i = 0; i < line.length; i++) {
351
+ if (line[i] === "@") {
352
+ const candidateLocation = line.slice(i + 1);
353
+ // Minimum length 3 for valid location: 1 for filename + 1 for colon + 1 for line number (e.g., "a:1")
354
+ if (candidateLocation.includes(":") && candidateLocation.length >= 3) {
355
+ atIndex = i;
356
+ locationPart = candidateLocation;
357
+ functionName = i > 0 ? line.slice(0, i) : undefined;
358
+ break;
359
+ }
360
+ }
361
+ }
362
+ // Validate we found a valid location with minimum length (filename:line format)
363
+ if (atIndex === -1 || !locationPart.includes(":") || locationPart.length < 3) {
364
+ return null;
365
+ }
366
+ const [url, lineNumber, columnNumber] = extractLocation(locationPart);
667
367
  if (!url || !lineNumber || !columnNumber) {
668
368
  return null;
669
369
  }
@@ -705,9 +405,9 @@ function parseSingleV8Stack(raw) {
705
405
  file = file.slice(7);
706
406
  }
707
407
  // normalize Windows path (\ -> /)
708
- file = file.startsWith("node:") || file.startsWith("internal:") ? file : resolve$1(file);
408
+ file = file.startsWith("node:") || file.startsWith("internal:") ? file : resolve(file);
709
409
  if (method) {
710
- method = method.replace(/__vite_ssr_import_\d+__\./g, "");
410
+ method = method.replace(/__vite_ssr_import_\d+__\./g, "").replace(/(Object\.)?__vite_ssr_export_default__\s?/g, "");
711
411
  }
712
412
  return {
713
413
  method,
@@ -728,17 +428,15 @@ function parseStacktrace(stack, options = {}) {
728
428
  if (!map || typeof map !== "object" || !map.version) {
729
429
  return shouldFilter(ignoreStackEntries, stack.file) ? null : stack;
730
430
  }
731
- const traceMap = new TraceMap(map);
732
- const { line, column, source, name } = originalPositionFor(traceMap, stack);
733
- let file = stack.file;
734
- if (source) {
735
- const fileUrl = stack.file.startsWith("file://") ? stack.file : `file://${stack.file}`;
736
- const sourceRootUrl = map.sourceRoot ? new URL(map.sourceRoot, fileUrl) : fileUrl;
737
- file = new URL(source, sourceRootUrl).pathname;
738
- // if the file path is on windows, we need to remove the leading slash
739
- if (file.match(/\/\w:\//)) {
740
- file = file.slice(1);
741
- }
431
+ const traceMap = new DecodedMap(map, stack.file);
432
+ const position = getOriginalPosition(traceMap, stack);
433
+ if (!position) {
434
+ return stack;
435
+ }
436
+ const { line, column, source, name } = position;
437
+ let file = source || stack.file;
438
+ if (file.match(/\/\w:\//)) {
439
+ file = file.slice(1);
742
440
  }
743
441
  if (shouldFilter(ignoreStackEntries, file)) {
744
442
  return null;
@@ -789,544 +487,40 @@ function parseErrorStacktrace(e, options = {}) {
789
487
  e.stacks = stackFrames;
790
488
  return stackFrames;
791
489
  }
792
-
793
- const { AsymmetricMatcher: AsymmetricMatcher$1, DOMCollection: DOMCollection$1, DOMElement: DOMElement$1, Immutable: Immutable$1, ReactElement: ReactElement$1, ReactTestComponent: ReactTestComponent$1 } = plugins;
794
-
795
- function getDefaultExportFromCjs (x) {
796
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
490
+ class DecodedMap {
491
+ _encoded;
492
+ _decoded;
493
+ _decodedMemo;
494
+ url;
495
+ version;
496
+ names = [];
497
+ resolvedSources;
498
+ constructor(map, from) {
499
+ this.map = map;
500
+ const { mappings, names, sources } = map;
501
+ this.version = map.version;
502
+ this.names = names || [];
503
+ this._encoded = mappings || "";
504
+ this._decodedMemo = memoizedState();
505
+ this.url = from;
506
+ this.resolvedSources = (sources || []).map((s) => resolve(s || "", from));
507
+ }
797
508
  }
798
-
799
- var jsTokens_1;
800
- var hasRequiredJsTokens;
801
-
802
- function requireJsTokens () {
803
- if (hasRequiredJsTokens) return jsTokens_1;
804
- hasRequiredJsTokens = 1;
805
- // Copyright 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Simon Lydell
806
- // License: MIT.
807
- var Identifier, JSXIdentifier, JSXPunctuator, JSXString, JSXText, KeywordsWithExpressionAfter, KeywordsWithNoLineTerminatorAfter, LineTerminatorSequence, MultiLineComment, Newline, NumericLiteral, Punctuator, RegularExpressionLiteral, SingleLineComment, StringLiteral, Template, TokensNotPrecedingObjectLiteral, TokensPrecedingExpression, WhiteSpace;
808
- RegularExpressionLiteral = /\/(?![*\/])(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\\]).|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/yu;
809
- Punctuator = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y;
810
- Identifier = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/yu;
811
- StringLiteral = /(['"])(?:(?!\1)[^\\\n\r]|\\(?:\r\n|[^]))*(\1)?/y;
812
- NumericLiteral = /(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\d)*n|(?:(?:0(?!\d)|0\d*[89]\d*|[1-9](?:_?\d)*)(?:\.(?:\d(?:_?\d)*)?)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|0[0-7]+/y;
813
- Template = /[`}](?:[^`\\$]|\\[^]|\$(?!\{))*(`|\$\{)?/y;
814
- WhiteSpace = /[\t\v\f\ufeff\p{Zs}]+/yu;
815
- LineTerminatorSequence = /\r?\n|[\r\u2028\u2029]/y;
816
- MultiLineComment = /\/\*(?:[^*]|\*(?!\/))*(\*\/)?/y;
817
- SingleLineComment = /\/\/.*/y;
818
- JSXPunctuator = /[<>.:={}]|\/(?![\/*])/y;
819
- JSXIdentifier = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/yu;
820
- JSXString = /(['"])(?:(?!\1)[^])*(\1)?/y;
821
- JSXText = /[^<>{}]+/y;
822
- TokensPrecedingExpression = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/;
823
- TokensNotPrecedingObjectLiteral = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/;
824
- KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
825
- KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
826
- Newline = RegExp(LineTerminatorSequence.source);
827
- jsTokens_1 = function*(input, {jsx = false} = {}) {
828
- var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
829
- ({length} = input);
830
- lastIndex = 0;
831
- lastSignificantToken = "";
832
- stack = [
833
- {tag: "JS"}
834
- ];
835
- braces = [];
836
- parenNesting = 0;
837
- postfixIncDec = false;
838
- while (lastIndex < length) {
839
- mode = stack[stack.length - 1];
840
- switch (mode.tag) {
841
- case "JS":
842
- case "JSNonExpressionParen":
843
- case "InterpolationInTemplate":
844
- case "InterpolationInJSX":
845
- if (input[lastIndex] === "/" && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
846
- RegularExpressionLiteral.lastIndex = lastIndex;
847
- if (match = RegularExpressionLiteral.exec(input)) {
848
- lastIndex = RegularExpressionLiteral.lastIndex;
849
- lastSignificantToken = match[0];
850
- postfixIncDec = true;
851
- yield ({
852
- type: "RegularExpressionLiteral",
853
- value: match[0],
854
- closed: match[1] !== void 0 && match[1] !== "\\"
855
- });
856
- continue;
857
- }
858
- }
859
- Punctuator.lastIndex = lastIndex;
860
- if (match = Punctuator.exec(input)) {
861
- punctuator = match[0];
862
- nextLastIndex = Punctuator.lastIndex;
863
- nextLastSignificantToken = punctuator;
864
- switch (punctuator) {
865
- case "(":
866
- if (lastSignificantToken === "?NonExpressionParenKeyword") {
867
- stack.push({
868
- tag: "JSNonExpressionParen",
869
- nesting: parenNesting
870
- });
871
- }
872
- parenNesting++;
873
- postfixIncDec = false;
874
- break;
875
- case ")":
876
- parenNesting--;
877
- postfixIncDec = true;
878
- if (mode.tag === "JSNonExpressionParen" && parenNesting === mode.nesting) {
879
- stack.pop();
880
- nextLastSignificantToken = "?NonExpressionParenEnd";
881
- postfixIncDec = false;
882
- }
883
- break;
884
- case "{":
885
- Punctuator.lastIndex = 0;
886
- isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken));
887
- braces.push(isExpression);
888
- postfixIncDec = false;
889
- break;
890
- case "}":
891
- switch (mode.tag) {
892
- case "InterpolationInTemplate":
893
- if (braces.length === mode.nesting) {
894
- Template.lastIndex = lastIndex;
895
- match = Template.exec(input);
896
- lastIndex = Template.lastIndex;
897
- lastSignificantToken = match[0];
898
- if (match[1] === "${") {
899
- lastSignificantToken = "?InterpolationInTemplate";
900
- postfixIncDec = false;
901
- yield ({
902
- type: "TemplateMiddle",
903
- value: match[0]
904
- });
905
- } else {
906
- stack.pop();
907
- postfixIncDec = true;
908
- yield ({
909
- type: "TemplateTail",
910
- value: match[0],
911
- closed: match[1] === "`"
912
- });
913
- }
914
- continue;
915
- }
916
- break;
917
- case "InterpolationInJSX":
918
- if (braces.length === mode.nesting) {
919
- stack.pop();
920
- lastIndex += 1;
921
- lastSignificantToken = "}";
922
- yield ({
923
- type: "JSXPunctuator",
924
- value: "}"
925
- });
926
- continue;
927
- }
928
- }
929
- postfixIncDec = braces.pop();
930
- nextLastSignificantToken = postfixIncDec ? "?ExpressionBraceEnd" : "}";
931
- break;
932
- case "]":
933
- postfixIncDec = true;
934
- break;
935
- case "++":
936
- case "--":
937
- nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
938
- break;
939
- case "<":
940
- if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
941
- stack.push({tag: "JSXTag"});
942
- lastIndex += 1;
943
- lastSignificantToken = "<";
944
- yield ({
945
- type: "JSXPunctuator",
946
- value: punctuator
947
- });
948
- continue;
949
- }
950
- postfixIncDec = false;
951
- break;
952
- default:
953
- postfixIncDec = false;
954
- }
955
- lastIndex = nextLastIndex;
956
- lastSignificantToken = nextLastSignificantToken;
957
- yield ({
958
- type: "Punctuator",
959
- value: punctuator
960
- });
961
- continue;
962
- }
963
- Identifier.lastIndex = lastIndex;
964
- if (match = Identifier.exec(input)) {
965
- lastIndex = Identifier.lastIndex;
966
- nextLastSignificantToken = match[0];
967
- switch (match[0]) {
968
- case "for":
969
- case "if":
970
- case "while":
971
- case "with":
972
- if (lastSignificantToken !== "." && lastSignificantToken !== "?.") {
973
- nextLastSignificantToken = "?NonExpressionParenKeyword";
974
- }
975
- }
976
- lastSignificantToken = nextLastSignificantToken;
977
- postfixIncDec = !KeywordsWithExpressionAfter.test(match[0]);
978
- yield ({
979
- type: match[1] === "#" ? "PrivateIdentifier" : "IdentifierName",
980
- value: match[0]
981
- });
982
- continue;
983
- }
984
- StringLiteral.lastIndex = lastIndex;
985
- if (match = StringLiteral.exec(input)) {
986
- lastIndex = StringLiteral.lastIndex;
987
- lastSignificantToken = match[0];
988
- postfixIncDec = true;
989
- yield ({
990
- type: "StringLiteral",
991
- value: match[0],
992
- closed: match[2] !== void 0
993
- });
994
- continue;
995
- }
996
- NumericLiteral.lastIndex = lastIndex;
997
- if (match = NumericLiteral.exec(input)) {
998
- lastIndex = NumericLiteral.lastIndex;
999
- lastSignificantToken = match[0];
1000
- postfixIncDec = true;
1001
- yield ({
1002
- type: "NumericLiteral",
1003
- value: match[0]
1004
- });
1005
- continue;
1006
- }
1007
- Template.lastIndex = lastIndex;
1008
- if (match = Template.exec(input)) {
1009
- lastIndex = Template.lastIndex;
1010
- lastSignificantToken = match[0];
1011
- if (match[1] === "${") {
1012
- lastSignificantToken = "?InterpolationInTemplate";
1013
- stack.push({
1014
- tag: "InterpolationInTemplate",
1015
- nesting: braces.length
1016
- });
1017
- postfixIncDec = false;
1018
- yield ({
1019
- type: "TemplateHead",
1020
- value: match[0]
1021
- });
1022
- } else {
1023
- postfixIncDec = true;
1024
- yield ({
1025
- type: "NoSubstitutionTemplate",
1026
- value: match[0],
1027
- closed: match[1] === "`"
1028
- });
1029
- }
1030
- continue;
1031
- }
1032
- break;
1033
- case "JSXTag":
1034
- case "JSXTagEnd":
1035
- JSXPunctuator.lastIndex = lastIndex;
1036
- if (match = JSXPunctuator.exec(input)) {
1037
- lastIndex = JSXPunctuator.lastIndex;
1038
- nextLastSignificantToken = match[0];
1039
- switch (match[0]) {
1040
- case "<":
1041
- stack.push({tag: "JSXTag"});
1042
- break;
1043
- case ">":
1044
- stack.pop();
1045
- if (lastSignificantToken === "/" || mode.tag === "JSXTagEnd") {
1046
- nextLastSignificantToken = "?JSX";
1047
- postfixIncDec = true;
1048
- } else {
1049
- stack.push({tag: "JSXChildren"});
1050
- }
1051
- break;
1052
- case "{":
1053
- stack.push({
1054
- tag: "InterpolationInJSX",
1055
- nesting: braces.length
1056
- });
1057
- nextLastSignificantToken = "?InterpolationInJSX";
1058
- postfixIncDec = false;
1059
- break;
1060
- case "/":
1061
- if (lastSignificantToken === "<") {
1062
- stack.pop();
1063
- if (stack[stack.length - 1].tag === "JSXChildren") {
1064
- stack.pop();
1065
- }
1066
- stack.push({tag: "JSXTagEnd"});
1067
- }
1068
- }
1069
- lastSignificantToken = nextLastSignificantToken;
1070
- yield ({
1071
- type: "JSXPunctuator",
1072
- value: match[0]
1073
- });
1074
- continue;
1075
- }
1076
- JSXIdentifier.lastIndex = lastIndex;
1077
- if (match = JSXIdentifier.exec(input)) {
1078
- lastIndex = JSXIdentifier.lastIndex;
1079
- lastSignificantToken = match[0];
1080
- yield ({
1081
- type: "JSXIdentifier",
1082
- value: match[0]
1083
- });
1084
- continue;
1085
- }
1086
- JSXString.lastIndex = lastIndex;
1087
- if (match = JSXString.exec(input)) {
1088
- lastIndex = JSXString.lastIndex;
1089
- lastSignificantToken = match[0];
1090
- yield ({
1091
- type: "JSXString",
1092
- value: match[0],
1093
- closed: match[2] !== void 0
1094
- });
1095
- continue;
1096
- }
1097
- break;
1098
- case "JSXChildren":
1099
- JSXText.lastIndex = lastIndex;
1100
- if (match = JSXText.exec(input)) {
1101
- lastIndex = JSXText.lastIndex;
1102
- lastSignificantToken = match[0];
1103
- yield ({
1104
- type: "JSXText",
1105
- value: match[0]
1106
- });
1107
- continue;
1108
- }
1109
- switch (input[lastIndex]) {
1110
- case "<":
1111
- stack.push({tag: "JSXTag"});
1112
- lastIndex++;
1113
- lastSignificantToken = "<";
1114
- yield ({
1115
- type: "JSXPunctuator",
1116
- value: "<"
1117
- });
1118
- continue;
1119
- case "{":
1120
- stack.push({
1121
- tag: "InterpolationInJSX",
1122
- nesting: braces.length
1123
- });
1124
- lastIndex++;
1125
- lastSignificantToken = "?InterpolationInJSX";
1126
- postfixIncDec = false;
1127
- yield ({
1128
- type: "JSXPunctuator",
1129
- value: "{"
1130
- });
1131
- continue;
1132
- }
1133
- }
1134
- WhiteSpace.lastIndex = lastIndex;
1135
- if (match = WhiteSpace.exec(input)) {
1136
- lastIndex = WhiteSpace.lastIndex;
1137
- yield ({
1138
- type: "WhiteSpace",
1139
- value: match[0]
1140
- });
1141
- continue;
1142
- }
1143
- LineTerminatorSequence.lastIndex = lastIndex;
1144
- if (match = LineTerminatorSequence.exec(input)) {
1145
- lastIndex = LineTerminatorSequence.lastIndex;
1146
- postfixIncDec = false;
1147
- if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) {
1148
- lastSignificantToken = "?NoLineTerminatorHere";
1149
- }
1150
- yield ({
1151
- type: "LineTerminatorSequence",
1152
- value: match[0]
1153
- });
1154
- continue;
1155
- }
1156
- MultiLineComment.lastIndex = lastIndex;
1157
- if (match = MultiLineComment.exec(input)) {
1158
- lastIndex = MultiLineComment.lastIndex;
1159
- if (Newline.test(match[0])) {
1160
- postfixIncDec = false;
1161
- if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) {
1162
- lastSignificantToken = "?NoLineTerminatorHere";
1163
- }
1164
- }
1165
- yield ({
1166
- type: "MultiLineComment",
1167
- value: match[0],
1168
- closed: match[1] !== void 0
1169
- });
1170
- continue;
1171
- }
1172
- SingleLineComment.lastIndex = lastIndex;
1173
- if (match = SingleLineComment.exec(input)) {
1174
- lastIndex = SingleLineComment.lastIndex;
1175
- postfixIncDec = false;
1176
- yield ({
1177
- type: "SingleLineComment",
1178
- value: match[0]
1179
- });
1180
- continue;
1181
- }
1182
- firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex));
1183
- lastIndex += firstCodePoint.length;
1184
- lastSignificantToken = firstCodePoint;
1185
- postfixIncDec = false;
1186
- yield ({
1187
- type: mode.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid",
1188
- value: firstCodePoint
1189
- });
1190
- }
1191
- return void 0;
509
+ function memoizedState() {
510
+ return {
511
+ lastKey: -1,
512
+ lastNeedle: -1,
513
+ lastIndex: -1
1192
514
  };
1193
- return jsTokens_1;
1194
- }
1195
-
1196
- requireJsTokens();
1197
-
1198
- // src/index.ts
1199
- var reservedWords = {
1200
- keyword: [
1201
- "break",
1202
- "case",
1203
- "catch",
1204
- "continue",
1205
- "debugger",
1206
- "default",
1207
- "do",
1208
- "else",
1209
- "finally",
1210
- "for",
1211
- "function",
1212
- "if",
1213
- "return",
1214
- "switch",
1215
- "throw",
1216
- "try",
1217
- "var",
1218
- "const",
1219
- "while",
1220
- "with",
1221
- "new",
1222
- "this",
1223
- "super",
1224
- "class",
1225
- "extends",
1226
- "export",
1227
- "import",
1228
- "null",
1229
- "true",
1230
- "false",
1231
- "in",
1232
- "instanceof",
1233
- "typeof",
1234
- "void",
1235
- "delete"
1236
- ],
1237
- strict: [
1238
- "implements",
1239
- "interface",
1240
- "let",
1241
- "package",
1242
- "private",
1243
- "protected",
1244
- "public",
1245
- "static",
1246
- "yield"
1247
- ]
1248
- }; new Set(reservedWords.keyword); new Set(reservedWords.strict);
1249
-
1250
- // src/index.ts
1251
- var f = {
1252
- reset: [0, 0],
1253
- bold: [1, 22, "\x1B[22m\x1B[1m"],
1254
- dim: [2, 22, "\x1B[22m\x1B[2m"],
1255
- italic: [3, 23],
1256
- underline: [4, 24],
1257
- inverse: [7, 27],
1258
- hidden: [8, 28],
1259
- strikethrough: [9, 29],
1260
- black: [30, 39],
1261
- red: [31, 39],
1262
- green: [32, 39],
1263
- yellow: [33, 39],
1264
- blue: [34, 39],
1265
- magenta: [35, 39],
1266
- cyan: [36, 39],
1267
- white: [37, 39],
1268
- gray: [90, 39],
1269
- bgBlack: [40, 49],
1270
- bgRed: [41, 49],
1271
- bgGreen: [42, 49],
1272
- bgYellow: [43, 49],
1273
- bgBlue: [44, 49],
1274
- bgMagenta: [45, 49],
1275
- bgCyan: [46, 49],
1276
- bgWhite: [47, 49],
1277
- blackBright: [90, 39],
1278
- redBright: [91, 39],
1279
- greenBright: [92, 39],
1280
- yellowBright: [93, 39],
1281
- blueBright: [94, 39],
1282
- magentaBright: [95, 39],
1283
- cyanBright: [96, 39],
1284
- whiteBright: [97, 39],
1285
- bgBlackBright: [100, 49],
1286
- bgRedBright: [101, 49],
1287
- bgGreenBright: [102, 49],
1288
- bgYellowBright: [103, 49],
1289
- bgBlueBright: [104, 49],
1290
- bgMagentaBright: [105, 49],
1291
- bgCyanBright: [106, 49],
1292
- bgWhiteBright: [107, 49]
1293
- }, h = Object.entries(f);
1294
- function a(n) {
1295
- return String(n);
1296
- }
1297
- a.open = "";
1298
- a.close = "";
1299
- function C(n = false) {
1300
- let e = typeof process != "undefined" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || [];
1301
- return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || n && i.TERM !== "dumb" || "CI" in i) || typeof window != "undefined" && !!window.chrome;
1302
515
  }
1303
- function p(n = false) {
1304
- let e = C(n), i = (r, t, c, o) => {
1305
- let l = "", s = 0;
1306
- do
1307
- l += r.substring(s, o) + c, s = o + t.length, o = r.indexOf(t, s);
1308
- while (~o);
1309
- return l + r.substring(s);
1310
- }, g = (r, t, c = r) => {
1311
- let o = (l) => {
1312
- let s = String(l), b = s.indexOf(t, r.length);
1313
- return ~b ? r + i(s, t, c, b) + t : r + s + t;
1314
- };
1315
- return o.open = r, o.close = t, o;
1316
- }, u = {
1317
- isColorSupported: e
1318
- }, d = (r) => `\x1B[${r}m`;
1319
- for (let [r, t] of h)
1320
- u[r] = e ? g(
1321
- d(t[0]),
1322
- d(t[1]),
1323
- t[2]
1324
- ) : a;
1325
- return u;
516
+ function getOriginalPosition(map, needle) {
517
+ const result = originalPositionFor(map, needle);
518
+ if (result.column == null) {
519
+ return null;
520
+ }
521
+ return result;
1326
522
  }
1327
523
 
1328
- p();
1329
-
1330
524
  const lineSplitRE = /\r?\n/;
1331
525
  function positionToOffset(source, lineNumber, columnNumber) {
1332
526
  const lines = source.split(lineSplitRE);
@@ -1519,6 +713,10 @@ async function saveRawSnapshots(environment, snapshots) {
1519
713
  }));
1520
714
  }
1521
715
 
716
+ function getDefaultExportFromCjs (x) {
717
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
718
+ }
719
+
1522
720
  var naturalCompare$1 = {exports: {}};
1523
721
 
1524
722
  var hasRequiredNaturalCompare;
@@ -1664,7 +862,7 @@ function addExtraLineBreaks(string) {
1664
862
  // Instead of trim, which can remove additional newlines or spaces
1665
863
  // at beginning or end of the content from a custom serializer.
1666
864
  function removeExtraLineBreaks(string) {
1667
- return string.length > 2 && string.startsWith("\n") && string.endsWith("\n") ? string.slice(1, -1) : string;
865
+ return string.length > 2 && string[0] === "\n" && string.endsWith("\n") ? string.slice(1, -1) : string;
1668
866
  }
1669
867
  // export const removeLinesBeforeExternalMatcherTrap = (stack: string): string => {
1670
868
  // const lines = stack.split('\n')
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/snapshot",
3
3
  "type": "module",
4
- "version": "4.0.0-beta.10",
4
+ "version": "4.0.0-beta.11",
5
5
  "description": "Vitest snapshot manager",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -38,14 +38,14 @@
38
38
  "dist"
39
39
  ],
40
40
  "dependencies": {
41
- "magic-string": "^0.30.18",
41
+ "magic-string": "^0.30.19",
42
42
  "pathe": "^2.0.3",
43
- "@vitest/pretty-format": "4.0.0-beta.10"
43
+ "@vitest/pretty-format": "4.0.0-beta.11"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/natural-compare": "^1.4.3",
47
47
  "natural-compare": "^1.4.0",
48
- "@vitest/utils": "4.0.0-beta.10"
48
+ "@vitest/utils": "4.0.0-beta.11"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "rimraf dist && rollup -c",