@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
package/dist/client.js
ADDED
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
//#region src/messages.ts
|
|
2
|
+
const TYPE_REQUEST = "q";
|
|
3
|
+
const TYPE_RESPONSE = "s";
|
|
4
|
+
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/utils.ts
|
|
7
|
+
function createPromiseWithResolvers() {
|
|
8
|
+
let resolve;
|
|
9
|
+
let reject;
|
|
10
|
+
return {
|
|
11
|
+
promise: new Promise((res, rej) => {
|
|
12
|
+
resolve = res;
|
|
13
|
+
reject = rej;
|
|
14
|
+
}),
|
|
15
|
+
resolve,
|
|
16
|
+
reject
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const random = Math.random.bind(Math);
|
|
20
|
+
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
21
|
+
function nanoid(size = 21) {
|
|
22
|
+
let id = "";
|
|
23
|
+
let i = size;
|
|
24
|
+
while (i--) id += urlAlphabet[random() * 64 | 0];
|
|
25
|
+
return id;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/main.ts
|
|
30
|
+
const DEFAULT_TIMEOUT = 6e4;
|
|
31
|
+
const defaultSerialize = (i) => i;
|
|
32
|
+
const defaultDeserialize = defaultSerialize;
|
|
33
|
+
const { clearTimeout: clearTimeout$1, setTimeout: setTimeout$1 } = globalThis;
|
|
34
|
+
function createBirpc($functions, options) {
|
|
35
|
+
const { post, on, off = () => {}, eventNames = [], serialize = defaultSerialize, deserialize = defaultDeserialize, resolver, bind = "rpc", timeout = DEFAULT_TIMEOUT, proxify = true } = options;
|
|
36
|
+
let $closed = false;
|
|
37
|
+
const _rpcPromiseMap = /* @__PURE__ */ new Map();
|
|
38
|
+
let _promiseInit;
|
|
39
|
+
let rpc;
|
|
40
|
+
async function _call(method, args, event, optional) {
|
|
41
|
+
if ($closed) throw new Error(`[birpc] rpc is closed, cannot call "${method}"`);
|
|
42
|
+
const req = {
|
|
43
|
+
m: method,
|
|
44
|
+
a: args,
|
|
45
|
+
t: TYPE_REQUEST
|
|
46
|
+
};
|
|
47
|
+
if (optional) req.o = true;
|
|
48
|
+
const send = async (_req) => post(serialize(_req));
|
|
49
|
+
if (event) {
|
|
50
|
+
await send(req);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (_promiseInit) try {
|
|
54
|
+
await _promiseInit;
|
|
55
|
+
} finally {
|
|
56
|
+
_promiseInit = void 0;
|
|
57
|
+
}
|
|
58
|
+
let { promise, resolve, reject } = createPromiseWithResolvers();
|
|
59
|
+
const id = nanoid();
|
|
60
|
+
req.i = id;
|
|
61
|
+
let timeoutId;
|
|
62
|
+
async function handler(newReq = req) {
|
|
63
|
+
if (timeout >= 0) {
|
|
64
|
+
timeoutId = setTimeout$1(() => {
|
|
65
|
+
try {
|
|
66
|
+
if (options.onTimeoutError?.call(rpc, method, args) !== true) throw new Error(`[birpc] timeout on calling "${method}"`);
|
|
67
|
+
} catch (e) {
|
|
68
|
+
reject(e);
|
|
69
|
+
}
|
|
70
|
+
_rpcPromiseMap.delete(id);
|
|
71
|
+
}, timeout);
|
|
72
|
+
if (typeof timeoutId === "object") timeoutId = timeoutId.unref?.();
|
|
73
|
+
}
|
|
74
|
+
_rpcPromiseMap.set(id, {
|
|
75
|
+
resolve,
|
|
76
|
+
reject,
|
|
77
|
+
timeoutId,
|
|
78
|
+
method
|
|
79
|
+
});
|
|
80
|
+
await send(newReq);
|
|
81
|
+
return promise;
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
if (options.onRequest) await options.onRequest.call(rpc, req, handler, resolve);
|
|
85
|
+
else await handler();
|
|
86
|
+
} catch (e) {
|
|
87
|
+
if (options.onGeneralError?.call(rpc, e) !== true) throw e;
|
|
88
|
+
return;
|
|
89
|
+
} finally {
|
|
90
|
+
clearTimeout$1(timeoutId);
|
|
91
|
+
_rpcPromiseMap.delete(id);
|
|
92
|
+
}
|
|
93
|
+
return promise;
|
|
94
|
+
}
|
|
95
|
+
const builtinMethods = {
|
|
96
|
+
$call: (method, ...args) => _call(method, args, false),
|
|
97
|
+
$callOptional: (method, ...args) => _call(method, args, false, true),
|
|
98
|
+
$callEvent: (method, ...args) => _call(method, args, true),
|
|
99
|
+
$callRaw: (options$1) => _call(options$1.method, options$1.args, options$1.event, options$1.optional),
|
|
100
|
+
$rejectPendingCalls,
|
|
101
|
+
get $closed() {
|
|
102
|
+
return $closed;
|
|
103
|
+
},
|
|
104
|
+
get $meta() {
|
|
105
|
+
return options.meta;
|
|
106
|
+
},
|
|
107
|
+
$close,
|
|
108
|
+
$functions
|
|
109
|
+
};
|
|
110
|
+
if (proxify) rpc = new Proxy({}, { get(_, method) {
|
|
111
|
+
if (Object.prototype.hasOwnProperty.call(builtinMethods, method)) return builtinMethods[method];
|
|
112
|
+
if (method === "then" && !eventNames.includes("then") && !("then" in $functions)) return void 0;
|
|
113
|
+
const sendEvent = (...args) => _call(method, args, true);
|
|
114
|
+
if (eventNames.includes(method)) {
|
|
115
|
+
sendEvent.asEvent = sendEvent;
|
|
116
|
+
return sendEvent;
|
|
117
|
+
}
|
|
118
|
+
const sendCall = (...args) => _call(method, args, false);
|
|
119
|
+
sendCall.asEvent = sendEvent;
|
|
120
|
+
return sendCall;
|
|
121
|
+
} });
|
|
122
|
+
else rpc = builtinMethods;
|
|
123
|
+
function $close(customError) {
|
|
124
|
+
$closed = true;
|
|
125
|
+
_rpcPromiseMap.forEach(({ reject, method }) => {
|
|
126
|
+
const error = /* @__PURE__ */ new Error(`[birpc] rpc is closed, cannot call "${method}"`);
|
|
127
|
+
if (customError) {
|
|
128
|
+
customError.cause ??= error;
|
|
129
|
+
return reject(customError);
|
|
130
|
+
}
|
|
131
|
+
reject(error);
|
|
132
|
+
});
|
|
133
|
+
_rpcPromiseMap.clear();
|
|
134
|
+
off(onMessage);
|
|
135
|
+
}
|
|
136
|
+
function $rejectPendingCalls(handler) {
|
|
137
|
+
const handlerResults = Array.from(_rpcPromiseMap.values()).map(({ method, reject }) => {
|
|
138
|
+
if (!handler) return reject(/* @__PURE__ */ new Error(`[birpc]: rejected pending call "${method}".`));
|
|
139
|
+
return handler({
|
|
140
|
+
method,
|
|
141
|
+
reject
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
_rpcPromiseMap.clear();
|
|
145
|
+
return handlerResults;
|
|
146
|
+
}
|
|
147
|
+
async function onMessage(data, ...extra) {
|
|
148
|
+
let msg;
|
|
149
|
+
try {
|
|
150
|
+
msg = deserialize(data);
|
|
151
|
+
} catch (e) {
|
|
152
|
+
if (options.onGeneralError?.call(rpc, e) !== true) throw e;
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (msg.t === TYPE_REQUEST) {
|
|
156
|
+
const { m: method, a: args, o: optional } = msg;
|
|
157
|
+
let result, error;
|
|
158
|
+
let fn = await (resolver ? resolver.call(rpc, method, $functions[method]) : $functions[method]);
|
|
159
|
+
if (optional) fn ||= () => void 0;
|
|
160
|
+
if (!fn) error = /* @__PURE__ */ new Error(`[birpc] function "${method}" not found`);
|
|
161
|
+
else try {
|
|
162
|
+
result = await fn.apply(bind === "rpc" ? rpc : $functions, args);
|
|
163
|
+
} catch (e) {
|
|
164
|
+
error = e;
|
|
165
|
+
}
|
|
166
|
+
if (msg.i) {
|
|
167
|
+
if (error && options.onFunctionError) {
|
|
168
|
+
if (options.onFunctionError.call(rpc, error, method, args) === true) return;
|
|
169
|
+
}
|
|
170
|
+
if (!error) try {
|
|
171
|
+
await post(serialize({
|
|
172
|
+
t: TYPE_RESPONSE,
|
|
173
|
+
i: msg.i,
|
|
174
|
+
r: result
|
|
175
|
+
}), ...extra);
|
|
176
|
+
return;
|
|
177
|
+
} catch (e) {
|
|
178
|
+
error = e;
|
|
179
|
+
if (options.onGeneralError?.call(rpc, e, method, args) !== true) throw e;
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
await post(serialize({
|
|
183
|
+
t: TYPE_RESPONSE,
|
|
184
|
+
i: msg.i,
|
|
185
|
+
e: error
|
|
186
|
+
}), ...extra);
|
|
187
|
+
} catch (e) {
|
|
188
|
+
if (options.onGeneralError?.call(rpc, e, method, args) !== true) throw e;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
const { i: ack, r: result, e: error } = msg;
|
|
193
|
+
const promise = _rpcPromiseMap.get(ack);
|
|
194
|
+
if (promise) {
|
|
195
|
+
clearTimeout$1(promise.timeoutId);
|
|
196
|
+
if (error) promise.reject(error);
|
|
197
|
+
else promise.resolve(result);
|
|
198
|
+
}
|
|
199
|
+
_rpcPromiseMap.delete(ack);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
_promiseInit = on(onMessage);
|
|
203
|
+
return rpc;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/// <reference types="../types/index.d.ts" />
|
|
207
|
+
|
|
208
|
+
// (c) 2020-present Andrea Giammarchi
|
|
209
|
+
|
|
210
|
+
const {parse: $parse, stringify: $stringify} = JSON;
|
|
211
|
+
const {keys} = Object;
|
|
212
|
+
|
|
213
|
+
const Primitive = String; // it could be Number
|
|
214
|
+
const primitive = 'string'; // it could be 'number'
|
|
215
|
+
|
|
216
|
+
const ignore = {};
|
|
217
|
+
const object = 'object';
|
|
218
|
+
|
|
219
|
+
const noop = (_, value) => value;
|
|
220
|
+
|
|
221
|
+
const primitives = value => (
|
|
222
|
+
value instanceof Primitive ? Primitive(value) : value
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
const Primitives = (_, value) => (
|
|
226
|
+
typeof value === primitive ? new Primitive(value) : value
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
const revive = (input, parsed, output, $) => {
|
|
230
|
+
const lazy = [];
|
|
231
|
+
for (let ke = keys(output), {length} = ke, y = 0; y < length; y++) {
|
|
232
|
+
const k = ke[y];
|
|
233
|
+
const value = output[k];
|
|
234
|
+
if (value instanceof Primitive) {
|
|
235
|
+
const tmp = input[value];
|
|
236
|
+
if (typeof tmp === object && !parsed.has(tmp)) {
|
|
237
|
+
parsed.add(tmp);
|
|
238
|
+
output[k] = ignore;
|
|
239
|
+
lazy.push({k, a: [input, parsed, tmp, $]});
|
|
240
|
+
}
|
|
241
|
+
else
|
|
242
|
+
output[k] = $.call(output, k, tmp);
|
|
243
|
+
}
|
|
244
|
+
else if (output[k] !== ignore)
|
|
245
|
+
output[k] = $.call(output, k, value);
|
|
246
|
+
}
|
|
247
|
+
for (let {length} = lazy, i = 0; i < length; i++) {
|
|
248
|
+
const {k, a} = lazy[i];
|
|
249
|
+
output[k] = $.call(output, k, revive.apply(null, a));
|
|
250
|
+
}
|
|
251
|
+
return output;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
const set = (known, input, value) => {
|
|
255
|
+
const index = Primitive(input.push(value) - 1);
|
|
256
|
+
known.set(value, index);
|
|
257
|
+
return index;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Converts a specialized flatted string into a JS value.
|
|
262
|
+
* @param {string} text
|
|
263
|
+
* @param {(this: any, key: string, value: any) => any} [reviver]
|
|
264
|
+
* @returns {any}
|
|
265
|
+
*/
|
|
266
|
+
const parse = (text, reviver) => {
|
|
267
|
+
const input = $parse(text, Primitives).map(primitives);
|
|
268
|
+
const value = input[0];
|
|
269
|
+
const $ = reviver || noop;
|
|
270
|
+
const tmp = typeof value === object && value ?
|
|
271
|
+
revive(input, new Set, value, $) :
|
|
272
|
+
value;
|
|
273
|
+
return $.call({'': tmp}, '', tmp);
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Converts a JS value into a specialized flatted string.
|
|
278
|
+
* @param {any} value
|
|
279
|
+
* @param {((this: any, key: string, value: any) => any) | (string | number)[] | null | undefined} [replacer]
|
|
280
|
+
* @param {string | number | undefined} [space]
|
|
281
|
+
* @returns {string}
|
|
282
|
+
*/
|
|
283
|
+
const stringify = (value, replacer, space) => {
|
|
284
|
+
const $ = replacer && typeof replacer === object ?
|
|
285
|
+
(k, v) => (k === '' || -1 < replacer.indexOf(k) ? v : void 0) :
|
|
286
|
+
(replacer || noop);
|
|
287
|
+
const known = new Map;
|
|
288
|
+
const input = [];
|
|
289
|
+
const output = [];
|
|
290
|
+
let i = +set(known, input, $.call({'': value}, '', value));
|
|
291
|
+
let firstRun = !i;
|
|
292
|
+
while (i < input.length) {
|
|
293
|
+
firstRun = true;
|
|
294
|
+
output[i] = $stringify(input[i++], replace, space);
|
|
295
|
+
}
|
|
296
|
+
return '[' + output.join(',') + ']';
|
|
297
|
+
function replace(key, value) {
|
|
298
|
+
if (firstRun) {
|
|
299
|
+
firstRun = !firstRun;
|
|
300
|
+
return value;
|
|
301
|
+
}
|
|
302
|
+
const after = $.call(this, key, value);
|
|
303
|
+
switch (typeof after) {
|
|
304
|
+
case object:
|
|
305
|
+
if (after === null) return after;
|
|
306
|
+
case primitive:
|
|
307
|
+
return known.get(after) || set(known, input, after);
|
|
308
|
+
}
|
|
309
|
+
return after;
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
314
|
+
function getBrowserState() {
|
|
315
|
+
// @ts-expect-error not typed global
|
|
316
|
+
return window.__vitest_browser_runner__;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const channel = new BroadcastChannel(`vitest:${getBrowserState().sessionId}`);
|
|
320
|
+
const globalChannel = new BroadcastChannel("vitest:global");
|
|
321
|
+
|
|
322
|
+
const PAGE_TYPE = getBrowserState().type;
|
|
323
|
+
const PORT = location.port;
|
|
324
|
+
const HOST = [location.hostname, PORT].filter(Boolean).join(":");
|
|
325
|
+
const RPC_ID = PAGE_TYPE === "orchestrator" ? getBrowserState().sessionId : getBrowserState().testerId;
|
|
326
|
+
const METHOD = getBrowserState().method;
|
|
327
|
+
const ENTRY_URL = `${location.protocol === "https:" ? "wss:" : "ws:"}//${HOST}/__vitest_browser_api__?type=${PAGE_TYPE}&rpcId=${RPC_ID}&sessionId=${getBrowserState().sessionId}&projectName=${getBrowserState().config.name || ""}&method=${METHOD}&token=${window.VITEST_API_TOKEN || "0"}`;
|
|
328
|
+
const onCancelCallbacks = [];
|
|
329
|
+
function onCancel(callback) {
|
|
330
|
+
onCancelCallbacks.push(callback);
|
|
331
|
+
}
|
|
332
|
+
// ws connection can be established before the orchestrator is fully loaded
|
|
333
|
+
// in very rare cases in the preview provider
|
|
334
|
+
function waitForOrchestrator() {
|
|
335
|
+
return new Promise((resolve, reject) => {
|
|
336
|
+
const type = getBrowserState().type;
|
|
337
|
+
if (type !== "orchestrator") {
|
|
338
|
+
reject(new TypeError("Only orchestrator can create testers."));
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
function check() {
|
|
342
|
+
const orchestrator = getBrowserState().orchestrator;
|
|
343
|
+
if (orchestrator) {
|
|
344
|
+
return resolve(orchestrator);
|
|
345
|
+
}
|
|
346
|
+
setTimeout(check);
|
|
347
|
+
}
|
|
348
|
+
check();
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
function createClient() {
|
|
352
|
+
const reconnectInterval = 2e3;
|
|
353
|
+
const reconnectTries = 10;
|
|
354
|
+
const connectTimeout = 6e4;
|
|
355
|
+
let tries = reconnectTries;
|
|
356
|
+
const ctx = {
|
|
357
|
+
ws: new WebSocket(ENTRY_URL),
|
|
358
|
+
waitForConnection
|
|
359
|
+
};
|
|
360
|
+
let onMessage;
|
|
361
|
+
ctx.rpc = createBirpc({
|
|
362
|
+
async onCancel(reason) {
|
|
363
|
+
await Promise.all(onCancelCallbacks.map((fn) => fn(reason)));
|
|
364
|
+
},
|
|
365
|
+
async createTesters(options) {
|
|
366
|
+
const orchestrator = await waitForOrchestrator();
|
|
367
|
+
return orchestrator.createTesters(options);
|
|
368
|
+
},
|
|
369
|
+
async cleanupTesters() {
|
|
370
|
+
const orchestrator = await waitForOrchestrator();
|
|
371
|
+
return orchestrator.cleanupTesters();
|
|
372
|
+
},
|
|
373
|
+
cdpEvent(event, payload) {
|
|
374
|
+
const cdp = getBrowserState().cdp;
|
|
375
|
+
if (!cdp) {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
cdp.emit(event, payload);
|
|
379
|
+
},
|
|
380
|
+
async resolveManualMock(url) {
|
|
381
|
+
// @ts-expect-error not typed global API
|
|
382
|
+
const mocker = globalThis.__vitest_mocker__;
|
|
383
|
+
const responseId = getBrowserState().sessionId;
|
|
384
|
+
if (!mocker) {
|
|
385
|
+
return {
|
|
386
|
+
url,
|
|
387
|
+
keys: [],
|
|
388
|
+
responseId
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
const exports$1 = await mocker.resolveFactoryModule(url);
|
|
392
|
+
const keys = Object.keys(exports$1);
|
|
393
|
+
return {
|
|
394
|
+
url,
|
|
395
|
+
keys,
|
|
396
|
+
responseId
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
}, {
|
|
400
|
+
post: (msg) => ctx.ws.send(msg),
|
|
401
|
+
on: (fn) => onMessage = fn,
|
|
402
|
+
serialize: (e) => stringify(e, (_, v) => {
|
|
403
|
+
if (v instanceof Error) {
|
|
404
|
+
return {
|
|
405
|
+
name: v.name,
|
|
406
|
+
message: v.message,
|
|
407
|
+
stack: v.stack
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
return v;
|
|
411
|
+
}),
|
|
412
|
+
deserialize: parse,
|
|
413
|
+
timeout: -1
|
|
414
|
+
});
|
|
415
|
+
let openPromise;
|
|
416
|
+
function reconnect(reset = false) {
|
|
417
|
+
if (reset) {
|
|
418
|
+
tries = reconnectTries;
|
|
419
|
+
}
|
|
420
|
+
ctx.ws = new WebSocket(ENTRY_URL);
|
|
421
|
+
registerWS();
|
|
422
|
+
}
|
|
423
|
+
function registerWS() {
|
|
424
|
+
openPromise = new Promise((resolve, reject) => {
|
|
425
|
+
const timeout = setTimeout(() => {
|
|
426
|
+
reject(new Error(`Cannot connect to the server in ${connectTimeout / 1e3} seconds`));
|
|
427
|
+
}, connectTimeout);
|
|
428
|
+
if (ctx.ws.OPEN === ctx.ws.readyState) {
|
|
429
|
+
resolve();
|
|
430
|
+
}
|
|
431
|
+
// still have a listener even if it's already open to update tries
|
|
432
|
+
ctx.ws.addEventListener("open", () => {
|
|
433
|
+
tries = reconnectTries;
|
|
434
|
+
resolve();
|
|
435
|
+
clearTimeout(timeout);
|
|
436
|
+
});
|
|
437
|
+
});
|
|
438
|
+
ctx.ws.addEventListener("message", (v) => {
|
|
439
|
+
onMessage(v.data);
|
|
440
|
+
});
|
|
441
|
+
ctx.ws.addEventListener("close", () => {
|
|
442
|
+
tries -= 1;
|
|
443
|
+
if (tries > 0) {
|
|
444
|
+
setTimeout(reconnect, reconnectInterval);
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
registerWS();
|
|
449
|
+
function waitForConnection() {
|
|
450
|
+
return openPromise;
|
|
451
|
+
}
|
|
452
|
+
return ctx;
|
|
453
|
+
}
|
|
454
|
+
const client = createClient();
|
|
455
|
+
|
|
456
|
+
export { ENTRY_URL, HOST, PORT, RPC_ID, channel, client, globalChannel, onCancel };
|
package/dist/config.cjs
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var os = require('node:os');
|
|
4
|
+
var stdEnv = require('std-env');
|
|
5
|
+
var vite = require('@voidzero-dev/vite-plus-core');
|
|
6
|
+
|
|
7
|
+
const isNode = typeof process < "u" && typeof process.stdout < "u" && !process.versions?.deno && !globalThis.window;
|
|
8
|
+
const isDeno = typeof process < "u" && typeof process.stdout < "u" && process.versions?.deno !== void 0;
|
|
9
|
+
(isNode || isDeno) && process.platform === "win32";
|
|
10
|
+
(isNode || isDeno) && process.stdout?.isTTY && !stdEnv.isCI;
|
|
11
|
+
|
|
12
|
+
// if changed, update also jsdocs and docs
|
|
13
|
+
const defaultBrowserPort = 63315;
|
|
14
|
+
|
|
15
|
+
const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
|
|
16
|
+
const defaultExclude = ["**/node_modules/**", "**/.git/**"];
|
|
17
|
+
// These are the generic defaults for coverage. Providers may also set some provider specific defaults.
|
|
18
|
+
const coverageConfigDefaults = {
|
|
19
|
+
provider: "v8",
|
|
20
|
+
enabled: false,
|
|
21
|
+
clean: true,
|
|
22
|
+
cleanOnRerun: true,
|
|
23
|
+
reportsDirectory: "./coverage",
|
|
24
|
+
exclude: [],
|
|
25
|
+
reportOnFailure: false,
|
|
26
|
+
reporter: [
|
|
27
|
+
["text", {}],
|
|
28
|
+
["html", {}],
|
|
29
|
+
["clover", {}],
|
|
30
|
+
["json", {}]
|
|
31
|
+
],
|
|
32
|
+
allowExternal: false,
|
|
33
|
+
excludeAfterRemap: false,
|
|
34
|
+
processingConcurrency: Math.min(20, os.availableParallelism?.() ?? os.cpus().length)
|
|
35
|
+
};
|
|
36
|
+
const fakeTimersDefaults = {
|
|
37
|
+
loopLimit: 1e4,
|
|
38
|
+
shouldClearNativeTimers: true
|
|
39
|
+
};
|
|
40
|
+
const configDefaults = Object.freeze({
|
|
41
|
+
allowOnly: !stdEnv.isCI,
|
|
42
|
+
isolate: true,
|
|
43
|
+
watch: !stdEnv.isCI && process.stdin.isTTY,
|
|
44
|
+
globals: false,
|
|
45
|
+
environment: "node",
|
|
46
|
+
clearMocks: false,
|
|
47
|
+
restoreMocks: false,
|
|
48
|
+
mockReset: false,
|
|
49
|
+
unstubGlobals: false,
|
|
50
|
+
unstubEnvs: false,
|
|
51
|
+
include: defaultInclude,
|
|
52
|
+
exclude: defaultExclude,
|
|
53
|
+
teardownTimeout: 1e4,
|
|
54
|
+
forceRerunTriggers: ["**/package.json/**", "**/{vitest,vite}.config.*/**"],
|
|
55
|
+
update: false,
|
|
56
|
+
reporters: [],
|
|
57
|
+
silent: false,
|
|
58
|
+
hideSkippedTests: false,
|
|
59
|
+
api: false,
|
|
60
|
+
ui: false,
|
|
61
|
+
uiBase: "/__vitest__/",
|
|
62
|
+
open: !stdEnv.isCI,
|
|
63
|
+
css: { include: [] },
|
|
64
|
+
coverage: coverageConfigDefaults,
|
|
65
|
+
fakeTimers: fakeTimersDefaults,
|
|
66
|
+
maxConcurrency: 5,
|
|
67
|
+
dangerouslyIgnoreUnhandledErrors: false,
|
|
68
|
+
typecheck: {
|
|
69
|
+
checker: "tsc",
|
|
70
|
+
include: ["**/*.{test,spec}-d.?(c|m)[jt]s?(x)"],
|
|
71
|
+
exclude: defaultExclude
|
|
72
|
+
},
|
|
73
|
+
slowTestThreshold: 300,
|
|
74
|
+
disableConsoleIntercept: false
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
function defineConfig(config) {
|
|
78
|
+
return config;
|
|
79
|
+
}
|
|
80
|
+
function defineProject(config) {
|
|
81
|
+
return config;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
Object.defineProperty(exports, "mergeConfig", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () { return vite.mergeConfig; }
|
|
87
|
+
});
|
|
88
|
+
exports.configDefaults = configDefaults;
|
|
89
|
+
exports.coverageConfigDefaults = coverageConfigDefaults;
|
|
90
|
+
exports.defaultBrowserPort = defaultBrowserPort;
|
|
91
|
+
exports.defaultExclude = defaultExclude;
|
|
92
|
+
exports.defaultInclude = defaultInclude;
|
|
93
|
+
exports.defineConfig = defineConfig;
|
|
94
|
+
exports.defineProject = defineProject;
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { HookHandler, ConfigEnv, UserConfig } from '@voidzero-dev/vite-plus-core';
|
|
2
|
+
export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from '@voidzero-dev/vite-plus-core';
|
|
3
|
+
import { I as InlineConfig, c as CoverageV8Options, R as ResolvedCoverageOptions, U as UserWorkspaceConfig, d as UserProjectConfigFn, e as UserProjectConfigExport } from './chunks/reporters.d.CWXNI2jG.js';
|
|
4
|
+
export { b as TestProjectConfiguration, g as TestProjectInlineConfiguration, f as TestUserConfig, W as WatcherTriggerPattern } from './chunks/reporters.d.CWXNI2jG.js';
|
|
5
|
+
import { V as VitestPluginContext } from './chunks/plugin.d.CtqpEehP.js';
|
|
6
|
+
import { F as FakeTimerInstallOpts } from './chunks/config.d.Cy95HiCx.js';
|
|
7
|
+
import './@vitest/runner/index.js';
|
|
8
|
+
import './@vitest/utils/index.js';
|
|
9
|
+
import './chunks/rpc.d.RH3apGEf.js';
|
|
10
|
+
import './@vitest/snapshot/index.js';
|
|
11
|
+
import '@voidzero-dev/vite-plus-core/module-runner';
|
|
12
|
+
import './chunks/traces.d.402V_yFI.js';
|
|
13
|
+
import 'node:stream';
|
|
14
|
+
import './chunks/browser.d.ChKACdzH.js';
|
|
15
|
+
import './chunks/worker.d.Dyxm8DEL.js';
|
|
16
|
+
import './chunks/environment.d.CrsxCzP1.js';
|
|
17
|
+
import './@vitest/mocker/index.js';
|
|
18
|
+
import './@vitest/utils/source-map.js';
|
|
19
|
+
import './@vitest/browser/index.js';
|
|
20
|
+
import './@vitest/pretty-format/index.js';
|
|
21
|
+
import './@vitest/utils/diff.js';
|
|
22
|
+
import './@vitest/expect/index.js';
|
|
23
|
+
import 'vitest/optional-types.js';
|
|
24
|
+
import './chunks/benchmark.d.DAaHLpsq.js';
|
|
25
|
+
import './@vitest/runner/utils.js';
|
|
26
|
+
import './vendor/tinybench.mjs';
|
|
27
|
+
import './chunks/coverage.d.BZtK59WP.js';
|
|
28
|
+
import './@vitest/snapshot/manager.js';
|
|
29
|
+
import 'node:console';
|
|
30
|
+
import 'node:fs';
|
|
31
|
+
|
|
32
|
+
type VitestInlineConfig = InlineConfig;
|
|
33
|
+
declare module "@voidzero-dev/vite-plus-core" {
|
|
34
|
+
interface UserConfig {
|
|
35
|
+
/**
|
|
36
|
+
* Options for Vitest
|
|
37
|
+
*/
|
|
38
|
+
test?: VitestInlineConfig;
|
|
39
|
+
}
|
|
40
|
+
interface Plugin<A = any> {
|
|
41
|
+
configureVitest?: HookHandler<(context: VitestPluginContext) => void>;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare const defaultBrowserPort = 63315;
|
|
46
|
+
|
|
47
|
+
declare const defaultInclude: string[];
|
|
48
|
+
declare const defaultExclude: string[];
|
|
49
|
+
declare const coverageConfigDefaults: ResolvedCoverageOptions;
|
|
50
|
+
declare const configDefaults: Readonly<{
|
|
51
|
+
allowOnly: boolean;
|
|
52
|
+
isolate: boolean;
|
|
53
|
+
watch: boolean;
|
|
54
|
+
globals: boolean;
|
|
55
|
+
environment: "node";
|
|
56
|
+
clearMocks: boolean;
|
|
57
|
+
restoreMocks: boolean;
|
|
58
|
+
mockReset: boolean;
|
|
59
|
+
unstubGlobals: boolean;
|
|
60
|
+
unstubEnvs: boolean;
|
|
61
|
+
include: string[];
|
|
62
|
+
exclude: string[];
|
|
63
|
+
teardownTimeout: number;
|
|
64
|
+
forceRerunTriggers: string[];
|
|
65
|
+
update: boolean;
|
|
66
|
+
reporters: never[];
|
|
67
|
+
silent: boolean;
|
|
68
|
+
hideSkippedTests: boolean;
|
|
69
|
+
api: boolean;
|
|
70
|
+
ui: boolean;
|
|
71
|
+
uiBase: string;
|
|
72
|
+
open: boolean;
|
|
73
|
+
css: {
|
|
74
|
+
include: never[];
|
|
75
|
+
};
|
|
76
|
+
coverage: CoverageV8Options;
|
|
77
|
+
fakeTimers: FakeTimerInstallOpts;
|
|
78
|
+
maxConcurrency: number;
|
|
79
|
+
dangerouslyIgnoreUnhandledErrors: boolean;
|
|
80
|
+
typecheck: {
|
|
81
|
+
checker: "tsc";
|
|
82
|
+
include: string[];
|
|
83
|
+
exclude: string[];
|
|
84
|
+
};
|
|
85
|
+
slowTestThreshold: number;
|
|
86
|
+
disableConsoleIntercept: boolean;
|
|
87
|
+
}>;
|
|
88
|
+
|
|
89
|
+
type ViteUserConfigFnObject = (env: ConfigEnv) => UserConfig;
|
|
90
|
+
type ViteUserConfigFnPromise = (env: ConfigEnv) => Promise<UserConfig>;
|
|
91
|
+
type ViteUserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
|
|
92
|
+
type ViteUserConfigExport = UserConfig | Promise<UserConfig> | ViteUserConfigFnObject | ViteUserConfigFnPromise | ViteUserConfigFn;
|
|
93
|
+
declare function defineConfig(config: UserConfig): UserConfig;
|
|
94
|
+
declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
|
|
95
|
+
declare function defineConfig(config: ViteUserConfigFnObject): ViteUserConfigFnObject;
|
|
96
|
+
declare function defineConfig(config: ViteUserConfigFnPromise): ViteUserConfigFnPromise;
|
|
97
|
+
declare function defineConfig(config: ViteUserConfigExport): ViteUserConfigExport;
|
|
98
|
+
declare function defineProject(config: UserWorkspaceConfig): UserWorkspaceConfig;
|
|
99
|
+
declare function defineProject(config: Promise<UserWorkspaceConfig>): Promise<UserWorkspaceConfig>;
|
|
100
|
+
declare function defineProject(config: UserProjectConfigFn): UserProjectConfigFn;
|
|
101
|
+
declare function defineProject(config: UserProjectConfigExport): UserProjectConfigExport;
|
|
102
|
+
|
|
103
|
+
export { UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig, configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude, defineConfig, defineProject };
|
|
104
|
+
export type { ViteUserConfigExport, ViteUserConfigFn, ViteUserConfigFnObject, ViteUserConfigFnPromise };
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { c as configDefaults, a as coverageConfigDefaults, d as defaultExclude, b as defaultInclude } from './chunks/defaults.BOqNVLsY.js';
|
|
2
|
+
export { mergeConfig } from '@voidzero-dev/vite-plus-core';
|
|
3
|
+
export { d as defaultBrowserPort } from './chunks/constants.D_Q9UYh-.js';
|
|
4
|
+
import 'node:os';
|
|
5
|
+
import './chunks/env.D4Lgay0q.js';
|
|
6
|
+
import './vendor/std-env.mjs';
|
|
7
|
+
|
|
8
|
+
function defineConfig(config) {
|
|
9
|
+
return config;
|
|
10
|
+
}
|
|
11
|
+
function defineProject(config) {
|
|
12
|
+
return config;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { defineConfig, defineProject };
|