@halo-dev/ui-plugin-bundler-kit 2.20.21 → 2.21.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/dist/index.cjs CHANGED
@@ -3856,14 +3856,25 @@ var jsYaml = {
3856
3856
  safeDump: safeDump
3857
3857
  };
3858
3858
 
3859
- function HaloUIPluginBundlerKit() {
3859
+ const DEFAULT_OUT_DIR_DEV = "../src/main/resources/console";
3860
+ const DEFAULT_OUT_DIR_PROD = "../build/resources/main/console";
3861
+ const DEFAULT_MANIFEST_PATH = "../src/main/resources/plugin.yaml";
3862
+ function HaloUIPluginBundlerKit(options = {}) {
3860
3863
  return {
3861
3864
  name: "halo-ui-plugin-bundler-kit",
3862
3865
  config(config, env) {
3863
3866
  const isProduction = env.mode === "production";
3864
- const outDir = isProduction ? "../src/main/resources/console" : "../build/resources/main/console";
3867
+ let outDir = isProduction ? DEFAULT_OUT_DIR_PROD : DEFAULT_OUT_DIR_DEV;
3868
+ if (options.outDir) {
3869
+ if (typeof options.outDir === "string") {
3870
+ outDir = options.outDir;
3871
+ } else {
3872
+ outDir = isProduction ? options.outDir.prod : options.outDir.dev;
3873
+ }
3874
+ }
3875
+ const manifestPath = options.manifestPath || DEFAULT_MANIFEST_PATH;
3865
3876
  const manifest = jsYaml.load(
3866
- fs__default.readFileSync("../src/main/resources/plugin.yaml", "utf8")
3877
+ fs__default.readFileSync(manifestPath, "utf8")
3867
3878
  );
3868
3879
  return {
3869
3880
  ...config,
package/dist/index.d.ts CHANGED
@@ -1,5 +1,12 @@
1
1
  import { Plugin } from 'vite';
2
2
 
3
- declare function HaloUIPluginBundlerKit(): Plugin;
3
+ interface HaloUIPluginBundlerKitOptions {
4
+ outDir?: string | {
5
+ dev: string;
6
+ prod: string;
7
+ };
8
+ manifestPath?: string;
9
+ }
10
+ declare function HaloUIPluginBundlerKit(options?: HaloUIPluginBundlerKitOptions): Plugin;
4
11
 
5
12
  export { HaloUIPluginBundlerKit };
package/dist/index.mjs CHANGED
@@ -3848,14 +3848,25 @@ var jsYaml = {
3848
3848
  safeDump: safeDump
3849
3849
  };
3850
3850
 
3851
- function HaloUIPluginBundlerKit() {
3851
+ const DEFAULT_OUT_DIR_DEV = "../src/main/resources/console";
3852
+ const DEFAULT_OUT_DIR_PROD = "../build/resources/main/console";
3853
+ const DEFAULT_MANIFEST_PATH = "../src/main/resources/plugin.yaml";
3854
+ function HaloUIPluginBundlerKit(options = {}) {
3852
3855
  return {
3853
3856
  name: "halo-ui-plugin-bundler-kit",
3854
3857
  config(config, env) {
3855
3858
  const isProduction = env.mode === "production";
3856
- const outDir = isProduction ? "../src/main/resources/console" : "../build/resources/main/console";
3859
+ let outDir = isProduction ? DEFAULT_OUT_DIR_PROD : DEFAULT_OUT_DIR_DEV;
3860
+ if (options.outDir) {
3861
+ if (typeof options.outDir === "string") {
3862
+ outDir = options.outDir;
3863
+ } else {
3864
+ outDir = isProduction ? options.outDir.prod : options.outDir.dev;
3865
+ }
3866
+ }
3867
+ const manifestPath = options.manifestPath || DEFAULT_MANIFEST_PATH;
3857
3868
  const manifest = jsYaml.load(
3858
- fs.readFileSync("../src/main/resources/plugin.yaml", "utf8")
3869
+ fs.readFileSync(manifestPath, "utf8")
3859
3870
  );
3860
3871
  return {
3861
3872
  ...config,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halo-dev/ui-plugin-bundler-kit",
3
- "version": "2.20.21",
3
+ "version": "2.21.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"
@@ -29,7 +29,7 @@
29
29
  "@types/js-yaml": "^4.0.9",
30
30
  "js-yaml": "^4.1.0",
31
31
  "unbuild": "^0.7.6",
32
- "@halo-dev/api-client": "2.20.21"
32
+ "@halo-dev/api-client": "2.21.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "vite": "^4.0.0 || ^5.0.0"