vitest 0.27.0 → 0.27.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 +13 -12
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +10 -10
- package/dist/{chunk-api-setup.16ac28c0.js → chunk-api-setup.029198e3.js} +54 -30
- package/dist/{chunk-env-node.b3664da2.js → chunk-env-node.787e9561.js} +7 -0
- package/dist/{chunk-install-pkg.6dd2bae6.js → chunk-install-pkg.7b006b3e.js} +8 -8
- package/dist/{chunk-integrations-globals.3dfaeb99.js → chunk-integrations-globals.0024ce21.js} +6 -6
- package/dist/{chunk-mock-date.a1c85759.js → chunk-mock-date.c543fa3e.js} +15 -7
- package/dist/{chunk-node-git.543e964a.js → chunk-node-git.125c9008.js} +3 -3
- package/dist/{chunk-runtime-chain.6df5a66b.js → chunk-runtime-chain.2da9e75c.js} +6 -6
- package/dist/{chunk-runtime-error.fad2c32b.js → chunk-runtime-error.de671af0.js} +1 -1
- package/dist/{chunk-runtime-mocker.a677dd28.js → chunk-runtime-mocker.58511c38.js} +4 -4
- package/dist/{chunk-runtime-rpc.7f83c8a9.js → chunk-runtime-rpc.d709e91b.js} +1 -1
- package/dist/{chunk-runtime-setup.731b2b04.js → chunk-runtime-setup.35da9209.js} +15 -12
- package/dist/{chunk-snapshot-manager.700322bf.js → chunk-snapshot-manager.ce714e21.js} +127 -57
- package/dist/{chunk-utils-env.b861e3a0.js → chunk-utils-env.f4a39d2c.js} +7 -7
- package/dist/{chunk-utils-import.2baa69a9.js → chunk-utils-import.054ab315.js} +47 -4
- package/dist/{chunk-utils-source-map.60562959.js → chunk-utils-source-map.5f5d12cf.js} +2 -2
- package/dist/cli-wrapper.js +5 -5
- package/dist/cli.js +8 -8
- package/dist/config.cjs +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/entry.js +9 -9
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/{index-2d10c3fd.d.ts → index-50755efe.d.ts} +4 -2
- package/dist/index.d.ts +8 -4
- package/dist/index.js +7 -7
- package/dist/loader.js +8 -9
- package/dist/node.d.ts +2 -2
- package/dist/node.js +12 -10
- package/dist/suite.js +5 -5
- package/dist/{types-e1e1d1e5.d.ts → types-d97c72c7.d.ts} +17 -3
- package/dist/{vendor-index.b2fdde54.js → vendor-index.451e37bc.js} +1 -1
- package/dist/vendor-index.b0346fe4.js +395 -0
- package/dist/{vendor-index.7a2cebfe.js → vendor-index.e6c27006.js} +12 -12
- package/dist/worker.js +23 -18
- package/package.json +10 -9
- package/dist/vendor-index.2e96c50b.js +0 -215
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { performance } from 'perf_hooks';
|
|
2
2
|
import { g as generateHash, c as calculateSuiteHash, s as someTasksAreOnly, i as interpretTaskModes, t as takeCoverageInsideWorker, p as pLimit } from './chunk-integrations-coverage.44413252.js';
|
|
3
|
-
import { f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as getBenchOptions, n as getFn, o as setState, p as getSnapshotClient, G as GLOBAL_EXPECT, q as getState } from './chunk-runtime-chain.
|
|
4
|
-
import { r as resetRunOnceCounter, i as index, v as vi, s as setCurrentTest } from './chunk-utils-import.
|
|
5
|
-
import { g as getWorkerState, R as RealDate, t as toArray, k as relativePath, h as isRunningInBenchmark, p as partitionSuiteChildren, l as shuffle, q as hasTests, u as hasFailed, v as createDefer, e as getFullName } from './chunk-mock-date.
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
7
|
-
import { p as processError } from './chunk-runtime-error.
|
|
3
|
+
import { f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as getBenchOptions, n as getFn, o as setState, p as getSnapshotClient, G as GLOBAL_EXPECT, q as getState } from './chunk-runtime-chain.2da9e75c.js';
|
|
4
|
+
import { r as resetRunOnceCounter, i as index, v as vi, s as setCurrentTest } from './chunk-utils-import.054ab315.js';
|
|
5
|
+
import { g as getWorkerState, R as RealDate, t as toArray, k as relativePath, h as isRunningInBenchmark, p as partitionSuiteChildren, l as shuffle, q as hasTests, u as hasFailed, v as createDefer, e as getFullName } from './chunk-mock-date.c543fa3e.js';
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.d709e91b.js';
|
|
7
|
+
import { p as processError } from './chunk-runtime-error.de671af0.js';
|
|
8
8
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
9
|
-
import { e as environments } from './chunk-env-node.
|
|
10
|
-
import { i as isNode, a as isBrowser } from './chunk-utils-env.
|
|
9
|
+
import { e as environments } from './chunk-env-node.787e9561.js';
|
|
10
|
+
import { i as isNode, a as isBrowser } from './chunk-utils-env.f4a39d2c.js';
|
|
11
11
|
import { b as safeClearTimeout, s as safeSetTimeout } from './chunk-utils-timers.52534f96.js';
|
|
12
12
|
|
|
13
13
|
let globalSetup = false;
|
|
@@ -20,6 +20,9 @@ async function setupGlobalEnv(config) {
|
|
|
20
20
|
setupDefines(config.defines);
|
|
21
21
|
if (globalSetup)
|
|
22
22
|
return;
|
|
23
|
+
require.extensions[".css"] = () => ({});
|
|
24
|
+
require.extensions[".scss"] = () => ({});
|
|
25
|
+
require.extensions[".sass"] = () => ({});
|
|
23
26
|
globalSetup = true;
|
|
24
27
|
if (isNode) {
|
|
25
28
|
const state = getWorkerState();
|
|
@@ -29,7 +32,7 @@ async function setupGlobalEnv(config) {
|
|
|
29
32
|
await setupConsoleLogSpy();
|
|
30
33
|
}
|
|
31
34
|
if (config.globals)
|
|
32
|
-
(await import('./chunk-integrations-globals.
|
|
35
|
+
(await import('./chunk-integrations-globals.0024ce21.js')).registerApiGlobally();
|
|
33
36
|
}
|
|
34
37
|
function setupDefines(defines) {
|
|
35
38
|
for (const key in defines)
|
|
@@ -314,7 +317,7 @@ const callCleanupHooks = async (cleanups) => {
|
|
|
314
317
|
async function runTest(test) {
|
|
315
318
|
var _a, _b, _c;
|
|
316
319
|
if (test.mode !== "run") {
|
|
317
|
-
const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.
|
|
320
|
+
const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.2da9e75c.js').then(function (n) { return n.u; });
|
|
318
321
|
getSnapshotClient2().skipTestSnapshots(test);
|
|
319
322
|
return;
|
|
320
323
|
}
|
|
@@ -331,7 +334,7 @@ async function runTest(test) {
|
|
|
331
334
|
clearModuleMocks();
|
|
332
335
|
setCurrentTest(test);
|
|
333
336
|
if (isNode) {
|
|
334
|
-
const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.
|
|
337
|
+
const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.2da9e75c.js').then(function (n) { return n.u; });
|
|
335
338
|
await getSnapshotClient2().setTest(test);
|
|
336
339
|
}
|
|
337
340
|
const workerState = getWorkerState();
|
|
@@ -402,7 +405,7 @@ async function runTest(test) {
|
|
|
402
405
|
console.error(test.result.error.message, test.result.error.stackStr);
|
|
403
406
|
setCurrentTest(void 0);
|
|
404
407
|
if (isNode) {
|
|
405
|
-
const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.
|
|
408
|
+
const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.2da9e75c.js').then(function (n) { return n.u; });
|
|
406
409
|
getSnapshotClient2().clearTest();
|
|
407
410
|
}
|
|
408
411
|
test.result.duration = now() - start;
|
|
@@ -615,7 +618,7 @@ async function startTestsBrowser(paths, config) {
|
|
|
615
618
|
async function startTestsNode(paths, config) {
|
|
616
619
|
const files = await collectTests(paths, config);
|
|
617
620
|
rpc().onCollected(files);
|
|
618
|
-
const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.
|
|
621
|
+
const { getSnapshotClient: getSnapshotClient2 } = await import('./chunk-runtime-chain.2da9e75c.js').then(function (n) { return n.u; });
|
|
619
622
|
getSnapshotClient2().clear();
|
|
620
623
|
await runFiles(files, config);
|
|
621
624
|
const coverage = await takeCoverageInsideWorker(config.coverage);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { j as join, c as basename, d as dirname, r as relative, e as extname, b as resolve, f as distDir, g as rootDir, h as isAbsolute, i as isNode, k as configFiles, l as defaultPort, n as normalize, t as toNamespacedPath, E as EXIT_CODE_RESTART } from './chunk-utils-env.
|
|
1
|
+
import { j as join, c as basename, d as dirname, r as relative, e as extname, b as resolve, f as distDir, g as rootDir, h as isAbsolute, i as isNode, k as configFiles, l as defaultPort, n as normalize, t as toNamespacedPath, E as EXIT_CODE_RESTART } from './chunk-utils-env.f4a39d2c.js';
|
|
2
2
|
import { p as pLimit, g as generateHash, c as calculateSuiteHash, s as someTasksAreOnly, i as interpretTaskModes, a as getCoverageProvider, C as CoverageProviderMap } from './chunk-integrations-coverage.44413252.js';
|
|
3
|
-
import { g as getEnvPackageName } from './chunk-env-node.
|
|
4
|
-
import { y as ensurePackageInstalled, A as AggregateErrorPonyfill, s as slash$1, k as relativePath,
|
|
3
|
+
import { g as getEnvPackageName } from './chunk-env-node.787e9561.js';
|
|
4
|
+
import { y as ensurePackageInstalled, z as getTasks, A as AggregateErrorPonyfill, s as slash$1, k as relativePath, B as getTests, e as getFullName, u as hasFailed, C as hasFailedSnapshot, D as getSuites, j as notNullish, l as shuffle, t as toArray, n as noop$1, E as deepMerge, b as getCallLastIndex, F as removeUndefinedValues, G as isWindows, H as stdout } from './chunk-mock-date.c543fa3e.js';
|
|
5
5
|
import { loadConfigFromFile, normalizePath, createServer, mergeConfig } from 'vite';
|
|
6
6
|
import path$a from 'node:path';
|
|
7
7
|
import url, { fileURLToPath } from 'node:url';
|
|
8
8
|
import process$1 from 'node:process';
|
|
9
9
|
import fs$8, { promises, existsSync } from 'node:fs';
|
|
10
|
-
import
|
|
10
|
+
import k from 'path';
|
|
11
11
|
import require$$0 from 'os';
|
|
12
12
|
import util$2 from 'util';
|
|
13
13
|
import require$$0$1 from 'stream';
|
|
@@ -18,9 +18,9 @@ import c from 'picocolors';
|
|
|
18
18
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
19
19
|
import { ViteNodeServer } from 'vite-node/server';
|
|
20
20
|
import { writeFile, rm } from 'node:fs/promises';
|
|
21
|
-
import { e as execa } from './vendor-index.
|
|
21
|
+
import { e as execa } from './vendor-index.451e37bc.js';
|
|
22
22
|
import { SourceMapConsumer } from 'source-map';
|
|
23
|
-
import
|
|
23
|
+
import K, { createRequire } from 'module';
|
|
24
24
|
import { parse as parse$4 } from 'acorn';
|
|
25
25
|
import { ancestor } from 'acorn-walk';
|
|
26
26
|
import { MessageChannel } from 'node:worker_threads';
|
|
@@ -28,20 +28,20 @@ import { cpus, hostname } from 'node:os';
|
|
|
28
28
|
import { Tinypool } from 'tinypool';
|
|
29
29
|
import { c as createBirpc } from './vendor-index.783e7f3e.js';
|
|
30
30
|
import { performance } from 'perf_hooks';
|
|
31
|
-
import { s as stripAnsi, c as cliTruncate, b as parseStacktrace, d as stringWidth, e as sliceAnsi, a as positionToOffset, l as lineSplitRE } from './chunk-utils-source-map.
|
|
31
|
+
import { s as stripAnsi, c as cliTruncate, b as parseStacktrace, d as stringWidth, e as sliceAnsi, a as positionToOffset, l as lineSplitRE } from './chunk-utils-source-map.5f5d12cf.js';
|
|
32
32
|
import { g as safeSetInterval, h as safeClearInterval, s as safeSetTimeout, d as ansiStyles, c as createPatch, a as stringify$5, b as safeClearTimeout } from './chunk-utils-timers.52534f96.js';
|
|
33
33
|
import { resolveModule } from 'local-pkg';
|
|
34
34
|
import { createHash } from 'crypto';
|
|
35
35
|
import { slash as slash$2, cleanUrl } from 'vite-node/utils';
|
|
36
36
|
import { o as onetime } from './vendor-index.9c919048.js';
|
|
37
|
-
import { s as signalExit } from './vendor-index.
|
|
37
|
+
import { s as signalExit } from './vendor-index.e6c27006.js';
|
|
38
38
|
import { createHash as createHash$1 } from 'node:crypto';
|
|
39
39
|
import MagicString from './chunk-magic-string.3a794426.js';
|
|
40
40
|
import { stripLiteral } from 'strip-literal';
|
|
41
41
|
import require$$0$3 from 'readline';
|
|
42
42
|
import { p as prompts } from './vendor-index.9f20a9be.js';
|
|
43
43
|
|
|
44
|
-
var version$1 = "0.27.
|
|
44
|
+
var version$1 = "0.27.2";
|
|
45
45
|
|
|
46
46
|
class EndError extends Error {
|
|
47
47
|
constructor(value) {
|
|
@@ -247,7 +247,7 @@ var path$9 = {};
|
|
|
247
247
|
|
|
248
248
|
Object.defineProperty(path$9, "__esModule", { value: true });
|
|
249
249
|
path$9.removeLeadingDotSegment = path$9.escape = path$9.makeAbsolute = path$9.unixify = void 0;
|
|
250
|
-
const path$8 =
|
|
250
|
+
const path$8 = k;
|
|
251
251
|
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
|
|
252
252
|
const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
|
|
253
253
|
/**
|
|
@@ -453,7 +453,7 @@ var isGlob$1 = function isGlob(str, options) {
|
|
|
453
453
|
};
|
|
454
454
|
|
|
455
455
|
var isGlob = isGlob$1;
|
|
456
|
-
var pathPosixDirname =
|
|
456
|
+
var pathPosixDirname = k.posix.dirname;
|
|
457
457
|
var isWin32 = require$$0.platform() === 'win32';
|
|
458
458
|
|
|
459
459
|
var slash = '/';
|
|
@@ -1917,7 +1917,7 @@ var picomatch$2 = {exports: {}};
|
|
|
1917
1917
|
|
|
1918
1918
|
var utils$f = {};
|
|
1919
1919
|
|
|
1920
|
-
const path$7 =
|
|
1920
|
+
const path$7 = k;
|
|
1921
1921
|
const WIN_SLASH = '\\\\/';
|
|
1922
1922
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
1923
1923
|
|
|
@@ -2097,7 +2097,7 @@ var constants$3 = {
|
|
|
2097
2097
|
|
|
2098
2098
|
(function (exports) {
|
|
2099
2099
|
|
|
2100
|
-
const path =
|
|
2100
|
+
const path = k;
|
|
2101
2101
|
const win32 = process.platform === 'win32';
|
|
2102
2102
|
const {
|
|
2103
2103
|
REGEX_BACKSLASH,
|
|
@@ -3641,7 +3641,7 @@ parse$1.fastpaths = (input, options) => {
|
|
|
3641
3641
|
|
|
3642
3642
|
var parse_1 = parse$1;
|
|
3643
3643
|
|
|
3644
|
-
const path$6 =
|
|
3644
|
+
const path$6 = k;
|
|
3645
3645
|
const scan = scan_1;
|
|
3646
3646
|
const parse = parse_1;
|
|
3647
3647
|
const utils$c = utils$f;
|
|
@@ -4455,7 +4455,7 @@ var micromatch_1 = micromatch$1;
|
|
|
4455
4455
|
|
|
4456
4456
|
Object.defineProperty(pattern$1, "__esModule", { value: true });
|
|
4457
4457
|
pattern$1.matchAny = pattern$1.convertPatternsToRe = pattern$1.makeRe = pattern$1.getPatternParts = pattern$1.expandBraceExpansion = pattern$1.expandPatternsWithBraceExpansion = pattern$1.isAffectDepthOfReadingPattern = pattern$1.endsWithSlashGlobStar = pattern$1.hasGlobStar = pattern$1.getBaseDirectory = pattern$1.isPatternRelatedToParentDirectory = pattern$1.getPatternsOutsideCurrentDirectory = pattern$1.getPatternsInsideCurrentDirectory = pattern$1.getPositivePatterns = pattern$1.getNegativePatterns = pattern$1.isPositivePattern = pattern$1.isNegativePattern = pattern$1.convertToNegativePattern = pattern$1.convertToPositivePattern = pattern$1.isDynamicPattern = pattern$1.isStaticPattern = void 0;
|
|
4458
|
-
const path$5 =
|
|
4458
|
+
const path$5 = k;
|
|
4459
4459
|
const globParent = globParent$1;
|
|
4460
4460
|
const micromatch = micromatch_1;
|
|
4461
4461
|
const GLOBSTAR = '**';
|
|
@@ -5374,7 +5374,7 @@ var fs$1 = {};
|
|
|
5374
5374
|
} (fs$1));
|
|
5375
5375
|
|
|
5376
5376
|
Object.defineProperty(settings$2, "__esModule", { value: true });
|
|
5377
|
-
const path$3 =
|
|
5377
|
+
const path$3 = k;
|
|
5378
5378
|
const fsStat$3 = out$1;
|
|
5379
5379
|
const fs = fs$1;
|
|
5380
5380
|
class Settings$1 {
|
|
@@ -6028,7 +6028,7 @@ sync$3.default = SyncProvider;
|
|
|
6028
6028
|
var settings$1 = {};
|
|
6029
6029
|
|
|
6030
6030
|
Object.defineProperty(settings$1, "__esModule", { value: true });
|
|
6031
|
-
const path$2 =
|
|
6031
|
+
const path$2 = k;
|
|
6032
6032
|
const fsScandir = out$2;
|
|
6033
6033
|
class Settings {
|
|
6034
6034
|
constructor(_options = {}) {
|
|
@@ -6090,7 +6090,7 @@ function getSettings(settingsOrOptions = {}) {
|
|
|
6090
6090
|
var reader = {};
|
|
6091
6091
|
|
|
6092
6092
|
Object.defineProperty(reader, "__esModule", { value: true });
|
|
6093
|
-
const path$1 =
|
|
6093
|
+
const path$1 = k;
|
|
6094
6094
|
const fsStat$2 = out$1;
|
|
6095
6095
|
const utils$6 = utils$k;
|
|
6096
6096
|
class Reader {
|
|
@@ -6484,7 +6484,7 @@ class EntryTransformer {
|
|
|
6484
6484
|
entry.default = EntryTransformer;
|
|
6485
6485
|
|
|
6486
6486
|
Object.defineProperty(provider, "__esModule", { value: true });
|
|
6487
|
-
const path =
|
|
6487
|
+
const path = k;
|
|
6488
6488
|
const deep_1 = deep;
|
|
6489
6489
|
const entry_1 = entry$1;
|
|
6490
6490
|
const error_1 = error;
|
|
@@ -6854,9 +6854,9 @@ function addSnapshotResult(summary, result) {
|
|
|
6854
6854
|
summary.total += result.added + result.matched + result.unmatched + result.updated;
|
|
6855
6855
|
}
|
|
6856
6856
|
|
|
6857
|
-
function
|
|
6858
|
-
`;break;case 114:
|
|
6859
|
-
`),u++,d=e,o=14;switch(s){case 123:return e++,o=1;case 125:return e++,o=2;case 91:return e++,o=3;case 93:return e++,o=4;case 58:return e++,o=6;case 44:return e++,o=5;case 34:return e++,i=_(),o=10;case 47:var m=e-1;if(r.charCodeAt(e+1)===47){for(e+=2;e<n&&!P(r.charCodeAt(e));)e++;return i=r.substring(m,e),o=12}if(r.charCodeAt(e+1)===42){e+=2;for(var v=n-1,b=!1;e<v;){var h=r.charCodeAt(e);if(h===42&&r.charCodeAt(e+1)===47){e+=2,b=!0;break}e++,P(h)&&(h===13&&r.charCodeAt(e)===10&&e++,u++,d=e);}return b||(e++,c=1),i=r.substring(m,e),o=13}return i+=String.fromCharCode(s),e++,o=16;case 45:if(i+=String.fromCharCode(s),e++,e===n||!j(r.charCodeAt(e)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=$(),o=11;default:for(;e<n&&k(s);)e++,s=r.charCodeAt(e);if(a!==e){switch(i=r.substring(a,e),i){case"true":return o=8;case"false":return o=9;case"null":return o=7}return o=16}return i+=String.fromCharCode(s),e++,o=16}}function k(s){if(U(s)||P(s))return !1;switch(s){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return !1}return !0}function l(){var s;do s=S();while(s>=12&&s<=15);return s}return {setPosition:V,getPosition:function(){return e},scan:t?l:S,getToken:function(){return o},getTokenValue:function(){return i},getTokenOffset:function(){return a},getTokenLength:function(){return e-a},getTokenStartLine:function(){return f},getTokenStartCharacter:function(){return a-C},getTokenError:function(){return c}}}function U(r){return r===32||r===9||r===11||r===12||r===160||r===5760||r>=8192&&r<=8203||r===8239||r===8287||r===12288||r===65279}function P(r){return r===10||r===13||r===8232||r===8233}function j(r){return r>=48&&r<=57}var N;(function(r){r.DEFAULT={allowTrailingComma:!1};})(N||(N={}));function K(r,t,n){t===void 0&&(t=[]),n===void 0&&(n=N.DEFAULT);var e=null,i=[],a=[];function o(f){Array.isArray(i)?i.push(f):e!==null&&(i[e]=f);}var u={onObjectBegin:function(){var f={};o(f),a.push(i),i=f,e=null;},onObjectProperty:function(f){e=f;},onObjectEnd:function(){i=a.pop();},onArrayBegin:function(){var f=[];o(f),a.push(i),i=f,e=null;},onArrayEnd:function(){i=a.pop();},onLiteralValue:o,onError:function(f,d,C){t.push({error:f,offset:d,length:C});}};return Q(r,u,n),i[0]}function Q(r,t,n){n===void 0&&(n=N.DEFAULT);var e=G(r,!1);function i(p){return p?function(){return p(e.getTokenOffset(),e.getTokenLength(),e.getTokenStartLine(),e.getTokenStartCharacter())}:function(){return !0}}function a(p){return p?function(w){return p(w,e.getTokenOffset(),e.getTokenLength(),e.getTokenStartLine(),e.getTokenStartCharacter())}:function(){return !0}}var o=i(t.onObjectBegin),u=a(t.onObjectProperty),f=i(t.onObjectEnd),d=i(t.onArrayBegin),C=i(t.onArrayEnd),c=a(t.onLiteralValue),y=a(t.onSeparator),V=i(t.onComment),$=a(t.onError),_=n&&n.disallowComments,S=n&&n.allowTrailingComma;function k(){for(;;){var p=e.scan();switch(e.getTokenError()){case 4:l(14);break;case 5:l(15);break;case 3:l(13);break;case 1:_||l(11);break;case 2:l(12);break;case 6:l(16);break}switch(p){case 12:case 13:_?l(10):V();break;case 16:l(1);break;case 15:case 14:break;default:return p}}}function l(p,w,L){if(w===void 0&&(w=[]),L===void 0&&(L=[]),$(p),w.length+L.length>0)for(var D=e.getToken();D!==17;){if(w.indexOf(D)!==-1){k();break}else if(L.indexOf(D)!==-1)break;D=k();}}function s(p){var w=e.getTokenValue();return p?c(w):u(w),k(),!0}function m(){switch(e.getToken()){case 11:var p=e.getTokenValue(),w=Number(p);isNaN(w)&&(l(2),w=0),c(w);break;case 7:c(null);break;case 8:c(!0);break;case 9:c(!1);break;default:return !1}return k(),!0}function v(){return e.getToken()!==10?(l(3,[],[2,5]),!1):(s(!1),e.getToken()===6?(y(":"),k(),F()||l(4,[],[2,5])):l(5,[],[2,5]),!0)}function b(){o(),k();for(var p=!1;e.getToken()!==2&&e.getToken()!==17;){if(e.getToken()===5){if(p||l(4,[],[]),y(","),k(),e.getToken()===2&&S)break}else p&&l(6,[],[]);v()||l(4,[],[2,5]),p=!0;}return f(),e.getToken()!==2?l(7,[2],[]):k(),!0}function h(){d(),k();for(var p=!1;e.getToken()!==4&&e.getToken()!==17;){if(e.getToken()===5){if(p||l(4,[],[]),y(","),k(),e.getToken()===4&&S)break}else p&&l(6,[],[]);F()||l(4,[],[4,5]),p=!0;}return C(),e.getToken()!==4?l(8,[4],[]):k(),!0}function F(){switch(e.getToken()){case 3:return h();case 1:return b();case 10:return s(!0);default:return m()}}return k(),e.getToken()===17?n.allowEmptyContent?!0:(l(4,[],[]),!1):F()?(e.getToken()!==17&&l(9,[],[]),!0):(l(4,[],[]),!1)}var X=K;const W=/^\.{1,2}(\/.*)?$/,J=r=>T(W.test(r)?r:`./${r}`),{existsSync:E}=require$$0$2,Y=r=>{try{return JSON.parse(r)}catch{}},Z=()=>{const{findPnpApi:r}=H;return r&&r(process.cwd())};function I(r){const t=Y(require$$0$2.readFileSync(r,"utf8"));return g.join(r,"..",t&&"tsconfig"in t?t.tsconfig:"tsconfig.json")}function x(r,t){let n=r;if(n===".."&&(n+="/tsconfig.json"),n.startsWith(".")){let a=g.resolve(t,n);if(E(a)&&require$$0$2.statSync(a).isFile()||!a.endsWith(".json")&&(a+=".json",E(a)))return a;throw new Error(`File '${r}' not found.`)}const e=Z();if(e){const{resolveRequest:a}=e,[o,u]=r.split("/"),f=o.startsWith("@")?`${o}/${u}`:o;try{if(f===r){const d=a(g.join(f,"package.json"),t);if(d){const C=I(d);if(E(C))return C}}else try{return a(r,t,{extensions:[".json"]})}catch{return a(g.join(r,"tsconfig.json"),t)}}catch{}}let i=B(t,g.join("node_modules",n));if(i){if(require$$0$2.statSync(i).isDirectory()){const a=g.join(i,"package.json");if(E(a)?i=I(a):i=g.join(i,"tsconfig.json"),E(i))return i}else if(i.endsWith(".json"))return i}if(!n.endsWith(".json")&&(n+=".json",i=B(t,g.join("node_modules",n)),i))return i;throw new Error(`File '${r}' not found.`)}var ee=Object.defineProperty,re=Object.defineProperties,ne=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,ae=Object.prototype.propertyIsEnumerable,q=(r,t,n)=>t in r?ee(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n,A=(r,t)=>{for(var n in t||(t={}))te.call(t,n)&&q(r,n,t[n]);if(R)for(var n of R(t))ae.call(t,n)&&q(r,n,t[n]);return r},oe=(r,t)=>re(r,ne(t));function M(r){var t;let n;try{n=require$$0$2.realpathSync(r);}catch{throw new Error(`Cannot resolve tsconfig at path: ${r}`)}const e=g.dirname(n),i=require$$0$2.readFileSync(n,"utf8").trim();let a={};if(i&&(a=X(i),!a||typeof a!="object"))throw new SyntaxError(`Failed to parse tsconfig at: ${r}`);if(a.extends){const o=x(a.extends,e),u=M(o);if(delete u.references,(t=u.compilerOptions)!=null&&t.baseUrl){const{compilerOptions:d}=u;d.baseUrl=g.relative(e,g.join(g.dirname(o),d.baseUrl))||"./";}u.files&&(u.files=u.files.map(d=>g.relative(e,g.join(g.dirname(o),d)))),u.include&&(u.include=u.include.map(d=>g.relative(e,g.join(g.dirname(o),d)))),delete a.extends;const f=oe(A(A({},u),a),{compilerOptions:A(A({},u.compilerOptions),a.compilerOptions)});u.watchOptions&&(f.watchOptions=A(A({},u.watchOptions),a.watchOptions)),a=f;}if(a.compilerOptions){const{compilerOptions:o}=a;o.baseUrl&&(o.baseUrl=J(o.baseUrl)),o.outDir&&(Array.isArray(a.exclude)||(a.exclude=[]),a.exclude.push(o.outDir),o.outDir=J(o.outDir));}if(a.files&&(a.files=a.files.map(J)),a.include&&(a.include=a.include.map(T)),a.watchOptions){const{watchOptions:o}=a;o.excludeDirectories&&(o.excludeDirectories=o.excludeDirectories.map(u=>T(g.resolve(e,u))));}return a}function ie(r=process.cwd(),t="tsconfig.json"){const n=B(r,t);if(!n)return null;const e=M(n);return {path:n,config:e}}
|
|
6857
|
+
function A(n){return /^\\\\\?\\/.test(n)?n:n.replace(/\\/g,"/")}function y(n,u){for(;;){const l=k.join(n,u);if(require$$0$2.existsSync(l))return A(l);const e=k.dirname(n);if(e===n)return;n=e;}}const M=/^\.{1,2}(\/.*)?$/,R=n=>A(M.test(n)?n:`./${n}`);function d(n,u=!1){const l=n.length;let e=0,t="",f=0,i=16,b=0,c=0,w=0,T=0,p=0;function V(o,r){let s=0,O=0;for(;s<o||!r;){let m=n.charCodeAt(e);if(m>=48&&m<=57)O=O*16+m-48;else if(m>=65&&m<=70)O=O*16+m-65+10;else if(m>=97&&m<=102)O=O*16+m-97+10;else break;e++,s++;}return s<o&&(O=-1),O}function D(o){e=o,t="",f=0,i=16,p=0;}function v(){let o=e;if(n.charCodeAt(e)===48)e++;else for(e++;e<n.length&&B(n.charCodeAt(e));)e++;if(e<n.length&&n.charCodeAt(e)===46)if(e++,e<n.length&&B(n.charCodeAt(e)))for(e++;e<n.length&&B(n.charCodeAt(e));)e++;else return p=3,n.substring(o,e);let r=e;if(e<n.length&&(n.charCodeAt(e)===69||n.charCodeAt(e)===101))if(e++,(e<n.length&&n.charCodeAt(e)===43||n.charCodeAt(e)===45)&&e++,e<n.length&&B(n.charCodeAt(e))){for(e++;e<n.length&&B(n.charCodeAt(e));)e++;r=e;}else p=3;return n.substring(o,r)}function L(){let o="",r=e;for(;;){if(e>=l){o+=n.substring(r,e),p=2;break}const s=n.charCodeAt(e);if(s===34){o+=n.substring(r,e),e++;break}if(s===92){if(o+=n.substring(r,e),e++,e>=l){p=2;break}switch(n.charCodeAt(e++)){case 34:o+='"';break;case 92:o+="\\";break;case 47:o+="/";break;case 98:o+="\b";break;case 102:o+="\f";break;case 110:o+=`
|
|
6858
|
+
`;break;case 114:o+="\r";break;case 116:o+=" ";break;case 117:const m=V(4,!0);m>=0?o+=String.fromCharCode(m):p=4;break;default:p=5;}r=e;continue}if(s>=0&&s<=31)if(U(s)){o+=n.substring(r,e),p=2;break}else p=6;e++;}return o}function E(){if(t="",p=0,f=e,c=b,T=w,e>=l)return f=l,i=17;let o=n.charCodeAt(e);if(J(o)){do e++,t+=String.fromCharCode(o),o=n.charCodeAt(e);while(J(o));return i=15}if(U(o))return e++,t+=String.fromCharCode(o),o===13&&n.charCodeAt(e)===10&&(e++,t+=`
|
|
6859
|
+
`),b++,w=e,i=14;switch(o){case 123:return e++,i=1;case 125:return e++,i=2;case 91:return e++,i=3;case 93:return e++,i=4;case 58:return e++,i=6;case 44:return e++,i=5;case 34:return e++,t=L(),i=10;case 47:const r=e-1;if(n.charCodeAt(e+1)===47){for(e+=2;e<l&&!U(n.charCodeAt(e));)e++;return t=n.substring(r,e),i=12}if(n.charCodeAt(e+1)===42){e+=2;const s=l-1;let O=!1;for(;e<s;){const m=n.charCodeAt(e);if(m===42&&n.charCodeAt(e+1)===47){e+=2,O=!0;break}e++,U(m)&&(m===13&&n.charCodeAt(e)===10&&e++,b++,w=e);}return O||(e++,p=1),t=n.substring(r,e),i=13}return t+=String.fromCharCode(o),e++,i=16;case 45:if(t+=String.fromCharCode(o),e++,e===l||!B(n.charCodeAt(e)))return i=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return t+=v(),i=11;default:for(;e<l&&W(o);)e++,o=n.charCodeAt(e);if(f!==e){switch(t=n.substring(f,e),t){case"true":return i=8;case"false":return i=9;case"null":return i=7}return i=16}return t+=String.fromCharCode(o),e++,i=16}}function W(o){if(J(o)||U(o))return !1;switch(o){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return !1}return !0}function _(){let o;do o=E();while(o>=12&&o<=15);return o}return {setPosition:D,getPosition:()=>e,scan:u?_:E,getToken:()=>i,getTokenValue:()=>t,getTokenOffset:()=>f,getTokenLength:()=>e-f,getTokenStartLine:()=>c,getTokenStartCharacter:()=>f-T,getTokenError:()=>p}}function J(n){return n===32||n===9}function U(n){return n===10||n===13}function B(n){return n>=48&&n<=57}var H;(function(n){n[n.lineFeed=10]="lineFeed",n[n.carriageReturn=13]="carriageReturn",n[n.space=32]="space",n[n._0=48]="_0",n[n._1=49]="_1",n[n._2=50]="_2",n[n._3=51]="_3",n[n._4=52]="_4",n[n._5=53]="_5",n[n._6=54]="_6",n[n._7=55]="_7",n[n._8=56]="_8",n[n._9=57]="_9",n[n.a=97]="a",n[n.b=98]="b",n[n.c=99]="c",n[n.d=100]="d",n[n.e=101]="e",n[n.f=102]="f",n[n.g=103]="g",n[n.h=104]="h",n[n.i=105]="i",n[n.j=106]="j",n[n.k=107]="k",n[n.l=108]="l",n[n.m=109]="m",n[n.n=110]="n",n[n.o=111]="o",n[n.p=112]="p",n[n.q=113]="q",n[n.r=114]="r",n[n.s=115]="s",n[n.t=116]="t",n[n.u=117]="u",n[n.v=118]="v",n[n.w=119]="w",n[n.x=120]="x",n[n.y=121]="y",n[n.z=122]="z",n[n.A=65]="A",n[n.B=66]="B",n[n.C=67]="C",n[n.D=68]="D",n[n.E=69]="E",n[n.F=70]="F",n[n.G=71]="G",n[n.H=72]="H",n[n.I=73]="I",n[n.J=74]="J",n[n.K=75]="K",n[n.L=76]="L",n[n.M=77]="M",n[n.N=78]="N",n[n.O=79]="O",n[n.P=80]="P",n[n.Q=81]="Q",n[n.R=82]="R",n[n.S=83]="S",n[n.T=84]="T",n[n.U=85]="U",n[n.V=86]="V",n[n.W=87]="W",n[n.X=88]="X",n[n.Y=89]="Y",n[n.Z=90]="Z",n[n.asterisk=42]="asterisk",n[n.backslash=92]="backslash",n[n.closeBrace=125]="closeBrace",n[n.closeBracket=93]="closeBracket",n[n.colon=58]="colon",n[n.comma=44]="comma",n[n.dot=46]="dot",n[n.doubleQuote=34]="doubleQuote",n[n.minus=45]="minus",n[n.openBrace=123]="openBrace",n[n.openBracket=91]="openBracket",n[n.plus=43]="plus",n[n.slash=47]="slash",n[n.formFeed=12]="formFeed",n[n.tab=9]="tab";})(H||(H={}));var I;(function(n){n.DEFAULT={allowTrailingComma:!1};})(I||(I={}));function C(n,u=[],l=I.DEFAULT){let e=null,t=[];const f=[];function i(c){Array.isArray(t)?t.push(c):e!==null&&(t[e]=c);}return nn(n,{onObjectBegin:()=>{const c={};i(c),f.push(t),t=c,e=null;},onObjectProperty:c=>{e=c;},onObjectEnd:()=>{t=f.pop();},onArrayBegin:()=>{const c=[];i(c),f.push(t),t=c,e=null;},onArrayEnd:()=>{t=f.pop();},onLiteralValue:i,onError:(c,w,T)=>{u.push({error:c,offset:w,length:T});}},l),t[0]}function nn(n,u,l=I.DEFAULT){const e=d(n,!1),t=[];function f(g){return g?()=>g(e.getTokenOffset(),e.getTokenLength(),e.getTokenStartLine(),e.getTokenStartCharacter()):()=>!0}function i(g){return g?()=>g(e.getTokenOffset(),e.getTokenLength(),e.getTokenStartLine(),e.getTokenStartCharacter(),()=>t.slice()):()=>!0}function b(g){return g?a=>g(a,e.getTokenOffset(),e.getTokenLength(),e.getTokenStartLine(),e.getTokenStartCharacter()):()=>!0}function c(g){return g?a=>g(a,e.getTokenOffset(),e.getTokenLength(),e.getTokenStartLine(),e.getTokenStartCharacter(),()=>t.slice()):()=>!0}const w=i(u.onObjectBegin),T=c(u.onObjectProperty),p=f(u.onObjectEnd),V=i(u.onArrayBegin),D=f(u.onArrayEnd),v=c(u.onLiteralValue),L=b(u.onSeparator),E=f(u.onComment),W=b(u.onError),_=l&&l.disallowComments,o=l&&l.allowTrailingComma;function r(){for(;;){const g=e.scan();switch(e.getTokenError()){case 4:s(14);break;case 5:s(15);break;case 3:s(13);break;case 1:_||s(11);break;case 2:s(12);break;case 6:s(16);break}switch(g){case 12:case 13:_?s(10):E();break;case 16:s(1);break;case 15:case 14:break;default:return g}}}function s(g,a=[],z=[]){if(W(g),a.length+z.length>0){let F=e.getToken();for(;F!==17;){if(a.indexOf(F)!==-1){r();break}else if(z.indexOf(F)!==-1)break;F=r();}}}function O(g){const a=e.getTokenValue();return g?v(a):(T(a),t.push(a)),r(),!0}function m(){switch(e.getToken()){case 11:const g=e.getTokenValue();let a=Number(g);isNaN(a)&&(s(2),a=0),v(a);break;case 7:v(null);break;case 8:v(!0);break;case 9:v(!1);break;default:return !1}return r(),!0}function P(){return e.getToken()!==10?(s(3,[],[2,5]),!1):(O(!1),e.getToken()===6?(L(":"),r(),$()||s(4,[],[2,5])):s(5,[],[2,5]),t.pop(),!0)}function q(){w(),r();let g=!1;for(;e.getToken()!==2&&e.getToken()!==17;){if(e.getToken()===5){if(g||s(4,[],[]),L(","),r(),e.getToken()===2&&o)break}else g&&s(6,[],[]);P()||s(4,[],[2,5]),g=!0;}return p(),e.getToken()!==2?s(7,[2],[]):r(),!0}function x(){V(),r();let g=!0,a=!1;for(;e.getToken()!==4&&e.getToken()!==17;){if(e.getToken()===5){if(a||s(4,[],[]),L(","),r(),e.getToken()===4&&o)break}else a&&s(6,[],[]);g?(t.push(0),g=!1):t[t.length-1]++,$()||s(4,[],[4,5]),a=!0;}return D(),g||t.pop(),e.getToken()!==4?s(8,[4],[]):r(),!0}function $(){switch(e.getToken()){case 3:return x();case 1:return q();case 10:return O(!0);default:return m()}}return r(),e.getToken()===17?l.allowEmptyContent?!0:(s(4,[],[]),!1):$()?(e.getToken()!==17&&s(9,[],[]),!0):(s(4,[],[]),!1)}var G;(function(n){n[n.None=0]="None",n[n.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",n[n.UnexpectedEndOfString=2]="UnexpectedEndOfString",n[n.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",n[n.InvalidUnicode=4]="InvalidUnicode",n[n.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",n[n.InvalidCharacter=6]="InvalidCharacter";})(G||(G={}));var X;(function(n){n[n.OpenBraceToken=1]="OpenBraceToken",n[n.CloseBraceToken=2]="CloseBraceToken",n[n.OpenBracketToken=3]="OpenBracketToken",n[n.CloseBracketToken=4]="CloseBracketToken",n[n.CommaToken=5]="CommaToken",n[n.ColonToken=6]="ColonToken",n[n.NullKeyword=7]="NullKeyword",n[n.TrueKeyword=8]="TrueKeyword",n[n.FalseKeyword=9]="FalseKeyword",n[n.StringLiteral=10]="StringLiteral",n[n.NumericLiteral=11]="NumericLiteral",n[n.LineCommentTrivia=12]="LineCommentTrivia",n[n.BlockCommentTrivia=13]="BlockCommentTrivia",n[n.LineBreakTrivia=14]="LineBreakTrivia",n[n.Trivia=15]="Trivia",n[n.Unknown=16]="Unknown",n[n.EOF=17]="EOF";})(X||(X={}));const en=C;var Y;(function(n){n[n.InvalidSymbol=1]="InvalidSymbol",n[n.InvalidNumberFormat=2]="InvalidNumberFormat",n[n.PropertyNameExpected=3]="PropertyNameExpected",n[n.ValueExpected=4]="ValueExpected",n[n.ColonExpected=5]="ColonExpected",n[n.CommaExpected=6]="CommaExpected",n[n.CloseBraceExpected=7]="CloseBraceExpected",n[n.CloseBracketExpected=8]="CloseBracketExpected",n[n.EndOfFileExpected=9]="EndOfFileExpected",n[n.InvalidCommentToken=10]="InvalidCommentToken",n[n.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",n[n.UnexpectedEndOfString=12]="UnexpectedEndOfString",n[n.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",n[n.InvalidUnicode=14]="InvalidUnicode",n[n.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",n[n.InvalidCharacter=16]="InvalidCharacter";})(Y||(Y={}));const Z=n=>en(require$$0$2.readFileSync(n,"utf8")),{existsSync:N}=require$$0$2,tn=()=>{const{findPnpApi:n}=K;return n&&n(process.cwd())};function h(n){const u=Z(n);return k.join(n,"..",u&&"tsconfig"in u?u.tsconfig:"tsconfig.json")}function ln(n,u){let l=n;const e=n[0]===".";if(e||k.isAbsolute(n)){if(e&&(l===".."&&(l+="/tsconfig.json"),l=k.resolve(u,l)),N(l)&&require$$0$2.statSync(l).isFile()||!l.endsWith(".json")&&(l+=".json",N(l)))return l;throw new Error(`File '${n}' not found.`)}const t=tn();if(t){const{resolveRequest:i}=t,[b,c]=n.split("/"),w=b.startsWith("@")?`${b}/${c}`:b;try{if(w===n){const T=i(k.join(w,"package.json"),u);if(T){const p=h(T);if(N(p))return p}}else {let T;try{T=i(n,u,{extensions:[".json"]});}catch{T=i(k.join(n,"tsconfig.json"),u);}if(T)return T}}catch{}}let f=y(u,k.join("node_modules",l));if(f){if(require$$0$2.statSync(f).isDirectory()){const i=k.join(f,"package.json");if(N(i)?f=h(i):f=k.join(f,"tsconfig.json"),N(f))return f}else if(f.endsWith(".json"))return f}if(!l.endsWith(".json")&&(l+=".json",f=y(u,k.join("node_modules",l)),f))return f;throw new Error(`File '${n}' not found.`)}function Q(n){var u;let l;try{l=require$$0$2.realpathSync(n);}catch{throw new Error(`Cannot resolve tsconfig at path: ${n}`)}const e=k.dirname(l);let t=Z(l)||{};if(typeof t!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${n}`);if(t.extends){const f=ln(t.extends,e),i=Q(f);if(delete i.references,(u=i.compilerOptions)!=null&&u.baseUrl){const{compilerOptions:c}=i;c.baseUrl=k.relative(e,k.join(k.dirname(f),c.baseUrl))||"./";}i.files&&(i.files=i.files.map(c=>k.relative(e,k.join(k.dirname(f),c)))),i.include&&(i.include=i.include.map(c=>k.relative(e,k.join(k.dirname(f),c)))),delete t.extends;const b={...i,...t,compilerOptions:{...i.compilerOptions,...t.compilerOptions}};i.watchOptions&&(b.watchOptions={...i.watchOptions,...t.watchOptions}),t=b;}if(t.compilerOptions){const{compilerOptions:f}=t;f.baseUrl&&(f.baseUrl=R(f.baseUrl)),f.outDir&&(Array.isArray(t.exclude)||(t.exclude=[]),t.exclude.push(f.outDir),f.outDir=R(f.outDir));}else t.compilerOptions={};if(t.files&&(t.files=t.files.map(R)),t.include&&(t.include=t.include.map(A)),t.watchOptions){const{watchOptions:f}=t;f.excludeDirectories&&(f.excludeDirectories=f.excludeDirectories.map(i=>A(k.resolve(e,i))));}return t}function fn(n=process.cwd(),u="tsconfig.json"){const l=y(n,u);if(!l)return null;const e=Q(l);return {path:l,config:e}}
|
|
6860
6860
|
|
|
6861
6861
|
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
|
6862
6862
|
const newLineRegExp = /\r?\n/;
|
|
@@ -6897,7 +6897,7 @@ async function getTsconfig(root, config) {
|
|
|
6897
6897
|
var _a;
|
|
6898
6898
|
const tempConfigPath = join(root, "tsconfig.temp.json");
|
|
6899
6899
|
const configName = ((_a = config.tsconfig) == null ? void 0 : _a.includes("jsconfig.json")) ? "jsconfig.json" : void 0;
|
|
6900
|
-
const tsconfig =
|
|
6900
|
+
const tsconfig = fn(config.tsconfig || root, configName);
|
|
6901
6901
|
if (!tsconfig)
|
|
6902
6902
|
throw new Error("no tsconfig.json found");
|
|
6903
6903
|
try {
|
|
@@ -7126,6 +7126,27 @@ class Typechecker {
|
|
|
7126
7126
|
this._tests = tests;
|
|
7127
7127
|
return tests;
|
|
7128
7128
|
}
|
|
7129
|
+
markPassed(file) {
|
|
7130
|
+
var _a;
|
|
7131
|
+
if (!((_a = file.result) == null ? void 0 : _a.state)) {
|
|
7132
|
+
file.result = {
|
|
7133
|
+
state: "pass"
|
|
7134
|
+
};
|
|
7135
|
+
}
|
|
7136
|
+
const markTasks = (tasks) => {
|
|
7137
|
+
var _a2;
|
|
7138
|
+
for (const task of tasks) {
|
|
7139
|
+
if ("tasks" in task)
|
|
7140
|
+
markTasks(task.tasks);
|
|
7141
|
+
if (!((_a2 = task.result) == null ? void 0 : _a2.state) && task.mode === "run") {
|
|
7142
|
+
task.result = {
|
|
7143
|
+
state: "pass"
|
|
7144
|
+
};
|
|
7145
|
+
}
|
|
7146
|
+
}
|
|
7147
|
+
};
|
|
7148
|
+
markTasks(file.tasks);
|
|
7149
|
+
}
|
|
7129
7150
|
async prepareResults(output) {
|
|
7130
7151
|
const typeErrors = await this.parseTscLikeOutput(output);
|
|
7131
7152
|
const testFiles = new Set(this.getFiles());
|
|
@@ -7137,17 +7158,19 @@ class Typechecker {
|
|
|
7137
7158
|
const { file, definitions, map, parsed } = this._tests[path];
|
|
7138
7159
|
const errors = typeErrors.get(path);
|
|
7139
7160
|
files.push(file);
|
|
7140
|
-
if (!errors)
|
|
7161
|
+
if (!errors) {
|
|
7162
|
+
this.markPassed(file);
|
|
7141
7163
|
return;
|
|
7164
|
+
}
|
|
7142
7165
|
const sortedDefinitions = [...definitions.sort((a, b) => b.start - a.start)];
|
|
7143
7166
|
const mapConsumer = map && new SourceMapConsumer(map);
|
|
7144
7167
|
const indexMap = createIndexMap(parsed);
|
|
7145
|
-
const
|
|
7168
|
+
const markState = (task, state) => {
|
|
7146
7169
|
task.result = {
|
|
7147
|
-
state: task.mode === "run" || task.mode === "only" ?
|
|
7170
|
+
state: task.mode === "run" || task.mode === "only" ? state : task.mode
|
|
7148
7171
|
};
|
|
7149
7172
|
if (task.suite)
|
|
7150
|
-
|
|
7173
|
+
markState(task.suite, state);
|
|
7151
7174
|
};
|
|
7152
7175
|
errors.forEach(({ error, originalError }) => {
|
|
7153
7176
|
var _a;
|
|
@@ -7167,8 +7190,9 @@ class Typechecker {
|
|
|
7167
7190
|
};
|
|
7168
7191
|
errors2.push(error);
|
|
7169
7192
|
if (state === "fail" && suite.suite)
|
|
7170
|
-
|
|
7193
|
+
markState(suite.suite, "fail");
|
|
7171
7194
|
});
|
|
7195
|
+
this.markPassed(file);
|
|
7172
7196
|
});
|
|
7173
7197
|
typeErrors.forEach((errors, path) => {
|
|
7174
7198
|
if (!testFiles.has(path))
|
|
@@ -7281,7 +7305,7 @@ class Typechecker {
|
|
|
7281
7305
|
return Object.values(this._tests || {}).map((i) => i.file);
|
|
7282
7306
|
}
|
|
7283
7307
|
getTestPacks() {
|
|
7284
|
-
return Object.values(this._tests || {}).map((i) => [i.
|
|
7308
|
+
return Object.values(this._tests || {}).map(({ file }) => getTasks(file)).flat().map((i) => [i.id, void 0]);
|
|
7285
7309
|
}
|
|
7286
7310
|
}
|
|
7287
7311
|
|
|
@@ -7366,6 +7390,7 @@ function createPool(ctx) {
|
|
|
7366
7390
|
return {
|
|
7367
7391
|
runTests: runWithFiles("run"),
|
|
7368
7392
|
close: async () => {
|
|
7393
|
+
await Promise.all(pool.threads.map((w) => w.terminate()));
|
|
7369
7394
|
}
|
|
7370
7395
|
};
|
|
7371
7396
|
}
|
|
@@ -7375,7 +7400,8 @@ function createChannel(ctx) {
|
|
|
7375
7400
|
const workerPort = channel.port1;
|
|
7376
7401
|
createBirpc(
|
|
7377
7402
|
{
|
|
7378
|
-
onWorkerExit(code) {
|
|
7403
|
+
async onWorkerExit(error, code) {
|
|
7404
|
+
await ctx.logger.printError(error, false, "Unexpected Exit");
|
|
7379
7405
|
process.exit(code || 1);
|
|
7380
7406
|
},
|
|
7381
7407
|
snapshotSaved(snapshot) {
|
|
@@ -8572,7 +8598,8 @@ class JUnitReporter {
|
|
|
8572
8598
|
if (task.mode === "skip" || task.mode === "todo")
|
|
8573
8599
|
await this.logger.log("<skipped/>");
|
|
8574
8600
|
if (((_a = task.result) == null ? void 0 : _a.state) === "fail") {
|
|
8575
|
-
const
|
|
8601
|
+
const errors = ((_b = task.result.errors) == null ? void 0 : _b.length) ? task.result.errors : [task.result.error];
|
|
8602
|
+
for (const error of errors) {
|
|
8576
8603
|
await this.writeElement("failure", {
|
|
8577
8604
|
message: error == null ? void 0 : error.message,
|
|
8578
8605
|
type: (error == null ? void 0 : error.name) ?? (error == null ? void 0 : error.nameStr)
|
|
@@ -8581,8 +8608,7 @@ class JUnitReporter {
|
|
|
8581
8608
|
return;
|
|
8582
8609
|
await this.writeErrorDetails(error);
|
|
8583
8610
|
});
|
|
8584
|
-
}
|
|
8585
|
-
await Promise.all(promises);
|
|
8611
|
+
}
|
|
8586
8612
|
}
|
|
8587
8613
|
});
|
|
8588
8614
|
}
|
|
@@ -8666,6 +8692,17 @@ class TapFlatReporter extends TapReporter {
|
|
|
8666
8692
|
}
|
|
8667
8693
|
}
|
|
8668
8694
|
|
|
8695
|
+
class HangingProcessReporter {
|
|
8696
|
+
onInit() {
|
|
8697
|
+
const _require = createRequire(import.meta.url);
|
|
8698
|
+
this.whyRunning = _require("why-is-node-running");
|
|
8699
|
+
}
|
|
8700
|
+
onProcessTimeout() {
|
|
8701
|
+
var _a;
|
|
8702
|
+
(_a = this.whyRunning) == null ? void 0 : _a.call(this);
|
|
8703
|
+
}
|
|
8704
|
+
}
|
|
8705
|
+
|
|
8669
8706
|
class JsonReporter {
|
|
8670
8707
|
constructor() {
|
|
8671
8708
|
this.start = 0;
|
|
@@ -8942,7 +8979,8 @@ const ReportersMap = {
|
|
|
8942
8979
|
"json": JsonReporter$1,
|
|
8943
8980
|
"tap": TapReporter,
|
|
8944
8981
|
"tap-flat": TapFlatReporter,
|
|
8945
|
-
"junit": JUnitReporter
|
|
8982
|
+
"junit": JUnitReporter,
|
|
8983
|
+
"hanging-process": HangingProcessReporter
|
|
8946
8984
|
};
|
|
8947
8985
|
|
|
8948
8986
|
async function loadCustomReporterModule(path, runner) {
|
|
@@ -9151,7 +9189,7 @@ const config = {
|
|
|
9151
9189
|
exclude: defaultExclude,
|
|
9152
9190
|
testTimeout: 5e3,
|
|
9153
9191
|
hookTimeout: 1e4,
|
|
9154
|
-
teardownTimeout:
|
|
9192
|
+
teardownTimeout: 1e4,
|
|
9155
9193
|
isolate: true,
|
|
9156
9194
|
watchExclude: ["**/node_modules/**", "**/dist/**"],
|
|
9157
9195
|
forceRerunTriggers: [
|
|
@@ -9456,6 +9494,10 @@ function resolveConfig(mode, options, viteConfig) {
|
|
|
9456
9494
|
resolveModule(file, { paths: [resolved.root] }) ?? resolve(resolved.root, file)
|
|
9457
9495
|
)
|
|
9458
9496
|
);
|
|
9497
|
+
resolved.forceRerunTriggers = [
|
|
9498
|
+
...resolved.forceRerunTriggers,
|
|
9499
|
+
...resolved.setupFiles
|
|
9500
|
+
];
|
|
9459
9501
|
resolved.api = resolveApiConfig(options);
|
|
9460
9502
|
if (options.related)
|
|
9461
9503
|
resolved.related = toArray(options.related).map((file) => resolve(resolved.root, file));
|
|
@@ -9977,7 +10019,7 @@ createLogUpdate(process$1.stdout);
|
|
|
9977
10019
|
|
|
9978
10020
|
createLogUpdate(process$1.stderr);
|
|
9979
10021
|
|
|
9980
|
-
var version = "0.27.
|
|
10022
|
+
var version = "0.27.2";
|
|
9981
10023
|
|
|
9982
10024
|
function formatLine(line, outputTruncateLength) {
|
|
9983
10025
|
var _a;
|
|
@@ -10106,6 +10148,15 @@ async function printError(error, ctx, options = {}) {
|
|
|
10106
10148
|
}
|
|
10107
10149
|
});
|
|
10108
10150
|
}
|
|
10151
|
+
const testPath = e.VITEST_TEST_PATH;
|
|
10152
|
+
const testName = e.VITEST_TEST_NAME;
|
|
10153
|
+
if (testPath)
|
|
10154
|
+
ctx.logger.error(c.red(`This error originated in "${c.bold(testPath)}" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.`));
|
|
10155
|
+
if (testName) {
|
|
10156
|
+
ctx.logger.error(c.red(`The latest test that might've caused the error is "${c.bold(testName)}". It might mean one of the following:
|
|
10157
|
+
- The error was thrown, while Vitest was running this test.
|
|
10158
|
+
- This was the last recorder test before the error was thrown, if error originated after test finished its execution.`));
|
|
10159
|
+
}
|
|
10109
10160
|
if (typeof e.cause === "object" && e.cause && "name" in e.cause) {
|
|
10110
10161
|
e.cause.name = `Caused by: ${e.cause.name}`;
|
|
10111
10162
|
await printError(e.cause, ctx, { fullStack, showCodeFrame: false });
|
|
@@ -10133,6 +10184,8 @@ const skipErrorProperties = /* @__PURE__ */ new Set([
|
|
|
10133
10184
|
"showDiff",
|
|
10134
10185
|
"actual",
|
|
10135
10186
|
"expected",
|
|
10187
|
+
"VITEST_TEST_NAME",
|
|
10188
|
+
"VITEST_TEST_PATH",
|
|
10136
10189
|
...Object.getOwnPropertyNames(Error.prototype),
|
|
10137
10190
|
...Object.getOwnPropertyNames(Object.prototype)
|
|
10138
10191
|
]);
|
|
@@ -10198,8 +10251,6 @@ function printStack(ctx, stack, highlight, errorProperties, onStack) {
|
|
|
10198
10251
|
const path = relative(ctx.config.root, frame.file);
|
|
10199
10252
|
logger.error(color(` ${c.dim(F_POINTER)} ${[frame.method, c.dim(`${path}:${frame.line}:${frame.column}`)].filter(Boolean).join(" ")}`));
|
|
10200
10253
|
onStack == null ? void 0 : onStack(frame);
|
|
10201
|
-
if (frame.file in ctx.state.filesMap)
|
|
10202
|
-
break;
|
|
10203
10254
|
}
|
|
10204
10255
|
logger.error();
|
|
10205
10256
|
const hasProperties = Object.keys(errorProperties).length > 0;
|
|
@@ -10536,10 +10587,7 @@ class Vitest {
|
|
|
10536
10587
|
}
|
|
10537
10588
|
await Promise.all(files.map((file) => this.cache.stats.updateStats(file)));
|
|
10538
10589
|
await this.runFiles(files);
|
|
10539
|
-
|
|
10540
|
-
this.logger.log(c.blue(" % ") + c.dim("Coverage report from ") + c.yellow(this.coverageProvider.name));
|
|
10541
|
-
await this.coverageProvider.reportCoverage();
|
|
10542
|
-
}
|
|
10590
|
+
await this.reportCoverage(true);
|
|
10543
10591
|
if (this.config.watch && !this.config.browser)
|
|
10544
10592
|
await this.report("onWatcherStart");
|
|
10545
10593
|
}
|
|
@@ -10564,7 +10612,7 @@ class Vitest {
|
|
|
10564
10612
|
}
|
|
10565
10613
|
async filterTestsBySource(tests) {
|
|
10566
10614
|
if (this.config.changed && !this.config.related) {
|
|
10567
|
-
const { VitestGit } = await import('./chunk-node-git.
|
|
10615
|
+
const { VitestGit } = await import('./chunk-node-git.125c9008.js');
|
|
10568
10616
|
const vitestGit = new VitestGit(this.config.root);
|
|
10569
10617
|
const related2 = await vitestGit.findChangedFiles({
|
|
10570
10618
|
changedSince: this.config.changed
|
|
@@ -10626,8 +10674,11 @@ class Vitest {
|
|
|
10626
10674
|
return await this.runningPromise;
|
|
10627
10675
|
}
|
|
10628
10676
|
async rerunFiles(files = this.state.getFilepaths(), trigger) {
|
|
10677
|
+
if (this.coverageProvider && this.config.coverage.cleanOnRerun)
|
|
10678
|
+
await this.coverageProvider.clean();
|
|
10629
10679
|
await this.report("onWatcherRerun", files, trigger);
|
|
10630
10680
|
await this.runFiles(files);
|
|
10681
|
+
await this.reportCoverage(!trigger);
|
|
10631
10682
|
if (!this.config.browser)
|
|
10632
10683
|
await this.report("onWatcherStart");
|
|
10633
10684
|
}
|
|
@@ -10662,9 +10713,6 @@ class Vitest {
|
|
|
10662
10713
|
}
|
|
10663
10714
|
}
|
|
10664
10715
|
async scheduleRerun(triggerId) {
|
|
10665
|
-
const mod = this.server.moduleGraph.getModuleById(triggerId);
|
|
10666
|
-
if (mod)
|
|
10667
|
-
mod.lastHMRTimestamp = Date.now();
|
|
10668
10716
|
const currentCount = this.restartsCount;
|
|
10669
10717
|
safeClearTimeout(this._rerunTimer);
|
|
10670
10718
|
await this.runningPromise;
|
|
@@ -10672,7 +10720,6 @@ class Vitest {
|
|
|
10672
10720
|
if (this.restartsCount !== currentCount)
|
|
10673
10721
|
return;
|
|
10674
10722
|
this._rerunTimer = safeSetTimeout(async () => {
|
|
10675
|
-
var _a;
|
|
10676
10723
|
if (this.changedTests.size === 0) {
|
|
10677
10724
|
this.invalidates.clear();
|
|
10678
10725
|
return;
|
|
@@ -10687,14 +10734,20 @@ class Vitest {
|
|
|
10687
10734
|
await this.coverageProvider.clean();
|
|
10688
10735
|
await this.report("onWatcherRerun", files, triggerId);
|
|
10689
10736
|
await this.runFiles(files);
|
|
10690
|
-
await
|
|
10737
|
+
await this.reportCoverage(false);
|
|
10691
10738
|
if (!this.config.browser)
|
|
10692
10739
|
await this.report("onWatcherStart");
|
|
10693
10740
|
}, WATCHER_DEBOUNCE);
|
|
10694
10741
|
}
|
|
10695
10742
|
registerWatcher() {
|
|
10743
|
+
const updateLastChanged = (id) => {
|
|
10744
|
+
const mod = this.server.moduleGraph.getModuleById(id);
|
|
10745
|
+
if (mod)
|
|
10746
|
+
mod.lastHMRTimestamp = Date.now();
|
|
10747
|
+
};
|
|
10696
10748
|
const onChange = (id) => {
|
|
10697
10749
|
id = slash$1(id);
|
|
10750
|
+
updateLastChanged(id);
|
|
10698
10751
|
const needsRerun = this.handleFileChanged(id);
|
|
10699
10752
|
if (needsRerun)
|
|
10700
10753
|
this.scheduleRerun(id);
|
|
@@ -10712,6 +10765,7 @@ class Vitest {
|
|
|
10712
10765
|
};
|
|
10713
10766
|
const onAdd = async (id) => {
|
|
10714
10767
|
id = slash$1(id);
|
|
10768
|
+
updateLastChanged(id);
|
|
10715
10769
|
if (await this.isTargetFile(id)) {
|
|
10716
10770
|
this.changedTests.add(id);
|
|
10717
10771
|
await this.cache.stats.updateStats(id);
|
|
@@ -10757,6 +10811,12 @@ class Vitest {
|
|
|
10757
10811
|
});
|
|
10758
10812
|
return rerun;
|
|
10759
10813
|
}
|
|
10814
|
+
async reportCoverage(allTestsRun) {
|
|
10815
|
+
if (this.coverageProvider) {
|
|
10816
|
+
this.logger.log(c.blue(" % ") + c.dim("Coverage report from ") + c.yellow(this.coverageProvider.name));
|
|
10817
|
+
await this.coverageProvider.reportCoverage({ allTestsRun });
|
|
10818
|
+
}
|
|
10819
|
+
}
|
|
10760
10820
|
async close() {
|
|
10761
10821
|
var _a, _b;
|
|
10762
10822
|
if (!this.closingPromise) {
|
|
@@ -10774,8 +10834,10 @@ class Vitest {
|
|
|
10774
10834
|
}
|
|
10775
10835
|
async exit(force = false) {
|
|
10776
10836
|
safeSetTimeout(() => {
|
|
10777
|
-
|
|
10778
|
-
|
|
10837
|
+
this.report("onProcessTimeout").then(() => {
|
|
10838
|
+
console.warn(`close timed out after ${this.config.teardownTimeout}ms`);
|
|
10839
|
+
process.exit();
|
|
10840
|
+
});
|
|
10779
10841
|
}, this.config.teardownTimeout).unref();
|
|
10780
10842
|
await this.close();
|
|
10781
10843
|
if (force)
|
|
@@ -11154,7 +11216,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
11154
11216
|
this.meta.watchMode = false;
|
|
11155
11217
|
},
|
|
11156
11218
|
config(viteConfig) {
|
|
11157
|
-
var _a, _b, _c;
|
|
11219
|
+
var _a, _b, _c, _d;
|
|
11158
11220
|
const preOptions = deepMerge(
|
|
11159
11221
|
{},
|
|
11160
11222
|
configDefaults,
|
|
@@ -11195,6 +11257,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
11195
11257
|
else if (preOptions.browser)
|
|
11196
11258
|
open = "/";
|
|
11197
11259
|
const config = {
|
|
11260
|
+
root: ((_a = viteConfig.test) == null ? void 0 : _a.root) || options.root,
|
|
11198
11261
|
esbuild: {
|
|
11199
11262
|
sourcemap: "external",
|
|
11200
11263
|
legalComments: "inline"
|
|
@@ -11215,10 +11278,10 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
11215
11278
|
preTransformRequests: false
|
|
11216
11279
|
}
|
|
11217
11280
|
};
|
|
11218
|
-
const classNameStrategy = preOptions.css && ((
|
|
11281
|
+
const classNameStrategy = preOptions.css && ((_c = (_b = preOptions.css) == null ? void 0 : _b.modules) == null ? void 0 : _c.classNameStrategy);
|
|
11219
11282
|
if (classNameStrategy !== "scoped") {
|
|
11220
11283
|
config.css ?? (config.css = {});
|
|
11221
|
-
(
|
|
11284
|
+
(_d = config.css).modules ?? (_d.modules = {});
|
|
11222
11285
|
config.css.modules.generateScopedName = (name, filename) => {
|
|
11223
11286
|
const root = getRoot();
|
|
11224
11287
|
return generateScopedClassName(classNameStrategy, name, relative(root, filename));
|
|
@@ -11255,12 +11318,19 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
11255
11318
|
(_c = process.env).SSR ?? (_c.SSR = "1");
|
|
11256
11319
|
for (const name in envs)
|
|
11257
11320
|
(_d = process.env)[name] ?? (_d[name] = envs[name]);
|
|
11321
|
+
if (!options.watch) {
|
|
11322
|
+
viteConfig.server.watch = {
|
|
11323
|
+
persistent: false,
|
|
11324
|
+
depth: 0,
|
|
11325
|
+
ignored: ["**/*"]
|
|
11326
|
+
};
|
|
11327
|
+
}
|
|
11258
11328
|
},
|
|
11259
11329
|
async configureServer(server) {
|
|
11260
11330
|
try {
|
|
11261
11331
|
await ctx.setServer(options, server);
|
|
11262
11332
|
if (options.api && options.watch)
|
|
11263
|
-
(await import('./chunk-api-setup.
|
|
11333
|
+
(await import('./chunk-api-setup.029198e3.js')).setup(ctx);
|
|
11264
11334
|
} catch (err) {
|
|
11265
11335
|
ctx.logger.printError(err, true);
|
|
11266
11336
|
process.exit(1);
|
|
@@ -11356,7 +11426,7 @@ function registerConsoleShortcuts(ctx) {
|
|
|
11356
11426
|
message: "Input test name pattern (RegExp)",
|
|
11357
11427
|
initial: ((_a = ctx.config.testNamePattern) == null ? void 0 : _a.source) || ""
|
|
11358
11428
|
}]);
|
|
11359
|
-
await ctx.changeNamePattern(filter, void 0, "change pattern");
|
|
11429
|
+
await ctx.changeNamePattern(filter.trim(), void 0, "change pattern");
|
|
11360
11430
|
on();
|
|
11361
11431
|
}
|
|
11362
11432
|
async function inputFilePattern() {
|
|
@@ -11367,8 +11437,8 @@ function registerConsoleShortcuts(ctx) {
|
|
|
11367
11437
|
message: "Input filename pattern",
|
|
11368
11438
|
initial: latestFilename
|
|
11369
11439
|
}]);
|
|
11370
|
-
latestFilename = filter;
|
|
11371
|
-
await ctx.changeFilenamePattern(filter);
|
|
11440
|
+
latestFilename = filter.trim();
|
|
11441
|
+
await ctx.changeFilenamePattern(filter.trim());
|
|
11372
11442
|
on();
|
|
11373
11443
|
}
|
|
11374
11444
|
let rl;
|