@zxiaosi/sdk 0.1.1 → 0.1.3

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
@@ -1,75 +1,39 @@
1
- ## 项目结构
1
+ ## 介绍
2
2
 
3
- ```sh
4
- ├── src
5
- | └── core # sdk 实例
6
- | └── plugins # sdk 插件
7
- | └── config # SdkConfigPlugin 配置插件
8
- | └── storage # SdkStoragePlugin 本地缓存插件
9
- | └── index # 导出插件
10
- | └── utils
11
- ├── index # 入口
12
- ├── types # 类型定义
13
- ```
14
-
15
- ## 如何开发一个自己的插件?
16
-
17
- 1. 在 `/src/plugins` 下新建一个文件夹,比如 `custom`,然后在 `src/custom/index.ts` 中导出插件的构造函数
3
+ - 旨在简化微前端功能
18
4
 
19
- ```ts
20
- import { merge } from 'es-toolkit';
5
+ - [规划图地址](https://excalidraw.com/#json=s2zc7f8zAhOnhX6NEMKcv,0qIxSEqNMs7vwkq0a6G2yQ)
21
6
 
22
- interface CustomProps {}
7
+ ![](https://cdn.zxiaosi.com/hexo/micro-sdk/sdk1.0.png)
23
8
 
24
- interface CustomResult extends Required<CustomProps> {}
9
+ ## SDK 使用
25
10
 
26
- /** 插件名称 */
27
- const pluginName = 'custom';
11
+ - 主应用, `sdk.use(Plugin, options)`, `sdk.mount('sdk')` 使用插件, 挂载到 `window` 上
28
12
 
29
- /**
30
- * CustomPlugin 插件
31
- * - 详见配置 {@link CustomProps} {@link CustomResult}
32
- */
33
- const SdkCustomPlugin: Plugin<'custom'> = {
34
- name: pluginName,
35
- install(sdk, options = {}) {
36
- // 默认插件配置
37
- const defaultOptions = {} satisfies CustomResult;
38
-
39
- sdk[pluginName] = merge(defaultOptions, options);
40
- },
41
- };
42
-
43
- export { SdkCustomPlugin, CustomProps, CustomResult };
44
- ```
13
+ ```js
14
+ // main.ts
45
15
 
46
- 2. `/src/plugins/index.ts` 导出插件
16
+ import { SdkApiPlugin, sdk } from '@zxiaosi/sdk';
47
17
 
48
- ```ts
49
- export * from './custom';
18
+ sdk
19
+ .use(SdkApiPlugin, {
20
+ config: {
21
+ baseURL: '/api',
22
+ },
23
+ })
24
+ .mount('sdk');
50
25
  ```
51
26
 
52
- 3. `/src/types` 中的 `PluginOptions` 和 `PluginResults` 加上自己的插件类型定义
27
+ - 子应用 `sdk.extend('sdk')`, `window` 上找实例
53
28
 
54
- ```ts
55
- interface PluginOptions {
56
- custom?: CustomProps;
57
- }
58
-
59
- interface PluginResults {
60
- custom: CustomResult;
61
- }
62
- ```
63
-
64
- 4. 在 `/src/core/index.ts` 中定义插件变量
29
+ ```js
30
+ // main.ts
65
31
 
66
- ```ts
67
- class Sdk implements SdkResult {
68
- name: BaseProps['name'];
69
- plugins: BaseProps['plugins'];
32
+ import { sdk } from '@zxiaosi/sdk';
70
33
 
71
- custom: SdkResult['custom'];
34
+ // qiankun 生命周期
35
+ export async function mount(props: any) {
36
+ sdk.extend('sdk');
37
+ render(props);
72
38
  }
73
39
  ```
74
-
75
- ## SDK 实现功能
@@ -0,0 +1,101 @@
1
+ import { ProLayoutProps } from "@ant-design/pro-layout";
2
+ import { ConfigProviderProps } from "antd";
3
+ import { RouteObject } from "react-router-dom";
4
+
5
+ //#region src/plugins/config/index.d.ts
6
+ interface ConfigOptions {
7
+ /** 环境变量(主应用共享给子应用变量) */
8
+ env?: Record<string, any>;
9
+ /** 主题 */
10
+ theme?: ThemeProps;
11
+ /** 国际化 */
12
+ locale?: LocaleProps;
13
+ /**
14
+ * Qiankun模式(切换模式后请重新打开页面)
15
+ * - router: 基于路由模式
16
+ * - load: 手动加载模式
17
+ */
18
+ qiankunMode?: 'router' | 'load';
19
+ /** 登录页路由 */
20
+ loginPath?: string;
21
+ /**
22
+ * 登录后跳转的路由
23
+ * - 优先使用指定值
24
+ * - 其次使用重定向的值
25
+ * - 最后使用菜单中第一项
26
+ */
27
+ defaultPath?: string;
28
+ /**
29
+ * 自定义路由信息
30
+ * - 目前只支持最外层路由自定义
31
+ * - 会合并到 sdk.app.allRoutes 中
32
+ */
33
+ customRoutes?: RouteObject[];
34
+ /** Antd 配置 */
35
+ antdConfig?: ConfigProviderProps;
36
+ /** ProLayout 配置 */
37
+ proLayoutConfig?: ProLayoutProps;
38
+ }
39
+ interface ConfigResults extends Required<ConfigOptions> {}
40
+ /**
41
+ * Sdk 配置信息
42
+ * - 详情参考 {@link ConfigOptions} {@link ConfigResults}
43
+ * - 配置 env 环境变量
44
+ * - 配置 默认主题、国际化
45
+ * - 配置 Qiankun 模式
46
+ * - 配置 默认登录路径、跳转路径、自定义路由
47
+ * - 配置 Antd 配置、ProLayout 配置
48
+ */
49
+ declare const SdkConfigPlugin: Plugin<'config'>;
50
+ //#endregion
51
+ //#region src/types.d.ts
52
+ type ThemeProps = 'light' | 'dark' | (string & {});
53
+ type LocaleProps = 'zh-CN' | 'en-US' | (string & {});
54
+ interface PluginOptions {
55
+ /** Sdk 配置信息 */
56
+ config?: ConfigOptions;
57
+ }
58
+ interface PluginResults {
59
+ /** Sdk 配置信息 */
60
+ config: ConfigResults;
61
+ }
62
+ type PluginName = keyof PluginOptions;
63
+ interface Plugin<K extends PluginName> {
64
+ /** 插件名字 */
65
+ name: K;
66
+ /** 插件安装方法 */
67
+ install(sdk: SdkResult, options?: PluginOptions[K]): void;
68
+ /** 插件配置项 */
69
+ options?: PluginOptions[K];
70
+ }
71
+ interface SdkBase {
72
+ /** SDK 名称 */
73
+ name: string;
74
+ /** 插件列表 */
75
+ _plugins: Map<string, any>;
76
+ /** 挂载sdk - 主应用挂载 SDK 到 Window */
77
+ mount(name: string): void;
78
+ /** 继承sdk - 子应用从 Window 上继承 SDK */
79
+ extend(name: string): void;
80
+ /** 使用插件 */
81
+ use<K extends PluginName>(plugin: Plugin<K>, options?: PluginOptions[K]): this;
82
+ }
83
+ type SdkResult = SdkBase & PluginResults;
84
+ //#endregion
85
+ //#region src/core/index.d.ts
86
+ declare class Sdk implements SdkResult {
87
+ name: SdkResult['name'];
88
+ _plugins: SdkResult['_plugins'];
89
+ config: SdkResult['config'];
90
+ constructor();
91
+ mount(name: string): void;
92
+ extend(name: string): void;
93
+ use<K extends keyof PluginOptions>(plugin: Plugin<K>, options?: PluginOptions[K]): this;
94
+ }
95
+ /**
96
+ * sdk 实例
97
+ */
98
+ declare const sdk: Sdk;
99
+ //#endregion
100
+ export { type ConfigOptions, type ConfigResults, SdkConfigPlugin, sdk };
101
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ const e=new class{name;_plugins;config;constructor(){this.name=``,this._plugins=new Map}mount(e){if(window[e])throw Error(`The SDK already exists - ${e}`);console.log(`%c SDK mounted:`,`color: pink; font-weight: bold;`,e),this.name=e;let t=new Proxy(this,{get:(e,t,n)=>e?Reflect.get(e,t,n):null,set:()=>(console.error(`The SDK cannot be modified.`),!1),deleteProperty:()=>(console.error(`The SDK cannot be deleted.`),!1)});window[this.name]=t}extend(e){if(!window[e])throw Error(`The SDK not found - ${e}`);console.log(`%c SDK extended:`,`color: pink; font-weight: bold;`,e),Object.assign(this,window[e])}use(e,t){let{name:n,install:r}=e;if(!n)throw Error(`${n} plugin has no name`);if(typeof r!=`function`)throw Error(`${n} plugin is not a function`);return r(this,t),this._plugins.set(n,{...e,options:t}),this}};function t(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(e)===`[object Object]`:!1}function n(e){return e===`__proto__`}function r(e,i){let a=Object.keys(i);for(let o=0;o<a.length;o++){let s=a[o];if(n(s))continue;let c=i[s],l=e[s];Array.isArray(c)?Array.isArray(l)?e[s]=r(l,c):e[s]=r([],c):t(c)?t(l)?e[s]=r(l,c):e[s]=r({},c):(l===void 0||c!==void 0)&&(e[s]=c)}return e}const i=`config`,a={name:i,install(e,t={}){e[i]=r({env:{},qiankunMode:`router`,theme:null,locale:null,loginPath:`/login`,defaultPath:``,customRoutes:[],antdConfig:{},proLayoutConfig:{title:`Demo`}},t)}};export{a as SdkConfigPlugin,e as sdk};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["SdkConfigPlugin: Plugin<'config'>"],"sources":["../src/core/index.ts","../../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs","../../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs","../../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/object/merge.mjs","../src/plugins/config/index.ts"],"sourcesContent":["import type { Plugin, PluginOptions, SdkResult } from '@/types';\n\nclass Sdk implements SdkResult {\n name: SdkResult['name'];\n _plugins: SdkResult['_plugins'];\n\n config: SdkResult['config'];\n\n constructor() {\n this.name = '';\n this._plugins = new Map();\n }\n\n mount(name: string) {\n if (window[name]) throw new Error(`The SDK already exists - ${name}`);\n console.log('%c SDK mounted:', 'color: pink; font-weight: bold;', name);\n\n // 设置名称\n this.name = name;\n\n // 使用 new Proxy 禁止控制台对sdk属性的操作 (仅第一层属性)\n const _this = new Proxy(this, {\n get: (target, key, receiver) => {\n if (!target) return null;\n return Reflect.get(target, key, receiver);\n },\n set: () => {\n console.error('The SDK cannot be modified.');\n return false;\n },\n deleteProperty: () => {\n console.error('The SDK cannot be deleted.');\n return false;\n },\n });\n\n // 挂载到 Window 上\n window[this.name] = _this;\n }\n\n extend(name: string) {\n if (!window[name]) throw new Error(`The SDK not found - ${name}`);\n console.log('%c SDK extended:', 'color: pink; font-weight: bold;', name);\n\n // 合并实例属性\n Object.assign(this, window[name]);\n }\n\n use<K extends keyof PluginOptions>(\n plugin: Plugin<K>,\n options?: PluginOptions[K],\n ) {\n const { name, install } = plugin;\n\n if (!name) throw new Error(`${name} plugin has no name`);\n\n if (typeof install !== 'function')\n throw new Error(`${name} plugin is not a function`);\n\n // 插件安装\n install(this, options);\n\n // 添加到插件列表\n this._plugins.set(name, { ...plugin, options });\n\n // 链式调用\n return this;\n }\n}\n\n/**\n * sdk 实例\n */\nconst sdk = new Sdk();\n\nexport { sdk };\n","function isPlainObject(value) {\n if (!value || typeof value !== 'object') {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n const hasObjectPrototype = proto === null ||\n proto === Object.prototype ||\n Object.getPrototypeOf(proto) === null;\n if (!hasObjectPrototype) {\n return false;\n }\n return Object.prototype.toString.call(value) === '[object Object]';\n}\n\nexport { isPlainObject };\n","function isUnsafeProperty(key) {\n return key === '__proto__';\n}\n\nexport { isUnsafeProperty };\n","import { isUnsafeProperty } from '../_internal/isUnsafeProperty.mjs';\nimport { isPlainObject } from '../predicate/isPlainObject.mjs';\n\nfunction merge(target, source) {\n const sourceKeys = Object.keys(source);\n for (let i = 0; i < sourceKeys.length; i++) {\n const key = sourceKeys[i];\n if (isUnsafeProperty(key)) {\n continue;\n }\n const sourceValue = source[key];\n const targetValue = target[key];\n if (Array.isArray(sourceValue)) {\n if (Array.isArray(targetValue)) {\n target[key] = merge(targetValue, sourceValue);\n }\n else {\n target[key] = merge([], sourceValue);\n }\n }\n else if (isPlainObject(sourceValue)) {\n if (isPlainObject(targetValue)) {\n target[key] = merge(targetValue, sourceValue);\n }\n else {\n target[key] = merge({}, sourceValue);\n }\n }\n else if (targetValue === undefined || sourceValue !== undefined) {\n target[key] = sourceValue;\n }\n }\n return target;\n}\n\nexport { merge };\n","import type { LocaleProps, Plugin, ThemeProps } from '@/types';\nimport type { ProLayoutProps } from '@ant-design/pro-layout';\nimport type { ConfigProviderProps } from 'antd';\nimport { merge } from 'es-toolkit';\nimport type { RouteObject } from 'react-router-dom';\n\ninterface ConfigOptions {\n /** 环境变量(主应用共享给子应用变量) */\n env?: Record<string, any>;\n\n /** 主题 */\n theme?: ThemeProps;\n /** 国际化 */\n locale?: LocaleProps;\n\n /**\n * Qiankun模式(切换模式后请重新打开页面)\n * - router: 基于路由模式\n * - load: 手动加载模式\n */\n qiankunMode?: 'router' | 'load';\n\n /** 登录页路由 */\n loginPath?: string;\n /**\n * 登录后跳转的路由\n * - 优先使用指定值\n * - 其次使用重定向的值\n * - 最后使用菜单中第一项\n */\n defaultPath?: string;\n /**\n * 自定义路由信息\n * - 目前只支持最外层路由自定义\n * - 会合并到 sdk.app.allRoutes 中\n */\n customRoutes?: RouteObject[];\n\n /** Antd 配置 */\n antdConfig?: ConfigProviderProps;\n /** ProLayout 配置 */\n proLayoutConfig?: ProLayoutProps;\n}\n\ninterface ConfigResults extends Required<ConfigOptions> {}\n\n/** 插件名称 */\nconst pluginName = 'config';\n\n/**\n * Sdk 配置信息\n * - 详情参考 {@link ConfigOptions} {@link ConfigResults}\n * - 配置 env 环境变量\n * - 配置 默认主题、国际化\n * - 配置 Qiankun 模式\n * - 配置 默认登录路径、跳转路径、自定义路由\n * - 配置 Antd 配置、ProLayout 配置\n */\nconst SdkConfigPlugin: Plugin<'config'> = {\n name: pluginName,\n install(sdk, options = {}) {\n // 默认插件配置\n const defaultOptions = {\n env: {},\n\n qiankunMode: 'router',\n\n theme: null,\n locale: null,\n\n loginPath: '/login',\n defaultPath: '',\n customRoutes: [],\n\n antdConfig: {},\n proLayoutConfig: {\n title: 'Demo',\n },\n } satisfies ConfigResults;\n\n sdk[pluginName] = merge(defaultOptions, options);\n },\n};\n\nexport { SdkConfigPlugin };\nexport type { ConfigOptions, ConfigResults };\n"],"x_google_ignoreList":[1,2,3],"mappings":"AAyEA,MAAM,EAAM,IAvEZ,KAA+B,CAC7B,KACA,SAEA,OAEA,aAAc,CACZ,KAAK,KAAO,GACZ,KAAK,SAAW,IAAI,IAGtB,MAAM,EAAc,CAClB,GAAI,OAAO,GAAO,MAAU,MAAM,4BAA4B,IAAO,CACrE,QAAQ,IAAI,kBAAmB,kCAAmC,EAAK,CAGvE,KAAK,KAAO,EAGZ,IAAM,EAAQ,IAAI,MAAM,KAAM,CAC5B,KAAM,EAAQ,EAAK,IACZ,EACE,QAAQ,IAAI,EAAQ,EAAK,EAAS,CADrB,KAGtB,SACE,QAAQ,MAAM,8BAA8B,CACrC,IAET,oBACE,QAAQ,MAAM,6BAA6B,CACpC,IAEV,CAAC,CAGF,OAAO,KAAK,MAAQ,EAGtB,OAAO,EAAc,CACnB,GAAI,CAAC,OAAO,GAAO,MAAU,MAAM,uBAAuB,IAAO,CACjE,QAAQ,IAAI,mBAAoB,kCAAmC,EAAK,CAGxE,OAAO,OAAO,KAAM,OAAO,GAAM,CAGnC,IACE,EACA,EACA,CACA,GAAM,CAAE,OAAM,WAAY,EAE1B,GAAI,CAAC,EAAM,MAAU,MAAM,GAAG,EAAK,qBAAqB,CAExD,GAAI,OAAO,GAAY,WACrB,MAAU,MAAM,GAAG,EAAK,2BAA2B,CASrD,OANA,EAAQ,KAAM,EAAQ,CAGtB,KAAK,SAAS,IAAI,EAAM,CAAE,GAAG,EAAQ,UAAS,CAAC,CAGxC,OClEX,SAAS,EAAc,EAAO,CAC1B,GAAI,CAAC,GAAS,OAAO,GAAU,SAC3B,MAAO,GAEX,IAAM,EAAQ,OAAO,eAAe,EAAM,CAO1C,OAN2B,IAAU,MACjC,IAAU,OAAO,WACjB,OAAO,eAAe,EAAM,GAAK,KAI9B,OAAO,UAAU,SAAS,KAAK,EAAM,GAAK,kBAFtC,GCTf,SAAS,EAAiB,EAAK,CAC3B,OAAO,IAAQ,YCEnB,SAAS,EAAM,EAAQ,EAAQ,CAC3B,IAAM,EAAa,OAAO,KAAK,EAAO,CACtC,IAAK,IAAI,EAAI,EAAG,EAAI,EAAW,OAAQ,IAAK,CACxC,IAAM,EAAM,EAAW,GACvB,GAAI,EAAiB,EAAI,CACrB,SAEJ,IAAM,EAAc,EAAO,GACrB,EAAc,EAAO,GACvB,MAAM,QAAQ,EAAY,CACtB,MAAM,QAAQ,EAAY,CAC1B,EAAO,GAAO,EAAM,EAAa,EAAY,CAG7C,EAAO,GAAO,EAAM,EAAE,CAAE,EAAY,CAGnC,EAAc,EAAY,CAC3B,EAAc,EAAY,CAC1B,EAAO,GAAO,EAAM,EAAa,EAAY,CAG7C,EAAO,GAAO,EAAM,EAAE,CAAE,EAAY,EAGnC,IAAgB,IAAA,IAAa,IAAgB,IAAA,MAClD,EAAO,GAAO,GAGtB,OAAO,ECeX,MAAM,EAAa,SAWbA,EAAoC,CACxC,KAAM,EACN,QAAQ,EAAK,EAAU,EAAE,CAAE,CAoBzB,EAAI,GAAc,EAlBK,CACrB,IAAK,EAAE,CAEP,YAAa,SAEb,MAAO,KACP,OAAQ,KAER,UAAW,SACX,YAAa,GACb,aAAc,EAAE,CAEhB,WAAY,EAAE,CACd,gBAAiB,CACf,MAAO,OACR,CACF,CAEuC,EAAQ,EAEnD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zxiaosi/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "A micro frontend kit",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,44 +10,35 @@
10
10
  "license": "MIT",
11
11
  "author": "zxiaosi",
12
12
  "type": "module",
13
- "main": "dist/cjs/index.cjs",
14
- "module": "dist/esm/index.mjs",
15
- "types": "dist/esm/index.d.mts",
13
+ "main": "dist/index.js",
14
+ "module": "dist/index.js",
15
+ "types": "dist/index.d.ts",
16
16
  "files": [
17
17
  "dist",
18
18
  "rolldown.config.ts",
19
19
  "tsconfig.json"
20
20
  ],
21
21
  "scripts": {
22
- "build": "npx rimraf dist && rolldown -c rolldown.config.ts",
22
+ "build": "rolldown -c rolldown.config.ts --minify",
23
23
  "dev": "rolldown -c rolldown.config.ts --watch"
24
24
  },
25
25
  "dependencies": {
26
- "@ant-design/pro-layout": "^7.22.7",
27
- "axios": "^1.12.2",
28
- "qiankun": "^2.10.16",
29
- "react-intl-universal": "^2.13.4"
26
+ "@ant-design/pro-layout": "^7.22.7"
30
27
  },
31
28
  "devDependencies": {
32
- "@babel/preset-env": "^7.28.3",
33
- "@babel/preset-react": "^7.27.1",
34
- "@rollup/plugin-babel": "^6.0.4",
35
29
  "@types/react": "^18.3.12",
36
30
  "@types/react-dom": "^18.3.1",
37
- "es-toolkit": "^1.40.0",
38
- "rolldown": "^1.0.0-beta.42",
39
- "rolldown-plugin-dts": "^0.16.11",
40
- "rollup-plugin-node-externals": "^8.1.1"
31
+ "es-toolkit": "^1.42.0",
32
+ "rolldown": "^1.0.0-beta.52",
33
+ "rolldown-plugin-dts": "^0.18.1",
34
+ "rollup-plugin-node-externals": "^8.1.2",
35
+ "typescript": "^5.9.3"
41
36
  },
42
37
  "peerDependencies": {
43
- "@ant-design/icons": "^5.6.1",
44
- "antd": "^5.27.4",
45
- "echarts": "^6.0.0",
46
- "echarts-for-react": "^3.0.4",
38
+ "antd": "^5.29.1",
47
39
  "react": "^18.3.1",
48
40
  "react-dom": "^18.3.1",
49
- "react-router-dom": "^6.30.1",
50
- "zustand": "^5.0.8"
41
+ "react-router-dom": "^6.30.2"
51
42
  },
52
43
  "publishConfig": {
53
44
  "access": "public",
@@ -1,78 +1,21 @@
1
- import babel, { RollupBabelInputPluginOptions } from '@rollup/plugin-babel';
2
1
  import { defineConfig } from 'rolldown';
3
2
  import { dts } from 'rolldown-plugin-dts';
4
3
  import nodeExternals from 'rollup-plugin-node-externals';
5
4
 
6
- /** babel 配置 */
7
- const babelOptions: RollupBabelInputPluginOptions = {
8
- presets: [
9
- [
10
- '@babel/preset-env',
11
- {
12
- modules: false, // 不转换模块语法, 让 Rollup 处理模块语法
13
- targets: {
14
- node: 'current', // 当前 Node.js 版本
15
- },
16
- },
17
- ],
18
- '@babel/preset-react',
19
- ], // 使用 React 和 ES6+ 预设
20
- exclude: 'node_modules/**', // 排除 node_modules 中的文件
21
- babelHelpers: 'bundled', // 使用打包的 Babel 辅助函数, 避免重复打包
22
- };
23
-
24
- /** 通用配置 */
25
- const common = defineConfig({
26
- input: './src/index.ts',
5
+ const config = defineConfig({
27
6
  platform: 'browser', // 作用于浏览器环境
28
7
  tsconfig: './tsconfig.json', // 指定 tsconfig 文件
8
+ input: './src/index.ts', // 入口文件
9
+ plugins: [
10
+ nodeExternals(), // 排除 deps、peerDeps 中的依赖
11
+ dts(),
12
+ ],
29
13
  output: {
14
+ dir: 'dist', // 输出目录
15
+ format: 'es', // 输出格式为 ES 模块
16
+ cleanDir: true, // 构建前清理输出目录
30
17
  sourcemap: true, // 生成 sourcemap 文件
31
- minify: true, // 启用代码压缩, 调试时可以关闭
32
18
  },
33
19
  });
34
20
 
35
- const config = defineConfig([
36
- {
37
- ...common,
38
- plugins: [
39
- nodeExternals(), // 排除 deps、peerDeps 中的依赖
40
- babel(babelOptions),
41
- dts(),
42
- ],
43
- output: {
44
- dir: 'dist/esm',
45
- format: 'es',
46
- entryFileNames: '[name].mjs',
47
- chunkFileNames: '[name]-[hash].mjs',
48
- ...common.output,
49
- },
50
- },
51
- {
52
- ...common,
53
- plugins: [
54
- nodeExternals(), // 排除 deps、peerDeps 中的依赖
55
- babel(babelOptions),
56
- ],
57
- output: {
58
- dir: 'dist/cjs',
59
- format: 'cjs',
60
- entryFileNames: '[name].cjs',
61
- chunkFileNames: '[name]-[hash].cjs',
62
- ...common.output,
63
- },
64
- },
65
- {
66
- ...common,
67
- plugins: [dts({ emitDtsOnly: true })],
68
- output: {
69
- dir: 'dist/cjs',
70
- format: 'esm',
71
- entryFileNames: '[name].cjs',
72
- chunkFileNames: '[name]-[hash].cjs',
73
- ...common.output,
74
- },
75
- },
76
- ]);
77
-
78
21
  export default config;
package/tsconfig.json CHANGED
@@ -1,26 +1,21 @@
1
- {
2
- "compilerOptions": {
3
- "resolveJsonModule": true,
4
- "esModuleInterop": true,
5
- "moduleResolution": "node",
6
- "jsx": "react-jsx",
7
- "module": "commonjs",
8
- "target": "es5",
9
- "allowJs": false,
10
- "noUnusedLocals": false,
11
- "preserveConstEnums": true,
12
- "skipLibCheck": true,
13
- "sourceMap": true,
14
- "inlineSources": true,
15
- "declaration": true,
16
- "experimentalDecorators": true,
17
- "downlevelIteration": true,
18
- "lib": ["DOM", "ESNext"],
19
- "baseUrl": ".",
20
- "paths": {
21
- "@/*": ["src/*"]
22
- }
23
- },
24
- "include": ["src"],
25
- "exclude": ["rolldown.config.ts", "tsconfig.json"]
26
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "jsx": "react-jsx",
5
+ "lib": ["es2023", "DOM"],
6
+ "moduleDetection": "force",
7
+ "module": "preserve",
8
+ "moduleResolution": "bundler",
9
+ "resolveJsonModule": true,
10
+ "types": [],
11
+ "declaration": true,
12
+ "emitDeclarationOnly": true,
13
+ "verbatimModuleSyntax": true,
14
+ "baseUrl": ".",
15
+ "paths": {
16
+ "@/*": ["src/*"]
17
+ }
18
+ },
19
+ "include": ["src"],
20
+ "exclude": ["rolldown.config.ts", "tsconfig.json"]
21
+ }
@@ -1,2 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`antd`);c=s(c);let l=require(`react`);l=s(l);let u=require(`zustand`);u=s(u);let d=require(`zustand/shallow`);d=s(d);let f=require(`react/jsx-runtime`);f=s(f);let p=require(`@ant-design/icons`);p=s(p);let m=require(`react-router-dom`);m=s(m);let h=require(`qiankun`);h=s(h);let g=require(`axios`);g=s(g);let _=require(`react-intl-universal`);_=s(_);let v=require(`zustand/middleware`);v=s(v);let y=require(`@ant-design/pro-layout`);y=s(y);var b=class{constructor(){this.name=``,this._plugins=new Map}mount(e){if(e&&window[e])Object.assign(this,window[e]);else{this.name=e;let t=new Proxy(this,{get:(e,t,n)=>e?Reflect.get(e,t,n):null,set:()=>(console.error(`The SDK cannot be modified.`),!1),deleteProperty:()=>(console.error(`The SDK cannot be deleted.`),!1)});window[this.name]=t}}unmount(){this._plugins.clear(),delete window[this.name]}use(e,t){let{name:n,install:r}=e;if(!n)throw Error(`${n} plugin has no name`);if(typeof r!=`function`)throw Error(`${n} plugin is not a function`);return r(this,t),this._plugins.set(n,{...e,options:t}),this}};const x=new b;function S(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function C(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function w(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function T(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}const ee=`[object RegExp]`,te=`[object String]`,ne=`[object Number]`,re=`[object Boolean]`,ie=`[object Arguments]`,ae=`[object Symbol]`,oe=`[object Date]`,se=`[object Map]`,ce=`[object Set]`,le=`[object Array]`,ue=`[object ArrayBuffer]`,de=`[object Object]`,fe=`[object DataView]`,pe=`[object Uint8Array]`,me=`[object Uint8ClampedArray]`,he=`[object Uint16Array]`,ge=`[object Uint32Array]`,_e=`[object Int8Array]`,ve=`[object Int16Array]`,ye=`[object Int32Array]`,be=`[object Float32Array]`,xe=`[object Float64Array]`;function E(e,t,n,r=new Map,i=void 0){let a=i?.(e,t,n,r);if(a!==void 0)return a;if(S(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=E(e[a],a,n,r,i);return Object.hasOwn(e,`index`)&&(t.index=e.index),Object.hasOwn(e,`input`)&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){let t=new Map;r.set(e,t);for(let[a,o]of e)t.set(a,E(o,a,n,r,i));return t}if(e instanceof Set){let t=new Set;r.set(e,t);for(let a of e)t.add(E(a,void 0,n,r,i));return t}if(typeof Buffer<`u`&&Buffer.isBuffer(e))return e.subarray();if(C(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=E(e[a],a,n,r,i);return t}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,t),D(t,e,n,r,i),t}if(typeof File<`u`&&e instanceof File){let t=new File([e],e.name,{type:e.type});return r.set(e,t),D(t,e,n,r,i),t}if(typeof Blob<`u`&&e instanceof Blob){let t=new Blob([e],{type:e.type});return r.set(e,t),D(t,e,n,r,i),t}if(e instanceof Error){let t=new e.constructor;return r.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,D(t,e,n,r,i),t}if(e instanceof Boolean){let t=new Boolean(e.valueOf());return r.set(e,t),D(t,e,n,r,i),t}if(e instanceof Number){let t=new Number(e.valueOf());return r.set(e,t),D(t,e,n,r,i),t}if(e instanceof String){let t=new String(e.valueOf());return r.set(e,t),D(t,e,n,r,i),t}if(typeof e==`object`&&O(e)){let t=Object.create(Object.getPrototypeOf(e));return r.set(e,t),D(t,e,n,r,i),t}return e}function D(e,t,n=e,r,i){let a=[...Object.keys(t),...w(t)];for(let o=0;o<a.length;o++){let s=a[o],c=Object.getOwnPropertyDescriptor(e,s);(c==null||c.writable)&&(e[s]=E(t[s],s,n,r,i))}}function O(e){switch(T(e)){case`[object Arguments]`:case`[object Array]`:case`[object ArrayBuffer]`:case`[object DataView]`:case`[object Boolean]`:case`[object Date]`:case`[object Float32Array]`:case`[object Float64Array]`:case`[object Int8Array]`:case`[object Int16Array]`:case`[object Int32Array]`:case`[object Map]`:case`[object Number]`:case`[object Object]`:case`[object RegExp]`:case`[object Set]`:case`[object String]`:case`[object Symbol]`:case`[object Uint8Array]`:case`[object Uint8ClampedArray]`:case`[object Uint16Array]`:case`[object Uint32Array]`:return!0;default:return!1}}function k(e){return E(e,void 0,e,new Map,void 0)}function A(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(e)===`[object Object]`:!1}function j(e){return e===`__proto__`}function M(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r++){let i=n[r];if(j(i))continue;let a=t[i],o=e[i];Array.isArray(a)?Array.isArray(o)?e[i]=M(o,a):e[i]=M([],a):A(a)?A(o)?e[i]=M(o,a):e[i]=M({},a):(o===void 0||a!==void 0)&&(e[i]=a)}return e}const N=e=>{let{children:t}=e,[n,r]=(0,u.useStore)(x.store,(0,d.useShallow)(e=>[e.locale,e.theme]));return(0,f.jsx)(c.ConfigProvider,{...(0,l.useMemo)(()=>M(k(x.config.antdConfig),e),[n,r]),children:t})},P={beforeLoad:[async e=>{console.log(`[LifeCycle] before load %c%s`,`color: green;`,e.name)}],beforeMount:[async e=>{console.log(`[LifeCycle] before mount %c%s`,`color: green;`,e.name)}],afterUnmount:[async e=>{console.log(`[LifeCycle] after unmount %c%s`,`color: green;`,e.name)}]},F=e=>{let t=e.storage.getTheme();if(t)return t;let n=e.config?.theme;if(n)return n;let r=window.matchMedia(`(prefers-color-scheme: dark)`);return r.matches&&r.matches?`dark`:`light`},I=e=>e.storage.getLocale()||e.config?.locale||navigator.language||`zh-CN`,L=e=>(0,l.createElement)(p[e]),R=(e,t)=>{let n=new Map,r=z(e,n,t);return{microApps:[...n.values()],menuData:r}},z=(e,t,n)=>!e||e?.length===0?[]:e.map(e=>{let r=null,{locale:i,path:a,icon:o,component:s,routeAttr:c,children:l}=e;if(c){let e={};try{e=JSON.parse(c)}catch{console.error(`子应用路由属性格式错误:`,c)}let{name:i,rootId:a,...o}=e,s={...o,name:i,container:`#${a}`,props:{sdk:n},loader:e=>n.store.getState().setMicroAppState(e)};t.set(i,s),r=n.ui.renderComponent(`Microapp`,{name:i,rootId:a})}else r=s===`Outlet`?(0,f.jsx)(m.Outlet,{}):n.ui.renderComponent(s);let u=l?.length?z(l,t,n):[];return{...e,key:`${i}_${o}_${a}`,element:r,icon:L(o),children:u,handle:{crumb:t=>({...e,...t})}}}),B=e=>{let t=`/`;return!e||e.length===0?t:(t=e?.[0]?.path,e?.[0]?.children&&e?.[0]?.children.length>0&&(t=B(e?.[0]?.children)),t)},V=e=>{let{requestId:t,url:n,method:r,params:i,data:a}=e;return t||`${r}:${n}?${JSON.stringify(i)}&${JSON.stringify(a)}`},H=e=>{let t=V(e),n=x.api.controllers.get(t);n&&(n.abort(),x.api.controllers.delete(t))},U=({children:e})=>{let t=(0,m.useLocation)(),n=(0,m.useNavigate)(),r=(0,m.useMatches)();return x.client.location||(x.client.location=t),x.client.navigate||(x.client.navigate=n),(0,l.useEffect)(()=>{x.client.matches=r},[r]),e};var W=U;const G=()=>{let e=x.config.loginPath,t=[{path:e,element:x.ui.renderComponent(`Login`)},{path:`*`,element:x.ui.renderComponent(`NotFound`)},...x.config.customRoutes],[n,r,i]=(0,u.useStore)(x.store,(0,d.useShallow)(e=>[e.setTheme,e.setLocale,e.setInitState])),[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(t),p=(e,t)=>{n(e||F(x)),r(t||I(x))},g=async()=>{try{o(()=>!0);let[{data:e={}},{data:n=[]}]=await Promise.all([x.api.getUserInfoApi(),x.api.getRoutesApi()]);o(()=>!1);let{theme:r,locale:a}=e?.settings||{};p(r,a);let{microApps:s,menuData:l}=R(n,x);x.config.qiankunMode===`router`&&s&&s.length&&((0,h.registerMicroApps)(s,P),(0,h.start)());let u=B(l),d=[...t,{path:`/`,element:(0,f.jsx)(m.Navigate,{to:u,replace:!0})},{path:`/`,element:x.ui.renderComponent(`Layout`),children:l,errorElement:(0,f.jsx)(f.Fragment,{children:`找不到页面`})}];c(d.map(e=>({...e,element:W(e.element)}))),x.app={...x.app,allRoutes:d,microApps:s,menuData:l},i(e)}catch(e){p(),o(()=>!1),console.error(`初始化数据错误:`,e)}};return(0,l.useEffect)(()=>{x.app.allRoutes=t;let n=x.config.customRoutes?.map(e=>e.path),r=window.location.pathname;[e,...n]?.includes(r)?p():g()},[]),a?(0,f.jsx)(f.Fragment,{children:`Loading...`}):(0,f.jsx)(N,{children:(0,f.jsx)(l.Suspense,{fallback:(0,f.jsx)(f.Fragment,{children:`Loading...`}),children:(0,f.jsx)(m.RouterProvider,{router:(0,m.createBrowserRouter)(s,{basename:`/`}),future:{v7_startTransition:!1}})})})};let K=0;function q(e=``){return`${e}${++K}`}var J=class{constructor(e={}){this.instance=g.default.create(e),this.defaultRequestInterceptor(),this.defaultResponseInterceptor()}defaultRequestInterceptor(){this.instance.interceptors.request.use(function(e){let t=x.storage.getToken(),n=V(e);H(e);let r=new AbortController;return x.api.controllers.set(n,r),e.requestId=n,e.signal=r.signal,e.headers.Authorization=t,e.headers.lang=x.config.locale,e},function(e){return console.error(`请求错误`),Promise.reject(e)})}defaultResponseInterceptor(){this.instance.interceptors.response.use(function(e){let{data:t,config:n}=e,{isOriginalData:r,isShowFailMsg:i}=n,{code:a,msg:o}=t;return a!==0&&(i&&c.message.error(o),console.error(`response error: `,n.url,o),a==20041&&x.app.pageToLogin()),x.api.controllers.delete(n.requestId),r?e:e.data},function(e){let{response:t,config:n}=e,{isShowFailMsg:r}=n;if(g.default.isCancel(e))return Promise.reject(e);if(t){let{status:e,data:n,statusText:i}=t;r&&c.message.error(n.msg||i),e==401&&x.app.pageToLogin()}else r&&c.message.error(`请求超时或服务器异常,请检查网络或联系管理员`),console.error(`Request error:`,n.url,e);return Promise.reject(e)})}getInstance(){return this.instance}},Se=J;const Ce=`api`,we={name:`api`,install(e,t={}){let n={baseURL:`/api`,timeout:0,...t.config},r=t?.instance||new Se(n).getInstance();e.api=M({config:n,controllers:new Map,instance:null,getUserInfoApi:()=>e.api.request(`/getUserInfo`,{method:`GET`}),getRoutesApi:()=>e.api.request(`/routes`,{method:`GET`}),request:(e,t={})=>r.request({url:e,isOriginalData:!1,isShowFailMsg:!0,...t}),request2:async(t,n={})=>{let r,i,a=null,o={url:t,...n};a=()=>H(o);try{r=await e.api.request(t,o)}catch(e){i=e}return[r,i,a]},download:async(t,n={})=>{let r,i,a=null,o={url:t,responseType:`blob`,...n},s=q();a=()=>H(o),c.message.loading({key:s,content:`正在下载中...`});try{r=await e.api.request(t,o),c.message.success({key:s,content:`下载成功`})}catch(e){i=e,c.message.error({key:s,content:`下载失败`})}return[r,i,a]}},t)}},Te=`app`,Ee={name:`app`,install(e,t={}){e.app=M({menuData:[],allRoutes:[],microApps:[],microAppsInstance:new Map,user:null,permissions:[],roles:[],settings:{},pageToLogin:()=>{e.storage.clearToken();let t=location.pathname,n=e.config.loginPath,r=t===n?n:`${n}?redirect=${encodeURIComponent(t||`/`)}`;window.location.replace(r)},getRedirectPath:()=>{let t=e.config.defaultPath;if(t)return t;let n=new URLSearchParams(window.location.search);return decodeURIComponent(n.get(`redirect`)||``)||`/`}},t)}},Y=`client`,De={name:Y,install(e,t={}){e[Y]=M({location:null,navigate:null,matches:null},t)}},X=`config`,Oe={name:X,install(e,t={}){e[X]=M({env:{},qiankunMode:`router`,theme:null,locale:null,loginPath:`/login`,defaultPath:``,customRoutes:[],antdConfig:{},proLayoutConfig:{title:`Demo`}},t)}},Z=`i18n`,ke={name:Z,install(e,t={}){e[Z]=M({intl:_.default,intlConfig:{},loadLocale:e=>void 0},t)}},Q=`storage`,Ae={name:Q,install(e,t={}){e[Q]=M({localeKey:`locale`,themeKey:`theme`,tokenKey:`token`,getLocale(){return localStorage.getItem(e.storage.localeKey)||`zh-CN`},setLocale(t){localStorage.setItem(e.storage.localeKey,t)},clearLocale(){localStorage.removeItem(e.storage.localeKey)},getTheme(){return localStorage.getItem(e.storage.themeKey)||`light`},setTheme(t){localStorage.setItem(e.storage.themeKey,t)},clearTheme(){localStorage.removeItem(e.storage.themeKey)},getToken(){return localStorage.getItem(e.storage.tokenKey)||null},setToken(t){localStorage.setItem(e.storage.tokenKey,t)},clearToken(){localStorage.removeItem(e.storage.tokenKey)}},t)}},je=(e,t)=>({microAppState:!1,setMicroAppState:t=>e(()=>({microAppState:t}))}),Me=(e,t)=>({initState:{},setInitState:t=>{e(()=>({initState:t})),x.app={...x.app,...t}}}),Ne=(e,t)=>({locale:null,setLocale:t=>{e(()=>({locale:t})),x.config.locale=t,x.storage.setLocale(t),document.documentElement.setAttribute(`lang`,t);let n=x.i18n.intlConfig;_.default.init({currentLocale:t,locales:n});try{let e=x.i18n.loadLocale?.(t)||void 0;x.config.antdConfig.locale=e}catch(e){console.error(`Load antd locale error:`,e)}}}),{defaultAlgorithm:Pe,darkAlgorithm:Fe}=c.theme,Ie=(e,t)=>({theme:null,setTheme:t=>{e(()=>({theme:t})),x.config.theme=t,x.storage.setTheme(t),document.documentElement.setAttribute(`data-theme`,t);let n=t===`light`?Pe:Fe;x.config.antdConfig.theme.algorithm=n}}),Le=(0,u.createStore)()((0,v.subscribeWithSelector)((...e)=>({...je(...e),...Me(...e),...Ne(...e),...Ie(...e)}))),$=`store`,Re={name:$,install(e,t={}){e[$]=Le}},ze=()=>{let e=(0,m.useNavigate)(),t=(0,m.useLocation)(),n=(0,m.useMatches)(),r=(0,u.useStore)(x.store,e=>e.locale),[i,a]=(0,l.useState)(!1),o=t=>{e(t.path)};return(0,l.useEffect)(()=>{x.client.navigate=e},[]),(0,l.useEffect)(()=>{x.client.matches=n},[n]),(0,f.jsx)(y.ProLayout,{locale:r,formatMessage:({id:e,defaultMessage:t})=>x.i18n.intl.get(e).d(t),location:t,menuItemRender:(e,t)=>(0,f.jsx)(`div`,{onClick:()=>o(e),children:t}),onMenuHeaderClick:()=>{e(`/`)},onPageChange:e=>{x.client.location=e;let t=e.pathname;if(!x.app.user||Object.keys(x.app.user).length===0)return x.app.pageToLogin();a(x.app.permissions.includes(t))},...x.config.proLayoutConfig,menu:{request:async()=>x.app.menuData||[],...x.config.proLayoutConfig.menu},children:(0,f.jsx)(l.Suspense,{fallback:(0,f.jsx)(f.Fragment,{children:`Loading...`}),children:i?(0,f.jsx)(m.Outlet,{}):(0,f.jsx)(f.Fragment,{children:`无权限`})})})};var Be=(0,l.memo)(ze);const Ve=()=>{let e=(0,m.useNavigate)(),[t,n]=(0,l.useState)(!1);return(0,f.jsx)(c.Flex,{style:{width:`100%`,height:`100%`,background:`var(--bg-color)`},justify:`center`,align:`center`,children:(0,f.jsxs)(c.Form,{labelCol:{span:8},wrapperCol:{span:16},style:{maxWidth:600},initialValues:{remember:!0},onFinish:async t=>{n(()=>!0);let r=await x.api.request(`/login`,{method:`POST`,data:t});n(()=>!1);let i=r?.data?.token||``;i&&(x.storage.setToken(i),e(x.app.getRedirectPath(),{replace:!0}))},autoComplete:`off`,children:[(0,f.jsx)(c.Form.Item,{label:`用户名`,name:`username`,rules:[{required:!0,message:`请输入用户名!`}],children:(0,f.jsx)(c.Input,{})}),(0,f.jsx)(c.Form.Item,{label:`密码`,name:`password`,rules:[{required:!0,message:`请输入密码!`}],children:(0,f.jsx)(c.Input.Password,{})}),(0,f.jsx)(c.Form.Item,{label:null,children:(0,f.jsx)(c.Button,{block:!0,type:`primary`,htmlType:`submit`,loading:t,children:`登录`})})]})})};var He=Ve;const Ue=({name:e,rootId:t})=>{let n=(0,u.useStore)(x.store,e=>e.microAppState);return(0,l.useEffect)(()=>{if(!e||x.config.qiankunMode!==`load`)return;let t=x.app.microAppsInstance.get(e);if(t)t.mount();else{let t=x.app.microApps.find(t=>t.name===e);if(!t)return;let n=(0,h.loadMicroApp)(t,{},P);x.app.microAppsInstance.set(e,n)}return console.log(`Microapp`,e),()=>{let t=x.app.microAppsInstance.get(e);t&&t.unmount()}},[e]),(0,f.jsxs)(f.Fragment,{children:[n&&(0,f.jsx)(`div`,{children:`Loading...`}),(0,f.jsx)(`main`,{id:t})]})};var We=(0,l.memo)(Ue);const Ge=()=>{let e=(0,m.useNavigate)();return x.client.navigate=e,(0,f.jsx)(c.Flex,{style:{width:`100%`,height:`100%`,background:`var(--bg-color)`},justify:`center`,align:`center`,children:(0,f.jsx)(c.Empty,{description:`找不到页面`})})};var Ke=Ge;const qe=`ui`,Je={name:`ui`,install(e,t={}){e.ui=M({Login:He,NotFound:Ke,Layout:Be,Microapp:We,getComponent:t=>{if(!t)throw Error(`Component name cannot be empty`);return e.ui[t]},renderComponent:(t,n={})=>{let r=e.ui.getComponent(t);if(!r)throw Error(`Component ${t} not found`);return(0,l.createElement)(r,n)}},t)}};exports.AntdConfigProvider=N,exports.MainApp=G,exports.SdkApiPlugin=we,exports.SdkAppPlugin=Ee,exports.SdkClientPlugin=De,exports.SdkConfigPlugin=Oe,exports.SdkI18nPlugin=ke,exports.SdkStoragePlugin=Ae,exports.SdkStorePlugin=Re,exports.SdkUIPlugin=Je,exports.sdk=x;
2
- //# sourceMappingURL=index.cjs.map