@module-federation/runtime-core 0.0.0-next-20250616190501 → 0.0.0-next-20250616203439

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.
@@ -196,7 +196,7 @@ function getGlobalFederationConstructor() {
196
196
  function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
197
197
  if (isDebug) {
198
198
  CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
199
- CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.15.0";
199
+ CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.14.3";
200
200
  }
201
201
  }
202
202
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -1310,8 +1310,7 @@ let Module = class Module {
1310
1310
  });
1311
1311
  if (typeof (remoteEntryExports == null ? void 0 : remoteEntryExports.init) === 'undefined') {
1312
1312
  error(errorCodes.getShortErrorMsg(errorCodes.RUNTIME_002, errorCodes.runtimeDescMap, {
1313
- hostName: this.host.name,
1314
- remoteName: this.remoteInfo.name,
1313
+ remoteName: name,
1315
1314
  remoteEntryUrl: this.remoteInfo.entry,
1316
1315
  remoteEntryKey: this.remoteInfo.entryGlobalName
1317
1316
  }));
@@ -1745,12 +1744,9 @@ function snapshotPlugin() {
1745
1744
  return {
1746
1745
  name: 'snapshot-plugin',
1747
1746
  async afterResolve (args) {
1748
- const { remote, pkgNameOrAlias, expose, origin, remoteInfo, id } = args;
1747
+ const { remote, pkgNameOrAlias, expose, origin, remoteInfo } = args;
1749
1748
  if (!isRemoteInfoWithEntry(remote) || !isPureRemoteEntry(remote)) {
1750
- const { remoteSnapshot, globalSnapshot } = await origin.snapshotHandler.loadRemoteSnapshotInfo({
1751
- moduleInfo: remote,
1752
- id
1753
- });
1749
+ const { remoteSnapshot, globalSnapshot } = await origin.snapshotHandler.loadRemoteSnapshotInfo(remote);
1754
1750
  assignRemoteInfo(remoteInfo, remoteSnapshot);
1755
1751
  // preloading assets
1756
1752
  const preloadOptions = {
@@ -2009,7 +2005,7 @@ const generatePreloadAssetsPlugin = function() {
2009
2005
 
2010
2006
  function getGlobalRemoteInfo(moduleInfo, origin) {
2011
2007
  const hostGlobalSnapshot = getGlobalSnapshotInfoByModuleInfo({
2012
- name: origin.name,
2008
+ name: origin.options.name,
2013
2009
  version: origin.options.version
2014
2010
  });
2015
2011
  // get remote detail info from global
@@ -2034,8 +2030,23 @@ function getGlobalRemoteInfo(moduleInfo, origin) {
2034
2030
  };
2035
2031
  }
2036
2032
  class SnapshotHandler {
2033
+ async loadSnapshot(moduleInfo) {
2034
+ const { options } = this.HostInstance;
2035
+ const { hostGlobalSnapshot, remoteSnapshot, globalSnapshot } = this.getGlobalRemoteInfo(moduleInfo);
2036
+ const { remoteSnapshot: globalRemoteSnapshot, globalSnapshot: globalSnapshotRes } = await this.hooks.lifecycle.loadSnapshot.emit({
2037
+ options,
2038
+ moduleInfo,
2039
+ hostGlobalSnapshot,
2040
+ remoteSnapshot,
2041
+ globalSnapshot
2042
+ });
2043
+ return {
2044
+ remoteSnapshot: globalRemoteSnapshot,
2045
+ globalSnapshot: globalSnapshotRes
2046
+ };
2047
+ }
2037
2048
  // eslint-disable-next-line max-lines-per-function
2038
- async loadRemoteSnapshotInfo({ moduleInfo, id, expose }) {
2049
+ async loadRemoteSnapshotInfo(moduleInfo) {
2039
2050
  const { options } = this.HostInstance;
2040
2051
  await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({
2041
2052
  options,
@@ -2122,8 +2133,6 @@ class SnapshotHandler {
2122
2133
  }
2123
2134
  }
2124
2135
  await this.hooks.lifecycle.afterLoadSnapshot.emit({
2125
- id,
2126
- host: this.HostInstance,
2127
2136
  options,
2128
2137
  moduleInfo,
2129
2138
  remoteSnapshot: mSnapshot
@@ -2661,9 +2670,7 @@ class RemoteHandler {
2661
2670
  await Promise.all(preloadOps.map(async (ops)=>{
2662
2671
  const { remote } = ops;
2663
2672
  const remoteInfo = getRemoteInfo(remote);
2664
- const { globalSnapshot, remoteSnapshot } = await host.snapshotHandler.loadRemoteSnapshotInfo({
2665
- moduleInfo: remote
2666
- });
2673
+ const { globalSnapshot, remoteSnapshot } = await host.snapshotHandler.loadRemoteSnapshotInfo(remote);
2667
2674
  const assets = await this.hooks.lifecycle.generatePreloadAssets.emit({
2668
2675
  origin: host,
2669
2676
  preloadOptions: ops,
@@ -3024,7 +3031,7 @@ class FederationHost {
3024
3031
  // maybe will change, temporarily for internal use only
3025
3032
  initContainer: new AsyncWaterfallHook('initContainer')
3026
3033
  });
3027
- this.version = "0.15.0";
3034
+ this.version = "0.14.3";
3028
3035
  this.moduleCache = new Map();
3029
3036
  this.loaderHook = new PluginSystem({
3030
3037
  // FIXME: may not be suitable , not open to the public yet
package/dist/index.esm.js CHANGED
@@ -195,7 +195,7 @@ function getGlobalFederationConstructor() {
195
195
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
196
196
  if (isDebug) {
197
197
  CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
198
- CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.15.0";
198
+ CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.14.3";
199
199
  }
200
200
  }
201
201
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -1309,8 +1309,7 @@ let Module = class Module {
1309
1309
  });
1310
1310
  if (typeof (remoteEntryExports == null ? void 0 : remoteEntryExports.init) === 'undefined') {
1311
1311
  error(getShortErrorMsg(RUNTIME_002, runtimeDescMap, {
1312
- hostName: this.host.name,
1313
- remoteName: this.remoteInfo.name,
1312
+ remoteName: name,
1314
1313
  remoteEntryUrl: this.remoteInfo.entry,
1315
1314
  remoteEntryKey: this.remoteInfo.entryGlobalName
1316
1315
  }));
@@ -1744,12 +1743,9 @@ function snapshotPlugin() {
1744
1743
  return {
1745
1744
  name: 'snapshot-plugin',
1746
1745
  async afterResolve (args) {
1747
- const { remote, pkgNameOrAlias, expose, origin, remoteInfo, id } = args;
1746
+ const { remote, pkgNameOrAlias, expose, origin, remoteInfo } = args;
1748
1747
  if (!isRemoteInfoWithEntry(remote) || !isPureRemoteEntry(remote)) {
1749
- const { remoteSnapshot, globalSnapshot } = await origin.snapshotHandler.loadRemoteSnapshotInfo({
1750
- moduleInfo: remote,
1751
- id
1752
- });
1748
+ const { remoteSnapshot, globalSnapshot } = await origin.snapshotHandler.loadRemoteSnapshotInfo(remote);
1753
1749
  assignRemoteInfo(remoteInfo, remoteSnapshot);
1754
1750
  // preloading assets
1755
1751
  const preloadOptions = {
@@ -2008,7 +2004,7 @@ const generatePreloadAssetsPlugin = function() {
2008
2004
 
2009
2005
  function getGlobalRemoteInfo(moduleInfo, origin) {
2010
2006
  const hostGlobalSnapshot = getGlobalSnapshotInfoByModuleInfo({
2011
- name: origin.name,
2007
+ name: origin.options.name,
2012
2008
  version: origin.options.version
2013
2009
  });
2014
2010
  // get remote detail info from global
@@ -2033,8 +2029,23 @@ function getGlobalRemoteInfo(moduleInfo, origin) {
2033
2029
  };
2034
2030
  }
2035
2031
  class SnapshotHandler {
2032
+ async loadSnapshot(moduleInfo) {
2033
+ const { options } = this.HostInstance;
2034
+ const { hostGlobalSnapshot, remoteSnapshot, globalSnapshot } = this.getGlobalRemoteInfo(moduleInfo);
2035
+ const { remoteSnapshot: globalRemoteSnapshot, globalSnapshot: globalSnapshotRes } = await this.hooks.lifecycle.loadSnapshot.emit({
2036
+ options,
2037
+ moduleInfo,
2038
+ hostGlobalSnapshot,
2039
+ remoteSnapshot,
2040
+ globalSnapshot
2041
+ });
2042
+ return {
2043
+ remoteSnapshot: globalRemoteSnapshot,
2044
+ globalSnapshot: globalSnapshotRes
2045
+ };
2046
+ }
2036
2047
  // eslint-disable-next-line max-lines-per-function
2037
- async loadRemoteSnapshotInfo({ moduleInfo, id, expose }) {
2048
+ async loadRemoteSnapshotInfo(moduleInfo) {
2038
2049
  const { options } = this.HostInstance;
2039
2050
  await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({
2040
2051
  options,
@@ -2121,8 +2132,6 @@ class SnapshotHandler {
2121
2132
  }
2122
2133
  }
2123
2134
  await this.hooks.lifecycle.afterLoadSnapshot.emit({
2124
- id,
2125
- host: this.HostInstance,
2126
2135
  options,
2127
2136
  moduleInfo,
2128
2137
  remoteSnapshot: mSnapshot
@@ -2660,9 +2669,7 @@ class RemoteHandler {
2660
2669
  await Promise.all(preloadOps.map(async (ops)=>{
2661
2670
  const { remote } = ops;
2662
2671
  const remoteInfo = getRemoteInfo(remote);
2663
- const { globalSnapshot, remoteSnapshot } = await host.snapshotHandler.loadRemoteSnapshotInfo({
2664
- moduleInfo: remote
2665
- });
2672
+ const { globalSnapshot, remoteSnapshot } = await host.snapshotHandler.loadRemoteSnapshotInfo(remote);
2666
2673
  const assets = await this.hooks.lifecycle.generatePreloadAssets.emit({
2667
2674
  origin: host,
2668
2675
  preloadOptions: ops,
@@ -3023,7 +3030,7 @@ class FederationHost {
3023
3030
  // maybe will change, temporarily for internal use only
3024
3031
  initContainer: new AsyncWaterfallHook('initContainer')
3025
3032
  });
3026
- this.version = "0.15.0";
3033
+ this.version = "0.14.3";
3027
3034
  this.moduleCache = new Map();
3028
3035
  this.loaderHook = new PluginSystem({
3029
3036
  // FIXME: may not be suitable , not open to the public yet
@@ -33,8 +33,6 @@ export declare class SnapshotHandler {
33
33
  from: "global" | "manifest";
34
34
  }>;
35
35
  afterLoadSnapshot: AsyncWaterfallHook<{
36
- id?: string;
37
- host: FederationHost;
38
36
  options: Options;
39
37
  moduleInfo: Remote;
40
38
  remoteSnapshot: ModuleInfo;
@@ -43,11 +41,11 @@ export declare class SnapshotHandler {
43
41
  loaderHook: FederationHost['loaderHook'];
44
42
  manifestLoading: Record<string, Promise<ModuleInfo>>;
45
43
  constructor(HostInstance: FederationHost);
46
- loadRemoteSnapshotInfo({ moduleInfo, id, expose, }: {
47
- moduleInfo: Remote;
48
- id?: string;
49
- expose?: string;
50
- }): Promise<{
44
+ loadSnapshot(moduleInfo: Remote): Promise<{
45
+ remoteSnapshot: GlobalModuleInfo[string] | undefined;
46
+ globalSnapshot: ReturnType<typeof getGlobalSnapshot>;
47
+ }>;
48
+ loadRemoteSnapshotInfo(moduleInfo: Remote): Promise<{
51
49
  remoteSnapshot: ModuleInfo;
52
50
  globalSnapshot: GlobalModuleInfo;
53
51
  }> | never;
@@ -20,7 +20,6 @@ export type LoadShareExtraOptions = {
20
20
  resolver?: (sharedOptions: ShareInfos[string]) => Shared;
21
21
  };
22
22
  export interface RemoteInfo {
23
- alias?: string;
24
23
  name: string;
25
24
  version?: string;
26
25
  buildVersion?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime-core",
3
- "version": "0.0.0-next-20250616190501",
3
+ "version": "0.0.0-next-20250616203439",
4
4
  "type": "module",
5
5
  "author": "zhouxiao <codingzx@gmail.com>",
6
6
  "main": "./dist/index.cjs.cjs",
@@ -52,7 +52,7 @@
52
52
  }
53
53
  },
54
54
  "dependencies": {
55
- "@module-federation/sdk": "0.0.0-next-20250616190501",
56
- "@module-federation/error-codes": "0.0.0-next-20250616190501"
55
+ "@module-federation/sdk": "0.0.0-next-20250616203439",
56
+ "@module-federation/error-codes": "0.0.0-next-20250616203439"
57
57
  }
58
58
  }