@module-federation/runtime-core 0.0.0-next-20250916081540 → 0.0.0-next-20250920011011

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.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { _ as _extends, a as _object_without_properties_loose } from './polyfills.esm.js';
2
2
  import { createLogger, isBrowserEnv, isReactNativeEnv, isDebugMode, composeKeyWithSeparator, loadScriptNode, loadScript, createLink, createScript, safeToString, getResourceUrl, isManifestProvider, generateSnapshotFromManifest, warn as warn$1 } from '@module-federation/sdk';
3
3
  export { loadScript, loadScriptNode } from '@module-federation/sdk';
4
- import { RUNTIME_008, getShortErrorMsg, runtimeDescMap, RUNTIME_001, RUNTIME_002, RUNTIME_007, RUNTIME_003, RUNTIME_005, RUNTIME_006, RUNTIME_004 } from '@module-federation/error-codes';
4
+ import { getShortErrorMsg, RUNTIME_008, runtimeDescMap, RUNTIME_001, RUNTIME_002, RUNTIME_007, RUNTIME_003, RUNTIME_005, RUNTIME_006, RUNTIME_004 } from '@module-federation/error-codes';
5
5
 
6
6
  const LOG_CATEGORY = '[ Federation Runtime ]';
7
7
  // FIXME: pre-bundle ?
@@ -201,7 +201,7 @@ function getGlobalFederationConstructor() {
201
201
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
202
202
  if (isDebug) {
203
203
  CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
204
- CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.0-next-20250916081540";
204
+ CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.0-next-20250920011011";
205
205
  }
206
206
  }
207
207
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -1190,7 +1190,7 @@ function getRemoteEntryUniqueKey(remoteInfo) {
1190
1190
  return composeKeyWithSeparator(name, entry);
1191
1191
  }
1192
1192
  async function getRemoteEntry(params) {
1193
- const { origin, remoteEntryExports, remoteInfo, getEntryUrl, _inErrorHandling = false } = params;
1193
+ const { origin, remoteEntryExports, remoteInfo, getEntryUrl } = params;
1194
1194
  const uniqueKey = getRemoteEntryUniqueKey(remoteInfo);
1195
1195
  if (remoteEntryExports) {
1196
1196
  return remoteEntryExports;
@@ -1217,41 +1217,6 @@ async function getRemoteEntry(params) {
1217
1217
  remoteInfo,
1218
1218
  loaderHook
1219
1219
  });
1220
- }).catch(async (err)=>{
1221
- const uniqueKey = getRemoteEntryUniqueKey(remoteInfo);
1222
- const isScriptLoadError = err instanceof Error && err.message.includes(RUNTIME_008);
1223
- // Only call loadEntryError when not in error handling state to prevent recursion
1224
- if (isScriptLoadError && !_inErrorHandling) {
1225
- try {
1226
- // Create a wrapped getRemoteEntry function with _inErrorHandling flag
1227
- const wrappedGetRemoteEntry = (params)=>{
1228
- return getRemoteEntry(_extends({}, params, {
1229
- _inErrorHandling: true
1230
- }));
1231
- };
1232
- const retryResult = await origin.loaderHook.lifecycle.loadEntryError.emit({
1233
- getRemoteEntry: wrappedGetRemoteEntry,
1234
- origin,
1235
- remoteInfo: remoteInfo,
1236
- remoteEntryExports,
1237
- globalLoading,
1238
- uniqueKey
1239
- });
1240
- // If retry returns a result (could be remote entry exports object or function)
1241
- if (retryResult) {
1242
- if (typeof retryResult === 'function') {
1243
- return await retryResult();
1244
- } else {
1245
- return retryResult;
1246
- }
1247
- }
1248
- } catch (retryError) {
1249
- // If retry failed, throw retry error to preserve retry details
1250
- throw retryError;
1251
- }
1252
- }
1253
- // If no retry or retry didn't return result, throw original error
1254
- throw err;
1255
1220
  });
1256
1221
  }
1257
1222
  return globalLoading[uniqueKey];
@@ -1473,7 +1438,20 @@ let Module = class Module {
1473
1438
  remoteInfo: this.remoteInfo,
1474
1439
  remoteEntryExports: this.remoteEntryExports
1475
1440
  });
1476
- } catch (err) {}
1441
+ } catch (err) {
1442
+ const uniqueKey = getRemoteEntryUniqueKey(this.remoteInfo);
1443
+ const isScriptLoadError = err instanceof Error && err.message.includes(RUNTIME_008);
1444
+ if (isScriptLoadError) {
1445
+ remoteEntryExports = await this.host.loaderHook.lifecycle.loadEntryError.emit({
1446
+ getRemoteEntry,
1447
+ origin: this.host,
1448
+ remoteInfo: this.remoteInfo,
1449
+ remoteEntryExports: this.remoteEntryExports,
1450
+ globalLoading,
1451
+ uniqueKey
1452
+ });
1453
+ }
1454
+ }
1477
1455
  assert(remoteEntryExports, `remoteEntryExports is undefined \n ${safeToString(this.remoteInfo)}`);
1478
1456
  this.remoteEntryExports = remoteEntryExports;
1479
1457
  return this.remoteEntryExports;
@@ -3064,7 +3042,7 @@ class ModuleFederation {
3064
3042
  // maybe will change, temporarily for internal use only
3065
3043
  initContainer: new AsyncWaterfallHook('initContainer')
3066
3044
  });
3067
- this.version = "0.0.0-next-20250916081540";
3045
+ this.version = "0.0.0-next-20250920011011";
3068
3046
  this.moduleCache = new Map();
3069
3047
  this.loaderHook = new PluginSystem({
3070
3048
  // FIXME: may not be suitable , not open to the public yet