@module-federation/runtime-core 0.0.0-next-20250910070153 → 0.0.0-next-20250916055342

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.
@@ -202,7 +202,7 @@ function getGlobalFederationConstructor() {
202
202
  function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
203
203
  if (isDebug) {
204
204
  CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
205
- CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.18.4";
205
+ CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.0-next-20250916055342";
206
206
  }
207
207
  }
208
208
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -1191,7 +1191,7 @@ function getRemoteEntryUniqueKey(remoteInfo) {
1191
1191
  return sdk.composeKeyWithSeparator(name, entry);
1192
1192
  }
1193
1193
  async function getRemoteEntry(params) {
1194
- const { origin, remoteEntryExports, remoteInfo, getEntryUrl } = params;
1194
+ const { origin, remoteEntryExports, remoteInfo, getEntryUrl, _inErrorHandling = false } = params;
1195
1195
  const uniqueKey = getRemoteEntryUniqueKey(remoteInfo);
1196
1196
  if (remoteEntryExports) {
1197
1197
  return remoteEntryExports;
@@ -1218,6 +1218,41 @@ async function getRemoteEntry(params) {
1218
1218
  remoteInfo,
1219
1219
  loaderHook
1220
1220
  });
1221
+ }).catch(async (err)=>{
1222
+ const uniqueKey = getRemoteEntryUniqueKey(remoteInfo);
1223
+ const isScriptLoadError = err instanceof Error && err.message.includes(errorCodes.RUNTIME_008);
1224
+ // Only call loadEntryError when not in error handling state to prevent recursion
1225
+ if (isScriptLoadError && !_inErrorHandling) {
1226
+ try {
1227
+ // Create a wrapped getRemoteEntry function with _inErrorHandling flag
1228
+ const wrappedGetRemoteEntry = (params)=>{
1229
+ return getRemoteEntry(polyfills._extends({}, params, {
1230
+ _inErrorHandling: true
1231
+ }));
1232
+ };
1233
+ const retryResult = await origin.loaderHook.lifecycle.loadEntryError.emit({
1234
+ getRemoteEntry: wrappedGetRemoteEntry,
1235
+ origin,
1236
+ remoteInfo: remoteInfo,
1237
+ remoteEntryExports,
1238
+ globalLoading,
1239
+ uniqueKey
1240
+ });
1241
+ // If retry returns a result (could be remote entry exports object or function)
1242
+ if (retryResult) {
1243
+ if (typeof retryResult === 'function') {
1244
+ return await retryResult();
1245
+ } else {
1246
+ return retryResult;
1247
+ }
1248
+ }
1249
+ } catch (retryError) {
1250
+ // If retry failed, throw retry error to preserve retry details
1251
+ throw retryError;
1252
+ }
1253
+ }
1254
+ // If no retry or retry didn't return result, throw original error
1255
+ throw err;
1221
1256
  });
1222
1257
  }
1223
1258
  return globalLoading[uniqueKey];
@@ -1439,20 +1474,7 @@ let Module = class Module {
1439
1474
  remoteInfo: this.remoteInfo,
1440
1475
  remoteEntryExports: this.remoteEntryExports
1441
1476
  });
1442
- } catch (err) {
1443
- const uniqueKey = getRemoteEntryUniqueKey(this.remoteInfo);
1444
- const isScriptLoadError = err instanceof Error && err.message.includes(errorCodes.RUNTIME_008);
1445
- if (isScriptLoadError) {
1446
- remoteEntryExports = await this.host.loaderHook.lifecycle.loadEntryError.emit({
1447
- getRemoteEntry,
1448
- origin: this.host,
1449
- remoteInfo: this.remoteInfo,
1450
- remoteEntryExports: this.remoteEntryExports,
1451
- globalLoading,
1452
- uniqueKey
1453
- });
1454
- }
1455
- }
1477
+ } catch (err) {}
1456
1478
  assert(remoteEntryExports, `remoteEntryExports is undefined \n ${sdk.safeToString(this.remoteInfo)}`);
1457
1479
  this.remoteEntryExports = remoteEntryExports;
1458
1480
  return this.remoteEntryExports;
@@ -3043,7 +3065,7 @@ class ModuleFederation {
3043
3065
  // maybe will change, temporarily for internal use only
3044
3066
  initContainer: new AsyncWaterfallHook('initContainer')
3045
3067
  });
3046
- this.version = "0.18.4";
3068
+ this.version = "0.0.0-next-20250916055342";
3047
3069
  this.moduleCache = new Map();
3048
3070
  this.loaderHook = new PluginSystem({
3049
3071
  // FIXME: may not be suitable , not open to the public yet