@module-federation/webpack-bundler-runtime 2.3.2 → 2.4.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.
@@ -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 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"}
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,K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Ae,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 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"}
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,C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AU;AAGnD,QAAO,QAAQ,IACb,cAAc,KAAK,QAAQ;AAEzB,SAAO,eAAe,EAAE,KAAK,UAAU;GACvC,CACH,CAAC,WAAW,KAAK"}
@@ -66,12 +66,24 @@ declare class ModuleFederation {
66
66
  createScript: SyncHook<[{
67
67
  url: string;
68
68
  attrs?: Record<string, any>;
69
+ /**
70
+ * The producer(remote) info bound to this resource.
71
+ * Only present when the loader is invoked in a remote-related context
72
+ * (e.g. preloadRemote / loading remoteEntry).
73
+ */
74
+ remoteInfo?: RemoteInfo;
69
75
  }], CreateScriptHookReturn>;
70
76
  createLink: SyncHook<[{
71
77
  url: string;
72
78
  attrs?: Record<string, any>;
79
+ /**
80
+ * The producer(remote) info bound to this resource.
81
+ * Only present when the loader is invoked in a remote-related context
82
+ * (e.g. preloadRemote / loading remoteEntry).
83
+ */
84
+ remoteInfo?: RemoteInfo;
73
85
  }], void | HTMLLinkElement>;
74
- fetch: AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
86
+ fetch: AsyncHook<[string, RequestInit, (RemoteInfo | undefined)?], false | void | Promise<Response>>;
75
87
  loadEntryError: AsyncHook<[{
76
88
  getRemoteEntry: typeof getRemoteEntry;
77
89
  origin: ModuleFederation;
@@ -10,7 +10,6 @@ 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<{
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.3.2",
4
+ "version": "2.4.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/sdk": "2.3.2",
30
- "@module-federation/runtime": "2.3.2",
31
- "@module-federation/error-codes": "2.3.2"
29
+ "@module-federation/runtime": "2.4.0",
30
+ "@module-federation/sdk": "2.4.0",
31
+ "@module-federation/error-codes": "2.4.0"
32
32
  },
33
33
  "exports": {
34
34
  ".": {