vitest 0.22.1 → 0.23.2
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 +29 -29
- package/dist/browser.d.ts +5 -4
- package/dist/browser.mjs +10 -8
- package/dist/{chunk-api-setup.377c28aa.mjs → chunk-api-setup.11cfd513.mjs} +89 -86
- package/dist/{chunk-integrations-coverage.d205bd87.mjs → chunk-env-node.ceb43f1c.mjs} +31 -179
- package/dist/chunk-integrations-coverage.99c020eb.mjs +166 -0
- package/dist/{chunk-integrations-globals.60af7da3.mjs → chunk-integrations-globals.ad5b1b51.mjs} +5 -6
- package/dist/{chunk-magic-string.efe26975.mjs → chunk-magic-string.56b2b543.mjs} +30 -10
- package/dist/{chunk-mock-date.304e29b1.mjs → chunk-mock-date.2917be60.mjs} +25 -4
- package/dist/{chunk-node-git.9a7e3153.mjs → chunk-node-git.a44b4872.mjs} +14 -8
- package/dist/{chunk-runtime-chain.be610650.mjs → chunk-runtime-chain.7a7f3c3b.mjs} +494 -172
- package/dist/{chunk-runtime-error.1104e45a.mjs → chunk-runtime-error.2723946b.mjs} +219 -75
- package/dist/{chunk-runtime-hooks.5d7073db.mjs → chunk-runtime-hooks.1a0bc3fd.mjs} +18 -12
- package/dist/{chunk-runtime-mocker.49d21aa6.mjs → chunk-runtime-mocker.8d4a2494.mjs} +18 -11
- package/dist/{chunk-runtime-rpc.57586b73.mjs → chunk-runtime-rpc.00a890d2.mjs} +1 -2
- package/dist/{chunk-utils-source-map.bbf3ad19.mjs → chunk-utils-source-map.2be5aa48.mjs} +10 -4
- package/dist/{chunk-vite-node-client.cddda63d.mjs → chunk-vite-node-client.da0a17ff.mjs} +49 -12
- package/dist/{chunk-vite-node-externalize.c843f497.mjs → chunk-vite-node-externalize.f55c4577.mjs} +547 -218
- package/dist/{chunk-vite-node-utils.b432150c.mjs → chunk-vite-node-utils.473cd0b2.mjs} +39 -41
- package/dist/cli-wrapper.mjs +17 -13
- package/dist/cli.mjs +26 -14
- package/dist/config.cjs +2 -2
- package/dist/config.d.ts +4 -3
- package/dist/config.mjs +2 -2
- package/dist/entry.mjs +18 -13
- package/dist/environments.d.ts +23 -0
- package/dist/environments.mjs +3 -0
- package/dist/{global-fe52f84b.d.ts → global-d05ffb3f.d.ts} +140 -19
- package/dist/{index-ea17aa0c.d.ts → index-60e2a8e1.d.ts} +3 -2
- package/dist/index.d.ts +6 -5
- package/dist/index.mjs +5 -6
- package/dist/loader.mjs +5 -6
- package/dist/node.d.ts +5 -4
- package/dist/node.mjs +11 -9
- package/dist/suite.mjs +4 -5
- package/dist/vendor-index.0557b03a.mjs +147 -0
- package/dist/worker.mjs +16 -14
- package/package.json +20 -13
- package/dist/chunk-utils-global.fa20c2f6.mjs +0 -5
|
@@ -2,7 +2,7 @@ import { createRequire } from 'module';
|
|
|
2
2
|
import { pathToFileURL, fileURLToPath } from 'url';
|
|
3
3
|
import vm from 'vm';
|
|
4
4
|
import { a as resolve, d as dirname, i as isAbsolute, h as extname } from './chunk-constants.71e8a211.mjs';
|
|
5
|
-
import { s as slash, n as normalizeRequestId, b as toFilePath, i as isNodeBuiltin, c as isPrimitive, d as normalizeModuleId, m as mergeSlashes } from './chunk-vite-node-utils.
|
|
5
|
+
import { s as slash, n as normalizeRequestId, b as toFilePath, i as isNodeBuiltin, c as isPrimitive, d as normalizeModuleId, m as mergeSlashes } from './chunk-vite-node-utils.473cd0b2.mjs';
|
|
6
6
|
import createDebug from 'debug';
|
|
7
7
|
|
|
8
8
|
const debugExecute = createDebug("vite-node:client:execute");
|
|
@@ -80,6 +80,21 @@ class ModuleCacheMap extends Map {
|
|
|
80
80
|
}
|
|
81
81
|
return invalidated;
|
|
82
82
|
}
|
|
83
|
+
invalidateSubDepTree(ids, invalidated = /* @__PURE__ */ new Set()) {
|
|
84
|
+
for (const _id of ids) {
|
|
85
|
+
const id = this.normalizePath(_id);
|
|
86
|
+
if (invalidated.has(id))
|
|
87
|
+
continue;
|
|
88
|
+
invalidated.add(id);
|
|
89
|
+
const subIds = Array.from(super.entries()).filter(([, mod]) => {
|
|
90
|
+
var _a;
|
|
91
|
+
return (_a = mod.importers) == null ? void 0 : _a.has(id);
|
|
92
|
+
}).map(([key]) => key);
|
|
93
|
+
subIds.length && this.invalidateSubDepTree(subIds, invalidated);
|
|
94
|
+
super.delete(id);
|
|
95
|
+
}
|
|
96
|
+
return invalidated;
|
|
97
|
+
}
|
|
83
98
|
}
|
|
84
99
|
class ViteNodeRunner {
|
|
85
100
|
constructor(options) {
|
|
@@ -170,15 +185,34 @@ ${getStack()}`), 2e3);
|
|
|
170
185
|
enumerable: false,
|
|
171
186
|
configurable: false
|
|
172
187
|
});
|
|
188
|
+
const cjsExports = new Proxy(exports, {
|
|
189
|
+
get(_, p, receiver) {
|
|
190
|
+
return Reflect.get(exports, p, receiver);
|
|
191
|
+
},
|
|
192
|
+
set(_, p, value) {
|
|
193
|
+
if (p !== "default") {
|
|
194
|
+
if (!Reflect.has(exports, "default"))
|
|
195
|
+
exports.default = {};
|
|
196
|
+
if (exports.default === null || typeof exports.default !== "object") {
|
|
197
|
+
defineExport(exports, p, () => void 0);
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
exports.default[p] = value;
|
|
201
|
+
defineExport(exports, p, () => value);
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
204
|
+
return Reflect.set(exports, p, value);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
173
207
|
Object.assign(mod, { code: transformed, exports });
|
|
174
208
|
const __filename = fileURLToPath(url);
|
|
175
209
|
const moduleProxy = {
|
|
176
210
|
set exports(value) {
|
|
177
|
-
exportAll(
|
|
178
|
-
|
|
211
|
+
exportAll(cjsExports, value);
|
|
212
|
+
cjsExports.default = value;
|
|
179
213
|
},
|
|
180
214
|
get exports() {
|
|
181
|
-
return
|
|
215
|
+
return cjsExports;
|
|
182
216
|
}
|
|
183
217
|
};
|
|
184
218
|
let hotContext;
|
|
@@ -200,7 +234,7 @@ ${getStack()}`), 2e3);
|
|
|
200
234
|
__vite_ssr_import_meta__: meta,
|
|
201
235
|
__vitest_resolve_id__: resolveId,
|
|
202
236
|
require: createRequire(url),
|
|
203
|
-
exports,
|
|
237
|
+
exports: cjsExports,
|
|
204
238
|
module: moduleProxy,
|
|
205
239
|
__filename,
|
|
206
240
|
__dirname: dirname(__filename)
|
|
@@ -256,19 +290,22 @@ function proxyMethod(name, tryDefault) {
|
|
|
256
290
|
return result;
|
|
257
291
|
};
|
|
258
292
|
}
|
|
293
|
+
function defineExport(exports, key, value) {
|
|
294
|
+
Object.defineProperty(exports, key, {
|
|
295
|
+
enumerable: true,
|
|
296
|
+
configurable: true,
|
|
297
|
+
get: value
|
|
298
|
+
});
|
|
299
|
+
}
|
|
259
300
|
function exportAll(exports, sourceModule) {
|
|
260
301
|
if (exports === sourceModule)
|
|
261
302
|
return;
|
|
303
|
+
if (typeof sourceModule !== "object" || Array.isArray(sourceModule) || !sourceModule)
|
|
304
|
+
return;
|
|
262
305
|
for (const key in sourceModule) {
|
|
263
306
|
if (key !== "default") {
|
|
264
307
|
try {
|
|
265
|
-
|
|
266
|
-
enumerable: true,
|
|
267
|
-
configurable: true,
|
|
268
|
-
get() {
|
|
269
|
-
return sourceModule[key];
|
|
270
|
-
}
|
|
271
|
-
});
|
|
308
|
+
defineExport(exports, key, () => sourceModule[key]);
|
|
272
309
|
} catch (_err) {
|
|
273
310
|
}
|
|
274
311
|
}
|