@vixt/core 0.7.3 → 0.8.0

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.
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,29 @@
1
+ import { defineCommand, runMain } from "citty";
2
+
3
+ //#region src/cli/index.ts
4
+ runMain(defineCommand({
5
+ meta: {
6
+ name: "vixt",
7
+ description: "Vixt CLI"
8
+ },
9
+ args: { command: {
10
+ type: "positional",
11
+ required: true
12
+ } },
13
+ subCommands: { prepare: defineCommand({
14
+ meta: {
15
+ name: "prepare",
16
+ description: "Prepare Vixt"
17
+ },
18
+ async run() {
19
+ const { loadConfigFromFile } = await import("vite");
20
+ await loadConfigFromFile({
21
+ command: "serve",
22
+ mode: "dev"
23
+ }, void 0, void 0, void 0, void 0, "native");
24
+ }
25
+ }) }
26
+ }));
27
+
28
+ //#endregion
29
+ export { };
@@ -61,8 +61,8 @@ async function loadVixtConfig(opts) {
61
61
  rcFile: false,
62
62
  ...opts
63
63
  });
64
- const { config, cwd: cwd$1 } = result;
65
- config.rootDir ??= cwd$1;
64
+ const { config, cwd } = result;
65
+ config.rootDir ??= cwd;
66
66
  config.buildDir ??= resolve(config.rootDir, ".vixt");
67
67
  config.buildTypesDir ??= resolve(config.buildDir, "types");
68
68
  config.buildLayersDir ??= resolve(config.buildDir, "layers");
@@ -91,6 +91,12 @@ function applyLayers({ config, layers = [] }) {
91
91
  } });
92
92
  layer.cwd = newCwd;
93
93
  }
94
+ if (isSamePath(layer.cwd, resolve(rootDir))) {
95
+ layer.config.rootDir ??= config.rootDir;
96
+ layer.config.srcDir ??= config.srcDir;
97
+ layer.config.modulesDir ??= config.modulesDir;
98
+ layer.config.pluginsDir ??= config.pluginsDir;
99
+ }
94
100
  layer.config.rootDir ??= layer.cwd;
95
101
  layer.config.srcDir ??= resolve(layer.config.rootDir, "src");
96
102
  layer.config.modulesDir ??= resolve(layer.config.srcDir, "modules");
@@ -405,14 +411,14 @@ declare module '*.vue' {
405
411
  const codePath = path.resolve(buildTypesDir, "vue-shim.d.ts");
406
412
  fs.outputFileSync(codePath, code);
407
413
  }
408
- function generateEnvDts(env$1, vixt) {
414
+ function generateEnvDts(env, vixt) {
409
415
  const { buildTypesDir } = vixt.options;
410
416
  const codePath = path.resolve(buildTypesDir, "vite-env.d.ts");
411
417
  const code = `interface ImportMeta {
412
418
  readonly env: ImportMetaEnv
413
419
  }
414
420
  interface ImportMetaEnv {
415
- ${Object.entries(env$1).map(([key, value]) => `/** ${key}=${value} */\n ${key}: ${typeof value}`).join("\n ")}
421
+ ${Object.entries(env).map(([key, value]) => `/** ${key}=${value} */\n ${key}: ${typeof value}`).join("\n ")}
416
422
  }
417
423
  `;
418
424
  fs.outputFileSync(codePath, code);
@@ -431,7 +437,7 @@ var typescript_default = defineVixtModule({
431
437
  paths[ak] = [av];
432
438
  if (stats?.isDirectory()) paths[`${ak}/*`] = [`${av}/*`];
433
439
  }
434
- const include = ["./**/*", ...vixt._layers.map((e) => e.cwd)];
440
+ const include = ["./**/*", ...vixt._layers.map((e) => `${e.cwd}/**/*`)];
435
441
  return {
436
442
  tsConfig: {
437
443
  extends: "@vue/tsconfig/tsconfig.dom.json",
@@ -449,10 +455,10 @@ var typescript_default = defineVixtModule({
449
455
  };
450
456
  },
451
457
  setup(options, vixt) {
458
+ generateTsConfig(options, vixt);
452
459
  return [{
453
460
  name: name$4,
454
461
  configResolved(config) {
455
- generateTsConfig(options, vixt);
456
462
  generateVixtDts(options, vixt);
457
463
  genarateShim(options, vixt);
458
464
  generateEnvDts(config.env, vixt);
@@ -569,14 +575,14 @@ const name = "vixt:vite";
569
575
  var vite_default = defineVixtModule({
570
576
  meta: { name },
571
577
  setup(_, vixt) {
572
- let env$1;
578
+ let env;
573
579
  return {
574
580
  name,
575
581
  enforce: "pre",
576
582
  config(config) {
577
583
  const { rootDir, app } = vixt.options;
578
- env$1 = loadEnv(config.mode, config.envDir, config.envPrefix);
579
- const defineEnv = Object.fromEntries(Object.entries(env$1).filter(([k]) => ![
584
+ env = loadEnv(config.mode, config.envDir, config.envPrefix);
585
+ const defineEnv = Object.fromEntries(Object.entries(env).filter(([k]) => ![
580
586
  "MODE",
581
587
  "DEV",
582
588
  "PROD"
@@ -589,7 +595,7 @@ var vite_default = defineVixtModule({
589
595
  },
590
596
  configResolved(config) {
591
597
  Object.assign(config.env, {
592
- ...env$1,
598
+ ...env,
593
599
  ...config.env
594
600
  });
595
601
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixt/core",
3
3
  "type": "module",
4
- "version": "0.7.3",
4
+ "version": "0.8.0",
5
5
  "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://soullyoko.github.io/vixt/",
@@ -17,6 +17,7 @@
17
17
  ],
18
18
  "exports": {
19
19
  ".": "./dist/node/index.mjs",
20
+ "./cli": "./dist/cli/index.mjs",
20
21
  "./client": "./dist/client/index.js",
21
22
  "./package.json": "./package.json"
22
23
  },
@@ -28,11 +29,12 @@
28
29
  ],
29
30
  "dependencies": {
30
31
  "@types/fs-extra": "^11.0.4",
31
- "@vitejs/plugin-basic-ssl": "^2.1.3",
32
- "@vitejs/plugin-legacy": "^8.0.0-beta.0",
32
+ "@vitejs/plugin-basic-ssl": "^2.1.4",
33
+ "@vitejs/plugin-legacy": "^8.0.0-beta.1",
33
34
  "@vue/tsconfig": "^0.8.1",
34
35
  "c12": "^3.3.3",
35
36
  "cac": "^6.7.14",
37
+ "citty": "^0.2.0",
36
38
  "defu": "^6.1.4",
37
39
  "find-up": "^8.0.0",
38
40
  "fs-extra": "^11.3.3",