@quiteer/vite 0.1.7 → 0.1.8
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/bin/qvite.mjs +22 -11
- package/dist/index.d.mts +2 -0
- package/package.json +4 -4
- package/uno.config.ts +13 -1
package/dist/bin/qvite.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { cac } from "cac";
|
|
|
3
3
|
import { build, createServer, loadEnv, mergeConfig } from "vite";
|
|
4
4
|
import UnoCSS from "@quiteer/unocss";
|
|
5
5
|
import { PersistentStore, deepMerge } from "@quiteer/utils";
|
|
6
|
-
import { AutoImport, Components, Icons, IconsResolver, NaiveUiResolver, Progress, Vue, VueDevTools, VueJsx, bootstrapEnv, createSvgIconsPlugin, envConfigPlugin, fileChangeLoggerPlugin, mockRouterPlugin, removeConsolePlugin, virtualHtmlPlugin } from "@quiteer/vite-plugins";
|
|
6
|
+
import { AutoImport, Components, FileSystemIconLoader, Icons, IconsResolver, NaiveUiResolver, Progress, Vue, VueDevTools, VueJsx, bootstrapEnv, createSvgIconsPlugin, envConfigPlugin, fileChangeLoggerPlugin, mockRouterPlugin, removeConsolePlugin, virtualHtmlPlugin } from "@quiteer/vite-plugins";
|
|
7
7
|
import path, { join, resolve } from "node:path";
|
|
8
8
|
import { cwd } from "node:process";
|
|
9
9
|
import { isFunction } from "@quiteer/is";
|
|
@@ -13,7 +13,7 @@ import { setTimeout } from "node:timers/promises";
|
|
|
13
13
|
import { getPortPromise } from "portfinder";
|
|
14
14
|
|
|
15
15
|
//#region package.json
|
|
16
|
-
var version = "0.1.
|
|
16
|
+
var version = "0.1.8";
|
|
17
17
|
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/store.ts
|
|
@@ -25,13 +25,16 @@ store.set("mode", "development");
|
|
|
25
25
|
store.set("env", {});
|
|
26
26
|
store.set("minify", false);
|
|
27
27
|
store.set("port", 8080);
|
|
28
|
-
store.set("prefixes", ["QVITE_", "VITE_"]);
|
|
29
28
|
|
|
30
29
|
//#endregion
|
|
31
30
|
//#region src/defaults.ts
|
|
32
|
-
function getDefaultOptions() {
|
|
31
|
+
function getDefaultOptions(config) {
|
|
33
32
|
const root$1 = store.get("root");
|
|
33
|
+
const minify = store.get("minify");
|
|
34
|
+
const localIconDir = config.localIconDir || "src/assets/icons";
|
|
34
35
|
return {
|
|
36
|
+
minify,
|
|
37
|
+
localIconDir,
|
|
35
38
|
UnoCSS: false,
|
|
36
39
|
plugins: {
|
|
37
40
|
Vue: [{ customElement: true }],
|
|
@@ -41,7 +44,12 @@ function getDefaultOptions() {
|
|
|
41
44
|
FileChangeLogger: false,
|
|
42
45
|
RemoveConsole: false,
|
|
43
46
|
MockRouter: false,
|
|
44
|
-
Icons:
|
|
47
|
+
Icons: [{
|
|
48
|
+
compiler: "vue3",
|
|
49
|
+
customCollections: { local: FileSystemIconLoader(resolve(root$1, localIconDir), (svg) => svg.replace(/^<svg\s/, "<svg width=\"1em\" height=\"1em\" ")) },
|
|
50
|
+
scale: 1,
|
|
51
|
+
defaultClass: "inline-block"
|
|
52
|
+
}],
|
|
45
53
|
SvgIcons: false,
|
|
46
54
|
AutoImport: [{ imports: [
|
|
47
55
|
"vue",
|
|
@@ -72,11 +80,12 @@ function getDefaultOptions() {
|
|
|
72
80
|
vite: {
|
|
73
81
|
server: {
|
|
74
82
|
port: 3e3,
|
|
83
|
+
host: "0.0.0.0",
|
|
75
84
|
open: false,
|
|
76
85
|
strictPort: false
|
|
77
86
|
},
|
|
78
87
|
resolve: { alias: { "@": resolve(root$1, "src") } },
|
|
79
|
-
build: { minify
|
|
88
|
+
build: { minify }
|
|
80
89
|
}
|
|
81
90
|
};
|
|
82
91
|
}
|
|
@@ -125,7 +134,7 @@ function withUnoInjection(config) {
|
|
|
125
134
|
return next;
|
|
126
135
|
}
|
|
127
136
|
async function normalizeConfig(raw) {
|
|
128
|
-
return deepMerge(getDefaultOptions(), raw);
|
|
137
|
+
return deepMerge(getDefaultOptions(raw), raw);
|
|
129
138
|
}
|
|
130
139
|
function geVitePlugins(config) {
|
|
131
140
|
const { env, plugins } = config;
|
|
@@ -208,12 +217,13 @@ async function getConfig(filePath) {
|
|
|
208
217
|
const path$1 = await configPath(filePath);
|
|
209
218
|
const command = store.get("command");
|
|
210
219
|
const mode = store.get("mode");
|
|
220
|
+
const includePrefixes = ["QVITE_", "VITE_"];
|
|
211
221
|
await bootstrapEnv({
|
|
212
222
|
mode,
|
|
213
|
-
includePrefixes
|
|
223
|
+
includePrefixes
|
|
214
224
|
});
|
|
215
|
-
const modeEnv = loadEnv(mode, root,
|
|
216
|
-
const env = deepMerge({}, loadEnv("", root,
|
|
225
|
+
const modeEnv = loadEnv(mode, root, includePrefixes);
|
|
226
|
+
const env = deepMerge({}, loadEnv("", root, includePrefixes), modeEnv);
|
|
217
227
|
try {
|
|
218
228
|
const option = await parserConfig(path$1, "qvite.config");
|
|
219
229
|
if (isFunction(option)) return option({
|
|
@@ -258,7 +268,8 @@ async function getConfig(filePath) {
|
|
|
258
268
|
*/
|
|
259
269
|
async function watch(options) {
|
|
260
270
|
const normalized = await normalizeConfig(options);
|
|
261
|
-
const
|
|
271
|
+
const port = normalized.vite?.server?.port;
|
|
272
|
+
const p = await getPortPromise({ port });
|
|
262
273
|
store.set("port", p);
|
|
263
274
|
const inline = await toViteInlineConfig(normalized);
|
|
264
275
|
const viteDevServer = await createServer({
|
package/dist/index.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quiteer/vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.8",
|
|
5
5
|
"description": "在 vite 的基础上增强的前端架构 cli",
|
|
6
6
|
"author": "quiteer",
|
|
7
7
|
"license": "MIT",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"tsdown": "^0.16.1",
|
|
60
60
|
"vite": "npm:rolldown-vite@7.2.2",
|
|
61
61
|
"zx": "^8.8.5",
|
|
62
|
+
"@quiteer/unocss": "0.0.5",
|
|
62
63
|
"@quiteer/is": "0.0.2",
|
|
63
|
-
"@quiteer/
|
|
64
|
-
"@quiteer/
|
|
65
|
-
"@quiteer/vite-plugins": "^0.1.2"
|
|
64
|
+
"@quiteer/vite-plugins": "^0.1.2",
|
|
65
|
+
"@quiteer/utils": "0.0.2"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"dev": "tsdown -w",
|
package/uno.config.ts
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineConfig, NaiveUIPreset, QuiteerPreset } from '@quiteer/unocss'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
content: {
|
|
5
|
+
pipeline: {
|
|
6
|
+
exclude: ['node_modules', 'dist']
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
presets: [
|
|
10
|
+
QuiteerPreset(),
|
|
11
|
+
NaiveUIPreset()
|
|
12
|
+
]
|
|
13
|
+
})
|