vitest 3.0.6 → 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +6 -24
- package/dist/browser.js +3 -3
- package/dist/chunks/{base.B2NLWv2w.js → base.XvKTsMeK.js} +2 -2
- package/dist/chunks/{cac.mNJBJcT7.js → cac.VN5q-TPC.js} +28 -4
- package/dist/chunks/{cli-api.Dkt_XoKq.js → cli-api.Dis64jtY.js} +205 -203
- package/dist/chunks/{config.BRtC-JeT.d.ts → config.BCv-fVdT.d.ts} +1 -1
- package/dist/chunks/{execute.DNQad00_.js → execute.eDH0aFFd.js} +10 -5
- package/dist/chunks/{globals.DrEiwfS1.js → globals.CydvVTgC.js} +3 -3
- package/dist/chunks/{index.C1f-_gvH.js → index.B7vJpkTD.js} +2 -2
- package/dist/chunks/{index.DC3HGwr0.js → index.BmFgJtkv.js} +1 -1
- package/dist/chunks/{index.SduP00mx.js → index.CNRemkXW.js} +1 -1
- package/dist/chunks/{reporters.DTtkbAtP.d.ts → reporters.66aFHiyX.d.ts} +1 -3
- package/dist/chunks/{resolveConfig.BbcK25zb.js → resolveConfig.L1_HR0_0.js} +6 -6
- package/dist/chunks/{runBaseTests.Cr-AyqFv.js → runBaseTests.DnaAUBKD.js} +5 -5
- package/dist/chunks/{setup-common.IrcyRZ8C.js → setup-common.Uaw6Zgv9.js} +1 -1
- package/dist/chunks/{vi.DrftpPF8.js → vi.B5EKKJdE.js} +4 -4
- package/dist/chunks/{vite.BmCIRnbq.d.ts → vite.BCQa3xFG.d.ts} +1 -1
- package/dist/chunks/{vm.ku9l48hv.js → vm.jEFQDlX_.js} +1 -1
- package/dist/chunks/{worker.B2JXutr8.d.ts → worker.BT4v-DKx.d.ts} +1 -1
- package/dist/chunks/{worker.DaAIyCKm.d.ts → worker.BmVno_ab.d.ts} +1 -1
- package/dist/cli.js +1 -1
- package/dist/config.d.ts +4 -4
- package/dist/coverage.d.ts +2 -2
- package/dist/coverage.js +1 -1
- package/dist/execute.d.ts +2 -2
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +3 -3
- package/dist/node.d.ts +6 -6
- package/dist/node.js +10 -10
- package/dist/reporters.d.ts +2 -2
- package/dist/reporters.js +1 -1
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +2 -2
- package/dist/workers/forks.js +2 -2
- package/dist/workers/runVmTests.js +5 -5
- package/dist/workers/threads.js +2 -2
- package/dist/workers/vmForks.js +2 -2
- package/dist/workers/vmThreads.js +2 -2
- package/dist/workers.d.ts +3 -3
- package/dist/workers.js +3 -3
- package/package.json +17 -17
- package/dist/chunks/spy.Cf_4R5Oe.js +0 -22
package/dist/browser.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { b as CoverageModuleLoader, c as CoverageProvider } from './chunks/reporters.
|
|
2
|
-
import {
|
|
3
|
-
import * as spy$1 from '@vitest/spy';
|
|
1
|
+
import { b as CoverageModuleLoader, c as CoverageProvider } from './chunks/reporters.66aFHiyX.js';
|
|
2
|
+
import { S as SerializedCoverageConfig, a as SerializedConfig } from './chunks/config.BCv-fVdT.js';
|
|
4
3
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
5
4
|
import { VitestExecutor } from './execute.js';
|
|
6
5
|
export { collectTests, processError, startTests } from '@vitest/runner';
|
|
6
|
+
import * as spy from '@vitest/spy';
|
|
7
|
+
export { spy as SpyModule };
|
|
7
8
|
import './chunks/environment.d8YfPkTm.js';
|
|
8
9
|
import '@vitest/utils';
|
|
9
10
|
import 'node:stream';
|
|
@@ -20,30 +21,11 @@ import '@vitest/snapshot/manager';
|
|
|
20
21
|
import 'node:fs';
|
|
21
22
|
import '@vitest/snapshot/environment';
|
|
22
23
|
import 'vite-node/client';
|
|
23
|
-
import './chunks/worker.
|
|
24
|
+
import './chunks/worker.BmVno_ab.js';
|
|
24
25
|
import 'node:vm';
|
|
25
26
|
import '@vitest/mocker';
|
|
26
27
|
import './chunks/mocker.cRtM890J.js';
|
|
27
28
|
|
|
28
|
-
function _mergeNamespaces(n, m) {
|
|
29
|
-
m.forEach(function (e) {
|
|
30
|
-
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
31
|
-
if (k !== 'default' && !(k in n)) {
|
|
32
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
33
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function () { return e[k]; }
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
return Object.freeze(n);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
var spy = /*#__PURE__*/_mergeNamespaces({
|
|
44
|
-
__proto__: null
|
|
45
|
-
}, [spy$1]);
|
|
46
|
-
|
|
47
29
|
declare function getCoverageProvider(options: SerializedCoverageConfig | undefined, loader: CoverageModuleLoader): Promise<CoverageProvider | null>;
|
|
48
30
|
declare function startCoverageInsideWorker(options: SerializedCoverageConfig | undefined, loader: CoverageModuleLoader, runtimeOptions: {
|
|
49
31
|
isolate: boolean;
|
|
@@ -57,4 +39,4 @@ declare function setupCommonEnv(config: SerializedConfig): Promise<void>;
|
|
|
57
39
|
declare function loadDiffConfig(config: SerializedConfig, executor: VitestExecutor): Promise<SerializedDiffOptions | undefined>;
|
|
58
40
|
declare function loadSnapshotSerializers(config: SerializedConfig, executor: VitestExecutor): Promise<void>;
|
|
59
41
|
|
|
60
|
-
export {
|
|
42
|
+
export { getCoverageProvider, loadDiffConfig, loadSnapshotSerializers, setupCommonEnv, startCoverageInsideWorker, stopCoverageInsideWorker, takeCoverageInsideWorker };
|
package/dist/browser.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { g as getCoverageProvider, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.DnNIv-kJ.js';
|
|
2
|
-
export { s as
|
|
3
|
-
export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './chunks/setup-common.IrcyRZ8C.js';
|
|
2
|
+
export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './chunks/setup-common.Uaw6Zgv9.js';
|
|
4
3
|
export { collectTests, processError, startTests } from '@vitest/runner';
|
|
5
|
-
import '@vitest/spy';
|
|
4
|
+
import * as spy from '@vitest/spy';
|
|
5
|
+
export { spy as SpyModule };
|
|
6
6
|
import '@vitest/snapshot';
|
|
7
7
|
import '@vitest/utils';
|
|
8
8
|
import './chunks/run-once.2ogXb3JV.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModuleCacheMap } from 'vite-node/client';
|
|
2
|
-
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.
|
|
2
|
+
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.eDH0aFFd.js';
|
|
3
3
|
import { p as provideWorkerState } from './utils.C8RiOc4B.js';
|
|
4
4
|
|
|
5
5
|
let _viteNode;
|
|
@@ -28,7 +28,7 @@ async function runBaseTests(method, state) {
|
|
|
28
28
|
));
|
|
29
29
|
const [executor, { run }] = await Promise.all([
|
|
30
30
|
startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
|
|
31
|
-
import('./runBaseTests.
|
|
31
|
+
import('./runBaseTests.DnaAUBKD.js')
|
|
32
32
|
]);
|
|
33
33
|
const fileSpecs = ctx.files.map(
|
|
34
34
|
(f) => typeof f === "string" ? { filepath: f, testLocations: void 0 } : f
|
|
@@ -618,7 +618,7 @@ class CAC extends EventEmitter {
|
|
|
618
618
|
|
|
619
619
|
const cac = (name = "") => new CAC(name);
|
|
620
620
|
|
|
621
|
-
var version = "3.0.
|
|
621
|
+
var version = "3.0.8";
|
|
622
622
|
|
|
623
623
|
const apiConfig = (port) => ({
|
|
624
624
|
port: {
|
|
@@ -1398,6 +1398,7 @@ function addCommand(cli, name, option) {
|
|
|
1398
1398
|
`Expected a single value for option "${command}", received [${received}]`
|
|
1399
1399
|
);
|
|
1400
1400
|
}
|
|
1401
|
+
value = removeQuotes(value);
|
|
1401
1402
|
if (option.transform) {
|
|
1402
1403
|
return option.transform(value);
|
|
1403
1404
|
}
|
|
@@ -1502,8 +1503,31 @@ function createCLI(options = {}) {
|
|
|
1502
1503
|
cli.command("[...filters]", void 0, options).action((filters, options2) => start("test", filters, options2));
|
|
1503
1504
|
return cli;
|
|
1504
1505
|
}
|
|
1506
|
+
function removeQuotes(str) {
|
|
1507
|
+
if (typeof str !== "string") {
|
|
1508
|
+
if (Array.isArray(str)) {
|
|
1509
|
+
return str.map(removeQuotes);
|
|
1510
|
+
}
|
|
1511
|
+
return str;
|
|
1512
|
+
}
|
|
1513
|
+
if (str.startsWith('"') && str.endsWith('"')) {
|
|
1514
|
+
return str.slice(1, -1);
|
|
1515
|
+
}
|
|
1516
|
+
if (str.startsWith(`'`) && str.endsWith(`'`)) {
|
|
1517
|
+
return str.slice(1, -1);
|
|
1518
|
+
}
|
|
1519
|
+
return str;
|
|
1520
|
+
}
|
|
1521
|
+
function splitArgv(argv) {
|
|
1522
|
+
const reg = /(['"])(?:(?!\1).)+\1/g;
|
|
1523
|
+
argv = argv.replace(reg, (match) => match.replace(/\s/g, "\0"));
|
|
1524
|
+
return argv.split(" ").map((arg) => {
|
|
1525
|
+
arg = arg.replace(/\0/g, " ");
|
|
1526
|
+
return removeQuotes(arg);
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1505
1529
|
function parseCLI(argv, config = {}) {
|
|
1506
|
-
const arrayArgs = typeof argv === "string" ? argv
|
|
1530
|
+
const arrayArgs = typeof argv === "string" ? splitArgv(argv) : argv;
|
|
1507
1531
|
if (arrayArgs[0] !== "vitest") {
|
|
1508
1532
|
throw new Error(`Expected "vitest" as the first argument, received "${arrayArgs[0]}"`);
|
|
1509
1533
|
}
|
|
@@ -1567,7 +1591,7 @@ async function start(mode, cliFilters, options) {
|
|
|
1567
1591
|
} catch {
|
|
1568
1592
|
}
|
|
1569
1593
|
try {
|
|
1570
|
-
const { startVitest } = await import('./cli-api.
|
|
1594
|
+
const { startVitest } = await import('./cli-api.Dis64jtY.js').then(function (n) { return n.f; });
|
|
1571
1595
|
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
1572
1596
|
if (!ctx.shouldKeepServer()) {
|
|
1573
1597
|
await ctx.exit();
|
|
@@ -1598,7 +1622,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
1598
1622
|
} catch {
|
|
1599
1623
|
}
|
|
1600
1624
|
try {
|
|
1601
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.
|
|
1625
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.Dis64jtY.js').then(function (n) { return n.f; });
|
|
1602
1626
|
const ctx = await prepareVitest(mode, {
|
|
1603
1627
|
...normalizeCliOptions(cliFilters, options),
|
|
1604
1628
|
watch: false,
|
|
@@ -11,24 +11,24 @@ import { generateFileHash, createFileTask, limitConcurrency, hasFailed, getTasks
|
|
|
11
11
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
12
12
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
13
13
|
import { ViteNodeServer } from 'vite-node/server';
|
|
14
|
-
import { v as version$1 } from './cac.
|
|
14
|
+
import { v as version$1 } from './cac.VN5q-TPC.js';
|
|
15
15
|
import { c as createBirpc } from './index.68735LiX.js';
|
|
16
|
-
import { p as parse, s as stringify, g as printError, h as generateCodeFrame, b as BenchmarkReportsMap, R as ReportersMap, i as BlobReporter, r as readBlobs, H as HangingProcessReporter } from './index.
|
|
17
|
-
import require$$0 from 'stream';
|
|
18
|
-
import require$$0$1 from 'zlib';
|
|
19
|
-
import require$$0$2 from 'buffer';
|
|
20
|
-
import require$$1 from 'crypto';
|
|
16
|
+
import { p as parse, s as stringify, g as printError, h as generateCodeFrame, b as BenchmarkReportsMap, R as ReportersMap, i as BlobReporter, r as readBlobs, H as HangingProcessReporter } from './index.B7vJpkTD.js';
|
|
21
17
|
import require$$0$3 from 'events';
|
|
22
18
|
import require$$1$1 from 'https';
|
|
23
19
|
import require$$2 from 'http';
|
|
24
20
|
import require$$3 from 'net';
|
|
25
21
|
import require$$4 from 'tls';
|
|
22
|
+
import require$$1 from 'crypto';
|
|
23
|
+
import require$$0$2 from 'stream';
|
|
26
24
|
import require$$7 from 'url';
|
|
25
|
+
import require$$0 from 'zlib';
|
|
26
|
+
import require$$0$1 from 'buffer';
|
|
27
27
|
import { g as getDefaultExportFromCjs } from './_commonjsHelpers.BFTU3MAI.js';
|
|
28
28
|
import { parseErrorStacktrace } from '@vitest/utils/source-map';
|
|
29
29
|
import crypto from 'node:crypto';
|
|
30
30
|
import { distDir, rootDir } from '../path.js';
|
|
31
|
-
import { R as RandomSequencer, i as isPackageExists, h as hash, V as VitestCache, e as configDefaults, g as getFilePoolName, f as isBrowserEnabled, m as mm, a as resolveConfig, j as groupBy, w as wildcardPatternToRegExp, k as createPool, b as resolveApiServerConfig, s as stdout } from './resolveConfig.
|
|
31
|
+
import { R as RandomSequencer, i as isPackageExists, h as hash, V as VitestCache, e as configDefaults, g as getFilePoolName, f as isBrowserEnabled, m as mm, a as resolveConfig, j as groupBy, w as wildcardPatternToRegExp, k as createPool, b as resolveApiServerConfig, s as stdout } from './resolveConfig.L1_HR0_0.js';
|
|
32
32
|
import { i as isTTY, b as isWindows, c as convertTasksToEvents } from './typechecker.cZ0LjdSi.js';
|
|
33
33
|
import { Console } from 'node:console';
|
|
34
34
|
import c from 'tinyrainbow';
|
|
@@ -47,175 +47,6 @@ import { serializeError } from '@vitest/utils/error';
|
|
|
47
47
|
import readline from 'node:readline';
|
|
48
48
|
import { stripVTControlCharacters } from 'node:util';
|
|
49
49
|
|
|
50
|
-
var stream;
|
|
51
|
-
var hasRequiredStream;
|
|
52
|
-
|
|
53
|
-
function requireStream () {
|
|
54
|
-
if (hasRequiredStream) return stream;
|
|
55
|
-
hasRequiredStream = 1;
|
|
56
|
-
|
|
57
|
-
const { Duplex } = require$$0;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Emits the `'close'` event on a stream.
|
|
61
|
-
*
|
|
62
|
-
* @param {Duplex} stream The stream.
|
|
63
|
-
* @private
|
|
64
|
-
*/
|
|
65
|
-
function emitClose(stream) {
|
|
66
|
-
stream.emit('close');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* The listener of the `'end'` event.
|
|
71
|
-
*
|
|
72
|
-
* @private
|
|
73
|
-
*/
|
|
74
|
-
function duplexOnEnd() {
|
|
75
|
-
if (!this.destroyed && this._writableState.finished) {
|
|
76
|
-
this.destroy();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* The listener of the `'error'` event.
|
|
82
|
-
*
|
|
83
|
-
* @param {Error} err The error
|
|
84
|
-
* @private
|
|
85
|
-
*/
|
|
86
|
-
function duplexOnError(err) {
|
|
87
|
-
this.removeListener('error', duplexOnError);
|
|
88
|
-
this.destroy();
|
|
89
|
-
if (this.listenerCount('error') === 0) {
|
|
90
|
-
// Do not suppress the throwing behavior.
|
|
91
|
-
this.emit('error', err);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Wraps a `WebSocket` in a duplex stream.
|
|
97
|
-
*
|
|
98
|
-
* @param {WebSocket} ws The `WebSocket` to wrap
|
|
99
|
-
* @param {Object} [options] The options for the `Duplex` constructor
|
|
100
|
-
* @return {Duplex} The duplex stream
|
|
101
|
-
* @public
|
|
102
|
-
*/
|
|
103
|
-
function createWebSocketStream(ws, options) {
|
|
104
|
-
let terminateOnDestroy = true;
|
|
105
|
-
|
|
106
|
-
const duplex = new Duplex({
|
|
107
|
-
...options,
|
|
108
|
-
autoDestroy: false,
|
|
109
|
-
emitClose: false,
|
|
110
|
-
objectMode: false,
|
|
111
|
-
writableObjectMode: false
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
ws.on('message', function message(msg, isBinary) {
|
|
115
|
-
const data =
|
|
116
|
-
!isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
117
|
-
|
|
118
|
-
if (!duplex.push(data)) ws.pause();
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
ws.once('error', function error(err) {
|
|
122
|
-
if (duplex.destroyed) return;
|
|
123
|
-
|
|
124
|
-
// Prevent `ws.terminate()` from being called by `duplex._destroy()`.
|
|
125
|
-
//
|
|
126
|
-
// - If the `'error'` event is emitted before the `'open'` event, then
|
|
127
|
-
// `ws.terminate()` is a noop as no socket is assigned.
|
|
128
|
-
// - Otherwise, the error is re-emitted by the listener of the `'error'`
|
|
129
|
-
// event of the `Receiver` object. The listener already closes the
|
|
130
|
-
// connection by calling `ws.close()`. This allows a close frame to be
|
|
131
|
-
// sent to the other peer. If `ws.terminate()` is called right after this,
|
|
132
|
-
// then the close frame might not be sent.
|
|
133
|
-
terminateOnDestroy = false;
|
|
134
|
-
duplex.destroy(err);
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
ws.once('close', function close() {
|
|
138
|
-
if (duplex.destroyed) return;
|
|
139
|
-
|
|
140
|
-
duplex.push(null);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
duplex._destroy = function (err, callback) {
|
|
144
|
-
if (ws.readyState === ws.CLOSED) {
|
|
145
|
-
callback(err);
|
|
146
|
-
process.nextTick(emitClose, duplex);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
let called = false;
|
|
151
|
-
|
|
152
|
-
ws.once('error', function error(err) {
|
|
153
|
-
called = true;
|
|
154
|
-
callback(err);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
ws.once('close', function close() {
|
|
158
|
-
if (!called) callback(err);
|
|
159
|
-
process.nextTick(emitClose, duplex);
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
if (terminateOnDestroy) ws.terminate();
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
duplex._final = function (callback) {
|
|
166
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
167
|
-
ws.once('open', function open() {
|
|
168
|
-
duplex._final(callback);
|
|
169
|
-
});
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// If the value of the `_socket` property is `null` it means that `ws` is a
|
|
174
|
-
// client websocket and the handshake failed. In fact, when this happens, a
|
|
175
|
-
// socket is never assigned to the websocket. Wait for the `'error'` event
|
|
176
|
-
// that will be emitted by the websocket.
|
|
177
|
-
if (ws._socket === null) return;
|
|
178
|
-
|
|
179
|
-
if (ws._socket._writableState.finished) {
|
|
180
|
-
callback();
|
|
181
|
-
if (duplex._readableState.endEmitted) duplex.destroy();
|
|
182
|
-
} else {
|
|
183
|
-
ws._socket.once('finish', function finish() {
|
|
184
|
-
// `duplex` is not destroyed here because the `'end'` event will be
|
|
185
|
-
// emitted on `duplex` after this `'finish'` event. The EOF signaling
|
|
186
|
-
// `null` chunk is, in fact, pushed when the websocket emits `'close'`.
|
|
187
|
-
callback();
|
|
188
|
-
});
|
|
189
|
-
ws.close();
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
duplex._read = function () {
|
|
194
|
-
if (ws.isPaused) ws.resume();
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
duplex._write = function (chunk, encoding, callback) {
|
|
198
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
199
|
-
ws.once('open', function open() {
|
|
200
|
-
duplex._write(chunk, encoding, callback);
|
|
201
|
-
});
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
ws.send(chunk, callback);
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
duplex.on('end', duplexOnEnd);
|
|
209
|
-
duplex.on('error', duplexOnError);
|
|
210
|
-
return duplex;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
stream = createWebSocketStream;
|
|
214
|
-
return stream;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
requireStream();
|
|
218
|
-
|
|
219
50
|
var bufferUtil = {exports: {}};
|
|
220
51
|
|
|
221
52
|
var constants$1;
|
|
@@ -452,7 +283,7 @@ function requirePermessageDeflate () {
|
|
|
452
283
|
if (hasRequiredPermessageDeflate) return permessageDeflate;
|
|
453
284
|
hasRequiredPermessageDeflate = 1;
|
|
454
285
|
|
|
455
|
-
const zlib = require$$0
|
|
286
|
+
const zlib = require$$0;
|
|
456
287
|
|
|
457
288
|
const bufferUtil = requireBufferUtil();
|
|
458
289
|
const Limiter = requireLimiter();
|
|
@@ -975,7 +806,7 @@ function requireValidation () {
|
|
|
975
806
|
if (hasRequiredValidation) return validation.exports;
|
|
976
807
|
hasRequiredValidation = 1;
|
|
977
808
|
|
|
978
|
-
const { isUtf8 } = require$$0$
|
|
809
|
+
const { isUtf8 } = require$$0$1;
|
|
979
810
|
|
|
980
811
|
const { hasBlob } = requireConstants$1();
|
|
981
812
|
|
|
@@ -1135,7 +966,7 @@ function requireReceiver () {
|
|
|
1135
966
|
if (hasRequiredReceiver) return receiver;
|
|
1136
967
|
hasRequiredReceiver = 1;
|
|
1137
968
|
|
|
1138
|
-
const { Writable } = require$$0;
|
|
969
|
+
const { Writable } = require$$0$2;
|
|
1139
970
|
|
|
1140
971
|
const PerMessageDeflate = requirePermessageDeflate();
|
|
1141
972
|
const {
|
|
@@ -1842,8 +1673,6 @@ function requireReceiver () {
|
|
|
1842
1673
|
return receiver;
|
|
1843
1674
|
}
|
|
1844
1675
|
|
|
1845
|
-
requireReceiver();
|
|
1846
|
-
|
|
1847
1676
|
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex" }] */
|
|
1848
1677
|
|
|
1849
1678
|
var sender;
|
|
@@ -1853,7 +1682,7 @@ function requireSender () {
|
|
|
1853
1682
|
if (hasRequiredSender) return sender;
|
|
1854
1683
|
hasRequiredSender = 1;
|
|
1855
1684
|
|
|
1856
|
-
const { Duplex } = require$$0;
|
|
1685
|
+
const { Duplex } = require$$0$2;
|
|
1857
1686
|
const { randomFillSync } = require$$1;
|
|
1858
1687
|
|
|
1859
1688
|
const PerMessageDeflate = requirePermessageDeflate();
|
|
@@ -2402,7 +2231,7 @@ function requireSender () {
|
|
|
2402
2231
|
/**
|
|
2403
2232
|
* Sends a frame.
|
|
2404
2233
|
*
|
|
2405
|
-
* @param {Buffer[]} list The frame to send
|
|
2234
|
+
* @param {(Buffer | String)[]} list The frame to send
|
|
2406
2235
|
* @param {Function} [cb] Callback
|
|
2407
2236
|
* @private
|
|
2408
2237
|
*/
|
|
@@ -2454,8 +2283,6 @@ function requireSender () {
|
|
|
2454
2283
|
return sender;
|
|
2455
2284
|
}
|
|
2456
2285
|
|
|
2457
|
-
requireSender();
|
|
2458
|
-
|
|
2459
2286
|
var eventTarget;
|
|
2460
2287
|
var hasRequiredEventTarget;
|
|
2461
2288
|
|
|
@@ -2982,7 +2809,7 @@ function requireWebsocket () {
|
|
|
2982
2809
|
const net = require$$3;
|
|
2983
2810
|
const tls = require$$4;
|
|
2984
2811
|
const { randomBytes, createHash } = require$$1;
|
|
2985
|
-
const { Duplex, Readable } = require$$0;
|
|
2812
|
+
const { Duplex, Readable } = require$$0$2;
|
|
2986
2813
|
const { URL } = require$$7;
|
|
2987
2814
|
|
|
2988
2815
|
const PerMessageDeflate = requirePermessageDeflate();
|
|
@@ -4363,6 +4190,182 @@ function requireWebsocket () {
|
|
|
4363
4190
|
return websocket;
|
|
4364
4191
|
}
|
|
4365
4192
|
|
|
4193
|
+
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^WebSocket$" }] */
|
|
4194
|
+
|
|
4195
|
+
var stream;
|
|
4196
|
+
var hasRequiredStream;
|
|
4197
|
+
|
|
4198
|
+
function requireStream () {
|
|
4199
|
+
if (hasRequiredStream) return stream;
|
|
4200
|
+
hasRequiredStream = 1;
|
|
4201
|
+
|
|
4202
|
+
requireWebsocket();
|
|
4203
|
+
const { Duplex } = require$$0$2;
|
|
4204
|
+
|
|
4205
|
+
/**
|
|
4206
|
+
* Emits the `'close'` event on a stream.
|
|
4207
|
+
*
|
|
4208
|
+
* @param {Duplex} stream The stream.
|
|
4209
|
+
* @private
|
|
4210
|
+
*/
|
|
4211
|
+
function emitClose(stream) {
|
|
4212
|
+
stream.emit('close');
|
|
4213
|
+
}
|
|
4214
|
+
|
|
4215
|
+
/**
|
|
4216
|
+
* The listener of the `'end'` event.
|
|
4217
|
+
*
|
|
4218
|
+
* @private
|
|
4219
|
+
*/
|
|
4220
|
+
function duplexOnEnd() {
|
|
4221
|
+
if (!this.destroyed && this._writableState.finished) {
|
|
4222
|
+
this.destroy();
|
|
4223
|
+
}
|
|
4224
|
+
}
|
|
4225
|
+
|
|
4226
|
+
/**
|
|
4227
|
+
* The listener of the `'error'` event.
|
|
4228
|
+
*
|
|
4229
|
+
* @param {Error} err The error
|
|
4230
|
+
* @private
|
|
4231
|
+
*/
|
|
4232
|
+
function duplexOnError(err) {
|
|
4233
|
+
this.removeListener('error', duplexOnError);
|
|
4234
|
+
this.destroy();
|
|
4235
|
+
if (this.listenerCount('error') === 0) {
|
|
4236
|
+
// Do not suppress the throwing behavior.
|
|
4237
|
+
this.emit('error', err);
|
|
4238
|
+
}
|
|
4239
|
+
}
|
|
4240
|
+
|
|
4241
|
+
/**
|
|
4242
|
+
* Wraps a `WebSocket` in a duplex stream.
|
|
4243
|
+
*
|
|
4244
|
+
* @param {WebSocket} ws The `WebSocket` to wrap
|
|
4245
|
+
* @param {Object} [options] The options for the `Duplex` constructor
|
|
4246
|
+
* @return {Duplex} The duplex stream
|
|
4247
|
+
* @public
|
|
4248
|
+
*/
|
|
4249
|
+
function createWebSocketStream(ws, options) {
|
|
4250
|
+
let terminateOnDestroy = true;
|
|
4251
|
+
|
|
4252
|
+
const duplex = new Duplex({
|
|
4253
|
+
...options,
|
|
4254
|
+
autoDestroy: false,
|
|
4255
|
+
emitClose: false,
|
|
4256
|
+
objectMode: false,
|
|
4257
|
+
writableObjectMode: false
|
|
4258
|
+
});
|
|
4259
|
+
|
|
4260
|
+
ws.on('message', function message(msg, isBinary) {
|
|
4261
|
+
const data =
|
|
4262
|
+
!isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
4263
|
+
|
|
4264
|
+
if (!duplex.push(data)) ws.pause();
|
|
4265
|
+
});
|
|
4266
|
+
|
|
4267
|
+
ws.once('error', function error(err) {
|
|
4268
|
+
if (duplex.destroyed) return;
|
|
4269
|
+
|
|
4270
|
+
// Prevent `ws.terminate()` from being called by `duplex._destroy()`.
|
|
4271
|
+
//
|
|
4272
|
+
// - If the `'error'` event is emitted before the `'open'` event, then
|
|
4273
|
+
// `ws.terminate()` is a noop as no socket is assigned.
|
|
4274
|
+
// - Otherwise, the error is re-emitted by the listener of the `'error'`
|
|
4275
|
+
// event of the `Receiver` object. The listener already closes the
|
|
4276
|
+
// connection by calling `ws.close()`. This allows a close frame to be
|
|
4277
|
+
// sent to the other peer. If `ws.terminate()` is called right after this,
|
|
4278
|
+
// then the close frame might not be sent.
|
|
4279
|
+
terminateOnDestroy = false;
|
|
4280
|
+
duplex.destroy(err);
|
|
4281
|
+
});
|
|
4282
|
+
|
|
4283
|
+
ws.once('close', function close() {
|
|
4284
|
+
if (duplex.destroyed) return;
|
|
4285
|
+
|
|
4286
|
+
duplex.push(null);
|
|
4287
|
+
});
|
|
4288
|
+
|
|
4289
|
+
duplex._destroy = function (err, callback) {
|
|
4290
|
+
if (ws.readyState === ws.CLOSED) {
|
|
4291
|
+
callback(err);
|
|
4292
|
+
process.nextTick(emitClose, duplex);
|
|
4293
|
+
return;
|
|
4294
|
+
}
|
|
4295
|
+
|
|
4296
|
+
let called = false;
|
|
4297
|
+
|
|
4298
|
+
ws.once('error', function error(err) {
|
|
4299
|
+
called = true;
|
|
4300
|
+
callback(err);
|
|
4301
|
+
});
|
|
4302
|
+
|
|
4303
|
+
ws.once('close', function close() {
|
|
4304
|
+
if (!called) callback(err);
|
|
4305
|
+
process.nextTick(emitClose, duplex);
|
|
4306
|
+
});
|
|
4307
|
+
|
|
4308
|
+
if (terminateOnDestroy) ws.terminate();
|
|
4309
|
+
};
|
|
4310
|
+
|
|
4311
|
+
duplex._final = function (callback) {
|
|
4312
|
+
if (ws.readyState === ws.CONNECTING) {
|
|
4313
|
+
ws.once('open', function open() {
|
|
4314
|
+
duplex._final(callback);
|
|
4315
|
+
});
|
|
4316
|
+
return;
|
|
4317
|
+
}
|
|
4318
|
+
|
|
4319
|
+
// If the value of the `_socket` property is `null` it means that `ws` is a
|
|
4320
|
+
// client websocket and the handshake failed. In fact, when this happens, a
|
|
4321
|
+
// socket is never assigned to the websocket. Wait for the `'error'` event
|
|
4322
|
+
// that will be emitted by the websocket.
|
|
4323
|
+
if (ws._socket === null) return;
|
|
4324
|
+
|
|
4325
|
+
if (ws._socket._writableState.finished) {
|
|
4326
|
+
callback();
|
|
4327
|
+
if (duplex._readableState.endEmitted) duplex.destroy();
|
|
4328
|
+
} else {
|
|
4329
|
+
ws._socket.once('finish', function finish() {
|
|
4330
|
+
// `duplex` is not destroyed here because the `'end'` event will be
|
|
4331
|
+
// emitted on `duplex` after this `'finish'` event. The EOF signaling
|
|
4332
|
+
// `null` chunk is, in fact, pushed when the websocket emits `'close'`.
|
|
4333
|
+
callback();
|
|
4334
|
+
});
|
|
4335
|
+
ws.close();
|
|
4336
|
+
}
|
|
4337
|
+
};
|
|
4338
|
+
|
|
4339
|
+
duplex._read = function () {
|
|
4340
|
+
if (ws.isPaused) ws.resume();
|
|
4341
|
+
};
|
|
4342
|
+
|
|
4343
|
+
duplex._write = function (chunk, encoding, callback) {
|
|
4344
|
+
if (ws.readyState === ws.CONNECTING) {
|
|
4345
|
+
ws.once('open', function open() {
|
|
4346
|
+
duplex._write(chunk, encoding, callback);
|
|
4347
|
+
});
|
|
4348
|
+
return;
|
|
4349
|
+
}
|
|
4350
|
+
|
|
4351
|
+
ws.send(chunk, callback);
|
|
4352
|
+
};
|
|
4353
|
+
|
|
4354
|
+
duplex.on('end', duplexOnEnd);
|
|
4355
|
+
duplex.on('error', duplexOnError);
|
|
4356
|
+
return duplex;
|
|
4357
|
+
}
|
|
4358
|
+
|
|
4359
|
+
stream = createWebSocketStream;
|
|
4360
|
+
return stream;
|
|
4361
|
+
}
|
|
4362
|
+
|
|
4363
|
+
requireStream();
|
|
4364
|
+
|
|
4365
|
+
requireReceiver();
|
|
4366
|
+
|
|
4367
|
+
requireSender();
|
|
4368
|
+
|
|
4366
4369
|
requireWebsocket();
|
|
4367
4370
|
|
|
4368
4371
|
var subprotocol;
|
|
@@ -4446,7 +4449,7 @@ function requireWebsocketServer () {
|
|
|
4446
4449
|
|
|
4447
4450
|
const EventEmitter = require$$0$3;
|
|
4448
4451
|
const http = require$$2;
|
|
4449
|
-
const { Duplex } = require$$0;
|
|
4452
|
+
const { Duplex } = require$$0$2;
|
|
4450
4453
|
const { createHash } = require$$1;
|
|
4451
4454
|
|
|
4452
4455
|
const extension = requireExtension();
|
|
@@ -8686,6 +8689,7 @@ var picomatchExports = /*@__PURE__*/ requirePicomatch();
|
|
|
8686
8689
|
var picomatch2 = /*@__PURE__*/getDefaultExportFromCjs(picomatchExports);
|
|
8687
8690
|
|
|
8688
8691
|
// src/index.ts
|
|
8692
|
+
var ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
8689
8693
|
function getPartialMatcher(patterns, options) {
|
|
8690
8694
|
const patternsCount = patterns.length;
|
|
8691
8695
|
const patternsParts = Array(patternsCount);
|
|
@@ -8702,6 +8706,9 @@ function getPartialMatcher(patterns, options) {
|
|
|
8702
8706
|
}
|
|
8703
8707
|
return (input) => {
|
|
8704
8708
|
const inputParts = input.split("/");
|
|
8709
|
+
if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) {
|
|
8710
|
+
return true;
|
|
8711
|
+
}
|
|
8705
8712
|
for (let i = 0; i < patterns.length; i++) {
|
|
8706
8713
|
const patternParts = patternsParts[i];
|
|
8707
8714
|
const regex = regexes[i];
|
|
@@ -8892,7 +8899,9 @@ function crawl(options, cwd, sync) {
|
|
|
8892
8899
|
exclude: options.debug ? (_, p) => {
|
|
8893
8900
|
const relativePath = processPath(p, cwd, props.root, true, true);
|
|
8894
8901
|
const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
8895
|
-
if (
|
|
8902
|
+
if (skipped) {
|
|
8903
|
+
log(`skipped ${p}`);
|
|
8904
|
+
} else {
|
|
8896
8905
|
log(`crawling ${p}`);
|
|
8897
8906
|
}
|
|
8898
8907
|
return skipped;
|
|
@@ -9945,17 +9954,6 @@ function deleteDefineConfig(viteConfig) {
|
|
|
9945
9954
|
}
|
|
9946
9955
|
return defines;
|
|
9947
9956
|
}
|
|
9948
|
-
function hijackVitePluginInject(viteConfig) {
|
|
9949
|
-
const processEnvPlugin = viteConfig.plugins.find(
|
|
9950
|
-
(p) => p.name === "vite:client-inject"
|
|
9951
|
-
);
|
|
9952
|
-
if (processEnvPlugin) {
|
|
9953
|
-
const originalTransform = processEnvPlugin.transform;
|
|
9954
|
-
processEnvPlugin.transform = function transform(code, id, options) {
|
|
9955
|
-
return originalTransform.call(this, code, id, { ...options, ssr: true });
|
|
9956
|
-
};
|
|
9957
|
-
}
|
|
9958
|
-
}
|
|
9959
9957
|
function resolveFsAllow(projectRoot, rootConfigFile) {
|
|
9960
9958
|
if (!rootConfigFile) {
|
|
9961
9959
|
return [searchForWorkspaceRoot(projectRoot), rootDir];
|
|
@@ -10127,6 +10125,10 @@ function WorkspaceVitestPlugin(project, options) {
|
|
|
10127
10125
|
const resolveOptions = getDefaultResolveOptions();
|
|
10128
10126
|
const config = {
|
|
10129
10127
|
root,
|
|
10128
|
+
define: {
|
|
10129
|
+
// disable replacing `process.env.NODE_ENV` with static string by vite:client-inject
|
|
10130
|
+
"process.env.NODE_ENV": "process.env.NODE_ENV"
|
|
10131
|
+
},
|
|
10130
10132
|
resolve: {
|
|
10131
10133
|
...resolveOptions,
|
|
10132
10134
|
alias: testConfig.alias
|
|
@@ -10191,9 +10193,6 @@ function WorkspaceVitestPlugin(project, options) {
|
|
|
10191
10193
|
config.customLogger = silenceImportViteIgnoreWarning(config.customLogger);
|
|
10192
10194
|
return config;
|
|
10193
10195
|
},
|
|
10194
|
-
configResolved(viteConfig) {
|
|
10195
|
-
hijackVitePluginInject(viteConfig);
|
|
10196
|
-
},
|
|
10197
10196
|
async configureServer(server) {
|
|
10198
10197
|
const options2 = deepMerge({}, configDefaults, server.config.test || {});
|
|
10199
10198
|
await project._configureServer(options2, server);
|
|
@@ -13339,6 +13338,10 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
13339
13338
|
const resolveOptions = getDefaultResolveOptions();
|
|
13340
13339
|
const config = {
|
|
13341
13340
|
root: viteConfig.test?.root || options.root,
|
|
13341
|
+
define: {
|
|
13342
|
+
// disable replacing `process.env.NODE_ENV` with static string by vite:client-inject
|
|
13343
|
+
"process.env.NODE_ENV": "process.env.NODE_ENV"
|
|
13344
|
+
},
|
|
13342
13345
|
esbuild: viteConfig.esbuild === false ? false : {
|
|
13343
13346
|
// Lowest target Vitest supports is Node18
|
|
13344
13347
|
target: viteConfig.esbuild?.target || "node18",
|
|
@@ -13456,7 +13459,6 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
13456
13459
|
if (!options.watch) {
|
|
13457
13460
|
viteConfig.server.watch = null;
|
|
13458
13461
|
}
|
|
13459
|
-
hijackVitePluginInject(viteConfig);
|
|
13460
13462
|
Object.defineProperty(viteConfig, "_vitest", {
|
|
13461
13463
|
value: options,
|
|
13462
13464
|
enumerable: false,
|