vite-plus 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +1 -1
  2. package/binding/index.cjs +53 -52
  3. package/binding/index.d.cts +43 -41
  4. package/dist/{agent-eMtwgY-u.js → agent-0gFJkIKu.js} +34 -109
  5. package/dist/bin.d.ts +1 -1
  6. package/dist/bin.js +8 -5
  7. package/dist/config/bin.d.ts +1 -1
  8. package/dist/config/bin.js +2 -2
  9. package/dist/{constants-DdXYYBsz.js → constants-CaXMuYUG.js} +1 -1
  10. package/dist/create/bin.js +73 -22
  11. package/dist/{define-config-BuMs_LKa.d.ts → define-config-eLQH9us2.d.ts} +2 -3
  12. package/dist/{define-config-Dn5coJS5.js → define-config-hV8qyU8p.js} +2 -2
  13. package/dist/{define-config-DUsBrwKn.cjs → define-config-iGV0CGUk.cjs} +1 -1
  14. package/dist/define-config.cjs +1 -1
  15. package/dist/define-config.d.ts +1 -1
  16. package/dist/define-config.js +1 -1
  17. package/dist/{editor-DL4u-ujK.js → editor-D4T70tKk.js} +95 -4
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/migration/bin.d.ts +1 -1
  22. package/dist/migration/bin.js +5 -5
  23. package/dist/migration/compat/worker.d.ts +1 -1
  24. package/dist/{oxlint-plugin-config-BiYDWQLd.js → oxlint-plugin-config-CMSCIkks.js} +1 -1
  25. package/dist/oxlint-plugin.js +1 -1
  26. package/dist/{pack-Ciiho0Tq.d.ts → pack-PvUg_xpv.d.ts} +0 -1
  27. package/dist/pack-bin.js +1 -1
  28. package/dist/pack.d.ts +1 -1
  29. package/dist/{package-D2xMMmTQ.js → package-CP5EUXlu.js} +1 -1
  30. package/dist/{resolve-vite-config-5SuNAKdv.js → resolve-vite-config-BY7PB-LW.js} +1 -1
  31. package/dist/staged/bin.d.ts +1 -1
  32. package/dist/staged/bin.js +47 -17
  33. package/dist/{tsconfig-CtdiYBV_.js → tsconfig-Cac-NNdT.js} +86 -78
  34. package/dist/version.js +2 -2
  35. package/dist/versions.js +6 -6
  36. package/docs/config/run.md +3 -6
  37. package/docs/guide/docker.md +46 -2
  38. package/docs/guide/env.md +12 -0
  39. package/docs/guide/github-actions-cache.md +2 -2
  40. package/docs/guide/index.md +2 -0
  41. package/docs/guide/installer-env-vars.md +195 -0
  42. package/package.json +20 -23
  43. package/templates/monorepo/_gitignore +5 -0
  44. package/templates/monorepo/_yarnrc.yml +1 -1
  45. package/templates/monorepo/pnpm-workspace.yaml +1 -1
@@ -1,13 +1,13 @@
1
1
  import { r as __toESM } from "./rolldown-runtime-C7HZzL1F.js";
2
- import { a as VITEST_AGE_GATE_EXEMPT_PACKAGES, c as VITE_PLUS_OVERRIDE_PACKAGES, d as isForceOverrideMode, l as VITE_PLUS_VERSION, n as BASEURL_TSCONFIG_WARNING, o as VITEST_VERSION, s as VITE_PLUS_NAME } from "./constants-DdXYYBsz.js";
3
- import { i as ensureVitePlusImportRuleDefaults, r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-BiYDWQLd.js";
4
- import { B as runCommandSilently, D as require_semver, E as PackageManager, M as multiselect, P as select, R as isCancel, V as require_cross_spawn, a as hasTypesToRewriteInTsconfig, b as scalarString, c as rewriteTypesInTsconfig, i as hasBaseUrlInTsconfig, j as log, k as confirm, l as cancelAndExit, n as findTsconfigFiles, o as hasVitestTypesInTsconfig, s as removeDeprecatedTsconfigFalseOption, v as editYamlFile, w as getSpinner, y as readYamlFile } from "./tsconfig-CtdiYBV_.js";
2
+ import { a as VITEST_AGE_GATE_EXEMPT_PACKAGES, c as VITE_PLUS_OVERRIDE_PACKAGES, d as isForceOverrideMode, l as VITE_PLUS_VERSION, n as BASEURL_TSCONFIG_WARNING, o as VITEST_VERSION, s as VITE_PLUS_NAME } from "./constants-CaXMuYUG.js";
3
+ import { i as ensureVitePlusImportRuleDefaults, r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-CMSCIkks.js";
4
+ import { B as runCommandSilently, D as require_semver, E as PackageManager, M as multiselect, P as select, R as isCancel, V as require_cross_spawn, a as hasTypesToRewriteInTsconfig, b as scalarString, c as rewriteTypesInTsconfig, i as hasBaseUrlInTsconfig, j as log, k as confirm, l as cancelAndExit, n as findTsconfigFiles, o as hasVitestTypesInTsconfig, s as removeDeprecatedTsconfigFalseOption, v as editYamlFile, w as getSpinner, y as readYamlFile } from "./tsconfig-Cac-NNdT.js";
5
5
  import { a as writeJsonFile, i as readJsonFile, n as editJsonFile, r as isJsonFile } from "./json-DiRs8ceZ.js";
6
6
  import { t as require_dist } from "./dist-CKz3vcoG.js";
7
- import { n as detectPackageMetadata, r as getScopeFromPackageName } from "./package-D2xMMmTQ.js";
7
+ import { n as detectPackageMetadata } from "./package-CP5EUXlu.js";
8
8
  import { n as addMigrationWarning, t as addManualStep } from "./report-BS7ULx7A.js";
9
9
  import path, { posix, win32 } from "node:path";
10
- import { detectWorkspace, hasConfigKey, mergeJsonConfig, mergeTsdownConfig, rewriteEslint, rewriteImportsInDirectory, rewriteScripts, wrapLazyPlugins } from "../binding/index.js";
10
+ import { hasConfigKey, mergeJsonConfig, mergeTsdownConfig, rewriteEslint, rewriteImportsInDirectory, rewriteScripts, wrapLazyPlugins } from "../binding/index.js";
11
11
  import * as actualFS from "node:fs";
12
12
  import fs from "node:fs";
13
13
  import { lstatSync, readdir, readdirSync, readlinkSync, realpathSync as realpathSync$1 } from "fs";
@@ -1062,6 +1062,7 @@ function collectVitestEcosystemInstallDependencyNames(rootDir, packages) {
1062
1062
  }
1063
1063
  //#endregion
1064
1064
  //#region ../../node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js
1065
+ var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
1065
1066
  const balanced = (a, b, str) => {
1066
1067
  const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
1067
1068
  const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
@@ -2556,9 +2557,14 @@ minimatch.escape = escape;
2556
2557
  minimatch.unescape = unescape;
2557
2558
  //#endregion
2558
2559
  //#region ../../node_modules/.pnpm/lru-cache@11.2.7/node_modules/lru-cache/dist/esm/index.min.js
2559
- var x = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, I = /* @__PURE__ */ new Set(), R = typeof process == "object" && process ? process : {}, U = (c, t, e, i) => {
2560
+ var x = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
2561
+ var I = /* @__PURE__ */ new Set();
2562
+ var R = typeof process == "object" && process ? process : {};
2563
+ var U = (c, t, e, i) => {
2560
2564
  typeof R.emitWarning == "function" ? R.emitWarning(c, t, e, i) : console.error(`[${e}] ${t}: ${c}`);
2561
- }, C = globalThis.AbortController, D = globalThis.AbortSignal;
2565
+ };
2566
+ var C = globalThis.AbortController;
2567
+ var D = globalThis.AbortSignal;
2562
2568
  if (typeof C > "u") {
2563
2569
  D = class {
2564
2570
  onabort;
@@ -2585,11 +2591,15 @@ if (typeof C > "u") {
2585
2591
  c && (c = !1, U("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
2586
2592
  };
2587
2593
  }
2588
- var G = (c) => !I.has(c), y = (c) => c && c === Math.floor(c) && c > 0 && isFinite(c), M = (c) => y(c) ? c <= Math.pow(2, 8) ? Uint8Array : c <= Math.pow(2, 16) ? Uint16Array : c <= Math.pow(2, 32) ? Uint32Array : c <= Number.MAX_SAFE_INTEGER ? z : null : null, z = class extends Array {
2594
+ var G = (c) => !I.has(c);
2595
+ var y = (c) => c && c === Math.floor(c) && c > 0 && isFinite(c);
2596
+ var M = (c) => y(c) ? c <= Math.pow(2, 8) ? Uint8Array : c <= Math.pow(2, 16) ? Uint16Array : c <= Math.pow(2, 32) ? Uint32Array : c <= Number.MAX_SAFE_INTEGER ? z : null : null;
2597
+ var z = class extends Array {
2589
2598
  constructor(t) {
2590
2599
  super(t), this.fill(0);
2591
2600
  }
2592
- }, W = class c {
2601
+ };
2602
+ var W = class c {
2593
2603
  heap;
2594
2604
  length;
2595
2605
  static #o = !1;
@@ -2610,7 +2620,8 @@ var G = (c) => !I.has(c), y = (c) => c && c === Math.floor(c) && c > 0 && isFini
2610
2620
  pop() {
2611
2621
  return this.heap[--this.length];
2612
2622
  }
2613
- }, L = class c {
2623
+ };
2624
+ var L = class c {
2614
2625
  #o;
2615
2626
  #c;
2616
2627
  #w;
@@ -6493,94 +6504,6 @@ const glob = Object.assign(glob_, {
6493
6504
  });
6494
6505
  glob.glob = glob;
6495
6506
  //#endregion
6496
- //#region src/utils/workspace.ts
6497
- async function detectWorkspace$1(rootDir) {
6498
- const bindingResult = await detectWorkspace(rootDir);
6499
- const result = {
6500
- rootDir,
6501
- packageManager: void 0,
6502
- packageManagerVersion: "latest",
6503
- isMonorepo: false,
6504
- monorepoScope: "",
6505
- workspacePatterns: [],
6506
- parentDirs: [],
6507
- packages: []
6508
- };
6509
- if (bindingResult.packageManagerName) result.packageManager = bindingResult.packageManagerName;
6510
- if (bindingResult.packageManagerVersion) result.packageManagerVersion = bindingResult.packageManagerVersion;
6511
- if (bindingResult.isMonorepo) result.isMonorepo = bindingResult.isMonorepo;
6512
- if (bindingResult.root) result.rootDir = bindingResult.root;
6513
- if (result.isMonorepo) {
6514
- const pnpmWorkspaceFile = path.join(result.rootDir, "pnpm-workspace.yaml");
6515
- const packageJsonFile = path.join(result.rootDir, "package.json");
6516
- if (fs.existsSync(pnpmWorkspaceFile)) {
6517
- const workspaceConfig = readYamlFile(pnpmWorkspaceFile);
6518
- if (Array.isArray(workspaceConfig.packages)) result.workspacePatterns = workspaceConfig.packages;
6519
- } else if (fs.existsSync(packageJsonFile)) {
6520
- const pkg = readJsonFile(packageJsonFile);
6521
- if (Array.isArray(pkg.workspaces)) result.workspacePatterns = pkg.workspaces;
6522
- else if (pkg.workspaces && Array.isArray(pkg.workspaces.packages)) result.workspacePatterns = pkg.workspaces.packages;
6523
- }
6524
- const dirs = /* @__PURE__ */ new Set();
6525
- for (const pattern of result.workspacePatterns) {
6526
- if (!pattern.endsWith("*")) continue;
6527
- const dir = pattern.replace(/\/\*{1,2}$/, "");
6528
- if (dir) dirs.add(dir);
6529
- }
6530
- result.parentDirs = Array.from(dirs).sort();
6531
- const pkg = readJsonFile(packageJsonFile);
6532
- if (pkg.name) result.monorepoScope = getScopeFromPackageName(pkg.name);
6533
- result.packages = discoverWorkspacePackages(result.workspacePatterns, result.rootDir);
6534
- }
6535
- return result;
6536
- }
6537
- function isBingoTemplate(pkg) {
6538
- return !!pkg.dependencies?.bingo;
6539
- }
6540
- function discoverWorkspacePackages(workspacePatterns, rootDir) {
6541
- const packages = [];
6542
- if (workspacePatterns.length === 0) return packages;
6543
- const packageJsonRelativePaths = globSync(workspacePatterns.map((pattern) => `${pattern}/package.json`), {
6544
- absolute: false,
6545
- cwd: rootDir,
6546
- ignore: ["**/node_modules/**"]
6547
- });
6548
- for (const packageJsonRelativePath of packageJsonRelativePaths) {
6549
- const pkg = readJsonFile(path.join(rootDir, packageJsonRelativePath));
6550
- if (!pkg.name) continue;
6551
- packages.push({
6552
- name: pkg.name,
6553
- path: path.dirname(packageJsonRelativePath).split(path.sep).join("/"),
6554
- description: pkg.description,
6555
- version: pkg.version
6556
- });
6557
- }
6558
- return packages;
6559
- }
6560
- function updatePackageJsonWithDeps(rootDir, projectDir, dependencies, dependencyType) {
6561
- editJsonFile(path.join(rootDir, projectDir, "package.json"), (pkg) => {
6562
- if (!pkg[dependencyType]) pkg[dependencyType] = {};
6563
- for (const dep of dependencies) pkg[dependencyType][dep] = "workspace:*";
6564
- return pkg;
6565
- });
6566
- }
6567
- function updateWorkspaceConfig(projectPath, workspaceInfo) {
6568
- for (const pattern of workspaceInfo.workspacePatterns) if (minimatch(projectPath, pattern)) return;
6569
- const parentDir = path.dirname(projectPath);
6570
- const pattern = parentDir === "." ? projectPath : `${parentDir}/*`;
6571
- if (workspaceInfo.packageManager === PackageManager.pnpm) editYamlFile(path.join(workspaceInfo.rootDir, "pnpm-workspace.yaml"), (doc) => {
6572
- let packages = doc.getIn(["packages"]);
6573
- if (!packages) packages = new import_dist.YAMLSeq();
6574
- packages.add(new import_dist.Scalar(pattern));
6575
- doc.setIn(["packages"], packages);
6576
- });
6577
- else editJsonFile(path.join(workspaceInfo.rootDir, "package.json"), (pkg) => {
6578
- if (pkg.workspaces && !Array.isArray(pkg.workspaces)) pkg.workspaces.packages = [...pkg.workspaces.packages || [], pattern];
6579
- else pkg.workspaces = [...pkg.workspaces || [], pattern];
6580
- return pkg;
6581
- });
6582
- }
6583
- //#endregion
6584
6507
  //#region src/migration/migrator/catalog.ts
6585
6508
  const BROWSER_PROVIDER_POSTINSTALL_PACKAGES = ["edgedriver", "geckodriver"];
6586
6509
  const PUBLIC_PEER_DEPENDENCY_FALLBACKS = {
@@ -6598,23 +6521,26 @@ const PNPM_MINIMUM_RELEASE_AGE_EXCLUDES = [
6598
6521
  "@oxfmt/*",
6599
6522
  ...VITEST_AGE_GATE_EXEMPT_PACKAGES
6600
6523
  ];
6524
+ function versionAtLeast(version, minVersion, tags) {
6525
+ const coerced = import_semver.default.coerce(version);
6526
+ if (coerced) return import_semver.default.gte(coerced, minVersion);
6527
+ return tags.includes(version);
6528
+ }
6601
6529
  const PNPM_WORKSPACE_SETTINGS_MIN_VERSION = "10.6.2";
6602
6530
  function pnpmSupportsWorkspaceSettings(version) {
6603
- const coerced = import_semver.default.coerce(version);
6604
- if (coerced) return import_semver.default.gte(coerced, PNPM_WORKSPACE_SETTINGS_MIN_VERSION);
6605
- return version === "latest" || version === "next";
6531
+ return versionAtLeast(version, PNPM_WORKSPACE_SETTINGS_MIN_VERSION, ["latest", "next"]);
6606
6532
  }
6607
6533
  const PNPM_CATALOG_MIN_VERSION = "9.5.0";
6608
6534
  function pnpmSupportsCatalog(version) {
6609
- const coerced = import_semver.default.coerce(version);
6610
- if (coerced) return import_semver.default.gte(coerced, PNPM_CATALOG_MIN_VERSION);
6611
- return version === "latest" || version === "next";
6535
+ return versionAtLeast(version, PNPM_CATALOG_MIN_VERSION, ["latest", "next"]);
6612
6536
  }
6613
6537
  const YARN_CATALOG_MIN_VERSION = "4.10.0";
6614
6538
  function yarnSupportsCatalog(version) {
6615
- const coerced = import_semver.default.coerce(version);
6616
- if (coerced) return import_semver.default.gte(coerced, YARN_CATALOG_MIN_VERSION);
6617
- return version === "latest" || version === "next" || version === "stable";
6539
+ return versionAtLeast(version, YARN_CATALOG_MIN_VERSION, [
6540
+ "latest",
6541
+ "next",
6542
+ "stable"
6543
+ ]);
6618
6544
  }
6619
6545
  function supportsCatalog(packageManager, version, isBunWorkspace = false) {
6620
6546
  switch (packageManager) {
@@ -8370,7 +8296,6 @@ function rewriteAllImports(projectPath, silent = false, report, preserveNuxtVite
8370
8296
  }
8371
8297
  //#endregion
8372
8298
  //#region src/migration/migrator/git-hooks.ts
8373
- var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
8374
8299
  /**
8375
8300
  * Check if the project has an unsupported husky version (<9.0.0).
8376
8301
  * Uses `semver.coerce` to handle ranges like `^8.0.0` → `8.0.0`.
@@ -9453,4 +9378,4 @@ function getMarkedRange(content, startMarker, endMarker) {
9453
9378
  };
9454
9379
  }
9455
9380
  //#endregion
9456
- export { detectWorkspace$1 as A, warnIncompatibleEslintIntegration as B, injectLintTypeCheckDefaults as C, ensureVitePlusBootstrap as D, detectVitePlusBootstrapPending as E, detectEslintProject as F, detectConfigs as G, warnPackageLevelEslint as H, detectIncompatibleEslintIntegration as I, warnMigration as J, checkViteVersion as K, migrateEslintToOxlint as L, updatePackageJsonWithDeps as M, updateWorkspaceConfig as N, configureYarnNodeModulesMode as O, confirmEslintMigration as P, promptEslintMigration as R, injectCreateDefaultTemplate as S, collectToolchainVersionChanges as T, PRETTIER_CONFIG_FILES as U, warnLegacyEslintConfig as V, PRETTIER_PACKAGE_JSON_CONFIG as W, templatesDir as X, displayRelative as Y, detectLegacyGitHooksMigrationCandidate as _, selectAgentTargets as a, preflightGitHooksSetup as b, writeCopilotSetupWorkflow as c, rewriteStandaloneProject as d, detectPendingCoreMigration as f, setPackageManager as g, migrateNodeVersionManagerFile as h, selectAgentTargetPaths as i, isBingoTemplate as j, detectYarnPnpMode as k, rewriteMonorepo as l, detectNodeVersionManagerFile as m, detectAgentConflicts as n, updateExistingAgentInstructions as o, finalizeCoreMigrationForExistingVitePlus as p, checkVitestVersion as q, detectExistingAgentTargetPaths as r, writeAgentInstructions as s, COPILOT_AGENT_ID as t, rewriteMonorepoProject as u, ensurePreCommitHook as v, mergeViteConfigFiles as w, hasStagedConfigInViteConfig as x, installGitHooks as y, rewriteToolLintStagedConfigFiles as z };
9381
+ export { globSync as A, warnPackageLevelEslint as B, injectLintTypeCheckDefaults as C, ensureVitePlusBootstrap as D, detectVitePlusBootstrapPending as E, migrateEslintToOxlint as F, checkVitestVersion as G, PRETTIER_PACKAGE_JSON_CONFIG as H, promptEslintMigration as I, templatesDir as J, warnMigration as K, rewriteToolLintStagedConfigFiles as L, confirmEslintMigration as M, detectEslintProject as N, configureYarnNodeModulesMode as O, detectIncompatibleEslintIntegration as P, warnIncompatibleEslintIntegration as R, injectCreateDefaultTemplate as S, collectToolchainVersionChanges as T, detectConfigs as U, PRETTIER_CONFIG_FILES as V, checkViteVersion as W, detectLegacyGitHooksMigrationCandidate as _, selectAgentTargets as a, preflightGitHooksSetup as b, writeCopilotSetupWorkflow as c, rewriteStandaloneProject as d, detectPendingCoreMigration as f, setPackageManager as g, migrateNodeVersionManagerFile as h, selectAgentTargetPaths as i, minimatch as j, detectYarnPnpMode as k, rewriteMonorepo as l, detectNodeVersionManagerFile as m, detectAgentConflicts as n, updateExistingAgentInstructions as o, finalizeCoreMigrationForExistingVitePlus as p, displayRelative as q, detectExistingAgentTargetPaths as r, writeAgentInstructions as s, COPILOT_AGENT_ID as t, rewriteMonorepoProject as u, ensurePreCommitHook as v, mergeViteConfigFiles as w, hasStagedConfigInViteConfig as x, installGitHooks as y, warnLegacyEslintConfig as z };
package/dist/bin.d.ts CHANGED
@@ -1 +1 @@
1
- export { };
1
+ export {}
package/dist/bin.js CHANGED
@@ -1,11 +1,11 @@
1
- import { f as resolve$1, i as DEFAULT_ENVS, n as BASEURL_TSCONFIG_WARNING, p as resolveBundled, r as CONFIG_METADATA_ENV, s as VITE_PLUS_NAME } from "./constants-DdXYYBsz.js";
2
- import { r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-BiYDWQLd.js";
3
- import { B as runCommandSilently, i as hasBaseUrlInTsconfig, r as fixBaseUrlInTsconfig } from "./tsconfig-CtdiYBV_.js";
1
+ import { f as resolve$1, i as DEFAULT_ENVS, n as BASEURL_TSCONFIG_WARNING, p as resolveBundled, r as CONFIG_METADATA_ENV, s as VITE_PLUS_NAME } from "./constants-CaXMuYUG.js";
2
+ import { r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-CMSCIkks.js";
3
+ import { B as runCommandSilently, i as hasBaseUrlInTsconfig, r as fixBaseUrlInTsconfig } from "./tsconfig-Cac-NNdT.js";
4
4
  import { n as errorMsg, r as log, s as warnMsg, t as accent } from "./terminal-uTv0ZaMr.js";
5
5
  import { t as resolveTsgolintExecutable } from "./tsgolint-path-B-yOos8p.js";
6
- import { i as resolveUniversalViteConfig } from "./resolve-vite-config-5SuNAKdv.js";
6
+ import { i as resolveUniversalViteConfig } from "./resolve-vite-config-BY7PB-LW.js";
7
7
  import path, { dirname, join } from "node:path";
8
- import { hasConfigKey, mergeJsonConfig, run } from "../binding/index.js";
8
+ import { ensureBlockingStdio, hasConfigKey, mergeJsonConfig, run } from "../binding/index.js";
9
9
  import fs, { readFileSync } from "node:fs";
10
10
  import { fileURLToPath } from "node:url";
11
11
  //#region src/resolve-fmt.ts
@@ -390,6 +390,9 @@ async function vite() {
390
390
  * vite-plus installation using oxc_resolver and runs its dist/bin.js directly.
391
391
  * If no local installation is found, this global dist/bin.js is used as fallback.
392
392
  */
393
+ process.stdout;
394
+ process.stderr;
395
+ ensureBlockingStdio();
393
396
  function getErrorMessage(err) {
394
397
  if (err instanceof Error) return err.message;
395
398
  if (typeof err === "object" && err && "message" in err && typeof err.message === "string") return err.message;
@@ -1 +1 @@
1
- export { };
1
+ export {}
@@ -1,7 +1,7 @@
1
- import { f as promptGitHooks, u as defaultInteractive } from "../tsconfig-CtdiYBV_.js";
1
+ import { f as promptGitHooks, u as defaultInteractive } from "../tsconfig-Cac-NNdT.js";
2
2
  import { a as printHeader, r as log } from "../terminal-uTv0ZaMr.js";
3
3
  import { t as lib_default } from "../lib-L3DWSRQp.js";
4
- import { o as updateExistingAgentInstructions, v as ensurePreCommitHook, x as hasStagedConfigInViteConfig } from "../agent-eMtwgY-u.js";
4
+ import { o as updateExistingAgentInstructions, v as ensurePreCommitHook, x as hasStagedConfigInViteConfig } from "../agent-0gFJkIKu.js";
5
5
  import { t as renderCliDoc } from "../help-YP84FSEz.js";
6
6
  import { join } from "node:path";
7
7
  import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from "node:module";
2
2
  //#region package.json
3
- var version = "0.2.4";
3
+ var version = "0.2.6";
4
4
  //#endregion
5
5
  //#region src/utils/constants.ts
6
6
  const VITE_PLUS_NAME = "vite-plus";
@@ -1,21 +1,21 @@
1
1
  import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-C7HZzL1F.js";
2
- import { s as VITE_PLUS_NAME } from "../constants-DdXYYBsz.js";
3
- import { A as intro, B as runCommandSilently, C as resolveApproveBuildTargets, E as PackageManager, F as spinner, I as text, L as require_picocolors, M as multiselect, O as cancel, P as select, R as isCancel, S as detectGatedBuilds, T as DependencyType, V as require_cross_spawn, d as downloadPackageManager$1, f as promptGitHooks, g as selectPackageManager, h as runViteInstall, j as log, k as confirm, m as runViteFmt, p as resolveGitInit, u as defaultInteractive, x as approveBuilds, z as runCommand$1 } from "../tsconfig-CtdiYBV_.js";
2
+ import { s as VITE_PLUS_NAME } from "../constants-CaXMuYUG.js";
3
+ import { A as intro, B as runCommandSilently, C as resolveApproveBuildTargets, E as PackageManager, F as spinner, I as text, L as require_picocolors, M as multiselect, O as cancel, P as select, R as isCancel, S as detectGatedBuilds, T as DependencyType, V as require_cross_spawn, d as downloadPackageManager$1, f as promptGitHooks, g as selectPackageManager, h as runViteInstall, j as log, k as confirm, m as runViteFmt, p as resolveGitInit, u as defaultInteractive, v as editYamlFile, x as approveBuilds, y as readYamlFile, z as runCommand$1 } from "../tsconfig-Cac-NNdT.js";
4
4
  import { a as printHeader, i as muted, o as success, r as log$1, t as accent } from "../terminal-uTv0ZaMr.js";
5
5
  import { i as readJsonFile, n as editJsonFile } from "../json-DiRs8ceZ.js";
6
- import { a as resolveViteConfig, n as findWorkspaceRoot, r as hasViteConfig, t as findViteConfig } from "../resolve-vite-config-5SuNAKdv.js";
6
+ import { a as resolveViteConfig, n as findWorkspaceRoot, r as hasViteConfig, t as findViteConfig } from "../resolve-vite-config-BY7PB-LW.js";
7
7
  import { t as lib_default } from "../lib-L3DWSRQp.js";
8
- import { o as fetchNpmResource, s as getNpmRegistry, t as checkNpmPackageExists } from "../package-D2xMMmTQ.js";
9
- import { A as detectWorkspace$1, F as detectEslintProject, M as updatePackageJsonWithDeps, N as updateWorkspaceConfig, R as promptEslintMigration, S as injectCreateDefaultTemplate, X as templatesDir, Y as displayRelative, a as selectAgentTargets, c as writeCopilotSetupWorkflow, d as rewriteStandaloneProject, g as setPackageManager, j as isBingoTemplate, l as rewriteMonorepo, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, t as COPILOT_AGENT_ID, u as rewriteMonorepoProject, y as installGitHooks } from "../agent-eMtwgY-u.js";
10
- import { a as writeEditorConfigs, c as hasFrameworkShim, f as promptPrettierMigration, i as selectEditors, n as detectExistingEditors, o as addFrameworkShim, s as detectFramework, u as detectPrettierProject } from "../editor-DL4u-ujK.js";
8
+ import { o as fetchNpmResource, s as getNpmRegistry, t as checkNpmPackageExists } from "../package-CP5EUXlu.js";
9
+ import { I as promptEslintMigration, J as templatesDir, N as detectEslintProject, S as injectCreateDefaultTemplate, a as selectAgentTargets, c as writeCopilotSetupWorkflow, d as rewriteStandaloneProject, g as setPackageManager, l as rewriteMonorepo, q as displayRelative, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, t as COPILOT_AGENT_ID, u as rewriteMonorepoProject, y as installGitHooks } from "../agent-0gFJkIKu.js";
10
+ import { a as writeEditorConfigs, c as updatePackageJsonWithDeps, d as detectFramework, f as hasFrameworkShim, g as promptPrettierMigration, i as selectEditors, l as updateWorkspaceConfig, m as detectPrettierProject, n as detectExistingEditors, o as detectWorkspace$1, s as isBingoTemplate, u as addFrameworkShim } from "../editor-D4T70tKk.js";
11
11
  import { t as renderCliDoc } from "../help-YP84FSEz.js";
12
12
  import path from "node:path";
13
13
  import { runCommand, upsertJsonConfig, vitePlusHeader } from "../../binding/index.js";
14
14
  import fs from "node:fs";
15
15
  import { styleText } from "node:util";
16
+ import { createHash, randomUUID } from "node:crypto";
16
17
  import os from "node:os";
17
18
  import fsPromises from "node:fs/promises";
18
- import { createHash, randomUUID } from "node:crypto";
19
19
  import assert from "node:assert";
20
20
  //#region src/utils/git.ts
21
21
  var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
@@ -3951,23 +3951,46 @@ function renameFiles(projectDir) {
3951
3951
  if (fs.existsSync(fromPath)) fs.renameSync(fromPath, path.join(projectDir, to));
3952
3952
  }
3953
3953
  }
3954
+ const DOTENV_GITIGNORE_LINES = [
3955
+ "# dotenv environment variable files",
3956
+ ".env",
3957
+ ".env.*",
3958
+ "!.env.example"
3959
+ ];
3954
3960
  /**
3955
- * Make sure the scaffolded project's `.gitignore` excludes `node_modules`.
3961
+ * Make sure the scaffolded project's `.gitignore` excludes default generated
3962
+ * project artifacts.
3956
3963
  *
3957
3964
  * Called right after `git init` so even bundled `@org` templates (which
3958
- * may ship without a `.gitignore`) don't end up tracking installed
3959
- * dependencies on the user's first commit. No-op when an existing
3960
- * `.gitignore` already lists `node_modules`.
3965
+ * may ship without a `.gitignore`) don't end up tracking dependencies or
3966
+ * local environment files on the user's first commit.
3961
3967
  */
3962
- function ensureGitignoreNodeModules(projectDir) {
3968
+ function ensureDefaultGitignoreEntries(projectDir) {
3963
3969
  const gitignorePath = path.join(projectDir, ".gitignore");
3964
3970
  let content = "";
3965
3971
  try {
3966
3972
  content = fs.readFileSync(gitignorePath, "utf-8");
3967
3973
  } catch {}
3968
- if (/^\s*node_modules\/?\s*$/m.test(content)) return;
3974
+ const lines = [];
3975
+ if (!hasNodeModulesGitignoreLine(content)) lines.push("node_modules");
3976
+ const missingDotenvLines = DOTENV_GITIGNORE_LINES.filter((line) => !hasGitignoreLine(content, line));
3977
+ if (missingDotenvLines.length > 0) {
3978
+ const startsDotenvSection = missingDotenvLines[0] === DOTENV_GITIGNORE_LINES[0];
3979
+ if (lines.length > 0 || startsDotenvSection && content.trim() !== "") lines.push("");
3980
+ lines.push(...missingDotenvLines);
3981
+ }
3982
+ appendGitignoreLines(gitignorePath, content, lines);
3983
+ }
3984
+ function hasNodeModulesGitignoreLine(content) {
3985
+ return /^\s*node_modules\/?\s*$/m.test(content);
3986
+ }
3987
+ function hasGitignoreLine(content, line) {
3988
+ return content.split(/\r?\n/).some((entry) => entry.trim() === line);
3989
+ }
3990
+ function appendGitignoreLines(gitignorePath, content, lines) {
3991
+ if (lines.length === 0) return;
3969
3992
  const prefix = content === "" || content.endsWith("\n") ? "" : "\n";
3970
- fs.appendFileSync(gitignorePath, `${prefix}node_modules\n`);
3993
+ fs.appendFileSync(gitignorePath, `${prefix}${lines.join("\n")}\n`);
3971
3994
  }
3972
3995
  const VSCODE_SETTINGS_PATH = ".vscode/settings.json";
3973
3996
  const VSCODE_CONFIG_UNIGNORE_BLOCK = [
@@ -3993,11 +4016,6 @@ function appendGitignoreVsCodeEditorConfigsBlock(gitignorePath, content) {
3993
4016
  if (content.trimEnd().endsWith(VSCODE_CONFIG_UNIGNORE_BLOCK.join("\n"))) return;
3994
4017
  appendGitignoreLines(gitignorePath, content, VSCODE_CONFIG_UNIGNORE_BLOCK);
3995
4018
  }
3996
- function appendGitignoreLines(gitignorePath, content, lines) {
3997
- if (lines.length === 0) return;
3998
- const prefix = content === "" || content.endsWith("\n") ? "" : "\n";
3999
- fs.appendFileSync(gitignorePath, `${prefix}${lines.join("\n")}\n`);
4000
- }
4001
4019
  function formatDisplayTargetDir(targetDir) {
4002
4020
  const normalized = targetDir.split(path.sep).join("/");
4003
4021
  if (normalized === "" || normalized === ".") return "./";
@@ -4594,12 +4612,45 @@ async function executeMonorepoTemplate(workspaceInfo, templateInfo, options) {
4594
4612
  const libraryProjectPath = path.join(fullPath, libraryDir);
4595
4613
  setPackageName(libraryProjectPath, libraryPackageName);
4596
4614
  rewriteMonorepoProject(libraryProjectPath, workspaceInfo.packageManager, void 0, options?.silent ?? false);
4615
+ alignMonorepoTypeScriptVersion(fullPath, appProjectPath, libraryProjectPath);
4597
4616
  return {
4598
4617
  exitCode: 0,
4599
4618
  projectDir: templateInfo.targetDir
4600
4619
  };
4601
4620
  }
4602
4621
  /**
4622
+ * Keep every scaffolded workspace member on the same TypeScript version.
4623
+ *
4624
+ * The app and library come from independently updated remote templates. If
4625
+ * their TypeScript ranges resolve to different versions, `typescript` — an
4626
+ * optional peer of vite-plus — resolves differently per member, so package
4627
+ * managers either create separate vite-plus peer instances (pnpm) or hoist a
4628
+ * compiler the other workspace member did not ask for (npm/Yarn). The library
4629
+ * template is the compatibility baseline because its declaration build may
4630
+ * require a newer compiler, so the app adopts its TypeScript range instead of
4631
+ * silently downgrading the library. The workspace catalog entry follows the
4632
+ * same baseline so members that reference `typescript: "catalog:"` (e.g. a
4633
+ * later `vite:generator` scaffold) stay on the workspace's compiler.
4634
+ */
4635
+ function alignMonorepoTypeScriptVersion(workspaceRootPath, appProjectPath, libraryProjectPath) {
4636
+ const typescriptVersion = JSON.parse(fs.readFileSync(path.join(libraryProjectPath, "package.json"), "utf8")).devDependencies?.typescript;
4637
+ if (!typescriptVersion) return;
4638
+ editJsonFile(path.join(appProjectPath, "package.json"), (pkg) => {
4639
+ if (!pkg.devDependencies?.typescript || pkg.devDependencies.typescript === typescriptVersion) return;
4640
+ pkg.devDependencies.typescript = typescriptVersion;
4641
+ return pkg;
4642
+ });
4643
+ for (const catalogFile of ["pnpm-workspace.yaml", ".yarnrc.yml"]) {
4644
+ const catalogPath = path.join(workspaceRootPath, catalogFile);
4645
+ if (!fs.existsSync(catalogPath)) continue;
4646
+ const catalogEntry = readYamlFile(catalogPath)?.catalog?.typescript;
4647
+ if (catalogEntry === void 0 || catalogEntry === typescriptVersion) continue;
4648
+ editYamlFile(catalogPath, (doc) => {
4649
+ doc.setIn(["catalog", "typescript"], typescriptVersion);
4650
+ });
4651
+ }
4652
+ }
4653
+ /**
4603
4654
  * Drop the aliased `vite` / `vitest` devDeps that `create-vite` leaves on a
4604
4655
  * scaffolded sub-package. After migration its scripts already use `vp ...` and
4605
4656
  * nothing imports `'vite'` directly, so `vite-plus` provides them transitively.
@@ -5274,7 +5325,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5274
5325
  });
5275
5326
  if (gitResult.status === 0) {
5276
5327
  if (!compactOutput) log.success("Git repository initialized");
5277
- ensureGitignoreNodeModules(fullPath);
5328
+ ensureDefaultGitignoreEntries(fullPath);
5278
5329
  } else {
5279
5330
  log.warn("Failed to initialize git repository");
5280
5331
  if (gitResult.stderr) log.info(gitResult.stderr.toString());
@@ -5309,7 +5360,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5309
5360
  rewriteMonorepo(workspaceInfo, void 0, compactOutput);
5310
5361
  if (shouldSetupGit) {
5311
5362
  updateCreateProgress("Initializing git repository");
5312
- await initGitRepository(fullPath);
5363
+ if (await initGitRepository(fullPath)) ensureDefaultGitignoreEntries(fullPath);
5313
5364
  }
5314
5365
  if (bundled?.monorepo) injectCreateDefaultTemplate(fullPath, bundled.scope, compactOutput);
5315
5366
  if (shouldSetupHooks) installGitHooks(fullPath, compactOutput, void 0, workspaceInfo.packageManager);
@@ -5501,7 +5552,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5501
5552
  for (const framework of detectFramework(fullPath)) if (!hasFrameworkShim(fullPath, framework)) addFrameworkShim(fullPath, framework);
5502
5553
  if (shouldSetupGit) {
5503
5554
  updateCreateProgress("Initializing git repository");
5504
- await initGitRepository(fullPath);
5555
+ if (await initGitRepository(fullPath)) ensureDefaultGitignoreEntries(fullPath);
5505
5556
  }
5506
5557
  if (shouldSetupHooks) installGitHooks(fullPath, compactOutput, void 0, workspaceInfo.packageManager);
5507
5558
  updateCreateProgress("Installing dependencies");
@@ -1,10 +1,9 @@
1
- import { t as PackUserConfig } from "./pack-Ciiho0Tq.js";
1
+ import { t as PackUserConfig } from "./pack-PvUg_xpv.js";
2
2
  import { ConfigEnv, UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig } from "vitest/config";
3
3
  import { PluginOption, UserConfig } from "@voidzero-dev/vite-plus-core";
4
4
  import { OxfmtConfig } from "oxfmt";
5
5
  import { OxlintConfig } from "oxlint";
6
6
  import { InlineConfig } from "vitest/node";
7
-
8
7
  //#region src/create/org-manifest.d.ts
9
8
  /**
10
9
  * A single template entry shared by org manifests (`createConfig.templates`)
@@ -142,7 +141,7 @@ type RunConfig = {
142
141
  /**
143
142
  * Task definitions: full task objects, command strings, or command string arrays.
144
143
  */
145
- tasks?: { [key in string]: TaskDefinition };
144
+ tasks?: { [key in string]: TaskDefinition; };
146
145
  /**
147
146
  * Whether to automatically run `preX`/`postX` package.json scripts as
148
147
  * lifecycle hooks when script `X` is executed.
@@ -1,10 +1,10 @@
1
- import { o as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-DdXYYBsz.js";
1
+ import { o as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-CaXMuYUG.js";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import { readFileSync } from "node:fs";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { defineConfig, defineProject } from "vitest/config";
7
- //#region ../../node_modules/.pnpm/tsdown@0.22.3_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.3_@tsdown+exe@0.22.3_@type_b3805a6765df28d505319221a7193e18/node_modules/tsdown/esm-shims.js
7
+ //#region ../../node_modules/.pnpm/tsdown@0.22.13_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.13_@tsdown+exe@0.22.13_@t_f26a610f558bef85f3db2230cc877c56/node_modules/tsdown/esm-shims.js
8
8
  const getFilename = () => fileURLToPath(import.meta.url);
9
9
  const getDirname = () => path.dirname(getFilename());
10
10
  const __dirname = /* @__PURE__ */ getDirname();
@@ -37,7 +37,7 @@ let node_module = require("node:module");
37
37
  let node_url = require("node:url");
38
38
  let vitest_config = require("vitest/config");
39
39
  //#region package.json
40
- var version = "0.2.4", VITE_PLUS_VERSION, VITEST_VERSION, CONFIG_METADATA_ENV;
40
+ var version = "0.2.6", VITE_PLUS_VERSION, VITEST_VERSION, CONFIG_METADATA_ENV;
41
41
  var init_constants = __esmMin((() => {
42
42
  VITE_PLUS_VERSION = process.env.VP_VERSION || version;
43
43
  VITEST_VERSION = "4.1.10";
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_define_config = require("./define-config-DUsBrwKn.cjs");
2
+ const require_define_config = require("./define-config-iGV0CGUk.cjs");
3
3
  require_define_config.init_define_config();
4
4
  exports.AUTO_INLINE_DEPS = require_define_config.AUTO_INLINE_DEPS;
5
5
  exports.assertCoverageProviderVersionMatch = require_define_config.assertCoverageProviderVersionMatch;
@@ -1,2 +1,2 @@
1
- import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-BuMs_LKa.js";
1
+ import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-eLQH9us2.js";
2
2
  export { AUTO_INLINE_DEPS, assertCoverageProviderVersionMatch, checkCoverageProviderVersion, computeAutoInlineList, defineConfig, defineProject, isVitestFamilySpecifier, lazyPlugins, resolveCoverageProviderToCheck, withConfigMetadataResolution };
@@ -1,2 +1,2 @@
1
- import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-Dn5coJS5.js";
1
+ import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-hV8qyU8p.js";
2
2
  export { AUTO_INLINE_DEPS, assertCoverageProviderVersionMatch, checkCoverageProviderVersion, computeAutoInlineList, defineConfig, defineProject, isVitestFamilySpecifier, lazyPlugins, resolveCoverageProviderToCheck, withConfigMetadataResolution };
@@ -1,8 +1,10 @@
1
- import { B as runCommandSilently, M as multiselect, P as select, R as isCancel, j as log, k as confirm, l as cancelAndExit, w as getSpinner } from "./tsconfig-CtdiYBV_.js";
1
+ import { B as runCommandSilently, E as PackageManager, M as multiselect, P as select, R as isCancel, j as log, k as confirm, l as cancelAndExit, v as editYamlFile, w as getSpinner, y as readYamlFile } from "./tsconfig-Cac-NNdT.js";
2
2
  import { a as writeJsonFile, c as parse, i as readJsonFile, n as editJsonFile, o as applyEdits, s as modify, t as detectFormattingOptions } from "./json-DiRs8ceZ.js";
3
- import { G as detectConfigs, J as warnMigration, U as PRETTIER_CONFIG_FILES, Y as displayRelative, z as rewriteToolLintStagedConfigFiles } from "./agent-eMtwgY-u.js";
3
+ import { t as require_dist } from "./dist-CKz3vcoG.js";
4
+ import { r as getScopeFromPackageName } from "./package-CP5EUXlu.js";
5
+ import { A as globSync, K as warnMigration, L as rewriteToolLintStagedConfigFiles, U as detectConfigs, V as PRETTIER_CONFIG_FILES, j as minimatch, q as displayRelative } from "./agent-0gFJkIKu.js";
4
6
  import path from "node:path";
5
- import { rewritePrettier } from "../binding/index.js";
7
+ import { detectWorkspace, rewritePrettier } from "../binding/index.js";
6
8
  import fs from "node:fs";
7
9
  import { styleText } from "node:util";
8
10
  import fsPromises from "node:fs/promises";
@@ -242,6 +244,95 @@ function addFrameworkShim(projectPath, framework, report) {
242
244
  }
243
245
  if (report) report.frameworkShimAdded = true;
244
246
  }
247
+ //#endregion
248
+ //#region src/utils/workspace.ts
249
+ var import_dist = require_dist();
250
+ async function detectWorkspace$1(rootDir) {
251
+ const bindingResult = await detectWorkspace(rootDir);
252
+ const result = {
253
+ rootDir,
254
+ packageManager: void 0,
255
+ packageManagerVersion: "latest",
256
+ isMonorepo: false,
257
+ monorepoScope: "",
258
+ workspacePatterns: [],
259
+ parentDirs: [],
260
+ packages: []
261
+ };
262
+ if (bindingResult.packageManagerName) result.packageManager = bindingResult.packageManagerName;
263
+ if (bindingResult.packageManagerVersion) result.packageManagerVersion = bindingResult.packageManagerVersion;
264
+ if (bindingResult.isMonorepo) result.isMonorepo = bindingResult.isMonorepo;
265
+ if (bindingResult.root) result.rootDir = bindingResult.root;
266
+ if (result.isMonorepo) {
267
+ const pnpmWorkspaceFile = path.join(result.rootDir, "pnpm-workspace.yaml");
268
+ const packageJsonFile = path.join(result.rootDir, "package.json");
269
+ if (fs.existsSync(pnpmWorkspaceFile)) {
270
+ const workspaceConfig = readYamlFile(pnpmWorkspaceFile);
271
+ if (Array.isArray(workspaceConfig.packages)) result.workspacePatterns = workspaceConfig.packages;
272
+ } else if (fs.existsSync(packageJsonFile)) {
273
+ const pkg = readJsonFile(packageJsonFile);
274
+ if (Array.isArray(pkg.workspaces)) result.workspacePatterns = pkg.workspaces;
275
+ else if (pkg.workspaces && Array.isArray(pkg.workspaces.packages)) result.workspacePatterns = pkg.workspaces.packages;
276
+ }
277
+ const dirs = /* @__PURE__ */ new Set();
278
+ for (const pattern of result.workspacePatterns) {
279
+ if (!pattern.endsWith("*")) continue;
280
+ const dir = pattern.replace(/\/\*{1,2}$/, "");
281
+ if (dir) dirs.add(dir);
282
+ }
283
+ result.parentDirs = Array.from(dirs).sort();
284
+ const pkg = readJsonFile(packageJsonFile);
285
+ if (pkg.name) result.monorepoScope = getScopeFromPackageName(pkg.name);
286
+ result.packages = discoverWorkspacePackages(result.workspacePatterns, result.rootDir);
287
+ }
288
+ return result;
289
+ }
290
+ function isBingoTemplate(pkg) {
291
+ return !!pkg.dependencies?.bingo;
292
+ }
293
+ function discoverWorkspacePackages(workspacePatterns, rootDir) {
294
+ const packages = [];
295
+ if (workspacePatterns.length === 0) return packages;
296
+ const packageJsonRelativePaths = globSync(workspacePatterns.map((pattern) => `${pattern}/package.json`), {
297
+ absolute: false,
298
+ cwd: rootDir,
299
+ ignore: ["**/node_modules/**"]
300
+ });
301
+ for (const packageJsonRelativePath of packageJsonRelativePaths) {
302
+ const pkg = readJsonFile(path.join(rootDir, packageJsonRelativePath));
303
+ if (!pkg.name) continue;
304
+ packages.push({
305
+ name: pkg.name,
306
+ path: path.dirname(packageJsonRelativePath).split(path.sep).join("/"),
307
+ description: pkg.description,
308
+ version: pkg.version
309
+ });
310
+ }
311
+ return packages;
312
+ }
313
+ function updatePackageJsonWithDeps(rootDir, projectDir, dependencies, dependencyType) {
314
+ editJsonFile(path.join(rootDir, projectDir, "package.json"), (pkg) => {
315
+ if (!pkg[dependencyType]) pkg[dependencyType] = {};
316
+ for (const dep of dependencies) pkg[dependencyType][dep] = "workspace:*";
317
+ return pkg;
318
+ });
319
+ }
320
+ function updateWorkspaceConfig(projectPath, workspaceInfo) {
321
+ for (const pattern of workspaceInfo.workspacePatterns) if (minimatch(projectPath, pattern)) return;
322
+ const parentDir = path.dirname(projectPath);
323
+ const pattern = parentDir === "." ? projectPath : `${parentDir}/*`;
324
+ if (workspaceInfo.packageManager === PackageManager.pnpm) editYamlFile(path.join(workspaceInfo.rootDir, "pnpm-workspace.yaml"), (doc) => {
325
+ let packages = doc.getIn(["packages"]);
326
+ if (!packages) packages = new import_dist.YAMLSeq();
327
+ packages.add(new import_dist.Scalar(pattern));
328
+ doc.setIn(["packages"], packages);
329
+ });
330
+ else editJsonFile(path.join(workspaceInfo.rootDir, "package.json"), (pkg) => {
331
+ if (pkg.workspaces && !Array.isArray(pkg.workspaces)) pkg.workspaces.packages = [...pkg.workspaces.packages || [], pattern];
332
+ else pkg.workspaces = [...pkg.workspaces || [], pattern];
333
+ return pkg;
334
+ });
335
+ }
245
336
  const EDITORS = [{
246
337
  id: "vscode",
247
338
  label: "VSCode",
@@ -581,4 +672,4 @@ function resolveEditorIds(editors) {
581
672
  return uniqueEditorIds.length === 0 ? void 0 : uniqueEditorIds;
582
673
  }
583
674
  //#endregion
584
- export { writeEditorConfigs as a, hasFrameworkShim as c, migratePrettierToOxfmt as d, promptPrettierMigration as f, selectEditors as i, confirmPrettierMigration as l, detectExistingEditors as n, addFrameworkShim as o, warnPackageLevelPrettier as p, selectEditor as r, detectFramework as s, detectEditorConflicts as t, detectPrettierProject as u };
675
+ export { warnPackageLevelPrettier as _, writeEditorConfigs as a, updatePackageJsonWithDeps as c, detectFramework as d, hasFrameworkShim as f, promptPrettierMigration as g, migratePrettierToOxfmt as h, selectEditors as i, updateWorkspaceConfig as l, detectPrettierProject as m, detectExistingEditors as n, detectWorkspace$1 as o, confirmPrettierMigration as p, selectEditor as r, isBingoTemplate as s, detectEditorConflicts as t, addFrameworkShim as u };
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_define_config = require("./define-config-DUsBrwKn.cjs");
1
+ const require_define_config = require("./define-config-iGV0CGUk.cjs");
2
2
  //#region src/index.cts
3
3
  const vite = require("@voidzero-dev/vite-plus-core");
4
4
  const { configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude } = require("vitest/config");