@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 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/console-shared";
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/console-shared": "HaloConsoleShared",
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
- const manifest = yaml.load(fs.readFileSync(manifestPath, "utf8"));
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 manifestPath = options.manifestPath || DEFAULT_MANIFEST_PATH;
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 isProduction = envMode === "production";
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 || DEFAULT_MANIFEST_PATH);
144
+ const presetsConfigFn = createRsbuildPresetsConfig(config?.manifestPath || "../src/main/resources/plugin.yaml");
156
145
  return defineConfig((env) => {
157
- const presetsConfig = presetsConfigFn(env);
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 || DEFAULT_MANIFEST_PATH);
195
+ const presetsConfigFn = createVitePresetsConfig(config?.manifestPath || "../src/main/resources/plugin.yaml");
210
196
  return defineConfig$1((env) => {
211
- const presetsConfig = presetsConfigFn(env);
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.21.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.js",
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.0",
25
- "@halo-dev/api-client": "2.21.1"
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": "^5.0.0 || ^6.0.0 || ^7.0.0"
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/console-shared": "HaloConsoleShared",
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",
@@ -1,5 +1,5 @@
1
+ import fs from "node:fs";
1
2
  import type { Plugin as HaloPlugin } from "@halo-dev/api-client";
2
- import fs from "fs";
3
3
  import yaml from "js-yaml";
4
4
 
5
5
  export function getHaloPluginManifest(manifestPath: string) {
package/tsconfig.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "outDir": "dist",
6
6
  "target": "ES2020",
7
7
  "module": "ES2020",
8
- "moduleResolution": "node",
8
+ "moduleResolution": "bundler",
9
9
  "strict": true,
10
10
  "declaration": true,
11
11
  "sourceMap": true,
File without changes