@noma.to/qwik-testing-library 1.0.3 → 1.1.0

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 (100) hide show
  1. package/README.md +120 -7
  2. package/lib/_virtual/_commonjsHelpers.qwik.cjs +2 -0
  3. package/lib/_virtual/_commonjsHelpers.qwik.mjs +2 -0
  4. package/lib/_virtual/sourcemap-codec.umd.qwik.cjs +4 -0
  5. package/lib/_virtual/sourcemap-codec.umd.qwik.mjs +4 -0
  6. package/lib/index.qwik.cjs +4 -0
  7. package/lib/index.qwik.mjs +4 -0
  8. package/lib/lib/mock.qwik.cjs +14 -0
  9. package/lib/lib/mock.qwik.mjs +14 -0
  10. package/lib/lib/qwik-testing-library.qwik.cjs +4 -0
  11. package/lib/lib/qwik-testing-library.qwik.mjs +4 -0
  12. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.qwik.cjs +425 -0
  13. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.qwik.mjs +425 -0
  14. package/lib/node_modules/.pnpm/@vitest_expect@2.1.1/node_modules/@vitest/expect/dist/index.qwik.cjs +1967 -0
  15. package/lib/node_modules/.pnpm/@vitest_expect@2.1.1/node_modules/@vitest/expect/dist/index.qwik.mjs +1967 -0
  16. package/lib/node_modules/.pnpm/@vitest_pretty-format@2.1.1/node_modules/@vitest/pretty-format/dist/index.qwik.cjs +1202 -0
  17. package/lib/node_modules/.pnpm/@vitest_pretty-format@2.1.1/node_modules/@vitest/pretty-format/dist/index.qwik.mjs +1202 -0
  18. package/lib/node_modules/.pnpm/@vitest_runner@2.1.1/node_modules/@vitest/runner/dist/chunk-tasks.qwik.cjs +44 -0
  19. package/lib/node_modules/.pnpm/@vitest_runner@2.1.1/node_modules/@vitest/runner/dist/chunk-tasks.qwik.mjs +44 -0
  20. package/lib/node_modules/.pnpm/@vitest_runner@2.1.1/node_modules/@vitest/runner/dist/index.qwik.cjs +665 -0
  21. package/lib/node_modules/.pnpm/@vitest_runner@2.1.1/node_modules/@vitest/runner/dist/index.qwik.mjs +665 -0
  22. package/lib/node_modules/.pnpm/@vitest_snapshot@2.1.1/node_modules/@vitest/snapshot/dist/index.qwik.cjs +1641 -0
  23. package/lib/node_modules/.pnpm/@vitest_snapshot@2.1.1/node_modules/@vitest/snapshot/dist/index.qwik.mjs +1641 -0
  24. package/lib/node_modules/.pnpm/@vitest_spy@2.1.1/node_modules/@vitest/spy/dist/index.qwik.cjs +148 -0
  25. package/lib/node_modules/.pnpm/@vitest_spy@2.1.1/node_modules/@vitest/spy/dist/index.qwik.mjs +148 -0
  26. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.cjs +158 -0
  27. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.mjs +158 -0
  28. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/diff.qwik.cjs +1731 -0
  29. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/diff.qwik.mjs +1731 -0
  30. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/error.qwik.cjs +137 -0
  31. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/error.qwik.mjs +137 -0
  32. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/helpers.qwik.cjs +150 -0
  33. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/helpers.qwik.mjs +150 -0
  34. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/index.qwik.cjs +81 -0
  35. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/index.qwik.mjs +81 -0
  36. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/source-map.qwik.cjs +216 -0
  37. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/source-map.qwik.mjs +216 -0
  38. package/lib/node_modules/.pnpm/chai@5.1.1/node_modules/chai/chai.qwik.cjs +3905 -0
  39. package/lib/node_modules/.pnpm/chai@5.1.1/node_modules/chai/chai.qwik.mjs +3905 -0
  40. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/arguments.qwik.cjs +9 -0
  41. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/arguments.qwik.mjs +10 -0
  42. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/array.qwik.cjs +16 -0
  43. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/array.qwik.mjs +17 -0
  44. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/bigint.qwik.cjs +9 -0
  45. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/bigint.qwik.mjs +10 -0
  46. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/class.qwik.cjs +16 -0
  47. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/class.qwik.mjs +17 -0
  48. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/date.qwik.cjs +12 -0
  49. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/date.qwik.mjs +13 -0
  50. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/error.qwik.cjs +30 -0
  51. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/error.qwik.mjs +31 -0
  52. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/function.qwik.cjs +11 -0
  53. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/function.qwik.mjs +12 -0
  54. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/helpers.qwik.cjs +160 -0
  55. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/helpers.qwik.mjs +160 -0
  56. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/html.qwik.cjs +36 -0
  57. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/html.qwik.mjs +36 -0
  58. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/index.qwik.cjs +130 -0
  59. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/index.qwik.mjs +130 -0
  60. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/map.qwik.cjs +25 -0
  61. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/map.qwik.mjs +26 -0
  62. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/number.qwik.cjs +19 -0
  63. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/number.qwik.mjs +20 -0
  64. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/object.qwik.cjs +24 -0
  65. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/object.qwik.mjs +25 -0
  66. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/promise.qwik.cjs +17 -0
  67. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/promise.qwik.mjs +18 -0
  68. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/regexp.qwik.cjs +9 -0
  69. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/regexp.qwik.mjs +10 -0
  70. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/set.qwik.cjs +16 -0
  71. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/set.qwik.mjs +17 -0
  72. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/string.qwik.cjs +24 -0
  73. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/string.qwik.mjs +25 -0
  74. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/symbol.qwik.cjs +8 -0
  75. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/symbol.qwik.mjs +9 -0
  76. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/typedarray.qwik.cjs +34 -0
  77. package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/typedarray.qwik.mjs +35 -0
  78. package/lib/node_modules/.pnpm/magic-string@0.30.11/node_modules/magic-string/dist/magic-string.es.qwik.cjs +968 -0
  79. package/lib/node_modules/.pnpm/magic-string@0.30.11/node_modules/magic-string/dist/magic-string.es.qwik.mjs +968 -0
  80. package/lib/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.cjs +101 -0
  81. package/lib/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.mjs +101 -0
  82. package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +7 -0
  83. package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +8 -0
  84. package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.cjs +80 -0
  85. package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.mjs +80 -0
  86. package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.cjs +104 -0
  87. package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.mjs +104 -0
  88. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.cjs +8 -0
  89. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.mjs +8 -0
  90. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/base.BlXpj3e_.qwik.cjs +6 -0
  91. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/base.BlXpj3e_.qwik.mjs +6 -0
  92. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.cjs +56 -0
  93. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.mjs +56 -0
  94. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.qwik.cjs +16 -0
  95. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.qwik.mjs +16 -0
  96. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.cjs +2556 -0
  97. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.mjs +2556 -0
  98. package/lib-types/lib/mock.d.ts +34 -0
  99. package/lib-types/lib/qwik-testing-library.d.ts +2 -1
  100. package/package.json +9 -8
@@ -0,0 +1,81 @@
1
+ import "../../../../../tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.mjs";
2
+ import "../../../../../loupe@3.1.1/node_modules/loupe/lib/index.qwik.mjs";
3
+ const SAFE_TIMERS_SYMBOL = Symbol("vitest:SAFE_TIMERS");
4
+ function getSafeTimers() {
5
+ const {
6
+ setTimeout: safeSetTimeout,
7
+ setInterval: safeSetInterval,
8
+ clearInterval: safeClearInterval,
9
+ clearTimeout: safeClearTimeout,
10
+ setImmediate: safeSetImmediate,
11
+ clearImmediate: safeClearImmediate
12
+ } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis;
13
+ const { nextTick: safeNextTick } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis.process || { nextTick: (cb) => cb() };
14
+ return {
15
+ nextTick: safeNextTick,
16
+ setTimeout: safeSetTimeout,
17
+ setInterval: safeSetInterval,
18
+ clearInterval: safeClearInterval,
19
+ clearTimeout: safeClearTimeout,
20
+ setImmediate: safeSetImmediate,
21
+ clearImmediate: safeClearImmediate
22
+ };
23
+ }
24
+ var LineTerminatorSequence;
25
+ LineTerminatorSequence = /\r?\n|[\r\u2028\u2029]/y;
26
+ RegExp(LineTerminatorSequence.source);
27
+ var reservedWords = {
28
+ keyword: [
29
+ "break",
30
+ "case",
31
+ "catch",
32
+ "continue",
33
+ "debugger",
34
+ "default",
35
+ "do",
36
+ "else",
37
+ "finally",
38
+ "for",
39
+ "function",
40
+ "if",
41
+ "return",
42
+ "switch",
43
+ "throw",
44
+ "try",
45
+ "var",
46
+ "const",
47
+ "while",
48
+ "with",
49
+ "new",
50
+ "this",
51
+ "super",
52
+ "class",
53
+ "extends",
54
+ "export",
55
+ "import",
56
+ "null",
57
+ "true",
58
+ "false",
59
+ "in",
60
+ "instanceof",
61
+ "typeof",
62
+ "void",
63
+ "delete"
64
+ ],
65
+ strict: [
66
+ "implements",
67
+ "interface",
68
+ "let",
69
+ "package",
70
+ "private",
71
+ "protected",
72
+ "public",
73
+ "static",
74
+ "yield"
75
+ ]
76
+ };
77
+ new Set(reservedWords.keyword);
78
+ new Set(reservedWords.strict);
79
+ export {
80
+ getSafeTimers
81
+ };
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
4
+ function normalizeWindowsPath(input = "") {
5
+ if (!input) {
6
+ return input;
7
+ }
8
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
9
+ }
10
+ const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
11
+ function cwd() {
12
+ if (typeof process !== "undefined" && typeof process.cwd === "function") {
13
+ return process.cwd().replace(/\\/g, "/");
14
+ }
15
+ return "/";
16
+ }
17
+ const resolve$2 = function(...arguments_) {
18
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
19
+ let resolvedPath = "";
20
+ let resolvedAbsolute = false;
21
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
22
+ const path = index >= 0 ? arguments_[index] : cwd();
23
+ if (!path || path.length === 0) {
24
+ continue;
25
+ }
26
+ resolvedPath = `${path}/${resolvedPath}`;
27
+ resolvedAbsolute = isAbsolute(path);
28
+ }
29
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
30
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
31
+ return `/${resolvedPath}`;
32
+ }
33
+ return resolvedPath.length > 0 ? resolvedPath : ".";
34
+ };
35
+ function normalizeString(path, allowAboveRoot) {
36
+ let res = "";
37
+ let lastSegmentLength = 0;
38
+ let lastSlash = -1;
39
+ let dots = 0;
40
+ let char = null;
41
+ for (let index = 0; index <= path.length; ++index) {
42
+ if (index < path.length) {
43
+ char = path[index];
44
+ } else if (char === "/") {
45
+ break;
46
+ } else {
47
+ char = "/";
48
+ }
49
+ if (char === "/") {
50
+ if (lastSlash === index - 1 || dots === 1) ;
51
+ else if (dots === 2) {
52
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
53
+ if (res.length > 2) {
54
+ const lastSlashIndex = res.lastIndexOf("/");
55
+ if (lastSlashIndex === -1) {
56
+ res = "";
57
+ lastSegmentLength = 0;
58
+ } else {
59
+ res = res.slice(0, lastSlashIndex);
60
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
61
+ }
62
+ lastSlash = index;
63
+ dots = 0;
64
+ continue;
65
+ } else if (res.length > 0) {
66
+ res = "";
67
+ lastSegmentLength = 0;
68
+ lastSlash = index;
69
+ dots = 0;
70
+ continue;
71
+ }
72
+ }
73
+ if (allowAboveRoot) {
74
+ res += res.length > 0 ? "/.." : "..";
75
+ lastSegmentLength = 2;
76
+ }
77
+ } else {
78
+ if (res.length > 0) {
79
+ res += `/${path.slice(lastSlash + 1, index)}`;
80
+ } else {
81
+ res = path.slice(lastSlash + 1, index);
82
+ }
83
+ lastSegmentLength = index - lastSlash - 1;
84
+ }
85
+ lastSlash = index;
86
+ dots = 0;
87
+ } else if (char === "." && dots !== -1) {
88
+ ++dots;
89
+ } else {
90
+ dots = -1;
91
+ }
92
+ }
93
+ return res;
94
+ }
95
+ const isAbsolute = function(p) {
96
+ return _IS_ABSOLUTE_RE.test(p);
97
+ };
98
+ const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
99
+ const intToChar = new Uint8Array(64);
100
+ const charToInt = new Uint8Array(128);
101
+ for (let i = 0; i < chars.length; i++) {
102
+ const c = chars.charCodeAt(i);
103
+ intToChar[i] = c;
104
+ charToInt[c] = i;
105
+ }
106
+ var UrlType;
107
+ (function(UrlType2) {
108
+ UrlType2[UrlType2["Empty"] = 1] = "Empty";
109
+ UrlType2[UrlType2["Hash"] = 2] = "Hash";
110
+ UrlType2[UrlType2["Query"] = 3] = "Query";
111
+ UrlType2[UrlType2["RelativePath"] = 4] = "RelativePath";
112
+ UrlType2[UrlType2["AbsolutePath"] = 5] = "AbsolutePath";
113
+ UrlType2[UrlType2["SchemeRelative"] = 6] = "SchemeRelative";
114
+ UrlType2[UrlType2["Absolute"] = 7] = "Absolute";
115
+ })(UrlType || (UrlType = {}));
116
+ const CHROME_IE_STACK_REGEXP = /^\s*at .*(?:\S:\d+|\(native\))/m;
117
+ const SAFARI_NATIVE_CODE_REGEXP = /^(?:eval@)?(?:\[native code\])?$/;
118
+ function extractLocation(urlLike) {
119
+ if (!urlLike.includes(":")) {
120
+ return [urlLike];
121
+ }
122
+ const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
123
+ const parts = regExp.exec(urlLike.replace(/^\(|\)$/g, ""));
124
+ if (!parts) {
125
+ return [urlLike];
126
+ }
127
+ let url = parts[1];
128
+ if (url.startsWith("async ")) {
129
+ url = url.slice(6);
130
+ }
131
+ if (url.startsWith("http:") || url.startsWith("https:")) {
132
+ const urlObj = new URL(url);
133
+ url = urlObj.pathname;
134
+ }
135
+ if (url.startsWith("/@fs/")) {
136
+ const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url);
137
+ url = url.slice(isWindows ? 5 : 4);
138
+ }
139
+ return [url, parts[2] || void 0, parts[3] || void 0];
140
+ }
141
+ function parseSingleFFOrSafariStack(raw) {
142
+ let line = raw.trim();
143
+ if (SAFARI_NATIVE_CODE_REGEXP.test(line)) {
144
+ return null;
145
+ }
146
+ if (line.includes(" > eval")) {
147
+ line = line.replace(
148
+ / line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,
149
+ ":$1"
150
+ );
151
+ }
152
+ if (!line.includes("@") && !line.includes(":")) {
153
+ return null;
154
+ }
155
+ const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(@)/;
156
+ const matches = line.match(functionNameRegex);
157
+ const functionName = matches && matches[1] ? matches[1] : void 0;
158
+ const [url, lineNumber, columnNumber] = extractLocation(
159
+ line.replace(functionNameRegex, "")
160
+ );
161
+ if (!url || !lineNumber || !columnNumber) {
162
+ return null;
163
+ }
164
+ return {
165
+ file: url,
166
+ method: functionName || "",
167
+ line: Number.parseInt(lineNumber),
168
+ column: Number.parseInt(columnNumber)
169
+ };
170
+ }
171
+ function parseSingleStack(raw) {
172
+ const line = raw.trim();
173
+ if (!CHROME_IE_STACK_REGEXP.test(line)) {
174
+ return parseSingleFFOrSafariStack(line);
175
+ }
176
+ return parseSingleV8Stack(line);
177
+ }
178
+ function parseSingleV8Stack(raw) {
179
+ let line = raw.trim();
180
+ if (!CHROME_IE_STACK_REGEXP.test(line)) {
181
+ return null;
182
+ }
183
+ if (line.includes("(eval ")) {
184
+ line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
185
+ }
186
+ let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
187
+ const location = sanitizedLine.match(/ (\(.+\)$)/);
188
+ sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
189
+ const [url, lineNumber, columnNumber] = extractLocation(
190
+ location ? location[1] : sanitizedLine
191
+ );
192
+ let method = location && sanitizedLine || "";
193
+ let file = url && ["eval", "<anonymous>"].includes(url) ? void 0 : url;
194
+ if (!file || !lineNumber || !columnNumber) {
195
+ return null;
196
+ }
197
+ if (method.startsWith("async ")) {
198
+ method = method.slice(6);
199
+ }
200
+ if (file.startsWith("file://")) {
201
+ file = file.slice(7);
202
+ }
203
+ file = resolve$2(file);
204
+ if (method) {
205
+ method = method.replace(/__vite_ssr_import_\d+__\./g, "");
206
+ }
207
+ return {
208
+ method,
209
+ file,
210
+ line: Number.parseInt(lineNumber),
211
+ column: Number.parseInt(columnNumber)
212
+ };
213
+ }
214
+ exports.parseSingleFFOrSafariStack = parseSingleFFOrSafariStack;
215
+ exports.parseSingleStack = parseSingleStack;
216
+ exports.parseSingleV8Stack = parseSingleV8Stack;
@@ -0,0 +1,216 @@
1
+ const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
2
+ function normalizeWindowsPath(input = "") {
3
+ if (!input) {
4
+ return input;
5
+ }
6
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
7
+ }
8
+ const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
9
+ function cwd() {
10
+ if (typeof process !== "undefined" && typeof process.cwd === "function") {
11
+ return process.cwd().replace(/\\/g, "/");
12
+ }
13
+ return "/";
14
+ }
15
+ const resolve$2 = function(...arguments_) {
16
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
17
+ let resolvedPath = "";
18
+ let resolvedAbsolute = false;
19
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
20
+ const path = index >= 0 ? arguments_[index] : cwd();
21
+ if (!path || path.length === 0) {
22
+ continue;
23
+ }
24
+ resolvedPath = `${path}/${resolvedPath}`;
25
+ resolvedAbsolute = isAbsolute(path);
26
+ }
27
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
28
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
29
+ return `/${resolvedPath}`;
30
+ }
31
+ return resolvedPath.length > 0 ? resolvedPath : ".";
32
+ };
33
+ function normalizeString(path, allowAboveRoot) {
34
+ let res = "";
35
+ let lastSegmentLength = 0;
36
+ let lastSlash = -1;
37
+ let dots = 0;
38
+ let char = null;
39
+ for (let index = 0; index <= path.length; ++index) {
40
+ if (index < path.length) {
41
+ char = path[index];
42
+ } else if (char === "/") {
43
+ break;
44
+ } else {
45
+ char = "/";
46
+ }
47
+ if (char === "/") {
48
+ if (lastSlash === index - 1 || dots === 1) ;
49
+ else if (dots === 2) {
50
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
51
+ if (res.length > 2) {
52
+ const lastSlashIndex = res.lastIndexOf("/");
53
+ if (lastSlashIndex === -1) {
54
+ res = "";
55
+ lastSegmentLength = 0;
56
+ } else {
57
+ res = res.slice(0, lastSlashIndex);
58
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
59
+ }
60
+ lastSlash = index;
61
+ dots = 0;
62
+ continue;
63
+ } else if (res.length > 0) {
64
+ res = "";
65
+ lastSegmentLength = 0;
66
+ lastSlash = index;
67
+ dots = 0;
68
+ continue;
69
+ }
70
+ }
71
+ if (allowAboveRoot) {
72
+ res += res.length > 0 ? "/.." : "..";
73
+ lastSegmentLength = 2;
74
+ }
75
+ } else {
76
+ if (res.length > 0) {
77
+ res += `/${path.slice(lastSlash + 1, index)}`;
78
+ } else {
79
+ res = path.slice(lastSlash + 1, index);
80
+ }
81
+ lastSegmentLength = index - lastSlash - 1;
82
+ }
83
+ lastSlash = index;
84
+ dots = 0;
85
+ } else if (char === "." && dots !== -1) {
86
+ ++dots;
87
+ } else {
88
+ dots = -1;
89
+ }
90
+ }
91
+ return res;
92
+ }
93
+ const isAbsolute = function(p) {
94
+ return _IS_ABSOLUTE_RE.test(p);
95
+ };
96
+ const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
97
+ const intToChar = new Uint8Array(64);
98
+ const charToInt = new Uint8Array(128);
99
+ for (let i = 0; i < chars.length; i++) {
100
+ const c = chars.charCodeAt(i);
101
+ intToChar[i] = c;
102
+ charToInt[c] = i;
103
+ }
104
+ var UrlType;
105
+ (function(UrlType2) {
106
+ UrlType2[UrlType2["Empty"] = 1] = "Empty";
107
+ UrlType2[UrlType2["Hash"] = 2] = "Hash";
108
+ UrlType2[UrlType2["Query"] = 3] = "Query";
109
+ UrlType2[UrlType2["RelativePath"] = 4] = "RelativePath";
110
+ UrlType2[UrlType2["AbsolutePath"] = 5] = "AbsolutePath";
111
+ UrlType2[UrlType2["SchemeRelative"] = 6] = "SchemeRelative";
112
+ UrlType2[UrlType2["Absolute"] = 7] = "Absolute";
113
+ })(UrlType || (UrlType = {}));
114
+ const CHROME_IE_STACK_REGEXP = /^\s*at .*(?:\S:\d+|\(native\))/m;
115
+ const SAFARI_NATIVE_CODE_REGEXP = /^(?:eval@)?(?:\[native code\])?$/;
116
+ function extractLocation(urlLike) {
117
+ if (!urlLike.includes(":")) {
118
+ return [urlLike];
119
+ }
120
+ const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
121
+ const parts = regExp.exec(urlLike.replace(/^\(|\)$/g, ""));
122
+ if (!parts) {
123
+ return [urlLike];
124
+ }
125
+ let url = parts[1];
126
+ if (url.startsWith("async ")) {
127
+ url = url.slice(6);
128
+ }
129
+ if (url.startsWith("http:") || url.startsWith("https:")) {
130
+ const urlObj = new URL(url);
131
+ url = urlObj.pathname;
132
+ }
133
+ if (url.startsWith("/@fs/")) {
134
+ const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url);
135
+ url = url.slice(isWindows ? 5 : 4);
136
+ }
137
+ return [url, parts[2] || void 0, parts[3] || void 0];
138
+ }
139
+ function parseSingleFFOrSafariStack(raw) {
140
+ let line = raw.trim();
141
+ if (SAFARI_NATIVE_CODE_REGEXP.test(line)) {
142
+ return null;
143
+ }
144
+ if (line.includes(" > eval")) {
145
+ line = line.replace(
146
+ / line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,
147
+ ":$1"
148
+ );
149
+ }
150
+ if (!line.includes("@") && !line.includes(":")) {
151
+ return null;
152
+ }
153
+ const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(@)/;
154
+ const matches = line.match(functionNameRegex);
155
+ const functionName = matches && matches[1] ? matches[1] : void 0;
156
+ const [url, lineNumber, columnNumber] = extractLocation(
157
+ line.replace(functionNameRegex, "")
158
+ );
159
+ if (!url || !lineNumber || !columnNumber) {
160
+ return null;
161
+ }
162
+ return {
163
+ file: url,
164
+ method: functionName || "",
165
+ line: Number.parseInt(lineNumber),
166
+ column: Number.parseInt(columnNumber)
167
+ };
168
+ }
169
+ function parseSingleStack(raw) {
170
+ const line = raw.trim();
171
+ if (!CHROME_IE_STACK_REGEXP.test(line)) {
172
+ return parseSingleFFOrSafariStack(line);
173
+ }
174
+ return parseSingleV8Stack(line);
175
+ }
176
+ function parseSingleV8Stack(raw) {
177
+ let line = raw.trim();
178
+ if (!CHROME_IE_STACK_REGEXP.test(line)) {
179
+ return null;
180
+ }
181
+ if (line.includes("(eval ")) {
182
+ line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
183
+ }
184
+ let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
185
+ const location = sanitizedLine.match(/ (\(.+\)$)/);
186
+ sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
187
+ const [url, lineNumber, columnNumber] = extractLocation(
188
+ location ? location[1] : sanitizedLine
189
+ );
190
+ let method = location && sanitizedLine || "";
191
+ let file = url && ["eval", "<anonymous>"].includes(url) ? void 0 : url;
192
+ if (!file || !lineNumber || !columnNumber) {
193
+ return null;
194
+ }
195
+ if (method.startsWith("async ")) {
196
+ method = method.slice(6);
197
+ }
198
+ if (file.startsWith("file://")) {
199
+ file = file.slice(7);
200
+ }
201
+ file = resolve$2(file);
202
+ if (method) {
203
+ method = method.replace(/__vite_ssr_import_\d+__\./g, "");
204
+ }
205
+ return {
206
+ method,
207
+ file,
208
+ line: Number.parseInt(lineNumber),
209
+ column: Number.parseInt(columnNumber)
210
+ };
211
+ }
212
+ export {
213
+ parseSingleFFOrSafariStack,
214
+ parseSingleStack,
215
+ parseSingleV8Stack
216
+ };