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

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.
@@ -7,7 +7,7 @@ import { existsSync } from 'node:fs';
7
7
  import { join } from 'node:path';
8
8
  import mri from 'mri';
9
9
  import { vitePlusHeader } from '../../binding/index.js';
10
- import { ensurePreCommitHook } from '../migration/migrator.js';
10
+ import { ensurePreCommitHook, hasStagedConfigInViteConfig } from '../migration/migrator.js';
11
11
  import { updateExistingAgentInstructions } from '../utils/agent.js';
12
12
  import { renderCliDoc } from '../utils/help.js';
13
13
  import { defaultInteractive, promptGitHooks } from '../utils/prompts.js';
@@ -48,15 +48,21 @@ async function main() {
48
48
  const dir = args['hooks-dir'];
49
49
  const hooksOnly = args['hooks-only'];
50
50
  const interactive = defaultInteractive();
51
- const isPrepareScript = process.env.npm_lifecycle_event === 'prepare';
51
+ const lifecycleEvent = process.env.npm_lifecycle_event;
52
+ const isLifecycleScript = lifecycleEvent === 'prepare' || lifecycleEvent === 'postinstall';
52
53
  const root = process.cwd();
53
54
  // --- Step 1: Hooks setup ---
54
55
  const hooksDir = dir ?? '.vite-hooks';
55
56
  const isFirstHooksRun = !existsSync(join(root, hooksDir, '_', 'pre-commit'));
56
57
  let shouldSetupHooks = true;
57
- if (interactive && isFirstHooksRun && !dir && !isPrepareScript) {
58
+ if (interactive &&
59
+ isFirstHooksRun &&
60
+ !dir &&
61
+ !isLifecycleScript &&
62
+ !hasStagedConfigInViteConfig(root)) {
58
63
  // --hooks-dir implies agreement; only prompt when using default dir on first run
59
- // prepare script implies the project opted into hooks — install automatically
64
+ // lifecycle script (prepare/postinstall) implies the project opted into hooks — install automatically
65
+ // existing staged config in vite.config.ts implies the project already opted in
60
66
  shouldSetupHooks = await promptGitHooks({ interactive });
61
67
  }
62
68
  if (shouldSetupHooks) {
@@ -2828,8 +2828,7 @@ var require_semver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2828
2828
  const PackageManager = {
2829
2829
  pnpm: "pnpm",
2830
2830
  npm: "npm",
2831
- yarn: "yarn",
2832
- bun: "bun"
2831
+ yarn: "yarn"
2833
2832
  };
2834
2833
  const DependencyType = {
2835
2834
  dependencies: "dependencies",
@@ -2898,8 +2897,7 @@ async function selectPackageManager(interactive, silent = false) {
2898
2897
  hint: "recommended"
2899
2898
  },
2900
2899
  { value: PackageManager.yarn },
2901
- { value: PackageManager.npm },
2902
- { value: PackageManager.bun }
2900
+ { value: PackageManager.npm }
2903
2901
  ],
2904
2902
  initialValue: PackageManager.pnpm
2905
2903
  });
@@ -3555,7 +3553,7 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
3555
3553
  ...pkg.resolutions,
3556
3554
  ...VITE_PLUS_OVERRIDE_PACKAGES
3557
3555
  };
3558
- else if (packageManager === PackageManager.npm || packageManager === PackageManager.bun) pkg.overrides = {
3556
+ else if (packageManager === PackageManager.npm) pkg.overrides = {
3559
3557
  ...pkg.overrides,
3560
3558
  ...VITE_PLUS_OVERRIDE_PACKAGES
3561
3559
  };
@@ -3593,7 +3591,6 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
3593
3591
  function rewriteMonorepo(workspaceInfo, skipStagedMigration, silent = false, report) {
3594
3592
  if (workspaceInfo.packageManager === PackageManager.pnpm) rewritePnpmWorkspaceYaml(workspaceInfo.rootDir);
3595
3593
  else if (workspaceInfo.packageManager === PackageManager.yarn) rewriteYarnrcYml(workspaceInfo.rootDir);
3596
- else if (workspaceInfo.packageManager === PackageManager.bun) rewriteBunCatalog(workspaceInfo.rootDir);
3597
3594
  rewriteRootWorkspacePackageJson(workspaceInfo.rootDir, workspaceInfo.packageManager, skipStagedMigration);
3598
3595
  for (const pkg of workspaceInfo.packages) rewriteMonorepoProject(path.join(workspaceInfo.rootDir, pkg.path), workspaceInfo.packageManager, skipStagedMigration, silent, report);
3599
3596
  if (!skipStagedMigration) rewriteLintStagedConfigFile(workspaceInfo.rootDir, report);
@@ -3695,27 +3692,6 @@ function rewriteCatalog(doc) {
3695
3692
  }
3696
3693
  }
3697
3694
  /**
3698
- * Write catalog entries to root package.json for bun.
3699
- * Bun stores catalogs in package.json under the `catalog` key,
3700
- * unlike pnpm which uses pnpm-workspace.yaml.
3701
- * @see https://bun.sh/docs/pm/catalogs
3702
- */
3703
- function rewriteBunCatalog(projectPath) {
3704
- const packageJsonPath = path.join(projectPath, "package.json");
3705
- if (!fs.existsSync(packageJsonPath)) return;
3706
- editJsonFile(packageJsonPath, (pkg) => {
3707
- const catalog = { ...pkg.catalog };
3708
- for (const [key, value] of Object.entries(VITE_PLUS_OVERRIDE_PACKAGES)) if (!value.startsWith("file:")) catalog[key] = value;
3709
- if (!VITE_PLUS_VERSION.startsWith("file:")) catalog[VITE_PLUS_NAME] = VITE_PLUS_VERSION;
3710
- for (const name of REMOVE_PACKAGES) delete catalog[name];
3711
- pkg.catalog = catalog;
3712
- const overrides = { ...pkg.overrides };
3713
- for (const key of Object.keys(VITE_PLUS_OVERRIDE_PACKAGES)) overrides[key] = "catalog:";
3714
- pkg.overrides = overrides;
3715
- return pkg;
3716
- });
3717
- }
3718
- /**
3719
3695
  * Rewrite root workspace package.json to add vite-plus dependencies
3720
3696
  * @param projectPath - The path to the project
3721
3697
  */
@@ -3731,7 +3707,7 @@ function rewriteRootWorkspacePackageJson(projectPath, packageManager, skipStaged
3731
3707
  ...pkg.overrides,
3732
3708
  ...VITE_PLUS_OVERRIDE_PACKAGES
3733
3709
  };
3734
- else if (packageManager === PackageManager.bun) {} else if (packageManager === PackageManager.pnpm) {
3710
+ else if (packageManager === PackageManager.pnpm) {
3735
3711
  if (isForceOverrideMode()) pkg.pnpm = {
3736
3712
  ...pkg.pnpm,
3737
3713
  overrides: {
@@ -4621,4 +4597,4 @@ function getMarkedRange(content, startMarker, endMarker) {
4621
4597
  };
4622
4598
  }
4623
4599
  //#endregion
4624
- export { templatesDir as A, select as B, downloadPackageManager$1 as C, selectPackageManager as D, runViteInstall as E, confirm as F, text as H, intro as I, log as L, PackageManager as M, require_semver as N, upgradeYarn as O, cancel as P, multiselect as R, defaultInteractive as S, runViteFmt as T, Ct as U, spinner as V, rewriteMonorepoProject as _, writeAgentInstructions as a, readYamlFile as b, detectEslintProject as c, installGitHooks as d, mergeViteConfigFiles as f, rewriteMonorepo as g, preflightGitHooksSetup as h, updateExistingAgentInstructions as i, DependencyType as j, displayRelative as k, detectPrettierProject as l, migratePrettierToOxfmt as m, detectExistingAgentTargetPaths as n, checkViteVersion as o, migrateEslintToOxlint as p, selectAgentTargetPaths as r, checkVitestVersion as s, detectAgentConflicts as t, ensurePreCommitHook as u, rewriteStandaloneProject as v, promptGitHooks as w, cancelAndExit as x, editYamlFile as y, outro as z };
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 };
@@ -1,4 +1,4 @@
1
- import { S as defaultInteractive, i as updateExistingAgentInstructions, u as ensurePreCommitHook, w as promptGitHooks } from "./agent-soFdSW5Z.js";
1
+ import { C as defaultInteractive, T as promptGitHooks, d as hasStagedConfigInViteConfig, i as updateExistingAgentInstructions, u as ensurePreCommitHook } from "./agent-BJ8PFvbU.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";
@@ -141,12 +141,13 @@ async function main() {
141
141
  const dir = args["hooks-dir"];
142
142
  const hooksOnly = args["hooks-only"];
143
143
  const interactive = defaultInteractive();
144
- const isPrepareScript = process.env.npm_lifecycle_event === "prepare";
144
+ const lifecycleEvent = process.env.npm_lifecycle_event;
145
+ const isLifecycleScript = lifecycleEvent === "prepare" || lifecycleEvent === "postinstall";
145
146
  const root = process.cwd();
146
147
  const hooksDir = dir ?? ".vite-hooks";
147
148
  const isFirstHooksRun = !existsSync(join(root, hooksDir, "_", "pre-commit"));
148
149
  let shouldSetupHooks = true;
149
- if (interactive && isFirstHooksRun && !dir && !isPrepareScript) shouldSetupHooks = await promptGitHooks({ interactive });
150
+ if (interactive && isFirstHooksRun && !dir && !isLifecycleScript && !hasStagedConfigInViteConfig(root)) shouldSetupHooks = await promptGitHooks({ interactive });
150
151
  if (shouldSetupHooks) {
151
152
  const { message, isError } = install(dir);
152
153
  if (message) {
@@ -1,9 +1,9 @@
1
1
  import { r as __toESM, t as __commonJSMin } from "./chunk-BoAXSpZd.js";
2
- import { A as templatesDir, B as select, C as downloadPackageManager$1, D as selectPackageManager, E as runViteInstall, F as confirm, H as text, I as intro, L as log, M as PackageManager, P as cancel, R as multiselect, S as defaultInteractive, T as runViteFmt, U as Ct, V as spinner, _ as rewriteMonorepoProject, a as writeAgentInstructions, d as installGitHooks, g as rewriteMonorepo, j as DependencyType, k as displayRelative, n as detectExistingAgentTargetPaths, r as selectAgentTargetPaths, v as rewriteStandaloneProject, w as promptGitHooks } from "./agent-soFdSW5Z.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";
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-A1-sHiSV.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";
7
7
  import path from "node:path";
8
8
  import { styleText } from "node:util";
9
9
  import color from "picocolors";
@@ -97,10 +97,6 @@ function getPackageRunner(workspaceInfo) {
97
97
  command: "yarn",
98
98
  args: ["dlx"]
99
99
  };
100
- case "bun": return {
101
- command: "bun",
102
- args: ["x"]
103
- };
104
100
  default: return {
105
101
  command: "npx",
106
102
  args: []
@@ -109,7 +105,7 @@ function getPackageRunner(workspaceInfo) {
109
105
  }
110
106
  function formatDlxCommand(packageName, args, workspaceInfo) {
111
107
  const runner = getPackageRunner(workspaceInfo);
112
- const dlxArgs = runner.command === "npx" ? ["--", ...args] : args;
108
+ const dlxArgs = runner.command === "npm" ? ["--", ...args] : args;
113
109
  return {
114
110
  command: runner.command,
115
111
  args: [
@@ -3690,10 +3686,6 @@ const helpMessage = renderCliDoc({
3690
3686
  label: "--no-hooks",
3691
3687
  description: "Skip pre-commit hooks setup"
3692
3688
  },
3693
- {
3694
- label: "--package-manager NAME",
3695
- description: "Use specified package manager (pnpm, npm, yarn, bun)"
3696
- },
3697
3689
  {
3698
3690
  label: "--verbose",
3699
3691
  description: "Show detailed scaffolding output"
@@ -3837,8 +3829,7 @@ function parseArgs() {
3837
3829
  string: [
3838
3830
  "directory",
3839
3831
  "agent",
3840
- "editor",
3841
- "package-manager"
3832
+ "editor"
3842
3833
  ],
3843
3834
  default: { interactive: defaultInteractive() }
3844
3835
  });
@@ -3852,8 +3843,7 @@ function parseArgs() {
3852
3843
  verbose: parsed.verbose || false,
3853
3844
  agent: parsed.agent,
3854
3845
  editor: parsed.editor,
3855
- hooks: parsed.hooks,
3856
- packageManager: parsed["package-manager"]
3846
+ hooks: parsed.hooks
3857
3847
  },
3858
3848
  templateArgs
3859
3849
  };
@@ -4055,7 +4045,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
4055
4045
  packageName = selected.packageName;
4056
4046
  targetDir = selectedParentDir ? path.join(selectedParentDir, selected.targetDir).split(path.sep).join("/") : selected.targetDir;
4057
4047
  }
4058
- const packageManager = workspaceInfoOptional.packageManager ?? options.packageManager ?? await selectPackageManager(options.interactive, compactOutput);
4048
+ const packageManager = workspaceInfoOptional.packageManager ?? await selectPackageManager(options.interactive, compactOutput);
4059
4049
  const shouldSilencePackageManagerInstallLog = compactOutput || isMonorepo && workspaceInfoOptional.packageManager !== void 0;
4060
4050
  const downloadResult = await downloadPackageManager$1(packageManager, workspaceInfoOptional.packageManagerVersion, options.interactive, shouldSilencePackageManagerInstallLog);
4061
4051
  const workspaceInfo = {
@@ -1,10 +1,10 @@
1
1
  import { r as __toESM } from "./chunk-BoAXSpZd.js";
2
- import { B as select, C as downloadPackageManager$1, D as selectPackageManager, E as runViteInstall, F as confirm, L as log, M as PackageManager, N as require_semver, O as upgradeYarn, S as defaultInteractive, U as Ct, V as spinner, a as writeAgentInstructions, c as detectEslintProject, d as installGitHooks, f as mergeViteConfigFiles, g as rewriteMonorepo, h as preflightGitHooksSetup, k as displayRelative, l as detectPrettierProject, m as migratePrettierToOxfmt, n as detectExistingAgentTargetPaths, o as checkViteVersion, p as migrateEslintToOxlint, r as selectAgentTargetPaths, s as checkVitestVersion, t as detectAgentConflicts, v as rewriteStandaloneProject, w as promptGitHooks, x as cancelAndExit, z as outro } from "./agent-soFdSW5Z.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";
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-A1-sHiSV.js";
7
+ import { i as detectEditorConflicts, o as selectEditor, s as writeEditorConfigs, t as detectWorkspace$1 } from "./workspace-BnY0PTee.js";
8
8
  import path from "node:path";
9
9
  import { styleText } from "node:util";
10
10
  import { vitePlusHeader } from "../../binding/index.js";
@@ -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 || plan.packageManager === PackageManager.bun ? ["--force"] : void 0;
429
+ const installArgs = plan.packageManager === PackageManager.npm ? ["--force"] : void 0;
430
430
  updateMigrationProgress("Installing dependencies");
431
431
  const finalInstallSummary = await runViteInstall(workspaceInfo.rootDir, interactive, installArgs, { silent: true });
432
432
  clearMigrationProgress();
@@ -3229,10 +3229,11 @@ const chunkFiles = ({ files, baseDir, maxArgLength = null, relative = false }) =
3229
3229
  return chunkArray(normalizedFiles, chunkCount);
3230
3230
  };
3231
3231
  //#endregion
3232
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js
3232
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
3233
3233
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3234
3234
  const WIN_SLASH = "\\\\/";
3235
3235
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
3236
+ const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
3236
3237
  /**
3237
3238
  * Posix glob regex
3238
3239
  */
@@ -3282,8 +3283,10 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3282
3283
  SEP: "\\"
3283
3284
  };
3284
3285
  module.exports = {
3286
+ DEFAULT_MAX_EXTGLOB_RECURSION,
3285
3287
  MAX_LENGTH: 1024 * 64,
3286
3288
  POSIX_REGEX_SOURCE: {
3289
+ __proto__: null,
3287
3290
  alnum: "a-zA-Z0-9",
3288
3291
  alpha: "a-zA-Z",
3289
3292
  ascii: "\\x00-\\x7F",
@@ -3389,7 +3392,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3389
3392
  };
3390
3393
  }));
3391
3394
  //#endregion
3392
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js
3395
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
3393
3396
  var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
3394
3397
  const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
3395
3398
  exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
@@ -3437,7 +3440,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
3437
3440
  };
3438
3441
  }));
3439
3442
  //#endregion
3440
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js
3443
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
3441
3444
  var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3442
3445
  const utils = require_utils();
3443
3446
  const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
@@ -3724,7 +3727,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3724
3727
  module.exports = scan;
3725
3728
  }));
3726
3729
  //#endregion
3727
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js
3730
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
3728
3731
  var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3729
3732
  const constants = require_constants();
3730
3733
  const utils = require_utils();
@@ -3752,6 +3755,177 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3752
3755
  const syntaxError = (type, char) => {
3753
3756
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
3754
3757
  };
3758
+ const splitTopLevel = (input) => {
3759
+ const parts = [];
3760
+ let bracket = 0;
3761
+ let paren = 0;
3762
+ let quote = 0;
3763
+ let value = "";
3764
+ let escaped = false;
3765
+ for (const ch of input) {
3766
+ if (escaped === true) {
3767
+ value += ch;
3768
+ escaped = false;
3769
+ continue;
3770
+ }
3771
+ if (ch === "\\") {
3772
+ value += ch;
3773
+ escaped = true;
3774
+ continue;
3775
+ }
3776
+ if (ch === "\"") {
3777
+ quote = quote === 1 ? 0 : 1;
3778
+ value += ch;
3779
+ continue;
3780
+ }
3781
+ if (quote === 0) {
3782
+ if (ch === "[") bracket++;
3783
+ else if (ch === "]" && bracket > 0) bracket--;
3784
+ else if (bracket === 0) {
3785
+ if (ch === "(") paren++;
3786
+ else if (ch === ")" && paren > 0) paren--;
3787
+ else if (ch === "|" && paren === 0) {
3788
+ parts.push(value);
3789
+ value = "";
3790
+ continue;
3791
+ }
3792
+ }
3793
+ }
3794
+ value += ch;
3795
+ }
3796
+ parts.push(value);
3797
+ return parts;
3798
+ };
3799
+ const isPlainBranch = (branch) => {
3800
+ let escaped = false;
3801
+ for (const ch of branch) {
3802
+ if (escaped === true) {
3803
+ escaped = false;
3804
+ continue;
3805
+ }
3806
+ if (ch === "\\") {
3807
+ escaped = true;
3808
+ continue;
3809
+ }
3810
+ if (/[?*+@!()[\]{}]/.test(ch)) return false;
3811
+ }
3812
+ return true;
3813
+ };
3814
+ const normalizeSimpleBranch = (branch) => {
3815
+ let value = branch.trim();
3816
+ let changed = true;
3817
+ while (changed === true) {
3818
+ changed = false;
3819
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
3820
+ value = value.slice(2, -1);
3821
+ changed = true;
3822
+ }
3823
+ }
3824
+ if (!isPlainBranch(value)) return;
3825
+ return value.replace(/\\(.)/g, "$1");
3826
+ };
3827
+ const hasRepeatedCharPrefixOverlap = (branches) => {
3828
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
3829
+ for (let i = 0; i < values.length; i++) for (let j = i + 1; j < values.length; j++) {
3830
+ const a = values[i];
3831
+ const b = values[j];
3832
+ const char = a[0];
3833
+ if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) continue;
3834
+ if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
3835
+ }
3836
+ return false;
3837
+ };
3838
+ const parseRepeatedExtglob = (pattern, requireEnd = true) => {
3839
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") return;
3840
+ let bracket = 0;
3841
+ let paren = 0;
3842
+ let quote = 0;
3843
+ let escaped = false;
3844
+ for (let i = 1; i < pattern.length; i++) {
3845
+ const ch = pattern[i];
3846
+ if (escaped === true) {
3847
+ escaped = false;
3848
+ continue;
3849
+ }
3850
+ if (ch === "\\") {
3851
+ escaped = true;
3852
+ continue;
3853
+ }
3854
+ if (ch === "\"") {
3855
+ quote = quote === 1 ? 0 : 1;
3856
+ continue;
3857
+ }
3858
+ if (quote === 1) continue;
3859
+ if (ch === "[") {
3860
+ bracket++;
3861
+ continue;
3862
+ }
3863
+ if (ch === "]" && bracket > 0) {
3864
+ bracket--;
3865
+ continue;
3866
+ }
3867
+ if (bracket > 0) continue;
3868
+ if (ch === "(") {
3869
+ paren++;
3870
+ continue;
3871
+ }
3872
+ if (ch === ")") {
3873
+ paren--;
3874
+ if (paren === 0) {
3875
+ if (requireEnd === true && i !== pattern.length - 1) return;
3876
+ return {
3877
+ type: pattern[0],
3878
+ body: pattern.slice(2, i),
3879
+ end: i
3880
+ };
3881
+ }
3882
+ }
3883
+ }
3884
+ };
3885
+ const getStarExtglobSequenceOutput = (pattern) => {
3886
+ let index = 0;
3887
+ const chars = [];
3888
+ while (index < pattern.length) {
3889
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
3890
+ if (!match || match.type !== "*") return;
3891
+ const branches = splitTopLevel(match.body).map((branch) => branch.trim());
3892
+ if (branches.length !== 1) return;
3893
+ const branch = normalizeSimpleBranch(branches[0]);
3894
+ if (!branch || branch.length !== 1) return;
3895
+ chars.push(branch);
3896
+ index += match.end + 1;
3897
+ }
3898
+ if (chars.length < 1) return;
3899
+ return `${chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`}*`;
3900
+ };
3901
+ const repeatedExtglobRecursion = (pattern) => {
3902
+ let depth = 0;
3903
+ let value = pattern.trim();
3904
+ let match = parseRepeatedExtglob(value);
3905
+ while (match) {
3906
+ depth++;
3907
+ value = match.body.trim();
3908
+ match = parseRepeatedExtglob(value);
3909
+ }
3910
+ return depth;
3911
+ };
3912
+ const analyzeRepeatedExtglob = (body, options) => {
3913
+ if (options.maxExtglobRecursion === false) return { risky: false };
3914
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
3915
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
3916
+ if (branches.length > 1) {
3917
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return { risky: true };
3918
+ }
3919
+ for (const branch of branches) {
3920
+ const safeOutput = getStarExtglobSequenceOutput(branch);
3921
+ if (safeOutput) return {
3922
+ risky: true,
3923
+ safeOutput
3924
+ };
3925
+ if (repeatedExtglobRecursion(branch) > max) return { risky: true };
3926
+ }
3927
+ return { risky: false };
3928
+ };
3755
3929
  /**
3756
3930
  * Parse the given input string.
3757
3931
  * @param {String} input
@@ -3881,6 +4055,8 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3881
4055
  token.prev = prev;
3882
4056
  token.parens = state.parens;
3883
4057
  token.output = state.output;
4058
+ token.startIndex = state.index;
4059
+ token.tokensIndex = tokens.length;
3884
4060
  const output = (opts.capture ? "(" : "") + token.open;
3885
4061
  increment("parens");
3886
4062
  push({
@@ -3897,6 +4073,30 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3897
4073
  extglobs.push(token);
3898
4074
  };
3899
4075
  const extglobClose = (token) => {
4076
+ const literal = input.slice(token.startIndex, state.index + 1);
4077
+ const analysis = analyzeRepeatedExtglob(input.slice(token.startIndex + 2, state.index), opts);
4078
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
4079
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
4080
+ const open = tokens[token.tokensIndex];
4081
+ open.type = "text";
4082
+ open.value = literal;
4083
+ open.output = safeOutput || utils.escapeRegex(literal);
4084
+ for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
4085
+ tokens[i].value = "";
4086
+ tokens[i].output = "";
4087
+ delete tokens[i].suffix;
4088
+ }
4089
+ state.output = token.output + open.output;
4090
+ state.backtrack = true;
4091
+ push({
4092
+ type: "paren",
4093
+ extglob: true,
4094
+ value,
4095
+ output: ""
4096
+ });
4097
+ decrement("parens");
4098
+ return;
4099
+ }
3900
4100
  let output = token.close + (opts.capture ? ")" : "");
3901
4101
  let rest;
3902
4102
  if (token.type === "negate") {
@@ -4582,7 +4782,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4582
4782
  module.exports = parse;
4583
4783
  }));
4584
4784
  //#endregion
4585
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js
4785
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
4586
4786
  var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4587
4787
  const scan = require_scan();
4588
4788
  const parse = require_parse();
@@ -4792,6 +4992,14 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4792
4992
  * Compile a regular expression from the `state` object returned by the
4793
4993
  * [parse()](#parse) method.
4794
4994
  *
4995
+ * ```js
4996
+ * const picomatch = require('picomatch');
4997
+ * const state = picomatch.parse('*.js');
4998
+ * // picomatch.compileRe(state[, options]);
4999
+ *
5000
+ * console.log(picomatch.compileRe(state));
5001
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
5002
+ * ```
4795
5003
  * @param {Object} `state`
4796
5004
  * @param {Object} `options`
4797
5005
  * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
@@ -4815,10 +5023,10 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4815
5023
  *
4816
5024
  * ```js
4817
5025
  * const picomatch = require('picomatch');
4818
- * const state = picomatch.parse('*.js');
4819
- * // picomatch.compileRe(state[, options]);
5026
+ * // picomatch.makeRe(state[, options]);
4820
5027
  *
4821
- * console.log(picomatch.compileRe(state));
5028
+ * const result = picomatch.makeRe('*.js');
5029
+ * console.log(result);
4822
5030
  * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
4823
5031
  * ```
4824
5032
  * @param {String} `state` The object returned from the `.parse` method.
@@ -1,4 +1,4 @@
1
- import { B as select, L as log, M as PackageManager, U as Ct, b as readYamlFile, y as editYamlFile } from "./agent-soFdSW5Z.js";
1
+ import { N as PackageManager, R as log, V as select, W as Ct, b as editYamlFile, x as readYamlFile } from "./agent-BJ8PFvbU.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";
@@ -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 || packageManager === PackageManager.bun) {
501
+ else if (packageManager === PackageManager.npm) {
502
502
  pkg.overrides = {
503
503
  ...pkg.overrides,
504
504
  ...VITE_PLUS_OVERRIDE_PACKAGES,
@@ -559,9 +559,6 @@ export function rewriteMonorepo(workspaceInfo, skipStagedMigration, silent = fal
559
559
  else if (workspaceInfo.packageManager === PackageManager.yarn) {
560
560
  rewriteYarnrcYml(workspaceInfo.rootDir);
561
561
  }
562
- else if (workspaceInfo.packageManager === PackageManager.bun) {
563
- rewriteBunCatalog(workspaceInfo.rootDir);
564
- }
565
562
  rewriteRootWorkspacePackageJson(workspaceInfo.rootDir, workspaceInfo.packageManager, skipStagedMigration);
566
563
  // rewrite packages
567
564
  for (const pkg of workspaceInfo.packages) {
@@ -719,42 +716,6 @@ function rewriteCatalog(doc) {
719
716
  }
720
717
  // TODO: rewrite `catalogs` when OVERRIDE_PACKAGES exists in catalog
721
718
  }
722
- /**
723
- * Write catalog entries to root package.json for bun.
724
- * Bun stores catalogs in package.json under the `catalog` key,
725
- * unlike pnpm which uses pnpm-workspace.yaml.
726
- * @see https://bun.sh/docs/pm/catalogs
727
- */
728
- function rewriteBunCatalog(projectPath) {
729
- const packageJsonPath = path.join(projectPath, 'package.json');
730
- if (!fs.existsSync(packageJsonPath)) {
731
- return;
732
- }
733
- editJsonFile(packageJsonPath, (pkg) => {
734
- const catalog = { ...pkg.catalog };
735
- // Add vite-plus managed packages to catalog
736
- for (const [key, value] of Object.entries(VITE_PLUS_OVERRIDE_PACKAGES)) {
737
- if (!value.startsWith('file:')) {
738
- catalog[key] = value;
739
- }
740
- }
741
- if (!VITE_PLUS_VERSION.startsWith('file:')) {
742
- catalog[VITE_PLUS_NAME] = VITE_PLUS_VERSION;
743
- }
744
- // Remove replaced packages from catalog
745
- for (const name of REMOVE_PACKAGES) {
746
- delete catalog[name];
747
- }
748
- pkg.catalog = catalog;
749
- // bun overrides support catalog: references
750
- const overrides = { ...pkg.overrides };
751
- for (const key of Object.keys(VITE_PLUS_OVERRIDE_PACKAGES)) {
752
- overrides[key] = 'catalog:';
753
- }
754
- pkg.overrides = overrides;
755
- return pkg;
756
- });
757
- }
758
719
  /**
759
720
  * Rewrite root workspace package.json to add vite-plus dependencies
760
721
  * @param projectPath - The path to the project
@@ -779,9 +740,6 @@ function rewriteRootWorkspacePackageJson(projectPath, packageManager, skipStaged
779
740
  ...VITE_PLUS_OVERRIDE_PACKAGES,
780
741
  };
781
742
  }
782
- else if (packageManager === PackageManager.bun) {
783
- // bun overrides are handled in rewriteBunCatalog() with catalog: references
784
- }
785
743
  else if (packageManager === PackageManager.pnpm) {
786
744
  if (isForceOverrideMode()) {
787
745
  // In force-override mode, keep overrides in package.json pnpm.overrides
@@ -1,3 +1,20 @@
1
+ export type AutoInput = {
2
+ /**
3
+ * Automatically track which files the task reads
4
+ */
5
+ auto: boolean;
6
+ };
7
+ export type GlobWithBase = {
8
+ /**
9
+ * The glob pattern (positive or negative starting with `!`)
10
+ */
11
+ pattern: string;
12
+ /**
13
+ * The base directory for resolving the pattern
14
+ */
15
+ base: InputBase;
16
+ };
17
+ export type InputBase = 'package' | 'workspace';
1
18
  export type Task = {
2
19
  /**
3
20
  * The command to run for the task.
@@ -29,18 +46,12 @@ export type Task = {
29
46
  *
30
47
  * - Omitted: automatically tracks which files the task reads
31
48
  * - `[]` (empty): disables file tracking entirely
32
- * - Glob patterns (e.g. `"src/**"`) select specific files
49
+ * - Glob patterns (e.g. `"src/**"`) select specific files, relative to the package directory
50
+ * - `{pattern: "...", base: "workspace" | "package"}` specifies a glob with an explicit base directory
33
51
  * - `{auto: true}` enables automatic file tracking
34
52
  * - Negative patterns (e.g. `"!dist/**"`) exclude matched files
35
- *
36
- * Patterns are relative to the package directory.
37
- */
38
- input?: Array<string | {
39
- /**
40
- * Automatically track which files the task reads
41
- */
42
- auto: boolean;
43
- }>;
53
+ */
54
+ input?: Array<string | GlobWithBase | AutoInput>;
44
55
  } | {
45
56
  /**
46
57
  * Whether to cache the task
@@ -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" | "bun">;
9
+ export declare function selectPackageManager(interactive?: boolean, silent?: boolean): Promise<"pnpm" | "npm" | "yarn">;
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,7 +15,6 @@ 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 },
19
18
  ],
20
19
  initialValue: PackageManager.pnpm,
21
20
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plus",
3
- "version": "0.1.15-alpha.0",
3
+ "version": "0.1.15-alpha.1",
4
4
  "description": "The Unified Toolchain for the Web",
5
5
  "homepage": "https://viteplus.dev/guide",
6
6
  "bugs": {
@@ -315,10 +315,10 @@
315
315
  "cross-spawn": "^7.0.5",
316
316
  "oxfmt": "=0.42.0",
317
317
  "oxlint": "=1.57.0",
318
- "oxlint-tsgolint": "=0.17.3",
318
+ "oxlint-tsgolint": "=0.17.4",
319
319
  "picocolors": "^1.1.1",
320
- "@voidzero-dev/vite-plus-core": "0.1.15-alpha.0",
321
- "@voidzero-dev/vite-plus-test": "0.1.15-alpha.0"
320
+ "@voidzero-dev/vite-plus-core": "0.1.15-alpha.1",
321
+ "@voidzero-dev/vite-plus-test": "0.1.15-alpha.1"
322
322
  },
323
323
  "devDependencies": {
324
324
  "@napi-rs/cli": "^3.4.1",
@@ -337,12 +337,12 @@
337
337
  "mri": "^1.2.0",
338
338
  "rolldown-plugin-dts": "^0.22.0",
339
339
  "semver": "^7.7.3",
340
- "tsdown": "^0.21.4",
340
+ "tsdown": "^0.21.5",
341
341
  "validate-npm-package-name": "^7.0.2",
342
342
  "yaml": "^2.8.1",
343
343
  "@voidzero-dev/vite-plus-prompts": "0.0.0",
344
- "vite": "npm:@voidzero-dev/vite-plus-core@0.1.15-alpha.0",
345
- "rolldown": "1.0.0-rc.11"
344
+ "rolldown": "1.0.0-rc.12",
345
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.1.15-alpha.1"
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.0",
366
- "@voidzero-dev/vite-plus-darwin-x64": "0.1.15-alpha.0",
367
- "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.15-alpha.0",
368
- "@voidzero-dev/vite-plus-linux-arm64-musl": "0.1.15-alpha.0",
369
- "@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.15-alpha.0",
370
- "@voidzero-dev/vite-plus-linux-x64-musl": "0.1.15-alpha.0",
371
- "@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.15-alpha.0",
372
- "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.15-alpha.0"
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"
373
373
  },
374
374
  "scripts": {
375
375
  "build": "oxnode -C dev ./build.ts",