@voidzero-dev/vite-plus-test 0.0.0-0bfcc90f.20260209-0731
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/LICENSE.md +691 -0
- package/browser/context.d.ts +4 -0
- package/browser/context.js +20 -0
- package/config.d.ts +3 -0
- package/coverage.d.ts +1 -0
- package/dist/@vitest/browser/client/.vite/manifest.json +24 -0
- package/dist/@vitest/browser/client/__vitest__/assets/index-BUCFJtth.js +57 -0
- package/dist/@vitest/browser/client/__vitest__/assets/index-DlhE0rqZ.css +1 -0
- package/dist/@vitest/browser/client/__vitest__/bg.png +0 -0
- package/dist/@vitest/browser/client/__vitest__/favicon.ico +0 -0
- package/dist/@vitest/browser/client/__vitest__/favicon.svg +5 -0
- package/dist/@vitest/browser/client/__vitest__/index.html +32 -0
- package/dist/@vitest/browser/client/__vitest_browser__/orchestrator-S_3e_uzt.js +345 -0
- package/dist/@vitest/browser/client/__vitest_browser__/tester-k74mgIRa.js +2171 -0
- package/dist/@vitest/browser/client/__vitest_browser__/utils-uxqdqUz8.js +223 -0
- package/dist/@vitest/browser/client/error-catcher.js +82 -0
- package/dist/@vitest/browser/client/esm-client-injector.js +67 -0
- package/dist/@vitest/browser/client/favicon.svg +5 -0
- package/dist/@vitest/browser/client/orchestrator.html +35 -0
- package/dist/@vitest/browser/client/tester/tester.html +13 -0
- package/dist/@vitest/browser/client.js +456 -0
- package/dist/@vitest/browser/context.d.ts +792 -0
- package/dist/@vitest/browser/context.js +541 -0
- package/dist/@vitest/browser/expect-element.js +32 -0
- package/dist/@vitest/browser/index-D6m36C6U.js +11 -0
- package/dist/@vitest/browser/index.d.ts +73 -0
- package/dist/@vitest/browser/index.js +3513 -0
- package/dist/@vitest/browser/jest-dom.d.ts +724 -0
- package/dist/@vitest/browser/locators.d.ts +354 -0
- package/dist/@vitest/browser/locators.js +1 -0
- package/dist/@vitest/browser/matchers.d.ts +29 -0
- package/dist/@vitest/browser/shared/screenshotMatcher/types.d.ts +22 -0
- package/dist/@vitest/browser/state.js +280 -0
- package/dist/@vitest/browser/types.d.ts +69 -0
- package/dist/@vitest/browser-playwright/context.d.ts +1 -0
- package/dist/@vitest/browser-playwright/index.d.ts +106 -0
- package/dist/@vitest/browser-playwright/index.js +1111 -0
- package/dist/@vitest/browser-playwright/locators.js +114 -0
- package/dist/@vitest/browser-preview/context.d.ts +1 -0
- package/dist/@vitest/browser-preview/index.d.ts +19 -0
- package/dist/@vitest/browser-preview/index.js +148 -0
- package/dist/@vitest/browser-preview/locators.js +79 -0
- package/dist/@vitest/browser-webdriverio/context.d.ts +1 -0
- package/dist/@vitest/browser-webdriverio/index.d.ts +63 -0
- package/dist/@vitest/browser-webdriverio/index.js +600 -0
- package/dist/@vitest/browser-webdriverio/locators.js +163 -0
- package/dist/@vitest/expect/index.d.ts +807 -0
- package/dist/@vitest/expect/index.js +1875 -0
- package/dist/@vitest/mocker/auto-register.d.ts +2 -0
- package/dist/@vitest/mocker/auto-register.js +9 -0
- package/dist/@vitest/mocker/automock.d.ts +12 -0
- package/dist/@vitest/mocker/automock.js +1 -0
- package/dist/@vitest/mocker/browser.d.ts +53 -0
- package/dist/@vitest/mocker/browser.js +91 -0
- package/dist/@vitest/mocker/chunk-automock.js +354 -0
- package/dist/@vitest/mocker/chunk-interceptor-native.js +15 -0
- package/dist/@vitest/mocker/chunk-mocker.js +521 -0
- package/dist/@vitest/mocker/chunk-pathe.M-eThtNZ.js +174 -0
- package/dist/@vitest/mocker/chunk-registry.js +185 -0
- package/dist/@vitest/mocker/chunk-utils.js +16 -0
- package/dist/@vitest/mocker/index.d-C-sLYZi-.d.ts +25 -0
- package/dist/@vitest/mocker/index.d.ts +2 -0
- package/dist/@vitest/mocker/index.js +185 -0
- package/dist/@vitest/mocker/mocker.d-TnKRhz7N.d.ts +81 -0
- package/dist/@vitest/mocker/node.d.ts +800 -0
- package/dist/@vitest/mocker/node.js +966 -0
- package/dist/@vitest/mocker/redirect.d.ts +3 -0
- package/dist/@vitest/mocker/redirect.js +79 -0
- package/dist/@vitest/mocker/register.d.ts +9 -0
- package/dist/@vitest/mocker/register.js +41 -0
- package/dist/@vitest/mocker/types.d-B8CCKmHt.d.ts +107 -0
- package/dist/@vitest/pretty-format/index.d.ts +124 -0
- package/dist/@vitest/pretty-format/index.js +1022 -0
- package/dist/@vitest/runner/chunk-tasks.js +340 -0
- package/dist/@vitest/runner/index.d.ts +180 -0
- package/dist/@vitest/runner/index.js +2114 -0
- package/dist/@vitest/runner/tasks.d-C7UxawJ9.d.ts +834 -0
- package/dist/@vitest/runner/types.d.ts +183 -0
- package/dist/@vitest/runner/types.js +1 -0
- package/dist/@vitest/runner/utils.d.ts +45 -0
- package/dist/@vitest/runner/utils.js +5 -0
- package/dist/@vitest/snapshot/environment.d-DHdQ1Csl.d.ts +22 -0
- package/dist/@vitest/snapshot/environment.d.ts +16 -0
- package/dist/@vitest/snapshot/environment.js +40 -0
- package/dist/@vitest/snapshot/index.d.ts +130 -0
- package/dist/@vitest/snapshot/index.js +1437 -0
- package/dist/@vitest/snapshot/manager.d.ts +18 -0
- package/dist/@vitest/snapshot/manager.js +73 -0
- package/dist/@vitest/snapshot/rawSnapshot.d-lFsMJFUd.d.ts +61 -0
- package/dist/@vitest/spy/index.d.ts +384 -0
- package/dist/@vitest/spy/index.js +433 -0
- package/dist/@vitest/utils/chunk-_commonjsHelpers.js +5 -0
- package/dist/@vitest/utils/chunk-pathe.M-eThtNZ.js +156 -0
- package/dist/@vitest/utils/constants.d.ts +21 -0
- package/dist/@vitest/utils/constants.js +49 -0
- package/dist/@vitest/utils/diff.d.ts +93 -0
- package/dist/@vitest/utils/diff.js +2199 -0
- package/dist/@vitest/utils/display.d.ts +29 -0
- package/dist/@vitest/utils/display.js +742 -0
- package/dist/@vitest/utils/error.d.ts +7 -0
- package/dist/@vitest/utils/error.js +42 -0
- package/dist/@vitest/utils/helpers.d.ts +73 -0
- package/dist/@vitest/utils/helpers.js +295 -0
- package/dist/@vitest/utils/highlight.d.ts +9 -0
- package/dist/@vitest/utils/highlight.js +538 -0
- package/dist/@vitest/utils/index.d.ts +5 -0
- package/dist/@vitest/utils/index.js +1 -0
- package/dist/@vitest/utils/offset.d.ts +5 -0
- package/dist/@vitest/utils/offset.js +32 -0
- package/dist/@vitest/utils/resolver.d.ts +7 -0
- package/dist/@vitest/utils/resolver.js +71 -0
- package/dist/@vitest/utils/serialize.d.ts +3 -0
- package/dist/@vitest/utils/serialize.js +118 -0
- package/dist/@vitest/utils/source-map.d.ts +55 -0
- package/dist/@vitest/utils/source-map.js +478 -0
- package/dist/@vitest/utils/timers.d.ts +33 -0
- package/dist/@vitest/utils/timers.js +49 -0
- package/dist/@vitest/utils/types.d-BCElaP-c.d.ts +53 -0
- package/dist/@vitest/utils/types.d.ts +34 -0
- package/dist/@vitest/utils/types.js +1 -0
- package/dist/browser-compat.js +3 -0
- package/dist/browser.d.ts +46 -0
- package/dist/browser.js +20 -0
- package/dist/chunks/_commonjsHelpers.D26ty3Ew.js +6 -0
- package/dist/chunks/base.CJ0Y4ePK.js +165 -0
- package/dist/chunks/benchmark.B3N2zMcH.js +40 -0
- package/dist/chunks/benchmark.d.DAaHLpsq.d.ts +24 -0
- package/dist/chunks/browser.d.ChKACdzH.d.ts +59 -0
- package/dist/chunks/cac.DVeoLl0M.js +1409 -0
- package/dist/chunks/cli-api.B7PN_QUv.js +13672 -0
- package/dist/chunks/config.d.Cy95HiCx.d.ts +210 -0
- package/dist/chunks/console.Cf-YriPC.js +146 -0
- package/dist/chunks/constants.D_Q9UYh-.js +36 -0
- package/dist/chunks/coverage.AVPTjMgw.js +3292 -0
- package/dist/chunks/coverage.D_JHT54q.js +25 -0
- package/dist/chunks/coverage.d.BZtK59WP.d.ts +37 -0
- package/dist/chunks/creator.DAmOKTvJ.js +673 -0
- package/dist/chunks/date.Bq6ZW5rf.js +73 -0
- package/dist/chunks/defaults.BOqNVLsY.js +74 -0
- package/dist/chunks/env.D4Lgay0q.js +8 -0
- package/dist/chunks/environment.d.CrsxCzP1.d.ts +29 -0
- package/dist/chunks/evaluatedModules.Dg1zASAC.js +17 -0
- package/dist/chunks/evaluatedModules.d.BxJ5omdx.d.ts +7 -0
- package/dist/chunks/git.Bm2pzPAa.js +71 -0
- package/dist/chunks/global.d.B15mdLcR.d.ts +99 -0
- package/dist/chunks/globals.DOayXfHP.js +30 -0
- package/dist/chunks/index.6Qv1eEA6.js +109 -0
- package/dist/chunks/index.C5r1PdPD.js +231 -0
- package/dist/chunks/index.Chj8NDwU.js +206 -0
- package/dist/chunks/index.CyBMJtT7.js +727 -0
- package/dist/chunks/index.D3XRDfWc.js +213 -0
- package/dist/chunks/index.D4KonVSU.js +6343 -0
- package/dist/chunks/index.M8mOzt4Y.js +3839 -0
- package/dist/chunks/index.Z5E_ObnR.js +37 -0
- package/dist/chunks/init-forks._y3TW739.js +41 -0
- package/dist/chunks/init-threads.DBO2kn-p.js +18 -0
- package/dist/chunks/init.B6MLFIaN.js +334 -0
- package/dist/chunks/inspector.CvyFGlXm.js +53 -0
- package/dist/chunks/modules.BJuCwlRJ.js +36 -0
- package/dist/chunks/node.Ce0vMQM7.js +14 -0
- package/dist/chunks/plugin.d.CtqpEehP.d.ts +38 -0
- package/dist/chunks/reporters.d.CWXNI2jG.d.ts +3271 -0
- package/dist/chunks/rpc.BoxB0q7B.js +76 -0
- package/dist/chunks/rpc.d.RH3apGEf.d.ts +64 -0
- package/dist/chunks/setup-common.Cm-kSBVi.js +60 -0
- package/dist/chunks/startModuleRunner.DEj0jb3e.js +861 -0
- package/dist/chunks/suite.d.BJWk38HB.d.ts +10 -0
- package/dist/chunks/test.B8ej_ZHS.js +254 -0
- package/dist/chunks/traces.CCmnQaNT.js +217 -0
- package/dist/chunks/traces.d.402V_yFI.d.ts +18 -0
- package/dist/chunks/utils.DvEY5TfP.js +52 -0
- package/dist/chunks/vi.2VT5v0um.js +3919 -0
- package/dist/chunks/vm.D3epNOPZ.js +744 -0
- package/dist/chunks/worker.d.Dyxm8DEL.d.ts +255 -0
- package/dist/cli.js +28 -0
- package/dist/client/.vite/manifest.json +24 -0
- package/dist/client/__vitest__/assets/index-BUCFJtth.js +57 -0
- package/dist/client/__vitest__/assets/index-DlhE0rqZ.css +1 -0
- package/dist/client/__vitest__/bg.png +0 -0
- package/dist/client/__vitest__/favicon.ico +0 -0
- package/dist/client/__vitest__/favicon.svg +5 -0
- package/dist/client/__vitest__/index.html +32 -0
- package/dist/client/__vitest_browser__/orchestrator-S_3e_uzt.js +345 -0
- package/dist/client/__vitest_browser__/tester-k74mgIRa.js +2171 -0
- package/dist/client/__vitest_browser__/utils-uxqdqUz8.js +223 -0
- package/dist/client/error-catcher.js +82 -0
- package/dist/client/esm-client-injector.js +67 -0
- package/dist/client/favicon.svg +5 -0
- package/dist/client/orchestrator.html +35 -0
- package/dist/client/tester/tester.html +13 -0
- package/dist/client.js +456 -0
- package/dist/config.cjs +94 -0
- package/dist/config.d.ts +104 -0
- package/dist/config.js +15 -0
- package/dist/context.js +541 -0
- package/dist/coverage.d.ts +118 -0
- package/dist/coverage.js +23 -0
- package/dist/dummy.js +2 -0
- package/dist/environments.d.ts +22 -0
- package/dist/environments.js +3 -0
- package/dist/expect-element.js +27 -0
- package/dist/index-D6m36C6U.js +6 -0
- package/dist/index-node.js +7 -0
- package/dist/index.d.ts +510 -0
- package/dist/index.js +19 -0
- package/dist/locators.d.ts +354 -0
- package/dist/locators.js +1 -0
- package/dist/mocker.d.ts +1 -0
- package/dist/mocker.js +1 -0
- package/dist/module-evaluator.d.ts +124 -0
- package/dist/module-evaluator.js +343 -0
- package/dist/module-runner-stub.js +44 -0
- package/dist/module-runner.js +17 -0
- package/dist/node.d.ts +251 -0
- package/dist/node.js +98 -0
- package/dist/path.js +7 -0
- package/dist/plugins/browser-client.mjs +2 -0
- package/dist/plugins/browser-context.mjs +2 -0
- package/dist/plugins/browser-locators.mjs +2 -0
- package/dist/plugins/browser-playwright.mjs +2 -0
- package/dist/plugins/browser-preview.mjs +2 -0
- package/dist/plugins/browser-webdriverio.mjs +2 -0
- package/dist/plugins/browser.mjs +2 -0
- package/dist/plugins/expect.mjs +2 -0
- package/dist/plugins/mocker-automock.mjs +2 -0
- package/dist/plugins/mocker-browser.mjs +2 -0
- package/dist/plugins/mocker-node.mjs +2 -0
- package/dist/plugins/mocker-redirect.mjs +2 -0
- package/dist/plugins/mocker-register.mjs +2 -0
- package/dist/plugins/mocker.mjs +2 -0
- package/dist/plugins/pretty-format.mjs +2 -0
- package/dist/plugins/runner-types.mjs +2 -0
- package/dist/plugins/runner-utils.mjs +2 -0
- package/dist/plugins/runner.mjs +2 -0
- package/dist/plugins/snapshot-environment.mjs +2 -0
- package/dist/plugins/snapshot-manager.mjs +2 -0
- package/dist/plugins/snapshot.mjs +2 -0
- package/dist/plugins/spy.mjs +2 -0
- package/dist/plugins/utils-constants.mjs +2 -0
- package/dist/plugins/utils-diff.mjs +2 -0
- package/dist/plugins/utils-display.mjs +2 -0
- package/dist/plugins/utils-error.mjs +2 -0
- package/dist/plugins/utils-helpers.mjs +2 -0
- package/dist/plugins/utils-highlight.mjs +2 -0
- package/dist/plugins/utils-offset.mjs +2 -0
- package/dist/plugins/utils-resolver.mjs +2 -0
- package/dist/plugins/utils-serialize.mjs +2 -0
- package/dist/plugins/utils-source-map.mjs +2 -0
- package/dist/plugins/utils-timers.mjs +2 -0
- package/dist/plugins/utils.mjs +2 -0
- package/dist/reporters.d.ts +27 -0
- package/dist/reporters.js +24 -0
- package/dist/runners.d.ts +50 -0
- package/dist/runners.js +19 -0
- package/dist/shared/screenshotMatcher/types.d.ts +22 -0
- package/dist/snapshot.d.ts +9 -0
- package/dist/snapshot.js +4 -0
- package/dist/spy.js +1 -0
- package/dist/state.js +280 -0
- package/dist/suite.d.ts +5 -0
- package/dist/suite.js +6 -0
- package/dist/types.d.ts +69 -0
- package/dist/vendor/chai.d.mts +1 -0
- package/dist/vendor/chai.mjs +3577 -0
- package/dist/vendor/es-module-lexer.d.mts +193 -0
- package/dist/vendor/es-module-lexer.mjs +79 -0
- package/dist/vendor/estree-walker.d.mts +583 -0
- package/dist/vendor/estree-walker.mjs +339 -0
- package/dist/vendor/expect-type.d.mts +1574 -0
- package/dist/vendor/expect-type.mjs +214 -0
- package/dist/vendor/magic-string.d.mts +261 -0
- package/dist/vendor/magic-string.mjs +1700 -0
- package/dist/vendor/obug.d.mts +56 -0
- package/dist/vendor/obug.mjs +276 -0
- package/dist/vendor/pathe.d.mts +46 -0
- package/dist/vendor/pathe.mjs +496 -0
- package/dist/vendor/picomatch.d.mts +1 -0
- package/dist/vendor/picomatch.mjs +1855 -0
- package/dist/vendor/shared-3g9mwCWP.mjs +31 -0
- package/dist/vendor/std-env.d.mts +88 -0
- package/dist/vendor/std-env.mjs +159 -0
- package/dist/vendor/tinybench.d.mts +317 -0
- package/dist/vendor/tinybench.mjs +504 -0
- package/dist/vendor/tinyexec.d.mts +72 -0
- package/dist/vendor/tinyexec.mjs +637 -0
- package/dist/vendor/tinyglobby.d.mts +157 -0
- package/dist/vendor/tinyglobby.mjs +832 -0
- package/dist/vendor/tinyrainbow.d.mts +60 -0
- package/dist/vendor/tinyrainbow.mjs +93 -0
- package/dist/vendor/vitest_browser.mjs +2 -0
- package/dist/vendor/vitest_internal_browser.mjs +2 -0
- package/dist/vendor/vitest_runner.mjs +2 -0
- package/dist/vendor/vitest_runners.mjs +2 -0
- package/dist/worker.d.ts +32 -0
- package/dist/worker.js +48 -0
- package/dist/workers/forks.js +54 -0
- package/dist/workers/runVmTests.js +95 -0
- package/dist/workers/threads.js +55 -0
- package/dist/workers/vmForks.js +36 -0
- package/dist/workers/vmThreads.js +37 -0
- package/environments.d.ts +1 -0
- package/globals.d.ts +20 -0
- package/import-meta.d.ts +5 -0
- package/importMeta.d.ts +4 -0
- package/index.cjs +5 -0
- package/index.d.cts +1 -0
- package/jsdom.d.ts +6 -0
- package/mocker.d.ts +1 -0
- package/node.d.ts +1 -0
- package/optional-types.d.ts +7 -0
- package/package.json +335 -0
- package/reporters.d.ts +1 -0
- package/runners.d.ts +1 -0
- package/snapshot.d.ts +1 -0
- package/suite.d.ts +1 -0
- package/suppress-warnings.cjs +21 -0
- package/vitest.mjs +2 -0
- package/worker.d.ts +1 -0
|
@@ -0,0 +1,1022 @@
|
|
|
1
|
+
import styles from '../../vendor/tinyrainbow.mjs';
|
|
2
|
+
|
|
3
|
+
function _mergeNamespaces(n, m) {
|
|
4
|
+
m.forEach(function (e) {
|
|
5
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
6
|
+
if (k !== 'default' && !(k in n)) {
|
|
7
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
8
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return e[k]; }
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
return Object.freeze(n);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function getKeysOfEnumerableProperties(object, compareKeys) {
|
|
19
|
+
const rawKeys = Object.keys(object);
|
|
20
|
+
const keys = compareKeys === null ? rawKeys : rawKeys.sort(compareKeys);
|
|
21
|
+
if (Object.getOwnPropertySymbols) {
|
|
22
|
+
for (const symbol of Object.getOwnPropertySymbols(object)) {
|
|
23
|
+
if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
|
|
24
|
+
keys.push(symbol);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return keys;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Return entries (for example, of a map)
|
|
32
|
+
* with spacing, indentation, and comma
|
|
33
|
+
* without surrounding punctuation (for example, braces)
|
|
34
|
+
*/
|
|
35
|
+
function printIteratorEntries(iterator, config, indentation, depth, refs, printer, separator = ": ") {
|
|
36
|
+
let result = "";
|
|
37
|
+
let width = 0;
|
|
38
|
+
let current = iterator.next();
|
|
39
|
+
if (!current.done) {
|
|
40
|
+
result += config.spacingOuter;
|
|
41
|
+
const indentationNext = indentation + config.indent;
|
|
42
|
+
while (!current.done) {
|
|
43
|
+
result += indentationNext;
|
|
44
|
+
if (width++ === config.maxWidth) {
|
|
45
|
+
result += "…";
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
const name = printer(current.value[0], config, indentationNext, depth, refs);
|
|
49
|
+
const value = printer(current.value[1], config, indentationNext, depth, refs);
|
|
50
|
+
result += name + separator + value;
|
|
51
|
+
current = iterator.next();
|
|
52
|
+
if (!current.done) {
|
|
53
|
+
result += `,${config.spacingInner}`;
|
|
54
|
+
} else if (!config.min) {
|
|
55
|
+
result += ",";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
result += config.spacingOuter + indentation;
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Return values (for example, of a set)
|
|
64
|
+
* with spacing, indentation, and comma
|
|
65
|
+
* without surrounding punctuation (braces or brackets)
|
|
66
|
+
*/
|
|
67
|
+
function printIteratorValues(iterator, config, indentation, depth, refs, printer) {
|
|
68
|
+
let result = "";
|
|
69
|
+
let width = 0;
|
|
70
|
+
let current = iterator.next();
|
|
71
|
+
if (!current.done) {
|
|
72
|
+
result += config.spacingOuter;
|
|
73
|
+
const indentationNext = indentation + config.indent;
|
|
74
|
+
while (!current.done) {
|
|
75
|
+
result += indentationNext;
|
|
76
|
+
if (width++ === config.maxWidth) {
|
|
77
|
+
result += "…";
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
result += printer(current.value, config, indentationNext, depth, refs);
|
|
81
|
+
current = iterator.next();
|
|
82
|
+
if (!current.done) {
|
|
83
|
+
result += `,${config.spacingInner}`;
|
|
84
|
+
} else if (!config.min) {
|
|
85
|
+
result += ",";
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
result += config.spacingOuter + indentation;
|
|
89
|
+
}
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Return items (for example, of an array)
|
|
94
|
+
* with spacing, indentation, and comma
|
|
95
|
+
* without surrounding punctuation (for example, brackets)
|
|
96
|
+
*/
|
|
97
|
+
function printListItems(list, config, indentation, depth, refs, printer) {
|
|
98
|
+
let result = "";
|
|
99
|
+
list = list instanceof ArrayBuffer ? new DataView(list) : list;
|
|
100
|
+
const isDataView = (l) => l instanceof DataView;
|
|
101
|
+
const length = isDataView(list) ? list.byteLength : list.length;
|
|
102
|
+
if (length > 0) {
|
|
103
|
+
result += config.spacingOuter;
|
|
104
|
+
const indentationNext = indentation + config.indent;
|
|
105
|
+
for (let i = 0; i < length; i++) {
|
|
106
|
+
result += indentationNext;
|
|
107
|
+
if (i === config.maxWidth) {
|
|
108
|
+
result += "…";
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
if (isDataView(list) || i in list) {
|
|
112
|
+
result += printer(isDataView(list) ? list.getInt8(i) : list[i], config, indentationNext, depth, refs);
|
|
113
|
+
}
|
|
114
|
+
if (i < length - 1) {
|
|
115
|
+
result += `,${config.spacingInner}`;
|
|
116
|
+
} else if (!config.min) {
|
|
117
|
+
result += ",";
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
result += config.spacingOuter + indentation;
|
|
121
|
+
}
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Return properties of an object
|
|
126
|
+
* with spacing, indentation, and comma
|
|
127
|
+
* without surrounding punctuation (for example, braces)
|
|
128
|
+
*/
|
|
129
|
+
function printObjectProperties(val, config, indentation, depth, refs, printer) {
|
|
130
|
+
let result = "";
|
|
131
|
+
const keys = getKeysOfEnumerableProperties(val, config.compareKeys);
|
|
132
|
+
if (keys.length > 0) {
|
|
133
|
+
result += config.spacingOuter;
|
|
134
|
+
const indentationNext = indentation + config.indent;
|
|
135
|
+
for (let i = 0; i < keys.length; i++) {
|
|
136
|
+
const key = keys[i];
|
|
137
|
+
const name = printer(key, config, indentationNext, depth, refs);
|
|
138
|
+
const value = printer(val[key], config, indentationNext, depth, refs);
|
|
139
|
+
result += `${indentationNext + name}: ${value}`;
|
|
140
|
+
if (i < keys.length - 1) {
|
|
141
|
+
result += `,${config.spacingInner}`;
|
|
142
|
+
} else if (!config.min) {
|
|
143
|
+
result += ",";
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
result += config.spacingOuter + indentation;
|
|
147
|
+
}
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const asymmetricMatcher = typeof Symbol === "function" && Symbol.for ? Symbol.for("jest.asymmetricMatcher") : 1267621;
|
|
152
|
+
const SPACE$2 = " ";
|
|
153
|
+
const serialize$5 = (val, config, indentation, depth, refs, printer) => {
|
|
154
|
+
const stringedValue = val.toString();
|
|
155
|
+
if (stringedValue === "ArrayContaining" || stringedValue === "ArrayNotContaining") {
|
|
156
|
+
if (++depth > config.maxDepth) {
|
|
157
|
+
return `[${stringedValue}]`;
|
|
158
|
+
}
|
|
159
|
+
return `${stringedValue + SPACE$2}[${printListItems(val.sample, config, indentation, depth, refs, printer)}]`;
|
|
160
|
+
}
|
|
161
|
+
if (stringedValue === "ObjectContaining" || stringedValue === "ObjectNotContaining") {
|
|
162
|
+
if (++depth > config.maxDepth) {
|
|
163
|
+
return `[${stringedValue}]`;
|
|
164
|
+
}
|
|
165
|
+
return `${stringedValue + SPACE$2}{${printObjectProperties(val.sample, config, indentation, depth, refs, printer)}}`;
|
|
166
|
+
}
|
|
167
|
+
if (stringedValue === "StringMatching" || stringedValue === "StringNotMatching") {
|
|
168
|
+
return stringedValue + SPACE$2 + printer(val.sample, config, indentation, depth, refs);
|
|
169
|
+
}
|
|
170
|
+
if (stringedValue === "StringContaining" || stringedValue === "StringNotContaining") {
|
|
171
|
+
return stringedValue + SPACE$2 + printer(val.sample, config, indentation, depth, refs);
|
|
172
|
+
}
|
|
173
|
+
if (typeof val.toAsymmetricMatcher !== "function") {
|
|
174
|
+
throw new TypeError(`Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()`);
|
|
175
|
+
}
|
|
176
|
+
return val.toAsymmetricMatcher();
|
|
177
|
+
};
|
|
178
|
+
const test$5 = (val) => val && val.$$typeof === asymmetricMatcher;
|
|
179
|
+
const plugin$5 = {
|
|
180
|
+
serialize: serialize$5,
|
|
181
|
+
test: test$5
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const SPACE$1 = " ";
|
|
185
|
+
const OBJECT_NAMES = new Set(["DOMStringMap", "NamedNodeMap"]);
|
|
186
|
+
const ARRAY_REGEXP = /^(?:HTML\w*Collection|NodeList)$/;
|
|
187
|
+
function testName(name) {
|
|
188
|
+
return OBJECT_NAMES.has(name) || ARRAY_REGEXP.test(name);
|
|
189
|
+
}
|
|
190
|
+
const test$4 = (val) => val && val.constructor && !!val.constructor.name && testName(val.constructor.name);
|
|
191
|
+
function isNamedNodeMap(collection) {
|
|
192
|
+
return collection.constructor.name === "NamedNodeMap";
|
|
193
|
+
}
|
|
194
|
+
const serialize$4 = (collection, config, indentation, depth, refs, printer) => {
|
|
195
|
+
const name = collection.constructor.name;
|
|
196
|
+
if (++depth > config.maxDepth) {
|
|
197
|
+
return `[${name}]`;
|
|
198
|
+
}
|
|
199
|
+
return (config.min ? "" : name + SPACE$1) + (OBJECT_NAMES.has(name) ? `{${printObjectProperties(isNamedNodeMap(collection) ? [...collection].reduce((props, attribute) => {
|
|
200
|
+
props[attribute.name] = attribute.value;
|
|
201
|
+
return props;
|
|
202
|
+
}, {}) : { ...collection }, config, indentation, depth, refs, printer)}}` : `[${printListItems([...collection], config, indentation, depth, refs, printer)}]`);
|
|
203
|
+
};
|
|
204
|
+
const plugin$4 = {
|
|
205
|
+
serialize: serialize$4,
|
|
206
|
+
test: test$4
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
211
|
+
*
|
|
212
|
+
* This source code is licensed under the MIT license found in the
|
|
213
|
+
* LICENSE file in the root directory of this source tree.
|
|
214
|
+
*/
|
|
215
|
+
function escapeHTML(str) {
|
|
216
|
+
return str.replaceAll("<", "<").replaceAll(">", ">");
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Return empty string if keys is empty.
|
|
220
|
+
function printProps(keys, props, config, indentation, depth, refs, printer) {
|
|
221
|
+
const indentationNext = indentation + config.indent;
|
|
222
|
+
const colors = config.colors;
|
|
223
|
+
return keys.map((key) => {
|
|
224
|
+
const value = props[key];
|
|
225
|
+
// hidden injected value that should not be printed
|
|
226
|
+
if (typeof value === "string" && value[0] === "_" && value.startsWith("__vitest_") && value.match(/__vitest_\d+__/)) {
|
|
227
|
+
return "";
|
|
228
|
+
}
|
|
229
|
+
let printed = printer(value, config, indentationNext, depth, refs);
|
|
230
|
+
if (typeof value !== "string") {
|
|
231
|
+
if (printed.includes("\n")) {
|
|
232
|
+
printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
|
|
233
|
+
}
|
|
234
|
+
printed = `{${printed}}`;
|
|
235
|
+
}
|
|
236
|
+
return `${config.spacingInner + indentation + colors.prop.open + key + colors.prop.close}=${colors.value.open}${printed}${colors.value.close}`;
|
|
237
|
+
}).join("");
|
|
238
|
+
}
|
|
239
|
+
// Return empty string if children is empty.
|
|
240
|
+
function printChildren(children, config, indentation, depth, refs, printer) {
|
|
241
|
+
return children.map((child) => config.spacingOuter + indentation + (typeof child === "string" ? printText(child, config) : printer(child, config, indentation, depth, refs))).join("");
|
|
242
|
+
}
|
|
243
|
+
function printShadowRoot(children, config, indentation, depth, refs, printer) {
|
|
244
|
+
if (config.printShadowRoot === false) {
|
|
245
|
+
return "";
|
|
246
|
+
}
|
|
247
|
+
return [`${config.spacingOuter + indentation}#shadow-root`, printChildren(children, config, indentation + config.indent, depth, refs, printer)].join("");
|
|
248
|
+
}
|
|
249
|
+
function printText(text, config) {
|
|
250
|
+
const contentColor = config.colors.content;
|
|
251
|
+
return contentColor.open + escapeHTML(text) + contentColor.close;
|
|
252
|
+
}
|
|
253
|
+
function printComment(comment, config) {
|
|
254
|
+
const commentColor = config.colors.comment;
|
|
255
|
+
return `${commentColor.open}<!--${escapeHTML(comment)}-->${commentColor.close}`;
|
|
256
|
+
}
|
|
257
|
+
// Separate the functions to format props, children, and element,
|
|
258
|
+
// so a plugin could override a particular function, if needed.
|
|
259
|
+
// Too bad, so sad: the traditional (but unnecessary) space
|
|
260
|
+
// in a self-closing tagColor requires a second test of printedProps.
|
|
261
|
+
function printElement(type, printedProps, printedChildren, config, indentation) {
|
|
262
|
+
const tagColor = config.colors.tag;
|
|
263
|
+
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}`;
|
|
264
|
+
}
|
|
265
|
+
function printElementAsLeaf(type, config) {
|
|
266
|
+
const tagColor = config.colors.tag;
|
|
267
|
+
return `${tagColor.open}<${type}${tagColor.close} …${tagColor.open} />${tagColor.close}`;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const ELEMENT_NODE = 1;
|
|
271
|
+
const TEXT_NODE = 3;
|
|
272
|
+
const COMMENT_NODE = 8;
|
|
273
|
+
const FRAGMENT_NODE = 11;
|
|
274
|
+
const ELEMENT_REGEXP = /^(?:(?:HTML|SVG)\w*)?Element$/;
|
|
275
|
+
function testHasAttribute(val) {
|
|
276
|
+
try {
|
|
277
|
+
return typeof val.hasAttribute === "function" && val.hasAttribute("is");
|
|
278
|
+
} catch {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function testNode(val) {
|
|
283
|
+
const constructorName = val.constructor.name;
|
|
284
|
+
const { nodeType, tagName } = val;
|
|
285
|
+
const isCustomElement = typeof tagName === "string" && tagName.includes("-") || testHasAttribute(val);
|
|
286
|
+
return nodeType === ELEMENT_NODE && (ELEMENT_REGEXP.test(constructorName) || isCustomElement) || nodeType === TEXT_NODE && constructorName === "Text" || nodeType === COMMENT_NODE && constructorName === "Comment" || nodeType === FRAGMENT_NODE && constructorName === "DocumentFragment";
|
|
287
|
+
}
|
|
288
|
+
const test$3 = (val) => val?.constructor?.name && testNode(val);
|
|
289
|
+
function nodeIsText(node) {
|
|
290
|
+
return node.nodeType === TEXT_NODE;
|
|
291
|
+
}
|
|
292
|
+
function nodeIsComment(node) {
|
|
293
|
+
return node.nodeType === COMMENT_NODE;
|
|
294
|
+
}
|
|
295
|
+
function nodeIsFragment(node) {
|
|
296
|
+
return node.nodeType === FRAGMENT_NODE;
|
|
297
|
+
}
|
|
298
|
+
const serialize$3 = (node, config, indentation, depth, refs, printer) => {
|
|
299
|
+
if (nodeIsText(node)) {
|
|
300
|
+
return printText(node.data, config);
|
|
301
|
+
}
|
|
302
|
+
if (nodeIsComment(node)) {
|
|
303
|
+
return printComment(node.data, config);
|
|
304
|
+
}
|
|
305
|
+
const type = nodeIsFragment(node) ? "DocumentFragment" : node.tagName.toLowerCase();
|
|
306
|
+
if (++depth > config.maxDepth) {
|
|
307
|
+
return printElementAsLeaf(type, config);
|
|
308
|
+
}
|
|
309
|
+
return printElement(type, printProps(nodeIsFragment(node) ? [] : Array.from(node.attributes, (attr) => attr.name).sort(), nodeIsFragment(node) ? {} : [...node.attributes].reduce((props, attribute) => {
|
|
310
|
+
props[attribute.name] = attribute.value;
|
|
311
|
+
return props;
|
|
312
|
+
}, {}), config, indentation + config.indent, depth, refs, printer), (nodeIsFragment(node) || !node.shadowRoot ? "" : printShadowRoot(Array.prototype.slice.call(node.shadowRoot.children), config, indentation + config.indent, depth, refs, printer)) + printChildren(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
|
|
313
|
+
};
|
|
314
|
+
const plugin$3 = {
|
|
315
|
+
serialize: serialize$3,
|
|
316
|
+
test: test$3
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
// SENTINEL constants are from https://github.com/facebook/immutable-js
|
|
320
|
+
const IS_ITERABLE_SENTINEL = "@@__IMMUTABLE_ITERABLE__@@";
|
|
321
|
+
const IS_LIST_SENTINEL = "@@__IMMUTABLE_LIST__@@";
|
|
322
|
+
const IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@";
|
|
323
|
+
const IS_MAP_SENTINEL = "@@__IMMUTABLE_MAP__@@";
|
|
324
|
+
const IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@";
|
|
325
|
+
const IS_RECORD_SENTINEL = "@@__IMMUTABLE_RECORD__@@";
|
|
326
|
+
const IS_SEQ_SENTINEL = "@@__IMMUTABLE_SEQ__@@";
|
|
327
|
+
const IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@";
|
|
328
|
+
const IS_STACK_SENTINEL = "@@__IMMUTABLE_STACK__@@";
|
|
329
|
+
const getImmutableName = (name) => `Immutable.${name}`;
|
|
330
|
+
const printAsLeaf = (name) => `[${name}]`;
|
|
331
|
+
const SPACE = " ";
|
|
332
|
+
const LAZY = "…";
|
|
333
|
+
function printImmutableEntries(val, config, indentation, depth, refs, printer, type) {
|
|
334
|
+
return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}{${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer)}}`;
|
|
335
|
+
}
|
|
336
|
+
// Record has an entries method because it is a collection in immutable v3.
|
|
337
|
+
// Return an iterator for Immutable Record from version v3 or v4.
|
|
338
|
+
function getRecordEntries(val) {
|
|
339
|
+
let i = 0;
|
|
340
|
+
return { next() {
|
|
341
|
+
if (i < val._keys.length) {
|
|
342
|
+
const key = val._keys[i++];
|
|
343
|
+
return {
|
|
344
|
+
done: false,
|
|
345
|
+
value: [key, val.get(key)]
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
return {
|
|
349
|
+
done: true,
|
|
350
|
+
value: undefined
|
|
351
|
+
};
|
|
352
|
+
} };
|
|
353
|
+
}
|
|
354
|
+
function printImmutableRecord(val, config, indentation, depth, refs, printer) {
|
|
355
|
+
// _name property is defined only for an Immutable Record instance
|
|
356
|
+
// which was constructed with a second optional descriptive name arg
|
|
357
|
+
const name = getImmutableName(val._name || "Record");
|
|
358
|
+
return ++depth > config.maxDepth ? printAsLeaf(name) : `${name + SPACE}{${printIteratorEntries(getRecordEntries(val), config, indentation, depth, refs, printer)}}`;
|
|
359
|
+
}
|
|
360
|
+
function printImmutableSeq(val, config, indentation, depth, refs, printer) {
|
|
361
|
+
const name = getImmutableName("Seq");
|
|
362
|
+
if (++depth > config.maxDepth) {
|
|
363
|
+
return printAsLeaf(name);
|
|
364
|
+
}
|
|
365
|
+
if (val[IS_KEYED_SENTINEL]) {
|
|
366
|
+
return `${name + SPACE}{${val._iter || val._object ? printIteratorEntries(val.entries(), config, indentation, depth, refs, printer) : LAZY}}`;
|
|
367
|
+
}
|
|
368
|
+
return `${name + SPACE}[${val._iter || val._array || val._collection || val._iterable ? printIteratorValues(val.values(), config, indentation, depth, refs, printer) : LAZY}]`;
|
|
369
|
+
}
|
|
370
|
+
function printImmutableValues(val, config, indentation, depth, refs, printer, type) {
|
|
371
|
+
return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}[${printIteratorValues(val.values(), config, indentation, depth, refs, printer)}]`;
|
|
372
|
+
}
|
|
373
|
+
const serialize$2 = (val, config, indentation, depth, refs, printer) => {
|
|
374
|
+
if (val[IS_MAP_SENTINEL]) {
|
|
375
|
+
return printImmutableEntries(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? "OrderedMap" : "Map");
|
|
376
|
+
}
|
|
377
|
+
if (val[IS_LIST_SENTINEL]) {
|
|
378
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer, "List");
|
|
379
|
+
}
|
|
380
|
+
if (val[IS_SET_SENTINEL]) {
|
|
381
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? "OrderedSet" : "Set");
|
|
382
|
+
}
|
|
383
|
+
if (val[IS_STACK_SENTINEL]) {
|
|
384
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer, "Stack");
|
|
385
|
+
}
|
|
386
|
+
if (val[IS_SEQ_SENTINEL]) {
|
|
387
|
+
return printImmutableSeq(val, config, indentation, depth, refs, printer);
|
|
388
|
+
}
|
|
389
|
+
// For compatibility with immutable v3 and v4, let record be the default.
|
|
390
|
+
return printImmutableRecord(val, config, indentation, depth, refs, printer);
|
|
391
|
+
};
|
|
392
|
+
// Explicitly comparing sentinel properties to true avoids false positive
|
|
393
|
+
// when mock identity-obj-proxy returns the key as the value for any key.
|
|
394
|
+
const test$2 = (val) => val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
|
|
395
|
+
const plugin$2 = {
|
|
396
|
+
serialize: serialize$2,
|
|
397
|
+
test: test$2
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
function getDefaultExportFromCjs(x) {
|
|
401
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
var reactIs$1 = {exports: {}};
|
|
405
|
+
|
|
406
|
+
var reactIs_production = {};
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* @license React
|
|
410
|
+
* react-is.production.js
|
|
411
|
+
*
|
|
412
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
413
|
+
*
|
|
414
|
+
* This source code is licensed under the MIT license found in the
|
|
415
|
+
* LICENSE file in the root directory of this source tree.
|
|
416
|
+
*/
|
|
417
|
+
|
|
418
|
+
var hasRequiredReactIs_production;
|
|
419
|
+
|
|
420
|
+
function requireReactIs_production () {
|
|
421
|
+
if (hasRequiredReactIs_production) return reactIs_production;
|
|
422
|
+
hasRequiredReactIs_production = 1;
|
|
423
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
424
|
+
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
425
|
+
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
426
|
+
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
427
|
+
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
|
428
|
+
REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
429
|
+
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
430
|
+
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
431
|
+
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
432
|
+
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
|
433
|
+
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
|
434
|
+
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
|
435
|
+
REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
|
|
436
|
+
REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
|
|
437
|
+
function typeOf(object) {
|
|
438
|
+
if ("object" === typeof object && null !== object) {
|
|
439
|
+
var $$typeof = object.$$typeof;
|
|
440
|
+
switch ($$typeof) {
|
|
441
|
+
case REACT_ELEMENT_TYPE:
|
|
442
|
+
switch (((object = object.type), object)) {
|
|
443
|
+
case REACT_FRAGMENT_TYPE:
|
|
444
|
+
case REACT_PROFILER_TYPE:
|
|
445
|
+
case REACT_STRICT_MODE_TYPE:
|
|
446
|
+
case REACT_SUSPENSE_TYPE:
|
|
447
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
448
|
+
case REACT_VIEW_TRANSITION_TYPE:
|
|
449
|
+
return object;
|
|
450
|
+
default:
|
|
451
|
+
switch (((object = object && object.$$typeof), object)) {
|
|
452
|
+
case REACT_CONTEXT_TYPE:
|
|
453
|
+
case REACT_FORWARD_REF_TYPE:
|
|
454
|
+
case REACT_LAZY_TYPE:
|
|
455
|
+
case REACT_MEMO_TYPE:
|
|
456
|
+
return object;
|
|
457
|
+
case REACT_CONSUMER_TYPE:
|
|
458
|
+
return object;
|
|
459
|
+
default:
|
|
460
|
+
return $$typeof;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
case REACT_PORTAL_TYPE:
|
|
464
|
+
return $$typeof;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
reactIs_production.ContextConsumer = REACT_CONSUMER_TYPE;
|
|
469
|
+
reactIs_production.ContextProvider = REACT_CONTEXT_TYPE;
|
|
470
|
+
reactIs_production.Element = REACT_ELEMENT_TYPE;
|
|
471
|
+
reactIs_production.ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
472
|
+
reactIs_production.Fragment = REACT_FRAGMENT_TYPE;
|
|
473
|
+
reactIs_production.Lazy = REACT_LAZY_TYPE;
|
|
474
|
+
reactIs_production.Memo = REACT_MEMO_TYPE;
|
|
475
|
+
reactIs_production.Portal = REACT_PORTAL_TYPE;
|
|
476
|
+
reactIs_production.Profiler = REACT_PROFILER_TYPE;
|
|
477
|
+
reactIs_production.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
478
|
+
reactIs_production.Suspense = REACT_SUSPENSE_TYPE;
|
|
479
|
+
reactIs_production.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
480
|
+
reactIs_production.isContextConsumer = function (object) {
|
|
481
|
+
return typeOf(object) === REACT_CONSUMER_TYPE;
|
|
482
|
+
};
|
|
483
|
+
reactIs_production.isContextProvider = function (object) {
|
|
484
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
485
|
+
};
|
|
486
|
+
reactIs_production.isElement = function (object) {
|
|
487
|
+
return (
|
|
488
|
+
"object" === typeof object &&
|
|
489
|
+
null !== object &&
|
|
490
|
+
object.$$typeof === REACT_ELEMENT_TYPE
|
|
491
|
+
);
|
|
492
|
+
};
|
|
493
|
+
reactIs_production.isForwardRef = function (object) {
|
|
494
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
495
|
+
};
|
|
496
|
+
reactIs_production.isFragment = function (object) {
|
|
497
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
498
|
+
};
|
|
499
|
+
reactIs_production.isLazy = function (object) {
|
|
500
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
501
|
+
};
|
|
502
|
+
reactIs_production.isMemo = function (object) {
|
|
503
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
504
|
+
};
|
|
505
|
+
reactIs_production.isPortal = function (object) {
|
|
506
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
507
|
+
};
|
|
508
|
+
reactIs_production.isProfiler = function (object) {
|
|
509
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
510
|
+
};
|
|
511
|
+
reactIs_production.isStrictMode = function (object) {
|
|
512
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
513
|
+
};
|
|
514
|
+
reactIs_production.isSuspense = function (object) {
|
|
515
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
516
|
+
};
|
|
517
|
+
reactIs_production.isSuspenseList = function (object) {
|
|
518
|
+
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
519
|
+
};
|
|
520
|
+
reactIs_production.isValidElementType = function (type) {
|
|
521
|
+
return "string" === typeof type ||
|
|
522
|
+
"function" === typeof type ||
|
|
523
|
+
type === REACT_FRAGMENT_TYPE ||
|
|
524
|
+
type === REACT_PROFILER_TYPE ||
|
|
525
|
+
type === REACT_STRICT_MODE_TYPE ||
|
|
526
|
+
type === REACT_SUSPENSE_TYPE ||
|
|
527
|
+
type === REACT_SUSPENSE_LIST_TYPE ||
|
|
528
|
+
("object" === typeof type &&
|
|
529
|
+
null !== type &&
|
|
530
|
+
(type.$$typeof === REACT_LAZY_TYPE ||
|
|
531
|
+
type.$$typeof === REACT_MEMO_TYPE ||
|
|
532
|
+
type.$$typeof === REACT_CONTEXT_TYPE ||
|
|
533
|
+
type.$$typeof === REACT_CONSUMER_TYPE ||
|
|
534
|
+
type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
|
535
|
+
type.$$typeof === REACT_CLIENT_REFERENCE ||
|
|
536
|
+
void 0 !== type.getModuleId))
|
|
537
|
+
? true
|
|
538
|
+
: false;
|
|
539
|
+
};
|
|
540
|
+
reactIs_production.typeOf = typeOf;
|
|
541
|
+
return reactIs_production;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
var hasRequiredReactIs$1;
|
|
545
|
+
|
|
546
|
+
function requireReactIs$1 () {
|
|
547
|
+
if (hasRequiredReactIs$1) return reactIs$1.exports;
|
|
548
|
+
hasRequiredReactIs$1 = 1;
|
|
549
|
+
|
|
550
|
+
{
|
|
551
|
+
reactIs$1.exports = requireReactIs_production();
|
|
552
|
+
}
|
|
553
|
+
return reactIs$1.exports;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
var reactIsExports$1 = requireReactIs$1();
|
|
557
|
+
var index$1 = /*@__PURE__*/getDefaultExportFromCjs(reactIsExports$1);
|
|
558
|
+
|
|
559
|
+
var ReactIs19 = /*#__PURE__*/_mergeNamespaces({
|
|
560
|
+
__proto__: null,
|
|
561
|
+
default: index$1
|
|
562
|
+
}, [reactIsExports$1]);
|
|
563
|
+
|
|
564
|
+
var reactIs = {exports: {}};
|
|
565
|
+
|
|
566
|
+
var reactIs_production_min = {};
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* @license React
|
|
570
|
+
* react-is.production.min.js
|
|
571
|
+
*
|
|
572
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
573
|
+
*
|
|
574
|
+
* This source code is licensed under the MIT license found in the
|
|
575
|
+
* LICENSE file in the root directory of this source tree.
|
|
576
|
+
*/
|
|
577
|
+
|
|
578
|
+
var hasRequiredReactIs_production_min;
|
|
579
|
+
|
|
580
|
+
function requireReactIs_production_min () {
|
|
581
|
+
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
582
|
+
hasRequiredReactIs_production_min = 1;
|
|
583
|
+
var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");
|
|
584
|
+
function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=g;reactIs_production_min.Element=b;reactIs_production_min.ForwardRef=l;reactIs_production_min.Fragment=d;reactIs_production_min.Lazy=q;reactIs_production_min.Memo=p;reactIs_production_min.Portal=c;reactIs_production_min.Profiler=f;reactIs_production_min.StrictMode=e;reactIs_production_min.Suspense=m;
|
|
585
|
+
reactIs_production_min.SuspenseList=n;reactIs_production_min.isAsyncMode=function(){return false};reactIs_production_min.isConcurrentMode=function(){return false};reactIs_production_min.isContextConsumer=function(a){return v(a)===h};reactIs_production_min.isContextProvider=function(a){return v(a)===g};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return v(a)===l};reactIs_production_min.isFragment=function(a){return v(a)===d};reactIs_production_min.isLazy=function(a){return v(a)===q};reactIs_production_min.isMemo=function(a){return v(a)===p};
|
|
586
|
+
reactIs_production_min.isPortal=function(a){return v(a)===c};reactIs_production_min.isProfiler=function(a){return v(a)===f};reactIs_production_min.isStrictMode=function(a){return v(a)===e};reactIs_production_min.isSuspense=function(a){return v(a)===m};reactIs_production_min.isSuspenseList=function(a){return v(a)===n};
|
|
587
|
+
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?true:false};reactIs_production_min.typeOf=v;
|
|
588
|
+
return reactIs_production_min;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
var hasRequiredReactIs;
|
|
592
|
+
|
|
593
|
+
function requireReactIs () {
|
|
594
|
+
if (hasRequiredReactIs) return reactIs.exports;
|
|
595
|
+
hasRequiredReactIs = 1;
|
|
596
|
+
|
|
597
|
+
{
|
|
598
|
+
reactIs.exports = requireReactIs_production_min();
|
|
599
|
+
}
|
|
600
|
+
return reactIs.exports;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
var reactIsExports = requireReactIs();
|
|
604
|
+
var index = /*@__PURE__*/getDefaultExportFromCjs(reactIsExports);
|
|
605
|
+
|
|
606
|
+
var ReactIs18 = /*#__PURE__*/_mergeNamespaces({
|
|
607
|
+
__proto__: null,
|
|
608
|
+
default: index
|
|
609
|
+
}, [reactIsExports]);
|
|
610
|
+
|
|
611
|
+
const reactIsMethods = [
|
|
612
|
+
"isAsyncMode",
|
|
613
|
+
"isConcurrentMode",
|
|
614
|
+
"isContextConsumer",
|
|
615
|
+
"isContextProvider",
|
|
616
|
+
"isElement",
|
|
617
|
+
"isForwardRef",
|
|
618
|
+
"isFragment",
|
|
619
|
+
"isLazy",
|
|
620
|
+
"isMemo",
|
|
621
|
+
"isPortal",
|
|
622
|
+
"isProfiler",
|
|
623
|
+
"isStrictMode",
|
|
624
|
+
"isSuspense",
|
|
625
|
+
"isSuspenseList",
|
|
626
|
+
"isValidElementType"
|
|
627
|
+
];
|
|
628
|
+
const ReactIs = Object.fromEntries(reactIsMethods.map((m) => [m, (v) => ReactIs18[m](v) || ReactIs19[m](v)]));
|
|
629
|
+
// Given element.props.children, or subtree during recursive traversal,
|
|
630
|
+
// return flattened array of children.
|
|
631
|
+
function getChildren(arg, children = []) {
|
|
632
|
+
if (Array.isArray(arg)) {
|
|
633
|
+
for (const item of arg) {
|
|
634
|
+
getChildren(item, children);
|
|
635
|
+
}
|
|
636
|
+
} else if (arg != null && arg !== false && arg !== "") {
|
|
637
|
+
children.push(arg);
|
|
638
|
+
}
|
|
639
|
+
return children;
|
|
640
|
+
}
|
|
641
|
+
function getType(element) {
|
|
642
|
+
const type = element.type;
|
|
643
|
+
if (typeof type === "string") {
|
|
644
|
+
return type;
|
|
645
|
+
}
|
|
646
|
+
if (typeof type === "function") {
|
|
647
|
+
return type.displayName || type.name || "Unknown";
|
|
648
|
+
}
|
|
649
|
+
if (ReactIs.isFragment(element)) {
|
|
650
|
+
return "React.Fragment";
|
|
651
|
+
}
|
|
652
|
+
if (ReactIs.isSuspense(element)) {
|
|
653
|
+
return "React.Suspense";
|
|
654
|
+
}
|
|
655
|
+
if (typeof type === "object" && type !== null) {
|
|
656
|
+
if (ReactIs.isContextProvider(element)) {
|
|
657
|
+
return "Context.Provider";
|
|
658
|
+
}
|
|
659
|
+
if (ReactIs.isContextConsumer(element)) {
|
|
660
|
+
return "Context.Consumer";
|
|
661
|
+
}
|
|
662
|
+
if (ReactIs.isForwardRef(element)) {
|
|
663
|
+
if (type.displayName) {
|
|
664
|
+
return type.displayName;
|
|
665
|
+
}
|
|
666
|
+
const functionName = type.render.displayName || type.render.name || "";
|
|
667
|
+
return functionName === "" ? "ForwardRef" : `ForwardRef(${functionName})`;
|
|
668
|
+
}
|
|
669
|
+
if (ReactIs.isMemo(element)) {
|
|
670
|
+
const functionName = type.displayName || type.type.displayName || type.type.name || "";
|
|
671
|
+
return functionName === "" ? "Memo" : `Memo(${functionName})`;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
return "UNDEFINED";
|
|
675
|
+
}
|
|
676
|
+
function getPropKeys$1(element) {
|
|
677
|
+
const { props } = element;
|
|
678
|
+
return Object.keys(props).filter((key) => key !== "children" && props[key] !== undefined).sort();
|
|
679
|
+
}
|
|
680
|
+
const serialize$1 = (element, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? printElementAsLeaf(getType(element), config) : printElement(getType(element), printProps(getPropKeys$1(element), element.props, config, indentation + config.indent, depth, refs, printer), printChildren(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
|
|
681
|
+
const test$1 = (val) => val != null && ReactIs.isElement(val);
|
|
682
|
+
const plugin$1 = {
|
|
683
|
+
serialize: serialize$1,
|
|
684
|
+
test: test$1
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
const testSymbol = typeof Symbol === "function" && Symbol.for ? Symbol.for("react.test.json") : 245830487;
|
|
688
|
+
function getPropKeys(object) {
|
|
689
|
+
const { props } = object;
|
|
690
|
+
return props ? Object.keys(props).filter((key) => props[key] !== undefined).sort() : [];
|
|
691
|
+
}
|
|
692
|
+
const serialize = (object, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? printElementAsLeaf(object.type, config) : printElement(object.type, object.props ? printProps(getPropKeys(object), object.props, config, indentation + config.indent, depth, refs, printer) : "", object.children ? printChildren(object.children, config, indentation + config.indent, depth, refs, printer) : "", config, indentation);
|
|
693
|
+
const test = (val) => val && val.$$typeof === testSymbol;
|
|
694
|
+
const plugin = {
|
|
695
|
+
serialize,
|
|
696
|
+
test
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
const toString = Object.prototype.toString;
|
|
700
|
+
const toISOString = Date.prototype.toISOString;
|
|
701
|
+
const errorToString = Error.prototype.toString;
|
|
702
|
+
const regExpToString = RegExp.prototype.toString;
|
|
703
|
+
/**
|
|
704
|
+
* Explicitly comparing typeof constructor to function avoids undefined as name
|
|
705
|
+
* when mock identity-obj-proxy returns the key as the value for any key.
|
|
706
|
+
*/
|
|
707
|
+
function getConstructorName(val) {
|
|
708
|
+
return typeof val.constructor === "function" && val.constructor.name || "Object";
|
|
709
|
+
}
|
|
710
|
+
/** Is val is equal to global window object? Works even if it does not exist :) */
|
|
711
|
+
function isWindow(val) {
|
|
712
|
+
return typeof window !== "undefined" && val === window;
|
|
713
|
+
}
|
|
714
|
+
// eslint-disable-next-line regexp/no-super-linear-backtracking
|
|
715
|
+
const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
|
|
716
|
+
const NEWLINE_REGEXP = /\n/g;
|
|
717
|
+
class PrettyFormatPluginError extends Error {
|
|
718
|
+
constructor(message, stack) {
|
|
719
|
+
super(message);
|
|
720
|
+
this.stack = stack;
|
|
721
|
+
this.name = this.constructor.name;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
function isToStringedArrayType(toStringed) {
|
|
725
|
+
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]";
|
|
726
|
+
}
|
|
727
|
+
function printNumber(val) {
|
|
728
|
+
return Object.is(val, -0) ? "-0" : String(val);
|
|
729
|
+
}
|
|
730
|
+
function printBigInt(val) {
|
|
731
|
+
return String(`${val}n`);
|
|
732
|
+
}
|
|
733
|
+
function printFunction(val, printFunctionName) {
|
|
734
|
+
if (!printFunctionName) {
|
|
735
|
+
return "[Function]";
|
|
736
|
+
}
|
|
737
|
+
return `[Function ${val.name || "anonymous"}]`;
|
|
738
|
+
}
|
|
739
|
+
function printSymbol(val) {
|
|
740
|
+
return String(val).replace(SYMBOL_REGEXP, "Symbol($1)");
|
|
741
|
+
}
|
|
742
|
+
function printError(val) {
|
|
743
|
+
return `[${errorToString.call(val)}]`;
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* The first port of call for printing an object, handles most of the
|
|
747
|
+
* data-types in JS.
|
|
748
|
+
*/
|
|
749
|
+
function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
|
|
750
|
+
if (val === true || val === false) {
|
|
751
|
+
return `${val}`;
|
|
752
|
+
}
|
|
753
|
+
if (val === undefined) {
|
|
754
|
+
return "undefined";
|
|
755
|
+
}
|
|
756
|
+
if (val === null) {
|
|
757
|
+
return "null";
|
|
758
|
+
}
|
|
759
|
+
const typeOf = typeof val;
|
|
760
|
+
if (typeOf === "number") {
|
|
761
|
+
return printNumber(val);
|
|
762
|
+
}
|
|
763
|
+
if (typeOf === "bigint") {
|
|
764
|
+
return printBigInt(val);
|
|
765
|
+
}
|
|
766
|
+
if (typeOf === "string") {
|
|
767
|
+
if (escapeString) {
|
|
768
|
+
return `"${val.replaceAll(/"|\\/g, "\\$&")}"`;
|
|
769
|
+
}
|
|
770
|
+
return `"${val}"`;
|
|
771
|
+
}
|
|
772
|
+
if (typeOf === "function") {
|
|
773
|
+
return printFunction(val, printFunctionName);
|
|
774
|
+
}
|
|
775
|
+
if (typeOf === "symbol") {
|
|
776
|
+
return printSymbol(val);
|
|
777
|
+
}
|
|
778
|
+
const toStringed = toString.call(val);
|
|
779
|
+
if (toStringed === "[object WeakMap]") {
|
|
780
|
+
return "WeakMap {}";
|
|
781
|
+
}
|
|
782
|
+
if (toStringed === "[object WeakSet]") {
|
|
783
|
+
return "WeakSet {}";
|
|
784
|
+
}
|
|
785
|
+
if (toStringed === "[object Function]" || toStringed === "[object GeneratorFunction]") {
|
|
786
|
+
return printFunction(val, printFunctionName);
|
|
787
|
+
}
|
|
788
|
+
if (toStringed === "[object Symbol]") {
|
|
789
|
+
return printSymbol(val);
|
|
790
|
+
}
|
|
791
|
+
if (toStringed === "[object Date]") {
|
|
792
|
+
return Number.isNaN(+val) ? "Date { NaN }" : toISOString.call(val);
|
|
793
|
+
}
|
|
794
|
+
if (toStringed === "[object Error]") {
|
|
795
|
+
return printError(val);
|
|
796
|
+
}
|
|
797
|
+
if (toStringed === "[object RegExp]") {
|
|
798
|
+
if (escapeRegex) {
|
|
799
|
+
// https://github.com/benjamingr/RegExp.escape/blob/main/polyfill.js
|
|
800
|
+
return regExpToString.call(val).replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&");
|
|
801
|
+
}
|
|
802
|
+
return regExpToString.call(val);
|
|
803
|
+
}
|
|
804
|
+
if (val instanceof Error) {
|
|
805
|
+
return printError(val);
|
|
806
|
+
}
|
|
807
|
+
return null;
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Handles more complex objects ( such as objects with circular references.
|
|
811
|
+
* maps and sets etc )
|
|
812
|
+
*/
|
|
813
|
+
function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
814
|
+
if (refs.includes(val)) {
|
|
815
|
+
return "[Circular]";
|
|
816
|
+
}
|
|
817
|
+
refs = [...refs];
|
|
818
|
+
refs.push(val);
|
|
819
|
+
const hitMaxDepth = ++depth > config.maxDepth;
|
|
820
|
+
const min = config.min;
|
|
821
|
+
if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === "function" && !hasCalledToJSON) {
|
|
822
|
+
return printer(val.toJSON(), config, indentation, depth, refs, true);
|
|
823
|
+
}
|
|
824
|
+
const toStringed = toString.call(val);
|
|
825
|
+
if (toStringed === "[object Arguments]") {
|
|
826
|
+
return hitMaxDepth ? "[Arguments]" : `${min ? "" : "Arguments "}[${printListItems(val, config, indentation, depth, refs, printer)}]`;
|
|
827
|
+
}
|
|
828
|
+
if (isToStringedArrayType(toStringed)) {
|
|
829
|
+
return hitMaxDepth ? `[${val.constructor.name}]` : `${min ? "" : !config.printBasicPrototype && val.constructor.name === "Array" ? "" : `${val.constructor.name} `}[${printListItems(val, config, indentation, depth, refs, printer)}]`;
|
|
830
|
+
}
|
|
831
|
+
if (toStringed === "[object Map]") {
|
|
832
|
+
return hitMaxDepth ? "[Map]" : `Map {${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer, " => ")}}`;
|
|
833
|
+
}
|
|
834
|
+
if (toStringed === "[object Set]") {
|
|
835
|
+
return hitMaxDepth ? "[Set]" : `Set {${printIteratorValues(val.values(), config, indentation, depth, refs, printer)}}`;
|
|
836
|
+
}
|
|
837
|
+
// Avoid failure to serialize global window object in jsdom test environment.
|
|
838
|
+
// For example, not even relevant if window is prop of React element.
|
|
839
|
+
return hitMaxDepth || isWindow(val) ? `[${getConstructorName(val)}]` : `${min ? "" : !config.printBasicPrototype && getConstructorName(val) === "Object" ? "" : `${getConstructorName(val)} `}{${printObjectProperties(val, config, indentation, depth, refs, printer)}}`;
|
|
840
|
+
}
|
|
841
|
+
const ErrorPlugin = {
|
|
842
|
+
test: (val) => val && val instanceof Error,
|
|
843
|
+
serialize(val, config, indentation, depth, refs, printer) {
|
|
844
|
+
if (refs.includes(val)) {
|
|
845
|
+
return "[Circular]";
|
|
846
|
+
}
|
|
847
|
+
refs = [...refs, val];
|
|
848
|
+
const hitMaxDepth = ++depth > config.maxDepth;
|
|
849
|
+
const { message, cause, ...rest } = val;
|
|
850
|
+
const entries = {
|
|
851
|
+
message,
|
|
852
|
+
...typeof cause !== "undefined" ? { cause } : {},
|
|
853
|
+
...val instanceof AggregateError ? { errors: val.errors } : {},
|
|
854
|
+
...rest
|
|
855
|
+
};
|
|
856
|
+
const name = val.name !== "Error" ? val.name : getConstructorName(val);
|
|
857
|
+
return hitMaxDepth ? `[${name}]` : `${name} {${printIteratorEntries(Object.entries(entries).values(), config, indentation, depth, refs, printer)}}`;
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
function isNewPlugin(plugin) {
|
|
861
|
+
return plugin.serialize != null;
|
|
862
|
+
}
|
|
863
|
+
function printPlugin(plugin, val, config, indentation, depth, refs) {
|
|
864
|
+
let printed;
|
|
865
|
+
try {
|
|
866
|
+
printed = isNewPlugin(plugin) ? plugin.serialize(val, config, indentation, depth, refs, printer) : plugin.print(val, (valChild) => printer(valChild, config, indentation, depth, refs), (str) => {
|
|
867
|
+
const indentationNext = indentation + config.indent;
|
|
868
|
+
return indentationNext + str.replaceAll(NEWLINE_REGEXP, `\n${indentationNext}`);
|
|
869
|
+
}, {
|
|
870
|
+
edgeSpacing: config.spacingOuter,
|
|
871
|
+
min: config.min,
|
|
872
|
+
spacing: config.spacingInner
|
|
873
|
+
}, config.colors);
|
|
874
|
+
} catch (error) {
|
|
875
|
+
throw new PrettyFormatPluginError(error.message, error.stack);
|
|
876
|
+
}
|
|
877
|
+
if (typeof printed !== "string") {
|
|
878
|
+
throw new TypeError(`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`);
|
|
879
|
+
}
|
|
880
|
+
return printed;
|
|
881
|
+
}
|
|
882
|
+
function findPlugin(plugins, val) {
|
|
883
|
+
for (const plugin of plugins) {
|
|
884
|
+
try {
|
|
885
|
+
if (plugin.test(val)) {
|
|
886
|
+
return plugin;
|
|
887
|
+
}
|
|
888
|
+
} catch (error) {
|
|
889
|
+
throw new PrettyFormatPluginError(error.message, error.stack);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
return null;
|
|
893
|
+
}
|
|
894
|
+
function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
895
|
+
const plugin = findPlugin(config.plugins, val);
|
|
896
|
+
if (plugin !== null) {
|
|
897
|
+
return printPlugin(plugin, val, config, indentation, depth, refs);
|
|
898
|
+
}
|
|
899
|
+
const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString);
|
|
900
|
+
if (basicResult !== null) {
|
|
901
|
+
return basicResult;
|
|
902
|
+
}
|
|
903
|
+
return printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
|
|
904
|
+
}
|
|
905
|
+
const DEFAULT_THEME = {
|
|
906
|
+
comment: "gray",
|
|
907
|
+
content: "reset",
|
|
908
|
+
prop: "yellow",
|
|
909
|
+
tag: "cyan",
|
|
910
|
+
value: "green"
|
|
911
|
+
};
|
|
912
|
+
const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
|
|
913
|
+
const DEFAULT_OPTIONS = {
|
|
914
|
+
callToJSON: true,
|
|
915
|
+
compareKeys: undefined,
|
|
916
|
+
escapeRegex: false,
|
|
917
|
+
escapeString: true,
|
|
918
|
+
highlight: false,
|
|
919
|
+
indent: 2,
|
|
920
|
+
maxDepth: Number.POSITIVE_INFINITY,
|
|
921
|
+
maxWidth: Number.POSITIVE_INFINITY,
|
|
922
|
+
min: false,
|
|
923
|
+
plugins: [],
|
|
924
|
+
printBasicPrototype: true,
|
|
925
|
+
printFunctionName: true,
|
|
926
|
+
printShadowRoot: true,
|
|
927
|
+
theme: DEFAULT_THEME
|
|
928
|
+
};
|
|
929
|
+
function validateOptions(options) {
|
|
930
|
+
for (const key of Object.keys(options)) {
|
|
931
|
+
if (!Object.hasOwn(DEFAULT_OPTIONS, key)) {
|
|
932
|
+
throw new Error(`pretty-format: Unknown option "${key}".`);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
if (options.min && options.indent !== undefined && options.indent !== 0) {
|
|
936
|
+
throw new Error("pretty-format: Options \"min\" and \"indent\" cannot be used together.");
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
function getColorsHighlight() {
|
|
940
|
+
return DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
941
|
+
const value = DEFAULT_THEME[key];
|
|
942
|
+
const color = value && styles[value];
|
|
943
|
+
if (color && typeof color.close === "string" && typeof color.open === "string") {
|
|
944
|
+
colors[key] = color;
|
|
945
|
+
} else {
|
|
946
|
+
throw new Error(`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`);
|
|
947
|
+
}
|
|
948
|
+
return colors;
|
|
949
|
+
}, Object.create(null));
|
|
950
|
+
}
|
|
951
|
+
function getColorsEmpty() {
|
|
952
|
+
return DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
953
|
+
colors[key] = {
|
|
954
|
+
close: "",
|
|
955
|
+
open: ""
|
|
956
|
+
};
|
|
957
|
+
return colors;
|
|
958
|
+
}, Object.create(null));
|
|
959
|
+
}
|
|
960
|
+
function getPrintFunctionName(options) {
|
|
961
|
+
return options?.printFunctionName ?? DEFAULT_OPTIONS.printFunctionName;
|
|
962
|
+
}
|
|
963
|
+
function getEscapeRegex(options) {
|
|
964
|
+
return options?.escapeRegex ?? DEFAULT_OPTIONS.escapeRegex;
|
|
965
|
+
}
|
|
966
|
+
function getEscapeString(options) {
|
|
967
|
+
return options?.escapeString ?? DEFAULT_OPTIONS.escapeString;
|
|
968
|
+
}
|
|
969
|
+
function getConfig(options) {
|
|
970
|
+
return {
|
|
971
|
+
callToJSON: options?.callToJSON ?? DEFAULT_OPTIONS.callToJSON,
|
|
972
|
+
colors: options?.highlight ? getColorsHighlight() : getColorsEmpty(),
|
|
973
|
+
compareKeys: typeof options?.compareKeys === "function" || options?.compareKeys === null ? options.compareKeys : DEFAULT_OPTIONS.compareKeys,
|
|
974
|
+
escapeRegex: getEscapeRegex(options),
|
|
975
|
+
escapeString: getEscapeString(options),
|
|
976
|
+
indent: options?.min ? "" : createIndent(options?.indent ?? DEFAULT_OPTIONS.indent),
|
|
977
|
+
maxDepth: options?.maxDepth ?? DEFAULT_OPTIONS.maxDepth,
|
|
978
|
+
maxWidth: options?.maxWidth ?? DEFAULT_OPTIONS.maxWidth,
|
|
979
|
+
min: options?.min ?? DEFAULT_OPTIONS.min,
|
|
980
|
+
plugins: options?.plugins ?? DEFAULT_OPTIONS.plugins,
|
|
981
|
+
printBasicPrototype: options?.printBasicPrototype ?? true,
|
|
982
|
+
printFunctionName: getPrintFunctionName(options),
|
|
983
|
+
printShadowRoot: options?.printShadowRoot ?? true,
|
|
984
|
+
spacingInner: options?.min ? " " : "\n",
|
|
985
|
+
spacingOuter: options?.min ? "" : "\n"
|
|
986
|
+
};
|
|
987
|
+
}
|
|
988
|
+
function createIndent(indent) {
|
|
989
|
+
return Array.from({ length: indent + 1 }).join(" ");
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Returns a presentation string of your `val` object
|
|
993
|
+
* @param val any potential JavaScript object
|
|
994
|
+
* @param options Custom settings
|
|
995
|
+
*/
|
|
996
|
+
function format(val, options) {
|
|
997
|
+
if (options) {
|
|
998
|
+
validateOptions(options);
|
|
999
|
+
if (options.plugins) {
|
|
1000
|
+
const plugin = findPlugin(options.plugins, val);
|
|
1001
|
+
if (plugin !== null) {
|
|
1002
|
+
return printPlugin(plugin, val, getConfig(options), "", 0, []);
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
const basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options), getEscapeString(options));
|
|
1007
|
+
if (basicResult !== null) {
|
|
1008
|
+
return basicResult;
|
|
1009
|
+
}
|
|
1010
|
+
return printComplexValue(val, getConfig(options), "", 0, []);
|
|
1011
|
+
}
|
|
1012
|
+
const plugins = {
|
|
1013
|
+
AsymmetricMatcher: plugin$5,
|
|
1014
|
+
DOMCollection: plugin$4,
|
|
1015
|
+
DOMElement: plugin$3,
|
|
1016
|
+
Immutable: plugin$2,
|
|
1017
|
+
ReactElement: plugin$1,
|
|
1018
|
+
ReactTestComponent: plugin,
|
|
1019
|
+
Error: ErrorPlugin
|
|
1020
|
+
};
|
|
1021
|
+
|
|
1022
|
+
export { DEFAULT_OPTIONS, format, plugins };
|