@module-federation/runtime-core 0.6.16 → 0.6.18

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/index.cjs.js CHANGED
@@ -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.6.16";
199
+ CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.18";
200
200
  }
201
201
  }
202
202
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -2089,16 +2089,25 @@ class SnapshotHandler {
2089
2089
  res = await fetch(manifestUrl, {});
2090
2090
  }
2091
2091
  manifestJson = await res.json();
2092
- assert(manifestJson.metaData && manifestJson.exposes && manifestJson.shared, `${manifestUrl} is not a federation manifest`);
2093
- this.manifestCache.set(manifestUrl, manifestJson);
2094
- return manifestJson;
2095
2092
  } catch (err) {
2096
- delete this.manifestLoading[manifestUrl];
2097
- error(errorCodes.getShortErrorMsg(errorCodes.RUNTIME_003, errorCodes.runtimeDescMap, {
2098
- manifestUrl,
2099
- moduleName: moduleInfo.name
2100
- }, `${err}`));
2093
+ manifestJson = await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
2094
+ id: manifestUrl,
2095
+ error,
2096
+ from: 'runtime',
2097
+ lifecycle: 'afterResolve',
2098
+ origin: this.HostInstance
2099
+ });
2100
+ if (!manifestJson) {
2101
+ delete this.manifestLoading[manifestUrl];
2102
+ error(errorCodes.getShortErrorMsg(errorCodes.RUNTIME_003, errorCodes.runtimeDescMap, {
2103
+ manifestUrl,
2104
+ moduleName: moduleInfo.name
2105
+ }, `${err}`));
2106
+ }
2101
2107
  }
2108
+ assert(manifestJson.metaData && manifestJson.exposes && manifestJson.shared, `${manifestUrl} is not a federation manifest`);
2109
+ this.manifestCache.set(manifestUrl, manifestJson);
2110
+ return manifestJson;
2102
2111
  };
2103
2112
  const asyncLoadProcess = async ()=>{
2104
2113
  const manifestJson = await getManifest();
@@ -2952,7 +2961,7 @@ class FederationHost {
2952
2961
  // maybe will change, temporarily for internal use only
2953
2962
  initContainer: new AsyncWaterfallHook('initContainer')
2954
2963
  });
2955
- this.version = "0.6.16";
2964
+ this.version = "0.6.18";
2956
2965
  this.moduleCache = new Map();
2957
2966
  this.loaderHook = new PluginSystem({
2958
2967
  // FIXME: may not be suitable , not open to the public yet
@@ -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.6.16";
198
+ CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.18";
199
199
  }
200
200
  }
201
201
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -2088,16 +2088,25 @@ class SnapshotHandler {
2088
2088
  res = await fetch(manifestUrl, {});
2089
2089
  }
2090
2090
  manifestJson = await res.json();
2091
- assert(manifestJson.metaData && manifestJson.exposes && manifestJson.shared, `${manifestUrl} is not a federation manifest`);
2092
- this.manifestCache.set(manifestUrl, manifestJson);
2093
- return manifestJson;
2094
2091
  } catch (err) {
2095
- delete this.manifestLoading[manifestUrl];
2096
- error(getShortErrorMsg(RUNTIME_003, runtimeDescMap, {
2097
- manifestUrl,
2098
- moduleName: moduleInfo.name
2099
- }, `${err}`));
2092
+ manifestJson = await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
2093
+ id: manifestUrl,
2094
+ error,
2095
+ from: 'runtime',
2096
+ lifecycle: 'afterResolve',
2097
+ origin: this.HostInstance
2098
+ });
2099
+ if (!manifestJson) {
2100
+ delete this.manifestLoading[manifestUrl];
2101
+ error(getShortErrorMsg(RUNTIME_003, runtimeDescMap, {
2102
+ manifestUrl,
2103
+ moduleName: moduleInfo.name
2104
+ }, `${err}`));
2105
+ }
2100
2106
  }
2107
+ assert(manifestJson.metaData && manifestJson.exposes && manifestJson.shared, `${manifestUrl} is not a federation manifest`);
2108
+ this.manifestCache.set(manifestUrl, manifestJson);
2109
+ return manifestJson;
2101
2110
  };
2102
2111
  const asyncLoadProcess = async ()=>{
2103
2112
  const manifestJson = await getManifest();
@@ -2951,7 +2960,7 @@ class FederationHost {
2951
2960
  // maybe will change, temporarily for internal use only
2952
2961
  initContainer: new AsyncWaterfallHook('initContainer')
2953
2962
  });
2954
- this.version = "0.6.16";
2963
+ this.version = "0.6.18";
2955
2964
  this.moduleCache = new Map();
2956
2965
  this.loaderHook = new PluginSystem({
2957
2966
  // FIXME: may not be suitable , not open to the public yet
@@ -57,7 +57,7 @@ export declare class RemoteHandler {
57
57
  error: unknown;
58
58
  options?: any;
59
59
  from: CallFrom;
60
- lifecycle: "onLoad" | "beforeRequest" | "beforeLoadShare";
60
+ lifecycle: "beforeRequest" | "beforeLoadShare" | "afterResolve" | "onLoad";
61
61
  origin: FederationHost;
62
62
  }], unknown>;
63
63
  beforePreloadRemote: AsyncHook<[{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime-core",
3
- "version": "0.6.16",
3
+ "version": "0.6.18",
4
4
  "author": "zhouxiao <codingzx@gmail.com>",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.mjs",
@@ -36,7 +36,7 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "@module-federation/sdk": "0.8.8",
40
- "@module-federation/error-codes": "0.8.8"
39
+ "@module-federation/sdk": "0.8.10",
40
+ "@module-federation/error-codes": "0.8.10"
41
41
  }
42
42
  }