vitest 0.22.1 → 0.23.0
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 +11 -9
- package/dist/{chunk-api-setup.377c28aa.mjs → chunk-api-setup.5fc06d1d.mjs} +90 -87
- package/dist/{chunk-constants.71e8a211.mjs → chunk-constants.6196597b.mjs} +0 -0
- package/dist/{chunk-integrations-coverage.d205bd87.mjs → chunk-env-node.ceb43f1c.mjs} +31 -179
- package/dist/{chunk-install-pkg.3aa3eae6.mjs → chunk-install-pkg.e081fc1b.mjs} +3 -3
- package/dist/chunk-integrations-coverage.99c020eb.mjs +166 -0
- package/dist/{chunk-integrations-globals.60af7da3.mjs → chunk-integrations-globals.ef598c23.mjs} +6 -7
- package/dist/{chunk-magic-string.efe26975.mjs → chunk-magic-string.56b2b543.mjs} +30 -10
- package/dist/{chunk-mock-date.304e29b1.mjs → chunk-mock-date.0d86eaa5.mjs} +26 -5
- package/dist/{chunk-node-git.9a7e3153.mjs → chunk-node-git.6f289b0a.mjs} +18 -12
- package/dist/{chunk-runtime-chain.be610650.mjs → chunk-runtime-chain.2af36ddf.mjs} +507 -173
- package/dist/{chunk-runtime-error.1104e45a.mjs → chunk-runtime-error.ed9b4f70.mjs} +206 -75
- package/dist/{chunk-runtime-hooks.5d7073db.mjs → chunk-runtime-hooks.75ce0575.mjs} +18 -12
- package/dist/{chunk-runtime-mocker.49d21aa6.mjs → chunk-runtime-mocker.fc76f21d.mjs} +17 -10
- package/dist/{chunk-runtime-rpc.57586b73.mjs → chunk-runtime-rpc.3fe371e9.mjs} +1 -2
- package/dist/{chunk-utils-source-map.bbf3ad19.mjs → chunk-utils-source-map.70ee97e1.mjs} +11 -5
- package/dist/{chunk-vite-node-client.cddda63d.mjs → chunk-vite-node-client.74ebe3d5.mjs} +55 -13
- package/dist/{chunk-vite-node-debug.536c4c5b.mjs → chunk-vite-node-debug.2d8a1dc3.mjs} +1 -1
- package/dist/{chunk-vite-node-externalize.c843f497.mjs → chunk-vite-node-externalize.41bf722e.mjs} +483 -197
- package/dist/{chunk-vite-node-utils.b432150c.mjs → chunk-vite-node-utils.68573626.mjs} +24 -40
- package/dist/cli-wrapper.mjs +21 -17
- package/dist/cli.mjs +23 -15
- package/dist/config.cjs +2 -2
- package/dist/config.d.ts +4 -3
- package/dist/config.mjs +2 -2
- package/dist/entry.mjs +19 -14
- package/dist/environments.d.ts +23 -0
- package/dist/environments.mjs +3 -0
- package/dist/{global-fe52f84b.d.ts → global-ea084c9f.d.ts} +135 -19
- package/dist/{index-ea17aa0c.d.ts → index-5f09f4d0.d.ts} +3 -2
- package/dist/index.d.ts +6 -5
- package/dist/index.mjs +6 -7
- package/dist/loader.mjs +3 -4
- package/dist/node.d.ts +5 -4
- package/dist/node.mjs +14 -12
- package/dist/suite.mjs +5 -6
- package/dist/vendor-index.0557b03a.mjs +147 -0
- package/dist/{vendor-index.9d9196cc.mjs → vendor-index.13e3bda3.mjs} +0 -0
- package/dist/{vendor-index.fbec8a81.mjs → vendor-index.4aeeb598.mjs} +2 -2
- package/dist/{vendor-index.2ae8040a.mjs → vendor-index.62ce5c33.mjs} +0 -0
- package/dist/{vendor-index.29636037.mjs → vendor-index.731a22f2.mjs} +0 -0
- package/dist/worker.mjs +17 -15
- package/package.json +17 -10
- package/dist/chunk-utils-global.fa20c2f6.mjs +0 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
2
|
import { pathToFileURL, fileURLToPath } from 'url';
|
|
3
3
|
import vm from 'vm';
|
|
4
|
-
import { a as resolve, d as dirname, i as isAbsolute, h as extname } from './chunk-constants.
|
|
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.
|
|
4
|
+
import { a as resolve, d as dirname, i as isAbsolute, h as extname } from './chunk-constants.6196597b.mjs';
|
|
5
|
+
import { s as slash, n as normalizeRequestId, b as toFilePath, i as isNodeBuiltin, c as isPrimitive, g as getType, d as normalizeModuleId, m as mergeSlashes } from './chunk-vite-node-utils.68573626.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,27 @@ 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) {
|
|
301
|
+
var _a;
|
|
260
302
|
if (exports === sourceModule)
|
|
261
303
|
return;
|
|
304
|
+
const type = getType(sourceModule);
|
|
305
|
+
if (type !== "Object" && type !== "Module")
|
|
306
|
+
return;
|
|
307
|
+
const constructor = (_a = sourceModule.constructor) == null ? void 0 : _a.name;
|
|
308
|
+
if (constructor && constructor !== "Object")
|
|
309
|
+
return;
|
|
262
310
|
for (const key in sourceModule) {
|
|
263
311
|
if (key !== "default") {
|
|
264
312
|
try {
|
|
265
|
-
|
|
266
|
-
enumerable: true,
|
|
267
|
-
configurable: true,
|
|
268
|
-
get() {
|
|
269
|
-
return sourceModule[key];
|
|
270
|
-
}
|
|
271
|
-
});
|
|
313
|
+
defineExport(exports, key, () => sourceModule[key]);
|
|
272
314
|
} catch (_err) {
|
|
273
315
|
}
|
|
274
316
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { existsSync, promises } from 'fs';
|
|
2
|
-
import { a as resolve, p as picocolors, j as join } from './chunk-constants.
|
|
2
|
+
import { a as resolve, p as picocolors, j as join } from './chunk-constants.6196597b.mjs';
|
|
3
3
|
import 'tty';
|
|
4
4
|
import 'url';
|
|
5
5
|
import 'path';
|