@gct-paas/core 0.1.4-dev.13 → 0.1.4-dev.14

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.
@@ -12,6 +12,11 @@ import { RouterUtil } from '../../router';
12
12
  * @class GctGlobal
13
13
  */
14
14
  export declare class GctGlobal {
15
+ /**
16
+ * 模块联邦实例
17
+ *
18
+ * @description 使用规范参考官方文档: https://module-federation.io/zh/guide/start/index.html
19
+ */
15
20
  /**
16
21
  * i18n 工具类
17
22
  */
@@ -31,6 +36,227 @@ export declare class GctGlobal {
31
36
  * 全局 store 实例
32
37
  */
33
38
  readonly store: import('pinia').Store<"global-store", import('../..').IGlobalState, import('../..').IGlobalGetters, import('../..').IGlobalActions>;
39
+ /**
40
+ * 全局平台配置 store 实例
41
+ *
42
+ */
43
+ readonly platformStore: import('pinia').Store<"platform-config", Pick<{
44
+ projectSetting: {};
45
+ setProjectConfig: (config: {}) => void;
46
+ deploySetting: {
47
+ deployMode: import('../..').DeployModeEnum;
48
+ };
49
+ setDeploySetting: (data: import('@gct-paas/api/platform').SysConfigResponse) => void;
50
+ isIndependentApp: import('vue').ComputedRef<boolean>;
51
+ watermarkSetting: {
52
+ openWatermark: boolean;
53
+ watermarkContent: string;
54
+ fontSize: number;
55
+ color: string;
56
+ verticalAlign: string;
57
+ textAlign: string;
58
+ text: string;
59
+ transparent: number;
60
+ width: number;
61
+ height: number;
62
+ };
63
+ postWatermarkSetting: () => Promise<void>;
64
+ setWatermarkSetting: (data: import('@gct-paas/api/platform').SysConfigResponse) => void;
65
+ themeSetting: import('../..').IThemeSetting;
66
+ setThemeSetting: (data: import('@gct-paas/api/platform').SysConfigResponse) => void;
67
+ postThemeSetting: () => Promise<void>;
68
+ menuCollapsed: import('vue').Ref<boolean, boolean>;
69
+ toggleMenuCollapsed: () => void;
70
+ menuCollapsedWidth: number;
71
+ menuWidthRange: number[];
72
+ themeColors: string[];
73
+ securitySetting: import('@gct-paas/api/platform').SecurityConfig;
74
+ postSecuritySetting: () => Promise<void>;
75
+ setSecuritySetting: (data: import('@gct-paas/api/platform').SysConfigResponse) => void;
76
+ orgSetting: import('@gct-paas/api/platform').OrgConfig;
77
+ setOrgSetting: (data: import('@gct-paas/api/platform').SysConfigResponse) => void;
78
+ postOrgSetting: () => Promise<void>;
79
+ relationFields: import('vue').Ref<{
80
+ label: string;
81
+ value: string;
82
+ type: number;
83
+ }[], {
84
+ label: string;
85
+ value: string;
86
+ type: number;
87
+ }[] | {
88
+ label: string;
89
+ value: string;
90
+ type: number;
91
+ }[]>;
92
+ relationFiledsCopy: import('vue').Ref<{
93
+ label: string;
94
+ value: string;
95
+ }[], {
96
+ label: string;
97
+ value: string;
98
+ }[] | {
99
+ label: string;
100
+ value: string;
101
+ }[]>;
102
+ loginSetting: import('@gct-paas/api/platform').AuthConfig;
103
+ postLoginSetting: () => Promise<void>;
104
+ setLoginSetting: (config: import('@gct-paas/api/platform').SysConfigResponse | undefined) => void;
105
+ loginModeAuthTypes: import('vue').Ref<string[], string[]>;
106
+ openIDOAuthAuthTypes: import('vue').Ref<string[], string[]>;
107
+ sysLoginSort: import('vue').Ref<IObject[], IObject[]>;
108
+ openIDOAuthAuthSort: import('vue').Ref<IObject[], IObject[]>;
109
+ loginModeConfig: Map<string, IObject>;
110
+ basicSetting: import('@gct-paas/api/platform').PlatformBaseConfig;
111
+ setBasicSetting: (data: import('@gct-paas/api/platform').SysConfigResponse, transfer?: boolean) => void;
112
+ postBasicSetting: () => Promise<string>;
113
+ init: () => Promise<void>;
114
+ renderInit: () => Promise<void>;
115
+ }, "projectSetting" | "deploySetting" | "watermarkSetting" | "themeSetting" | "menuCollapsed" | "menuCollapsedWidth" | "menuWidthRange" | "themeColors" | "securitySetting" | "orgSetting" | "relationFields" | "relationFiledsCopy" | "loginSetting" | "loginModeAuthTypes" | "openIDOAuthAuthTypes" | "sysLoginSort" | "openIDOAuthAuthSort" | "loginModeConfig" | "basicSetting">, Pick<{
116
+ projectSetting: {};
117
+ setProjectConfig: (config: {}) => void;
118
+ deploySetting: {
119
+ deployMode: import('../..').DeployModeEnum;
120
+ };
121
+ setDeploySetting: (data: import('@gct-paas/api/platform').SysConfigResponse) => void;
122
+ isIndependentApp: import('vue').ComputedRef<boolean>;
123
+ watermarkSetting: {
124
+ openWatermark: boolean;
125
+ watermarkContent: string;
126
+ fontSize: number;
127
+ color: string;
128
+ verticalAlign: string;
129
+ textAlign: string;
130
+ text: string;
131
+ transparent: number;
132
+ width: number;
133
+ height: number;
134
+ };
135
+ postWatermarkSetting: () => Promise<void>;
136
+ setWatermarkSetting: (data: import('@gct-paas/api/platform').SysConfigResponse) => void;
137
+ themeSetting: import('../..').IThemeSetting;
138
+ setThemeSetting: (data: import('@gct-paas/api/platform').SysConfigResponse) => void;
139
+ postThemeSetting: () => Promise<void>;
140
+ menuCollapsed: import('vue').Ref<boolean, boolean>;
141
+ toggleMenuCollapsed: () => void;
142
+ menuCollapsedWidth: number;
143
+ menuWidthRange: number[];
144
+ themeColors: string[];
145
+ securitySetting: import('@gct-paas/api/platform').SecurityConfig;
146
+ postSecuritySetting: () => Promise<void>;
147
+ setSecuritySetting: (data: import('@gct-paas/api/platform').SysConfigResponse) => void;
148
+ orgSetting: import('@gct-paas/api/platform').OrgConfig;
149
+ setOrgSetting: (data: import('@gct-paas/api/platform').SysConfigResponse) => void;
150
+ postOrgSetting: () => Promise<void>;
151
+ relationFields: import('vue').Ref<{
152
+ label: string;
153
+ value: string;
154
+ type: number;
155
+ }[], {
156
+ label: string;
157
+ value: string;
158
+ type: number;
159
+ }[] | {
160
+ label: string;
161
+ value: string;
162
+ type: number;
163
+ }[]>;
164
+ relationFiledsCopy: import('vue').Ref<{
165
+ label: string;
166
+ value: string;
167
+ }[], {
168
+ label: string;
169
+ value: string;
170
+ }[] | {
171
+ label: string;
172
+ value: string;
173
+ }[]>;
174
+ loginSetting: import('@gct-paas/api/platform').AuthConfig;
175
+ postLoginSetting: () => Promise<void>;
176
+ setLoginSetting: (config: import('@gct-paas/api/platform').SysConfigResponse | undefined) => void;
177
+ loginModeAuthTypes: import('vue').Ref<string[], string[]>;
178
+ openIDOAuthAuthTypes: import('vue').Ref<string[], string[]>;
179
+ sysLoginSort: import('vue').Ref<IObject[], IObject[]>;
180
+ openIDOAuthAuthSort: import('vue').Ref<IObject[], IObject[]>;
181
+ loginModeConfig: Map<string, IObject>;
182
+ basicSetting: import('@gct-paas/api/platform').PlatformBaseConfig;
183
+ setBasicSetting: (data: import('@gct-paas/api/platform').SysConfigResponse, transfer?: boolean) => void;
184
+ postBasicSetting: () => Promise<string>;
185
+ init: () => Promise<void>;
186
+ renderInit: () => Promise<void>;
187
+ }, "isIndependentApp">, Pick<{
188
+ projectSetting: {};
189
+ setProjectConfig: (config: {}) => void;
190
+ deploySetting: {
191
+ deployMode: import('../..').DeployModeEnum;
192
+ };
193
+ setDeploySetting: (data: import('@gct-paas/api/platform').SysConfigResponse) => void;
194
+ isIndependentApp: import('vue').ComputedRef<boolean>;
195
+ watermarkSetting: {
196
+ openWatermark: boolean;
197
+ watermarkContent: string;
198
+ fontSize: number;
199
+ color: string;
200
+ verticalAlign: string;
201
+ textAlign: string;
202
+ text: string;
203
+ transparent: number;
204
+ width: number;
205
+ height: number;
206
+ };
207
+ postWatermarkSetting: () => Promise<void>;
208
+ setWatermarkSetting: (data: import('@gct-paas/api/platform').SysConfigResponse) => void;
209
+ themeSetting: import('../..').IThemeSetting;
210
+ setThemeSetting: (data: import('@gct-paas/api/platform').SysConfigResponse) => void;
211
+ postThemeSetting: () => Promise<void>;
212
+ menuCollapsed: import('vue').Ref<boolean, boolean>;
213
+ toggleMenuCollapsed: () => void;
214
+ menuCollapsedWidth: number;
215
+ menuWidthRange: number[];
216
+ themeColors: string[];
217
+ securitySetting: import('@gct-paas/api/platform').SecurityConfig;
218
+ postSecuritySetting: () => Promise<void>;
219
+ setSecuritySetting: (data: import('@gct-paas/api/platform').SysConfigResponse) => void;
220
+ orgSetting: import('@gct-paas/api/platform').OrgConfig;
221
+ setOrgSetting: (data: import('@gct-paas/api/platform').SysConfigResponse) => void;
222
+ postOrgSetting: () => Promise<void>;
223
+ relationFields: import('vue').Ref<{
224
+ label: string;
225
+ value: string;
226
+ type: number;
227
+ }[], {
228
+ label: string;
229
+ value: string;
230
+ type: number;
231
+ }[] | {
232
+ label: string;
233
+ value: string;
234
+ type: number;
235
+ }[]>;
236
+ relationFiledsCopy: import('vue').Ref<{
237
+ label: string;
238
+ value: string;
239
+ }[], {
240
+ label: string;
241
+ value: string;
242
+ }[] | {
243
+ label: string;
244
+ value: string;
245
+ }[]>;
246
+ loginSetting: import('@gct-paas/api/platform').AuthConfig;
247
+ postLoginSetting: () => Promise<void>;
248
+ setLoginSetting: (config: import('@gct-paas/api/platform').SysConfigResponse | undefined) => void;
249
+ loginModeAuthTypes: import('vue').Ref<string[], string[]>;
250
+ openIDOAuthAuthTypes: import('vue').Ref<string[], string[]>;
251
+ sysLoginSort: import('vue').Ref<IObject[], IObject[]>;
252
+ openIDOAuthAuthSort: import('vue').Ref<IObject[], IObject[]>;
253
+ loginModeConfig: Map<string, IObject>;
254
+ basicSetting: import('@gct-paas/api/platform').PlatformBaseConfig;
255
+ setBasicSetting: (data: import('@gct-paas/api/platform').SysConfigResponse, transfer?: boolean) => void;
256
+ postBasicSetting: () => Promise<string>;
257
+ init: () => Promise<void>;
258
+ renderInit: () => Promise<void>;
259
+ }, "setProjectConfig" | "setDeploySetting" | "postWatermarkSetting" | "setWatermarkSetting" | "setThemeSetting" | "postThemeSetting" | "toggleMenuCollapsed" | "postSecuritySetting" | "setSecuritySetting" | "setOrgSetting" | "postOrgSetting" | "postLoginSetting" | "setLoginSetting" | "setBasicSetting" | "postBasicSetting" | "init" | "renderInit">>;
34
260
  /**
35
261
  * 全局 router 工具类
36
262
  */
@@ -14,6 +14,11 @@ import { RouterUtil } from "../../router/index.mjs";
14
14
  * @class GctGlobal
15
15
  */
16
16
  var GctGlobal = class {
17
+ /**
18
+ * 模块联邦实例
19
+ *
20
+ * @description 使用规范参考官方文档: https://module-federation.io/zh/guide/start/index.html
21
+ */
17
22
  /**
18
23
  * i18n 工具类
19
24
  */
@@ -34,6 +39,11 @@ var GctGlobal = class {
34
39
  */
35
40
  store = this.storeUtil.store;
36
41
  /**
42
+ * 全局平台配置 store 实例
43
+ *
44
+ */
45
+ platformStore = this.storeUtil.platformConfigStore;
46
+ /**
37
47
  * 全局 router 工具类
38
48
  */
39
49
  routerUtil = new RouterUtil();
package/es/index.mjs CHANGED
@@ -68,6 +68,15 @@ import { sizeParser, typeParser } from "./utils/file/parser.mjs";
68
68
  import { isMultipleOperator } from "./utils/design/design.mjs";
69
69
  import { permission } from "./utils/permission.mjs";
70
70
  import "./utils/index.mjs";
71
+ import { LoginSortTypeEnum, LoginTypeEnum } from "./modules/platform-config/enums/login.enum.mjs";
72
+ import { KickRuleEnum, PassRule } from "./modules/platform-config/enums/platform.enum.mjs";
73
+ import { DeployModeEnum } from "./modules/platform-config/enums/deploy.enum.mjs";
74
+ import { OTHER_LOGIN_KEYS, SYSTEM_LOGIN_KEYS, getLoginTypeOptions } from "./modules/platform-config/constants/login.const.mjs";
75
+ import { RELATION_FIELDS } from "./modules/platform-config/constants/org.const.mjs";
76
+ import { MENU_COLLAPSED_WIDTH, MENU_WIDTH_RANGE, THEME_COLORS } from "./modules/platform-config/constants/theme.const.mjs";
77
+ import { WATERMARK_INIT_DATA } from "./modules/platform-config/constants/watermark.const.mjs";
78
+ import { usePlatformConfigStore } from "./modules/platform-config/store.mjs";
79
+ import "./modules/platform-config/index.mjs";
71
80
  import { GlobalStoreUtil } from "./store/index.mjs";
72
81
  import { EnvironmentType } from "./modules/env-manager/env-manager.interface.mjs";
73
82
  import { APP_PREVIEW_PATH_REG, APP_PROD_PATH_REG, APP_RUN_PATH_REG, DEV_SINGLE_PATH_REG, HOST_REG, IP_REG, TEST_SINGLE_PATH_REG } from "./modules/env-manager/env-manager.const.mjs";
@@ -87,15 +96,6 @@ import { copyTextToClipboard, isDef, useCopyToClipboard } from "./hooks/useCopyT
87
96
  import "./hooks/index.mjs";
88
97
  import { ErrorStrategyFactory } from "./modules/error-handler/error-strategy.mjs";
89
98
  import { ErrorHandler, setupErrorHandler } from "./modules/error-handler/index.mjs";
90
- import { LoginSortTypeEnum, LoginTypeEnum } from "./modules/platform-config/enums/login.enum.mjs";
91
- import { KickRuleEnum, PassRule } from "./modules/platform-config/enums/platform.enum.mjs";
92
- import { DeployModeEnum } from "./modules/platform-config/enums/deploy.enum.mjs";
93
- import { OTHER_LOGIN_KEYS, SYSTEM_LOGIN_KEYS, getLoginTypeOptions } from "./modules/platform-config/constants/login.const.mjs";
94
- import { RELATION_FIELDS } from "./modules/platform-config/constants/org.const.mjs";
95
- import { MENU_COLLAPSED_WIDTH, MENU_WIDTH_RANGE, THEME_COLORS } from "./modules/platform-config/constants/theme.const.mjs";
96
- import { WATERMARK_INIT_DATA } from "./modules/platform-config/constants/watermark.const.mjs";
97
- import { usePlatformConfigStore } from "./modules/platform-config/store.mjs";
98
- import "./modules/platform-config/index.mjs";
99
99
  import { useUserStore } from "./modules/user-stores/store/user.store.mjs";
100
100
  import { useTenantStore } from "./modules/user-stores/store/tenant.store.mjs";
101
101
  import { usePermissionStore } from "./modules/user-stores/store/permission.store.mjs";
@@ -1,5 +1,4 @@
1
1
  import { createI18n } from "vue-i18n";
2
- import { HttpUtil } from "@gct-paas/api";
3
2
  //#region src/locale/index.ts
4
3
  var LocaleUtil = class {
5
4
  i18n = createI18n({
@@ -21,22 +20,16 @@ var LocaleUtil = class {
21
20
  await this.loadMessages(platformUrl);
22
21
  }
23
22
  async loadLocales() {
24
- const data = await HttpUtil.get("/gct-platform/api/i18n-config/list");
25
- if (data) {
26
- const defaultItem = data.find((item) => item.defaultLanguage);
27
- if (defaultItem) this.locale = defaultItem.languageTag;
28
- }
23
+ const res = await (await fetch("/gct-platform/api/i18n-config/list")).json();
24
+ if (res.code === 200) this.locale = res.data.find((item) => item.defaultLanguage).languageTag;
29
25
  }
30
26
  async loadMessages(url, locale = this.locale) {
31
- const data = await HttpUtil.get(url);
32
- if (data) {
33
- const messages = data.split("\n").reduce((acc, item) => {
34
- const [key, ...value] = item.split(":");
35
- acc[key] = value.join(":");
36
- return acc;
37
- }, {});
38
- this.i18n.global.mergeLocaleMessage(locale, messages);
39
- }
27
+ const messages = (await (await fetch(url)).text()).split("\n").reduce((acc, item) => {
28
+ const [key, ...value] = item.split(":");
29
+ acc[key] = value.join(":");
30
+ return acc;
31
+ }, {});
32
+ this.i18n.global.mergeLocaleMessage(locale, messages);
40
33
  }
41
34
  getMessageUrl(payload) {
42
35
  if ("app" in payload) {
@@ -5,4 +5,4 @@
5
5
  export * from './enums/index';
6
6
  export * from './interfaces/index';
7
7
  export * from './constants/index';
8
- export { usePlatformConfigStore } from './store';
8
+ export { usePlatformConfigStore, type IPlatformConfigStore } from './store';
@@ -219,3 +219,4 @@ export declare const usePlatformConfigStore: import('pinia').StoreDefinition<"pl
219
219
  init: () => Promise<void>;
220
220
  renderInit: () => Promise<void>;
221
221
  }, "setProjectConfig" | "setDeploySetting" | "postWatermarkSetting" | "setWatermarkSetting" | "setThemeSetting" | "postThemeSetting" | "toggleMenuCollapsed" | "postSecuritySetting" | "setSecuritySetting" | "setOrgSetting" | "postOrgSetting" | "postLoginSetting" | "setLoginSetting" | "setBasicSetting" | "postBasicSetting" | "init" | "renderInit">>;
222
+ export type IPlatformConfigStore = ReturnType<typeof usePlatformConfigStore>;
package/es/setup-app.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { getToken } from "./utils/tools/tools.mjs";
2
2
  import { interceptors } from "./utils/axios/interceptors.mjs";
3
3
  import "./utils/index.mjs";
4
- import { setupErrorHandler } from "./modules/error-handler/index.mjs";
5
4
  import { usePlatformConfigStore } from "./modules/platform-config/store.mjs";
6
5
  import "./modules/platform-config/index.mjs";
6
+ import { setupErrorHandler } from "./modules/error-handler/index.mjs";
7
7
  import { useUserStore } from "./modules/user-stores/store/user.store.mjs";
8
8
  import "./modules/user-stores/index.mjs";
9
9
  import { HttpUtil } from "@gct-paas/api";
@@ -1,4 +1,5 @@
1
1
  import { IGlobalStore } from './global-store';
2
+ import { IPlatformConfigStore } from '../modules/platform-config';
2
3
  /**
3
4
  * 全局的状态管理工具类
4
5
  *
@@ -15,5 +16,11 @@ export declare class GlobalStoreUtil {
15
16
  *
16
17
  */
17
18
  readonly store: IGlobalStore;
19
+ /**
20
+ * 全局平台配置状态管理实例
21
+ *
22
+ * @type {IPlatformConfigStore}
23
+ */
24
+ readonly platformConfigStore: IPlatformConfigStore;
18
25
  constructor();
19
26
  }
@@ -1,4 +1,6 @@
1
1
  import { useGlobalStore } from "./global-store.mjs";
2
+ import { usePlatformConfigStore } from "../modules/platform-config/store.mjs";
3
+ import "../modules/platform-config/index.mjs";
2
4
  import { createPinia, setActivePinia } from "pinia";
3
5
  //#region src/store/index.ts
4
6
  /**
@@ -17,9 +19,16 @@ var GlobalStoreUtil = class {
17
19
  *
18
20
  */
19
21
  store;
22
+ /**
23
+ * 全局平台配置状态管理实例
24
+ *
25
+ * @type {IPlatformConfigStore}
26
+ */
27
+ platformConfigStore;
20
28
  constructor() {
21
29
  setActivePinia(this.pinia);
22
30
  this.store = useGlobalStore();
31
+ this.platformConfigStore = usePlatformConfigStore();
23
32
  }
24
33
  };
25
34
  //#endregion
@@ -6,6 +6,7 @@ import type { GctGlobal } from '../global';
6
6
  import type { ApiManage as APaasApiManage } from '@gct-paas/api/apaas';
7
7
  import type { ApiManage as PlatformApiManage } from '@gct-paas/api/platform';
8
8
  import type { bus } from 'wujie';
9
+ // import type { ModuleFederation } from '@module-federation/runtime';
9
10
 
10
11
  /**
11
12
  * 全局 api 对象
@@ -28,6 +29,10 @@ declare global {
28
29
  * paas 平台 API 管理
29
30
  */
30
31
  const _api: GlobalApi;
32
+ /**
33
+ * 模块联邦运行时对象
34
+ */
35
+ // const _mf: ModuleFederation;
31
36
 
32
37
  interface Window {
33
38
  /**
@@ -50,6 +55,12 @@ declare global {
50
55
  * @type {*}
51
56
  */
52
57
  $wujie: { props: IObject; bus: bus };
58
+ /**
59
+ * 模块联邦运行时对象
60
+ *
61
+ * @type {ModuleFederation}
62
+ */
63
+ // _mf: ModuleFederation;
53
64
  }
54
65
 
55
66
  interface ImportMetaEnv {
@@ -1,4 +1,4 @@
1
- import { getTenant, getTimezone, getToken, isMobile } from "../tools/tools.mjs";
1
+ import { getTenant, getTimezone, getToken } from "../tools/tools.mjs";
2
2
  import { AxiosHeaders } from "axios";
3
3
  //#region src/utils/axios/interceptors.ts
4
4
  /**
@@ -12,7 +12,6 @@ function interceptors(axios) {
12
12
  if (!config.headers) config.headers = new AxiosHeaders();
13
13
  Object.assign(config.headers, {
14
14
  Token: getToken(),
15
- Source: isMobile ? 502 : 501,
16
15
  Lang: _gct.store.lang,
17
16
  "Tenant-Id": getTenant(),
18
17
  Timezone: getTimezone()
@@ -1,37 +1,12 @@
1
1
  /**
2
2
  * 插件静态资源工具类
3
3
  *
4
+ * @description 此文件只能在插件中使用,并且初始化必须是在插件的入口文件中进行,且传入的 mateUrl 必须是插件入口文件的 URL。
4
5
  * @export
5
6
  * @class PluginStaticResource
6
7
  */
7
8
  export declare class PluginStaticResource {
8
- private isDev;
9
- /**
10
- * 计算出的静态资源跟路径
11
- *
12
- * @protected
13
- * @type {string}
14
- */
15
- protected baseDir: string;
16
- /**
17
- * mete 路径解析对象
18
- *
19
- * @protected
20
- * @type {URL}
21
- */
22
- protected url: URL;
23
- /**
24
- * 插件静态资源工具类.
25
- *
26
- * @param {string} mateUrl
27
- * @param {boolean} [isDev=false]
28
- */
9
+ protected baseUrl: URL;
29
10
  constructor(mateUrl: string, isDev?: boolean);
30
- /**
31
- * 合并输出静态资源目录
32
- *
33
- * @param {string} pathStr
34
- * @return {*} {string}
35
- */
36
11
  dir(pathStr: string): string;
37
12
  }
@@ -1,46 +1,19 @@
1
- import path from "path-browserify";
2
1
  //#region src/utils/plugin-static-resource/plugin-static-resource.ts
3
2
  /**
4
3
  * 插件静态资源工具类
5
4
  *
5
+ * @description 此文件只能在插件中使用,并且初始化必须是在插件的入口文件中进行,且传入的 mateUrl 必须是插件入口文件的 URL。
6
6
  * @export
7
7
  * @class PluginStaticResource
8
8
  */
9
9
  var PluginStaticResource = class {
10
- /**
11
- * 计算出的静态资源跟路径
12
- *
13
- * @protected
14
- * @type {string}
15
- */
16
- baseDir;
17
- /**
18
- * mete 路径解析对象
19
- *
20
- * @protected
21
- * @type {URL}
22
- */
23
- url;
24
- /**
25
- * 插件静态资源工具类.
26
- *
27
- * @param {string} mateUrl
28
- * @param {boolean} [isDev=false]
29
- */
10
+ baseUrl;
30
11
  constructor(mateUrl, isDev = false) {
31
- this.isDev = isDev;
32
- this.url = new URL(mateUrl);
33
- this.baseDir = path.dirname(this.url.pathname);
12
+ const url = new URL(mateUrl);
13
+ this.baseUrl = new URL(isDev ? "../" : "./", url);
34
14
  }
35
- /**
36
- * 合并输出静态资源目录
37
- *
38
- * @param {string} pathStr
39
- * @return {*} {string}
40
- */
41
15
  dir(pathStr) {
42
- if (this.isDev === true) return pathStr;
43
- return this.url.origin + path.resolve(this.baseDir, pathStr);
16
+ return new URL(pathStr, this.baseUrl).href;
44
17
  }
45
18
  };
46
19
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/core",
3
- "version": "0.1.4-dev.13",
3
+ "version": "0.1.4-dev.14",
4
4
  "type": "module",
5
5
  "description": "paas 平台核心包",
6
6
  "main": "dist/index.min.cjs",
@@ -50,6 +50,7 @@
50
50
  "dependencies": {
51
51
  "@fingerprintjs/fingerprintjs": "^5.1.0",
52
52
  "@gct-paas/api": "^0.1.1",
53
+ "@module-federation/runtime": "^2.2.3",
53
54
  "@vueuse/core": "^14.1.0",
54
55
  "async-validator": "^4.2.5",
55
56
  "axios": "^1.13.2",
@@ -59,7 +60,6 @@
59
60
  "mitt": "^3.0.1",
60
61
  "mqtt": "^5.15.0",
61
62
  "overlayscrollbars": "^2.14.0",
62
- "path-browserify": "^1.0.1",
63
63
  "pinia": "^3.0.4",
64
64
  "qs": "^6.15.0",
65
65
  "qx-util": "^0.4.8",
@@ -69,13 +69,9 @@
69
69
  "wujie": "^1.0.29"
70
70
  },
71
71
  "devDependencies": {
72
- "@gct-paas/build": "^0.1.6-dev.4",
73
- "@types/lodash-es": "^4.17.12",
74
- "@types/path-browserify": "^1.0.3",
75
- "@types/qs": "^6.15.0",
76
72
  "@vue/test-utils": "^2.4.6",
77
73
  "fs-extra": "^11.3.3",
78
74
  "playwright": "^1.58.0"
79
75
  },
80
- "gitHead": "730343d424ac98e1cd00b6f4cddf8a9823a48357"
76
+ "gitHead": "d03e6d5c7bd1c3edf73777ce40e0c0ed4982622f"
81
77
  }