vite-plus 0.1.23 → 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-aSGY0osq.js → agent-BD31CsvU.js} +969 -89
  8. package/dist/bin.js +29 -33
  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 +7 -1
  13. package/dist/create/bin.js +578 -266
  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 +301 -84
  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 +150 -417
  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-DlUVXT3J.js → tsconfig-CJ_StdFc.js} +605 -263
  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 +7 -7
  149. package/dist/{workspace-DElv730L.js → workspace-Cjoc1c_A.js} +20 -18
  150. package/docs/_data/team.ts +5 -4
  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 +9 -3
  157. package/docs/guide/install.md +46 -10
  158. package/docs/guide/migrate.md +13 -3
  159. package/docs/guide/troubleshooting.md +3 -29
  160. package/docs/guide/upgrade.md +36 -6
  161. package/docs/package.json +3 -3
  162. package/docs/pnpm-lock.yaml +298 -395
  163. package/package.json +104 -56
  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 };