vite-plus 0.1.24 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/LICENSE +30 -0
  2. package/README.md +8 -6
  3. package/bin/oxfmt +5 -2
  4. package/bin/oxlint +12 -2
  5. package/binding/index.cjs +84 -67
  6. package/binding/index.d.cts +155 -4
  7. package/dist/{agent-Nuk-9l77.js → agent-BD31CsvU.js} +941 -70
  8. package/dist/bin.js +22 -30
  9. package/dist/{compat-DXZgnEyq.js → compat-Cql3K40m.js} +1 -1
  10. package/dist/config/bin.js +30 -14
  11. package/dist/constants-CrfJQIUX.js +66 -0
  12. package/dist/create/bin.d.ts +6 -0
  13. package/dist/create/bin.js +508 -232
  14. package/dist/define-config-2tfJoXr1.d.ts +305 -0
  15. package/dist/define-config-BGSjF6Xp.cjs +488 -0
  16. package/dist/define-config-DJUehepE.js +445 -0
  17. package/dist/define-config.cjs +8 -1
  18. package/dist/define-config.d.ts +2 -2
  19. package/dist/define-config.js +2 -2
  20. package/dist/dist-DRJUd9bL.js +3 -0
  21. package/dist/{dist-BgQuvbtq.js → dist-Oxo16Y0q.js} +4 -4
  22. package/dist/index.cjs +9 -4
  23. package/dist/index.d.ts +3 -3
  24. package/dist/index.js +3 -3
  25. package/dist/{main-DpJl3LoU.js → json-Dn87fvjk.js} +137 -1
  26. package/dist/migration/bin.js +292 -76
  27. package/dist/{oxlint-plugin-config-B89iKTKN.js → oxlint-plugin-config-q8a5PFch.js} +1 -1
  28. package/dist/oxlint-plugin.js +11 -3
  29. package/dist/pack-bin.js +44 -15
  30. package/dist/{package-PmBUZ-ve.js → package-BHirM1_v.js} +3 -138
  31. package/dist/{report-DgSBQUdz.js → report-BHSkWqRR.js} +2 -0
  32. package/dist/{resolve-vite-config-TTvhycU1.js → resolve-vite-config-CmdsfQzS.js} +13 -4
  33. package/dist/staged/bin.js +3 -3
  34. package/dist/test/_at-vitest-browser/context.d.ts +2 -0
  35. package/dist/test/_at-vitest-browser.d.ts +2 -0
  36. package/dist/test/browser/context.d.ts +2 -2
  37. package/dist/test/browser/context.js +1 -1
  38. package/dist/test/browser/providers/playwright/context.d.ts +1 -0
  39. package/dist/test/browser/providers/playwright/context.js +1 -0
  40. package/dist/test/browser/providers/playwright.d.ts +124 -2
  41. package/dist/test/browser/providers/playwright.js +1 -1
  42. package/dist/test/browser/providers/preview/context.d.ts +1 -0
  43. package/dist/test/browser/providers/preview/context.js +1 -0
  44. package/dist/test/browser/providers/preview.d.ts +32 -2
  45. package/dist/test/browser/providers/preview.js +1 -1
  46. package/dist/test/browser/providers/webdriverio/context.d.ts +1 -0
  47. package/dist/test/browser/providers/webdriverio/context.js +1 -0
  48. package/dist/test/browser/providers/webdriverio.d.ts +77 -2
  49. package/dist/test/browser/providers/webdriverio.js +1 -1
  50. package/dist/test/browser-compat.d.ts +2 -0
  51. package/dist/test/browser-compat.js +1 -1
  52. package/dist/test/browser-playwright/context.d.ts +1 -0
  53. package/dist/test/browser-playwright/context.js +1 -0
  54. package/dist/test/browser-playwright.d.ts +124 -2
  55. package/dist/test/browser-playwright.js +1 -1
  56. package/dist/test/browser-preview/context.d.ts +1 -0
  57. package/dist/test/browser-preview/context.js +1 -0
  58. package/dist/test/browser-preview.d.ts +32 -2
  59. package/dist/test/browser-preview.js +1 -1
  60. package/dist/test/browser-webdriverio/context.d.ts +1 -0
  61. package/dist/test/browser-webdriverio/context.js +1 -0
  62. package/dist/test/browser-webdriverio.d.ts +77 -2
  63. package/dist/test/browser-webdriverio.js +1 -1
  64. package/dist/test/browser.d.ts +2 -2
  65. package/dist/test/browser.js +1 -1
  66. package/dist/test/client.js +1 -1
  67. package/dist/test/config.cjs +1 -1
  68. package/dist/test/config.d.ts +2 -2
  69. package/dist/test/config.js +1 -1
  70. package/dist/test/context.d.ts +942 -2
  71. package/dist/test/context.js +1 -1
  72. package/dist/test/coverage.d.ts +2 -2
  73. package/dist/test/coverage.js +1 -1
  74. package/dist/test/environments.d.ts +2 -2
  75. package/dist/test/environments.js +1 -1
  76. package/dist/test/globals.d.ts +2 -2
  77. package/dist/test/import-meta.d.ts +2 -2
  78. package/dist/test/importMeta.d.ts +2 -2
  79. package/dist/test/index.cjs +1 -1
  80. package/dist/test/index.d.cts +2 -2
  81. package/dist/test/index.d.ts +2 -2
  82. package/dist/test/index.js +1 -1
  83. package/dist/test/internal/browser.d.ts +2 -2
  84. package/dist/test/internal/browser.js +1 -1
  85. package/dist/test/jsdom.d.ts +2 -2
  86. package/dist/test/locators.d.ts +294 -0
  87. package/dist/test/locators.js +1 -1
  88. package/dist/test/matchers.d.ts +29 -0
  89. package/dist/test/matchers.js +1 -1
  90. package/dist/test/node.d.ts +2 -2
  91. package/dist/test/node.js +1 -1
  92. package/dist/test/optional-runtime-types.js.d.ts +2 -2
  93. package/dist/test/optional-types.js.d.ts +2 -2
  94. package/dist/test/plugins/browser-client.js +1 -1
  95. package/dist/test/plugins/browser-context.js +1 -1
  96. package/dist/test/plugins/browser-locators.js +1 -1
  97. package/dist/test/plugins/browser-playwright.js +1 -1
  98. package/dist/test/plugins/browser-preview.js +1 -1
  99. package/dist/test/plugins/browser-webdriverio.js +1 -1
  100. package/dist/test/plugins/browser.js +1 -1
  101. package/dist/test/plugins/expect.js +1 -1
  102. package/dist/test/plugins/mocker-automock.js +1 -1
  103. package/dist/test/plugins/mocker-browser.js +1 -1
  104. package/dist/test/plugins/mocker-node.js +1 -1
  105. package/dist/test/plugins/mocker-redirect.js +1 -1
  106. package/dist/test/plugins/mocker-register.js +1 -1
  107. package/dist/test/plugins/mocker-transforms.js +1 -1
  108. package/dist/test/plugins/mocker.js +1 -1
  109. package/dist/test/plugins/pretty-format.js +1 -1
  110. package/dist/test/plugins/runner-types.js +1 -1
  111. package/dist/test/plugins/runner-utils.js +1 -1
  112. package/dist/test/plugins/runner.js +1 -1
  113. package/dist/test/plugins/snapshot-environment.js +1 -1
  114. package/dist/test/plugins/snapshot-manager.js +1 -1
  115. package/dist/test/plugins/snapshot.js +1 -1
  116. package/dist/test/plugins/spy.js +1 -1
  117. package/dist/test/plugins/utils-constants.js +1 -1
  118. package/dist/test/plugins/utils-diff.js +1 -1
  119. package/dist/test/plugins/utils-display.js +1 -1
  120. package/dist/test/plugins/utils-error.js +1 -1
  121. package/dist/test/plugins/utils-helpers.js +1 -1
  122. package/dist/test/plugins/utils-offset.js +1 -1
  123. package/dist/test/plugins/utils-resolver.js +1 -1
  124. package/dist/test/plugins/utils-serialize.js +1 -1
  125. package/dist/test/plugins/utils-source-map-node.js +1 -1
  126. package/dist/test/plugins/utils-source-map.js +1 -1
  127. package/dist/test/plugins/utils-timers.js +1 -1
  128. package/dist/test/plugins/utils.js +1 -1
  129. package/dist/test/reporters.d.ts +2 -2
  130. package/dist/test/reporters.js +1 -1
  131. package/dist/test/runners.d.ts +2 -2
  132. package/dist/test/runners.js +1 -1
  133. package/dist/test/runtime.d.ts +2 -2
  134. package/dist/test/runtime.js +1 -1
  135. package/dist/test/snapshot.d.ts +2 -2
  136. package/dist/test/snapshot.js +1 -1
  137. package/dist/test/suite.d.ts +2 -2
  138. package/dist/test/suite.js +1 -1
  139. package/dist/test/utils.js +1 -1
  140. package/dist/test/worker.d.ts +2 -2
  141. package/dist/test/worker.js +1 -1
  142. package/dist/{tsconfig-DFb5BKyT.js → tsconfig-CJ_StdFc.js} +563 -229
  143. package/dist/tsgolint-path-B-yOos8p.js +32 -0
  144. package/dist/tsgolint-path.d.ts +8 -0
  145. package/dist/tsgolint-path.js +2 -0
  146. package/dist/version.js +3 -3
  147. package/dist/versions.d.ts +1 -1
  148. package/dist/versions.js +6 -6
  149. package/dist/{workspace-NL-m9wgM.js → workspace-Cjoc1c_A.js} +11 -9
  150. package/docs/_data/team.ts +2 -1
  151. package/docs/config/create.md +36 -1
  152. package/docs/config/index.md +7 -5
  153. package/docs/guide/commit-hooks.md +9 -0
  154. package/docs/guide/create.md +106 -2
  155. package/docs/guide/env.md +33 -5
  156. package/docs/guide/index.md +5 -3
  157. package/docs/guide/install.md +31 -12
  158. package/docs/guide/migrate.md +13 -3
  159. package/docs/guide/troubleshooting.md +2 -2
  160. package/docs/guide/upgrade.md +26 -7
  161. package/docs/package.json +3 -3
  162. package/docs/pnpm-lock.yaml +298 -395
  163. package/package.json +103 -55
  164. package/templates/generator/bin/index.ts +6 -3
  165. package/templates/generator/package.json +2 -3
  166. package/templates/generator/src/template.ts +0 -2
  167. package/templates/monorepo/package.json +1 -1
  168. package/dist/constants-DCBWlNrn.js +0 -33
  169. package/dist/define-config-BR1Y88zz.cjs +0 -84
  170. package/dist/define-config-BRC7qPNE.js +0 -21
  171. package/dist/define-config-COdn-tsn.d.ts +0 -177
  172. package/dist/dist-Bapm49IR.js +0 -3
  173. package/dist/test/plugins/utils-highlight.js +0 -1
  174. /package/dist/{chunk-DnnnRqeS.js → rolldown-runtime-DnnnRqeS.js} +0 -0
package/dist/pack-bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { i as resolveViteConfig } from "./resolve-vite-config-TTvhycU1.js";
2
+ import { a as resolveViteConfig } from "./resolve-vite-config-CmdsfQzS.js";
3
3
  import module from "node:module";
4
4
  import { buildWithConfigs, enableDebug, globalLogger, resolveUserConfig } from "@voidzero-dev/vite-plus-core/pack";
5
5
  //#region ../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
@@ -621,26 +621,55 @@ var CAC = class extends EventTarget {
621
621
  const cac = (name = "") => new CAC(name);
622
622
  //#endregion
623
623
  //#region src/pack-bin.ts
624
+ const RE_DTS = /\.d\.[cm]?ts$/;
625
+ const EXTERNAL_DTS_PKG_RE = /^(?:postcss|lightningcss|vitest|@vitest\/[^/]+|vite-plus)(?:\/|$)/;
624
626
  /**
625
- * Rolldown plugin that transforms value imports/exports to type-only in external
626
- * packages' .d.ts files. Some packages (e.g. postcss, lightningcss) use
627
- * `import { X }` and `export { X } from` instead of their type-only equivalents,
628
- * which causes MISSING_EXPORT warnings from the DTS bundler.
627
+ * Rolldown plugin that keeps `postcss` / `lightningcss` / `vitest` / `@vitest/*`
628
+ * / `vite-plus` external to the DTS bundle.
629
629
  *
630
- * Since .d.ts files contain only type information, all imports/exports are
631
- * inherently type-only, so this transformation is always safe.
630
+ * The DTS bundler resolves these packages and tries to inline their `.d.ts`
631
+ * files. postcss ships its public types as a CJS `export = postcss` over a
632
+ * `declare namespace postcss { export { AtRule, ... } }` (see
633
+ * postcss/lib/postcss.d.ts), and its ESM types entry (postcss.d.mts) re-exports
634
+ * those names with `export { AtRule, ... } from './postcss.js'`. The bundler
635
+ * cannot map named imports onto an `export =`'d namespace's members, so every
636
+ * consumer `import type { AtRule } from 'postcss'` becomes a MISSING_EXPORT
637
+ * error.
638
+ *
639
+ * vitest fails for a different reason: `vitest@4.1.9`'s `dist/index.d.ts`
640
+ * re-exports `ExpectPollOptions` from `@vitest/expect`, but `@vitest/expect`
641
+ * does not actually export that name. `tsc` tolerates the dangling re-export
642
+ * because it only resolves re-exports lazily on use, but the DTS bundler
643
+ * eagerly resolves every re-export while inlining and so hits the missing
644
+ * export. `@vitest/browser/matchers.d.ts` then re-imports the same name from
645
+ * `vitest`, propagating the failure. Established vite-plus projects reach
646
+ * these files through the `vite-plus/test*` shims, which re-export `vitest` /
647
+ * `@vitest/*` from declaration files.
648
+ *
649
+ * `vite-plus` itself (root and `vite-plus/test*` shims) is kept external so the
650
+ * PUBLIC specifier survives in the emitted declarations. If the shim were
651
+ * inlined instead, its private `vitest` / `@vitest/*` re-exports would be the
652
+ * ones externalized above and the published `.d.ts` would carry bare `vitest`
653
+ * specifiers — unresolvable for consumers under strict pnpm / Yarn PnP layouts,
654
+ * where `vitest` is a dependency of `vite-plus` and not of the packed package.
655
+ *
656
+ * Marking these packages external for `.d.ts` importers leaves the import
657
+ * untouched in the emitted declarations (`import type { AtRule } from 'postcss'`),
658
+ * which is how third-party packages should be treated in a DTS bundle anyway.
659
+ * They are only externalized when imported *from a declaration file*, so runtime
660
+ * bundling is unaffected.
632
661
  */
633
- const EXTERNAL_DTS_INTERNAL_RE = /node_modules\/(postcss|lightningcss)\/.*\.d\.(ts|mts|cts)$/;
634
- const EXTERNAL_DTS_FIX_RE = new RegExp(`${EXTERNAL_DTS_INTERNAL_RE.source}|${/(?:vite-plus-core|packages\/core)\/.*lightningcssOptions\.d\.ts$|(?:vite-plus-core|packages\/core)\/dist\/.*\.d\.ts$/.source}`);
635
662
  function externalDtsTypeOnlyPlugin() {
636
663
  return {
637
664
  name: "vite-plus:external-dts-type-only",
638
- transform: {
639
- filter: { id: { include: [EXTERNAL_DTS_FIX_RE] } },
640
- handler(code, rawId) {
641
- const id = rawId.replaceAll("\\", "/");
642
- if (EXTERNAL_DTS_INTERNAL_RE.test(id)) return code.replace(/^(import\s+)(?!type\s)/gm, "import type ");
643
- return code.replace(/^(import\s+)(?!type\s)(.+from\s+['"](?:postcss|lightningcss)['"])/gm, "import type $2");
665
+ resolveId: {
666
+ order: "pre",
667
+ handler(id, importer) {
668
+ const normalizedImporter = importer?.replaceAll("\\", "/");
669
+ if (normalizedImporter && RE_DTS.test(normalizedImporter) && EXTERNAL_DTS_PKG_RE.test(id)) return {
670
+ id,
671
+ external: true
672
+ };
644
673
  }
645
674
  }
646
675
  };
@@ -1,144 +1,9 @@
1
- import "./constants-DCBWlNrn.js";
2
- import { r as parse } from "./main-DpJl3LoU.js";
1
+ import "./constants-CrfJQIUX.js";
2
+ import { r as readJsonFile } from "./json-Dn87fvjk.js";
3
3
  import { createRequire } from "node:module";
4
4
  import path from "node:path";
5
5
  import fs from "node:fs";
6
6
  import os from "node:os";
7
- //#region ../../node_modules/.pnpm/detect-indent@7.0.2/node_modules/detect-indent/index.js
8
- const INDENT_REGEX = /^(?:( )+|\t+)/;
9
- const INDENT_TYPE_SPACE = "space";
10
- const INDENT_TYPE_TAB = "tab";
11
- function shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, value) {
12
- return ignoreSingleSpaces && indentType === INDENT_TYPE_SPACE && value === 1;
13
- }
14
- /**
15
- Make a Map that counts how many indents/unindents have occurred for a given size and how many lines follow a given indentation.
16
-
17
- The key is a concatenation of the indentation type (s = space and t = tab) and the size of the indents/unindents.
18
-
19
- ```
20
- indents = {
21
- t3: [1, 0],
22
- t4: [1, 5],
23
- s5: [1, 0],
24
- s12: [1, 0],
25
- }
26
- ```
27
- */
28
- function makeIndentsMap(string, ignoreSingleSpaces) {
29
- const indents = /* @__PURE__ */ new Map();
30
- let previousSize = 0;
31
- let previousIndentType;
32
- let key;
33
- for (const line of string.split(/\n/g)) {
34
- if (!line) continue;
35
- const matches = line.match(INDENT_REGEX);
36
- if (matches === null) {
37
- previousSize = 0;
38
- previousIndentType = "";
39
- } else {
40
- const indent = matches[0].length;
41
- const indentType = matches[1] ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
42
- if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, indent)) continue;
43
- if (indentType !== previousIndentType) previousSize = 0;
44
- previousIndentType = indentType;
45
- let use = 1;
46
- let weight = 0;
47
- const indentDifference = indent - previousSize;
48
- previousSize = indent;
49
- if (indentDifference === 0) {
50
- use = 0;
51
- weight = 1;
52
- } else {
53
- const absoluteIndentDifference = Math.abs(indentDifference);
54
- if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, absoluteIndentDifference)) continue;
55
- key = encodeIndentsKey(indentType, absoluteIndentDifference);
56
- }
57
- const entry = indents.get(key);
58
- indents.set(key, entry === void 0 ? [1, 0] : [entry[0] + use, entry[1] + weight]);
59
- }
60
- }
61
- return indents;
62
- }
63
- function encodeIndentsKey(indentType, indentAmount) {
64
- return (indentType === INDENT_TYPE_SPACE ? "s" : "t") + String(indentAmount);
65
- }
66
- function decodeIndentsKey(indentsKey) {
67
- return {
68
- type: indentsKey[0] === "s" ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB,
69
- amount: Number(indentsKey.slice(1))
70
- };
71
- }
72
- function getMostUsedKey(indents) {
73
- let result;
74
- let maxUsed = 0;
75
- let maxWeight = 0;
76
- for (const [key, [usedCount, weight]] of indents) if (usedCount > maxUsed || usedCount === maxUsed && weight > maxWeight) {
77
- maxUsed = usedCount;
78
- maxWeight = weight;
79
- result = key;
80
- }
81
- return result;
82
- }
83
- function makeIndentString(type, amount) {
84
- return (type === INDENT_TYPE_SPACE ? " " : " ").repeat(amount);
85
- }
86
- function detectIndent(string) {
87
- if (typeof string !== "string") throw new TypeError("Expected a string");
88
- let indents = makeIndentsMap(string, true);
89
- if (indents.size === 0) indents = makeIndentsMap(string, false);
90
- const keyOfMostUsedIndent = getMostUsedKey(indents);
91
- let type;
92
- let amount = 0;
93
- let indent = "";
94
- if (keyOfMostUsedIndent !== void 0) {
95
- ({type, amount} = decodeIndentsKey(keyOfMostUsedIndent));
96
- indent = makeIndentString(type, amount);
97
- }
98
- return {
99
- amount,
100
- type,
101
- indent
102
- };
103
- }
104
- //#endregion
105
- //#region ../../node_modules/.pnpm/detect-newline@4.0.1/node_modules/detect-newline/index.js
106
- function detectNewline(string) {
107
- if (typeof string !== "string") throw new TypeError("Expected a string");
108
- const newlines = string.match(/(?:\r?\n)/g) || [];
109
- if (newlines.length === 0) return;
110
- const crlf = newlines.filter((newline) => newline === "\r\n").length;
111
- return crlf > newlines.length - crlf ? "\r\n" : "\n";
112
- }
113
- //#endregion
114
- //#region src/utils/json.ts
115
- function readJsonFile(file, allowComments) {
116
- const content = fs.readFileSync(file, "utf-8");
117
- return (allowComments ? parse : JSON.parse)(content);
118
- }
119
- function writeJsonFile(file, data) {
120
- let newline = "\n";
121
- let indent = " ";
122
- if (fs.existsSync(file)) {
123
- const content = fs.readFileSync(file, "utf-8");
124
- indent = detectIndent(content).indent;
125
- newline = detectNewline(content) ?? "";
126
- }
127
- fs.writeFileSync(file, JSON.stringify(data, null, indent) + newline, "utf-8");
128
- }
129
- function editJsonFile(file, callback) {
130
- const newJson = callback(readJsonFile(file));
131
- if (newJson) writeJsonFile(file, newJson);
132
- }
133
- function isJsonFile(file) {
134
- try {
135
- readJsonFile(file);
136
- return true;
137
- } catch {
138
- return false;
139
- }
140
- }
141
- //#endregion
142
7
  //#region src/utils/npm-config.ts
143
8
  function expandNpmrcValue(raw) {
144
9
  let value = raw.trim();
@@ -321,4 +186,4 @@ async function checkNpmPackageExists(packageName) {
321
186
  }
322
187
  }
323
188
  //#endregion
324
- export { readNearestPackageJson as a, editJsonFile as c, writeJsonFile as d, hasVitePlusDependency as i, isJsonFile as l, detectPackageMetadata as n, fetchNpmResource as o, getScopeFromPackageName as r, getNpmRegistry as s, checkNpmPackageExists as t, readJsonFile as u };
189
+ export { readNearestPackageJson as a, hasVitePlusDependency as i, detectPackageMetadata as n, fetchNpmResource as o, getScopeFromPackageName as r, getNpmRegistry as s, checkNpmPackageExists as t };
@@ -7,6 +7,7 @@ function createMigrationReport() {
7
7
  inlinedLintStagedConfigCount: 0,
8
8
  removedConfigCount: 0,
9
9
  tsdownImportCount: 0,
10
+ wrappedPluginConfigCount: 0,
10
11
  rewrittenImportFileCount: 0,
11
12
  rewrittenImportErrors: [],
12
13
  eslintMigrated: false,
@@ -14,6 +15,7 @@ function createMigrationReport() {
14
15
  nodeVersionFileMigrated: false,
15
16
  gitHooksConfigured: false,
16
17
  frameworkShimAdded: false,
18
+ packageManagerBootstrapConfigured: false,
17
19
  warnings: [],
18
20
  manualSteps: []
19
21
  };
@@ -2,11 +2,11 @@ import path from "node:path";
2
2
  import fs from "node:fs";
3
3
  //#region src/resolve-vite-config.ts
4
4
  const VITE_CONFIG_FILES = [
5
- "vite.config.ts",
6
5
  "vite.config.js",
7
6
  "vite.config.mjs",
8
- "vite.config.mts",
7
+ "vite.config.ts",
9
8
  "vite.config.cjs",
9
+ "vite.config.mts",
10
10
  "vite.config.cts"
11
11
  ];
12
12
  /**
@@ -26,8 +26,17 @@ function findViteConfigUp(startDir, stopDir) {
26
26
  dir = parent;
27
27
  }
28
28
  }
29
+ /**
30
+ * Find a vite config file directly in `dir` (no walking up). Returns the
31
+ * absolute path of the first config file found, or undefined. Covers every
32
+ * supported extension (`.ts/.js/.mjs/.mts/.cjs/.cts`).
33
+ */
34
+ function findViteConfig(dir) {
35
+ const filename = VITE_CONFIG_FILES.find((f) => fs.existsSync(path.join(dir, f)));
36
+ return filename ? path.join(dir, filename) : void 0;
37
+ }
29
38
  function hasViteConfig(dir) {
30
- return VITE_CONFIG_FILES.some((f) => fs.existsSync(path.join(dir, f)));
39
+ return findViteConfig(dir) !== void 0;
31
40
  }
32
41
  /**
33
42
  * Find the workspace root by walking up from `startDir` looking for
@@ -81,4 +90,4 @@ async function resolveUniversalViteConfig(err, viteConfigCwd) {
81
90
  }
82
91
  }
83
92
  //#endregion
84
- export { resolveViteConfig as i, hasViteConfig as n, resolveUniversalViteConfig as r, findWorkspaceRoot as t };
93
+ export { resolveViteConfig as a, resolveUniversalViteConfig as i, findWorkspaceRoot as n, hasViteConfig as r, findViteConfig as t };
@@ -1,6 +1,6 @@
1
- import { r as __toESM, t as __commonJSMin } from "../chunk-DnnnRqeS.js";
1
+ import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-DnnnRqeS.js";
2
2
  import { a as printHeader, n as errorMsg, r as log } from "../terminal-uTv0ZaMr.js";
3
- import { i as resolveViteConfig } from "../resolve-vite-config-TTvhycU1.js";
3
+ import { a as resolveViteConfig } from "../resolve-vite-config-CmdsfQzS.js";
4
4
  import { t as lib_default } from "../lib-L3DWSRQp.js";
5
5
  import { t as renderCliDoc } from "../help-YP84FSEz.js";
6
6
  import { createRequire } from "node:module";
@@ -5912,7 +5912,7 @@ const jsonParse = async (filename) => {
5912
5912
  const yamlParse = async (filename) => {
5913
5913
  const isPackageFile = PACKAGE_YAML_FILES.includes(path.basename(filename));
5914
5914
  try {
5915
- const [YAML, content] = await Promise.all([import("../dist-Bapm49IR.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1)), readFile(filename)]);
5915
+ const [YAML, content] = await Promise.all([import("../dist-DRJUd9bL.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1)), readFile(filename)]);
5916
5916
  const yaml = YAML.parse(content);
5917
5917
  return isPackageFile ? yaml[CONFIG_NAME] : yaml;
5918
5918
  } catch (error) {
@@ -0,0 +1,2 @@
1
+ import '@vitest/browser/context';
2
+ export * from '@vitest/browser/context';
@@ -0,0 +1,2 @@
1
+ import '@vitest/browser';
2
+ export * from '@vitest/browser';
@@ -1,2 +1,2 @@
1
- import '@voidzero-dev/vite-plus-test/browser/context';
2
- export * from '@voidzero-dev/vite-plus-test/browser/context';
1
+ import '@vitest/browser/context';
2
+ export * from '@vitest/browser/context';
@@ -1 +1 @@
1
- export * from '@voidzero-dev/vite-plus-test/browser/context';
1
+ export * from '@vitest/browser/context';
@@ -0,0 +1 @@
1
+ export * from '../../../_at-vitest-browser/context'
@@ -0,0 +1 @@
1
+ export * from '@vitest/browser/context';
@@ -1,2 +1,124 @@
1
- import '@voidzero-dev/vite-plus-test/browser/providers/playwright';
2
- export * from '@voidzero-dev/vite-plus-test/browser/providers/playwright';
1
+ import { CustomComparatorsRegistry } from '../../_at-vitest-browser';
2
+ export { defineBrowserCommand } from '../../_at-vitest-browser';
3
+ import { Page, Frame, FrameLocator, BrowserContext, CDPSession, Browser, LaunchOptions, ConnectOptions, BrowserContextOptions } from 'playwright';
4
+ import { ScreenshotMatcherOptions, ScreenshotComparatorRegistry, Locator } from '../../browser';
5
+ import { BrowserProvider, BrowserModuleMocker, TestProject, CDPSession as CDPSession$1, BrowserProviderOption } from '../../node';
6
+
7
+ declare const playwrightBrowsers: readonly ["firefox", "webkit", "chromium"];
8
+ type PlaywrightBrowser = (typeof playwrightBrowsers)[number];
9
+ interface PlaywrightProviderOptions {
10
+ /**
11
+ * The options passed down to [`playwright.connect`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch) method.
12
+ * @see {@link https://playwright.dev/docs/api/class-browsertype#browser-type-launch}
13
+ */
14
+ launchOptions?: Omit<LaunchOptions, "tracesDir">;
15
+ /**
16
+ * The options passed down to [`playwright.connect`](https://playwright.dev/docs/api/class-browsertype#browser-type-connect) method.
17
+ *
18
+ * This is used only if you connect remotely to the playwright instance via a WebSocket connection.
19
+ * @see {@link https://playwright.dev/docs/api/class-browsertype#browser-type-connect}
20
+ */
21
+ connectOptions?: ConnectOptions & {
22
+ wsEndpoint: string;
23
+ };
24
+ /**
25
+ * The options passed down to [`browser.newContext`](https://playwright.dev/docs/api/class-browser#browser-new-context) method.
26
+ * @see {@link https://playwright.dev/docs/api/class-browser#browser-new-context}
27
+ */
28
+ contextOptions?: Omit<BrowserContextOptions, "ignoreHTTPSErrors" | "serviceWorkers">;
29
+ /**
30
+ * The maximum time in milliseconds to wait for `userEvent` action to complete.
31
+ * @default 0 (no timeout)
32
+ */
33
+ actionTimeout?: number;
34
+ /**
35
+ * Use a persistent context instead of a regular browser context.
36
+ * This allows browser state (cookies, localStorage, DevTools settings, etc.) to persist between test runs.
37
+ * When set to `true`, the user data is stored in `./node_modules/.cache/vitest-playwright-user-data`.
38
+ * When set to a string, the value is used as the path to the user data directory.
39
+ *
40
+ * Note: This option is ignored when running tests in parallel (e.g. headless with fileParallelism enabled)
41
+ * because persistent context cannot be shared across parallel sessions.
42
+ * @default false
43
+ * @see {@link https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context}
44
+ */
45
+ persistentContext?: boolean | string;
46
+ }
47
+ declare function playwright(options?: PlaywrightProviderOptions): BrowserProviderOption<PlaywrightProviderOptions>;
48
+ declare class PlaywrightBrowserProvider implements BrowserProvider {
49
+ private project;
50
+ private options;
51
+ name: "playwright";
52
+ supportsParallelism: boolean;
53
+ browser: Browser | null;
54
+ persistentContext: BrowserContext | null;
55
+ contexts: Map<string, BrowserContext>;
56
+ pages: Map<string, Page>;
57
+ mocker: BrowserModuleMocker;
58
+ browserName: PlaywrightBrowser;
59
+ private browserPromise;
60
+ private closing;
61
+ tracingContexts: Set<string>;
62
+ pendingTraces: Map<string, string>;
63
+ initScripts: string[];
64
+ constructor(project: TestProject, options: PlaywrightProviderOptions);
65
+ private onSIGTERM;
66
+ private openBrowser;
67
+ private createMocker;
68
+ private createContext;
69
+ private getContextOptions;
70
+ getPage(sessionId: string): Page;
71
+ getCommandsContext(sessionId: string): {
72
+ page: Page;
73
+ context: BrowserContext;
74
+ frame: () => Promise<Frame>;
75
+ readonly iframe: FrameLocator;
76
+ };
77
+ private openBrowserPage;
78
+ openPage(sessionId: string, url: string, options: {
79
+ parallel: boolean;
80
+ }): Promise<void>;
81
+ private _throwIfClosing;
82
+ getCDPSession(sessionid: string): Promise<CDPSession$1>;
83
+ close(): Promise<void>;
84
+ }
85
+ declare module '../../node' {
86
+ interface BrowserCommandContext {
87
+ page: Page;
88
+ frame(): Promise<Frame>;
89
+ iframe: FrameLocator;
90
+ context: BrowserContext;
91
+ }
92
+ interface _BrowserNames {
93
+ playwright: PlaywrightBrowser;
94
+ }
95
+ interface ToMatchScreenshotOptions extends Omit<ScreenshotMatcherOptions, "comparatorName" | "comparatorOptions">, CustomComparatorsRegistry {}
96
+ interface ToMatchScreenshotComparators extends ScreenshotComparatorRegistry {}
97
+ }
98
+ type PWHoverOptions = NonNullable<Parameters<Page["hover"]>[1]>;
99
+ type PWClickOptions = NonNullable<Parameters<Page["click"]>[1]>;
100
+ type PWDoubleClickOptions = NonNullable<Parameters<Page["dblclick"]>[1]>;
101
+ type PWFillOptions = NonNullable<Parameters<Page["fill"]>[2]>;
102
+ type PWScreenshotOptions = NonNullable<Parameters<Page["screenshot"]>[0]>;
103
+ type PWSelectOptions = NonNullable<Parameters<Page["selectOption"]>[2]>;
104
+ type PWDragAndDropOptions = NonNullable<Parameters<Page["dragAndDrop"]>[2]>;
105
+ type PWSetInputFiles = NonNullable<Parameters<Page["setInputFiles"]>[2]>;
106
+ type PWCDPSession = Pick<CDPSession, "send" | "on" | "off" | "once">;
107
+
108
+ declare module '../../browser' {
109
+ interface UserEventHoverOptions extends PWHoverOptions {}
110
+ interface UserEventClickOptions extends PWClickOptions {}
111
+ interface UserEventDoubleClickOptions extends PWDoubleClickOptions {}
112
+ interface UserEventTripleClickOptions extends PWClickOptions {}
113
+ interface UserEventFillOptions extends PWFillOptions {}
114
+ interface UserEventSelectOptions extends PWSelectOptions {}
115
+ interface UserEventDragAndDropOptions extends PWDragAndDropOptions {}
116
+ interface UserEventUploadOptions extends PWSetInputFiles {}
117
+ interface ScreenshotOptions extends Omit<PWScreenshotOptions, "mask"> {
118
+ mask?: ReadonlyArray<Element | Locator> | undefined;
119
+ }
120
+ interface CDPSession extends PWCDPSession {}
121
+ }
122
+
123
+ export { PlaywrightBrowserProvider, playwright };
124
+ export type { PWCDPSession as CDPSession, PlaywrightProviderOptions };
@@ -1 +1 @@
1
- export * from '@voidzero-dev/vite-plus-test/browser/providers/playwright';
1
+ export * from '@vitest/browser-playwright';
@@ -0,0 +1 @@
1
+ export * from '../../../_at-vitest-browser/context'
@@ -0,0 +1 @@
1
+ export * from '@vitest/browser/context';
@@ -1,2 +1,32 @@
1
- import '@voidzero-dev/vite-plus-test/browser/providers/preview';
2
- export * from '@voidzero-dev/vite-plus-test/browser/providers/preview';
1
+ import { SelectorOptions } from '../../browser';
2
+ import { BrowserProvider, TestProject, BrowserProviderOption } from '../../node';
3
+ export { defineBrowserCommand } from '../../_at-vitest-browser';
4
+
5
+ declare function preview(): BrowserProviderOption;
6
+ declare class PreviewBrowserProvider implements BrowserProvider {
7
+ name: "preview";
8
+ supportsParallelism: boolean;
9
+ private project;
10
+ private open;
11
+ distRoot: string;
12
+ initScripts: string[];
13
+ constructor(project: TestProject);
14
+ isOpen(): boolean;
15
+ getCommandsContext(): {};
16
+ openPage(_sessionId: string, url: string): Promise<void>;
17
+ close(): Promise<void>;
18
+ }
19
+ declare module '../../browser' {
20
+ interface UserEventClickOptions extends SelectorOptions {}
21
+ interface UserEventHoverOptions extends SelectorOptions {}
22
+ interface UserEventFillOptions extends SelectorOptions {}
23
+ interface UserEventSelectOptions extends SelectorOptions {}
24
+ interface UserEventClearOptions extends SelectorOptions {}
25
+ interface UserEventDoubleClickOptions extends SelectorOptions {}
26
+ interface UserEventTripleClickOptions extends SelectorOptions {}
27
+ interface UserEventUploadOptions extends SelectorOptions {}
28
+ interface UserEventWheelBaseOptions extends SelectorOptions {}
29
+ interface LocatorScreenshotOptions extends SelectorOptions {}
30
+ }
31
+
32
+ export { PreviewBrowserProvider, preview };
@@ -1 +1 @@
1
- export * from '@voidzero-dev/vite-plus-test/browser/providers/preview';
1
+ export * from '@vitest/browser-preview';
@@ -0,0 +1 @@
1
+ export * from '../../../_at-vitest-browser/context'
@@ -0,0 +1 @@
1
+ export * from '@vitest/browser/context';
@@ -1,2 +1,77 @@
1
- import '@voidzero-dev/vite-plus-test/browser/providers/webdriverio';
2
- export * from '@voidzero-dev/vite-plus-test/browser/providers/webdriverio';
1
+ import { CustomComparatorsRegistry } from '../../_at-vitest-browser';
2
+ export { defineBrowserCommand } from '../../_at-vitest-browser';
3
+ import { SelectorOptions, ScreenshotMatcherOptions, ScreenshotComparatorRegistry } from '../../browser';
4
+ import { BrowserProvider, TestProject, CDPSession, BrowserProviderOption } from '../../node';
5
+ import { ClickOptions, MoveToOptions, DragAndDropOptions, remote } from 'webdriverio';
6
+
7
+ declare const webdriverBrowsers: readonly ["firefox", "chrome", "edge", "safari"];
8
+ type WebdriverBrowser = (typeof webdriverBrowsers)[number];
9
+ interface WebdriverProviderOptions extends Partial<Parameters<typeof remote>[0]> {}
10
+ declare function webdriverio(options?: WebdriverProviderOptions): BrowserProviderOption<WebdriverProviderOptions>;
11
+ declare class WebdriverBrowserProvider implements BrowserProvider {
12
+ name: "webdriverio";
13
+ supportsParallelism: boolean;
14
+ browser: WebdriverIO.Browser | null;
15
+ private browserName;
16
+ private project;
17
+ private options?;
18
+ private closing;
19
+ private iframeSwitched;
20
+ private topLevelContext;
21
+ initScripts: string[];
22
+ getSupportedBrowsers(): readonly string[];
23
+ constructor(project: TestProject, options: WebdriverProviderOptions);
24
+ isIframeSwitched(): boolean;
25
+ switchToTestFrame(): Promise<void>;
26
+ switchToMainFrame(): Promise<void>;
27
+ setViewport(options: {
28
+ width: number;
29
+ height: number;
30
+ }): Promise<void>;
31
+ getCommandsContext(): {
32
+ browser: WebdriverIO.Browser | null;
33
+ };
34
+ openBrowser(): Promise<WebdriverIO.Browser>;
35
+ private buildCapabilities;
36
+ openPage(sessionId: string, url: string): Promise<void>;
37
+ private _throwIfClosing;
38
+ close(): Promise<void>;
39
+ getCDPSession(_sessionId: string): Promise<CDPSession>;
40
+ }
41
+ declare module '../../browser' {
42
+ interface UserEventClickOptions extends Partial<ClickOptions>, SelectorOptions {}
43
+ interface UserEventHoverOptions extends MoveToOptions, SelectorOptions {}
44
+ interface UserEventDragAndDropOptions extends DragAndDropOptions {
45
+ sourceX?: number;
46
+ sourceY?: number;
47
+ targetX?: number;
48
+ targetY?: number;
49
+ }
50
+ interface UserEventFillOptions extends SelectorOptions {}
51
+ interface UserEventSelectOptions extends SelectorOptions {}
52
+ interface UserEventClearOptions extends SelectorOptions {}
53
+ interface UserEventDoubleClickOptions extends SelectorOptions {}
54
+ interface UserEventTripleClickOptions extends SelectorOptions {}
55
+ interface UserEventWheelBaseOptions extends SelectorOptions {}
56
+ interface LocatorScreenshotOptions extends SelectorOptions {}
57
+ }
58
+ interface WebdriverCDPSession {
59
+ send: (method: string, params?: Record<string, unknown>) => Promise<unknown>;
60
+ on: (event: string, listener: (...args: unknown[]) => void) => void;
61
+ once: (event: string, listener: (...args: unknown[]) => void) => void;
62
+ off: (event: string, listener: (...args: unknown[]) => void) => void;
63
+ }
64
+ declare module '../../node' {
65
+ interface BrowserCommandContext {
66
+ browser: WebdriverIO.Browser;
67
+ }
68
+ interface _BrowserNames {
69
+ webdriverio: WebdriverBrowser;
70
+ }
71
+ interface ToMatchScreenshotOptions extends Omit<ScreenshotMatcherOptions, "comparatorName" | "comparatorOptions">, CustomComparatorsRegistry {}
72
+ interface ToMatchScreenshotComparators extends ScreenshotComparatorRegistry {}
73
+ interface CDPSession extends WebdriverCDPSession {}
74
+ }
75
+
76
+ export { WebdriverBrowserProvider, webdriverio };
77
+ export type { WebdriverProviderOptions };
@@ -1 +1 @@
1
- export * from '@voidzero-dev/vite-plus-test/browser/providers/webdriverio';
1
+ export * from '@vitest/browser-webdriverio';
@@ -0,0 +1,2 @@
1
+ import '@vitest/browser';
2
+ export { asLocator, defineBrowserCommand, defineBrowserProvider, parseKeyDef, resolveScreenshotPath } from '@vitest/browser';
@@ -1 +1 @@
1
- export * from '@voidzero-dev/vite-plus-test/browser-compat';
1
+ export { asLocator, defineBrowserCommand, defineBrowserProvider, parseKeyDef, resolveScreenshotPath } from '@vitest/browser';
@@ -0,0 +1 @@
1
+ export * from '../_at-vitest-browser/context'
@@ -0,0 +1 @@
1
+ export * from '@vitest/browser/context';