vitest 0.0.112 → 0.0.116
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 +61 -33
- package/dist/cli.js +1110 -32
- package/dist/{constants-2b0310b7.js → constants-080f26e8.js} +2 -2
- package/dist/{diff-66d6bb83.js → diff-80c47cfa.js} +3299 -3298
- package/dist/entry.js +122 -30
- package/dist/{global-201fd559.js → global-a73dfade.js} +6 -6
- package/dist/{index-8ab26d25.js → index-1af8810e.js} +231 -1191
- package/dist/{index-61c8686f.js → index-648e7ab2.js} +62 -62
- package/dist/index-6e709f57.js +781 -0
- package/dist/{index-2bb9fd4d.js → index-80d9a771.js} +2 -2
- package/dist/{utils-cb6b1266.js → index-bf29f0e6.js} +37 -3
- package/dist/{index-9f4b9905.js → index-ce49e384.js} +33 -800
- package/dist/index-e909c175.js +62 -0
- package/dist/index.d.ts +110 -35
- package/dist/index.js +5 -4
- package/dist/{jest-mock-a57b745c.js → jest-mock-4a754991.js} +1 -12
- package/dist/magic-string.es-94000aea.js +1360 -0
- package/dist/node.d.ts +88 -16
- package/dist/node.js +9 -6
- package/dist/rpc-8c7cc374.js +5 -0
- package/dist/setup-95b119ff.js +4318 -0
- package/dist/utils.js +3 -2
- package/dist/{vi-cb9e4e4e.js → vi-b3412f83.js} +4 -5
- package/dist/worker.js +23 -37
- package/package.json +6 -5
- package/vitest.mjs +1 -20
- package/dist/middleware-2028dfa0.js +0 -81
- package/dist/rpc-7de86f29.js +0 -10
|
@@ -2,68 +2,6 @@ import { c as commonjsGlobal } from './_commonjsHelpers-c9e3b764.js';
|
|
|
2
2
|
import assert$1 from 'assert';
|
|
3
3
|
import require$$2 from 'events';
|
|
4
4
|
|
|
5
|
-
var onetime$2 = {exports: {}};
|
|
6
|
-
|
|
7
|
-
var mimicFn$2 = {exports: {}};
|
|
8
|
-
|
|
9
|
-
const mimicFn$1 = (to, from) => {
|
|
10
|
-
for (const prop of Reflect.ownKeys(from)) {
|
|
11
|
-
Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
mimicFn$2.exports = mimicFn$1;
|
|
18
|
-
// TODO: Remove this for the next major release
|
|
19
|
-
mimicFn$2.exports.default = mimicFn$1;
|
|
20
|
-
|
|
21
|
-
const mimicFn = mimicFn$2.exports;
|
|
22
|
-
|
|
23
|
-
const calledFunctions = new WeakMap();
|
|
24
|
-
|
|
25
|
-
const onetime = (function_, options = {}) => {
|
|
26
|
-
if (typeof function_ !== 'function') {
|
|
27
|
-
throw new TypeError('Expected a function');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
let returnValue;
|
|
31
|
-
let callCount = 0;
|
|
32
|
-
const functionName = function_.displayName || function_.name || '<anonymous>';
|
|
33
|
-
|
|
34
|
-
const onetime = function (...arguments_) {
|
|
35
|
-
calledFunctions.set(onetime, ++callCount);
|
|
36
|
-
|
|
37
|
-
if (callCount === 1) {
|
|
38
|
-
returnValue = function_.apply(this, arguments_);
|
|
39
|
-
function_ = null;
|
|
40
|
-
} else if (options.throw === true) {
|
|
41
|
-
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return returnValue;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
mimicFn(onetime, function_);
|
|
48
|
-
calledFunctions.set(onetime, callCount);
|
|
49
|
-
|
|
50
|
-
return onetime;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
onetime$2.exports = onetime;
|
|
54
|
-
// TODO: Remove this for the next major release
|
|
55
|
-
onetime$2.exports.default = onetime;
|
|
56
|
-
|
|
57
|
-
onetime$2.exports.callCount = function_ => {
|
|
58
|
-
if (!calledFunctions.has(function_)) {
|
|
59
|
-
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return calledFunctions.get(function_);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
var onetime$1 = onetime$2.exports;
|
|
66
|
-
|
|
67
5
|
var signalExit$1 = {exports: {}};
|
|
68
6
|
|
|
69
7
|
var signals$1 = {exports: {}};
|
|
@@ -327,4 +265,66 @@ if (!processOk(process$1)) {
|
|
|
327
265
|
|
|
328
266
|
var signalExit = signalExit$1.exports;
|
|
329
267
|
|
|
268
|
+
var onetime$2 = {exports: {}};
|
|
269
|
+
|
|
270
|
+
var mimicFn$2 = {exports: {}};
|
|
271
|
+
|
|
272
|
+
const mimicFn$1 = (to, from) => {
|
|
273
|
+
for (const prop of Reflect.ownKeys(from)) {
|
|
274
|
+
Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return to;
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
mimicFn$2.exports = mimicFn$1;
|
|
281
|
+
// TODO: Remove this for the next major release
|
|
282
|
+
mimicFn$2.exports.default = mimicFn$1;
|
|
283
|
+
|
|
284
|
+
const mimicFn = mimicFn$2.exports;
|
|
285
|
+
|
|
286
|
+
const calledFunctions = new WeakMap();
|
|
287
|
+
|
|
288
|
+
const onetime = (function_, options = {}) => {
|
|
289
|
+
if (typeof function_ !== 'function') {
|
|
290
|
+
throw new TypeError('Expected a function');
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
let returnValue;
|
|
294
|
+
let callCount = 0;
|
|
295
|
+
const functionName = function_.displayName || function_.name || '<anonymous>';
|
|
296
|
+
|
|
297
|
+
const onetime = function (...arguments_) {
|
|
298
|
+
calledFunctions.set(onetime, ++callCount);
|
|
299
|
+
|
|
300
|
+
if (callCount === 1) {
|
|
301
|
+
returnValue = function_.apply(this, arguments_);
|
|
302
|
+
function_ = null;
|
|
303
|
+
} else if (options.throw === true) {
|
|
304
|
+
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return returnValue;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
mimicFn(onetime, function_);
|
|
311
|
+
calledFunctions.set(onetime, callCount);
|
|
312
|
+
|
|
313
|
+
return onetime;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
onetime$2.exports = onetime;
|
|
317
|
+
// TODO: Remove this for the next major release
|
|
318
|
+
onetime$2.exports.default = onetime;
|
|
319
|
+
|
|
320
|
+
onetime$2.exports.callCount = function_ => {
|
|
321
|
+
if (!calledFunctions.has(function_)) {
|
|
322
|
+
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
return calledFunctions.get(function_);
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
var onetime$1 = onetime$2.exports;
|
|
329
|
+
|
|
330
330
|
export { signalExit$1 as a, onetime$2 as b, onetime$1 as o, signalExit as s };
|