vite-plus 0.2.9 → 0.3.0

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 (58) hide show
  1. package/README.md +4 -3
  2. package/binding/index.cjs +57 -54
  3. package/binding/index.d.cts +93 -0
  4. package/dist/{agent-DQU8uS6P.js → agent-Wqx0MPk0.js} +1 -1
  5. package/dist/bin.js +16 -6
  6. package/dist/command-CLJK5jGW.js +2 -0
  7. package/dist/command-CguLh2KL.js +471 -0
  8. package/dist/config/bin.js +7 -5
  9. package/dist/{constants-CG513DRa.js → constants-Bn-U8o4v.js} +5 -3
  10. package/dist/create/bin.js +28 -52
  11. package/dist/{define-config-CV4bQG_8.js → define-config-GXUdVT-0.js} +2 -2
  12. package/dist/{define-config-DyNLA_f0.cjs → define-config-WiVlryJ2.cjs} +2 -2
  13. package/dist/define-config.cjs +1 -1
  14. package/dist/define-config.js +1 -1
  15. package/dist/{editor-g4PosU99.js → editor-CC4DqODz.js} +562 -59
  16. package/dist/{terminal-Bz-ps6rJ.js → help-BmKpeOP9.js} +1 -38
  17. package/dist/hooks/bin.js +3 -2
  18. package/dist/{hooks-pNCBWtFT.js → hooks-DFqViZqZ.js} +5 -2
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/migration/bin.js +60 -11
  22. package/dist/migration/compat/worker.js +1 -1
  23. package/dist/{oxlint-plugin-config-BEZ9IUf7.js → oxlint-plugin-config-DX5ezKbB.js} +1 -1
  24. package/dist/oxlint-plugin.js +1 -1
  25. package/dist/pack-bin.js +5 -4
  26. package/dist/{package-B4T8RGMG.js → package-CBe9EWPY.js} +2 -2
  27. package/dist/{prompts-CHz_98bJ.js → prompts-DF3yU-eU.js} +6 -474
  28. package/dist/{report-BS7ULx7A.js → report-ZNR1Mk6h.js} +1 -0
  29. package/dist/{resolve-vite-config-Dmeyeyj-.js → resolve-vite-config-ipGb39Jo.js} +2 -2
  30. package/dist/staged/bin.js +77 -47
  31. package/dist/terminal-MKGAuy-p.js +39 -0
  32. package/dist/toolchain.js +9 -9
  33. package/dist/toolchain.json +9 -9
  34. package/dist/tsconfig-BVHG3DpR.js +2 -0
  35. package/dist/{tsconfig-7v_BHagU.js → tsconfig-LD2QhQ0O.js} +5 -4
  36. package/dist/version.js +4 -3
  37. package/dist/versions.js +5 -5
  38. package/docs/guide/env.md +20 -6
  39. package/docs/guide/install.md +2 -1
  40. package/docs/guide/installer-env-vars.md +41 -5
  41. package/docs/guide/migrate-rules.md +9 -0
  42. package/docs/guide/migrate.md +5 -5
  43. package/docs/guide/test.md +8 -0
  44. package/docs/guide/upgrade.md +48 -1
  45. package/package.json +32 -33
  46. package/docs/_data/team.ts +0 -131
  47. package/docs/package.json +0 -30
  48. package/docs/pnpm-lock.yaml +0 -4003
  49. package/docs/pnpm-workspace.yaml +0 -13
  50. package/docs/public/checkmark.svg +0 -1
  51. package/docs/public/cta-background.jpg +0 -0
  52. package/docs/public/favicon.svg +0 -1
  53. package/docs/public/icon.svg +0 -1
  54. package/docs/public/logo.svg +0 -1
  55. package/docs/public/og.jpg +0 -0
  56. package/docs/vite.config.ts +0 -20
  57. package/dist/{json-qlK6UH0r.js → json-cULBl7Pi.js} +107 -107
  58. package/dist/{log-update-CoW8Z4Dl.js → log-update-DHZRyJ2m.js} +1 -1
@@ -1,23 +1,24 @@
1
1
  import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-CMFfr-1z.js";
2
- import { a as muted, i as log, l as renderCliDoc, o as printHeader, r as formatDuration, s as success, t as accent } from "../terminal-Bz-ps6rJ.js";
3
- import { c as VITE_PLUS_NAME } from "../constants-CG513DRa.js";
4
- import { A as isCancel, C as log$1, D as spinner, E as select, M as runCommandSilently, N as require_cross_spawn, O as text, S as intro, a as resolveGitInit, c as selectPackageManager, d as readYamlFile, h as resolveApproveBuildTargets, i as promptGitHooks, j as runCommand$1, 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, x as confirm, y as PackageManager } from "../prompts-CHz_98bJ.js";
5
- import { i as readJsonFile, n as editJsonFile } from "../json-qlK6UH0r.js";
6
- import { a as resolveViteConfig, n as findWorkspaceRoot, r as hasViteConfig, t as findViteConfig } from "../resolve-vite-config-Dmeyeyj-.js";
2
+ import { t as renderCliDoc } from "../help-BmKpeOP9.js";
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
7
  import { t as lib_default } from "../lib-L3DWSRQp.js";
8
- import { o as fetchNpmResource, r as getScopeFromPackageName, s as getNpmRegistry, t as checkNpmPackageExists } from "../package-B4T8RGMG.js";
9
- 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-DQU8uS6P.js";
10
- import { A as isBingoTemplate, F as hasFrameworkShim, G as promptEslintMigration, H as detectEslintProject, L as detectPrettierProject, M as updateWorkspaceConfig, N as addFrameworkShim, P as detectFramework, a as selectEditors, b as initGitRepository, c as rewriteMonorepoProject, g as installGitHooks, j as updatePackageJsonWithDeps, k as detectWorkspace$1, l as rewriteStandaloneProject, m as setPackageManager, n as detectExistingEditors, o as writeEditorConfigs, s as rewriteMonorepo, v as shouldSkipStagedMigrationForHooks, x as injectCreateDefaultTemplate, y as findGitRoot, z as promptPrettierMigration } from "../editor-g4PosU99.js";
8
+ 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";
12
+ import { n as runCommandSilently, t as runCommand$1 } from "../command-CguLh2KL.js";
11
13
  import path from "node:path";
12
- import { runCommand, upsertJsonConfig, vitePlusHeader } from "../../binding/index.js";
14
+ import { getVpDirs, runCommand, upsertJsonConfig, vitePlusHeader } from "../../binding/index.js";
13
15
  import { styleText } from "node:util";
14
16
  import fs from "node:fs";
15
- import os from "node:os";
16
17
  import { createHash, randomUUID } from "node:crypto";
18
+ import os from "node:os";
17
19
  import fsPromises from "node:fs/promises";
18
20
  import assert from "node:assert";
19
21
  //#region src/create/command.ts
20
- var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
21
22
  async function runCommandAndDetectProjectDir(options, parentDir) {
22
23
  const cwd = parentDir ? path.join(options.cwd, parentDir) : options.cwd;
23
24
  const existingDirs = /* @__PURE__ */ new Set();
@@ -245,8 +246,7 @@ function _parseExtendedHeaders(data) {
245
246
  //#endregion
246
247
  //#region src/create/org-tarball.ts
247
248
  function getCacheRoot() {
248
- const home = process.env.VP_HOME || path.join(os.homedir(), ".vite-plus");
249
- return path.join(home, "tmp", "create-org");
249
+ return path.join(getVpDirs().cache, "create-org");
250
250
  }
251
251
  /**
252
252
  * Replace characters that are illegal in Windows path segments
@@ -4642,13 +4642,14 @@ function alignMonorepoTypeScriptVersion(workspaceRootPath, appProjectPath, libra
4642
4642
  * scaffolded sub-package. After migration its scripts already use `vp ...` and
4643
4643
  * nothing imports `'vite'` directly, so `vite-plus` provides them transitively.
4644
4644
  *
4645
- * pnpm is the exception and keeps them: pnpm only surfaces the
4646
- * pnpm-workspace.yaml `overrides.vite: catalog:` entry through a package that
4647
- * directly depends on `vite`, so keeping the aliased devDep lets `vp why vite`
4648
- * reflect the override (resolving to @voidzero-dev/vite-plus-core). npm, yarn,
4649
- * and bun redirect the transitive/peer vite via their root
4650
- * overrides/resolutions regardless of a direct dep, so the aliased keys are
4651
- * dead weight and are dropped.
4645
+ * pnpm is the exception and keeps them: a package needs a DIRECT `vite` edge for
4646
+ * `vite` to resolve to @voidzero-dev/vite-plus-core there (and for `vp why vite`
4647
+ * to show it) rather than pnpm auto-installing an upstream Vite to satisfy
4648
+ * Vitest's peer. Migration points that edge at the workspace catalog, which owns
4649
+ * the alias; the `vite@*` workspace override covers the transitive and peer
4650
+ * declarations instead (see `pnpmOverrideKey`). npm, yarn, and bun redirect the
4651
+ * transitive/peer vite via their root overrides/resolutions regardless of a
4652
+ * direct dep, so the aliased keys are dead weight and are dropped.
4652
4653
  */
4653
4654
  function dropAliasedRuntimeDevDeps(appProjectPath, packageManager) {
4654
4655
  if (packageManager === PackageManager.pnpm) return;
@@ -5195,7 +5196,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5195
5196
  onCancel: () => cancelAndExit()
5196
5197
  });
5197
5198
  const shouldSetupGit = await resolveGitInit(options, isMonorepo);
5198
- if (!isMonorepo) shouldSetupHooks = await promptGitHooks(options);
5199
+ if (!isMonorepo && (!options.interactive || shouldSetupGit || options.hooks === true)) shouldSetupHooks = await promptGitHooks(options);
5199
5200
  const createProgress = options.interactive && compactOutput ? spinner({ indicator: "timer" }) : void 0;
5200
5201
  let createProgressStarted = false;
5201
5202
  let createProgressMessage = "Scaffolding project";
@@ -5265,19 +5266,6 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5265
5266
  resumeCreateProgress();
5266
5267
  }
5267
5268
  if (templateInfo.command === BuiltinTemplate.monorepo || isBundledMonorepo) {
5268
- let shouldInitGit = shouldSetupGit;
5269
- if (options.interactive && !compactOutput && options.git === void 0) {
5270
- pauseCreateProgress();
5271
- const selected = await confirm({
5272
- message: "Initialize git repository:",
5273
- initialValue: true
5274
- });
5275
- resumeCreateProgress();
5276
- if (isCancel(selected)) {
5277
- log$1.info("Operation cancelled. Skipping git initialization");
5278
- shouldInitGit = false;
5279
- } else shouldInitGit = selected;
5280
- } else if (shouldInitGit && !compactOutput) log$1.info("Initializing git repository (default: yes)");
5281
5269
  updateCreateProgress("Creating monorepo");
5282
5270
  await checkProjectDirExists(path.join(workspaceInfo.rootDir, targetDir), options.interactive);
5283
5271
  const result = isBundledMonorepo ? await executeBundledTemplate(workspaceInfo, {
@@ -5300,18 +5288,9 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5300
5288
  workspaceInfo.workspacePatterns = scaffoldedWorkspace.workspacePatterns;
5301
5289
  workspaceInfo.parentDirs = scaffoldedWorkspace.parentDirs;
5302
5290
  workspaceInfo.packages = scaffoldedWorkspace.packages;
5303
- if (shouldInitGit) {
5304
- const gitResult = import_cross_spawn.default.sync("git", ["init"], {
5305
- stdio: "pipe",
5306
- cwd: fullPath
5307
- });
5308
- if (gitResult.status === 0) {
5309
- if (!compactOutput) log$1.success("Git repository initialized");
5310
- ensureDefaultGitignoreEntries(fullPath);
5311
- } else {
5312
- log$1.warn("Failed to initialize git repository");
5313
- if (gitResult.stderr) log$1.info(gitResult.stderr.toString());
5314
- }
5291
+ if (shouldSetupGit) {
5292
+ updateCreateProgress("Initializing git repository");
5293
+ if (await initGitRepository(fullPath)) ensureDefaultGitignoreEntries(fullPath);
5315
5294
  }
5316
5295
  updateCreateProgress("Writing agent instructions");
5317
5296
  pauseCreateProgress();
@@ -5342,10 +5321,6 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5342
5321
  updateCreateProgress("Integrating monorepo");
5343
5322
  const skipStagedMigration = shouldSkipStagedMigrationForHooks(fullPath, shouldSetupHooks, workspaceInfo.packageManager, workspaceInfo.packages);
5344
5323
  rewriteMonorepo(workspaceInfo, skipStagedMigration, compactOutput);
5345
- if (shouldSetupGit) {
5346
- updateCreateProgress("Initializing git repository");
5347
- if (await initGitRepository(fullPath)) ensureDefaultGitignoreEntries(fullPath);
5348
- }
5349
5324
  if (bundled?.monorepo) injectCreateDefaultTemplate(fullPath, bundled.scope, compactOutput);
5350
5325
  if (shouldSetupHooks) installGitHooks(fullPath, compactOutput, void 0, workspaceInfo.packageManager, workspaceInfo.packages);
5351
5326
  updateCreateProgress("Installing dependencies");
@@ -5458,7 +5433,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5458
5433
  if (selectedEditors?.includes("vscode")) ensureGitignoreVsCodeEditorConfigs(fullPath);
5459
5434
  resumeCreateProgress();
5460
5435
  }
5461
- const shouldMigrateLintFmtTools = detectEslintProject(fullPath).hasDependency || detectPrettierProject(fullPath).hasDependency;
5436
+ const shouldMigrateLintFmtTools = detectEslintProject(fullPath).hasDependency || detectPrettierProject(fullPath).hasDependency || detectTsupProject(fullPath).hasDependency;
5462
5437
  let installSummary;
5463
5438
  const installAndMigrate = async (installCwd) => {
5464
5439
  setPackageManager(fullPath, workspaceInfo.downloadPackageManager);
@@ -5475,10 +5450,11 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5475
5450
  });
5476
5451
  if (installSummary.status !== "installed") return;
5477
5452
  if (installSummary.pendingBuilds && installSummary.pendingBuilds.length > 0) migratePendingBuilds = installSummary.pendingBuilds;
5478
- updateCreateProgress("Migrating lint and format tools");
5453
+ updateCreateProgress("Migrating lint, format & pack tools");
5479
5454
  pauseCreateProgress();
5480
5455
  await promptEslintMigration(fullPath, false);
5481
5456
  await promptPrettierMigration(fullPath, false);
5457
+ await promptTsupMigration(fullPath, false, packageManager);
5482
5458
  resumeCreateProgress();
5483
5459
  };
5484
5460
  if (isMonorepo) {
@@ -1,10 +1,10 @@
1
- import { o as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-CG513DRa.js";
1
+ import { c as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-Bn-U8o4v.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_8361ec2a4d03114085b1954a2fc42e35/node_modules/tsdown/esm-shims.js
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
8
8
  const getFilename = () => fileURLToPath(import.meta.url);
9
9
  const getDirname = () => path.dirname(getFilename());
10
10
  const __dirname = /* @__PURE__ */ getDirname();
@@ -37,10 +37,10 @@ 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.9", VITE_PLUS_VERSION, VITEST_VERSION, CONFIG_METADATA_ENV;
40
+ var version = "0.3.0", 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
- VITEST_VERSION = "4.1.10";
43
+ VITEST_VERSION = "4.1.11";
44
44
  process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : `${VITE_PLUS_VERSION}`;
45
45
  (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
46
46
  process.versions.node, process.release.name;
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_define_config = require("./define-config-DyNLA_f0.cjs");
2
+ const require_define_config = require("./define-config-WiVlryJ2.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-CV4bQG_8.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-GXUdVT-0.js";
2
2
  export { AUTO_INLINE_DEPS, assertCoverageProviderVersionMatch, checkCoverageProviderVersion, computeAutoInlineList, defineConfig, defineProject, isVitestFamilySpecifier, lazyPlugins, resolveCoverageProviderToCheck, withConfigMetadataResolution };