@vixt/core 0.13.0 → 0.13.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.
@@ -401,124 +401,8 @@ declare function applyLayers({ config, layers }: ResolvedVixtConfig): VixtConfig
401
401
  declare function isSamePath(a: string, b: string): boolean;
402
402
  declare function resolveLayersDirs(layers?: VixtConfigLayer[]): Record<string, string[] | undefined>;
403
403
  //#endregion
404
- //#region ../../node_modules/.pnpm/citty@0.2.2/node_modules/citty/dist/index.d.mts
405
- //#region src/types.d.ts
406
- type ArgType = "boolean" | "string" | "enum" | "positional" | undefined;
407
- type _ArgDef<T extends ArgType, VT extends boolean | number | string> = {
408
- type?: T;
409
- description?: string;
410
- valueHint?: string;
411
- alias?: string | string[];
412
- default?: VT;
413
- required?: boolean;
414
- options?: string[];
415
- };
416
- type BooleanArgDef = Omit<_ArgDef<"boolean", boolean>, "options"> & {
417
- negativeDescription?: string;
418
- };
419
- type StringArgDef = Omit<_ArgDef<"string", string>, "options">;
420
- type EnumArgDef = _ArgDef<"enum", string>;
421
- type PositionalArgDef = Omit<_ArgDef<"positional", string>, "alias" | "options">;
422
- type ArgDef = BooleanArgDef | StringArgDef | PositionalArgDef | EnumArgDef;
423
- type ArgsDef = Record<string, ArgDef>;
424
- type ResolveParsedArgType<T extends ArgDef, VT> = T extends {
425
- default?: any;
426
- required?: boolean;
427
- } ? T["default"] extends NonNullable<VT> ? VT : T["required"] extends true ? VT : VT | undefined : VT | undefined;
428
- type ParsedPositionalArg<T extends ArgDef> = T extends {
429
- type: "positional";
430
- } ? ResolveParsedArgType<T, string> : never;
431
- type ParsedStringArg<T extends ArgDef> = T extends {
432
- type: "string";
433
- } ? ResolveParsedArgType<T, string> : never;
434
- type ParsedBooleanArg<T extends ArgDef> = T extends {
435
- type: "boolean";
436
- } ? ResolveParsedArgType<T, boolean> : never;
437
- type ParsedEnumArg<T extends ArgDef> = T extends {
438
- type: "enum";
439
- options: infer U;
440
- } ? U extends Array<any> ? ResolveParsedArgType<T, U[number]> : never : never;
441
- type RawArgs = {
442
- _: string[];
443
- };
444
- type ParsedArg<T extends ArgDef> = T["type"] extends "positional" ? ParsedPositionalArg<T> : T["type"] extends "boolean" ? ParsedBooleanArg<T> : T["type"] extends "string" ? ParsedStringArg<T> : T["type"] extends "enum" ? ParsedEnumArg<T> : never;
445
- type ParsedArgs<T extends ArgsDef = ArgsDef> = RawArgs & { [K in keyof T]: ParsedArg<T[K]>; } & { [K in keyof T as T[K] extends {
446
- alias: string;
447
- } ? T[K]["alias"] : never]: ParsedArg<T[K]>; } & { [K in keyof T as T[K] extends {
448
- alias: string[];
449
- } ? T[K]["alias"][number] : never]: ParsedArg<T[K]>; } & Record<string, string | number | boolean | string[]>;
450
- //#endregion
451
404
  //#region src/node/env.d.ts
452
- declare function loadCLIOptions(): ParsedArgs<{
453
- https: {
454
- type: "boolean";
455
- description: string;
456
- };
457
- host: {
458
- type: "string";
459
- description: string;
460
- };
461
- port: {
462
- type: "string";
463
- description: string;
464
- alias: string[];
465
- };
466
- open: {
467
- type: "boolean";
468
- description: string;
469
- alias: string[];
470
- default: false;
471
- };
472
- cors: {
473
- type: "boolean";
474
- description: string;
475
- };
476
- strictPort: {
477
- type: "boolean";
478
- description: string;
479
- };
480
- root: {
481
- type: "positional";
482
- description: string;
483
- required: false;
484
- default: undefined;
485
- };
486
- debug: {
487
- type: "boolean";
488
- description: string;
489
- alias: string[];
490
- default: false;
491
- };
492
- mode: {
493
- type: "string";
494
- description: string;
495
- alias: string[];
496
- };
497
- logLevel: {
498
- type: "enum";
499
- description: string;
500
- options: ("error" | "warn" | "info" | "silent")[];
501
- alias: string[];
502
- };
503
- clear: {
504
- type: "boolean";
505
- description: string;
506
- default: false;
507
- };
508
- force: {
509
- type: "boolean";
510
- description: string;
511
- default: false;
512
- };
513
- legacy: {
514
- type: "boolean";
515
- description: string;
516
- };
517
- analyze: {
518
- type: "boolean";
519
- description: string;
520
- };
521
- }>;
405
+ declare function loadCLIOptions(): Partial<import("@vixt/cli").VixtArgs>;
522
406
  declare function loadMode(): string | undefined;
523
407
  /**
524
408
  * Load workspace and cwd env variables by default
@@ -18,7 +18,11 @@ import Checker from "vite-plugin-checker";
18
18
  import { builders, parseExpression, parseModule } from "magicast";
19
19
  //#region src/node/env.ts
20
20
  function loadCLIOptions() {
21
- return parseVixtArgs();
21
+ try {
22
+ return parseVixtArgs();
23
+ } catch {
24
+ return {};
25
+ }
22
26
  }
23
27
  function loadMode() {
24
28
  const { mode } = loadCLIOptions();
@@ -69,12 +73,13 @@ function defineVixtConfig(input) {
69
73
  return input;
70
74
  }
71
75
  async function loadVixtConfig(opts) {
76
+ const _cli = process.argv[1]?.endsWith("vixt.mjs");
72
77
  const cliOptions = loadCLIOptions();
73
78
  const result = await loadConfig({
74
79
  name: "vixt",
75
80
  rcFile: false,
76
81
  ...opts,
77
- ...cliOptions.root ? { cwd: cliOptions.root } : {}
82
+ ..._cli && cliOptions.root ? { cwd: cliOptions.root } : {}
78
83
  });
79
84
  const { config, cwd } = result;
80
85
  config.rootDir ??= cwd;
@@ -86,8 +91,10 @@ async function loadVixtConfig(opts) {
86
91
  config.modulesDir ??= resolve(config.srcDir, "modules");
87
92
  config.pluginsDir ??= resolve(config.srcDir, "plugins");
88
93
  config.debug = !!cliOptions.debug;
89
- config.dev = env.NODE_ENV !== "production";
94
+ config.dev = env.NODE_ENV === "development";
90
95
  config.test = env.NODE_ENV === "test";
96
+ config._cli = process.argv[1]?.endsWith("vixt.mjs");
97
+ config._prepare = cliOptions.command === "prepare";
91
98
  cliOptions.force && fs.removeSync(config.buildDir);
92
99
  return result;
93
100
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vixt/core",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "keywords": [
5
5
  "nuxt",
6
6
  "react",
@@ -33,7 +33,7 @@
33
33
  "@types/fs-extra": "^11.0.4",
34
34
  "@vitejs/plugin-basic-ssl": "^2.3.0",
35
35
  "@vitejs/plugin-legacy": "^8.2.3",
36
- "@vixt/cli": "0.13.0",
36
+ "@vixt/cli": "0.13.2",
37
37
  "@vue/tsconfig": "^0.9.1",
38
38
  "c12": "^3.3.4",
39
39
  "defu": "^6.1.7",