vite-plus 0.2.7 → 0.2.9
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 +7 -0
- package/LICENSE +5 -1
- package/README.md +9 -3
- package/bin/vpr +3 -2
- package/binding/index.cjs +193 -80
- package/binding/index.d.cts +106 -11
- package/dist/agent-DQU8uS6P.js +416 -0
- package/dist/bin.js +1388 -23
- package/dist/{cli-truncate-BVOlIIPy.js → cli-truncate-Bg3RDXpi.js} +0 -2
- package/dist/client/bundledDevClient.mjs +1 -0
- package/dist/config/bin.js +32 -133
- package/dist/{constants-BsuzPowC.js → constants-CG513DRa.js} +10 -2
- package/dist/create/bin.js +255 -268
- package/dist/{define-config-C2KfLHpC.js → define-config-CV4bQG_8.js} +3 -3
- package/dist/{define-config-eLQH9us2.d.ts → define-config-DWoAkNdp.d.ts} +16 -0
- package/dist/{define-config-DLh9fE95.cjs → define-config-DyNLA_f0.cjs} +1 -1
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/define-config.js +1 -1
- package/dist/{dist-CKz3vcoG.js → dist-BDYZP12R.js} +196 -157
- package/dist/dist-Dqv1-Clg.js +3 -0
- package/dist/{agent-CPwWJ4qf.js → editor-g4PosU99.js} +819 -628
- package/dist/hooks/bin.d.ts +1 -0
- package/dist/hooks/bin.js +130 -0
- package/dist/hooks-pNCBWtFT.js +570 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-DiRs8ceZ.js → json-qlK6UH0r.js} +40 -38
- package/dist/migration/bin.js +65 -58
- package/dist/{oxlint-plugin-config-Bxgc4cwF.js → oxlint-plugin-config-BEZ9IUf7.js} +1 -1
- package/dist/oxlint-plugin.js +1 -1
- package/dist/pack-bin.js +1 -1
- package/dist/{package-Ds3uThLb.js → package-B4T8RGMG.js} +2 -2
- package/dist/{tsconfig-Jia2vgMG.js → prompts-CHz_98bJ.js} +169 -219
- package/dist/{resolve-vite-config-BiuLZnn8.js → resolve-vite-config-Dmeyeyj-.js} +2 -9
- package/dist/{rolldown-runtime-C7HZzL1F.js → rolldown-runtime-CMFfr-1z.js} +1 -1
- package/dist/staged/bin.js +241 -226
- package/dist/terminal-Bz-ps6rJ.js +128 -0
- package/dist/test/browser/providers/playwright/context.d.ts +1 -1
- package/dist/test/browser/providers/playwright.d.ts +6 -6
- package/dist/test/browser/providers/preview/context.d.ts +1 -1
- package/dist/test/browser/providers/preview.d.ts +4 -4
- package/dist/test/browser/providers/webdriverio/context.d.ts +1 -1
- package/dist/test/browser/providers/webdriverio.d.ts +6 -6
- package/dist/test/browser-playwright/context.d.ts +1 -1
- package/dist/test/browser-playwright.d.ts +6 -6
- package/dist/test/browser-preview/context.d.ts +1 -1
- package/dist/test/browser-preview.d.ts +4 -4
- package/dist/test/browser-webdriverio/context.d.ts +1 -1
- package/dist/test/browser-webdriverio.d.ts +6 -6
- package/dist/test/context.d.ts +3 -3
- package/dist/test/locators.d.ts +1 -1
- package/dist/toolchain.d.ts +25 -0
- package/dist/toolchain.js +194 -0
- package/dist/toolchain.json +193 -0
- package/dist/tsconfig-7v_BHagU.js +151 -0
- package/dist/{tsgolint-path-B-yOos8p.js → tsgolint-path-CbDReEOx.js} +5 -3
- package/dist/tsgolint-path.js +1 -1
- package/dist/version.js +6 -6
- package/dist/versions.d.ts +3 -3
- package/dist/versions.js +6 -6
- package/docs/config/index.md +13 -0
- package/docs/config/staged.md +2 -1
- package/docs/guide/ci.md +37 -4
- package/docs/guide/commit-hooks.md +112 -21
- package/docs/guide/create.md +7 -4
- package/docs/guide/env.md +8 -4
- package/docs/guide/fmt.md +2 -2
- package/docs/guide/github-actions-cache.md +5 -1
- package/docs/guide/ide-integration.md +61 -2
- package/docs/guide/index.md +4 -2
- package/docs/guide/install.md +27 -0
- package/docs/guide/installer-env-vars.md +14 -3
- package/docs/guide/lint.md +3 -1
- package/docs/guide/migrate.md +49 -4
- package/docs/guide/monorepo.md +98 -10
- package/docs/guide/troubleshooting.md +12 -3
- package/docs/guide/upgrade.md +27 -4
- package/docs/package.json +1 -1
- package/docs/pnpm-workspace.yaml +7 -0
- package/docs/vite.config.ts +3 -0
- package/package.json +21 -23
- package/rules/vite-tools.yml +0 -7
- package/dist/dist-CtM2JRbM.js +0 -3
- package/dist/editor-BbT1lTNc.js +0 -675
- package/dist/help-YP84FSEz.js +0 -61
- package/dist/terminal-uTv0ZaMr.js +0 -33
- package/dist/{log-update-DHZRyJ2m.js → log-update-CoW8Z4Dl.js} +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@voidzero-dev/vite-plus-core/dist/client/bundledDevClient.mjs';
|
package/dist/config/bin.js
CHANGED
|
@@ -1,123 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { i as log, l as renderCliDoc, o as printHeader } from "../terminal-Bz-ps6rJ.js";
|
|
2
|
+
import { i as promptGitHooks, n as defaultInteractive } from "../prompts-CHz_98bJ.js";
|
|
3
3
|
import { t as lib_default } from "../lib-L3DWSRQp.js";
|
|
4
|
-
import { o as updateExistingAgentInstructions
|
|
5
|
-
import {
|
|
4
|
+
import { o as updateExistingAgentInstructions } from "../agent-DQU8uS6P.js";
|
|
5
|
+
import { c as resolveHooksLocation, o as install, s as isHooksUserDisabled } from "../hooks-pNCBWtFT.js";
|
|
6
6
|
import { join } from "node:path";
|
|
7
|
-
import { existsSync
|
|
8
|
-
import { spawnSync } from "node:child_process";
|
|
9
|
-
//#region src/config/hooks.ts
|
|
10
|
-
const HOOKS = [
|
|
11
|
-
"pre-commit",
|
|
12
|
-
"pre-merge-commit",
|
|
13
|
-
"prepare-commit-msg",
|
|
14
|
-
"commit-msg",
|
|
15
|
-
"post-commit",
|
|
16
|
-
"applypatch-msg",
|
|
17
|
-
"pre-applypatch",
|
|
18
|
-
"post-applypatch",
|
|
19
|
-
"pre-rebase",
|
|
20
|
-
"post-rewrite",
|
|
21
|
-
"post-checkout",
|
|
22
|
-
"post-merge",
|
|
23
|
-
"pre-push",
|
|
24
|
-
"pre-auto-gc"
|
|
25
|
-
];
|
|
26
|
-
function nestedDirname(depth) {
|
|
27
|
-
let expr = "\"$0\"";
|
|
28
|
-
for (let i = 0; i < depth; i++) expr = `"$(dirname ${expr})"`;
|
|
29
|
-
return expr;
|
|
30
|
-
}
|
|
31
|
-
function hookScript(dir) {
|
|
32
|
-
return `#!/usr/bin/env sh
|
|
33
|
-
{ [ "$HUSKY" = "2" ] || [ "$VITE_GIT_HOOKS" = "2" ]; } && set -x
|
|
34
|
-
n=$(basename "$0")
|
|
35
|
-
s=$(dirname "$(dirname "$0")")/$n
|
|
36
|
-
|
|
37
|
-
[ ! -f "$s" ] && exit 0
|
|
38
|
-
|
|
39
|
-
i="\${XDG_CONFIG_HOME:-$HOME/.config}/vite-plus/hooks-init.sh"
|
|
40
|
-
[ ! -f "$i" ] && i="\${XDG_CONFIG_HOME:-$HOME/.config}/husky/init.sh"
|
|
41
|
-
[ -f "$i" ] && . "$i"
|
|
42
|
-
|
|
43
|
-
{ [ "\${HUSKY-}" = "0" ] || [ "\${VITE_GIT_HOOKS-}" = "0" ]; } && exit 0
|
|
44
|
-
|
|
45
|
-
d=${nestedDirname(dir.split("/").filter((s) => s !== "" && s !== ".").length + 2)}
|
|
46
|
-
__vp_shell=/bin/sh
|
|
47
|
-
[ -x "$__vp_shell" ] || __vp_shell=$(command -v sh)
|
|
48
|
-
|
|
49
|
-
if [ -n "\${VP_HOME-}" ]; then
|
|
50
|
-
__vp_bin="$VP_HOME/bin"
|
|
51
|
-
elif [ -n "\${HOME-}" ]; then
|
|
52
|
-
__vp_bin="$HOME/.vite-plus/bin"
|
|
53
|
-
else
|
|
54
|
-
__vp_bin=""
|
|
55
|
-
fi
|
|
56
|
-
[ -n "$__vp_bin" ] && [ -d "$__vp_bin" ] && export PATH="$PATH:$__vp_bin"
|
|
57
|
-
|
|
58
|
-
export PATH="$d/node_modules/.bin:$PATH"
|
|
59
|
-
"$__vp_shell" -e "$s" "$@"
|
|
60
|
-
c=$?
|
|
61
|
-
|
|
62
|
-
[ $c != 0 ] && echo "VITE+ - $n script failed (code $c)"
|
|
63
|
-
[ $c = 127 ] && echo "VITE+ - command not found in PATH=$PATH"
|
|
64
|
-
exit $c`;
|
|
65
|
-
}
|
|
66
|
-
function install(dir = ".vite-hooks") {
|
|
67
|
-
if (process.env.HUSKY === "0" || process.env.VITE_GIT_HOOKS === "0") return {
|
|
68
|
-
message: "skip install (git hooks disabled)",
|
|
69
|
-
isError: false
|
|
70
|
-
};
|
|
71
|
-
if (dir.includes("..")) return {
|
|
72
|
-
message: ".. not allowed",
|
|
73
|
-
isError: false
|
|
74
|
-
};
|
|
75
|
-
const prefixResult = spawnSync("git", ["rev-parse", "--show-prefix"]);
|
|
76
|
-
if (prefixResult.status == null) return {
|
|
77
|
-
message: "git command not found",
|
|
78
|
-
isError: true
|
|
79
|
-
};
|
|
80
|
-
if (prefixResult.status !== 0) return {
|
|
81
|
-
message: ".git can't be found",
|
|
82
|
-
isError: false
|
|
83
|
-
};
|
|
84
|
-
const internal = (x = "") => join(dir, "_", x);
|
|
85
|
-
const rel = prefixResult.stdout.toString().trim().replace(/\/$/, "");
|
|
86
|
-
const target = rel ? `${rel}/${dir}/_` : `${dir}/_`;
|
|
87
|
-
const checkResult = spawnSync("git", [
|
|
88
|
-
"config",
|
|
89
|
-
"--local",
|
|
90
|
-
"core.hooksPath"
|
|
91
|
-
]);
|
|
92
|
-
const existingHooksPath = checkResult.status === 0 ? checkResult.stdout?.toString().trim() : "";
|
|
93
|
-
if (existingHooksPath && existingHooksPath !== target && existingHooksPath !== ".husky" && !existingHooksPath.startsWith(".husky/")) return {
|
|
94
|
-
message: `core.hooksPath is already set to "${existingHooksPath}", skipping`,
|
|
95
|
-
isError: false
|
|
96
|
-
};
|
|
97
|
-
const { status, stderr } = spawnSync("git", [
|
|
98
|
-
"config",
|
|
99
|
-
"core.hooksPath",
|
|
100
|
-
target
|
|
101
|
-
]);
|
|
102
|
-
if (status == null) return {
|
|
103
|
-
message: "git command not found",
|
|
104
|
-
isError: true
|
|
105
|
-
};
|
|
106
|
-
if (status) return {
|
|
107
|
-
message: "" + stderr,
|
|
108
|
-
isError: true
|
|
109
|
-
};
|
|
110
|
-
rmSync(internal("husky.sh"), { force: true });
|
|
111
|
-
mkdirSync(internal(), { recursive: true });
|
|
112
|
-
writeFileSync(internal(".gitignore"), "*");
|
|
113
|
-
writeFileSync(internal("h"), hookScript(dir), { mode: 493 });
|
|
114
|
-
for (const hook of HOOKS) writeFileSync(internal(hook), `#!/usr/bin/env sh\n. "$(dirname "$0")/h"`, { mode: 493 });
|
|
115
|
-
return {
|
|
116
|
-
message: "",
|
|
117
|
-
isError: false
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
//#endregion
|
|
7
|
+
import { existsSync } from "node:fs";
|
|
121
8
|
//#region src/config/bin.ts
|
|
122
9
|
async function main() {
|
|
123
10
|
const args = lib_default(process.argv.slice(3), {
|
|
@@ -132,18 +19,18 @@ async function main() {
|
|
|
132
19
|
if (args.help) {
|
|
133
20
|
const helpMessage = renderCliDoc({
|
|
134
21
|
usage: "vp config [OPTIONS]",
|
|
135
|
-
summary: "Configure Vite+ for the current project (
|
|
22
|
+
summary: "Configure Vite+ for the current project (hook dispatcher + agent integration).",
|
|
136
23
|
documentationUrl: "https://viteplus.dev/guide/commit-hooks",
|
|
137
24
|
sections: [{
|
|
138
25
|
title: "Options",
|
|
139
26
|
rows: [
|
|
140
27
|
{
|
|
141
28
|
label: "--hooks-dir <path>",
|
|
142
|
-
description: "Custom hooks directory (default: .vite-hooks)"
|
|
29
|
+
description: "Custom hooks directory (default: .vite-hooks, or last used in this clone)"
|
|
143
30
|
},
|
|
144
31
|
{
|
|
145
32
|
label: "--no-hooks",
|
|
146
|
-
description: "Skip hook installation"
|
|
33
|
+
description: "Skip hook dispatcher installation"
|
|
147
34
|
},
|
|
148
35
|
{
|
|
149
36
|
label: "--no-agent",
|
|
@@ -157,8 +44,8 @@ async function main() {
|
|
|
157
44
|
}, {
|
|
158
45
|
title: "Environment",
|
|
159
46
|
rows: [{
|
|
160
|
-
label: "
|
|
161
|
-
description: "Skip hook installation"
|
|
47
|
+
label: "VP_GIT_HOOKS=0",
|
|
48
|
+
description: "Skip hook dispatcher installation"
|
|
162
49
|
}]
|
|
163
50
|
}]
|
|
164
51
|
});
|
|
@@ -173,17 +60,29 @@ async function main() {
|
|
|
173
60
|
const lifecycleEvent = process.env.npm_lifecycle_event;
|
|
174
61
|
const isLifecycleScript = lifecycleEvent === "prepare" || lifecycleEvent === "postinstall";
|
|
175
62
|
const root = process.cwd();
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
if (
|
|
63
|
+
if (!skipHooks) {
|
|
64
|
+
const location = resolveHooksLocation(dir);
|
|
65
|
+
if ("isError" in location) {
|
|
66
|
+
if (location.message) log(location.message);
|
|
67
|
+
if (location.isError) process.exit(1);
|
|
68
|
+
} else {
|
|
69
|
+
const isFirstHooksRun = !existsSync(join(location.baseDir, location.dir, "_", "pre-commit"));
|
|
70
|
+
let shouldSetupHooks = true;
|
|
71
|
+
if (isHooksUserDisabled()) {
|
|
72
|
+
log("skip install (hooks disabled; run `vp hooks enable` to re-enable)");
|
|
73
|
+
shouldSetupHooks = false;
|
|
74
|
+
} else if (interactive && isFirstHooksRun && !dir && !isLifecycleScript) shouldSetupHooks = await promptGitHooks({
|
|
75
|
+
interactive,
|
|
76
|
+
message: "Install the Git hook dispatcher for this project?"
|
|
77
|
+
});
|
|
78
|
+
if (shouldSetupHooks) {
|
|
79
|
+
const { message, isError } = install(dir);
|
|
80
|
+
if (message) {
|
|
81
|
+
log(message);
|
|
82
|
+
if (isError) process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
185
85
|
}
|
|
186
|
-
if (!message) ensurePreCommitHook(root, hooksDir);
|
|
187
86
|
}
|
|
188
87
|
if (!skipAgent) updateExistingAgentInstructions(root);
|
|
189
88
|
}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
//#region package.json
|
|
3
|
-
var version = "0.2.
|
|
3
|
+
var version = "0.2.9";
|
|
4
4
|
//#endregion
|
|
5
5
|
//#region src/utils/constants.ts
|
|
6
6
|
const VITE_PLUS_NAME = "vite-plus";
|
|
7
7
|
const VITE_PLUS_VERSION = process.env.VP_VERSION || version;
|
|
8
|
+
const VITE_CONFIG_FILES = [
|
|
9
|
+
"vite.config.js",
|
|
10
|
+
"vite.config.mjs",
|
|
11
|
+
"vite.config.ts",
|
|
12
|
+
"vite.config.cjs",
|
|
13
|
+
"vite.config.mts",
|
|
14
|
+
"vite.config.cts"
|
|
15
|
+
];
|
|
8
16
|
const VITEST_VERSION = "4.1.10";
|
|
9
17
|
const VITE_PLUS_OVERRIDE_PACKAGES = process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : {
|
|
10
18
|
vite: `npm:@voidzero-dev/vite-plus-core@${VITE_PLUS_VERSION}`,
|
|
@@ -67,4 +75,4 @@ const DEFAULT_ENVS = {
|
|
|
67
75
|
};
|
|
68
76
|
const CONFIG_METADATA_ENV = "VP_RESOLVING_CONFIG_METADATA";
|
|
69
77
|
//#endregion
|
|
70
|
-
export { VITEST_AGE_GATE_EXEMPT_PACKAGES as a,
|
|
78
|
+
export { VITEST_AGE_GATE_EXEMPT_PACKAGES as a, VITE_PLUS_NAME as c, createBaseUrlTsconfigFixArgs as d, isForceOverrideMode as f, version as h, DEFAULT_ENVS as i, VITE_PLUS_OVERRIDE_PACKAGES as l, resolveBundled as m, BASEURL_TSCONFIG_WARNING as n, VITEST_VERSION as o, resolve as p, CONFIG_METADATA_ENV as r, VITE_CONFIG_FILES as s, BASEURL_TSCONFIG_FIX_PACKAGE as t, VITE_PLUS_VERSION as u };
|