vite-plus 0.1.15-alpha.1 → 0.1.15-alpha.3

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.
@@ -1,8 +1,8 @@
1
1
  import { r as __toESM, t as __commonJSMin } from "./chunk-BoAXSpZd.js";
2
2
  import { _ as YAMLMap, g as YAMLSeq, i as parseDocument, n as parse, y as Scalar } from "./browser-09BZLUYM.js";
3
- import { c as readJsonFile, d as VITE_PLUS_NAME, f as VITE_PLUS_OVERRIDE_PACKAGES, m as isForceOverrideMode, n as detectPackageMetadata, o as editJsonFile, p as VITE_PLUS_VERSION, s as isJsonFile, u as BASEURL_TSCONFIG_WARNING } from "./package-Y1UTfJnZ.js";
3
+ import { _ as isForceOverrideMode, c as readJsonFile, d as modify, f as parse$1, g as VITE_PLUS_VERSION, h as VITE_PLUS_OVERRIDE_PACKAGES, m as VITE_PLUS_NAME, n as detectPackageMetadata, o as editJsonFile, p as BASEURL_TSCONFIG_WARNING, s as isJsonFile, u as applyEdits } from "./package-CnlCtq4D.js";
4
4
  import { n as accent } from "./help-HviKaKAU.js";
5
- import { n as addMigrationWarning, t as addManualStep } from "./report-C7xbSNED.js";
5
+ import { n as addMigrationWarning, t as addManualStep } from "./report-DGaKL5VQ.js";
6
6
  import path from "node:path";
7
7
  import { stripVTControlCharacters, styleText } from "node:util";
8
8
  import process$1, { stdin, stdout } from "node:process";
@@ -2828,7 +2828,8 @@ var require_semver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2828
2828
  const PackageManager = {
2829
2829
  pnpm: "pnpm",
2830
2830
  npm: "npm",
2831
- yarn: "yarn"
2831
+ yarn: "yarn",
2832
+ bun: "bun"
2832
2833
  };
2833
2834
  const DependencyType = {
2834
2835
  dependencies: "dependencies",
@@ -2897,7 +2898,8 @@ async function selectPackageManager(interactive, silent = false) {
2897
2898
  hint: "recommended"
2898
2899
  },
2899
2900
  { value: PackageManager.yarn },
2900
- { value: PackageManager.npm }
2901
+ { value: PackageManager.npm },
2902
+ { value: PackageManager.bun }
2901
2903
  ],
2902
2904
  initialValue: PackageManager.pnpm
2903
2905
  });
@@ -3059,6 +3061,28 @@ function hasBaseUrlInTsconfig(projectPath) {
3059
3061
  return false;
3060
3062
  }
3061
3063
  }
3064
+ const TSCONFIG_FILE_RE = /^tsconfig(\.[\w-]+)?\.json$/i;
3065
+ function findTsconfigFiles(projectPath) {
3066
+ try {
3067
+ return fs.readdirSync(projectPath).filter((name) => TSCONFIG_FILE_RE.test(name)).map((name) => path.join(projectPath, name));
3068
+ } catch {
3069
+ return [];
3070
+ }
3071
+ }
3072
+ function removeDeprecatedTsconfigFalseOption(filePath, optionName) {
3073
+ let text;
3074
+ try {
3075
+ text = fs.readFileSync(filePath, "utf-8");
3076
+ } catch {
3077
+ return false;
3078
+ }
3079
+ if (parse$1(text)?.compilerOptions?.[optionName] !== false) return false;
3080
+ const edits = modify(text, ["compilerOptions", optionName], void 0, {});
3081
+ if (edits.length === 0) return false;
3082
+ const newText = applyEdits(text, edits);
3083
+ fs.writeFileSync(filePath, newText);
3084
+ return true;
3085
+ }
3062
3086
  //#endregion
3063
3087
  //#region src/utils/yaml.ts
3064
3088
  function readYamlFile(file) {
@@ -3174,6 +3198,7 @@ function detectConfigs(projectPath) {
3174
3198
  } catch {}
3175
3199
  }
3176
3200
  if (fs.existsSync(path.join(projectPath, ".prettierignore"))) configs.prettierIgnore = true;
3201
+ if (fs.existsSync(path.join(projectPath, ".nvmrc"))) configs.nvmrcFile = true;
3177
3202
  return configs;
3178
3203
  }
3179
3204
  //#endregion
@@ -3474,7 +3499,7 @@ async function migratePrettierToOxfmt(projectPath, interactive, prettierConfigFi
3474
3499
  if (packages) for (const pkg of packages) rewritePrettierPackageJson(path.join(projectPath, pkg.path, "package.json"));
3475
3500
  rewritePrettierLintStagedConfigFiles(projectPath, options?.report);
3476
3501
  const prettierIgnorePath = path.join(projectPath, ".prettierignore");
3477
- if (fs.existsSync(prettierIgnorePath)) warnMigration(`${displayRelative(prettierIgnorePath)} found — Oxfmt uses .oxfmtignore. Please migrate manually.`, options?.report);
3502
+ if (fs.existsSync(prettierIgnorePath)) warnMigration(`${displayRelative(prettierIgnorePath)} found — Oxfmt supports .prettierignore, but using the \`ignorePatterns\` option is recommended.`, options?.report);
3478
3503
  return true;
3479
3504
  }
3480
3505
  function deletePrettierConfigFiles(basePath, report, silent = false) {
@@ -3539,6 +3564,15 @@ function rewritePrettierPackageJson(packageJsonPath) {
3539
3564
  function rewritePrettierLintStagedConfigFiles(projectPath, report) {
3540
3565
  rewriteToolLintStagedConfigFiles(projectPath, rewritePrettier, "prettier", report);
3541
3566
  }
3567
+ function cleanupDeprecatedTsconfigOptions(projectPath, silent = false, report) {
3568
+ const deprecatedOptions = ["esModuleInterop", "allowSyntheticDefaultImports"];
3569
+ const files = findTsconfigFiles(projectPath);
3570
+ for (const filePath of files) for (const name of deprecatedOptions) if (removeDeprecatedTsconfigFalseOption(filePath, name)) {
3571
+ if (report) report.removedConfigCount++;
3572
+ if (!silent) log.success(`✔ Removed ${name}: false from ${displayRelative(filePath)}`);
3573
+ warnMigration(`Removed \`"${name}": false\` from ${displayRelative(filePath)} — this option has been deprecated. See https://github.com/oxc-project/tsgolint/issues/351, https://github.com/microsoft/TypeScript/issues/62529`, report);
3574
+ }
3575
+ }
3542
3576
  /**
3543
3577
  * Rewrite standalone project to add vite-plus dependencies
3544
3578
  * @param projectPath - The path to the project
@@ -3553,7 +3587,7 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
3553
3587
  ...pkg.resolutions,
3554
3588
  ...VITE_PLUS_OVERRIDE_PACKAGES
3555
3589
  };
3556
- else if (packageManager === PackageManager.npm) pkg.overrides = {
3590
+ else if (packageManager === PackageManager.npm || packageManager === PackageManager.bun) pkg.overrides = {
3557
3591
  ...pkg.overrides,
3558
3592
  ...VITE_PLUS_OVERRIDE_PACKAGES
3559
3593
  };
@@ -3562,13 +3596,14 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
3562
3596
  ...pkg.pnpm,
3563
3597
  overrides: {
3564
3598
  ...pkg.pnpm?.overrides,
3565
- ...VITE_PLUS_OVERRIDE_PACKAGES
3599
+ ...VITE_PLUS_OVERRIDE_PACKAGES,
3600
+ ...isForceOverrideMode() ? { [VITE_PLUS_NAME]: VITE_PLUS_VERSION } : {}
3566
3601
  }
3567
3602
  };
3568
3603
  for (const key of [...Object.keys(VITE_PLUS_OVERRIDE_PACKAGES), ...REMOVE_PACKAGES]) if (pkg.resolutions?.[key]) delete pkg.resolutions[key];
3569
3604
  }
3570
3605
  extractedStagedConfig = rewritePackageJson(pkg, packageManager, false, skipStagedMigration);
3571
- if (!pkg.devDependencies?.["vite-plus"]) pkg.devDependencies = {
3606
+ if (!pkg.devDependencies?.["vite-plus"] || isForceOverrideMode()) pkg.devDependencies = {
3572
3607
  ...pkg.devDependencies,
3573
3608
  [VITE_PLUS_NAME]: VITE_PLUS_VERSION
3574
3609
  };
@@ -3578,8 +3613,10 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
3578
3613
  if (mergeStagedConfigToViteConfig(projectPath, extractedStagedConfig, silent, report)) removeLintStagedFromPackageJson(packageJsonPath);
3579
3614
  }
3580
3615
  if (!skipStagedMigration) rewriteLintStagedConfigFile(projectPath, report);
3616
+ cleanupDeprecatedTsconfigOptions(projectPath, silent, report);
3581
3617
  mergeViteConfigFiles(projectPath, silent, report);
3582
3618
  injectLintTypeCheckDefaults(projectPath, silent, report);
3619
+ injectFmtDefaults(projectPath, silent, report);
3583
3620
  mergeTsdownConfigFile(projectPath, silent, report);
3584
3621
  rewriteAllImports(projectPath, silent, report);
3585
3622
  setPackageManager(projectPath, workspaceInfo.downloadPackageManager);
@@ -3591,11 +3628,14 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
3591
3628
  function rewriteMonorepo(workspaceInfo, skipStagedMigration, silent = false, report) {
3592
3629
  if (workspaceInfo.packageManager === PackageManager.pnpm) rewritePnpmWorkspaceYaml(workspaceInfo.rootDir);
3593
3630
  else if (workspaceInfo.packageManager === PackageManager.yarn) rewriteYarnrcYml(workspaceInfo.rootDir);
3631
+ else if (workspaceInfo.packageManager === PackageManager.bun) rewriteBunCatalog(workspaceInfo.rootDir);
3594
3632
  rewriteRootWorkspacePackageJson(workspaceInfo.rootDir, workspaceInfo.packageManager, skipStagedMigration);
3595
3633
  for (const pkg of workspaceInfo.packages) rewriteMonorepoProject(path.join(workspaceInfo.rootDir, pkg.path), workspaceInfo.packageManager, skipStagedMigration, silent, report);
3596
3634
  if (!skipStagedMigration) rewriteLintStagedConfigFile(workspaceInfo.rootDir, report);
3635
+ cleanupDeprecatedTsconfigOptions(workspaceInfo.rootDir, silent, report);
3597
3636
  mergeViteConfigFiles(workspaceInfo.rootDir, silent, report);
3598
3637
  injectLintTypeCheckDefaults(workspaceInfo.rootDir, silent, report);
3638
+ injectFmtDefaults(workspaceInfo.rootDir, silent, report);
3599
3639
  mergeTsdownConfigFile(workspaceInfo.rootDir, silent, report);
3600
3640
  rewriteAllImports(workspaceInfo.rootDir, silent, report);
3601
3641
  setPackageManager(workspaceInfo.rootDir, workspaceInfo.downloadPackageManager);
@@ -3605,6 +3645,7 @@ function rewriteMonorepo(workspaceInfo, skipStagedMigration, silent = false, rep
3605
3645
  * @param projectPath - The path to the project
3606
3646
  */
3607
3647
  function rewriteMonorepoProject(projectPath, packageManager, skipStagedMigration, silent = false, report) {
3648
+ cleanupDeprecatedTsconfigOptions(projectPath, silent, report);
3608
3649
  mergeViteConfigFiles(projectPath, silent, report);
3609
3650
  mergeTsdownConfigFile(projectPath, silent, report);
3610
3651
  const packageJsonPath = path.join(projectPath, "package.json");
@@ -3692,6 +3733,27 @@ function rewriteCatalog(doc) {
3692
3733
  }
3693
3734
  }
3694
3735
  /**
3736
+ * Write catalog entries to root package.json for bun.
3737
+ * Bun stores catalogs in package.json under the `catalog` key,
3738
+ * unlike pnpm which uses pnpm-workspace.yaml.
3739
+ * @see https://bun.sh/docs/pm/catalogs
3740
+ */
3741
+ function rewriteBunCatalog(projectPath) {
3742
+ const packageJsonPath = path.join(projectPath, "package.json");
3743
+ if (!fs.existsSync(packageJsonPath)) return;
3744
+ editJsonFile(packageJsonPath, (pkg) => {
3745
+ const catalog = { ...pkg.catalog };
3746
+ for (const [key, value] of Object.entries(VITE_PLUS_OVERRIDE_PACKAGES)) if (!value.startsWith("file:")) catalog[key] = value;
3747
+ if (!VITE_PLUS_VERSION.startsWith("file:")) catalog[VITE_PLUS_NAME] = VITE_PLUS_VERSION;
3748
+ for (const name of REMOVE_PACKAGES) delete catalog[name];
3749
+ pkg.catalog = catalog;
3750
+ const overrides = { ...pkg.overrides };
3751
+ for (const key of Object.keys(VITE_PLUS_OVERRIDE_PACKAGES)) overrides[key] = "catalog:";
3752
+ pkg.overrides = overrides;
3753
+ return pkg;
3754
+ });
3755
+ }
3756
+ /**
3695
3757
  * Rewrite root workspace package.json to add vite-plus dependencies
3696
3758
  * @param projectPath - The path to the project
3697
3759
  */
@@ -3707,7 +3769,7 @@ function rewriteRootWorkspacePackageJson(projectPath, packageManager, skipStaged
3707
3769
  ...pkg.overrides,
3708
3770
  ...VITE_PLUS_OVERRIDE_PACKAGES
3709
3771
  };
3710
- else if (packageManager === PackageManager.pnpm) {
3772
+ else if (packageManager === PackageManager.bun) {} else if (packageManager === PackageManager.pnpm) {
3711
3773
  if (isForceOverrideMode()) pkg.pnpm = {
3712
3774
  ...pkg.pnpm,
3713
3775
  overrides: {
@@ -3901,6 +3963,9 @@ function injectLintTypeCheckDefaults(projectPath, silent = false, report) {
3901
3963
  typeCheck: true
3902
3964
  } }), silent, report);
3903
3965
  }
3966
+ function injectFmtDefaults(projectPath, silent = false, report) {
3967
+ injectConfigDefaults(projectPath, "fmt", ".vite-plus-fmt-init.oxfmtrc.json", JSON.stringify({}), silent, report);
3968
+ }
3904
3969
  function injectConfigDefaults(projectPath, configKey, tempFileName, tempFileContent, silent, report) {
3905
3970
  const configs = detectConfigs(projectPath);
3906
3971
  if (configs.viteConfig) {
@@ -4297,6 +4362,48 @@ function setPackageManager(projectDir, downloadPackageManager) {
4297
4362
  return pkg;
4298
4363
  });
4299
4364
  }
4365
+ /**
4366
+ * Detect a .nvmrc file in the project directory.
4367
+ * Returns undefined if not found or .node-version already exists.
4368
+ */
4369
+ function detectNodeVersionManagerFile(projectPath) {
4370
+ if (fs.existsSync(path.join(projectPath, ".node-version"))) return;
4371
+ if (detectConfigs(projectPath).nvmrcFile) return { file: ".nvmrc" };
4372
+ }
4373
+ /**
4374
+ * Parse a version alias from a .nvmrc file into a .node-version compatible string.
4375
+ * Accepts the first line of .nvmrc (pre-trimmed).
4376
+ * Returns null for unsupported aliases like "system", "default", "iojs".
4377
+ */
4378
+ function parseNvmrcVersion(alias) {
4379
+ const version = alias.trim();
4380
+ if (!version) return null;
4381
+ if (version === "node" || version === "stable") return "lts/*";
4382
+ if (version === "iojs" || version === "system" || version === "default") return null;
4383
+ if (version.startsWith("lts/")) return version;
4384
+ const normalized = version.startsWith("v") ? version.slice(1) : version;
4385
+ if (!normalized || !import_semver.default.validRange(normalized)) return null;
4386
+ return normalized;
4387
+ }
4388
+ /**
4389
+ * Migrate .nvmrc to .node-version and remove .nvmrc.
4390
+ * Returns true on success, false if migration was skipped or failed.
4391
+ */
4392
+ function migrateNodeVersionManagerFile(projectPath, _detection, report) {
4393
+ const sourcePath = path.join(projectPath, ".nvmrc");
4394
+ const nodeVersionPath = path.join(projectPath, ".node-version");
4395
+ const originalAlias = fs.readFileSync(sourcePath, "utf8").split("\n")[0]?.trim() ?? "";
4396
+ const version = parseNvmrcVersion(originalAlias);
4397
+ if (!version) {
4398
+ warnMigration(".nvmrc contains an unsupported version alias. Create .node-version manually with your desired Node.js version.", report);
4399
+ return false;
4400
+ }
4401
+ if (version === "lts/*" && (originalAlias === "node" || originalAlias === "stable")) log.info(`"${originalAlias}" in .nvmrc is not a specific version; automatically mapping to "lts/*"`);
4402
+ fs.writeFileSync(nodeVersionPath, `${version}\n`);
4403
+ fs.unlinkSync(sourcePath);
4404
+ if (report) report.nodeVersionFileMigrated = true;
4405
+ return true;
4406
+ }
4300
4407
  const AGENT_ALIASES = {
4301
4408
  chatgpt: "chatgpt-codex",
4302
4409
  codex: "chatgpt-codex"
@@ -4597,4 +4704,4 @@ function getMarkedRange(content, startMarker, endMarker) {
4597
4704
  };
4598
4705
  }
4599
4706
  //#endregion
4600
- export { displayRelative as A, outro as B, defaultInteractive as C, runViteInstall as D, runViteFmt as E, cancel as F, spinner as H, confirm as I, intro as L, DependencyType as M, PackageManager as N, selectPackageManager as O, require_semver as P, log as R, cancelAndExit as S, promptGitHooks as T, text as U, select as V, Ct as W, rewriteMonorepo as _, writeAgentInstructions as a, editYamlFile as b, detectEslintProject as c, hasStagedConfigInViteConfig as d, installGitHooks as f, preflightGitHooksSetup as g, migratePrettierToOxfmt as h, updateExistingAgentInstructions as i, templatesDir as j, upgradeYarn as k, detectPrettierProject as l, migrateEslintToOxlint as m, detectExistingAgentTargetPaths as n, checkViteVersion as o, mergeViteConfigFiles as p, selectAgentTargetPaths as r, checkVitestVersion as s, detectAgentConflicts as t, ensurePreCommitHook as u, rewriteMonorepoProject as v, downloadPackageManager$1 as w, readYamlFile as x, rewriteStandaloneProject as y, multiselect as z };
4707
+ export { selectPackageManager as A, log as B, readYamlFile as C, promptGitHooks as D, downloadPackageManager$1 as E, PackageManager as F, text as G, outro as H, require_semver as I, Ct as K, cancel as L, displayRelative as M, templatesDir as N, runViteFmt as O, DependencyType as P, confirm as R, editYamlFile as S, defaultInteractive as T, select as U, multiselect as V, spinner as W, migratePrettierToOxfmt as _, writeAgentInstructions as a, rewriteMonorepoProject as b, detectEslintProject as c, ensurePreCommitHook as d, hasStagedConfigInViteConfig as f, migrateNodeVersionManagerFile as g, migrateEslintToOxlint as h, updateExistingAgentInstructions as i, upgradeYarn as j, runViteInstall as k, detectNodeVersionManagerFile as l, mergeViteConfigFiles as m, detectExistingAgentTargetPaths as n, checkViteVersion as o, installGitHooks as p, selectAgentTargetPaths as r, checkVitestVersion as s, detectAgentConflicts as t, detectPrettierProject as u, preflightGitHooksSetup as v, cancelAndExit as w, rewriteStandaloneProject as x, rewriteMonorepo as y, intro as z };
@@ -1,4 +1,4 @@
1
- import { n as addMigrationWarning } from "./report-C7xbSNED.js";
1
+ import { n as addMigrationWarning } from "./report-DGaKL5VQ.js";
2
2
  //#region src/migration/compat.ts
3
3
  /**
4
4
  * Check for Rolldown-incompatible manualChunks config patterns.
@@ -1,4 +1,4 @@
1
- import { C as defaultInteractive, T as promptGitHooks, d as hasStagedConfigInViteConfig, i as updateExistingAgentInstructions, u as ensurePreCommitHook } from "./agent-BJ8PFvbU.js";
1
+ import { D as promptGitHooks, T as defaultInteractive, d as ensurePreCommitHook, f as hasStagedConfigInViteConfig, i as updateExistingAgentInstructions } from "./agent-DE6dQKO4.js";
2
2
  import { t as lib_default } from "./lib-DxappLRQ.js";
3
3
  import { i as log, t as renderCliDoc } from "./help-HviKaKAU.js";
4
4
  import { join } from "node:path";
@@ -1,9 +1,9 @@
1
1
  import { r as __toESM, t as __commonJSMin } from "./chunk-BoAXSpZd.js";
2
- import { A as displayRelative, C as defaultInteractive, D as runViteInstall, E as runViteFmt, F as cancel, H as spinner, I as confirm, L as intro, M as DependencyType, N as PackageManager, O as selectPackageManager, R as log, T as promptGitHooks, U as text, V as select, W as Ct, _ as rewriteMonorepo, a as writeAgentInstructions, f as installGitHooks, j as templatesDir, n as detectExistingAgentTargetPaths, r as selectAgentTargetPaths, v as rewriteMonorepoProject, w as downloadPackageManager$1, y as rewriteStandaloneProject, z as multiselect } from "./agent-BJ8PFvbU.js";
2
+ import { A as selectPackageManager, B as log, D as promptGitHooks, E as downloadPackageManager$1, F as PackageManager, G as text, K as Ct, L as cancel, M as displayRelative, N as templatesDir, O as runViteFmt, P as DependencyType, R as confirm, T as defaultInteractive, U as select, V as multiselect, W as spinner, a as writeAgentInstructions, b as rewriteMonorepoProject, k as runViteInstall, n as detectExistingAgentTargetPaths, p as installGitHooks, r as selectAgentTargetPaths, x as rewriteStandaloneProject, y as rewriteMonorepo, z as intro } from "./agent-DE6dQKO4.js";
3
3
  import { t as lib_default } from "./lib-DxappLRQ.js";
4
- import { c as readJsonFile, o as editJsonFile, t as checkNpmPackageExists } from "./package-Y1UTfJnZ.js";
4
+ import { c as readJsonFile, o as editJsonFile, t as checkNpmPackageExists } from "./package-CnlCtq4D.js";
5
5
  import { a as muted, i as log$1, n as accent, o as success, t as renderCliDoc } from "./help-HviKaKAU.js";
6
- import { a as detectExistingEditor, n as updatePackageJsonWithDeps, o as selectEditor, r as updateWorkspaceConfig, s as writeEditorConfigs, t as detectWorkspace$1 } from "./workspace-BnY0PTee.js";
6
+ import { a as detectExistingEditor, n as updatePackageJsonWithDeps, o as selectEditor, r as updateWorkspaceConfig, s as writeEditorConfigs, t as detectWorkspace$1 } from "./workspace-j8KWxSkv.js";
7
7
  import path from "node:path";
8
8
  import { styleText } from "node:util";
9
9
  import color from "picocolors";
@@ -97,6 +97,10 @@ function getPackageRunner(workspaceInfo) {
97
97
  command: "yarn",
98
98
  args: ["dlx"]
99
99
  };
100
+ case "bun": return {
101
+ command: "bun",
102
+ args: ["x"]
103
+ };
100
104
  default: return {
101
105
  command: "npx",
102
106
  args: []
@@ -105,7 +109,7 @@ function getPackageRunner(workspaceInfo) {
105
109
  }
106
110
  function formatDlxCommand(packageName, args, workspaceInfo) {
107
111
  const runner = getPackageRunner(workspaceInfo);
108
- const dlxArgs = runner.command === "npm" ? ["--", ...args] : args;
112
+ const dlxArgs = runner.command === "npx" ? ["--", ...args] : args;
109
113
  return {
110
114
  command: runner.command,
111
115
  args: [
@@ -3686,6 +3690,10 @@ const helpMessage = renderCliDoc({
3686
3690
  label: "--no-hooks",
3687
3691
  description: "Skip pre-commit hooks setup"
3688
3692
  },
3693
+ {
3694
+ label: "--package-manager NAME",
3695
+ description: "Use specified package manager (pnpm, npm, yarn, bun)"
3696
+ },
3689
3697
  {
3690
3698
  label: "--verbose",
3691
3699
  description: "Show detailed scaffolding output"
@@ -3829,7 +3837,8 @@ function parseArgs() {
3829
3837
  string: [
3830
3838
  "directory",
3831
3839
  "agent",
3832
- "editor"
3840
+ "editor",
3841
+ "package-manager"
3833
3842
  ],
3834
3843
  default: { interactive: defaultInteractive() }
3835
3844
  });
@@ -3843,7 +3852,8 @@ function parseArgs() {
3843
3852
  verbose: parsed.verbose || false,
3844
3853
  agent: parsed.agent,
3845
3854
  editor: parsed.editor,
3846
- hooks: parsed.hooks
3855
+ hooks: parsed.hooks,
3856
+ packageManager: parsed["package-manager"]
3847
3857
  },
3848
3858
  templateArgs
3849
3859
  };
@@ -4045,7 +4055,12 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
4045
4055
  packageName = selected.packageName;
4046
4056
  targetDir = selectedParentDir ? path.join(selectedParentDir, selected.targetDir).split(path.sep).join("/") : selected.targetDir;
4047
4057
  }
4048
- const packageManager = workspaceInfoOptional.packageManager ?? await selectPackageManager(options.interactive, compactOutput);
4058
+ if (options.packageManager && !Object.values(PackageManager).includes(options.packageManager)) {
4059
+ const valid = Object.values(PackageManager).join(", ");
4060
+ log.error(`Invalid package manager: ${options.packageManager}. Must be one of: ${valid}`);
4061
+ cancelAndExit("Invalid --package-manager value", 1);
4062
+ }
4063
+ const packageManager = workspaceInfoOptional.packageManager ?? options.packageManager ?? await selectPackageManager(options.interactive, compactOutput);
4049
4064
  const shouldSilencePackageManagerInstallLog = compactOutput || isMonorepo && workspaceInfoOptional.packageManager !== void 0;
4050
4065
  const downloadResult = await downloadPackageManager$1(packageManager, workspaceInfoOptional.packageManagerVersion, options.interactive, shouldSilencePackageManagerInstallLog);
4051
4066
  const workspaceInfo = {
@@ -1,10 +1,10 @@
1
1
  import { r as __toESM } from "./chunk-BoAXSpZd.js";
2
- import { A as displayRelative, B as outro, C as defaultInteractive, D as runViteInstall, H as spinner, I as confirm, N as PackageManager, O as selectPackageManager, P as require_semver, R as log, S as cancelAndExit, T as promptGitHooks, V as select, W as Ct, _ as rewriteMonorepo, a as writeAgentInstructions, c as detectEslintProject, f as installGitHooks, g as preflightGitHooksSetup, h as migratePrettierToOxfmt, k as upgradeYarn, l as detectPrettierProject, m as migrateEslintToOxlint, n as detectExistingAgentTargetPaths, o as checkViteVersion, p as mergeViteConfigFiles, r as selectAgentTargetPaths, s as checkVitestVersion, t as detectAgentConflicts, w as downloadPackageManager$1, y as rewriteStandaloneProject } from "./agent-BJ8PFvbU.js";
2
+ import { A as selectPackageManager, B as log, D as promptGitHooks, E as downloadPackageManager$1, F as PackageManager, H as outro, I as require_semver, K as Ct, M as displayRelative, R as confirm, T as defaultInteractive, U as select, W as spinner, _ as migratePrettierToOxfmt, a as writeAgentInstructions, c as detectEslintProject, g as migrateNodeVersionManagerFile, h as migrateEslintToOxlint, j as upgradeYarn, k as runViteInstall, l as detectNodeVersionManagerFile, m as mergeViteConfigFiles, n as detectExistingAgentTargetPaths, o as checkViteVersion, p as installGitHooks, r as selectAgentTargetPaths, s as checkVitestVersion, t as detectAgentConflicts, u as detectPrettierProject, v as preflightGitHooksSetup, w as cancelAndExit, x as rewriteStandaloneProject, y as rewriteMonorepo } from "./agent-DE6dQKO4.js";
3
3
  import { t as lib_default } from "./lib-DxappLRQ.js";
4
- import { a as readNearestPackageJson, i as hasVitePlusDependency, m as isForceOverrideMode } from "./package-Y1UTfJnZ.js";
4
+ import { _ as isForceOverrideMode, a as readNearestPackageJson, i as hasVitePlusDependency } from "./package-CnlCtq4D.js";
5
5
  import { a as muted, i as log$1, n as accent, t as renderCliDoc } from "./help-HviKaKAU.js";
6
- import { r as createMigrationReport } from "./report-C7xbSNED.js";
7
- import { i as detectEditorConflicts, o as selectEditor, s as writeEditorConfigs, t as detectWorkspace$1 } from "./workspace-BnY0PTee.js";
6
+ import { r as createMigrationReport } from "./report-DGaKL5VQ.js";
7
+ import { i as detectEditorConflicts, o as selectEditor, s as writeEditorConfigs, t as detectWorkspace$1 } from "./workspace-j8KWxSkv.js";
8
8
  import path from "node:path";
9
9
  import { styleText } from "node:util";
10
10
  import { vitePlusHeader } from "../../binding/index.js";
@@ -68,6 +68,17 @@ async function promptPrettierMigration(projectPath, interactive, packages) {
68
68
  if (!await migratePrettierToOxfmt(projectPath, interactive, prettierProject.configFile, packages)) cancelAndExit("Prettier migration failed. Fix the issue and re-run `vp migrate`.", 1);
69
69
  return true;
70
70
  }
71
+ async function confirmNodeVersionFileMigration(interactive) {
72
+ if (interactive) {
73
+ const confirmed = await confirm({
74
+ message: "Migrate .nvmrc to .node-version?",
75
+ initialValue: true
76
+ });
77
+ if (Ct(confirmed)) cancelAndExit();
78
+ return !!confirmed;
79
+ }
80
+ return true;
81
+ }
71
82
  const helpMessage = renderCliDoc({
72
83
  usage: "vp migrate [PATH] [OPTIONS]",
73
84
  summary: "Migrate standalone Vite, Vitest, Oxlint, Oxfmt, and Prettier projects to unified Vite+.",
@@ -271,6 +282,9 @@ async function collectMigrationPlan(rootDir, detectedPackageManager, options, pa
271
282
  let migratePrettier = false;
272
283
  if (prettierProject.hasDependency && prettierProject.configFile) migratePrettier = await confirmPrettierMigration(options.interactive);
273
284
  else if (prettierProject.hasDependency) warnPackageLevelPrettier();
285
+ const nodeVersionDetection = detectNodeVersionManagerFile(rootDir);
286
+ let migrateNodeVersionFile = false;
287
+ if (nodeVersionDetection) migrateNodeVersionFile = await confirmNodeVersionFileMigration(options.interactive);
274
288
  return {
275
289
  packageManager,
276
290
  shouldSetupHooks,
@@ -281,7 +295,9 @@ async function collectMigrationPlan(rootDir, detectedPackageManager, options, pa
281
295
  migrateEslint,
282
296
  eslintConfigFile: eslintProject.configFile,
283
297
  migratePrettier,
284
- prettierConfigFile: prettierProject.configFile
298
+ prettierConfigFile: prettierProject.configFile,
299
+ migrateNodeVersionFile,
300
+ nodeVersionDetection
285
301
  };
286
302
  }
287
303
  function formatDuration(durationMs) {
@@ -305,6 +321,7 @@ function showMigrationSummary(options) {
305
321
  }
306
322
  if (report.eslintMigrated) log$1(`${styleText("gray", "•")} ESLint rules migrated to Oxlint`);
307
323
  if (report.prettierMigrated) log$1(`${styleText("gray", "•")} Prettier migrated to Oxfmt`);
324
+ if (report.nodeVersionFileMigrated) log$1(`${styleText("gray", "•")} Node version manager file migrated to .node-version`);
308
325
  if (report.gitHooksConfigured) log$1(`${styleText("gray", "•")} Git hooks configured`);
309
326
  if (report.warnings.length > 0) {
310
327
  log$1(`${styleText("yellow", "!")} Warnings:`);
@@ -317,8 +334,8 @@ function showMigrationSummary(options) {
317
334
  }
318
335
  async function checkRolldownCompatibility(rootDir, report) {
319
336
  try {
320
- const { resolveConfig } = await import("./src-B-pcmd0F.js");
321
- const { checkManualChunksCompat } = await import("./compat-Ch3iWOnQ.js");
337
+ const { resolveConfig } = await import("./src-CXhDaJZD.js");
338
+ const { checkManualChunksCompat } = await import("./compat-CiHwUbA_.js");
322
339
  checkManualChunksCompat((await resolveConfig({
323
340
  root: rootDir,
324
341
  logLevel: "silent",
@@ -370,6 +387,10 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive) {
370
387
  log.error(`✘ npm@${downloadResult.version} is not supported by auto migration, please upgrade npm to >=8.3.0 first`);
371
388
  cancelAndExit("Vite+ cannot automatically migrate this project yet.", 1);
372
389
  }
390
+ if (plan.migrateNodeVersionFile && plan.nodeVersionDetection) {
391
+ updateMigrationProgress("Migrating node version file");
392
+ migrateNodeVersionManagerFile(workspaceInfo.rootDir, plan.nodeVersionDetection, report);
393
+ }
373
394
  updateMigrationProgress("Installing dependencies");
374
395
  const initialInstallSummary = await runViteInstall(workspaceInfo.rootDir, interactive, void 0, { silent: true });
375
396
  updateMigrationProgress("Validating toolchain");
@@ -426,7 +447,7 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive) {
426
447
  conflictDecisions: plan.editorConflictDecisions,
427
448
  silent: true
428
449
  });
429
- const installArgs = plan.packageManager === PackageManager.npm ? ["--force"] : void 0;
450
+ const installArgs = plan.packageManager === PackageManager.npm || plan.packageManager === PackageManager.bun ? ["--force"] : void 0;
430
451
  updateMigrationProgress("Installing dependencies");
431
452
  const finalInstallSummary = await runViteInstall(workspaceInfo.rootDir, interactive, installArgs, { silent: true });
432
453
  clearMigrationProgress();
@@ -470,6 +491,10 @@ async function main() {
470
491
  };
471
492
  const eslintMigrated = await promptEslintMigration(workspaceInfoOptional.rootDir, options.interactive, workspaceInfoOptional.packages);
472
493
  const prettierMigrated = await promptPrettierMigration(workspaceInfoOptional.rootDir, options.interactive, workspaceInfoOptional.packages);
494
+ const nodeVersionDetection = detectNodeVersionManagerFile(workspaceInfoOptional.rootDir);
495
+ if (nodeVersionDetection) {
496
+ if (await confirmNodeVersionFileMigration(options.interactive) && migrateNodeVersionManagerFile(workspaceInfoOptional.rootDir, nodeVersionDetection, report)) didMigrate = true;
497
+ }
473
498
  if (eslintMigrated || prettierMigrated) {
474
499
  updateMigrationProgress("Rewriting configs");
475
500
  mergeViteConfigFiles(workspaceInfoOptional.rootDir, true, report);