@gct-paas/core 0.1.5-dev.3 → 0.1.5-dev.5

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.
Files changed (38) hide show
  1. package/dist/index.esm.min.js +1 -1
  2. package/es/enums/page-designer/widget.d.ts +2 -2
  3. package/es/global/gct/gct.d.ts +108 -107
  4. package/es/hooks/index.d.ts +1 -0
  5. package/es/hooks/index.mjs +1 -0
  6. package/es/hooks/useFile.d.ts +4 -0
  7. package/es/hooks/useFile.mjs +22 -0
  8. package/es/index.mjs +3 -1
  9. package/es/interface/i-kit-plugin-module/i-kit-plugin-module.d.ts +23 -0
  10. package/es/interface/i-pinia-action/i-global-actions.d.ts +3 -0
  11. package/es/interface/index.d.ts +1 -1
  12. package/es/locale/index.d.ts +3 -1
  13. package/es/locale/index.mjs +18 -3
  14. package/es/modules/platform-config/store.d.ts +106 -106
  15. package/es/modules/platform-config/useSecuritySetting.d.ts +1 -1
  16. package/es/modules/user-stores/store/tenant.store.d.ts +6 -8
  17. package/es/modules/user-stores/store/tenant.store.mjs +12 -14
  18. package/es/modules/user-stores/store/user.store.d.ts +7 -2
  19. package/es/modules/user-stores/store/user.store.mjs +15 -4
  20. package/es/modules/user-stores/types/tenant.d.ts +7 -1
  21. package/es/router/index.mjs +2 -2
  22. package/es/setup-app.mjs +4 -2
  23. package/es/store/global-store.mjs +3 -0
  24. package/es/store/index.d.ts +1 -0
  25. package/es/store/index.mjs +1 -0
  26. package/es/store/session-store.d.ts +7 -0
  27. package/es/store/session-store.mjs +7 -0
  28. package/es/store/storage-store.d.ts +2 -0
  29. package/es/store/storage-store.mjs +3 -2
  30. package/es/types/index.d.ts +0 -1
  31. package/es/utils/file/download.d.ts +1 -1
  32. package/es/utils/file/parser.d.ts +1 -1
  33. package/es/utils/kit-pkg-util/kit-pkg-util.d.ts +34 -13
  34. package/es/utils/kit-pkg-util/kit-pkg-util.mjs +51 -40
  35. package/es/utils/plugin-pkg-util/plugin-pkg-util.d.ts +2 -2
  36. package/es/utils/tools/tools.d.ts +1 -1
  37. package/package.json +4 -4
  38. package/es/interface/i-kit-info/i-kit-info.d.ts +0 -20
@@ -1,3 +1,5 @@
1
+ import { PluginModeEnum } from "../../enums/plugin-enum.mjs";
2
+ import "../../enums/index.mjs";
1
3
  //#region src/utils/kit-pkg-util/kit-pkg-util.ts
2
4
  /**
3
5
  * 用于加载套件包的工具类
@@ -6,8 +8,7 @@
6
8
  * @class KitPkgUtil
7
9
  */
8
10
  var KitPkgUtil = class {
9
- static KIT_PKG_BASE_PATH = "/kits";
10
- static cache = /* @__PURE__ */ new Map();
11
+ static KIT_PKG_BASE_PATH = "/plugin-kit";
11
12
  static joinPaths(...paths) {
12
13
  return paths.filter((p) => p && p.length > 0).map((p, index) => {
13
14
  let normalized = p;
@@ -17,56 +18,66 @@ var KitPkgUtil = class {
17
18
  }).join("/");
18
19
  }
19
20
  /**
20
- * 加载套件包配置
21
+ * 加载套件包,返回套件包入口实例
21
22
  *
22
23
  * @static
23
24
  * @param {string} kit
24
- * @return {*} {(Promise<IKitInfo | undefined>)}
25
+ * @param {PluginModeEnum} mode
26
+ * @return {*} {(Promise<IPluginKitModule | null>)}
25
27
  */
26
- static async loadKitPkgInfo(kit) {
27
- if (this.cache.has(kit)) return this.cache.get(kit);
28
+ static async loadKit(kit, mode) {
29
+ const loaderUrl = this.joinPaths(this.KIT_PKG_BASE_PATH, kit, mode, "loader.esm.min.js");
28
30
  try {
29
- const url = this.joinPaths(this.KIT_PKG_BASE_PATH, kit.toUpperCase(), "kit-info.json");
30
- const response = await fetch(url);
31
- if (!response.ok) throw new Error(`Failed to load kit package from ${url}`);
32
- const config = await response.json();
33
- this.cache.set(kit, config);
34
- return config;
31
+ const module = await import(
32
+ /* @vite-ignore */
33
+ loaderUrl
34
+ );
35
+ if (module) return module;
36
+ else console.warn(`Kit ${kit} does not export a default function`);
35
37
  } catch (error) {
36
- console.error(`Error loading kit package ${kit}:`, error);
38
+ console.error(`Error loading kit ${kit} from ${loaderUrl}:`, error);
37
39
  }
40
+ return null;
38
41
  }
39
42
  /**
40
- * 加载套件包内的插件
43
+ * 加载设计模式套件包
41
44
  *
42
45
  * @static
43
- * @param {App} app
44
- * @param {(string | string[])} kit
45
- * @param {PluginModeEnum} mode
46
- * @return {*} {Promise<void>}
46
+ * @param {string} kit
47
+ * @return {*} {(Promise<IPluginKitModule | null>)}
47
48
  */
48
- static async loadKits(app, kit, mode) {
49
- const kits = Array.isArray(kit) ? kit : [kit];
50
- for (const k of kits) {
51
- if (this.cache.has(k)) {
52
- console.warn(`Kit package ${k} is already loaded, skipping.`);
53
- return;
54
- }
55
- const config = await this.loadKitPkgInfo(k);
56
- if (config) {
57
- const loaderUrl = this.joinPaths(this.KIT_PKG_BASE_PATH, config.kit.toUpperCase(), mode, `loader.esm.min.js?version=${config.version || "0.0.0"}`);
58
- try {
59
- const module = await import(
60
- /* @vite-ignore */
61
- loaderUrl
62
- );
63
- if (module && module.default) app.use(module.default);
64
- else console.warn(`Kit ${config.kit} does not export a default function`);
65
- } catch (error) {
66
- console.error(`Error loading kit ${config.kit} from ${loaderUrl}:`, error);
67
- }
68
- }
69
- }
49
+ static loadDesign(kit) {
50
+ return this.loadKit(kit, PluginModeEnum.DESIGN);
51
+ }
52
+ /**
53
+ * 加载移动端绘制模式套件包
54
+ *
55
+ * @static
56
+ * @param {string} kit
57
+ * @return {*} {(Promise<IPluginKitModule | null>)}
58
+ */
59
+ static loadMobile(kit) {
60
+ return this.loadKit(kit, PluginModeEnum.MOBILE);
61
+ }
62
+ /**
63
+ * 加载平板端绘制模式套件包
64
+ *
65
+ * @static
66
+ * @param {string} kit
67
+ * @return {*} {(Promise<IPluginKitModule | null>)}
68
+ */
69
+ static loadPad(kit) {
70
+ return this.loadKit(kit, PluginModeEnum.PAD);
71
+ }
72
+ /**
73
+ * 加载网页端绘制模式套件包
74
+ *
75
+ * @static
76
+ * @param {string} kit
77
+ * @return {*} {(Promise<IPluginKitModule | null>)}
78
+ */
79
+ static loadWeb(kit) {
80
+ return this.loadKit(kit, PluginModeEnum.WEB);
70
81
  }
71
82
  };
72
83
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { PluginModeEnum, Platform } from '../../enums';
2
2
  import { PluginTenant } from '@gct-paas/api/platform';
3
- export type IModuleMap = Record<string, System.Module>;
3
+ export type IModuleMap = Record<string, IObject>;
4
4
  export type LoadPluginResult = [PluginTenant[], IModuleMap];
5
5
  /**
6
6
  * 插件包处理工具类
@@ -28,7 +28,7 @@ export declare class PluginPgkUtil {
28
28
  *
29
29
  * @static
30
30
  */
31
- static readonly module: Map<string, System.Module>;
31
+ static readonly module: Map<string, IObject>;
32
32
  protected static joinPaths(...paths: string[]): string;
33
33
  /**
34
34
  * 加载插件包配置
@@ -11,7 +11,7 @@ export declare function getToken(): string | null;
11
11
  * @export
12
12
  * @param {string} token
13
13
  */
14
- export declare function setToken(token: string): void;
14
+ export declare function setToken(token?: string): void;
15
15
  /**
16
16
  * 从 cookie 获取租户标识
17
17
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/core",
3
- "version": "0.1.5-dev.3",
3
+ "version": "0.1.5-dev.5",
4
4
  "type": "module",
5
5
  "description": "paas 平台核心包",
6
6
  "loader": "dist/index.esm.min.js",
@@ -32,7 +32,7 @@
32
32
  "author": "gct",
33
33
  "dependencies": {
34
34
  "@fingerprintjs/fingerprintjs": "^5.1.0",
35
- "@gct-paas/api": "^0.1.3",
35
+ "@gct-paas/api": "0.1.4-dev.0",
36
36
  "@module-federation/runtime": "^2.2.3",
37
37
  "@vueuse/core": "^14.1.0",
38
38
  "async-validator": "^4.2.5",
@@ -57,7 +57,7 @@
57
57
  "playwright": "^1.58.0"
58
58
  },
59
59
  "peerDependencies": {
60
- "@gct-paas/api": "^0.1.3",
60
+ "@gct-paas/api": "0.1.4-dev.0",
61
61
  "vue": ">=3",
62
62
  "vue-i18n": ">=11",
63
63
  "vue-router": ">=4"
@@ -65,7 +65,7 @@
65
65
  "scripts": {
66
66
  "dev": "cross-env NODE_ENV=development vite build --watch --config vite.dev.config.ts",
67
67
  "es:build": "vite build --config vite.dev.config.ts",
68
- "build": "npm run lint && vite build --config vite.dev.config.ts && vite build --config vite.config.ts",
68
+ "build": "npm run lint && vue-tsc --noEmit && vite build --config vite.dev.config.ts && vite build --config vite.config.ts",
69
69
  "lint": "eslint src/",
70
70
  "test": "vitest",
71
71
  "test:run": "vitest run",
@@ -1,20 +0,0 @@
1
- /**
2
- * 套件配置信息
3
- *
4
- * @export
5
- * @interface IKitInfo
6
- */
7
- export interface IKitInfo {
8
- /**
9
- * 套件名称
10
- *
11
- * @type {string}
12
- */
13
- kit: string;
14
- /**
15
- * 套件版本
16
- *
17
- * @type {string}
18
- */
19
- version: string;
20
- }