vite-plus 0.3.0 → 0.3.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.
Files changed (95) hide show
  1. package/LICENSE +29 -29
  2. package/README.md +3 -3
  3. package/bin/vp +1 -1
  4. package/binding/index.cjs +60 -56
  5. package/binding/index.d.cts +137 -14
  6. package/dist/{agent-Wqx0MPk0.js → agent-C59HKB4Y.js} +3 -2
  7. package/dist/bin.js +90 -58
  8. package/dist/cli-parse-DHE8NrBU.js +13 -0
  9. package/dist/client/bundledDevClient.mjs +1 -1
  10. package/dist/client/client.mjs +1 -1
  11. package/dist/client/env.mjs +1 -1
  12. package/dist/client.d.ts +1 -1
  13. package/dist/config/bin.js +83 -55
  14. package/dist/{constants-Bn-U8o4v.js → constants-IhOditRA.js} +3 -3
  15. package/dist/create/bin.d.ts +13 -5
  16. package/dist/create/bin.js +50 -193
  17. package/dist/{define-config-GXUdVT-0.js → define-config-DAaCa0U_.js} +2 -2
  18. package/dist/{define-config-DWoAkNdp.d.ts → define-config-DPNEJxPz.d.ts} +5 -9
  19. package/dist/{define-config-WiVlryJ2.cjs → define-config-DpAPETDf.cjs} +1 -1
  20. package/dist/define-config.cjs +1 -1
  21. package/dist/define-config.d.ts +1 -1
  22. package/dist/define-config.js +1 -1
  23. package/dist/dist-DfmT__Aw.js +619 -0
  24. package/dist/{editor-CC4DqODz.js → editor-QOIGtmH4.js} +205 -70
  25. package/dist/hooks/bin.js +9 -114
  26. package/dist/{hooks-DFqViZqZ.js → hooks-C-4gykWR.js} +1 -1
  27. package/dist/index.cjs +2 -2
  28. package/dist/index.d.ts +2 -2
  29. package/dist/index.js +2 -2
  30. package/dist/internal.d.ts +1 -1
  31. package/dist/internal.js +1 -1
  32. package/dist/lint-plugins-dev.d.ts +3 -0
  33. package/dist/lint-plugins-dev.js +2 -0
  34. package/dist/lint-plugins.cjs +21 -0
  35. package/dist/lint-plugins.d.ts +3 -0
  36. package/dist/lint-plugins.js +2 -0
  37. package/dist/migration/bin.js +25 -144
  38. package/dist/migration/compat/worker.js +1 -1
  39. package/dist/module-runner.d.ts +1 -1
  40. package/dist/module-runner.js +1 -1
  41. package/dist/{oxlint-plugin-config-DX5ezKbB.js → oxlint-plugin-config-BU42tr8y.js} +1 -1
  42. package/dist/oxlint-plugin.d.ts +2 -2
  43. package/dist/oxlint-plugin.js +93 -32
  44. package/dist/{pack-PvUg_xpv.d.ts → pack-BK38MLVZ.d.ts} +1 -1
  45. package/dist/pack-bin.d.ts +2 -3
  46. package/dist/pack-bin.js +5 -622
  47. package/dist/pack-client.d.ts +1 -1
  48. package/dist/pack.d.ts +2 -2
  49. package/dist/pack.js +1 -1
  50. package/dist/{package-CBe9EWPY.js → package-BB-Jh_z3.js} +1 -1
  51. package/dist/{prompts-DF3yU-eU.js → prompts-CujFOJXu.js} +3 -1400
  52. package/dist/{report-ZNR1Mk6h.js → report-CK5TnTsr.js} +1 -0
  53. package/dist/resolve-vite-config-6Nox70uP.js +2 -0
  54. package/dist/{resolve-vite-config-ipGb39Jo.js → resolve-vite-config-CHHjsjKJ.js} +3 -3
  55. package/dist/semver-CaDAb8vV.js +1400 -0
  56. package/dist/staged/bin.js +83 -218
  57. package/dist/sync-versions/bin.d.ts +1 -0
  58. package/dist/sync-versions/bin.js +3884 -0
  59. package/dist/sync-versions/bin.mjs +13323 -0
  60. package/dist/toolchain.js +10 -10
  61. package/dist/toolchain.json +10 -10
  62. package/dist/{tsconfig-LD2QhQ0O.js → tsconfig-DCtWfQPA.js} +2 -2
  63. package/dist/{tsconfig-BVHG3DpR.js → tsconfig-MXktI3SX.js} +1 -1
  64. package/dist/tsgolint-path.d.ts +3 -4
  65. package/dist/types/customEvent.d.ts +1 -1
  66. package/dist/types/hmrPayload.d.ts +1 -1
  67. package/dist/types/hot.d.ts +1 -1
  68. package/dist/types/import-meta.d.ts +1 -1
  69. package/dist/types/importGlob.d.ts +1 -1
  70. package/dist/types/importMeta.d.ts +1 -1
  71. package/dist/types/metadata.d.ts +1 -1
  72. package/dist/version.d.ts +2 -3
  73. package/dist/version.js +2 -2
  74. package/dist/versions.js +5 -5
  75. package/dist/vitest-ecosystem-BiRqcaRI.js +23 -0
  76. package/docs/config/fmt.md +4 -2
  77. package/docs/config/lint.md +4 -2
  78. package/docs/guide/check.md +1 -0
  79. package/docs/guide/ci.md +42 -2
  80. package/docs/guide/env.md +148 -52
  81. package/docs/guide/fmt.md +3 -1
  82. package/docs/guide/ide-integration.md +14 -2
  83. package/docs/guide/index.md +1 -1
  84. package/docs/guide/install.md +4 -1
  85. package/docs/guide/installer-env-vars.md +45 -1
  86. package/docs/guide/lint.md +58 -1
  87. package/docs/guide/migrate-rules.md +95 -2
  88. package/docs/guide/migrate.md +1 -1
  89. package/docs/guide/monorepo.md +2 -0
  90. package/docs/guide/troubleshooting.md +14 -0
  91. package/package.json +27 -20
  92. package/templates/generator/README.md +14 -0
  93. package/templates/generator/bin/index.ts +54 -5
  94. package/dist/lib-L3DWSRQp.js +0 -75
  95. package/dist/{log-update-DHZRyJ2m.js → log-update-CoW8Z4Dl.js} +1 -1
@@ -1,66 +1,94 @@
1
- import { t as renderCliDoc } from "../help-BmKpeOP9.js";
2
- import { i as log, o as printHeader } from "../terminal-MKGAuy-p.js";
3
- import { i as promptGitHooks, n as defaultInteractive } from "../prompts-DF3yU-eU.js";
4
- import { t as lib_default } from "../lib-L3DWSRQp.js";
5
- import { o as updateExistingAgentInstructions } from "../agent-Wqx0MPk0.js";
6
- import { c as isHooksUserDisabled, l as resolveHooksLocation, o as install, s as isGitHooksEnvDisabled } from "../hooks-DFqViZqZ.js";
7
- import { join } from "node:path";
8
- import { existsSync } from "node:fs";
9
- //#region src/config/bin.ts
10
- async function main() {
11
- const args = lib_default(process.argv.slice(3), {
12
- boolean: [
13
- "help",
14
- "hooks",
15
- "agent"
16
- ],
17
- string: ["hooks-dir"],
18
- alias: { h: "help" }
19
- });
20
- if (args.help) {
21
- const helpMessage = renderCliDoc({
22
- usage: "vp config [OPTIONS]",
23
- summary: "Configure Vite+ for the current project (hook dispatcher + agent integration).",
24
- documentationUrl: "https://viteplus.dev/guide/commit-hooks",
25
- sections: [{
26
- title: "Options",
27
- rows: [
28
- {
29
- label: "--hooks-dir <path>",
30
- description: "Custom hooks directory (default: .vite-hooks, or last used in this clone)"
31
- },
32
- {
33
- label: "--no-hooks",
34
- description: "Skip hook dispatcher installation"
35
- },
36
- {
37
- label: "--no-agent",
38
- description: "Skip updating coding agent instructions"
39
- },
40
- {
41
- label: "-h, --help",
42
- description: "Show this help message"
43
- }
44
- ]
45
- }, {
46
- title: "Environment",
47
- rows: [{
48
- label: "VP_GIT_HOOKS=0",
49
- description: "Skip hook dispatcher installation"
50
- }]
51
- }]
52
- });
53
- printHeader();
54
- log(helpMessage);
1
+ import { i as log, n as errorMsg } from "../terminal-MKGAuy-p.js";
2
+ import { i as promptGitHooks, n as defaultInteractive } from "../prompts-CujFOJXu.js";
3
+ import { o as updateExistingAgentInstructions } from "../agent-C59HKB4Y.js";
4
+ import { t as require_dist } from "../dist-BDYZP12R.js";
5
+ import { a as install, c as resolveHooksLocation, o as isGitHooksEnvDisabled, s as isHooksUserDisabled } from "../hooks-C-4gykWR.js";
6
+ import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
7
+ import path, { join, relative } from "node:path";
8
+ import { parseConfigArgs } from "../../binding/index.js";
9
+ import fs, { existsSync } from "node:fs";
10
+ //#region src/utils/legacy-vitest-alias.ts
11
+ var import_dist = require_dist();
12
+ const LEGACY_VITEST_ALIAS = "npm:@voidzero-dev/vite-plus-test";
13
+ function containsLegacyVitestAlias(value, visited = /* @__PURE__ */ new Set()) {
14
+ if (typeof value === "string") return value === LEGACY_VITEST_ALIAS || value.startsWith(`${LEGACY_VITEST_ALIAS}@`);
15
+ if (value === null || typeof value !== "object" || visited.has(value)) return false;
16
+ visited.add(value);
17
+ return Object.values(value).some((entry) => containsLegacyVitestAlias(entry, visited));
18
+ }
19
+ function asRecord(value) {
20
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
21
+ }
22
+ function containsAliasInFields(config, fields) {
23
+ const record = asRecord(config);
24
+ return fields.some((field) => containsLegacyVitestAlias(record?.[field]));
25
+ }
26
+ function containsPackageAlias(config) {
27
+ return containsAliasInFields(config, [
28
+ "dependencies",
29
+ "devDependencies",
30
+ "optionalDependencies",
31
+ "peerDependencies",
32
+ "overrides",
33
+ "resolutions",
34
+ "catalog",
35
+ "catalogs"
36
+ ]) || containsAliasInFields(config?.pnpm, ["overrides"]) || containsAliasInFields(config?.workspaces, ["catalog", "catalogs"]);
37
+ }
38
+ function readConfigFile(filePath) {
39
+ try {
40
+ const source = fs.readFileSync(filePath, "utf8");
41
+ return asRecord(path.basename(filePath) === "package.json" ? JSON.parse(source) : (0, import_dist.parse)(source));
42
+ } catch {
55
43
  return;
56
44
  }
57
- const dir = args["hooks-dir"];
45
+ }
46
+ /**
47
+ * Find a package-manager setting that still aliases Vitest to the deleted
48
+ * `@voidzero-dev/vite-plus-test` wrapper. Check the nearest package and its
49
+ * workspace root, without inspecting unrelated ancestor package settings.
50
+ */
51
+ function findLegacyVitestAliasConfig(startDir) {
52
+ let currentDir = path.resolve(startDir);
53
+ let foundPackage = false;
54
+ while (true) {
55
+ const packagePath = path.join(currentDir, "package.json");
56
+ const pkg = readConfigFile(packagePath);
57
+ const isNearestPackage = !foundPackage && fs.existsSync(packagePath);
58
+ if (isNearestPackage) foundPackage = true;
59
+ const workspacePath = path.join(currentDir, "pnpm-workspace.yaml");
60
+ const isWorkspaceRoot = fs.existsSync(workspacePath) || pkg !== void 0 && Object.hasOwn(pkg, "workspaces");
61
+ if ((isNearestPackage || isWorkspaceRoot) && containsPackageAlias(pkg)) return packagePath;
62
+ if (isWorkspaceRoot) {
63
+ if (containsAliasInFields(readConfigFile(workspacePath), [
64
+ "catalog",
65
+ "catalogs",
66
+ "overrides"
67
+ ])) return workspacePath;
68
+ return;
69
+ }
70
+ const parentDir = path.dirname(currentDir);
71
+ if (parentDir === currentDir) return;
72
+ currentDir = parentDir;
73
+ }
74
+ }
75
+ //#endregion
76
+ //#region src/config/bin.ts
77
+ async function main() {
78
+ const args = unwrapCliParseOutcome(parseConfigArgs(process.argv.slice(3)));
79
+ const dir = args.hooksDir;
58
80
  const skipHooks = args.hooks === false;
59
81
  const skipAgent = args.agent === false;
60
82
  const interactive = defaultInteractive();
61
83
  const lifecycleEvent = process.env.npm_lifecycle_event;
62
84
  const isLifecycleScript = lifecycleEvent === "prepare" || lifecycleEvent === "postinstall";
63
85
  const root = process.cwd();
86
+ const staleVitestAliasConfig = findLegacyVitestAliasConfig(root);
87
+ if (staleVitestAliasConfig) {
88
+ const relativeConfigPath = relative(root, staleVitestAliasConfig);
89
+ errorMsg(`Found a stale Vitest alias in ${relativeConfigPath} that points to the removed \`@voidzero-dev/vite-plus-test\` package. Run \`vp migrate\` to update the project before installing dependencies.`);
90
+ process.exit(1);
91
+ }
64
92
  if (!skipHooks && isGitHooksEnvDisabled()) log("skip install (git hooks disabled)");
65
93
  else if (!skipHooks) {
66
94
  const location = resolveHooksLocation(dir);
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from "node:module";
2
2
  //#region package.json
3
- var version = "0.3.0";
3
+ var version = "0.3.2";
4
4
  //#endregion
5
5
  //#region src/utils/constants.ts
6
6
  const VITE_PLUS_NAME = "vite-plus";
@@ -14,7 +14,7 @@ const VITE_CONFIG_FILES = [
14
14
  "vite.config.cts"
15
15
  ];
16
16
  const VITEST_VERSION = "4.1.11";
17
- const TSDOWN_MIGRATE_VERSION = "0.23.0-rc.0";
17
+ const SETUP_VP_VERSION = "v1.20.0";
18
18
  const TSDOWN_MIGRATION_SKILL_URL = "https://github.com/rolldown/tsdown/blob/main/skills/tsdown-migrate/SKILL.md";
19
19
  const VITE_PLUS_OVERRIDE_PACKAGES = process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : {
20
20
  vite: `npm:@voidzero-dev/vite-plus-core@${VITE_PLUS_VERSION}`,
@@ -77,4 +77,4 @@ const DEFAULT_ENVS = {
77
77
  };
78
78
  const CONFIG_METADATA_ENV = "VP_RESOLVING_CONFIG_METADATA";
79
79
  //#endregion
80
- export { version as _, TSDOWN_MIGRATE_VERSION as a, VITEST_VERSION as c, VITE_PLUS_OVERRIDE_PACKAGES as d, VITE_PLUS_VERSION as f, resolveBundled as g, resolve as h, DEFAULT_ENVS as i, VITE_CONFIG_FILES as l, isForceOverrideMode as m, BASEURL_TSCONFIG_WARNING as n, TSDOWN_MIGRATION_SKILL_URL as o, createBaseUrlTsconfigFixArgs as p, CONFIG_METADATA_ENV as r, VITEST_AGE_GATE_EXEMPT_PACKAGES as s, BASEURL_TSCONFIG_FIX_PACKAGE as t, VITE_PLUS_NAME as u };
80
+ export { version as _, SETUP_VP_VERSION as a, VITEST_VERSION as c, VITE_PLUS_OVERRIDE_PACKAGES as d, VITE_PLUS_VERSION as f, resolveBundled as g, resolve as h, DEFAULT_ENVS as i, VITE_CONFIG_FILES as l, isForceOverrideMode as m, BASEURL_TSCONFIG_WARNING as n, TSDOWN_MIGRATION_SKILL_URL as o, createBaseUrlTsconfigFixArgs as p, CONFIG_METADATA_ENV as r, VITEST_AGE_GATE_EXEMPT_PACKAGES as s, BASEURL_TSCONFIG_FIX_PACKAGE as t, VITE_PLUS_NAME as u };
@@ -1,20 +1,28 @@
1
+ import "../../binding/index.js";
2
+ //#region src/types/package.d.ts
3
+ declare const PackageManager: {
4
+ readonly pnpm: "pnpm";
5
+ readonly npm: "npm";
6
+ readonly yarn: "yarn";
7
+ readonly bun: "bun";
8
+ };
9
+ type PackageManager = (typeof PackageManager)[keyof typeof PackageManager];
10
+ //#endregion
1
11
  //#region src/create/bin.d.ts
2
- interface Options {
12
+ export interface Options {
3
13
  directory?: string;
4
14
  interactive: boolean;
5
15
  list: boolean;
6
- help: boolean;
7
16
  verbose: boolean;
8
17
  agent?: string | string[] | false;
9
18
  editor?: string | false;
10
19
  git?: boolean;
11
20
  hooks?: boolean;
12
- packageManager?: string;
21
+ packageManager?: PackageManager;
13
22
  /**
14
23
  * Approve and run gated dependency build scripts without prompting. Useful in
15
24
  * non-interactive runs that need a ready-to-use project.
16
25
  */
17
26
  approveBuilds?: boolean;
18
27
  }
19
- //#endregion
20
- export { Options };
28
+ //#endregion
@@ -1,21 +1,22 @@
1
1
  import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-CMFfr-1z.js";
2
2
  import { t as renderCliDoc } from "../help-BmKpeOP9.js";
3
3
  import { a as muted, i as log, o as printHeader, r as formatDuration, s as success, t as accent } from "../terminal-MKGAuy-p.js";
4
- import { u as VITE_PLUS_NAME } from "../constants-Bn-U8o4v.js";
5
- import { a as resolveViteConfig, n as findWorkspaceRoot, r as hasViteConfig, t as findViteConfig } from "../resolve-vite-config-ipGb39Jo.js";
6
- import { A as isCancel, C as log$1, D as spinner, E as select, O as text, S as intro, a as resolveGitInit, c as selectPackageManager, d as readYamlFile, h as resolveApproveBuildTargets, i as promptGitHooks, k as require_picocolors, m as detectGatedBuilds, n as defaultInteractive, o as runViteFmt, p as approveBuilds, r as downloadPackageManager$1, s as runViteInstall, t as cancelAndExit, u as editYamlFile, v as DependencyType, w as multiselect, y as PackageManager } from "../prompts-DF3yU-eU.js";
7
- import { t as lib_default } from "../lib-L3DWSRQp.js";
4
+ import { u as VITE_PLUS_NAME } from "../constants-IhOditRA.js";
8
5
  import { i as readJsonFile, n as editJsonFile } from "../json-cULBl7Pi.js";
9
- import { o as fetchNpmResource, r as getScopeFromPackageName, s as getNpmRegistry, t as checkNpmPackageExists } from "../package-CBe9EWPY.js";
10
- import { a as selectAgentTargets, c as writeCopilotSetupWorkflow, d as templatesDir, l as displayRelative, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, t as COPILOT_AGENT_ID } from "../agent-Wqx0MPk0.js";
11
- import { A as detectWorkspace$1, B as promptTsupMigration, F as detectFramework, G as promptPrettierMigration, I as hasFrameworkShim, J as detectEslintProject, M as updatePackageJsonWithDeps, N as updateWorkspaceConfig, P as addFrameworkShim, R as detectTsupProject, U as detectPrettierProject, Z as promptEslintMigration, a as selectEditors, b as initGitRepository, c as rewriteMonorepoProject, g as installGitHooks, j as isBingoTemplate, l as rewriteStandaloneProject, m as setPackageManager, n as detectExistingEditors, o as writeEditorConfigs, s as rewriteMonorepo, v as shouldSkipStagedMigrationForHooks, x as injectCreateDefaultTemplate, y as findGitRoot } from "../editor-CC4DqODz.js";
6
+ import { o as fetchNpmResource, r as getScopeFromPackageName, s as getNpmRegistry, t as checkNpmPackageExists } from "../package-BB-Jh_z3.js";
7
+ import { i as hasViteConfig, o as resolveViteConfig, r as findWorkspaceRoot, t as findViteConfig } from "../resolve-vite-config-CHHjsjKJ.js";
8
+ import { C as multiselect, D as text, E as spinner, O as require_picocolors, S as log$1, T as select, a as resolveGitInit, c as selectPackageManager, d as readYamlFile, h as resolveApproveBuildTargets, i as promptGitHooks, k as isCancel, m as detectGatedBuilds, n as defaultInteractive, o as runViteFmt, p as approveBuilds, r as downloadPackageManager$1, s as runViteInstall, t as cancelAndExit, u as editYamlFile, v as DependencyType, x as intro, y as PackageManager } from "../prompts-CujFOJXu.js";
9
+ import { t as require_semver } from "../semver-CaDAb8vV.js";
10
+ import { a as selectAgentTargets, c as writeCopilotSetupWorkflow, d as templatesDir, l as displayRelative, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, t as COPILOT_AGENT_ID } from "../agent-C59HKB4Y.js";
11
+ import { F as addFrameworkShim, I as detectFramework, K as promptPrettierMigration, L as hasFrameworkShim, M as isBingoTemplate, N as updatePackageJsonWithDeps, P as updateWorkspaceConfig, Q as promptEslintMigration, S as injectCreateDefaultTemplate, V as promptTsupMigration, W as detectPrettierProject, Y as detectEslintProject, _ as installGitHooks, a as selectEditors, b as findGitRoot, c as rewriteMonorepoProject, h as setPackageManager, j as detectWorkspace$1, l as rewriteStandaloneProject, n as detectExistingEditors, o as writeEditorConfigs, s as rewriteMonorepo, x as initGitRepository, y as shouldSkipStagedMigrationForHooks, z as detectTsupProject } from "../editor-QOIGtmH4.js";
12
12
  import { n as runCommandSilently, t as runCommand$1 } from "../command-CguLh2KL.js";
13
+ import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
13
14
  import path from "node:path";
14
- import { getVpDirs, runCommand, upsertJsonConfig, vitePlusHeader } from "../../binding/index.js";
15
+ import { getVpDirs, parseCreateArgs, runCommand, upsertJsonConfig, vitePlusHeader } from "../../binding/index.js";
15
16
  import { styleText } from "node:util";
16
17
  import fs from "node:fs";
17
- import { createHash, randomUUID } from "node:crypto";
18
18
  import os from "node:os";
19
+ import { createHash, randomUUID } from "node:crypto";
19
20
  import fsPromises from "node:fs/promises";
20
21
  import assert from "node:assert";
21
22
  //#region src/create/command.ts
@@ -96,6 +97,7 @@ function prependToPathToEnvs(extraPath, envs) {
96
97
  }
97
98
  //#endregion
98
99
  //#region ../../node_modules/.pnpm/nanotar@0.3.0/node_modules/nanotar/dist/index.mjs
100
+ var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
99
101
  const tarItemTypeMap = {
100
102
  "0": "file",
101
103
  "1": "hardLink",
@@ -263,10 +265,16 @@ function sanitizeHostForPath(host) {
263
265
  * (via `.npmrc` scope mappings) don't share a cache slot. The registry
264
266
  * guarantees `manifest.tarballUrl` is a valid URL, so any parse failure
265
267
  * here is a real bug worth surfacing.
268
+ *
269
+ * Require a strict descendant of `cacheRoot` so sibling staging directories
270
+ * stay inside the cache, even if a caller skips `readOrgManifest` validation.
266
271
  */
267
- function getExtractionDir(manifest) {
272
+ function resolveExtractionDir(cacheRoot, manifest) {
268
273
  const { host } = new URL(manifest.tarballUrl);
269
- return path.join(getCacheRoot(), sanitizeHostForPath(host), manifest.scope, "create", manifest.version);
274
+ const resolvedRoot = path.resolve(cacheRoot);
275
+ const resolvedDir = path.resolve(resolvedRoot, sanitizeHostForPath(host), manifest.scope, "create", manifest.version);
276
+ if (!resolvedDir.startsWith(`${resolvedRoot}${path.sep}`)) throw new Error(`org template extraction path escapes the cache root: ${manifest.version}`);
277
+ return resolvedDir;
270
278
  }
271
279
  function parseIntegrity(integrity) {
272
280
  const match = integrity.split(/\s+/)[0].match(/^(sha\d+)-(.+)$/);
@@ -446,7 +454,7 @@ async function cleanupStaleStagingDirs(destDir) {
446
454
  * cleans up and returns the existing directory.
447
455
  */
448
456
  async function ensureOrgPackageExtracted(manifest) {
449
- const extractedRoot = getExtractionDir(manifest);
457
+ const extractedRoot = resolveExtractionDir(getCacheRoot(), manifest);
450
458
  if (fs.existsSync(path.join(extractedRoot, "package.json"))) return extractedRoot;
451
459
  const parent = path.dirname(extractedRoot);
452
460
  await fs.promises.mkdir(parent, { recursive: true });
@@ -668,6 +676,7 @@ async function readOrgManifest(scope, requestedVersion) {
668
676
  resolvedVersion = packument["dist-tags"]?.latest;
669
677
  if (!resolvedVersion) return null;
670
678
  }
679
+ if (import_semver.default.valid(resolvedVersion) === null) throw new OrgManifestSchemaError(`invalid version "${resolvedVersion}" (expected a semantic version)`, packageName);
671
680
  const meta = packument.versions?.[resolvedVersion];
672
681
  if (!meta) return null;
673
682
  let templates = validateManifest(meta, packageName);
@@ -783,6 +792,7 @@ function discoverTemplate(templateName, templateArgs, workspaceInfo, interactive
783
792
  if (isBingoTemplate(pkg)) {
784
793
  type = TemplateType.bingo;
785
794
  args.push("--skip-requests");
795
+ envs.VP_CREATE_INTERACTIVE = interactive === false ? "0" : "1";
786
796
  }
787
797
  return {
788
798
  command: "node",
@@ -3976,11 +3986,6 @@ function getRandomProjectName(options = {}) {
3976
3986
  function hasExplicitEditorOptIn(editor) {
3977
3987
  return typeof editor === "string" && editor.trim() !== "";
3978
3988
  }
3979
- function normalizeEditorOption(editor) {
3980
- if (!Array.isArray(editor)) return editor;
3981
- if (editor.includes(false)) return false;
3982
- return editor.findLast((value) => typeof value === "string");
3983
- }
3984
3989
  function shouldConfigureEditorsForCreate({ editor, isMonorepo }) {
3985
3990
  if (editor === false) return false;
3986
3991
  if (!isMonorepo) return true;
@@ -4664,129 +4669,6 @@ function dropAliasedRuntimeDevDeps(appProjectPath, packageManager) {
4664
4669
  }
4665
4670
  //#endregion
4666
4671
  //#region src/create/bin.ts
4667
- const helpMessage = renderCliDoc({
4668
- usage: "vp create [TEMPLATE] [OPTIONS] [-- TEMPLATE_OPTIONS]",
4669
- summary: "Use any builtin, local or remote template with Vite+.",
4670
- documentationUrl: "https://viteplus.dev/guide/create",
4671
- sections: [
4672
- {
4673
- title: "Arguments",
4674
- rows: [{
4675
- label: "TEMPLATE",
4676
- description: [
4677
- `Template name. Run \`${accent("vp create --list")}\` to see available templates.`,
4678
- `- Default: ${accent("vite:monorepo")}, ${accent("vite:application")}, ${accent("vite:library")}, ${accent("vite:generator")}`,
4679
- "- Remote: vite, @tanstack/start, create-next-app,",
4680
- " create-nuxt, github:user/repo, https://github.com/user/template-repo, etc.",
4681
- "- Local: a `create.templates` entry name from vite.config.ts (monorepo)",
4682
- `- Org scope: ${accent("@your-org")} → picker from ${accent("@your-org/create")}'s ${accent("createConfig.templates")} manifest`,
4683
- `- Org entry: ${accent("@your-org:web")} → manifest entry "web" from ${accent("@your-org/create")}`,
4684
- `When omitted, uses \`create.defaultTemplate\` from vite.config.ts if set.`
4685
- ]
4686
- }]
4687
- },
4688
- {
4689
- title: "Options",
4690
- rows: [
4691
- {
4692
- label: "--directory DIR",
4693
- description: "Target directory for the generated project."
4694
- },
4695
- {
4696
- label: "--agent NAME",
4697
- description: "Write coding agent instructions to AGENTS.md, CLAUDE.md, etc."
4698
- },
4699
- {
4700
- label: "--no-agent",
4701
- description: "Skip writing coding agent instructions"
4702
- },
4703
- {
4704
- label: "--editor NAME",
4705
- description: "Write editor config files for the specified editor."
4706
- },
4707
- {
4708
- label: "--no-editor",
4709
- description: "Skip writing editor config files"
4710
- },
4711
- {
4712
- label: "--git",
4713
- description: "Initialize a git repository"
4714
- },
4715
- {
4716
- label: "--no-git",
4717
- description: "Skip git repository initialization"
4718
- },
4719
- {
4720
- label: "--hooks",
4721
- description: "Set up pre-commit hooks (default in non-interactive mode)"
4722
- },
4723
- {
4724
- label: "--no-hooks",
4725
- description: "Skip pre-commit hooks setup"
4726
- },
4727
- {
4728
- label: "--package-manager NAME",
4729
- description: "Use specified package manager (pnpm, npm, yarn, bun)"
4730
- },
4731
- {
4732
- label: "--approve-builds",
4733
- description: "Approve and run gated dependency build scripts without prompting"
4734
- },
4735
- {
4736
- label: "--verbose",
4737
- description: "Show detailed scaffolding output"
4738
- },
4739
- {
4740
- label: "--no-interactive",
4741
- description: "Run in non-interactive mode"
4742
- },
4743
- {
4744
- label: "--list",
4745
- description: "List all available templates"
4746
- },
4747
- {
4748
- label: "-h, --help",
4749
- description: "Show this help message"
4750
- }
4751
- ]
4752
- },
4753
- {
4754
- title: "Template Options",
4755
- lines: [" Any arguments after -- are passed directly to the template."]
4756
- },
4757
- {
4758
- title: "Examples",
4759
- lines: [
4760
- ` ${muted("# Interactive mode")}`,
4761
- ` ${accent("vp create")}`,
4762
- "",
4763
- ` ${muted("# Use existing templates (shorthand expands to create-* packages)")}`,
4764
- ` ${accent("vp create vite")}`,
4765
- ` ${accent("vp create @tanstack/start")}`,
4766
- ` ${accent("vp create svelte")}`,
4767
- ` ${accent("vp create vite -- --template react-ts")}`,
4768
- "",
4769
- ` ${muted("# Full package names also work")}`,
4770
- ` ${accent("vp create create-vite")}`,
4771
- ` ${accent("vp create create-next-app")}`,
4772
- "",
4773
- ` ${muted("# Create Vite+ monorepo, application, library, or generator scaffolds")}`,
4774
- ` ${accent("vp create vite:monorepo")}`,
4775
- ` ${accent("vp create vite:application")}`,
4776
- ` ${accent("vp create vite:library")}`,
4777
- ` ${accent("vp create vite:generator")}`,
4778
- "",
4779
- ` ${muted("# Use templates from GitHub (via degit)")}`,
4780
- ` ${accent("vp create github:user/repo")}`,
4781
- ` ${accent("vp create https://github.com/user/template-repo")}`,
4782
- "",
4783
- ` ${muted("# Pick from an org that publishes @scope/create with createConfig.templates")}`,
4784
- ` ${accent("vp create @your-org")} ${muted("# interactive picker")}`,
4785
- ` ${accent("vp create @your-org:web")} ${muted("# direct manifest-entry selection")}`
4786
- ]
4787
- }
4788
- ]
4789
- });
4790
4672
  const listTemplatesMessage = renderCliDoc({
4791
4673
  usage: "vp create --list",
4792
4674
  summary: "List available builtin and popular project templates.",
@@ -4861,52 +4743,23 @@ const listTemplatesMessage = renderCliDoc({
4861
4743
  }
4862
4744
  ]
4863
4745
  });
4864
- function normalizeAgentOption(agent) {
4865
- if (!Array.isArray(agent)) return agent;
4866
- if (agent.includes(false)) return false;
4867
- return agent.filter((value) => typeof value === "string");
4868
- }
4869
4746
  function parseArgs() {
4870
- const args = process.argv.slice(3);
4871
- const separatorIndex = args.indexOf("--");
4872
- const viteArgs = separatorIndex >= 0 ? args.slice(0, separatorIndex) : args;
4873
- const templateArgs = separatorIndex >= 0 ? args.slice(separatorIndex + 1) : [];
4874
- const parsed = lib_default(viteArgs, {
4875
- alias: { h: "help" },
4876
- boolean: [
4877
- "help",
4878
- "list",
4879
- "all",
4880
- "interactive",
4881
- "hooks",
4882
- "verbose",
4883
- "git",
4884
- "approve-builds"
4885
- ],
4886
- string: [
4887
- "directory",
4888
- "agent",
4889
- "editor",
4890
- "package-manager"
4891
- ],
4892
- default: { interactive: defaultInteractive() }
4893
- });
4747
+ const parsed = unwrapCliParseOutcome(parseCreateArgs(process.argv.slice(3)));
4894
4748
  return {
4895
- templateName: parsed._[0],
4749
+ templateName: parsed.templateName,
4896
4750
  options: {
4897
4751
  directory: parsed.directory,
4898
- interactive: parsed.interactive,
4899
- list: parsed.list || false,
4900
- help: parsed.help || false,
4901
- verbose: parsed.verbose || false,
4902
- agent: normalizeAgentOption(parsed.agent),
4903
- editor: normalizeEditorOption(parsed.editor),
4752
+ interactive: parsed.interactive ?? defaultInteractive(),
4753
+ list: parsed.list ?? false,
4754
+ verbose: parsed.verbose ?? false,
4755
+ agent: parsed.agent,
4756
+ editor: parsed.editor,
4904
4757
  git: parsed.git,
4905
4758
  hooks: parsed.hooks,
4906
- packageManager: parsed["package-manager"],
4907
- approveBuilds: parsed["approve-builds"] || false
4759
+ packageManager: parsed.packageManager,
4760
+ approveBuilds: parsed.approveBuilds ?? false
4908
4761
  },
4909
- templateArgs
4762
+ templateArgs: parsed.templateArgs
4910
4763
  };
4911
4764
  }
4912
4765
  function describeScaffold(templateName, templateArgs) {
@@ -4944,27 +4797,31 @@ function formatTemplateName(templateName) {
4944
4797
  }
4945
4798
  function getNextCommand(projectDir, command) {
4946
4799
  if (!projectDir || projectDir === ".") return command;
4947
- return `cd ${projectDir} && ${command}`;
4800
+ return `cd ${formatProjectDirArgument(projectDir)} && ${command}`;
4801
+ }
4802
+ function formatProjectDirArgument(projectDir) {
4803
+ const argument = projectDir.startsWith("-") ? `./${projectDir}` : projectDir;
4804
+ return /^[A-Za-z0-9_@./\\-]+$/.test(argument) ? argument : JSON.stringify(argument);
4948
4805
  }
4949
4806
  function getCopilotSetupRoot(projectRoot, isExistingMonorepo) {
4950
4807
  if (!isExistingMonorepo) return projectRoot;
4951
4808
  return findGitRoot(projectRoot) ?? projectRoot;
4952
4809
  }
4953
4810
  function showCreateSummary(options) {
4954
- const { description, installSummary, nextCommand, packageManager, packageManagerVersion, projectDir } = options;
4811
+ const { description, gitInitialized, installSummary, nextCommand, packageManager, packageManagerVersion, projectDir } = options;
4955
4812
  log(`${styleText("magenta", "◇")} Scaffolded ${accent(projectDir)}${description ? ` with ${description}` : ""}`);
4956
4813
  log(`${styleText("gray", "•")} Node ${process.versions.node} ${packageManager} ${packageManagerVersion}`);
4957
4814
  if (installSummary?.status === "installed") log(`${styleText("green", "✓")} Dependencies installed in ${formatDuration(installSummary.durationMs)}`);
4815
+ if (gitInitialized) {
4816
+ const git = !projectDir || projectDir === "." ? "git" : `git -C ${formatProjectDirArgument(projectDir)}`;
4817
+ const gitCommand = `${git} add -A && ${git} commit -m "chore: initial commit"`;
4818
+ log(`${styleText("blue", "→")} Git (optional): ${accent(gitCommand)}`);
4819
+ }
4958
4820
  log(`${styleText("blue", "→")} Next: ${accent(nextCommand)}`);
4959
4821
  }
4960
4822
  async function main() {
4961
4823
  const { templateName, options, templateArgs } = parseArgs();
4962
4824
  let compactOutput = !options.verbose;
4963
- if (options.help) {
4964
- printHeader();
4965
- log(helpMessage);
4966
- return;
4967
- }
4968
4825
  if (options.list) {
4969
4826
  await showAvailableTemplates();
4970
4827
  return;
@@ -4996,6 +4853,7 @@ async function main() {
4996
4853
  let selectedEditors;
4997
4854
  let selectedParentDir;
4998
4855
  let remoteTargetDir;
4856
+ let gitInitialized = false;
4999
4857
  let shouldSetupHooks = false;
5000
4858
  let bundled;
5001
4859
  let skipShorthandExpansion = false;
@@ -5159,11 +5017,6 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5159
5017
  targetDir = selectedParentDir ? path.join(selectedParentDir, selected.targetDir).split(path.sep).join("/") : selected.targetDir;
5160
5018
  }
5161
5019
  }
5162
- if (options.packageManager && !Object.values(PackageManager).includes(options.packageManager)) {
5163
- const valid = Object.values(PackageManager).join(", ");
5164
- log$1.error(`Invalid package manager: ${options.packageManager}. Must be one of: ${valid}`);
5165
- cancelAndExit("Invalid --package-manager value", 1);
5166
- }
5167
5020
  const requestedPackageManager = options.packageManager;
5168
5021
  const detectedPackageManager = workspaceInfoOptional.packageManager;
5169
5022
  const packageManager = (isMonorepo ? detectedPackageManager ?? requestedPackageManager : requestedPackageManager ?? detectedPackageManager) ?? await selectPackageManager(options.interactive, compactOutput);
@@ -5290,7 +5143,8 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5290
5143
  workspaceInfo.packages = scaffoldedWorkspace.packages;
5291
5144
  if (shouldSetupGit) {
5292
5145
  updateCreateProgress("Initializing git repository");
5293
- if (await initGitRepository(fullPath)) ensureDefaultGitignoreEntries(fullPath);
5146
+ gitInitialized = await initGitRepository(fullPath);
5147
+ if (gitInitialized) ensureDefaultGitignoreEntries(fullPath);
5294
5148
  }
5295
5149
  updateCreateProgress("Writing agent instructions");
5296
5150
  pauseCreateProgress();
@@ -5336,6 +5190,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5336
5190
  clearCreateProgress();
5337
5191
  showCreateSummary({
5338
5192
  description: describeScaffold(selectedTemplateName, selectedTemplateArgs),
5193
+ gitInitialized,
5339
5194
  installSummary,
5340
5195
  nextCommand: getNextCommand(projectDir, "vp run"),
5341
5196
  packageManager: workspaceInfo.packageManager,
@@ -5510,7 +5365,8 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5510
5365
  } else {
5511
5366
  if (shouldSetupGit) {
5512
5367
  updateCreateProgress("Initializing git repository");
5513
- if (await initGitRepository(fullPath)) ensureDefaultGitignoreEntries(fullPath);
5368
+ gitInitialized = await initGitRepository(fullPath);
5369
+ if (gitInitialized) ensureDefaultGitignoreEntries(fullPath);
5514
5370
  }
5515
5371
  if (shouldMigrateLintFmtTools) await installAndMigrate(fullPath);
5516
5372
  updateCreateProgress("Applying Vite+ project setup");
@@ -5532,6 +5388,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5532
5388
  clearCreateProgress();
5533
5389
  showCreateSummary({
5534
5390
  description: describeScaffold(selectedTemplateName, selectedTemplateArgs),
5391
+ gitInitialized,
5535
5392
  installSummary,
5536
5393
  nextCommand: getNextCommand(projectDir, "vp run"),
5537
5394
  packageManager: workspaceInfo.packageManager,
@@ -1,10 +1,10 @@
1
- import { c as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-Bn-U8o4v.js";
1
+ import { c as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-IhOditRA.js";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { defineConfig, defineProject } from "vitest/config";
7
- //#region ../../node_modules/.pnpm/tsdown@0.22.14_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.14_@tsdown+exe@0.22.14_@t_4084c24f9f44f250d2b604ebc16f10f3/node_modules/tsdown/esm-shims.js
7
+ //#region ../../node_modules/.pnpm/tsdown@0.23.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.0_@tsdown+exe@0.23.0_@type_298964156353ef75a02894ab80b3a2e6/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();
@@ -1,6 +1,6 @@
1
- import { t as PackUserConfig } from "./pack-PvUg_xpv.js";
1
+ import { t as PackUserConfig } from "./pack-BK38MLVZ.js";
2
2
  import { ConfigEnv, UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig } from "vitest/config";
3
- import { PluginOption, UserConfig } from "@voidzero-dev/vite-plus-core";
3
+ import { PluginOption, UserConfig } from "vite";
4
4
  import { OxfmtConfig } from "oxfmt";
5
5
  import { OxlintConfig } from "oxlint";
6
6
  import { InlineConfig } from "vitest/node";
@@ -169,7 +169,7 @@ type Configuration = Record<string, string | TaskFunction | GenerateTask | (stri
169
169
  type StagedConfig = Configuration;
170
170
  //#endregion
171
171
  //#region src/define-config.d.ts
172
- declare module '@voidzero-dev/vite-plus-core' {
172
+ declare module 'vite' {
173
173
  interface UserConfig {
174
174
  /**
175
175
  * Options for oxlint
@@ -236,12 +236,8 @@ declare module '@voidzero-dev/vite-plus-core' {
236
236
  templates?: CreateTemplateEntry[];
237
237
  };
238
238
  /**
239
- * Vitest test configuration.
240
- *
241
- * Vitest augments vite's `UserConfig` with a `test` field via
242
- * `declare module 'vite'`, but vite-plus-core is a fork of vite so that
243
- * augmentation does not apply here. Re-declare it locally so user
244
- * configs like `defineConfig({ test: { globals: true } })` typecheck.
239
+ * Vitest may augment a separate Vite copy, for example an npm peer dependency.
240
+ * Keep the public test field on the CLI's core types in that layout too.
245
241
  */
246
242
  test?: InlineConfig;
247
243
  }
@@ -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.3.0", VITE_PLUS_VERSION, VITEST_VERSION, CONFIG_METADATA_ENV;
40
+ var version = "0.3.2", 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.11";
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_define_config = require("./define-config-WiVlryJ2.cjs");
2
+ const require_define_config = require("./define-config-DpAPETDf.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;