@vixt/core 0.1.14 → 0.1.16
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/client/index.d.mts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/index.d.mts +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.mjs +59 -56
- package/dist/shared/{core.a9343bb9.d.mts → core.3b42a3cd.d.mts} +1 -1
- package/dist/shared/{core.a9343bb9.d.ts → core.3b42a3cd.d.ts} +1 -1
- package/package.json +4 -3
package/dist/client/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { App, Plugin } from 'vue';
|
|
2
2
|
import { Router, RouteRecord } from 'vue-router';
|
|
3
3
|
import { Pinia } from 'pinia';
|
|
4
|
-
import { f as VixtAppConfig } from '../shared/core.
|
|
4
|
+
import { f as VixtAppConfig } from '../shared/core.3b42a3cd.mjs';
|
|
5
5
|
import 'vite';
|
|
6
6
|
import 'c12';
|
|
7
7
|
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { App, Plugin } from 'vue';
|
|
2
2
|
import { Router, RouteRecord } from 'vue-router';
|
|
3
3
|
import { Pinia } from 'pinia';
|
|
4
|
-
import { f as VixtAppConfig } from '../shared/core.
|
|
4
|
+
import { f as VixtAppConfig } from '../shared/core.3b42a3cd.js';
|
|
5
5
|
import 'vite';
|
|
6
6
|
import 'c12';
|
|
7
7
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as
|
|
2
|
-
export { g as ModuleMeta, P as PluginOptions, f as VixtAppConfig
|
|
1
|
+
import { V as Vixt, a as VixtModule, M as ModuleOptions, b as VixtOptions, c as VixtConfigLayer, d as VixtConfigLayerMeta, e as ModuleDefinition } from './shared/core.3b42a3cd.mjs';
|
|
2
|
+
export { g as ModuleMeta, P as PluginOptions, f as VixtAppConfig } from './shared/core.3b42a3cd.mjs';
|
|
3
3
|
import { TSConfig } from 'pkg-types';
|
|
4
4
|
import { RawVueCompilerOptions } from '@vue/language-core';
|
|
5
5
|
import Checker from 'vite-plugin-checker';
|
|
@@ -8,8 +8,6 @@ import { LoadConfigOptions } from 'c12';
|
|
|
8
8
|
import * as vite from 'vite';
|
|
9
9
|
import { PluginOption } from 'vite';
|
|
10
10
|
|
|
11
|
-
declare const alias: VixtModule<ModuleOptions>;
|
|
12
|
-
|
|
13
11
|
declare module '@vixt/core' {
|
|
14
12
|
interface VixtOptions {
|
|
15
13
|
app?: AppOptions;
|
|
@@ -76,12 +74,25 @@ declare const typescript: VixtModule<TypescriptOptions>;
|
|
|
76
74
|
|
|
77
75
|
declare function defineVixtConfig(input: VixtOptions): VixtOptions;
|
|
78
76
|
declare function loadVixtConfig(opts?: LoadConfigOptions<VixtOptions>): Promise<c12.ResolvedConfig<VixtOptions, c12.ConfigLayerMeta>>;
|
|
77
|
+
declare function applyLayers(layers: VixtConfigLayer[], config: VixtOptions): {
|
|
78
|
+
meta: VixtConfigLayerMeta;
|
|
79
|
+
cwd?: string;
|
|
80
|
+
config: VixtOptions | null;
|
|
81
|
+
source?: string;
|
|
82
|
+
sourceOptions?: c12.SourceOptions<VixtOptions, VixtConfigLayerMeta> | undefined;
|
|
83
|
+
configFile?: string;
|
|
84
|
+
}[];
|
|
85
|
+
declare function isSamePath(a: string, b: string): boolean;
|
|
79
86
|
declare function resolveLayersDirs(layers: VixtConfigLayer[] | undefined, config: VixtOptions): Record<string, string[] | undefined>;
|
|
80
87
|
|
|
81
88
|
/**
|
|
82
89
|
* Load workspace and cwd env variables by default
|
|
83
90
|
*/
|
|
84
91
|
declare function loadEnv(mode?: string, envDir?: string, prefixes?: string | string[]): ImportMeta["env"];
|
|
92
|
+
/**
|
|
93
|
+
* Load workspace env variables
|
|
94
|
+
*/
|
|
95
|
+
declare function loadWorkspaceEnv(mode?: string, prefixes?: string | string[]): Record<string, string>;
|
|
85
96
|
|
|
86
97
|
declare function defineVitePlugin<Options = any>(pluginFn: (options?: Options) => PluginOption): (options?: Options) => PluginOption;
|
|
87
98
|
declare function defineVixtModule<T extends ModuleOptions>(definition: ModuleDefinition<T> | VixtModule<T>): VixtModule<T>;
|
|
@@ -91,4 +102,4 @@ declare function applyLayerModules(layers: VixtConfigLayer[], config: VixtOption
|
|
|
91
102
|
declare function loadVixt(opts?: LoadConfigOptions<VixtOptions>): Promise<Vixt>;
|
|
92
103
|
declare function createVixtPlugin(loadOptions: LoadConfigOptions<VixtOptions>): (options?: VixtOptions | undefined) => vite.PluginOption;
|
|
93
104
|
|
|
94
|
-
export { type AppHead, type AppOptions, ModuleDefinition, ModuleOptions, type TypescriptOptions, Vixt, VixtConfigLayer, VixtModule, type VixtOptions,
|
|
105
|
+
export { type AppHead, type AppOptions, ModuleDefinition, ModuleOptions, type TypescriptOptions, Vixt, VixtConfigLayer, VixtConfigLayerMeta, VixtModule, type VixtOptions, app, applyLayerModules, applyLayers, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, resolveLayersDirs, typescript };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as
|
|
2
|
-
export { g as ModuleMeta, P as PluginOptions, f as VixtAppConfig
|
|
1
|
+
import { V as Vixt, a as VixtModule, M as ModuleOptions, b as VixtOptions, c as VixtConfigLayer, d as VixtConfigLayerMeta, e as ModuleDefinition } from './shared/core.3b42a3cd.js';
|
|
2
|
+
export { g as ModuleMeta, P as PluginOptions, f as VixtAppConfig } from './shared/core.3b42a3cd.js';
|
|
3
3
|
import { TSConfig } from 'pkg-types';
|
|
4
4
|
import { RawVueCompilerOptions } from '@vue/language-core';
|
|
5
5
|
import Checker from 'vite-plugin-checker';
|
|
@@ -8,8 +8,6 @@ import { LoadConfigOptions } from 'c12';
|
|
|
8
8
|
import * as vite from 'vite';
|
|
9
9
|
import { PluginOption } from 'vite';
|
|
10
10
|
|
|
11
|
-
declare const alias: VixtModule<ModuleOptions>;
|
|
12
|
-
|
|
13
11
|
declare module '@vixt/core' {
|
|
14
12
|
interface VixtOptions {
|
|
15
13
|
app?: AppOptions;
|
|
@@ -76,12 +74,25 @@ declare const typescript: VixtModule<TypescriptOptions>;
|
|
|
76
74
|
|
|
77
75
|
declare function defineVixtConfig(input: VixtOptions): VixtOptions;
|
|
78
76
|
declare function loadVixtConfig(opts?: LoadConfigOptions<VixtOptions>): Promise<c12.ResolvedConfig<VixtOptions, c12.ConfigLayerMeta>>;
|
|
77
|
+
declare function applyLayers(layers: VixtConfigLayer[], config: VixtOptions): {
|
|
78
|
+
meta: VixtConfigLayerMeta;
|
|
79
|
+
cwd?: string;
|
|
80
|
+
config: VixtOptions | null;
|
|
81
|
+
source?: string;
|
|
82
|
+
sourceOptions?: c12.SourceOptions<VixtOptions, VixtConfigLayerMeta> | undefined;
|
|
83
|
+
configFile?: string;
|
|
84
|
+
}[];
|
|
85
|
+
declare function isSamePath(a: string, b: string): boolean;
|
|
79
86
|
declare function resolveLayersDirs(layers: VixtConfigLayer[] | undefined, config: VixtOptions): Record<string, string[] | undefined>;
|
|
80
87
|
|
|
81
88
|
/**
|
|
82
89
|
* Load workspace and cwd env variables by default
|
|
83
90
|
*/
|
|
84
91
|
declare function loadEnv(mode?: string, envDir?: string, prefixes?: string | string[]): ImportMeta["env"];
|
|
92
|
+
/**
|
|
93
|
+
* Load workspace env variables
|
|
94
|
+
*/
|
|
95
|
+
declare function loadWorkspaceEnv(mode?: string, prefixes?: string | string[]): Record<string, string>;
|
|
85
96
|
|
|
86
97
|
declare function defineVitePlugin<Options = any>(pluginFn: (options?: Options) => PluginOption): (options?: Options) => PluginOption;
|
|
87
98
|
declare function defineVixtModule<T extends ModuleOptions>(definition: ModuleDefinition<T> | VixtModule<T>): VixtModule<T>;
|
|
@@ -91,4 +102,4 @@ declare function applyLayerModules(layers: VixtConfigLayer[], config: VixtOption
|
|
|
91
102
|
declare function loadVixt(opts?: LoadConfigOptions<VixtOptions>): Promise<Vixt>;
|
|
92
103
|
declare function createVixtPlugin(loadOptions: LoadConfigOptions<VixtOptions>): (options?: VixtOptions | undefined) => vite.PluginOption;
|
|
93
104
|
|
|
94
|
-
export { type AppHead, type AppOptions, ModuleDefinition, ModuleOptions, type TypescriptOptions, Vixt, VixtConfigLayer, VixtModule, type VixtOptions,
|
|
105
|
+
export { type AppHead, type AppOptions, ModuleDefinition, ModuleOptions, type TypescriptOptions, Vixt, VixtConfigLayer, VixtConfigLayerMeta, VixtModule, type VixtOptions, app, applyLayerModules, applyLayers, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, resolveLayersDirs, typescript };
|
package/dist/index.mjs
CHANGED
|
@@ -5,40 +5,10 @@ import { pathToFileURL } from 'mlly';
|
|
|
5
5
|
import defu from 'defu';
|
|
6
6
|
import { cwd, env } from 'node:process';
|
|
7
7
|
import { loadConfig } from 'c12';
|
|
8
|
-
import Checker from 'vite-plugin-checker';
|
|
9
|
-
import { cac } from 'cac';
|
|
10
8
|
import { loadEnv as loadEnv$1 } from 'vite';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
meta: { name: name$3 },
|
|
15
|
-
setup(_, vixt) {
|
|
16
|
-
const { rootDir, buildDir, srcDir } = vixt.options;
|
|
17
|
-
const defaultAlias = {
|
|
18
|
-
"@": srcDir,
|
|
19
|
-
"~": srcDir,
|
|
20
|
-
"@@": rootDir,
|
|
21
|
-
"~~": rootDir
|
|
22
|
-
};
|
|
23
|
-
for (const layer of vixt._layers) {
|
|
24
|
-
if (layer.meta?.alias) {
|
|
25
|
-
defaultAlias[layer.meta.alias] = layer.cwd;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
defaultAlias["#"] = buildDir;
|
|
29
|
-
return {
|
|
30
|
-
name: name$3,
|
|
31
|
-
config() {
|
|
32
|
-
return {
|
|
33
|
-
root: rootDir,
|
|
34
|
-
resolve: {
|
|
35
|
-
alias: defaultAlias
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
});
|
|
9
|
+
import { cac } from 'cac';
|
|
10
|
+
import { findUpSync } from 'find-up';
|
|
11
|
+
import Checker from 'vite-plugin-checker';
|
|
42
12
|
|
|
43
13
|
function defineVixtConfig(input) {
|
|
44
14
|
return input;
|
|
@@ -68,10 +38,9 @@ async function loadVixtConfig(opts) {
|
|
|
68
38
|
...opts?.defaults
|
|
69
39
|
}
|
|
70
40
|
});
|
|
71
|
-
result.layers = mapLayers(result.layers?.filter((e) => e.cwd) ?? [], result.config);
|
|
72
41
|
return result;
|
|
73
42
|
}
|
|
74
|
-
function
|
|
43
|
+
function applyLayers(layers, config) {
|
|
75
44
|
const { rootDir, buildLayersDir } = config;
|
|
76
45
|
return layers.map((layer) => {
|
|
77
46
|
const meta = layer.config?.meta ?? {};
|
|
@@ -93,7 +62,7 @@ function mapLayers(layers, config) {
|
|
|
93
62
|
});
|
|
94
63
|
}
|
|
95
64
|
function isSamePath(a, b) {
|
|
96
|
-
return path.
|
|
65
|
+
return path.normalize(a) === path.normalize(b);
|
|
97
66
|
}
|
|
98
67
|
function resolveLayersDirs(layers = [], config) {
|
|
99
68
|
const { srcDirName } = config;
|
|
@@ -330,6 +299,22 @@ const app = defineVixtModule({
|
|
|
330
299
|
}
|
|
331
300
|
});
|
|
332
301
|
|
|
302
|
+
function loadEnv(mode, envDir, prefixes) {
|
|
303
|
+
const parsedArgv = cac().parse();
|
|
304
|
+
mode = mode || parsedArgv.options.mode || parsedArgv.options.m || env.NODE_ENV;
|
|
305
|
+
return {
|
|
306
|
+
MODE: mode,
|
|
307
|
+
DEV: env.NODE_ENV !== "production",
|
|
308
|
+
PROD: env.NODE_ENV === "production",
|
|
309
|
+
...loadWorkspaceEnv(mode, prefixes),
|
|
310
|
+
...loadEnv$1(mode, envDir || cwd(), prefixes)
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
function loadWorkspaceEnv(mode, prefixes) {
|
|
314
|
+
const workspaceManifestLocation = findUpSync(["pnpm-workspace.yaml", "pnpm-workspace.yml"]);
|
|
315
|
+
return workspaceManifestLocation ? loadEnv$1(mode, path.dirname(workspaceManifestLocation), prefixes) : {};
|
|
316
|
+
}
|
|
317
|
+
|
|
333
318
|
const name$1 = "vixt:config";
|
|
334
319
|
const config = defineVixtModule({
|
|
335
320
|
meta: { name: name$1 },
|
|
@@ -337,8 +322,43 @@ const config = defineVixtModule({
|
|
|
337
322
|
return {
|
|
338
323
|
name: name$1,
|
|
339
324
|
enforce: "pre",
|
|
325
|
+
config(config2) {
|
|
326
|
+
const { rootDir, buildDir, srcDir } = vixt.options;
|
|
327
|
+
const defaultAlias = {
|
|
328
|
+
"@": srcDir,
|
|
329
|
+
"~": srcDir,
|
|
330
|
+
"@@": rootDir,
|
|
331
|
+
"~~": rootDir
|
|
332
|
+
};
|
|
333
|
+
for (const layer of vixt._layers) {
|
|
334
|
+
if (layer.meta?.alias) {
|
|
335
|
+
defaultAlias[layer.meta.alias] = layer.cwd;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
defaultAlias["#"] = buildDir;
|
|
339
|
+
const env = loadEnv(config2.mode, config2.envDir, config2.envPrefix);
|
|
340
|
+
const defineEnv = Object.fromEntries(
|
|
341
|
+
Object.entries(env).filter(([k]) => !["MODE", "DEV", "PROD"].includes(k)).map(([k, v]) => [`import.meta.env.${k}`, JSON.stringify(v)])
|
|
342
|
+
);
|
|
343
|
+
return {
|
|
344
|
+
root: rootDir,
|
|
345
|
+
resolve: {
|
|
346
|
+
alias: defaultAlias
|
|
347
|
+
},
|
|
348
|
+
define: defineEnv
|
|
349
|
+
};
|
|
350
|
+
},
|
|
340
351
|
configResolved(config2) {
|
|
341
352
|
vixt.options.vite = config2;
|
|
353
|
+
},
|
|
354
|
+
configureServer(server) {
|
|
355
|
+
const configFiles = vixt._layers.map((layer) => path.resolve(layer.cwd, "vixt.config.ts"));
|
|
356
|
+
server.watcher.add(configFiles);
|
|
357
|
+
server.watcher.on("change", (file) => {
|
|
358
|
+
if (configFiles.includes(path.normalize(file))) {
|
|
359
|
+
server.restart();
|
|
360
|
+
}
|
|
361
|
+
});
|
|
342
362
|
}
|
|
343
363
|
};
|
|
344
364
|
}
|
|
@@ -455,28 +475,10 @@ const typescript = defineVixtModule({
|
|
|
455
475
|
}
|
|
456
476
|
});
|
|
457
477
|
|
|
458
|
-
function loadEnv(mode, envDir, prefixes) {
|
|
459
|
-
const parsedArgv = cac().parse();
|
|
460
|
-
mode = mode || parsedArgv.options.mode || parsedArgv.options.m || env.NODE_ENV;
|
|
461
|
-
const loadedEnv = {};
|
|
462
|
-
if (envDir) {
|
|
463
|
-
Object.assign(loadedEnv, loadEnv$1(mode, envDir, prefixes));
|
|
464
|
-
} else {
|
|
465
|
-
const workspaceDir = env.INIT_CWD;
|
|
466
|
-
Object.assign(loadedEnv, loadEnv$1(mode, workspaceDir, prefixes), loadEnv$1(mode, cwd(), prefixes));
|
|
467
|
-
}
|
|
468
|
-
return {
|
|
469
|
-
MODE: mode,
|
|
470
|
-
DEV: env.NODE_ENV !== "production",
|
|
471
|
-
PROD: env.NODE_ENV === "production",
|
|
472
|
-
...loadedEnv
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
|
|
476
478
|
async function loadVixt(opts) {
|
|
477
479
|
const result = await loadVixtConfig(defu(opts, {
|
|
478
480
|
defaults: {
|
|
479
|
-
modules: [
|
|
481
|
+
modules: [config, app, typescript]
|
|
480
482
|
}
|
|
481
483
|
}));
|
|
482
484
|
const parsedArgv = cac().parse();
|
|
@@ -484,6 +486,7 @@ async function loadVixt(opts) {
|
|
|
484
486
|
if (isForce) {
|
|
485
487
|
fs.removeSync(result.config.buildDir);
|
|
486
488
|
}
|
|
489
|
+
result.layers = applyLayers(result.layers?.filter((e) => e.cwd) ?? [], result.config);
|
|
487
490
|
const layerModules = await applyLayerModules(result.layers ?? [], result.config);
|
|
488
491
|
const vixt = {
|
|
489
492
|
options: result.config,
|
|
@@ -500,4 +503,4 @@ function createVixtPlugin(loadOptions) {
|
|
|
500
503
|
});
|
|
501
504
|
}
|
|
502
505
|
|
|
503
|
-
export {
|
|
506
|
+
export { app, applyLayerModules, applyLayers, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, resolveLayersDirs, typescript };
|
|
@@ -78,4 +78,4 @@ interface VixtConfigLayer extends ConfigLayer<VixtOptions, VixtConfigLayerMeta>
|
|
|
78
78
|
interface VixtAppConfig extends Record<string, any> {
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
export type { ModuleOptions as M, PluginOptions as P,
|
|
81
|
+
export type { ModuleOptions as M, PluginOptions as P, Vixt as V, VixtModule as a, VixtOptions as b, VixtConfigLayer as c, VixtConfigLayerMeta as d, ModuleDefinition as e, VixtAppConfig as f, ModuleMeta as g };
|
|
@@ -78,4 +78,4 @@ interface VixtConfigLayer extends ConfigLayer<VixtOptions, VixtConfigLayerMeta>
|
|
|
78
78
|
interface VixtAppConfig extends Record<string, any> {
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
export type { ModuleOptions as M, PluginOptions as P,
|
|
81
|
+
export type { ModuleOptions as M, PluginOptions as P, Vixt as V, VixtModule as a, VixtOptions as b, VixtConfigLayer as c, VixtConfigLayerMeta as d, ModuleDefinition as e, VixtAppConfig as f, ModuleMeta as g };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vixt/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.16",
|
|
5
5
|
"author": "SoulLyoko<https://github.com/SoulLyoko>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/SoulLyoko/vixt#readme",
|
|
@@ -27,15 +27,16 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@types/fs-extra": "11.0.4",
|
|
29
29
|
"@vue/tsconfig": "^0.5.1",
|
|
30
|
-
"c12": "^1.11.
|
|
30
|
+
"c12": "^1.11.2",
|
|
31
31
|
"cac": "^6.7.14",
|
|
32
32
|
"defu": "^6.1.4",
|
|
33
|
+
"find-up": "^7.0.0",
|
|
33
34
|
"fs-extra": "^11.2.0",
|
|
34
35
|
"mlly": "1.7.1",
|
|
35
36
|
"pathe": "^1.1.2",
|
|
36
37
|
"pkg-types": "^1.2.0",
|
|
37
38
|
"tsx": "^4.19.0",
|
|
38
|
-
"vite": "^5.4.
|
|
39
|
+
"vite": "^5.4.3",
|
|
39
40
|
"vite-plugin-checker": "^0.7.2",
|
|
40
41
|
"vue-tsc": "2.0.26"
|
|
41
42
|
},
|