@vixt/cli 0.12.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-PRESENT SoulLyoko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/bin/vixt.mjs ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { runMain } = await import('../dist/index.mjs')
4
+
5
+ runMain()
@@ -0,0 +1,693 @@
1
+ import { ParsedArgs } from "citty";
2
+ //#region src/commands/build.d.ts
3
+ declare const buildArgsDef: {
4
+ legacy: {
5
+ type: "boolean";
6
+ description: string;
7
+ };
8
+ analyze: {
9
+ type: "boolean";
10
+ description: string;
11
+ };
12
+ root: {
13
+ type: "positional";
14
+ description: string;
15
+ required: false;
16
+ default: undefined;
17
+ };
18
+ debug: {
19
+ type: "boolean";
20
+ description: string;
21
+ alias: string[];
22
+ default: false;
23
+ };
24
+ mode: {
25
+ type: "string";
26
+ description: string;
27
+ alias: string[];
28
+ };
29
+ logLevel: {
30
+ type: "enum";
31
+ description: string;
32
+ options: ("error" | "warn" | "info" | "silent")[];
33
+ alias: string[];
34
+ };
35
+ clear: {
36
+ type: "boolean";
37
+ description: string;
38
+ default: false;
39
+ };
40
+ force: {
41
+ type: "boolean";
42
+ description: string;
43
+ default: false;
44
+ };
45
+ };
46
+ declare const buildCommand: import("citty").CommandDef<{
47
+ legacy: {
48
+ type: "boolean";
49
+ description: string;
50
+ };
51
+ analyze: {
52
+ type: "boolean";
53
+ description: string;
54
+ };
55
+ root: {
56
+ type: "positional";
57
+ description: string;
58
+ required: false;
59
+ default: undefined;
60
+ };
61
+ debug: {
62
+ type: "boolean";
63
+ description: string;
64
+ alias: string[];
65
+ default: false;
66
+ };
67
+ mode: {
68
+ type: "string";
69
+ description: string;
70
+ alias: string[];
71
+ };
72
+ logLevel: {
73
+ type: "enum";
74
+ description: string;
75
+ options: ("error" | "warn" | "info" | "silent")[];
76
+ alias: string[];
77
+ };
78
+ clear: {
79
+ type: "boolean";
80
+ description: string;
81
+ default: false;
82
+ };
83
+ force: {
84
+ type: "boolean";
85
+ description: string;
86
+ default: false;
87
+ };
88
+ }>;
89
+ type BuildArgs = ParsedArgs<typeof buildArgsDef>;
90
+ //#endregion
91
+ //#region src/commands/cleanup.d.ts
92
+ declare const cleanupCommand: import("citty").CommandDef<{
93
+ readonly root: {
94
+ type: "positional";
95
+ description: string;
96
+ required: false;
97
+ default: undefined;
98
+ };
99
+ }>;
100
+ //#endregion
101
+ //#region src/commands/dev.d.ts
102
+ declare const devArgsDef: {
103
+ https: {
104
+ type: "boolean";
105
+ description: string;
106
+ };
107
+ host: {
108
+ type: "string";
109
+ description: string;
110
+ };
111
+ port: {
112
+ type: "string";
113
+ description: string;
114
+ alias: string[];
115
+ };
116
+ open: {
117
+ type: "boolean";
118
+ description: string;
119
+ alias: string[];
120
+ default: false;
121
+ };
122
+ cors: {
123
+ type: "boolean";
124
+ description: string;
125
+ };
126
+ strictPort: {
127
+ type: "boolean";
128
+ description: string;
129
+ };
130
+ root: {
131
+ type: "positional";
132
+ description: string;
133
+ required: false;
134
+ default: undefined;
135
+ };
136
+ debug: {
137
+ type: "boolean";
138
+ description: string;
139
+ alias: string[];
140
+ default: false;
141
+ };
142
+ mode: {
143
+ type: "string";
144
+ description: string;
145
+ alias: string[];
146
+ };
147
+ logLevel: {
148
+ type: "enum";
149
+ description: string;
150
+ options: ("error" | "warn" | "info" | "silent")[];
151
+ alias: string[];
152
+ };
153
+ clear: {
154
+ type: "boolean";
155
+ description: string;
156
+ default: false;
157
+ };
158
+ force: {
159
+ type: "boolean";
160
+ description: string;
161
+ default: false;
162
+ };
163
+ };
164
+ declare const devCommand: import("citty").CommandDef<{
165
+ https: {
166
+ type: "boolean";
167
+ description: string;
168
+ };
169
+ host: {
170
+ type: "string";
171
+ description: string;
172
+ };
173
+ port: {
174
+ type: "string";
175
+ description: string;
176
+ alias: string[];
177
+ };
178
+ open: {
179
+ type: "boolean";
180
+ description: string;
181
+ alias: string[];
182
+ default: false;
183
+ };
184
+ cors: {
185
+ type: "boolean";
186
+ description: string;
187
+ };
188
+ strictPort: {
189
+ type: "boolean";
190
+ description: string;
191
+ };
192
+ root: {
193
+ type: "positional";
194
+ description: string;
195
+ required: false;
196
+ default: undefined;
197
+ };
198
+ debug: {
199
+ type: "boolean";
200
+ description: string;
201
+ alias: string[];
202
+ default: false;
203
+ };
204
+ mode: {
205
+ type: "string";
206
+ description: string;
207
+ alias: string[];
208
+ };
209
+ logLevel: {
210
+ type: "enum";
211
+ description: string;
212
+ options: ("error" | "warn" | "info" | "silent")[];
213
+ alias: string[];
214
+ };
215
+ clear: {
216
+ type: "boolean";
217
+ description: string;
218
+ default: false;
219
+ };
220
+ force: {
221
+ type: "boolean";
222
+ description: string;
223
+ default: false;
224
+ };
225
+ }>;
226
+ type DevArgs = ParsedArgs<typeof devArgsDef>;
227
+ //#endregion
228
+ //#region src/commands/prepare.d.ts
229
+ declare const prepareCommand: import("citty").CommandDef<{
230
+ readonly root: {
231
+ type: "positional";
232
+ description: string;
233
+ required: false;
234
+ default: undefined;
235
+ };
236
+ readonly debug: {
237
+ type: "boolean";
238
+ description: string;
239
+ alias: string[];
240
+ default: false;
241
+ };
242
+ readonly mode: {
243
+ type: "string";
244
+ description: string;
245
+ alias: string[];
246
+ };
247
+ readonly logLevel: {
248
+ type: "enum";
249
+ description: string;
250
+ options: ("error" | "warn" | "info" | "silent")[];
251
+ alias: string[];
252
+ };
253
+ readonly clear: {
254
+ type: "boolean";
255
+ description: string;
256
+ default: false;
257
+ };
258
+ readonly force: {
259
+ type: "boolean";
260
+ description: string;
261
+ default: false;
262
+ };
263
+ }>;
264
+ //#endregion
265
+ //#region src/commands/preview.d.ts
266
+ declare const previewCommand: import("citty").CommandDef<{
267
+ readonly host: {
268
+ type: "string";
269
+ description: string;
270
+ };
271
+ readonly port: {
272
+ type: "string";
273
+ description: string;
274
+ alias: string[];
275
+ };
276
+ readonly open: {
277
+ type: "boolean";
278
+ description: string;
279
+ alias: string[];
280
+ default: false;
281
+ };
282
+ readonly cors: {
283
+ type: "boolean";
284
+ description: string;
285
+ };
286
+ readonly strictPort: {
287
+ type: "boolean";
288
+ description: string;
289
+ };
290
+ readonly root: {
291
+ type: "positional";
292
+ description: string;
293
+ required: false;
294
+ default: undefined;
295
+ };
296
+ readonly debug: {
297
+ type: "boolean";
298
+ description: string;
299
+ alias: string[];
300
+ default: false;
301
+ };
302
+ readonly mode: {
303
+ type: "string";
304
+ description: string;
305
+ alias: string[];
306
+ };
307
+ readonly logLevel: {
308
+ type: "enum";
309
+ description: string;
310
+ options: ("error" | "warn" | "info" | "silent")[];
311
+ alias: string[];
312
+ };
313
+ readonly clear: {
314
+ type: "boolean";
315
+ description: string;
316
+ default: false;
317
+ };
318
+ readonly force: {
319
+ type: "boolean";
320
+ description: string;
321
+ default: false;
322
+ };
323
+ }>;
324
+ //#endregion
325
+ //#region src/commands/index.d.ts
326
+ declare const commands: {
327
+ build: import("citty").CommandDef<{
328
+ legacy: {
329
+ type: "boolean";
330
+ description: string;
331
+ };
332
+ analyze: {
333
+ type: "boolean";
334
+ description: string;
335
+ };
336
+ root: {
337
+ type: "positional";
338
+ description: string;
339
+ required: false;
340
+ default: undefined;
341
+ };
342
+ debug: {
343
+ type: "boolean";
344
+ description: string;
345
+ alias: string[];
346
+ default: false;
347
+ };
348
+ mode: {
349
+ type: "string";
350
+ description: string;
351
+ alias: string[];
352
+ };
353
+ logLevel: {
354
+ type: "enum";
355
+ description: string;
356
+ options: ("error" | "warn" | "info" | "silent")[];
357
+ alias: string[];
358
+ };
359
+ clear: {
360
+ type: "boolean";
361
+ description: string;
362
+ default: false;
363
+ };
364
+ force: {
365
+ type: "boolean";
366
+ description: string;
367
+ default: false;
368
+ };
369
+ }>;
370
+ cleanup: import("citty").CommandDef<{
371
+ readonly root: {
372
+ type: "positional";
373
+ description: string;
374
+ required: false;
375
+ default: undefined;
376
+ };
377
+ }>;
378
+ dev: import("citty").CommandDef<{
379
+ https: {
380
+ type: "boolean";
381
+ description: string;
382
+ };
383
+ host: {
384
+ type: "string";
385
+ description: string;
386
+ };
387
+ port: {
388
+ type: "string";
389
+ description: string;
390
+ alias: string[];
391
+ };
392
+ open: {
393
+ type: "boolean";
394
+ description: string;
395
+ alias: string[];
396
+ default: false;
397
+ };
398
+ cors: {
399
+ type: "boolean";
400
+ description: string;
401
+ };
402
+ strictPort: {
403
+ type: "boolean";
404
+ description: string;
405
+ };
406
+ root: {
407
+ type: "positional";
408
+ description: string;
409
+ required: false;
410
+ default: undefined;
411
+ };
412
+ debug: {
413
+ type: "boolean";
414
+ description: string;
415
+ alias: string[];
416
+ default: false;
417
+ };
418
+ mode: {
419
+ type: "string";
420
+ description: string;
421
+ alias: string[];
422
+ };
423
+ logLevel: {
424
+ type: "enum";
425
+ description: string;
426
+ options: ("error" | "warn" | "info" | "silent")[];
427
+ alias: string[];
428
+ };
429
+ clear: {
430
+ type: "boolean";
431
+ description: string;
432
+ default: false;
433
+ };
434
+ force: {
435
+ type: "boolean";
436
+ description: string;
437
+ default: false;
438
+ };
439
+ }>;
440
+ prepare: import("citty").CommandDef<{
441
+ readonly root: {
442
+ type: "positional";
443
+ description: string;
444
+ required: false;
445
+ default: undefined;
446
+ };
447
+ readonly debug: {
448
+ type: "boolean";
449
+ description: string;
450
+ alias: string[];
451
+ default: false;
452
+ };
453
+ readonly mode: {
454
+ type: "string";
455
+ description: string;
456
+ alias: string[];
457
+ };
458
+ readonly logLevel: {
459
+ type: "enum";
460
+ description: string;
461
+ options: ("error" | "warn" | "info" | "silent")[];
462
+ alias: string[];
463
+ };
464
+ readonly clear: {
465
+ type: "boolean";
466
+ description: string;
467
+ default: false;
468
+ };
469
+ readonly force: {
470
+ type: "boolean";
471
+ description: string;
472
+ default: false;
473
+ };
474
+ }>;
475
+ preview: import("citty").CommandDef<{
476
+ readonly host: {
477
+ type: "string";
478
+ description: string;
479
+ };
480
+ readonly port: {
481
+ type: "string";
482
+ description: string;
483
+ alias: string[];
484
+ };
485
+ readonly open: {
486
+ type: "boolean";
487
+ description: string;
488
+ alias: string[];
489
+ default: false;
490
+ };
491
+ readonly cors: {
492
+ type: "boolean";
493
+ description: string;
494
+ };
495
+ readonly strictPort: {
496
+ type: "boolean";
497
+ description: string;
498
+ };
499
+ readonly root: {
500
+ type: "positional";
501
+ description: string;
502
+ required: false;
503
+ default: undefined;
504
+ };
505
+ readonly debug: {
506
+ type: "boolean";
507
+ description: string;
508
+ alias: string[];
509
+ default: false;
510
+ };
511
+ readonly mode: {
512
+ type: "string";
513
+ description: string;
514
+ alias: string[];
515
+ };
516
+ readonly logLevel: {
517
+ type: "enum";
518
+ description: string;
519
+ options: ("error" | "warn" | "info" | "silent")[];
520
+ alias: string[];
521
+ };
522
+ readonly clear: {
523
+ type: "boolean";
524
+ description: string;
525
+ default: false;
526
+ };
527
+ readonly force: {
528
+ type: "boolean";
529
+ description: string;
530
+ default: false;
531
+ };
532
+ }>;
533
+ };
534
+ //#endregion
535
+ //#region src/main.d.ts
536
+ declare const main: import("citty").CommandDef<{
537
+ readonly command: {
538
+ readonly type: "positional";
539
+ readonly required: true;
540
+ };
541
+ }>;
542
+ declare const vixtArgsDef: {
543
+ https: {
544
+ type: "boolean";
545
+ description: string;
546
+ };
547
+ host: {
548
+ type: "string";
549
+ description: string;
550
+ };
551
+ port: {
552
+ type: "string";
553
+ description: string;
554
+ alias: string[];
555
+ };
556
+ open: {
557
+ type: "boolean";
558
+ description: string;
559
+ alias: string[];
560
+ default: false;
561
+ };
562
+ cors: {
563
+ type: "boolean";
564
+ description: string;
565
+ };
566
+ strictPort: {
567
+ type: "boolean";
568
+ description: string;
569
+ };
570
+ root: {
571
+ type: "positional";
572
+ description: string;
573
+ required: false;
574
+ default: undefined;
575
+ };
576
+ debug: {
577
+ type: "boolean";
578
+ description: string;
579
+ alias: string[];
580
+ default: false;
581
+ };
582
+ mode: {
583
+ type: "string";
584
+ description: string;
585
+ alias: string[];
586
+ };
587
+ logLevel: {
588
+ type: "enum";
589
+ description: string;
590
+ options: ("error" | "warn" | "info" | "silent")[];
591
+ alias: string[];
592
+ };
593
+ clear: {
594
+ type: "boolean";
595
+ description: string;
596
+ default: false;
597
+ };
598
+ force: {
599
+ type: "boolean";
600
+ description: string;
601
+ default: false;
602
+ };
603
+ legacy: {
604
+ type: "boolean";
605
+ description: string;
606
+ };
607
+ analyze: {
608
+ type: "boolean";
609
+ description: string;
610
+ };
611
+ };
612
+ type VixtArgs = ParsedArgs<typeof vixtArgsDef>;
613
+ type VixtCLIOptions = Partial<VixtArgs>;
614
+ declare function parseVixtArgs(args?: string[]): ParsedArgs<{
615
+ https: {
616
+ type: "boolean";
617
+ description: string;
618
+ };
619
+ host: {
620
+ type: "string";
621
+ description: string;
622
+ };
623
+ port: {
624
+ type: "string";
625
+ description: string;
626
+ alias: string[];
627
+ };
628
+ open: {
629
+ type: "boolean";
630
+ description: string;
631
+ alias: string[];
632
+ default: false;
633
+ };
634
+ cors: {
635
+ type: "boolean";
636
+ description: string;
637
+ };
638
+ strictPort: {
639
+ type: "boolean";
640
+ description: string;
641
+ };
642
+ root: {
643
+ type: "positional";
644
+ description: string;
645
+ required: false;
646
+ default: undefined;
647
+ };
648
+ debug: {
649
+ type: "boolean";
650
+ description: string;
651
+ alias: string[];
652
+ default: false;
653
+ };
654
+ mode: {
655
+ type: "string";
656
+ description: string;
657
+ alias: string[];
658
+ };
659
+ logLevel: {
660
+ type: "enum";
661
+ description: string;
662
+ options: ("error" | "warn" | "info" | "silent")[];
663
+ alias: string[];
664
+ };
665
+ clear: {
666
+ type: "boolean";
667
+ description: string;
668
+ default: false;
669
+ };
670
+ force: {
671
+ type: "boolean";
672
+ description: string;
673
+ default: false;
674
+ };
675
+ legacy: {
676
+ type: "boolean";
677
+ description: string;
678
+ };
679
+ analyze: {
680
+ type: "boolean";
681
+ description: string;
682
+ };
683
+ }>;
684
+ //#endregion
685
+ //#region src/run.d.ts
686
+ declare function runMain(): Promise<void>;
687
+ declare function runCommand(name: string, argv?: string[], data?: {
688
+ overrides?: Record<string, any>;
689
+ }): Promise<{
690
+ result: unknown;
691
+ }>;
692
+ //#endregion
693
+ export { BuildArgs, DevArgs, VixtArgs, VixtCLIOptions, buildArgsDef, buildCommand, cleanupCommand, commands, devArgsDef, devCommand, main, parseVixtArgs, prepareCommand, previewCommand, runCommand, runMain, vixtArgsDef };
package/dist/index.mjs ADDED
@@ -0,0 +1,244 @@
1
+ import { defineCommand, parseArgs, runCommand as runCommand$1, runMain as runMain$1 } from "citty";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ //#region src/commands/shared.ts
5
+ const sharedArgs = {
6
+ root: {
7
+ type: "positional",
8
+ description: "The root directory of your project (default: .)",
9
+ required: false,
10
+ default: void 0
11
+ },
12
+ debug: {
13
+ type: "boolean",
14
+ description: "Show debug logs",
15
+ alias: ["d"],
16
+ default: false
17
+ },
18
+ mode: {
19
+ type: "string",
20
+ description: "Set env mode",
21
+ alias: ["m"]
22
+ },
23
+ logLevel: {
24
+ type: "enum",
25
+ description: "info|warn|error|silent",
26
+ options: [
27
+ "info",
28
+ "warn",
29
+ "error",
30
+ "silent"
31
+ ],
32
+ alias: ["l"]
33
+ },
34
+ clear: {
35
+ type: "boolean",
36
+ description: "Clear console on restart",
37
+ default: false
38
+ },
39
+ force: {
40
+ type: "boolean",
41
+ description: "Force the optimizer to ignore the cache and re-bundle",
42
+ default: false
43
+ }
44
+ };
45
+ const serverArgs = {
46
+ host: {
47
+ type: "string",
48
+ description: "Host to listen on"
49
+ },
50
+ port: {
51
+ type: "string",
52
+ description: "Port to listen on",
53
+ alias: ["p"]
54
+ },
55
+ open: {
56
+ type: "boolean",
57
+ description: "Open the URL in the browser",
58
+ alias: ["o"],
59
+ default: false
60
+ },
61
+ cors: {
62
+ type: "boolean",
63
+ description: "Configure CORS for the dev server"
64
+ },
65
+ strictPort: {
66
+ type: "boolean",
67
+ description: "Exit if specified port is already in use"
68
+ }
69
+ };
70
+ //#endregion
71
+ //#region src/commands/utils.ts
72
+ function resolveSharedConfig(args) {
73
+ const { root, mode, logLevel, clear, force } = args;
74
+ return {
75
+ root,
76
+ mode,
77
+ logLevel,
78
+ clearScreen: clear,
79
+ forceOptimizeDeps: force
80
+ };
81
+ }
82
+ function resolveServerConfig(args) {
83
+ const { host, port, open, cors, strictPort } = args;
84
+ return {
85
+ port: port ? Number(port) : void 0,
86
+ host: host === "" ? "0.0.0.0" : host,
87
+ open,
88
+ cors,
89
+ strictPort
90
+ };
91
+ }
92
+ //#endregion
93
+ //#region src/commands/build.ts
94
+ const buildArgsDef = {
95
+ ...sharedArgs,
96
+ legacy: {
97
+ type: "boolean",
98
+ description: "Enable legacy plugin on build"
99
+ },
100
+ analyze: {
101
+ type: "boolean",
102
+ description: "Enable analyze plugin on build"
103
+ }
104
+ };
105
+ const buildCommand = defineCommand({
106
+ meta: {
107
+ name: "build",
108
+ description: "Build vixt app"
109
+ },
110
+ args: buildArgsDef,
111
+ async run(ctx) {
112
+ const { createBuilder } = await import("vite");
113
+ const builder = await createBuilder(resolveSharedConfig(ctx.args), null);
114
+ await builder.buildApp();
115
+ await builder.runDevTools();
116
+ }
117
+ });
118
+ //#endregion
119
+ //#region src/commands/cleanup.ts
120
+ const cleanupCommand = defineCommand({
121
+ meta: {
122
+ name: "cleanup",
123
+ description: "Cleanup vixt files"
124
+ },
125
+ args: { root: sharedArgs.root },
126
+ run(ctx) {
127
+ for (const dir of [
128
+ ".vixt",
129
+ ".output",
130
+ "dist",
131
+ "node_modules/.vite",
132
+ "node_modules/.cache"
133
+ ]) fs.rmSync(path.resolve(ctx.args.root ?? "", dir), {
134
+ recursive: true,
135
+ force: true
136
+ });
137
+ }
138
+ });
139
+ //#endregion
140
+ //#region src/commands/dev.ts
141
+ const devArgsDef = {
142
+ ...sharedArgs,
143
+ ...serverArgs,
144
+ https: {
145
+ type: "boolean",
146
+ description: "Enable HTTPS with a locally-trusted development certificate"
147
+ }
148
+ };
149
+ const devCommand = defineCommand({
150
+ meta: {
151
+ name: "dev",
152
+ description: "Create vixt server"
153
+ },
154
+ args: devArgsDef,
155
+ async run(ctx) {
156
+ const { createServer } = await import("vite");
157
+ const server = await createServer({
158
+ ...resolveSharedConfig(ctx.args),
159
+ server: resolveServerConfig(ctx.args)
160
+ });
161
+ await server.listen();
162
+ server.printUrls();
163
+ server.bindCLIShortcuts({ print: true });
164
+ }
165
+ });
166
+ //#endregion
167
+ //#region src/commands/prepare.ts
168
+ const prepareCommand = defineCommand({
169
+ meta: {
170
+ name: "prepare",
171
+ description: "Prepare vixt app"
172
+ },
173
+ args: { ...sharedArgs },
174
+ async run(ctx) {
175
+ const { createServer } = await import("vite");
176
+ await (await createServer(resolveSharedConfig(ctx.args))).close();
177
+ process.exit();
178
+ }
179
+ });
180
+ //#endregion
181
+ //#region src/commands/preview.ts
182
+ const previewCommand = defineCommand({
183
+ meta: {
184
+ name: "preview",
185
+ description: "Preview vixt app"
186
+ },
187
+ args: {
188
+ ...sharedArgs,
189
+ ...serverArgs
190
+ },
191
+ async run(ctx) {
192
+ const { preview } = await import("vite");
193
+ const server = await preview({
194
+ ...resolveSharedConfig(ctx.args),
195
+ server: resolveServerConfig(ctx.args)
196
+ });
197
+ server.printUrls();
198
+ server.bindCLIShortcuts({ print: true });
199
+ }
200
+ });
201
+ //#endregion
202
+ //#region src/commands/index.ts
203
+ const commands = {
204
+ build: buildCommand,
205
+ cleanup: cleanupCommand,
206
+ dev: devCommand,
207
+ prepare: prepareCommand,
208
+ preview: previewCommand
209
+ };
210
+ //#endregion
211
+ //#region src/main.ts
212
+ const main = defineCommand({
213
+ meta: {
214
+ name: "vixt",
215
+ description: "Vixt CLI"
216
+ },
217
+ args: { command: {
218
+ type: "positional",
219
+ required: true
220
+ } },
221
+ subCommands: commands
222
+ });
223
+ const vixtArgsDef = {
224
+ ...buildArgsDef,
225
+ ...devArgsDef
226
+ };
227
+ function parseVixtArgs(args = process.argv.slice(3)) {
228
+ return parseArgs(args, vixtArgsDef);
229
+ }
230
+ //#endregion
231
+ //#region src/run.ts
232
+ function runMain() {
233
+ return runMain$1(main);
234
+ }
235
+ function runCommand(name, argv = process.argv.slice(2), data = {}) {
236
+ if (!Object.hasOwn(commands, name)) throw new Error(`Invalid command ${name}`);
237
+ const command = commands[name];
238
+ return runCommand$1(command, {
239
+ rawArgs: [...argv],
240
+ data: { overrides: data.overrides || {} }
241
+ });
242
+ }
243
+ //#endregion
244
+ export { buildArgsDef, buildCommand, cleanupCommand, commands, devArgsDef, devCommand, main, parseVixtArgs, prepareCommand, previewCommand, runCommand, runMain, vixtArgsDef };
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@vixt/cli",
3
+ "version": "0.12.2",
4
+ "keywords": [
5
+ "nuxi",
6
+ "nuxt",
7
+ "nuxt-cli",
8
+ "vixt",
9
+ "vixt-cli"
10
+ ],
11
+ "homepage": "https://soullyoko.github.io/vixt/",
12
+ "license": "MIT",
13
+ "author": "SoulLyoko<https://github.com/SoulLyoko>",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/SoulLyoko/vixt.git"
17
+ },
18
+ "bin": {
19
+ "vixt": "bin/vixt.mjs"
20
+ },
21
+ "files": [
22
+ "bin",
23
+ "dist"
24
+ ],
25
+ "type": "module",
26
+ "main": "./dist/index.mjs",
27
+ "types": "./dist/index.d.mts",
28
+ "exports": {
29
+ ".": "./dist/index.mjs",
30
+ "./cli": "./bin/vixt.mjs"
31
+ },
32
+ "dependencies": {
33
+ "citty": "^0.2.2",
34
+ "vite": "^8.2.2"
35
+ },
36
+ "devDependencies": {
37
+ "jiti": "^2.7.0"
38
+ }
39
+ }