@noma.to/qwik-mock 1.0.2 → 1.1.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.
Files changed (53) hide show
  1. package/lib/lib/qwik-mock.cjs +24 -6
  2. package/lib/lib/qwik-mock.mjs +24 -6
  3. package/lib-types/index.d.ts +2 -1
  4. package/lib-types/lib/qwik-mock.d.ts +21 -19
  5. package/package.json +7 -6
  6. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.cjs +0 -83
  7. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +0 -83
  8. package/lib/node_modules/.pnpm/@vitest_expect@4.0.18/node_modules/@vitest/expect/dist/index.cjs +0 -1785
  9. package/lib/node_modules/.pnpm/@vitest_expect@4.0.18/node_modules/@vitest/expect/dist/index.mjs +0 -1785
  10. package/lib/node_modules/.pnpm/@vitest_pretty-format@4.0.18/node_modules/@vitest/pretty-format/dist/index.cjs +0 -964
  11. package/lib/node_modules/.pnpm/@vitest_pretty-format@4.0.18/node_modules/@vitest/pretty-format/dist/index.mjs +0 -964
  12. package/lib/node_modules/.pnpm/@vitest_runner@4.0.18/node_modules/@vitest/runner/dist/chunk-tasks.cjs +0 -60
  13. package/lib/node_modules/.pnpm/@vitest_runner@4.0.18/node_modules/@vitest/runner/dist/chunk-tasks.mjs +0 -60
  14. package/lib/node_modules/.pnpm/@vitest_runner@4.0.18/node_modules/@vitest/runner/dist/index.cjs +0 -1102
  15. package/lib/node_modules/.pnpm/@vitest_runner@4.0.18/node_modules/@vitest/runner/dist/index.mjs +0 -1102
  16. package/lib/node_modules/.pnpm/@vitest_snapshot@4.0.18/node_modules/@vitest/snapshot/dist/index.cjs +0 -1289
  17. package/lib/node_modules/.pnpm/@vitest_snapshot@4.0.18/node_modules/@vitest/snapshot/dist/index.mjs +0 -1289
  18. package/lib/node_modules/.pnpm/@vitest_spy@4.0.18/node_modules/@vitest/spy/dist/index.cjs +0 -422
  19. package/lib/node_modules/.pnpm/@vitest_spy@4.0.18/node_modules/@vitest/spy/dist/index.mjs +0 -422
  20. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.cjs +0 -6
  21. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.mjs +0 -6
  22. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.cjs +0 -98
  23. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.mjs +0 -98
  24. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/diff.cjs +0 -1626
  25. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/diff.mjs +0 -1626
  26. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/display.cjs +0 -690
  27. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/display.mjs +0 -690
  28. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/error.cjs +0 -39
  29. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/error.mjs +0 -39
  30. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/helpers.cjs +0 -151
  31. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/helpers.mjs +0 -151
  32. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/serialize.cjs +0 -114
  33. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/serialize.mjs +0 -114
  34. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/source-map.cjs +0 -125
  35. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/source-map.mjs +0 -125
  36. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/timers.cjs +0 -22
  37. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/timers.mjs +0 -22
  38. package/lib/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.cjs +0 -4056
  39. package/lib/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.mjs +0 -4056
  40. package/lib/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.cjs +0 -994
  41. package/lib/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs +0 -994
  42. package/lib/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.cjs +0 -101
  43. package/lib/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -101
  44. package/lib/node_modules/.pnpm/tinyrainbow@3.0.3/node_modules/tinyrainbow/dist/index.cjs +0 -84
  45. package/lib/node_modules/.pnpm/tinyrainbow@3.0.3/node_modules/tinyrainbow/dist/index.mjs +0 -84
  46. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.cjs +0 -4
  47. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.mjs +0 -4
  48. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.cjs +0 -51
  49. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.mjs +0 -51
  50. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/utils.DvEY5TfP.cjs +0 -45
  51. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/utils.DvEY5TfP.mjs +0 -45
  52. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/vi.2VT5v0um.cjs +0 -2609
  53. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/vi.2VT5v0um.mjs +0 -2609
@@ -1,690 +0,0 @@
1
- import { format as format$1, plugins } from "../../../../../@vitest_pretty-format@4.0.18/node_modules/@vitest/pretty-format/dist/index.mjs";
2
- const ansiColors = {
3
- bold: ["1", "22"],
4
- dim: ["2", "22"],
5
- italic: ["3", "23"],
6
- underline: ["4", "24"],
7
- // 5 & 6 are blinking
8
- inverse: ["7", "27"],
9
- hidden: ["8", "28"],
10
- strike: ["9", "29"],
11
- // 10-20 are fonts
12
- // 21-29 are resets for 1-9
13
- black: ["30", "39"],
14
- red: ["31", "39"],
15
- green: ["32", "39"],
16
- yellow: ["33", "39"],
17
- blue: ["34", "39"],
18
- magenta: ["35", "39"],
19
- cyan: ["36", "39"],
20
- white: ["37", "39"],
21
- brightblack: ["30;1", "39"],
22
- brightred: ["31;1", "39"],
23
- brightgreen: ["32;1", "39"],
24
- brightyellow: ["33;1", "39"],
25
- brightblue: ["34;1", "39"],
26
- brightmagenta: ["35;1", "39"],
27
- brightcyan: ["36;1", "39"],
28
- brightwhite: ["37;1", "39"],
29
- grey: ["90", "39"]
30
- };
31
- const styles = {
32
- special: "cyan",
33
- number: "yellow",
34
- bigint: "yellow",
35
- boolean: "yellow",
36
- undefined: "grey",
37
- null: "bold",
38
- string: "green",
39
- symbol: "green",
40
- date: "magenta",
41
- regexp: "red"
42
- };
43
- const truncator = "…";
44
- function colorise(value, styleType) {
45
- const color = ansiColors[styles[styleType]] || ansiColors[styleType] || "";
46
- if (!color) {
47
- return String(value);
48
- }
49
- return `\x1B[${color[0]}m${String(value)}\x1B[${color[1]}m`;
50
- }
51
- function normaliseOptions({
52
- showHidden = false,
53
- depth = 2,
54
- colors = false,
55
- customInspect = true,
56
- showProxy = false,
57
- maxArrayLength = Infinity,
58
- breakLength = Infinity,
59
- seen = [],
60
- // eslint-disable-next-line no-shadow
61
- truncate: truncate2 = Infinity,
62
- stylize = String
63
- } = {}, inspect2) {
64
- const options = {
65
- showHidden: Boolean(showHidden),
66
- depth: Number(depth),
67
- colors: Boolean(colors),
68
- customInspect: Boolean(customInspect),
69
- showProxy: Boolean(showProxy),
70
- maxArrayLength: Number(maxArrayLength),
71
- breakLength: Number(breakLength),
72
- truncate: Number(truncate2),
73
- seen,
74
- inspect: inspect2,
75
- stylize
76
- };
77
- if (options.colors) {
78
- options.stylize = colorise;
79
- }
80
- return options;
81
- }
82
- function isHighSurrogate(char) {
83
- return char >= "\uD800" && char <= "\uDBFF";
84
- }
85
- function truncate(string, length, tail = truncator) {
86
- string = String(string);
87
- const tailLength = tail.length;
88
- const stringLength = string.length;
89
- if (tailLength > length && stringLength > tailLength) {
90
- return tail;
91
- }
92
- if (stringLength > length && stringLength > tailLength) {
93
- let end = length - tailLength;
94
- if (end > 0 && isHighSurrogate(string[end - 1])) {
95
- end = end - 1;
96
- }
97
- return `${string.slice(0, end)}${tail}`;
98
- }
99
- return string;
100
- }
101
- function inspectList(list, options, inspectItem, separator = ", ") {
102
- inspectItem = inspectItem || options.inspect;
103
- const size = list.length;
104
- if (size === 0)
105
- return "";
106
- const originalLength = options.truncate;
107
- let output = "";
108
- let peek = "";
109
- let truncated = "";
110
- for (let i = 0; i < size; i += 1) {
111
- const last = i + 1 === list.length;
112
- const secondToLast = i + 2 === list.length;
113
- truncated = `${truncator}(${list.length - i})`;
114
- const value = list[i];
115
- options.truncate = originalLength - output.length - (last ? 0 : separator.length);
116
- const string = peek || inspectItem(value, options) + (last ? "" : separator);
117
- const nextLength = output.length + string.length;
118
- const truncatedLength = nextLength + truncated.length;
119
- if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) {
120
- break;
121
- }
122
- if (!last && !secondToLast && truncatedLength > originalLength) {
123
- break;
124
- }
125
- peek = last ? "" : inspectItem(list[i + 1], options) + (secondToLast ? "" : separator);
126
- if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) {
127
- break;
128
- }
129
- output += string;
130
- if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
131
- truncated = `${truncator}(${list.length - i - 1})`;
132
- break;
133
- }
134
- truncated = "";
135
- }
136
- return `${output}${truncated}`;
137
- }
138
- function quoteComplexKey(key) {
139
- if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) {
140
- return key;
141
- }
142
- return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
143
- }
144
- function inspectProperty([key, value], options) {
145
- options.truncate -= 2;
146
- if (typeof key === "string") {
147
- key = quoteComplexKey(key);
148
- } else if (typeof key !== "number") {
149
- key = `[${options.inspect(key, options)}]`;
150
- }
151
- options.truncate -= key.length;
152
- value = options.inspect(value, options);
153
- return `${key}: ${value}`;
154
- }
155
- function inspectArray(array, options) {
156
- const nonIndexProperties = Object.keys(array).slice(array.length);
157
- if (!array.length && !nonIndexProperties.length)
158
- return "[]";
159
- options.truncate -= 4;
160
- const listContents = inspectList(array, options);
161
- options.truncate -= listContents.length;
162
- let propertyContents = "";
163
- if (nonIndexProperties.length) {
164
- propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
165
- }
166
- return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`;
167
- }
168
- const getArrayName = (array) => {
169
- if (typeof Buffer === "function" && array instanceof Buffer) {
170
- return "Buffer";
171
- }
172
- if (array[Symbol.toStringTag]) {
173
- return array[Symbol.toStringTag];
174
- }
175
- return array.constructor.name;
176
- };
177
- function inspectTypedArray(array, options) {
178
- const name = getArrayName(array);
179
- options.truncate -= name.length + 4;
180
- const nonIndexProperties = Object.keys(array).slice(array.length);
181
- if (!array.length && !nonIndexProperties.length)
182
- return `${name}[]`;
183
- let output = "";
184
- for (let i = 0; i < array.length; i++) {
185
- const string = `${options.stylize(truncate(array[i], options.truncate), "number")}${i === array.length - 1 ? "" : ", "}`;
186
- options.truncate -= string.length;
187
- if (array[i] !== array.length && options.truncate <= 3) {
188
- output += `${truncator}(${array.length - array[i] + 1})`;
189
- break;
190
- }
191
- output += string;
192
- }
193
- let propertyContents = "";
194
- if (nonIndexProperties.length) {
195
- propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
196
- }
197
- return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ""} ]`;
198
- }
199
- function inspectDate(dateObject, options) {
200
- const stringRepresentation = dateObject.toJSON();
201
- if (stringRepresentation === null) {
202
- return "Invalid Date";
203
- }
204
- const split = stringRepresentation.split("T");
205
- const date = split[0];
206
- return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date");
207
- }
208
- function inspectFunction(func, options) {
209
- const functionType = func[Symbol.toStringTag] || "Function";
210
- const name = func.name;
211
- if (!name) {
212
- return options.stylize(`[${functionType}]`, "special");
213
- }
214
- return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, "special");
215
- }
216
- function inspectMapEntry([key, value], options) {
217
- options.truncate -= 4;
218
- key = options.inspect(key, options);
219
- options.truncate -= key.length;
220
- value = options.inspect(value, options);
221
- return `${key} => ${value}`;
222
- }
223
- function mapToEntries(map) {
224
- const entries = [];
225
- map.forEach((value, key) => {
226
- entries.push([key, value]);
227
- });
228
- return entries;
229
- }
230
- function inspectMap(map, options) {
231
- if (map.size === 0)
232
- return "Map{}";
233
- options.truncate -= 7;
234
- return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
235
- }
236
- const isNaN = Number.isNaN || ((i) => i !== i);
237
- function inspectNumber(number, options) {
238
- if (isNaN(number)) {
239
- return options.stylize("NaN", "number");
240
- }
241
- if (number === Infinity) {
242
- return options.stylize("Infinity", "number");
243
- }
244
- if (number === -Infinity) {
245
- return options.stylize("-Infinity", "number");
246
- }
247
- if (number === 0) {
248
- return options.stylize(1 / number === Infinity ? "+0" : "-0", "number");
249
- }
250
- return options.stylize(truncate(String(number), options.truncate), "number");
251
- }
252
- function inspectBigInt(number, options) {
253
- let nums = truncate(number.toString(), options.truncate - 1);
254
- if (nums !== truncator)
255
- nums += "n";
256
- return options.stylize(nums, "bigint");
257
- }
258
- function inspectRegExp(value, options) {
259
- const flags = value.toString().split("/")[2];
260
- const sourceLength = options.truncate - (2 + flags.length);
261
- const source = value.source;
262
- return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, "regexp");
263
- }
264
- function arrayFromSet(set) {
265
- const values = [];
266
- set.forEach((value) => {
267
- values.push(value);
268
- });
269
- return values;
270
- }
271
- function inspectSet(set, options) {
272
- if (set.size === 0)
273
- return "Set{}";
274
- options.truncate -= 7;
275
- return `Set{ ${inspectList(arrayFromSet(set), options)} }`;
276
- }
277
- const stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g");
278
- const escapeCharacters = {
279
- "\b": "\\b",
280
- " ": "\\t",
281
- "\n": "\\n",
282
- "\f": "\\f",
283
- "\r": "\\r",
284
- "'": "\\'",
285
- "\\": "\\\\"
286
- };
287
- const hex = 16;
288
- function escape(char) {
289
- return escapeCharacters[char] || `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-4)}`;
290
- }
291
- function inspectString(string, options) {
292
- if (stringEscapeChars.test(string)) {
293
- string = string.replace(stringEscapeChars, escape);
294
- }
295
- return options.stylize(`'${truncate(string, options.truncate - 2)}'`, "string");
296
- }
297
- function inspectSymbol(value) {
298
- if ("description" in Symbol.prototype) {
299
- return value.description ? `Symbol(${value.description})` : "Symbol()";
300
- }
301
- return value.toString();
302
- }
303
- const getPromiseValue = () => "Promise{…}";
304
- function inspectObject$1(object, options) {
305
- const properties = Object.getOwnPropertyNames(object);
306
- const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
307
- if (properties.length === 0 && symbols.length === 0) {
308
- return "{}";
309
- }
310
- options.truncate -= 4;
311
- options.seen = options.seen || [];
312
- if (options.seen.includes(object)) {
313
- return "[Circular]";
314
- }
315
- options.seen.push(object);
316
- const propertyContents = inspectList(properties.map((key) => [key, object[key]]), options, inspectProperty);
317
- const symbolContents = inspectList(symbols.map((key) => [key, object[key]]), options, inspectProperty);
318
- options.seen.pop();
319
- let sep = "";
320
- if (propertyContents && symbolContents) {
321
- sep = ", ";
322
- }
323
- return `{ ${propertyContents}${sep}${symbolContents} }`;
324
- }
325
- const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
326
- function inspectClass(value, options) {
327
- let name = "";
328
- if (toStringTag && toStringTag in value) {
329
- name = value[toStringTag];
330
- }
331
- name = name || value.constructor.name;
332
- if (!name || name === "_class") {
333
- name = "<Anonymous Class>";
334
- }
335
- options.truncate -= name.length;
336
- return `${name}${inspectObject$1(value, options)}`;
337
- }
338
- function inspectArguments(args, options) {
339
- if (args.length === 0)
340
- return "Arguments[]";
341
- options.truncate -= 13;
342
- return `Arguments[ ${inspectList(args, options)} ]`;
343
- }
344
- const errorKeys = [
345
- "stack",
346
- "line",
347
- "column",
348
- "name",
349
- "message",
350
- "fileName",
351
- "lineNumber",
352
- "columnNumber",
353
- "number",
354
- "description",
355
- "cause"
356
- ];
357
- function inspectObject(error, options) {
358
- const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1);
359
- const name = error.name;
360
- options.truncate -= name.length;
361
- let message = "";
362
- if (typeof error.message === "string") {
363
- message = truncate(error.message, options.truncate);
364
- } else {
365
- properties.unshift("message");
366
- }
367
- message = message ? `: ${message}` : "";
368
- options.truncate -= message.length + 5;
369
- options.seen = options.seen || [];
370
- if (options.seen.includes(error)) {
371
- return "[Circular]";
372
- }
373
- options.seen.push(error);
374
- const propertyContents = inspectList(properties.map((key) => [key, error[key]]), options, inspectProperty);
375
- return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`;
376
- }
377
- function inspectAttribute([key, value], options) {
378
- options.truncate -= 3;
379
- if (!value) {
380
- return `${options.stylize(String(key), "yellow")}`;
381
- }
382
- return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
383
- }
384
- function inspectNodeCollection(collection, options) {
385
- return inspectList(collection, options, inspectNode, "\n");
386
- }
387
- function inspectNode(node, options) {
388
- switch (node.nodeType) {
389
- case 1:
390
- return inspectHTML(node, options);
391
- case 3:
392
- return options.inspect(node.data, options);
393
- default:
394
- return options.inspect(node, options);
395
- }
396
- }
397
- function inspectHTML(element, options) {
398
- const properties = element.getAttributeNames();
399
- const name = element.tagName.toLowerCase();
400
- const head = options.stylize(`<${name}`, "special");
401
- const headClose = options.stylize(`>`, "special");
402
- const tail = options.stylize(`</${name}>`, "special");
403
- options.truncate -= name.length * 2 + 5;
404
- let propertyContents = "";
405
- if (properties.length > 0) {
406
- propertyContents += " ";
407
- propertyContents += inspectList(properties.map((key) => [key, element.getAttribute(key)]), options, inspectAttribute, " ");
408
- }
409
- options.truncate -= propertyContents.length;
410
- const truncate2 = options.truncate;
411
- let children = inspectNodeCollection(element.children, options);
412
- if (children && children.length > truncate2) {
413
- children = `${truncator}(${element.children.length})`;
414
- }
415
- return `${head}${propertyContents}${headClose}${children}${tail}`;
416
- }
417
- const symbolsSupported = typeof Symbol === "function" && typeof Symbol.for === "function";
418
- const chaiInspect = symbolsSupported ? /* @__PURE__ */ Symbol.for("chai/inspect") : "@@chai/inspect";
419
- const nodeInspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
420
- const constructorMap = /* @__PURE__ */ new WeakMap();
421
- const stringTagMap = {};
422
- const baseTypesMap = {
423
- undefined: (value, options) => options.stylize("undefined", "undefined"),
424
- null: (value, options) => options.stylize("null", "null"),
425
- boolean: (value, options) => options.stylize(String(value), "boolean"),
426
- Boolean: (value, options) => options.stylize(String(value), "boolean"),
427
- number: inspectNumber,
428
- Number: inspectNumber,
429
- bigint: inspectBigInt,
430
- BigInt: inspectBigInt,
431
- string: inspectString,
432
- String: inspectString,
433
- function: inspectFunction,
434
- Function: inspectFunction,
435
- symbol: inspectSymbol,
436
- // A Symbol polyfill will return `Symbol` not `symbol` from typedetect
437
- Symbol: inspectSymbol,
438
- Array: inspectArray,
439
- Date: inspectDate,
440
- Map: inspectMap,
441
- Set: inspectSet,
442
- RegExp: inspectRegExp,
443
- Promise: getPromiseValue,
444
- // WeakSet, WeakMap are totally opaque to us
445
- WeakSet: (value, options) => options.stylize("WeakSet{…}", "special"),
446
- WeakMap: (value, options) => options.stylize("WeakMap{…}", "special"),
447
- Arguments: inspectArguments,
448
- Int8Array: inspectTypedArray,
449
- Uint8Array: inspectTypedArray,
450
- Uint8ClampedArray: inspectTypedArray,
451
- Int16Array: inspectTypedArray,
452
- Uint16Array: inspectTypedArray,
453
- Int32Array: inspectTypedArray,
454
- Uint32Array: inspectTypedArray,
455
- Float32Array: inspectTypedArray,
456
- Float64Array: inspectTypedArray,
457
- Generator: () => "",
458
- DataView: () => "",
459
- ArrayBuffer: () => "",
460
- Error: inspectObject,
461
- HTMLCollection: inspectNodeCollection,
462
- NodeList: inspectNodeCollection
463
- };
464
- const inspectCustom = (value, options, type, inspectFn) => {
465
- if (chaiInspect in value && typeof value[chaiInspect] === "function") {
466
- return value[chaiInspect](options);
467
- }
468
- if (nodeInspect in value && typeof value[nodeInspect] === "function") {
469
- return value[nodeInspect](options.depth, options, inspectFn);
470
- }
471
- if ("inspect" in value && typeof value.inspect === "function") {
472
- return value.inspect(options.depth, options);
473
- }
474
- if ("constructor" in value && constructorMap.has(value.constructor)) {
475
- return constructorMap.get(value.constructor)(value, options);
476
- }
477
- if (stringTagMap[type]) {
478
- return stringTagMap[type](value, options);
479
- }
480
- return "";
481
- };
482
- const toString = Object.prototype.toString;
483
- function inspect$1(value, opts = {}) {
484
- const options = normaliseOptions(opts, inspect$1);
485
- const { customInspect } = options;
486
- let type = value === null ? "null" : typeof value;
487
- if (type === "object") {
488
- type = toString.call(value).slice(8, -1);
489
- }
490
- if (type in baseTypesMap) {
491
- return baseTypesMap[type](value, options);
492
- }
493
- if (customInspect && value) {
494
- const output = inspectCustom(value, options, type, inspect$1);
495
- if (output) {
496
- if (typeof output === "string")
497
- return output;
498
- return inspect$1(output, options);
499
- }
500
- }
501
- const proto = value ? Object.getPrototypeOf(value) : false;
502
- if (proto === Object.prototype || proto === null) {
503
- return inspectObject$1(value, options);
504
- }
505
- if (value && typeof HTMLElement === "function" && value instanceof HTMLElement) {
506
- return inspectHTML(value, options);
507
- }
508
- if ("constructor" in value) {
509
- if (value.constructor !== Object) {
510
- return inspectClass(value, options);
511
- }
512
- return inspectObject$1(value, options);
513
- }
514
- if (value === Object(value)) {
515
- return inspectObject$1(value, options);
516
- }
517
- return options.stylize(String(value), type);
518
- }
519
- const { AsymmetricMatcher, DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent } = plugins;
520
- const PLUGINS = [
521
- ReactTestComponent,
522
- ReactElement,
523
- DOMElement,
524
- DOMCollection,
525
- Immutable,
526
- AsymmetricMatcher
527
- ];
528
- function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) {
529
- const MAX_LENGTH = maxLength ?? 1e4;
530
- let result;
531
- try {
532
- result = format$1(object, {
533
- maxDepth,
534
- escapeString: false,
535
- plugins: PLUGINS,
536
- ...options
537
- });
538
- } catch {
539
- result = format$1(object, {
540
- callToJSON: false,
541
- maxDepth,
542
- escapeString: false,
543
- plugins: PLUGINS,
544
- ...options
545
- });
546
- }
547
- return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(Math.min(maxDepth, Number.MAX_SAFE_INTEGER) / 2), {
548
- maxLength,
549
- ...options
550
- }) : result;
551
- }
552
- const formatRegExp = /%[sdjifoOc%]/g;
553
- function baseFormat(args, options = {}) {
554
- const formatArg = (item, inspecOptions) => {
555
- if (options.prettifyObject) {
556
- return stringify(item, void 0, {
557
- printBasicPrototype: false,
558
- escapeString: false
559
- });
560
- }
561
- return inspect(item, inspecOptions);
562
- };
563
- if (typeof args[0] !== "string") {
564
- const objects = [];
565
- for (let i2 = 0; i2 < args.length; i2++) {
566
- objects.push(formatArg(args[i2], {
567
- depth: 0,
568
- colors: false
569
- }));
570
- }
571
- return objects.join(" ");
572
- }
573
- const len = args.length;
574
- let i = 1;
575
- const template = args[0];
576
- let str = String(template).replace(formatRegExp, (x) => {
577
- if (x === "%%") {
578
- return "%";
579
- }
580
- if (i >= len) {
581
- return x;
582
- }
583
- switch (x) {
584
- case "%s": {
585
- const value = args[i++];
586
- if (typeof value === "bigint") {
587
- return `${value.toString()}n`;
588
- }
589
- if (typeof value === "number" && value === 0 && 1 / value < 0) {
590
- return "-0";
591
- }
592
- if (typeof value === "object" && value !== null) {
593
- if (typeof value.toString === "function" && value.toString !== Object.prototype.toString) {
594
- return value.toString();
595
- }
596
- return formatArg(value, {
597
- depth: 0,
598
- colors: false
599
- });
600
- }
601
- return String(value);
602
- }
603
- case "%d": {
604
- const value = args[i++];
605
- if (typeof value === "bigint") {
606
- return `${value.toString()}n`;
607
- }
608
- return Number(value).toString();
609
- }
610
- case "%i": {
611
- const value = args[i++];
612
- if (typeof value === "bigint") {
613
- return `${value.toString()}n`;
614
- }
615
- return Number.parseInt(String(value)).toString();
616
- }
617
- case "%f":
618
- return Number.parseFloat(String(args[i++])).toString();
619
- case "%o":
620
- return formatArg(args[i++], {
621
- showHidden: true,
622
- showProxy: true
623
- });
624
- case "%O":
625
- return formatArg(args[i++]);
626
- case "%c": {
627
- i++;
628
- return "";
629
- }
630
- case "%j":
631
- try {
632
- return JSON.stringify(args[i++]);
633
- } catch (err) {
634
- const m = err.message;
635
- if (m.includes("circular structure") || m.includes("cyclic structures") || m.includes("cyclic object")) {
636
- return "[Circular]";
637
- }
638
- throw err;
639
- }
640
- default:
641
- return x;
642
- }
643
- });
644
- for (let x = args[i]; i < len; x = args[++i]) {
645
- if (x === null || typeof x !== "object") {
646
- str += ` ${x}`;
647
- } else {
648
- str += ` ${formatArg(x)}`;
649
- }
650
- }
651
- return str;
652
- }
653
- function format(...args) {
654
- return baseFormat(args);
655
- }
656
- function inspect(obj, options = {}) {
657
- if (options.truncate === 0) {
658
- options.truncate = Number.POSITIVE_INFINITY;
659
- }
660
- return inspect$1(obj, options);
661
- }
662
- function objDisplay(obj, options = {}) {
663
- if (typeof options.truncate === "undefined") {
664
- options.truncate = 40;
665
- }
666
- const str = inspect(obj, options);
667
- const type = Object.prototype.toString.call(obj);
668
- if (options.truncate && str.length >= options.truncate) {
669
- if (type === "[object Function]") {
670
- const fn = obj;
671
- return !fn.name ? "[Function]" : `[Function: ${fn.name}]`;
672
- } else if (type === "[object Array]") {
673
- return `[ Array(${obj.length}) ]`;
674
- } else if (type === "[object Object]") {
675
- const keys = Object.keys(obj);
676
- const kstr = keys.length > 2 ? `${keys.splice(0, 2).join(", ")}, ...` : keys.join(", ");
677
- return `{ Object (${kstr}) }`;
678
- } else {
679
- return str;
680
- }
681
- }
682
- return str;
683
- }
684
- export {
685
- format,
686
- formatRegExp,
687
- inspect,
688
- objDisplay,
689
- stringify
690
- };