vite-plus 0.1.19 → 0.1.20-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +6 -79
- package/binding/index.cjs +1 -0
- package/binding/index.d.cts +8 -0
- package/dist/{agent-iabUQh_f.js → agent-Dz7r-vyX.js} +60 -2
- package/dist/bin.js +2 -3
- package/dist/config/bin.js +3 -4
- package/dist/create/bin.js +30 -12
- package/dist/migration/bin.js +7 -66
- package/dist/staged/bin.js +3 -4
- package/dist/{terminal-P9aw9Fib.js → terminal-CxTMfsxZ.js} +12 -1
- package/dist/version.js +2 -4
- package/dist/versions.js +4 -4
- package/dist/{workspace-CbqYKgbm.js → workspace-DE_pac71.js} +60 -8
- package/docs/_data/team.js +122 -0
- package/docs/index.md +12 -0
- package/docs/package.json +26 -0
- package/docs/pnpm-lock.yaml +3330 -0
- package/docs/pnpm-workspace.yaml +6 -0
- package/docs/public/checkmark.svg +1 -0
- package/docs/public/cta-background.jpg +0 -0
- package/docs/public/favicon.svg +1 -0
- package/docs/public/icon.svg +1 -0
- package/docs/public/logo.svg +1 -0
- package/docs/public/og.jpg +0 -0
- package/docs/team.md +35 -0
- package/package.json +18 -18
- package/dist/mcp/bin.d.ts +0 -1
- package/dist/mcp/bin.js +0 -377
- package/skills/vite-plus/SKILL.md +0 -58
- /package/{skills/vite-plus/docs → docs}/config/build.md +0 -0
- /package/{skills/vite-plus/docs → docs}/config/fmt.md +0 -0
- /package/{skills/vite-plus/docs → docs}/config/index.md +0 -0
- /package/{skills/vite-plus/docs → docs}/config/lint.md +0 -0
- /package/{skills/vite-plus/docs → docs}/config/pack.md +0 -0
- /package/{skills/vite-plus/docs → docs}/config/run.md +0 -0
- /package/{skills/vite-plus/docs → docs}/config/staged.md +0 -0
- /package/{skills/vite-plus/docs → docs}/config/test.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/build.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/cache.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/check.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/ci.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/commit-hooks.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/create.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/dev.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/env.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/fmt.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/ide-integration.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/implode.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/index.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/install.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/lint.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/migrate.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/pack.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/run.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/test.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/troubleshooting.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/upgrade.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/vpx.md +0 -0
- /package/{skills/vite-plus/docs → docs}/guide/why.md +0 -0
package/AGENTS.md
CHANGED
|
@@ -2,87 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
# Using Vite+, the Unified Toolchain for the Web
|
|
4
4
|
|
|
5
|
-
This project is using Vite+, a unified toolchain built on top of Vite, Rolldown, Vitest, tsdown, Oxlint, Oxfmt, and Vite Task. Vite+ wraps runtime management, package management, and frontend tooling in a single global CLI called `vp`. Vite+ is distinct from Vite,
|
|
5
|
+
This project is using Vite+, a unified toolchain built on top of Vite, Rolldown, Vitest, tsdown, Oxlint, Oxfmt, and Vite Task. Vite+ wraps runtime management, package management, and frontend tooling in a single global CLI called `vp`. Vite+ is distinct from Vite, and it invokes Vite through `vp dev` and `vp build`. Run `vp help` to print a list of commands and `vp <command> --help` for information about a specific command.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Docs are local at `node_modules/vite-plus/docs` or online at https://viteplus.dev/guide/.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### Start
|
|
12
|
-
|
|
13
|
-
- create - Create a new project from a template
|
|
14
|
-
- migrate - Migrate an existing project to Vite+
|
|
15
|
-
- config - Configure hooks and agent integration
|
|
16
|
-
- staged - Run linters on staged files
|
|
17
|
-
- install (`i`) - Install dependencies
|
|
18
|
-
- env - Manage Node.js versions
|
|
19
|
-
|
|
20
|
-
### Develop
|
|
21
|
-
|
|
22
|
-
- dev - Run the development server
|
|
23
|
-
- check - Run format, lint, and TypeScript type checks
|
|
24
|
-
- lint - Lint code
|
|
25
|
-
- fmt - Format code
|
|
26
|
-
- test - Run tests
|
|
27
|
-
|
|
28
|
-
### Execute
|
|
29
|
-
|
|
30
|
-
- run - Run monorepo tasks
|
|
31
|
-
- exec - Execute a command from local `node_modules/.bin`
|
|
32
|
-
- dlx - Execute a package binary without installing it as a dependency
|
|
33
|
-
- cache - Manage the task cache
|
|
34
|
-
|
|
35
|
-
### Build
|
|
36
|
-
|
|
37
|
-
- build - Build for production
|
|
38
|
-
- pack - Build libraries
|
|
39
|
-
- preview - Preview production build
|
|
40
|
-
|
|
41
|
-
### Manage Dependencies
|
|
42
|
-
|
|
43
|
-
Vite+ automatically detects and wraps the underlying package manager such as pnpm, npm, or Yarn through the `packageManager` field in `package.json` or package manager-specific lockfiles.
|
|
44
|
-
|
|
45
|
-
- add - Add packages to dependencies
|
|
46
|
-
- remove (`rm`, `un`, `uninstall`) - Remove packages from dependencies
|
|
47
|
-
- update (`up`) - Update packages to latest versions
|
|
48
|
-
- dedupe - Deduplicate dependencies
|
|
49
|
-
- outdated - Check for outdated packages
|
|
50
|
-
- list (`ls`) - List installed packages
|
|
51
|
-
- why (`explain`) - Show why a package is installed
|
|
52
|
-
- info (`view`, `show`) - View package information from the registry
|
|
53
|
-
- link (`ln`) / unlink - Manage local package links
|
|
54
|
-
- pm - Forward a command to the package manager
|
|
55
|
-
|
|
56
|
-
### Maintain
|
|
57
|
-
|
|
58
|
-
- upgrade - Update `vp` itself to the latest version
|
|
59
|
-
|
|
60
|
-
These commands map to their corresponding tools. For example, `vp dev --port 3000` runs Vite's dev server and works the same as Vite. `vp test` runs JavaScript tests through the bundled Vitest. The version of all tools can be checked using `vp --version`. This is useful when researching documentation, features, and bugs.
|
|
61
|
-
|
|
62
|
-
## Common Pitfalls
|
|
63
|
-
|
|
64
|
-
- **Using the package manager directly:** Do not use pnpm, npm, or Yarn directly. Vite+ can handle all package manager operations.
|
|
65
|
-
- **Always use Vite commands to run tools:** Don't attempt to run `vp vitest` or `vp oxlint`. They do not exist. Use `vp test` and `vp lint` instead.
|
|
66
|
-
- **Running scripts:** Vite+ built-in commands (`vp dev`, `vp build`, `vp test`, etc.) always run the Vite+ built-in tool, not any `package.json` script of the same name. To run a custom script that shares a name with a built-in command, use `vp run <script>`. For example, if you have a custom `dev` script that runs multiple services concurrently, run it with `vp run dev`, not `vp dev` (which always starts Vite's dev server).
|
|
67
|
-
- **Do not install Vitest, Oxlint, Oxfmt, or tsdown directly:** Vite+ wraps these tools. They must not be installed directly. You cannot upgrade these tools by installing their latest versions. Always use Vite+ commands.
|
|
68
|
-
- **Use Vite+ wrappers for one-off binaries:** Use `vp dlx` instead of package-manager-specific `dlx`/`npx` commands.
|
|
69
|
-
- **Import JavaScript modules from `vite-plus`:** Instead of importing from `vite` or `vitest`, all modules should be imported from the project's `vite-plus` dependency. For example, `import { defineConfig } from 'vite-plus';` or `import { expect, test, vi } from 'vite-plus/test';`. You must not install `vitest` to import test utilities.
|
|
70
|
-
- **Type-Aware Linting:** There is no need to install `oxlint-tsgolint`, `vp lint --type-aware` works out of the box.
|
|
71
|
-
|
|
72
|
-
## CI Integration
|
|
73
|
-
|
|
74
|
-
For GitHub Actions, consider using [`voidzero-dev/setup-vp`](https://github.com/voidzero-dev/setup-vp) to replace separate `actions/setup-node`, package-manager setup, cache, and install steps with a single action.
|
|
75
|
-
|
|
76
|
-
```yaml
|
|
77
|
-
- uses: voidzero-dev/setup-vp@v1
|
|
78
|
-
with:
|
|
79
|
-
cache: true
|
|
80
|
-
- run: vp check
|
|
81
|
-
- run: vp test
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Review Checklist for Agents
|
|
9
|
+
## Review Checklist
|
|
85
10
|
|
|
86
11
|
- [ ] Run `vp install` after pulling remote changes and before getting started.
|
|
87
|
-
- [ ] Run `vp check` and `vp test` to
|
|
12
|
+
- [ ] Run `vp check` and `vp test` to format, lint, type check and test changes.
|
|
13
|
+
- [ ] Check if there are `vite.config.ts` tasks or `package.json` scripts necessary for validation, run via `vp run <script>`.
|
|
14
|
+
|
|
88
15
|
<!--VITE PLUS END-->
|
package/binding/index.cjs
CHANGED
|
@@ -775,4 +775,5 @@ module.exports.rewritePrettier = nativeBinding.rewritePrettier;
|
|
|
775
775
|
module.exports.rewriteScripts = nativeBinding.rewriteScripts;
|
|
776
776
|
module.exports.run = nativeBinding.run;
|
|
777
777
|
module.exports.runCommand = nativeBinding.runCommand;
|
|
778
|
+
module.exports.shouldPrintVitePlusHeader = nativeBinding.shouldPrintVitePlusHeader;
|
|
778
779
|
module.exports.vitePlusHeader = nativeBinding.vitePlusHeader;
|
package/binding/index.d.cts
CHANGED
|
@@ -369,5 +369,13 @@ export interface RunCommandResult {
|
|
|
369
369
|
pathAccesses: Record<string, PathAccess>;
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Whether the Vite+ banner should be emitted in the current environment.
|
|
374
|
+
*
|
|
375
|
+
* Mirrors `vite_shared::header::should_print_header` so both CLIs apply
|
|
376
|
+
* the same TTY + git-hook gating without duplicating the rules in JS.
|
|
377
|
+
*/
|
|
378
|
+
export declare function shouldPrintVitePlusHeader(): boolean;
|
|
379
|
+
|
|
372
380
|
/** Render the Vite+ header using the Rust implementation. */
|
|
373
381
|
export declare function vitePlusHeader(): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "./chunk-q7NCDQ7-.js";
|
|
2
2
|
import { c as VITE_PLUS_VERSION, i as BASEURL_TSCONFIG_WARNING, l as isForceOverrideMode, o as VITE_PLUS_NAME, s as VITE_PLUS_OVERRIDE_PACKAGES } from "./main-A6UrSTYb.js";
|
|
3
3
|
import { a as require_cross_spawn, i as runCommandSilently, n as hasBaseUrlInTsconfig, r as removeDeprecatedTsconfigFalseOption, t as findTsconfigFiles } from "./tsconfig-DQTf06oN.js";
|
|
4
|
-
import { t as accent } from "./terminal-
|
|
4
|
+
import { t as accent } from "./terminal-CxTMfsxZ.js";
|
|
5
5
|
import { t as require_dist } from "./dist-Dkzst9fl.js";
|
|
6
6
|
import { c as readJsonFile, n as detectPackageMetadata, o as editJsonFile, s as isJsonFile } from "./package-D_LD1iiI.js";
|
|
7
7
|
import { n as addMigrationWarning, t as addManualStep } from "./report-DbrfjWiP.js";
|
|
@@ -4752,6 +4752,64 @@ function migrateNodeVersionManagerFile(projectPath, detection, report) {
|
|
|
4752
4752
|
} else if (detection.voltaPresent) log.info("You can now remove the \"volta\" field from package.json manually.");
|
|
4753
4753
|
return true;
|
|
4754
4754
|
}
|
|
4755
|
+
function warnPackageLevelEslint() {
|
|
4756
|
+
log.warn("ESLint detected in workspace packages but no root config found. Package-level ESLint must be migrated manually.");
|
|
4757
|
+
}
|
|
4758
|
+
function warnLegacyEslintConfig(legacyConfigFile) {
|
|
4759
|
+
log.warn(`Legacy ESLint configuration detected (${legacyConfigFile}). Automatic migration to Oxlint requires ESLint v9+ with flat config format (eslint.config.*). Please upgrade to ESLint v9 first: https://eslint.org/docs/latest/use/migrate-to-9.0.0`);
|
|
4760
|
+
}
|
|
4761
|
+
async function confirmEslintMigration(interactive) {
|
|
4762
|
+
if (interactive) {
|
|
4763
|
+
const confirmed = await confirm({
|
|
4764
|
+
message: "Migrate ESLint rules to Oxlint using @oxlint/migrate?\n " + styleText("gray", "Oxlint is Vite+'s built-in linter — significantly faster than ESLint with compatible rule support. @oxlint/migrate converts your existing rules automatically."),
|
|
4765
|
+
initialValue: true
|
|
4766
|
+
});
|
|
4767
|
+
if (q(confirmed)) cancelAndExit();
|
|
4768
|
+
return confirmed;
|
|
4769
|
+
}
|
|
4770
|
+
return true;
|
|
4771
|
+
}
|
|
4772
|
+
async function promptEslintMigration(projectPath, interactive, packages) {
|
|
4773
|
+
const eslintProject = detectEslintProject(projectPath, packages);
|
|
4774
|
+
if (eslintProject.hasDependency && !eslintProject.configFile && eslintProject.legacyConfigFile) {
|
|
4775
|
+
warnLegacyEslintConfig(eslintProject.legacyConfigFile);
|
|
4776
|
+
return false;
|
|
4777
|
+
}
|
|
4778
|
+
if (!eslintProject.hasDependency) return false;
|
|
4779
|
+
if (!eslintProject.configFile) {
|
|
4780
|
+
warnPackageLevelEslint();
|
|
4781
|
+
return false;
|
|
4782
|
+
}
|
|
4783
|
+
if (!await confirmEslintMigration(interactive)) return false;
|
|
4784
|
+
if (!await migrateEslintToOxlint(projectPath, interactive, eslintProject.configFile, packages)) cancelAndExit("ESLint migration failed.", 1);
|
|
4785
|
+
return true;
|
|
4786
|
+
}
|
|
4787
|
+
function warnPackageLevelPrettier() {
|
|
4788
|
+
log.warn("Prettier detected in workspace packages but no root config found. Package-level Prettier must be migrated manually.");
|
|
4789
|
+
}
|
|
4790
|
+
async function confirmPrettierMigration(interactive) {
|
|
4791
|
+
if (interactive) {
|
|
4792
|
+
const confirmed = await confirm({
|
|
4793
|
+
message: "Migrate Prettier to Oxfmt?\n " + styleText("gray", "Oxfmt is Vite+'s built-in formatter that replaces Prettier with faster performance. Your configuration will be converted automatically."),
|
|
4794
|
+
initialValue: true
|
|
4795
|
+
});
|
|
4796
|
+
if (q(confirmed)) cancelAndExit();
|
|
4797
|
+
return confirmed;
|
|
4798
|
+
}
|
|
4799
|
+
log.info("Prettier configuration detected. Auto-migrating to Oxfmt...");
|
|
4800
|
+
return true;
|
|
4801
|
+
}
|
|
4802
|
+
async function promptPrettierMigration(projectPath, interactive, packages) {
|
|
4803
|
+
const prettierProject = detectPrettierProject(projectPath, packages);
|
|
4804
|
+
if (!prettierProject.hasDependency) return false;
|
|
4805
|
+
if (!prettierProject.configFile) {
|
|
4806
|
+
warnPackageLevelPrettier();
|
|
4807
|
+
return false;
|
|
4808
|
+
}
|
|
4809
|
+
if (!await confirmPrettierMigration(interactive)) return false;
|
|
4810
|
+
if (!await migratePrettierToOxfmt(projectPath, interactive, prettierProject.configFile, packages)) cancelAndExit("Prettier migration failed.", 1);
|
|
4811
|
+
return true;
|
|
4812
|
+
}
|
|
4755
4813
|
//#endregion
|
|
4756
4814
|
//#region src/utils/agent.ts
|
|
4757
4815
|
const AGENTS = [
|
|
@@ -5061,4 +5119,4 @@ function getMarkedRange(content, startMarker, endMarker) {
|
|
|
5061
5119
|
};
|
|
5062
5120
|
}
|
|
5063
5121
|
//#endregion
|
|
5064
|
-
export {
|
|
5122
|
+
export { outro as $, warnLegacyEslintConfig as A, runViteInstall as B, preflightGitHooksSetup as C, rewriteMonorepoProject as D, rewriteMonorepo as E, cancelAndExit as F, DependencyType as G, upgradeYarn as H, defaultInteractive as I, cancel as J, PackageManager as K, downloadPackageManager$1 as L, warnPackageLevelPrettier as M, editYamlFile as N, rewriteStandaloneProject as O, readYamlFile as P, multiselect as Q, promptGitHooks as R, migratePrettierToOxfmt as S, promptPrettierMigration as T, displayRelative as U, selectPackageManager as V, templatesDir as W, intro as X, confirm as Y, log as Z, hasStagedConfigInViteConfig as _, writeAgentInstructions as a, migrateEslintToOxlint as b, checkVitestVersion as c, detectEslintProject as d, select as et, detectFramework as f, hasFrameworkShim as g, ensurePreCommitHook as h, updateExistingAgentInstructions as i, q as it, warnPackageLevelEslint as j, setPackageManager as k, confirmEslintMigration as l, detectPrettierProject as m, detectExistingAgentTargetPaths as n, text as nt, addFrameworkShim as o, detectNodeVersionManagerFile as p, require_semver as q, selectAgentTargetPaths as r, require_picocolors as rt, checkViteVersion as s, detectAgentConflicts as t, spinner as tt, confirmPrettierMigration as u, installGitHooks as v, promptEslintMigration as w, migrateNodeVersionManagerFile as x, mergeViteConfigFiles as y, runViteFmt as z };
|
package/dist/bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as DEFAULT_ENVS, i as BASEURL_TSCONFIG_WARNING, o as VITE_PLUS_NAME, u as resolve$1 } from "./main-A6UrSTYb.js";
|
|
2
2
|
import { i as runCommandSilently, n as hasBaseUrlInTsconfig } from "./tsconfig-DQTf06oN.js";
|
|
3
|
-
import { n as errorMsg,
|
|
3
|
+
import { n as errorMsg, r as log, s as warnMsg, t as accent } from "./terminal-CxTMfsxZ.js";
|
|
4
4
|
import { t as resolveUniversalViteConfig } from "./resolve-vite-config-B_w1u1j4.js";
|
|
5
5
|
import path, { dirname, join } from "node:path";
|
|
6
6
|
import { mergeJsonConfig, run } from "../binding/index.js";
|
|
@@ -387,7 +387,7 @@ async function vite() {
|
|
|
387
387
|
/**
|
|
388
388
|
* Unified entry point for both the local CLI (via bin/vp) and the global CLI (via Rust vp binary).
|
|
389
389
|
*
|
|
390
|
-
* Global commands (create, migrate, config,
|
|
390
|
+
* Global commands (create, migrate, config, staged, --version) are handled by tsdown-bundled modules.
|
|
391
391
|
* All other commands are delegated to the Rust core through NAPI bindings, which
|
|
392
392
|
* uses JavaScript tool resolver functions to locate tool binaries.
|
|
393
393
|
*
|
|
@@ -414,7 +414,6 @@ process.env.VP_COMMAND = command ?? "";
|
|
|
414
414
|
if (command === "create") await import("./create/bin.js");
|
|
415
415
|
else if (command === "migrate") await import("./migration/bin.js");
|
|
416
416
|
else if (command === "config") await import("./config/bin.js");
|
|
417
|
-
else if (command === "mcp") await import("./mcp/bin.js");
|
|
418
417
|
else if (command === "--version" || command === "-V") await import("./version.js");
|
|
419
418
|
else if (command === "staged") await import("./staged/bin.js");
|
|
420
419
|
else try {
|
package/dist/config/bin.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { r as log } from "../terminal-
|
|
2
|
-
import {
|
|
1
|
+
import { a as printHeader, r as log } from "../terminal-CxTMfsxZ.js";
|
|
2
|
+
import { I as defaultInteractive, R as promptGitHooks, _ as hasStagedConfigInViteConfig, h as ensurePreCommitHook, i as updateExistingAgentInstructions } from "../agent-Dz7r-vyX.js";
|
|
3
3
|
import { t as lib_default } from "../lib-BamM40b7.js";
|
|
4
4
|
import { t as renderCliDoc } from "../help-BtkjXtRM.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
|
-
import { vitePlusHeader } from "../../binding/index.js";
|
|
7
6
|
import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
8
7
|
import { spawnSync } from "node:child_process";
|
|
9
8
|
//#region src/config/hooks.ts
|
|
@@ -135,7 +134,7 @@ async function main() {
|
|
|
135
134
|
}]
|
|
136
135
|
}]
|
|
137
136
|
});
|
|
138
|
-
|
|
137
|
+
printHeader();
|
|
139
138
|
log(helpMessage);
|
|
140
139
|
return;
|
|
141
140
|
}
|
package/dist/create/bin.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "../chunk-q7NCDQ7-.js";
|
|
2
2
|
import { a as require_cross_spawn } from "../tsconfig-DQTf06oN.js";
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
3
|
+
import { a as printHeader, i as muted, o as success, r as log, t as accent } from "../terminal-CxTMfsxZ.js";
|
|
4
|
+
import { B as runViteInstall, D as rewriteMonorepoProject, E as rewriteMonorepo, G as DependencyType, I as defaultInteractive, J as cancel, K as PackageManager, L as downloadPackageManager$1, O as rewriteStandaloneProject, Q as multiselect, R as promptGitHooks, T as promptPrettierMigration, U as displayRelative, V as selectPackageManager, W as templatesDir, X as intro, Y as confirm, Z as log$1, a as writeAgentInstructions, d as detectEslintProject, et as select, f as detectFramework, g as hasFrameworkShim, it as q, k as setPackageManager, m as detectPrettierProject, n as detectExistingAgentTargetPaths, nt as text, o as addFrameworkShim, r as selectAgentTargetPaths, rt as require_picocolors, tt as spinner, v as installGitHooks, w as promptEslintMigration, z as runViteFmt } from "../agent-Dz7r-vyX.js";
|
|
5
5
|
import { t as lib_default } from "../lib-BamM40b7.js";
|
|
6
6
|
import { c as readJsonFile, o as editJsonFile, t as checkNpmPackageExists } from "../package-D_LD1iiI.js";
|
|
7
|
-
import { a as
|
|
7
|
+
import { a as detectExistingEditors, c as writeEditorConfigs, n as updatePackageJsonWithDeps, r as updateWorkspaceConfig, s as selectEditors, t as detectWorkspace$1 } from "../workspace-DE_pac71.js";
|
|
8
8
|
import { t as renderCliDoc } from "../help-BtkjXtRM.js";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { runCommand, vitePlusHeader } from "../../binding/index.js";
|
|
@@ -3915,7 +3915,7 @@ async function main() {
|
|
|
3915
3915
|
const { templateName, options, templateArgs } = parseArgs();
|
|
3916
3916
|
let compactOutput = !options.verbose;
|
|
3917
3917
|
if (options.help) {
|
|
3918
|
-
|
|
3918
|
+
printHeader();
|
|
3919
3919
|
log(helpMessage);
|
|
3920
3920
|
return;
|
|
3921
3921
|
}
|
|
@@ -3960,7 +3960,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
3960
3960
|
let selectedTemplateName = templateName;
|
|
3961
3961
|
let selectedTemplateArgs = [...templateArgs];
|
|
3962
3962
|
let selectedAgentTargetPaths;
|
|
3963
|
-
let
|
|
3963
|
+
let selectedEditors;
|
|
3964
3964
|
let selectedParentDir;
|
|
3965
3965
|
let remoteTargetDir;
|
|
3966
3966
|
let shouldSetupHooks = false;
|
|
@@ -4078,7 +4078,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4078
4078
|
agent: options.agent,
|
|
4079
4079
|
onCancel: () => cancelAndExit()
|
|
4080
4080
|
});
|
|
4081
|
-
|
|
4081
|
+
selectedEditors = (options.editor || !options.interactive ? void 0 : detectExistingEditors(workspaceInfoOptional.rootDir)) ?? await selectEditors({
|
|
4082
4082
|
interactive: options.interactive,
|
|
4083
4083
|
editor: options.editor,
|
|
4084
4084
|
onCancel: () => cancelAndExit()
|
|
@@ -4158,7 +4158,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4158
4158
|
pauseCreateProgress();
|
|
4159
4159
|
await writeEditorConfigs({
|
|
4160
4160
|
projectRoot: fullPath,
|
|
4161
|
-
editorId:
|
|
4161
|
+
editorId: selectedEditors,
|
|
4162
4162
|
interactive: options.interactive,
|
|
4163
4163
|
silent: compactOutput,
|
|
4164
4164
|
extraVsCodeSettings: { "npm.scriptRunner": "vp" }
|
|
@@ -4230,18 +4230,31 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4230
4230
|
pauseCreateProgress();
|
|
4231
4231
|
await writeEditorConfigs({
|
|
4232
4232
|
projectRoot: fullPath,
|
|
4233
|
-
editorId:
|
|
4233
|
+
editorId: selectedEditors,
|
|
4234
4234
|
interactive: options.interactive,
|
|
4235
4235
|
silent: compactOutput,
|
|
4236
4236
|
extraVsCodeSettings: { "npm.scriptRunner": "vp" }
|
|
4237
4237
|
});
|
|
4238
4238
|
resumeCreateProgress();
|
|
4239
|
+
const shouldMigrateLintFmtTools = detectEslintProject(fullPath).hasDependency || detectPrettierProject(fullPath).hasDependency;
|
|
4239
4240
|
let installSummary;
|
|
4241
|
+
const installAndMigrate = async (installCwd) => {
|
|
4242
|
+
setPackageManager(fullPath, workspaceInfo.downloadPackageManager);
|
|
4243
|
+
if (workspaceInfo.packageManager === PackageManager.yarn) {
|
|
4244
|
+
const yarnrcPath = path.join(fullPath, ".yarnrc.yml");
|
|
4245
|
+
if (!fs.existsSync(yarnrcPath)) fs.writeFileSync(yarnrcPath, "nodeLinker: node-modules\n");
|
|
4246
|
+
}
|
|
4247
|
+
updateCreateProgress("Installing dependencies");
|
|
4248
|
+
installSummary = await runViteInstall(installCwd, options.interactive, installArgs, { silent: compactOutput });
|
|
4249
|
+
if (installSummary.status !== "installed") return;
|
|
4250
|
+
updateCreateProgress("Migrating lint and format tools");
|
|
4251
|
+
pauseCreateProgress();
|
|
4252
|
+
await promptEslintMigration(fullPath, false);
|
|
4253
|
+
await promptPrettierMigration(fullPath, false);
|
|
4254
|
+
resumeCreateProgress();
|
|
4255
|
+
};
|
|
4240
4256
|
if (isMonorepo) {
|
|
4241
4257
|
if (!compactOutput) log$1.step("Monorepo integration...");
|
|
4242
|
-
updateCreateProgress("Integrating into monorepo");
|
|
4243
|
-
rewriteMonorepoProject(fullPath, workspaceInfo.packageManager, void 0, compactOutput);
|
|
4244
|
-
for (const framework of detectFramework(fullPath)) if (!hasFrameworkShim(fullPath, framework)) addFrameworkShim(fullPath, framework);
|
|
4245
4258
|
if (workspaceInfo.packages.length > 0) {
|
|
4246
4259
|
if (options.interactive) {
|
|
4247
4260
|
pauseCreateProgress();
|
|
@@ -4274,11 +4287,16 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4274
4287
|
}
|
|
4275
4288
|
}
|
|
4276
4289
|
updateWorkspaceConfig(projectDir, workspaceInfo);
|
|
4290
|
+
if (shouldMigrateLintFmtTools) await installAndMigrate(workspaceInfo.rootDir);
|
|
4291
|
+
updateCreateProgress("Integrating into monorepo");
|
|
4292
|
+
rewriteMonorepoProject(fullPath, workspaceInfo.packageManager, void 0, compactOutput);
|
|
4293
|
+
for (const framework of detectFramework(fullPath)) if (!hasFrameworkShim(fullPath, framework)) addFrameworkShim(fullPath, framework);
|
|
4277
4294
|
updateCreateProgress("Installing dependencies");
|
|
4278
4295
|
installSummary = await runViteInstall(workspaceInfo.rootDir, options.interactive, installArgs, { silent: compactOutput });
|
|
4279
4296
|
updateCreateProgress("Formatting code");
|
|
4280
4297
|
await runViteFmt(workspaceInfo.rootDir, options.interactive, [projectDir], { silent: compactOutput });
|
|
4281
4298
|
} else {
|
|
4299
|
+
if (shouldMigrateLintFmtTools) await installAndMigrate(fullPath);
|
|
4282
4300
|
updateCreateProgress("Applying Vite+ project setup");
|
|
4283
4301
|
rewriteStandaloneProject(fullPath, workspaceInfo, void 0, compactOutput);
|
|
4284
4302
|
for (const framework of detectFramework(fullPath)) if (!hasFrameworkShim(fullPath, framework)) addFrameworkShim(fullPath, framework);
|
|
@@ -4299,7 +4317,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4299
4317
|
});
|
|
4300
4318
|
}
|
|
4301
4319
|
async function showAvailableTemplates() {
|
|
4302
|
-
|
|
4320
|
+
printHeader();
|
|
4303
4321
|
log(listTemplatesMessage);
|
|
4304
4322
|
}
|
|
4305
4323
|
main().catch((err) => {
|
package/dist/migration/bin.js
CHANGED
|
@@ -1,75 +1,16 @@
|
|
|
1
1
|
import { r as __toESM } from "../chunk-q7NCDQ7-.js";
|
|
2
2
|
import { l as isForceOverrideMode } from "../main-A6UrSTYb.js";
|
|
3
|
-
import { i as muted, r as log, t as accent } from "../terminal-
|
|
4
|
-
import { A as
|
|
3
|
+
import { a as printHeader, i as muted, r as log, t as accent } from "../terminal-CxTMfsxZ.js";
|
|
4
|
+
import { $ as outro, A as warnLegacyEslintConfig, B as runViteInstall, C as preflightGitHooksSetup, E as rewriteMonorepo, F as cancelAndExit, H as upgradeYarn, I as defaultInteractive, K as PackageManager, L as downloadPackageManager, M as warnPackageLevelPrettier, O as rewriteStandaloneProject, R as promptGitHooks, S as migratePrettierToOxfmt, T as promptPrettierMigration, U as displayRelative, V as selectPackageManager, Y as confirm, Z as log$1, a as writeAgentInstructions, b as migrateEslintToOxlint, c as checkVitestVersion, d as detectEslintProject, et as select, f as detectFramework, g as hasFrameworkShim, it as q, j as warnPackageLevelEslint, l as confirmEslintMigration, m as detectPrettierProject, n as detectExistingAgentTargetPaths, o as addFrameworkShim, p as detectNodeVersionManagerFile, q as require_semver, r as selectAgentTargetPaths, s as checkViteVersion, t as detectAgentConflicts, tt as spinner, u as confirmPrettierMigration, v as installGitHooks, w as promptEslintMigration, x as migrateNodeVersionManagerFile, y as mergeViteConfigFiles } from "../agent-Dz7r-vyX.js";
|
|
5
5
|
import { t as lib_default } from "../lib-BamM40b7.js";
|
|
6
6
|
import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-D_LD1iiI.js";
|
|
7
7
|
import { r as createMigrationReport } from "../report-DbrfjWiP.js";
|
|
8
|
-
import {
|
|
8
|
+
import { c as writeEditorConfigs, i as detectEditorConflicts, o as selectEditor, t as detectWorkspace } from "../workspace-DE_pac71.js";
|
|
9
9
|
import { t as renderCliDoc } from "../help-BtkjXtRM.js";
|
|
10
10
|
import path from "node:path";
|
|
11
|
-
import { vitePlusHeader } from "../../binding/index.js";
|
|
12
11
|
import { styleText } from "node:util";
|
|
13
12
|
//#region src/migration/bin.ts
|
|
14
13
|
var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
|
|
15
|
-
function warnPackageLevelEslint() {
|
|
16
|
-
log$1.warn("ESLint detected in workspace packages but no root config found. Package-level ESLint must be migrated manually.");
|
|
17
|
-
}
|
|
18
|
-
function warnLegacyEslintConfig(legacyConfigFile) {
|
|
19
|
-
log$1.warn(`Legacy ESLint configuration detected (${legacyConfigFile}). Automatic migration to Oxlint requires ESLint v9+ with flat config format (eslint.config.*). Please upgrade to ESLint v9 first: https://eslint.org/docs/latest/use/migrate-to-9.0.0`);
|
|
20
|
-
}
|
|
21
|
-
async function confirmEslintMigration(interactive) {
|
|
22
|
-
if (interactive) {
|
|
23
|
-
const confirmed = await confirm({
|
|
24
|
-
message: "Migrate ESLint rules to Oxlint using @oxlint/migrate?\n " + styleText("gray", "Oxlint is Vite+'s built-in linter — significantly faster than ESLint with compatible rule support. @oxlint/migrate converts your existing rules automatically."),
|
|
25
|
-
initialValue: true
|
|
26
|
-
});
|
|
27
|
-
if (q(confirmed)) cancelAndExit();
|
|
28
|
-
return confirmed;
|
|
29
|
-
}
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
async function promptEslintMigration(projectPath, interactive, packages) {
|
|
33
|
-
const eslintProject = detectEslintProject(projectPath, packages);
|
|
34
|
-
if (eslintProject.hasDependency && !eslintProject.configFile && eslintProject.legacyConfigFile) {
|
|
35
|
-
warnLegacyEslintConfig(eslintProject.legacyConfigFile);
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
if (!eslintProject.hasDependency) return false;
|
|
39
|
-
if (!eslintProject.configFile) {
|
|
40
|
-
warnPackageLevelEslint();
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
if (!await confirmEslintMigration(interactive)) return false;
|
|
44
|
-
if (!await migrateEslintToOxlint(projectPath, interactive, eslintProject.configFile, packages)) cancelAndExit("ESLint migration failed. Fix the issue and re-run `vp migrate`.", 1);
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
function warnPackageLevelPrettier() {
|
|
48
|
-
log$1.warn("Prettier detected in workspace packages but no root config found. Package-level Prettier must be migrated manually.");
|
|
49
|
-
}
|
|
50
|
-
async function confirmPrettierMigration(interactive) {
|
|
51
|
-
if (interactive) {
|
|
52
|
-
const confirmed = await confirm({
|
|
53
|
-
message: "Migrate Prettier to Oxfmt?\n " + styleText("gray", "Oxfmt is Vite+'s built-in formatter that replaces Prettier with faster performance. Your configuration will be converted automatically."),
|
|
54
|
-
initialValue: true
|
|
55
|
-
});
|
|
56
|
-
if (q(confirmed)) cancelAndExit();
|
|
57
|
-
return confirmed;
|
|
58
|
-
}
|
|
59
|
-
log$1.info("Prettier configuration detected. Auto-migrating to Oxfmt...");
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
async function promptPrettierMigration(projectPath, interactive, packages) {
|
|
63
|
-
const prettierProject = detectPrettierProject(projectPath, packages);
|
|
64
|
-
if (!prettierProject.hasDependency) return false;
|
|
65
|
-
if (!prettierProject.configFile) {
|
|
66
|
-
warnPackageLevelPrettier();
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
if (!await confirmPrettierMigration(interactive)) return false;
|
|
70
|
-
if (!await migratePrettierToOxfmt(projectPath, interactive, prettierProject.configFile, packages)) cancelAndExit("Prettier migration failed. Fix the issue and re-run `vp migrate`.", 1);
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
14
|
async function confirmNodeVersionFileMigration(interactive, detection) {
|
|
74
15
|
const message = {
|
|
75
16
|
"package.json": "Migrate Volta node version (package.json) to .node-version?",
|
|
@@ -401,7 +342,7 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive) {
|
|
|
401
342
|
}
|
|
402
343
|
};
|
|
403
344
|
updateMigrationProgress("Preparing migration");
|
|
404
|
-
const downloadResult = await downloadPackageManager
|
|
345
|
+
const downloadResult = await downloadPackageManager(plan.packageManager, workspaceInfoOptional.packageManagerVersion, interactive, true);
|
|
405
346
|
const workspaceInfo = {
|
|
406
347
|
...workspaceInfoOptional,
|
|
407
348
|
packageManager: plan.packageManager,
|
|
@@ -502,12 +443,12 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive) {
|
|
|
502
443
|
async function main() {
|
|
503
444
|
const { projectPath, options } = parseArgs();
|
|
504
445
|
if (options.help) {
|
|
505
|
-
|
|
446
|
+
printHeader();
|
|
506
447
|
log(helpMessage);
|
|
507
448
|
return;
|
|
508
449
|
}
|
|
509
|
-
|
|
510
|
-
const workspaceInfoOptional = await detectWorkspace
|
|
450
|
+
printHeader();
|
|
451
|
+
const workspaceInfoOptional = await detectWorkspace(projectPath);
|
|
511
452
|
const resolvedPackageManager = workspaceInfoOptional.packageManager ?? "unknown";
|
|
512
453
|
const rootPkg = readNearestPackageJson(workspaceInfoOptional.rootDir);
|
|
513
454
|
if (hasVitePlusDependency(rootPkg) && !isForceOverrideMode()) {
|
package/dist/staged/bin.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "../chunk-q7NCDQ7-.js";
|
|
2
|
-
import { n as errorMsg, r as log } from "../terminal-
|
|
2
|
+
import { a as printHeader, n as errorMsg, r as log } from "../terminal-CxTMfsxZ.js";
|
|
3
3
|
import { n as resolveViteConfig } from "../resolve-vite-config-B_w1u1j4.js";
|
|
4
4
|
import { t as lib_default } from "../lib-BamM40b7.js";
|
|
5
5
|
import { t as renderCliDoc } from "../help-BtkjXtRM.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import path, { delimiter, dirname, normalize, resolve } from "node:path";
|
|
8
|
-
import { vitePlusHeader } from "../../binding/index.js";
|
|
9
8
|
import { constants } from "node:fs";
|
|
10
9
|
import { formatWithOptions, inspect, promisify } from "node:util";
|
|
11
10
|
import { pathToFileURL } from "node:url";
|
|
@@ -6969,7 +6968,7 @@ if (args.help) {
|
|
|
6969
6968
|
]
|
|
6970
6969
|
}]
|
|
6971
6970
|
});
|
|
6972
|
-
|
|
6971
|
+
printHeader();
|
|
6973
6972
|
log(helpMessage);
|
|
6974
6973
|
} else {
|
|
6975
6974
|
const options = {};
|
|
@@ -6993,7 +6992,7 @@ if (args.help) {
|
|
|
6993
6992
|
}
|
|
6994
6993
|
if (stagedConfig) options.config = stagedConfig;
|
|
6995
6994
|
else {
|
|
6996
|
-
|
|
6995
|
+
printHeader();
|
|
6997
6996
|
errorMsg("No \"staged\" config found in vite.config.ts. Please add a staged config:");
|
|
6998
6997
|
log("");
|
|
6999
6998
|
log(" // vite.config.ts");
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
import { shouldPrintVitePlusHeader, vitePlusHeader } from "../binding/index.js";
|
|
1
2
|
import { styleText } from "node:util";
|
|
2
3
|
//#region src/utils/terminal.ts
|
|
3
4
|
function log(message) {
|
|
4
5
|
console.log(message);
|
|
5
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Emit the Vite+ banner (header line + trailing blank line) to stdout.
|
|
9
|
+
* Gating (non-TTY, git hooks) lives in `shouldPrintVitePlusHeader` on the
|
|
10
|
+
* Rust side so both CLIs stay in sync.
|
|
11
|
+
*/
|
|
12
|
+
function printHeader() {
|
|
13
|
+
if (!shouldPrintVitePlusHeader()) return;
|
|
14
|
+
log(vitePlusHeader());
|
|
15
|
+
log("");
|
|
16
|
+
}
|
|
6
17
|
function accent(text) {
|
|
7
18
|
return styleText("blue", text);
|
|
8
19
|
}
|
|
@@ -19,4 +30,4 @@ function errorMsg(msg) {
|
|
|
19
30
|
console.error(styleText(["red", "bold"], "error:"), msg);
|
|
20
31
|
}
|
|
21
32
|
//#endregion
|
|
22
|
-
export {
|
|
33
|
+
export { printHeader as a, muted as i, errorMsg as n, success as o, log as r, warnMsg as s, accent as t };
|
package/dist/version.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import "./main-A6UrSTYb.js";
|
|
2
|
-
import { r as log, t as accent } from "./terminal-
|
|
2
|
+
import { a as printHeader, r as log, t as accent } from "./terminal-CxTMfsxZ.js";
|
|
3
3
|
import { i as hasVitePlusDependency, n as detectPackageMetadata } from "./package-D_LD1iiI.js";
|
|
4
4
|
import { t as renderCliDoc } from "./help-BtkjXtRM.js";
|
|
5
5
|
import path from "node:path";
|
|
6
|
-
import { vitePlusHeader } from "../binding/index.js";
|
|
7
6
|
import fs from "node:fs";
|
|
8
7
|
//#region package.json
|
|
9
8
|
var version = "0.0.0";
|
|
@@ -62,8 +61,7 @@ async function printVersion(cwd) {
|
|
|
62
61
|
const localMetadata = getLocalMetadata(cwd);
|
|
63
62
|
const localVersion = localMetadata?.version ?? null;
|
|
64
63
|
const vpVersion = globalVersion ?? cliVersion ?? localVersion ?? "unknown";
|
|
65
|
-
|
|
66
|
-
log("");
|
|
64
|
+
printHeader();
|
|
67
65
|
log(`vp v${vpVersion}\n`);
|
|
68
66
|
const sections = [{
|
|
69
67
|
title: "Local vite-plus",
|
package/dist/versions.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export const versions = {
|
|
2
|
-
"vite": "8.0.
|
|
2
|
+
"vite": "8.0.9",
|
|
3
3
|
"rolldown": "1.0.0-rc.16",
|
|
4
4
|
"tsdown": "0.21.9",
|
|
5
|
-
"vitest": "4.1.
|
|
6
|
-
"oxlint": "1.
|
|
7
|
-
"oxfmt": "0.
|
|
5
|
+
"vitest": "4.1.5",
|
|
6
|
+
"oxlint": "1.61.0",
|
|
7
|
+
"oxfmt": "0.46.0",
|
|
8
8
|
"oxlint-tsgolint": "0.21.1"
|
|
9
9
|
};
|