@shware/security 2.0.0 → 2.0.1
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.
- package/dist/auth/index.cjs +18 -7
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +1 -0
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.mjs +18 -7
- package/dist/auth/index.mjs.map +1 -1
- package/dist/session/__tests__/redis.test.cjs +3119 -17
- package/dist/session/__tests__/redis.test.cjs.map +1 -1
- package/dist/session/__tests__/redis.test.mjs +3148 -17
- package/dist/session/__tests__/redis.test.mjs.map +1 -1
- package/package.json +8 -10
|
@@ -1,71 +1,3202 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a3, b4) => (typeof require !== "undefined" ? require : a3)[b4]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
13
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
14
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
32
|
+
|
|
33
|
+
// ../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/index.js
|
|
34
|
+
var require_dist = __commonJS({
|
|
35
|
+
"../../node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/index.js"(exports) {
|
|
36
|
+
"use strict";
|
|
37
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o2, m2, k2, k22) {
|
|
38
|
+
if (k22 === void 0) k22 = k2;
|
|
39
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k2);
|
|
40
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
41
|
+
desc = { enumerable: true, get: function() {
|
|
42
|
+
return m2[k2];
|
|
43
|
+
} };
|
|
44
|
+
}
|
|
45
|
+
Object.defineProperty(o2, k22, desc);
|
|
46
|
+
}) : (function(o2, m2, k2, k22) {
|
|
47
|
+
if (k22 === void 0) k22 = k2;
|
|
48
|
+
o2[k22] = m2[k2];
|
|
49
|
+
}));
|
|
50
|
+
var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
|
|
51
|
+
for (var p2 in m2) if (p2 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p2)) __createBinding(exports2, m2, p2);
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.expectTypeOf = void 0;
|
|
55
|
+
__exportStar(__require("./branding.mjs"), exports);
|
|
56
|
+
__exportStar(__require("./messages.mjs"), exports);
|
|
57
|
+
__exportStar(__require("./overloads.mjs"), exports);
|
|
58
|
+
__exportStar(__require("./utils.mjs"), exports);
|
|
59
|
+
var fn = () => true;
|
|
60
|
+
var expectTypeOf2 = (_actual) => {
|
|
61
|
+
const nonFunctionProperties = [
|
|
62
|
+
"parameters",
|
|
63
|
+
"returns",
|
|
64
|
+
"resolves",
|
|
65
|
+
"not",
|
|
66
|
+
"items",
|
|
67
|
+
"constructorParameters",
|
|
68
|
+
"thisParameter",
|
|
69
|
+
"instance",
|
|
70
|
+
"guards",
|
|
71
|
+
"asserts",
|
|
72
|
+
"branded"
|
|
73
|
+
];
|
|
74
|
+
const obj = {
|
|
75
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
76
|
+
toBeAny: fn,
|
|
77
|
+
toBeUnknown: fn,
|
|
78
|
+
toBeNever: fn,
|
|
79
|
+
toBeFunction: fn,
|
|
80
|
+
toBeObject: fn,
|
|
81
|
+
toBeArray: fn,
|
|
82
|
+
toBeString: fn,
|
|
83
|
+
toBeNumber: fn,
|
|
84
|
+
toBeBoolean: fn,
|
|
85
|
+
toBeVoid: fn,
|
|
86
|
+
toBeSymbol: fn,
|
|
87
|
+
toBeNull: fn,
|
|
88
|
+
toBeUndefined: fn,
|
|
89
|
+
toBeNullable: fn,
|
|
90
|
+
toBeBigInt: fn,
|
|
91
|
+
toMatchTypeOf: fn,
|
|
92
|
+
toEqualTypeOf: fn,
|
|
93
|
+
toBeConstructibleWith: fn,
|
|
94
|
+
toMatchObjectType: fn,
|
|
95
|
+
toExtend: fn,
|
|
96
|
+
map: exports.expectTypeOf,
|
|
97
|
+
toBeCallableWith: exports.expectTypeOf,
|
|
98
|
+
extract: exports.expectTypeOf,
|
|
99
|
+
exclude: exports.expectTypeOf,
|
|
100
|
+
pick: exports.expectTypeOf,
|
|
101
|
+
omit: exports.expectTypeOf,
|
|
102
|
+
toHaveProperty: exports.expectTypeOf,
|
|
103
|
+
parameter: exports.expectTypeOf
|
|
104
|
+
};
|
|
105
|
+
const getterProperties = nonFunctionProperties;
|
|
106
|
+
getterProperties.forEach((prop) => Object.defineProperty(obj, prop, { get: () => (0, exports.expectTypeOf)({}) }));
|
|
107
|
+
return obj;
|
|
108
|
+
};
|
|
109
|
+
exports.expectTypeOf = expectTypeOf2;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
1
113
|
// src/session/__tests__/redis.test.ts
|
|
2
114
|
import Redis from "ioredis";
|
|
115
|
+
|
|
116
|
+
// ../../node_modules/.pnpm/vitest@4.0.16_@types+node@24.10.4_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_yaml@2.8.2/node_modules/vitest/dist/index.js
|
|
117
|
+
var import_expect_type = __toESM(require_dist(), 1);
|
|
118
|
+
import { b as b2, c as c2, g as g3, i as i2, s as s2, v, d as d3 } from "./chunks/vi.2VT5v0um.js.mjs";
|
|
119
|
+
import { b as b3 } from "./chunks/benchmark.B3N2zMcH.js.mjs";
|
|
120
|
+
import { V } from "./chunks/evaluatedModules.Dg1zASAC.js.mjs";
|
|
121
|
+
import { a as a2 } from "./chunks/index.Z5E_ObnR.js.mjs";
|
|
122
|
+
|
|
123
|
+
// ../../node_modules/.pnpm/tinyrainbow@3.0.3/node_modules/tinyrainbow/dist/index.js
|
|
124
|
+
var d = {
|
|
125
|
+
reset: [0, 0],
|
|
126
|
+
bold: [1, 22, "\x1B[22m\x1B[1m"],
|
|
127
|
+
dim: [2, 22, "\x1B[22m\x1B[2m"],
|
|
128
|
+
italic: [3, 23],
|
|
129
|
+
underline: [4, 24],
|
|
130
|
+
inverse: [7, 27],
|
|
131
|
+
hidden: [8, 28],
|
|
132
|
+
strikethrough: [9, 29],
|
|
133
|
+
black: [30, 39],
|
|
134
|
+
red: [31, 39],
|
|
135
|
+
green: [32, 39],
|
|
136
|
+
yellow: [33, 39],
|
|
137
|
+
blue: [34, 39],
|
|
138
|
+
magenta: [35, 39],
|
|
139
|
+
cyan: [36, 39],
|
|
140
|
+
white: [37, 39],
|
|
141
|
+
gray: [90, 39],
|
|
142
|
+
bgBlack: [40, 49],
|
|
143
|
+
bgRed: [41, 49],
|
|
144
|
+
bgGreen: [42, 49],
|
|
145
|
+
bgYellow: [43, 49],
|
|
146
|
+
bgBlue: [44, 49],
|
|
147
|
+
bgMagenta: [45, 49],
|
|
148
|
+
bgCyan: [46, 49],
|
|
149
|
+
bgWhite: [47, 49],
|
|
150
|
+
blackBright: [90, 39],
|
|
151
|
+
redBright: [91, 39],
|
|
152
|
+
greenBright: [92, 39],
|
|
153
|
+
yellowBright: [93, 39],
|
|
154
|
+
blueBright: [94, 39],
|
|
155
|
+
magentaBright: [95, 39],
|
|
156
|
+
cyanBright: [96, 39],
|
|
157
|
+
whiteBright: [97, 39],
|
|
158
|
+
bgBlackBright: [100, 49],
|
|
159
|
+
bgRedBright: [101, 49],
|
|
160
|
+
bgGreenBright: [102, 49],
|
|
161
|
+
bgYellowBright: [103, 49],
|
|
162
|
+
bgBlueBright: [104, 49],
|
|
163
|
+
bgMagentaBright: [105, 49],
|
|
164
|
+
bgCyanBright: [106, 49],
|
|
165
|
+
bgWhiteBright: [107, 49]
|
|
166
|
+
};
|
|
167
|
+
function g(e2) {
|
|
168
|
+
return String(e2);
|
|
169
|
+
}
|
|
170
|
+
g.open = "";
|
|
171
|
+
g.close = "";
|
|
172
|
+
function h() {
|
|
173
|
+
let e2 = typeof process != "undefined" ? process : void 0, n2 = (e2 == null ? void 0 : e2.env) || {}, a3 = n2.FORCE_TTY !== "false", i3 = (e2 == null ? void 0 : e2.argv) || [];
|
|
174
|
+
return !("NO_COLOR" in n2 || i3.includes("--no-color")) && ("FORCE_COLOR" in n2 || i3.includes("--color") || (e2 == null ? void 0 : e2.platform) === "win32" || a3 && n2.TERM !== "dumb" || "CI" in n2) || typeof window != "undefined" && !!window.chrome;
|
|
175
|
+
}
|
|
176
|
+
function f() {
|
|
177
|
+
let e2 = h(), n2 = (r2, t2, u, o2) => {
|
|
178
|
+
let l2 = "", s3 = 0;
|
|
179
|
+
do
|
|
180
|
+
l2 += r2.substring(s3, o2) + u, s3 = o2 + t2.length, o2 = r2.indexOf(t2, s3);
|
|
181
|
+
while (~o2);
|
|
182
|
+
return l2 + r2.substring(s3);
|
|
183
|
+
}, a3 = (r2, t2, u = r2) => {
|
|
184
|
+
let o2 = (l2) => {
|
|
185
|
+
let s3 = String(l2), b4 = s3.indexOf(t2, r2.length);
|
|
186
|
+
return ~b4 ? r2 + n2(s3, t2, u, b4) + t2 : r2 + s3 + t2;
|
|
187
|
+
};
|
|
188
|
+
return o2.open = r2, o2.close = t2, o2;
|
|
189
|
+
}, i3 = {
|
|
190
|
+
isColorSupported: e2
|
|
191
|
+
}, c3 = (r2) => `\x1B[${r2}m`;
|
|
192
|
+
for (let r2 in d) {
|
|
193
|
+
let t2 = d[r2];
|
|
194
|
+
i3[r2] = e2 ? a3(
|
|
195
|
+
c3(t2[0]),
|
|
196
|
+
c3(t2[1]),
|
|
197
|
+
t2[2]
|
|
198
|
+
) : g;
|
|
199
|
+
}
|
|
200
|
+
return i3;
|
|
201
|
+
}
|
|
202
|
+
var C = f();
|
|
203
|
+
|
|
204
|
+
// ../../node_modules/.pnpm/@vitest+pretty-format@4.0.16/node_modules/@vitest/pretty-format/dist/index.js
|
|
205
|
+
function _mergeNamespaces(n2, m2) {
|
|
206
|
+
m2.forEach(function(e2) {
|
|
207
|
+
e2 && typeof e2 !== "string" && !Array.isArray(e2) && Object.keys(e2).forEach(function(k2) {
|
|
208
|
+
if (k2 !== "default" && !(k2 in n2)) {
|
|
209
|
+
var d4 = Object.getOwnPropertyDescriptor(e2, k2);
|
|
210
|
+
Object.defineProperty(n2, k2, d4.get ? d4 : {
|
|
211
|
+
enumerable: true,
|
|
212
|
+
get: function() {
|
|
213
|
+
return e2[k2];
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
return Object.freeze(n2);
|
|
220
|
+
}
|
|
221
|
+
function getKeysOfEnumerableProperties(object, compareKeys) {
|
|
222
|
+
const rawKeys = Object.keys(object);
|
|
223
|
+
const keys = compareKeys === null ? rawKeys : rawKeys.sort(compareKeys);
|
|
224
|
+
if (Object.getOwnPropertySymbols) {
|
|
225
|
+
for (const symbol of Object.getOwnPropertySymbols(object)) {
|
|
226
|
+
if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
|
|
227
|
+
keys.push(symbol);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return keys;
|
|
232
|
+
}
|
|
233
|
+
function printIteratorEntries(iterator, config, indentation, depth, refs, printer2, separator = ": ") {
|
|
234
|
+
let result = "";
|
|
235
|
+
let width = 0;
|
|
236
|
+
let current = iterator.next();
|
|
237
|
+
if (!current.done) {
|
|
238
|
+
result += config.spacingOuter;
|
|
239
|
+
const indentationNext = indentation + config.indent;
|
|
240
|
+
while (!current.done) {
|
|
241
|
+
result += indentationNext;
|
|
242
|
+
if (width++ === config.maxWidth) {
|
|
243
|
+
result += "\u2026";
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
const name = printer2(current.value[0], config, indentationNext, depth, refs);
|
|
247
|
+
const value = printer2(current.value[1], config, indentationNext, depth, refs);
|
|
248
|
+
result += name + separator + value;
|
|
249
|
+
current = iterator.next();
|
|
250
|
+
if (!current.done) {
|
|
251
|
+
result += `,${config.spacingInner}`;
|
|
252
|
+
} else if (!config.min) {
|
|
253
|
+
result += ",";
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
result += config.spacingOuter + indentation;
|
|
257
|
+
}
|
|
258
|
+
return result;
|
|
259
|
+
}
|
|
260
|
+
function printIteratorValues(iterator, config, indentation, depth, refs, printer2) {
|
|
261
|
+
let result = "";
|
|
262
|
+
let width = 0;
|
|
263
|
+
let current = iterator.next();
|
|
264
|
+
if (!current.done) {
|
|
265
|
+
result += config.spacingOuter;
|
|
266
|
+
const indentationNext = indentation + config.indent;
|
|
267
|
+
while (!current.done) {
|
|
268
|
+
result += indentationNext;
|
|
269
|
+
if (width++ === config.maxWidth) {
|
|
270
|
+
result += "\u2026";
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
result += printer2(current.value, config, indentationNext, depth, refs);
|
|
274
|
+
current = iterator.next();
|
|
275
|
+
if (!current.done) {
|
|
276
|
+
result += `,${config.spacingInner}`;
|
|
277
|
+
} else if (!config.min) {
|
|
278
|
+
result += ",";
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
result += config.spacingOuter + indentation;
|
|
282
|
+
}
|
|
283
|
+
return result;
|
|
284
|
+
}
|
|
285
|
+
function printListItems(list, config, indentation, depth, refs, printer2) {
|
|
286
|
+
let result = "";
|
|
287
|
+
list = list instanceof ArrayBuffer ? new DataView(list) : list;
|
|
288
|
+
const isDataView = (l2) => l2 instanceof DataView;
|
|
289
|
+
const length = isDataView(list) ? list.byteLength : list.length;
|
|
290
|
+
if (length > 0) {
|
|
291
|
+
result += config.spacingOuter;
|
|
292
|
+
const indentationNext = indentation + config.indent;
|
|
293
|
+
for (let i3 = 0; i3 < length; i3++) {
|
|
294
|
+
result += indentationNext;
|
|
295
|
+
if (i3 === config.maxWidth) {
|
|
296
|
+
result += "\u2026";
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
if (isDataView(list) || i3 in list) {
|
|
300
|
+
result += printer2(isDataView(list) ? list.getInt8(i3) : list[i3], config, indentationNext, depth, refs);
|
|
301
|
+
}
|
|
302
|
+
if (i3 < length - 1) {
|
|
303
|
+
result += `,${config.spacingInner}`;
|
|
304
|
+
} else if (!config.min) {
|
|
305
|
+
result += ",";
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
result += config.spacingOuter + indentation;
|
|
309
|
+
}
|
|
310
|
+
return result;
|
|
311
|
+
}
|
|
312
|
+
function printObjectProperties(val, config, indentation, depth, refs, printer2) {
|
|
313
|
+
let result = "";
|
|
314
|
+
const keys = getKeysOfEnumerableProperties(val, config.compareKeys);
|
|
315
|
+
if (keys.length > 0) {
|
|
316
|
+
result += config.spacingOuter;
|
|
317
|
+
const indentationNext = indentation + config.indent;
|
|
318
|
+
for (let i3 = 0; i3 < keys.length; i3++) {
|
|
319
|
+
const key = keys[i3];
|
|
320
|
+
const name = printer2(key, config, indentationNext, depth, refs);
|
|
321
|
+
const value = printer2(val[key], config, indentationNext, depth, refs);
|
|
322
|
+
result += `${indentationNext + name}: ${value}`;
|
|
323
|
+
if (i3 < keys.length - 1) {
|
|
324
|
+
result += `,${config.spacingInner}`;
|
|
325
|
+
} else if (!config.min) {
|
|
326
|
+
result += ",";
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
result += config.spacingOuter + indentation;
|
|
330
|
+
}
|
|
331
|
+
return result;
|
|
332
|
+
}
|
|
333
|
+
var asymmetricMatcher = typeof Symbol === "function" && Symbol.for ? /* @__PURE__ */ Symbol.for("jest.asymmetricMatcher") : 1267621;
|
|
334
|
+
var SPACE$2 = " ";
|
|
335
|
+
var serialize$5 = (val, config, indentation, depth, refs, printer2) => {
|
|
336
|
+
const stringedValue = val.toString();
|
|
337
|
+
if (stringedValue === "ArrayContaining" || stringedValue === "ArrayNotContaining") {
|
|
338
|
+
if (++depth > config.maxDepth) {
|
|
339
|
+
return `[${stringedValue}]`;
|
|
340
|
+
}
|
|
341
|
+
return `${stringedValue + SPACE$2}[${printListItems(val.sample, config, indentation, depth, refs, printer2)}]`;
|
|
342
|
+
}
|
|
343
|
+
if (stringedValue === "ObjectContaining" || stringedValue === "ObjectNotContaining") {
|
|
344
|
+
if (++depth > config.maxDepth) {
|
|
345
|
+
return `[${stringedValue}]`;
|
|
346
|
+
}
|
|
347
|
+
return `${stringedValue + SPACE$2}{${printObjectProperties(val.sample, config, indentation, depth, refs, printer2)}}`;
|
|
348
|
+
}
|
|
349
|
+
if (stringedValue === "StringMatching" || stringedValue === "StringNotMatching") {
|
|
350
|
+
return stringedValue + SPACE$2 + printer2(val.sample, config, indentation, depth, refs);
|
|
351
|
+
}
|
|
352
|
+
if (stringedValue === "StringContaining" || stringedValue === "StringNotContaining") {
|
|
353
|
+
return stringedValue + SPACE$2 + printer2(val.sample, config, indentation, depth, refs);
|
|
354
|
+
}
|
|
355
|
+
if (typeof val.toAsymmetricMatcher !== "function") {
|
|
356
|
+
throw new TypeError(`Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()`);
|
|
357
|
+
}
|
|
358
|
+
return val.toAsymmetricMatcher();
|
|
359
|
+
};
|
|
360
|
+
var test$5 = (val) => val && val.$$typeof === asymmetricMatcher;
|
|
361
|
+
var plugin$5 = {
|
|
362
|
+
serialize: serialize$5,
|
|
363
|
+
test: test$5
|
|
364
|
+
};
|
|
365
|
+
var SPACE$1 = " ";
|
|
366
|
+
var OBJECT_NAMES = /* @__PURE__ */ new Set(["DOMStringMap", "NamedNodeMap"]);
|
|
367
|
+
var ARRAY_REGEXP = /^(?:HTML\w*Collection|NodeList)$/;
|
|
368
|
+
function testName(name) {
|
|
369
|
+
return OBJECT_NAMES.has(name) || ARRAY_REGEXP.test(name);
|
|
370
|
+
}
|
|
371
|
+
var test$4 = (val) => val && val.constructor && !!val.constructor.name && testName(val.constructor.name);
|
|
372
|
+
function isNamedNodeMap(collection) {
|
|
373
|
+
return collection.constructor.name === "NamedNodeMap";
|
|
374
|
+
}
|
|
375
|
+
var serialize$4 = (collection, config, indentation, depth, refs, printer2) => {
|
|
376
|
+
const name = collection.constructor.name;
|
|
377
|
+
if (++depth > config.maxDepth) {
|
|
378
|
+
return `[${name}]`;
|
|
379
|
+
}
|
|
380
|
+
return (config.min ? "" : name + SPACE$1) + (OBJECT_NAMES.has(name) ? `{${printObjectProperties(isNamedNodeMap(collection) ? [...collection].reduce((props, attribute) => {
|
|
381
|
+
props[attribute.name] = attribute.value;
|
|
382
|
+
return props;
|
|
383
|
+
}, {}) : { ...collection }, config, indentation, depth, refs, printer2)}}` : `[${printListItems([...collection], config, indentation, depth, refs, printer2)}]`);
|
|
384
|
+
};
|
|
385
|
+
var plugin$4 = {
|
|
386
|
+
serialize: serialize$4,
|
|
387
|
+
test: test$4
|
|
388
|
+
};
|
|
389
|
+
function escapeHTML(str) {
|
|
390
|
+
return str.replaceAll("<", "<").replaceAll(">", ">");
|
|
391
|
+
}
|
|
392
|
+
function printProps(keys, props, config, indentation, depth, refs, printer2) {
|
|
393
|
+
const indentationNext = indentation + config.indent;
|
|
394
|
+
const colors = config.colors;
|
|
395
|
+
return keys.map((key) => {
|
|
396
|
+
const value = props[key];
|
|
397
|
+
let printed = printer2(value, config, indentationNext, depth, refs);
|
|
398
|
+
if (typeof value !== "string") {
|
|
399
|
+
if (printed.includes("\n")) {
|
|
400
|
+
printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
|
|
401
|
+
}
|
|
402
|
+
printed = `{${printed}}`;
|
|
403
|
+
}
|
|
404
|
+
return `${config.spacingInner + indentation + colors.prop.open + key + colors.prop.close}=${colors.value.open}${printed}${colors.value.close}`;
|
|
405
|
+
}).join("");
|
|
406
|
+
}
|
|
407
|
+
function printChildren(children, config, indentation, depth, refs, printer2) {
|
|
408
|
+
return children.map((child) => config.spacingOuter + indentation + (typeof child === "string" ? printText(child, config) : printer2(child, config, indentation, depth, refs))).join("");
|
|
409
|
+
}
|
|
410
|
+
function printShadowRoot(children, config, indentation, depth, refs, printer2) {
|
|
411
|
+
if (config.printShadowRoot === false) {
|
|
412
|
+
return "";
|
|
413
|
+
}
|
|
414
|
+
return [`${config.spacingOuter + indentation}#shadow-root`, printChildren(children, config, indentation + config.indent, depth, refs, printer2)].join("");
|
|
415
|
+
}
|
|
416
|
+
function printText(text, config) {
|
|
417
|
+
const contentColor = config.colors.content;
|
|
418
|
+
return contentColor.open + escapeHTML(text) + contentColor.close;
|
|
419
|
+
}
|
|
420
|
+
function printComment(comment, config) {
|
|
421
|
+
const commentColor = config.colors.comment;
|
|
422
|
+
return `${commentColor.open}<!--${escapeHTML(comment)}-->${commentColor.close}`;
|
|
423
|
+
}
|
|
424
|
+
function printElement(type, printedProps, printedChildren, config, indentation) {
|
|
425
|
+
const tagColor = config.colors.tag;
|
|
426
|
+
return `${tagColor.open}<${type}${printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open}${printedChildren ? `>${tagColor.close}${printedChildren}${config.spacingOuter}${indentation}${tagColor.open}</${type}` : `${printedProps && !config.min ? "" : " "}/`}>${tagColor.close}`;
|
|
427
|
+
}
|
|
428
|
+
function printElementAsLeaf(type, config) {
|
|
429
|
+
const tagColor = config.colors.tag;
|
|
430
|
+
return `${tagColor.open}<${type}${tagColor.close} \u2026${tagColor.open} />${tagColor.close}`;
|
|
431
|
+
}
|
|
432
|
+
var ELEMENT_NODE = 1;
|
|
433
|
+
var TEXT_NODE = 3;
|
|
434
|
+
var COMMENT_NODE = 8;
|
|
435
|
+
var FRAGMENT_NODE = 11;
|
|
436
|
+
var ELEMENT_REGEXP = /^(?:(?:HTML|SVG)\w*)?Element$/;
|
|
437
|
+
function testHasAttribute(val) {
|
|
438
|
+
try {
|
|
439
|
+
return typeof val.hasAttribute === "function" && val.hasAttribute("is");
|
|
440
|
+
} catch {
|
|
441
|
+
return false;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
function testNode(val) {
|
|
445
|
+
const constructorName = val.constructor.name;
|
|
446
|
+
const { nodeType, tagName } = val;
|
|
447
|
+
const isCustomElement = typeof tagName === "string" && tagName.includes("-") || testHasAttribute(val);
|
|
448
|
+
return nodeType === ELEMENT_NODE && (ELEMENT_REGEXP.test(constructorName) || isCustomElement) || nodeType === TEXT_NODE && constructorName === "Text" || nodeType === COMMENT_NODE && constructorName === "Comment" || nodeType === FRAGMENT_NODE && constructorName === "DocumentFragment";
|
|
449
|
+
}
|
|
450
|
+
var test$3 = (val) => val?.constructor?.name && testNode(val);
|
|
451
|
+
function nodeIsText(node) {
|
|
452
|
+
return node.nodeType === TEXT_NODE;
|
|
453
|
+
}
|
|
454
|
+
function nodeIsComment(node) {
|
|
455
|
+
return node.nodeType === COMMENT_NODE;
|
|
456
|
+
}
|
|
457
|
+
function nodeIsFragment(node) {
|
|
458
|
+
return node.nodeType === FRAGMENT_NODE;
|
|
459
|
+
}
|
|
460
|
+
var serialize$3 = (node, config, indentation, depth, refs, printer2) => {
|
|
461
|
+
if (nodeIsText(node)) {
|
|
462
|
+
return printText(node.data, config);
|
|
463
|
+
}
|
|
464
|
+
if (nodeIsComment(node)) {
|
|
465
|
+
return printComment(node.data, config);
|
|
466
|
+
}
|
|
467
|
+
const type = nodeIsFragment(node) ? "DocumentFragment" : node.tagName.toLowerCase();
|
|
468
|
+
if (++depth > config.maxDepth) {
|
|
469
|
+
return printElementAsLeaf(type, config);
|
|
470
|
+
}
|
|
471
|
+
return printElement(type, printProps(nodeIsFragment(node) ? [] : Array.from(node.attributes, (attr) => attr.name).sort(), nodeIsFragment(node) ? {} : [...node.attributes].reduce((props, attribute) => {
|
|
472
|
+
props[attribute.name] = attribute.value;
|
|
473
|
+
return props;
|
|
474
|
+
}, {}), config, indentation + config.indent, depth, refs, printer2), (nodeIsFragment(node) || !node.shadowRoot ? "" : printShadowRoot(Array.prototype.slice.call(node.shadowRoot.children), config, indentation + config.indent, depth, refs, printer2)) + printChildren(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer2), config, indentation);
|
|
475
|
+
};
|
|
476
|
+
var plugin$3 = {
|
|
477
|
+
serialize: serialize$3,
|
|
478
|
+
test: test$3
|
|
479
|
+
};
|
|
480
|
+
var IS_ITERABLE_SENTINEL = "@@__IMMUTABLE_ITERABLE__@@";
|
|
481
|
+
var IS_LIST_SENTINEL = "@@__IMMUTABLE_LIST__@@";
|
|
482
|
+
var IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@";
|
|
483
|
+
var IS_MAP_SENTINEL = "@@__IMMUTABLE_MAP__@@";
|
|
484
|
+
var IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@";
|
|
485
|
+
var IS_RECORD_SENTINEL = "@@__IMMUTABLE_RECORD__@@";
|
|
486
|
+
var IS_SEQ_SENTINEL = "@@__IMMUTABLE_SEQ__@@";
|
|
487
|
+
var IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@";
|
|
488
|
+
var IS_STACK_SENTINEL = "@@__IMMUTABLE_STACK__@@";
|
|
489
|
+
var getImmutableName = (name) => `Immutable.${name}`;
|
|
490
|
+
var printAsLeaf = (name) => `[${name}]`;
|
|
491
|
+
var SPACE = " ";
|
|
492
|
+
var LAZY = "\u2026";
|
|
493
|
+
function printImmutableEntries(val, config, indentation, depth, refs, printer2, type) {
|
|
494
|
+
return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}{${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer2)}}`;
|
|
495
|
+
}
|
|
496
|
+
function getRecordEntries(val) {
|
|
497
|
+
let i3 = 0;
|
|
498
|
+
return { next() {
|
|
499
|
+
if (i3 < val._keys.length) {
|
|
500
|
+
const key = val._keys[i3++];
|
|
501
|
+
return {
|
|
502
|
+
done: false,
|
|
503
|
+
value: [key, val.get(key)]
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
return {
|
|
507
|
+
done: true,
|
|
508
|
+
value: void 0
|
|
509
|
+
};
|
|
510
|
+
} };
|
|
511
|
+
}
|
|
512
|
+
function printImmutableRecord(val, config, indentation, depth, refs, printer2) {
|
|
513
|
+
const name = getImmutableName(val._name || "Record");
|
|
514
|
+
return ++depth > config.maxDepth ? printAsLeaf(name) : `${name + SPACE}{${printIteratorEntries(getRecordEntries(val), config, indentation, depth, refs, printer2)}}`;
|
|
515
|
+
}
|
|
516
|
+
function printImmutableSeq(val, config, indentation, depth, refs, printer2) {
|
|
517
|
+
const name = getImmutableName("Seq");
|
|
518
|
+
if (++depth > config.maxDepth) {
|
|
519
|
+
return printAsLeaf(name);
|
|
520
|
+
}
|
|
521
|
+
if (val[IS_KEYED_SENTINEL]) {
|
|
522
|
+
return `${name + SPACE}{${val._iter || val._object ? printIteratorEntries(val.entries(), config, indentation, depth, refs, printer2) : LAZY}}`;
|
|
523
|
+
}
|
|
524
|
+
return `${name + SPACE}[${val._iter || val._array || val._collection || val._iterable ? printIteratorValues(val.values(), config, indentation, depth, refs, printer2) : LAZY}]`;
|
|
525
|
+
}
|
|
526
|
+
function printImmutableValues(val, config, indentation, depth, refs, printer2, type) {
|
|
527
|
+
return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}[${printIteratorValues(val.values(), config, indentation, depth, refs, printer2)}]`;
|
|
528
|
+
}
|
|
529
|
+
var serialize$2 = (val, config, indentation, depth, refs, printer2) => {
|
|
530
|
+
if (val[IS_MAP_SENTINEL]) {
|
|
531
|
+
return printImmutableEntries(val, config, indentation, depth, refs, printer2, val[IS_ORDERED_SENTINEL] ? "OrderedMap" : "Map");
|
|
532
|
+
}
|
|
533
|
+
if (val[IS_LIST_SENTINEL]) {
|
|
534
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer2, "List");
|
|
535
|
+
}
|
|
536
|
+
if (val[IS_SET_SENTINEL]) {
|
|
537
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer2, val[IS_ORDERED_SENTINEL] ? "OrderedSet" : "Set");
|
|
538
|
+
}
|
|
539
|
+
if (val[IS_STACK_SENTINEL]) {
|
|
540
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer2, "Stack");
|
|
541
|
+
}
|
|
542
|
+
if (val[IS_SEQ_SENTINEL]) {
|
|
543
|
+
return printImmutableSeq(val, config, indentation, depth, refs, printer2);
|
|
544
|
+
}
|
|
545
|
+
return printImmutableRecord(val, config, indentation, depth, refs, printer2);
|
|
546
|
+
};
|
|
547
|
+
var test$2 = (val) => val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
|
|
548
|
+
var plugin$2 = {
|
|
549
|
+
serialize: serialize$2,
|
|
550
|
+
test: test$2
|
|
551
|
+
};
|
|
552
|
+
function getDefaultExportFromCjs(x) {
|
|
553
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
554
|
+
}
|
|
555
|
+
var reactIs$1 = { exports: {} };
|
|
556
|
+
var reactIs_production = {};
|
|
557
|
+
var hasRequiredReactIs_production;
|
|
558
|
+
function requireReactIs_production() {
|
|
559
|
+
if (hasRequiredReactIs_production) return reactIs_production;
|
|
560
|
+
hasRequiredReactIs_production = 1;
|
|
561
|
+
var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), REACT_VIEW_TRANSITION_TYPE = /* @__PURE__ */ Symbol.for("react.view_transition"), REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference");
|
|
562
|
+
function typeOf(object) {
|
|
563
|
+
if ("object" === typeof object && null !== object) {
|
|
564
|
+
var $$typeof = object.$$typeof;
|
|
565
|
+
switch ($$typeof) {
|
|
566
|
+
case REACT_ELEMENT_TYPE:
|
|
567
|
+
switch (object = object.type, object) {
|
|
568
|
+
case REACT_FRAGMENT_TYPE:
|
|
569
|
+
case REACT_PROFILER_TYPE:
|
|
570
|
+
case REACT_STRICT_MODE_TYPE:
|
|
571
|
+
case REACT_SUSPENSE_TYPE:
|
|
572
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
573
|
+
case REACT_VIEW_TRANSITION_TYPE:
|
|
574
|
+
return object;
|
|
575
|
+
default:
|
|
576
|
+
switch (object = object && object.$$typeof, object) {
|
|
577
|
+
case REACT_CONTEXT_TYPE:
|
|
578
|
+
case REACT_FORWARD_REF_TYPE:
|
|
579
|
+
case REACT_LAZY_TYPE:
|
|
580
|
+
case REACT_MEMO_TYPE:
|
|
581
|
+
return object;
|
|
582
|
+
case REACT_CONSUMER_TYPE:
|
|
583
|
+
return object;
|
|
584
|
+
default:
|
|
585
|
+
return $$typeof;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
case REACT_PORTAL_TYPE:
|
|
589
|
+
return $$typeof;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
reactIs_production.ContextConsumer = REACT_CONSUMER_TYPE;
|
|
594
|
+
reactIs_production.ContextProvider = REACT_CONTEXT_TYPE;
|
|
595
|
+
reactIs_production.Element = REACT_ELEMENT_TYPE;
|
|
596
|
+
reactIs_production.ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
597
|
+
reactIs_production.Fragment = REACT_FRAGMENT_TYPE;
|
|
598
|
+
reactIs_production.Lazy = REACT_LAZY_TYPE;
|
|
599
|
+
reactIs_production.Memo = REACT_MEMO_TYPE;
|
|
600
|
+
reactIs_production.Portal = REACT_PORTAL_TYPE;
|
|
601
|
+
reactIs_production.Profiler = REACT_PROFILER_TYPE;
|
|
602
|
+
reactIs_production.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
603
|
+
reactIs_production.Suspense = REACT_SUSPENSE_TYPE;
|
|
604
|
+
reactIs_production.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
605
|
+
reactIs_production.isContextConsumer = function(object) {
|
|
606
|
+
return typeOf(object) === REACT_CONSUMER_TYPE;
|
|
607
|
+
};
|
|
608
|
+
reactIs_production.isContextProvider = function(object) {
|
|
609
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
610
|
+
};
|
|
611
|
+
reactIs_production.isElement = function(object) {
|
|
612
|
+
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
613
|
+
};
|
|
614
|
+
reactIs_production.isForwardRef = function(object) {
|
|
615
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
616
|
+
};
|
|
617
|
+
reactIs_production.isFragment = function(object) {
|
|
618
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
619
|
+
};
|
|
620
|
+
reactIs_production.isLazy = function(object) {
|
|
621
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
622
|
+
};
|
|
623
|
+
reactIs_production.isMemo = function(object) {
|
|
624
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
625
|
+
};
|
|
626
|
+
reactIs_production.isPortal = function(object) {
|
|
627
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
628
|
+
};
|
|
629
|
+
reactIs_production.isProfiler = function(object) {
|
|
630
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
631
|
+
};
|
|
632
|
+
reactIs_production.isStrictMode = function(object) {
|
|
633
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
634
|
+
};
|
|
635
|
+
reactIs_production.isSuspense = function(object) {
|
|
636
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
637
|
+
};
|
|
638
|
+
reactIs_production.isSuspenseList = function(object) {
|
|
639
|
+
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
640
|
+
};
|
|
641
|
+
reactIs_production.isValidElementType = function(type) {
|
|
642
|
+
return "string" === typeof type || "function" === typeof type || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || "object" === typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE || void 0 !== type.getModuleId) ? true : false;
|
|
643
|
+
};
|
|
644
|
+
reactIs_production.typeOf = typeOf;
|
|
645
|
+
return reactIs_production;
|
|
646
|
+
}
|
|
647
|
+
var hasRequiredReactIs$1;
|
|
648
|
+
function requireReactIs$1() {
|
|
649
|
+
if (hasRequiredReactIs$1) return reactIs$1.exports;
|
|
650
|
+
hasRequiredReactIs$1 = 1;
|
|
651
|
+
{
|
|
652
|
+
reactIs$1.exports = requireReactIs_production();
|
|
653
|
+
}
|
|
654
|
+
return reactIs$1.exports;
|
|
655
|
+
}
|
|
656
|
+
var reactIsExports$1 = requireReactIs$1();
|
|
657
|
+
var index$1 = /* @__PURE__ */ getDefaultExportFromCjs(reactIsExports$1);
|
|
658
|
+
var ReactIs19 = /* @__PURE__ */ _mergeNamespaces({
|
|
659
|
+
__proto__: null,
|
|
660
|
+
default: index$1
|
|
661
|
+
}, [reactIsExports$1]);
|
|
662
|
+
var reactIs = { exports: {} };
|
|
663
|
+
var reactIs_production_min = {};
|
|
664
|
+
var hasRequiredReactIs_production_min;
|
|
665
|
+
function requireReactIs_production_min() {
|
|
666
|
+
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
667
|
+
hasRequiredReactIs_production_min = 1;
|
|
668
|
+
var b4 = /* @__PURE__ */ Symbol.for("react.element"), c3 = /* @__PURE__ */ Symbol.for("react.portal"), d4 = /* @__PURE__ */ Symbol.for("react.fragment"), e2 = /* @__PURE__ */ Symbol.for("react.strict_mode"), f3 = /* @__PURE__ */ Symbol.for("react.profiler"), g4 = /* @__PURE__ */ Symbol.for("react.provider"), h3 = /* @__PURE__ */ Symbol.for("react.context"), k2 = /* @__PURE__ */ Symbol.for("react.server_context"), l2 = /* @__PURE__ */ Symbol.for("react.forward_ref"), m2 = /* @__PURE__ */ Symbol.for("react.suspense"), n2 = /* @__PURE__ */ Symbol.for("react.suspense_list"), p2 = /* @__PURE__ */ Symbol.for("react.memo"), q2 = /* @__PURE__ */ Symbol.for("react.lazy"), t2 = /* @__PURE__ */ Symbol.for("react.offscreen"), u;
|
|
669
|
+
u = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
670
|
+
function v2(a3) {
|
|
671
|
+
if ("object" === typeof a3 && null !== a3) {
|
|
672
|
+
var r2 = a3.$$typeof;
|
|
673
|
+
switch (r2) {
|
|
674
|
+
case b4:
|
|
675
|
+
switch (a3 = a3.type, a3) {
|
|
676
|
+
case d4:
|
|
677
|
+
case f3:
|
|
678
|
+
case e2:
|
|
679
|
+
case m2:
|
|
680
|
+
case n2:
|
|
681
|
+
return a3;
|
|
682
|
+
default:
|
|
683
|
+
switch (a3 = a3 && a3.$$typeof, a3) {
|
|
684
|
+
case k2:
|
|
685
|
+
case h3:
|
|
686
|
+
case l2:
|
|
687
|
+
case q2:
|
|
688
|
+
case p2:
|
|
689
|
+
case g4:
|
|
690
|
+
return a3;
|
|
691
|
+
default:
|
|
692
|
+
return r2;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
case c3:
|
|
696
|
+
return r2;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
reactIs_production_min.ContextConsumer = h3;
|
|
701
|
+
reactIs_production_min.ContextProvider = g4;
|
|
702
|
+
reactIs_production_min.Element = b4;
|
|
703
|
+
reactIs_production_min.ForwardRef = l2;
|
|
704
|
+
reactIs_production_min.Fragment = d4;
|
|
705
|
+
reactIs_production_min.Lazy = q2;
|
|
706
|
+
reactIs_production_min.Memo = p2;
|
|
707
|
+
reactIs_production_min.Portal = c3;
|
|
708
|
+
reactIs_production_min.Profiler = f3;
|
|
709
|
+
reactIs_production_min.StrictMode = e2;
|
|
710
|
+
reactIs_production_min.Suspense = m2;
|
|
711
|
+
reactIs_production_min.SuspenseList = n2;
|
|
712
|
+
reactIs_production_min.isAsyncMode = function() {
|
|
713
|
+
return false;
|
|
714
|
+
};
|
|
715
|
+
reactIs_production_min.isConcurrentMode = function() {
|
|
716
|
+
return false;
|
|
717
|
+
};
|
|
718
|
+
reactIs_production_min.isContextConsumer = function(a3) {
|
|
719
|
+
return v2(a3) === h3;
|
|
720
|
+
};
|
|
721
|
+
reactIs_production_min.isContextProvider = function(a3) {
|
|
722
|
+
return v2(a3) === g4;
|
|
723
|
+
};
|
|
724
|
+
reactIs_production_min.isElement = function(a3) {
|
|
725
|
+
return "object" === typeof a3 && null !== a3 && a3.$$typeof === b4;
|
|
726
|
+
};
|
|
727
|
+
reactIs_production_min.isForwardRef = function(a3) {
|
|
728
|
+
return v2(a3) === l2;
|
|
729
|
+
};
|
|
730
|
+
reactIs_production_min.isFragment = function(a3) {
|
|
731
|
+
return v2(a3) === d4;
|
|
732
|
+
};
|
|
733
|
+
reactIs_production_min.isLazy = function(a3) {
|
|
734
|
+
return v2(a3) === q2;
|
|
735
|
+
};
|
|
736
|
+
reactIs_production_min.isMemo = function(a3) {
|
|
737
|
+
return v2(a3) === p2;
|
|
738
|
+
};
|
|
739
|
+
reactIs_production_min.isPortal = function(a3) {
|
|
740
|
+
return v2(a3) === c3;
|
|
741
|
+
};
|
|
742
|
+
reactIs_production_min.isProfiler = function(a3) {
|
|
743
|
+
return v2(a3) === f3;
|
|
744
|
+
};
|
|
745
|
+
reactIs_production_min.isStrictMode = function(a3) {
|
|
746
|
+
return v2(a3) === e2;
|
|
747
|
+
};
|
|
748
|
+
reactIs_production_min.isSuspense = function(a3) {
|
|
749
|
+
return v2(a3) === m2;
|
|
750
|
+
};
|
|
751
|
+
reactIs_production_min.isSuspenseList = function(a3) {
|
|
752
|
+
return v2(a3) === n2;
|
|
753
|
+
};
|
|
754
|
+
reactIs_production_min.isValidElementType = function(a3) {
|
|
755
|
+
return "string" === typeof a3 || "function" === typeof a3 || a3 === d4 || a3 === f3 || a3 === e2 || a3 === m2 || a3 === n2 || a3 === t2 || "object" === typeof a3 && null !== a3 && (a3.$$typeof === q2 || a3.$$typeof === p2 || a3.$$typeof === g4 || a3.$$typeof === h3 || a3.$$typeof === l2 || a3.$$typeof === u || void 0 !== a3.getModuleId) ? true : false;
|
|
756
|
+
};
|
|
757
|
+
reactIs_production_min.typeOf = v2;
|
|
758
|
+
return reactIs_production_min;
|
|
759
|
+
}
|
|
760
|
+
var hasRequiredReactIs;
|
|
761
|
+
function requireReactIs() {
|
|
762
|
+
if (hasRequiredReactIs) return reactIs.exports;
|
|
763
|
+
hasRequiredReactIs = 1;
|
|
764
|
+
{
|
|
765
|
+
reactIs.exports = requireReactIs_production_min();
|
|
766
|
+
}
|
|
767
|
+
return reactIs.exports;
|
|
768
|
+
}
|
|
769
|
+
var reactIsExports = requireReactIs();
|
|
770
|
+
var index = /* @__PURE__ */ getDefaultExportFromCjs(reactIsExports);
|
|
771
|
+
var ReactIs18 = /* @__PURE__ */ _mergeNamespaces({
|
|
772
|
+
__proto__: null,
|
|
773
|
+
default: index
|
|
774
|
+
}, [reactIsExports]);
|
|
775
|
+
var reactIsMethods = [
|
|
776
|
+
"isAsyncMode",
|
|
777
|
+
"isConcurrentMode",
|
|
778
|
+
"isContextConsumer",
|
|
779
|
+
"isContextProvider",
|
|
780
|
+
"isElement",
|
|
781
|
+
"isForwardRef",
|
|
782
|
+
"isFragment",
|
|
783
|
+
"isLazy",
|
|
784
|
+
"isMemo",
|
|
785
|
+
"isPortal",
|
|
786
|
+
"isProfiler",
|
|
787
|
+
"isStrictMode",
|
|
788
|
+
"isSuspense",
|
|
789
|
+
"isSuspenseList",
|
|
790
|
+
"isValidElementType"
|
|
791
|
+
];
|
|
792
|
+
var ReactIs = Object.fromEntries(reactIsMethods.map((m2) => [m2, (v2) => ReactIs18[m2](v2) || ReactIs19[m2](v2)]));
|
|
793
|
+
function getChildren(arg, children = []) {
|
|
794
|
+
if (Array.isArray(arg)) {
|
|
795
|
+
for (const item of arg) {
|
|
796
|
+
getChildren(item, children);
|
|
797
|
+
}
|
|
798
|
+
} else if (arg != null && arg !== false && arg !== "") {
|
|
799
|
+
children.push(arg);
|
|
800
|
+
}
|
|
801
|
+
return children;
|
|
802
|
+
}
|
|
803
|
+
function getType(element) {
|
|
804
|
+
const type = element.type;
|
|
805
|
+
if (typeof type === "string") {
|
|
806
|
+
return type;
|
|
807
|
+
}
|
|
808
|
+
if (typeof type === "function") {
|
|
809
|
+
return type.displayName || type.name || "Unknown";
|
|
810
|
+
}
|
|
811
|
+
if (ReactIs.isFragment(element)) {
|
|
812
|
+
return "React.Fragment";
|
|
813
|
+
}
|
|
814
|
+
if (ReactIs.isSuspense(element)) {
|
|
815
|
+
return "React.Suspense";
|
|
816
|
+
}
|
|
817
|
+
if (typeof type === "object" && type !== null) {
|
|
818
|
+
if (ReactIs.isContextProvider(element)) {
|
|
819
|
+
return "Context.Provider";
|
|
820
|
+
}
|
|
821
|
+
if (ReactIs.isContextConsumer(element)) {
|
|
822
|
+
return "Context.Consumer";
|
|
823
|
+
}
|
|
824
|
+
if (ReactIs.isForwardRef(element)) {
|
|
825
|
+
if (type.displayName) {
|
|
826
|
+
return type.displayName;
|
|
827
|
+
}
|
|
828
|
+
const functionName = type.render.displayName || type.render.name || "";
|
|
829
|
+
return functionName === "" ? "ForwardRef" : `ForwardRef(${functionName})`;
|
|
830
|
+
}
|
|
831
|
+
if (ReactIs.isMemo(element)) {
|
|
832
|
+
const functionName = type.displayName || type.type.displayName || type.type.name || "";
|
|
833
|
+
return functionName === "" ? "Memo" : `Memo(${functionName})`;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
return "UNDEFINED";
|
|
837
|
+
}
|
|
838
|
+
function getPropKeys$1(element) {
|
|
839
|
+
const { props } = element;
|
|
840
|
+
return Object.keys(props).filter((key) => key !== "children" && props[key] !== void 0).sort();
|
|
841
|
+
}
|
|
842
|
+
var serialize$1 = (element, config, indentation, depth, refs, printer2) => ++depth > config.maxDepth ? printElementAsLeaf(getType(element), config) : printElement(getType(element), printProps(getPropKeys$1(element), element.props, config, indentation + config.indent, depth, refs, printer2), printChildren(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer2), config, indentation);
|
|
843
|
+
var test$1 = (val) => val != null && ReactIs.isElement(val);
|
|
844
|
+
var plugin$1 = {
|
|
845
|
+
serialize: serialize$1,
|
|
846
|
+
test: test$1
|
|
847
|
+
};
|
|
848
|
+
var testSymbol = typeof Symbol === "function" && Symbol.for ? /* @__PURE__ */ Symbol.for("react.test.json") : 245830487;
|
|
849
|
+
function getPropKeys(object) {
|
|
850
|
+
const { props } = object;
|
|
851
|
+
return props ? Object.keys(props).filter((key) => props[key] !== void 0).sort() : [];
|
|
852
|
+
}
|
|
853
|
+
var serialize = (object, config, indentation, depth, refs, printer2) => ++depth > config.maxDepth ? printElementAsLeaf(object.type, config) : printElement(object.type, object.props ? printProps(getPropKeys(object), object.props, config, indentation + config.indent, depth, refs, printer2) : "", object.children ? printChildren(object.children, config, indentation + config.indent, depth, refs, printer2) : "", config, indentation);
|
|
854
|
+
var test = (val) => val && val.$$typeof === testSymbol;
|
|
855
|
+
var plugin = {
|
|
856
|
+
serialize,
|
|
857
|
+
test
|
|
858
|
+
};
|
|
859
|
+
var toString = Object.prototype.toString;
|
|
860
|
+
var toISOString = Date.prototype.toISOString;
|
|
861
|
+
var errorToString = Error.prototype.toString;
|
|
862
|
+
var regExpToString = RegExp.prototype.toString;
|
|
863
|
+
function getConstructorName(val) {
|
|
864
|
+
return typeof val.constructor === "function" && val.constructor.name || "Object";
|
|
865
|
+
}
|
|
866
|
+
function isWindow(val) {
|
|
867
|
+
return typeof window !== "undefined" && val === window;
|
|
868
|
+
}
|
|
869
|
+
var SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
|
|
870
|
+
var NEWLINE_REGEXP = /\n/g;
|
|
871
|
+
var PrettyFormatPluginError = class extends Error {
|
|
872
|
+
constructor(message, stack) {
|
|
873
|
+
super(message);
|
|
874
|
+
this.stack = stack;
|
|
875
|
+
this.name = this.constructor.name;
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
function isToStringedArrayType(toStringed) {
|
|
879
|
+
return toStringed === "[object Array]" || toStringed === "[object ArrayBuffer]" || toStringed === "[object DataView]" || toStringed === "[object Float32Array]" || toStringed === "[object Float64Array]" || toStringed === "[object Int8Array]" || toStringed === "[object Int16Array]" || toStringed === "[object Int32Array]" || toStringed === "[object Uint8Array]" || toStringed === "[object Uint8ClampedArray]" || toStringed === "[object Uint16Array]" || toStringed === "[object Uint32Array]";
|
|
880
|
+
}
|
|
881
|
+
function printNumber(val) {
|
|
882
|
+
return Object.is(val, -0) ? "-0" : String(val);
|
|
883
|
+
}
|
|
884
|
+
function printBigInt(val) {
|
|
885
|
+
return String(`${val}n`);
|
|
886
|
+
}
|
|
887
|
+
function printFunction(val, printFunctionName) {
|
|
888
|
+
if (!printFunctionName) {
|
|
889
|
+
return "[Function]";
|
|
890
|
+
}
|
|
891
|
+
return `[Function ${val.name || "anonymous"}]`;
|
|
892
|
+
}
|
|
893
|
+
function printSymbol(val) {
|
|
894
|
+
return String(val).replace(SYMBOL_REGEXP, "Symbol($1)");
|
|
895
|
+
}
|
|
896
|
+
function printError(val) {
|
|
897
|
+
return `[${errorToString.call(val)}]`;
|
|
898
|
+
}
|
|
899
|
+
function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
|
|
900
|
+
if (val === true || val === false) {
|
|
901
|
+
return `${val}`;
|
|
902
|
+
}
|
|
903
|
+
if (val === void 0) {
|
|
904
|
+
return "undefined";
|
|
905
|
+
}
|
|
906
|
+
if (val === null) {
|
|
907
|
+
return "null";
|
|
908
|
+
}
|
|
909
|
+
const typeOf = typeof val;
|
|
910
|
+
if (typeOf === "number") {
|
|
911
|
+
return printNumber(val);
|
|
912
|
+
}
|
|
913
|
+
if (typeOf === "bigint") {
|
|
914
|
+
return printBigInt(val);
|
|
915
|
+
}
|
|
916
|
+
if (typeOf === "string") {
|
|
917
|
+
if (escapeString) {
|
|
918
|
+
return `"${val.replaceAll(/"|\\/g, "\\$&")}"`;
|
|
919
|
+
}
|
|
920
|
+
return `"${val}"`;
|
|
921
|
+
}
|
|
922
|
+
if (typeOf === "function") {
|
|
923
|
+
return printFunction(val, printFunctionName);
|
|
924
|
+
}
|
|
925
|
+
if (typeOf === "symbol") {
|
|
926
|
+
return printSymbol(val);
|
|
927
|
+
}
|
|
928
|
+
const toStringed = toString.call(val);
|
|
929
|
+
if (toStringed === "[object WeakMap]") {
|
|
930
|
+
return "WeakMap {}";
|
|
931
|
+
}
|
|
932
|
+
if (toStringed === "[object WeakSet]") {
|
|
933
|
+
return "WeakSet {}";
|
|
934
|
+
}
|
|
935
|
+
if (toStringed === "[object Function]" || toStringed === "[object GeneratorFunction]") {
|
|
936
|
+
return printFunction(val, printFunctionName);
|
|
937
|
+
}
|
|
938
|
+
if (toStringed === "[object Symbol]") {
|
|
939
|
+
return printSymbol(val);
|
|
940
|
+
}
|
|
941
|
+
if (toStringed === "[object Date]") {
|
|
942
|
+
return Number.isNaN(+val) ? "Date { NaN }" : toISOString.call(val);
|
|
943
|
+
}
|
|
944
|
+
if (toStringed === "[object Error]") {
|
|
945
|
+
return printError(val);
|
|
946
|
+
}
|
|
947
|
+
if (toStringed === "[object RegExp]") {
|
|
948
|
+
if (escapeRegex) {
|
|
949
|
+
return regExpToString.call(val).replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&");
|
|
950
|
+
}
|
|
951
|
+
return regExpToString.call(val);
|
|
952
|
+
}
|
|
953
|
+
if (val instanceof Error) {
|
|
954
|
+
return printError(val);
|
|
955
|
+
}
|
|
956
|
+
return null;
|
|
957
|
+
}
|
|
958
|
+
function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
959
|
+
if (refs.includes(val)) {
|
|
960
|
+
return "[Circular]";
|
|
961
|
+
}
|
|
962
|
+
refs = [...refs];
|
|
963
|
+
refs.push(val);
|
|
964
|
+
const hitMaxDepth = ++depth > config.maxDepth;
|
|
965
|
+
const min = config.min;
|
|
966
|
+
if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === "function" && !hasCalledToJSON) {
|
|
967
|
+
return printer(val.toJSON(), config, indentation, depth, refs, true);
|
|
968
|
+
}
|
|
969
|
+
const toStringed = toString.call(val);
|
|
970
|
+
if (toStringed === "[object Arguments]") {
|
|
971
|
+
return hitMaxDepth ? "[Arguments]" : `${min ? "" : "Arguments "}[${printListItems(val, config, indentation, depth, refs, printer)}]`;
|
|
972
|
+
}
|
|
973
|
+
if (isToStringedArrayType(toStringed)) {
|
|
974
|
+
return hitMaxDepth ? `[${val.constructor.name}]` : `${min ? "" : !config.printBasicPrototype && val.constructor.name === "Array" ? "" : `${val.constructor.name} `}[${printListItems(val, config, indentation, depth, refs, printer)}]`;
|
|
975
|
+
}
|
|
976
|
+
if (toStringed === "[object Map]") {
|
|
977
|
+
return hitMaxDepth ? "[Map]" : `Map {${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer, " => ")}}`;
|
|
978
|
+
}
|
|
979
|
+
if (toStringed === "[object Set]") {
|
|
980
|
+
return hitMaxDepth ? "[Set]" : `Set {${printIteratorValues(val.values(), config, indentation, depth, refs, printer)}}`;
|
|
981
|
+
}
|
|
982
|
+
return hitMaxDepth || isWindow(val) ? `[${getConstructorName(val)}]` : `${min ? "" : !config.printBasicPrototype && getConstructorName(val) === "Object" ? "" : `${getConstructorName(val)} `}{${printObjectProperties(val, config, indentation, depth, refs, printer)}}`;
|
|
983
|
+
}
|
|
984
|
+
var ErrorPlugin = {
|
|
985
|
+
test: (val) => val && val instanceof Error,
|
|
986
|
+
serialize(val, config, indentation, depth, refs, printer2) {
|
|
987
|
+
if (refs.includes(val)) {
|
|
988
|
+
return "[Circular]";
|
|
989
|
+
}
|
|
990
|
+
refs = [...refs, val];
|
|
991
|
+
const hitMaxDepth = ++depth > config.maxDepth;
|
|
992
|
+
const { message, cause, ...rest } = val;
|
|
993
|
+
const entries = {
|
|
994
|
+
message,
|
|
995
|
+
...typeof cause !== "undefined" ? { cause } : {},
|
|
996
|
+
...val instanceof AggregateError ? { errors: val.errors } : {},
|
|
997
|
+
...rest
|
|
998
|
+
};
|
|
999
|
+
const name = val.name !== "Error" ? val.name : getConstructorName(val);
|
|
1000
|
+
return hitMaxDepth ? `[${name}]` : `${name} {${printIteratorEntries(Object.entries(entries).values(), config, indentation, depth, refs, printer2)}}`;
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
function isNewPlugin(plugin2) {
|
|
1004
|
+
return plugin2.serialize != null;
|
|
1005
|
+
}
|
|
1006
|
+
function printPlugin(plugin2, val, config, indentation, depth, refs) {
|
|
1007
|
+
let printed;
|
|
1008
|
+
try {
|
|
1009
|
+
printed = isNewPlugin(plugin2) ? plugin2.serialize(val, config, indentation, depth, refs, printer) : plugin2.print(val, (valChild) => printer(valChild, config, indentation, depth, refs), (str) => {
|
|
1010
|
+
const indentationNext = indentation + config.indent;
|
|
1011
|
+
return indentationNext + str.replaceAll(NEWLINE_REGEXP, `
|
|
1012
|
+
${indentationNext}`);
|
|
1013
|
+
}, {
|
|
1014
|
+
edgeSpacing: config.spacingOuter,
|
|
1015
|
+
min: config.min,
|
|
1016
|
+
spacing: config.spacingInner
|
|
1017
|
+
}, config.colors);
|
|
1018
|
+
} catch (error) {
|
|
1019
|
+
throw new PrettyFormatPluginError(error.message, error.stack);
|
|
1020
|
+
}
|
|
1021
|
+
if (typeof printed !== "string") {
|
|
1022
|
+
throw new TypeError(`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`);
|
|
1023
|
+
}
|
|
1024
|
+
return printed;
|
|
1025
|
+
}
|
|
1026
|
+
function findPlugin(plugins2, val) {
|
|
1027
|
+
for (const plugin2 of plugins2) {
|
|
1028
|
+
try {
|
|
1029
|
+
if (plugin2.test(val)) {
|
|
1030
|
+
return plugin2;
|
|
1031
|
+
}
|
|
1032
|
+
} catch (error) {
|
|
1033
|
+
throw new PrettyFormatPluginError(error.message, error.stack);
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
return null;
|
|
1037
|
+
}
|
|
1038
|
+
function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
1039
|
+
const plugin2 = findPlugin(config.plugins, val);
|
|
1040
|
+
if (plugin2 !== null) {
|
|
1041
|
+
return printPlugin(plugin2, val, config, indentation, depth, refs);
|
|
1042
|
+
}
|
|
1043
|
+
const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString);
|
|
1044
|
+
if (basicResult !== null) {
|
|
1045
|
+
return basicResult;
|
|
1046
|
+
}
|
|
1047
|
+
return printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
|
|
1048
|
+
}
|
|
1049
|
+
var DEFAULT_THEME = {
|
|
1050
|
+
comment: "gray",
|
|
1051
|
+
content: "reset",
|
|
1052
|
+
prop: "yellow",
|
|
1053
|
+
tag: "cyan",
|
|
1054
|
+
value: "green"
|
|
1055
|
+
};
|
|
1056
|
+
var DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
|
|
1057
|
+
var DEFAULT_OPTIONS = {
|
|
1058
|
+
callToJSON: true,
|
|
1059
|
+
compareKeys: void 0,
|
|
1060
|
+
escapeRegex: false,
|
|
1061
|
+
escapeString: true,
|
|
1062
|
+
highlight: false,
|
|
1063
|
+
indent: 2,
|
|
1064
|
+
maxDepth: Number.POSITIVE_INFINITY,
|
|
1065
|
+
maxWidth: Number.POSITIVE_INFINITY,
|
|
1066
|
+
min: false,
|
|
1067
|
+
plugins: [],
|
|
1068
|
+
printBasicPrototype: true,
|
|
1069
|
+
printFunctionName: true,
|
|
1070
|
+
printShadowRoot: true,
|
|
1071
|
+
theme: DEFAULT_THEME
|
|
1072
|
+
};
|
|
1073
|
+
function validateOptions(options) {
|
|
1074
|
+
for (const key of Object.keys(options)) {
|
|
1075
|
+
if (!Object.hasOwn(DEFAULT_OPTIONS, key)) {
|
|
1076
|
+
throw new Error(`pretty-format: Unknown option "${key}".`);
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
if (options.min && options.indent !== void 0 && options.indent !== 0) {
|
|
1080
|
+
throw new Error('pretty-format: Options "min" and "indent" cannot be used together.');
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
function getColorsHighlight() {
|
|
1084
|
+
return DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
1085
|
+
const value = DEFAULT_THEME[key];
|
|
1086
|
+
const color = value && C[value];
|
|
1087
|
+
if (color && typeof color.close === "string" && typeof color.open === "string") {
|
|
1088
|
+
colors[key] = color;
|
|
1089
|
+
} else {
|
|
1090
|
+
throw new Error(`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`);
|
|
1091
|
+
}
|
|
1092
|
+
return colors;
|
|
1093
|
+
}, /* @__PURE__ */ Object.create(null));
|
|
1094
|
+
}
|
|
1095
|
+
function getColorsEmpty() {
|
|
1096
|
+
return DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
1097
|
+
colors[key] = {
|
|
1098
|
+
close: "",
|
|
1099
|
+
open: ""
|
|
1100
|
+
};
|
|
1101
|
+
return colors;
|
|
1102
|
+
}, /* @__PURE__ */ Object.create(null));
|
|
1103
|
+
}
|
|
1104
|
+
function getPrintFunctionName(options) {
|
|
1105
|
+
return options?.printFunctionName ?? DEFAULT_OPTIONS.printFunctionName;
|
|
1106
|
+
}
|
|
1107
|
+
function getEscapeRegex(options) {
|
|
1108
|
+
return options?.escapeRegex ?? DEFAULT_OPTIONS.escapeRegex;
|
|
1109
|
+
}
|
|
1110
|
+
function getEscapeString(options) {
|
|
1111
|
+
return options?.escapeString ?? DEFAULT_OPTIONS.escapeString;
|
|
1112
|
+
}
|
|
1113
|
+
function getConfig(options) {
|
|
1114
|
+
return {
|
|
1115
|
+
callToJSON: options?.callToJSON ?? DEFAULT_OPTIONS.callToJSON,
|
|
1116
|
+
colors: options?.highlight ? getColorsHighlight() : getColorsEmpty(),
|
|
1117
|
+
compareKeys: typeof options?.compareKeys === "function" || options?.compareKeys === null ? options.compareKeys : DEFAULT_OPTIONS.compareKeys,
|
|
1118
|
+
escapeRegex: getEscapeRegex(options),
|
|
1119
|
+
escapeString: getEscapeString(options),
|
|
1120
|
+
indent: options?.min ? "" : createIndent(options?.indent ?? DEFAULT_OPTIONS.indent),
|
|
1121
|
+
maxDepth: options?.maxDepth ?? DEFAULT_OPTIONS.maxDepth,
|
|
1122
|
+
maxWidth: options?.maxWidth ?? DEFAULT_OPTIONS.maxWidth,
|
|
1123
|
+
min: options?.min ?? DEFAULT_OPTIONS.min,
|
|
1124
|
+
plugins: options?.plugins ?? DEFAULT_OPTIONS.plugins,
|
|
1125
|
+
printBasicPrototype: options?.printBasicPrototype ?? true,
|
|
1126
|
+
printFunctionName: getPrintFunctionName(options),
|
|
1127
|
+
printShadowRoot: options?.printShadowRoot ?? true,
|
|
1128
|
+
spacingInner: options?.min ? " " : "\n",
|
|
1129
|
+
spacingOuter: options?.min ? "" : "\n"
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1132
|
+
function createIndent(indent) {
|
|
1133
|
+
return Array.from({ length: indent + 1 }).join(" ");
|
|
1134
|
+
}
|
|
1135
|
+
function format(val, options) {
|
|
1136
|
+
if (options) {
|
|
1137
|
+
validateOptions(options);
|
|
1138
|
+
if (options.plugins) {
|
|
1139
|
+
const plugin2 = findPlugin(options.plugins, val);
|
|
1140
|
+
if (plugin2 !== null) {
|
|
1141
|
+
return printPlugin(plugin2, val, getConfig(options), "", 0, []);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
const basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options), getEscapeString(options));
|
|
1146
|
+
if (basicResult !== null) {
|
|
1147
|
+
return basicResult;
|
|
1148
|
+
}
|
|
1149
|
+
return printComplexValue(val, getConfig(options), "", 0, []);
|
|
1150
|
+
}
|
|
1151
|
+
var plugins = {
|
|
1152
|
+
AsymmetricMatcher: plugin$5,
|
|
1153
|
+
DOMCollection: plugin$4,
|
|
1154
|
+
DOMElement: plugin$3,
|
|
1155
|
+
Immutable: plugin$2,
|
|
1156
|
+
ReactElement: plugin$1,
|
|
1157
|
+
ReactTestComponent: plugin,
|
|
1158
|
+
Error: ErrorPlugin
|
|
1159
|
+
};
|
|
1160
|
+
|
|
1161
|
+
// ../../node_modules/.pnpm/@vitest+utils@4.0.16/node_modules/@vitest/utils/dist/helpers.js
|
|
1162
|
+
import { VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER } from "./constants.js.mjs";
|
|
1163
|
+
function assertTypes(value, name, types) {
|
|
1164
|
+
const receivedType = typeof value;
|
|
1165
|
+
const pass = types.includes(receivedType);
|
|
1166
|
+
if (!pass) {
|
|
1167
|
+
throw new TypeError(`${name} value must be ${types.join(" or ")}, received "${receivedType}"`);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
function toArray(array) {
|
|
1171
|
+
if (array === null || array === void 0) {
|
|
1172
|
+
array = [];
|
|
1173
|
+
}
|
|
1174
|
+
if (Array.isArray(array)) {
|
|
1175
|
+
return array;
|
|
1176
|
+
}
|
|
1177
|
+
return [array];
|
|
1178
|
+
}
|
|
1179
|
+
function isObject(item) {
|
|
1180
|
+
return item != null && typeof item === "object" && !Array.isArray(item);
|
|
1181
|
+
}
|
|
1182
|
+
function objectAttr(source, path, defaultValue = void 0) {
|
|
1183
|
+
const paths = path.replace(/\[(\d+)\]/g, ".$1").split(".");
|
|
1184
|
+
let result = source;
|
|
1185
|
+
for (const p2 of paths) {
|
|
1186
|
+
result = new Object(result)[p2];
|
|
1187
|
+
if (result === void 0) {
|
|
1188
|
+
return defaultValue;
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
return result;
|
|
1192
|
+
}
|
|
1193
|
+
function createDefer() {
|
|
1194
|
+
let resolve = null;
|
|
1195
|
+
let reject = null;
|
|
1196
|
+
const p2 = new Promise((_resolve, _reject) => {
|
|
1197
|
+
resolve = _resolve;
|
|
1198
|
+
reject = _reject;
|
|
1199
|
+
});
|
|
1200
|
+
p2.resolve = resolve;
|
|
1201
|
+
p2.reject = reject;
|
|
1202
|
+
return p2;
|
|
1203
|
+
}
|
|
1204
|
+
function isNegativeNaN(val) {
|
|
1205
|
+
if (!Number.isNaN(val)) {
|
|
1206
|
+
return false;
|
|
1207
|
+
}
|
|
1208
|
+
const f64 = new Float64Array(1);
|
|
1209
|
+
f64[0] = val;
|
|
1210
|
+
const u32 = new Uint32Array(f64.buffer);
|
|
1211
|
+
const isNegative = u32[1] >>> 31 === 1;
|
|
1212
|
+
return isNegative;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
// ../../node_modules/.pnpm/@vitest+utils@4.0.16/node_modules/@vitest/utils/dist/timers.js
|
|
1216
|
+
var SAFE_TIMERS_SYMBOL = /* @__PURE__ */ Symbol("vitest:SAFE_TIMERS");
|
|
1217
|
+
function getSafeTimers() {
|
|
1218
|
+
const { setTimeout: safeSetTimeout, setInterval: safeSetInterval, clearInterval: safeClearInterval, clearTimeout: safeClearTimeout, setImmediate: safeSetImmediate, clearImmediate: safeClearImmediate, queueMicrotask: safeQueueMicrotask } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis;
|
|
1219
|
+
const { nextTick: safeNextTick } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis.process || {};
|
|
1220
|
+
return {
|
|
1221
|
+
nextTick: safeNextTick,
|
|
1222
|
+
setTimeout: safeSetTimeout,
|
|
1223
|
+
setInterval: safeSetInterval,
|
|
1224
|
+
clearInterval: safeClearInterval,
|
|
1225
|
+
clearTimeout: safeClearTimeout,
|
|
1226
|
+
setImmediate: safeSetImmediate,
|
|
1227
|
+
clearImmediate: safeClearImmediate,
|
|
1228
|
+
queueMicrotask: safeQueueMicrotask
|
|
1229
|
+
};
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
// ../../node_modules/.pnpm/@vitest+utils@4.0.16/node_modules/@vitest/utils/dist/display.js
|
|
1233
|
+
var ansiColors = {
|
|
1234
|
+
bold: ["1", "22"],
|
|
1235
|
+
dim: ["2", "22"],
|
|
1236
|
+
italic: ["3", "23"],
|
|
1237
|
+
underline: ["4", "24"],
|
|
1238
|
+
// 5 & 6 are blinking
|
|
1239
|
+
inverse: ["7", "27"],
|
|
1240
|
+
hidden: ["8", "28"],
|
|
1241
|
+
strike: ["9", "29"],
|
|
1242
|
+
// 10-20 are fonts
|
|
1243
|
+
// 21-29 are resets for 1-9
|
|
1244
|
+
black: ["30", "39"],
|
|
1245
|
+
red: ["31", "39"],
|
|
1246
|
+
green: ["32", "39"],
|
|
1247
|
+
yellow: ["33", "39"],
|
|
1248
|
+
blue: ["34", "39"],
|
|
1249
|
+
magenta: ["35", "39"],
|
|
1250
|
+
cyan: ["36", "39"],
|
|
1251
|
+
white: ["37", "39"],
|
|
1252
|
+
brightblack: ["30;1", "39"],
|
|
1253
|
+
brightred: ["31;1", "39"],
|
|
1254
|
+
brightgreen: ["32;1", "39"],
|
|
1255
|
+
brightyellow: ["33;1", "39"],
|
|
1256
|
+
brightblue: ["34;1", "39"],
|
|
1257
|
+
brightmagenta: ["35;1", "39"],
|
|
1258
|
+
brightcyan: ["36;1", "39"],
|
|
1259
|
+
brightwhite: ["37;1", "39"],
|
|
1260
|
+
grey: ["90", "39"]
|
|
1261
|
+
};
|
|
1262
|
+
var styles = {
|
|
1263
|
+
special: "cyan",
|
|
1264
|
+
number: "yellow",
|
|
1265
|
+
bigint: "yellow",
|
|
1266
|
+
boolean: "yellow",
|
|
1267
|
+
undefined: "grey",
|
|
1268
|
+
null: "bold",
|
|
1269
|
+
string: "green",
|
|
1270
|
+
symbol: "green",
|
|
1271
|
+
date: "magenta",
|
|
1272
|
+
regexp: "red"
|
|
1273
|
+
};
|
|
1274
|
+
var truncator = "\u2026";
|
|
1275
|
+
function colorise(value, styleType) {
|
|
1276
|
+
const color = ansiColors[styles[styleType]] || ansiColors[styleType] || "";
|
|
1277
|
+
if (!color) {
|
|
1278
|
+
return String(value);
|
|
1279
|
+
}
|
|
1280
|
+
return `\x1B[${color[0]}m${String(value)}\x1B[${color[1]}m`;
|
|
1281
|
+
}
|
|
1282
|
+
function normaliseOptions({
|
|
1283
|
+
showHidden = false,
|
|
1284
|
+
depth = 2,
|
|
1285
|
+
colors = false,
|
|
1286
|
+
customInspect = true,
|
|
1287
|
+
showProxy = false,
|
|
1288
|
+
maxArrayLength = Infinity,
|
|
1289
|
+
breakLength = Infinity,
|
|
1290
|
+
seen = [],
|
|
1291
|
+
// eslint-disable-next-line no-shadow
|
|
1292
|
+
truncate: truncate2 = Infinity,
|
|
1293
|
+
stylize = String
|
|
1294
|
+
} = {}, inspect2) {
|
|
1295
|
+
const options = {
|
|
1296
|
+
showHidden: Boolean(showHidden),
|
|
1297
|
+
depth: Number(depth),
|
|
1298
|
+
colors: Boolean(colors),
|
|
1299
|
+
customInspect: Boolean(customInspect),
|
|
1300
|
+
showProxy: Boolean(showProxy),
|
|
1301
|
+
maxArrayLength: Number(maxArrayLength),
|
|
1302
|
+
breakLength: Number(breakLength),
|
|
1303
|
+
truncate: Number(truncate2),
|
|
1304
|
+
seen,
|
|
1305
|
+
inspect: inspect2,
|
|
1306
|
+
stylize
|
|
1307
|
+
};
|
|
1308
|
+
if (options.colors) {
|
|
1309
|
+
options.stylize = colorise;
|
|
1310
|
+
}
|
|
1311
|
+
return options;
|
|
1312
|
+
}
|
|
1313
|
+
function isHighSurrogate(char) {
|
|
1314
|
+
return char >= "\uD800" && char <= "\uDBFF";
|
|
1315
|
+
}
|
|
1316
|
+
function truncate(string, length, tail = truncator) {
|
|
1317
|
+
string = String(string);
|
|
1318
|
+
const tailLength = tail.length;
|
|
1319
|
+
const stringLength = string.length;
|
|
1320
|
+
if (tailLength > length && stringLength > tailLength) {
|
|
1321
|
+
return tail;
|
|
1322
|
+
}
|
|
1323
|
+
if (stringLength > length && stringLength > tailLength) {
|
|
1324
|
+
let end = length - tailLength;
|
|
1325
|
+
if (end > 0 && isHighSurrogate(string[end - 1])) {
|
|
1326
|
+
end = end - 1;
|
|
1327
|
+
}
|
|
1328
|
+
return `${string.slice(0, end)}${tail}`;
|
|
1329
|
+
}
|
|
1330
|
+
return string;
|
|
1331
|
+
}
|
|
1332
|
+
function inspectList(list, options, inspectItem, separator = ", ") {
|
|
1333
|
+
inspectItem = inspectItem || options.inspect;
|
|
1334
|
+
const size = list.length;
|
|
1335
|
+
if (size === 0)
|
|
1336
|
+
return "";
|
|
1337
|
+
const originalLength = options.truncate;
|
|
1338
|
+
let output = "";
|
|
1339
|
+
let peek = "";
|
|
1340
|
+
let truncated = "";
|
|
1341
|
+
for (let i3 = 0; i3 < size; i3 += 1) {
|
|
1342
|
+
const last = i3 + 1 === list.length;
|
|
1343
|
+
const secondToLast = i3 + 2 === list.length;
|
|
1344
|
+
truncated = `${truncator}(${list.length - i3})`;
|
|
1345
|
+
const value = list[i3];
|
|
1346
|
+
options.truncate = originalLength - output.length - (last ? 0 : separator.length);
|
|
1347
|
+
const string = peek || inspectItem(value, options) + (last ? "" : separator);
|
|
1348
|
+
const nextLength = output.length + string.length;
|
|
1349
|
+
const truncatedLength = nextLength + truncated.length;
|
|
1350
|
+
if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) {
|
|
1351
|
+
break;
|
|
1352
|
+
}
|
|
1353
|
+
if (!last && !secondToLast && truncatedLength > originalLength) {
|
|
1354
|
+
break;
|
|
1355
|
+
}
|
|
1356
|
+
peek = last ? "" : inspectItem(list[i3 + 1], options) + (secondToLast ? "" : separator);
|
|
1357
|
+
if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) {
|
|
1358
|
+
break;
|
|
1359
|
+
}
|
|
1360
|
+
output += string;
|
|
1361
|
+
if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
|
|
1362
|
+
truncated = `${truncator}(${list.length - i3 - 1})`;
|
|
1363
|
+
break;
|
|
1364
|
+
}
|
|
1365
|
+
truncated = "";
|
|
1366
|
+
}
|
|
1367
|
+
return `${output}${truncated}`;
|
|
1368
|
+
}
|
|
1369
|
+
function quoteComplexKey(key) {
|
|
1370
|
+
if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) {
|
|
1371
|
+
return key;
|
|
1372
|
+
}
|
|
1373
|
+
return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
|
|
1374
|
+
}
|
|
1375
|
+
function inspectProperty([key, value], options) {
|
|
1376
|
+
options.truncate -= 2;
|
|
1377
|
+
if (typeof key === "string") {
|
|
1378
|
+
key = quoteComplexKey(key);
|
|
1379
|
+
} else if (typeof key !== "number") {
|
|
1380
|
+
key = `[${options.inspect(key, options)}]`;
|
|
1381
|
+
}
|
|
1382
|
+
options.truncate -= key.length;
|
|
1383
|
+
value = options.inspect(value, options);
|
|
1384
|
+
return `${key}: ${value}`;
|
|
1385
|
+
}
|
|
1386
|
+
function inspectArray(array, options) {
|
|
1387
|
+
const nonIndexProperties = Object.keys(array).slice(array.length);
|
|
1388
|
+
if (!array.length && !nonIndexProperties.length)
|
|
1389
|
+
return "[]";
|
|
1390
|
+
options.truncate -= 4;
|
|
1391
|
+
const listContents = inspectList(array, options);
|
|
1392
|
+
options.truncate -= listContents.length;
|
|
1393
|
+
let propertyContents = "";
|
|
1394
|
+
if (nonIndexProperties.length) {
|
|
1395
|
+
propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
|
|
1396
|
+
}
|
|
1397
|
+
return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`;
|
|
1398
|
+
}
|
|
1399
|
+
var getArrayName = (array) => {
|
|
1400
|
+
if (typeof Buffer === "function" && array instanceof Buffer) {
|
|
1401
|
+
return "Buffer";
|
|
1402
|
+
}
|
|
1403
|
+
if (array[Symbol.toStringTag]) {
|
|
1404
|
+
return array[Symbol.toStringTag];
|
|
1405
|
+
}
|
|
1406
|
+
return array.constructor.name;
|
|
1407
|
+
};
|
|
1408
|
+
function inspectTypedArray(array, options) {
|
|
1409
|
+
const name = getArrayName(array);
|
|
1410
|
+
options.truncate -= name.length + 4;
|
|
1411
|
+
const nonIndexProperties = Object.keys(array).slice(array.length);
|
|
1412
|
+
if (!array.length && !nonIndexProperties.length)
|
|
1413
|
+
return `${name}[]`;
|
|
1414
|
+
let output = "";
|
|
1415
|
+
for (let i3 = 0; i3 < array.length; i3++) {
|
|
1416
|
+
const string = `${options.stylize(truncate(array[i3], options.truncate), "number")}${i3 === array.length - 1 ? "" : ", "}`;
|
|
1417
|
+
options.truncate -= string.length;
|
|
1418
|
+
if (array[i3] !== array.length && options.truncate <= 3) {
|
|
1419
|
+
output += `${truncator}(${array.length - array[i3] + 1})`;
|
|
1420
|
+
break;
|
|
1421
|
+
}
|
|
1422
|
+
output += string;
|
|
1423
|
+
}
|
|
1424
|
+
let propertyContents = "";
|
|
1425
|
+
if (nonIndexProperties.length) {
|
|
1426
|
+
propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
|
|
1427
|
+
}
|
|
1428
|
+
return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ""} ]`;
|
|
1429
|
+
}
|
|
1430
|
+
function inspectDate(dateObject, options) {
|
|
1431
|
+
const stringRepresentation = dateObject.toJSON();
|
|
1432
|
+
if (stringRepresentation === null) {
|
|
1433
|
+
return "Invalid Date";
|
|
1434
|
+
}
|
|
1435
|
+
const split = stringRepresentation.split("T");
|
|
1436
|
+
const date = split[0];
|
|
1437
|
+
return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date");
|
|
1438
|
+
}
|
|
1439
|
+
function inspectFunction(func, options) {
|
|
1440
|
+
const functionType = func[Symbol.toStringTag] || "Function";
|
|
1441
|
+
const name = func.name;
|
|
1442
|
+
if (!name) {
|
|
1443
|
+
return options.stylize(`[${functionType}]`, "special");
|
|
1444
|
+
}
|
|
1445
|
+
return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, "special");
|
|
1446
|
+
}
|
|
1447
|
+
function inspectMapEntry([key, value], options) {
|
|
1448
|
+
options.truncate -= 4;
|
|
1449
|
+
key = options.inspect(key, options);
|
|
1450
|
+
options.truncate -= key.length;
|
|
1451
|
+
value = options.inspect(value, options);
|
|
1452
|
+
return `${key} => ${value}`;
|
|
1453
|
+
}
|
|
1454
|
+
function mapToEntries(map) {
|
|
1455
|
+
const entries = [];
|
|
1456
|
+
map.forEach((value, key) => {
|
|
1457
|
+
entries.push([key, value]);
|
|
1458
|
+
});
|
|
1459
|
+
return entries;
|
|
1460
|
+
}
|
|
1461
|
+
function inspectMap(map, options) {
|
|
1462
|
+
if (map.size === 0)
|
|
1463
|
+
return "Map{}";
|
|
1464
|
+
options.truncate -= 7;
|
|
1465
|
+
return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
|
|
1466
|
+
}
|
|
1467
|
+
var isNaN = Number.isNaN || ((i3) => i3 !== i3);
|
|
1468
|
+
function inspectNumber(number, options) {
|
|
1469
|
+
if (isNaN(number)) {
|
|
1470
|
+
return options.stylize("NaN", "number");
|
|
1471
|
+
}
|
|
1472
|
+
if (number === Infinity) {
|
|
1473
|
+
return options.stylize("Infinity", "number");
|
|
1474
|
+
}
|
|
1475
|
+
if (number === -Infinity) {
|
|
1476
|
+
return options.stylize("-Infinity", "number");
|
|
1477
|
+
}
|
|
1478
|
+
if (number === 0) {
|
|
1479
|
+
return options.stylize(1 / number === Infinity ? "+0" : "-0", "number");
|
|
1480
|
+
}
|
|
1481
|
+
return options.stylize(truncate(String(number), options.truncate), "number");
|
|
1482
|
+
}
|
|
1483
|
+
function inspectBigInt(number, options) {
|
|
1484
|
+
let nums = truncate(number.toString(), options.truncate - 1);
|
|
1485
|
+
if (nums !== truncator)
|
|
1486
|
+
nums += "n";
|
|
1487
|
+
return options.stylize(nums, "bigint");
|
|
1488
|
+
}
|
|
1489
|
+
function inspectRegExp(value, options) {
|
|
1490
|
+
const flags = value.toString().split("/")[2];
|
|
1491
|
+
const sourceLength = options.truncate - (2 + flags.length);
|
|
1492
|
+
const source = value.source;
|
|
1493
|
+
return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, "regexp");
|
|
1494
|
+
}
|
|
1495
|
+
function arrayFromSet(set) {
|
|
1496
|
+
const values = [];
|
|
1497
|
+
set.forEach((value) => {
|
|
1498
|
+
values.push(value);
|
|
1499
|
+
});
|
|
1500
|
+
return values;
|
|
1501
|
+
}
|
|
1502
|
+
function inspectSet(set, options) {
|
|
1503
|
+
if (set.size === 0)
|
|
1504
|
+
return "Set{}";
|
|
1505
|
+
options.truncate -= 7;
|
|
1506
|
+
return `Set{ ${inspectList(arrayFromSet(set), options)} }`;
|
|
1507
|
+
}
|
|
1508
|
+
var stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g");
|
|
1509
|
+
var escapeCharacters = {
|
|
1510
|
+
"\b": "\\b",
|
|
1511
|
+
" ": "\\t",
|
|
1512
|
+
"\n": "\\n",
|
|
1513
|
+
"\f": "\\f",
|
|
1514
|
+
"\r": "\\r",
|
|
1515
|
+
"'": "\\'",
|
|
1516
|
+
"\\": "\\\\"
|
|
1517
|
+
};
|
|
1518
|
+
var hex = 16;
|
|
1519
|
+
function escape(char) {
|
|
1520
|
+
return escapeCharacters[char] || `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-4)}`;
|
|
1521
|
+
}
|
|
1522
|
+
function inspectString(string, options) {
|
|
1523
|
+
if (stringEscapeChars.test(string)) {
|
|
1524
|
+
string = string.replace(stringEscapeChars, escape);
|
|
1525
|
+
}
|
|
1526
|
+
return options.stylize(`'${truncate(string, options.truncate - 2)}'`, "string");
|
|
1527
|
+
}
|
|
1528
|
+
function inspectSymbol(value) {
|
|
1529
|
+
if ("description" in Symbol.prototype) {
|
|
1530
|
+
return value.description ? `Symbol(${value.description})` : "Symbol()";
|
|
1531
|
+
}
|
|
1532
|
+
return value.toString();
|
|
1533
|
+
}
|
|
1534
|
+
var getPromiseValue = () => "Promise{\u2026}";
|
|
1535
|
+
function inspectObject$1(object, options) {
|
|
1536
|
+
const properties = Object.getOwnPropertyNames(object);
|
|
1537
|
+
const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
|
|
1538
|
+
if (properties.length === 0 && symbols.length === 0) {
|
|
1539
|
+
return "{}";
|
|
1540
|
+
}
|
|
1541
|
+
options.truncate -= 4;
|
|
1542
|
+
options.seen = options.seen || [];
|
|
1543
|
+
if (options.seen.includes(object)) {
|
|
1544
|
+
return "[Circular]";
|
|
1545
|
+
}
|
|
1546
|
+
options.seen.push(object);
|
|
1547
|
+
const propertyContents = inspectList(properties.map((key) => [key, object[key]]), options, inspectProperty);
|
|
1548
|
+
const symbolContents = inspectList(symbols.map((key) => [key, object[key]]), options, inspectProperty);
|
|
1549
|
+
options.seen.pop();
|
|
1550
|
+
let sep = "";
|
|
1551
|
+
if (propertyContents && symbolContents) {
|
|
1552
|
+
sep = ", ";
|
|
1553
|
+
}
|
|
1554
|
+
return `{ ${propertyContents}${sep}${symbolContents} }`;
|
|
1555
|
+
}
|
|
1556
|
+
var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
|
|
1557
|
+
function inspectClass(value, options) {
|
|
1558
|
+
let name = "";
|
|
1559
|
+
if (toStringTag && toStringTag in value) {
|
|
1560
|
+
name = value[toStringTag];
|
|
1561
|
+
}
|
|
1562
|
+
name = name || value.constructor.name;
|
|
1563
|
+
if (!name || name === "_class") {
|
|
1564
|
+
name = "<Anonymous Class>";
|
|
1565
|
+
}
|
|
1566
|
+
options.truncate -= name.length;
|
|
1567
|
+
return `${name}${inspectObject$1(value, options)}`;
|
|
1568
|
+
}
|
|
1569
|
+
function inspectArguments(args, options) {
|
|
1570
|
+
if (args.length === 0)
|
|
1571
|
+
return "Arguments[]";
|
|
1572
|
+
options.truncate -= 13;
|
|
1573
|
+
return `Arguments[ ${inspectList(args, options)} ]`;
|
|
1574
|
+
}
|
|
1575
|
+
var errorKeys = [
|
|
1576
|
+
"stack",
|
|
1577
|
+
"line",
|
|
1578
|
+
"column",
|
|
1579
|
+
"name",
|
|
1580
|
+
"message",
|
|
1581
|
+
"fileName",
|
|
1582
|
+
"lineNumber",
|
|
1583
|
+
"columnNumber",
|
|
1584
|
+
"number",
|
|
1585
|
+
"description",
|
|
1586
|
+
"cause"
|
|
1587
|
+
];
|
|
1588
|
+
function inspectObject(error, options) {
|
|
1589
|
+
const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1);
|
|
1590
|
+
const name = error.name;
|
|
1591
|
+
options.truncate -= name.length;
|
|
1592
|
+
let message = "";
|
|
1593
|
+
if (typeof error.message === "string") {
|
|
1594
|
+
message = truncate(error.message, options.truncate);
|
|
1595
|
+
} else {
|
|
1596
|
+
properties.unshift("message");
|
|
1597
|
+
}
|
|
1598
|
+
message = message ? `: ${message}` : "";
|
|
1599
|
+
options.truncate -= message.length + 5;
|
|
1600
|
+
options.seen = options.seen || [];
|
|
1601
|
+
if (options.seen.includes(error)) {
|
|
1602
|
+
return "[Circular]";
|
|
1603
|
+
}
|
|
1604
|
+
options.seen.push(error);
|
|
1605
|
+
const propertyContents = inspectList(properties.map((key) => [key, error[key]]), options, inspectProperty);
|
|
1606
|
+
return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`;
|
|
1607
|
+
}
|
|
1608
|
+
function inspectAttribute([key, value], options) {
|
|
1609
|
+
options.truncate -= 3;
|
|
1610
|
+
if (!value) {
|
|
1611
|
+
return `${options.stylize(String(key), "yellow")}`;
|
|
1612
|
+
}
|
|
1613
|
+
return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
|
|
1614
|
+
}
|
|
1615
|
+
function inspectNodeCollection(collection, options) {
|
|
1616
|
+
return inspectList(collection, options, inspectNode, "\n");
|
|
1617
|
+
}
|
|
1618
|
+
function inspectNode(node, options) {
|
|
1619
|
+
switch (node.nodeType) {
|
|
1620
|
+
case 1:
|
|
1621
|
+
return inspectHTML(node, options);
|
|
1622
|
+
case 3:
|
|
1623
|
+
return options.inspect(node.data, options);
|
|
1624
|
+
default:
|
|
1625
|
+
return options.inspect(node, options);
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
function inspectHTML(element, options) {
|
|
1629
|
+
const properties = element.getAttributeNames();
|
|
1630
|
+
const name = element.tagName.toLowerCase();
|
|
1631
|
+
const head = options.stylize(`<${name}`, "special");
|
|
1632
|
+
const headClose = options.stylize(`>`, "special");
|
|
1633
|
+
const tail = options.stylize(`</${name}>`, "special");
|
|
1634
|
+
options.truncate -= name.length * 2 + 5;
|
|
1635
|
+
let propertyContents = "";
|
|
1636
|
+
if (properties.length > 0) {
|
|
1637
|
+
propertyContents += " ";
|
|
1638
|
+
propertyContents += inspectList(properties.map((key) => [key, element.getAttribute(key)]), options, inspectAttribute, " ");
|
|
1639
|
+
}
|
|
1640
|
+
options.truncate -= propertyContents.length;
|
|
1641
|
+
const truncate2 = options.truncate;
|
|
1642
|
+
let children = inspectNodeCollection(element.children, options);
|
|
1643
|
+
if (children && children.length > truncate2) {
|
|
1644
|
+
children = `${truncator}(${element.children.length})`;
|
|
1645
|
+
}
|
|
1646
|
+
return `${head}${propertyContents}${headClose}${children}${tail}`;
|
|
1647
|
+
}
|
|
1648
|
+
var symbolsSupported = typeof Symbol === "function" && typeof Symbol.for === "function";
|
|
1649
|
+
var chaiInspect = symbolsSupported ? /* @__PURE__ */ Symbol.for("chai/inspect") : "@@chai/inspect";
|
|
1650
|
+
var nodeInspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
1651
|
+
var constructorMap = /* @__PURE__ */ new WeakMap();
|
|
1652
|
+
var stringTagMap = {};
|
|
1653
|
+
var baseTypesMap = {
|
|
1654
|
+
undefined: (value, options) => options.stylize("undefined", "undefined"),
|
|
1655
|
+
null: (value, options) => options.stylize("null", "null"),
|
|
1656
|
+
boolean: (value, options) => options.stylize(String(value), "boolean"),
|
|
1657
|
+
Boolean: (value, options) => options.stylize(String(value), "boolean"),
|
|
1658
|
+
number: inspectNumber,
|
|
1659
|
+
Number: inspectNumber,
|
|
1660
|
+
bigint: inspectBigInt,
|
|
1661
|
+
BigInt: inspectBigInt,
|
|
1662
|
+
string: inspectString,
|
|
1663
|
+
String: inspectString,
|
|
1664
|
+
function: inspectFunction,
|
|
1665
|
+
Function: inspectFunction,
|
|
1666
|
+
symbol: inspectSymbol,
|
|
1667
|
+
// A Symbol polyfill will return `Symbol` not `symbol` from typedetect
|
|
1668
|
+
Symbol: inspectSymbol,
|
|
1669
|
+
Array: inspectArray,
|
|
1670
|
+
Date: inspectDate,
|
|
1671
|
+
Map: inspectMap,
|
|
1672
|
+
Set: inspectSet,
|
|
1673
|
+
RegExp: inspectRegExp,
|
|
1674
|
+
Promise: getPromiseValue,
|
|
1675
|
+
// WeakSet, WeakMap are totally opaque to us
|
|
1676
|
+
WeakSet: (value, options) => options.stylize("WeakSet{\u2026}", "special"),
|
|
1677
|
+
WeakMap: (value, options) => options.stylize("WeakMap{\u2026}", "special"),
|
|
1678
|
+
Arguments: inspectArguments,
|
|
1679
|
+
Int8Array: inspectTypedArray,
|
|
1680
|
+
Uint8Array: inspectTypedArray,
|
|
1681
|
+
Uint8ClampedArray: inspectTypedArray,
|
|
1682
|
+
Int16Array: inspectTypedArray,
|
|
1683
|
+
Uint16Array: inspectTypedArray,
|
|
1684
|
+
Int32Array: inspectTypedArray,
|
|
1685
|
+
Uint32Array: inspectTypedArray,
|
|
1686
|
+
Float32Array: inspectTypedArray,
|
|
1687
|
+
Float64Array: inspectTypedArray,
|
|
1688
|
+
Generator: () => "",
|
|
1689
|
+
DataView: () => "",
|
|
1690
|
+
ArrayBuffer: () => "",
|
|
1691
|
+
Error: inspectObject,
|
|
1692
|
+
HTMLCollection: inspectNodeCollection,
|
|
1693
|
+
NodeList: inspectNodeCollection
|
|
1694
|
+
};
|
|
1695
|
+
var inspectCustom = (value, options, type, inspectFn) => {
|
|
1696
|
+
if (chaiInspect in value && typeof value[chaiInspect] === "function") {
|
|
1697
|
+
return value[chaiInspect](options);
|
|
1698
|
+
}
|
|
1699
|
+
if (nodeInspect in value && typeof value[nodeInspect] === "function") {
|
|
1700
|
+
return value[nodeInspect](options.depth, options, inspectFn);
|
|
1701
|
+
}
|
|
1702
|
+
if ("inspect" in value && typeof value.inspect === "function") {
|
|
1703
|
+
return value.inspect(options.depth, options);
|
|
1704
|
+
}
|
|
1705
|
+
if ("constructor" in value && constructorMap.has(value.constructor)) {
|
|
1706
|
+
return constructorMap.get(value.constructor)(value, options);
|
|
1707
|
+
}
|
|
1708
|
+
if (stringTagMap[type]) {
|
|
1709
|
+
return stringTagMap[type](value, options);
|
|
1710
|
+
}
|
|
1711
|
+
return "";
|
|
1712
|
+
};
|
|
1713
|
+
var toString2 = Object.prototype.toString;
|
|
1714
|
+
function inspect$1(value, opts = {}) {
|
|
1715
|
+
const options = normaliseOptions(opts, inspect$1);
|
|
1716
|
+
const { customInspect } = options;
|
|
1717
|
+
let type = value === null ? "null" : typeof value;
|
|
1718
|
+
if (type === "object") {
|
|
1719
|
+
type = toString2.call(value).slice(8, -1);
|
|
1720
|
+
}
|
|
1721
|
+
if (type in baseTypesMap) {
|
|
1722
|
+
return baseTypesMap[type](value, options);
|
|
1723
|
+
}
|
|
1724
|
+
if (customInspect && value) {
|
|
1725
|
+
const output = inspectCustom(value, options, type, inspect$1);
|
|
1726
|
+
if (output) {
|
|
1727
|
+
if (typeof output === "string")
|
|
1728
|
+
return output;
|
|
1729
|
+
return inspect$1(output, options);
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
const proto = value ? Object.getPrototypeOf(value) : false;
|
|
1733
|
+
if (proto === Object.prototype || proto === null) {
|
|
1734
|
+
return inspectObject$1(value, options);
|
|
1735
|
+
}
|
|
1736
|
+
if (value && typeof HTMLElement === "function" && value instanceof HTMLElement) {
|
|
1737
|
+
return inspectHTML(value, options);
|
|
1738
|
+
}
|
|
1739
|
+
if ("constructor" in value) {
|
|
1740
|
+
if (value.constructor !== Object) {
|
|
1741
|
+
return inspectClass(value, options);
|
|
1742
|
+
}
|
|
1743
|
+
return inspectObject$1(value, options);
|
|
1744
|
+
}
|
|
1745
|
+
if (value === Object(value)) {
|
|
1746
|
+
return inspectObject$1(value, options);
|
|
1747
|
+
}
|
|
1748
|
+
return options.stylize(String(value), type);
|
|
1749
|
+
}
|
|
1750
|
+
var { AsymmetricMatcher, DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent } = plugins;
|
|
1751
|
+
var PLUGINS = [
|
|
1752
|
+
ReactTestComponent,
|
|
1753
|
+
ReactElement,
|
|
1754
|
+
DOMElement,
|
|
1755
|
+
DOMCollection,
|
|
1756
|
+
Immutable,
|
|
1757
|
+
AsymmetricMatcher
|
|
1758
|
+
];
|
|
1759
|
+
function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) {
|
|
1760
|
+
const MAX_LENGTH = maxLength ?? 1e4;
|
|
1761
|
+
let result;
|
|
1762
|
+
try {
|
|
1763
|
+
result = format(object, {
|
|
1764
|
+
maxDepth,
|
|
1765
|
+
escapeString: false,
|
|
1766
|
+
plugins: PLUGINS,
|
|
1767
|
+
...options
|
|
1768
|
+
});
|
|
1769
|
+
} catch {
|
|
1770
|
+
result = format(object, {
|
|
1771
|
+
callToJSON: false,
|
|
1772
|
+
maxDepth,
|
|
1773
|
+
escapeString: false,
|
|
1774
|
+
plugins: PLUGINS,
|
|
1775
|
+
...options
|
|
1776
|
+
});
|
|
1777
|
+
}
|
|
1778
|
+
return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(Math.min(maxDepth, Number.MAX_SAFE_INTEGER) / 2), {
|
|
1779
|
+
maxLength,
|
|
1780
|
+
...options
|
|
1781
|
+
}) : result;
|
|
1782
|
+
}
|
|
1783
|
+
var formatRegExp = /%[sdjifoOc%]/g;
|
|
1784
|
+
function baseFormat(args, options = {}) {
|
|
1785
|
+
const formatArg = (item, inspecOptions) => {
|
|
1786
|
+
if (options.prettifyObject) {
|
|
1787
|
+
return stringify(item, void 0, {
|
|
1788
|
+
printBasicPrototype: false,
|
|
1789
|
+
escapeString: false
|
|
1790
|
+
});
|
|
1791
|
+
}
|
|
1792
|
+
return inspect(item, inspecOptions);
|
|
1793
|
+
};
|
|
1794
|
+
if (typeof args[0] !== "string") {
|
|
1795
|
+
const objects = [];
|
|
1796
|
+
for (let i4 = 0; i4 < args.length; i4++) {
|
|
1797
|
+
objects.push(formatArg(args[i4], {
|
|
1798
|
+
depth: 0,
|
|
1799
|
+
colors: false
|
|
1800
|
+
}));
|
|
1801
|
+
}
|
|
1802
|
+
return objects.join(" ");
|
|
1803
|
+
}
|
|
1804
|
+
const len = args.length;
|
|
1805
|
+
let i3 = 1;
|
|
1806
|
+
const template = args[0];
|
|
1807
|
+
let str = String(template).replace(formatRegExp, (x) => {
|
|
1808
|
+
if (x === "%%") {
|
|
1809
|
+
return "%";
|
|
1810
|
+
}
|
|
1811
|
+
if (i3 >= len) {
|
|
1812
|
+
return x;
|
|
1813
|
+
}
|
|
1814
|
+
switch (x) {
|
|
1815
|
+
case "%s": {
|
|
1816
|
+
const value = args[i3++];
|
|
1817
|
+
if (typeof value === "bigint") {
|
|
1818
|
+
return `${value.toString()}n`;
|
|
1819
|
+
}
|
|
1820
|
+
if (typeof value === "number" && value === 0 && 1 / value < 0) {
|
|
1821
|
+
return "-0";
|
|
1822
|
+
}
|
|
1823
|
+
if (typeof value === "object" && value !== null) {
|
|
1824
|
+
if (typeof value.toString === "function" && value.toString !== Object.prototype.toString) {
|
|
1825
|
+
return value.toString();
|
|
1826
|
+
}
|
|
1827
|
+
return formatArg(value, {
|
|
1828
|
+
depth: 0,
|
|
1829
|
+
colors: false
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1832
|
+
return String(value);
|
|
1833
|
+
}
|
|
1834
|
+
case "%d": {
|
|
1835
|
+
const value = args[i3++];
|
|
1836
|
+
if (typeof value === "bigint") {
|
|
1837
|
+
return `${value.toString()}n`;
|
|
1838
|
+
}
|
|
1839
|
+
return Number(value).toString();
|
|
1840
|
+
}
|
|
1841
|
+
case "%i": {
|
|
1842
|
+
const value = args[i3++];
|
|
1843
|
+
if (typeof value === "bigint") {
|
|
1844
|
+
return `${value.toString()}n`;
|
|
1845
|
+
}
|
|
1846
|
+
return Number.parseInt(String(value)).toString();
|
|
1847
|
+
}
|
|
1848
|
+
case "%f":
|
|
1849
|
+
return Number.parseFloat(String(args[i3++])).toString();
|
|
1850
|
+
case "%o":
|
|
1851
|
+
return formatArg(args[i3++], {
|
|
1852
|
+
showHidden: true,
|
|
1853
|
+
showProxy: true
|
|
1854
|
+
});
|
|
1855
|
+
case "%O":
|
|
1856
|
+
return formatArg(args[i3++]);
|
|
1857
|
+
case "%c": {
|
|
1858
|
+
i3++;
|
|
1859
|
+
return "";
|
|
1860
|
+
}
|
|
1861
|
+
case "%j":
|
|
1862
|
+
try {
|
|
1863
|
+
return JSON.stringify(args[i3++]);
|
|
1864
|
+
} catch (err) {
|
|
1865
|
+
const m2 = err.message;
|
|
1866
|
+
if (m2.includes("circular structure") || m2.includes("cyclic structures") || m2.includes("cyclic object")) {
|
|
1867
|
+
return "[Circular]";
|
|
1868
|
+
}
|
|
1869
|
+
throw err;
|
|
1870
|
+
}
|
|
1871
|
+
default:
|
|
1872
|
+
return x;
|
|
1873
|
+
}
|
|
1874
|
+
});
|
|
1875
|
+
for (let x = args[i3]; i3 < len; x = args[++i3]) {
|
|
1876
|
+
if (x === null || typeof x !== "object") {
|
|
1877
|
+
str += ` ${x}`;
|
|
1878
|
+
} else {
|
|
1879
|
+
str += ` ${formatArg(x)}`;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
return str;
|
|
1883
|
+
}
|
|
1884
|
+
function format2(...args) {
|
|
1885
|
+
return baseFormat(args);
|
|
1886
|
+
}
|
|
1887
|
+
function inspect(obj, options = {}) {
|
|
1888
|
+
if (options.truncate === 0) {
|
|
1889
|
+
options.truncate = Number.POSITIVE_INFINITY;
|
|
1890
|
+
}
|
|
1891
|
+
return inspect$1(obj, options);
|
|
1892
|
+
}
|
|
1893
|
+
function objDisplay(obj, options = {}) {
|
|
1894
|
+
if (typeof options.truncate === "undefined") {
|
|
1895
|
+
options.truncate = 40;
|
|
1896
|
+
}
|
|
1897
|
+
const str = inspect(obj, options);
|
|
1898
|
+
const type = Object.prototype.toString.call(obj);
|
|
1899
|
+
if (options.truncate && str.length >= options.truncate) {
|
|
1900
|
+
if (type === "[object Function]") {
|
|
1901
|
+
const fn = obj;
|
|
1902
|
+
return !fn.name ? "[Function]" : `[Function: ${fn.name}]`;
|
|
1903
|
+
} else if (type === "[object Array]") {
|
|
1904
|
+
return `[ Array(${obj.length}) ]`;
|
|
1905
|
+
} else if (type === "[object Object]") {
|
|
1906
|
+
const keys = Object.keys(obj);
|
|
1907
|
+
const kstr = keys.length > 2 ? `${keys.splice(0, 2).join(", ")}, ...` : keys.join(", ");
|
|
1908
|
+
return `{ Object (${kstr}) }`;
|
|
1909
|
+
} else {
|
|
1910
|
+
return str;
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
return str;
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
// ../../node_modules/.pnpm/@vitest+runner@4.0.16/node_modules/@vitest/runner/dist/index.js
|
|
1917
|
+
import { c as createChainable, e as createTaskName, f as findTestFileStackTrace, b as createFileTask, a as calculateSuiteHash, s as someTasksAreOnly, i as interpretTaskModes, l as limitConcurrency, p as partitionSuiteChildren, r as hasTests, q as hasFailed } from "./chunk-tasks.js.mjs";
|
|
1918
|
+
var PendingError = class extends Error {
|
|
1919
|
+
code = "VITEST_PENDING";
|
|
1920
|
+
taskId;
|
|
1921
|
+
constructor(message, task, note) {
|
|
1922
|
+
super(message);
|
|
1923
|
+
this.message = message;
|
|
1924
|
+
this.note = note;
|
|
1925
|
+
this.taskId = task.id;
|
|
1926
|
+
}
|
|
1927
|
+
};
|
|
1928
|
+
var fnMap = /* @__PURE__ */ new WeakMap();
|
|
1929
|
+
var testFixtureMap = /* @__PURE__ */ new WeakMap();
|
|
1930
|
+
var hooksMap = /* @__PURE__ */ new WeakMap();
|
|
1931
|
+
function setFn(key, fn) {
|
|
1932
|
+
fnMap.set(key, fn);
|
|
1933
|
+
}
|
|
1934
|
+
function setTestFixture(key, fixture) {
|
|
1935
|
+
testFixtureMap.set(key, fixture);
|
|
1936
|
+
}
|
|
1937
|
+
function getTestFixture(key) {
|
|
1938
|
+
return testFixtureMap.get(key);
|
|
1939
|
+
}
|
|
1940
|
+
function setHooks(key, hooks) {
|
|
1941
|
+
hooksMap.set(key, hooks);
|
|
1942
|
+
}
|
|
1943
|
+
function getHooks(key) {
|
|
1944
|
+
return hooksMap.get(key);
|
|
1945
|
+
}
|
|
1946
|
+
function mergeScopedFixtures(testFixtures, scopedFixtures) {
|
|
1947
|
+
const scopedFixturesMap = scopedFixtures.reduce((map, fixture) => {
|
|
1948
|
+
map[fixture.prop] = fixture;
|
|
1949
|
+
return map;
|
|
1950
|
+
}, {});
|
|
1951
|
+
const newFixtures = {};
|
|
1952
|
+
testFixtures.forEach((fixture) => {
|
|
1953
|
+
const useFixture = scopedFixturesMap[fixture.prop] || { ...fixture };
|
|
1954
|
+
newFixtures[useFixture.prop] = useFixture;
|
|
1955
|
+
});
|
|
1956
|
+
for (const fixtureKep in newFixtures) {
|
|
1957
|
+
var _fixture$deps;
|
|
1958
|
+
const fixture = newFixtures[fixtureKep];
|
|
1959
|
+
fixture.deps = (_fixture$deps = fixture.deps) === null || _fixture$deps === void 0 ? void 0 : _fixture$deps.map((dep) => newFixtures[dep.prop]);
|
|
1960
|
+
}
|
|
1961
|
+
return Object.values(newFixtures);
|
|
1962
|
+
}
|
|
1963
|
+
function mergeContextFixtures(fixtures, context, runner2) {
|
|
1964
|
+
const fixtureOptionKeys = [
|
|
1965
|
+
"auto",
|
|
1966
|
+
"injected",
|
|
1967
|
+
"scope"
|
|
1968
|
+
];
|
|
1969
|
+
const fixtureArray = Object.entries(fixtures).map(([prop, value]) => {
|
|
1970
|
+
const fixtureItem = { value };
|
|
1971
|
+
if (Array.isArray(value) && value.length >= 2 && isObject(value[1]) && Object.keys(value[1]).some((key) => fixtureOptionKeys.includes(key))) {
|
|
1972
|
+
var _runner$injectValue;
|
|
1973
|
+
Object.assign(fixtureItem, value[1]);
|
|
1974
|
+
const userValue = value[0];
|
|
1975
|
+
fixtureItem.value = fixtureItem.injected ? ((_runner$injectValue = runner2.injectValue) === null || _runner$injectValue === void 0 ? void 0 : _runner$injectValue.call(runner2, prop)) ?? userValue : userValue;
|
|
1976
|
+
}
|
|
1977
|
+
fixtureItem.scope = fixtureItem.scope || "test";
|
|
1978
|
+
if (fixtureItem.scope === "worker" && !runner2.getWorkerContext) {
|
|
1979
|
+
fixtureItem.scope = "file";
|
|
1980
|
+
}
|
|
1981
|
+
fixtureItem.prop = prop;
|
|
1982
|
+
fixtureItem.isFn = typeof fixtureItem.value === "function";
|
|
1983
|
+
return fixtureItem;
|
|
1984
|
+
});
|
|
1985
|
+
if (Array.isArray(context.fixtures)) {
|
|
1986
|
+
context.fixtures = context.fixtures.concat(fixtureArray);
|
|
1987
|
+
} else {
|
|
1988
|
+
context.fixtures = fixtureArray;
|
|
1989
|
+
}
|
|
1990
|
+
fixtureArray.forEach((fixture) => {
|
|
1991
|
+
if (fixture.isFn) {
|
|
1992
|
+
const usedProps = getUsedProps(fixture.value);
|
|
1993
|
+
if (usedProps.length) {
|
|
1994
|
+
fixture.deps = context.fixtures.filter(({ prop }) => prop !== fixture.prop && usedProps.includes(prop));
|
|
1995
|
+
}
|
|
1996
|
+
if (fixture.scope !== "test") {
|
|
1997
|
+
var _fixture$deps2;
|
|
1998
|
+
(_fixture$deps2 = fixture.deps) === null || _fixture$deps2 === void 0 ? void 0 : _fixture$deps2.forEach((dep) => {
|
|
1999
|
+
if (!dep.isFn) {
|
|
2000
|
+
return;
|
|
2001
|
+
}
|
|
2002
|
+
if (fixture.scope === "worker" && dep.scope === "worker") {
|
|
2003
|
+
return;
|
|
2004
|
+
}
|
|
2005
|
+
if (fixture.scope === "file" && dep.scope !== "test") {
|
|
2006
|
+
return;
|
|
2007
|
+
}
|
|
2008
|
+
throw new SyntaxError(`cannot use the ${dep.scope} fixture "${dep.prop}" inside the ${fixture.scope} fixture "${fixture.prop}"`);
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
});
|
|
2013
|
+
return context;
|
|
2014
|
+
}
|
|
2015
|
+
var fixtureValueMaps = /* @__PURE__ */ new Map();
|
|
2016
|
+
var cleanupFnArrayMap = /* @__PURE__ */ new Map();
|
|
2017
|
+
function withFixtures(runner2, fn, testContext) {
|
|
2018
|
+
return (hookContext) => {
|
|
2019
|
+
const context = hookContext || testContext;
|
|
2020
|
+
if (!context) {
|
|
2021
|
+
return fn({});
|
|
2022
|
+
}
|
|
2023
|
+
const fixtures = getTestFixture(context);
|
|
2024
|
+
if (!(fixtures === null || fixtures === void 0 ? void 0 : fixtures.length)) {
|
|
2025
|
+
return fn(context);
|
|
2026
|
+
}
|
|
2027
|
+
const usedProps = getUsedProps(fn);
|
|
2028
|
+
const hasAutoFixture = fixtures.some(({ auto }) => auto);
|
|
2029
|
+
if (!usedProps.length && !hasAutoFixture) {
|
|
2030
|
+
return fn(context);
|
|
2031
|
+
}
|
|
2032
|
+
if (!fixtureValueMaps.get(context)) {
|
|
2033
|
+
fixtureValueMaps.set(context, /* @__PURE__ */ new Map());
|
|
2034
|
+
}
|
|
2035
|
+
const fixtureValueMap = fixtureValueMaps.get(context);
|
|
2036
|
+
if (!cleanupFnArrayMap.has(context)) {
|
|
2037
|
+
cleanupFnArrayMap.set(context, []);
|
|
2038
|
+
}
|
|
2039
|
+
const cleanupFnArray = cleanupFnArrayMap.get(context);
|
|
2040
|
+
const usedFixtures = fixtures.filter(({ prop, auto }) => auto || usedProps.includes(prop));
|
|
2041
|
+
const pendingFixtures = resolveDeps(usedFixtures);
|
|
2042
|
+
if (!pendingFixtures.length) {
|
|
2043
|
+
return fn(context);
|
|
2044
|
+
}
|
|
2045
|
+
async function resolveFixtures() {
|
|
2046
|
+
for (const fixture of pendingFixtures) {
|
|
2047
|
+
if (fixtureValueMap.has(fixture)) {
|
|
2048
|
+
continue;
|
|
2049
|
+
}
|
|
2050
|
+
const resolvedValue = await resolveFixtureValue(runner2, fixture, context, cleanupFnArray);
|
|
2051
|
+
context[fixture.prop] = resolvedValue;
|
|
2052
|
+
fixtureValueMap.set(fixture, resolvedValue);
|
|
2053
|
+
if (fixture.scope === "test") {
|
|
2054
|
+
cleanupFnArray.unshift(() => {
|
|
2055
|
+
fixtureValueMap.delete(fixture);
|
|
2056
|
+
});
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
return resolveFixtures().then(() => fn(context));
|
|
2061
|
+
};
|
|
2062
|
+
}
|
|
2063
|
+
var globalFixturePromise = /* @__PURE__ */ new WeakMap();
|
|
2064
|
+
function resolveFixtureValue(runner2, fixture, context, cleanupFnArray) {
|
|
2065
|
+
var _runner$getWorkerCont;
|
|
2066
|
+
const fileContext = getFileContext(context.task.file);
|
|
2067
|
+
const workerContext = (_runner$getWorkerCont = runner2.getWorkerContext) === null || _runner$getWorkerCont === void 0 ? void 0 : _runner$getWorkerCont.call(runner2);
|
|
2068
|
+
if (!fixture.isFn) {
|
|
2069
|
+
var _fixture$prop;
|
|
2070
|
+
fileContext[_fixture$prop = fixture.prop] ?? (fileContext[_fixture$prop] = fixture.value);
|
|
2071
|
+
if (workerContext) {
|
|
2072
|
+
var _fixture$prop2;
|
|
2073
|
+
workerContext[_fixture$prop2 = fixture.prop] ?? (workerContext[_fixture$prop2] = fixture.value);
|
|
2074
|
+
}
|
|
2075
|
+
return fixture.value;
|
|
2076
|
+
}
|
|
2077
|
+
if (fixture.scope === "test") {
|
|
2078
|
+
return resolveFixtureFunction(fixture.value, context, cleanupFnArray);
|
|
2079
|
+
}
|
|
2080
|
+
if (globalFixturePromise.has(fixture)) {
|
|
2081
|
+
return globalFixturePromise.get(fixture);
|
|
2082
|
+
}
|
|
2083
|
+
let fixtureContext;
|
|
2084
|
+
if (fixture.scope === "worker") {
|
|
2085
|
+
if (!workerContext) {
|
|
2086
|
+
throw new TypeError("[@vitest/runner] The worker context is not available in the current test runner. Please, provide the `getWorkerContext` method when initiating the runner.");
|
|
2087
|
+
}
|
|
2088
|
+
fixtureContext = workerContext;
|
|
2089
|
+
} else {
|
|
2090
|
+
fixtureContext = fileContext;
|
|
2091
|
+
}
|
|
2092
|
+
if (fixture.prop in fixtureContext) {
|
|
2093
|
+
return fixtureContext[fixture.prop];
|
|
2094
|
+
}
|
|
2095
|
+
if (!cleanupFnArrayMap.has(fixtureContext)) {
|
|
2096
|
+
cleanupFnArrayMap.set(fixtureContext, []);
|
|
2097
|
+
}
|
|
2098
|
+
const cleanupFnFileArray = cleanupFnArrayMap.get(fixtureContext);
|
|
2099
|
+
const promise = resolveFixtureFunction(fixture.value, fixtureContext, cleanupFnFileArray).then((value) => {
|
|
2100
|
+
fixtureContext[fixture.prop] = value;
|
|
2101
|
+
globalFixturePromise.delete(fixture);
|
|
2102
|
+
return value;
|
|
2103
|
+
});
|
|
2104
|
+
globalFixturePromise.set(fixture, promise);
|
|
2105
|
+
return promise;
|
|
2106
|
+
}
|
|
2107
|
+
async function resolveFixtureFunction(fixtureFn, context, cleanupFnArray) {
|
|
2108
|
+
const useFnArgPromise = createDefer();
|
|
2109
|
+
let isUseFnArgResolved = false;
|
|
2110
|
+
const fixtureReturn = fixtureFn(context, async (useFnArg) => {
|
|
2111
|
+
isUseFnArgResolved = true;
|
|
2112
|
+
useFnArgPromise.resolve(useFnArg);
|
|
2113
|
+
const useReturnPromise = createDefer();
|
|
2114
|
+
cleanupFnArray.push(async () => {
|
|
2115
|
+
useReturnPromise.resolve();
|
|
2116
|
+
await fixtureReturn;
|
|
2117
|
+
});
|
|
2118
|
+
await useReturnPromise;
|
|
2119
|
+
}).catch((e2) => {
|
|
2120
|
+
if (!isUseFnArgResolved) {
|
|
2121
|
+
useFnArgPromise.reject(e2);
|
|
2122
|
+
return;
|
|
2123
|
+
}
|
|
2124
|
+
throw e2;
|
|
2125
|
+
});
|
|
2126
|
+
return useFnArgPromise;
|
|
2127
|
+
}
|
|
2128
|
+
function resolveDeps(fixtures, depSet = /* @__PURE__ */ new Set(), pendingFixtures = []) {
|
|
2129
|
+
fixtures.forEach((fixture) => {
|
|
2130
|
+
if (pendingFixtures.includes(fixture)) {
|
|
2131
|
+
return;
|
|
2132
|
+
}
|
|
2133
|
+
if (!fixture.isFn || !fixture.deps) {
|
|
2134
|
+
pendingFixtures.push(fixture);
|
|
2135
|
+
return;
|
|
2136
|
+
}
|
|
2137
|
+
if (depSet.has(fixture)) {
|
|
2138
|
+
throw new Error(`Circular fixture dependency detected: ${fixture.prop} <- ${[...depSet].reverse().map((d4) => d4.prop).join(" <- ")}`);
|
|
2139
|
+
}
|
|
2140
|
+
depSet.add(fixture);
|
|
2141
|
+
resolveDeps(fixture.deps, depSet, pendingFixtures);
|
|
2142
|
+
pendingFixtures.push(fixture);
|
|
2143
|
+
depSet.clear();
|
|
2144
|
+
});
|
|
2145
|
+
return pendingFixtures;
|
|
2146
|
+
}
|
|
2147
|
+
function getUsedProps(fn) {
|
|
2148
|
+
let fnString = filterOutComments(fn.toString());
|
|
2149
|
+
if (/__async\((?:this|null), (?:null|arguments|\[[_0-9, ]*\]), function\*/.test(fnString)) {
|
|
2150
|
+
fnString = fnString.split(/__async\((?:this|null),/)[1];
|
|
2151
|
+
}
|
|
2152
|
+
const match = fnString.match(/[^(]*\(([^)]*)/);
|
|
2153
|
+
if (!match) {
|
|
2154
|
+
return [];
|
|
2155
|
+
}
|
|
2156
|
+
const args = splitByComma(match[1]);
|
|
2157
|
+
if (!args.length) {
|
|
2158
|
+
return [];
|
|
2159
|
+
}
|
|
2160
|
+
let first = args[0];
|
|
2161
|
+
if ("__VITEST_FIXTURE_INDEX__" in fn) {
|
|
2162
|
+
first = args[fn.__VITEST_FIXTURE_INDEX__];
|
|
2163
|
+
if (!first) {
|
|
2164
|
+
return [];
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
if (!(first[0] === "{" && first.endsWith("}"))) {
|
|
2168
|
+
throw new Error(`The first argument inside a fixture must use object destructuring pattern, e.g. ({ test } => {}). Instead, received "${first}".`);
|
|
2169
|
+
}
|
|
2170
|
+
const _first = first.slice(1, -1).replace(/\s/g, "");
|
|
2171
|
+
const props = splitByComma(_first).map((prop) => {
|
|
2172
|
+
return prop.replace(/:.*|=.*/g, "");
|
|
2173
|
+
});
|
|
2174
|
+
const last = props.at(-1);
|
|
2175
|
+
if (last && last.startsWith("...")) {
|
|
2176
|
+
throw new Error(`Rest parameters are not supported in fixtures, received "${last}".`);
|
|
2177
|
+
}
|
|
2178
|
+
return props;
|
|
2179
|
+
}
|
|
2180
|
+
function filterOutComments(s3) {
|
|
2181
|
+
const result = [];
|
|
2182
|
+
let commentState = "none";
|
|
2183
|
+
for (let i3 = 0; i3 < s3.length; ++i3) {
|
|
2184
|
+
if (commentState === "singleline") {
|
|
2185
|
+
if (s3[i3] === "\n") {
|
|
2186
|
+
commentState = "none";
|
|
2187
|
+
}
|
|
2188
|
+
} else if (commentState === "multiline") {
|
|
2189
|
+
if (s3[i3 - 1] === "*" && s3[i3] === "/") {
|
|
2190
|
+
commentState = "none";
|
|
2191
|
+
}
|
|
2192
|
+
} else if (commentState === "none") {
|
|
2193
|
+
if (s3[i3] === "/" && s3[i3 + 1] === "/") {
|
|
2194
|
+
commentState = "singleline";
|
|
2195
|
+
} else if (s3[i3] === "/" && s3[i3 + 1] === "*") {
|
|
2196
|
+
commentState = "multiline";
|
|
2197
|
+
i3 += 2;
|
|
2198
|
+
} else {
|
|
2199
|
+
result.push(s3[i3]);
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
return result.join("");
|
|
2204
|
+
}
|
|
2205
|
+
function splitByComma(s3) {
|
|
2206
|
+
const result = [];
|
|
2207
|
+
const stack = [];
|
|
2208
|
+
let start = 0;
|
|
2209
|
+
for (let i3 = 0; i3 < s3.length; i3++) {
|
|
2210
|
+
if (s3[i3] === "{" || s3[i3] === "[") {
|
|
2211
|
+
stack.push(s3[i3] === "{" ? "}" : "]");
|
|
2212
|
+
} else if (s3[i3] === stack.at(-1)) {
|
|
2213
|
+
stack.pop();
|
|
2214
|
+
} else if (!stack.length && s3[i3] === ",") {
|
|
2215
|
+
const token = s3.substring(start, i3).trim();
|
|
2216
|
+
if (token) {
|
|
2217
|
+
result.push(token);
|
|
2218
|
+
}
|
|
2219
|
+
start = i3 + 1;
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
const lastToken = s3.substring(start).trim();
|
|
2223
|
+
if (lastToken) {
|
|
2224
|
+
result.push(lastToken);
|
|
2225
|
+
}
|
|
2226
|
+
return result;
|
|
2227
|
+
}
|
|
2228
|
+
var _test;
|
|
2229
|
+
function getCurrentTest() {
|
|
2230
|
+
return _test;
|
|
2231
|
+
}
|
|
2232
|
+
function getDefaultHookTimeout() {
|
|
2233
|
+
return getRunner().config.hookTimeout;
|
|
2234
|
+
}
|
|
2235
|
+
var CLEANUP_TIMEOUT_KEY = /* @__PURE__ */ Symbol.for("VITEST_CLEANUP_TIMEOUT");
|
|
2236
|
+
var CLEANUP_STACK_TRACE_KEY = /* @__PURE__ */ Symbol.for("VITEST_CLEANUP_STACK_TRACE");
|
|
2237
|
+
function beforeAll(fn, timeout = getDefaultHookTimeout()) {
|
|
2238
|
+
assertTypes(fn, '"beforeAll" callback', ["function"]);
|
|
2239
|
+
const stackTraceError = new Error("STACK_TRACE_ERROR");
|
|
2240
|
+
return getCurrentSuite().on("beforeAll", Object.assign(withTimeout(fn, timeout, true, stackTraceError), {
|
|
2241
|
+
[CLEANUP_TIMEOUT_KEY]: timeout,
|
|
2242
|
+
[CLEANUP_STACK_TRACE_KEY]: stackTraceError
|
|
2243
|
+
}));
|
|
2244
|
+
}
|
|
2245
|
+
function afterAll(fn, timeout) {
|
|
2246
|
+
assertTypes(fn, '"afterAll" callback', ["function"]);
|
|
2247
|
+
return getCurrentSuite().on("afterAll", withTimeout(fn, timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR")));
|
|
2248
|
+
}
|
|
2249
|
+
function beforeEach(fn, timeout = getDefaultHookTimeout()) {
|
|
2250
|
+
assertTypes(fn, '"beforeEach" callback', ["function"]);
|
|
2251
|
+
const stackTraceError = new Error("STACK_TRACE_ERROR");
|
|
2252
|
+
const runner2 = getRunner();
|
|
2253
|
+
return getCurrentSuite().on("beforeEach", Object.assign(withTimeout(withFixtures(runner2, fn), timeout ?? getDefaultHookTimeout(), true, stackTraceError, abortIfTimeout), {
|
|
2254
|
+
[CLEANUP_TIMEOUT_KEY]: timeout,
|
|
2255
|
+
[CLEANUP_STACK_TRACE_KEY]: stackTraceError
|
|
2256
|
+
}));
|
|
2257
|
+
}
|
|
2258
|
+
function afterEach(fn, timeout) {
|
|
2259
|
+
assertTypes(fn, '"afterEach" callback', ["function"]);
|
|
2260
|
+
const runner2 = getRunner();
|
|
2261
|
+
return getCurrentSuite().on("afterEach", withTimeout(withFixtures(runner2, fn), timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR"), abortIfTimeout));
|
|
2262
|
+
}
|
|
2263
|
+
var onTestFailed = createTestHook("onTestFailed", (test3, handler, timeout) => {
|
|
2264
|
+
test3.onFailed || (test3.onFailed = []);
|
|
2265
|
+
test3.onFailed.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR"), abortIfTimeout));
|
|
2266
|
+
});
|
|
2267
|
+
var onTestFinished = createTestHook("onTestFinished", (test3, handler, timeout) => {
|
|
2268
|
+
test3.onFinished || (test3.onFinished = []);
|
|
2269
|
+
test3.onFinished.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR"), abortIfTimeout));
|
|
2270
|
+
});
|
|
2271
|
+
function createTestHook(name, handler) {
|
|
2272
|
+
return (fn, timeout) => {
|
|
2273
|
+
assertTypes(fn, `"${name}" callback`, ["function"]);
|
|
2274
|
+
const current = getCurrentTest();
|
|
2275
|
+
if (!current) {
|
|
2276
|
+
throw new Error(`Hook ${name}() can only be called inside a test`);
|
|
2277
|
+
}
|
|
2278
|
+
return handler(current, fn, timeout);
|
|
2279
|
+
};
|
|
2280
|
+
}
|
|
2281
|
+
var suite = createSuite();
|
|
2282
|
+
var test2 = createTest(function(name, optionsOrFn, optionsOrTest) {
|
|
2283
|
+
if (getCurrentTest()) {
|
|
2284
|
+
throw new Error('Calling the test function inside another test function is not allowed. Please put it inside "describe" or "suite" so it can be properly collected.');
|
|
2285
|
+
}
|
|
2286
|
+
getCurrentSuite().test.fn.call(this, formatName(name), optionsOrFn, optionsOrTest);
|
|
2287
|
+
});
|
|
2288
|
+
var describe = suite;
|
|
2289
|
+
var runner;
|
|
2290
|
+
var defaultSuite;
|
|
2291
|
+
var currentTestFilepath;
|
|
2292
|
+
function assert(condition, message) {
|
|
2293
|
+
if (!condition) {
|
|
2294
|
+
throw new Error(`Vitest failed to find ${message}. This is a bug in Vitest. Please, open an issue with reproduction.`);
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
function getRunner() {
|
|
2298
|
+
assert(runner, "the runner");
|
|
2299
|
+
return runner;
|
|
2300
|
+
}
|
|
2301
|
+
function getCurrentSuite() {
|
|
2302
|
+
const currentSuite = collectorContext.currentSuite || defaultSuite;
|
|
2303
|
+
assert(currentSuite, "the current suite");
|
|
2304
|
+
return currentSuite;
|
|
2305
|
+
}
|
|
2306
|
+
function createSuiteHooks() {
|
|
2307
|
+
return {
|
|
2308
|
+
beforeAll: [],
|
|
2309
|
+
afterAll: [],
|
|
2310
|
+
beforeEach: [],
|
|
2311
|
+
afterEach: []
|
|
2312
|
+
};
|
|
2313
|
+
}
|
|
2314
|
+
function parseArguments(optionsOrFn, timeoutOrTest) {
|
|
2315
|
+
if (timeoutOrTest != null && typeof timeoutOrTest === "object") {
|
|
2316
|
+
throw new TypeError(`Signature "test(name, fn, { ... })" was deprecated in Vitest 3 and removed in Vitest 4. Please, provide options as a second argument instead.`);
|
|
2317
|
+
}
|
|
2318
|
+
let options = {};
|
|
2319
|
+
let fn;
|
|
2320
|
+
if (typeof timeoutOrTest === "number") {
|
|
2321
|
+
options = { timeout: timeoutOrTest };
|
|
2322
|
+
} else if (typeof optionsOrFn === "object") {
|
|
2323
|
+
options = optionsOrFn;
|
|
2324
|
+
}
|
|
2325
|
+
if (typeof optionsOrFn === "function") {
|
|
2326
|
+
if (typeof timeoutOrTest === "function") {
|
|
2327
|
+
throw new TypeError("Cannot use two functions as arguments. Please use the second argument for options.");
|
|
2328
|
+
}
|
|
2329
|
+
fn = optionsOrFn;
|
|
2330
|
+
} else if (typeof timeoutOrTest === "function") {
|
|
2331
|
+
fn = timeoutOrTest;
|
|
2332
|
+
}
|
|
2333
|
+
return {
|
|
2334
|
+
options,
|
|
2335
|
+
handler: fn
|
|
2336
|
+
};
|
|
2337
|
+
}
|
|
2338
|
+
function createSuiteCollector(name, factory = () => {
|
|
2339
|
+
}, mode, each, suiteOptions, parentCollectorFixtures) {
|
|
2340
|
+
const tasks = [];
|
|
2341
|
+
let suite2;
|
|
2342
|
+
initSuite(true);
|
|
2343
|
+
const task = function(name2 = "", options = {}) {
|
|
2344
|
+
var _collectorContext$cur, _collectorContext$cur2, _collectorContext$cur3;
|
|
2345
|
+
const timeout = (options === null || options === void 0 ? void 0 : options.timeout) ?? runner.config.testTimeout;
|
|
2346
|
+
const currentSuite = (_collectorContext$cur = collectorContext.currentSuite) === null || _collectorContext$cur === void 0 ? void 0 : _collectorContext$cur.suite;
|
|
2347
|
+
const task2 = {
|
|
2348
|
+
id: "",
|
|
2349
|
+
name: name2,
|
|
2350
|
+
fullName: createTaskName([(currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fullName) ?? ((_collectorContext$cur2 = collectorContext.currentSuite) === null || _collectorContext$cur2 === void 0 || (_collectorContext$cur2 = _collectorContext$cur2.file) === null || _collectorContext$cur2 === void 0 ? void 0 : _collectorContext$cur2.fullName), name2]),
|
|
2351
|
+
fullTestName: createTaskName([currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fullTestName, name2]),
|
|
2352
|
+
suite: currentSuite,
|
|
2353
|
+
each: options.each,
|
|
2354
|
+
fails: options.fails,
|
|
2355
|
+
context: void 0,
|
|
2356
|
+
type: "test",
|
|
2357
|
+
file: (currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.file) ?? ((_collectorContext$cur3 = collectorContext.currentSuite) === null || _collectorContext$cur3 === void 0 ? void 0 : _collectorContext$cur3.file),
|
|
2358
|
+
timeout,
|
|
2359
|
+
retry: options.retry ?? runner.config.retry,
|
|
2360
|
+
repeats: options.repeats,
|
|
2361
|
+
mode: options.only ? "only" : options.skip ? "skip" : options.todo ? "todo" : "run",
|
|
2362
|
+
meta: options.meta ?? /* @__PURE__ */ Object.create(null),
|
|
2363
|
+
annotations: [],
|
|
2364
|
+
artifacts: []
|
|
2365
|
+
};
|
|
2366
|
+
const handler = options.handler;
|
|
2367
|
+
if (task2.mode === "run" && !handler) {
|
|
2368
|
+
task2.mode = "todo";
|
|
2369
|
+
}
|
|
2370
|
+
if (options.concurrent || !options.sequential && runner.config.sequence.concurrent) {
|
|
2371
|
+
task2.concurrent = true;
|
|
2372
|
+
}
|
|
2373
|
+
task2.shuffle = suiteOptions === null || suiteOptions === void 0 ? void 0 : suiteOptions.shuffle;
|
|
2374
|
+
const context = createTestContext(task2, runner);
|
|
2375
|
+
Object.defineProperty(task2, "context", {
|
|
2376
|
+
value: context,
|
|
2377
|
+
enumerable: false
|
|
2378
|
+
});
|
|
2379
|
+
setTestFixture(context, options.fixtures);
|
|
2380
|
+
const limit = Error.stackTraceLimit;
|
|
2381
|
+
Error.stackTraceLimit = 15;
|
|
2382
|
+
const stackTraceError = new Error("STACK_TRACE_ERROR");
|
|
2383
|
+
Error.stackTraceLimit = limit;
|
|
2384
|
+
if (handler) {
|
|
2385
|
+
setFn(task2, withTimeout(withAwaitAsyncAssertions(withFixtures(runner, handler, context), task2), timeout, false, stackTraceError, (_, error) => abortIfTimeout([context], error)));
|
|
2386
|
+
}
|
|
2387
|
+
if (runner.config.includeTaskLocation) {
|
|
2388
|
+
const error = stackTraceError.stack;
|
|
2389
|
+
const stack = findTestFileStackTrace(currentTestFilepath, error);
|
|
2390
|
+
if (stack) {
|
|
2391
|
+
task2.location = {
|
|
2392
|
+
line: stack.line,
|
|
2393
|
+
column: stack.column
|
|
2394
|
+
};
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
tasks.push(task2);
|
|
2398
|
+
return task2;
|
|
2399
|
+
};
|
|
2400
|
+
const test3 = createTest(function(name2, optionsOrFn, timeoutOrTest) {
|
|
2401
|
+
let { options, handler } = parseArguments(optionsOrFn, timeoutOrTest);
|
|
2402
|
+
if (typeof suiteOptions === "object") {
|
|
2403
|
+
options = Object.assign({}, suiteOptions, options);
|
|
2404
|
+
}
|
|
2405
|
+
options.concurrent = this.concurrent || !this.sequential && (options === null || options === void 0 ? void 0 : options.concurrent);
|
|
2406
|
+
options.sequential = this.sequential || !this.concurrent && (options === null || options === void 0 ? void 0 : options.sequential);
|
|
2407
|
+
const test4 = task(formatName(name2), {
|
|
2408
|
+
...this,
|
|
2409
|
+
...options,
|
|
2410
|
+
handler
|
|
2411
|
+
});
|
|
2412
|
+
test4.type = "test";
|
|
2413
|
+
});
|
|
2414
|
+
let collectorFixtures = parentCollectorFixtures;
|
|
2415
|
+
const collector = {
|
|
2416
|
+
type: "collector",
|
|
2417
|
+
name,
|
|
2418
|
+
mode,
|
|
2419
|
+
suite: suite2,
|
|
2420
|
+
options: suiteOptions,
|
|
2421
|
+
test: test3,
|
|
2422
|
+
tasks,
|
|
2423
|
+
collect,
|
|
2424
|
+
task,
|
|
2425
|
+
clear,
|
|
2426
|
+
on: addHook,
|
|
2427
|
+
fixtures() {
|
|
2428
|
+
return collectorFixtures;
|
|
2429
|
+
},
|
|
2430
|
+
scoped(fixtures) {
|
|
2431
|
+
const parsed = mergeContextFixtures(fixtures, { fixtures: collectorFixtures }, runner);
|
|
2432
|
+
if (parsed.fixtures) {
|
|
2433
|
+
collectorFixtures = parsed.fixtures;
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
};
|
|
2437
|
+
function addHook(name2, ...fn) {
|
|
2438
|
+
getHooks(suite2)[name2].push(...fn);
|
|
2439
|
+
}
|
|
2440
|
+
function initSuite(includeLocation) {
|
|
2441
|
+
var _collectorContext$cur4, _collectorContext$cur5, _collectorContext$cur6;
|
|
2442
|
+
if (typeof suiteOptions === "number") {
|
|
2443
|
+
suiteOptions = { timeout: suiteOptions };
|
|
2444
|
+
}
|
|
2445
|
+
const currentSuite = (_collectorContext$cur4 = collectorContext.currentSuite) === null || _collectorContext$cur4 === void 0 ? void 0 : _collectorContext$cur4.suite;
|
|
2446
|
+
suite2 = {
|
|
2447
|
+
id: "",
|
|
2448
|
+
type: "suite",
|
|
2449
|
+
name,
|
|
2450
|
+
fullName: createTaskName([(currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fullName) ?? ((_collectorContext$cur5 = collectorContext.currentSuite) === null || _collectorContext$cur5 === void 0 || (_collectorContext$cur5 = _collectorContext$cur5.file) === null || _collectorContext$cur5 === void 0 ? void 0 : _collectorContext$cur5.fullName), name]),
|
|
2451
|
+
fullTestName: createTaskName([currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fullTestName, name]),
|
|
2452
|
+
suite: currentSuite,
|
|
2453
|
+
mode,
|
|
2454
|
+
each,
|
|
2455
|
+
file: (currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.file) ?? ((_collectorContext$cur6 = collectorContext.currentSuite) === null || _collectorContext$cur6 === void 0 ? void 0 : _collectorContext$cur6.file),
|
|
2456
|
+
shuffle: suiteOptions === null || suiteOptions === void 0 ? void 0 : suiteOptions.shuffle,
|
|
2457
|
+
tasks: [],
|
|
2458
|
+
meta: /* @__PURE__ */ Object.create(null),
|
|
2459
|
+
concurrent: suiteOptions === null || suiteOptions === void 0 ? void 0 : suiteOptions.concurrent
|
|
2460
|
+
};
|
|
2461
|
+
if (runner && includeLocation && runner.config.includeTaskLocation) {
|
|
2462
|
+
const limit = Error.stackTraceLimit;
|
|
2463
|
+
Error.stackTraceLimit = 15;
|
|
2464
|
+
const error = new Error("stacktrace").stack;
|
|
2465
|
+
Error.stackTraceLimit = limit;
|
|
2466
|
+
const stack = findTestFileStackTrace(currentTestFilepath, error);
|
|
2467
|
+
if (stack) {
|
|
2468
|
+
suite2.location = {
|
|
2469
|
+
line: stack.line,
|
|
2470
|
+
column: stack.column
|
|
2471
|
+
};
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
setHooks(suite2, createSuiteHooks());
|
|
2475
|
+
}
|
|
2476
|
+
function clear() {
|
|
2477
|
+
tasks.length = 0;
|
|
2478
|
+
initSuite(false);
|
|
2479
|
+
}
|
|
2480
|
+
async function collect(file) {
|
|
2481
|
+
if (!file) {
|
|
2482
|
+
throw new TypeError("File is required to collect tasks.");
|
|
2483
|
+
}
|
|
2484
|
+
if (factory) {
|
|
2485
|
+
await runWithSuite(collector, () => factory(test3));
|
|
2486
|
+
}
|
|
2487
|
+
const allChildren = [];
|
|
2488
|
+
for (const i3 of tasks) {
|
|
2489
|
+
allChildren.push(i3.type === "collector" ? await i3.collect(file) : i3);
|
|
2490
|
+
}
|
|
2491
|
+
suite2.tasks = allChildren;
|
|
2492
|
+
return suite2;
|
|
2493
|
+
}
|
|
2494
|
+
collectTask(collector);
|
|
2495
|
+
return collector;
|
|
2496
|
+
}
|
|
2497
|
+
function withAwaitAsyncAssertions(fn, task) {
|
|
2498
|
+
return (async (...args) => {
|
|
2499
|
+
const fnResult = await fn(...args);
|
|
2500
|
+
if (task.promises) {
|
|
2501
|
+
const result = await Promise.allSettled(task.promises);
|
|
2502
|
+
const errors = result.map((r2) => r2.status === "rejected" ? r2.reason : void 0).filter(Boolean);
|
|
2503
|
+
if (errors.length) {
|
|
2504
|
+
throw errors;
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
return fnResult;
|
|
2508
|
+
});
|
|
2509
|
+
}
|
|
2510
|
+
function createSuite() {
|
|
2511
|
+
function suiteFn(name, factoryOrOptions, optionsOrFactory) {
|
|
2512
|
+
var _currentSuite$options;
|
|
2513
|
+
if (getCurrentTest()) {
|
|
2514
|
+
throw new Error("Calling the suite function inside test function is not allowed. It can be only called at the top level or inside another suite function.");
|
|
2515
|
+
}
|
|
2516
|
+
let mode = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
|
|
2517
|
+
const currentSuite = collectorContext.currentSuite || defaultSuite;
|
|
2518
|
+
let { options, handler: factory } = parseArguments(factoryOrOptions, optionsOrFactory);
|
|
2519
|
+
if (mode === "run" && !factory) {
|
|
2520
|
+
mode = "todo";
|
|
2521
|
+
}
|
|
2522
|
+
const isConcurrentSpecified = options.concurrent || this.concurrent || options.sequential === false;
|
|
2523
|
+
const isSequentialSpecified = options.sequential || this.sequential || options.concurrent === false;
|
|
2524
|
+
options = {
|
|
2525
|
+
...currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.options,
|
|
2526
|
+
...options,
|
|
2527
|
+
shuffle: this.shuffle ?? options.shuffle ?? (currentSuite === null || currentSuite === void 0 || (_currentSuite$options = currentSuite.options) === null || _currentSuite$options === void 0 ? void 0 : _currentSuite$options.shuffle) ?? (runner === null || runner === void 0 ? void 0 : runner.config.sequence.shuffle)
|
|
2528
|
+
};
|
|
2529
|
+
const isConcurrent = isConcurrentSpecified || options.concurrent && !isSequentialSpecified;
|
|
2530
|
+
const isSequential = isSequentialSpecified || options.sequential && !isConcurrentSpecified;
|
|
2531
|
+
options.concurrent = isConcurrent && !isSequential;
|
|
2532
|
+
options.sequential = isSequential && !isConcurrent;
|
|
2533
|
+
return createSuiteCollector(formatName(name), factory, mode, this.each, options, currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fixtures());
|
|
2534
|
+
}
|
|
2535
|
+
suiteFn.each = function(cases, ...args) {
|
|
2536
|
+
const suite2 = this.withContext();
|
|
2537
|
+
this.setContext("each", true);
|
|
2538
|
+
if (Array.isArray(cases) && args.length) {
|
|
2539
|
+
cases = formatTemplateString(cases, args);
|
|
2540
|
+
}
|
|
2541
|
+
return (name, optionsOrFn, fnOrOptions) => {
|
|
2542
|
+
const _name = formatName(name);
|
|
2543
|
+
const arrayOnlyCases = cases.every(Array.isArray);
|
|
2544
|
+
const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
|
|
2545
|
+
const fnFirst = typeof optionsOrFn === "function";
|
|
2546
|
+
cases.forEach((i3, idx) => {
|
|
2547
|
+
const items = Array.isArray(i3) ? i3 : [i3];
|
|
2548
|
+
if (fnFirst) {
|
|
2549
|
+
if (arrayOnlyCases) {
|
|
2550
|
+
suite2(formatTitle(_name, items, idx), handler ? () => handler(...items) : void 0, options.timeout);
|
|
2551
|
+
} else {
|
|
2552
|
+
suite2(formatTitle(_name, items, idx), handler ? () => handler(i3) : void 0, options.timeout);
|
|
2553
|
+
}
|
|
2554
|
+
} else {
|
|
2555
|
+
if (arrayOnlyCases) {
|
|
2556
|
+
suite2(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : void 0);
|
|
2557
|
+
} else {
|
|
2558
|
+
suite2(formatTitle(_name, items, idx), options, handler ? () => handler(i3) : void 0);
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
});
|
|
2562
|
+
this.setContext("each", void 0);
|
|
2563
|
+
};
|
|
2564
|
+
};
|
|
2565
|
+
suiteFn.for = function(cases, ...args) {
|
|
2566
|
+
if (Array.isArray(cases) && args.length) {
|
|
2567
|
+
cases = formatTemplateString(cases, args);
|
|
2568
|
+
}
|
|
2569
|
+
return (name, optionsOrFn, fnOrOptions) => {
|
|
2570
|
+
const name_ = formatName(name);
|
|
2571
|
+
const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
|
|
2572
|
+
cases.forEach((item, idx) => {
|
|
2573
|
+
suite(formatTitle(name_, toArray(item), idx), options, handler ? () => handler(item) : void 0);
|
|
2574
|
+
});
|
|
2575
|
+
};
|
|
2576
|
+
};
|
|
2577
|
+
suiteFn.skipIf = (condition) => condition ? suite.skip : suite;
|
|
2578
|
+
suiteFn.runIf = (condition) => condition ? suite : suite.skip;
|
|
2579
|
+
return createChainable([
|
|
2580
|
+
"concurrent",
|
|
2581
|
+
"sequential",
|
|
2582
|
+
"shuffle",
|
|
2583
|
+
"skip",
|
|
2584
|
+
"only",
|
|
2585
|
+
"todo"
|
|
2586
|
+
], suiteFn);
|
|
2587
|
+
}
|
|
2588
|
+
function createTaskCollector(fn, context) {
|
|
2589
|
+
const taskFn = fn;
|
|
2590
|
+
taskFn.each = function(cases, ...args) {
|
|
2591
|
+
const test3 = this.withContext();
|
|
2592
|
+
this.setContext("each", true);
|
|
2593
|
+
if (Array.isArray(cases) && args.length) {
|
|
2594
|
+
cases = formatTemplateString(cases, args);
|
|
2595
|
+
}
|
|
2596
|
+
return (name, optionsOrFn, fnOrOptions) => {
|
|
2597
|
+
const _name = formatName(name);
|
|
2598
|
+
const arrayOnlyCases = cases.every(Array.isArray);
|
|
2599
|
+
const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
|
|
2600
|
+
const fnFirst = typeof optionsOrFn === "function";
|
|
2601
|
+
cases.forEach((i3, idx) => {
|
|
2602
|
+
const items = Array.isArray(i3) ? i3 : [i3];
|
|
2603
|
+
if (fnFirst) {
|
|
2604
|
+
if (arrayOnlyCases) {
|
|
2605
|
+
test3(formatTitle(_name, items, idx), handler ? () => handler(...items) : void 0, options.timeout);
|
|
2606
|
+
} else {
|
|
2607
|
+
test3(formatTitle(_name, items, idx), handler ? () => handler(i3) : void 0, options.timeout);
|
|
2608
|
+
}
|
|
2609
|
+
} else {
|
|
2610
|
+
if (arrayOnlyCases) {
|
|
2611
|
+
test3(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : void 0);
|
|
2612
|
+
} else {
|
|
2613
|
+
test3(formatTitle(_name, items, idx), options, handler ? () => handler(i3) : void 0);
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
});
|
|
2617
|
+
this.setContext("each", void 0);
|
|
2618
|
+
};
|
|
2619
|
+
};
|
|
2620
|
+
taskFn.for = function(cases, ...args) {
|
|
2621
|
+
const test3 = this.withContext();
|
|
2622
|
+
if (Array.isArray(cases) && args.length) {
|
|
2623
|
+
cases = formatTemplateString(cases, args);
|
|
2624
|
+
}
|
|
2625
|
+
return (name, optionsOrFn, fnOrOptions) => {
|
|
2626
|
+
const _name = formatName(name);
|
|
2627
|
+
const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
|
|
2628
|
+
cases.forEach((item, idx) => {
|
|
2629
|
+
const handlerWrapper = handler ? (ctx) => handler(item, ctx) : void 0;
|
|
2630
|
+
if (handlerWrapper) {
|
|
2631
|
+
handlerWrapper.__VITEST_FIXTURE_INDEX__ = 1;
|
|
2632
|
+
handlerWrapper.toString = () => handler.toString();
|
|
2633
|
+
}
|
|
2634
|
+
test3(formatTitle(_name, toArray(item), idx), options, handlerWrapper);
|
|
2635
|
+
});
|
|
2636
|
+
};
|
|
2637
|
+
};
|
|
2638
|
+
taskFn.skipIf = function(condition) {
|
|
2639
|
+
return condition ? this.skip : this;
|
|
2640
|
+
};
|
|
2641
|
+
taskFn.runIf = function(condition) {
|
|
2642
|
+
return condition ? this : this.skip;
|
|
2643
|
+
};
|
|
2644
|
+
taskFn.scoped = function(fixtures) {
|
|
2645
|
+
const collector = getCurrentSuite();
|
|
2646
|
+
collector.scoped(fixtures);
|
|
2647
|
+
};
|
|
2648
|
+
taskFn.extend = function(fixtures) {
|
|
2649
|
+
const _context = mergeContextFixtures(fixtures, context || {}, runner);
|
|
2650
|
+
const originalWrapper = fn;
|
|
2651
|
+
return createTest(function(name, optionsOrFn, optionsOrTest) {
|
|
2652
|
+
const collector = getCurrentSuite();
|
|
2653
|
+
const scopedFixtures = collector.fixtures();
|
|
2654
|
+
const context2 = { ...this };
|
|
2655
|
+
if (scopedFixtures) {
|
|
2656
|
+
context2.fixtures = mergeScopedFixtures(context2.fixtures || [], scopedFixtures);
|
|
2657
|
+
}
|
|
2658
|
+
originalWrapper.call(context2, formatName(name), optionsOrFn, optionsOrTest);
|
|
2659
|
+
}, _context);
|
|
2660
|
+
};
|
|
2661
|
+
taskFn.beforeEach = beforeEach;
|
|
2662
|
+
taskFn.afterEach = afterEach;
|
|
2663
|
+
taskFn.beforeAll = beforeAll;
|
|
2664
|
+
taskFn.afterAll = afterAll;
|
|
2665
|
+
const _test2 = createChainable([
|
|
2666
|
+
"concurrent",
|
|
2667
|
+
"sequential",
|
|
2668
|
+
"skip",
|
|
2669
|
+
"only",
|
|
2670
|
+
"todo",
|
|
2671
|
+
"fails"
|
|
2672
|
+
], taskFn);
|
|
2673
|
+
if (context) {
|
|
2674
|
+
_test2.mergeContext(context);
|
|
2675
|
+
}
|
|
2676
|
+
return _test2;
|
|
2677
|
+
}
|
|
2678
|
+
function createTest(fn, context) {
|
|
2679
|
+
return createTaskCollector(fn, context);
|
|
2680
|
+
}
|
|
2681
|
+
function formatName(name) {
|
|
2682
|
+
return typeof name === "string" ? name : typeof name === "function" ? name.name || "<anonymous>" : String(name);
|
|
2683
|
+
}
|
|
2684
|
+
function formatTitle(template, items, idx) {
|
|
2685
|
+
if (template.includes("%#") || template.includes("%$")) {
|
|
2686
|
+
template = template.replace(/%%/g, "__vitest_escaped_%__").replace(/%#/g, `${idx}`).replace(/%\$/g, `${idx + 1}`).replace(/__vitest_escaped_%__/g, "%%");
|
|
2687
|
+
}
|
|
2688
|
+
const count = template.split("%").length - 1;
|
|
2689
|
+
if (template.includes("%f")) {
|
|
2690
|
+
const placeholders = template.match(/%f/g) || [];
|
|
2691
|
+
placeholders.forEach((_, i4) => {
|
|
2692
|
+
if (isNegativeNaN(items[i4]) || Object.is(items[i4], -0)) {
|
|
2693
|
+
let occurrence = 0;
|
|
2694
|
+
template = template.replace(/%f/g, (match) => {
|
|
2695
|
+
occurrence++;
|
|
2696
|
+
return occurrence === i4 + 1 ? "-%f" : match;
|
|
2697
|
+
});
|
|
2698
|
+
}
|
|
2699
|
+
});
|
|
2700
|
+
}
|
|
2701
|
+
const isObjectItem = isObject(items[0]);
|
|
2702
|
+
function formatAttribute(s3) {
|
|
2703
|
+
return s3.replace(/\$([$\w.]+)/g, (_, key) => {
|
|
2704
|
+
var _runner$config;
|
|
2705
|
+
const isArrayKey = /^\d+$/.test(key);
|
|
2706
|
+
if (!isObjectItem && !isArrayKey) {
|
|
2707
|
+
return `$${key}`;
|
|
2708
|
+
}
|
|
2709
|
+
const arrayElement = isArrayKey ? objectAttr(items, key) : void 0;
|
|
2710
|
+
const value = isObjectItem ? objectAttr(items[0], key, arrayElement) : arrayElement;
|
|
2711
|
+
return objDisplay(value, { truncate: runner === null || runner === void 0 || (_runner$config = runner.config) === null || _runner$config === void 0 || (_runner$config = _runner$config.chaiConfig) === null || _runner$config === void 0 ? void 0 : _runner$config.truncateThreshold });
|
|
2712
|
+
});
|
|
2713
|
+
}
|
|
2714
|
+
let output = "";
|
|
2715
|
+
let i3 = 0;
|
|
2716
|
+
handleRegexMatch(
|
|
2717
|
+
template,
|
|
2718
|
+
formatRegExp,
|
|
2719
|
+
// format "%"
|
|
2720
|
+
(match) => {
|
|
2721
|
+
if (i3 < count) {
|
|
2722
|
+
output += format2(match[0], items[i3++]);
|
|
2723
|
+
} else {
|
|
2724
|
+
output += match[0];
|
|
2725
|
+
}
|
|
2726
|
+
},
|
|
2727
|
+
// format "$"
|
|
2728
|
+
(nonMatch) => {
|
|
2729
|
+
output += formatAttribute(nonMatch);
|
|
2730
|
+
}
|
|
2731
|
+
);
|
|
2732
|
+
return output;
|
|
2733
|
+
}
|
|
2734
|
+
function handleRegexMatch(input, regex, onMatch, onNonMatch) {
|
|
2735
|
+
let lastIndex = 0;
|
|
2736
|
+
for (const m2 of input.matchAll(regex)) {
|
|
2737
|
+
if (lastIndex < m2.index) {
|
|
2738
|
+
onNonMatch(input.slice(lastIndex, m2.index));
|
|
2739
|
+
}
|
|
2740
|
+
onMatch(m2);
|
|
2741
|
+
lastIndex = m2.index + m2[0].length;
|
|
2742
|
+
}
|
|
2743
|
+
if (lastIndex < input.length) {
|
|
2744
|
+
onNonMatch(input.slice(lastIndex));
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
function formatTemplateString(cases, args) {
|
|
2748
|
+
const header = cases.join("").trim().replace(/ /g, "").split("\n").map((i3) => i3.split("|"))[0];
|
|
2749
|
+
const res = [];
|
|
2750
|
+
for (let i3 = 0; i3 < Math.floor(args.length / header.length); i3++) {
|
|
2751
|
+
const oneCase = {};
|
|
2752
|
+
for (let j2 = 0; j2 < header.length; j2++) {
|
|
2753
|
+
oneCase[header[j2]] = args[i3 * header.length + j2];
|
|
2754
|
+
}
|
|
2755
|
+
res.push(oneCase);
|
|
2756
|
+
}
|
|
2757
|
+
return res;
|
|
2758
|
+
}
|
|
2759
|
+
var now$2 = Date.now;
|
|
2760
|
+
var collectorContext = {
|
|
2761
|
+
tasks: [],
|
|
2762
|
+
currentSuite: null
|
|
2763
|
+
};
|
|
2764
|
+
function collectTask(task) {
|
|
2765
|
+
var _collectorContext$cur;
|
|
2766
|
+
(_collectorContext$cur = collectorContext.currentSuite) === null || _collectorContext$cur === void 0 ? void 0 : _collectorContext$cur.tasks.push(task);
|
|
2767
|
+
}
|
|
2768
|
+
async function runWithSuite(suite2, fn) {
|
|
2769
|
+
const prev = collectorContext.currentSuite;
|
|
2770
|
+
collectorContext.currentSuite = suite2;
|
|
2771
|
+
await fn();
|
|
2772
|
+
collectorContext.currentSuite = prev;
|
|
2773
|
+
}
|
|
2774
|
+
function withTimeout(fn, timeout, isHook = false, stackTraceError, onTimeout) {
|
|
2775
|
+
if (timeout <= 0 || timeout === Number.POSITIVE_INFINITY) {
|
|
2776
|
+
return fn;
|
|
2777
|
+
}
|
|
2778
|
+
const { setTimeout: setTimeout3, clearTimeout: clearTimeout3 } = getSafeTimers();
|
|
2779
|
+
return (function runWithTimeout(...args) {
|
|
2780
|
+
const startTime = now$2();
|
|
2781
|
+
const runner2 = getRunner();
|
|
2782
|
+
runner2._currentTaskStartTime = startTime;
|
|
2783
|
+
runner2._currentTaskTimeout = timeout;
|
|
2784
|
+
return new Promise((resolve_, reject_) => {
|
|
2785
|
+
var _timer$unref;
|
|
2786
|
+
const timer = setTimeout3(() => {
|
|
2787
|
+
clearTimeout3(timer);
|
|
2788
|
+
rejectTimeoutError();
|
|
2789
|
+
}, timeout);
|
|
2790
|
+
(_timer$unref = timer.unref) === null || _timer$unref === void 0 ? void 0 : _timer$unref.call(timer);
|
|
2791
|
+
function rejectTimeoutError() {
|
|
2792
|
+
const error = makeTimeoutError(isHook, timeout, stackTraceError);
|
|
2793
|
+
onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout(args, error);
|
|
2794
|
+
reject_(error);
|
|
2795
|
+
}
|
|
2796
|
+
function resolve(result) {
|
|
2797
|
+
runner2._currentTaskStartTime = void 0;
|
|
2798
|
+
runner2._currentTaskTimeout = void 0;
|
|
2799
|
+
clearTimeout3(timer);
|
|
2800
|
+
if (now$2() - startTime >= timeout) {
|
|
2801
|
+
rejectTimeoutError();
|
|
2802
|
+
return;
|
|
2803
|
+
}
|
|
2804
|
+
resolve_(result);
|
|
2805
|
+
}
|
|
2806
|
+
function reject(error) {
|
|
2807
|
+
runner2._currentTaskStartTime = void 0;
|
|
2808
|
+
runner2._currentTaskTimeout = void 0;
|
|
2809
|
+
clearTimeout3(timer);
|
|
2810
|
+
reject_(error);
|
|
2811
|
+
}
|
|
2812
|
+
try {
|
|
2813
|
+
const result = fn(...args);
|
|
2814
|
+
if (typeof result === "object" && result != null && typeof result.then === "function") {
|
|
2815
|
+
result.then(resolve, reject);
|
|
2816
|
+
} else {
|
|
2817
|
+
resolve(result);
|
|
2818
|
+
}
|
|
2819
|
+
} catch (error) {
|
|
2820
|
+
reject(error);
|
|
2821
|
+
}
|
|
2822
|
+
});
|
|
2823
|
+
});
|
|
2824
|
+
}
|
|
2825
|
+
var abortControllers = /* @__PURE__ */ new WeakMap();
|
|
2826
|
+
function abortIfTimeout([context], error) {
|
|
2827
|
+
if (context) {
|
|
2828
|
+
abortContextSignal(context, error);
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
function abortContextSignal(context, error) {
|
|
2832
|
+
const abortController = abortControllers.get(context);
|
|
2833
|
+
abortController === null || abortController === void 0 ? void 0 : abortController.abort(error);
|
|
2834
|
+
}
|
|
2835
|
+
function createTestContext(test3, runner2) {
|
|
2836
|
+
var _runner$extendTaskCon;
|
|
2837
|
+
const context = function() {
|
|
2838
|
+
throw new Error("done() callback is deprecated, use promise instead");
|
|
2839
|
+
};
|
|
2840
|
+
let abortController = abortControllers.get(context);
|
|
2841
|
+
if (!abortController) {
|
|
2842
|
+
abortController = new AbortController();
|
|
2843
|
+
abortControllers.set(context, abortController);
|
|
2844
|
+
}
|
|
2845
|
+
context.signal = abortController.signal;
|
|
2846
|
+
context.task = test3;
|
|
2847
|
+
context.skip = (condition, note) => {
|
|
2848
|
+
if (condition === false) {
|
|
2849
|
+
return void 0;
|
|
2850
|
+
}
|
|
2851
|
+
test3.result ?? (test3.result = { state: "skip" });
|
|
2852
|
+
test3.result.pending = true;
|
|
2853
|
+
throw new PendingError("test is skipped; abort execution", test3, typeof condition === "string" ? condition : note);
|
|
2854
|
+
};
|
|
2855
|
+
context.annotate = ((message, type, attachment) => {
|
|
2856
|
+
if (test3.result && test3.result.state !== "run") {
|
|
2857
|
+
throw new Error(`Cannot annotate tests outside of the test run. The test "${test3.name}" finished running with the "${test3.result.state}" state already.`);
|
|
2858
|
+
}
|
|
2859
|
+
const annotation = {
|
|
2860
|
+
message,
|
|
2861
|
+
type: typeof type === "object" || type === void 0 ? "notice" : type
|
|
2862
|
+
};
|
|
2863
|
+
const annotationAttachment = typeof type === "object" ? type : attachment;
|
|
2864
|
+
if (annotationAttachment) {
|
|
2865
|
+
annotation.attachment = annotationAttachment;
|
|
2866
|
+
manageArtifactAttachment(annotation.attachment);
|
|
2867
|
+
}
|
|
2868
|
+
return recordAsyncOperation(test3, recordArtifact(test3, {
|
|
2869
|
+
type: "internal:annotation",
|
|
2870
|
+
annotation
|
|
2871
|
+
}).then(async ({ annotation: annotation2 }) => {
|
|
2872
|
+
if (!runner2.onTestAnnotate) {
|
|
2873
|
+
throw new Error(`Test runner doesn't support test annotations.`);
|
|
2874
|
+
}
|
|
2875
|
+
await finishSendTasksUpdate(runner2);
|
|
2876
|
+
const resolvedAnnotation = await runner2.onTestAnnotate(test3, annotation2);
|
|
2877
|
+
test3.annotations.push(resolvedAnnotation);
|
|
2878
|
+
return resolvedAnnotation;
|
|
2879
|
+
}));
|
|
2880
|
+
});
|
|
2881
|
+
context.onTestFailed = (handler, timeout) => {
|
|
2882
|
+
test3.onFailed || (test3.onFailed = []);
|
|
2883
|
+
test3.onFailed.push(withTimeout(handler, timeout ?? runner2.config.hookTimeout, true, new Error("STACK_TRACE_ERROR"), (_, error) => abortController.abort(error)));
|
|
2884
|
+
};
|
|
2885
|
+
context.onTestFinished = (handler, timeout) => {
|
|
2886
|
+
test3.onFinished || (test3.onFinished = []);
|
|
2887
|
+
test3.onFinished.push(withTimeout(handler, timeout ?? runner2.config.hookTimeout, true, new Error("STACK_TRACE_ERROR"), (_, error) => abortController.abort(error)));
|
|
2888
|
+
};
|
|
2889
|
+
return ((_runner$extendTaskCon = runner2.extendTaskContext) === null || _runner$extendTaskCon === void 0 ? void 0 : _runner$extendTaskCon.call(runner2, context)) || context;
|
|
2890
|
+
}
|
|
2891
|
+
function makeTimeoutError(isHook, timeout, stackTraceError) {
|
|
2892
|
+
const message = `${isHook ? "Hook" : "Test"} timed out in ${timeout}ms.
|
|
2893
|
+
If this is a long-running ${isHook ? "hook" : "test"}, pass a timeout value as the last argument or configure it globally with "${isHook ? "hookTimeout" : "testTimeout"}".`;
|
|
2894
|
+
const error = new Error(message);
|
|
2895
|
+
if (stackTraceError === null || stackTraceError === void 0 ? void 0 : stackTraceError.stack) {
|
|
2896
|
+
error.stack = stackTraceError.stack.replace(error.message, stackTraceError.message);
|
|
2897
|
+
}
|
|
2898
|
+
return error;
|
|
2899
|
+
}
|
|
2900
|
+
var fileContexts = /* @__PURE__ */ new WeakMap();
|
|
2901
|
+
function getFileContext(file) {
|
|
2902
|
+
const context = fileContexts.get(file);
|
|
2903
|
+
if (!context) {
|
|
2904
|
+
throw new Error(`Cannot find file context for ${file.name}`);
|
|
2905
|
+
}
|
|
2906
|
+
return context;
|
|
2907
|
+
}
|
|
2908
|
+
var now$1 = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
2909
|
+
var now = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
2910
|
+
var unixNow = Date.now;
|
|
2911
|
+
var { clearTimeout: clearTimeout2, setTimeout: setTimeout2 } = getSafeTimers();
|
|
2912
|
+
var packs = /* @__PURE__ */ new Map();
|
|
2913
|
+
var eventsPacks = [];
|
|
2914
|
+
var pendingTasksUpdates = [];
|
|
2915
|
+
function sendTasksUpdate(runner2) {
|
|
2916
|
+
if (packs.size) {
|
|
2917
|
+
var _runner$onTaskUpdate;
|
|
2918
|
+
const taskPacks = Array.from(packs).map(([id, task]) => {
|
|
2919
|
+
return [
|
|
2920
|
+
id,
|
|
2921
|
+
task[0],
|
|
2922
|
+
task[1]
|
|
2923
|
+
];
|
|
2924
|
+
});
|
|
2925
|
+
const p2 = (_runner$onTaskUpdate = runner2.onTaskUpdate) === null || _runner$onTaskUpdate === void 0 ? void 0 : _runner$onTaskUpdate.call(runner2, taskPacks, eventsPacks);
|
|
2926
|
+
if (p2) {
|
|
2927
|
+
pendingTasksUpdates.push(p2);
|
|
2928
|
+
p2.then(() => pendingTasksUpdates.splice(pendingTasksUpdates.indexOf(p2), 1), () => {
|
|
2929
|
+
});
|
|
2930
|
+
}
|
|
2931
|
+
eventsPacks.length = 0;
|
|
2932
|
+
packs.clear();
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
async function finishSendTasksUpdate(runner2) {
|
|
2936
|
+
sendTasksUpdate(runner2);
|
|
2937
|
+
await Promise.all(pendingTasksUpdates);
|
|
2938
|
+
}
|
|
2939
|
+
function throttle(fn, ms) {
|
|
2940
|
+
let last = 0;
|
|
2941
|
+
let pendingCall;
|
|
2942
|
+
return function call(...args) {
|
|
2943
|
+
const now2 = unixNow();
|
|
2944
|
+
if (now2 - last > ms) {
|
|
2945
|
+
last = now2;
|
|
2946
|
+
clearTimeout2(pendingCall);
|
|
2947
|
+
pendingCall = void 0;
|
|
2948
|
+
return fn.apply(this, args);
|
|
2949
|
+
}
|
|
2950
|
+
pendingCall ?? (pendingCall = setTimeout2(() => call.bind(this)(...args), ms));
|
|
2951
|
+
};
|
|
2952
|
+
}
|
|
2953
|
+
var sendTasksUpdateThrottled = throttle(sendTasksUpdate, 100);
|
|
2954
|
+
async function recordArtifact(task, artifact) {
|
|
2955
|
+
const runner2 = getRunner();
|
|
2956
|
+
if (task.result && task.result.state !== "run") {
|
|
2957
|
+
throw new Error(`Cannot record a test artifact outside of the test run. The test "${task.name}" finished running with the "${task.result.state}" state already.`);
|
|
2958
|
+
}
|
|
2959
|
+
const stack = findTestFileStackTrace(task.file.filepath, new Error("STACK_TRACE").stack);
|
|
2960
|
+
if (stack) {
|
|
2961
|
+
artifact.location = {
|
|
2962
|
+
file: stack.file,
|
|
2963
|
+
line: stack.line,
|
|
2964
|
+
column: stack.column
|
|
2965
|
+
};
|
|
2966
|
+
if (artifact.type === "internal:annotation") {
|
|
2967
|
+
artifact.annotation.location = artifact.location;
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
if (Array.isArray(artifact.attachments)) {
|
|
2971
|
+
for (const attachment of artifact.attachments) {
|
|
2972
|
+
manageArtifactAttachment(attachment);
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
if (artifact.type === "internal:annotation") {
|
|
2976
|
+
return artifact;
|
|
2977
|
+
}
|
|
2978
|
+
if (!runner2.onTestArtifactRecord) {
|
|
2979
|
+
throw new Error(`Test runner doesn't support test artifacts.`);
|
|
2980
|
+
}
|
|
2981
|
+
await finishSendTasksUpdate(runner2);
|
|
2982
|
+
const resolvedArtifact = await runner2.onTestArtifactRecord(task, artifact);
|
|
2983
|
+
task.artifacts.push(resolvedArtifact);
|
|
2984
|
+
return resolvedArtifact;
|
|
2985
|
+
}
|
|
2986
|
+
var table = [];
|
|
2987
|
+
for (let i3 = 65; i3 < 91; i3++) {
|
|
2988
|
+
table.push(String.fromCharCode(i3));
|
|
2989
|
+
}
|
|
2990
|
+
for (let i3 = 97; i3 < 123; i3++) {
|
|
2991
|
+
table.push(String.fromCharCode(i3));
|
|
2992
|
+
}
|
|
2993
|
+
for (let i3 = 0; i3 < 10; i3++) {
|
|
2994
|
+
table.push(i3.toString(10));
|
|
2995
|
+
}
|
|
2996
|
+
table.push("+", "/");
|
|
2997
|
+
function encodeUint8Array(bytes) {
|
|
2998
|
+
let base64 = "";
|
|
2999
|
+
const len = bytes.byteLength;
|
|
3000
|
+
for (let i3 = 0; i3 < len; i3 += 3) {
|
|
3001
|
+
if (len === i3 + 1) {
|
|
3002
|
+
const a3 = (bytes[i3] & 252) >> 2;
|
|
3003
|
+
const b4 = (bytes[i3] & 3) << 4;
|
|
3004
|
+
base64 += table[a3];
|
|
3005
|
+
base64 += table[b4];
|
|
3006
|
+
base64 += "==";
|
|
3007
|
+
} else if (len === i3 + 2) {
|
|
3008
|
+
const a3 = (bytes[i3] & 252) >> 2;
|
|
3009
|
+
const b4 = (bytes[i3] & 3) << 4 | (bytes[i3 + 1] & 240) >> 4;
|
|
3010
|
+
const c3 = (bytes[i3 + 1] & 15) << 2;
|
|
3011
|
+
base64 += table[a3];
|
|
3012
|
+
base64 += table[b4];
|
|
3013
|
+
base64 += table[c3];
|
|
3014
|
+
base64 += "=";
|
|
3015
|
+
} else {
|
|
3016
|
+
const a3 = (bytes[i3] & 252) >> 2;
|
|
3017
|
+
const b4 = (bytes[i3] & 3) << 4 | (bytes[i3 + 1] & 240) >> 4;
|
|
3018
|
+
const c3 = (bytes[i3 + 1] & 15) << 2 | (bytes[i3 + 2] & 192) >> 6;
|
|
3019
|
+
const d4 = bytes[i3 + 2] & 63;
|
|
3020
|
+
base64 += table[a3];
|
|
3021
|
+
base64 += table[b4];
|
|
3022
|
+
base64 += table[c3];
|
|
3023
|
+
base64 += table[d4];
|
|
3024
|
+
}
|
|
3025
|
+
}
|
|
3026
|
+
return base64;
|
|
3027
|
+
}
|
|
3028
|
+
function recordAsyncOperation(test3, promise) {
|
|
3029
|
+
promise = promise.finally(() => {
|
|
3030
|
+
if (!test3.promises) {
|
|
3031
|
+
return;
|
|
3032
|
+
}
|
|
3033
|
+
const index2 = test3.promises.indexOf(promise);
|
|
3034
|
+
if (index2 !== -1) {
|
|
3035
|
+
test3.promises.splice(index2, 1);
|
|
3036
|
+
}
|
|
3037
|
+
});
|
|
3038
|
+
if (!test3.promises) {
|
|
3039
|
+
test3.promises = [];
|
|
3040
|
+
}
|
|
3041
|
+
test3.promises.push(promise);
|
|
3042
|
+
return promise;
|
|
3043
|
+
}
|
|
3044
|
+
function manageArtifactAttachment(attachment) {
|
|
3045
|
+
if (attachment.body == null && !attachment.path) {
|
|
3046
|
+
throw new TypeError(`Test attachment requires "body" or "path" to be set. Both are missing.`);
|
|
3047
|
+
}
|
|
3048
|
+
if (attachment.body && attachment.path) {
|
|
3049
|
+
throw new TypeError(`Test attachment requires only one of "body" or "path" to be set. Both are specified.`);
|
|
3050
|
+
}
|
|
3051
|
+
if (attachment.body instanceof Uint8Array) {
|
|
3052
|
+
attachment.body = encodeUint8Array(attachment.body);
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3056
|
+
// ../../node_modules/.pnpm/vitest@4.0.16_@types+node@24.10.4_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_yaml@2.8.2/node_modules/vitest/dist/index.js
|
|
3057
|
+
import "./chunks/utils.DvEY5TfP.js.mjs";
|
|
3058
|
+
|
|
3059
|
+
// ../../node_modules/.pnpm/@vitest+runner@4.0.16/node_modules/@vitest/runner/dist/utils.js
|
|
3060
|
+
import { a, c, b, e, f as f2, g as g2, d as d2, h as h2, j, k, m, n, o, q, r, i, t, l, p, s } from "./chunk-tasks.js.mjs";
|
|
3061
|
+
|
|
3062
|
+
// ../../node_modules/.pnpm/vitest@4.0.16_@types+node@24.10.4_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_yaml@2.8.2/node_modules/vitest/dist/index.js
|
|
3063
|
+
import "./chunks/_commonjsHelpers.D26ty3Ew.js.mjs";
|
|
3064
|
+
import "./chunks/date.Bq6ZW5rf.js.mjs";
|
|
3065
|
+
|
|
3066
|
+
// ../../node_modules/.pnpm/vite@7.3.0_@types+node@24.10.4_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_yaml@2.8.2/node_modules/vite/dist/node/module-runner.js
|
|
3067
|
+
var SOURCEMAPPING_URL = "sourceMa";
|
|
3068
|
+
SOURCEMAPPING_URL += "ppingURL";
|
|
3069
|
+
var isWindows = typeof process < "u" && process.platform === "win32";
|
|
3070
|
+
var AsyncFunction = async function() {
|
|
3071
|
+
}.constructor;
|
|
3072
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
3073
|
+
var intToChar = new Uint8Array(64);
|
|
3074
|
+
var charToInt = new Uint8Array(128);
|
|
3075
|
+
for (let i3 = 0; i3 < chars.length; i3++) {
|
|
3076
|
+
let c3 = chars.charCodeAt(i3);
|
|
3077
|
+
intToChar[i3] = c3, charToInt[c3] = i3;
|
|
3078
|
+
}
|
|
3079
|
+
var MODULE_RUNNER_SOURCEMAPPING_REGEXP = /* @__PURE__ */ RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json;base64,(.+)`);
|
|
3080
|
+
var retrieveFileHandlers = /* @__PURE__ */ new Set();
|
|
3081
|
+
var retrieveSourceMapHandlers = /* @__PURE__ */ new Set();
|
|
3082
|
+
var createExecHandlers = (handlers) => ((...args) => {
|
|
3083
|
+
for (let handler of handlers) {
|
|
3084
|
+
let result = handler(...args);
|
|
3085
|
+
if (result) return result;
|
|
3086
|
+
}
|
|
3087
|
+
return null;
|
|
3088
|
+
});
|
|
3089
|
+
var retrieveFileFromHandlers = createExecHandlers(retrieveFileHandlers);
|
|
3090
|
+
var retrieveSourceMapFromHandlers = createExecHandlers(retrieveSourceMapHandlers);
|
|
3091
|
+
var originalPrepare = Error.prepareStackTrace;
|
|
3092
|
+
var customizationHookNamespace = "vite-module-runner:import-meta-resolve/v1/";
|
|
3093
|
+
var customizationHooksModule = `
|
|
3094
|
+
|
|
3095
|
+
export async function resolve(specifier, context, nextResolve) {
|
|
3096
|
+
if (specifier.startsWith(${JSON.stringify(customizationHookNamespace)})) {
|
|
3097
|
+
const data = specifier.slice(${JSON.stringify(customizationHookNamespace)}.length)
|
|
3098
|
+
const [parsedSpecifier, parsedImporter] = JSON.parse(data)
|
|
3099
|
+
specifier = parsedSpecifier
|
|
3100
|
+
context.parentURL = parsedImporter
|
|
3101
|
+
}
|
|
3102
|
+
return nextResolve(specifier, context)
|
|
3103
|
+
}
|
|
3104
|
+
|
|
3105
|
+
`;
|
|
3106
|
+
`${customizationHookNamespace}`;
|
|
3107
|
+
var envProxy = new Proxy({}, { get(_, p2) {
|
|
3108
|
+
throw Error(`[module runner] Dynamic access of "import.meta.env" is not supported. Please, use "import.meta.env.${String(p2)}" instead.`);
|
|
3109
|
+
} });
|
|
3110
|
+
|
|
3111
|
+
// src/session/__tests__/redis.test.ts
|
|
3
3112
|
import { PRINCIPAL_NAME_INDEX_NAME } from "../common.mjs";
|
|
4
3113
|
import { RedisIndexedSessionRepository } from "../redis.mjs";
|
|
5
3114
|
var redis = new Redis("redis://default:123456@localhost:6379");
|
|
6
3115
|
var repository = new RedisIndexedSessionRepository(redis, "myapp:session");
|
|
7
3116
|
describe("redis session crud", () => {
|
|
8
3117
|
const principalName = "user_123456";
|
|
9
|
-
|
|
3118
|
+
test2("should create a session", async () => {
|
|
10
3119
|
const session = repository.createSession();
|
|
11
3120
|
const sessionId = session.getId();
|
|
12
3121
|
session.setAttribute(PRINCIPAL_NAME_INDEX_NAME, principalName);
|
|
13
3122
|
await repository.save(session);
|
|
14
3123
|
const foundSession = await repository.findById(sessionId);
|
|
15
|
-
|
|
3124
|
+
g3(foundSession?.getAttribute(PRINCIPAL_NAME_INDEX_NAME)).toBe(principalName);
|
|
16
3125
|
});
|
|
17
|
-
|
|
3126
|
+
test2("should find a session by principal name", async () => {
|
|
18
3127
|
const sessions = await repository.findByPrincipalName(principalName);
|
|
19
|
-
|
|
3128
|
+
g3(sessions.size).toBeGreaterThan(0);
|
|
20
3129
|
});
|
|
21
|
-
|
|
3130
|
+
test2("should delete a session by id", async () => {
|
|
22
3131
|
const sessions = await repository.findByPrincipalName(principalName);
|
|
23
3132
|
for (const session of sessions.values()) {
|
|
24
3133
|
const sessionId = session.getId();
|
|
25
3134
|
await repository.deleteById(sessionId);
|
|
26
3135
|
const foundSession = await repository.findById(sessionId);
|
|
27
|
-
|
|
3136
|
+
g3(foundSession).toBeNull();
|
|
28
3137
|
}
|
|
29
3138
|
});
|
|
30
3139
|
});
|
|
31
3140
|
describe("redis session attributes", () => {
|
|
32
|
-
|
|
3141
|
+
test2("should set and get attributes", async () => {
|
|
33
3142
|
const session = repository.createSession();
|
|
34
3143
|
session.setAttribute("test_key", "test_value");
|
|
35
3144
|
const sessionId = session.getId();
|
|
36
3145
|
await repository.save(session);
|
|
37
3146
|
const foundSession = await repository.findById(sessionId);
|
|
38
|
-
|
|
39
|
-
|
|
3147
|
+
g3(foundSession).not.toBeNull();
|
|
3148
|
+
g3(foundSession?.getAttribute("test_key")).toBe("test_value");
|
|
40
3149
|
foundSession?.removeAttribute("test_key");
|
|
41
3150
|
await repository.save(foundSession);
|
|
42
3151
|
const foundSession2 = await repository.findById(sessionId);
|
|
43
|
-
|
|
3152
|
+
g3(foundSession2?.getAttribute("test_key")).toBeNull();
|
|
44
3153
|
});
|
|
45
|
-
|
|
3154
|
+
test2("should change session id", async () => {
|
|
46
3155
|
const session = repository.createSession();
|
|
47
3156
|
session.setAttribute("test_key", "test_value");
|
|
48
3157
|
session.setAttribute(PRINCIPAL_NAME_INDEX_NAME, "user_123");
|
|
49
3158
|
const oldSessionId = session.getId();
|
|
50
3159
|
await repository.save(session);
|
|
51
3160
|
const oldSession = await repository.findById(oldSessionId);
|
|
52
|
-
|
|
3161
|
+
g3(oldSession).not.toBeNull();
|
|
53
3162
|
if (!oldSession) throw new Error("Not found session id");
|
|
54
3163
|
const newSessionId = oldSession.changeSessionId();
|
|
55
3164
|
await repository.save(oldSession);
|
|
56
3165
|
const foundSession1 = await repository.findById(oldSessionId);
|
|
57
|
-
|
|
3166
|
+
g3(foundSession1).toBeNull();
|
|
58
3167
|
const foundSession2 = await repository.findById(newSessionId);
|
|
59
|
-
|
|
3168
|
+
g3(foundSession2).not.toBeNull();
|
|
60
3169
|
});
|
|
61
3170
|
});
|
|
62
3171
|
describe("redis session config", () => {
|
|
63
3172
|
const maxInactiveInterval = 24 * 60 * 60;
|
|
64
3173
|
repository.setDefaultMaxInactiveInterval(maxInactiveInterval);
|
|
65
|
-
|
|
3174
|
+
test2("should set default max inactive interval", () => {
|
|
66
3175
|
const session = repository.createSession();
|
|
67
|
-
|
|
68
|
-
|
|
3176
|
+
g3(session.isExpired()).toBe(false);
|
|
3177
|
+
g3(session.getMaxInactiveInterval()).toBe(maxInactiveInterval);
|
|
69
3178
|
});
|
|
70
3179
|
});
|
|
3180
|
+
/*! Bundled license information:
|
|
3181
|
+
|
|
3182
|
+
@vitest/pretty-format/dist/index.js:
|
|
3183
|
+
(**
|
|
3184
|
+
* @license React
|
|
3185
|
+
* react-is.production.js
|
|
3186
|
+
*
|
|
3187
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3188
|
+
*
|
|
3189
|
+
* This source code is licensed under the MIT license found in the
|
|
3190
|
+
* LICENSE file in the root directory of this source tree.
|
|
3191
|
+
*)
|
|
3192
|
+
(**
|
|
3193
|
+
* @license React
|
|
3194
|
+
* react-is.production.min.js
|
|
3195
|
+
*
|
|
3196
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3197
|
+
*
|
|
3198
|
+
* This source code is licensed under the MIT license found in the
|
|
3199
|
+
* LICENSE file in the root directory of this source tree.
|
|
3200
|
+
*)
|
|
3201
|
+
*/
|
|
71
3202
|
//# sourceMappingURL=redis.test.mjs.map
|