vite-plus 1.3.0 → 1.5.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 (106) hide show
  1. package/AGENTS.md +4 -0
  2. package/LICENSE +1 -878
  3. package/README.md +1 -1
  4. package/bin/vpx +9 -0
  5. package/binding/index.cjs +59 -54
  6. package/binding/index.d.cts +159 -2
  7. package/dist/{agent-97KmGCyL.js → agent-DkQD3xqe.js} +5 -7
  8. package/dist/bin.js +35 -34
  9. package/dist/{cli-parse-DHE8NrBU.js → cli-parse-aeUeFDlC.js} +2 -3
  10. package/dist/command-TjS_6y9O.js +1 -0
  11. package/dist/{command-CdMBoZFD.js → command-rY79K5NI.js} +28 -30
  12. package/dist/{comparison-CmVirWIW-DUGaiYqF.js → comparison-CmVirWIW-UlEf2maz.js} +1 -2
  13. package/dist/config/bin.js +8 -10
  14. package/dist/{constants-DR55DpRm.js → constants-D2P2aVKb.js} +8 -6
  15. package/dist/create/bin.d.ts +4 -8
  16. package/dist/create/bin.js +151 -120
  17. package/dist/{define-config-Bexdd6RZ.d.ts → define-config-BrvHRi-G.d.ts} +31 -13
  18. package/dist/{define-config-BxDc_9BK.cjs → define-config-CwtQqYC1.cjs} +41 -14
  19. package/dist/{define-config-CvE5pHqB.js → define-config-wR57OZG_.js} +34 -12
  20. package/dist/define-config.cjs +2 -1
  21. package/dist/define-config.d.ts +2 -2
  22. package/dist/define-config.js +1 -1
  23. package/dist/{dist-DIpm7mot.js → dist-Bs0SObNC.js} +73 -145
  24. package/dist/{dist-Cqz8OtiO.js → dist-CdkMvIiQ.js} +11 -5
  25. package/dist/dist-zDZV5eEc.js +3 -0
  26. package/dist/{documentation-DqcZSthV.js → documentation-cv_y0Auv.js} +1 -2
  27. package/dist/{editor-CtJGQP7C.js → editor-aOy1T15H.js} +2735 -5072
  28. package/dist/{help-BmKpeOP9.js → help-B03t_iQ4.js} +1 -2
  29. package/dist/hooks/bin.js +4 -5
  30. package/dist/{hooks-DhwsWb46.js → hooks-w_e2whkQ.js} +45 -25
  31. package/dist/index.cjs +5 -5
  32. package/dist/index.d.ts +2 -2
  33. package/dist/index.js +2 -2
  34. package/dist/{json-JP24qHUF.js → json-kl84kDyH.js} +9 -18
  35. package/dist/lint-plugins.cjs +1 -1
  36. package/dist/migration/bin.js +1782 -256
  37. package/dist/migration/compat/worker.js +4 -6
  38. package/dist/{oxlint-plugin-config-BIzrO2y2.js → oxlint-plugin-config-CHsI_zKo.js} +3 -4
  39. package/dist/oxlint-plugin.d.ts +0 -2
  40. package/dist/oxlint-plugin.js +33 -9
  41. package/dist/{pack-BK38MLVZ.d.ts → pack-ARPFMefW.d.ts} +0 -2
  42. package/dist/pack-bin.d.ts +1 -3
  43. package/dist/pack-bin.js +4 -5
  44. package/dist/pack.d.ts +1 -1
  45. package/dist/{package-CQDXTm6j.js → package-DfFo6-E-.js} +10 -95
  46. package/dist/{package-overrides-D1RcXSFl.js → package-overrides-Ci8GXouY.js} +5 -8
  47. package/dist/picomatch-DEUoj81q.js +1916 -0
  48. package/dist/{prompts-1xNz_ne0.js → prompts-C7DI63WP.js} +30 -50
  49. package/dist/{protocol-D99W10Qi.js → protocol-CkNmY-Mr.js} +1 -2
  50. package/dist/register.d.ts +1 -0
  51. package/dist/register.js +12 -0
  52. package/dist/{report-NhQk8VHb.js → report-BEdpIQvC.js} +4 -2
  53. package/dist/resolve-vite-config-33bzSaeT.js +1 -0
  54. package/dist/{resolve-vite-config-BVr1SUNg.js → resolve-vite-config-Cx3cnVVI.js} +9 -25
  55. package/dist/{rolldown-runtime-kJ_i4yPo.js → rolldown-runtime-DegdyBIC.js} +1 -2
  56. package/dist/script-esm-hooks.d.ts +11 -0
  57. package/dist/script-esm-hooks.js +27 -0
  58. package/dist/script-hooks-9Fof5UMY.js +176 -0
  59. package/dist/script-preload.cjs +491 -0
  60. package/dist/script-register.d.ts +1 -0
  61. package/dist/script-register.js +27 -0
  62. package/dist/script-watch.d.ts +1 -0
  63. package/dist/script-watch.js +2002 -0
  64. package/dist/staged/bin.js +53 -2011
  65. package/dist/sync-versions/bin.js +26 -48
  66. package/dist/sync-versions/bin.mjs +109 -217
  67. package/dist/{terminal-MKGAuy-p.js → terminal-BcuPUy-j.js} +1 -2
  68. package/dist/toolchain.js +38 -12
  69. package/dist/toolchain.json +38 -12
  70. package/dist/{tsconfig-zWgHiQ3X.js → tsconfig-BE3Wj9OX.js} +1 -1
  71. package/dist/{tsconfig-BZu7kl-x.js → tsconfig-shNmmCE_.js} +8 -10
  72. package/dist/version.d.ts +1 -3
  73. package/dist/version.js +5 -6
  74. package/dist/versions.js +7 -7
  75. package/dist/{vitest-ecosystem-BU0AqZq-.js → vitest-ecosystem-BeEYz-qF.js} +1 -2
  76. package/dist/{vitest-v5-entry-points-DthU1e_O.js → vitest-v5-entry-points-NyJsFeux.js} +1 -2
  77. package/dist/vpx-bin.d.ts +1 -0
  78. package/dist/vpx-bin.js +232 -0
  79. package/dist/vpx-script-EXgV5QOf.js +434 -0
  80. package/docs/config/check.md +2 -0
  81. package/docs/config/fmt.md +1 -1
  82. package/docs/config/lint.md +1 -1
  83. package/docs/config/run.md +10 -2
  84. package/docs/config/staged.md +1 -1
  85. package/docs/guide/check.md +6 -1
  86. package/docs/guide/ci.md +13 -3
  87. package/docs/guide/create.md +1 -1
  88. package/docs/guide/env.md +11 -4
  89. package/docs/guide/global-cli.md +59 -3
  90. package/docs/guide/homebrew.md +127 -0
  91. package/docs/guide/ide-integration.md +1 -3
  92. package/docs/guide/implode.md +5 -3
  93. package/docs/guide/local-cli.md +21 -0
  94. package/docs/guide/migrate-rules.md +120 -18
  95. package/docs/guide/migrate.md +9 -9
  96. package/docs/guide/package-management.md +1 -1
  97. package/docs/guide/run.md +23 -1
  98. package/docs/guide/test.md +1 -1
  99. package/docs/guide/troubleshooting.md +1 -1
  100. package/docs/guide/upgrade.md +12 -6
  101. package/docs/guide/vitest-v5.md +2 -2
  102. package/docs/guide/vpx.md +210 -9
  103. package/package.json +43 -34
  104. package/dist/command-DVTILtS-.js +0 -1
  105. package/dist/dist-Dhu07wmN.js +0 -3
  106. package/dist/resolve-vite-config-7WDtXO4G.js +0 -1
@@ -1,10 +1,9 @@
1
- import { t as PackUserConfig } from "./pack-BK38MLVZ.js";
2
- import { PluginOption, UserConfig } from "vite";
1
+ import { t as PackUserConfig } from "./pack-ARPFMefW.js";
2
+ import { PluginOption, ResolvedConfig, UserConfig } from "vite";
3
3
  import { ConfigEnv, UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig } from "vitest/config";
4
4
  import { OxfmtConfig } from "oxfmt";
5
5
  import { OxlintConfig } from "oxlint";
6
6
  import { InlineConfig } from "vitest/node";
7
- //#region src/create/org-manifest.d.ts
8
7
  /**
9
8
  * A single template entry shared by org manifests (`createConfig.templates`)
10
9
  * and local monorepo config (`create.templates` in `vite.config.ts`).
@@ -14,8 +13,6 @@ interface CreateTemplateEntry {
14
13
  description: string;
15
14
  template: string;
16
15
  }
17
- //#endregion
18
- //#region src/run-config.d.ts
19
16
  type AutoTracking = {
20
17
  /**
21
18
  * Enable automatic file tracking for this input or output list.
@@ -156,8 +153,6 @@ type RunConfig = {
156
153
  */
157
154
  enablePrePostScripts?: boolean;
158
155
  };
159
- //#endregion
160
- //#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/config.d.ts
161
156
  /**
162
157
  * A single task that will be spawned
163
158
  *
@@ -223,11 +218,7 @@ type TaskFunction = {
223
218
  };
224
219
  /** An entire `lint-staged` configuration, or a function that returns one */
225
220
  type Configuration = Record<string, SpawnedTask | TaskFunction | GenerateTask | SequentialTasks> | GenerateTask;
226
- //#endregion
227
- //#region src/staged-config.d.ts
228
221
  type StagedConfig = Configuration;
229
- //#endregion
230
- //#region src/define-config.d.ts
231
222
  declare module 'vite' {
232
223
  interface UserConfig {
233
224
  /**
@@ -427,7 +418,34 @@ declare function defineProject$1(config: UserProjectConfigExport): UserProjectCo
427
418
  * all load plugins.
428
419
  */
429
420
  declare function withConfigMetadataResolution<T>(fn: () => Promise<T>): Promise<T>;
421
+ interface ResolveConfigFromFileOptions {
422
+ /**
423
+ * Base directory for an unset or relative `root` in the config file.
424
+ * Defaults to the config file's parent directory.
425
+ * Relative paths resolve from `process.cwd()`. Does not change the process cwd.
426
+ */
427
+ rootBase?: string;
428
+ }
429
+ /**
430
+ * Resolve a Vite config file to read a non-plugin block (`lint`, `fmt`, `pack`, …) from it,
431
+ * for tools such as oxlint, oxfmt, and Vite+ itself.
432
+ *
433
+ * With an absolute `configFile`, default resolution of the initial `root` from the
434
+ * config file is independent of `process.cwd()`: an unset or relative `root`
435
+ * resolves from the config file's parent directory.
436
+ * Callers can supply `rootBase` to use a different project directory,
437
+ * such as when the config is in a subdirectory. Absolute roots are preserved.
438
+ * Plugin hooks can later change `root` using Vite's normal semantics. For example,
439
+ * a relative `root` returned by a `config` hook resolves from `process.cwd()`.
440
+ *
441
+ * Relative `configFile` and explicit `rootBase` paths still resolve from `process.cwd()`.
442
+ * The helper does not change the process cwd; config code and plugins can still read it.
443
+ * The resolver loads the config once, as a config-metadata resolution,
444
+ * so `lazyPlugins` skips its factory.
445
+ * Plugins outside `lazyPlugins` still run their hooks and side effects,
446
+ * e.g. TanStack Start's router generator scans `src/routes`.
447
+ */
448
+ declare function resolveConfigFromFile(configFile: string, options?: ResolveConfigFromFileOptions): Promise<ResolvedConfig>;
430
449
  declare function lazyPlugins(cb: () => PluginOption[]): PluginOption[] | undefined;
431
450
  declare function lazyPlugins(cb: () => Promise<PluginOption[]>): PluginOption[] | undefined;
432
- //#endregion
433
- export { defineConfig$1 as a, lazyPlugins as c, computeAutoInlineList as i, resolveCoverageProviderToCheck as l, assertCoverageProviderVersionMatch as n, defineProject$1 as o, checkCoverageProviderVersion as r, isVitestFamilySpecifier as s, AUTO_INLINE_DEPS as t, withConfigMetadataResolution as u };
451
+ export { computeAutoInlineList as a, isVitestFamilySpecifier as c, resolveCoverageProviderToCheck as d, withConfigMetadataResolution as f, checkCoverageProviderVersion as i, lazyPlugins as l, ResolveConfigFromFileOptions as n, defineConfig$1 as o, assertCoverageProviderVersionMatch as r, defineProject$1 as s, AUTO_INLINE_DEPS as t, resolveConfigFromFile as u };
@@ -1,4 +1,4 @@
1
- //#region \0rolldown/runtime.js
1
+ // \0rolldown/runtime.js
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -31,14 +31,13 @@ var __copyProps = (to, from, except, desc) => {
31
31
  return to;
32
32
  };
33
33
  var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
- //#endregion
35
34
  let node_fs = require("node:fs");
36
35
  let node_module = require("node:module");
37
36
  let node_path = require("node:path");
38
37
  let node_url = require("node:url");
39
38
  let vite = require("vite");
40
39
  let vitest_config = require("vitest/config");
41
- //#region ../../node_modules/.pnpm/@voidzero-dev+vite-task-client@0.2.0/node_modules/@voidzero-dev/vite-task-client/src/index.js
40
+ // ../../node_modules/.pnpm/@voidzero-dev+vite-task-client@0.2.0/node_modules/@voidzero-dev/vite-task-client/src/index.js
42
41
  function load() {
43
42
  if (addon !== void 0) return addon;
44
43
  try {
@@ -75,19 +74,17 @@ function ignoreOutput(path) {
75
74
  }
76
75
  var addon;
77
76
  var init_src = __esmMin((() => {}));
78
- //#endregion
79
- //#region package.json
80
- var version = "1.3.0", VITE_PLUS_VERSION, VITEST_VERSION, CONFIG_METADATA_ENV;
77
+ // package.json
78
+ var version = "1.5.0", VITE_PLUS_VERSION, VITEST_VERSION, CONFIG_METADATA_ENV;
81
79
  var init_constants = __esmMin((() => {
82
80
  VITE_PLUS_VERSION = process.env.VP_VERSION || version;
83
- VITEST_VERSION = "5.0.5";
81
+ VITEST_VERSION = "5.1.0";
84
82
  process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : `${VITE_PLUS_VERSION}`;
85
83
  (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
86
84
  process.versions.node, process.release.name;
87
85
  CONFIG_METADATA_ENV = "VP_RESOLVING_CONFIG_METADATA";
88
86
  }));
89
- //#endregion
90
- //#region src/utils/vitest-ecosystem.ts
87
+ // src/utils/vitest-ecosystem.ts
91
88
  var VITEST_EXACT_VERSION_PACKAGES, VITEST_RESOLVER_PACKAGES;
92
89
  var init_vitest_ecosystem = __esmMin((() => {
93
90
  VITEST_EXACT_VERSION_PACKAGES = /* @__PURE__ */ new Set([
@@ -106,8 +103,7 @@ var init_vitest_ecosystem = __esmMin((() => {
106
103
  ]);
107
104
  VITEST_RESOLVER_PACKAGES = /* @__PURE__ */ new Set(["vitest", ...VITEST_EXACT_VERSION_PACKAGES]);
108
105
  }));
109
- //#endregion
110
- //#region src/define-config.ts
106
+ // src/define-config.ts
111
107
  var define_config_exports = /* @__PURE__ */ __exportAll({
112
108
  AUTO_INLINE_DEPS: () => AUTO_INLINE_DEPS,
113
109
  assertCoverageProviderVersionMatch: () => assertCoverageProviderVersionMatch,
@@ -117,6 +113,7 @@ var define_config_exports = /* @__PURE__ */ __exportAll({
117
113
  defineProject: () => defineProject,
118
114
  isVitestFamilySpecifier: () => isVitestFamilySpecifier,
119
115
  lazyPlugins: () => lazyPlugins,
116
+ resolveConfigFromFile: () => resolveConfigFromFile,
120
117
  resolveCoverageProviderToCheck: () => resolveCoverageProviderToCheck,
121
118
  withConfigMetadataResolution: () => withConfigMetadataResolution
122
119
  });
@@ -507,7 +504,7 @@ function vitePlusVitestCachePathsPlugin() {
507
504
  }
508
505
  function withoutVitePlusTestPlugins(plugin) {
509
506
  if (Array.isArray(plugin)) return plugin.filter(keepUserPlugin).map(withoutVitePlusTestPlugins);
510
- if (plugin instanceof Promise) return plugin.then(withoutVitePlusTestPlugins);
507
+ if (plugin instanceof Promise) return plugin;
511
508
  return plugin && VITE_PLUS_TEST_PLUGIN_NAMES.has(plugin.name) ? false : plugin;
512
509
  }
513
510
  function keepUserPlugin(plugin) {
@@ -639,13 +636,37 @@ async function withConfigMetadataResolution(fn) {
639
636
  }
640
637
  }
641
638
  }
639
+ /**
640
+ * Resolve a Vite config file to read a non-plugin block (`lint`, `fmt`, `pack`, …) from it,
641
+ * for tools such as oxlint, oxfmt, and Vite+ itself.
642
+ *
643
+ * With an absolute `configFile`, default resolution of the initial `root` from the
644
+ * config file is independent of `process.cwd()`: an unset or relative `root`
645
+ * resolves from the config file's parent directory.
646
+ * Callers can supply `rootBase` to use a different project directory,
647
+ * such as when the config is in a subdirectory. Absolute roots are preserved.
648
+ * Plugin hooks can later change `root` using Vite's normal semantics. For example,
649
+ * a relative `root` returned by a `config` hook resolves from `process.cwd()`.
650
+ *
651
+ * Relative `configFile` and explicit `rootBase` paths still resolve from `process.cwd()`.
652
+ * The helper does not change the process cwd; config code and plugins can still read it.
653
+ * The resolver loads the config once, as a config-metadata resolution,
654
+ * so `lazyPlugins` skips its factory.
655
+ * Plugins outside `lazyPlugins` still run their hooks and side effects,
656
+ * e.g. TanStack Start's router generator scans `src/routes`.
657
+ */
658
+ async function resolveConfigFromFile(configFile, options = {}) {
659
+ if (configFile.length === 0) throw new Error("Config file path must not be empty.");
660
+ const rootBase = (0, node_path.resolve)(options.rootBase ?? (0, node_path.dirname)((0, node_path.resolve)(configFile)));
661
+ return withConfigMetadataResolution(() => resolveConfigWithInternalOptions({ configFile }, "build", void 0, void 0, void 0, void 0, void 0, { rootBase }));
662
+ }
642
663
  function lazyPlugins(cb) {
643
664
  if (process.env["VP_RESOLVING_CONFIG_METADATA"] === "1") return;
644
665
  const result = cb();
645
666
  if (result instanceof Promise) return [result];
646
667
  return result;
647
668
  }
648
- var vitePlusRequire, vitePlusModuleFile, vitestAnchor, vitestExports, AUTO_INLINE_DEPS, KNOWN_COVERAGE_PROVIDERS, bundledVitestAnchorCache, coverageGuardedVitestInstances, VITE_PLUS_TEST_PLUGIN_NAMES, configMetadataDepth, configMetadataSavedValue;
669
+ var vitePlusRequire, vitePlusModuleFile, vitestAnchor, vitestExports, AUTO_INLINE_DEPS, KNOWN_COVERAGE_PROVIDERS, bundledVitestAnchorCache, coverageGuardedVitestInstances, VITE_PLUS_TEST_PLUGIN_NAMES, configMetadataDepth, configMetadataSavedValue, resolveConfigWithInternalOptions;
649
670
  var init_define_config = __esmMin((() => {
650
671
  init_src();
651
672
  init_constants();
@@ -666,8 +687,8 @@ var init_define_config = __esmMin((() => {
666
687
  "vite-plus:vitest-cache-paths"
667
688
  ]);
668
689
  configMetadataDepth = 0;
690
+ resolveConfigWithInternalOptions = vite.resolveConfig;
669
691
  }));
670
- //#endregion
671
692
  Object.defineProperty(exports, "AUTO_INLINE_DEPS", {
672
693
  enumerable: true,
673
694
  get: function() {
@@ -734,6 +755,12 @@ Object.defineProperty(exports, "lazyPlugins", {
734
755
  return lazyPlugins;
735
756
  }
736
757
  });
758
+ Object.defineProperty(exports, "resolveConfigFromFile", {
759
+ enumerable: true,
760
+ get: function() {
761
+ return resolveConfigFromFile;
762
+ }
763
+ });
737
764
  Object.defineProperty(exports, "resolveCoverageProviderToCheck", {
738
765
  enumerable: true,
739
766
  get: function() {
@@ -1,17 +1,16 @@
1
- import { c as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-DR55DpRm.js";
2
- import { t as VITEST_RESOLVER_PACKAGES } from "./vitest-ecosystem-BU0AqZq-.js";
1
+ import { c as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-D2P2aVKb.js";
2
+ import { t as VITEST_RESOLVER_PACKAGES } from "./vitest-ecosystem-BeEYz-qF.js";
3
3
  import { createRequire } from "node:module";
4
- import path, { join, resolve } from "node:path";
4
+ import path, { dirname, join, resolve } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { readFileSync } from "node:fs";
7
- import { searchForWorkspaceRoot } from "vite";
7
+ import { resolveConfig, searchForWorkspaceRoot } from "vite";
8
8
  import { defineConfig, defineProject } from "vitest/config";
9
- //#region ../../node_modules/.pnpm/tsdown@0.23.1_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.1_@tsdown+exe@0.23.1_@type_1c5668b23b89ab367f1fd43e24d0d72d/node_modules/tsdown/esm-shims.js
9
+ // ../../node_modules/.pnpm/tsdown@0.23.4_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.4_@tsdown+exe@0.23.4_@type_9df9dd7c3062027a6d643d1d1e50c648/node_modules/tsdown/esm-shims.js
10
10
  const getFilename = () => fileURLToPath(import.meta.url);
11
11
  const getDirname = () => path.dirname(getFilename());
12
12
  const __dirname = /* @__PURE__ */ getDirname();
13
- //#endregion
14
- //#region ../../node_modules/.pnpm/@voidzero-dev+vite-task-client@0.2.0/node_modules/@voidzero-dev/vite-task-client/src/index.js
13
+ // ../../node_modules/.pnpm/@voidzero-dev+vite-task-client@0.2.0/node_modules/@voidzero-dev/vite-task-client/src/index.js
15
14
  /**
16
15
  * @typedef {{ tracked?: boolean }} GetEnvOptions
17
16
  */
@@ -67,8 +66,7 @@ function ignoreInput(path) {
67
66
  function ignoreOutput(path) {
68
67
  load()?.ignoreOutput(path);
69
68
  }
70
- //#endregion
71
- //#region src/define-config.ts
69
+ // src/define-config.ts
72
70
  /**
73
71
  * `require` anchored at THIS module's location so `require.resolve` reaches
74
72
  * the `vitest` / `@vitest/*` family that the `vite-plus` package directly
@@ -553,7 +551,7 @@ const VITE_PLUS_TEST_PLUGIN_NAMES = /* @__PURE__ */ new Set([
553
551
  ]);
554
552
  function withoutVitePlusTestPlugins(plugin) {
555
553
  if (Array.isArray(plugin)) return plugin.filter(keepUserPlugin).map(withoutVitePlusTestPlugins);
556
- if (plugin instanceof Promise) return plugin.then(withoutVitePlusTestPlugins);
554
+ if (plugin instanceof Promise) return plugin;
557
555
  return plugin && VITE_PLUS_TEST_PLUGIN_NAMES.has(plugin.name) ? false : plugin;
558
556
  }
559
557
  function keepUserPlugin(plugin) {
@@ -687,11 +685,35 @@ async function withConfigMetadataResolution(fn) {
687
685
  }
688
686
  }
689
687
  }
688
+ const resolveConfigWithInternalOptions = resolveConfig;
689
+ /**
690
+ * Resolve a Vite config file to read a non-plugin block (`lint`, `fmt`, `pack`, …) from it,
691
+ * for tools such as oxlint, oxfmt, and Vite+ itself.
692
+ *
693
+ * With an absolute `configFile`, default resolution of the initial `root` from the
694
+ * config file is independent of `process.cwd()`: an unset or relative `root`
695
+ * resolves from the config file's parent directory.
696
+ * Callers can supply `rootBase` to use a different project directory,
697
+ * such as when the config is in a subdirectory. Absolute roots are preserved.
698
+ * Plugin hooks can later change `root` using Vite's normal semantics. For example,
699
+ * a relative `root` returned by a `config` hook resolves from `process.cwd()`.
700
+ *
701
+ * Relative `configFile` and explicit `rootBase` paths still resolve from `process.cwd()`.
702
+ * The helper does not change the process cwd; config code and plugins can still read it.
703
+ * The resolver loads the config once, as a config-metadata resolution,
704
+ * so `lazyPlugins` skips its factory.
705
+ * Plugins outside `lazyPlugins` still run their hooks and side effects,
706
+ * e.g. TanStack Start's router generator scans `src/routes`.
707
+ */
708
+ async function resolveConfigFromFile(configFile, options = {}) {
709
+ if (configFile.length === 0) throw new Error("Config file path must not be empty.");
710
+ const rootBase = resolve(options.rootBase ?? dirname(resolve(configFile)));
711
+ return withConfigMetadataResolution(() => resolveConfigWithInternalOptions({ configFile }, "build", void 0, void 0, void 0, void 0, void 0, { rootBase }));
712
+ }
690
713
  function lazyPlugins(cb) {
691
714
  if (process.env["VP_RESOLVING_CONFIG_METADATA"] === "1") return;
692
715
  const result = cb();
693
716
  if (result instanceof Promise) return [result];
694
717
  return result;
695
718
  }
696
- //#endregion
697
- export { defineConfig$1 as a, lazyPlugins as c, computeAutoInlineList as i, resolveCoverageProviderToCheck as l, assertCoverageProviderVersionMatch as n, defineProject$1 as o, checkCoverageProviderVersion as r, isVitestFamilySpecifier as s, AUTO_INLINE_DEPS as t, withConfigMetadataResolution as u };
719
+ export { defineConfig$1 as a, lazyPlugins as c, withConfigMetadataResolution as d, computeAutoInlineList as i, resolveConfigFromFile as l, assertCoverageProviderVersionMatch as n, defineProject$1 as o, checkCoverageProviderVersion as r, isVitestFamilySpecifier as s, AUTO_INLINE_DEPS as t, resolveCoverageProviderToCheck as u };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_define_config = require("./define-config-BxDc_9BK.cjs");
2
+ const require_define_config = require("./define-config-CwtQqYC1.cjs");
3
3
  require_define_config.init_define_config();
4
4
  exports.AUTO_INLINE_DEPS = require_define_config.AUTO_INLINE_DEPS;
5
5
  exports.assertCoverageProviderVersionMatch = require_define_config.assertCoverageProviderVersionMatch;
@@ -9,5 +9,6 @@ exports.defineConfig = require_define_config.defineConfig;
9
9
  exports.defineProject = require_define_config.defineProject;
10
10
  exports.isVitestFamilySpecifier = require_define_config.isVitestFamilySpecifier;
11
11
  exports.lazyPlugins = require_define_config.lazyPlugins;
12
+ exports.resolveConfigFromFile = require_define_config.resolveConfigFromFile;
12
13
  exports.resolveCoverageProviderToCheck = require_define_config.resolveCoverageProviderToCheck;
13
14
  exports.withConfigMetadataResolution = require_define_config.withConfigMetadataResolution;
@@ -1,2 +1,2 @@
1
- import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-Bexdd6RZ.js";
2
- export { AUTO_INLINE_DEPS, assertCoverageProviderVersionMatch, checkCoverageProviderVersion, computeAutoInlineList, defineConfig, defineProject, isVitestFamilySpecifier, lazyPlugins, resolveCoverageProviderToCheck, withConfigMetadataResolution };
1
+ import { a as computeAutoInlineList, c as isVitestFamilySpecifier, d as resolveCoverageProviderToCheck, f as withConfigMetadataResolution, i as checkCoverageProviderVersion, l as lazyPlugins, n as ResolveConfigFromFileOptions, o as defineConfig, r as assertCoverageProviderVersionMatch, s as defineProject, t as AUTO_INLINE_DEPS, u as resolveConfigFromFile } from "./define-config-BrvHRi-G.js";
2
+ export { AUTO_INLINE_DEPS, ResolveConfigFromFileOptions, assertCoverageProviderVersionMatch, checkCoverageProviderVersion, computeAutoInlineList, defineConfig, defineProject, isVitestFamilySpecifier, lazyPlugins, resolveConfigFromFile, resolveCoverageProviderToCheck, withConfigMetadataResolution };
@@ -1 +1 @@
1
- export { t as AUTO_INLINE_DEPS, n as assertCoverageProviderVersionMatch, r as checkCoverageProviderVersion, i as computeAutoInlineList, a as defineConfig, o as defineProject, s as isVitestFamilySpecifier, c as lazyPlugins, l as resolveCoverageProviderToCheck, u as withConfigMetadataResolution } from "./define-config-CvE5pHqB.js";
1
+ export { t as AUTO_INLINE_DEPS, n as assertCoverageProviderVersionMatch, r as checkCoverageProviderVersion, i as computeAutoInlineList, a as defineConfig, o as defineProject, s as isVitestFamilySpecifier, c as lazyPlugins, l as resolveConfigFromFile, u as resolveCoverageProviderToCheck, d as withConfigMetadataResolution } from "./define-config-wR57OZG_.js";