vite-plus 0.1.15-alpha.0 → 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.
@@ -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) {
@@ -3476,7 +3476,7 @@ async function migratePrettierToOxfmt(projectPath, interactive, prettierConfigFi
3476
3476
  if (packages) for (const pkg of packages) rewritePrettierPackageJson(path.join(projectPath, pkg.path, "package.json"));
3477
3477
  rewritePrettierLintStagedConfigFiles(projectPath, options?.report);
3478
3478
  const prettierIgnorePath = path.join(projectPath, ".prettierignore");
3479
- 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);
3480
3480
  return true;
3481
3481
  }
3482
3482
  function deletePrettierConfigFiles(basePath, report, silent = false) {
@@ -3582,6 +3582,7 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
3582
3582
  if (!skipStagedMigration) rewriteLintStagedConfigFile(projectPath, report);
3583
3583
  mergeViteConfigFiles(projectPath, silent, report);
3584
3584
  injectLintTypeCheckDefaults(projectPath, silent, report);
3585
+ injectFmtDefaults(projectPath, silent, report);
3585
3586
  mergeTsdownConfigFile(projectPath, silent, report);
3586
3587
  rewriteAllImports(projectPath, silent, report);
3587
3588
  setPackageManager(projectPath, workspaceInfo.downloadPackageManager);
@@ -3599,6 +3600,7 @@ function rewriteMonorepo(workspaceInfo, skipStagedMigration, silent = false, rep
3599
3600
  if (!skipStagedMigration) rewriteLintStagedConfigFile(workspaceInfo.rootDir, report);
3600
3601
  mergeViteConfigFiles(workspaceInfo.rootDir, silent, report);
3601
3602
  injectLintTypeCheckDefaults(workspaceInfo.rootDir, silent, report);
3603
+ injectFmtDefaults(workspaceInfo.rootDir, silent, report);
3602
3604
  mergeTsdownConfigFile(workspaceInfo.rootDir, silent, report);
3603
3605
  rewriteAllImports(workspaceInfo.rootDir, silent, report);
3604
3606
  setPackageManager(workspaceInfo.rootDir, workspaceInfo.downloadPackageManager);
@@ -3925,6 +3927,9 @@ function injectLintTypeCheckDefaults(projectPath, silent = false, report) {
3925
3927
  typeCheck: true
3926
3928
  } }), silent, report);
3927
3929
  }
3930
+ function injectFmtDefaults(projectPath, silent = false, report) {
3931
+ injectConfigDefaults(projectPath, "fmt", ".vite-plus-fmt-init.oxfmtrc.json", JSON.stringify({}), silent, report);
3932
+ }
3928
3933
  function injectConfigDefaults(projectPath, configKey, tempFileName, tempFileContent, silent, report) {
3929
3934
  const configs = detectConfigs(projectPath);
3930
3935
  if (configs.viteConfig) {
@@ -4621,4 +4626,4 @@ function getMarkedRange(content, startMarker, endMarker) {
4621
4626
  };
4622
4627
  }
4623
4628
  //#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 };
4629
+ 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-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";
@@ -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-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-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-CIZWj4FM.js";
7
7
  import path from "node:path";
8
8
  import { styleText } from "node:util";
9
9
  import color from "picocolors";
@@ -4055,6 +4055,11 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
4055
4055
  packageName = selected.packageName;
4056
4056
  targetDir = selectedParentDir ? path.join(selectedParentDir, selected.targetDir).split(path.sep).join("/") : selected.targetDir;
4057
4057
  }
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
+ }
4058
4063
  const packageManager = workspaceInfoOptional.packageManager ?? options.packageManager ?? await selectPackageManager(options.interactive, compactOutput);
4059
4064
  const shouldSilencePackageManagerInstallLog = compactOutput || isMonorepo && workspaceInfoOptional.packageManager !== void 0;
4060
4065
  const downloadResult = await downloadPackageManager$1(packageManager, workspaceInfoOptional.packageManagerVersion, options.interactive, shouldSilencePackageManagerInstallLog);
@@ -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-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-A1-sHiSV.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,
@@ -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,
@@ -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.
@@ -6703,7 +6911,7 @@ function findWorkspaceRoot(startDir) {
6703
6911
  * Resolve vite.config.ts and return the config object.
6704
6912
  */
6705
6913
  async function resolveViteConfig(cwd, options) {
6706
- const { resolveConfig } = await import("./src-B-pcmd0F.js");
6914
+ const { resolveConfig } = await import("./src-CXhDaJZD.js");
6707
6915
  if (options?.traverseUp && !hasViteConfig(cwd)) {
6708
6916
  const workspaceRoot = findWorkspaceRoot(cwd);
6709
6917
  if (workspaceRoot) {
@@ -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-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
  }
@@ -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);
@@ -572,6 +573,7 @@ export function rewriteMonorepo(workspaceInfo, skipStagedMigration, silent = fal
572
573
  }
573
574
  mergeViteConfigFiles(workspaceInfo.rootDir, silent, report);
574
575
  injectLintTypeCheckDefaults(workspaceInfo.rootDir, silent, report);
576
+ injectFmtDefaults(workspaceInfo.rootDir, silent, report);
575
577
  mergeTsdownConfigFile(workspaceInfo.rootDir, silent, report);
576
578
  // rewrite imports in all TypeScript/JavaScript files
577
579
  rewriteAllImports(workspaceInfo.rootDir, silent, report);
@@ -1068,6 +1070,9 @@ export function injectLintTypeCheckDefaults(projectPath, silent = false, report)
1068
1070
  }
1069
1071
  injectConfigDefaults(projectPath, 'lint', '.vite-plus-lint-init.oxlintrc.json', JSON.stringify({ options: { typeAware: true, typeCheck: true } }), silent, report);
1070
1072
  }
1073
+ export function injectFmtDefaults(projectPath, silent = false, report) {
1074
+ injectConfigDefaults(projectPath, 'fmt', '.vite-plus-fmt-init.oxfmtrc.json', JSON.stringify({}), silent, report);
1075
+ }
1071
1076
  function injectConfigDefaults(projectPath, configKey, tempFileName, tempFileContent, silent, report) {
1072
1077
  const configs = detectConfigs(projectPath);
1073
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}`;
@@ -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
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.2",
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-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",
@@ -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.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.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.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",