vite-plus 0.2.7 → 0.2.8

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 (54) hide show
  1. package/LICENSE +5 -1
  2. package/bin/vpr +3 -2
  3. package/binding/index.cjs +193 -80
  4. package/binding/index.d.cts +99 -8
  5. package/dist/agent-CI79DuSy.js +600 -0
  6. package/dist/bin.js +1368 -13
  7. package/dist/{cli-truncate-BVOlIIPy.js → cli-truncate-Bg3RDXpi.js} +0 -2
  8. package/dist/client/bundledDevClient.mjs +1 -0
  9. package/dist/config/bin.js +13 -126
  10. package/dist/{constants-BsuzPowC.js → constants-BppDcRc1.js} +1 -1
  11. package/dist/create/bin.js +90 -77
  12. package/dist/{define-config-DLh9fE95.cjs → define-config-CEm_MtvJ.cjs} +1 -1
  13. package/dist/{define-config-C2KfLHpC.js → define-config-DPnHe1Mx.js} +2 -2
  14. package/dist/{define-config-eLQH9us2.d.ts → define-config-DWoAkNdp.d.ts} +16 -0
  15. package/dist/define-config.cjs +1 -1
  16. package/dist/define-config.d.ts +1 -1
  17. package/dist/define-config.js +1 -1
  18. package/dist/{dist-CKz3vcoG.js → dist-CSQWHI6y.js} +3 -8
  19. package/dist/dist-DT25H9pj.js +3 -0
  20. package/dist/{agent-CPwWJ4qf.js → editor-CGWdbLgD.js} +690 -579
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/{json-DiRs8ceZ.js → json-BU88uu6o.js} +2 -6
  25. package/dist/migration/bin.js +58 -48
  26. package/dist/{oxlint-plugin-config-Bxgc4cwF.js → oxlint-plugin-config-BHOzlwMw.js} +1 -1
  27. package/dist/oxlint-plugin.js +1 -1
  28. package/dist/pack-bin.js +1 -1
  29. package/dist/{package-Ds3uThLb.js → package-hV-77cBb.js} +2 -2
  30. package/dist/{tsconfig-Jia2vgMG.js → prompts-DYap08te.js} +32 -174
  31. package/dist/{resolve-vite-config-BiuLZnn8.js → resolve-vite-config-EWXclqvV.js} +1 -1
  32. package/dist/{rolldown-runtime-C7HZzL1F.js → rolldown-runtime-CMFfr-1z.js} +1 -1
  33. package/dist/staged/bin.js +20 -23
  34. package/dist/{help-YP84FSEz.js → terminal-CrqqK8WT.js} +39 -2
  35. package/dist/tsconfig-CVUKLfL8.js +151 -0
  36. package/dist/{tsgolint-path-B-yOos8p.js → tsgolint-path-eMZT-oea.js} +4 -2
  37. package/dist/tsgolint-path.js +1 -1
  38. package/dist/version.js +5 -5
  39. package/dist/versions.js +4 -4
  40. package/docs/config/index.md +13 -0
  41. package/docs/config/staged.md +2 -1
  42. package/docs/guide/commit-hooks.md +38 -20
  43. package/docs/guide/env.md +8 -4
  44. package/docs/guide/index.md +1 -1
  45. package/docs/guide/install.md +2 -0
  46. package/docs/guide/installer-env-vars.md +3 -3
  47. package/docs/guide/migrate.md +10 -2
  48. package/docs/guide/monorepo.md +94 -6
  49. package/docs/guide/troubleshooting.md +3 -2
  50. package/package.json +17 -23
  51. package/dist/dist-CtM2JRbM.js +0 -3
  52. package/dist/editor-BbT1lTNc.js +0 -675
  53. package/dist/terminal-uTv0ZaMr.js +0 -33
  54. package/dist/{log-update-DHZRyJ2m.js → log-update-CoW8Z4Dl.js} +1 -1
@@ -518,8 +518,6 @@ function applySgrFragments(activeStyles, fragments) {
518
518
  case "start":
519
519
  activeStyles.delete(fragment.endCode);
520
520
  activeStyles.set(fragment.endCode, fragment.code);
521
- break;
522
- default: break;
523
521
  }
524
522
  return activeStyles;
525
523
  }
@@ -0,0 +1 @@
1
+ export * from '@voidzero-dev/vite-plus-core/dist/client/bundledDevClient.mjs';
@@ -1,123 +1,9 @@
1
- import { f as promptGitHooks, u as defaultInteractive } from "../tsconfig-Jia2vgMG.js";
2
- import { a as printHeader, r as log } from "../terminal-uTv0ZaMr.js";
1
+ import { a as printHeader, c as renderCliDoc, r as log } from "../terminal-CrqqK8WT.js";
2
+ import { i as promptGitHooks, n as defaultInteractive } from "../prompts-DYap08te.js";
3
3
  import { t as lib_default } from "../lib-L3DWSRQp.js";
4
- import { o as updateExistingAgentInstructions, v as ensurePreCommitHook, x as hasStagedConfigInViteConfig } from "../agent-CPwWJ4qf.js";
5
- import { t as renderCliDoc } from "../help-YP84FSEz.js";
4
+ import { d as install, o as updateExistingAgentInstructions } from "../agent-CI79DuSy.js";
6
5
  import { join } from "node:path";
7
- import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
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
6
+ import { existsSync } from "node:fs";
121
7
  //#region src/config/bin.ts
122
8
  async function main() {
123
9
  const args = lib_default(process.argv.slice(3), {
@@ -132,7 +18,7 @@ async function main() {
132
18
  if (args.help) {
133
19
  const helpMessage = renderCliDoc({
134
20
  usage: "vp config [OPTIONS]",
135
- summary: "Configure Vite+ for the current project (hooks + agent integration).",
21
+ summary: "Configure Vite+ for the current project (hook dispatcher + agent integration).",
136
22
  documentationUrl: "https://viteplus.dev/guide/commit-hooks",
137
23
  sections: [{
138
24
  title: "Options",
@@ -143,7 +29,7 @@ async function main() {
143
29
  },
144
30
  {
145
31
  label: "--no-hooks",
146
- description: "Skip hook installation"
32
+ description: "Skip hook dispatcher installation"
147
33
  },
148
34
  {
149
35
  label: "--no-agent",
@@ -157,8 +43,8 @@ async function main() {
157
43
  }, {
158
44
  title: "Environment",
159
45
  rows: [{
160
- label: "VITE_GIT_HOOKS=0",
161
- description: "Skip hook installation"
46
+ label: "VP_GIT_HOOKS=0",
47
+ description: "Skip hook dispatcher installation"
162
48
  }]
163
49
  }]
164
50
  });
@@ -173,17 +59,18 @@ async function main() {
173
59
  const lifecycleEvent = process.env.npm_lifecycle_event;
174
60
  const isLifecycleScript = lifecycleEvent === "prepare" || lifecycleEvent === "postinstall";
175
61
  const root = process.cwd();
176
- const hooksDir = dir ?? ".vite-hooks";
177
- const isFirstHooksRun = !existsSync(join(root, hooksDir, "_", "pre-commit"));
62
+ const isFirstHooksRun = !existsSync(join(root, dir ?? ".vite-hooks", "_", "pre-commit"));
178
63
  let shouldSetupHooks = !skipHooks;
179
- if (shouldSetupHooks && interactive && isFirstHooksRun && !dir && !isLifecycleScript && !hasStagedConfigInViteConfig(root)) shouldSetupHooks = await promptGitHooks({ interactive });
64
+ if (shouldSetupHooks && interactive && isFirstHooksRun && !dir && !isLifecycleScript) shouldSetupHooks = await promptGitHooks({
65
+ interactive,
66
+ message: "Install the Git hook dispatcher for this project?"
67
+ });
180
68
  if (shouldSetupHooks) {
181
69
  const { message, isError } = install(dir);
182
70
  if (message) {
183
71
  log(message);
184
72
  if (isError) process.exit(1);
185
73
  }
186
- if (!message) ensurePreCommitHook(root, hooksDir);
187
74
  }
188
75
  if (!skipAgent) updateExistingAgentInstructions(root);
189
76
  }
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from "node:module";
2
2
  //#region package.json
3
- var version = "0.2.7";
3
+ var version = "0.2.8";
4
4
  //#endregion
5
5
  //#region src/utils/constants.ts
6
6
  const VITE_PLUS_NAME = "vite-plus";