@vixt/core 0.1.13 → 0.1.15
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 +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.mjs +55 -46
- package/dist/shared/{core.a9343bb9.d.mts → core.c818f21a.d.mts} +1 -1
- package/dist/shared/{core.a9343bb9.d.ts → core.c818f21a.d.ts} +1 -1
- package/package.json +1 -1
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.c818f21a.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.c818f21a.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, e as VixtConfigLayerMeta } from './shared/core.
|
|
1
|
+
import { V as Vixt, a as VixtModule, M as ModuleOptions, b as VixtOptions, c as VixtConfigLayer, d as ModuleDefinition } from './shared/core.c818f21a.mjs';
|
|
2
|
+
export { g as ModuleMeta, P as PluginOptions, f as VixtAppConfig, e as VixtConfigLayerMeta } from './shared/core.c818f21a.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,9 +74,17 @@ 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 isSamePath(a: string, b: string): boolean;
|
|
79
78
|
declare function resolveLayersDirs(layers: VixtConfigLayer[] | undefined, config: VixtOptions): Record<string, string[] | undefined>;
|
|
80
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Load workspace and cwd env variables by default
|
|
82
|
+
*/
|
|
81
83
|
declare function loadEnv(mode?: string, envDir?: string, prefixes?: string | string[]): ImportMeta["env"];
|
|
84
|
+
/**
|
|
85
|
+
* Load workspace env variables
|
|
86
|
+
*/
|
|
87
|
+
declare function loadWorkspaceEnv(mode?: string, prefixes?: string | string[]): Record<string, string>;
|
|
82
88
|
|
|
83
89
|
declare function defineVitePlugin<Options = any>(pluginFn: (options?: Options) => PluginOption): (options?: Options) => PluginOption;
|
|
84
90
|
declare function defineVixtModule<T extends ModuleOptions>(definition: ModuleDefinition<T> | VixtModule<T>): VixtModule<T>;
|
|
@@ -88,4 +94,4 @@ declare function applyLayerModules(layers: VixtConfigLayer[], config: VixtOption
|
|
|
88
94
|
declare function loadVixt(opts?: LoadConfigOptions<VixtOptions>): Promise<Vixt>;
|
|
89
95
|
declare function createVixtPlugin(loadOptions: LoadConfigOptions<VixtOptions>): (options?: VixtOptions | undefined) => vite.PluginOption;
|
|
90
96
|
|
|
91
|
-
export { type AppHead, type AppOptions, ModuleDefinition, ModuleOptions, type TypescriptOptions, Vixt, VixtConfigLayer, VixtModule, type VixtOptions,
|
|
97
|
+
export { type AppHead, type AppOptions, ModuleDefinition, ModuleOptions, type TypescriptOptions, Vixt, VixtConfigLayer, VixtModule, type VixtOptions, app, applyLayerModules, 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, e as VixtConfigLayerMeta } from './shared/core.
|
|
1
|
+
import { V as Vixt, a as VixtModule, M as ModuleOptions, b as VixtOptions, c as VixtConfigLayer, d as ModuleDefinition } from './shared/core.c818f21a.js';
|
|
2
|
+
export { g as ModuleMeta, P as PluginOptions, f as VixtAppConfig, e as VixtConfigLayerMeta } from './shared/core.c818f21a.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,9 +74,17 @@ 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 isSamePath(a: string, b: string): boolean;
|
|
79
78
|
declare function resolveLayersDirs(layers: VixtConfigLayer[] | undefined, config: VixtOptions): Record<string, string[] | undefined>;
|
|
80
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Load workspace and cwd env variables by default
|
|
82
|
+
*/
|
|
81
83
|
declare function loadEnv(mode?: string, envDir?: string, prefixes?: string | string[]): ImportMeta["env"];
|
|
84
|
+
/**
|
|
85
|
+
* Load workspace env variables
|
|
86
|
+
*/
|
|
87
|
+
declare function loadWorkspaceEnv(mode?: string, prefixes?: string | string[]): Record<string, string>;
|
|
82
88
|
|
|
83
89
|
declare function defineVitePlugin<Options = any>(pluginFn: (options?: Options) => PluginOption): (options?: Options) => PluginOption;
|
|
84
90
|
declare function defineVixtModule<T extends ModuleOptions>(definition: ModuleDefinition<T> | VixtModule<T>): VixtModule<T>;
|
|
@@ -88,4 +94,4 @@ declare function applyLayerModules(layers: VixtConfigLayer[], config: VixtOption
|
|
|
88
94
|
declare function loadVixt(opts?: LoadConfigOptions<VixtOptions>): Promise<Vixt>;
|
|
89
95
|
declare function createVixtPlugin(loadOptions: LoadConfigOptions<VixtOptions>): (options?: VixtOptions | undefined) => vite.PluginOption;
|
|
90
96
|
|
|
91
|
-
export { type AppHead, type AppOptions, ModuleDefinition, ModuleOptions, type TypescriptOptions, Vixt, VixtConfigLayer, VixtModule, type VixtOptions,
|
|
97
|
+
export { type AppHead, type AppOptions, ModuleDefinition, ModuleOptions, type TypescriptOptions, Vixt, VixtConfigLayer, VixtModule, type VixtOptions, app, applyLayerModules, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, installModule, isSamePath, loadEnv, loadVixt, loadVixtConfig, loadWorkspaceEnv, resolveLayersDirs, typescript };
|
package/dist/index.mjs
CHANGED
|
@@ -5,40 +5,9 @@ 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
8
|
import { cac } from 'cac';
|
|
10
9
|
import { loadEnv as loadEnv$1 } from 'vite';
|
|
11
|
-
|
|
12
|
-
const name$3 = "vixt:alias";
|
|
13
|
-
const alias = defineVixtModule({
|
|
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
|
-
});
|
|
10
|
+
import Checker from 'vite-plugin-checker';
|
|
42
11
|
|
|
43
12
|
function defineVixtConfig(input) {
|
|
44
13
|
return input;
|
|
@@ -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,21 @@ 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
|
+
return env.INIT_CWD ? loadEnv$1(mode, env.INIT_CWD, prefixes) : {};
|
|
315
|
+
}
|
|
316
|
+
|
|
333
317
|
const name$1 = "vixt:config";
|
|
334
318
|
const config = defineVixtModule({
|
|
335
319
|
meta: { name: name$1 },
|
|
@@ -337,8 +321,39 @@ const config = defineVixtModule({
|
|
|
337
321
|
return {
|
|
338
322
|
name: name$1,
|
|
339
323
|
enforce: "pre",
|
|
324
|
+
config() {
|
|
325
|
+
const { rootDir, buildDir, srcDir } = vixt.options;
|
|
326
|
+
const defaultAlias = {
|
|
327
|
+
"@": srcDir,
|
|
328
|
+
"~": srcDir,
|
|
329
|
+
"@@": rootDir,
|
|
330
|
+
"~~": rootDir
|
|
331
|
+
};
|
|
332
|
+
for (const layer of vixt._layers) {
|
|
333
|
+
if (layer.meta?.alias) {
|
|
334
|
+
defaultAlias[layer.meta.alias] = layer.cwd;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
defaultAlias["#"] = buildDir;
|
|
338
|
+
return {
|
|
339
|
+
root: rootDir,
|
|
340
|
+
resolve: {
|
|
341
|
+
alias: defaultAlias
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
},
|
|
340
345
|
configResolved(config2) {
|
|
346
|
+
Object.assign(config2.env, { ...loadWorkspaceEnv(config2.mode, config2.envPrefix), ...config2.env });
|
|
341
347
|
vixt.options.vite = config2;
|
|
348
|
+
},
|
|
349
|
+
configureServer(server) {
|
|
350
|
+
const configFiles = vixt._layers.map((layer) => path.resolve(layer.cwd, "vixt.config.ts"));
|
|
351
|
+
server.watcher.add(configFiles);
|
|
352
|
+
server.watcher.on("change", (file) => {
|
|
353
|
+
if (configFiles.includes(path.normalize(file))) {
|
|
354
|
+
server.restart();
|
|
355
|
+
}
|
|
356
|
+
});
|
|
342
357
|
}
|
|
343
358
|
};
|
|
344
359
|
}
|
|
@@ -455,23 +470,17 @@ const typescript = defineVixtModule({
|
|
|
455
470
|
}
|
|
456
471
|
});
|
|
457
472
|
|
|
458
|
-
function loadEnv(mode, envDir, prefixes) {
|
|
459
|
-
const parsedArgv = cac().parse();
|
|
460
|
-
mode = mode || parsedArgv.options.mode || parsedArgv.options.m || env.NODE_ENV;
|
|
461
|
-
return {
|
|
462
|
-
MODE: mode,
|
|
463
|
-
DEV: env.NODE_ENV !== "production",
|
|
464
|
-
PROD: env.NODE_ENV === "production",
|
|
465
|
-
...loadEnv$1(mode, envDir || cwd(), prefixes)
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
|
-
|
|
469
473
|
async function loadVixt(opts) {
|
|
470
474
|
const result = await loadVixtConfig(defu(opts, {
|
|
471
475
|
defaults: {
|
|
472
|
-
modules: [
|
|
476
|
+
modules: [config, app, typescript]
|
|
473
477
|
}
|
|
474
478
|
}));
|
|
479
|
+
const parsedArgv = cac().parse();
|
|
480
|
+
const isForce = !!parsedArgv.options.force;
|
|
481
|
+
if (isForce) {
|
|
482
|
+
fs.removeSync(result.config.buildDir);
|
|
483
|
+
}
|
|
475
484
|
const layerModules = await applyLayerModules(result.layers ?? [], result.config);
|
|
476
485
|
const vixt = {
|
|
477
486
|
options: result.config,
|
|
@@ -488,4 +497,4 @@ function createVixtPlugin(loadOptions) {
|
|
|
488
497
|
});
|
|
489
498
|
}
|
|
490
499
|
|
|
491
|
-
export {
|
|
500
|
+
export { app, applyLayerModules, 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, ModuleDefinition as d, VixtConfigLayerMeta 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, ModuleDefinition as d, VixtConfigLayerMeta as e, VixtAppConfig as f, ModuleMeta as g };
|