@antdv-next/x-sdk 0.0.2 → 0.0.4

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 (37) hide show
  1. package/LICENSE +21 -0
  2. package/dist/chat-providers/types/model.d.ts +1 -1
  3. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +76 -0
  4. package/dist/node_modules/{vitest/dist/@vitest/expect → .pnpm/@vitest_expect@4.1.10/node_modules/@vitest/expect/dist}/index.js +76 -51
  5. package/dist/node_modules/{vitest/dist/@vitest/pretty-format → .pnpm/@vitest_pretty-format@4.1.10/node_modules/@vitest/pretty-format/dist}/index.js +11 -10
  6. package/dist/node_modules/{vitest/dist/@vitest/runner → .pnpm/@vitest_runner@4.1.10/node_modules/@vitest/runner/dist}/chunk-artifact.js +18 -41
  7. package/dist/node_modules/.pnpm/@vitest_runner@4.1.10/node_modules/@vitest/runner/dist/index.js +2 -0
  8. package/dist/node_modules/.pnpm/@vitest_runner@4.1.10/node_modules/@vitest/runner/dist/utils.js +2 -0
  9. package/dist/node_modules/{vitest/dist/@vitest/snapshot → .pnpm/@vitest_snapshot@4.1.10/node_modules/@vitest/snapshot/dist}/index.js +455 -195
  10. package/dist/node_modules/{vitest/dist/@vitest/spy → .pnpm/@vitest_spy@4.1.10/node_modules/@vitest/spy/dist}/index.js +3 -3
  11. package/dist/node_modules/{vitest/dist/@vitest/utils → .pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist}/chunk-pathe.M-eThtNZ.js +2 -2
  12. package/dist/node_modules/{vitest/dist/@vitest/utils → .pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist}/diff.js +40 -30
  13. package/dist/node_modules/{vitest/dist/@vitest/utils → .pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist}/display.js +3 -3
  14. package/dist/node_modules/.pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/error.js +34 -0
  15. package/dist/node_modules/{vitest/dist/@vitest/utils → .pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist}/helpers.js +3 -3
  16. package/dist/node_modules/{vitest/dist/@vitest/utils → .pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist}/offset.js +1 -1
  17. package/dist/node_modules/{vitest/dist/@vitest/utils → .pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist}/serialize.js +1 -1
  18. package/dist/node_modules/{vitest/dist/@vitest/utils → .pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist}/source-map.js +6 -6
  19. package/dist/node_modules/{vitest/dist/@vitest/utils → .pnpm/@vitest_utils@4.1.10/node_modules/@vitest/utils/dist}/timers.js +1 -1
  20. package/dist/node_modules/{vitest/dist/vendor/chai.js → .pnpm/chai@6.2.2/node_modules/chai/index.js} +103 -3
  21. package/dist/node_modules/{vitest/dist/vendor/magic-string.js → .pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.js} +4 -76
  22. package/dist/node_modules/.pnpm/tinyrainbow@3.1.1/node_modules/tinyrainbow/dist/index.js +84 -0
  23. package/dist/node_modules/.pnpm/vitest@4.1.10_@types_node@24.12.0_@vitest_browser-preview@4.1.10_@vitest_coverage-v8@4._55bf307888d746e7433721e12ae091d9/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +4 -0
  24. package/dist/node_modules/{vitest → .pnpm/vitest@4.1.10_@types_node@24.12.0_@vitest_browser-preview@4.1.10_@vitest_coverage-v8@4._55bf307888d746e7433721e12ae091d9/node_modules/vitest}/dist/chunks/rpc.MzXet3jl.js +2 -2
  25. package/dist/node_modules/{vitest/dist/chunks/test.CBQUpOM3.js → .pnpm/vitest@4.1.10_@types_node@24.12.0_@vitest_browser-preview@4.1.10_@vitest_coverage-v8@4._55bf307888d746e7433721e12ae091d9/node_modules/vitest/dist/chunks/test.DNmyFkvJ.js} +383 -327
  26. package/dist/node_modules/{vitest → .pnpm/vitest@4.1.10_@types_node@24.12.0_@vitest_browser-preview@4.1.10_@vitest_coverage-v8@4._55bf307888d746e7433721e12ae091d9/node_modules/vitest}/dist/chunks/utils.BX5Fg8C4.js +3 -3
  27. package/dist/x-chat/__tests__/index.test.js +3 -2
  28. package/dist/x-chat/index.js +3 -2
  29. package/dist/x-conversations/__tests__/index.test.js +2 -2
  30. package/dist/x-request/__tests__/index.test.js +2 -2
  31. package/dist/x-stream/__tests__/index.test.d.ts +1 -0
  32. package/dist/x-stream/__tests__/index.test.js +62 -0
  33. package/dist/x-stream/index.js +16 -5
  34. package/package.json +2 -1
  35. package/dist/node_modules/vitest/dist/@vitest/utils/error.js +0 -27
  36. package/dist/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +0 -4
  37. package/dist/node_modules/vitest/dist/vendor/tinyrainbow.js +0 -84
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Antdv Next
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -82,7 +82,7 @@ export interface XModelResponse {
82
82
  }[];
83
83
  };
84
84
  logprobs: AnyObject | null;
85
- finish_reason: "stop" | "length" | "content_filter" | "tool_calls" | string;
85
+ finish_reason: "stop" | "length" | "content_filter" | "tool_calls" | (string & {});
86
86
  }[];
87
87
  created: number;
88
88
  id: string;
@@ -0,0 +1,76 @@
1
+ //#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
2
+ var comma = ",".charCodeAt(0);
3
+ var semicolon = ";".charCodeAt(0);
4
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
5
+ var intToChar = /* @__PURE__ */ new Uint8Array(64);
6
+ var charToInt = /* @__PURE__ */ new Uint8Array(128);
7
+ for (let i = 0; i < chars.length; i++) {
8
+ const c = chars.charCodeAt(i);
9
+ intToChar[i] = c;
10
+ charToInt[c] = i;
11
+ }
12
+ function encodeInteger(builder, num, relative) {
13
+ let delta = num - relative;
14
+ delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
15
+ do {
16
+ let clamped = delta & 31;
17
+ delta >>>= 5;
18
+ if (delta > 0) clamped |= 32;
19
+ builder.write(intToChar[clamped]);
20
+ } while (delta > 0);
21
+ return num;
22
+ }
23
+ var bufLength = 1024 * 16;
24
+ var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) {
25
+ return Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength).toString();
26
+ } } : { decode(buf) {
27
+ let out = "";
28
+ for (let i = 0; i < buf.length; i++) out += String.fromCharCode(buf[i]);
29
+ return out;
30
+ } };
31
+ var StringWriter = class {
32
+ constructor() {
33
+ this.pos = 0;
34
+ this.out = "";
35
+ this.buffer = new Uint8Array(bufLength);
36
+ }
37
+ write(v) {
38
+ const { buffer } = this;
39
+ buffer[this.pos++] = v;
40
+ if (this.pos === bufLength) {
41
+ this.out += td.decode(buffer);
42
+ this.pos = 0;
43
+ }
44
+ }
45
+ flush() {
46
+ const { buffer, out, pos } = this;
47
+ return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
48
+ }
49
+ };
50
+ function encode(decoded) {
51
+ const writer = new StringWriter();
52
+ let sourcesIndex = 0;
53
+ let sourceLine = 0;
54
+ let sourceColumn = 0;
55
+ let namesIndex = 0;
56
+ for (let i = 0; i < decoded.length; i++) {
57
+ const line = decoded[i];
58
+ if (i > 0) writer.write(semicolon);
59
+ if (line.length === 0) continue;
60
+ let genColumn = 0;
61
+ for (let j = 0; j < line.length; j++) {
62
+ const segment = line[j];
63
+ if (j > 0) writer.write(comma);
64
+ genColumn = encodeInteger(writer, segment[0], genColumn);
65
+ if (segment.length === 1) continue;
66
+ sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
67
+ sourceLine = encodeInteger(writer, segment[2], sourceLine);
68
+ sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
69
+ if (segment.length === 4) continue;
70
+ namesIndex = encodeInteger(writer, segment[4], namesIndex);
71
+ }
72
+ }
73
+ return writer.flush();
74
+ }
75
+ //#endregion
76
+ export { encode };
@@ -1,11 +1,11 @@
1
- import { C } from "../../vendor/tinyrainbow.js";
2
- import { stringify } from "../utils/display.js";
3
- import { assertTypes, getType, isObject, noop, ordinal } from "../utils/helpers.js";
4
- import { diff, printDiffOrStringify } from "../utils/diff.js";
5
- import { processError } from "../utils/error.js";
6
- import { isMockFunction } from "../spy/index.js";
7
- import { use, utils_exports } from "../../vendor/chai.js";
8
- //#region ../../node_modules/vitest/dist/@vitest/expect/index.js
1
+ import y from "../../../../../tinyrainbow@3.1.1/node_modules/tinyrainbow/dist/index.js";
2
+ import { stringify } from "../../../../../@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/display.js";
3
+ import { assertTypes, getType, isObject, noop, ordinal } from "../../../../../@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/helpers.js";
4
+ import { diff, printDiffOrStringify } from "../../../../../@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/diff.js";
5
+ import { processError } from "../../../../../@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/error.js";
6
+ import { isMockFunction } from "../../../../../@vitest_spy@4.1.10/node_modules/@vitest/spy/dist/index.js";
7
+ import { use, util as utils_exports } from "../../../../../chai@6.2.2/node_modules/chai/index.js";
8
+ //#region ../../node_modules/.pnpm/@vitest+expect@4.1.10/node_modules/@vitest/expect/dist/index.js
9
9
  var ChaiStyleAssertions = (chai, utils) => {
10
10
  function defProperty(name, delegateTo) {
11
11
  utils.addProperty(chai.Assertion.prototype, name, function() {
@@ -97,11 +97,11 @@ ${printReceived(actual)}`
97
97
  };
98
98
  }
99
99
  };
100
- var EXPECTED_COLOR = C.green;
101
- var RECEIVED_COLOR = C.red;
102
- var INVERTED_COLOR = C.inverse;
103
- var BOLD_WEIGHT = C.bold;
104
- var DIM_COLOR = C.dim;
100
+ var EXPECTED_COLOR = y.green;
101
+ var RECEIVED_COLOR = y.red;
102
+ var INVERTED_COLOR = y.inverse;
103
+ var BOLD_WEIGHT = y.bold;
104
+ var DIM_COLOR = y.dim;
105
105
  function matcherHint(matcherName, received = "received", expected = "expected", options = {}) {
106
106
  const { comment = "", isDirectExpectCall = false, isNot = false, promise = "", secondArgument = "", expectedColor = EXPECTED_COLOR, receivedColor = RECEIVED_COLOR, secondArgumentColor = EXPECTED_COLOR } = options;
107
107
  let hint = "";
@@ -799,6 +799,7 @@ function handleTestError(test, err) {
799
799
  test.result.errors ||= [];
800
800
  test.result.errors.push(processError(err));
801
801
  }
802
+ /** wrap assertion function to support `expect.soft` and provide assertion name as `_name` */
802
803
  function wrapAssertion(utils, name, fn) {
803
804
  return function(...args) {
804
805
  if (name !== "withTest") utils.flag(this, "_name", name);
@@ -843,8 +844,10 @@ var JestChaiExpect = (chai, utils) => {
843
844
  if (promise === "rejects") utils.flag(this, "object", () => {
844
845
  throw object;
845
846
  });
846
- else if (promise === "resolves" && typeof object !== "function") if (!isNot) throw new AssertionError(utils.flag(this, "message") || "expected promise to throw an error, but it didn't", { showDiff: false }, utils.flag(this, "ssfi"));
847
- else return;
847
+ else if (promise === "resolves" && typeof object !== "function") if (!isNot) {
848
+ const message = utils.flag(this, "message") || "expected promise to throw an error, but it didn't";
849
+ throw new AssertionError(message, { showDiff: false }, utils.flag(this, "ssfi"));
850
+ } else return;
848
851
  _super.apply(this, args);
849
852
  };
850
853
  });
@@ -903,7 +906,8 @@ var JestChaiExpect = (chai, utils) => {
903
906
  actualSubset,
904
907
  false
905
908
  ]);
906
- throw new AssertionError(stripped === 0 ? msg : `${msg}\n(${stripped} matching ${stripped === 1 ? "property" : "properties"} omitted from actual)`, {
909
+ const message = stripped === 0 ? msg : `${msg}\n(${stripped} matching ${stripped === 1 ? "property" : "properties"} omitted from actual)`;
910
+ throw new AssertionError(message, {
907
911
  showDiff: true,
908
912
  expected,
909
913
  actual: actualSubset
@@ -1136,8 +1140,10 @@ var JestChaiExpect = (chai, utils) => {
1136
1140
  const isNot = utils.flag(this, "negate");
1137
1141
  let thrown = null;
1138
1142
  if (promise === "rejects") thrown = obj;
1139
- else if (promise === "resolves" && typeof obj !== "function") if (!isNot) throw new AssertionError(utils.flag(this, "message") || "expected promise to throw an error, but it didn't", { showDiff: false }, utils.flag(this, "ssfi"));
1140
- else return;
1143
+ else if (promise === "resolves" && typeof obj !== "function") if (!isNot) {
1144
+ const message = utils.flag(this, "message") || "expected promise to throw an error, but it didn't";
1145
+ throw new AssertionError(message, { showDiff: false }, utils.flag(this, "ssfi"));
1146
+ } else return;
1141
1147
  else {
1142
1148
  let isThrow = false;
1143
1149
  try {
@@ -1146,7 +1152,10 @@ var JestChaiExpect = (chai, utils) => {
1146
1152
  isThrow = true;
1147
1153
  thrown = err;
1148
1154
  }
1149
- if (!isThrow && !isNot) throw new AssertionError(utils.flag(this, "message") || "expected function to throw an error, but it didn't", { showDiff: false }, utils.flag(this, "ssfi"));
1155
+ if (!isThrow && !isNot) {
1156
+ const message = utils.flag(this, "message") || "expected function to throw an error, but it didn't";
1157
+ throw new AssertionError(message, { showDiff: false }, utils.flag(this, "ssfi"));
1158
+ }
1150
1159
  }
1151
1160
  if (typeof expected === "function") {
1152
1161
  const name = expected.name || expected.prototype.constructor.name;
@@ -1216,7 +1225,8 @@ var JestChaiExpect = (chai, utils) => {
1216
1225
  `expected "${spyName}" to not ${action} with: #{exp}`,
1217
1226
  value
1218
1227
  ]);
1219
- throw new AssertionError(formatReturns(spy, action === "return" ? spy.mock.results : spy.mock.settledResults, msg, value));
1228
+ const results = action === "return" ? spy.mock.results : spy.mock.settledResults;
1229
+ throw new AssertionError(formatReturns(spy, results, msg, value));
1220
1230
  }
1221
1231
  });
1222
1232
  });
@@ -1282,7 +1292,7 @@ var JestChaiExpect = (chai, utils) => {
1282
1292
  if (typeof result !== "function") return result instanceof chai.Assertion ? proxy : result;
1283
1293
  return (...args) => {
1284
1294
  utils.flag(this, "_name", key);
1285
- return recordAsyncExpect(test, Promise.resolve(obj).then((value) => {
1295
+ const promise = Promise.resolve(obj).then((value) => {
1286
1296
  utils.flag(this, "object", value);
1287
1297
  return result.call(this, ...args);
1288
1298
  }, (err) => {
@@ -1292,7 +1302,8 @@ var JestChaiExpect = (chai, utils) => {
1292
1302
  }).catch((err) => {
1293
1303
  if (isError(err) && error.stack) err.stack = error.stack.replace(error.message, err.message);
1294
1304
  throw err;
1295
- }), createAssertionMessage(utils, this, !!args.length), error, utils.flag(this, "soft"));
1305
+ });
1306
+ return recordAsyncExpect(test, promise, createAssertionMessage(utils, this, !!args.length), error, utils.flag(this, "soft"));
1296
1307
  };
1297
1308
  } });
1298
1309
  return proxy;
@@ -1311,7 +1322,7 @@ var JestChaiExpect = (chai, utils) => {
1311
1322
  if (typeof result !== "function") return result instanceof chai.Assertion ? proxy : result;
1312
1323
  return (...args) => {
1313
1324
  utils.flag(this, "_name", key);
1314
- return recordAsyncExpect(test, Promise.resolve(wrapper).then((value) => {
1325
+ const promise = Promise.resolve(wrapper).then((value) => {
1315
1326
  throw new AssertionError(`promise resolved "${utils.inspect(value)}" instead of rejecting`, {
1316
1327
  showDiff: true,
1317
1328
  expected: /* @__PURE__ */ new Error("rejected promise"),
@@ -1323,32 +1334,33 @@ var JestChaiExpect = (chai, utils) => {
1323
1334
  }).catch((err) => {
1324
1335
  if (isError(err) && error.stack) err.stack = error.stack.replace(error.message, err.message);
1325
1336
  throw err;
1326
- }), createAssertionMessage(utils, this, !!args.length), error, utils.flag(this, "soft"));
1337
+ });
1338
+ return recordAsyncExpect(test, promise, createAssertionMessage(utils, this, !!args.length), error, utils.flag(this, "soft"));
1327
1339
  };
1328
1340
  } });
1329
1341
  return proxy;
1330
1342
  });
1331
1343
  };
1332
1344
  function formatCalls(spy, msg, showActualCall) {
1333
- if (spy.mock.calls.length) msg += C.gray(`\n\nReceived:\n\n${spy.mock.calls.map((callArg, i) => {
1334
- let methodCall = C.bold(` ${ordinal(i + 1)} ${spy.getMockName()} call:\n\n`);
1345
+ if (spy.mock.calls.length) msg += y.gray(`\n\nReceived:\n\n${spy.mock.calls.map((callArg, i) => {
1346
+ let methodCall = y.bold(` ${ordinal(i + 1)} ${spy.getMockName()} call:\n\n`);
1335
1347
  if (showActualCall) methodCall += diff(showActualCall, callArg, { omitAnnotationLines: true });
1336
1348
  else methodCall += stringify(callArg).split("\n").map((line) => ` ${line}`).join("\n");
1337
1349
  methodCall += "\n";
1338
1350
  return methodCall;
1339
1351
  }).join("\n")}`);
1340
- msg += C.gray(`\n\nNumber of calls: ${C.bold(spy.mock.calls.length)}\n`);
1352
+ msg += y.gray(`\n\nNumber of calls: ${y.bold(spy.mock.calls.length)}\n`);
1341
1353
  return msg;
1342
1354
  }
1343
1355
  function formatReturns(spy, results, msg, showActualReturn) {
1344
- if (results.length) msg += C.gray(`\n\nReceived:\n\n${results.map((callReturn, i) => {
1345
- let methodCall = C.bold(` ${ordinal(i + 1)} ${spy.getMockName()} call return:\n\n`);
1356
+ if (results.length) msg += y.gray(`\n\nReceived:\n\n${results.map((callReturn, i) => {
1357
+ let methodCall = y.bold(` ${ordinal(i + 1)} ${spy.getMockName()} call return:\n\n`);
1346
1358
  if (showActualReturn) methodCall += diff(showActualReturn, callReturn.value, { omitAnnotationLines: true });
1347
1359
  else methodCall += stringify(callReturn).split("\n").map((line) => ` ${line}`).join("\n");
1348
1360
  methodCall += "\n";
1349
1361
  return methodCall;
1350
1362
  }).join("\n")}`);
1351
- msg += C.gray(`\n\nNumber of calls: ${C.bold(spy.mock.calls.length)}\n`);
1363
+ msg += y.gray(`\n\nNumber of calls: ${y.bold(spy.mock.calls.length)}\n`);
1352
1364
  return msg;
1353
1365
  }
1354
1366
  function getMatcherState(assertion, expect) {
@@ -1366,47 +1378,60 @@ function getMatcherState(assertion, expect) {
1366
1378
  let task = utils_exports.flag(assertion, "vitest-test");
1367
1379
  const currentTestName = task?.fullTestName ?? "";
1368
1380
  if (task?.type !== "test") task = void 0;
1381
+ const matcherState = {
1382
+ ...getState(expect),
1383
+ currentTestName,
1384
+ customTesters: getCustomEqualityTesters(),
1385
+ isNot,
1386
+ utils: jestUtils,
1387
+ promise,
1388
+ equals,
1389
+ suppressedErrors: [],
1390
+ soft: utils_exports.flag(assertion, "soft"),
1391
+ poll: utils_exports.flag(assertion, "poll"),
1392
+ assertion
1393
+ };
1394
+ Object.assign(matcherState, { task });
1369
1395
  return {
1370
- state: {
1371
- ...getState(expect),
1372
- task,
1373
- currentTestName,
1374
- customTesters: getCustomEqualityTesters(),
1375
- isNot,
1376
- utils: jestUtils,
1377
- promise,
1378
- equals,
1379
- suppressedErrors: [],
1380
- soft: utils_exports.flag(assertion, "soft"),
1381
- poll: utils_exports.flag(assertion, "poll")
1382
- },
1396
+ state: matcherState,
1383
1397
  isNot,
1384
1398
  obj,
1385
1399
  customMessage
1386
1400
  };
1387
1401
  }
1388
1402
  var JestExtendError = class extends Error {
1389
- constructor(message, actual, expected) {
1403
+ constructor(message, actual, expected, __vitest_error_context__) {
1390
1404
  super(message);
1391
1405
  this.actual = actual;
1392
1406
  this.expected = expected;
1407
+ this.__vitest_error_context__ = __vitest_error_context__;
1393
1408
  }
1394
1409
  };
1395
1410
  function JestExtendPlugin(c, expect, matchers) {
1396
1411
  return (_, utils) => {
1397
1412
  Object.entries(matchers).forEach(([expectAssertionName, expectAssertion]) => {
1398
- function expectWrapper(...args) {
1413
+ function __VITEST_EXTEND_ASSERTION__(...args) {
1399
1414
  const { state, isNot, obj, customMessage } = getMatcherState(this, expect);
1400
1415
  const result = expectAssertion.call(state, obj, ...args);
1401
- if (result && typeof result === "object" && typeof result.then === "function") return result.then(({ pass, message, actual, expected }) => {
1402
- if (pass && isNot || !pass && !isNot) throw new JestExtendError(customMessage != null ? customMessage : message(), actual, expected);
1416
+ if (result && typeof result === "object" && typeof result.then === "function") return result.then(({ pass, message, actual, expected, meta }) => {
1417
+ if (pass && isNot || !pass && !isNot) throw new JestExtendError((customMessage ? `${customMessage}: ` : "") + message(), actual, expected, {
1418
+ assertionName: expectAssertionName,
1419
+ meta
1420
+ });
1421
+ });
1422
+ const { pass, message, actual, expected, meta } = result;
1423
+ if (pass && isNot || !pass && !isNot) throw new JestExtendError((customMessage ? `${customMessage}: ` : "") + message(), actual, expected, {
1424
+ assertionName: expectAssertionName,
1425
+ meta
1403
1426
  });
1404
- const { pass, message, actual, expected } = result;
1405
- if (pass && isNot || !pass && !isNot) throw new JestExtendError(customMessage != null ? customMessage : message(), actual, expected);
1406
1427
  }
1407
- const softWrapper = wrapAssertion(utils, expectAssertionName, expectWrapper);
1428
+ const softWrapper = wrapAssertion(utils, expectAssertionName, __VITEST_EXTEND_ASSERTION__);
1408
1429
  utils.addMethod(globalThis[JEST_MATCHERS_OBJECT].matchers, expectAssertionName, softWrapper);
1409
1430
  utils.addMethod(c.Assertion.prototype, expectAssertionName, softWrapper);
1431
+ if (expectAssertion.__vitest_poll_takeover__) {
1432
+ const addedMethod = c.Assertion.prototype[expectAssertionName];
1433
+ Object.defineProperty(addedMethod, "__vitest_poll_takeover__", { value: true });
1434
+ }
1410
1435
  class CustomMatcher extends AsymmetricMatcher {
1411
1436
  constructor(inverse = false, ...sample) {
1412
1437
  super(sample, inverse);
@@ -1453,4 +1478,4 @@ var JestExtend = (chai, utils) => {
1453
1478
  });
1454
1479
  };
1455
1480
  //#endregion
1456
- export { ASYMMETRIC_MATCHERS_OBJECT, ChaiStyleAssertions, GLOBAL_EXPECT, JestAsymmetricMatchers, JestChaiExpect, JestExtend, addCustomEqualityTesters, createAssertionMessage, customMatchers, equals, getState, iterableEquality, recordAsyncExpect, setState, subsetEquality, wrapAssertion };
1481
+ export { ASYMMETRIC_MATCHERS_OBJECT, Any, Anything, ArrayContaining, AsymmetricMatcher, ChaiStyleAssertions, GLOBAL_EXPECT, JEST_MATCHERS_OBJECT, JestAsymmetricMatchers, JestChaiExpect, JestExtend, MATCHERS_OBJECT, ObjectContaining, SchemaMatching, StringContaining, StringMatching, addCustomEqualityTesters, arrayBufferEquality, createAssertionMessage, customMatchers, equals, generateToBeMessage, getObjectKeys, getObjectSubset, getState, isA, isAsymmetric, isError, isImmutableUnorderedKeyed, isImmutableUnorderedSet, isStandardSchema, iterableEquality, pluralize, recordAsyncExpect, setState, sparseArrayEquality, subsetEquality, typeEquality, wrapAssertion };
@@ -1,5 +1,5 @@
1
- import { C } from "../../vendor/tinyrainbow.js";
2
- //#region ../../node_modules/vitest/dist/@vitest/pretty-format/index.js
1
+ import y from "../../../../../tinyrainbow@3.1.1/node_modules/tinyrainbow/dist/index.js";
2
+ //#region ../../node_modules/.pnpm/@vitest+pretty-format@4.1.10/node_modules/@vitest/pretty-format/dist/index.js
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function(e) {
5
5
  e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
@@ -153,7 +153,7 @@ var plugin$5 = {
153
153
  test: test$5
154
154
  };
155
155
  var SPACE$1 = " ";
156
- var OBJECT_NAMES = new Set(["DOMStringMap", "NamedNodeMap"]);
156
+ var OBJECT_NAMES = /* @__PURE__ */ new Set(["DOMStringMap", "NamedNodeMap"]);
157
157
  var ARRAY_REGEXP = /^(?:HTML\w*Collection|NodeList)$/;
158
158
  function testName(name) {
159
159
  return OBJECT_NAMES.has(name) || ARRAY_REGEXP.test(name);
@@ -444,7 +444,7 @@ function requireReactIs$1() {
444
444
  return reactIs$1.exports;
445
445
  }
446
446
  var reactIsExports$1 = requireReactIs$1();
447
- var ReactIs19 = /* @__PURE__ */ _mergeNamespaces({
447
+ var ReactIs19 = /*#__PURE__*/ _mergeNamespaces({
448
448
  __proto__: null,
449
449
  default: /* @__PURE__ */ getDefaultExportFromCjs(reactIsExports$1)
450
450
  }, [reactIsExports$1]);
@@ -556,7 +556,7 @@ function requireReactIs() {
556
556
  return reactIs.exports;
557
557
  }
558
558
  var reactIsExports = requireReactIs();
559
- var ReactIs18 = /* @__PURE__ */ _mergeNamespaces({
559
+ var ReactIs18 = /*#__PURE__*/ _mergeNamespaces({
560
560
  __proto__: null,
561
561
  default: /* @__PURE__ */ getDefaultExportFromCjs(reactIsExports)
562
562
  }, [reactIsExports]);
@@ -770,8 +770,9 @@ function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
770
770
  if (basicResult !== null) result = basicResult;
771
771
  else result = printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
772
772
  }
773
- config.outputLength += result.length;
774
- if (config.outputLength > config.maxOutputLength) config.maxDepth = 0;
773
+ config._outputLengthPerDepth[depth] ??= 0;
774
+ config._outputLengthPerDepth[depth] += result.length;
775
+ if (config._outputLengthPerDepth[depth] > config.maxOutputLength) config.maxDepth = 0;
775
776
  return result;
776
777
  }
777
778
  var DEFAULT_THEME = {
@@ -806,7 +807,7 @@ function validateOptions(options) {
806
807
  function getColorsHighlight() {
807
808
  return DEFAULT_THEME_KEYS.reduce((colors, key) => {
808
809
  const value = DEFAULT_THEME[key];
809
- const color = value && C[value];
810
+ const color = value && y[value];
810
811
  if (color && typeof color.close === "string" && typeof color.open === "string") colors[key] = color;
811
812
  else throw new Error(`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`);
812
813
  return colors;
@@ -848,7 +849,7 @@ function getConfig(options) {
848
849
  spacingInner: options?.min ? " " : "\n",
849
850
  spacingOuter: options?.min ? "" : "\n",
850
851
  maxOutputLength: options?.maxOutputLength ?? DEFAULT_OPTIONS.maxOutputLength,
851
- outputLength: 0
852
+ _outputLengthPerDepth: []
852
853
  };
853
854
  }
854
855
  function createIndent(indent) {
@@ -881,4 +882,4 @@ var plugins = {
881
882
  Error: ErrorPlugin
882
883
  };
883
884
  //#endregion
884
- export { createDOMElementFilter, format, plugins };
885
+ export { DEFAULT_OPTIONS, createDOMElementFilter, format, plugins };
@@ -1,8 +1,8 @@
1
- import { format, formatRegExp, objDisplay } from "../utils/display.js";
2
- import { assertTypes, createDefer, filterOutComments, isNegativeNaN, isObject, objectAttr, ordinal, toArray, unique } from "../utils/helpers.js";
3
- import { getSafeTimers } from "../utils/timers.js";
4
- import { parseSingleStack } from "../utils/source-map.js";
5
- //#region ../../node_modules/vitest/dist/@vitest/runner/chunk-artifact.js
1
+ import { format, formatRegExp, objDisplay } from "../../../../../@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/display.js";
2
+ import { assertTypes, createDefer, filterOutComments, isNegativeNaN, isObject, objectAttr, ordinal, toArray, unique } from "../../../../../@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/helpers.js";
3
+ import { getSafeTimers } from "../../../../../@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/timers.js";
4
+ import { parseSingleStack } from "../../../../../@vitest_utils@4.1.10/node_modules/@vitest/utils/dist/source-map.js";
5
+ //#region ../../node_modules/.pnpm/@vitest+runner@4.1.10/node_modules/@vitest/runner/dist/chunk-artifact.js
6
6
  var PendingError = class extends Error {
7
7
  code = "VITEST_PENDING";
8
8
  taskId;
@@ -85,7 +85,8 @@ var TestFixtures = class TestFixtures {
85
85
  extend(runner, userFixtures) {
86
86
  const { suite } = getCurrentSuite();
87
87
  const isTopLevel = !suite || suite.file === suite;
88
- return new TestFixtures(this.parseUserFixtures(runner, userFixtures, isTopLevel));
88
+ const registrations = this.parseUserFixtures(runner, userFixtures, isTopLevel);
89
+ return new TestFixtures(registrations);
89
90
  }
90
91
  get(suite) {
91
92
  let currentSuite = suite;
@@ -197,7 +198,7 @@ function withFixtures(fn, options) {
197
198
  if (!registrations.size) return fn(context);
198
199
  const usedFixtures = [];
199
200
  const usedProps = getUsedProps(fn);
200
- for (const fixture of registrations.values()) if (fixture.auto || usedProps.has(fixture.name)) usedFixtures.push(fixture);
201
+ for (const fixture of registrations.values()) if (isAutoFixture(fixture, options) || usedProps.has(fixture.name)) usedFixtures.push(fixture);
201
202
  if (!usedFixtures.length) return fn(context);
202
203
  if (!cleanupFnArrayMap.has(context)) cleanupFnArrayMap.set(context, []);
203
204
  const cleanupFnArray = cleanupFnArrayMap.get(context);
@@ -233,6 +234,11 @@ function withFixtures(fn, options) {
233
234
  return fn(context);
234
235
  };
235
236
  }
237
+ function isAutoFixture(fixture, options) {
238
+ if (!fixture.auto) return false;
239
+ if (options?.suiteHook && fixture.scope === "test") return false;
240
+ return true;
241
+ }
236
242
  function isFixtureFunction(value) {
237
243
  return typeof value === "function";
238
244
  }
@@ -524,14 +530,6 @@ function afterEach(fn, timeout) {
524
530
  };
525
531
  return getCurrentSuite().on("afterEach", withTimeout(wrapper, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
526
532
  }
527
- createTestHook("onTestFailed", (test, handler, timeout) => {
528
- test.onFailed ||= [];
529
- test.onFailed.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
530
- });
531
- createTestHook("onTestFinished", (test, handler, timeout) => {
532
- test.onFinished ||= [];
533
- test.onFinished.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
534
- });
535
533
  /**
536
534
  * Registers a callback function that wraps around all tests within the current suite.
537
535
  * The callback receives a `runSuite` function that must be called to run the suite's tests.
@@ -631,14 +629,6 @@ function withSuiteFixtures(suiteHook, fn, context, stackTraceError, contextIndex
631
629
  })();
632
630
  };
633
631
  }
634
- function createTestHook(name, handler) {
635
- return (fn, timeout) => {
636
- assertTypes(fn, `"${name}" callback`, ["function"]);
637
- const current = getCurrentTest();
638
- if (!current) throw new Error(`Hook ${name}() can only be called inside a test`);
639
- return handler(current, fn, timeout);
640
- };
641
- }
642
632
  function findTestFileStackTrace(testFilePath, error) {
643
633
  const lines = error.split("\n").slice(1);
644
634
  for (const line of lines) {
@@ -890,7 +880,7 @@ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions
890
880
  };
891
881
  const handler = options.handler;
892
882
  if (task.mode === "run" && !handler) task.mode = "todo";
893
- if (options.concurrent || !options.sequential && runner.config.sequence.concurrent) task.concurrent = true;
883
+ if (options.concurrent ?? (!options.sequential && runner.config.sequence.concurrent)) task.concurrent = true;
894
884
  task.shuffle = suiteOptions?.shuffle;
895
885
  const context = createTestContext(task, runner);
896
886
  Object.defineProperty(task, "context", {
@@ -1378,7 +1368,7 @@ function makeTimeoutError(isHook, timeout, stackTraceError) {
1378
1368
  }
1379
1369
  globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
1380
1370
  globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
1381
- var unixNow = Date.now;
1371
+ Date.now;
1382
1372
  var { clearTimeout, setTimeout } = getSafeTimers();
1383
1373
  var packs = /* @__PURE__ */ new Map();
1384
1374
  var eventsPacks = [];
@@ -1405,21 +1395,6 @@ async function finishSendTasksUpdate(runner) {
1405
1395
  sendTasksUpdate(runner);
1406
1396
  await Promise.all(pendingTasksUpdates);
1407
1397
  }
1408
- function throttle(fn, ms) {
1409
- let last = 0;
1410
- let pendingCall;
1411
- return function call(...args) {
1412
- const now = unixNow();
1413
- if (now - last > ms) {
1414
- last = now;
1415
- clearTimeout(pendingCall);
1416
- pendingCall = void 0;
1417
- return fn.apply(this, args);
1418
- }
1419
- pendingCall ??= setTimeout(() => call.bind(this)(...args), ms);
1420
- };
1421
- }
1422
- throttle(sendTasksUpdate, 100);
1423
1398
  /**
1424
1399
  * @experimental
1425
1400
  * @advanced
@@ -1537,7 +1512,9 @@ function recordAsyncOperation(test, promise) {
1537
1512
  function manageArtifactAttachment(attachment) {
1538
1513
  if (attachment.body == null && !attachment.path) throw new TypeError(`Test attachment requires "body" or "path" to be set. Both are missing.`);
1539
1514
  if (attachment.body && attachment.path) throw new TypeError(`Test attachment requires only one of "body" or "path" to be set. Both are specified.`);
1515
+ if (attachment.path && attachment.bodyEncoding) throw new TypeError(`Test attachment with "path" should not have "bodyEncoding" specified.`);
1540
1516
  if (attachment.body instanceof Uint8Array) attachment.body = encodeUint8Array(attachment.body);
1517
+ if (attachment.body != null) attachment.bodyEncoding ??= "base64";
1541
1518
  }
1542
1519
  //#endregion
1543
- export { describe, getCurrentTest, getNames, it };
1520
+ export { createTaskName as B, findTestFileStackTrace as C, getNames as G, validateTags as T, afterAll as a, afterEach as b, aroundAll as c, aroundEach as d, beforeAll as e, beforeEach as f, createTaskCollector as g, describe as h, getCurrentSuite as i, getCurrentTest as j, getHooks as l, it as m, setHooks as q, recordArtifact as r, setFn as s, suite as u, test as v, createChainable as y };
@@ -0,0 +1,2 @@
1
+ import { h as describe, j as getCurrentTest, m as it } from "./chunk-artifact.js";
2
+ export { describe, getCurrentTest, it };
@@ -0,0 +1,2 @@
1
+ import { G as getNames } from "./chunk-artifact.js";
2
+ export { getNames };