@module-federation/webpack-bundler-runtime 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/attachShareScopeMap.cjs +11 -0
- package/dist/attachShareScopeMap.cjs.map +1 -0
- package/dist/attachShareScopeMap.d.ts +7 -0
- package/dist/attachShareScopeMap.js +10 -0
- package/dist/attachShareScopeMap.js.map +1 -0
- package/dist/constant.cjs +8 -0
- package/dist/constant.cjs.map +1 -0
- package/dist/constant.d.ts +5 -1
- package/dist/constant.js +6 -0
- package/dist/constant.js.map +1 -0
- package/dist/consumes.cjs +55 -0
- package/dist/consumes.cjs.map +1 -0
- package/dist/consumes.js +55 -0
- package/dist/consumes.js.map +1 -0
- package/dist/getSharedFallbackGetter.cjs +27 -0
- package/dist/getSharedFallbackGetter.cjs.map +1 -0
- package/dist/getSharedFallbackGetter.js +26 -0
- package/dist/getSharedFallbackGetter.js.map +1 -0
- package/dist/getUsedExports.cjs +11 -0
- package/dist/getUsedExports.cjs.map +1 -0
- package/dist/getUsedExports.js +10 -0
- package/dist/getUsedExports.js.map +1 -0
- package/dist/index.cjs +50 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +48 -2
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/init.cjs +82 -0
- package/dist/init.cjs.map +1 -0
- package/dist/init.js +80 -0
- package/dist/init.js.map +1 -0
- package/dist/initContainerEntry.cjs +43 -0
- package/dist/initContainerEntry.cjs.map +1 -0
- package/dist/initContainerEntry.d.ts +7 -0
- package/dist/initContainerEntry.js +42 -0
- package/dist/initContainerEntry.js.map +1 -0
- package/dist/initializeSharing.cjs +61 -0
- package/dist/initializeSharing.cjs.map +1 -0
- package/dist/initializeSharing.d.ts +13 -0
- package/dist/initializeSharing.js +61 -0
- package/dist/initializeSharing.js.map +1 -0
- package/dist/installInitialConsumes.cjs +63 -0
- package/dist/installInitialConsumes.cjs.map +1 -0
- package/dist/installInitialConsumes.js +63 -0
- package/dist/installInitialConsumes.js.map +1 -0
- package/dist/remotes.cjs +74 -0
- package/dist/remotes.cjs.map +1 -0
- package/dist/remotes.js +73 -0
- package/dist/remotes.js.map +1 -0
- package/dist/runtime-core/dist/core.d.ts +132 -0
- package/dist/runtime-core/dist/global.d.ts +25 -0
- package/dist/runtime-core/dist/helpers.d.ts +4 -0
- package/dist/runtime-core/dist/index.d.ts +15 -0
- package/dist/runtime-core/dist/module/index.d.ts +33 -0
- package/dist/runtime-core/dist/plugins/snapshot/SnapshotHandler.d.ts +68 -0
- package/dist/runtime-core/dist/remote/index.d.ts +121 -0
- package/dist/runtime-core/dist/shared/index.d.ts +85 -0
- package/dist/runtime-core/dist/type/config.d.ts +117 -0
- package/dist/runtime-core/dist/type/index.d.ts +3 -0
- package/dist/runtime-core/dist/type/plugin.d.ts +28 -0
- package/dist/runtime-core/dist/type/preload.d.ts +32 -0
- package/dist/runtime-core/dist/types.d.ts +4 -0
- package/dist/runtime-core/dist/utils/env.d.ts +1 -0
- package/dist/runtime-core/dist/utils/hooks/asyncHook.d.ts +11 -0
- package/dist/runtime-core/dist/utils/hooks/asyncWaterfallHooks.d.ts +13 -0
- package/dist/runtime-core/dist/utils/hooks/pluginSystem.d.ts +20 -0
- package/dist/runtime-core/dist/utils/hooks/syncHook.d.ts +17 -0
- package/dist/runtime-core/dist/utils/hooks/syncWaterfallHook.d.ts +12 -0
- package/dist/runtime-core/dist/utils/index.d.ts +2 -0
- package/dist/runtime-core/dist/utils/load.d.ts +16 -0
- package/dist/runtime-core/dist/utils/logger.d.ts +1 -0
- package/dist/runtime-core/dist/utils/manifest.d.ts +2 -0
- package/dist/runtime-core/dist/utils/plugin.d.ts +2 -0
- package/dist/runtime-core/dist/utils/preload.d.ts +4 -0
- package/dist/runtime-core/dist/utils/share.d.ts +3 -0
- package/dist/runtime-core/dist/utils/tool.d.ts +1 -0
- package/dist/sdk/dist/types/plugins/ModuleFederationPlugin.d.ts +13 -0
- package/dist/types.d.ts +201 -0
- package/dist/updateOptions.cjs +112 -0
- package/dist/updateOptions.cjs.map +1 -0
- package/dist/updateOptions.js +110 -0
- package/dist/updateOptions.js.map +1 -0
- package/package.json +9 -9
- package/dist/constant.cjs.cjs +0 -6
- package/dist/constant.cjs.cjs.map +0 -1
- package/dist/constant.cjs.d.ts +0 -1
- package/dist/constant.esm.js +0 -4
- package/dist/constant.esm.js.map +0 -1
- package/dist/index.cjs.cjs +0 -793
- package/dist/index.cjs.cjs.map +0 -1
- package/dist/index.cjs.d.ts +0 -2
- package/dist/index.esm.js +0 -772
- package/dist/index.esm.js.map +0 -1
- package/dist/src/attachShareScopeMap.d.ts +0 -2
- package/dist/src/constant.d.ts +0 -1
- package/dist/src/consumes.d.ts +0 -2
- package/dist/src/getSharedFallbackGetter.d.ts +0 -2
- package/dist/src/getUsedExports.d.ts +0 -2
- package/dist/src/index.d.ts +0 -39
- package/dist/src/init.d.ts +0 -4
- package/dist/src/initContainerEntry.d.ts +0 -2
- package/dist/src/initializeSharing.d.ts +0 -2
- package/dist/src/installInitialConsumes.d.ts +0 -2
- package/dist/src/remotes.d.ts +0 -2
- package/dist/src/types.d.ts +0 -194
- package/dist/src/updateOptions.d.ts +0 -3
package/dist/init.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { getRemoteEntry } from "@module-federation/runtime";
|
|
2
|
+
import helpers from "@module-federation/runtime/helpers";
|
|
3
|
+
|
|
4
|
+
//#region src/init.ts
|
|
5
|
+
function init({ webpackRequire }) {
|
|
6
|
+
const { initOptions, runtime, sharedFallback, bundlerRuntime, libraryType } = webpackRequire.federation;
|
|
7
|
+
if (!initOptions) throw new Error("initOptions is required!");
|
|
8
|
+
const treeShakingSharePlugin = function() {
|
|
9
|
+
return {
|
|
10
|
+
name: "tree-shake-plugin",
|
|
11
|
+
beforeInit(args) {
|
|
12
|
+
const { userOptions, origin, options: registeredOptions } = args;
|
|
13
|
+
const version = userOptions.version || registeredOptions.version;
|
|
14
|
+
if (!sharedFallback) return args;
|
|
15
|
+
const currentShared = userOptions.shared || {};
|
|
16
|
+
const shared = [];
|
|
17
|
+
Object.keys(currentShared).forEach((sharedName) => {
|
|
18
|
+
(Array.isArray(currentShared[sharedName]) ? currentShared[sharedName] : [currentShared[sharedName]]).forEach((sharedArg) => {
|
|
19
|
+
shared.push([sharedName, sharedArg]);
|
|
20
|
+
if ("get" in sharedArg) {
|
|
21
|
+
sharedArg.treeShaking ||= {};
|
|
22
|
+
sharedArg.treeShaking.get = sharedArg.get;
|
|
23
|
+
sharedArg.get = bundlerRuntime.getSharedFallbackGetter({
|
|
24
|
+
shareKey: sharedName,
|
|
25
|
+
factory: sharedArg.get,
|
|
26
|
+
webpackRequire,
|
|
27
|
+
libraryType,
|
|
28
|
+
version: sharedArg.version
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
const hostGlobalSnapshot = helpers.global.getGlobalSnapshotInfoByModuleInfo({
|
|
34
|
+
name: origin.name,
|
|
35
|
+
version
|
|
36
|
+
});
|
|
37
|
+
if (!hostGlobalSnapshot || !("shared" in hostGlobalSnapshot)) return args;
|
|
38
|
+
Object.keys(registeredOptions.shared || {}).forEach((pkgName) => {
|
|
39
|
+
registeredOptions.shared[pkgName].forEach((sharedArg) => {
|
|
40
|
+
shared.push([pkgName, sharedArg]);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
const patchShared = (pkgName, shared) => {
|
|
44
|
+
const shareSnapshot = hostGlobalSnapshot.shared.find((item) => item.sharedName === pkgName);
|
|
45
|
+
if (!shareSnapshot) return;
|
|
46
|
+
const { treeShaking } = shared;
|
|
47
|
+
if (!treeShaking) return;
|
|
48
|
+
const { secondarySharedTreeShakingName, secondarySharedTreeShakingEntry, treeShakingStatus } = shareSnapshot;
|
|
49
|
+
if (treeShaking.status === treeShakingStatus) return;
|
|
50
|
+
treeShaking.status = treeShakingStatus;
|
|
51
|
+
if (secondarySharedTreeShakingEntry && libraryType && secondarySharedTreeShakingName) treeShaking.get = async () => {
|
|
52
|
+
const shareEntry = await getRemoteEntry({
|
|
53
|
+
origin,
|
|
54
|
+
remoteInfo: {
|
|
55
|
+
name: secondarySharedTreeShakingName,
|
|
56
|
+
entry: secondarySharedTreeShakingEntry,
|
|
57
|
+
type: libraryType,
|
|
58
|
+
entryGlobalName: secondarySharedTreeShakingName,
|
|
59
|
+
shareScope: "default"
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
await shareEntry.init(origin, __webpack_require__.federation.bundlerRuntime);
|
|
63
|
+
return shareEntry.get();
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
shared.forEach(([pkgName, sharedArg]) => {
|
|
67
|
+
patchShared(pkgName, sharedArg);
|
|
68
|
+
});
|
|
69
|
+
return args;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
initOptions.plugins ||= [];
|
|
74
|
+
initOptions.plugins.push(treeShakingSharePlugin());
|
|
75
|
+
return runtime.init(initOptions);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
export { init };
|
|
80
|
+
//# sourceMappingURL=init.js.map
|
package/dist/init.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","names":[],"sources":["../src/init.ts"],"sourcesContent":["import type { WebpackRequire } from './types';\nimport {\n getRemoteEntry,\n type ModuleFederationRuntimePlugin,\n} from '@module-federation/runtime';\nimport { ShareArgs } from '@module-federation/runtime/types';\nimport helpers from '@module-federation/runtime/helpers';\n\nexport function init({ webpackRequire }: { webpackRequire: WebpackRequire }) {\n const { initOptions, runtime, sharedFallback, bundlerRuntime, libraryType } =\n webpackRequire.federation;\n\n if (!initOptions) {\n throw new Error('initOptions is required!');\n }\n\n const treeShakingSharePlugin: () => ModuleFederationRuntimePlugin =\n function () {\n return {\n name: 'tree-shake-plugin',\n beforeInit(args) {\n const { userOptions, origin, options: registeredOptions } = args;\n const version = userOptions.version || registeredOptions.version;\n if (!sharedFallback) {\n return args;\n }\n\n const currentShared = userOptions.shared || {};\n const shared: Array<[pkgName: string, ShareArgs]> = [];\n\n Object.keys(currentShared).forEach((sharedName) => {\n const sharedArgs = Array.isArray(currentShared[sharedName])\n ? currentShared[sharedName]\n : [currentShared[sharedName]];\n sharedArgs.forEach((sharedArg) => {\n shared.push([sharedName, sharedArg]);\n if ('get' in sharedArg) {\n sharedArg.treeShaking ||= {};\n sharedArg.treeShaking.get = sharedArg.get;\n sharedArg.get = bundlerRuntime!.getSharedFallbackGetter({\n shareKey: sharedName,\n factory: sharedArg.get,\n webpackRequire,\n libraryType,\n version: sharedArg.version,\n });\n }\n });\n });\n\n // read snapshot to override re-shake getter\n const hostGlobalSnapshot =\n helpers.global.getGlobalSnapshotInfoByModuleInfo({\n name: origin.name,\n version: version,\n });\n if (!hostGlobalSnapshot || !('shared' in hostGlobalSnapshot)) {\n return args;\n }\n\n Object.keys(registeredOptions.shared || {}).forEach((pkgName) => {\n const sharedInfo = registeredOptions.shared[pkgName];\n sharedInfo.forEach((sharedArg) => {\n shared.push([pkgName, sharedArg]);\n });\n });\n\n const patchShared = (pkgName: string, shared: ShareArgs) => {\n const shareSnapshot = hostGlobalSnapshot.shared.find(\n (item) => item.sharedName === pkgName,\n );\n if (!shareSnapshot) {\n return;\n }\n const { treeShaking } = shared;\n if (!treeShaking) {\n return;\n }\n const {\n secondarySharedTreeShakingName,\n secondarySharedTreeShakingEntry,\n treeShakingStatus,\n } = shareSnapshot;\n if (treeShaking.status === treeShakingStatus) {\n return;\n }\n treeShaking.status = treeShakingStatus;\n if (\n secondarySharedTreeShakingEntry &&\n libraryType &&\n secondarySharedTreeShakingName\n ) {\n treeShaking.get = async () => {\n const shareEntry = await getRemoteEntry({\n origin,\n remoteInfo: {\n name: secondarySharedTreeShakingName,\n entry: secondarySharedTreeShakingEntry,\n type: libraryType,\n entryGlobalName: secondarySharedTreeShakingName,\n // current not used\n shareScope: 'default',\n },\n });\n // TODO: add errorLoad hook ?\n // @ts-ignore\n await shareEntry.init(\n origin,\n // @ts-ignore\n __webpack_require__.federation.bundlerRuntime,\n );\n // @ts-ignore\n const getter = shareEntry.get();\n return getter;\n };\n }\n };\n shared.forEach(([pkgName, sharedArg]) => {\n patchShared(pkgName, sharedArg);\n });\n\n return args;\n },\n };\n };\n\n initOptions.plugins ||= [];\n initOptions.plugins.push(treeShakingSharePlugin());\n return runtime!.init(initOptions);\n}\n"],"mappings":";;;;AAQA,SAAgB,KAAK,EAAE,kBAAsD;CAC3E,MAAM,EAAE,aAAa,SAAS,gBAAgB,gBAAgB,gBAC5D,eAAe;AAEjB,KAAI,CAAC,YACH,OAAM,IAAI,MAAM,2BAA2B;CAG7C,MAAM,yBACJ,WAAY;AACV,SAAO;GACL,MAAM;GACN,WAAW,MAAM;IACf,MAAM,EAAE,aAAa,QAAQ,SAAS,sBAAsB;IAC5D,MAAM,UAAU,YAAY,WAAW,kBAAkB;AACzD,QAAI,CAAC,eACH,QAAO;IAGT,MAAM,gBAAgB,YAAY,UAAU,EAAE;IAC9C,MAAM,SAA8C,EAAE;AAEtD,WAAO,KAAK,cAAc,CAAC,SAAS,eAAe;AAIjD,MAHmB,MAAM,QAAQ,cAAc,YAAY,GACvD,cAAc,cACd,CAAC,cAAc,YAAY,EACpB,SAAS,cAAc;AAChC,aAAO,KAAK,CAAC,YAAY,UAAU,CAAC;AACpC,UAAI,SAAS,WAAW;AACtB,iBAAU,gBAAgB,EAAE;AAC5B,iBAAU,YAAY,MAAM,UAAU;AACtC,iBAAU,MAAM,eAAgB,wBAAwB;QACtD,UAAU;QACV,SAAS,UAAU;QACnB;QACA;QACA,SAAS,UAAU;QACpB,CAAC;;OAEJ;MACF;IAGF,MAAM,qBACJ,QAAQ,OAAO,kCAAkC;KAC/C,MAAM,OAAO;KACJ;KACV,CAAC;AACJ,QAAI,CAAC,sBAAsB,EAAE,YAAY,oBACvC,QAAO;AAGT,WAAO,KAAK,kBAAkB,UAAU,EAAE,CAAC,CAAC,SAAS,YAAY;AAE/D,KADmB,kBAAkB,OAAO,SACjC,SAAS,cAAc;AAChC,aAAO,KAAK,CAAC,SAAS,UAAU,CAAC;OACjC;MACF;IAEF,MAAM,eAAe,SAAiB,WAAsB;KAC1D,MAAM,gBAAgB,mBAAmB,OAAO,MAC7C,SAAS,KAAK,eAAe,QAC/B;AACD,SAAI,CAAC,cACH;KAEF,MAAM,EAAE,gBAAgB;AACxB,SAAI,CAAC,YACH;KAEF,MAAM,EACJ,gCACA,iCACA,sBACE;AACJ,SAAI,YAAY,WAAW,kBACzB;AAEF,iBAAY,SAAS;AACrB,SACE,mCACA,eACA,+BAEA,aAAY,MAAM,YAAY;MAC5B,MAAM,aAAa,MAAM,eAAe;OACtC;OACA,YAAY;QACV,MAAM;QACN,OAAO;QACP,MAAM;QACN,iBAAiB;QAEjB,YAAY;QACb;OACF,CAAC;AAGF,YAAM,WAAW,KACf,QAEA,oBAAoB,WAAW,eAChC;AAGD,aADe,WAAW,KAAK;;;AAKrC,WAAO,SAAS,CAAC,SAAS,eAAe;AACvC,iBAAY,SAAS,UAAU;MAC/B;AAEF,WAAO;;GAEV;;AAGL,aAAY,YAAY,EAAE;AAC1B,aAAY,QAAQ,KAAK,wBAAwB,CAAC;AAClD,QAAO,QAAS,KAAK,YAAY"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/initContainerEntry.ts
|
|
3
|
+
function initContainerEntry(options) {
|
|
4
|
+
const { webpackRequire, shareScope, initScope, shareScopeKey, remoteEntryInitOptions } = options;
|
|
5
|
+
if (!webpackRequire.S) return;
|
|
6
|
+
if (!webpackRequire.federation || !webpackRequire.federation.instance || !webpackRequire.federation.initOptions) return;
|
|
7
|
+
const federationInstance = webpackRequire.federation.instance;
|
|
8
|
+
federationInstance.initOptions({
|
|
9
|
+
name: webpackRequire.federation.initOptions.name,
|
|
10
|
+
remotes: [],
|
|
11
|
+
...remoteEntryInitOptions
|
|
12
|
+
});
|
|
13
|
+
const hostShareScopeKeys = remoteEntryInitOptions?.shareScopeKeys;
|
|
14
|
+
const hostShareScopeMap = remoteEntryInitOptions?.shareScopeMap;
|
|
15
|
+
if (!shareScopeKey || typeof shareScopeKey === "string") {
|
|
16
|
+
const key = shareScopeKey || "default";
|
|
17
|
+
if (Array.isArray(hostShareScopeKeys)) hostShareScopeKeys.forEach((hostKey) => {
|
|
18
|
+
if (!hostShareScopeMap[hostKey]) hostShareScopeMap[hostKey] = {};
|
|
19
|
+
const sc = hostShareScopeMap[hostKey];
|
|
20
|
+
federationInstance.initShareScopeMap(hostKey, sc, { hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {} });
|
|
21
|
+
});
|
|
22
|
+
else federationInstance.initShareScopeMap(key, shareScope, { hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {} });
|
|
23
|
+
} else shareScopeKey.forEach((key) => {
|
|
24
|
+
if (!hostShareScopeKeys || !hostShareScopeMap) {
|
|
25
|
+
federationInstance.initShareScopeMap(key, shareScope, { hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {} });
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (!hostShareScopeMap[key]) hostShareScopeMap[key] = {};
|
|
29
|
+
const sc = hostShareScopeMap[key];
|
|
30
|
+
federationInstance.initShareScopeMap(key, sc, { hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {} });
|
|
31
|
+
});
|
|
32
|
+
if (webpackRequire.federation.attachShareScopeMap) webpackRequire.federation.attachShareScopeMap(webpackRequire);
|
|
33
|
+
if (typeof webpackRequire.federation.prefetch === "function") webpackRequire.federation.prefetch();
|
|
34
|
+
if (!Array.isArray(shareScopeKey)) return webpackRequire.I(shareScopeKey || "default", initScope);
|
|
35
|
+
if (Boolean(webpackRequire.federation.initOptions.shared)) return webpackRequire.I(shareScopeKey, initScope);
|
|
36
|
+
return Promise.all(shareScopeKey.map((key) => {
|
|
37
|
+
return webpackRequire.I(key, initScope);
|
|
38
|
+
})).then(() => true);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
exports.initContainerEntry = initContainerEntry;
|
|
43
|
+
//# sourceMappingURL=initContainerEntry.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initContainerEntry.cjs","names":[],"sources":["../src/initContainerEntry.ts"],"sourcesContent":["import { InitContainerEntryOptions, WebpackRequire } from './types';\n\nexport function initContainerEntry(\n options: InitContainerEntryOptions,\n): WebpackRequire['I'] | void {\n const {\n webpackRequire,\n shareScope,\n initScope,\n shareScopeKey,\n remoteEntryInitOptions,\n } = options;\n if (!webpackRequire.S) return;\n if (\n !webpackRequire.federation ||\n !webpackRequire.federation.instance ||\n !webpackRequire.federation.initOptions\n )\n return;\n\n const federationInstance = webpackRequire.federation.instance;\n\n federationInstance.initOptions({\n name: webpackRequire.federation.initOptions.name,\n remotes: [],\n ...remoteEntryInitOptions,\n });\n\n const hostShareScopeKeys = remoteEntryInitOptions?.shareScopeKeys;\n const hostShareScopeMap = remoteEntryInitOptions?.shareScopeMap;\n\n // host: 'default' remote: 'default' remote['default'] = hostShareScopeMap['default']\n // host: ['default', 'scope1'] remote: 'default' remote['default'] = hostShareScopeMap['default']; remote['scope1'] = hostShareScopeMap['scop1']\n // host: 'default' remote: ['default','scope1'] remote['default'] = hostShareScopeMap['default']; remote['scope1'] = hostShareScopeMap['scope1'] = {}\n // host: ['scope1','default'] remote: ['scope1','scope2'] => remote['scope1'] = hostShareScopeMap['scope1']; remote['scope2'] = hostShareScopeMap['scope2'] = {};\n if (!shareScopeKey || typeof shareScopeKey === 'string') {\n const key = shareScopeKey || 'default';\n if (Array.isArray(hostShareScopeKeys)) {\n // const sc = hostShareScopeMap![key];\n // if (!sc) {\n // throw new Error('shareScopeKey is not exist in hostShareScopeMap');\n // }\n // federationInstance.initShareScopeMap(key, sc, {\n // hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {},\n // });\n\n hostShareScopeKeys.forEach((hostKey) => {\n if (!hostShareScopeMap![hostKey]) {\n hostShareScopeMap![hostKey] = {};\n }\n const sc = hostShareScopeMap![hostKey];\n federationInstance.initShareScopeMap(hostKey, sc, {\n hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {},\n });\n });\n } else {\n federationInstance.initShareScopeMap(key, shareScope, {\n hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {},\n });\n }\n } else {\n shareScopeKey.forEach((key) => {\n if (!hostShareScopeKeys || !hostShareScopeMap) {\n federationInstance.initShareScopeMap(key, shareScope, {\n hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {},\n });\n return;\n }\n\n if (!hostShareScopeMap[key]) {\n hostShareScopeMap[key] = {};\n }\n const sc = hostShareScopeMap[key];\n federationInstance.initShareScopeMap(key, sc, {\n hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {},\n });\n });\n }\n\n if (webpackRequire.federation.attachShareScopeMap) {\n webpackRequire.federation.attachShareScopeMap(webpackRequire);\n }\n if (typeof webpackRequire.federation.prefetch === 'function') {\n webpackRequire.federation.prefetch();\n }\n\n if (!Array.isArray(shareScopeKey)) {\n // @ts-ignore\n return webpackRequire.I(shareScopeKey || 'default', initScope);\n }\n\n var proxyInitializeSharing = Boolean(\n webpackRequire.federation.initOptions.shared,\n );\n\n if (proxyInitializeSharing) {\n // @ts-ignore\n return webpackRequire.I(shareScopeKey, initScope);\n }\n // @ts-ignore\n return Promise.all(\n shareScopeKey.map((key) => {\n // @ts-ignore\n return webpackRequire.I(key, initScope);\n }),\n ).then(() => true);\n}\n"],"mappings":";;AAEA,SAAgB,mBACd,SAC4B;CAC5B,MAAM,EACJ,gBACA,YACA,WACA,eACA,2BACE;AACJ,KAAI,CAAC,eAAe,EAAG;AACvB,KACE,CAAC,eAAe,cAChB,CAAC,eAAe,WAAW,YAC3B,CAAC,e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,QAAQ,IACb,cAAc,KAAK,QAAQ;AAEzB,SAAO,eAAe,EAAE,KAAK,UAAU;GACvC,CACH,CAAC,WAAW,KAAK"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InitContainerEntryOptions, WebpackRequire } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/initContainerEntry.d.ts
|
|
4
|
+
declare function initContainerEntry(options: InitContainerEntryOptions): WebpackRequire['I'] | void;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { initContainerEntry };
|
|
7
|
+
//# sourceMappingURL=initContainerEntry.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region src/initContainerEntry.ts
|
|
2
|
+
function initContainerEntry(options) {
|
|
3
|
+
const { webpackRequire, shareScope, initScope, shareScopeKey, remoteEntryInitOptions } = options;
|
|
4
|
+
if (!webpackRequire.S) return;
|
|
5
|
+
if (!webpackRequire.federation || !webpackRequire.federation.instance || !webpackRequire.federation.initOptions) return;
|
|
6
|
+
const federationInstance = webpackRequire.federation.instance;
|
|
7
|
+
federationInstance.initOptions({
|
|
8
|
+
name: webpackRequire.federation.initOptions.name,
|
|
9
|
+
remotes: [],
|
|
10
|
+
...remoteEntryInitOptions
|
|
11
|
+
});
|
|
12
|
+
const hostShareScopeKeys = remoteEntryInitOptions?.shareScopeKeys;
|
|
13
|
+
const hostShareScopeMap = remoteEntryInitOptions?.shareScopeMap;
|
|
14
|
+
if (!shareScopeKey || typeof shareScopeKey === "string") {
|
|
15
|
+
const key = shareScopeKey || "default";
|
|
16
|
+
if (Array.isArray(hostShareScopeKeys)) hostShareScopeKeys.forEach((hostKey) => {
|
|
17
|
+
if (!hostShareScopeMap[hostKey]) hostShareScopeMap[hostKey] = {};
|
|
18
|
+
const sc = hostShareScopeMap[hostKey];
|
|
19
|
+
federationInstance.initShareScopeMap(hostKey, sc, { hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {} });
|
|
20
|
+
});
|
|
21
|
+
else federationInstance.initShareScopeMap(key, shareScope, { hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {} });
|
|
22
|
+
} else shareScopeKey.forEach((key) => {
|
|
23
|
+
if (!hostShareScopeKeys || !hostShareScopeMap) {
|
|
24
|
+
federationInstance.initShareScopeMap(key, shareScope, { hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {} });
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (!hostShareScopeMap[key]) hostShareScopeMap[key] = {};
|
|
28
|
+
const sc = hostShareScopeMap[key];
|
|
29
|
+
federationInstance.initShareScopeMap(key, sc, { hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {} });
|
|
30
|
+
});
|
|
31
|
+
if (webpackRequire.federation.attachShareScopeMap) webpackRequire.federation.attachShareScopeMap(webpackRequire);
|
|
32
|
+
if (typeof webpackRequire.federation.prefetch === "function") webpackRequire.federation.prefetch();
|
|
33
|
+
if (!Array.isArray(shareScopeKey)) return webpackRequire.I(shareScopeKey || "default", initScope);
|
|
34
|
+
if (Boolean(webpackRequire.federation.initOptions.shared)) return webpackRequire.I(shareScopeKey, initScope);
|
|
35
|
+
return Promise.all(shareScopeKey.map((key) => {
|
|
36
|
+
return webpackRequire.I(key, initScope);
|
|
37
|
+
})).then(() => true);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { initContainerEntry };
|
|
42
|
+
//# sourceMappingURL=initContainerEntry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initContainerEntry.js","names":[],"sources":["../src/initContainerEntry.ts"],"sourcesContent":["import { InitContainerEntryOptions, WebpackRequire } from './types';\n\nexport function initContainerEntry(\n options: InitContainerEntryOptions,\n): WebpackRequire['I'] | void {\n const {\n webpackRequire,\n shareScope,\n initScope,\n shareScopeKey,\n remoteEntryInitOptions,\n } = options;\n if (!webpackRequire.S) return;\n if (\n !webpackRequire.federation ||\n !webpackRequire.federation.instance ||\n !webpackRequire.federation.initOptions\n )\n return;\n\n const federationInstance = webpackRequire.federation.instance;\n\n federationInstance.initOptions({\n name: webpackRequire.federation.initOptions.name,\n remotes: [],\n ...remoteEntryInitOptions,\n });\n\n const hostShareScopeKeys = remoteEntryInitOptions?.shareScopeKeys;\n const hostShareScopeMap = remoteEntryInitOptions?.shareScopeMap;\n\n // host: 'default' remote: 'default' remote['default'] = hostShareScopeMap['default']\n // host: ['default', 'scope1'] remote: 'default' remote['default'] = hostShareScopeMap['default']; remote['scope1'] = hostShareScopeMap['scop1']\n // host: 'default' remote: ['default','scope1'] remote['default'] = hostShareScopeMap['default']; remote['scope1'] = hostShareScopeMap['scope1'] = {}\n // host: ['scope1','default'] remote: ['scope1','scope2'] => remote['scope1'] = hostShareScopeMap['scope1']; remote['scope2'] = hostShareScopeMap['scope2'] = {};\n if (!shareScopeKey || typeof shareScopeKey === 'string') {\n const key = shareScopeKey || 'default';\n if (Array.isArray(hostShareScopeKeys)) {\n // const sc = hostShareScopeMap![key];\n // if (!sc) {\n // throw new Error('shareScopeKey is not exist in hostShareScopeMap');\n // }\n // federationInstance.initShareScopeMap(key, sc, {\n // hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {},\n // });\n\n hostShareScopeKeys.forEach((hostKey) => {\n if (!hostShareScopeMap![hostKey]) {\n hostShareScopeMap![hostKey] = {};\n }\n const sc = hostShareScopeMap![hostKey];\n federationInstance.initShareScopeMap(hostKey, sc, {\n hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {},\n });\n });\n } else {\n federationInstance.initShareScopeMap(key, shareScope, {\n hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {},\n });\n }\n } else {\n shareScopeKey.forEach((key) => {\n if (!hostShareScopeKeys || !hostShareScopeMap) {\n federationInstance.initShareScopeMap(key, shareScope, {\n hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {},\n });\n return;\n }\n\n if (!hostShareScopeMap[key]) {\n hostShareScopeMap[key] = {};\n }\n const sc = hostShareScopeMap[key];\n federationInstance.initShareScopeMap(key, sc, {\n hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {},\n });\n });\n }\n\n if (webpackRequire.federation.attachShareScopeMap) {\n webpackRequire.federation.attachShareScopeMap(webpackRequire);\n }\n if (typeof webpackRequire.federation.prefetch === 'function') {\n webpackRequire.federation.prefetch();\n }\n\n if (!Array.isArray(shareScopeKey)) {\n // @ts-ignore\n return webpackRequire.I(shareScopeKey || 'default', initScope);\n }\n\n var proxyInitializeSharing = Boolean(\n webpackRequire.federation.initOptions.shared,\n );\n\n if (proxyInitializeSharing) {\n // @ts-ignore\n return webpackRequire.I(shareScopeKey, initScope);\n }\n // @ts-ignore\n return Promise.all(\n shareScopeKey.map((key) => {\n // @ts-ignore\n return webpackRequire.I(key, initScope);\n }),\n ).then(() => true);\n}\n"],"mappings":";AAEA,SAAgB,mBACd,SAC4B;CAC5B,MAAM,EACJ,gBACA,YACA,WACA,eACA,2BACE;AACJ,KAAI,CAAC,eAAe,EAAG;AACvB,KACE,CAAC,eAAe,cAChB,CAAC,eAAe,WAAW,YAC3B,CAAC,eAAe,WAAW,YAE3B;CAEF,MAAM,qBAAqB,eAAe,WAAW;AAErD,oBAAmB,YAAY;EAC7B,MAAM,eAAe,WAAW,YAAY;EAC5C,SAAS,EAAE;EACX,GAAG;EACJ,CAAC;CAEF,MAAM,qBAAqB,wBAAwB;CACnD,MAAM,oBAAoB,wBAAwB;AAMlD,KAAI,CAAC,iBAAiB,OAAO,kBAAkB,UAAU;EACvD,MAAM,MAAM,iBAAiB;AAC7B,MAAI,MAAM,QAAQ,mBAAmB,CASnC,oBAAmB,SAAS,YAAY;AACtC,OAAI,CAAC,kBAAmB,SACtB,mBAAmB,WAAW,EAAE;GAElC,MAAM,KAAK,kBAAmB;AAC9B,sBAAmB,kBAAkB,SAAS,IAAI,EAChD,mBAAmB,wBAAwB,iBAAiB,EAAE,EAC/D,CAAC;IACF;MAEF,oBAAmB,kBAAkB,KAAK,YAAY,EACpD,mBAAmB,wBAAwB,iBAAiB,EAAE,EAC/D,CAAC;OAGJ,eAAc,SAAS,QAAQ;AAC7B,MAAI,CAAC,sBAAsB,CAAC,mBAAmB;AAC7C,sBAAmB,kBAAkB,KAAK,YAAY,EACpD,mBAAmB,wBAAwB,iBAAiB,EAAE,EAC/D,CAAC;AACF;;AAGF,MAAI,CAAC,kBAAkB,KACrB,mBAAkB,OAAO,EAAE;EAE7B,MAAM,KAAK,kBAAkB;AAC7B,qBAAmB,kBAAkB,KAAK,IAAI,EAC5C,mBAAmB,wBAAwB,iBAAiB,EAAE,EAC/D,CAAC;GACF;AAGJ,KAAI,eAAe,WAAW,oBAC5B,gBAAe,WAAW,oBAAoB,eAAe;AAE/D,KAAI,OAAO,eAAe,WAAW,aAAa,WAChD,gBAAe,WAAW,UAAU;AAGtC,KAAI,CAAC,MAAM,QAAQ,cAAc,CAE/B,QAAO,eAAe,EAAE,iBAAiB,WAAW,UAAU;AAOhE,KAJ6B,QAC3B,eAAe,WAAW,YAAY,OACvC,CAIC,QAAO,eAAe,EAAE,eAAe,UAAU;AAGnD,QAAO,QAAQ,IACb,cAAc,KAAK,QAAQ;AAEzB,SAAO,eAAe,EAAE,KAAK,UAAU;GACvC,CACH,CAAC,WAAW,KAAK"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const require_attachShareScopeMap = require('./attachShareScopeMap.cjs');
|
|
2
|
+
const require_constant = require('./constant.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/initializeSharing.ts
|
|
5
|
+
function initializeSharing({ shareScopeName, webpackRequire, initPromises, initTokens, initScope }) {
|
|
6
|
+
const shareScopeKeys = Array.isArray(shareScopeName) ? shareScopeName : [shareScopeName];
|
|
7
|
+
var initializeSharingPromises = [];
|
|
8
|
+
var _initializeSharing = function(shareScopeKey) {
|
|
9
|
+
if (!initScope) initScope = [];
|
|
10
|
+
const mfInstance = webpackRequire.federation.instance;
|
|
11
|
+
var initToken = initTokens[shareScopeKey];
|
|
12
|
+
if (!initToken) initToken = initTokens[shareScopeKey] = { from: mfInstance.name };
|
|
13
|
+
if (initScope.indexOf(initToken) >= 0) return;
|
|
14
|
+
initScope.push(initToken);
|
|
15
|
+
const promise = initPromises[shareScopeKey];
|
|
16
|
+
if (promise) return promise;
|
|
17
|
+
var warn = (msg) => typeof console !== "undefined" && console.warn && console.warn(msg);
|
|
18
|
+
var initExternal = (id) => {
|
|
19
|
+
var handleError = (err) => warn("Initialization of sharing external failed: " + err);
|
|
20
|
+
try {
|
|
21
|
+
var module = webpackRequire(id);
|
|
22
|
+
if (!module) return;
|
|
23
|
+
var initFn = (module) => module && module.init && module.init(webpackRequire.S[shareScopeKey], initScope, {
|
|
24
|
+
shareScopeMap: webpackRequire.S || {},
|
|
25
|
+
shareScopeKeys: shareScopeName
|
|
26
|
+
});
|
|
27
|
+
if (module.then) return promises.push(module.then(initFn, handleError));
|
|
28
|
+
var initResult = initFn(module);
|
|
29
|
+
if (initResult && typeof initResult !== "boolean" && initResult.then) return promises.push(initResult["catch"](handleError));
|
|
30
|
+
} catch (err) {
|
|
31
|
+
handleError(err);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const promises = mfInstance.initializeSharing(shareScopeKey, {
|
|
35
|
+
strategy: mfInstance.options.shareStrategy,
|
|
36
|
+
initScope,
|
|
37
|
+
from: "build"
|
|
38
|
+
});
|
|
39
|
+
require_attachShareScopeMap.attachShareScopeMap(webpackRequire);
|
|
40
|
+
const bundlerRuntimeRemotesOptions = webpackRequire.federation.bundlerRuntimeOptions.remotes;
|
|
41
|
+
if (bundlerRuntimeRemotesOptions) Object.keys(bundlerRuntimeRemotesOptions.idToRemoteMap).forEach((moduleId) => {
|
|
42
|
+
const info = bundlerRuntimeRemotesOptions.idToRemoteMap[moduleId];
|
|
43
|
+
const externalModuleId = bundlerRuntimeRemotesOptions.idToExternalAndNameMapping[moduleId][2];
|
|
44
|
+
if (info.length > 1) initExternal(externalModuleId);
|
|
45
|
+
else if (info.length === 1) {
|
|
46
|
+
const remoteInfo = info[0];
|
|
47
|
+
if (!require_constant.FEDERATION_SUPPORTED_TYPES.includes(remoteInfo.externalType)) initExternal(externalModuleId);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
if (!promises.length) return initPromises[shareScopeKey] = true;
|
|
51
|
+
return initPromises[shareScopeKey] = Promise.all(promises).then(() => initPromises[shareScopeKey] = true);
|
|
52
|
+
};
|
|
53
|
+
shareScopeKeys.forEach((key) => {
|
|
54
|
+
initializeSharingPromises.push(_initializeSharing(key));
|
|
55
|
+
});
|
|
56
|
+
return Promise.all(initializeSharingPromises).then(() => true);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
exports.initializeSharing = initializeSharing;
|
|
61
|
+
//# sourceMappingURL=initializeSharing.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initializeSharing.cjs","names":["FEDERATION_SUPPORTED_TYPES"],"sources":["../src/initializeSharing.ts"],"sourcesContent":["import { FEDERATION_SUPPORTED_TYPES } from './constant';\nimport { attachShareScopeMap } from './attachShareScopeMap';\nimport { RemoteEntryExports, InitializeSharingOptions } from './types';\n\nexport function initializeSharing({\n shareScopeName,\n webpackRequire,\n initPromises,\n initTokens,\n initScope,\n}: InitializeSharingOptions): Promise<boolean> | boolean | void {\n const shareScopeKeys = Array.isArray(shareScopeName)\n ? shareScopeName\n : [shareScopeName];\n var initializeSharingPromises: Array<Promise<boolean> | boolean | void> = [];\n var _initializeSharing = function (shareScopeKey: string) {\n if (!initScope) initScope = [];\n const mfInstance = webpackRequire.federation.instance!;\n\n // handling circular init calls\n var initToken = initTokens[shareScopeKey];\n if (!initToken)\n initToken = initTokens[shareScopeKey] = { from: mfInstance.name };\n if (initScope.indexOf(initToken) >= 0) return;\n initScope.push(initToken);\n\n const promise = initPromises[shareScopeKey];\n if (promise) return promise;\n var warn = (msg: string) =>\n typeof console !== 'undefined' && console.warn && console.warn(msg);\n\n var initExternal = (id: string | number) => {\n var handleError = (err: any) =>\n warn('Initialization of sharing external failed: ' + err);\n try {\n var module = webpackRequire(id);\n if (!module) return;\n var initFn = (module: RemoteEntryExports) =>\n module &&\n module.init &&\n // @ts-ignore compat legacy mf shared behavior\n module.init(webpackRequire.S![shareScopeKey], initScope, {\n shareScopeMap: webpackRequire.S || {},\n shareScopeKeys: shareScopeName,\n });\n if (module.then) return promises.push(module.then(initFn, handleError));\n var initResult = initFn(module);\n // @ts-ignore\n if (initResult && typeof initResult !== 'boolean' && initResult.then)\n // @ts-ignore\n return promises.push(initResult['catch'](handleError));\n } catch (err) {\n handleError(err);\n }\n };\n const promises = mfInstance.initializeSharing(shareScopeKey, {\n strategy: mfInstance.options.shareStrategy,\n initScope,\n from: 'build',\n });\n attachShareScopeMap(webpackRequire);\n\n const bundlerRuntimeRemotesOptions =\n webpackRequire.federation.bundlerRuntimeOptions.remotes;\n if (bundlerRuntimeRemotesOptions) {\n Object.keys(bundlerRuntimeRemotesOptions.idToRemoteMap).forEach(\n (moduleId) => {\n const info = bundlerRuntimeRemotesOptions.idToRemoteMap[moduleId];\n const externalModuleId =\n bundlerRuntimeRemotesOptions.idToExternalAndNameMapping[\n moduleId\n ][2];\n if (info.length > 1) {\n initExternal(externalModuleId);\n } else if (info.length === 1) {\n const remoteInfo = info[0];\n if (!FEDERATION_SUPPORTED_TYPES.includes(remoteInfo.externalType)) {\n initExternal(externalModuleId);\n }\n }\n },\n );\n }\n\n if (!promises.length) {\n return (initPromises[shareScopeKey] = true);\n }\n\n return (initPromises[shareScopeKey] = Promise.all(promises).then(\n () => (initPromises[shareScopeKey] = true),\n ));\n };\n\n shareScopeKeys.forEach((key) => {\n initializeSharingPromises.push(_initializeSharing(key));\n });\n return Promise.all(initializeSharingPromises).then(() => true);\n}\n"],"mappings":";;;;AAIA,SAAgB,kBAAkB,EAChC,gBACA,gBACA,cACA,YACA,aAC8D;CAC9D,MAAM,iBAAiB,MAAM,QAAQ,eA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C3B,UACA;AACJ,OAAI,KAAK,SAAS,EAChB,cAAa,iBAAiB;YACrB,KAAK,WAAW,GAAG;IAC5B,MAAM,aAAa,KAAK;AACxB,QAAI,CAACA,4CAA2B,SAAS,WAAW,aAAa,CAC/D,cAAa,iBAAiB;;IAIrC;AAGH,MAAI,CAAC,SAAS,OACZ,QAAQ,aAAa,iBAAiB;AAGxC,SAAQ,aAAa,iBAAiB,QAAQ,IAAI,SAAS,CAAC,WACnD,aAAa,iBAAiB,KACtC;;AAGH,gBAAe,SAAS,QAAQ;AAC9B,4BAA0B,KAAK,mBAAmB,IAAI,CAAC;GACvD;AACF,QAAO,QAAQ,IAAI,0BAA0B,CAAC,WAAW,KAAK"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InitializeSharingOptions } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/initializeSharing.d.ts
|
|
4
|
+
declare function initializeSharing({
|
|
5
|
+
shareScopeName,
|
|
6
|
+
webpackRequire,
|
|
7
|
+
initPromises,
|
|
8
|
+
initTokens,
|
|
9
|
+
initScope
|
|
10
|
+
}: InitializeSharingOptions): Promise<boolean> | boolean | void;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { initializeSharing };
|
|
13
|
+
//# sourceMappingURL=initializeSharing.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { attachShareScopeMap } from "./attachShareScopeMap.js";
|
|
2
|
+
import { FEDERATION_SUPPORTED_TYPES } from "./constant.js";
|
|
3
|
+
|
|
4
|
+
//#region src/initializeSharing.ts
|
|
5
|
+
function initializeSharing({ shareScopeName, webpackRequire, initPromises, initTokens, initScope }) {
|
|
6
|
+
const shareScopeKeys = Array.isArray(shareScopeName) ? shareScopeName : [shareScopeName];
|
|
7
|
+
var initializeSharingPromises = [];
|
|
8
|
+
var _initializeSharing = function(shareScopeKey) {
|
|
9
|
+
if (!initScope) initScope = [];
|
|
10
|
+
const mfInstance = webpackRequire.federation.instance;
|
|
11
|
+
var initToken = initTokens[shareScopeKey];
|
|
12
|
+
if (!initToken) initToken = initTokens[shareScopeKey] = { from: mfInstance.name };
|
|
13
|
+
if (initScope.indexOf(initToken) >= 0) return;
|
|
14
|
+
initScope.push(initToken);
|
|
15
|
+
const promise = initPromises[shareScopeKey];
|
|
16
|
+
if (promise) return promise;
|
|
17
|
+
var warn = (msg) => typeof console !== "undefined" && console.warn && console.warn(msg);
|
|
18
|
+
var initExternal = (id) => {
|
|
19
|
+
var handleError = (err) => warn("Initialization of sharing external failed: " + err);
|
|
20
|
+
try {
|
|
21
|
+
var module = webpackRequire(id);
|
|
22
|
+
if (!module) return;
|
|
23
|
+
var initFn = (module) => module && module.init && module.init(webpackRequire.S[shareScopeKey], initScope, {
|
|
24
|
+
shareScopeMap: webpackRequire.S || {},
|
|
25
|
+
shareScopeKeys: shareScopeName
|
|
26
|
+
});
|
|
27
|
+
if (module.then) return promises.push(module.then(initFn, handleError));
|
|
28
|
+
var initResult = initFn(module);
|
|
29
|
+
if (initResult && typeof initResult !== "boolean" && initResult.then) return promises.push(initResult["catch"](handleError));
|
|
30
|
+
} catch (err) {
|
|
31
|
+
handleError(err);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const promises = mfInstance.initializeSharing(shareScopeKey, {
|
|
35
|
+
strategy: mfInstance.options.shareStrategy,
|
|
36
|
+
initScope,
|
|
37
|
+
from: "build"
|
|
38
|
+
});
|
|
39
|
+
attachShareScopeMap(webpackRequire);
|
|
40
|
+
const bundlerRuntimeRemotesOptions = webpackRequire.federation.bundlerRuntimeOptions.remotes;
|
|
41
|
+
if (bundlerRuntimeRemotesOptions) Object.keys(bundlerRuntimeRemotesOptions.idToRemoteMap).forEach((moduleId) => {
|
|
42
|
+
const info = bundlerRuntimeRemotesOptions.idToRemoteMap[moduleId];
|
|
43
|
+
const externalModuleId = bundlerRuntimeRemotesOptions.idToExternalAndNameMapping[moduleId][2];
|
|
44
|
+
if (info.length > 1) initExternal(externalModuleId);
|
|
45
|
+
else if (info.length === 1) {
|
|
46
|
+
const remoteInfo = info[0];
|
|
47
|
+
if (!FEDERATION_SUPPORTED_TYPES.includes(remoteInfo.externalType)) initExternal(externalModuleId);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
if (!promises.length) return initPromises[shareScopeKey] = true;
|
|
51
|
+
return initPromises[shareScopeKey] = Promise.all(promises).then(() => initPromises[shareScopeKey] = true);
|
|
52
|
+
};
|
|
53
|
+
shareScopeKeys.forEach((key) => {
|
|
54
|
+
initializeSharingPromises.push(_initializeSharing(key));
|
|
55
|
+
});
|
|
56
|
+
return Promise.all(initializeSharingPromises).then(() => true);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { initializeSharing };
|
|
61
|
+
//# sourceMappingURL=initializeSharing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initializeSharing.js","names":[],"sources":["../src/initializeSharing.ts"],"sourcesContent":["import { FEDERATION_SUPPORTED_TYPES } from './constant';\nimport { attachShareScopeMap } from './attachShareScopeMap';\nimport { RemoteEntryExports, InitializeSharingOptions } from './types';\n\nexport function initializeSharing({\n shareScopeName,\n webpackRequire,\n initPromises,\n initTokens,\n initScope,\n}: InitializeSharingOptions): Promise<boolean> | boolean | void {\n const shareScopeKeys = Array.isArray(shareScopeName)\n ? shareScopeName\n : [shareScopeName];\n var initializeSharingPromises: Array<Promise<boolean> | boolean | void> = [];\n var _initializeSharing = function (shareScopeKey: string) {\n if (!initScope) initScope = [];\n const mfInstance = webpackRequire.federation.instance!;\n\n // handling circular init calls\n var initToken = initTokens[shareScopeKey];\n if (!initToken)\n initToken = initTokens[shareScopeKey] = { from: mfInstance.name };\n if (initScope.indexOf(initToken) >= 0) return;\n initScope.push(initToken);\n\n const promise = initPromises[shareScopeKey];\n if (promise) return promise;\n var warn = (msg: string) =>\n typeof console !== 'undefined' && console.warn && console.warn(msg);\n\n var initExternal = (id: string | number) => {\n var handleError = (err: any) =>\n warn('Initialization of sharing external failed: ' + err);\n try {\n var module = webpackRequire(id);\n if (!module) return;\n var initFn = (module: RemoteEntryExports) =>\n module &&\n module.init &&\n // @ts-ignore compat legacy mf shared behavior\n module.init(webpackRequire.S![shareScopeKey], initScope, {\n shareScopeMap: webpackRequire.S || {},\n shareScopeKeys: shareScopeName,\n });\n if (module.then) return promises.push(module.then(initFn, handleError));\n var initResult = initFn(module);\n // @ts-ignore\n if (initResult && typeof initResult !== 'boolean' && initResult.then)\n // @ts-ignore\n return promises.push(initResult['catch'](handleError));\n } catch (err) {\n handleError(err);\n }\n };\n const promises = mfInstance.initializeSharing(shareScopeKey, {\n strategy: mfInstance.options.shareStrategy,\n initScope,\n from: 'build',\n });\n attachShareScopeMap(webpackRequire);\n\n const bundlerRuntimeRemotesOptions =\n webpackRequire.federation.bundlerRuntimeOptions.remotes;\n if (bundlerRuntimeRemotesOptions) {\n Object.keys(bundlerRuntimeRemotesOptions.idToRemoteMap).forEach(\n (moduleId) => {\n const info = bundlerRuntimeRemotesOptions.idToRemoteMap[moduleId];\n const externalModuleId =\n bundlerRuntimeRemotesOptions.idToExternalAndNameMapping[\n moduleId\n ][2];\n if (info.length > 1) {\n initExternal(externalModuleId);\n } else if (info.length === 1) {\n const remoteInfo = info[0];\n if (!FEDERATION_SUPPORTED_TYPES.includes(remoteInfo.externalType)) {\n initExternal(externalModuleId);\n }\n }\n },\n );\n }\n\n if (!promises.length) {\n return (initPromises[shareScopeKey] = true);\n }\n\n return (initPromises[shareScopeKey] = Promise.all(promises).then(\n () => (initPromises[shareScopeKey] = true),\n ));\n };\n\n shareScopeKeys.forEach((key) => {\n initializeSharingPromises.push(_initializeSharing(key));\n });\n return Promise.all(initializeSharingPromises).then(() => true);\n}\n"],"mappings":";;;;AAIA,SAAgB,kBAAkB,EAChC,gBACA,gBACA,cACA,YACA,aAC8D;CAC9D,MAAM,iBAAiB,MAAM,QAAQ,eAAe,GAChD,iBACA,CAAC,eAAe;CACpB,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EAChB,cAAa,iBAAiB;YACrB,KAAK,WAAW,GAAG;IAC5B,MAAM,aAAa,KAAK;AACxB,QAAI,CAAC,2BAA2B,SAAS,WAAW,aAAa,CAC/D,cAAa,iBAAiB;;IAIrC;AAGH,MAAI,CAAC,SAAS,OACZ,QAAQ,aAAa,iBAAiB;AAGxC,SAAQ,aAAa,iBAAiB,QAAQ,IAAI,SAAS,CAAC,WACnD,aAAa,iBAAiB,KACtC;;AAGH,gBAAe,SAAS,QAAQ;AAC9B,4BAA0B,KAAK,mBAAmB,IAAI,CAAC;GACvD;AACF,QAAO,QAAQ,IAAI,0BAA0B,CAAC,WAAW,KAAK"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const require_updateOptions = require('./updateOptions.cjs');
|
|
2
|
+
const require_getUsedExports = require('./getUsedExports.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/installInitialConsumes.ts
|
|
5
|
+
function handleInitialConsumes(options) {
|
|
6
|
+
const { moduleId, moduleToHandlerMapping, webpackRequire, asyncLoad } = options;
|
|
7
|
+
const federationInstance = webpackRequire.federation.instance;
|
|
8
|
+
if (!federationInstance) throw new Error("Federation instance not found!");
|
|
9
|
+
const { shareKey, shareInfo } = moduleToHandlerMapping[moduleId];
|
|
10
|
+
try {
|
|
11
|
+
const usedExports = require_getUsedExports.getUsedExports(webpackRequire, shareKey);
|
|
12
|
+
const customShareInfo = { ...shareInfo };
|
|
13
|
+
if (usedExports) customShareInfo.treeShaking = {
|
|
14
|
+
usedExports,
|
|
15
|
+
useIn: [federationInstance.options.name]
|
|
16
|
+
};
|
|
17
|
+
if (asyncLoad) return federationInstance.loadShare(shareKey, { customShareInfo });
|
|
18
|
+
return federationInstance.loadShareSync(shareKey, { customShareInfo });
|
|
19
|
+
} catch (err) {
|
|
20
|
+
console.error("loadShareSync failed! The function should not be called unless you set \"eager:true\". If you do not set it, and encounter this issue, you can check whether an async boundary is implemented.");
|
|
21
|
+
console.error("The original error message is as follows: ");
|
|
22
|
+
throw err;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function installInitialConsumes(options) {
|
|
26
|
+
require_updateOptions.updateConsumeOptions(options);
|
|
27
|
+
const { moduleToHandlerMapping, webpackRequire, installedModules, initialConsumes, asyncLoad } = options;
|
|
28
|
+
const factoryIdSets = [];
|
|
29
|
+
initialConsumes.forEach((id) => {
|
|
30
|
+
const factoryGetter = () => handleInitialConsumes({
|
|
31
|
+
moduleId: id,
|
|
32
|
+
moduleToHandlerMapping,
|
|
33
|
+
webpackRequire,
|
|
34
|
+
asyncLoad
|
|
35
|
+
});
|
|
36
|
+
factoryIdSets.push([id, factoryGetter]);
|
|
37
|
+
});
|
|
38
|
+
const setModule = (id, factoryGetter) => {
|
|
39
|
+
webpackRequire.m[id] = (module) => {
|
|
40
|
+
installedModules[id] = 0;
|
|
41
|
+
delete webpackRequire.c[id];
|
|
42
|
+
const factory = factoryGetter();
|
|
43
|
+
if (typeof factory !== "function") throw new Error(`Shared module is not available for eager consumption: ${id}`);
|
|
44
|
+
const result = factory();
|
|
45
|
+
const { shareInfo } = moduleToHandlerMapping[id];
|
|
46
|
+
if (shareInfo?.shareConfig?.layer && result && typeof result === "object") try {
|
|
47
|
+
if (!result.hasOwnProperty("layer") || result.layer === void 0) result.layer = shareInfo.shareConfig.layer;
|
|
48
|
+
} catch (e) {}
|
|
49
|
+
module.exports = result;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
if (asyncLoad) return Promise.all(factoryIdSets.map(async ([id, factoryGetter]) => {
|
|
53
|
+
const result = await factoryGetter();
|
|
54
|
+
setModule(id, () => result);
|
|
55
|
+
}));
|
|
56
|
+
factoryIdSets.forEach(([id, factoryGetter]) => {
|
|
57
|
+
setModule(id, factoryGetter);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
exports.installInitialConsumes = installInitialConsumes;
|
|
63
|
+
//# sourceMappingURL=installInitialConsumes.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installInitialConsumes.cjs","names":["getUsedExports"],"sources":["../src/installInitialConsumes.ts"],"sourcesContent":["import { getUsedExports } from './getUsedExports';\nimport {\n HandleInitialConsumesOptions,\n InstallInitialConsumesOptions,\n} from './types';\nimport type { Shared } from '@module-federation/runtime/types';\nimport { updateConsumeOptions } from './updateOptions';\n\nfunction handleInitialConsumes(options: HandleInitialConsumesOptions) {\n const { moduleId, moduleToHandlerMapping, webpackRequire, asyncLoad } =\n options;\n\n const federationInstance = webpackRequire.federation.instance;\n if (!federationInstance) {\n throw new Error('Federation instance not found!');\n }\n const { shareKey, shareInfo } = moduleToHandlerMapping[moduleId];\n\n try {\n const usedExports = getUsedExports(webpackRequire, shareKey);\n\n const customShareInfo: Partial<Shared> = { ...shareInfo };\n if (usedExports) {\n customShareInfo.treeShaking = {\n usedExports,\n useIn: [federationInstance.options.name],\n };\n }\n if (asyncLoad) {\n return federationInstance.loadShare(shareKey, {\n customShareInfo,\n });\n }\n return federationInstance.loadShareSync(shareKey, {\n customShareInfo,\n });\n } catch (err) {\n console.error(\n 'loadShareSync failed! The function should not be called unless you set \"eager:true\". If you do not set it, and encounter this issue, you can check whether an async boundary is implemented.',\n );\n console.error('The original error message is as follows: ');\n throw err;\n }\n}\n\nexport function installInitialConsumes(options: InstallInitialConsumesOptions) {\n updateConsumeOptions(options);\n\n const {\n moduleToHandlerMapping,\n webpackRequire,\n installedModules,\n initialConsumes,\n asyncLoad,\n } = options;\n\n const factoryIdSets: Array<\n [string | number, () => Promise<false | (() => unknown)> | (() => unknown)]\n > = [];\n initialConsumes.forEach((id) => {\n const factoryGetter = () =>\n handleInitialConsumes({\n moduleId: id,\n moduleToHandlerMapping,\n webpackRequire,\n asyncLoad,\n }) as Promise<false | (() => unknown)>;\n factoryIdSets.push([id, factoryGetter]);\n });\n\n const setModule = (\n id: string | number,\n factoryGetter: () => () => unknown,\n ) => {\n webpackRequire.m[id] = (module) => {\n // Handle scenario when module is used synchronously\n installedModules[id] = 0;\n delete webpackRequire.c[id];\n\n const factory = factoryGetter();\n if (typeof factory !== 'function') {\n throw new Error(\n `Shared module is not available for eager consumption: ${id}`,\n );\n }\n const result = factory();\n // Add layer property from shareConfig if available\n const { shareInfo } = moduleToHandlerMapping[id];\n if (\n shareInfo?.shareConfig?.layer &&\n result &&\n typeof result === 'object'\n ) {\n try {\n // Only set layer if it's not already defined or if it's undefined\n if (\n !result.hasOwnProperty('layer') ||\n (result as any).layer === undefined\n ) {\n (result as any).layer = shareInfo.shareConfig.layer;\n }\n } catch (e) {\n // Ignore if layer property is read-only\n }\n }\n module.exports = result;\n };\n };\n\n if (asyncLoad) {\n return Promise.all(\n factoryIdSets.map(async ([id, factoryGetter]) => {\n const result = await factoryGetter();\n setModule(id, () => result as () => unknown);\n }),\n );\n }\n factoryIdSets.forEach(([id, factoryGetter]) => {\n setModule(id, factoryGetter as () => () => unknown);\n });\n}\n"],"mappings":";;;;AAQA,SAAS,sBAAsB,SAAuC;CACpE,MAAM,EAAE,UAAU,wBAAwB,gBAAgB,cACxD;CAEF,MAAM,qBAAqB,eAAe,WAAW;AACrD,KAAI,CAAC,mBACH,OAAM,IAAI,MAAM,iCAAiC;CAEnD,MAAM,EAAE,UAAU,cAAc,uBAAuB;AAEvD,KAAI;EACF,MAAM,cAAcA,sCAAe,gBAAgB,SAAS;EAE5D,MAAM,kBAAmC,EAAE,GAAG,WAAW;AACzD,MAAI,YACF,iBAAgB,cAAc;GAC5B;GACA,OAAO,CAAC,mBAAmB,QAAQ,KAAK;GACzC;AAEH,MAAI,UACF,QAAO,mBAAmB,UAAU,UAAU,EAC5C,iBACD,CAAC;AAEJ,SAAO,mBAAmB,cAAc,UAAU,EAChD,iBACD,CAAC;UACK,KAAK;AACZ,UAAQ,MACN,iMACD;AACD,UAAQ,MAAM,6CAA6C;AAC3D,QAAM;;;AAIV,SAAgB,uBAAuB,SAAwC;AAC7E,4CAAqB,QAAQ;CAE7B,MAAM,EACJ,wBACA,gBACA,kBACA,iBACA,cACE;CAEJ,MAAM,gBAEF,EAAE;AACN,iBAAgB,SAAS,OAAO;EAC9B,MAAM,sBACJ,sBAAsB;GACpB,UAAU;GACV;GACA;GACA;GACD,CAAC;AACJ,gBAAc,KAAK,CAAC,IAAI,cAAc,CAAC;GACvC;CAEF,MAAM,aACJ,IACA,kBACG;AACH,iBAAe,EAAE,OAAO,WAAW;AAEjC,oBAAiB,MAAM;AACvB,UAAO,eAAe,EAAE;GAExB,MAAM,UAAU,eAAe;AAC/B,OAAI,OAAO,YAAY,WACrB,OAAM,IAAI,MACR,yDAAyD,KAC1D;GAEH,MAAM,SAAS,SAAS;GAExB,MAAM,EAAE,cAAc,uBAAuB;AAC7C,OACE,WAAW,aAAa,SACxB,UACA,OAAO,WAAW,SAElB,KAAI;AAEF,QACE,CAAC,OAAO,eAAe,QAAQ,IAC9B,OAAe,UAAU,OAE1B,CAAC,OAAe,QAAQ,UAAU,YAAY;YAEzC,GAAG;AAId,UAAO,UAAU;;;AAIrB,KAAI,UACF,QAAO,QAAQ,IACb,cAAc,IAAI,OAAO,CAAC,IAAI,mBAAmB;EAC/C,MAAM,SAAS,MAAM,eAAe;AACpC,YAAU,UAAU,OAAwB;GAC5C,CACH;AAEH,eAAc,SAAS,CAAC,IAAI,mBAAmB;AAC7C,YAAU,IAAI,cAAqC;GACnD"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { updateConsumeOptions } from "./updateOptions.js";
|
|
2
|
+
import { getUsedExports } from "./getUsedExports.js";
|
|
3
|
+
|
|
4
|
+
//#region src/installInitialConsumes.ts
|
|
5
|
+
function handleInitialConsumes(options) {
|
|
6
|
+
const { moduleId, moduleToHandlerMapping, webpackRequire, asyncLoad } = options;
|
|
7
|
+
const federationInstance = webpackRequire.federation.instance;
|
|
8
|
+
if (!federationInstance) throw new Error("Federation instance not found!");
|
|
9
|
+
const { shareKey, shareInfo } = moduleToHandlerMapping[moduleId];
|
|
10
|
+
try {
|
|
11
|
+
const usedExports = getUsedExports(webpackRequire, shareKey);
|
|
12
|
+
const customShareInfo = { ...shareInfo };
|
|
13
|
+
if (usedExports) customShareInfo.treeShaking = {
|
|
14
|
+
usedExports,
|
|
15
|
+
useIn: [federationInstance.options.name]
|
|
16
|
+
};
|
|
17
|
+
if (asyncLoad) return federationInstance.loadShare(shareKey, { customShareInfo });
|
|
18
|
+
return federationInstance.loadShareSync(shareKey, { customShareInfo });
|
|
19
|
+
} catch (err) {
|
|
20
|
+
console.error("loadShareSync failed! The function should not be called unless you set \"eager:true\". If you do not set it, and encounter this issue, you can check whether an async boundary is implemented.");
|
|
21
|
+
console.error("The original error message is as follows: ");
|
|
22
|
+
throw err;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function installInitialConsumes(options) {
|
|
26
|
+
updateConsumeOptions(options);
|
|
27
|
+
const { moduleToHandlerMapping, webpackRequire, installedModules, initialConsumes, asyncLoad } = options;
|
|
28
|
+
const factoryIdSets = [];
|
|
29
|
+
initialConsumes.forEach((id) => {
|
|
30
|
+
const factoryGetter = () => handleInitialConsumes({
|
|
31
|
+
moduleId: id,
|
|
32
|
+
moduleToHandlerMapping,
|
|
33
|
+
webpackRequire,
|
|
34
|
+
asyncLoad
|
|
35
|
+
});
|
|
36
|
+
factoryIdSets.push([id, factoryGetter]);
|
|
37
|
+
});
|
|
38
|
+
const setModule = (id, factoryGetter) => {
|
|
39
|
+
webpackRequire.m[id] = (module) => {
|
|
40
|
+
installedModules[id] = 0;
|
|
41
|
+
delete webpackRequire.c[id];
|
|
42
|
+
const factory = factoryGetter();
|
|
43
|
+
if (typeof factory !== "function") throw new Error(`Shared module is not available for eager consumption: ${id}`);
|
|
44
|
+
const result = factory();
|
|
45
|
+
const { shareInfo } = moduleToHandlerMapping[id];
|
|
46
|
+
if (shareInfo?.shareConfig?.layer && result && typeof result === "object") try {
|
|
47
|
+
if (!result.hasOwnProperty("layer") || result.layer === void 0) result.layer = shareInfo.shareConfig.layer;
|
|
48
|
+
} catch (e) {}
|
|
49
|
+
module.exports = result;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
if (asyncLoad) return Promise.all(factoryIdSets.map(async ([id, factoryGetter]) => {
|
|
53
|
+
const result = await factoryGetter();
|
|
54
|
+
setModule(id, () => result);
|
|
55
|
+
}));
|
|
56
|
+
factoryIdSets.forEach(([id, factoryGetter]) => {
|
|
57
|
+
setModule(id, factoryGetter);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
export { installInitialConsumes };
|
|
63
|
+
//# sourceMappingURL=installInitialConsumes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installInitialConsumes.js","names":[],"sources":["../src/installInitialConsumes.ts"],"sourcesContent":["import { getUsedExports } from './getUsedExports';\nimport {\n HandleInitialConsumesOptions,\n InstallInitialConsumesOptions,\n} from './types';\nimport type { Shared } from '@module-federation/runtime/types';\nimport { updateConsumeOptions } from './updateOptions';\n\nfunction handleInitialConsumes(options: HandleInitialConsumesOptions) {\n const { moduleId, moduleToHandlerMapping, webpackRequire, asyncLoad } =\n options;\n\n const federationInstance = webpackRequire.federation.instance;\n if (!federationInstance) {\n throw new Error('Federation instance not found!');\n }\n const { shareKey, shareInfo } = moduleToHandlerMapping[moduleId];\n\n try {\n const usedExports = getUsedExports(webpackRequire, shareKey);\n\n const customShareInfo: Partial<Shared> = { ...shareInfo };\n if (usedExports) {\n customShareInfo.treeShaking = {\n usedExports,\n useIn: [federationInstance.options.name],\n };\n }\n if (asyncLoad) {\n return federationInstance.loadShare(shareKey, {\n customShareInfo,\n });\n }\n return federationInstance.loadShareSync(shareKey, {\n customShareInfo,\n });\n } catch (err) {\n console.error(\n 'loadShareSync failed! The function should not be called unless you set \"eager:true\". If you do not set it, and encounter this issue, you can check whether an async boundary is implemented.',\n );\n console.error('The original error message is as follows: ');\n throw err;\n }\n}\n\nexport function installInitialConsumes(options: InstallInitialConsumesOptions) {\n updateConsumeOptions(options);\n\n const {\n moduleToHandlerMapping,\n webpackRequire,\n installedModules,\n initialConsumes,\n asyncLoad,\n } = options;\n\n const factoryIdSets: Array<\n [string | number, () => Promise<false | (() => unknown)> | (() => unknown)]\n > = [];\n initialConsumes.forEach((id) => {\n const factoryGetter = () =>\n handleInitialConsumes({\n moduleId: id,\n moduleToHandlerMapping,\n webpackRequire,\n asyncLoad,\n }) as Promise<false | (() => unknown)>;\n factoryIdSets.push([id, factoryGetter]);\n });\n\n const setModule = (\n id: string | number,\n factoryGetter: () => () => unknown,\n ) => {\n webpackRequire.m[id] = (module) => {\n // Handle scenario when module is used synchronously\n installedModules[id] = 0;\n delete webpackRequire.c[id];\n\n const factory = factoryGetter();\n if (typeof factory !== 'function') {\n throw new Error(\n `Shared module is not available for eager consumption: ${id}`,\n );\n }\n const result = factory();\n // Add layer property from shareConfig if available\n const { shareInfo } = moduleToHandlerMapping[id];\n if (\n shareInfo?.shareConfig?.layer &&\n result &&\n typeof result === 'object'\n ) {\n try {\n // Only set layer if it's not already defined or if it's undefined\n if (\n !result.hasOwnProperty('layer') ||\n (result as any).layer === undefined\n ) {\n (result as any).layer = shareInfo.shareConfig.layer;\n }\n } catch (e) {\n // Ignore if layer property is read-only\n }\n }\n module.exports = result;\n };\n };\n\n if (asyncLoad) {\n return Promise.all(\n factoryIdSets.map(async ([id, factoryGetter]) => {\n const result = await factoryGetter();\n setModule(id, () => result as () => unknown);\n }),\n );\n }\n factoryIdSets.forEach(([id, factoryGetter]) => {\n setModule(id, factoryGetter as () => () => unknown);\n });\n}\n"],"mappings":";;;;AAQA,SAAS,sBAAsB,SAAuC;CACpE,MAAM,EAAE,UAAU,wBAAwB,gBAAgB,cACxD;CAEF,MAAM,qBAAqB,eAAe,WAAW;AACrD,KAAI,CAAC,mBACH,OAAM,IAAI,MAAM,iCAAiC;CAEnD,MAAM,EAAE,UAAU,cAAc,uBAAuB;AAEvD,KAAI;EACF,MAAM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YAAU,IAAI,cAAqC;GACnD"}
|
package/dist/remotes.cjs
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_attachShareScopeMap = require('./attachShareScopeMap.cjs');
|
|
3
|
+
const require_constant = require('./constant.cjs');
|
|
4
|
+
const require_updateOptions = require('./updateOptions.cjs');
|
|
5
|
+
let _module_federation_sdk = require("@module-federation/sdk");
|
|
6
|
+
|
|
7
|
+
//#region src/remotes.ts
|
|
8
|
+
function remotes(options) {
|
|
9
|
+
require_updateOptions.updateRemoteOptions(options);
|
|
10
|
+
const { chunkId, promises, webpackRequire, chunkMapping, idToExternalAndNameMapping, idToRemoteMap } = options;
|
|
11
|
+
require_attachShareScopeMap.attachShareScopeMap(webpackRequire);
|
|
12
|
+
if (webpackRequire.o(chunkMapping, chunkId)) chunkMapping[chunkId].forEach((id) => {
|
|
13
|
+
let getScope = webpackRequire.R;
|
|
14
|
+
if (!getScope) getScope = [];
|
|
15
|
+
const data = idToExternalAndNameMapping[id];
|
|
16
|
+
const remoteInfos = idToRemoteMap[id] || [];
|
|
17
|
+
if (getScope.indexOf(data) >= 0) return;
|
|
18
|
+
getScope.push(data);
|
|
19
|
+
if (data.p) return promises.push(data.p);
|
|
20
|
+
const onError = (error) => {
|
|
21
|
+
if (!error) error = /* @__PURE__ */ new Error("Container missing");
|
|
22
|
+
if (typeof error.message === "string") error.message += `\nwhile loading "${data[1]}" from ${data[2]}`;
|
|
23
|
+
webpackRequire.m[id] = () => {
|
|
24
|
+
throw error;
|
|
25
|
+
};
|
|
26
|
+
data.p = 0;
|
|
27
|
+
};
|
|
28
|
+
const handleFunction = (fn, arg1, arg2, d, next, first) => {
|
|
29
|
+
try {
|
|
30
|
+
const promise = fn(arg1, arg2);
|
|
31
|
+
if (promise && promise.then) {
|
|
32
|
+
const p = promise.then((result) => next(result, d), onError);
|
|
33
|
+
if (first) promises.push(data.p = p);
|
|
34
|
+
else return p;
|
|
35
|
+
} else return next(promise, d, first);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
onError(error);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const onExternal = (external, _, first) => external ? handleFunction(webpackRequire.I, data[0], 0, external, onInitialized, first) : onError();
|
|
41
|
+
var onInitialized = (_, external, first) => handleFunction(external.get, data[1], getScope, 0, onFactory, first);
|
|
42
|
+
var onFactory = (factory) => {
|
|
43
|
+
data.p = 1;
|
|
44
|
+
webpackRequire.m[id] = (module) => {
|
|
45
|
+
module.exports = factory();
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
const onRemoteLoaded = () => {
|
|
49
|
+
try {
|
|
50
|
+
const remoteModuleName = (0, _module_federation_sdk.decodeName)(remoteInfos[0].name, _module_federation_sdk.ENCODE_NAME_PREFIX) + data[1].slice(1);
|
|
51
|
+
const instance = webpackRequire.federation.instance;
|
|
52
|
+
const loadRemote = () => webpackRequire.federation.instance.loadRemote(remoteModuleName, {
|
|
53
|
+
loadFactory: false,
|
|
54
|
+
from: "build"
|
|
55
|
+
});
|
|
56
|
+
if (instance.options.shareStrategy === "version-first") {
|
|
57
|
+
const shareScopes = Array.isArray(data[0]) ? data[0] : [data[0]];
|
|
58
|
+
return Promise.all(shareScopes.map((shareScope) => instance.sharedHandler.initializeSharing(shareScope))).then(() => {
|
|
59
|
+
return loadRemote();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return loadRemote();
|
|
63
|
+
} catch (error) {
|
|
64
|
+
onError(error);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
if (remoteInfos.length === 1 && require_constant.FEDERATION_SUPPORTED_TYPES.includes(remoteInfos[0].externalType) && remoteInfos[0].name) handleFunction(onRemoteLoaded, data[2], 0, 0, onFactory, 1);
|
|
68
|
+
else handleFunction(webpackRequire, data[2], 0, 0, onExternal, 1);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
exports.remotes = remotes;
|
|
74
|
+
//# sourceMappingURL=remotes.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remotes.cjs","names":["ENCODE_NAME_PREFIX","FEDERATION_SUPPORTED_TYPES"],"sources":["../src/remotes.ts"],"sourcesContent":["import { attachShareScopeMap } from './attachShareScopeMap';\nimport type { RemoteEntryExports } from './types';\nimport { RemotesOptions } from './types';\nimport { FEDERATION_SUPPORTED_TYPES } from './constant';\nimport { decodeName, ENCODE_NAME_PREFIX } from '@module-federation/sdk';\nimport { updateRemoteOptions } from './updateOptions';\n\nexport function remotes(options: RemotesOptions) {\n updateRemoteOptions(options);\n\n const {\n chunkId,\n promises,\n webpackRequire,\n chunkMapping,\n idToExternalAndNameMapping,\n idToRemoteMap,\n } = options;\n attachShareScopeMap(webpackRequire);\n\n if (webpackRequire.o(chunkMapping, chunkId)) {\n chunkMapping[chunkId].forEach((id) => {\n let getScope = webpackRequire.R;\n if (!getScope) {\n getScope = [];\n }\n const data = idToExternalAndNameMapping[id];\n const remoteInfos = idToRemoteMap[id] || [];\n // @ts-ignore seems not work\n if (getScope.indexOf(data) >= 0) {\n return;\n }\n // @ts-ignore seems not work\n getScope.push(data);\n if (data.p) {\n return promises.push(data.p as Promise<any>);\n }\n const onError = (error?: Error) => {\n if (!error) {\n error = new Error('Container missing');\n }\n if (typeof error.message === 'string') {\n error.message += `\\nwhile loading \"${data[1]}\" from ${data[2]}`;\n }\n webpackRequire.m[id] = () => {\n throw error;\n };\n data.p = 0;\n };\n const handleFunction = (\n fn: (...args: any[]) => any,\n arg1: any,\n arg2: any,\n d: any,\n next: (...args: any[]) => any,\n first: 1 | 0,\n ) => {\n try {\n const promise = fn(arg1, arg2);\n if (promise && promise.then) {\n const p = promise.then((result: any) => next(result, d), onError);\n if (first) {\n promises.push((data.p = p));\n } else {\n return p;\n }\n } else {\n return next(promise, d, first);\n }\n } catch (error) {\n onError(error as Error);\n }\n };\n const onExternal = (\n external: (...args: any[]) => any,\n _: any,\n first: 1 | 0,\n ) =>\n external\n ? handleFunction(\n webpackRequire.I,\n data[0],\n 0,\n external,\n onInitialized,\n first,\n )\n : onError();\n\n // eslint-disable-next-line no-var\n var onInitialized = (\n _: any,\n external: RemoteEntryExports,\n first: 1 | 0,\n ) => handleFunction(external.get, data[1], getScope, 0, onFactory, first);\n // eslint-disable-next-line no-var\n var onFactory = (factory: () => any) => {\n data.p = 1;\n webpackRequire.m[id] = (module) => {\n module.exports = factory();\n };\n };\n const onRemoteLoaded = () => {\n try {\n const remoteName = decodeName(\n remoteInfos[0].name,\n ENCODE_NAME_PREFIX,\n );\n\n const remoteModuleName = remoteName + data[1].slice(1);\n const instance = webpackRequire.federation.instance!;\n const loadRemote = () =>\n webpackRequire.federation.instance!.loadRemote(remoteModuleName, {\n loadFactory: false,\n from: 'build',\n });\n\n if (instance.options.shareStrategy === 'version-first') {\n const shareScopes = Array.isArray(data[0]) ? data[0] : [data[0]];\n\n return Promise.all(\n shareScopes.map((shareScope) =>\n instance.sharedHandler.initializeSharing(shareScope),\n ),\n ).then(() => {\n return loadRemote();\n });\n }\n\n return loadRemote();\n } catch (error) {\n onError(error as Error);\n }\n };\n\n const useRuntimeLoad =\n remoteInfos.length === 1 &&\n FEDERATION_SUPPORTED_TYPES.includes(remoteInfos[0].externalType) &&\n remoteInfos[0].name;\n\n if (useRuntimeLoad) {\n handleFunction(onRemoteLoaded, data[2], 0, 0, onFactory, 1);\n } else {\n handleFunction(webpackRequire, data[2], 0, 0, onExternal, 1);\n }\n });\n }\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,QAAQ,SAAyB;AAC/C,2CAAoB,QAAQ;CAE5B,MAAM,EACJ,SACA,UACA,gBACA,cACA,4BACA,kBACE;AACJ,iDAAoB,eAAe;AAEnC,KAAI,eAAe,EAAE,cAAc,QAAQ,CACzC,cAAa,SAAS,SAAS,OAAO;EACpC,IAAI,WAAW,eAAe;AAC9B,MAAI,CAAC,SACH,YAA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