@empjs/share 3.13.9-beta.1 → 4.0.0-alpha.1
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 +202 -62
- package/dist/171.js +2 -0
- package/dist/171.js.map +1 -0
- package/dist/227.js +2 -0
- package/dist/227.js.map +1 -0
- package/dist/607.js +2 -0
- package/dist/607.js.map +1 -0
- package/dist/68.js +2 -0
- package/dist/68.js.map +1 -0
- package/dist/adapter/index.d.ts +1 -0
- package/dist/{adapter.d.cts → adapter/react.d.ts} +3 -8
- package/dist/adapter/vue.d.ts +1 -0
- package/dist/adapter.d.ts +1 -14
- package/dist/adapter.js +2 -1
- package/dist/adapter.js.map +1 -1
- package/dist/adapterVue.d.ts +1 -0
- package/dist/adapterVue.js +1 -0
- package/dist/forceRemote.d.ts +2 -19
- package/dist/forceRemote.js +2 -1
- package/dist/forceRemote.js.map +1 -1
- package/dist/framework/react/config.d.ts +1 -0
- package/dist/framework/react/index.d.ts +3 -0
- package/dist/framework/react/shared.d.ts +2 -0
- package/dist/framework/vue/config.d.ts +1 -0
- package/dist/framework/vue/index.d.ts +3 -0
- package/dist/framework/vue/shared.d.ts +2 -0
- package/dist/helper/config.d.ts +3 -0
- package/dist/helper/index.d.ts +6 -0
- package/dist/helper/moduleFederation.d.ts +6 -0
- package/dist/helper/resolvePackageExport.d.ts +1 -0
- package/dist/helper/rspack.d.ts +1 -0
- package/dist/index.d.ts +3 -9
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/library/full.d.ts +7 -0
- package/dist/library/sdk.d.ts +2 -0
- package/dist/library/sdkPolyfill.d.ts +3 -0
- package/dist/library/wSdk.d.ts +2 -0
- package/dist/mfRuntime.d.ts +1 -1
- package/dist/mfRuntime.js +1 -1
- package/dist/plugins/rspack/index.d.ts +11 -0
- package/dist/plugins/rspack/plugin.d.ts +7 -0
- package/dist/plugins/rspack/runtimePlugin/forceRemote.d.ts +13 -0
- package/dist/plugins/rspack/runtimePlugin/registerRemotes.d.ts +3 -0
- package/dist/plugins/rspack/share.d.ts +30 -0
- package/dist/{types-BGnQUQ0O.d.cts → plugins/rspack/types.d.ts} +14 -17
- package/dist/plugins/rspack/utils.d.ts +2 -0
- package/dist/react.d.ts +1 -9
- package/dist/react.js +2 -1
- package/dist/react.js.map +1 -1
- package/dist/rspack.d.ts +2 -15
- package/dist/rspack.js +2 -1
- package/dist/rspack.js.map +1 -1
- package/dist/{runtime.d.cts → runtime/index.d.ts} +4 -7
- package/dist/runtime/index.pre.version.d.ts +22 -0
- package/dist/runtime/plugins.d.ts +2 -0
- package/dist/runtime/sdk-prev.d.ts +30 -0
- package/dist/runtime/sdk.d.ts +31 -0
- package/dist/runtime.d.ts +2 -23
- package/dist/runtime.js +2 -1
- package/dist/runtime.js.map +1 -1
- package/dist/sdk.d.ts +1 -34
- package/dist/sdk.js +2 -1
- package/dist/sdk.js.map +1 -1
- package/dist/types/index.d.ts +26 -0
- package/dist/vue.d.ts +1 -9
- package/dist/vue.js +2 -1
- package/dist/vue.js.map +1 -1
- package/output/adapter/index.d.ts +1 -0
- package/output/adapter/react.d.ts +9 -0
- package/output/adapter/vue.d.ts +1 -0
- package/output/framework/react/config.d.ts +1 -0
- package/output/framework/react/index.d.ts +3 -0
- package/output/framework/react/shared.d.ts +2 -0
- package/output/framework/vue/config.d.ts +1 -0
- package/output/framework/vue/index.d.ts +3 -0
- package/output/framework/vue/shared.d.ts +2 -0
- package/output/helper/config.d.ts +3 -0
- package/output/helper/index.d.ts +6 -0
- package/output/helper/moduleFederation.d.ts +6 -0
- package/output/helper/resolvePackageExport.d.ts +1 -0
- package/output/helper/rspack.d.ts +1 -0
- package/output/index.d.ts +3 -0
- package/output/library/full.d.ts +7 -0
- package/output/library/sdk.d.ts +2 -0
- package/output/library/sdkPolyfill.d.ts +3 -0
- package/output/library/wSdk.d.ts +2 -0
- package/output/plugins/rspack/index.d.ts +11 -0
- package/output/plugins/rspack/plugin.d.ts +7 -0
- package/output/plugins/rspack/runtimePlugin/forceRemote.d.ts +13 -0
- package/output/plugins/rspack/runtimePlugin/registerRemotes.d.ts +3 -0
- package/output/plugins/rspack/share.d.ts +30 -0
- package/{dist/types-BGnQUQ0O.d.ts → output/plugins/rspack/types.d.ts} +14 -17
- package/output/plugins/rspack/utils.d.ts +2 -0
- package/output/runtime/index.d.ts +20 -0
- package/output/runtime/index.pre.version.d.ts +22 -0
- package/output/runtime/mfRuntime.d.ts +1 -0
- package/output/runtime/plugins.d.ts +2 -0
- package/output/runtime/sdk-prev.d.ts +30 -0
- package/output/runtime/sdk.d.ts +31 -0
- package/output/sdk.d.ts +1 -0
- package/output/sdk.js +5 -1
- package/output/types/index.d.ts +26 -0
- package/package.json +42 -91
- package/dist/adapter.cjs +0 -1
- package/dist/adapter.cjs.map +0 -1
- package/dist/forceRemote.cjs +0 -1
- package/dist/forceRemote.cjs.map +0 -1
- package/dist/forceRemote.d.cts +0 -19
- package/dist/index-DaSrQPN9.d.cts +0 -21
- package/dist/index-DaSrQPN9.d.ts +0 -21
- package/dist/index.cjs +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -9
- package/dist/mfRuntime.cjs +0 -1
- package/dist/mfRuntime.cjs.map +0 -1
- package/dist/mfRuntime.js.map +0 -1
- package/dist/react.cjs +0 -1
- package/dist/react.cjs.map +0 -1
- package/dist/react.d.cts +0 -9
- package/dist/rspack.cjs +0 -1
- package/dist/rspack.cjs.map +0 -1
- package/dist/rspack.d.cts +0 -15
- package/dist/runtime.cjs +0 -1
- package/dist/runtime.cjs.map +0 -1
- package/dist/sdk.cjs +0 -1
- package/dist/sdk.cjs.map +0 -1
- package/dist/sdk.d.cts +0 -34
- package/dist/vue.cjs +0 -1
- package/dist/vue.cjs.map +0 -1
- package/dist/vue.d.cts +0 -9
- /package/dist/{mfRuntime.d.cts → runtime/mfRuntime.d.ts} +0 -0
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { ModuleFederation } from '@module-federation/runtime';
|
|
2
|
-
import {
|
|
3
|
-
import '@module-federation/sdk';
|
|
4
|
-
|
|
1
|
+
import type { ModuleFederation } from '@module-federation/runtime';
|
|
2
|
+
import type { EMPShareRuntimeType, EmpRuntimeOptions, InitOptionsType, LoadRemoteType } from '../types';
|
|
5
3
|
type EmpInitOptionsType = Partial<InitOptionsType>;
|
|
6
|
-
declare class EMPRuntime {
|
|
4
|
+
export declare class EMPRuntime {
|
|
7
5
|
libs: EMPShareRuntimeType;
|
|
8
6
|
initOptions: InitOptionsType;
|
|
9
7
|
options: EmpRuntimeOptions;
|
|
@@ -19,5 +17,4 @@ declare class EMPRuntime {
|
|
|
19
17
|
preloadRemote(...args: Parameters<NonNullable<typeof this.mfInstance>['preloadRemote']>): Promise<void> | undefined;
|
|
20
18
|
}
|
|
21
19
|
declare const _default: EMPRuntime;
|
|
22
|
-
|
|
23
|
-
export { EMPRuntime, _default as default };
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { EMPShareRuntimeType, EmpRuntimeOptions, InitOptionsType, LoadRemoteType } from '../types';
|
|
2
|
+
type EmpInitOptionsType = Partial<InitOptionsType>;
|
|
3
|
+
export declare class EMPRuntime {
|
|
4
|
+
libs: EMPShareRuntimeType;
|
|
5
|
+
initOptions: InitOptionsType;
|
|
6
|
+
options: EmpRuntimeOptions;
|
|
7
|
+
shareGlobalName: string;
|
|
8
|
+
private isInit;
|
|
9
|
+
constructor(op?: EMPShareRuntimeType);
|
|
10
|
+
/**
|
|
11
|
+
* 实例化 adapter libs
|
|
12
|
+
*/
|
|
13
|
+
setup(o?: EMPShareRuntimeType | string): void;
|
|
14
|
+
init(options?: EmpInitOptionsType): void;
|
|
15
|
+
load<T = any>(...args: LoadRemoteType): Promise<T>;
|
|
16
|
+
register: typeof import("@module-federation/runtime").registerRemotes;
|
|
17
|
+
preload: typeof import("@module-federation/runtime").preloadRemote;
|
|
18
|
+
loadShare: typeof import("@module-federation/runtime").loadShare;
|
|
19
|
+
preloadRemote: typeof import("@module-federation/runtime").preloadRemote;
|
|
20
|
+
}
|
|
21
|
+
declare const _default: EMPRuntime;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as mfRuntime from '@module-federation/runtime';
|
|
2
|
+
export declare const getInstance: typeof mfRuntime.getInstance;
|
|
3
|
+
export declare const createInstance: typeof mfRuntime.createInstance;
|
|
4
|
+
export declare const init: typeof mfRuntime.init;
|
|
5
|
+
export declare const registerShared: typeof mfRuntime.registerShared;
|
|
6
|
+
export declare const registerRemotes: typeof mfRuntime.registerRemotes;
|
|
7
|
+
export declare const registerPlugins: typeof mfRuntime.registerPlugins;
|
|
8
|
+
export declare const loadRemote: typeof mfRuntime.loadRemote;
|
|
9
|
+
export declare const preloadRemote: typeof mfRuntime.preloadRemote;
|
|
10
|
+
export declare const loadShare: typeof mfRuntime.loadShare;
|
|
11
|
+
export declare const getReactShare: () => {
|
|
12
|
+
react: {
|
|
13
|
+
lib: () => any;
|
|
14
|
+
version: any;
|
|
15
|
+
scope: any;
|
|
16
|
+
shareConfig: {
|
|
17
|
+
singleton: boolean;
|
|
18
|
+
requiredVersion: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
'react-dom': {
|
|
22
|
+
lib: () => any;
|
|
23
|
+
version: any;
|
|
24
|
+
scope: any;
|
|
25
|
+
shareConfig: {
|
|
26
|
+
singleton: boolean;
|
|
27
|
+
requiredVersion: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as mfRuntime from '@module-federation/runtime';
|
|
2
|
+
declare const getInstance: () => ReturnType<typeof mfRuntime.getInstance>;
|
|
3
|
+
export { getInstance };
|
|
4
|
+
export declare const createInstance: typeof mfRuntime.createInstance;
|
|
5
|
+
export declare const init: typeof mfRuntime.init;
|
|
6
|
+
export declare const registerShared: typeof mfRuntime.registerShared;
|
|
7
|
+
export declare const registerRemotes: typeof mfRuntime.registerRemotes;
|
|
8
|
+
export declare const registerPlugins: typeof mfRuntime.registerPlugins;
|
|
9
|
+
export declare const loadRemote: typeof mfRuntime.loadRemote;
|
|
10
|
+
export declare const preloadRemote: typeof mfRuntime.preloadRemote;
|
|
11
|
+
export declare const loadShare: typeof mfRuntime.loadShare;
|
|
12
|
+
export declare const getReactShare: () => {
|
|
13
|
+
react: {
|
|
14
|
+
lib: () => any;
|
|
15
|
+
version: any;
|
|
16
|
+
scope: any;
|
|
17
|
+
shareConfig: {
|
|
18
|
+
singleton: boolean;
|
|
19
|
+
requiredVersion: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
'react-dom': {
|
|
23
|
+
lib: () => any;
|
|
24
|
+
version: any;
|
|
25
|
+
scope: any;
|
|
26
|
+
shareConfig: {
|
|
27
|
+
singleton: boolean;
|
|
28
|
+
requiredVersion: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import '@module-federation/sdk';
|
|
4
|
-
|
|
5
|
-
type EmpInitOptionsType = Partial<InitOptionsType>;
|
|
6
|
-
declare class EMPRuntime {
|
|
7
|
-
libs: EMPShareRuntimeType;
|
|
8
|
-
initOptions: InitOptionsType;
|
|
9
|
-
options: EmpRuntimeOptions;
|
|
10
|
-
shareGlobalName: string;
|
|
11
|
-
constructor(op?: EMPShareRuntimeType);
|
|
12
|
-
mfInstance?: ModuleFederation;
|
|
13
|
-
setup(o?: EMPShareRuntimeType | string): void;
|
|
14
|
-
init(options?: EmpInitOptionsType): ModuleFederation | undefined;
|
|
15
|
-
load<T = any>(...args: LoadRemoteType): Promise<T>;
|
|
16
|
-
register(...args: Parameters<NonNullable<typeof this.mfInstance>['registerRemotes']>): void | undefined;
|
|
17
|
-
preload(...args: Parameters<NonNullable<typeof this.mfInstance>['preloadRemote']>): Promise<void> | undefined;
|
|
18
|
-
loadShare(...args: Parameters<NonNullable<typeof this.mfInstance>['loadShare']>): Promise<false | (() => unknown)> | undefined;
|
|
19
|
-
preloadRemote(...args: Parameters<NonNullable<typeof this.mfInstance>['preloadRemote']>): Promise<void> | undefined;
|
|
20
|
-
}
|
|
21
|
-
declare const _default: EMPRuntime;
|
|
22
|
-
|
|
23
|
-
export { EMPRuntime, _default as default };
|
|
1
|
+
export {default} from './runtime/index'
|
|
2
|
+
export * from './runtime/index'
|
package/dist/runtime.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{deepAssign as e}from"./227.js";import{shareGlobalName as t}from"./607.js";function i(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}let n=window[t]||{},r=window,{EMPShareGlobalVal:s}=r||{};s&&s.runtimeLib&&(n=r[s.runtimeLib]);class o{setup(e){if(e&&("string"==typeof e&&(e=window[e]),this.libs=e),!this.libs.MFRuntime||!this.libs.MFSDK)throw Error("MFRuntime and MFSDK Required!")}init(t={}){if(this.mfInstance)return this.mfInstance;let i={name:"empRuntimeProject",remotes:[]};i=e(i,t),this.mfInstance=this.libs.MFRuntime.createInstance(i)}load(...e){var t;return null==(t=this.mfInstance)?void 0:t.loadRemote(...e)}register(...e){var t;return null==(t=this.mfInstance)?void 0:t.registerRemotes(...e)}preload(...e){var t;return null==(t=this.mfInstance)?void 0:t.preloadRemote(...e)}loadShare(...e){var t;return null==(t=this.mfInstance)?void 0:t.loadShare(...e)}preloadRemote(...e){var t;return null==(t=this.mfInstance)?void 0:t.preloadRemote(...e)}constructor(e){i(this,"libs",n),i(this,"initOptions",void 0),i(this,"options",{showLog:!1}),i(this,"shareGlobalName",t),i(this,"mfInstance",void 0),e&&this.setup(e)}}let a=new o;export default a;export{o as EMPRuntime};
|
|
2
|
+
//# sourceMappingURL=runtime.js.map
|
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"runtime.js","sources":["../src/runtime/index.ts"],"sourcesContent":["import type {ModuleFederation} from '@module-federation/runtime'\nimport {deepAssign} from 'src/helper'\nimport {shareGlobalName} from 'src/helper/config'\nimport type {EMPShareRuntimeType, EmpRuntimeOptions, InitOptionsType, LoadRemoteType} from 'src/types'\n\ntype EmpInitOptionsType = Partial<InitOptionsType>\nlet globalLib = window[shareGlobalName] || {}\n// 根据 injectGlobalValToHtml 提前把库赋值到 EMPRuntime\nconst win: any = window\nconst {EMPShareGlobalVal} = win || {}\nif (EMPShareGlobalVal && EMPShareGlobalVal.runtimeLib) {\n globalLib = win[EMPShareGlobalVal.runtimeLib]\n}\n\nexport class EMPRuntime {\n public libs: EMPShareRuntimeType = globalLib\n public initOptions!: InitOptionsType\n public options: EmpRuntimeOptions = {\n showLog: false,\n }\n public shareGlobalName = shareGlobalName\n constructor(op?: EMPShareRuntimeType) {\n if (op) this.setup(op)\n }\n public mfInstance?: ModuleFederation\n public setup(o?: EMPShareRuntimeType | string) {\n if (o) {\n if (typeof o === 'string') o = window[o]\n this.libs = o as any\n }\n if (!this.libs.MFRuntime || !this.libs.MFSDK) {\n throw new Error('MFRuntime and MFSDK Required!')\n }\n }\n public init(options: EmpInitOptionsType = {}) {\n if (this.mfInstance) return this.mfInstance\n let op: InitOptionsType = {\n name: 'empRuntimeProject',\n remotes: [],\n // plugins: [catchErrorNextPlugin(this.options.showLog)],\n }\n op = deepAssign<InitOptionsType>(op, options)\n this.mfInstance = this.libs.MFRuntime.createInstance(op)\n }\n public load<T = any>(...args: LoadRemoteType) {\n return this.mfInstance?.loadRemote<T>(...args) as Promise<T>\n }\n public register(...args: Parameters<NonNullable<typeof this.mfInstance>['registerRemotes']>) {\n return this.mfInstance?.registerRemotes(...args)\n }\n public preload(...args: Parameters<NonNullable<typeof this.mfInstance>['preloadRemote']>) {\n return this.mfInstance?.preloadRemote(...args)\n }\n public loadShare(...args: Parameters<NonNullable<typeof this.mfInstance>['loadShare']>) {\n return this.mfInstance?.loadShare(...args)\n }\n public preloadRemote(...args: Parameters<NonNullable<typeof this.mfInstance>['preloadRemote']>) {\n return this.mfInstance?.preloadRemote(...args)\n }\n}\n//\nexport default new EMPRuntime()\n"],"names":["globalLib","window","shareGlobalName","win","EMPShareGlobalVal","EMPRuntime","o","Error","options","op","deepAssign","args","_this_mfInstance"],"mappings":"qOAMA,IAAIA,EAAYC,MAAM,CAACC,EAAgB,EAAI,CAAC,EAEtCC,EAAWF,OACX,CAACG,kBAAAA,CAAiB,CAAC,CAAGD,GAAO,CAAC,CAChCC,CAAAA,GAAqBA,EAAkB,UAAU,EACnDJ,CAAAA,EAAYG,CAAG,CAACC,EAAkB,UAAU,CAAC,AAAD,CAGvC,OAAMC,EAWJ,MAAMC,CAAgC,CAAE,CAK7C,GAJIA,IACE,AAAa,UAAb,OAAOA,GAAgBA,CAAAA,EAAIL,MAAM,CAACK,EAAE,AAAD,EACvC,IAAI,CAAC,IAAI,CAAGA,GAEV,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAC1C,MAAM,AAAIC,MAAM,gCAEpB,CACO,KAAKC,EAA8B,CAAC,CAAC,CAAE,CAC5C,GAAI,IAAI,CAAC,UAAU,CAAE,OAAO,IAAI,CAAC,UAAU,CAC3C,IAAIC,EAAsB,CACxB,KAAM,oBACN,QAAS,EAAE,AAEb,EACAA,EAAKC,EAA4BD,EAAID,GACrC,IAAI,CAAC,UAAU,CAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAACC,EACvD,CACO,KAAc,GAAGE,CAAoB,CAAE,C,IACrCC,EAAP,OAAO,MAAAA,CAAAA,EAAAA,IAAI,CAAC,UAAU,AAAD,EAAdA,KAAAA,EAAAA,EAAiB,UAAU,IAAOD,EAC3C,CACO,SAAS,GAAGA,CAAwE,CAAE,C,IACpFC,EAAP,OAAO,MAAAA,CAAAA,EAAAA,IAAI,CAAC,UAAU,AAAD,EAAdA,KAAAA,EAAAA,EAAiB,eAAe,IAAID,EAC7C,CACO,QAAQ,GAAGA,CAAsE,CAAE,C,IACjFC,EAAP,OAAO,MAAAA,CAAAA,EAAAA,IAAI,CAAC,UAAU,AAAD,EAAdA,KAAAA,EAAAA,EAAiB,aAAa,IAAID,EAC3C,CACO,UAAU,GAAGA,CAAkE,CAAE,C,IAC/EC,EAAP,OAAO,MAAAA,CAAAA,EAAAA,IAAI,CAAC,UAAU,AAAD,EAAdA,KAAAA,EAAAA,EAAiB,SAAS,IAAID,EACvC,CACO,cAAc,GAAGA,CAAsE,CAAE,C,IACvFC,EAAP,OAAO,MAAAA,CAAAA,EAAAA,IAAI,CAAC,UAAU,AAAD,EAAdA,KAAAA,EAAAA,EAAiB,aAAa,IAAID,EAC3C,CArCA,YAAYF,CAAwB,CAAE,CANtC,OAAO,OAA4BT,GACnC,OAAO,cAAP,QACA,OAAO,UAA6B,CAClC,QAAS,EACX,GACA,OAAO,kBAAkBE,GAIzB,OAAO,aAAP,QAFMO,GAAI,IAAI,CAAC,KAAK,CAACA,EACrB,CAoCF,CAEA,MAAe,IAAIJ,C"}
|
package/dist/sdk.d.ts
CHANGED
|
@@ -1,34 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const getInstance: () => ReturnType<typeof mfRuntime.getInstance>;
|
|
4
|
-
|
|
5
|
-
declare const createInstance: typeof mfRuntime.createInstance;
|
|
6
|
-
declare const init: typeof mfRuntime.init;
|
|
7
|
-
declare const registerShared: typeof mfRuntime.registerShared;
|
|
8
|
-
declare const registerRemotes: typeof mfRuntime.registerRemotes;
|
|
9
|
-
declare const registerPlugins: typeof mfRuntime.registerPlugins;
|
|
10
|
-
declare const loadRemote: typeof mfRuntime.loadRemote;
|
|
11
|
-
declare const preloadRemote: typeof mfRuntime.preloadRemote;
|
|
12
|
-
declare const loadShare: typeof mfRuntime.loadShare;
|
|
13
|
-
declare const getReactShare: () => {
|
|
14
|
-
react: {
|
|
15
|
-
lib: () => any;
|
|
16
|
-
version: any;
|
|
17
|
-
scope: any;
|
|
18
|
-
shareConfig: {
|
|
19
|
-
singleton: boolean;
|
|
20
|
-
requiredVersion: string;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
'react-dom': {
|
|
24
|
-
lib: () => any;
|
|
25
|
-
version: any;
|
|
26
|
-
scope: any;
|
|
27
|
-
shareConfig: {
|
|
28
|
-
singleton: boolean;
|
|
29
|
-
requiredVersion: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export { createInstance, getInstance, getReactShare, init, loadRemote, loadShare, preloadRemote, registerPlugins, registerRemotes, registerShared };
|
|
1
|
+
export * from './runtime/sdk'
|
package/dist/sdk.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
let e="u">typeof window?window:void 0,r=e[e.EMPShareGlobalVal.runtimeLib].MFRuntime,t=[],o=()=>{let e=r.getInstance();return e&&(e.options.remotes.length>0?t=e.options.remotes:t.length>0&&(e.registerRemotes(t),t=[])),e},i=e=>(...r)=>{var t,i;return null==(i=o())||null==(t=i[e])?void 0:t.call(i,...r)},n=(...e)=>r.createInstance(...e),a=r.init,s=i("registerShared"),l=i("registerRemotes"),g=i("registerPlugins"),d=i("loadRemote"),m=i("preloadRemote"),u=i("loadShare"),h=()=>{let{React:r,ReactDOM:t,scope:o="default"}=e[e.EMPShareGlobalVal.frameworkLib];return{react:{lib:()=>r,version:r.version,scope:o,shareConfig:{singleton:!0,requiredVersion:`^${r.version}`}},"react-dom":{lib:()=>t,version:t.version,scope:o,shareConfig:{singleton:!0,requiredVersion:`^${r.version}`}}}};export{n as createInstance,o as getInstance,h as getReactShare,a as init,d as loadRemote,u as loadShare,m as preloadRemote,g as registerPlugins,l as registerRemotes,s as registerShared};
|
|
2
|
+
//# sourceMappingURL=sdk.js.map
|
package/dist/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/runtime/sdk.ts"],"
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../src/runtime/sdk.ts"],"sourcesContent":["import * as mfRuntime from '@module-federation/runtime'\n\nconst win: any = typeof window !== 'undefined' ? window : undefined\nconst mf = win[win.EMPShareGlobalVal.runtimeLib]['MFRuntime'] as typeof mfRuntime\n\nlet pendingRemotes: any[] = []\n\nconst getInstance = (): ReturnType<typeof mfRuntime.getInstance> => {\n const inst = mf.getInstance()\n if (!inst) return inst\n if (inst.options.remotes.length > 0) pendingRemotes = inst.options.remotes\n else if (pendingRemotes.length > 0) {\n inst.registerRemotes(pendingRemotes)\n pendingRemotes = []\n }\n return inst\n}\n\nconst call = <T>(method: string) => ((...args: any[]) => (getInstance() as any)?.[method]?.(...args)) as T\n\nexport {getInstance}\nexport const createInstance: typeof mfRuntime.createInstance = (...args) => mf.createInstance(...args)\nexport const init: typeof mfRuntime.init = mf.init\nexport const registerShared = call<typeof mfRuntime.registerShared>('registerShared')\nexport const registerRemotes = call<typeof mfRuntime.registerRemotes>('registerRemotes')\nexport const registerPlugins = call<typeof mfRuntime.registerPlugins>('registerPlugins')\nexport const loadRemote = call<typeof mfRuntime.loadRemote>('loadRemote')\nexport const preloadRemote = call<typeof mfRuntime.preloadRemote>('preloadRemote')\nexport const loadShare = call<typeof mfRuntime.loadShare>('loadShare')\n\nexport const getReactShare = () => {\n const {React, ReactDOM, scope = 'default'} = win[win.EMPShareGlobalVal.frameworkLib]\n return {\n react: {\n lib: () => React,\n version: React.version,\n scope,\n shareConfig: {singleton: true, requiredVersion: `^${React.version}`},\n },\n 'react-dom': {\n lib: () => ReactDOM,\n version: ReactDOM.version,\n scope,\n shareConfig: {singleton: true, requiredVersion: `^${React.version}`},\n },\n }\n}\n"],"names":["win","window","undefined","mf","pendingRemotes","getInstance","inst","call","method","args","_getInstance_method","_getInstance","createInstance","init","registerShared","registerRemotes","registerPlugins","loadRemote","preloadRemote","loadShare","getReactShare","React","ReactDOM","scope"],"mappings":"AAEA,IAAMA,EAAW,AAAkB,IAAlB,OAAOC,OAAyBA,OAASC,OACpDC,EAAKH,CAAG,CAACA,EAAI,iBAAiB,CAAC,UAAU,CAAC,CAAC,SAAY,CAEzDI,EAAwB,EAAE,CAExBC,EAAc,KAClB,IAAMC,EAAOH,EAAG,WAAW,UACtBG,IACDA,EAAK,OAAO,CAAC,OAAO,CAAC,MAAM,CAAG,EAAGF,EAAiBE,EAAK,OAAO,CAAC,OAAO,CACjEF,EAAe,MAAM,CAAG,IAC/BE,EAAK,eAAe,CAACF,GACrBA,EAAiB,EAAE,GAJHE,CAOpB,EAEMC,EAAO,AAAIC,GAAoB,CAAC,GAAGC,K,IAAgBC,EAACC,E,aAAAA,CAAAA,EAAAA,GAAY,GAAZA,MAADD,CAAAA,EAACC,CAAuB,CAACH,EAAO,AAAD,EAA/BE,KAAAA,EAAAA,EAAAA,IAAAA,CAACC,KAAqCF,E,EAGlFG,EAAkD,CAAC,GAAGH,IAASN,EAAG,cAAc,IAAIM,GACpFI,EAA8BV,EAAG,IAAI,CACrCW,EAAiBP,EAAsC,kBACvDQ,EAAkBR,EAAuC,mBACzDS,EAAkBT,EAAuC,mBACzDU,EAAaV,EAAkC,cAC/CW,EAAgBX,EAAqC,iBACrDY,EAAYZ,EAAiC,aAE7Ca,EAAgB,KAC3B,GAAM,CAACC,MAAAA,CAAK,CAAEC,SAAAA,CAAQ,CAAEC,MAAAA,EAAQ,SAAS,CAAC,CAAGvB,CAAG,CAACA,EAAI,iBAAiB,CAAC,YAAY,CAAC,CACpF,MAAO,CACL,MAAO,CACL,IAAK,IAAMqB,EACX,QAASA,EAAM,OAAO,CACtBE,MAAAA,EACA,YAAa,CAAC,UAAW,GAAM,gBAAiB,CAAC,CAAC,EAAEF,EAAM,OAAO,CAAC,CAAC,CACrE,EACA,YAAa,CACX,IAAK,IAAMC,EACX,QAASA,EAAS,OAAO,CACzBC,MAAAA,EACA,YAAa,CAAC,UAAW,GAAM,gBAAiB,CAAC,CAAC,EAAEF,EAAM,OAAO,CAAC,CAAC,CACrE,CACF,CACF,S"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type { FederationRuntimePlugin } from '../helper/moduleFederation';
|
|
2
|
+
import type { MFRuntime, MFSDK } from '../helper/moduleFederation';
|
|
3
|
+
export type Override<What, With> = Omit<What, keyof With> & With;
|
|
4
|
+
export type EMPShareRuntimeType = {
|
|
5
|
+
MFRuntime: Required<typeof MFRuntime>;
|
|
6
|
+
MFSDK: Required<typeof MFSDK>;
|
|
7
|
+
};
|
|
8
|
+
export type EMPShareRuntimeAdapterReactType = {
|
|
9
|
+
React?: any;
|
|
10
|
+
ReactDOM?: any;
|
|
11
|
+
createRoot?: any;
|
|
12
|
+
hydrateRoot?: any;
|
|
13
|
+
scope: string;
|
|
14
|
+
};
|
|
15
|
+
export type EMPShareRuntimeAdapterVueType = {
|
|
16
|
+
Vue?: any;
|
|
17
|
+
VueRouter?: any;
|
|
18
|
+
Pinia?: any;
|
|
19
|
+
scope: string;
|
|
20
|
+
};
|
|
21
|
+
export type InitOptionsType = Parameters<typeof MFRuntime.init>[0];
|
|
22
|
+
export type LoadRemoteType = Parameters<typeof MFRuntime.loadRemote>;
|
|
23
|
+
export type FrameworkType = 'react' | 'vue' | 'vue2' | 'angular';
|
|
24
|
+
export type EmpRuntimeOptions = {
|
|
25
|
+
showLog?: boolean;
|
|
26
|
+
};
|
package/dist/vue.d.ts
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import '@module-federation/runtime';
|
|
3
|
-
import '@module-federation/sdk';
|
|
4
|
-
|
|
5
|
-
declare const shared: () => InitOptionsType["shared"];
|
|
6
|
-
|
|
7
|
-
declare const external: (o: any, globalVal: string) => any;
|
|
8
|
-
|
|
9
|
-
export { external, shared };
|
|
1
|
+
export * from './framework/vue/index'
|
package/dist/vue.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{externalVue as e}from"./68.js";let r=window,n={},{EMPShareGlobalVal:o}=r||{};o&&o.frameworkLib&&(n=r[o.frameworkLib]);let t=function(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(r){var o;o=n[r],r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o})}return e}({scope:"default"},n),i=()=>{let{Vue:e,VueRouter:r,scope:n}=t;return{vue:{lib:()=>e,version:e.version,scope:n,shareConfig:{singleton:!0,requiredVersion:`^${e.version}`}},"vue-router":{lib:()=>r,version:r.version,scope:n,shareConfig:{singleton:!0,requiredVersion:`^${r.version}`}}}},l=e;export{l as external,i as shared};
|
|
2
|
+
//# sourceMappingURL=vue.js.map
|
package/dist/vue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"vue.js","sources":["../src/framework/vue/shared.ts","../src/framework/vue/index.ts"],"sourcesContent":["import {EMPShareRuntimeAdapterVueType, InitOptionsType} from 'src/types'\n\n// o['vue'] = `EMP_ADAPTER_VUE.Vue`\n// o['vue-router'] = `EMP_ADAPTER_VUE.VueRouter`\n// o['pinia'] = `EMP_ADAPTER_VUE.Pinia`\nconst win: any = window\nlet globalLib = {}\nconst {EMPShareGlobalVal} = win || {}\nif (EMPShareGlobalVal && EMPShareGlobalVal.frameworkLib) {\n globalLib = win[EMPShareGlobalVal.frameworkLib]\n}\nconst libs: EMPShareRuntimeAdapterVueType = {\n scope: 'default',\n ...globalLib,\n}\nexport const shared = (): InitOptionsType['shared'] => {\n const {Vue, VueRouter, scope} = libs\n return {\n vue: {\n lib: () => Vue,\n version: Vue.version,\n scope,\n shareConfig: {\n singleton: true,\n requiredVersion: `^${Vue.version}`,\n },\n },\n 'vue-router': {\n lib: () => VueRouter,\n version: VueRouter.version,\n scope,\n shareConfig: {\n singleton: true,\n requiredVersion: `^${VueRouter.version}`,\n },\n },\n }\n}\n","import {externalVue} from './config'\nimport {shared} from './shared'\n\nconst external = externalVue\nexport {shared, external}\n"],"names":["win","window","globalLib","EMPShareGlobalVal","libs","shared","Vue","VueRouter","scope","external","externalVue"],"mappings":"oDAKA,IAAMA,EAAWC,OACbC,EAAY,CAAC,EACX,CAACC,kBAAAA,CAAiB,CAAC,CAAGH,GAAO,CAAC,CAChCG,CAAAA,GAAqBA,EAAkB,YAAY,EACrDD,CAAAA,EAAYF,CAAG,CAACG,EAAkB,YAAY,CAAC,AAAD,EAEhD,IAAMC,EAAsC,A,iaAAA,CAC1C,MAAO,S,EACJF,GAEQG,EAAS,KACpB,GAAM,CAACC,IAAAA,CAAG,CAAEC,UAAAA,CAAS,CAAEC,MAAAA,CAAK,CAAC,CAAGJ,EAChC,MAAO,CACL,IAAK,CACH,IAAK,IAAME,EACX,QAASA,EAAI,OAAO,CACpBE,MAAAA,EACA,YAAa,CACX,UAAW,GACX,gBAAiB,CAAC,CAAC,EAAEF,EAAI,OAAO,CAAC,CAAC,AACpC,CACF,EACA,aAAc,CACZ,IAAK,IAAMC,EACX,QAASA,EAAU,OAAO,CAC1BC,MAAAA,EACA,YAAa,CACX,UAAW,GACX,gBAAiB,CAAC,CAAC,EAAED,EAAU,OAAO,CAAC,CAAC,AAC1C,CACF,CACF,CACF,EClCME,EAAWC,S"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './react';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EMPShareRuntimeAdapterReactType, InitOptionsType } from '../types';
|
|
2
|
+
export declare class ReactAdapter {
|
|
3
|
+
libs: EMPShareRuntimeAdapterReactType;
|
|
4
|
+
constructor(op?: EMPShareRuntimeAdapterReactType);
|
|
5
|
+
setup(o?: EMPShareRuntimeAdapterReactType | string): void;
|
|
6
|
+
get shared(): InitOptionsType['shared'];
|
|
7
|
+
adapter<P = any>(component: any, scope?: string, React?: any, ReactDOM?: any): P;
|
|
8
|
+
}
|
|
9
|
+
export declare const reactAdapter: ReactAdapter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Vue2InVue3Adapter: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const externalReact: (o: any, globalVal: string) => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const externalVue: (o: any, globalVal: string) => any;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const importJsVm: (content: string) => string;
|
|
2
|
+
export declare function deepAssign<T>(target: any, ...sources: any): T;
|
|
3
|
+
export declare const checkVersion: (version: string) => number;
|
|
4
|
+
export declare const isPromise: (p: any) => any;
|
|
5
|
+
export declare const isDev: boolean;
|
|
6
|
+
export declare const log: (...args: any[]) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as MFRuntime from '@module-federation/runtime';
|
|
2
|
+
import * as MFSDK from '@module-federation/sdk';
|
|
3
|
+
export { MFRuntime, MFSDK };
|
|
4
|
+
import type { ModuleFederationRuntimePlugin } from '@module-federation/runtime';
|
|
5
|
+
export type FederationRuntimePlugin = ModuleFederationRuntimePlugin;
|
|
6
|
+
export type { ModuleFederationRuntimePlugin };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolvePackageExport(specifier: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ModuleFederationPlugin } from '@module-federation/rspack';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import 'core-js/stable/global-this';
|
|
2
|
+
import 'core-js/stable/object/entries';
|
|
3
|
+
import { reactAdapter } from '../adapter';
|
|
4
|
+
import { MFRuntime, MFSDK } from '../helper/moduleFederation';
|
|
5
|
+
import { EMPRuntime } from '../runtime';
|
|
6
|
+
declare const runtime: EMPRuntime;
|
|
7
|
+
export { MFRuntime, MFSDK, reactAdapter, runtime };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GlobalStore } from '@empjs/cli';
|
|
2
|
+
import type { EMPPluginShareType } from './types';
|
|
3
|
+
export type { EMPPluginShareType };
|
|
4
|
+
export * from '../../framework/react/config';
|
|
5
|
+
export * from '../../framework/vue/config';
|
|
6
|
+
export * from './types';
|
|
7
|
+
export declare const pluginRspackEmpShare: (o?: EMPPluginShareType) => {
|
|
8
|
+
name: string;
|
|
9
|
+
rsConfig(store: GlobalStore): Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
export default pluginRspackEmpShare;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 运行时插件:根据 window[EMP_FORCE_REMOTES] 配置,在注册 remote 前拦截并改写其 entry/url。
|
|
3
|
+
* 支持两种方式二选一:指定完整 entry 地址,或仅指定 version 做 URL 内版本号替换。
|
|
4
|
+
*/
|
|
5
|
+
import { type ModuleFederationRuntimePlugin } from '@module-federation/runtime';
|
|
6
|
+
import { shareForceRemote } from '../../../helper/config';
|
|
7
|
+
import { type ForceRemoteOptions } from '../types';
|
|
8
|
+
declare global {
|
|
9
|
+
interface Window {
|
|
10
|
+
[shareForceRemote]?: ForceRemoteOptions;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export default function (): ModuleFederationRuntimePlugin;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { GlobalStore } from '@empjs/cli';
|
|
2
|
+
import type { EMPPluginShareType, frameworkOptions, runtimeLibType } from './types';
|
|
3
|
+
export declare class EmpShare {
|
|
4
|
+
private op;
|
|
5
|
+
private store;
|
|
6
|
+
/**
|
|
7
|
+
* 注入资源
|
|
8
|
+
*/
|
|
9
|
+
private injectHtml;
|
|
10
|
+
/**
|
|
11
|
+
* 兼容 shareLib
|
|
12
|
+
*/
|
|
13
|
+
private externalsLib;
|
|
14
|
+
constructor(op: EMPPluginShareType, store: GlobalStore);
|
|
15
|
+
setup(): void;
|
|
16
|
+
private injectToHtml;
|
|
17
|
+
private injectFramework;
|
|
18
|
+
private injectFkLibs;
|
|
19
|
+
private injectGlobalVal;
|
|
20
|
+
fk: Required<frameworkOptions>;
|
|
21
|
+
private resetFramework;
|
|
22
|
+
rt: Required<runtimeLibType>;
|
|
23
|
+
private resetRuntime;
|
|
24
|
+
private setExternal;
|
|
25
|
+
private setRuntimeLib;
|
|
26
|
+
private setMfName;
|
|
27
|
+
private setMF;
|
|
28
|
+
private setDtsRuntimePkgs;
|
|
29
|
+
private setShareLib;
|
|
30
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ModuleFederationPlugin } from '
|
|
2
|
-
|
|
3
|
-
type
|
|
4
|
-
type EMPSHARERuntimeOptions = {
|
|
1
|
+
import type { ModuleFederationPlugin } from '../../helper/rspack';
|
|
2
|
+
export type ModuleFederationPluginOptions = ConstructorParameters<typeof ModuleFederationPlugin>[0];
|
|
3
|
+
export type EMPSHARERuntimeOptions = {
|
|
5
4
|
/**
|
|
6
5
|
* 兼容 emp2.0 shareLib 配置
|
|
7
6
|
*/
|
|
@@ -36,7 +35,7 @@ type EMPSHARERuntimeOptions = {
|
|
|
36
35
|
*/
|
|
37
36
|
frameworkLib?: frameworLibType;
|
|
38
37
|
};
|
|
39
|
-
type runtimeLibType = {
|
|
38
|
+
export type runtimeLibType = {
|
|
40
39
|
/**
|
|
41
40
|
* MFRuntime 地址
|
|
42
41
|
*/
|
|
@@ -46,11 +45,11 @@ type runtimeLibType = {
|
|
|
46
45
|
*/
|
|
47
46
|
global?: string;
|
|
48
47
|
};
|
|
49
|
-
type frameworLibType = string | {
|
|
48
|
+
export type frameworLibType = string | {
|
|
50
49
|
dev: string;
|
|
51
50
|
prod: string;
|
|
52
51
|
};
|
|
53
|
-
type frameworkOptions = {
|
|
52
|
+
export type frameworkOptions = {
|
|
54
53
|
/**
|
|
55
54
|
* 框架名称
|
|
56
55
|
*/
|
|
@@ -81,7 +80,7 @@ type frameworkOptions = {
|
|
|
81
80
|
/**
|
|
82
81
|
* runtime beforeRegisterRemote 收到的 remote 对象结构(与 @module-federation/runtime Remote 兼容)
|
|
83
82
|
*/
|
|
84
|
-
type RemoteInfoForForce = {
|
|
83
|
+
export type RemoteInfoForForce = {
|
|
85
84
|
/** 唯一标识,如 @nova/bigolive-common,用于匹配 forceRemotes key(优先于 name) */
|
|
86
85
|
alias?: string;
|
|
87
86
|
/** 占位名,如 $1,可能重名;插件会为占位名生成唯一 name */
|
|
@@ -100,12 +99,12 @@ type RemoteInfoForForce = {
|
|
|
100
99
|
* 单项配置:仅替换 URL 中 `key@oldVer` 的版本部分
|
|
101
100
|
* @example "17.0.0"
|
|
102
101
|
*/
|
|
103
|
-
type ForceRemoteVersion = string;
|
|
102
|
+
export type ForceRemoteVersion = string;
|
|
104
103
|
/**
|
|
105
104
|
* 单项配置:显式指定仅替换版本(与 string 等价,便于扩展)
|
|
106
105
|
* @example { version: "17.0.0" }
|
|
107
106
|
*/
|
|
108
|
-
type ForceRemoteVersionOption = {
|
|
107
|
+
export type ForceRemoteVersionOption = {
|
|
109
108
|
version: string;
|
|
110
109
|
};
|
|
111
110
|
/**
|
|
@@ -113,7 +112,7 @@ type ForceRemoteVersionOption = {
|
|
|
113
112
|
* 匹配时优先用 alias(唯一标识,如 @nova/bigolive-common),避免 name 为 $1 等占位符导致重名
|
|
114
113
|
* @example { entry: "https://cdn.example.com/app1.js" }
|
|
115
114
|
*/
|
|
116
|
-
type ForceRemoteEntryOption = {
|
|
115
|
+
export type ForceRemoteEntryOption = {
|
|
117
116
|
entry: string;
|
|
118
117
|
};
|
|
119
118
|
/**
|
|
@@ -121,13 +120,13 @@ type ForceRemoteEntryOption = {
|
|
|
121
120
|
* - string / { version }:对所有 remote 的 entry/url/manifest 中 `key@xxx` 做版本替换
|
|
122
121
|
* - { entry }:key 为 remote 的 alias(优先)或 name 时,对该 remote 做整入口替换
|
|
123
122
|
*/
|
|
124
|
-
type ForceRemoteItem = ForceRemoteVersion | ForceRemoteVersionOption | ForceRemoteEntryOption;
|
|
125
|
-
type ForceRemoteOptions = Record<string, ForceRemoteItem>;
|
|
126
|
-
type EMPPluginShareType = ModuleFederationPluginOptions & {
|
|
123
|
+
export type ForceRemoteItem = ForceRemoteVersion | ForceRemoteVersionOption | ForceRemoteEntryOption;
|
|
124
|
+
export type ForceRemoteOptions = Record<string, ForceRemoteItem>;
|
|
125
|
+
export type EMPPluginShareType = ModuleFederationPluginOptions & {
|
|
127
126
|
empRuntime?: EMPSHARERuntimeOptions;
|
|
128
127
|
forceRemotes?: ForceRemoteOptions;
|
|
129
128
|
};
|
|
130
|
-
type ExternalsItemType = {
|
|
129
|
+
export type ExternalsItemType = {
|
|
131
130
|
/**
|
|
132
131
|
* 模块名
|
|
133
132
|
* @example react-dom
|
|
@@ -153,5 +152,3 @@ type ExternalsItemType = {
|
|
|
153
152
|
*/
|
|
154
153
|
type?: string;
|
|
155
154
|
};
|
|
156
|
-
|
|
157
|
-
export type { EMPPluginShareType as E, ForceRemoteVersion as F, ModuleFederationPluginOptions as M, RemoteInfoForForce as R, EMPSHARERuntimeOptions as a, frameworkOptions as b, ForceRemoteVersionOption as c, ForceRemoteEntryOption as d, ForceRemoteItem as e, frameworLibType as f, ForceRemoteOptions as g, ExternalsItemType as h, runtimeLibType as r };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ModuleFederation } from '@module-federation/runtime';
|
|
2
|
+
import type { EMPShareRuntimeType, EmpRuntimeOptions, InitOptionsType, LoadRemoteType } from '../types';
|
|
3
|
+
type EmpInitOptionsType = Partial<InitOptionsType>;
|
|
4
|
+
export declare class EMPRuntime {
|
|
5
|
+
libs: EMPShareRuntimeType;
|
|
6
|
+
initOptions: InitOptionsType;
|
|
7
|
+
options: EmpRuntimeOptions;
|
|
8
|
+
shareGlobalName: string;
|
|
9
|
+
constructor(op?: EMPShareRuntimeType);
|
|
10
|
+
mfInstance?: ModuleFederation;
|
|
11
|
+
setup(o?: EMPShareRuntimeType | string): void;
|
|
12
|
+
init(options?: EmpInitOptionsType): ModuleFederation | undefined;
|
|
13
|
+
load<T = any>(...args: LoadRemoteType): Promise<T>;
|
|
14
|
+
register(...args: Parameters<NonNullable<typeof this.mfInstance>['registerRemotes']>): void | undefined;
|
|
15
|
+
preload(...args: Parameters<NonNullable<typeof this.mfInstance>['preloadRemote']>): Promise<void> | undefined;
|
|
16
|
+
loadShare(...args: Parameters<NonNullable<typeof this.mfInstance>['loadShare']>): Promise<false | (() => unknown)> | undefined;
|
|
17
|
+
preloadRemote(...args: Parameters<NonNullable<typeof this.mfInstance>['preloadRemote']>): Promise<void> | undefined;
|
|
18
|
+
}
|
|
19
|
+
declare const _default: EMPRuntime;
|
|
20
|
+
export default _default;
|