vitest 0.25.8 → 0.26.1

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.
Files changed (45) hide show
  1. package/LICENSE.md +0 -142
  2. package/browser.d.ts +1 -0
  3. package/dist/browser.d.ts +8 -5
  4. package/dist/browser.js +17 -16
  5. package/dist/{chunk-api-setup.dc71e384.js → chunk-api-setup.adeab271.js} +45 -46
  6. package/dist/{chunk-env-node.67948209.js → chunk-env-node.b3664da2.js} +1 -1
  7. package/dist/{chunk-install-pkg.579a5a27.js → chunk-install-pkg.6dd2bae6.js} +19 -19
  8. package/dist/chunk-integrations-globals.96914902.js +27 -0
  9. package/dist/{chunk-node-git.5a1b1656.js → chunk-node-git.a90c0582.js} +10 -6
  10. package/dist/{chunk-runtime-chain.f86e5250.js → chunk-runtime-chain.4cd984be.js} +8 -8
  11. package/dist/{chunk-runtime-error.616e92ca.js → chunk-runtime-error.f5c8aaf2.js} +10 -8
  12. package/dist/{chunk-runtime-mocker.99b910d0.js → chunk-runtime-mocker.3fa602ba.js} +73 -65
  13. package/dist/{chunk-runtime-rpc.42aebbb9.js → chunk-runtime-rpc.54d72169.js} +2 -2
  14. package/dist/{chunk-runtime-setup.5398e2c4.js → chunk-runtime-setup.9cdedce6.js} +21 -34
  15. package/dist/{chunk-vite-node-externalize.b9495318.js → chunk-snapshot-manager.e54d78b8.js} +82 -358
  16. package/dist/{chunk-typecheck-constants.ed987901.js → chunk-typecheck-constants.06e1fe5b.js} +8 -7
  17. package/dist/{chunk-utils-env.03f840f2.js → chunk-utils-env.3fdc1793.js} +8 -8
  18. package/dist/{chunk-runtime-test-state.3f86f48f.js → chunk-utils-import.afe2ffde.js} +50 -19
  19. package/dist/{chunk-utils-source-map.29ff1088.js → chunk-utils-source-map.59ba6b0a.js} +6 -4
  20. package/dist/{chunk-utils-timers.793fd179.js → chunk-utils-timers.715da787.js} +31 -15
  21. package/dist/cli-wrapper.js +10 -5
  22. package/dist/cli.js +30 -25
  23. package/dist/config.d.ts +6 -3
  24. package/dist/entry.js +18 -16
  25. package/dist/environments.d.ts +6 -3
  26. package/dist/environments.js +2 -2
  27. package/dist/{index-5aad25c1.d.ts → index-1e9f7f83.d.ts} +1 -1
  28. package/dist/index.d.ts +30 -12
  29. package/dist/index.js +12 -10
  30. package/dist/loader.js +12 -7
  31. package/dist/node.d.ts +21 -20
  32. package/dist/node.js +33 -25
  33. package/dist/suite.js +10 -8
  34. package/dist/{types-71ccd11d.d.ts → types-c41bae41.d.ts} +39 -279
  35. package/dist/vendor-index.2e96c50b.js +215 -0
  36. package/dist/vendor-index.783e7f3e.js +71 -0
  37. package/dist/{vendor-index.e1d4cf84.js → vendor-index.7a2cebfe.js} +16 -16
  38. package/dist/{vendor-index.737c3cff.js → vendor-index.b2fdde54.js} +9 -8
  39. package/dist/worker.js +21 -18
  40. package/environments.d.ts +1 -0
  41. package/package.json +4 -4
  42. package/dist/chunk-integrations-globals.4d261bb8.js +0 -25
  43. package/dist/chunk-vite-node-source-map.b4ea5792.js +0 -446
  44. package/dist/chunk-vite-node-utils.0e4a6a88.js +0 -1385
  45. package/dist/vendor-source-map-support.1ce17397.js +0 -707
@@ -1,41 +1,46 @@
1
- import { b as resolve, p as picocolors, j as join, c as basename, d as dirname, r as relative, e as distDir, f as rootDir, g as isAbsolute, i as isNode, h as configFiles, k as defaultPort, n as normalize, t as toNamespacedPath, E as EXIT_CODE_RESTART } from './chunk-utils-env.03f840f2.js';
1
+ import { j as join, c as basename, d as dirname, r as relative, b as resolve, e as distDir, f as rootDir, p as picocolors, g as isAbsolute, i as isNode, h as configFiles, k as defaultPort, n as normalize, t as toNamespacedPath, E as EXIT_CODE_RESTART } from './chunk-utils-env.3fdc1793.js';
2
2
  import { p as pLimit, s as someTasksAreOnly, i as interpretTaskModes, g as getCoverageProvider, C as CoverageProviderMap } from './chunk-integrations-coverage.befed097.js';
3
- import { g as getEnvPackageName } from './chunk-env-node.67948209.js';
4
- import { T as TYPECHECK_SUITE, y as ensurePackageInstalled, A as AggregateErrorPonyfill, s as slash$2, k as relativePath, z as getTests, e as getFullName, u as hasFailed, B as hasFailedSnapshot, C as getTypecheckTests, D as getSuites, E as isTypecheckTest, j as notNullish, l as shuffle, t as toArray$1, n as noop$1, F as deepMerge, b as getCallLastIndex, G as removeUndefinedValues, H as isWindows, I as stdout } from './chunk-typecheck-constants.ed987901.js';
3
+ import { g as getEnvPackageName } from './chunk-env-node.b3664da2.js';
4
+ import { T as TYPECHECK_SUITE, z as ensurePackageInstalled, A as AggregateErrorPonyfill, s as slash$1, l as relativePath, B as getTests, f as getFullName, v as hasFailed, C as hasFailedSnapshot, D as getTypecheckTests, E as getSuites, F as isTypecheckTest, k as notNullish, q as shuffle, t as toArray, n as noop$1, G as deepMerge, b as getCallLastIndex, H as removeUndefinedValues, I as isWindows, J as stdout } from './chunk-typecheck-constants.06e1fe5b.js';
5
5
  import { loadConfigFromFile, normalizePath, createServer, mergeConfig } from 'vite';
6
- import path$a from 'path';
7
- import url, { fileURLToPath } from 'url';
8
- import process$1 from 'process';
9
- import fs$8, { promises, existsSync, readFileSync } from 'fs';
10
- import require$$0, { cpus, hostname } from 'os';
6
+ import path$a from 'node:path';
7
+ import url, { fileURLToPath } from 'node:url';
8
+ import process$1 from 'node:process';
9
+ import fs$8, { promises, existsSync } from 'node:fs';
10
+ import g from 'path';
11
+ import require$$0 from 'os';
11
12
  import util$2 from 'util';
12
13
  import require$$0$1 from 'stream';
13
14
  import require$$2 from 'events';
15
+ import require$$0$2, { existsSync as existsSync$1, readFileSync } from 'fs';
14
16
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
15
- import { w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-source-map.b4ea5792.js';
16
- import { performance } from 'perf_hooks';
17
- import createDebug from 'debug';
18
- import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toArray, n as normalizeModuleId, b as toFilePath } from './chunk-vite-node-utils.0e4a6a88.js';
19
- import { writeFile, rm } from 'fs/promises';
20
- import { e as execa } from './vendor-index.737c3cff.js';
17
+ import { ViteNodeRunner } from 'vite-node/client';
18
+ import { ViteNodeServer } from 'vite-node/server';
19
+ import { writeFile, rm } from 'node:fs/promises';
20
+ import { e as execa } from './vendor-index.b2fdde54.js';
21
21
  import { SourceMapConsumer } from 'source-map';
22
22
  import H from 'module';
23
23
  import { parse as parse$4 } from 'acorn';
24
24
  import { ancestor } from 'acorn-walk';
25
- import { MessageChannel } from 'worker_threads';
25
+ import { MessageChannel } from 'node:worker_threads';
26
+ import { cpus, hostname } from 'node:os';
26
27
  import { Tinypool } from 'tinypool';
27
- import { c as stripAnsi, d as safeSetInterval, e as safeClearInterval, g as cliTruncate, s as safeSetTimeout, h as stringWidth, i as ansiStyles, j as sliceAnsi, a as stringify$5, u as unifiedDiff, b as safeClearTimeout } from './chunk-utils-timers.793fd179.js';
28
- import { p as parseStacktrace, a as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.29ff1088.js';
28
+ import { c as createBirpc } from './vendor-index.783e7f3e.js';
29
+ import { performance } from 'perf_hooks';
30
+ import { c as stripAnsi, d as safeSetInterval, e as safeClearInterval, g as cliTruncate, s as safeSetTimeout, h as stringWidth, i as ansiStyles, j as sliceAnsi, a as stringify$5, u as unifiedDiff, b as safeClearTimeout } from './chunk-utils-timers.715da787.js';
31
+ import { p as parseStacktrace, a as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.59ba6b0a.js';
29
32
  import { resolveModule } from 'local-pkg';
30
33
  import { createHash } from 'crypto';
34
+ import { slash as slash$2 } from 'vite-node/utils';
31
35
  import { o as onetime } from './vendor-index.9c919048.js';
32
- import { s as signalExit } from './vendor-index.e1d4cf84.js';
36
+ import { s as signalExit } from './vendor-index.7a2cebfe.js';
37
+ import { createHash as createHash$1 } from 'node:crypto';
33
38
  import MagicString from './chunk-magic-string.3a794426.js';
34
39
  import { stripLiteral } from 'strip-literal';
35
- import require$$0$2 from 'readline';
40
+ import require$$0$3 from 'readline';
36
41
  import { p as prompts } from './vendor-index.9f20a9be.js';
37
42
 
38
- var version$1 = "0.25.8";
43
+ var version$1 = "0.26.1";
39
44
 
40
45
  class EndError extends Error {
41
46
  constructor(value) {
@@ -241,7 +246,7 @@ var path$9 = {};
241
246
 
242
247
  Object.defineProperty(path$9, "__esModule", { value: true });
243
248
  path$9.removeLeadingDotSegment = path$9.escape = path$9.makeAbsolute = path$9.unixify = void 0;
244
- const path$8 = path$a;
249
+ const path$8 = g;
245
250
  const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
246
251
  const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
247
252
  /**
@@ -447,7 +452,7 @@ var isGlob$1 = function isGlob(str, options) {
447
452
  };
448
453
 
449
454
  var isGlob = isGlob$1;
450
- var pathPosixDirname = path$a.posix.dirname;
455
+ var pathPosixDirname = g.posix.dirname;
451
456
  var isWin32 = require$$0.platform() === 'win32';
452
457
 
453
458
  var slash = '/';
@@ -1911,7 +1916,7 @@ var picomatch$2 = {exports: {}};
1911
1916
 
1912
1917
  var utils$f = {};
1913
1918
 
1914
- const path$7 = path$a;
1919
+ const path$7 = g;
1915
1920
  const WIN_SLASH = '\\\\/';
1916
1921
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1917
1922
 
@@ -2091,7 +2096,7 @@ var constants$3 = {
2091
2096
 
2092
2097
  (function (exports) {
2093
2098
 
2094
- const path = path$a;
2099
+ const path = g;
2095
2100
  const win32 = process.platform === 'win32';
2096
2101
  const {
2097
2102
  REGEX_BACKSLASH,
@@ -3635,7 +3640,7 @@ parse$1.fastpaths = (input, options) => {
3635
3640
 
3636
3641
  var parse_1 = parse$1;
3637
3642
 
3638
- const path$6 = path$a;
3643
+ const path$6 = g;
3639
3644
  const scan = scan_1;
3640
3645
  const parse = parse_1;
3641
3646
  const utils$c = utils$f;
@@ -4449,7 +4454,7 @@ var micromatch_1 = micromatch$1;
4449
4454
 
4450
4455
  Object.defineProperty(pattern$1, "__esModule", { value: true });
4451
4456
  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;
4452
- const path$5 = path$a;
4457
+ const path$5 = g;
4453
4458
  const globParent = globParent$1;
4454
4459
  const micromatch = micromatch_1;
4455
4460
  const GLOBSTAR = '**';
@@ -4998,7 +5003,7 @@ var fs$5 = {};
4998
5003
  (function (exports) {
4999
5004
  Object.defineProperty(exports, "__esModule", { value: true });
5000
5005
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
5001
- const fs = fs$8;
5006
+ const fs = require$$0$2;
5002
5007
  exports.FILE_SYSTEM_ADAPTER = {
5003
5008
  lstat: fs.lstat,
5004
5009
  stat: fs.stat,
@@ -5349,7 +5354,7 @@ var fs$1 = {};
5349
5354
  (function (exports) {
5350
5355
  Object.defineProperty(exports, "__esModule", { value: true });
5351
5356
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
5352
- const fs = fs$8;
5357
+ const fs = require$$0$2;
5353
5358
  exports.FILE_SYSTEM_ADAPTER = {
5354
5359
  lstat: fs.lstat,
5355
5360
  stat: fs.stat,
@@ -5368,7 +5373,7 @@ var fs$1 = {};
5368
5373
  } (fs$1));
5369
5374
 
5370
5375
  Object.defineProperty(settings$2, "__esModule", { value: true });
5371
- const path$3 = path$a;
5376
+ const path$3 = g;
5372
5377
  const fsStat$3 = out$1;
5373
5378
  const fs = fs$1;
5374
5379
  class Settings$1 {
@@ -6022,7 +6027,7 @@ sync$3.default = SyncProvider;
6022
6027
  var settings$1 = {};
6023
6028
 
6024
6029
  Object.defineProperty(settings$1, "__esModule", { value: true });
6025
- const path$2 = path$a;
6030
+ const path$2 = g;
6026
6031
  const fsScandir = out$2;
6027
6032
  class Settings {
6028
6033
  constructor(_options = {}) {
@@ -6084,7 +6089,7 @@ function getSettings(settingsOrOptions = {}) {
6084
6089
  var reader = {};
6085
6090
 
6086
6091
  Object.defineProperty(reader, "__esModule", { value: true });
6087
- const path$1 = path$a;
6092
+ const path$1 = g;
6088
6093
  const fsStat$2 = out$1;
6089
6094
  const utils$6 = utils$k;
6090
6095
  class Reader {
@@ -6478,7 +6483,7 @@ class EntryTransformer {
6478
6483
  entry.default = EntryTransformer;
6479
6484
 
6480
6485
  Object.defineProperty(provider, "__esModule", { value: true });
6481
- const path = path$a;
6486
+ const path = g;
6482
6487
  const deep_1 = deep;
6483
6488
  const entry_1 = entry$1;
6484
6489
  const error_1 = error;
@@ -6656,7 +6661,7 @@ var settings = {};
6656
6661
  (function (exports) {
6657
6662
  Object.defineProperty(exports, "__esModule", { value: true });
6658
6663
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
6659
- const fs = fs$8;
6664
+ const fs = require$$0$2;
6660
6665
  const os = require$$0;
6661
6666
  /**
6662
6667
  * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
@@ -6780,297 +6785,6 @@ function assertPatternsInput(input) {
6780
6785
  }
6781
6786
  var out = FastGlob;
6782
6787
 
6783
- const ESM_EXT_RE = /\.(es|esm|esm-browser|esm-bundler|es6|module)\.js$/;
6784
- const ESM_FOLDER_RE = /\/(es|esm)\/(.*\.js)$/;
6785
- const defaultInline = [
6786
- /virtual:/,
6787
- /\.[mc]?ts$/
6788
- ];
6789
- const depsExternal = [
6790
- /\.cjs\.js$/,
6791
- /\.mjs$/
6792
- ];
6793
- function guessCJSversion(id) {
6794
- if (id.match(ESM_EXT_RE)) {
6795
- for (const i of [
6796
- id.replace(ESM_EXT_RE, ".mjs"),
6797
- id.replace(ESM_EXT_RE, ".umd.js"),
6798
- id.replace(ESM_EXT_RE, ".cjs.js"),
6799
- id.replace(ESM_EXT_RE, ".js")
6800
- ]) {
6801
- if (existsSync(i))
6802
- return i;
6803
- }
6804
- }
6805
- if (id.match(ESM_FOLDER_RE)) {
6806
- for (const i of [
6807
- id.replace(ESM_FOLDER_RE, "/umd/$1"),
6808
- id.replace(ESM_FOLDER_RE, "/cjs/$1"),
6809
- id.replace(ESM_FOLDER_RE, "/lib/$1"),
6810
- id.replace(ESM_FOLDER_RE, "/$1")
6811
- ]) {
6812
- if (existsSync(i))
6813
- return i;
6814
- }
6815
- }
6816
- }
6817
- const _defaultExternalizeCache = /* @__PURE__ */ new Map();
6818
- async function shouldExternalize(id, options, cache = _defaultExternalizeCache) {
6819
- if (!cache.has(id))
6820
- cache.set(id, _shouldExternalize(id, options));
6821
- return cache.get(id);
6822
- }
6823
- async function _shouldExternalize(id, options) {
6824
- if (isNodeBuiltin(id))
6825
- return id;
6826
- if (id.startsWith("data:"))
6827
- return id;
6828
- id = patchWindowsImportPath(id);
6829
- if (matchExternalizePattern(id, options == null ? void 0 : options.inline))
6830
- return false;
6831
- if (matchExternalizePattern(id, options == null ? void 0 : options.external))
6832
- return id;
6833
- const isNodeModule = id.includes("/node_modules/");
6834
- const guessCJS = isNodeModule && (options == null ? void 0 : options.fallbackCJS);
6835
- id = guessCJS ? guessCJSversion(id) || id : id;
6836
- if (matchExternalizePattern(id, defaultInline))
6837
- return false;
6838
- if (matchExternalizePattern(id, depsExternal))
6839
- return id;
6840
- const isDist = id.includes("/dist/");
6841
- if ((isNodeModule || isDist) && await isValidNodeImport(id))
6842
- return id;
6843
- return false;
6844
- }
6845
- function matchExternalizePattern(id, patterns) {
6846
- if (patterns == null)
6847
- return false;
6848
- if (patterns === true)
6849
- return true;
6850
- for (const ex of patterns) {
6851
- if (typeof ex === "string") {
6852
- if (id.includes(`/node_modules/${ex}/`))
6853
- return true;
6854
- } else {
6855
- if (ex.test(id))
6856
- return true;
6857
- }
6858
- }
6859
- return false;
6860
- }
6861
- function patchWindowsImportPath(path) {
6862
- if (path.match(/^\w:\\/))
6863
- return `file:///${slash$1(path)}`;
6864
- else if (path.match(/^\w:\//))
6865
- return `file:///${path}`;
6866
- else
6867
- return path;
6868
- }
6869
-
6870
- function hashCode(s) {
6871
- return s.split("").reduce((a, b) => {
6872
- a = (a << 5) - a + b.charCodeAt(0);
6873
- return a & a;
6874
- }, 0);
6875
- }
6876
- class Debugger {
6877
- constructor(root, options) {
6878
- this.options = options;
6879
- this.externalizeMap = /* @__PURE__ */ new Map();
6880
- if (options.dumpModules)
6881
- this.dumpDir = resolve(root, options.dumpModules === true ? ".vite-node/dump" : options.dumpModules);
6882
- if (this.dumpDir) {
6883
- if (options.loadDumppedModules)
6884
- console.info(picocolors.exports.gray(`[vite-node] [debug] load modules from ${this.dumpDir}`));
6885
- else
6886
- console.info(picocolors.exports.gray(`[vite-node] [debug] dump modules to ${this.dumpDir}`));
6887
- }
6888
- this.initPromise = this.clearDump();
6889
- }
6890
- async clearDump() {
6891
- if (!this.dumpDir)
6892
- return;
6893
- if (!this.options.loadDumppedModules && existsSync(this.dumpDir))
6894
- await promises.rm(this.dumpDir, { recursive: true, force: true });
6895
- await promises.mkdir(this.dumpDir, { recursive: true });
6896
- }
6897
- encodeId(id) {
6898
- return `${id.replace(/[^\w@_-]/g, "_").replace(/_+/g, "_")}-${hashCode(id)}.js`;
6899
- }
6900
- async recordExternalize(id, path) {
6901
- if (!this.dumpDir)
6902
- return;
6903
- this.externalizeMap.set(id, path);
6904
- await this.writeInfo();
6905
- }
6906
- async dumpFile(id, result) {
6907
- if (!result || !this.dumpDir)
6908
- return;
6909
- await this.initPromise;
6910
- const name = this.encodeId(id);
6911
- return await promises.writeFile(join(this.dumpDir, name), `// ${id.replace(/\0/g, "\\0")}
6912
- ${result.code}`, "utf-8");
6913
- }
6914
- async loadDump(id) {
6915
- if (!this.dumpDir)
6916
- return null;
6917
- await this.initPromise;
6918
- const name = this.encodeId(id);
6919
- const path = join(this.dumpDir, name);
6920
- if (!existsSync(path))
6921
- return null;
6922
- const code = await promises.readFile(path, "utf-8");
6923
- return {
6924
- code: code.replace(/^\/\/.*?\n/, ""),
6925
- map: void 0
6926
- };
6927
- }
6928
- async writeInfo() {
6929
- if (!this.dumpDir)
6930
- return;
6931
- const info = JSON.stringify({
6932
- time: new Date().toLocaleString(),
6933
- externalize: Object.fromEntries(this.externalizeMap.entries())
6934
- }, null, 2);
6935
- return promises.writeFile(join(this.dumpDir, "info.json"), info, "utf-8");
6936
- }
6937
- }
6938
-
6939
- const debugRequest = createDebug("vite-node:server:request");
6940
- class ViteNodeServer {
6941
- constructor(server, options = {}) {
6942
- this.server = server;
6943
- this.options = options;
6944
- this.fetchPromiseMap = /* @__PURE__ */ new Map();
6945
- this.transformPromiseMap = /* @__PURE__ */ new Map();
6946
- this.fetchCache = /* @__PURE__ */ new Map();
6947
- this.externalizeCache = /* @__PURE__ */ new Map();
6948
- var _a, _b;
6949
- const ssrOptions = server.config.ssr;
6950
- if (ssrOptions) {
6951
- options.deps ?? (options.deps = {});
6952
- if (ssrOptions.noExternal === true) {
6953
- (_a = options.deps).inline ?? (_a.inline = true);
6954
- } else if (options.deps.inline !== true) {
6955
- (_b = options.deps).inline ?? (_b.inline = []);
6956
- options.deps.inline.push(...toArray(ssrOptions.noExternal));
6957
- }
6958
- }
6959
- if (process.env.VITE_NODE_DEBUG_DUMP) {
6960
- options.debug = Object.assign({
6961
- dumpModules: !!process.env.VITE_NODE_DEBUG_DUMP,
6962
- loadDumppedModules: process.env.VITE_NODE_DEBUG_DUMP === "load"
6963
- }, options.debug ?? {});
6964
- }
6965
- if (options.debug)
6966
- this.debugger = new Debugger(server.config.root, options.debug);
6967
- }
6968
- shouldExternalize(id) {
6969
- return shouldExternalize(id, this.options.deps, this.externalizeCache);
6970
- }
6971
- async resolveId(id, importer) {
6972
- if (importer && !importer.startsWith(this.server.config.root))
6973
- importer = resolve(this.server.config.root, importer);
6974
- const mode = importer && this.getTransformMode(importer) || "ssr";
6975
- return this.server.pluginContainer.resolveId(id, importer, { ssr: mode === "ssr" });
6976
- }
6977
- getSourceMap(source) {
6978
- var _a, _b;
6979
- const fetchResult = (_a = this.fetchCache.get(source)) == null ? void 0 : _a.result;
6980
- if (fetchResult == null ? void 0 : fetchResult.map)
6981
- return fetchResult.map;
6982
- const ssrTransformResult = (_b = this.server.moduleGraph.getModuleById(source)) == null ? void 0 : _b.ssrTransformResult;
6983
- return (ssrTransformResult == null ? void 0 : ssrTransformResult.map) || null;
6984
- }
6985
- async fetchModule(id) {
6986
- id = normalizeModuleId(id);
6987
- if (!this.fetchPromiseMap.has(id)) {
6988
- this.fetchPromiseMap.set(
6989
- id,
6990
- this._fetchModule(id).then((r) => {
6991
- return this.options.sourcemap !== true ? { ...r, map: void 0 } : r;
6992
- }).finally(() => {
6993
- this.fetchPromiseMap.delete(id);
6994
- })
6995
- );
6996
- }
6997
- return this.fetchPromiseMap.get(id);
6998
- }
6999
- async transformRequest(id) {
7000
- if (!this.transformPromiseMap.has(id)) {
7001
- this.transformPromiseMap.set(
7002
- id,
7003
- this._transformRequest(id).finally(() => {
7004
- this.transformPromiseMap.delete(id);
7005
- })
7006
- );
7007
- }
7008
- return this.transformPromiseMap.get(id);
7009
- }
7010
- getTransformMode(id) {
7011
- var _a, _b, _c, _d;
7012
- const withoutQuery = id.split("?")[0];
7013
- if ((_b = (_a = this.options.transformMode) == null ? void 0 : _a.web) == null ? void 0 : _b.some((r) => withoutQuery.match(r)))
7014
- return "web";
7015
- if ((_d = (_c = this.options.transformMode) == null ? void 0 : _c.ssr) == null ? void 0 : _d.some((r) => withoutQuery.match(r)))
7016
- return "ssr";
7017
- if (withoutQuery.match(/\.([cm]?[jt]sx?|json)$/))
7018
- return "ssr";
7019
- return "web";
7020
- }
7021
- async _fetchModule(id) {
7022
- var _a;
7023
- let result;
7024
- const filePath = toFilePath(id, this.server.config.root);
7025
- const module = this.server.moduleGraph.getModuleById(id);
7026
- const timestamp = module ? module.lastHMRTimestamp : null;
7027
- const cache = this.fetchCache.get(filePath);
7028
- if (timestamp !== null && cache && cache.timestamp >= timestamp)
7029
- return cache.result;
7030
- const time = Date.now();
7031
- const externalize = await this.shouldExternalize(filePath);
7032
- let duration;
7033
- if (externalize) {
7034
- result = { externalize };
7035
- (_a = this.debugger) == null ? void 0 : _a.recordExternalize(id, externalize);
7036
- } else {
7037
- const start = performance.now();
7038
- const r = await this._transformRequest(id);
7039
- duration = performance.now() - start;
7040
- result = { code: r == null ? void 0 : r.code, map: r == null ? void 0 : r.map };
7041
- }
7042
- this.fetchCache.set(filePath, {
7043
- duration,
7044
- timestamp: time,
7045
- result
7046
- });
7047
- return result;
7048
- }
7049
- async _transformRequest(id) {
7050
- var _a, _b, _c, _d;
7051
- debugRequest(id);
7052
- let result = null;
7053
- if ((_a = this.options.debug) == null ? void 0 : _a.loadDumppedModules) {
7054
- result = await ((_b = this.debugger) == null ? void 0 : _b.loadDump(id)) ?? null;
7055
- if (result)
7056
- return result;
7057
- }
7058
- if (this.getTransformMode(id) === "web") {
7059
- result = await this.server.transformRequest(id);
7060
- if (result)
7061
- result = await this.server.ssrTransform(result.code, result.map, id);
7062
- } else {
7063
- result = await this.server.transformRequest(id, { ssr: true });
7064
- }
7065
- const sourcemap = this.options.sourcemap ?? "inline";
7066
- if (sourcemap === "inline" && result && !id.includes("node_modules"))
7067
- withInlineSourcemap(result);
7068
- if ((_c = this.options.debug) == null ? void 0 : _c.dumpModules)
7069
- await ((_d = this.debugger) == null ? void 0 : _d.dumpFile(id, result));
7070
- return result;
7071
- }
7072
- }
7073
-
7074
6788
  class SnapshotManager {
7075
6789
  constructor(options) {
7076
6790
  this.options = options;
@@ -7139,9 +6853,9 @@ function addSnapshotResult(summary, result) {
7139
6853
  summary.total += result.added + result.matched + result.unmatched + result.updated;
7140
6854
  }
7141
6855
 
7142
- function T(r){const t=/^\\\\\?\\/.test(r),n=/[^\u0000-\u0080]+/.test(r);return t||n?r:r.replace(/\\/g,"/")}function B(r,t){for(;;){const n=path$a.join(r,t);if(fs$8.existsSync(n))return T(n);const e=path$a.dirname(r);if(e===r)return;r=e;}}function G(r,t){t===void 0&&(t=!1);var n=r.length,e=0,i="",a=0,o=16,u=0,f=0,d=0,C=0,c=0;function y(s,m){for(var v=0,b=0;v<s||!m;){var h=r.charCodeAt(e);if(h>=48&&h<=57)b=b*16+h-48;else if(h>=65&&h<=70)b=b*16+h-65+10;else if(h>=97&&h<=102)b=b*16+h-97+10;else break;e++,v++;}return v<s&&(b=-1),b}function V(s){e=s,i="",a=0,o=16,c=0;}function $(){var s=e;if(r.charCodeAt(e)===48)e++;else for(e++;e<r.length&&j(r.charCodeAt(e));)e++;if(e<r.length&&r.charCodeAt(e)===46)if(e++,e<r.length&&j(r.charCodeAt(e)))for(e++;e<r.length&&j(r.charCodeAt(e));)e++;else return c=3,r.substring(s,e);var m=e;if(e<r.length&&(r.charCodeAt(e)===69||r.charCodeAt(e)===101))if(e++,(e<r.length&&r.charCodeAt(e)===43||r.charCodeAt(e)===45)&&e++,e<r.length&&j(r.charCodeAt(e))){for(e++;e<r.length&&j(r.charCodeAt(e));)e++;m=e;}else c=3;return r.substring(s,m)}function _(){for(var s="",m=e;;){if(e>=n){s+=r.substring(m,e),c=2;break}var v=r.charCodeAt(e);if(v===34){s+=r.substring(m,e),e++;break}if(v===92){if(s+=r.substring(m,e),e++,e>=n){c=2;break}var b=r.charCodeAt(e++);switch(b){case 34:s+='"';break;case 92:s+="\\";break;case 47:s+="/";break;case 98:s+="\b";break;case 102:s+="\f";break;case 110:s+=`
6856
+ function T(r){const t=/^\\\\\?\\/.test(r),n=/[^\u0000-\u0080]+/.test(r);return t||n?r:r.replace(/\\/g,"/")}function B(r,t){for(;;){const n=g.join(r,t);if(require$$0$2.existsSync(n))return T(n);const e=g.dirname(r);if(e===r)return;r=e;}}function G(r,t){t===void 0&&(t=!1);var n=r.length,e=0,i="",a=0,o=16,u=0,f=0,d=0,C=0,c=0;function y(s,m){for(var v=0,b=0;v<s||!m;){var h=r.charCodeAt(e);if(h>=48&&h<=57)b=b*16+h-48;else if(h>=65&&h<=70)b=b*16+h-65+10;else if(h>=97&&h<=102)b=b*16+h-97+10;else break;e++,v++;}return v<s&&(b=-1),b}function V(s){e=s,i="",a=0,o=16,c=0;}function $(){var s=e;if(r.charCodeAt(e)===48)e++;else for(e++;e<r.length&&j(r.charCodeAt(e));)e++;if(e<r.length&&r.charCodeAt(e)===46)if(e++,e<r.length&&j(r.charCodeAt(e)))for(e++;e<r.length&&j(r.charCodeAt(e));)e++;else return c=3,r.substring(s,e);var m=e;if(e<r.length&&(r.charCodeAt(e)===69||r.charCodeAt(e)===101))if(e++,(e<r.length&&r.charCodeAt(e)===43||r.charCodeAt(e)===45)&&e++,e<r.length&&j(r.charCodeAt(e))){for(e++;e<r.length&&j(r.charCodeAt(e));)e++;m=e;}else c=3;return r.substring(s,m)}function _(){for(var s="",m=e;;){if(e>=n){s+=r.substring(m,e),c=2;break}var v=r.charCodeAt(e);if(v===34){s+=r.substring(m,e),e++;break}if(v===92){if(s+=r.substring(m,e),e++,e>=n){c=2;break}var b=r.charCodeAt(e++);switch(b){case 34:s+='"';break;case 92:s+="\\";break;case 47:s+="/";break;case 98:s+="\b";break;case 102:s+="\f";break;case 110:s+=`
7143
6857
  `;break;case 114:s+="\r";break;case 116:s+=" ";break;case 117:var h=y(4,!0);h>=0?s+=String.fromCharCode(h):c=4;break;default:c=5;}m=e;continue}if(v>=0&&v<=31)if(P(v)){s+=r.substring(m,e),c=2;break}else c=6;e++;}return s}function S(){if(i="",c=0,a=e,f=u,C=d,e>=n)return a=n,o=17;var s=r.charCodeAt(e);if(U(s)){do e++,i+=String.fromCharCode(s),s=r.charCodeAt(e);while(U(s));return o=15}if(P(s))return e++,i+=String.fromCharCode(s),s===13&&r.charCodeAt(e)===10&&(e++,i+=`
7144
- `),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}=fs$8,Y=r=>{try{return JSON.parse(r)}catch{}},Z=()=>{const{findPnpApi:r}=H;return r&&r(process.cwd())};function I(r){const t=Y(fs$8.readFileSync(r,"utf8"));return path$a.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=path$a.resolve(t,n);if(E(a)&&fs$8.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(path$a.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(path$a.join(r,"tsconfig.json"),t)}}catch{}}let i=B(t,path$a.join("node_modules",n));if(i){if(fs$8.statSync(i).isDirectory()){const a=path$a.join(i,"package.json");if(E(a)?i=I(a):i=path$a.join(i,"tsconfig.json"),E(i))return i}else if(i.endsWith(".json"))return i}if(!n.endsWith(".json")&&(n+=".json",i=B(t,path$a.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=fs$8.realpathSync(r);}catch{throw new Error(`Cannot resolve tsconfig at path: ${r}`)}const e=path$a.dirname(n),i=fs$8.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=path$a.relative(e,path$a.join(path$a.dirname(o),d.baseUrl))||"./";}u.files&&(u.files=u.files.map(d=>path$a.relative(e,path$a.join(path$a.dirname(o),d)))),u.include&&(u.include=u.include.map(d=>path$a.relative(e,path$a.join(path$a.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(path$a.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}}
6858
+ `),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}}
7145
6859
 
7146
6860
  const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
7147
6861
  const newLineRegExp = /\r?\n/;
@@ -7187,7 +6901,7 @@ async function getTsconfigPath(root, config) {
7187
6901
  throw new Error("no tsconfig.json found");
7188
6902
  try {
7189
6903
  const tmpTsConfig = { ...tsconfig.config };
7190
- tmpTsConfig.compilerOptions ?? (tmpTsConfig.compilerOptions = {});
6904
+ tmpTsConfig.compilerOptions = tmpTsConfig.compilerOptions || {};
7191
6905
  tmpTsConfig.compilerOptions.emitDeclarationOnly = false;
7192
6906
  tmpTsConfig.compilerOptions.incremental = true;
7193
6907
  tmpTsConfig.compilerOptions.tsBuildInfoFile = path$a.join(
@@ -7745,7 +7459,7 @@ function formatTestPath(root, path) {
7745
7459
  const dir = dirname(path);
7746
7460
  const ext = ((_a = path.match(/(\.(spec|test)\.[cm]?[tj]sx?)$/)) == null ? void 0 : _a[0]) || "";
7747
7461
  const base = basename(path, ext);
7748
- return slash$2(picocolors.exports.dim(`${dir}/`) + picocolors.exports.bold(base)) + picocolors.exports.dim(ext);
7462
+ return slash$1(picocolors.exports.dim(`${dir}/`) + picocolors.exports.bold(base)) + picocolors.exports.dim(ext);
7749
7463
  }
7750
7464
  function renderSnapshotSummary(rootDir, snapshots) {
7751
7465
  const summary = [];
@@ -9192,7 +8906,11 @@ async function loadCustomReporterModule(path, runner) {
9192
8906
  function createReporters(reporterReferences, runner) {
9193
8907
  const promisedReporters = reporterReferences.map(async (referenceOrInstance) => {
9194
8908
  if (typeof referenceOrInstance === "string") {
9195
- if (referenceOrInstance in ReportersMap) {
8909
+ if (referenceOrInstance === "html") {
8910
+ await ensurePackageInstalled("@vitest/ui", runner.root);
8911
+ const CustomReporter = await loadCustomReporterModule("@vitest/ui/reporter", runner);
8912
+ return new CustomReporter();
8913
+ } else if (referenceOrInstance in ReportersMap) {
9196
8914
  const BuiltinReporter = ReportersMap[referenceOrInstance];
9197
8915
  return new BuiltinReporter();
9198
8916
  } else {
@@ -9499,7 +9217,7 @@ class VitestCache {
9499
9217
  return this.stats.getStats(id);
9500
9218
  }
9501
9219
  static resolveCacheDir(root, dir) {
9502
- return resolve(root, slash$2(dir || "node_modules/.vitest"));
9220
+ return resolve(root, slash$1(dir || "node_modules/.vitest"));
9503
9221
  }
9504
9222
  static async clearCache(options) {
9505
9223
  var _a;
@@ -9530,7 +9248,7 @@ class BaseSequencer {
9530
9248
  const shardStart = shardSize * (index - 1);
9531
9249
  const shardEnd = shardSize * index;
9532
9250
  return [...files].map((file) => {
9533
- const fullPath = resolve(slash$1(config.root), slash$1(file));
9251
+ const fullPath = resolve(slash$2(config.root), slash$2(file));
9534
9252
  const specPath = fullPath == null ? void 0 : fullPath.slice(config.root.length);
9535
9253
  return {
9536
9254
  file,
@@ -9669,8 +9387,8 @@ function resolveConfig(mode, options, viteConfig) {
9669
9387
  resolved.exclude = resolved.benchmark.exclude;
9670
9388
  resolved.includeSource = resolved.benchmark.includeSource;
9671
9389
  const reporters = Array.from(/* @__PURE__ */ new Set([
9672
- ...toArray$1(resolved.benchmark.reporters),
9673
- ...toArray$1(options.reporter)
9390
+ ...toArray(resolved.benchmark.reporters),
9391
+ ...toArray(options.reporter)
9674
9392
  ])).filter(Boolean);
9675
9393
  if (reporters.length)
9676
9394
  resolved.benchmark.reporters = reporters;
@@ -9679,18 +9397,18 @@ function resolveConfig(mode, options, viteConfig) {
9679
9397
  if (options.outputFile)
9680
9398
  resolved.benchmark.outputFile = options.outputFile;
9681
9399
  }
9682
- resolved.setupFiles = toArray$1(resolved.setupFiles || []).map(
9400
+ resolved.setupFiles = toArray(resolved.setupFiles || []).map(
9683
9401
  (file) => normalize(
9684
9402
  resolveModule(file, { paths: [resolved.root] }) ?? resolve(resolved.root, file)
9685
9403
  )
9686
9404
  );
9687
9405
  resolved.api = resolveApiConfig(options);
9688
9406
  if (options.related)
9689
- resolved.related = toArray$1(options.related).map((file) => resolve(resolved.root, file));
9407
+ resolved.related = toArray(options.related).map((file) => resolve(resolved.root, file));
9690
9408
  if (mode !== "benchmark") {
9691
9409
  resolved.reporters = Array.from(/* @__PURE__ */ new Set([
9692
- ...toArray$1(resolved.reporters),
9693
- ...toArray$1(resolved.reporter)
9410
+ ...toArray(resolved.reporters),
9411
+ ...toArray(resolved.reporter)
9694
9412
  ])).filter(Boolean);
9695
9413
  }
9696
9414
  if (!resolved.reporters.length)
@@ -10207,7 +9925,7 @@ createLogUpdate(process$1.stdout);
10207
9925
 
10208
9926
  createLogUpdate(process$1.stderr);
10209
9927
 
10210
- var version = "0.25.8";
9928
+ var version = "0.26.1";
10211
9929
 
10212
9930
  function fileFromParsedStack(stack) {
10213
9931
  var _a, _b;
@@ -10233,7 +9951,7 @@ async function printError(error, ctx, options = {}) {
10233
9951
  }
10234
9952
  const stacks = parseStacktrace(e, fullStack);
10235
9953
  const nearest = error instanceof TypeCheckError ? error.stacks[0] : stacks.find(
10236
- (stack) => ctx.server.moduleGraph.getModuleById(stack.file) && existsSync(stack.file)
9954
+ (stack) => ctx.server.moduleGraph.getModuleById(stack.file) && existsSync$1(stack.file)
10237
9955
  );
10238
9956
  const errorProperties = getErrorProperties(e);
10239
9957
  if (type)
@@ -10245,7 +9963,7 @@ async function printError(error, ctx, options = {}) {
10245
9963
  printStack(ctx, stacks, nearest, errorProperties, (s, pos) => {
10246
9964
  if (showCodeFrame && s === nearest && nearest) {
10247
9965
  const file = fileFromParsedStack(nearest);
10248
- if (nearest.file === file || existsSync(file)) {
9966
+ if (nearest.file === file || existsSync$1(file)) {
10249
9967
  const sourceCode = readFileSync(file, "utf-8");
10250
9968
  ctx.logger.error(picocolors.exports.yellow(generateCodeFrame(sourceCode, 4, pos)));
10251
9969
  }
@@ -10321,8 +10039,14 @@ As a temporary workaround you can try to inline the package by updating your con
10321
10039
  `)
10322
10040
  ));
10323
10041
  }
10324
- function displayDiff(actual, expected, console, options) {
10325
- console.error(picocolors.exports.gray(unifiedDiff(actual, expected, options)) + "\n");
10042
+ function displayDiff(actual, expected, console, options = {}) {
10043
+ const diff = unifiedDiff(actual, expected, options);
10044
+ const dim = options.noColor ? (s) => s : picocolors.exports.dim;
10045
+ const black = options.noColor ? (s) => s : picocolors.exports.black;
10046
+ if (diff)
10047
+ console.error(diff + "\n");
10048
+ else if (actual && expected && actual !== '"undefined"' && expected !== '"undefined"')
10049
+ console.error(dim("Could not display diff. It's possible objects are too large to compare.\nTry increasing ") + black("--outputDiffMaxSize") + dim(" option.\n"));
10326
10050
  }
10327
10051
  function printErrorMessage(error, logger) {
10328
10052
  const errorName = error.name || error.nameStr || "Unknown Error";
@@ -10565,7 +10289,7 @@ class Vitest {
10565
10289
  }
10566
10290
  });
10567
10291
  }
10568
- this.reporters = resolved.mode === "benchmark" ? await createBenchmarkReporters(toArray$1((_c = resolved.benchmark) == null ? void 0 : _c.reporters), this.runner) : await createReporters(resolved.reporters, this.runner);
10292
+ this.reporters = resolved.mode === "benchmark" ? await createBenchmarkReporters(toArray((_c = resolved.benchmark) == null ? void 0 : _c.reporters), this.runner) : await createReporters(resolved.reporters, this.runner);
10569
10293
  this.runningPromise = void 0;
10570
10294
  this.cache.results.setConfig(resolved.root, resolved.cache);
10571
10295
  try {
@@ -10701,7 +10425,7 @@ class Vitest {
10701
10425
  }
10702
10426
  async filterTestsBySource(tests) {
10703
10427
  if (this.config.changed && !this.config.related) {
10704
- const { VitestGit } = await import('./chunk-node-git.5a1b1656.js');
10428
+ const { VitestGit } = await import('./chunk-node-git.a90c0582.js');
10705
10429
  const vitestGit = new VitestGit(this.config.root);
10706
10430
  const related2 = await vitestGit.findChangedFiles({
10707
10431
  changedSince: this.config.changed
@@ -10752,13 +10476,13 @@ class Vitest {
10752
10476
  const files = this.state.getFiles();
10753
10477
  if (hasFailed(files))
10754
10478
  process.exitCode = 1;
10755
- if (!this.config.browser)
10756
- await this.report("onFinished", files, this.state.getUnhandledErrors());
10757
10479
  this.cache.results.updateResults(files);
10758
10480
  await this.cache.results.writeToCache();
10759
- })().finally(() => {
10760
- this.runningPromise = void 0;
10481
+ })().finally(async () => {
10761
10482
  this.state.finishCollectingPaths();
10483
+ if (!this.config.browser)
10484
+ await this.report("onFinished", this.state.getFiles(), this.state.getUnhandledErrors());
10485
+ this.runningPromise = void 0;
10762
10486
  });
10763
10487
  return await this.runningPromise;
10764
10488
  }
@@ -10831,13 +10555,13 @@ class Vitest {
10831
10555
  }
10832
10556
  registerWatcher() {
10833
10557
  const onChange = (id) => {
10834
- id = slash$2(id);
10558
+ id = slash$1(id);
10835
10559
  const needsRerun = this.handleFileChanged(id);
10836
10560
  if (needsRerun)
10837
10561
  this.scheduleRerun(id);
10838
10562
  };
10839
10563
  const onUnlink = (id) => {
10840
- id = slash$2(id);
10564
+ id = slash$1(id);
10841
10565
  this.invalidates.add(id);
10842
10566
  if (this.state.filesMap.has(id)) {
10843
10567
  this.state.filesMap.delete(id);
@@ -10848,7 +10572,7 @@ class Vitest {
10848
10572
  }
10849
10573
  };
10850
10574
  const onAdd = async (id) => {
10851
- id = slash$2(id);
10575
+ id = slash$1(id);
10852
10576
  if (await this.isTargetFile(id)) {
10853
10577
  this.changedTests.add(id);
10854
10578
  await this.cache.stats.updateStats(id);
@@ -10981,7 +10705,7 @@ class Vitest {
10981
10705
  }
10982
10706
 
10983
10707
  function generateCssFilenameHash(filepath) {
10984
- return createHash("md5").update(filepath).digest("hex").slice(0, 6);
10708
+ return createHash$1("md5").update(filepath).digest("hex").slice(0, 6);
10985
10709
  }
10986
10710
  function generateScopedClassName(strategy, name, filename) {
10987
10711
  if (strategy === "scoped")
@@ -11021,7 +10745,7 @@ async function loadGlobalSetupFiles(ctx) {
11021
10745
  var _a;
11022
10746
  const server = ctx.server;
11023
10747
  const runner = ctx.runner;
11024
- const globalSetupFiles = toArray$1((_a = server.config.test) == null ? void 0 : _a.globalSetup);
10748
+ const globalSetupFiles = toArray((_a = server.config.test) == null ? void 0 : _a.globalSetup);
11025
10749
  return Promise.all(globalSetupFiles.map((file) => loadGlobalSetupFile(file, runner)));
11026
10750
  }
11027
10751
  async function loadGlobalSetupFile(file, runner) {
@@ -11215,9 +10939,9 @@ function CSSEnablerPlugin(ctx) {
11215
10939
  const { css } = ctx.config;
11216
10940
  if (typeof css === "boolean")
11217
10941
  return css;
11218
- if (toArray$1(css.exclude).some((re) => re.test(id)))
10942
+ if (toArray(css.exclude).some((re) => re.test(id)))
11219
10943
  return false;
11220
- if (toArray$1(css.include).some((re) => re.test(id)))
10944
+ if (toArray(css.include).some((re) => re.test(id)))
11221
10945
  return true;
11222
10946
  return false;
11223
10947
  };
@@ -11392,7 +11116,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
11392
11116
  try {
11393
11117
  await ctx.setServer(options, server);
11394
11118
  if (options.api && options.watch)
11395
- (await import('./chunk-api-setup.dc71e384.js')).setup(ctx);
11119
+ (await import('./chunk-api-setup.adeab271.js')).setup(ctx);
11396
11120
  } catch (err) {
11397
11121
  ctx.logger.printError(err, true);
11398
11122
  process.exit(1);
@@ -11506,8 +11230,8 @@ function registerConsoleShortcuts(ctx) {
11506
11230
  let rl;
11507
11231
  function on() {
11508
11232
  off();
11509
- rl = require$$0$2.createInterface({ input: process.stdin, escapeCodeTimeout: 50 });
11510
- require$$0$2.emitKeypressEvents(process.stdin, rl);
11233
+ rl = require$$0$3.createInterface({ input: process.stdin, escapeCodeTimeout: 50 });
11234
+ require$$0$3.emitKeypressEvents(process.stdin, rl);
11511
11235
  if (process.stdin.isTTY)
11512
11236
  process.stdin.setRawMode(true);
11513
11237
  process.stdin.on("keypress", keypressHandler);