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
@@ -1,10 +1,21 @@
1
1
  import { stripVTControlCharacters, styleText } from "node:util";
2
-
2
+ //#region src/utils/terminal.ts
3
+ function log(message) {
4
+ console.log(message);
5
+ }
6
+ function accent(text) {
7
+ return styleText("blue", text);
8
+ }
9
+ function muted(text) {
10
+ return styleText("gray", text);
11
+ }
12
+ function success(text) {
13
+ return styleText("green", text);
14
+ }
15
+ //#endregion
3
16
  //#region src/utils/help.ts
4
17
  function toLines(value) {
5
- if (!value) {
6
- return [];
7
- }
18
+ if (!value) return [];
8
19
  return Array.isArray(value) ? [...value] : [value];
9
20
  }
10
21
  function visibleLength(value) {
@@ -15,9 +26,7 @@ function padVisible(value, width) {
15
26
  return `${value}${" ".repeat(padding)}`;
16
27
  }
17
28
  function renderRows(rows) {
18
- if (rows.length === 0) {
19
- return [];
20
- }
29
+ if (rows.length === 0) return [];
21
30
  const labelWidth = Math.max(...rows.map((row) => visibleLength(row.label)));
22
31
  const output = [];
23
32
  for (const row of rows) {
@@ -28,9 +37,7 @@ function renderRows(rows) {
28
37
  }
29
38
  const [firstLine, ...rest] = descriptionLines;
30
39
  output.push(` ${padVisible(row.label, labelWidth)} ${firstLine}`);
31
- for (const line of rest) {
32
- output.push(` ${" ".repeat(labelWidth)} ${line}`);
33
- }
40
+ for (const line of rest) output.push(` ${" ".repeat(labelWidth)} ${line}`);
34
41
  }
35
42
  return output;
36
43
  }
@@ -46,57 +53,18 @@ function renderCliDoc(doc, options = {}) {
46
53
  }
47
54
  const summaryLines = toLines(doc.summary);
48
55
  if (summaryLines.length > 0) {
49
- if (output.length > 0) {
50
- output.push("");
51
- }
56
+ if (output.length > 0) output.push("");
52
57
  output.push(...summaryLines);
53
58
  }
54
59
  for (const section of doc.sections) {
55
- if (output.length > 0) {
56
- output.push("");
57
- }
60
+ if (output.length > 0) output.push("");
58
61
  output.push(heading(section.title, color));
59
62
  const lines = toLines(section.lines);
60
- if (lines.length > 0) {
61
- output.push(...lines);
62
- }
63
- if (section.rows && section.rows.length > 0) {
64
- output.push(...renderRows(section.rows));
65
- }
63
+ if (lines.length > 0) output.push(...lines);
64
+ if (section.rows && section.rows.length > 0) output.push(...renderRows(section.rows));
66
65
  }
67
66
  output.push("");
68
67
  return output.join("\n");
69
68
  }
70
-
71
- //#endregion
72
- //#region src/utils/terminal.ts
73
- function log(message) {
74
- console.log(message);
75
- }
76
- function accent(text) {
77
- return styleText("blue", text);
78
- }
79
- function muted(text) {
80
- return styleText("gray", text);
81
- }
82
- function success(text) {
83
- return styleText("green", text);
84
- }
85
- function error(text) {
86
- return styleText("red", text);
87
- }
88
- function infoMsg(msg) {
89
- console.log(styleText(["blue", "bold"], "info:"), msg);
90
- }
91
- function warnMsg(msg) {
92
- console.error(styleText(["yellow", "bold"], "warn:"), msg);
93
- }
94
- function errorMsg(msg) {
95
- console.error(styleText(["red", "bold"], "error:"), msg);
96
- }
97
- function noteMsg(msg) {
98
- console.log(styleText(["gray", "bold"], "note:"), msg);
99
- }
100
-
101
69
  //#endregion
102
- export { renderCliDoc as a, success as i, log as n, muted as r, accent as t };
70
+ export { success as a, muted as i, accent as n, log as r, renderCliDoc as t };
@@ -1,6 +1,5 @@
1
1
  import fs from "node:fs";
2
2
  import { createRequire } from "node:module";
3
-
4
3
  //#region src/utils/constants.ts
5
4
  const VITE_PLUS_NAME = "vite-plus";
6
5
  const VITE_PLUS_VERSION = process.env.VITE_PLUS_VERSION || "latest";
@@ -12,12 +11,12 @@ const require = createRequire(import.meta.url);
12
11
  function resolve(path) {
13
12
  return require.resolve(path, { paths: [process.cwd(), import.meta.dirname] });
14
13
  }
14
+ const BASEURL_TSCONFIG_WARNING = "Skipped typeAware/typeCheck: tsconfig.json contains baseUrl which is not yet supported by the oxlint type checker.\n Run `npx @andrewbranch/ts5to6 --fixBaseUrl .` to remove baseUrl from your tsconfig.";
15
15
  const DEFAULT_ENVS = {
16
16
  JS_RUNTIME_VERSION: process.versions.node,
17
17
  JS_RUNTIME_NAME: process.release.name,
18
18
  NODE_PACKAGE_MANAGER: "vite-plus"
19
19
  };
20
-
21
20
  //#endregion
22
21
  //#region ../../node_modules/.pnpm/detect-indent@7.0.2/node_modules/detect-indent/index.js
23
22
  const INDENT_REGEX = /^(?:( )+|\t+)/;
@@ -41,14 +40,12 @@ s12: [1, 0],
41
40
  ```
42
41
  */
43
42
  function makeIndentsMap(string, ignoreSingleSpaces) {
44
- const indents = new Map();
43
+ const indents = /* @__PURE__ */ new Map();
45
44
  let previousSize = 0;
46
45
  let previousIndentType;
47
46
  let key;
48
47
  for (const line of string.split(/\n/g)) {
49
- if (!line) {
50
- continue;
51
- }
48
+ if (!line) continue;
52
49
  const matches = line.match(INDENT_REGEX);
53
50
  if (matches === null) {
54
51
  previousSize = 0;
@@ -56,12 +53,8 @@ function makeIndentsMap(string, ignoreSingleSpaces) {
56
53
  } else {
57
54
  const indent = matches[0].length;
58
55
  const indentType = matches[1] ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
59
- if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, indent)) {
60
- continue;
61
- }
62
- if (indentType !== previousIndentType) {
63
- previousSize = 0;
64
- }
56
+ if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, indent)) continue;
57
+ if (indentType !== previousIndentType) previousSize = 0;
65
58
  previousIndentType = indentType;
66
59
  let use = 1;
67
60
  let weight = 0;
@@ -72,60 +65,47 @@ function makeIndentsMap(string, ignoreSingleSpaces) {
72
65
  weight = 1;
73
66
  } else {
74
67
  const absoluteIndentDifference = Math.abs(indentDifference);
75
- if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, absoluteIndentDifference)) {
76
- continue;
77
- }
68
+ if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, absoluteIndentDifference)) continue;
78
69
  key = encodeIndentsKey(indentType, absoluteIndentDifference);
79
70
  }
80
71
  const entry = indents.get(key);
81
- indents.set(key, entry === undefined ? [1, 0] : [entry[0] + use, entry[1] + weight]);
72
+ indents.set(key, entry === void 0 ? [1, 0] : [entry[0] + use, entry[1] + weight]);
82
73
  }
83
74
  }
84
75
  return indents;
85
76
  }
86
77
  function encodeIndentsKey(indentType, indentAmount) {
87
- const typeCharacter = indentType === INDENT_TYPE_SPACE ? "s" : "t";
88
- return typeCharacter + String(indentAmount);
78
+ return (indentType === INDENT_TYPE_SPACE ? "s" : "t") + String(indentAmount);
89
79
  }
90
80
  function decodeIndentsKey(indentsKey) {
91
- const keyHasTypeSpace = indentsKey[0] === "s";
92
- const type = keyHasTypeSpace ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
93
- const amount = Number(indentsKey.slice(1));
94
81
  return {
95
- type,
96
- amount
82
+ type: indentsKey[0] === "s" ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB,
83
+ amount: Number(indentsKey.slice(1))
97
84
  };
98
85
  }
99
86
  function getMostUsedKey(indents) {
100
87
  let result;
101
88
  let maxUsed = 0;
102
89
  let maxWeight = 0;
103
- for (const [key, [usedCount, weight]] of indents) {
104
- if (usedCount > maxUsed || usedCount === maxUsed && weight > maxWeight) {
105
- maxUsed = usedCount;
106
- maxWeight = weight;
107
- result = key;
108
- }
90
+ for (const [key, [usedCount, weight]] of indents) if (usedCount > maxUsed || usedCount === maxUsed && weight > maxWeight) {
91
+ maxUsed = usedCount;
92
+ maxWeight = weight;
93
+ result = key;
109
94
  }
110
95
  return result;
111
96
  }
112
97
  function makeIndentString(type, amount) {
113
- const indentCharacter = type === INDENT_TYPE_SPACE ? " " : " ";
114
- return indentCharacter.repeat(amount);
98
+ return (type === INDENT_TYPE_SPACE ? " " : " ").repeat(amount);
115
99
  }
116
100
  function detectIndent(string) {
117
- if (typeof string !== "string") {
118
- throw new TypeError("Expected a string");
119
- }
101
+ if (typeof string !== "string") throw new TypeError("Expected a string");
120
102
  let indents = makeIndentsMap(string, true);
121
- if (indents.size === 0) {
122
- indents = makeIndentsMap(string, false);
123
- }
103
+ if (indents.size === 0) indents = makeIndentsMap(string, false);
124
104
  const keyOfMostUsedIndent = getMostUsedKey(indents);
125
105
  let type;
126
106
  let amount = 0;
127
107
  let indent = "";
128
- if (keyOfMostUsedIndent !== undefined) {
108
+ if (keyOfMostUsedIndent !== void 0) {
129
109
  ({type, amount} = decodeIndentsKey(keyOfMostUsedIndent));
130
110
  indent = makeIndentString(type, amount);
131
111
  }
@@ -135,25 +115,15 @@ function detectIndent(string) {
135
115
  indent
136
116
  };
137
117
  }
138
-
139
118
  //#endregion
140
119
  //#region ../../node_modules/.pnpm/detect-newline@4.0.1/node_modules/detect-newline/index.js
141
120
  function detectNewline(string) {
142
- if (typeof string !== "string") {
143
- throw new TypeError("Expected a string");
144
- }
121
+ if (typeof string !== "string") throw new TypeError("Expected a string");
145
122
  const newlines = string.match(/(?:\r?\n)/g) || [];
146
- if (newlines.length === 0) {
147
- return;
148
- }
123
+ if (newlines.length === 0) return;
149
124
  const crlf = newlines.filter((newline) => newline === "\r\n").length;
150
- const lf = newlines.length - crlf;
151
- return crlf > lf ? "\r\n" : "\n";
125
+ return crlf > newlines.length - crlf ? "\r\n" : "\n";
152
126
  }
153
- function detectNewlineGraceful(string) {
154
- return typeof string === "string" && detectNewline(string) || "\n";
155
- }
156
-
157
127
  //#endregion
158
128
  //#region src/utils/json.ts
159
129
  function readJsonFile(file) {
@@ -171,11 +141,8 @@ function writeJsonFile(file, data) {
171
141
  fs.writeFileSync(file, JSON.stringify(data, null, indent) + newline, "utf-8");
172
142
  }
173
143
  function editJsonFile(file, callback) {
174
- const json = readJsonFile(file);
175
- const newJson = callback(json);
176
- if (newJson) {
177
- writeJsonFile(file, newJson);
178
- }
144
+ const newJson = callback(readJsonFile(file));
145
+ if (newJson) writeJsonFile(file, newJson);
179
146
  }
180
147
  function isJsonFile(file) {
181
148
  try {
@@ -185,6 +152,5 @@ function isJsonFile(file) {
185
152
  return false;
186
153
  }
187
154
  }
188
-
189
155
  //#endregion
190
- export { DEFAULT_ENVS as a, VITE_PLUS_VERSION as c, writeJsonFile as i, resolve as l, isJsonFile as n, VITE_PLUS_NAME as o, readJsonFile as r, VITE_PLUS_OVERRIDE_PACKAGES as s, editJsonFile as t };
156
+ export { BASEURL_TSCONFIG_WARNING as a, VITE_PLUS_OVERRIDE_PACKAGES as c, writeJsonFile as i, VITE_PLUS_VERSION as l, isJsonFile as n, DEFAULT_ENVS as o, readJsonFile as r, VITE_PLUS_NAME as s, editJsonFile as t, resolve as u };
@@ -17,13 +17,9 @@ function lib_default(args, opts) {
17
17
  opts.alias = opts.alias || {};
18
18
  opts.string = toArr(opts.string);
19
19
  opts.boolean = toArr(opts.boolean);
20
- if (alibi) {
21
- for (k in opts.alias) {
22
- arr = opts.alias[k] = toArr(opts.alias[k]);
23
- for (i = 0; i < arr.length; i++) {
24
- (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
25
- }
26
- }
20
+ if (alibi) for (k in opts.alias) {
21
+ arr = opts.alias[k] = toArr(opts.alias[k]);
22
+ for (i = 0; i < arr.length; i++) (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
27
23
  }
28
24
  for (i = opts.boolean.length; i-- > 0;) {
29
25
  arr = opts.alias[opts.boolean[i]] || [];
@@ -33,16 +29,12 @@ function lib_default(args, opts) {
33
29
  arr = opts.alias[opts.string[i]] || [];
34
30
  for (j = arr.length; j-- > 0;) opts.string.push(arr[j]);
35
31
  }
36
- if (defaults) {
37
- for (k in opts.default) {
38
- name = typeof opts.default[k];
39
- arr = opts.alias[k] = opts.alias[k] || [];
40
- if (opts[name] !== void 0) {
41
- opts[name].push(k);
42
- for (i = 0; i < arr.length; i++) {
43
- opts[name].push(arr[i]);
44
- }
45
- }
32
+ if (defaults) for (k in opts.default) {
33
+ name = typeof opts.default[k];
34
+ arr = opts.alias[k] = opts.alias[k] || [];
35
+ if (opts[name] !== void 0) {
36
+ opts[name].push(k);
37
+ for (i = 0; i < arr.length; i++) opts[name].push(arr[i]);
46
38
  }
47
39
  }
48
40
  const keys = strict ? Object.keys(opts.alias) : [];
@@ -52,21 +44,14 @@ function lib_default(args, opts) {
52
44
  out._ = out._.concat(args.slice(++i));
53
45
  break;
54
46
  }
55
- for (j = 0; j < arg.length; j++) {
56
- if (arg.charCodeAt(j) !== 45) break;
57
- }
58
- if (j === 0) {
59
- out._.push(arg);
60
- } else if (arg.substring(j, j + 3) === "no-") {
47
+ for (j = 0; j < arg.length; j++) if (arg.charCodeAt(j) !== 45) break;
48
+ if (j === 0) out._.push(arg);
49
+ else if (arg.substring(j, j + 3) === "no-") {
61
50
  name = arg.substring(j + 3);
62
- if (strict && !~keys.indexOf(name)) {
63
- return opts.unknown(arg);
64
- }
51
+ if (strict && !~keys.indexOf(name)) return opts.unknown(arg);
65
52
  out[name] = false;
66
53
  } else {
67
- for (idx = j + 1; idx < arg.length; idx++) {
68
- if (arg.charCodeAt(idx) === 61) break;
69
- }
54
+ for (idx = j + 1; idx < arg.length; idx++) if (arg.charCodeAt(idx) === 61) break;
70
55
  name = arg.substring(j, idx);
71
56
  val = arg.substring(++idx) || i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i];
72
57
  arr = j === 2 ? [name] : name;
@@ -78,22 +63,13 @@ function lib_default(args, opts) {
78
63
  }
79
64
  }
80
65
  if (defaults) {
81
- for (k in opts.default) {
82
- if (out[k] === void 0) {
83
- out[k] = opts.default[k];
84
- }
85
- }
66
+ for (k in opts.default) if (out[k] === void 0) out[k] = opts.default[k];
86
67
  }
87
- if (alibi) {
88
- for (k in out) {
89
- arr = opts.alias[k] || [];
90
- while (arr.length > 0) {
91
- out[arr.shift()] = out[k];
92
- }
93
- }
68
+ if (alibi) for (k in out) {
69
+ arr = opts.alias[k] || [];
70
+ while (arr.length > 0) out[arr.shift()] = out[k];
94
71
  }
95
72
  return out;
96
73
  }
97
-
98
74
  //#endregion
99
- export { lib_default as t };
75
+ export { lib_default as t };