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

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.
@@ -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
  });
@@ -3474,7 +3476,7 @@ async function migratePrettierToOxfmt(projectPath, interactive, prettierConfigFi
3474
3476
  if (packages) for (const pkg of packages) rewritePrettierPackageJson(path.join(projectPath, pkg.path, "package.json"));
3475
3477
  rewritePrettierLintStagedConfigFiles(projectPath, options?.report);
3476
3478
  const prettierIgnorePath = path.join(projectPath, ".prettierignore");
3477
- if (fs.existsSync(prettierIgnorePath)) warnMigration(`${displayRelative(prettierIgnorePath)} found — Oxfmt uses .oxfmtignore. Please migrate manually.`, options?.report);
3479
+ if (fs.existsSync(prettierIgnorePath)) warnMigration(`${displayRelative(prettierIgnorePath)} found — Oxfmt supports .prettierignore, but using the \`ignorePatterns\` option is recommended.`, options?.report);
3478
3480
  return true;
3479
3481
  }
3480
3482
  function deletePrettierConfigFiles(basePath, report, silent = false) {
@@ -3553,7 +3555,7 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
3553
3555
  ...pkg.resolutions,
3554
3556
  ...VITE_PLUS_OVERRIDE_PACKAGES
3555
3557
  };
3556
- else if (packageManager === PackageManager.npm) pkg.overrides = {
3558
+ else if (packageManager === PackageManager.npm || packageManager === PackageManager.bun) pkg.overrides = {
3557
3559
  ...pkg.overrides,
3558
3560
  ...VITE_PLUS_OVERRIDE_PACKAGES
3559
3561
  };
@@ -3580,6 +3582,7 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
3580
3582
  if (!skipStagedMigration) rewriteLintStagedConfigFile(projectPath, report);
3581
3583
  mergeViteConfigFiles(projectPath, silent, report);
3582
3584
  injectLintTypeCheckDefaults(projectPath, silent, report);
3585
+ injectFmtDefaults(projectPath, silent, report);
3583
3586
  mergeTsdownConfigFile(projectPath, silent, report);
3584
3587
  rewriteAllImports(projectPath, silent, report);
3585
3588
  setPackageManager(projectPath, workspaceInfo.downloadPackageManager);
@@ -3591,11 +3594,13 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
3591
3594
  function rewriteMonorepo(workspaceInfo, skipStagedMigration, silent = false, report) {
3592
3595
  if (workspaceInfo.packageManager === PackageManager.pnpm) rewritePnpmWorkspaceYaml(workspaceInfo.rootDir);
3593
3596
  else if (workspaceInfo.packageManager === PackageManager.yarn) rewriteYarnrcYml(workspaceInfo.rootDir);
3597
+ else if (workspaceInfo.packageManager === PackageManager.bun) rewriteBunCatalog(workspaceInfo.rootDir);
3594
3598
  rewriteRootWorkspacePackageJson(workspaceInfo.rootDir, workspaceInfo.packageManager, skipStagedMigration);
3595
3599
  for (const pkg of workspaceInfo.packages) rewriteMonorepoProject(path.join(workspaceInfo.rootDir, pkg.path), workspaceInfo.packageManager, skipStagedMigration, silent, report);
3596
3600
  if (!skipStagedMigration) rewriteLintStagedConfigFile(workspaceInfo.rootDir, report);
3597
3601
  mergeViteConfigFiles(workspaceInfo.rootDir, silent, report);
3598
3602
  injectLintTypeCheckDefaults(workspaceInfo.rootDir, silent, report);
3603
+ injectFmtDefaults(workspaceInfo.rootDir, silent, report);
3599
3604
  mergeTsdownConfigFile(workspaceInfo.rootDir, silent, report);
3600
3605
  rewriteAllImports(workspaceInfo.rootDir, silent, report);
3601
3606
  setPackageManager(workspaceInfo.rootDir, workspaceInfo.downloadPackageManager);
@@ -3692,6 +3697,27 @@ function rewriteCatalog(doc) {
3692
3697
  }
3693
3698
  }
3694
3699
  /**
3700
+ * Write catalog entries to root package.json for bun.
3701
+ * Bun stores catalogs in package.json under the `catalog` key,
3702
+ * unlike pnpm which uses pnpm-workspace.yaml.
3703
+ * @see https://bun.sh/docs/pm/catalogs
3704
+ */
3705
+ function rewriteBunCatalog(projectPath) {
3706
+ const packageJsonPath = path.join(projectPath, "package.json");
3707
+ if (!fs.existsSync(packageJsonPath)) return;
3708
+ editJsonFile(packageJsonPath, (pkg) => {
3709
+ const catalog = { ...pkg.catalog };
3710
+ for (const [key, value] of Object.entries(VITE_PLUS_OVERRIDE_PACKAGES)) if (!value.startsWith("file:")) catalog[key] = value;
3711
+ if (!VITE_PLUS_VERSION.startsWith("file:")) catalog[VITE_PLUS_NAME] = VITE_PLUS_VERSION;
3712
+ for (const name of REMOVE_PACKAGES) delete catalog[name];
3713
+ pkg.catalog = catalog;
3714
+ const overrides = { ...pkg.overrides };
3715
+ for (const key of Object.keys(VITE_PLUS_OVERRIDE_PACKAGES)) overrides[key] = "catalog:";
3716
+ pkg.overrides = overrides;
3717
+ return pkg;
3718
+ });
3719
+ }
3720
+ /**
3695
3721
  * Rewrite root workspace package.json to add vite-plus dependencies
3696
3722
  * @param projectPath - The path to the project
3697
3723
  */
@@ -3707,7 +3733,7 @@ function rewriteRootWorkspacePackageJson(projectPath, packageManager, skipStaged
3707
3733
  ...pkg.overrides,
3708
3734
  ...VITE_PLUS_OVERRIDE_PACKAGES
3709
3735
  };
3710
- else if (packageManager === PackageManager.pnpm) {
3736
+ else if (packageManager === PackageManager.bun) {} else if (packageManager === PackageManager.pnpm) {
3711
3737
  if (isForceOverrideMode()) pkg.pnpm = {
3712
3738
  ...pkg.pnpm,
3713
3739
  overrides: {
@@ -3901,6 +3927,9 @@ function injectLintTypeCheckDefaults(projectPath, silent = false, report) {
3901
3927
  typeCheck: true
3902
3928
  } }), silent, report);
3903
3929
  }
3930
+ function injectFmtDefaults(projectPath, silent = false, report) {
3931
+ injectConfigDefaults(projectPath, "fmt", ".vite-plus-fmt-init.oxfmtrc.json", JSON.stringify({}), silent, report);
3932
+ }
3904
3933
  function injectConfigDefaults(projectPath, configKey, tempFileName, tempFileContent, silent, report) {
3905
3934
  const configs = detectConfigs(projectPath);
3906
3935
  if (configs.viteConfig) {
@@ -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 { C as defaultInteractive, T as promptGitHooks, d as hasStagedConfigInViteConfig, i as updateExistingAgentInstructions, u as ensurePreCommitHook } from "./agent-D98pS-to.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 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-D98pS-to.js";
3
3
  import { t as lib_default } from "./lib-DxappLRQ.js";
4
4
  import { c as readJsonFile, o as editJsonFile, t as checkNpmPackageExists } from "./package-Y1UTfJnZ.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-CIZWj4FM.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 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-D98pS-to.js";
3
3
  import { t as lib_default } from "./lib-DxappLRQ.js";
4
4
  import { a as readNearestPackageJson, i as hasVitePlusDependency, m as isForceOverrideMode } from "./package-Y1UTfJnZ.js";
5
5
  import { a as muted, i as log$1, n as accent, t as renderCliDoc } from "./help-HviKaKAU.js";
6
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";
7
+ import { i as detectEditorConflicts, o as selectEditor, s as writeEditorConfigs, t as detectWorkspace$1 } from "./workspace-CIZWj4FM.js";
8
8
  import path from "node:path";
9
9
  import { styleText } from "node:util";
10
10
  import { vitePlusHeader } from "../../binding/index.js";
@@ -317,7 +317,7 @@ function showMigrationSummary(options) {
317
317
  }
318
318
  async function checkRolldownCompatibility(rootDir, report) {
319
319
  try {
320
- const { resolveConfig } = await import("./src-B-pcmd0F.js");
320
+ const { resolveConfig } = await import("./src-CXhDaJZD.js");
321
321
  const { checkManualChunksCompat } = await import("./compat-Ch3iWOnQ.js");
322
322
  checkManualChunksCompat((await resolveConfig({
323
323
  root: rootDir,
@@ -426,7 +426,7 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive) {
426
426
  conflictDecisions: plan.editorConflictDecisions,
427
427
  silent: true
428
428
  });
429
- const installArgs = plan.packageManager === PackageManager.npm ? ["--force"] : void 0;
429
+ const installArgs = plan.packageManager === PackageManager.npm || plan.packageManager === PackageManager.bun ? ["--force"] : void 0;
430
430
  updateMigrationProgress("Installing dependencies");
431
431
  const finalInstallSummary = await runViteInstall(workspaceInfo.rootDir, interactive, installArgs, { silent: true });
432
432
  clearMigrationProgress();
@@ -176,7 +176,7 @@ const isDeno = typeof process < "u" && typeof process.stdout < "u" && process.ve
176
176
  (isNode || isDeno) && process.platform;
177
177
  (isNode || isDeno) && process.stdout?.isTTY;
178
178
  //#endregion
179
- //#region ../test/dist/chunks/defaults.CdU2lD-q.js
179
+ //#region ../test/dist/chunks/defaults.9aQKnqFk.js
180
180
  const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
181
181
  const defaultExclude = ["**/node_modules/**", "**/.git/**"];
182
182
  const coverageConfigDefaults = {
@@ -188,14 +188,22 @@ const coverageConfigDefaults = {
188
188
  exclude: [],
189
189
  reportOnFailure: false,
190
190
  reporter: [
191
- ["text", {}],
192
- ["html", {}],
193
- ["clover", {}],
194
- ["json", {}]
191
+ "text",
192
+ "html",
193
+ "clover",
194
+ "json"
195
195
  ],
196
196
  allowExternal: false,
197
197
  excludeAfterRemap: false,
198
- processingConcurrency: Math.min(20, nodeos__default.availableParallelism?.() ?? nodeos__default.cpus().length)
198
+ processingConcurrency: Math.min(20, nodeos__default.availableParallelism?.() ?? nodeos__default.cpus().length),
199
+ ignoreClassMethods: [],
200
+ skipFull: false,
201
+ watermarks: {
202
+ statements: [50, 80],
203
+ functions: [50, 80],
204
+ branches: [50, 80],
205
+ lines: [50, 80]
206
+ }
199
207
  };
200
208
  Object.freeze({
201
209
  allowOnly: !m,
@@ -6911,7 +6911,7 @@ function findWorkspaceRoot(startDir) {
6911
6911
  * Resolve vite.config.ts and return the config object.
6912
6912
  */
6913
6913
  async function resolveViteConfig(cwd, options) {
6914
- const { resolveConfig } = await import("./src-B-pcmd0F.js");
6914
+ const { resolveConfig } = await import("./src-CXhDaJZD.js");
6915
6915
  if (options?.traverseUp && !hasViteConfig(cwd)) {
6916
6916
  const workspaceRoot = findWorkspaceRoot(cwd);
6917
6917
  if (workspaceRoot) {
@@ -1,4 +1,4 @@
1
- import { N as PackageManager, R as log, V as select, W as Ct, b as editYamlFile, x as readYamlFile } from "./agent-BJ8PFvbU.js";
1
+ import { N as PackageManager, R as log, V as select, W as Ct, b as editYamlFile, x as readYamlFile } from "./agent-D98pS-to.js";
2
2
  import { g as YAMLSeq, y as Scalar } from "./browser-09BZLUYM.js";
3
3
  import { c as readJsonFile, l as writeJsonFile, o as editJsonFile, r as getScopeFromPackageName } from "./package-Y1UTfJnZ.js";
4
4
  import path, { posix, win32 } from "node:path";
@@ -50,6 +50,7 @@ export declare function mergeViteConfigFiles(projectPath: string, silent?: boole
50
50
  * (e.g., newly created projects from create-vite templates).
51
51
  */
52
52
  export declare function injectLintTypeCheckDefaults(projectPath: string, silent?: boolean, report?: MigrationReport): void;
53
+ export declare function injectFmtDefaults(projectPath: string, silent?: boolean, report?: MigrationReport): void;
53
54
  /**
54
55
  * Merge a staged config object into vite.config.ts as `staged: { ... }`.
55
56
  * Writes the config to a temp JSON file, calls mergeJsonConfig NAPI, then cleans up.
@@ -392,7 +392,7 @@ export async function migratePrettierToOxfmt(projectPath, interactive, prettierC
392
392
  // Step 5: Warn about .prettierignore if it exists
393
393
  const prettierIgnorePath = path.join(projectPath, '.prettierignore');
394
394
  if (fs.existsSync(prettierIgnorePath)) {
395
- warnMigration(`${displayRelative(prettierIgnorePath)} found — Oxfmt uses .oxfmtignore. Please migrate manually.`, options?.report);
395
+ warnMigration(`${displayRelative(prettierIgnorePath)} found — Oxfmt supports .prettierignore, but using the \`ignorePatterns\` option is recommended.`, options?.report);
396
396
  }
397
397
  return true;
398
398
  }
@@ -498,7 +498,7 @@ export function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedM
498
498
  ...VITE_PLUS_OVERRIDE_PACKAGES,
499
499
  };
500
500
  }
501
- else if (packageManager === PackageManager.npm) {
501
+ else if (packageManager === PackageManager.npm || packageManager === PackageManager.bun) {
502
502
  pkg.overrides = {
503
503
  ...pkg.overrides,
504
504
  ...VITE_PLUS_OVERRIDE_PACKAGES,
@@ -541,6 +541,7 @@ export function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedM
541
541
  }
542
542
  mergeViteConfigFiles(projectPath, silent, report);
543
543
  injectLintTypeCheckDefaults(projectPath, silent, report);
544
+ injectFmtDefaults(projectPath, silent, report);
544
545
  mergeTsdownConfigFile(projectPath, silent, report);
545
546
  // rewrite imports in all TypeScript/JavaScript files
546
547
  rewriteAllImports(projectPath, silent, report);
@@ -559,6 +560,9 @@ export function rewriteMonorepo(workspaceInfo, skipStagedMigration, silent = fal
559
560
  else if (workspaceInfo.packageManager === PackageManager.yarn) {
560
561
  rewriteYarnrcYml(workspaceInfo.rootDir);
561
562
  }
563
+ else if (workspaceInfo.packageManager === PackageManager.bun) {
564
+ rewriteBunCatalog(workspaceInfo.rootDir);
565
+ }
562
566
  rewriteRootWorkspacePackageJson(workspaceInfo.rootDir, workspaceInfo.packageManager, skipStagedMigration);
563
567
  // rewrite packages
564
568
  for (const pkg of workspaceInfo.packages) {
@@ -569,6 +573,7 @@ export function rewriteMonorepo(workspaceInfo, skipStagedMigration, silent = fal
569
573
  }
570
574
  mergeViteConfigFiles(workspaceInfo.rootDir, silent, report);
571
575
  injectLintTypeCheckDefaults(workspaceInfo.rootDir, silent, report);
576
+ injectFmtDefaults(workspaceInfo.rootDir, silent, report);
572
577
  mergeTsdownConfigFile(workspaceInfo.rootDir, silent, report);
573
578
  // rewrite imports in all TypeScript/JavaScript files
574
579
  rewriteAllImports(workspaceInfo.rootDir, silent, report);
@@ -716,6 +721,42 @@ function rewriteCatalog(doc) {
716
721
  }
717
722
  // TODO: rewrite `catalogs` when OVERRIDE_PACKAGES exists in catalog
718
723
  }
724
+ /**
725
+ * Write catalog entries to root package.json for bun.
726
+ * Bun stores catalogs in package.json under the `catalog` key,
727
+ * unlike pnpm which uses pnpm-workspace.yaml.
728
+ * @see https://bun.sh/docs/pm/catalogs
729
+ */
730
+ function rewriteBunCatalog(projectPath) {
731
+ const packageJsonPath = path.join(projectPath, 'package.json');
732
+ if (!fs.existsSync(packageJsonPath)) {
733
+ return;
734
+ }
735
+ editJsonFile(packageJsonPath, (pkg) => {
736
+ const catalog = { ...pkg.catalog };
737
+ // Add vite-plus managed packages to catalog
738
+ for (const [key, value] of Object.entries(VITE_PLUS_OVERRIDE_PACKAGES)) {
739
+ if (!value.startsWith('file:')) {
740
+ catalog[key] = value;
741
+ }
742
+ }
743
+ if (!VITE_PLUS_VERSION.startsWith('file:')) {
744
+ catalog[VITE_PLUS_NAME] = VITE_PLUS_VERSION;
745
+ }
746
+ // Remove replaced packages from catalog
747
+ for (const name of REMOVE_PACKAGES) {
748
+ delete catalog[name];
749
+ }
750
+ pkg.catalog = catalog;
751
+ // bun overrides support catalog: references
752
+ const overrides = { ...pkg.overrides };
753
+ for (const key of Object.keys(VITE_PLUS_OVERRIDE_PACKAGES)) {
754
+ overrides[key] = 'catalog:';
755
+ }
756
+ pkg.overrides = overrides;
757
+ return pkg;
758
+ });
759
+ }
719
760
  /**
720
761
  * Rewrite root workspace package.json to add vite-plus dependencies
721
762
  * @param projectPath - The path to the project
@@ -740,6 +781,9 @@ function rewriteRootWorkspacePackageJson(projectPath, packageManager, skipStaged
740
781
  ...VITE_PLUS_OVERRIDE_PACKAGES,
741
782
  };
742
783
  }
784
+ else if (packageManager === PackageManager.bun) {
785
+ // bun overrides are handled in rewriteBunCatalog() with catalog: references
786
+ }
743
787
  else if (packageManager === PackageManager.pnpm) {
744
788
  if (isForceOverrideMode()) {
745
789
  // In force-override mode, keep overrides in package.json pnpm.overrides
@@ -1026,6 +1070,9 @@ export function injectLintTypeCheckDefaults(projectPath, silent = false, report)
1026
1070
  }
1027
1071
  injectConfigDefaults(projectPath, 'lint', '.vite-plus-lint-init.oxlintrc.json', JSON.stringify({ options: { typeAware: true, typeCheck: true } }), silent, report);
1028
1072
  }
1073
+ export function injectFmtDefaults(projectPath, silent = false, report) {
1074
+ injectConfigDefaults(projectPath, 'fmt', '.vite-plus-fmt-init.oxfmtrc.json', JSON.stringify({}), silent, report);
1075
+ }
1029
1076
  function injectConfigDefaults(projectPath, configKey, tempFileName, tempFileContent, silent, report) {
1030
1077
  const configs = detectConfigs(projectPath);
1031
1078
  if (configs.viteConfig) {
@@ -36,12 +36,16 @@ export async function lint() {
36
36
  const binPath = join(oxlintPackageRoot, 'bin', 'oxlint');
37
37
  let oxlintTsgolintPath = resolve('oxlint-tsgolint/bin/tsgolint');
38
38
  if (process.platform === 'win32') {
39
- // If on Windows, resolve the tsgolint binary from the local node_modules
40
- oxlintTsgolintPath = join(dirname(fileURLToPath(import.meta.url)), '..', 'node_modules', '.bin', 'tsgolint.cmd');
41
- if (!existsSync(oxlintTsgolintPath)) {
42
- // Fallback to the cwd node_modules
43
- oxlintTsgolintPath = join(process.cwd(), 'node_modules', '.bin', 'tsgolint.cmd');
44
- }
39
+ // On Windows, try .exe first (bun creates .exe), then .cmd (npm/pnpm/yarn create .cmd)
40
+ const localBinDir = join(dirname(fileURLToPath(import.meta.url)), '..', 'node_modules', '.bin');
41
+ const cwdBinDir = join(process.cwd(), 'node_modules', '.bin');
42
+ oxlintTsgolintPath =
43
+ [
44
+ join(localBinDir, 'tsgolint.exe'),
45
+ join(localBinDir, 'tsgolint.cmd'),
46
+ join(cwdBinDir, 'tsgolint.exe'),
47
+ join(cwdBinDir, 'tsgolint.cmd'),
48
+ ].find((p) => existsSync(p)) ?? join(cwdBinDir, 'tsgolint.cmd');
45
49
  const relativePath = relative(process.cwd(), oxlintTsgolintPath);
46
50
  // Only prepend .\ if it's actually a relative path (not an absolute path returned by relative())
47
51
  oxlintTsgolintPath = /^[a-zA-Z]:/.test(relativePath) ? relativePath : `.\\${relativePath}`;
@@ -6,7 +6,7 @@ export interface CommandRunSummary {
6
6
  status: 'installed' | 'formatted' | 'failed' | 'skipped';
7
7
  }
8
8
  export declare function cancelAndExit(message?: string, exitCode?: number): never;
9
- export declare function selectPackageManager(interactive?: boolean, silent?: boolean): Promise<"pnpm" | "npm" | "yarn">;
9
+ export declare function selectPackageManager(interactive?: boolean, silent?: boolean): Promise<"pnpm" | "npm" | "yarn" | "bun">;
10
10
  export declare function downloadPackageManager(packageManager: PackageManager, version: string, interactive?: boolean, silent?: boolean): Promise<import("../../binding/index.cjs").DownloadPackageManagerResult>;
11
11
  export declare function runViteInstall(cwd: string, interactive?: boolean, extraArgs?: string[], options?: {
12
12
  silent?: boolean;
@@ -15,6 +15,7 @@ export async function selectPackageManager(interactive, silent = false) {
15
15
  { value: PackageManager.pnpm, hint: 'recommended' },
16
16
  { value: PackageManager.yarn },
17
17
  { value: PackageManager.npm },
18
+ { value: PackageManager.bun },
18
19
  ],
19
20
  initialValue: PackageManager.pnpm,
20
21
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plus",
3
- "version": "0.1.15-alpha.1",
3
+ "version": "0.1.15-alpha.2",
4
4
  "description": "The Unified Toolchain for the Web",
5
5
  "homepage": "https://viteplus.dev/guide",
6
6
  "bugs": {
@@ -317,8 +317,8 @@
317
317
  "oxlint": "=1.57.0",
318
318
  "oxlint-tsgolint": "=0.17.4",
319
319
  "picocolors": "^1.1.1",
320
- "@voidzero-dev/vite-plus-core": "0.1.15-alpha.1",
321
- "@voidzero-dev/vite-plus-test": "0.1.15-alpha.1"
320
+ "@voidzero-dev/vite-plus-test": "0.1.15-alpha.2",
321
+ "@voidzero-dev/vite-plus-core": "0.1.15-alpha.2"
322
322
  },
323
323
  "devDependencies": {
324
324
  "@napi-rs/cli": "^3.4.1",
@@ -342,7 +342,7 @@
342
342
  "yaml": "^2.8.1",
343
343
  "@voidzero-dev/vite-plus-prompts": "0.0.0",
344
344
  "rolldown": "1.0.0-rc.12",
345
- "vite": "npm:@voidzero-dev/vite-plus-core@0.1.15-alpha.1"
345
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.1.15-alpha.2"
346
346
  },
347
347
  "napi": {
348
348
  "binaryName": "vite-plus",
@@ -362,14 +362,14 @@
362
362
  "node": "^20.19.0 || >=22.12.0"
363
363
  },
364
364
  "optionalDependencies": {
365
- "@voidzero-dev/vite-plus-darwin-arm64": "0.1.15-alpha.1",
366
- "@voidzero-dev/vite-plus-darwin-x64": "0.1.15-alpha.1",
367
- "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.15-alpha.1",
368
- "@voidzero-dev/vite-plus-linux-arm64-musl": "0.1.15-alpha.1",
369
- "@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.15-alpha.1",
370
- "@voidzero-dev/vite-plus-linux-x64-musl": "0.1.15-alpha.1",
371
- "@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.15-alpha.1",
372
- "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.15-alpha.1"
365
+ "@voidzero-dev/vite-plus-darwin-arm64": "0.1.15-alpha.2",
366
+ "@voidzero-dev/vite-plus-darwin-x64": "0.1.15-alpha.2",
367
+ "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.15-alpha.2",
368
+ "@voidzero-dev/vite-plus-linux-arm64-musl": "0.1.15-alpha.2",
369
+ "@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.15-alpha.2",
370
+ "@voidzero-dev/vite-plus-linux-x64-musl": "0.1.15-alpha.2",
371
+ "@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.15-alpha.2",
372
+ "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.15-alpha.2"
373
373
  },
374
374
  "scripts": {
375
375
  "build": "oxnode -C dev ./build.ts",