@module-federation/webpack-bundler-runtime 2.3.3 → 2.5.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/error-codes/dist/error-codes.cjs.map +1 -1
- package/dist/error-codes/dist/error-codes.js.map +1 -1
- package/dist/initContainerEntry.cjs +0 -1
- package/dist/initContainerEntry.cjs.map +1 -1
- package/dist/initContainerEntry.js +0 -1
- package/dist/initContainerEntry.js.map +1 -1
- package/dist/runtime-core/dist/core.d.ts +62 -6
- package/dist/runtime-core/dist/module/index.d.ts +5 -4
- package/dist/runtime-core/dist/plugins/snapshot/SnapshotHandler.d.ts +5 -2
- package/dist/runtime-core/dist/remote/index.d.ts +30 -4
- package/dist/runtime-core/dist/shared/index.d.ts +22 -0
- package/dist/runtime-core/dist/type/preload.d.ts +25 -2
- package/dist/runtime-core/dist/types.d.ts +1 -1
- package/dist/runtime-core/dist/utils/hooks/asyncWaterfallHooks.d.ts +2 -2
- package/dist/runtime-core/dist/utils/hooks/syncWaterfallHook.d.ts +1 -1
- package/dist/runtime-core/dist/utils/load.d.ts +2 -0
- package/dist/types.d.ts +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-codes.cjs","names":[],"sources":["../../../../error-codes/dist/error-codes.mjs"],"sourcesContent":["//#region src/error-codes.ts\nconst RUNTIME_001 = \"RUNTIME-001\";\nconst RUNTIME_002 = \"RUNTIME-002\";\nconst RUNTIME_003 = \"RUNTIME-003\";\nconst RUNTIME_004 = \"RUNTIME-004\";\nconst RUNTIME_005 = \"RUNTIME-005\";\nconst RUNTIME_006 = \"RUNTIME-006\";\nconst RUNTIME_007 = \"RUNTIME-007\";\nconst RUNTIME_008 = \"RUNTIME-008\";\nconst RUNTIME_009 = \"RUNTIME-009\";\nconst RUNTIME_010 = \"RUNTIME-010\";\nconst RUNTIME_011 = \"RUNTIME-011\";\nconst RUNTIME_012 = \"RUNTIME-012\";\nconst TYPE_001 = \"TYPE-001\";\nconst BUILD_001 = \"BUILD-001\";\nconst BUILD_002 = \"BUILD-002\";\n\n//#endregion\nexport { BUILD_001, BUILD_002, RUNTIME_001, RUNTIME_002, RUNTIME_003, RUNTIME_004, RUNTIME_005, RUNTIME_006, RUNTIME_007, RUNTIME_008, RUNTIME_009, RUNTIME_010, RUNTIME_011, RUNTIME_012, TYPE_001 };\n//# sourceMappingURL=error-codes.mjs.map"],"mappings":";;AAYA,MAAM,cAAc"}
|
|
1
|
+
{"version":3,"file":"error-codes.cjs","names":[],"sources":["../../../../error-codes/dist/error-codes.mjs"],"sourcesContent":["//#region src/error-codes.ts\nconst RUNTIME_001 = \"RUNTIME-001\";\nconst RUNTIME_002 = \"RUNTIME-002\";\nconst RUNTIME_003 = \"RUNTIME-003\";\nconst RUNTIME_004 = \"RUNTIME-004\";\nconst RUNTIME_005 = \"RUNTIME-005\";\nconst RUNTIME_006 = \"RUNTIME-006\";\nconst RUNTIME_007 = \"RUNTIME-007\";\nconst RUNTIME_008 = \"RUNTIME-008\";\nconst RUNTIME_009 = \"RUNTIME-009\";\nconst RUNTIME_010 = \"RUNTIME-010\";\nconst RUNTIME_011 = \"RUNTIME-011\";\nconst RUNTIME_012 = \"RUNTIME-012\";\nconst RUNTIME_013 = \"RUNTIME-013\";\nconst RUNTIME_014 = \"RUNTIME-014\";\nconst RUNTIME_015 = \"RUNTIME-015\";\nconst TYPE_001 = \"TYPE-001\";\nconst BUILD_001 = \"BUILD-001\";\nconst BUILD_002 = \"BUILD-002\";\n\n//#endregion\nexport { BUILD_001, BUILD_002, RUNTIME_001, RUNTIME_002, RUNTIME_003, RUNTIME_004, RUNTIME_005, RUNTIME_006, RUNTIME_007, RUNTIME_008, RUNTIME_009, RUNTIME_010, RUNTIME_011, RUNTIME_012, RUNTIME_013, RUNTIME_014, RUNTIME_015, TYPE_001 };\n//# sourceMappingURL=error-codes.mjs.map"],"mappings":";;AAYA,MAAM,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-codes.js","names":[],"sources":["../../../../error-codes/dist/error-codes.mjs"],"sourcesContent":["//#region src/error-codes.ts\nconst RUNTIME_001 = \"RUNTIME-001\";\nconst RUNTIME_002 = \"RUNTIME-002\";\nconst RUNTIME_003 = \"RUNTIME-003\";\nconst RUNTIME_004 = \"RUNTIME-004\";\nconst RUNTIME_005 = \"RUNTIME-005\";\nconst RUNTIME_006 = \"RUNTIME-006\";\nconst RUNTIME_007 = \"RUNTIME-007\";\nconst RUNTIME_008 = \"RUNTIME-008\";\nconst RUNTIME_009 = \"RUNTIME-009\";\nconst RUNTIME_010 = \"RUNTIME-010\";\nconst RUNTIME_011 = \"RUNTIME-011\";\nconst RUNTIME_012 = \"RUNTIME-012\";\nconst TYPE_001 = \"TYPE-001\";\nconst BUILD_001 = \"BUILD-001\";\nconst BUILD_002 = \"BUILD-002\";\n\n//#endregion\nexport { BUILD_001, BUILD_002, RUNTIME_001, RUNTIME_002, RUNTIME_003, RUNTIME_004, RUNTIME_005, RUNTIME_006, RUNTIME_007, RUNTIME_008, RUNTIME_009, RUNTIME_010, RUNTIME_011, RUNTIME_012, TYPE_001 };\n//# sourceMappingURL=error-codes.mjs.map"],"mappings":";AAYA,MAAM,cAAc"}
|
|
1
|
+
{"version":3,"file":"error-codes.js","names":[],"sources":["../../../../error-codes/dist/error-codes.mjs"],"sourcesContent":["//#region src/error-codes.ts\nconst RUNTIME_001 = \"RUNTIME-001\";\nconst RUNTIME_002 = \"RUNTIME-002\";\nconst RUNTIME_003 = \"RUNTIME-003\";\nconst RUNTIME_004 = \"RUNTIME-004\";\nconst RUNTIME_005 = \"RUNTIME-005\";\nconst RUNTIME_006 = \"RUNTIME-006\";\nconst RUNTIME_007 = \"RUNTIME-007\";\nconst RUNTIME_008 = \"RUNTIME-008\";\nconst RUNTIME_009 = \"RUNTIME-009\";\nconst RUNTIME_010 = \"RUNTIME-010\";\nconst RUNTIME_011 = \"RUNTIME-011\";\nconst RUNTIME_012 = \"RUNTIME-012\";\nconst RUNTIME_013 = \"RUNTIME-013\";\nconst RUNTIME_014 = \"RUNTIME-014\";\nconst RUNTIME_015 = \"RUNTIME-015\";\nconst TYPE_001 = \"TYPE-001\";\nconst BUILD_001 = \"BUILD-001\";\nconst BUILD_002 = \"BUILD-002\";\n\n//#endregion\nexport { BUILD_001, BUILD_002, RUNTIME_001, RUNTIME_002, RUNTIME_003, RUNTIME_004, RUNTIME_005, RUNTIME_006, RUNTIME_007, RUNTIME_008, RUNTIME_009, RUNTIME_010, RUNTIME_011, RUNTIME_012, RUNTIME_013, RUNTIME_014, RUNTIME_015, TYPE_001 };\n//# sourceMappingURL=error-codes.mjs.map"],"mappings":";AAYA,MAAM,cAAc"}
|
|
@@ -30,7 +30,6 @@ function initContainerEntry(options) {
|
|
|
30
30
|
federationInstance.initShareScopeMap(key, sc, { hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {} });
|
|
31
31
|
});
|
|
32
32
|
if (webpackRequire.federation.attachShareScopeMap) webpackRequire.federation.attachShareScopeMap(webpackRequire);
|
|
33
|
-
if (typeof webpackRequire.federation.prefetch === "function") webpackRequire.federation.prefetch();
|
|
34
33
|
if (!Array.isArray(shareScopeKey)) return webpackRequire.I(shareScopeKey || "default", initScope);
|
|
35
34
|
if (Boolean(webpackRequire.federation.initOptions.shared)) return webpackRequire.I(shareScopeKey, initScope);
|
|
36
35
|
return Promise.all(shareScopeKey.map((key) => {
|
|
@@ -1 +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
|
|
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\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;AAG/D,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"}
|
|
@@ -29,7 +29,6 @@ function initContainerEntry(options) {
|
|
|
29
29
|
federationInstance.initShareScopeMap(key, sc, { hostShareScopeMap: remoteEntryInitOptions?.shareScopeMap || {} });
|
|
30
30
|
});
|
|
31
31
|
if (webpackRequire.federation.attachShareScopeMap) webpackRequire.federation.attachShareScopeMap(webpackRequire);
|
|
32
|
-
if (typeof webpackRequire.federation.prefetch === "function") webpackRequire.federation.prefetch();
|
|
33
32
|
if (!Array.isArray(shareScopeKey)) return webpackRequire.I(shareScopeKey || "default", initScope);
|
|
34
33
|
if (Boolean(webpackRequire.federation.initOptions.shared)) return webpackRequire.I(shareScopeKey, initScope);
|
|
35
34
|
return Promise.all(shareScopeKey.map((key) => {
|
|
@@ -1 +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
|
|
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\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;AAG/D,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"}
|
|
@@ -4,13 +4,13 @@ import { SyncWaterfallHook } from "./utils/hooks/syncWaterfallHook.js";
|
|
|
4
4
|
import { AsyncWaterfallHook } from "./utils/hooks/asyncWaterfallHooks.js";
|
|
5
5
|
import { PluginSystem } from "./utils/hooks/pluginSystem.js";
|
|
6
6
|
import { CallFrom, InitScope, Options, Remote, RemoteEntryExports, RemoteEntryInitOptions, RemoteInfo, ShareInfos, ShareScopeMap, Shared, UserOptions } from "./type/config.js";
|
|
7
|
-
import { PreloadRemoteArgs } from "./type/preload.js";
|
|
7
|
+
import { PreloadRemoteArgs, ResourceLoadContext } from "./type/preload.js";
|
|
8
8
|
import { RemoteHandler } from "./remote/index.js";
|
|
9
9
|
import { SharedHandler } from "./shared/index.js";
|
|
10
10
|
import { SnapshotHandler } from "./plugins/snapshot/SnapshotHandler.js";
|
|
11
11
|
import { getRemoteEntry } from "./utils/load.js";
|
|
12
|
-
import { Module$1 } from "./module/index.js";
|
|
13
|
-
import { CreateScriptHookReturn, GlobalModuleInfo, ModuleInfo } from "@module-federation/sdk";
|
|
12
|
+
import { Module$1, RemoteModuleFactory } from "./module/index.js";
|
|
13
|
+
import { CreateLinkHookReturnDom, CreateScriptHookReturn, GlobalModuleInfo, ModuleInfo } from "@module-federation/sdk";
|
|
14
14
|
|
|
15
15
|
//#region ../runtime-core/dist/core.d.ts
|
|
16
16
|
//#region src/core.d.ts
|
|
@@ -72,6 +72,7 @@ declare class ModuleFederation {
|
|
|
72
72
|
* (e.g. preloadRemote / loading remoteEntry).
|
|
73
73
|
*/
|
|
74
74
|
remoteInfo?: RemoteInfo;
|
|
75
|
+
resourceContext?: ResourceLoadContext;
|
|
75
76
|
}], CreateScriptHookReturn>;
|
|
76
77
|
createLink: SyncHook<[{
|
|
77
78
|
url: string;
|
|
@@ -82,8 +83,9 @@ declare class ModuleFederation {
|
|
|
82
83
|
* (e.g. preloadRemote / loading remoteEntry).
|
|
83
84
|
*/
|
|
84
85
|
remoteInfo?: RemoteInfo;
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
resourceContext?: ResourceLoadContext;
|
|
87
|
+
}], CreateLinkHookReturnDom>;
|
|
88
|
+
fetch: AsyncHook<[string, RequestInit, (RemoteInfo | undefined)?, (ResourceLoadContext | undefined)?], false | void | Promise<Response>>;
|
|
87
89
|
loadEntryError: AsyncHook<[{
|
|
88
90
|
getRemoteEntry: typeof getRemoteEntry;
|
|
89
91
|
origin: ModuleFederation;
|
|
@@ -92,11 +94,65 @@ declare class ModuleFederation {
|
|
|
92
94
|
globalLoading: Record<string, Promise<void | RemoteEntryExports> | undefined>;
|
|
93
95
|
uniqueKey: string;
|
|
94
96
|
}], Promise<Promise<RemoteEntryExports | undefined> | undefined>>;
|
|
97
|
+
afterLoadEntry: AsyncHook<[{
|
|
98
|
+
origin: ModuleFederation;
|
|
99
|
+
remoteInfo: RemoteInfo;
|
|
100
|
+
remoteEntryExports?: false | void | RemoteEntryExports | undefined;
|
|
101
|
+
error?: unknown;
|
|
102
|
+
recovered?: boolean;
|
|
103
|
+
}], void>;
|
|
104
|
+
beforeInitRemote: AsyncHook<[{
|
|
105
|
+
id?: string;
|
|
106
|
+
remoteInfo: RemoteInfo;
|
|
107
|
+
remoteSnapshot?: ModuleInfo;
|
|
108
|
+
origin: ModuleFederation;
|
|
109
|
+
}], void>;
|
|
110
|
+
afterInitRemote: AsyncHook<[{
|
|
111
|
+
id?: string;
|
|
112
|
+
remoteInfo: RemoteInfo;
|
|
113
|
+
remoteSnapshot?: ModuleInfo;
|
|
114
|
+
remoteEntryExports?: RemoteEntryExports;
|
|
115
|
+
error?: unknown;
|
|
116
|
+
cached?: boolean;
|
|
117
|
+
origin: ModuleFederation;
|
|
118
|
+
}], void>;
|
|
119
|
+
beforeGetExpose: AsyncHook<[{
|
|
120
|
+
id: string;
|
|
121
|
+
expose: string;
|
|
122
|
+
moduleInfo: RemoteInfo;
|
|
123
|
+
remoteEntryExports: RemoteEntryExports;
|
|
124
|
+
origin: ModuleFederation;
|
|
125
|
+
}], void>;
|
|
126
|
+
afterGetExpose: AsyncHook<[{
|
|
127
|
+
id: string;
|
|
128
|
+
expose: string;
|
|
129
|
+
moduleInfo: RemoteInfo;
|
|
130
|
+
remoteEntryExports: RemoteEntryExports;
|
|
131
|
+
moduleFactory?: RemoteModuleFactory;
|
|
132
|
+
error?: unknown;
|
|
133
|
+
origin: ModuleFederation;
|
|
134
|
+
}], void>;
|
|
135
|
+
beforeExecuteFactory: AsyncHook<[{
|
|
136
|
+
id: string;
|
|
137
|
+
expose: string;
|
|
138
|
+
moduleInfo: RemoteInfo;
|
|
139
|
+
loadFactory: boolean;
|
|
140
|
+
origin: ModuleFederation;
|
|
141
|
+
}], void>;
|
|
142
|
+
afterExecuteFactory: AsyncHook<[{
|
|
143
|
+
id: string;
|
|
144
|
+
expose: string;
|
|
145
|
+
moduleInfo: RemoteInfo;
|
|
146
|
+
loadFactory: boolean;
|
|
147
|
+
exposeModule?: unknown;
|
|
148
|
+
error?: unknown;
|
|
149
|
+
origin: ModuleFederation;
|
|
150
|
+
}], void>;
|
|
95
151
|
getModuleFactory: AsyncHook<[{
|
|
96
152
|
remoteEntryExports: RemoteEntryExports;
|
|
97
153
|
expose: string;
|
|
98
154
|
moduleInfo: RemoteInfo;
|
|
99
|
-
}], Promise<
|
|
155
|
+
}], RemoteModuleFactory | Promise<RemoteModuleFactory | undefined> | undefined>;
|
|
100
156
|
}>;
|
|
101
157
|
bridgeHook: PluginSystem<{
|
|
102
158
|
beforeBridgeRender: SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
@@ -5,6 +5,7 @@ import { ModuleInfo } from "@module-federation/sdk";
|
|
|
5
5
|
//#region ../runtime-core/dist/module/index.d.ts
|
|
6
6
|
//#region src/module/index.d.ts
|
|
7
7
|
type ModuleOptions = ConstructorParameters<typeof Module$1>[0];
|
|
8
|
+
type RemoteModuleFactory = () => unknown | Promise<unknown>;
|
|
8
9
|
declare class Module$1 {
|
|
9
10
|
remoteInfo: RemoteInfo;
|
|
10
11
|
inited: boolean;
|
|
@@ -20,13 +21,13 @@ declare class Module$1 {
|
|
|
20
21
|
remoteInfo: RemoteInfo;
|
|
21
22
|
host: ModuleFederation;
|
|
22
23
|
});
|
|
23
|
-
getEntry(): Promise<RemoteEntryExports>;
|
|
24
|
-
init(id?: string, remoteSnapshot?: ModuleInfo, rawInitScope?: InitScope): Promise<RemoteEntryExports>;
|
|
24
|
+
getEntry(expose?: string): Promise<RemoteEntryExports>;
|
|
25
|
+
init(id?: string, remoteSnapshot?: ModuleInfo, rawInitScope?: InitScope, expose?: string): Promise<RemoteEntryExports>;
|
|
25
26
|
get(id: string, expose: string, options?: {
|
|
26
27
|
loadFactory?: boolean;
|
|
27
|
-
}, remoteSnapshot?: ModuleInfo): Promise<
|
|
28
|
+
}, remoteSnapshot?: ModuleInfo): Promise<unknown>;
|
|
28
29
|
private wraperFactory;
|
|
29
30
|
} //#endregion
|
|
30
31
|
//#endregion
|
|
31
|
-
export { Module$1, ModuleOptions };
|
|
32
|
+
export { Module$1, ModuleOptions, RemoteModuleFactory };
|
|
32
33
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -2,6 +2,7 @@ import { AsyncHook } from "../../utils/hooks/asyncHook.js";
|
|
|
2
2
|
import { AsyncWaterfallHook } from "../../utils/hooks/asyncWaterfallHooks.js";
|
|
3
3
|
import { PluginSystem } from "../../utils/hooks/pluginSystem.js";
|
|
4
4
|
import { Options, Remote } from "../../type/config.js";
|
|
5
|
+
import { ResourceLoadInitiator } from "../../type/preload.js";
|
|
5
6
|
import { getGlobalSnapshot } from "../../global.js";
|
|
6
7
|
import { ModuleFederation } from "../../core.js";
|
|
7
8
|
import { GlobalModuleInfo, Manifest, ModuleInfo } from "@module-federation/sdk";
|
|
@@ -16,6 +17,7 @@ declare class SnapshotHandler {
|
|
|
16
17
|
beforeLoadRemoteSnapshot: AsyncHook<[{
|
|
17
18
|
options: Options;
|
|
18
19
|
moduleInfo: Remote;
|
|
20
|
+
origin: ModuleFederation;
|
|
19
21
|
}], void>;
|
|
20
22
|
loadSnapshot: AsyncWaterfallHook<{
|
|
21
23
|
options: Options;
|
|
@@ -46,11 +48,11 @@ declare class SnapshotHandler {
|
|
|
46
48
|
loadRemoteSnapshotInfo({
|
|
47
49
|
moduleInfo,
|
|
48
50
|
id,
|
|
49
|
-
|
|
51
|
+
initiator
|
|
50
52
|
}: {
|
|
51
53
|
moduleInfo: Remote;
|
|
52
54
|
id?: string;
|
|
53
|
-
|
|
55
|
+
initiator?: ResourceLoadInitiator;
|
|
54
56
|
}): Promise<{
|
|
55
57
|
remoteSnapshot: ModuleInfo;
|
|
56
58
|
globalSnapshot: GlobalModuleInfo;
|
|
@@ -61,6 +63,7 @@ declare class SnapshotHandler {
|
|
|
61
63
|
remoteSnapshot: GlobalModuleInfo[string] | undefined;
|
|
62
64
|
};
|
|
63
65
|
private getManifestJson;
|
|
66
|
+
private loadManifestSnapshot;
|
|
64
67
|
} //#endregion
|
|
65
68
|
//#endregion
|
|
66
69
|
export { SnapshotHandler };
|
|
@@ -4,7 +4,7 @@ import { SyncWaterfallHook } from "../utils/hooks/syncWaterfallHook.js";
|
|
|
4
4
|
import { AsyncWaterfallHook } from "../utils/hooks/asyncWaterfallHooks.js";
|
|
5
5
|
import { PluginSystem } from "../utils/hooks/pluginSystem.js";
|
|
6
6
|
import { CallFrom, Options, Remote, RemoteEntryExports, RemoteInfo, UserOptions } from "../type/config.js";
|
|
7
|
-
import { PreloadAssets, PreloadOptions, PreloadRemoteArgs } from "../type/preload.js";
|
|
7
|
+
import { PreloadAssets, PreloadOptions, PreloadRemoteArgs, PreloadRemoteResult } from "../type/preload.js";
|
|
8
8
|
import { ModuleFederation } from "../core.js";
|
|
9
9
|
import { Module$1, ModuleOptions } from "../module/index.js";
|
|
10
10
|
import { GlobalModuleInfo, ModuleInfo } from "@module-federation/sdk";
|
|
@@ -41,6 +41,15 @@ declare class RemoteHandler {
|
|
|
41
41
|
options: Options;
|
|
42
42
|
origin: ModuleFederation;
|
|
43
43
|
}>;
|
|
44
|
+
afterMatchRemote: AsyncHook<[{
|
|
45
|
+
id: string;
|
|
46
|
+
options: Options;
|
|
47
|
+
remote?: Remote;
|
|
48
|
+
expose?: string;
|
|
49
|
+
remoteInfo?: RemoteInfo;
|
|
50
|
+
error?: unknown;
|
|
51
|
+
origin: ModuleFederation;
|
|
52
|
+
}], void>;
|
|
44
53
|
onLoad: AsyncHook<[{
|
|
45
54
|
id: string;
|
|
46
55
|
expose: string;
|
|
@@ -51,6 +60,18 @@ declare class RemoteHandler {
|
|
|
51
60
|
exposeModule: any;
|
|
52
61
|
exposeModuleFactory: any;
|
|
53
62
|
moduleInstance: Module$1;
|
|
63
|
+
}], unknown>;
|
|
64
|
+
afterLoadRemote: AsyncHook<[{
|
|
65
|
+
id: string;
|
|
66
|
+
expose?: string;
|
|
67
|
+
remote?: RemoteInfo;
|
|
68
|
+
options?: {
|
|
69
|
+
loadFactory?: boolean;
|
|
70
|
+
from?: CallFrom;
|
|
71
|
+
};
|
|
72
|
+
error?: unknown;
|
|
73
|
+
recovered?: boolean;
|
|
74
|
+
origin: ModuleFederation;
|
|
54
75
|
}], void>;
|
|
55
76
|
handlePreloadModule: SyncHook<[{
|
|
56
77
|
id: string;
|
|
@@ -66,6 +87,8 @@ declare class RemoteHandler {
|
|
|
66
87
|
options?: any;
|
|
67
88
|
from: CallFrom;
|
|
68
89
|
lifecycle: "beforeRequest" | "beforeLoadShare" | "afterResolve" | "onLoad";
|
|
90
|
+
remote?: RemoteInfo;
|
|
91
|
+
expose?: string;
|
|
69
92
|
origin: ModuleFederation;
|
|
70
93
|
}], unknown>;
|
|
71
94
|
beforePreloadRemote: AsyncHook<[{
|
|
@@ -81,16 +104,19 @@ declare class RemoteHandler {
|
|
|
81
104
|
remoteSnapshot: ModuleInfo;
|
|
82
105
|
globalSnapshot: GlobalModuleInfo;
|
|
83
106
|
}], Promise<PreloadAssets>>;
|
|
84
|
-
afterPreloadRemote: AsyncHook<{
|
|
107
|
+
afterPreloadRemote: AsyncHook<[{
|
|
85
108
|
preloadOps: Array<PreloadRemoteArgs>;
|
|
86
109
|
options: Options;
|
|
87
110
|
origin: ModuleFederation;
|
|
88
|
-
|
|
111
|
+
results: PreloadRemoteResult[];
|
|
112
|
+
error?: unknown;
|
|
113
|
+
}], false | void | Promise<false | void>>;
|
|
89
114
|
loadEntry: AsyncHook<[{
|
|
115
|
+
origin: ModuleFederation;
|
|
90
116
|
loaderHook: ModuleFederation["loaderHook"];
|
|
91
117
|
remoteInfo: RemoteInfo;
|
|
92
118
|
remoteEntryExports?: RemoteEntryExports;
|
|
93
|
-
}], Promise<RemoteEntryExports>>;
|
|
119
|
+
}], void | RemoteEntryExports | Promise<void | RemoteEntryExports>>;
|
|
94
120
|
}>;
|
|
95
121
|
constructor(host: ModuleFederation);
|
|
96
122
|
formatAndRegisterRemote(globalOptions: Options, userOptions: UserOptions): Remote[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SyncHook } from "../utils/hooks/syncHook.js";
|
|
1
2
|
import { AsyncHook } from "../utils/hooks/asyncHook.js";
|
|
2
3
|
import { SyncWaterfallHook } from "../utils/hooks/syncWaterfallHook.js";
|
|
3
4
|
import { AsyncWaterfallHook } from "../utils/hooks/asyncWaterfallHooks.js";
|
|
@@ -26,6 +27,25 @@ declare class SharedHandler {
|
|
|
26
27
|
origin: ModuleFederation;
|
|
27
28
|
}>;
|
|
28
29
|
loadShare: AsyncHook<[ModuleFederation, string, ShareInfos], false | void | Promise<false | void>>;
|
|
30
|
+
afterLoadShare: SyncHook<[{
|
|
31
|
+
pkgName: string;
|
|
32
|
+
shareInfo?: Partial<Shared>;
|
|
33
|
+
selectedShared?: Partial<Shared>;
|
|
34
|
+
shared: Options["shared"];
|
|
35
|
+
shareScopeMap: ShareScopeMap;
|
|
36
|
+
lifecycle: "loadShare" | "loadShareSync";
|
|
37
|
+
origin: ModuleFederation;
|
|
38
|
+
}], void>;
|
|
39
|
+
errorLoadShare: SyncHook<[{
|
|
40
|
+
pkgName: string;
|
|
41
|
+
shareInfo?: Partial<Shared>;
|
|
42
|
+
shared: Options["shared"];
|
|
43
|
+
shareScopeMap: ShareScopeMap;
|
|
44
|
+
lifecycle: "loadShare" | "loadShareSync";
|
|
45
|
+
origin: ModuleFederation;
|
|
46
|
+
error?: unknown;
|
|
47
|
+
recovered?: boolean;
|
|
48
|
+
}], void>;
|
|
29
49
|
resolveShare: SyncWaterfallHook<{
|
|
30
50
|
shareScopeMap: ShareScopeMap;
|
|
31
51
|
scope: string;
|
|
@@ -48,6 +68,8 @@ declare class SharedHandler {
|
|
|
48
68
|
}>;
|
|
49
69
|
initTokens: InitTokens;
|
|
50
70
|
constructor(host: ModuleFederation);
|
|
71
|
+
private emitAfterLoadShare;
|
|
72
|
+
private emitErrorLoadShare;
|
|
51
73
|
registerShared(globalOptions: Options, userOptions: UserOptions): {
|
|
52
74
|
newShareInfos: ShareInfos;
|
|
53
75
|
allShareInfos: {
|
|
@@ -10,13 +10,36 @@ interface PreloadRemoteArgs {
|
|
|
10
10
|
share?: boolean;
|
|
11
11
|
depsRemote?: boolean | Array<depsPreloadArg>;
|
|
12
12
|
filter?: (assetUrl: string) => boolean;
|
|
13
|
-
prefetchInterface?: boolean;
|
|
14
13
|
}
|
|
15
14
|
type PreloadConfig = PreloadRemoteArgs;
|
|
16
15
|
type PreloadOptions = Array<{
|
|
17
16
|
remote: Remote;
|
|
18
17
|
preloadConfig: PreloadConfig;
|
|
19
18
|
}>;
|
|
19
|
+
type ResourceLoadInitiator = 'loadRemote' | 'preloadRemote';
|
|
20
|
+
type ResourceLoadType = 'manifest' | 'remoteEntry' | 'js' | 'css';
|
|
21
|
+
interface ResourceLoadContext {
|
|
22
|
+
initiator: ResourceLoadInitiator;
|
|
23
|
+
id: string;
|
|
24
|
+
resourceType: ResourceLoadType;
|
|
25
|
+
url?: string;
|
|
26
|
+
}
|
|
27
|
+
type PreloadAssetStatus = 'success' | 'error' | 'timeout' | 'cached';
|
|
28
|
+
interface PreloadAssetResult {
|
|
29
|
+
url: string;
|
|
30
|
+
status: PreloadAssetStatus;
|
|
31
|
+
resourceType: ResourceLoadType;
|
|
32
|
+
initiator: ResourceLoadInitiator;
|
|
33
|
+
id: string;
|
|
34
|
+
error?: unknown;
|
|
35
|
+
}
|
|
36
|
+
interface PreloadRemoteResult {
|
|
37
|
+
remote: Remote;
|
|
38
|
+
remoteInfo: RemoteInfo;
|
|
39
|
+
preloadConfig: PreloadConfig;
|
|
40
|
+
id: string;
|
|
41
|
+
results: PreloadAssetResult[];
|
|
42
|
+
}
|
|
20
43
|
type EntryAssets = {
|
|
21
44
|
name: string;
|
|
22
45
|
url: string;
|
|
@@ -28,5 +51,5 @@ interface PreloadAssets {
|
|
|
28
51
|
entryAssets: Array<EntryAssets>;
|
|
29
52
|
} //#endregion
|
|
30
53
|
//#endregion
|
|
31
|
-
export { EntryAssets, PreloadAssets, PreloadConfig, PreloadOptions, PreloadRemoteArgs, depsPreloadArg };
|
|
54
|
+
export { EntryAssets, PreloadAssetResult, PreloadAssetStatus, PreloadAssets, PreloadConfig, PreloadOptions, PreloadRemoteArgs, PreloadRemoteResult, ResourceLoadContext, ResourceLoadInitiator, ResourceLoadType, depsPreloadArg };
|
|
32
55
|
//# sourceMappingURL=preload.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CallFrom, GlobalShareScopeMap, InitScope, InitTokens, Optional, Options, Remote, RemoteEntryExports, RemoteEntryInitOptions, RemoteInfo, RemoteInfoCommon, ShareArgs, ShareInfos, ShareScopeMap, ShareStrategy, Shared, SharedConfig, SharedGetter, TreeShakingArgs, UserOptions } from "./type/config.js";
|
|
2
|
-
import { EntryAssets, PreloadAssets, PreloadConfig, PreloadOptions, PreloadRemoteArgs, depsPreloadArg } from "./type/preload.js";
|
|
2
|
+
import { EntryAssets, PreloadAssetResult, PreloadAssetStatus, PreloadAssets, PreloadConfig, PreloadOptions, PreloadRemoteArgs, PreloadRemoteResult, ResourceLoadContext, ResourceLoadInitiator, ResourceLoadType, depsPreloadArg } from "./type/preload.js";
|
|
3
3
|
import { ModuleFederationRuntimePlugin } from "./type/plugin.js";
|
|
@@ -2,8 +2,8 @@ import { SyncHook } from "./syncHook.js";
|
|
|
2
2
|
|
|
3
3
|
//#region ../runtime-core/dist/utils/hooks/asyncWaterfallHooks.d.ts
|
|
4
4
|
//#region src/utils/hooks/asyncWaterfallHooks.d.ts
|
|
5
|
-
type CallbackReturnType<T> = T | Promise<T>;
|
|
6
|
-
declare class AsyncWaterfallHook<T extends
|
|
5
|
+
type CallbackReturnType<T> = T | void | Promise<T | void>;
|
|
6
|
+
declare class AsyncWaterfallHook<T extends object> extends SyncHook<[T], CallbackReturnType<T>> {
|
|
7
7
|
onerror: (errMsg: string | Error | unknown) => void;
|
|
8
8
|
constructor(type: string);
|
|
9
9
|
emit(data: T): Promise<T>;
|
|
@@ -2,7 +2,7 @@ import { SyncHook } from "./syncHook.js";
|
|
|
2
2
|
|
|
3
3
|
//#region ../runtime-core/dist/utils/hooks/syncWaterfallHook.d.ts
|
|
4
4
|
//#region src/utils/hooks/syncWaterfallHook.d.ts
|
|
5
|
-
declare class SyncWaterfallHook<T extends Record<string, any>> extends SyncHook<[T], T> {
|
|
5
|
+
declare class SyncWaterfallHook<T extends Record<string, any>> extends SyncHook<[T], T | void> {
|
|
6
6
|
onerror: (errMsg: string | Error | unknown) => void;
|
|
7
7
|
constructor(type: string);
|
|
8
8
|
emit(data: T): T;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RemoteEntryExports, RemoteInfo } from "../type/config.js";
|
|
2
|
+
import { ResourceLoadContext } from "../type/preload.js";
|
|
2
3
|
import { ModuleFederation } from "../core.js";
|
|
3
4
|
|
|
4
5
|
//#region ../runtime-core/dist/utils/load.d.ts
|
|
@@ -9,6 +10,7 @@ declare function getRemoteEntry(params: {
|
|
|
9
10
|
remoteEntryExports?: RemoteEntryExports | undefined;
|
|
10
11
|
getEntryUrl?: (url: string) => string;
|
|
11
12
|
_inErrorHandling?: boolean;
|
|
13
|
+
resourceContext?: ResourceLoadContext;
|
|
12
14
|
}): Promise<RemoteEntryExports | false | void>;
|
|
13
15
|
//#endregion
|
|
14
16
|
export { getRemoteEntry };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { initializeSharing } from "./initializeSharing.js";
|
|
2
2
|
import { attachShareScopeMap } from "./attachShareScopeMap.js";
|
|
3
3
|
import { initContainerEntry } from "./initContainerEntry.js";
|
|
4
|
-
import { moduleFederationPlugin } from "@module-federation/sdk";
|
|
5
4
|
import * as runtime from "@module-federation/runtime";
|
|
5
|
+
import { moduleFederationPlugin } from "@module-federation/sdk";
|
|
6
6
|
import { Remote, RemoteEntryInitOptions, SharedConfig, SharedGetter, TreeShakingArgs } from "@module-federation/runtime/types";
|
|
7
7
|
|
|
8
8
|
//#region src/types.d.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"public": true,
|
|
3
3
|
"name": "@module-federation/webpack-bundler-runtime",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.5.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "Module Federation Runtime for webpack",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"module": "./dist/index.js",
|
|
27
27
|
"types": "./dist/index.d.ts",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@module-federation/
|
|
30
|
-
"@module-federation/error-codes": "2.
|
|
31
|
-
"@module-federation/
|
|
29
|
+
"@module-federation/runtime": "2.5.0",
|
|
30
|
+
"@module-federation/error-codes": "2.5.0",
|
|
31
|
+
"@module-federation/sdk": "2.5.0"
|
|
32
32
|
},
|
|
33
33
|
"exports": {
|
|
34
34
|
".": {
|