@halo-dev/ui-plugin-bundler-kit 2.21.2 → 2.22.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,5 +1,5 @@
1
- import fs from "fs";
2
1
  import yaml from "js-yaml";
2
+ import fs from "node:fs";
3
3
  import { defineConfig, mergeRsbuildConfig } from "@rsbuild/core";
4
4
  import { pluginVue } from "@rsbuild/plugin-vue";
5
5
  import Vue from "@vitejs/plugin-vue";
@@ -14,10 +14,11 @@ const DEFAULT_OUT_DIR_PROD = "./build/dist";
14
14
  const GLOBALS = {
15
15
  vue: "Vue",
16
16
  "vue-router": "VueRouter",
17
+ pinia: "Pinia",
17
18
  "@vueuse/core": "VueUse",
18
19
  "@vueuse/components": "VueUse",
19
20
  "@vueuse/router": "VueUse",
20
- "@halo-dev/console-shared": "HaloConsoleShared",
21
+ "@halo-dev/ui-shared": "HaloUiShared",
21
22
  "@halo-dev/components": "HaloComponents",
22
23
  "@halo-dev/api-client": "HaloApiClient",
23
24
  "@halo-dev/richtext-editor": "RichTextEditor",
@@ -32,8 +33,7 @@ const DEFAULT_MANIFEST_PATH = "../src/main/resources/plugin.yaml";
32
33
  //#endregion
33
34
  //#region src/utils/halo-plugin.ts
34
35
  function getHaloPluginManifest(manifestPath) {
35
- const manifest = yaml.load(fs.readFileSync(manifestPath, "utf8"));
36
- return manifest;
36
+ return yaml.load(fs.readFileSync(manifestPath, "utf8"));
37
37
  }
38
38
 
39
39
  //#endregion
@@ -50,8 +50,7 @@ function HaloUIPluginBundlerKit(options = {}) {
50
50
  let outDir = isProduction ? LEGACY_OUT_DIR_PROD : DEFAULT_OUT_DIR_DEV;
51
51
  if (options.outDir) if (typeof options.outDir === "string") outDir = options.outDir;
52
52
  else outDir = isProduction ? options.outDir.prod : options.outDir.dev;
53
- const manifestPath = options.manifestPath || DEFAULT_MANIFEST_PATH;
54
- const manifest = getHaloPluginManifest(manifestPath);
53
+ const manifest = getHaloPluginManifest(options.manifestPath || DEFAULT_MANIFEST_PATH);
55
54
  return {
56
55
  ...config,
57
56
  define: { "process.env": process.env },
@@ -82,8 +81,7 @@ function HaloUIPluginBundlerKit(options = {}) {
82
81
  function createRsbuildPresetsConfig(manifestPath) {
83
82
  const manifest = getHaloPluginManifest(manifestPath);
84
83
  return defineConfig(({ envMode }) => {
85
- const isProduction = envMode === "production";
86
- const outDir = isProduction ? DEFAULT_OUT_DIR_PROD : DEFAULT_OUT_DIR_DEV;
84
+ const outDir = envMode === "production" ? DEFAULT_OUT_DIR_PROD : DEFAULT_OUT_DIR_DEV;
87
85
  return {
88
86
  mode: envMode || "production",
89
87
  plugins: [pluginVue()],
@@ -154,9 +152,7 @@ function createRsbuildPresetsConfig(manifestPath) {
154
152
  function rsbuildConfig(config) {
155
153
  const presetsConfigFn = createRsbuildPresetsConfig(config?.manifestPath || DEFAULT_MANIFEST_PATH);
156
154
  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);
155
+ return mergeRsbuildConfig(presetsConfigFn(env), typeof config?.rsbuild === "function" ? config.rsbuild(env) : config?.rsbuild || {});
160
156
  });
161
157
  }
162
158
 
@@ -208,9 +204,7 @@ function createVitePresetsConfig(manifestPath) {
208
204
  function viteConfig(config) {
209
205
  const presetsConfigFn = createVitePresetsConfig(config?.manifestPath || DEFAULT_MANIFEST_PATH);
210
206
  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);
207
+ return mergeConfig(presetsConfigFn(env), typeof config?.vite === "function" ? config.vite(env) : config?.vite || {});
214
208
  });
215
209
  }
216
210
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halo-dev/ui-plugin-bundler-kit",
3
- "version": "2.21.2",
3
+ "version": "2.22.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"
@@ -14,15 +14,15 @@
14
14
  "author": "@halo-dev",
15
15
  "type": "module",
16
16
  "exports": {
17
- ".": "./dist/index.js",
17
+ ".": "./dist/index.mjs",
18
18
  "./package.json": "./package.json"
19
19
  },
20
- "main": "./dist/index.js",
21
- "module": "./dist/index.js",
22
- "types": "./dist/index.d.ts",
20
+ "main": "./dist/index.mjs",
21
+ "module": "./dist/index.mjs",
22
+ "types": "./dist/index.d.mts",
23
23
  "dependencies": {
24
- "js-yaml": "^4.1.0",
25
- "@halo-dev/api-client": "2.21.1"
24
+ "js-yaml": "^4.1.1",
25
+ "@halo-dev/api-client": "2.22.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/js-yaml": "^4.0.9"
@@ -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,6 +1,6 @@
1
1
  import type { Plugin as HaloPlugin } from "@halo-dev/api-client";
2
- import fs from "fs";
3
2
  import yaml from "js-yaml";
3
+ import fs from "node:fs";
4
4
 
5
5
  export function getHaloPluginManifest(manifestPath: string) {
6
6
  const manifest = yaml.load(
File without changes