@vixt/core 0.7.4 → 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.
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.mjs +29 -0
- package/dist/node/index.mjs +10 -10
- package/package.json +5 -3
|
@@ -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 { };
|
package/dist/node/index.mjs
CHANGED
|
@@ -61,8 +61,8 @@ async function loadVixtConfig(opts) {
|
|
|
61
61
|
rcFile: false,
|
|
62
62
|
...opts
|
|
63
63
|
});
|
|
64
|
-
const { config, cwd
|
|
65
|
-
config.rootDir ??= cwd
|
|
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");
|
|
@@ -411,14 +411,14 @@ declare module '*.vue' {
|
|
|
411
411
|
const codePath = path.resolve(buildTypesDir, "vue-shim.d.ts");
|
|
412
412
|
fs.outputFileSync(codePath, code);
|
|
413
413
|
}
|
|
414
|
-
function generateEnvDts(env
|
|
414
|
+
function generateEnvDts(env, vixt) {
|
|
415
415
|
const { buildTypesDir } = vixt.options;
|
|
416
416
|
const codePath = path.resolve(buildTypesDir, "vite-env.d.ts");
|
|
417
417
|
const code = `interface ImportMeta {
|
|
418
418
|
readonly env: ImportMetaEnv
|
|
419
419
|
}
|
|
420
420
|
interface ImportMetaEnv {
|
|
421
|
-
${Object.entries(env
|
|
421
|
+
${Object.entries(env).map(([key, value]) => `/** ${key}=${value} */\n ${key}: ${typeof value}`).join("\n ")}
|
|
422
422
|
}
|
|
423
423
|
`;
|
|
424
424
|
fs.outputFileSync(codePath, code);
|
|
@@ -437,7 +437,7 @@ var typescript_default = defineVixtModule({
|
|
|
437
437
|
paths[ak] = [av];
|
|
438
438
|
if (stats?.isDirectory()) paths[`${ak}/*`] = [`${av}/*`];
|
|
439
439
|
}
|
|
440
|
-
const include = ["./**/*", ...vixt._layers.map((e) => e.cwd)];
|
|
440
|
+
const include = ["./**/*", ...vixt._layers.map((e) => `${e.cwd}/**/*`)];
|
|
441
441
|
return {
|
|
442
442
|
tsConfig: {
|
|
443
443
|
extends: "@vue/tsconfig/tsconfig.dom.json",
|
|
@@ -455,10 +455,10 @@ var typescript_default = defineVixtModule({
|
|
|
455
455
|
};
|
|
456
456
|
},
|
|
457
457
|
setup(options, vixt) {
|
|
458
|
+
generateTsConfig(options, vixt);
|
|
458
459
|
return [{
|
|
459
460
|
name: name$4,
|
|
460
461
|
configResolved(config) {
|
|
461
|
-
generateTsConfig(options, vixt);
|
|
462
462
|
generateVixtDts(options, vixt);
|
|
463
463
|
genarateShim(options, vixt);
|
|
464
464
|
generateEnvDts(config.env, vixt);
|
|
@@ -575,14 +575,14 @@ const name = "vixt:vite";
|
|
|
575
575
|
var vite_default = defineVixtModule({
|
|
576
576
|
meta: { name },
|
|
577
577
|
setup(_, vixt) {
|
|
578
|
-
let env
|
|
578
|
+
let env;
|
|
579
579
|
return {
|
|
580
580
|
name,
|
|
581
581
|
enforce: "pre",
|
|
582
582
|
config(config) {
|
|
583
583
|
const { rootDir, app } = vixt.options;
|
|
584
|
-
env
|
|
585
|
-
const defineEnv = Object.fromEntries(Object.entries(env
|
|
584
|
+
env = loadEnv(config.mode, config.envDir, config.envPrefix);
|
|
585
|
+
const defineEnv = Object.fromEntries(Object.entries(env).filter(([k]) => ![
|
|
586
586
|
"MODE",
|
|
587
587
|
"DEV",
|
|
588
588
|
"PROD"
|
|
@@ -595,7 +595,7 @@ var vite_default = defineVixtModule({
|
|
|
595
595
|
},
|
|
596
596
|
configResolved(config) {
|
|
597
597
|
Object.assign(config.env, {
|
|
598
|
-
...env
|
|
598
|
+
...env,
|
|
599
599
|
...config.env
|
|
600
600
|
});
|
|
601
601
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vixt/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
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.
|
|
32
|
-
"@vitejs/plugin-legacy": "^8.0.0-beta.
|
|
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",
|