@vixt/core 0.13.1 → 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.
@@ -1,5 +1,4 @@
1
1
  import { ConfigLayer, ConfigLayerMeta, LoadConfigOptions, ResolvedConfig } from "c12";
2
- import { commands } from "@vixt/cli";
3
2
  import { HtmlTagDescriptor, PluginOption, ServerOptions, UserConfig } from "vite";
4
3
  import Legacy from "@vitejs/plugin-legacy";
5
4
  import Analyzer from "vite-bundle-analyzer";
@@ -403,24 +402,7 @@ declare function isSamePath(a: string, b: string): boolean;
403
402
  declare function resolveLayersDirs(layers?: VixtConfigLayer[]): Record<string, string[] | undefined>;
404
403
  //#endregion
405
404
  //#region src/node/env.d.ts
406
- declare function loadCLIOptions(): {
407
- _: string[];
408
- https: boolean | undefined;
409
- host: string | undefined;
410
- port: string | undefined;
411
- open: boolean;
412
- cors: boolean | undefined;
413
- strictPort: boolean | undefined;
414
- root: string | undefined;
415
- debug: boolean;
416
- mode: string | undefined;
417
- logLevel: "error" | "warn" | "info" | "silent" | undefined;
418
- clear: boolean;
419
- force: boolean;
420
- legacy: boolean | undefined;
421
- analyze: boolean | undefined;
422
- command: keyof typeof commands;
423
- };
405
+ declare function loadCLIOptions(): Partial<import("@vixt/cli").VixtArgs>;
424
406
  declare function loadMode(): string | undefined;
425
407
  /**
426
408
  * Load workspace and cwd env variables by default
@@ -18,10 +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 {
22
- command: process.argv[2],
23
- ...parseVixtArgs()
24
- };
21
+ try {
22
+ return parseVixtArgs();
23
+ } catch {
24
+ return {};
25
+ }
25
26
  }
26
27
  function loadMode() {
27
28
  const { mode } = loadCLIOptions();
@@ -72,12 +73,13 @@ function defineVixtConfig(input) {
72
73
  return input;
73
74
  }
74
75
  async function loadVixtConfig(opts) {
76
+ const _cli = process.argv[1]?.endsWith("vixt.mjs");
75
77
  const cliOptions = loadCLIOptions();
76
78
  const result = await loadConfig({
77
79
  name: "vixt",
78
80
  rcFile: false,
79
81
  ...opts,
80
- ...cliOptions.root ? { cwd: cliOptions.root } : {}
82
+ ..._cli && cliOptions.root ? { cwd: cliOptions.root } : {}
81
83
  });
82
84
  const { config, cwd } = result;
83
85
  config.rootDir ??= cwd;
@@ -89,8 +91,9 @@ async function loadVixtConfig(opts) {
89
91
  config.modulesDir ??= resolve(config.srcDir, "modules");
90
92
  config.pluginsDir ??= resolve(config.srcDir, "plugins");
91
93
  config.debug = !!cliOptions.debug;
92
- config.dev = env.NODE_ENV !== "production";
94
+ config.dev = env.NODE_ENV === "development";
93
95
  config.test = env.NODE_ENV === "test";
96
+ config._cli = process.argv[1]?.endsWith("vixt.mjs");
94
97
  config._prepare = cliOptions.command === "prepare";
95
98
  cliOptions.force && fs.removeSync(config.buildDir);
96
99
  return result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vixt/core",
3
- "version": "0.13.1",
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.1",
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",