@vixt/core 0.0.5 → 0.0.7
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/index.d.mts +10 -41
- package/dist/index.d.ts +10 -41
- package/dist/index.mjs +68 -122
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
|
-
import { PluginOption, UserConfig, TransformResult
|
|
2
|
+
import { PluginOption, UserConfig, TransformResult } from 'vite';
|
|
3
3
|
import * as c12 from 'c12';
|
|
4
4
|
import { ConfigLayer, LoadConfigOptions } from 'c12';
|
|
5
5
|
import { TSConfig } from 'pkg-types';
|
|
6
|
+
import Checker from 'vite-plugin-checker';
|
|
6
7
|
|
|
7
8
|
declare const alias: VixtModule<ModuleOptions>;
|
|
8
9
|
|
|
@@ -30,6 +31,10 @@ interface VixtModule<T extends ModuleOptions = ModuleOptions> {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
interface VixtOptions extends Record<string, any> {
|
|
34
|
+
/**
|
|
35
|
+
* @default process.cwd()
|
|
36
|
+
*/
|
|
37
|
+
rootDir?: string;
|
|
33
38
|
/**
|
|
34
39
|
* @default '.vixt'
|
|
35
40
|
*/
|
|
@@ -90,27 +95,6 @@ declare const app: VixtModule<AppOptions>;
|
|
|
90
95
|
|
|
91
96
|
declare const config: VixtModule<ModuleOptions>;
|
|
92
97
|
|
|
93
|
-
declare module '@vixt/core' {
|
|
94
|
-
interface VixtOptions {
|
|
95
|
-
devProxy?: DevProxyOptions;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
interface DevProxyOptions {
|
|
99
|
-
/**
|
|
100
|
-
* 环境变量的 key
|
|
101
|
-
* @default 'VITE_PROXY'
|
|
102
|
-
*/
|
|
103
|
-
key?: string;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* @param list [prefix,target,rewrite?][]
|
|
107
|
-
*/
|
|
108
|
-
declare function transformProxy(list: string): {
|
|
109
|
-
[k: string]: ProxyOptions;
|
|
110
|
-
};
|
|
111
|
-
/** 为 vite 开发服务添加代理配置 */
|
|
112
|
-
declare const devProxy: VixtModule<DevProxyOptions>;
|
|
113
|
-
|
|
114
98
|
declare module '@vixt/core' {
|
|
115
99
|
interface VixtOptions {
|
|
116
100
|
typescript?: TypescriptOptions;
|
|
@@ -122,28 +106,13 @@ interface TypescriptOptions {
|
|
|
122
106
|
content?: string;
|
|
123
107
|
})[];
|
|
124
108
|
tsConfig?: TSConfig;
|
|
109
|
+
/** https://github.com/fi3ework/vite-plugin-checker */
|
|
110
|
+
typeCheck?: Parameters<typeof Checker>[0];
|
|
125
111
|
}
|
|
126
112
|
declare const typescript: VixtModule<TypescriptOptions>;
|
|
127
113
|
|
|
128
|
-
declare module '@vixt/core' {
|
|
129
|
-
interface VixtOptions {
|
|
130
|
-
warmup?: WarmupOptions;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
interface WarmupOptions {
|
|
134
|
-
enabled?: boolean;
|
|
135
|
-
/**
|
|
136
|
-
* The files to be transformed and used on the client-side. Supports glob patterns.
|
|
137
|
-
*/
|
|
138
|
-
clientFiles?: string[];
|
|
139
|
-
/**
|
|
140
|
-
* The files to be transformed and used in SSR. Supports glob patterns.
|
|
141
|
-
*/
|
|
142
|
-
ssrFiles?: string[];
|
|
143
|
-
}
|
|
144
|
-
declare const warmup: VixtModule<WarmupOptions>;
|
|
145
|
-
|
|
146
114
|
declare function defineVixtConfig(input: VixtOptions): VixtOptions;
|
|
115
|
+
declare const rootDir: string;
|
|
147
116
|
declare const buildDir = ".vixt";
|
|
148
117
|
declare const buildTypesDir = ".vixt/types";
|
|
149
118
|
declare function loadVixtConfig(opts?: LoadConfigOptions<VixtOptions>): Promise<c12.ResolvedConfig<VixtOptions, c12.ConfigLayerMeta>>;
|
|
@@ -157,4 +126,4 @@ declare function applyLayerModules(layers?: VixtConfigLayer[]): Promise<VixtModu
|
|
|
157
126
|
declare function loadVixt(opts?: LoadConfigOptions<VixtOptions>): Promise<Vixt>;
|
|
158
127
|
declare function createVixtPlugin(loadOptions: LoadConfigOptions<VixtOptions>): (options?: VixtOptions | undefined) => vite.PluginOption;
|
|
159
128
|
|
|
160
|
-
export { type AppHead, type AppOptions, type
|
|
129
|
+
export { type AppHead, type AppOptions, type ModuleDefinition, type ModuleMeta, type ModuleOptions, type PluginOptions, type TypescriptOptions, type Vixt, type VixtConfigLayer, type VixtModule, type VixtOptions, alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, rootDir, typescript };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
|
-
import { PluginOption, UserConfig, TransformResult
|
|
2
|
+
import { PluginOption, UserConfig, TransformResult } from 'vite';
|
|
3
3
|
import * as c12 from 'c12';
|
|
4
4
|
import { ConfigLayer, LoadConfigOptions } from 'c12';
|
|
5
5
|
import { TSConfig } from 'pkg-types';
|
|
6
|
+
import Checker from 'vite-plugin-checker';
|
|
6
7
|
|
|
7
8
|
declare const alias: VixtModule<ModuleOptions>;
|
|
8
9
|
|
|
@@ -30,6 +31,10 @@ interface VixtModule<T extends ModuleOptions = ModuleOptions> {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
interface VixtOptions extends Record<string, any> {
|
|
34
|
+
/**
|
|
35
|
+
* @default process.cwd()
|
|
36
|
+
*/
|
|
37
|
+
rootDir?: string;
|
|
33
38
|
/**
|
|
34
39
|
* @default '.vixt'
|
|
35
40
|
*/
|
|
@@ -90,27 +95,6 @@ declare const app: VixtModule<AppOptions>;
|
|
|
90
95
|
|
|
91
96
|
declare const config: VixtModule<ModuleOptions>;
|
|
92
97
|
|
|
93
|
-
declare module '@vixt/core' {
|
|
94
|
-
interface VixtOptions {
|
|
95
|
-
devProxy?: DevProxyOptions;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
interface DevProxyOptions {
|
|
99
|
-
/**
|
|
100
|
-
* 环境变量的 key
|
|
101
|
-
* @default 'VITE_PROXY'
|
|
102
|
-
*/
|
|
103
|
-
key?: string;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* @param list [prefix,target,rewrite?][]
|
|
107
|
-
*/
|
|
108
|
-
declare function transformProxy(list: string): {
|
|
109
|
-
[k: string]: ProxyOptions;
|
|
110
|
-
};
|
|
111
|
-
/** 为 vite 开发服务添加代理配置 */
|
|
112
|
-
declare const devProxy: VixtModule<DevProxyOptions>;
|
|
113
|
-
|
|
114
98
|
declare module '@vixt/core' {
|
|
115
99
|
interface VixtOptions {
|
|
116
100
|
typescript?: TypescriptOptions;
|
|
@@ -122,28 +106,13 @@ interface TypescriptOptions {
|
|
|
122
106
|
content?: string;
|
|
123
107
|
})[];
|
|
124
108
|
tsConfig?: TSConfig;
|
|
109
|
+
/** https://github.com/fi3ework/vite-plugin-checker */
|
|
110
|
+
typeCheck?: Parameters<typeof Checker>[0];
|
|
125
111
|
}
|
|
126
112
|
declare const typescript: VixtModule<TypescriptOptions>;
|
|
127
113
|
|
|
128
|
-
declare module '@vixt/core' {
|
|
129
|
-
interface VixtOptions {
|
|
130
|
-
warmup?: WarmupOptions;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
interface WarmupOptions {
|
|
134
|
-
enabled?: boolean;
|
|
135
|
-
/**
|
|
136
|
-
* The files to be transformed and used on the client-side. Supports glob patterns.
|
|
137
|
-
*/
|
|
138
|
-
clientFiles?: string[];
|
|
139
|
-
/**
|
|
140
|
-
* The files to be transformed and used in SSR. Supports glob patterns.
|
|
141
|
-
*/
|
|
142
|
-
ssrFiles?: string[];
|
|
143
|
-
}
|
|
144
|
-
declare const warmup: VixtModule<WarmupOptions>;
|
|
145
|
-
|
|
146
114
|
declare function defineVixtConfig(input: VixtOptions): VixtOptions;
|
|
115
|
+
declare const rootDir: string;
|
|
147
116
|
declare const buildDir = ".vixt";
|
|
148
117
|
declare const buildTypesDir = ".vixt/types";
|
|
149
118
|
declare function loadVixtConfig(opts?: LoadConfigOptions<VixtOptions>): Promise<c12.ResolvedConfig<VixtOptions, c12.ConfigLayerMeta>>;
|
|
@@ -157,4 +126,4 @@ declare function applyLayerModules(layers?: VixtConfigLayer[]): Promise<VixtModu
|
|
|
157
126
|
declare function loadVixt(opts?: LoadConfigOptions<VixtOptions>): Promise<Vixt>;
|
|
158
127
|
declare function createVixtPlugin(loadOptions: LoadConfigOptions<VixtOptions>): (options?: VixtOptions | undefined) => vite.PluginOption;
|
|
159
128
|
|
|
160
|
-
export { type AppHead, type AppOptions, type
|
|
129
|
+
export { type AppHead, type AppOptions, type ModuleDefinition, type ModuleMeta, type ModuleOptions, type PluginOptions, type TypescriptOptions, type Vixt, type VixtConfigLayer, type VixtModule, type VixtOptions, alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, rootDir, typescript };
|
package/dist/index.mjs
CHANGED
|
@@ -5,15 +5,17 @@ import 'tsx/esm';
|
|
|
5
5
|
import { pathToFileURL } from 'mlly';
|
|
6
6
|
import defu from 'defu';
|
|
7
7
|
import { loadConfig } from 'c12';
|
|
8
|
+
import Checker from 'vite-plugin-checker';
|
|
8
9
|
|
|
9
|
-
const name$
|
|
10
|
+
const name$3 = "vixt:alias";
|
|
10
11
|
const alias = defineVixtModule({
|
|
11
|
-
meta: { name: name$
|
|
12
|
-
setup() {
|
|
12
|
+
meta: { name: name$3 },
|
|
13
|
+
setup(_, vixt) {
|
|
13
14
|
return {
|
|
14
|
-
name: name$
|
|
15
|
+
name: name$3,
|
|
15
16
|
config() {
|
|
16
17
|
return {
|
|
18
|
+
root: vixt.options.rootDir,
|
|
17
19
|
resolve: {
|
|
18
20
|
alias: {
|
|
19
21
|
"@": `${path.resolve(cwd(), "src")}`,
|
|
@@ -28,6 +30,42 @@ const alias = defineVixtModule({
|
|
|
28
30
|
}
|
|
29
31
|
});
|
|
30
32
|
|
|
33
|
+
function defineVixtConfig(input) {
|
|
34
|
+
return input;
|
|
35
|
+
}
|
|
36
|
+
const rootDir = cwd();
|
|
37
|
+
const buildDir = ".vixt";
|
|
38
|
+
const buildTypesDir = `${buildDir}/types`;
|
|
39
|
+
async function loadVixtConfig(opts) {
|
|
40
|
+
const result = await loadConfig({
|
|
41
|
+
name: "vixt",
|
|
42
|
+
rcFile: false,
|
|
43
|
+
...opts,
|
|
44
|
+
defaults: {
|
|
45
|
+
rootDir,
|
|
46
|
+
buildDir,
|
|
47
|
+
buildTypesDir,
|
|
48
|
+
...opts?.defaults
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
result.layers = result.layers?.filter((e) => e.cwd);
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
function resolveLayersDirs(layers = []) {
|
|
55
|
+
const dirs = {};
|
|
56
|
+
for (const layer of layers) {
|
|
57
|
+
const contents = fs.readdirSync(path.resolve(layer.cwd, "src"));
|
|
58
|
+
for (const content of contents) {
|
|
59
|
+
const fileOrDirPath = path.resolve(layer.cwd, "src", content);
|
|
60
|
+
if (fs.statSync(fileOrDirPath).isDirectory()) {
|
|
61
|
+
dirs[content] ?? (dirs[content] = []);
|
|
62
|
+
dirs[content].push(fileOrDirPath);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return dirs;
|
|
67
|
+
}
|
|
68
|
+
|
|
31
69
|
function defineVitePlugin(pluginFn) {
|
|
32
70
|
return pluginFn;
|
|
33
71
|
}
|
|
@@ -70,49 +108,18 @@ async function applyLayerModules(layers) {
|
|
|
70
108
|
return modules;
|
|
71
109
|
}
|
|
72
110
|
|
|
73
|
-
function defineVixtConfig(input) {
|
|
74
|
-
return input;
|
|
75
|
-
}
|
|
76
|
-
const buildDir = ".vixt";
|
|
77
|
-
const buildTypesDir = `${buildDir}/types`;
|
|
78
|
-
function loadVixtConfig(opts) {
|
|
79
|
-
return loadConfig({
|
|
80
|
-
name: "vixt",
|
|
81
|
-
...opts,
|
|
82
|
-
defaults: {
|
|
83
|
-
buildDir,
|
|
84
|
-
buildTypesDir,
|
|
85
|
-
...opts?.defaults
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function resolveLayersDirs(layers) {
|
|
90
|
-
const dirs = {};
|
|
91
|
-
for (const layer of layers?.filter((e) => e.cwd) ?? []) {
|
|
92
|
-
const contents = fs.readdirSync(path.resolve(layer.cwd, "src"));
|
|
93
|
-
for (const content of contents) {
|
|
94
|
-
const fileOrDirPath = path.resolve(layer.cwd, "src", content);
|
|
95
|
-
if (fs.statSync(fileOrDirPath).isDirectory()) {
|
|
96
|
-
dirs[content] ?? (dirs[content] = []);
|
|
97
|
-
dirs[content].push(fileOrDirPath);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return dirs;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
111
|
function resolveHeadTag(tag, attrs) {
|
|
105
112
|
const attrsStr = Object.entries(attrs).filter(([k]) => k !== "children").map(([k, v]) => `${k}="${v}"`).join(" ");
|
|
106
113
|
return attrs?.children ? `<${tag} ${attrsStr}>${attrs.children}</${tag}>` : `<${tag} ${attrsStr} />`;
|
|
107
114
|
}
|
|
108
|
-
function generateIndexHtml(options, vixt
|
|
109
|
-
const { buildDir: buildDir2 } = vixt.options;
|
|
115
|
+
function generateIndexHtml(options, vixt) {
|
|
116
|
+
const { buildDir: buildDir2, rootDir } = vixt.options;
|
|
110
117
|
const { head = {}, rootTag, rootId, main, loadingTemplate: loading = "" } = options || {};
|
|
111
118
|
const headTemplate = Object.entries(head).filter(([k]) => k !== "noscript").map(([tag, attrs]) => attrs.map((e) => resolveHeadTag(tag, e))).flat().join("\n");
|
|
112
119
|
const noscriptTemplate = Object.entries(head).filter(([k]) => k === "noscript").map(([tag, attrs]) => attrs.map((e) => resolveHeadTag(tag, e))).flat().join("\n");
|
|
113
120
|
let loadingTemplate = "";
|
|
114
121
|
if (/^\.|\//.test(loading)) {
|
|
115
|
-
const loadingTemplatePath = path.resolve(
|
|
122
|
+
const loadingTemplatePath = path.resolve(rootDir, loading);
|
|
116
123
|
if (fs.existsSync(loadingTemplatePath)) {
|
|
117
124
|
loadingTemplate = fs.readFileSync(loadingTemplatePath, "utf-8");
|
|
118
125
|
}
|
|
@@ -134,13 +141,14 @@ ${noscriptTemplate}
|
|
|
134
141
|
</body>
|
|
135
142
|
</html>
|
|
136
143
|
`;
|
|
137
|
-
fs.outputFileSync(path.resolve(
|
|
144
|
+
fs.outputFileSync(path.resolve(rootDir, `${buildDir2}/index.html`), code);
|
|
138
145
|
return code;
|
|
139
146
|
}
|
|
140
|
-
const name$
|
|
141
|
-
const defaults$
|
|
147
|
+
const name$2 = "vixt:app";
|
|
148
|
+
const defaults$1 = {
|
|
142
149
|
rootId: "app",
|
|
143
150
|
rootTag: "div",
|
|
151
|
+
baseURL: "/",
|
|
144
152
|
loadingTemplate: "./loading.html",
|
|
145
153
|
main: `${buildDir}/main.ts`,
|
|
146
154
|
head: {
|
|
@@ -152,14 +160,12 @@ const defaults$2 = {
|
|
|
152
160
|
}
|
|
153
161
|
};
|
|
154
162
|
const app = defineVixtModule({
|
|
155
|
-
meta: { name: name$
|
|
156
|
-
defaults: defaults$
|
|
163
|
+
meta: { name: name$2, configKey: "app" },
|
|
164
|
+
defaults: defaults$1,
|
|
157
165
|
setup(options, vixt) {
|
|
166
|
+
generateIndexHtml(options, vixt);
|
|
158
167
|
return {
|
|
159
|
-
name: name$
|
|
160
|
-
configResolved(config) {
|
|
161
|
-
generateIndexHtml(options, vixt, config);
|
|
162
|
-
},
|
|
168
|
+
name: name$2,
|
|
163
169
|
transformIndexHtml: {
|
|
164
170
|
order: "pre",
|
|
165
171
|
handler() {
|
|
@@ -179,12 +185,12 @@ const app = defineVixtModule({
|
|
|
179
185
|
}
|
|
180
186
|
});
|
|
181
187
|
|
|
182
|
-
const name$
|
|
188
|
+
const name$1 = "vixt:config";
|
|
183
189
|
const config = defineVixtModule({
|
|
184
|
-
meta: { name: name$
|
|
190
|
+
meta: { name: name$1 },
|
|
185
191
|
setup(options, vixt) {
|
|
186
192
|
return {
|
|
187
|
-
name: name$
|
|
193
|
+
name: name$1,
|
|
188
194
|
enforce: "pre",
|
|
189
195
|
config(config2) {
|
|
190
196
|
vixt.options.vite = config2;
|
|
@@ -196,41 +202,6 @@ const config = defineVixtModule({
|
|
|
196
202
|
}
|
|
197
203
|
});
|
|
198
204
|
|
|
199
|
-
function transformProxy(list) {
|
|
200
|
-
return Object.fromEntries(
|
|
201
|
-
JSON.parse(list).map(([prefix, target, rewrite]) => {
|
|
202
|
-
const option = {
|
|
203
|
-
target,
|
|
204
|
-
changeOrigin: true,
|
|
205
|
-
ws: true,
|
|
206
|
-
secure: /^https:\/\//.test(target)
|
|
207
|
-
};
|
|
208
|
-
if (rewrite)
|
|
209
|
-
option.rewrite = (path) => path.replace(new RegExp(`^${prefix}`), "");
|
|
210
|
-
return [prefix, option];
|
|
211
|
-
})
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
const name$2 = "vixt:dev-proxy";
|
|
215
|
-
const devProxy = defineVixtModule({
|
|
216
|
-
meta: { name: name$2, configKey: "devProxy" },
|
|
217
|
-
defaults: { key: "VITE_PROXY" },
|
|
218
|
-
setup(options) {
|
|
219
|
-
return {
|
|
220
|
-
name: name$2,
|
|
221
|
-
configResolved(config) {
|
|
222
|
-
const { env } = config;
|
|
223
|
-
const proxyList = env[options.key];
|
|
224
|
-
if (proxyList) {
|
|
225
|
-
const proxy = transformProxy(proxyList);
|
|
226
|
-
config.server.proxy = defu(proxy, config.server.proxy);
|
|
227
|
-
config.preview.proxy = defu(proxy, config.server.proxy);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
|
|
234
205
|
function generateDts(options, vixt, config) {
|
|
235
206
|
const { root } = config;
|
|
236
207
|
const { buildDir } = vixt.options;
|
|
@@ -251,7 +222,7 @@ function generateTsConfig(options, vixt, config) {
|
|
|
251
222
|
const { root } = config;
|
|
252
223
|
const { buildDir } = vixt.options;
|
|
253
224
|
const tsConfigPath = path.resolve(root, buildDir, "tsconfig.json");
|
|
254
|
-
const layersDirs = vixt._layers.
|
|
225
|
+
const layersDirs = vixt._layers.map((e) => e.cwd);
|
|
255
226
|
const tsConfig = defu(options.tsConfig, { include: layersDirs });
|
|
256
227
|
fs.outputFileSync(tsConfigPath, JSON.stringify(tsConfig, null, 2));
|
|
257
228
|
}
|
|
@@ -284,8 +255,8 @@ declare module '*.vue' {
|
|
|
284
255
|
const shimsDtsPath = path.resolve(root, buildDir, "types", "shims.d.ts");
|
|
285
256
|
fs.outputFileSync(shimsDtsPath, shimsDts);
|
|
286
257
|
}
|
|
287
|
-
const name
|
|
288
|
-
const defaults
|
|
258
|
+
const name = "vixt:typescript";
|
|
259
|
+
const defaults = {
|
|
289
260
|
references: ["./types/vite-env.d.ts", "./types/shims.d.ts"],
|
|
290
261
|
tsConfig: {
|
|
291
262
|
extends: "@vue/tsconfig/tsconfig.dom.json",
|
|
@@ -301,57 +272,32 @@ const defaults$1 = {
|
|
|
301
272
|
include: [
|
|
302
273
|
"./**/*"
|
|
303
274
|
]
|
|
304
|
-
}
|
|
305
|
-
|
|
275
|
+
},
|
|
276
|
+
typeCheck: { enableBuild: false, overlay: { initialIsOpen: false } }
|
|
306
277
|
};
|
|
307
278
|
const typescript = defineVixtModule({
|
|
308
|
-
meta: { name
|
|
309
|
-
defaults
|
|
279
|
+
meta: { name, configKey: "typescript" },
|
|
280
|
+
defaults,
|
|
310
281
|
setup(options, vixt) {
|
|
311
282
|
return [
|
|
312
283
|
{
|
|
313
|
-
name
|
|
284
|
+
name,
|
|
314
285
|
configResolved(config) {
|
|
315
286
|
generateDts(options, vixt, config);
|
|
316
287
|
generateTsConfig(options, vixt, config);
|
|
317
288
|
generateEnvDts(options, vixt, config);
|
|
318
289
|
genarateShims(options, vixt, config);
|
|
319
290
|
}
|
|
320
|
-
}
|
|
321
|
-
|
|
291
|
+
},
|
|
292
|
+
Checker(options.typeCheck ?? {})
|
|
322
293
|
];
|
|
323
294
|
}
|
|
324
295
|
});
|
|
325
296
|
|
|
326
|
-
const defaults = {
|
|
327
|
-
enabled: true,
|
|
328
|
-
clientFiles: ["./index.html", "./src/**/*.vue", "./src/**/*.ts", "./src/**/*.tsx"],
|
|
329
|
-
ssrFiles: ["./index.html", "./src/**/*.vue", "./src/**/*.ts", "./src/**/*.tsx"]
|
|
330
|
-
};
|
|
331
|
-
const name = "vixt:warmup";
|
|
332
|
-
const warmup = defineVixtModule({
|
|
333
|
-
meta: { name, configKey: "warmup" },
|
|
334
|
-
defaults,
|
|
335
|
-
setup(options) {
|
|
336
|
-
return {
|
|
337
|
-
name,
|
|
338
|
-
config() {
|
|
339
|
-
if (!options.enabled)
|
|
340
|
-
return;
|
|
341
|
-
return {
|
|
342
|
-
server: {
|
|
343
|
-
warmup: options
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
|
|
351
297
|
async function loadVixt(opts) {
|
|
352
298
|
const result = await loadVixtConfig(defu(opts, {
|
|
353
299
|
defaults: {
|
|
354
|
-
modules: [alias, app, config,
|
|
300
|
+
modules: [alias, app, config, typescript]
|
|
355
301
|
}
|
|
356
302
|
}));
|
|
357
303
|
const layerModules = await applyLayerModules(result.layers);
|
|
@@ -370,4 +316,4 @@ function createVixtPlugin(loadOptions) {
|
|
|
370
316
|
});
|
|
371
317
|
}
|
|
372
318
|
|
|
373
|
-
export { alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule,
|
|
319
|
+
export { alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, rootDir, typescript };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vixt/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.7",
|
|
5
5
|
"author": "SoulLyoko<https://github.com/SoulLyoko>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/SoulLyoko/vixt#readme",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"fs-extra": "^11.2.0",
|
|
26
26
|
"mlly": "1.7.1",
|
|
27
27
|
"pathe": "^1.1.2",
|
|
28
|
-
"pkg-types": "^1.1.
|
|
28
|
+
"pkg-types": "^1.1.2",
|
|
29
29
|
"tsx": "^4.16.0",
|
|
30
30
|
"vite": "^5.3.2",
|
|
31
|
-
"vite-plugin-checker": "^0.
|
|
32
|
-
"vue-tsc": "^
|
|
31
|
+
"vite-plugin-checker": "^0.7.0",
|
|
32
|
+
"vue-tsc": "^2.0.24"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "unbuild"
|