vite-plus 0.1.2 → 0.1.4

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 (41) 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-CpNB3GIY.js} +475 -1350
  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 +86 -166
  9. package/dist/global/create.js +626 -615
  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 +330 -86
  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 +1353 -2112
  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-MTwAF3M9.js → workspace-CiqQdO1L.js} +1711 -2834
  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/utils/agent.d.ts +15 -1
  28. package/dist/utils/agent.js +104 -20
  29. package/dist/utils/constants.d.ts +1 -0
  30. package/dist/utils/constants.js +2 -0
  31. package/dist/utils/editor.d.ts +16 -3
  32. package/dist/utils/editor.js +55 -17
  33. package/dist/utils/prompts.d.ts +33 -4
  34. package/dist/utils/prompts.js +34 -10
  35. package/dist/utils/tsconfig.d.ts +6 -0
  36. package/dist/utils/tsconfig.js +16 -0
  37. package/package.json +14 -14
  38. package/templates/monorepo/package.json +1 -1
  39. package/dist/global/wrap-ansi-BJxjUEQR.js +0 -4
  40. package/dist/oxlint-config.d.ts +0 -498
  41. package/dist/oxlint-config.js +0 -309
@@ -1,309 +0,0 @@
1
- // To parse this data:
2
- //
3
- // import { Convert, OxlintConfig } from "./file";
4
- //
5
- // const oxlintConfig = Convert.toOxlintConfig(json);
6
- //
7
- // These functions will throw an error if the JSON doesn't
8
- // match the expected interface, even if the JSON is valid.
9
- // Converts JSON strings to/from your types
10
- // and asserts the results of JSON.parse at runtime
11
- export class Convert {
12
- static toOxlintConfig(json) {
13
- return cast(JSON.parse(json), r('OxlintConfig'));
14
- }
15
- static oxlintConfigToJson(value) {
16
- return JSON.stringify(uncast(value, r('OxlintConfig')), null, 2);
17
- }
18
- }
19
- function invalidValue(typ, val, key, parent = '') {
20
- const prettyTyp = prettyTypeName(typ);
21
- const parentText = parent ? ` on ${parent}` : '';
22
- const keyText = key ? ` for key "${key}"` : '';
23
- throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`);
24
- }
25
- function prettyTypeName(typ) {
26
- if (Array.isArray(typ)) {
27
- if (typ.length === 2 && typ[0] === undefined) {
28
- return `an optional ${prettyTypeName(typ[1])}`;
29
- }
30
- else {
31
- return `one of [${typ
32
- .map((a) => {
33
- return prettyTypeName(a);
34
- })
35
- .join(', ')}]`;
36
- }
37
- }
38
- else if (typeof typ === 'object' && typ.literal !== undefined) {
39
- return typ.literal;
40
- }
41
- else {
42
- return typeof typ;
43
- }
44
- }
45
- function jsonToJSProps(typ) {
46
- if (typ.jsonToJS === undefined) {
47
- const map = {};
48
- typ.props.forEach((p) => (map[p.json] = { key: p.js, typ: p.typ }));
49
- typ.jsonToJS = map;
50
- }
51
- return typ.jsonToJS;
52
- }
53
- function jsToJSONProps(typ) {
54
- if (typ.jsToJSON === undefined) {
55
- const map = {};
56
- typ.props.forEach((p) => (map[p.js] = { key: p.json, typ: p.typ }));
57
- typ.jsToJSON = map;
58
- }
59
- return typ.jsToJSON;
60
- }
61
- function transform(val, typ, getProps, key = '', parent = '') {
62
- function transformPrimitive(typ, val) {
63
- if (typeof typ === typeof val) {
64
- return val;
65
- }
66
- return invalidValue(typ, val, key, parent);
67
- }
68
- function transformUnion(typs, val) {
69
- // val must validate against one typ in typs
70
- const l = typs.length;
71
- for (let i = 0; i < l; i++) {
72
- const typ = typs[i];
73
- try {
74
- return transform(val, typ, getProps);
75
- }
76
- catch { }
77
- }
78
- return invalidValue(typs, val, key, parent);
79
- }
80
- function transformEnum(cases, val) {
81
- if (cases.indexOf(val) !== -1) {
82
- return val;
83
- }
84
- return invalidValue(cases.map((a) => {
85
- return l(a);
86
- }), val, key, parent);
87
- }
88
- function transformArray(typ, val) {
89
- // val must be an array with no invalid elements
90
- if (!Array.isArray(val)) {
91
- return invalidValue(l('array'), val, key, parent);
92
- }
93
- return val.map((el) => transform(el, typ, getProps));
94
- }
95
- function transformDate(val) {
96
- if (val === null) {
97
- return null;
98
- }
99
- const d = new Date(val);
100
- if (isNaN(d.valueOf())) {
101
- return invalidValue(l('Date'), val, key, parent);
102
- }
103
- return d;
104
- }
105
- function transformObject(props, additional, val) {
106
- if (val === null || typeof val !== 'object' || Array.isArray(val)) {
107
- return invalidValue(l(ref || 'object'), val, key, parent);
108
- }
109
- const result = {};
110
- Object.getOwnPropertyNames(props).forEach((key) => {
111
- const prop = props[key];
112
- const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined;
113
- result[prop.key] = transform(v, prop.typ, getProps, key, ref);
114
- });
115
- Object.getOwnPropertyNames(val).forEach((key) => {
116
- if (!Object.prototype.hasOwnProperty.call(props, key)) {
117
- result[key] = transform(val[key], additional, getProps, key, ref);
118
- }
119
- });
120
- return result;
121
- }
122
- if (typ === 'any') {
123
- return val;
124
- }
125
- if (typ === null) {
126
- if (val === null) {
127
- return val;
128
- }
129
- return invalidValue(typ, val, key, parent);
130
- }
131
- if (typ === false) {
132
- return invalidValue(typ, val, key, parent);
133
- }
134
- let ref = undefined;
135
- while (typeof typ === 'object' && typ.ref !== undefined) {
136
- ref = typ.ref;
137
- typ = typeMap[typ.ref];
138
- }
139
- if (Array.isArray(typ)) {
140
- return transformEnum(typ, val);
141
- }
142
- if (typeof typ === 'object') {
143
- return typ.hasOwnProperty('unionMembers')
144
- ? transformUnion(typ.unionMembers, val)
145
- : typ.hasOwnProperty('arrayItems')
146
- ? transformArray(typ.arrayItems, val)
147
- : typ.hasOwnProperty('props')
148
- ? transformObject(getProps(typ), typ.additional, val)
149
- : invalidValue(typ, val, key, parent);
150
- }
151
- // Numbers can be parsed by Date but shouldn't be.
152
- if (typ === Date && typeof val !== 'number') {
153
- return transformDate(val);
154
- }
155
- return transformPrimitive(typ, val);
156
- }
157
- function cast(val, typ) {
158
- return transform(val, typ, jsonToJSProps);
159
- }
160
- function uncast(val, typ) {
161
- return transform(val, typ, jsToJSONProps);
162
- }
163
- function l(typ) {
164
- return { literal: typ };
165
- }
166
- function a(typ) {
167
- return { arrayItems: typ };
168
- }
169
- function u(...typs) {
170
- return { unionMembers: typs };
171
- }
172
- function o(props, additional) {
173
- return { props, additional };
174
- }
175
- function m(additional) {
176
- return { props: [], additional };
177
- }
178
- function r(name) {
179
- return { ref: name };
180
- }
181
- const typeMap = {
182
- OxlintConfig: o([
183
- { json: '$schema', js: '$schema', typ: u(undefined, u(null, '')) },
184
- { json: 'categories', js: 'categories', typ: u(undefined, r('RuleCategories')) },
185
- { json: 'env', js: 'env', typ: u(undefined, m(true)) },
186
- { json: 'extends', js: 'extends', typ: u(undefined, a('')) },
187
- { json: 'globals', js: 'globals', typ: u(undefined, m(r('GlobalValue'))) },
188
- { json: 'ignorePatterns', js: 'ignorePatterns', typ: u(undefined, a('')) },
189
- {
190
- json: 'jsPlugins',
191
- js: 'jsPlugins',
192
- typ: u(undefined, u(a(u(r('ExternalPluginEntryClass'), '')), null)),
193
- },
194
- { json: 'overrides', js: 'overrides', typ: u(undefined, a(r('OxlintOverride'))) },
195
- {
196
- json: 'plugins',
197
- js: 'plugins',
198
- typ: u(undefined, u(a(r('LintPluginOptionsSchema')), null)),
199
- },
200
- { json: 'rules', js: 'rules', typ: u(undefined, m(u(a('any'), r('AllowWarnDenyEnum'), 0))) },
201
- { json: 'settings', js: 'settings', typ: u(undefined, r('OxlintPluginSettings')) },
202
- ], false),
203
- RuleCategories: o([
204
- { json: 'correctness', js: 'correctness', typ: u(undefined, u(r('AllowWarnDenyEnum'), 0)) },
205
- { json: 'nursery', js: 'nursery', typ: u(undefined, u(r('AllowWarnDenyEnum'), 0)) },
206
- { json: 'pedantic', js: 'pedantic', typ: u(undefined, u(r('AllowWarnDenyEnum'), 0)) },
207
- { json: 'perf', js: 'perf', typ: u(undefined, u(r('AllowWarnDenyEnum'), 0)) },
208
- { json: 'restriction', js: 'restriction', typ: u(undefined, u(r('AllowWarnDenyEnum'), 0)) },
209
- { json: 'style', js: 'style', typ: u(undefined, u(r('AllowWarnDenyEnum'), 0)) },
210
- { json: 'suspicious', js: 'suspicious', typ: u(undefined, u(r('AllowWarnDenyEnum'), 0)) },
211
- ], false),
212
- ExternalPluginEntryClass: o([
213
- { json: 'name', js: 'name', typ: '' },
214
- { json: 'specifier', js: 'specifier', typ: '' },
215
- ], false),
216
- OxlintOverride: o([
217
- { json: 'env', js: 'env', typ: u(undefined, u(m(true), null)) },
218
- { json: 'files', js: 'files', typ: a('') },
219
- { json: 'globals', js: 'globals', typ: u(undefined, u(m(r('GlobalValue')), null)) },
220
- {
221
- json: 'jsPlugins',
222
- js: 'jsPlugins',
223
- typ: u(undefined, u(a(u(r('ExternalPluginEntryClass'), '')), null)),
224
- },
225
- {
226
- json: 'plugins',
227
- js: 'plugins',
228
- typ: u(undefined, u(a(r('LintPluginOptionsSchema')), null)),
229
- },
230
- { json: 'rules', js: 'rules', typ: u(undefined, m(u(a('any'), r('AllowWarnDenyEnum'), 0))) },
231
- ], false),
232
- OxlintPluginSettings: o([
233
- { json: 'jsdoc', js: 'jsdoc', typ: u(undefined, r('JSDocPluginSettings')) },
234
- { json: 'jsx-a11y', js: 'jsx-a11y', typ: u(undefined, r('JSXA11YPluginSettings')) },
235
- { json: 'next', js: 'next', typ: u(undefined, r('NextPluginSettings')) },
236
- { json: 'react', js: 'react', typ: u(undefined, r('ReactPluginSettings')) },
237
- { json: 'vitest', js: 'vitest', typ: u(undefined, r('VitestPluginSettings')) },
238
- ], 'any'),
239
- JSDocPluginSettings: o([
240
- {
241
- json: 'augmentsExtendsReplacesDocs',
242
- js: 'augmentsExtendsReplacesDocs',
243
- typ: u(undefined, true),
244
- },
245
- {
246
- json: 'exemptDestructuredRootsFromChecks',
247
- js: 'exemptDestructuredRootsFromChecks',
248
- typ: u(undefined, true),
249
- },
250
- { json: 'ignoreInternal', js: 'ignoreInternal', typ: u(undefined, true) },
251
- { json: 'ignorePrivate', js: 'ignorePrivate', typ: u(undefined, true) },
252
- { json: 'ignoreReplacesDocs', js: 'ignoreReplacesDocs', typ: u(undefined, true) },
253
- { json: 'implementsReplacesDocs', js: 'implementsReplacesDocs', typ: u(undefined, true) },
254
- { json: 'overrideReplacesDocs', js: 'overrideReplacesDocs', typ: u(undefined, true) },
255
- {
256
- json: 'tagNamePreference',
257
- js: 'tagNamePreference',
258
- typ: u(undefined, m(u(true, r('TagNamePreferenceObject'), ''))),
259
- },
260
- ], 'any'),
261
- TagNamePreferenceObject: o([
262
- { json: 'message', js: 'message', typ: '' },
263
- { json: 'replacement', js: 'replacement', typ: u(undefined, '') },
264
- ], 'any'),
265
- JSXA11YPluginSettings: o([
266
- { json: 'attributes', js: 'attributes', typ: u(undefined, m(a(''))) },
267
- { json: 'components', js: 'components', typ: u(undefined, m('')) },
268
- { json: 'polymorphicPropName', js: 'polymorphicPropName', typ: u(undefined, u(null, '')) },
269
- ], 'any'),
270
- NextPluginSettings: o([{ json: 'rootDir', js: 'rootDir', typ: u(undefined, u(a(''), '')) }], 'any'),
271
- ReactPluginSettings: o([
272
- {
273
- json: 'formComponents',
274
- js: 'formComponents',
275
- typ: u(undefined, a(u(r('CustomComponentObject'), ''))),
276
- },
277
- {
278
- json: 'linkComponents',
279
- js: 'linkComponents',
280
- typ: u(undefined, a(u(r('CustomComponentObject'), ''))),
281
- },
282
- { json: 'version', js: 'version', typ: u(undefined, u(null, '')) },
283
- ], 'any'),
284
- CustomComponentObject: o([
285
- { json: 'attribute', js: 'attribute', typ: u(undefined, '') },
286
- { json: 'name', js: 'name', typ: '' },
287
- { json: 'attributes', js: 'attributes', typ: u(undefined, a('')) },
288
- ], 'any'),
289
- VitestPluginSettings: o([{ json: 'typecheck', js: 'typecheck', typ: u(undefined, true) }], 'any'),
290
- AllowWarnDenyEnum: ['allow', 'deny', 'error', 'off', 'warn'],
291
- GlobalValue: ['off', 'readonly', 'writable'],
292
- LintPluginOptionsSchema: [
293
- 'eslint',
294
- 'import',
295
- 'jest',
296
- 'jsdoc',
297
- 'jsx-a11y',
298
- 'nextjs',
299
- 'node',
300
- 'oxc',
301
- 'promise',
302
- 'react',
303
- 'react-perf',
304
- 'typescript',
305
- 'unicorn',
306
- 'vitest',
307
- 'vue',
308
- ],
309
- };