@halo-dev/ui-plugin-bundler-kit 2.21.2 → 2.23.0
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/README.md +1 -1
- package/dist/{index.js → index.mjs} +11 -28
- package/package.json +10 -12
- package/src/constants/externals.ts +2 -1
- package/src/utils/halo-plugin.ts +1 -1
- package/tsconfig.json +1 -1
- /package/dist/{index.d.ts → index.d.mts} +0 -0
package/README.md
CHANGED
|
@@ -273,7 +273,7 @@ Both Vite and Rsbuild are excellent build tools, but they have different strengt
|
|
|
273
273
|
**Example with dynamic imports:**
|
|
274
274
|
|
|
275
275
|
```typescript
|
|
276
|
-
import { definePlugin } from "@halo-dev/
|
|
276
|
+
import { definePlugin } from "@halo-dev/ui-shared";
|
|
277
277
|
import { defineAsyncComponent } from "vue";
|
|
278
278
|
import { VLoading } from "@halo-dev/components";
|
|
279
279
|
|
|
@@ -1,41 +1,33 @@
|
|
|
1
|
-
import fs from "fs";
|
|
1
|
+
import fs from "node:fs";
|
|
2
2
|
import yaml from "js-yaml";
|
|
3
3
|
import { defineConfig, mergeRsbuildConfig } from "@rsbuild/core";
|
|
4
4
|
import { pluginVue } from "@rsbuild/plugin-vue";
|
|
5
5
|
import Vue from "@vitejs/plugin-vue";
|
|
6
6
|
import { defineConfig as defineConfig$1, mergeConfig } from "vite";
|
|
7
|
-
|
|
8
7
|
//#region src/constants/build.ts
|
|
9
8
|
const DEFAULT_OUT_DIR_DEV = "../build/resources/main/console";
|
|
10
9
|
const DEFAULT_OUT_DIR_PROD = "./build/dist";
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
11
|
//#region src/constants/externals.ts
|
|
14
12
|
const GLOBALS = {
|
|
15
13
|
vue: "Vue",
|
|
16
14
|
"vue-router": "VueRouter",
|
|
15
|
+
pinia: "Pinia",
|
|
17
16
|
"@vueuse/core": "VueUse",
|
|
18
17
|
"@vueuse/components": "VueUse",
|
|
19
18
|
"@vueuse/router": "VueUse",
|
|
20
|
-
"@halo-dev/
|
|
19
|
+
"@halo-dev/ui-shared": "HaloUiShared",
|
|
21
20
|
"@halo-dev/components": "HaloComponents",
|
|
22
21
|
"@halo-dev/api-client": "HaloApiClient",
|
|
23
22
|
"@halo-dev/richtext-editor": "RichTextEditor",
|
|
24
23
|
axios: "axios"
|
|
25
24
|
};
|
|
26
25
|
const EXTERNALS = Object.keys(GLOBALS);
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/constants/halo-plugin.ts
|
|
30
|
-
const DEFAULT_MANIFEST_PATH = "../src/main/resources/plugin.yaml";
|
|
31
|
-
|
|
32
26
|
//#endregion
|
|
33
27
|
//#region src/utils/halo-plugin.ts
|
|
34
28
|
function getHaloPluginManifest(manifestPath) {
|
|
35
|
-
|
|
36
|
-
return manifest;
|
|
29
|
+
return yaml.load(fs.readFileSync(manifestPath, "utf8"));
|
|
37
30
|
}
|
|
38
|
-
|
|
39
31
|
//#endregion
|
|
40
32
|
//#region src/legacy.ts
|
|
41
33
|
const LEGACY_OUT_DIR_PROD = "../src/main/resources/console";
|
|
@@ -50,8 +42,7 @@ function HaloUIPluginBundlerKit(options = {}) {
|
|
|
50
42
|
let outDir = isProduction ? LEGACY_OUT_DIR_PROD : DEFAULT_OUT_DIR_DEV;
|
|
51
43
|
if (options.outDir) if (typeof options.outDir === "string") outDir = options.outDir;
|
|
52
44
|
else outDir = isProduction ? options.outDir.prod : options.outDir.dev;
|
|
53
|
-
const
|
|
54
|
-
const manifest = getHaloPluginManifest(manifestPath);
|
|
45
|
+
const manifest = getHaloPluginManifest(options.manifestPath || "../src/main/resources/plugin.yaml");
|
|
55
46
|
return {
|
|
56
47
|
...config,
|
|
57
48
|
define: { "process.env": process.env },
|
|
@@ -76,14 +67,12 @@ function HaloUIPluginBundlerKit(options = {}) {
|
|
|
76
67
|
}
|
|
77
68
|
};
|
|
78
69
|
}
|
|
79
|
-
|
|
80
70
|
//#endregion
|
|
81
71
|
//#region src/rsbuild.ts
|
|
82
72
|
function createRsbuildPresetsConfig(manifestPath) {
|
|
83
73
|
const manifest = getHaloPluginManifest(manifestPath);
|
|
84
74
|
return defineConfig(({ envMode }) => {
|
|
85
|
-
const
|
|
86
|
-
const outDir = isProduction ? DEFAULT_OUT_DIR_PROD : DEFAULT_OUT_DIR_DEV;
|
|
75
|
+
const outDir = envMode === "production" ? DEFAULT_OUT_DIR_PROD : DEFAULT_OUT_DIR_DEV;
|
|
87
76
|
return {
|
|
88
77
|
mode: envMode || "production",
|
|
89
78
|
plugins: [pluginVue()],
|
|
@@ -152,14 +141,11 @@ function createRsbuildPresetsConfig(manifestPath) {
|
|
|
152
141
|
* @returns
|
|
153
142
|
*/
|
|
154
143
|
function rsbuildConfig(config) {
|
|
155
|
-
const presetsConfigFn = createRsbuildPresetsConfig(config?.manifestPath ||
|
|
144
|
+
const presetsConfigFn = createRsbuildPresetsConfig(config?.manifestPath || "../src/main/resources/plugin.yaml");
|
|
156
145
|
return defineConfig((env) => {
|
|
157
|
-
|
|
158
|
-
const userConfig = typeof config?.rsbuild === "function" ? config.rsbuild(env) : config?.rsbuild || {};
|
|
159
|
-
return mergeRsbuildConfig(presetsConfig, userConfig);
|
|
146
|
+
return mergeRsbuildConfig(presetsConfigFn(env), typeof config?.rsbuild === "function" ? config.rsbuild(env) : config?.rsbuild || {});
|
|
160
147
|
});
|
|
161
148
|
}
|
|
162
|
-
|
|
163
149
|
//#endregion
|
|
164
150
|
//#region src/vite.ts
|
|
165
151
|
function createVitePresetsConfig(manifestPath) {
|
|
@@ -206,13 +192,10 @@ function createVitePresetsConfig(manifestPath) {
|
|
|
206
192
|
* ```
|
|
207
193
|
*/
|
|
208
194
|
function viteConfig(config) {
|
|
209
|
-
const presetsConfigFn = createVitePresetsConfig(config?.manifestPath ||
|
|
195
|
+
const presetsConfigFn = createVitePresetsConfig(config?.manifestPath || "../src/main/resources/plugin.yaml");
|
|
210
196
|
return defineConfig$1((env) => {
|
|
211
|
-
|
|
212
|
-
const userConfig = typeof config?.vite === "function" ? config.vite(env) : config?.vite || {};
|
|
213
|
-
return mergeConfig(presetsConfig, userConfig);
|
|
197
|
+
return mergeConfig(presetsConfigFn(env), typeof config?.vite === "function" ? config.vite(env) : config?.vite || {});
|
|
214
198
|
});
|
|
215
199
|
}
|
|
216
|
-
|
|
217
200
|
//#endregion
|
|
218
|
-
export { HaloUIPluginBundlerKit, rsbuildConfig, viteConfig };
|
|
201
|
+
export { HaloUIPluginBundlerKit, rsbuildConfig, viteConfig };
|
package/package.json
CHANGED
|
@@ -1,37 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@halo-dev/ui-plugin-bundler-kit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"homepage": "https://github.com/halo-dev/halo/tree/main/ui/packages/ui-plugin-bundler-kit#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/halo-dev/halo/issues"
|
|
7
7
|
},
|
|
8
|
+
"license": "GPL-3.0",
|
|
9
|
+
"author": "@halo-dev",
|
|
8
10
|
"repository": {
|
|
9
11
|
"type": "git",
|
|
10
12
|
"url": "https://github.com/halo-dev/halo.git",
|
|
11
13
|
"directory": "ui/packages/ui-plugin-bundler-kit"
|
|
12
14
|
},
|
|
13
|
-
"license": "GPL-3.0",
|
|
14
|
-
"author": "@halo-dev",
|
|
15
15
|
"type": "module",
|
|
16
|
+
"types": "./dist/index.d.mts",
|
|
16
17
|
"exports": {
|
|
17
|
-
".": "./dist/index.
|
|
18
|
+
".": "./dist/index.mjs",
|
|
18
19
|
"./package.json": "./package.json"
|
|
19
20
|
},
|
|
20
|
-
"main": "./dist/index.js",
|
|
21
|
-
"module": "./dist/index.js",
|
|
22
|
-
"types": "./dist/index.d.ts",
|
|
23
21
|
"dependencies": {
|
|
24
|
-
"js-yaml": "^4.1.
|
|
25
|
-
"@halo-dev/api-client": "2.
|
|
22
|
+
"js-yaml": "^4.1.1",
|
|
23
|
+
"@halo-dev/api-client": "2.23.0"
|
|
26
24
|
},
|
|
27
25
|
"devDependencies": {
|
|
28
26
|
"@types/js-yaml": "^4.0.9"
|
|
29
27
|
},
|
|
30
28
|
"peerDependencies": {
|
|
31
|
-
"@rsbuild/core": "^1.0.0",
|
|
32
|
-
"@rsbuild/plugin-vue": "^1.0.0",
|
|
29
|
+
"@rsbuild/core": "^1.0.0 || ^2.0.0",
|
|
30
|
+
"@rsbuild/plugin-vue": "^1.0.0 || ^2.0.0",
|
|
33
31
|
"@vitejs/plugin-vue": "^5.0.0 || ^6.0.0",
|
|
34
|
-
"vite": "^
|
|
32
|
+
"vite": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
35
33
|
},
|
|
36
34
|
"engines": {
|
|
37
35
|
"node": "^18.0.0 || >=20.0.0"
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
const GLOBALS = {
|
|
2
2
|
vue: "Vue",
|
|
3
3
|
"vue-router": "VueRouter",
|
|
4
|
+
pinia: "Pinia",
|
|
4
5
|
"@vueuse/core": "VueUse",
|
|
5
6
|
"@vueuse/components": "VueUse",
|
|
6
7
|
"@vueuse/router": "VueUse",
|
|
7
|
-
"@halo-dev/
|
|
8
|
+
"@halo-dev/ui-shared": "HaloUiShared",
|
|
8
9
|
"@halo-dev/components": "HaloComponents",
|
|
9
10
|
"@halo-dev/api-client": "HaloApiClient",
|
|
10
11
|
"@halo-dev/richtext-editor": "RichTextEditor",
|
package/src/utils/halo-plugin.ts
CHANGED
package/tsconfig.json
CHANGED
|
File without changes
|