vite-plus 1.4.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 (68) hide show
  1. package/binding/index.cjs +54 -54
  2. package/binding/index.d.cts +31 -0
  3. package/dist/{agent-D8oxxhVR.js → agent-DkQD3xqe.js} +2 -2
  4. package/dist/bin.js +15 -7
  5. package/dist/config/bin.js +5 -5
  6. package/dist/{constants-DRUnJ_Dz.js → constants-D2P2aVKb.js} +6 -2
  7. package/dist/create/bin.js +114 -64
  8. package/dist/{define-config-rPhYIFSn.d.ts → define-config-BrvHRi-G.d.ts} +30 -2
  9. package/dist/{define-config-Cv2P6NT2.cjs → define-config-CwtQqYC1.cjs} +35 -3
  10. package/dist/{define-config-ChwJcu5e.js → define-config-wR57OZG_.js} +30 -5
  11. package/dist/define-config.cjs +2 -1
  12. package/dist/define-config.d.ts +2 -2
  13. package/dist/define-config.js +1 -1
  14. package/dist/{editor-ClL78D8u.js → editor-aOy1T15H.js} +1266 -884
  15. package/dist/hooks/bin.js +2 -2
  16. package/dist/{hooks-xRcJPc-O.js → hooks-w_e2whkQ.js} +40 -21
  17. package/dist/index.cjs +4 -3
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.js +2 -2
  20. package/dist/lint-plugins.cjs +1 -1
  21. package/dist/migration/bin.js +1302 -311
  22. package/dist/migration/compat/worker.js +1 -1
  23. package/dist/{oxlint-plugin-config-BVpqYdcC.js → oxlint-plugin-config-CHsI_zKo.js} +1 -1
  24. package/dist/oxlint-plugin.js +29 -4
  25. package/dist/pack-bin.js +2 -2
  26. package/dist/{package-DzsomcUD.js → package-DfFo6-E-.js} +1 -1
  27. package/dist/{prompts-GL1vj0wk.js → prompts-C7DI63WP.js} +3 -3
  28. package/dist/register.d.ts +1 -0
  29. package/dist/register.js +12 -0
  30. package/dist/{report-DLHO30yZ.js → report-BEdpIQvC.js} +2 -0
  31. package/dist/{resolve-vite-config-QO6cC0SP.js → resolve-vite-config-33bzSaeT.js} +1 -1
  32. package/dist/{resolve-vite-config-Dn5896A4.js → resolve-vite-config-Cx3cnVVI.js} +2 -2
  33. package/dist/script-esm-hooks.d.ts +5 -2
  34. package/dist/script-esm-hooks.js +5 -2
  35. package/dist/script-preload.cjs +24 -1
  36. package/dist/script-register.js +7 -2
  37. package/dist/script-watch.js +135 -41
  38. package/dist/staged/bin.js +2 -2
  39. package/dist/sync-versions/bin.js +1 -1
  40. package/dist/toolchain.js +13 -13
  41. package/dist/toolchain.json +13 -13
  42. package/dist/{tsconfig-Do6MAG_f.js → tsconfig-BE3Wj9OX.js} +1 -1
  43. package/dist/{tsconfig-LE_mAwe_.js → tsconfig-shNmmCE_.js} +2 -2
  44. package/dist/version.js +2 -2
  45. package/dist/versions.js +6 -6
  46. package/docs/config/check.md +2 -0
  47. package/docs/config/fmt.md +1 -1
  48. package/docs/config/lint.md +1 -1
  49. package/docs/config/run.md +6 -2
  50. package/docs/config/staged.md +1 -1
  51. package/docs/guide/check.md +5 -1
  52. package/docs/guide/ci.md +2 -2
  53. package/docs/guide/create.md +1 -1
  54. package/docs/guide/env.md +1 -1
  55. package/docs/guide/global-cli.md +12 -8
  56. package/docs/guide/homebrew.md +127 -0
  57. package/docs/guide/ide-integration.md +1 -3
  58. package/docs/guide/implode.md +5 -3
  59. package/docs/guide/local-cli.md +21 -0
  60. package/docs/guide/migrate-rules.md +81 -22
  61. package/docs/guide/migrate.md +9 -9
  62. package/docs/guide/run.md +23 -1
  63. package/docs/guide/test.md +1 -1
  64. package/docs/guide/troubleshooting.md +1 -1
  65. package/docs/guide/upgrade.md +12 -6
  66. package/docs/guide/vitest-v5.md +2 -2
  67. package/docs/guide/vpx.md +44 -4
  68. package/package.json +39 -33
@@ -1,17 +1,17 @@
1
1
  import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-DegdyBIC.js";
2
+ import { A as text, E as multiselect, M as isCancel, O as select, S as normalize$1, T as log, a as resolveGitInit, c as selectPackageManager, d as readYamlFile, h as resolveApproveBuildTargets, i as promptGitHooks, j as require_picocolors, k as spinner, m as detectGatedBuilds, n as defaultInteractive, o as runViteFmt, p as approveBuilds, r as downloadPackageManager$1, s as runViteInstall, t as cancelAndExit, u as editYamlFile, v as DependencyType, w as intro, y as PackageManager } from "../prompts-C7DI63WP.js";
3
+ import { $ as promptTsupMigration, B as isBingoTemplate, G as initGitRepository, H as updateWorkspaceConfig, I as createCatalogDependencyResolver, J as detectFramework, L as supportsCatalog, R as detectWorkspace$1, V as updatePackageJsonWithDeps, W as findGitRoot, Y as hasFrameworkShim, Z as detectTsupProject, a as selectEditors, c as rewriteMonorepoProject, h as setPackageManager, it as promptPrettierMigration, l as rewriteStandaloneProject, n as detectExistingEditors, nt as detectPrettierProject, o as writeEditorConfigs, q as addFrameworkShim, s as rewriteMonorepo, st as detectEslintProject, ut as promptEslintMigration, v as installGitHooks, w as injectCreateDefaultTemplate, x as shouldSkipStagedMigrationForHooks, z as discoverWorkspacePackages } from "../editor-aOy1T15H.js";
4
+ import { a as selectAgentTargets, c as writeCopilotSetupWorkflow, d as templatesDir, l as displayRelative, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, t as COPILOT_AGENT_ID } from "../agent-DkQD3xqe.js";
5
+ import { t as unwrapCliParseOutcome } from "../cli-parse-aeUeFDlC.js";
2
6
  import { t as documentationUrl$1 } from "../documentation-cv_y0Auv.js";
3
7
  import { t as renderCliDoc } from "../help-B03t_iQ4.js";
4
- import { a as muted, i as log, o as printHeader, r as formatDuration, s as success, t as accent } from "../terminal-BcuPUy-j.js";
5
- import { d as VITE_PLUS_OVERRIDE_PACKAGES, f as VITE_PLUS_VERSION, u as VITE_PLUS_NAME } from "../constants-DRUnJ_Dz.js";
6
8
  import { i as readJsonFile, n as editJsonFile } from "../json-kl84kDyH.js";
7
- import { c as getNpmRegistry, r as getScopeFromPackageName, s as fetchNpmResource, t as checkNpmPackageExists } from "../package-DzsomcUD.js";
8
- import { a as resolveViteConfig, r as hasViteConfig, t as findViteConfig } from "../resolve-vite-config-Dn5896A4.js";
9
- import { A as text, E as multiselect, M as isCancel, O as select, S as normalize$1, T as log$1, a as resolveGitInit, c as selectPackageManager, d as readYamlFile, h as resolveApproveBuildTargets, i as promptGitHooks, j as require_picocolors, k as spinner, m as detectGatedBuilds, n as defaultInteractive, o as runViteFmt, p as approveBuilds, r as downloadPackageManager$1, s as runViteInstall, t as cancelAndExit, u as editYamlFile, v as DependencyType, w as intro, y as PackageManager } from "../prompts-GL1vj0wk.js";
10
- import { a as selectAgentTargets, c as writeCopilotSetupWorkflow, d as templatesDir, l as displayRelative, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, t as COPILOT_AGENT_ID } from "../agent-D8oxxhVR.js";
11
- import { $ as promptTsupMigration, B as isBingoTemplate, G as initGitRepository, H as updateWorkspaceConfig, I as createCatalogDependencyResolver, J as detectFramework, L as supportsCatalog, R as detectWorkspace$1, V as updatePackageJsonWithDeps, W as findGitRoot, Y as hasFrameworkShim, Z as detectTsupProject, a as selectEditors, c as rewriteMonorepoProject, h as setPackageManager, it as promptPrettierMigration, l as rewriteStandaloneProject, n as detectExistingEditors, nt as detectPrettierProject, o as writeEditorConfigs, q as addFrameworkShim, s as rewriteMonorepo, st as detectEslintProject, ut as promptEslintMigration, v as installGitHooks, w as injectCreateDefaultTemplate, x as shouldSkipStagedMigrationForHooks, z as discoverWorkspacePackages } from "../editor-ClL78D8u.js";
12
- import { i as runCommandSilently, r as runCommand$1 } from "../command-rY79K5NI.js";
9
+ import { a as muted, i as log$1, o as printHeader, r as formatDuration, s as success, t as accent } from "../terminal-BcuPUy-j.js";
10
+ import { c as getNpmRegistry, r as getScopeFromPackageName, s as fetchNpmResource, t as checkNpmPackageExists } from "../package-DfFo6-E-.js";
11
+ import { a as resolveViteConfig, r as hasViteConfig, t as findViteConfig } from "../resolve-vite-config-Cx3cnVVI.js";
13
12
  import { t as require_dist } from "../dist-Bs0SObNC.js";
14
- import { t as unwrapCliParseOutcome } from "../cli-parse-aeUeFDlC.js";
13
+ import { d as VITE_PLUS_OVERRIDE_PACKAGES, f as VITE_PLUS_VERSION, u as VITE_PLUS_NAME } from "../constants-D2P2aVKb.js";
14
+ import { i as runCommandSilently, r as runCommand$1 } from "../command-rY79K5NI.js";
15
15
  import path from "node:path";
16
16
  import { findMonorepoRoot, getVpDirs, parseCreateArgs, removeConfigKey, runCommand, upsertJsonConfig, vitePlusHeader } from "../../binding/index.js";
17
17
  import { promisify, styleText } from "node:util";
@@ -1039,7 +1039,7 @@ function printNonInteractiveTable(manifest, orgSpec, isMonorepo) {
1039
1039
  }
1040
1040
  function rejectMonorepoEntryInsideMonorepo(entry, isMonorepo) {
1041
1041
  if (entry.monorepo && isMonorepo) {
1042
- log$1.info("You are already in a monorepo workspace.\nUse a different template or run this command outside the monorepo");
1042
+ log.info("You are already in a monorepo workspace.\nUse a different template or run this command outside the monorepo");
1043
1043
  cancelAndExit("Cannot create a monorepo inside an existing monorepo", 1);
1044
1044
  }
1045
1045
  }
@@ -1077,7 +1077,7 @@ async function resolveOrgManifestForCreate(args) {
1077
1077
  }
1078
1078
  if (!manifest) {
1079
1079
  if (orgSpec.name !== void 0) cancelAndExit(`No \`createConfig.templates\` manifest in ${orgSpec.scope}/create — \`@org:name\` requires one.`, 1);
1080
- log$1.info(`No \`createConfig.templates\` manifest in ${orgSpec.scope}/create — running it as a normal package.`);
1080
+ log.info(`No \`createConfig.templates\` manifest in ${orgSpec.scope}/create — running it as a normal package.`);
1081
1081
  return { kind: "passthrough" };
1082
1082
  }
1083
1083
  if (orgSpec.name === void 0) {
@@ -1088,7 +1088,7 @@ async function resolveOrgManifestForCreate(args) {
1088
1088
  const picked = await pickOrgTemplate(manifest, { isMonorepo: args.isMonorepo });
1089
1089
  if (picked === ORG_PICKER_CANCEL) cancelAndExit();
1090
1090
  if (picked === ORG_PICKER_BUILTIN_ESCAPE) {
1091
- if (args.isMonorepo && manifest.templates.every((t) => t.monorepo)) log$1.info(`No templates from ${manifest.packageName} are applicable inside a monorepo — showing Vite+ built-in templates instead.`);
1091
+ if (args.isMonorepo && manifest.templates.every((t) => t.monorepo)) log.info(`No templates from ${manifest.packageName} are applicable inside a monorepo — showing Vite+ built-in templates instead.`);
1092
1092
  return { kind: "escape-hatch" };
1093
1093
  }
1094
1094
  rejectMonorepoEntryInsideMonorepo(picked.entry, args.isMonorepo);
@@ -4277,7 +4277,7 @@ async function promptPackageNameAndTargetDir(defaultPackageName, interactive) {
4277
4277
  } else {
4278
4278
  packageName = defaultPackageName;
4279
4279
  targetDir = getProjectDirFromPackageName(packageName);
4280
- log$1.info(`Using default package name: ${accent(packageName)}`);
4280
+ log.info(`Using default package name: ${accent(packageName)}`);
4281
4281
  }
4282
4282
  return {
4283
4283
  packageName,
@@ -4297,7 +4297,7 @@ async function promptTargetDir(defaultTargetDir, interactive, options) {
4297
4297
  targetDir = validateTargetDir(selected ?? defaultTargetDir, options?.cwd).directory;
4298
4298
  } else {
4299
4299
  targetDir = validateTargetDir(defaultTargetDir, options?.cwd).directory;
4300
- log$1.info(`Using default target directory: ${accent(targetDir)}`);
4300
+ log.info(`Using default target directory: ${accent(targetDir)}`);
4301
4301
  }
4302
4302
  return targetDir;
4303
4303
  }
@@ -4310,26 +4310,57 @@ function suggestAvailableTargetDir(defaultTargetDir, cwd) {
4310
4310
  }
4311
4311
  return suggestedTargetDir;
4312
4312
  }
4313
+ function describeExistingTarget(projectDirFullPath, stats) {
4314
+ if (stats.isSymbolicLink()) {
4315
+ let linkedPath;
4316
+ try {
4317
+ linkedPath = fs.realpathSync(projectDirFullPath);
4318
+ } catch {
4319
+ linkedPath = path.resolve(path.dirname(projectDirFullPath), fs.readlinkSync(projectDirFullPath));
4320
+ }
4321
+ return {
4322
+ description: `Target path "${projectDirFullPath}" is a symbolic link to "${linkedPath}"`,
4323
+ removeLabel: "Remove symbolic link and continue"
4324
+ };
4325
+ }
4326
+ if (stats.isDirectory()) return {
4327
+ description: `Target directory "${projectDirFullPath}" is not empty`,
4328
+ removeLabel: "Remove existing files and continue"
4329
+ };
4330
+ return {
4331
+ description: `Target path "${projectDirFullPath}" already exists`,
4332
+ removeLabel: "Remove existing path and continue"
4333
+ };
4334
+ }
4335
+ function stripTrailingPathSeparators(targetPath) {
4336
+ const root = path.parse(targetPath).root;
4337
+ let end = targetPath.length;
4338
+ while (end > root.length && targetPath[end - 1] === path.sep) end--;
4339
+ return targetPath.slice(0, end);
4340
+ }
4313
4341
  async function checkProjectDirExists(projectDirFullPath, interactive) {
4314
- if (isTargetDirAvailable(projectDirFullPath)) return;
4342
+ const targetPath = stripTrailingPathSeparators(projectDirFullPath);
4343
+ const stats = fs.lstatSync(targetPath, { throwIfNoEntry: false });
4344
+ if (!stats || stats.isDirectory() && isEmpty(targetPath)) return;
4345
+ const { description, removeLabel } = describeExistingTarget(targetPath, stats);
4315
4346
  if (!interactive) {
4316
- log$1.info("Use --directory to specify a different location or remove the directory first");
4317
- cancelAndExit(`Target directory "${projectDirFullPath}" is not empty`, 1);
4347
+ log.info("Use --directory to specify a different location or remove the directory first");
4348
+ cancelAndExit(description, 1);
4318
4349
  }
4319
4350
  const overwrite = await select({
4320
- message: `Target directory "${projectDirFullPath}" is not empty. Please choose how to proceed:`,
4351
+ message: `${description}. Please choose how to proceed:`,
4321
4352
  options: [{
4322
4353
  label: "Cancel operation",
4323
4354
  value: "no"
4324
4355
  }, {
4325
- label: "Remove existing files and continue",
4356
+ label: removeLabel,
4326
4357
  value: "yes"
4327
4358
  }]
4328
4359
  });
4329
4360
  if (isCancel(overwrite)) cancelAndExit();
4330
4361
  switch (overwrite) {
4331
4362
  case "yes":
4332
- emptyDir(projectDirFullPath);
4363
+ clearTargetPath(targetPath, stats);
4333
4364
  break;
4334
4365
  case "no": cancelAndExit();
4335
4366
  }
@@ -4338,18 +4369,37 @@ function isEmpty(path) {
4338
4369
  const files = fs.readdirSync(path);
4339
4370
  return files.length === 0 || files.length === 1 && files[0] === ".git";
4340
4371
  }
4341
- function emptyDir(dir) {
4342
- if (!fs.existsSync(dir)) return;
4343
- for (const file of fs.readdirSync(dir)) {
4372
+ function isSameTargetEntry(expected, actual) {
4373
+ return expected.dev === actual.dev && expected.ino === actual.ino && expected.isDirectory() === actual.isDirectory() && expected.isSymbolicLink() === actual.isSymbolicLink();
4374
+ }
4375
+ function getUnchangedTargetStats(targetPath, expected, cleanupStarted = false) {
4376
+ const stats = fs.lstatSync(targetPath, { throwIfNoEntry: false });
4377
+ if (!stats) return;
4378
+ if (!isSameTargetEntry(expected, stats)) throw new Error(cleanupStarted ? `Target path "${targetPath}" changed during cleanup. Cleanup was stopped. Please inspect the target and retry the command.` : `Target path "${targetPath}" changed while waiting for confirmation. No files were removed. Please retry the command.`);
4379
+ return stats;
4380
+ }
4381
+ function clearTargetPath(targetPath, expectedStats) {
4382
+ const strippedTargetPath = stripTrailingPathSeparators(targetPath);
4383
+ const stats = getUnchangedTargetStats(strippedTargetPath, expectedStats);
4384
+ if (!stats) return;
4385
+ if (!stats.isDirectory()) {
4386
+ fs.unlinkSync(strippedTargetPath);
4387
+ return;
4388
+ }
4389
+ const files = fs.readdirSync(strippedTargetPath);
4390
+ for (const file of files) {
4344
4391
  if (file === ".git") continue;
4345
- fs.rmSync(path.resolve(dir, file), {
4392
+ if (!getUnchangedTargetStats(strippedTargetPath, expectedStats, true)) return;
4393
+ fs.rmSync(path.resolve(strippedTargetPath, file), {
4346
4394
  recursive: true,
4347
4395
  force: true
4348
4396
  });
4349
4397
  }
4350
4398
  }
4351
4399
  function isTargetDirAvailable(projectDirFullPath) {
4352
- return !fs.existsSync(projectDirFullPath) || isEmpty(projectDirFullPath);
4400
+ const targetPath = stripTrailingPathSeparators(projectDirFullPath);
4401
+ const stats = fs.lstatSync(targetPath, { throwIfNoEntry: false });
4402
+ return !stats || stats.isDirectory() && isEmpty(targetPath);
4353
4403
  }
4354
4404
  function validateTargetDir(input, cwd) {
4355
4405
  const value = input?.trim() ?? "";
@@ -4411,7 +4461,7 @@ async function registerLocalTemplate(workspaceRoot, entry, silent = false) {
4411
4461
  });
4412
4462
  const existingEntry = existing.templates.find((t) => t.name === entry.name);
4413
4463
  if (existingEntry) {
4414
- if (existingEntry.template !== entry.template) log$1.warn(`create.templates already has an entry named '${entry.name}' pointing at '${existingEntry.template}'; left unchanged.\nUpdate it by hand if it should run '${entry.template}' instead.`);
4464
+ if (existingEntry.template !== entry.template) log.warn(`create.templates already has an entry named '${entry.name}' pointing at '${existingEntry.template}'; left unchanged.\nUpdate it by hand if it should run '${entry.template}' instead.`);
4415
4465
  return;
4416
4466
  }
4417
4467
  const nextCreate = {
@@ -4429,7 +4479,7 @@ async function registerLocalTemplate(workspaceRoot, entry, silent = false) {
4429
4479
  function ensureViteConfig(workspaceRoot, silent) {
4430
4480
  const configPath = path.join(workspaceRoot, "vite.config.ts");
4431
4481
  fs.writeFileSync(configPath, `import { defineConfig } from '${VITE_PLUS_NAME}';\n\nexport default defineConfig({});\n`);
4432
- if (!silent) log$1.success(`✔ Created vite.config.ts in ${displayRelative(configPath)}`);
4482
+ if (!silent) log.success(`✔ Created vite.config.ts in ${displayRelative(configPath)}`);
4433
4483
  return configPath;
4434
4484
  }
4435
4485
  /**
@@ -4456,7 +4506,7 @@ function writeCreateBlock(configPath, create) {
4456
4506
  }
4457
4507
  // src/create/templates/generator.ts
4458
4508
  async function executeGeneratorScaffold(workspaceInfo, templateInfo, options) {
4459
- if (!options?.silent) log$1.step("Creating generator scaffold...");
4509
+ if (!options?.silent) log.step("Creating generator scaffold...");
4460
4510
  let description;
4461
4511
  if (templateInfo.interactive) {
4462
4512
  const defaultDescription = "Generate new components for our monorepo";
@@ -4479,7 +4529,7 @@ async function executeGeneratorScaffold(workspaceInfo, templateInfo, options) {
4479
4529
  if (description) pkg.description = description;
4480
4530
  return pkg;
4481
4531
  });
4482
- if (!options?.silent) log$1.success("Generator scaffold created");
4532
+ if (!options?.silent) log.success("Generator scaffold created");
4483
4533
  return {
4484
4534
  exitCode: 0,
4485
4535
  projectDir: templateInfo.targetDir
@@ -4490,14 +4540,14 @@ var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
4490
4540
  const { gray, yellow } = import_picocolors.default;
4491
4541
  async function executeRemoteTemplate(workspaceInfo, templateInfo, options) {
4492
4542
  const silent = options?.silent ?? false;
4493
- if (!silent) log$1.step("Generating project…");
4543
+ if (!silent) log.step("Generating project…");
4494
4544
  let isGitHubTemplate = templateInfo.command === "degit";
4495
4545
  let result;
4496
4546
  if (templateInfo.command === "node") {
4497
4547
  const command = templateInfo.command;
4498
4548
  const args = templateInfo.args;
4499
4549
  const envs = templateInfo.envs;
4500
- if (!silent) log$1.info(`Running: ${gray(`${command} ${args.join(" ")}`)}`);
4550
+ if (!silent) log.info(`Running: ${gray(`${command} ${args.join(" ")}`)}`);
4501
4551
  result = await runCommandAndDetectProjectDir({
4502
4552
  command,
4503
4553
  args,
@@ -4507,7 +4557,7 @@ async function executeRemoteTemplate(workspaceInfo, templateInfo, options) {
4507
4557
  } else {
4508
4558
  if (!isGitHubTemplate) {
4509
4559
  if (!await checkNpmPackageExists(templateInfo.command)) {
4510
- if (!silent) log$1.error(`Template "${templateInfo.command}" not found on npm. Run ${yellow("vp create --list")} to see available templates.`);
4560
+ if (!silent) log.error(`Template "${templateInfo.command}" not found on npm. Run ${yellow("vp create --list")} to see available templates.`);
4511
4561
  return { exitCode: 1 };
4512
4562
  }
4513
4563
  }
@@ -4515,13 +4565,13 @@ async function executeRemoteTemplate(workspaceInfo, templateInfo, options) {
4515
4565
  }
4516
4566
  const exitCode = result.exitCode;
4517
4567
  if (exitCode === 127) {
4518
- log$1.info(yellow("\nTroubleshooting:"));
4519
- log$1.info(` ${gray("•")} Command not found. Make sure Node.js is installed`);
4568
+ log.info(yellow("\nTroubleshooting:"));
4569
+ log.info(` ${gray("•")} Command not found. Make sure Node.js is installed`);
4520
4570
  } else if (isGitHubTemplate && exitCode !== 0) {
4521
- log$1.info(yellow("\nTroubleshooting:"));
4522
- log$1.info(` ${gray("•")} Make sure the GitHub repository exists`);
4523
- log$1.info(` ${gray("•")} Check your internet connection`);
4524
- log$1.info(` ${gray("•")} Repository might be private (requires authentication)`);
4571
+ log.info(yellow("\nTroubleshooting:"));
4572
+ log.info(` ${gray("•")} Make sure the GitHub repository exists`);
4573
+ log.info(` ${gray("•")} Check your internet connection`);
4574
+ log.info(` ${gray("•")} Repository might be private (requires authentication)`);
4525
4575
  }
4526
4576
  return result;
4527
4577
  }
@@ -4531,7 +4581,7 @@ async function runRemoteTemplateCommand(workspaceInfo, cwd, templateInfo, detect
4531
4581
  const execArgs = [...templateInfo.args];
4532
4582
  const envs = templateInfo.envs;
4533
4583
  const { command, args } = formatDlxCommand(remotePackageName, execArgs, workspaceInfo);
4534
- if (!silent) log$1.info(`Running: ${gray(`${command} ${args.join(" ")}`)}`);
4584
+ if (!silent) log.info(`Running: ${gray(`${command} ${args.join(" ")}`)}`);
4535
4585
  if (detectCreatedProjectDir) return await runCommandAndDetectProjectDir({
4536
4586
  command,
4537
4587
  args,
@@ -4579,8 +4629,8 @@ async function executeMonorepoTemplate(workspaceInfo, templateInfo, options) {
4579
4629
  workspaceInfo.monorepoScope = getScopeFromPackageName(templateInfo.packageName);
4580
4630
  const fullPath = path.join(workspaceInfo.rootDir, templateInfo.targetDir);
4581
4631
  if (!options?.silent) {
4582
- log$1.info(`Target directory: ${formatDisplayTargetDir(templateInfo.targetDir)}`);
4583
- log$1.step("Creating Vite+ monorepo...");
4632
+ log.info(`Target directory: ${formatDisplayTargetDir(templateInfo.targetDir)}`);
4633
+ log.step("Creating Vite+ monorepo...");
4584
4634
  }
4585
4635
  copyDir(path.join(templatesDir, "monorepo"), fullPath);
4586
4636
  renameFiles(fullPath);
@@ -4613,8 +4663,8 @@ async function executeMonorepoTemplate(workspaceInfo, templateInfo, options) {
4613
4663
  const yarnrcPath = path.join(fullPath, ".yarnrc.yml");
4614
4664
  if (fs.existsSync(yarnrcPath)) fs.unlinkSync(yarnrcPath);
4615
4665
  }
4616
- if (!options?.silent) log$1.success("Monorepo template created");
4617
- if (!options?.silent) log$1.step("Creating default application in apps/website...");
4666
+ if (!options?.silent) log.success("Monorepo template created");
4667
+ if (!options?.silent) log.step("Creating default application in apps/website...");
4618
4668
  const appResult = await runRemoteTemplateCommand(workspaceInfo, fullPath, discoverTemplate("create-vite@latest", [
4619
4669
  InitialMonorepoAppDir,
4620
4670
  "--template",
@@ -4622,7 +4672,7 @@ async function executeMonorepoTemplate(workspaceInfo, templateInfo, options) {
4622
4672
  "--no-interactive"
4623
4673
  ], workspaceInfo), false, options?.silent ?? false);
4624
4674
  if (appResult.exitCode !== 0) {
4625
- log$1.error(`Failed to create default application: ${appResult.exitCode}`);
4675
+ log.error(`Failed to create default application: ${appResult.exitCode}`);
4626
4676
  return appResult;
4627
4677
  }
4628
4678
  const appPackageName = workspaceInfo.monorepoScope ? `${workspaceInfo.monorepoScope}/website` : "website";
@@ -4630,11 +4680,11 @@ async function executeMonorepoTemplate(workspaceInfo, templateInfo, options) {
4630
4680
  setPackageName(appProjectPath, appPackageName);
4631
4681
  rewriteMonorepoProject(appProjectPath, workspaceInfo.packageManager, void 0, options?.silent ?? false);
4632
4682
  dropAliasedRuntimeDevDeps(appProjectPath, workspaceInfo.packageManager);
4633
- if (!options?.silent) log$1.step("Creating default library in packages/utils...");
4683
+ if (!options?.silent) log.step("Creating default library in packages/utils...");
4634
4684
  const libraryDir = "packages/utils";
4635
4685
  const libraryResult = await runRemoteTemplateCommand(workspaceInfo, fullPath, discoverTemplate(LibraryTemplateRepo, [libraryDir], workspaceInfo), false, options?.silent ?? false);
4636
4686
  if (libraryResult.exitCode !== 0) {
4637
- log$1.error(`Failed to create default library, exit code: ${libraryResult.exitCode}`);
4687
+ log.error(`Failed to create default library, exit code: ${libraryResult.exitCode}`);
4638
4688
  return libraryResult;
4639
4689
  }
4640
4690
  const libraryPackageName = workspaceInfo.monorepoScope ? `${workspaceInfo.monorepoScope}/utils` : "utils";
@@ -4743,7 +4793,7 @@ async function executeBuiltinTemplate(workspaceInfo, templateInfo, options) {
4743
4793
  };
4744
4794
  }
4745
4795
  if (templateInfo.command.startsWith("vite:")) {
4746
- if (!options?.silent) log$1.error(`Unknown builtin template "${templateInfo.command}". Run ${import_picocolors.default.yellow("vp create --list")} to see available templates.`);
4796
+ if (!options?.silent) log.error(`Unknown builtin template "${templateInfo.command}". Run ${import_picocolors.default.yellow("vp create --list")} to see available templates.`);
4747
4797
  return { exitCode: 1 };
4748
4798
  }
4749
4799
  const result = await runRemoteTemplateCommand(workspaceInfo, workspaceInfo.rootDir, templateInfo, false, options?.silent ?? false);
@@ -4920,15 +4970,15 @@ function getCopilotSetupRoot(projectRoot, isExistingMonorepo) {
4920
4970
  }
4921
4971
  function showCreateSummary(options) {
4922
4972
  const { description, gitInitialized, installSummary, nextCommand, packageManager, packageManagerVersion, projectDir } = options;
4923
- log(`${styleText("magenta", "◇")} Scaffolded ${accent(projectDir)}${description ? ` with ${description}` : ""}`);
4924
- log(`${styleText("gray", "•")} Node ${process.versions.node} ${packageManager} ${packageManagerVersion}`);
4925
- if (installSummary?.status === "installed") log(`${styleText("green", "✓")} Dependencies installed in ${formatDuration(installSummary.durationMs)}`);
4973
+ log$1(`${styleText("magenta", "◇")} Scaffolded ${accent(projectDir)}${description ? ` with ${description}` : ""}`);
4974
+ log$1(`${styleText("gray", "•")} Node ${process.versions.node} ${packageManager} ${packageManagerVersion}`);
4975
+ if (installSummary?.status === "installed") log$1(`${styleText("green", "✓")} Dependencies installed in ${formatDuration(installSummary.durationMs)}`);
4926
4976
  if (gitInitialized) {
4927
4977
  const git = !projectDir || projectDir === "." ? "git" : `git -C ${formatProjectDirArgument(projectDir)}`;
4928
4978
  const gitCommand = `${git} add -A && ${git} commit -m "chore: initial commit"`;
4929
- log(`${styleText("blue", "→")} Git (optional): ${accent(gitCommand)}`);
4979
+ log$1(`${styleText("blue", "→")} Git (optional): ${accent(gitCommand)}`);
4930
4980
  }
4931
- log(`${styleText("blue", "→")} Next: ${accent(nextCommand)}`);
4981
+ log$1(`${styleText("blue", "→")} Next: ${accent(nextCommand)}`);
4932
4982
  }
4933
4983
  async function main() {
4934
4984
  const { templateName, options, templateArgs } = parseArgs();
@@ -4943,7 +4993,7 @@ async function main() {
4943
4993
  if (options.directory) {
4944
4994
  const formatted = formatTargetDir(options.directory);
4945
4995
  if (formatted.error) {
4946
- log$1.error(formatted.error);
4996
+ log.error(formatted.error);
4947
4997
  cancelAndExit("The --directory option is invalid", 1);
4948
4998
  }
4949
4999
  targetDir = formatted.directory;
@@ -4977,7 +5027,7 @@ async function main() {
4977
5027
  if (!selectedTemplateName && configuredCreate.defaultTemplate) selectedTemplateName = configuredCreate.defaultTemplate;
4978
5028
  } catch (error) {
4979
5029
  if (error instanceof CreateConfigSchemaError) cancelAndExit(error.message, 1);
4980
- log$1.warn(`Could not read \`create\` config from the workspace vite.config (${error.message}); local templates are unavailable`);
5030
+ log.warn(`Could not read \`create\` config from the workspace vite.config (${error.message}); local templates are unavailable`);
4981
5031
  }
4982
5032
  else if (!selectedTemplateName) {
4983
5033
  let defaultTemplate;
@@ -5040,15 +5090,15 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5040
5090
  if (!isDirectScaffoldTemplate) compactOutput = false;
5041
5091
  if (targetDir && !isDirectScaffoldTemplate) cancelAndExit("The --directory option is only available for builtin and bundled @org templates", 1);
5042
5092
  if (selectedTemplateName === BuiltinTemplate.monorepo && isMonorepo) {
5043
- log$1.info("You are already in a monorepo workspace.\nUse a different template or run this command outside the monorepo");
5093
+ log.info("You are already in a monorepo workspace.\nUse a different template or run this command outside the monorepo");
5044
5094
  cancelAndExit("Cannot create a monorepo inside an existing monorepo", 1);
5045
5095
  }
5046
5096
  if (selectedTemplateName === BuiltinTemplate.generator && !isMonorepo) {
5047
- log$1.info("The vite:generator template requires a monorepo workspace.\nRun this command inside a Vite+ monorepo, or create one first with `vp create vite:monorepo`");
5097
+ log.info("The vite:generator template requires a monorepo workspace.\nRun this command inside a Vite+ monorepo, or create one first with `vp create vite:monorepo`");
5048
5098
  cancelAndExit("Cannot create a generator outside a monorepo", 1);
5049
5099
  }
5050
5100
  if (isMonorepo && options.git !== void 0) cancelAndExit("The --git/--no-git options are not available when adding a package to an existing monorepo", 1);
5051
- if (isInSubdirectory && !compactOutput) log$1.info(`Detected monorepo root at ${accent(workspaceInfoOptional.rootDir)}`);
5101
+ if (isInSubdirectory && !compactOutput) log.info(`Detected monorepo root at ${accent(workspaceInfoOptional.rootDir)}`);
5052
5102
  if (isMonorepo && options.interactive && !targetDir) {
5053
5103
  let parentDir;
5054
5104
  if (workspaceInfoOptional.parentDirs.length > 0 || isInSubdirectory) {
@@ -5090,7 +5140,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5090
5140
  selectedParentDir = parentDir;
5091
5141
  }
5092
5142
  if (isMonorepo && !options.interactive && !targetDir) {
5093
- if (isInSubdirectory && !compactOutput) log$1.info(`Use ${accent("--directory")} to specify a different target location.`);
5143
+ if (isInSubdirectory && !compactOutput) log.info(`Use ${accent("--directory")} to specify a different target location.`);
5094
5144
  selectedParentDir = inferParentDir(selectedTemplateName, workspaceInfoOptional, isLocalTemplate) ?? workspaceInfoOptional.parentDirs[0];
5095
5145
  }
5096
5146
  if (isGitHubUrl(selectedTemplateName)) {
@@ -5099,7 +5149,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5099
5149
  const inferredTargetDir = inferGitHubRepoName(selectedTemplateName) ?? "template";
5100
5150
  const remoteTargetBaseDir = selectedParentDir ? path.join(workspaceInfoOptional.rootDir, selectedParentDir) : workspaceInfoOptional.rootDir;
5101
5151
  const defaultTargetDir = suggestAvailableTargetDir(inferredTargetDir, remoteTargetBaseDir);
5102
- if (defaultTargetDir !== inferredTargetDir && options.interactive) log$1.info(` Target directory "${inferredTargetDir}" already exists. Suggested: ${accent(defaultTargetDir)}`);
5152
+ if (defaultTargetDir !== inferredTargetDir && options.interactive) log.info(` Target directory "${inferredTargetDir}" already exists. Suggested: ${accent(defaultTargetDir)}`);
5103
5153
  remoteTargetDir = await promptTargetDir(defaultTargetDir, options.interactive, { cwd: remoteTargetBaseDir });
5104
5154
  selectedTemplateArgs = [remoteTargetDir, ...selectedTemplateArgs];
5105
5155
  }
@@ -5114,7 +5164,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5114
5164
  if (enclosingPackage) cancelAndExit(`Cannot scaffold inside existing package "${enclosingPackage.name}" (${enclosingPackage.path}). Use --directory to specify a different location`, 1);
5115
5165
  targetDir = cwdRelativeToRoot;
5116
5166
  }
5117
- log$1.info(`Using package name: ${accent(packageName)}`);
5167
+ log.info(`Using package name: ${accent(packageName)}`);
5118
5168
  } else if (selectedTemplateName === BuiltinTemplate.monorepo) {
5119
5169
  const selected = await promptPackageNameAndTargetDir(getRandomProjectName({ fallbackName: "vite-plus-monorepo" }), options.interactive);
5120
5170
  packageName = selected.packageName;
@@ -5373,7 +5423,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5373
5423
  template: generatorTemplatePath
5374
5424
  }, compactOutput);
5375
5425
  } catch (error) {
5376
- log$1.warn(`Could not register the generator in create.templates (${error.message}).\nAdd it by hand: { name: '${generatorName || path.basename(projectDir)}', template: '${generatorTemplatePath}' }`);
5426
+ log.warn(`Could not register the generator in create.templates (${error.message}).\nAdd it by hand: { name: '${generatorName || path.basename(projectDir)}', template: '${generatorTemplatePath}' }`);
5377
5427
  }
5378
5428
  resumeCreateProgress();
5379
5429
  }
@@ -5430,7 +5480,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5430
5480
  resumeCreateProgress();
5431
5481
  };
5432
5482
  if (isMonorepo) {
5433
- if (!compactOutput) log$1.step("Monorepo integration...");
5483
+ if (!compactOutput) log.step("Monorepo integration...");
5434
5484
  if (workspaceInfo.packages.length > 0) {
5435
5485
  if (options.interactive) {
5436
5486
  pauseCreateProgress();
@@ -5520,10 +5570,10 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5520
5570
  }
5521
5571
  async function showAvailableTemplates() {
5522
5572
  printHeader();
5523
- log(listTemplatesMessage);
5573
+ log$1(listTemplatesMessage);
5524
5574
  }
5525
5575
  main().catch((err) => {
5526
- log$1.error(err.message);
5576
+ log.error(err.message);
5527
5577
  console.error(err);
5528
5578
  cancelAndExit(`Failed to generate code: ${err.message}`, 1);
5529
5579
  });
@@ -1,5 +1,5 @@
1
1
  import { t as PackUserConfig } from "./pack-ARPFMefW.js";
2
- import { PluginOption, UserConfig } from "vite";
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";
@@ -418,6 +418,34 @@ declare function defineProject$1(config: UserProjectConfigExport): UserProjectCo
418
418
  * all load plugins.
419
419
  */
420
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>;
421
449
  declare function lazyPlugins(cb: () => PluginOption[]): PluginOption[] | undefined;
422
450
  declare function lazyPlugins(cb: () => Promise<PluginOption[]>): PluginOption[] | undefined;
423
- 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 };
@@ -75,10 +75,10 @@ function ignoreOutput(path) {
75
75
  var addon;
76
76
  var init_src = __esmMin((() => {}));
77
77
  // package.json
78
- var version = "1.4.0", VITE_PLUS_VERSION, VITEST_VERSION, CONFIG_METADATA_ENV;
78
+ var version = "1.5.0", VITE_PLUS_VERSION, VITEST_VERSION, CONFIG_METADATA_ENV;
79
79
  var init_constants = __esmMin((() => {
80
80
  VITE_PLUS_VERSION = process.env.VP_VERSION || version;
81
- VITEST_VERSION = "5.0.5";
81
+ VITEST_VERSION = "5.1.0";
82
82
  process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : `${VITE_PLUS_VERSION}`;
83
83
  (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
84
84
  process.versions.node, process.release.name;
@@ -113,6 +113,7 @@ var define_config_exports = /* @__PURE__ */ __exportAll({
113
113
  defineProject: () => defineProject,
114
114
  isVitestFamilySpecifier: () => isVitestFamilySpecifier,
115
115
  lazyPlugins: () => lazyPlugins,
116
+ resolveConfigFromFile: () => resolveConfigFromFile,
116
117
  resolveCoverageProviderToCheck: () => resolveCoverageProviderToCheck,
117
118
  withConfigMetadataResolution: () => withConfigMetadataResolution
118
119
  });
@@ -635,13 +636,37 @@ async function withConfigMetadataResolution(fn) {
635
636
  }
636
637
  }
637
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
+ }
638
663
  function lazyPlugins(cb) {
639
664
  if (process.env["VP_RESOLVING_CONFIG_METADATA"] === "1") return;
640
665
  const result = cb();
641
666
  if (result instanceof Promise) return [result];
642
667
  return result;
643
668
  }
644
- 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;
645
670
  var init_define_config = __esmMin((() => {
646
671
  init_src();
647
672
  init_constants();
@@ -662,6 +687,7 @@ var init_define_config = __esmMin((() => {
662
687
  "vite-plus:vitest-cache-paths"
663
688
  ]);
664
689
  configMetadataDepth = 0;
690
+ resolveConfigWithInternalOptions = vite.resolveConfig;
665
691
  }));
666
692
  Object.defineProperty(exports, "AUTO_INLINE_DEPS", {
667
693
  enumerable: true,
@@ -729,6 +755,12 @@ Object.defineProperty(exports, "lazyPlugins", {
729
755
  return lazyPlugins;
730
756
  }
731
757
  });
758
+ Object.defineProperty(exports, "resolveConfigFromFile", {
759
+ enumerable: true,
760
+ get: function() {
761
+ return resolveConfigFromFile;
762
+ }
763
+ });
732
764
  Object.defineProperty(exports, "resolveCoverageProviderToCheck", {
733
765
  enumerable: true,
734
766
  get: function() {
@@ -1,12 +1,12 @@
1
- import { c as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-DRUnJ_Dz.js";
1
+ import { c as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-D2P2aVKb.js";
2
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
- // ../../node_modules/.pnpm/tsdown@0.23.1_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.1_@tsdown+exe@0.23.1_@type_1cd5eff5b2f775ab43816d8441c9e500/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();
@@ -685,10 +685,35 @@ async function withConfigMetadataResolution(fn) {
685
685
  }
686
686
  }
687
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
+ }
688
713
  function lazyPlugins(cb) {
689
714
  if (process.env["VP_RESOLVING_CONFIG_METADATA"] === "1") return;
690
715
  const result = cb();
691
716
  if (result instanceof Promise) return [result];
692
717
  return result;
693
718
  }
694
- 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-Cv2P6NT2.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-rPhYIFSn.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 };