@vixt/core 0.0.5 → 0.0.6
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 +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.mjs +15 -13
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ import { PluginOption, UserConfig, TransformResult, ProxyOptions } 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
|
*/
|
|
@@ -122,6 +127,8 @@ interface TypescriptOptions {
|
|
|
122
127
|
content?: string;
|
|
123
128
|
})[];
|
|
124
129
|
tsConfig?: TSConfig;
|
|
130
|
+
/** https://github.com/fi3ework/vite-plugin-checker */
|
|
131
|
+
typeCheck?: Parameters<typeof Checker>[0];
|
|
125
132
|
}
|
|
126
133
|
declare const typescript: VixtModule<TypescriptOptions>;
|
|
127
134
|
|
|
@@ -144,6 +151,7 @@ interface WarmupOptions {
|
|
|
144
151
|
declare const warmup: VixtModule<WarmupOptions>;
|
|
145
152
|
|
|
146
153
|
declare function defineVixtConfig(input: VixtOptions): VixtOptions;
|
|
154
|
+
declare const rootDir: string;
|
|
147
155
|
declare const buildDir = ".vixt";
|
|
148
156
|
declare const buildTypesDir = ".vixt/types";
|
|
149
157
|
declare function loadVixtConfig(opts?: LoadConfigOptions<VixtOptions>): Promise<c12.ResolvedConfig<VixtOptions, c12.ConfigLayerMeta>>;
|
|
@@ -157,4 +165,4 @@ declare function applyLayerModules(layers?: VixtConfigLayer[]): Promise<VixtModu
|
|
|
157
165
|
declare function loadVixt(opts?: LoadConfigOptions<VixtOptions>): Promise<Vixt>;
|
|
158
166
|
declare function createVixtPlugin(loadOptions: LoadConfigOptions<VixtOptions>): (options?: VixtOptions | undefined) => vite.PluginOption;
|
|
159
167
|
|
|
160
|
-
export { type AppHead, type AppOptions, type DevProxyOptions, type ModuleDefinition, type ModuleMeta, type ModuleOptions, type PluginOptions, type TypescriptOptions, type Vixt, type VixtConfigLayer, type VixtModule, type VixtOptions, type WarmupOptions, alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, devProxy, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, transformProxy, typescript, warmup };
|
|
168
|
+
export { type AppHead, type AppOptions, type DevProxyOptions, type ModuleDefinition, type ModuleMeta, type ModuleOptions, type PluginOptions, type TypescriptOptions, type Vixt, type VixtConfigLayer, type VixtModule, type VixtOptions, type WarmupOptions, alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, devProxy, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, rootDir, transformProxy, typescript, warmup };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { PluginOption, UserConfig, TransformResult, ProxyOptions } 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
|
*/
|
|
@@ -122,6 +127,8 @@ interface TypescriptOptions {
|
|
|
122
127
|
content?: string;
|
|
123
128
|
})[];
|
|
124
129
|
tsConfig?: TSConfig;
|
|
130
|
+
/** https://github.com/fi3ework/vite-plugin-checker */
|
|
131
|
+
typeCheck?: Parameters<typeof Checker>[0];
|
|
125
132
|
}
|
|
126
133
|
declare const typescript: VixtModule<TypescriptOptions>;
|
|
127
134
|
|
|
@@ -144,6 +151,7 @@ interface WarmupOptions {
|
|
|
144
151
|
declare const warmup: VixtModule<WarmupOptions>;
|
|
145
152
|
|
|
146
153
|
declare function defineVixtConfig(input: VixtOptions): VixtOptions;
|
|
154
|
+
declare const rootDir: string;
|
|
147
155
|
declare const buildDir = ".vixt";
|
|
148
156
|
declare const buildTypesDir = ".vixt/types";
|
|
149
157
|
declare function loadVixtConfig(opts?: LoadConfigOptions<VixtOptions>): Promise<c12.ResolvedConfig<VixtOptions, c12.ConfigLayerMeta>>;
|
|
@@ -157,4 +165,4 @@ declare function applyLayerModules(layers?: VixtConfigLayer[]): Promise<VixtModu
|
|
|
157
165
|
declare function loadVixt(opts?: LoadConfigOptions<VixtOptions>): Promise<Vixt>;
|
|
158
166
|
declare function createVixtPlugin(loadOptions: LoadConfigOptions<VixtOptions>): (options?: VixtOptions | undefined) => vite.PluginOption;
|
|
159
167
|
|
|
160
|
-
export { type AppHead, type AppOptions, type DevProxyOptions, type ModuleDefinition, type ModuleMeta, type ModuleOptions, type PluginOptions, type TypescriptOptions, type Vixt, type VixtConfigLayer, type VixtModule, type VixtOptions, type WarmupOptions, alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, devProxy, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, transformProxy, typescript, warmup };
|
|
168
|
+
export { type AppHead, type AppOptions, type DevProxyOptions, type ModuleDefinition, type ModuleMeta, type ModuleOptions, type PluginOptions, type TypescriptOptions, type Vixt, type VixtConfigLayer, type VixtModule, type VixtOptions, type WarmupOptions, alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, devProxy, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, rootDir, transformProxy, typescript, warmup };
|
package/dist/index.mjs
CHANGED
|
@@ -4,16 +4,18 @@ import fs from 'fs-extra';
|
|
|
4
4
|
import 'tsx/esm';
|
|
5
5
|
import { pathToFileURL } from 'mlly';
|
|
6
6
|
import defu from 'defu';
|
|
7
|
+
import Checker from 'vite-plugin-checker';
|
|
7
8
|
import { loadConfig } from 'c12';
|
|
8
9
|
|
|
9
10
|
const name$5 = "vixt:alias";
|
|
10
11
|
const alias = defineVixtModule({
|
|
11
12
|
meta: { name: name$5 },
|
|
12
|
-
setup() {
|
|
13
|
+
setup(_, vixt) {
|
|
13
14
|
return {
|
|
14
15
|
name: name$5,
|
|
15
16
|
config() {
|
|
16
17
|
return {
|
|
18
|
+
root: vixt.options.rootDir,
|
|
17
19
|
resolve: {
|
|
18
20
|
alias: {
|
|
19
21
|
"@": `${path.resolve(cwd(), "src")}`,
|
|
@@ -73,6 +75,7 @@ async function applyLayerModules(layers) {
|
|
|
73
75
|
function defineVixtConfig(input) {
|
|
74
76
|
return input;
|
|
75
77
|
}
|
|
78
|
+
const rootDir = cwd();
|
|
76
79
|
const buildDir = ".vixt";
|
|
77
80
|
const buildTypesDir = `${buildDir}/types`;
|
|
78
81
|
function loadVixtConfig(opts) {
|
|
@@ -80,6 +83,7 @@ function loadVixtConfig(opts) {
|
|
|
80
83
|
name: "vixt",
|
|
81
84
|
...opts,
|
|
82
85
|
defaults: {
|
|
86
|
+
rootDir,
|
|
83
87
|
buildDir,
|
|
84
88
|
buildTypesDir,
|
|
85
89
|
...opts?.defaults
|
|
@@ -105,14 +109,14 @@ function resolveHeadTag(tag, attrs) {
|
|
|
105
109
|
const attrsStr = Object.entries(attrs).filter(([k]) => k !== "children").map(([k, v]) => `${k}="${v}"`).join(" ");
|
|
106
110
|
return attrs?.children ? `<${tag} ${attrsStr}>${attrs.children}</${tag}>` : `<${tag} ${attrsStr} />`;
|
|
107
111
|
}
|
|
108
|
-
function generateIndexHtml(options, vixt
|
|
109
|
-
const { buildDir: buildDir2 } = vixt.options;
|
|
112
|
+
function generateIndexHtml(options, vixt) {
|
|
113
|
+
const { buildDir: buildDir2, rootDir } = vixt.options;
|
|
110
114
|
const { head = {}, rootTag, rootId, main, loadingTemplate: loading = "" } = options || {};
|
|
111
115
|
const headTemplate = Object.entries(head).filter(([k]) => k !== "noscript").map(([tag, attrs]) => attrs.map((e) => resolveHeadTag(tag, e))).flat().join("\n");
|
|
112
116
|
const noscriptTemplate = Object.entries(head).filter(([k]) => k === "noscript").map(([tag, attrs]) => attrs.map((e) => resolveHeadTag(tag, e))).flat().join("\n");
|
|
113
117
|
let loadingTemplate = "";
|
|
114
118
|
if (/^\.|\//.test(loading)) {
|
|
115
|
-
const loadingTemplatePath = path.resolve(
|
|
119
|
+
const loadingTemplatePath = path.resolve(rootDir, loading);
|
|
116
120
|
if (fs.existsSync(loadingTemplatePath)) {
|
|
117
121
|
loadingTemplate = fs.readFileSync(loadingTemplatePath, "utf-8");
|
|
118
122
|
}
|
|
@@ -134,7 +138,7 @@ ${noscriptTemplate}
|
|
|
134
138
|
</body>
|
|
135
139
|
</html>
|
|
136
140
|
`;
|
|
137
|
-
fs.outputFileSync(path.resolve(
|
|
141
|
+
fs.outputFileSync(path.resolve(rootDir, `${buildDir2}/index.html`), code);
|
|
138
142
|
return code;
|
|
139
143
|
}
|
|
140
144
|
const name$4 = "vixt:app";
|
|
@@ -155,11 +159,9 @@ const app = defineVixtModule({
|
|
|
155
159
|
meta: { name: name$4, configKey: "app" },
|
|
156
160
|
defaults: defaults$2,
|
|
157
161
|
setup(options, vixt) {
|
|
162
|
+
generateIndexHtml(options, vixt);
|
|
158
163
|
return {
|
|
159
164
|
name: name$4,
|
|
160
|
-
configResolved(config) {
|
|
161
|
-
generateIndexHtml(options, vixt, config);
|
|
162
|
-
},
|
|
163
165
|
transformIndexHtml: {
|
|
164
166
|
order: "pre",
|
|
165
167
|
handler() {
|
|
@@ -301,8 +303,8 @@ const defaults$1 = {
|
|
|
301
303
|
include: [
|
|
302
304
|
"./**/*"
|
|
303
305
|
]
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
+
},
|
|
307
|
+
typeCheck: { enableBuild: false, overlay: { initialIsOpen: false } }
|
|
306
308
|
};
|
|
307
309
|
const typescript = defineVixtModule({
|
|
308
310
|
meta: { name: name$1, configKey: "typescript" },
|
|
@@ -317,8 +319,8 @@ const typescript = defineVixtModule({
|
|
|
317
319
|
generateEnvDts(options, vixt, config);
|
|
318
320
|
genarateShims(options, vixt, config);
|
|
319
321
|
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
+
},
|
|
323
|
+
Checker(options.typeCheck ?? {})
|
|
322
324
|
];
|
|
323
325
|
}
|
|
324
326
|
});
|
|
@@ -370,4 +372,4 @@ function createVixtPlugin(loadOptions) {
|
|
|
370
372
|
});
|
|
371
373
|
}
|
|
372
374
|
|
|
373
|
-
export { alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, devProxy, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, transformProxy, typescript, warmup };
|
|
375
|
+
export { alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, devProxy, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, rootDir, transformProxy, typescript, warmup };
|
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.6",
|
|
5
5
|
"author": "SoulLyoko<https://github.com/SoulLyoko>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/SoulLyoko/vixt#readme",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"pkg-types": "^1.1.1",
|
|
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"
|