vite-plus 0.1.1 → 0.1.3

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 (43) hide show
  1. package/binding/index.cjs +2 -0
  2. package/binding/index.d.cts +32 -0
  3. package/dist/global/{prompts-CAIahN1u.js → agent-BE4Xze8Q.js} +380 -1280
  4. package/dist/global/{browser-CY4NBwxR.js → browser-CBapUTD0.js} +579 -1023
  5. package/dist/global/{browser-DFpJ6sKb.js → browser-EZnNDcaO.js} +2 -3
  6. package/dist/global/{chunk-CtfvYSle.js → chunk-CgnkrU7a.js} +13 -22
  7. package/dist/global/{cli-truncate-BxinOqz5.js → cli-truncate-Da6Y8aM8.js} +25 -74
  8. package/dist/global/config.js +95 -165
  9. package/dist/global/create.js +353 -496
  10. package/dist/global/{terminal-Cb-NuRkb.js → help-BAGHa8fD.js} +22 -54
  11. package/dist/global/{json-Bfvtp2rL.js → json-BRdVJ52a.js} +24 -58
  12. package/dist/global/{lib-CibYHP32.js → lib-DxappLRQ.js} +19 -43
  13. package/dist/global/{log-update-DdU6_LCN.js → log-update-C8WCYCbc.js} +102 -281
  14. package/dist/global/mcp.js +97 -169
  15. package/dist/global/migrate.js +223 -72
  16. package/dist/global/{package-Pq2biU7_.js → package-YAMvX5PJ.js} +6 -13
  17. package/dist/global/{slice-ansi-BhwAwMdF.js → slice-ansi-Fap0ehe9.js} +21 -52
  18. package/dist/global/{src-C6aLHRsS.js → src-DwSJ0s0I.js} +28 -110
  19. package/dist/global/staged.js +654 -1521
  20. package/dist/global/{strip-ansi-BL-dgd7n.js → strip-ansi-CE-VDMdw.js} +20 -67
  21. package/dist/global/version.js +16 -37
  22. package/dist/global/{workspace-De4OKHV7.js → workspace-lRm8huz4.js} +1645 -2806
  23. package/dist/global/wrap-ansi-Ou9oAs-a.js +3 -0
  24. package/dist/global/{wrap-ansi-Iww6Ak1s.js → wrap-ansi-eywLlPVQ.js} +29 -80
  25. package/dist/index.d.ts +1 -1
  26. package/dist/init-config.js +10 -2
  27. package/dist/run-config.d.ts +17 -0
  28. package/dist/utils/agent.d.ts +15 -1
  29. package/dist/utils/agent.js +104 -20
  30. package/dist/utils/constants.d.ts +1 -0
  31. package/dist/utils/constants.js +2 -0
  32. package/dist/utils/editor.d.ts +16 -3
  33. package/dist/utils/editor.js +55 -17
  34. package/dist/utils/prompts.d.ts +32 -3
  35. package/dist/utils/prompts.js +32 -8
  36. package/dist/utils/skills.js +18 -2
  37. package/dist/utils/tsconfig.d.ts +6 -0
  38. package/dist/utils/tsconfig.js +16 -0
  39. package/package.json +13 -13
  40. package/templates/monorepo/package.json +1 -1
  41. package/dist/global/wrap-ansi-BJxjUEQR.js +0 -4
  42. package/dist/oxlint-config.d.ts +0 -498
  43. package/dist/oxlint-config.js +0 -309
@@ -56,12 +56,12 @@ const styles = {
56
56
  bgWhiteBright: [107, 49]
57
57
  }
58
58
  };
59
- const modifierNames = Object.keys(styles.modifier);
59
+ Object.keys(styles.modifier);
60
60
  const foregroundColorNames = Object.keys(styles.color);
61
61
  const backgroundColorNames = Object.keys(styles.bgColor);
62
- const colorNames = [...foregroundColorNames, ...backgroundColorNames];
62
+ [...foregroundColorNames, ...backgroundColorNames];
63
63
  function assembleStyles() {
64
- const codes = new Map();
64
+ const codes = /* @__PURE__ */ new Map();
65
65
  for (const [groupName, group] of Object.entries(styles)) {
66
66
  for (const [styleName, style] of Object.entries(group)) {
67
67
  styles[styleName] = {
@@ -92,12 +92,8 @@ function assembleStyles() {
92
92
  rgbToAnsi256: {
93
93
  value(red, green, blue) {
94
94
  if (red === green && green === blue) {
95
- if (red < 8) {
96
- return 16;
97
- }
98
- if (red > 248) {
99
- return 231;
100
- }
95
+ if (red < 8) return 16;
96
+ if (red > 248) return 231;
101
97
  return Math.round((red - 8) / 247 * 24) + 232;
102
98
  }
103
99
  return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
@@ -107,17 +103,13 @@ function assembleStyles() {
107
103
  hexToRgb: {
108
104
  value(hex) {
109
105
  const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
110
- if (!matches) {
111
- return [
112
- 0,
113
- 0,
114
- 0
115
- ];
116
- }
106
+ if (!matches) return [
107
+ 0,
108
+ 0,
109
+ 0
110
+ ];
117
111
  let [colorString] = matches;
118
- if (colorString.length === 3) {
119
- colorString = [...colorString].map((character) => character + character).join("");
120
- }
112
+ if (colorString.length === 3) colorString = [...colorString].map((character) => character + character).join("");
121
113
  const integer = Number.parseInt(colorString, 16);
122
114
  return [
123
115
  integer >> 16 & 255,
@@ -133,12 +125,8 @@ function assembleStyles() {
133
125
  },
134
126
  ansi256ToAnsi: {
135
127
  value(code) {
136
- if (code < 8) {
137
- return 30 + code;
138
- }
139
- if (code < 16) {
140
- return 90 + (code - 8);
141
- }
128
+ if (code < 8) return 30 + code;
129
+ if (code < 16) return 90 + (code - 8);
142
130
  let red;
143
131
  let green;
144
132
  let blue;
@@ -154,13 +142,9 @@ function assembleStyles() {
154
142
  blue = remainder % 6 / 5;
155
143
  }
156
144
  const value = Math.max(red, green, blue) * 2;
157
- if (value === 0) {
158
- return 30;
159
- }
145
+ if (value === 0) return 30;
160
146
  let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
161
- if (value === 2) {
162
- result += 60;
163
- }
147
+ if (value === 2) result += 60;
164
148
  return result;
165
149
  },
166
150
  enumerable: false
@@ -177,7 +161,6 @@ function assembleStyles() {
177
161
  return styles;
178
162
  }
179
163
  const ansiStyles = assembleStyles();
180
-
181
164
  //#endregion
182
165
  //#region ../../node_modules/.pnpm/get-east-asian-width@1.4.0/node_modules/get-east-asian-width/lookup.js
183
166
  function isAmbiguous(x) {
@@ -189,57 +172,27 @@ function isFullWidth(x) {
189
172
  function isWide(x) {
190
173
  return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x >= 94192 && x <= 94198 || x >= 94208 && x <= 101589 || x >= 101631 && x <= 101662 || x >= 101760 && x <= 101874 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128728 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129674 || x >= 129678 && x <= 129734 || x === 129736 || x >= 129741 && x <= 129756 || x >= 129759 && x <= 129770 || x >= 129775 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
191
174
  }
192
- function getCategory(x) {
193
- if (isAmbiguous(x)) return "ambiguous";
194
- if (isFullWidth(x)) return "fullwidth";
195
- if (x === 8361 || x >= 65377 && x <= 65470 || x >= 65474 && x <= 65479 || x >= 65482 && x <= 65487 || x >= 65490 && x <= 65495 || x >= 65498 && x <= 65500 || x >= 65512 && x <= 65518) {
196
- return "halfwidth";
197
- }
198
- if (x >= 32 && x <= 126 || x === 162 || x === 163 || x === 165 || x === 166 || x === 172 || x === 175 || x >= 10214 && x <= 10221 || x === 10629 || x === 10630) {
199
- return "narrow";
200
- }
201
- if (isWide(x)) return "wide";
202
- return "neutral";
203
- }
204
-
205
175
  //#endregion
206
176
  //#region ../../node_modules/.pnpm/get-east-asian-width@1.4.0/node_modules/get-east-asian-width/index.js
207
177
  function validate(codePoint) {
208
- if (!Number.isSafeInteger(codePoint)) {
209
- throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
210
- }
211
- }
212
- function eastAsianWidthType(codePoint) {
213
- validate(codePoint);
214
- return getCategory(codePoint);
178
+ if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
215
179
  }
216
180
  function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
217
181
  validate(codePoint);
218
- if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
219
- return 2;
220
- }
182
+ if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
221
183
  return 1;
222
184
  }
223
-
224
185
  //#endregion
225
186
  //#region ../../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
226
187
  function ansiRegex({ onlyFirst = false } = {}) {
227
- const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
228
- const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
229
- const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
230
- const pattern = `${osc}|${csi}`;
231
- return new RegExp(pattern, onlyFirst ? undefined : "g");
188
+ return new RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`, onlyFirst ? void 0 : "g");
232
189
  }
233
-
234
190
  //#endregion
235
191
  //#region ../../node_modules/.pnpm/strip-ansi@7.1.2/node_modules/strip-ansi/index.js
236
192
  const regex = ansiRegex();
237
193
  function stripAnsi(string) {
238
- if (typeof string !== "string") {
239
- throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
240
- }
194
+ if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
241
195
  return string.replace(regex, "");
242
196
  }
243
-
244
197
  //#endregion
245
- export { ansiStyles as a, isWide as i, eastAsianWidth as n, isFullWidth as r, stripAnsi as t };
198
+ export { ansiStyles as a, isWide as i, eastAsianWidth as n, isFullWidth as r, stripAnsi as t };
@@ -1,38 +1,29 @@
1
- import { o as VITE_PLUS_NAME } from "./json-Bfvtp2rL.js";
2
- import { r as hasVitePlusDependency, t as detectPackageMetadata } from "./package-Pq2biU7_.js";
3
- import { a as renderCliDoc, n as log, t as accent } from "./terminal-Cb-NuRkb.js";
1
+ import { s as VITE_PLUS_NAME } from "./json-BRdVJ52a.js";
2
+ import { r as hasVitePlusDependency, t as detectPackageMetadata } from "./package-YAMvX5PJ.js";
3
+ import { n as accent, r as log, t as renderCliDoc } from "./help-BAGHa8fD.js";
4
4
  import path from "node:path";
5
5
  import fs from "node:fs";
6
6
  import { vitePlusHeader } from "../../binding/index.js";
7
7
  import { createRequire } from "node:module";
8
-
9
8
  //#region src/version.ts
10
9
  const require = createRequire(import.meta.url);
11
10
  function getGlobalVersion() {
12
11
  return process.env.VITE_PLUS_GLOBAL_VERSION ?? null;
13
12
  }
14
13
  function getCliVersion() {
15
- const pkg = resolvePackageJson(VITE_PLUS_NAME, process.cwd());
16
- return pkg?.version ?? null;
14
+ return resolvePackageJson(VITE_PLUS_NAME, process.cwd())?.version ?? null;
17
15
  }
18
16
  function getLocalMetadata(cwd) {
19
- if (!isVitePlusDeclaredInAncestors(cwd)) {
20
- return null;
21
- }
22
- return detectPackageMetadata(cwd, VITE_PLUS_NAME) ?? null;
17
+ if (!isVitePlusDeclaredInAncestors(cwd)) return null;
18
+ return detectPackageMetadata(cwd, "vite-plus") ?? null;
23
19
  }
24
20
  function isVitePlusDeclaredInAncestors(cwd) {
25
21
  let currentDir = path.resolve(cwd);
26
22
  while (true) {
27
- const packageJsonPath = path.join(currentDir, "package.json");
28
- const pkg = readPackageJsonFromPath(packageJsonPath);
29
- if (pkg && hasVitePlusDependency(pkg)) {
30
- return true;
31
- }
23
+ const pkg = readPackageJsonFromPath(path.join(currentDir, "package.json"));
24
+ if (pkg && hasVitePlusDependency(pkg)) return true;
32
25
  const parentDir = path.dirname(currentDir);
33
- if (parentDir === currentDir) {
34
- break;
35
- }
26
+ if (parentDir === currentDir) break;
36
27
  currentDir = parentDir;
37
28
  }
38
29
  return false;
@@ -46,18 +37,14 @@ function readPackageJsonFromPath(packageJsonPath) {
46
37
  }
47
38
  function resolvePackageJson(packageName, baseDir) {
48
39
  try {
49
- const packageJsonPath = require.resolve(`${packageName}/package.json`, { paths: [baseDir] });
50
- return readPackageJsonFromPath(packageJsonPath);
40
+ return readPackageJsonFromPath(require.resolve(`${packageName}/package.json`, { paths: [baseDir] }));
51
41
  } catch {
52
42
  try {
53
43
  const mainPath = require.resolve(packageName, { paths: [baseDir] });
54
44
  let dir = path.dirname(mainPath);
55
45
  while (dir !== path.dirname(dir)) {
56
- const pkgPath = path.join(dir, "package.json");
57
- const pkg = readPackageJsonFromPath(pkgPath);
58
- if (pkg) {
59
- return pkg;
60
- }
46
+ const pkg = readPackageJsonFromPath(path.join(dir, "package.json"));
47
+ if (pkg) return pkg;
61
48
  dir = path.dirname(dir);
62
49
  }
63
50
  } catch {}
@@ -67,17 +54,10 @@ function resolvePackageJson(packageName, baseDir) {
67
54
  function resolveToolVersion(tool, localPackagePath) {
68
55
  const pkg = resolvePackageJson(tool.packageName, localPackagePath);
69
56
  const bundledVersion = tool.bundledVersionKey ? pkg?.bundledVersions?.[tool.bundledVersionKey] ?? null : null;
70
- if (bundledVersion) {
71
- return bundledVersion;
72
- }
57
+ if (bundledVersion) return bundledVersion;
73
58
  const version = pkg?.version ?? null;
74
- if (version) {
75
- return version;
76
- }
77
- if (tool.fallbackPackageJson) {
78
- const fallbackPath = path.join(localPackagePath, tool.fallbackPackageJson);
79
- return readPackageJsonFromPath(fallbackPath)?.version ?? null;
80
- }
59
+ if (version) return version;
60
+ if (tool.fallbackPackageJson) return readPackageJsonFromPath(path.join(localPackagePath, tool.fallbackPackageJson))?.version ?? null;
81
61
  return null;
82
62
  }
83
63
  /**
@@ -149,6 +129,5 @@ async function printVersion(cwd) {
149
129
  log(renderCliDoc({ sections }));
150
130
  }
151
131
  await printVersion(process.cwd());
152
-
153
132
  //#endregion
154
- export { printVersion };
133
+ export { printVersion };