elit 3.6.6 → 3.6.7

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 (153) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/dist/build.cjs +421 -331
  4. package/dist/build.d.ts +1 -19
  5. package/dist/build.js +420 -330
  6. package/dist/build.mjs +420 -330
  7. package/dist/chokidar.cjs +219 -182
  8. package/dist/chokidar.d.ts +25 -10
  9. package/dist/chokidar.js +217 -182
  10. package/dist/chokidar.mjs +218 -183
  11. package/dist/cli.cjs +22439 -21563
  12. package/dist/cli.d.ts +19 -37
  13. package/dist/cli.mjs +24113 -23252
  14. package/dist/config.cjs +357 -350
  15. package/dist/config.d.ts +17 -245
  16. package/dist/config.js +520 -515
  17. package/dist/config.mjs +346 -341
  18. package/dist/contracts-BeW9k0yZ.d.ts +54 -0
  19. package/dist/contracts-D7KIS-TK.d.ts +36 -0
  20. package/dist/coverage.cjs +448 -485
  21. package/dist/coverage.d.ts +13 -62
  22. package/dist/coverage.js +447 -484
  23. package/dist/coverage.mjs +447 -484
  24. package/dist/database.cjs +819 -828
  25. package/dist/database.d.ts +8 -24
  26. package/dist/database.js +818 -829
  27. package/dist/database.mjs +818 -829
  28. package/dist/desktop-auto-render.cjs +1700 -1523
  29. package/dist/desktop-auto-render.d.ts +4 -12
  30. package/dist/desktop-auto-render.js +1695 -1518
  31. package/dist/desktop-auto-render.mjs +1696 -1519
  32. package/dist/desktop.cjs +3 -1
  33. package/dist/desktop.d.ts +4 -1
  34. package/dist/desktop.js +1 -1
  35. package/dist/desktop.mjs +1 -1
  36. package/dist/dev-build.cjs +830 -0
  37. package/dist/dev-build.d.ts +53 -0
  38. package/dist/dev-build.js +3318 -0
  39. package/dist/dev-build.mjs +797 -0
  40. package/dist/dom.cjs +717 -591
  41. package/dist/dom.d.ts +2 -17
  42. package/dist/dom.js +714 -588
  43. package/dist/dom.mjs +716 -590
  44. package/dist/el.cjs +62 -52
  45. package/dist/el.d.ts +5 -12
  46. package/dist/el.js +60 -52
  47. package/dist/el.mjs +60 -52
  48. package/dist/fs.cjs +72 -63
  49. package/dist/fs.d.ts +22 -19
  50. package/dist/fs.js +71 -62
  51. package/dist/fs.mjs +71 -62
  52. package/dist/hmr.cjs +40 -14
  53. package/dist/hmr.d.ts +11 -23
  54. package/dist/hmr.js +38 -14
  55. package/dist/hmr.mjs +38 -14
  56. package/dist/http.cjs +251 -99
  57. package/dist/http.d.ts +38 -104
  58. package/dist/http.js +249 -99
  59. package/dist/http.mjs +249 -99
  60. package/dist/https.cjs +524 -228
  61. package/dist/https.d.ts +44 -36
  62. package/dist/https.js +520 -226
  63. package/dist/https.mjs +522 -228
  64. package/dist/index.cjs +7502 -7691
  65. package/dist/index.d.ts +6 -3
  66. package/dist/index.js +7486 -7677
  67. package/dist/index.mjs +7497 -7687
  68. package/dist/mime-types.cjs +10 -4
  69. package/dist/mime-types.d.ts +8 -11
  70. package/dist/mime-types.js +9 -3
  71. package/dist/mime-types.mjs +9 -3
  72. package/dist/native.cjs +8616 -8870
  73. package/dist/native.d.ts +7 -10
  74. package/dist/native.js +8682 -8936
  75. package/dist/native.mjs +8615 -8869
  76. package/dist/path.cjs +83 -77
  77. package/dist/path.d.ts +29 -29
  78. package/dist/path.js +82 -76
  79. package/dist/path.mjs +82 -76
  80. package/dist/pm.cjs +3300 -0
  81. package/dist/pm.d.ts +256 -0
  82. package/dist/pm.js +5638 -0
  83. package/dist/pm.mjs +3196 -0
  84. package/dist/preview-build.cjs +712 -0
  85. package/dist/preview-build.d.ts +59 -0
  86. package/dist/preview-build.js +3194 -0
  87. package/dist/preview-build.mjs +676 -0
  88. package/dist/render-context.cjs +13 -2
  89. package/dist/render-context.d.ts +9 -34
  90. package/dist/render-context.js +11 -2
  91. package/dist/render-context.mjs +11 -2
  92. package/dist/router.cjs +787 -646
  93. package/dist/router.d.ts +8 -14
  94. package/dist/router.js +786 -645
  95. package/dist/router.mjs +786 -645
  96. package/dist/runtime.cjs +1 -1
  97. package/dist/runtime.js +1 -1
  98. package/dist/runtime.mjs +1 -1
  99. package/dist/server.cjs +3254 -2684
  100. package/dist/server.d.ts +47 -5
  101. package/dist/server.js +3427 -2859
  102. package/dist/server.mjs +3397 -2829
  103. package/dist/smtp-server.cjs +16 -3
  104. package/dist/smtp-server.d.ts +12 -26
  105. package/dist/smtp-server.js +18 -5
  106. package/dist/smtp-server.mjs +16 -3
  107. package/dist/state-DvEkDehk.d.ts +195 -0
  108. package/dist/state.cjs +768 -659
  109. package/dist/state.d.ts +11 -71
  110. package/dist/state.js +760 -651
  111. package/dist/state.mjs +767 -658
  112. package/dist/style.cjs +1011 -968
  113. package/dist/style.d.ts +13 -127
  114. package/dist/style.js +1009 -970
  115. package/dist/style.mjs +1011 -971
  116. package/dist/test-reporter.cjs +332 -316
  117. package/dist/test-reporter.d.ts +28 -33
  118. package/dist/test-reporter.js +328 -312
  119. package/dist/test-reporter.mjs +328 -312
  120. package/dist/test-runtime.cjs +927 -968
  121. package/dist/test-runtime.d.ts +24 -99
  122. package/dist/test-runtime.js +922 -965
  123. package/dist/test-runtime.mjs +922 -965
  124. package/dist/test.cjs +4428 -4273
  125. package/dist/test.d.ts +2 -8
  126. package/dist/test.js +4307 -4154
  127. package/dist/test.mjs +4419 -4267
  128. package/dist/types-BONVzPtp.d.ts +59 -0
  129. package/dist/types-BR4wMiVx.d.ts +32 -0
  130. package/dist/types-C4gKykuG.d.ts +23 -0
  131. package/dist/types-CIhpN1-K.d.ts +64 -0
  132. package/dist/types-Ckj8md_j.d.ts +84 -0
  133. package/dist/types-CpjQTAkX.d.ts +24 -0
  134. package/dist/types-D0LjrYjS.d.ts +14 -0
  135. package/dist/types-DAisuVr5.d.ts +75 -0
  136. package/dist/types-tJn88E1N.d.ts +242 -0
  137. package/dist/types.d.ts +50 -237
  138. package/dist/universal.cjs +1 -1
  139. package/dist/universal.d.ts +1 -7
  140. package/dist/universal.js +1 -1
  141. package/dist/universal.mjs +1 -1
  142. package/dist/websocket-XfyK23zD.d.ts +119 -0
  143. package/dist/ws.cjs +129 -108
  144. package/dist/ws.d.ts +21 -131
  145. package/dist/ws.js +128 -109
  146. package/dist/ws.mjs +128 -109
  147. package/dist/wss.cjs +757 -479
  148. package/dist/wss.d.ts +31 -28
  149. package/dist/wss.js +755 -479
  150. package/dist/wss.mjs +758 -482
  151. package/package.json +8 -1
  152. package/vendor/epaint-0.31.1/src/image.rs +418 -0
  153. package/dist/server-uMQvZAll.d.ts +0 -458
@@ -17,9 +17,9 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/test-reporter.ts
21
- var test_reporter_exports = {};
22
- __export(test_reporter_exports, {
20
+ // src/test/reporter/index.ts
21
+ var reporter_exports = {};
22
+ __export(reporter_exports, {
23
23
  DotReporter: () => DotReporter,
24
24
  JsonReporter: () => JsonReporter,
25
25
  TestReporter: () => TestReporter,
@@ -27,9 +27,9 @@ __export(test_reporter_exports, {
27
27
  formatErrorStack: () => formatErrorStack,
28
28
  formatProgress: () => formatProgress
29
29
  });
30
- module.exports = __toCommonJS(test_reporter_exports);
30
+ module.exports = __toCommonJS(reporter_exports);
31
31
 
32
- // src/runtime.ts
32
+ // src/shares/runtime.ts
33
33
  var runtime = (() => {
34
34
  if (typeof Deno !== "undefined") return "deno";
35
35
  if (typeof Bun !== "undefined") return "bun";
@@ -39,37 +39,33 @@ var isNode = runtime === "node";
39
39
  var isBun = runtime === "bun";
40
40
  var isDeno = runtime === "deno";
41
41
 
42
- // src/path.ts
42
+ // src/server/path/platform.ts
43
43
  function getSeparator(isWin) {
44
44
  return isWin ? "\\" : "/";
45
45
  }
46
46
  function getCwd() {
47
47
  if (isNode || isBun) {
48
48
  return process.cwd();
49
- } else if (isDeno) {
49
+ }
50
+ if (isDeno) {
50
51
  return Deno.cwd();
51
52
  }
52
53
  return "/";
53
54
  }
55
+ var isWindows = (() => {
56
+ if (isNode) {
57
+ return process.platform === "win32";
58
+ }
59
+ if (isDeno) {
60
+ return Deno.build.os === "windows";
61
+ }
62
+ return typeof process !== "undefined" && process.platform === "win32";
63
+ })();
64
+
65
+ // src/server/path/operations.ts
54
66
  function findLastSeparator(path) {
55
67
  return Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
56
68
  }
57
- function createPathOps(isWin) {
58
- return {
59
- sep: getSeparator(isWin),
60
- delimiter: isWin ? ";" : ":",
61
- normalize: (path) => normalizePath(path, isWin),
62
- join: (...paths) => joinPaths(paths, isWin),
63
- resolve: (...paths) => resolvePaths(paths, isWin),
64
- isAbsolute: (path) => isWin ? isAbsoluteWin(path) : isAbsolutePosix(path),
65
- relative: (from, to) => relativePath(from, to, isWin),
66
- dirname: (path) => getDirname(path, isWin),
67
- basename: (path, ext) => getBasename(path, ext, isWin),
68
- extname: (path) => getExtname(path),
69
- parse: (path) => parsePath(path, isWin),
70
- format: (pathObject) => formatPath(pathObject, isWin)
71
- };
72
- }
73
69
  function isAbsolutePosix(path) {
74
70
  return path.length > 0 && path[0] === "/";
75
71
  }
@@ -90,28 +86,18 @@ function isAbsoluteWin(path) {
90
86
  }
91
87
  return false;
92
88
  }
93
- var isWindows = (() => {
94
- if (isNode) {
95
- return process.platform === "win32";
96
- } else if (isDeno) {
97
- return Deno.build.os === "windows";
98
- }
99
- return typeof process !== "undefined" && process.platform === "win32";
100
- })();
101
- var posix = createPathOps(false);
102
- var win32 = createPathOps(true);
103
89
  function normalizePath(path, isWin) {
104
90
  if (path.length === 0) return ".";
105
91
  const separator = getSeparator(isWin);
106
92
  const isAbsolute = isWin ? isAbsoluteWin(path) : isAbsolutePosix(path);
107
93
  const trailingSeparator = path[path.length - 1] === separator || isWin && path[path.length - 1] === "/";
108
- let normalized = path.replace(isWin ? /[\/\\]+/g : /\/+/g, separator);
94
+ const normalized = path.replace(isWin ? /[\/\\]+/g : /\/+/g, separator);
109
95
  const parts = normalized.split(separator);
110
96
  const result = [];
111
- for (let i = 0; i < parts.length; i++) {
112
- const part = parts[i];
97
+ for (let index = 0; index < parts.length; index++) {
98
+ const part = parts[index];
113
99
  if (part === "" || part === ".") {
114
- if (i === 0 && isAbsolute) result.push("");
100
+ if (index === 0 && isAbsolute) result.push("");
115
101
  continue;
116
102
  }
117
103
  if (part === "..") {
@@ -126,21 +112,21 @@ function normalizePath(path, isWin) {
126
112
  result.push(part);
127
113
  }
128
114
  }
129
- let final = result.join(separator);
130
- if (final.length === 0) {
115
+ let finalPath = result.join(separator);
116
+ if (finalPath.length === 0) {
131
117
  return isAbsolute ? separator : ".";
132
118
  }
133
- if (trailingSeparator && final[final.length - 1] !== separator) {
134
- final += separator;
119
+ if (trailingSeparator && finalPath[finalPath.length - 1] !== separator) {
120
+ finalPath += separator;
135
121
  }
136
- return final;
122
+ return finalPath;
137
123
  }
138
124
  function joinPaths(paths, isWin) {
139
125
  if (paths.length === 0) return ".";
140
126
  const separator = getSeparator(isWin);
141
127
  let joined = "";
142
- for (let i = 0; i < paths.length; i++) {
143
- const path = paths[i];
128
+ for (let index = 0; index < paths.length; index++) {
129
+ const path = paths[index];
144
130
  if (path && path.length > 0) {
145
131
  if (joined.length === 0) {
146
132
  joined = path;
@@ -155,43 +141,43 @@ function joinPaths(paths, isWin) {
155
141
  function resolvePaths(paths, isWin) {
156
142
  const separator = getSeparator(isWin);
157
143
  let resolved = "";
158
- let isAbsolute = false;
159
- for (let i = paths.length - 1; i >= 0 && !isAbsolute; i--) {
160
- const path = paths[i];
144
+ let absolute = false;
145
+ for (let index = paths.length - 1; index >= 0 && !absolute; index--) {
146
+ const path = paths[index];
161
147
  if (path && path.length > 0) {
162
148
  resolved = path + (resolved.length > 0 ? separator + resolved : "");
163
- isAbsolute = isWin ? isAbsoluteWin(resolved) : isAbsolutePosix(resolved);
149
+ absolute = isWin ? isAbsoluteWin(resolved) : isAbsolutePosix(resolved);
164
150
  }
165
151
  }
166
- if (!isAbsolute) {
152
+ if (!absolute) {
167
153
  const cwd = getCwd();
168
154
  resolved = cwd + (resolved.length > 0 ? separator + resolved : "");
169
155
  }
170
156
  return normalizePath(resolved, isWin);
171
157
  }
172
158
  function relativePath(from, to, isWin) {
173
- from = resolvePaths([from], isWin);
174
- to = resolvePaths([to], isWin);
175
- if (from === to) return "";
159
+ const resolvedFrom = resolvePaths([from], isWin);
160
+ const resolvedTo = resolvePaths([to], isWin);
161
+ if (resolvedFrom === resolvedTo) return "";
176
162
  const separator = getSeparator(isWin);
177
- const fromParts = from.split(separator).filter((p) => p.length > 0);
178
- const toParts = to.split(separator).filter((p) => p.length > 0);
179
- let commonLength = 0;
163
+ const fromParts = resolvedFrom.split(separator).filter((part) => part.length > 0);
164
+ const toParts = resolvedTo.split(separator).filter((part) => part.length > 0);
180
165
  const minLength = Math.min(fromParts.length, toParts.length);
181
- for (let i = 0; i < minLength; i++) {
182
- if (fromParts[i] === toParts[i]) {
166
+ let commonLength = 0;
167
+ for (let index = 0; index < minLength; index++) {
168
+ if (fromParts[index] === toParts[index]) {
183
169
  commonLength++;
184
170
  } else {
185
171
  break;
186
172
  }
187
173
  }
188
- const upCount = fromParts.length - commonLength;
189
174
  const result = [];
190
- for (let i = 0; i < upCount; i++) {
175
+ const upCount = fromParts.length - commonLength;
176
+ for (let index = 0; index < upCount; index++) {
191
177
  result.push("..");
192
178
  }
193
- for (let i = commonLength; i < toParts.length; i++) {
194
- result.push(toParts[i]);
179
+ for (let index = commonLength; index < toParts.length; index++) {
180
+ result.push(toParts[index]);
195
181
  }
196
182
  return result.join(separator) || ".";
197
183
  }
@@ -199,15 +185,15 @@ function getDirname(path, isWin) {
199
185
  if (path.length === 0) return ".";
200
186
  const separator = getSeparator(isWin);
201
187
  const normalized = normalizePath(path, isWin);
202
- const lastSepIndex = normalized.lastIndexOf(separator);
203
- if (lastSepIndex === -1) return ".";
204
- if (lastSepIndex === 0) return separator;
205
- return normalized.slice(0, lastSepIndex);
188
+ const lastSeparatorIndex = normalized.lastIndexOf(separator);
189
+ if (lastSeparatorIndex === -1) return ".";
190
+ if (lastSeparatorIndex === 0) return separator;
191
+ return normalized.slice(0, lastSeparatorIndex);
206
192
  }
207
193
  function getBasename(path, ext, isWin) {
208
194
  if (path.length === 0) return "";
209
- const lastSepIndex = isWin ? findLastSeparator(path) : path.lastIndexOf("/");
210
- let base = lastSepIndex === -1 ? path : path.slice(lastSepIndex + 1);
195
+ const lastSeparatorIndex = isWin ? findLastSeparator(path) : path.lastIndexOf("/");
196
+ let base = lastSeparatorIndex === -1 ? path : path.slice(lastSeparatorIndex + 1);
211
197
  if (ext && base.endsWith(ext)) {
212
198
  base = base.slice(0, base.length - ext.length);
213
199
  }
@@ -215,8 +201,8 @@ function getBasename(path, ext, isWin) {
215
201
  }
216
202
  function getExtname(path) {
217
203
  const lastDotIndex = path.lastIndexOf(".");
218
- const lastSepIndex = findLastSeparator(path);
219
- if (lastDotIndex === -1 || lastDotIndex < lastSepIndex || lastDotIndex === path.length - 1) {
204
+ const lastSeparatorIndex = findLastSeparator(path);
205
+ if (lastDotIndex === -1 || lastDotIndex < lastSeparatorIndex || lastDotIndex === path.length - 1) {
220
206
  return "";
221
207
  }
222
208
  return path.slice(lastDotIndex);
@@ -232,10 +218,8 @@ function parsePath(path, isWin) {
232
218
  } else if (path[0] === "\\" || path[0] === "/") {
233
219
  root = "\\";
234
220
  }
235
- } else {
236
- if (path[0] === "/") {
237
- root = "/";
238
- }
221
+ } else if (path[0] === "/") {
222
+ root = "/";
239
223
  }
240
224
  const dir = getDirname(path, isWin);
241
225
  const base = getBasename(path, void 0, isWin);
@@ -251,11 +235,31 @@ function formatPath(pathObject, isWin) {
251
235
  if (dir === pathObject.root) return dir + base;
252
236
  return dir + separator + base;
253
237
  }
238
+ function createPathOps(isWin) {
239
+ return {
240
+ sep: getSeparator(isWin),
241
+ delimiter: isWin ? ";" : ":",
242
+ normalize: (path) => normalizePath(path, isWin),
243
+ join: (...paths) => joinPaths(paths, isWin),
244
+ resolve: (...paths) => resolvePaths(paths, isWin),
245
+ isAbsolute: (path) => isWin ? isAbsoluteWin(path) : isAbsolutePosix(path),
246
+ relative: (from, to) => relativePath(from, to, isWin),
247
+ dirname: (path) => getDirname(path, isWin),
248
+ basename: (path, ext) => getBasename(path, ext, isWin),
249
+ extname: (path) => getExtname(path),
250
+ parse: (path) => parsePath(path, isWin),
251
+ format: (pathObject) => formatPath(pathObject, isWin)
252
+ };
253
+ }
254
+
255
+ // src/server/path/index.ts
256
+ var posix = createPathOps(false);
257
+ var win32 = createPathOps(true);
254
258
  function relative(from, to) {
255
259
  return relativePath(from, to, isWindows);
256
260
  }
257
261
 
258
- // src/test-reporter.ts
262
+ // src/test/reporter/colors.ts
259
263
  var colors = {
260
264
  reset: "\x1B[0m",
261
265
  bold: "\x1B[1m",
@@ -267,68 +271,220 @@ var colors = {
267
271
  cyan: "\x1B[36m",
268
272
  white: "\x1B[37m"
269
273
  };
274
+ function colorize(color, text, enabled = true) {
275
+ return enabled ? colors[color] + text + colors.reset : text;
276
+ }
277
+
278
+ // src/test/reporter/suggestions.ts
270
279
  function extractArg(code, functionName) {
271
- const searchStr = `.${functionName}(`;
272
- const startIndex = code.indexOf(searchStr);
280
+ const searchString = `.${functionName}(`;
281
+ const startIndex = code.indexOf(searchString);
273
282
  if (startIndex === -1) return null;
274
283
  let parenCount = 0;
275
284
  let inString = false;
276
285
  let stringChar = "";
277
- let argStart = startIndex + searchStr.length;
278
- for (let i = argStart; i < code.length; i++) {
279
- const char = code[i];
286
+ const argumentStart = startIndex + searchString.length;
287
+ for (let index = argumentStart; index < code.length; index++) {
288
+ const char = code[index];
280
289
  if (!inString) {
281
- if (char === "(") parenCount++;
282
- else if (char === ")") {
290
+ if (char === "(") {
291
+ parenCount++;
292
+ } else if (char === ")") {
283
293
  parenCount--;
284
294
  if (parenCount < 0) {
285
- return code.slice(argStart, i);
295
+ return code.slice(argumentStart, index);
286
296
  }
287
297
  } else if (char === '"' || char === "'" || char === "`") {
288
298
  inString = true;
289
299
  stringChar = char;
290
300
  }
291
- } else {
292
- if (char === "\\" && i + 1 < code.length) {
293
- i++;
294
- } else if (char === stringChar) {
295
- inString = false;
296
- }
301
+ } else if (char === "\\" && index + 1 < code.length) {
302
+ index++;
303
+ } else if (char === stringChar) {
304
+ inString = false;
297
305
  }
298
306
  }
299
307
  return null;
300
308
  }
301
- function extractReceivedValue(errorMsg) {
302
- const receivedIndex = errorMsg.indexOf("Received:");
309
+ function extractReceivedValue(errorMessage) {
310
+ const receivedIndex = errorMessage.indexOf("Received:");
303
311
  if (receivedIndex === -1) return null;
304
- const afterReceived = errorMsg.slice(receivedIndex + 9).trimStart();
312
+ const afterReceived = errorMessage.slice(receivedIndex + 9).trimStart();
305
313
  const newlineIndex = afterReceived.indexOf("\n");
306
314
  if (newlineIndex !== -1) {
307
315
  return afterReceived.slice(0, newlineIndex).trimEnd();
308
316
  }
309
317
  return afterReceived.trimEnd();
310
318
  }
311
- function parseQuotedString(str) {
312
- if (str.length < 2) return null;
313
- const firstChar = str[0];
314
- const lastChar = str[str.length - 1];
319
+ function parseQuotedString(value) {
320
+ if (value.length < 2) return null;
321
+ const firstChar = value[0];
322
+ const lastChar = value[value.length - 1];
315
323
  if ((firstChar === '"' || firstChar === "'" || firstChar === "`") && firstChar === lastChar) {
316
324
  return {
317
325
  quote: firstChar,
318
- content: str.slice(1, -1)
326
+ content: value.slice(1, -1)
319
327
  };
320
328
  }
321
329
  return null;
322
330
  }
323
- function stripQuotes(str) {
324
- if (str.length < 2) return str;
325
- const firstChar = str[0];
326
- const lastChar = str[str.length - 1];
331
+ function stripQuotes(value) {
332
+ if (value.length < 2) return value;
333
+ const firstChar = value[0];
334
+ const lastChar = value[value.length - 1];
327
335
  if ((firstChar === '"' || firstChar === "'" || firstChar === "`") && firstChar === lastChar) {
328
- return str.slice(1, -1);
336
+ return value.slice(1, -1);
329
337
  }
330
- return str;
338
+ return value;
331
339
  }
340
+ function buildSuggestion(code, errorMessage) {
341
+ const receivedValue = extractReceivedValue(errorMessage);
342
+ if (code.includes(".toBeGreaterThanOrEqual(")) {
343
+ const currentValue = extractArg(code, "toBeGreaterThanOrEqual");
344
+ if (currentValue && receivedValue) {
345
+ const actualValue = Number(receivedValue);
346
+ if (!Number.isNaN(actualValue)) {
347
+ return code.replace(
348
+ `.toBeGreaterThanOrEqual(${currentValue})`,
349
+ `.toBeGreaterThanOrEqual(${actualValue})`
350
+ );
351
+ }
352
+ }
353
+ } else if (code.includes(".toBeGreaterThan(")) {
354
+ const currentValue = extractArg(code, "toBeGreaterThan");
355
+ if (currentValue && receivedValue) {
356
+ const actualValue = Number(receivedValue);
357
+ if (!Number.isNaN(actualValue)) {
358
+ return code.replace(
359
+ `.toBeGreaterThan(${currentValue})`,
360
+ `.toBeGreaterThan(${actualValue - 1})`
361
+ );
362
+ }
363
+ }
364
+ } else if (code.includes(".toBeLessThanOrEqual(")) {
365
+ const currentValue = extractArg(code, "toBeLessThanOrEqual");
366
+ if (currentValue && receivedValue) {
367
+ const actualValue = Number(receivedValue);
368
+ if (!Number.isNaN(actualValue)) {
369
+ return code.replace(
370
+ `.toBeLessThanOrEqual(${currentValue})`,
371
+ `.toBeLessThanOrEqual(${actualValue})`
372
+ );
373
+ }
374
+ }
375
+ } else if (code.includes(".toBeLessThan(")) {
376
+ const currentValue = extractArg(code, "toBeLessThan");
377
+ if (currentValue && receivedValue) {
378
+ const actualValue = Number(receivedValue);
379
+ if (!Number.isNaN(actualValue)) {
380
+ return code.replace(
381
+ `.toBeLessThan(${currentValue})`,
382
+ `.toBeLessThan(${actualValue + 1})`
383
+ );
384
+ }
385
+ }
386
+ } else if (code.includes(".toStrictEqual(")) {
387
+ const expectedValue = extractArg(code, "toStrictEqual");
388
+ if (expectedValue && receivedValue) {
389
+ const quoted = parseQuotedString(expectedValue);
390
+ if (quoted) {
391
+ return code.replace(
392
+ `.toStrictEqual(${expectedValue})`,
393
+ `.toStrictEqual(${quoted.quote}${stripQuotes(receivedValue)}${quoted.quote})`
394
+ );
395
+ }
396
+ return code.replace(
397
+ `.toStrictEqual(${expectedValue})`,
398
+ `.toStrictEqual(${receivedValue})`
399
+ );
400
+ }
401
+ } else if (code.includes(".toEqual(")) {
402
+ const expectedValue = extractArg(code, "toEqual");
403
+ if (expectedValue && receivedValue) {
404
+ const quoted = parseQuotedString(expectedValue);
405
+ if (quoted) {
406
+ return code.replace(
407
+ `.toEqual(${expectedValue})`,
408
+ `.toEqual(${quoted.quote}${stripQuotes(receivedValue)}${quoted.quote})`
409
+ );
410
+ }
411
+ return code.replace(
412
+ `.toEqual(${expectedValue})`,
413
+ `.toEqual(${receivedValue})`
414
+ );
415
+ }
416
+ } else if (code.includes(".toMatch(")) {
417
+ const expectedPattern = extractArg(code, "toMatch");
418
+ if (expectedPattern && receivedValue) {
419
+ const quoted = parseQuotedString(expectedPattern);
420
+ if (quoted) {
421
+ return code.replace(
422
+ `.toMatch(${expectedPattern})`,
423
+ `.toMatch(${quoted.quote}${stripQuotes(receivedValue)}${quoted.quote})`
424
+ );
425
+ }
426
+ }
427
+ } else if (code.includes(".toContain(")) {
428
+ const expectedValue = extractArg(code, "toContain");
429
+ if (expectedValue && receivedValue) {
430
+ const quoted = parseQuotedString(expectedValue);
431
+ if (quoted) {
432
+ return code.replace(
433
+ `.toContain(${expectedValue})`,
434
+ `.toContain(${quoted.quote}${stripQuotes(receivedValue)}${quoted.quote})`
435
+ );
436
+ }
437
+ return code.replace(
438
+ `.toContain(${expectedValue})`,
439
+ `.toContain(${receivedValue})`
440
+ );
441
+ }
442
+ } else if (code.includes(".toHaveLength(")) {
443
+ const expectedLength = extractArg(code, "toHaveLength");
444
+ if (expectedLength && receivedValue) {
445
+ const actualLength = Number(receivedValue);
446
+ if (!Number.isNaN(actualLength)) {
447
+ return code.replace(
448
+ `.toHaveLength(${expectedLength})`,
449
+ `.toHaveLength(${actualLength})`
450
+ );
451
+ }
452
+ }
453
+ } else if (code.includes(".toBe(")) {
454
+ const expectedValue = extractArg(code, "toBe");
455
+ if (expectedValue) {
456
+ if (receivedValue) {
457
+ const quoted = parseQuotedString(expectedValue);
458
+ if (quoted) {
459
+ return code.replace(
460
+ `.toBe(${expectedValue})`,
461
+ `.toBe(${quoted.quote}${stripQuotes(receivedValue)}${quoted.quote})`
462
+ );
463
+ }
464
+ return code.replace(
465
+ `.toBe(${expectedValue})`,
466
+ `.toBe(${receivedValue})`
467
+ );
468
+ }
469
+ if (expectedValue.includes("'") || expectedValue.includes('"')) {
470
+ return code.replace(".toBe(", ".toEqual(");
471
+ }
472
+ }
473
+ } else if (code.includes(".toBeDefined()")) {
474
+ return code.replace(".toBeDefined()", ".toBeTruthy()");
475
+ } else if (code.includes(".toBeNull()")) {
476
+ return code.replace(".toBeNull()", ".toBeUndefined()");
477
+ } else if (code.includes(".toBeUndefined()")) {
478
+ return code.replace(".toBeUndefined()", ".toBeNull()");
479
+ } else if (code.includes(".toBeTruthy()")) {
480
+ return code.replace(".toBeTruthy()", ".toBeDefined()");
481
+ } else if (code.includes(".toBeFalsy()")) {
482
+ return code.replace(".toBeFalsy()", ".toBeUndefined()");
483
+ }
484
+ return "";
485
+ }
486
+
487
+ // src/test/reporter/default-reporter.ts
332
488
  var TestReporter = class {
333
489
  constructor(options = {}) {
334
490
  this.startTime = 0;
@@ -342,7 +498,7 @@ var TestReporter = class {
342
498
  };
343
499
  }
344
500
  c(color, text) {
345
- return this.options.colors !== false ? colors[color] + text + colors.reset : text;
501
+ return colorize(color, text, this.options.colors !== false);
346
502
  }
347
503
  onRunStart(files) {
348
504
  this.startTime = Date.now();
@@ -368,202 +524,52 @@ ${this.c("bold", "Test Files")}: ${files.length}`);
368
524
  this.fileTestCount++;
369
525
  if (result.status === "pass") {
370
526
  console.log(` ${this.c("green", "\u2713")} ${this.c("dim", result.suite + " > ")}${result.name} ${this.c("dim", `(${result.duration}ms)`)}`);
371
- } else if (result.status === "fail") {
527
+ return;
528
+ }
529
+ if (result.status === "fail") {
372
530
  console.log(` ${this.c("red", "\u2715")} ${this.c("dim", result.suite + " > ")}${result.name}`);
373
- if (result.error) {
374
- const filePath2 = result.file;
375
- if (filePath2) {
376
- const relativePath2 = relative(process.cwd(), filePath2).split("\\").join("/");
377
- const lineSuffix = result.lineNumber ? `:${result.lineNumber}` : "";
378
- console.log(` ${this.c("cyan", `\u{1F4C4} ${relativePath2}${lineSuffix}`)}`);
379
- }
380
- const lines = result.error.message.split("\n");
381
- for (const line of lines) {
382
- if (line.includes("Expected:")) {
383
- console.log(` ${this.c("green", "Expected:")} ${line.trim().replace("Expected:", "").trim()}`);
384
- } else if (line.includes("Received:")) {
385
- console.log(` ${this.c("red", "Received:")} ${line.trim().replace("Received:", "").trim()}`);
386
- } else {
387
- console.log(` ${this.c("red", line.trim())}`);
388
- }
389
- }
390
- if (result.codeSnippet) {
391
- let suggestion = "";
392
- const code = result.codeSnippet;
393
- const errorMsg = result.error?.message || "";
394
- const receivedValue = extractReceivedValue(errorMsg);
395
- if (code.includes(".toBeGreaterThanOrEqual(")) {
396
- const currentValue = extractArg(code, "toBeGreaterThanOrEqual");
397
- if (currentValue && receivedValue) {
398
- const actualValue = Number(receivedValue);
399
- if (!isNaN(actualValue)) {
400
- suggestion = code.replace(
401
- `.toBeGreaterThanOrEqual(${currentValue})`,
402
- `.toBeGreaterThanOrEqual(${actualValue})`
403
- );
404
- }
405
- }
406
- } else if (code.includes(".toBeGreaterThan(")) {
407
- const currentValue = extractArg(code, "toBeGreaterThan");
408
- if (currentValue && receivedValue) {
409
- const actualValue = Number(receivedValue);
410
- if (!isNaN(actualValue)) {
411
- suggestion = code.replace(
412
- `.toBeGreaterThan(${currentValue})`,
413
- `.toBeGreaterThan(${actualValue - 1})`
414
- );
415
- }
416
- }
417
- } else if (code.includes(".toBeLessThanOrEqual(")) {
418
- const currentValue = extractArg(code, "toBeLessThanOrEqual");
419
- if (currentValue && receivedValue) {
420
- const actualValue = Number(receivedValue);
421
- if (!isNaN(actualValue)) {
422
- suggestion = code.replace(
423
- `.toBeLessThanOrEqual(${currentValue})`,
424
- `.toBeLessThanOrEqual(${actualValue})`
425
- );
426
- }
427
- }
428
- } else if (code.includes(".toBeLessThan(")) {
429
- const currentValue = extractArg(code, "toBeLessThan");
430
- if (currentValue && receivedValue) {
431
- const actualValue = Number(receivedValue);
432
- if (!isNaN(actualValue)) {
433
- suggestion = code.replace(
434
- `.toBeLessThan(${currentValue})`,
435
- `.toBeLessThan(${actualValue + 1})`
436
- );
437
- }
438
- }
439
- } else if (code.includes(".toStrictEqual(")) {
440
- const expectedValue = extractArg(code, "toStrictEqual");
441
- if (expectedValue && receivedValue) {
442
- const quoted = parseQuotedString(expectedValue);
443
- if (quoted) {
444
- const strippedReceived = stripQuotes(receivedValue);
445
- suggestion = code.replace(
446
- `.toStrictEqual(${expectedValue})`,
447
- `.toStrictEqual(${quoted.quote}${strippedReceived}${quoted.quote})`
448
- );
449
- } else {
450
- suggestion = code.replace(
451
- `.toStrictEqual(${expectedValue})`,
452
- `.toStrictEqual(${receivedValue})`
453
- );
454
- }
455
- }
456
- } else if (code.includes(".toEqual(")) {
457
- const expectedValue = extractArg(code, "toEqual");
458
- if (expectedValue && receivedValue) {
459
- const quoted = parseQuotedString(expectedValue);
460
- if (quoted) {
461
- const strippedReceived = stripQuotes(receivedValue);
462
- suggestion = code.replace(
463
- `.toEqual(${expectedValue})`,
464
- `.toEqual(${quoted.quote}${strippedReceived}${quoted.quote})`
465
- );
466
- } else {
467
- suggestion = code.replace(
468
- `.toEqual(${expectedValue})`,
469
- `.toEqual(${receivedValue})`
470
- );
471
- }
472
- }
473
- } else if (code.includes(".toMatch(")) {
474
- const expectedPattern = extractArg(code, "toMatch");
475
- if (expectedPattern && receivedValue) {
476
- const quoted = parseQuotedString(expectedPattern);
477
- if (quoted) {
478
- const strippedReceived = stripQuotes(receivedValue);
479
- suggestion = code.replace(
480
- `.toMatch(${expectedPattern})`,
481
- `.toMatch(${quoted.quote}${strippedReceived}${quoted.quote})`
482
- );
483
- }
484
- }
485
- } else if (code.includes(".toContain(")) {
486
- const expectedValue = extractArg(code, "toContain");
487
- if (expectedValue && receivedValue) {
488
- const quoted = parseQuotedString(expectedValue);
489
- if (quoted) {
490
- const strippedReceived = stripQuotes(receivedValue);
491
- suggestion = code.replace(
492
- `.toContain(${expectedValue})`,
493
- `.toContain(${quoted.quote}${strippedReceived}${quoted.quote})`
494
- );
495
- } else {
496
- suggestion = code.replace(
497
- `.toContain(${expectedValue})`,
498
- `.toContain(${receivedValue})`
499
- );
500
- }
501
- }
502
- } else if (code.includes(".toHaveLength(")) {
503
- const expectedLength = extractArg(code, "toHaveLength");
504
- if (expectedLength && receivedValue) {
505
- const actualLength = Number(receivedValue);
506
- if (!isNaN(actualLength)) {
507
- suggestion = code.replace(
508
- `.toHaveLength(${expectedLength})`,
509
- `.toHaveLength(${actualLength})`
510
- );
511
- }
512
- }
513
- } else if (code.includes(".toBe(")) {
514
- const expectedValue = extractArg(code, "toBe");
515
- if (expectedValue) {
516
- if (receivedValue) {
517
- const quoted = parseQuotedString(expectedValue);
518
- if (quoted) {
519
- const strippedReceived = stripQuotes(receivedValue);
520
- suggestion = code.replace(
521
- `.toBe(${expectedValue})`,
522
- `.toBe(${quoted.quote}${strippedReceived}${quoted.quote})`
523
- );
524
- } else {
525
- suggestion = code.replace(
526
- `.toBe(${expectedValue})`,
527
- `.toBe(${receivedValue})`
528
- );
529
- }
530
- } else if (expectedValue.includes("'") || expectedValue.includes('"')) {
531
- suggestion = code.replace(".toBe(", ".toEqual(");
532
- }
533
- }
534
- } else if (code.includes(".toBeDefined()")) {
535
- suggestion = code.replace(".toBeDefined()", ".toBeTruthy()");
536
- } else if (code.includes(".toBeNull()")) {
537
- suggestion = code.replace(".toBeNull()", ".toBeUndefined()");
538
- } else if (code.includes(".toBeUndefined()")) {
539
- suggestion = code.replace(".toBeUndefined()", ".toBeNull()");
540
- } else if (code.includes(".toBeTruthy()")) {
541
- suggestion = code.replace(".toBeTruthy()", ".toBeDefined()");
542
- } else if (code.includes(".toBeFalsy()")) {
543
- suggestion = code.replace(".toBeFalsy()", ".toBeUndefined()");
544
- }
545
- console.log(` ${this.c("dim", "Code:")}`);
546
- console.log(` ${this.c("dim", code)}`);
547
- if (suggestion && suggestion !== code) {
548
- console.log(` ${this.c("yellow", "example \u2192")} ${this.c("green", suggestion)}`);
549
- }
531
+ if (!result.error) {
532
+ return;
533
+ }
534
+ if (result.file) {
535
+ const relativePath2 = relative(process.cwd(), result.file).split("\\").join("/");
536
+ const lineSuffix = result.lineNumber ? `:${result.lineNumber}` : "";
537
+ console.log(` ${this.c("cyan", `\u{1F4C4} ${relativePath2}${lineSuffix}`)}`);
538
+ }
539
+ for (const line of result.error.message.split("\n")) {
540
+ if (line.includes("Expected:")) {
541
+ console.log(` ${this.c("green", "Expected:")} ${line.trim().replace("Expected:", "").trim()}`);
542
+ } else if (line.includes("Received:")) {
543
+ console.log(` ${this.c("red", "Received:")} ${line.trim().replace("Received:", "").trim()}`);
544
+ } else {
545
+ console.log(` ${this.c("red", line.trim())}`);
550
546
  }
551
- if (this.options.verbose && result.error.stack) {
552
- const stack = result.error.stack.split("\n").slice(1, 3).join("\n");
553
- console.log(` ${this.c("dim", stack)}`);
547
+ }
548
+ if (result.codeSnippet) {
549
+ const suggestion = buildSuggestion(result.codeSnippet, result.error.message || "");
550
+ console.log(` ${this.c("dim", "Code:")}`);
551
+ console.log(` ${this.c("dim", result.codeSnippet)}`);
552
+ if (suggestion && suggestion !== result.codeSnippet) {
553
+ console.log(` ${this.c("yellow", "example \u2192")} ${this.c("green", suggestion)}`);
554
554
  }
555
555
  }
556
- } else if (result.status === "skip") {
556
+ if (this.options.verbose && result.error.stack) {
557
+ const stack = result.error.stack.split("\n").slice(1, 3).join("\n");
558
+ console.log(` ${this.c("dim", stack)}`);
559
+ }
560
+ return;
561
+ }
562
+ if (result.status === "skip") {
557
563
  console.log(` ${this.c("yellow", "\u25CB")} ${this.c("dim", result.suite + " > ")}${result.name} ${this.c("yellow", "(skipped)")}`);
558
- } else if (result.status === "todo") {
559
- console.log(` ${this.c("cyan", "\u25CB")} ${this.c("dim", result.suite + " > ")}${result.name} ${this.c("cyan", "(todo)")}`);
564
+ return;
560
565
  }
566
+ console.log(` ${this.c("cyan", "\u25CB")} ${this.c("dim", result.suite + " > ")}${result.name} ${this.c("cyan", "(todo)")}`);
561
567
  }
562
568
  onRunEnd(results) {
563
569
  const duration = Date.now() - this.startTime;
564
- const passed = results.filter((r) => r.status === "pass").length;
565
- const failed = results.filter((r) => r.status === "fail").length;
566
- const skipped = results.filter((r) => r.status === "skip").length;
570
+ const passed = results.filter((result) => result.status === "pass").length;
571
+ const failed = results.filter((result) => result.status === "fail").length;
572
+ const skipped = results.filter((result) => result.status === "skip").length;
567
573
  const total = results.length;
568
574
  if (this.currentFile && this.fileTestCount > 0) {
569
575
  console.log("");
@@ -577,6 +583,8 @@ ${this.c("bold", "Test Files")}: ${files.length}`);
577
583
  console.log("");
578
584
  }
579
585
  };
586
+
587
+ // src/test/reporter/dot-reporter.ts
580
588
  var DotReporter = class {
581
589
  constructor() {
582
590
  this.passed = 0;
@@ -610,9 +618,11 @@ var DotReporter = class {
610
618
  `);
611
619
  }
612
620
  c(color, text) {
613
- return colors[color] + text + colors.reset;
621
+ return colorize(color, text);
614
622
  }
615
623
  };
624
+
625
+ // src/test/reporter/json-reporter.ts
616
626
  var JsonReporter = class {
617
627
  constructor() {
618
628
  this.startTime = 0;
@@ -625,30 +635,32 @@ var JsonReporter = class {
625
635
  onTestResult(result) {
626
636
  this.results.push(result);
627
637
  }
628
- onRunEnd(results) {
638
+ onRunEnd(_results) {
629
639
  const report = {
630
640
  summary: {
631
- total: results.length,
632
- passed: results.filter((r) => r.status === "pass").length,
633
- failed: results.filter((r) => r.status === "fail").length,
634
- skipped: results.filter((r) => r.status === "skip").length,
635
- todo: results.filter((r) => r.status === "todo").length,
641
+ total: this.results.length,
642
+ passed: this.results.filter((result) => result.status === "pass").length,
643
+ failed: this.results.filter((result) => result.status === "fail").length,
644
+ skipped: this.results.filter((result) => result.status === "skip").length,
645
+ todo: this.results.filter((result) => result.status === "todo").length,
636
646
  duration: Date.now() - this.startTime
637
647
  },
638
- tests: results.map((r) => ({
639
- status: r.status === "pass" ? "passed" : r.status === "fail" ? "failed" : r.status === "skip" ? "skipped" : "todo",
640
- name: r.name,
641
- suite: r.suite,
642
- duration: r.duration,
643
- error: r.error ? {
644
- message: r.error.message,
645
- stack: r.error.stack
648
+ tests: this.results.map((result) => ({
649
+ status: result.status === "pass" ? "passed" : result.status === "fail" ? "failed" : result.status === "skip" ? "skipped" : "todo",
650
+ name: result.name,
651
+ suite: result.suite,
652
+ duration: result.duration,
653
+ error: result.error ? {
654
+ message: result.error.message,
655
+ stack: result.error.stack
646
656
  } : void 0
647
657
  }))
648
658
  };
649
659
  console.log(JSON.stringify(report, null, 2));
650
660
  }
651
661
  };
662
+
663
+ // src/test/reporter/verbose-reporter.ts
652
664
  var VerboseReporter = class {
653
665
  constructor() {
654
666
  this.currentSuite = "";
@@ -676,9 +688,9 @@ ${colors.red} ${result.error.message}${colors.reset}`);
676
688
  }
677
689
  }
678
690
  onRunEnd(results) {
679
- const passed = results.filter((r) => r.status === "pass").length;
680
- const failed = results.filter((r) => r.status === "fail").length;
681
- const skipped = results.filter((r) => r.status === "skip").length;
691
+ const passed = results.filter((result) => result.status === "pass").length;
692
+ const failed = results.filter((result) => result.status === "fail").length;
693
+ const skipped = results.filter((result) => result.status === "skip").length;
682
694
  console.log(`
683
695
  ${colors.dim}${"\u2500".repeat(50)}${colors.reset}
684
696
  `);
@@ -686,18 +698,22 @@ ${colors.dim}${"\u2500".repeat(50)}${colors.reset}
686
698
  console.log(`${colors.green}All tests passed!${colors.reset}`);
687
699
  console.log(`${colors.dim}${passed} tests${colors.reset}
688
700
  `);
689
- } else {
690
- console.log(`${colors.red}${failed} tests failed${colors.reset}`);
691
- console.log(`${colors.green}${passed} tests passed${colors.reset}`);
692
- if (skipped > 0) {
693
- console.log(`${colors.yellow}${skipped} tests skipped${colors.reset}`);
694
- }
695
- console.log("");
701
+ return;
702
+ }
703
+ console.log(`${colors.red}${failed} tests failed${colors.reset}`);
704
+ console.log(`${colors.green}${passed} tests passed${colors.reset}`);
705
+ if (skipped > 0) {
706
+ console.log(`${colors.yellow}${skipped} tests skipped${colors.reset}`);
696
707
  }
708
+ console.log("");
697
709
  }
698
710
  };
711
+
712
+ // src/test/reporter/utilities.ts
699
713
  function formatErrorStack(error) {
700
- if (!error.stack) return error.message;
714
+ if (!error.stack) {
715
+ return error.message;
716
+ }
701
717
  const lines = error.stack.split("\n");
702
718
  let formatted = `${error.message}
703
719
  `;