@module-federation/bridge-react 0.18.0 → 0.18.1

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/{bridge-base-BoshEggF.mjs → bridge-base-BwHtOqw_.mjs} +1 -1
  3. package/dist/{bridge-base-UGCwcMnG.js → bridge-base-Ds850AOx.js} +1 -1
  4. package/dist/data-fetch-server-middleware.cjs.js +2 -2
  5. package/dist/data-fetch-server-middleware.es.js +2 -2
  6. package/dist/data-fetch-utils.cjs.js +2 -2
  7. package/dist/data-fetch-utils.es.js +4 -4
  8. package/dist/{index-C0fDZB5b.js → index-eN2xRRXs.js} +1 -1
  9. package/dist/{index-CqxytsLY.mjs → index-rAO0Wr0M.mjs} +1 -1
  10. package/dist/index.cjs.js +9 -7
  11. package/dist/index.es.js +9 -7
  12. package/dist/{index.esm-BCeUd-x9.mjs → index.esm-CtI0uQUR.mjs} +13 -1
  13. package/dist/{index.esm-j_1sIRzg.js → index.esm-Ju4RY-yW.js} +13 -1
  14. package/dist/{lazy-load-component-plugin-bvcZL_K6.mjs → lazy-load-component-plugin-B2SUeYm-.mjs} +2 -2
  15. package/dist/{lazy-load-component-plugin-BqBbq96C.js → lazy-load-component-plugin-CjgDjWep.js} +2 -2
  16. package/dist/lazy-load-component-plugin.cjs.js +2 -2
  17. package/dist/lazy-load-component-plugin.es.js +2 -2
  18. package/dist/lazy-utils.cjs.js +2 -2
  19. package/dist/lazy-utils.es.js +2 -2
  20. package/dist/{prefetch-DkCa_033.mjs → prefetch-CEqDjW2R.mjs} +21 -15
  21. package/dist/{prefetch-BdNDwnqI.js → prefetch-CzVHYHef.js} +21 -15
  22. package/dist/router-v5.cjs.js +1 -1
  23. package/dist/router-v5.es.js +1 -1
  24. package/dist/router-v6.cjs.js +1 -1
  25. package/dist/router-v6.es.js +1 -1
  26. package/dist/router.cjs.js +1 -1
  27. package/dist/router.es.js +1 -1
  28. package/dist/{utils-C4oPJV34.mjs → utils-VSOJTX_o.mjs} +1 -1
  29. package/dist/{utils-iEVlDmyk.js → utils-vIpCrZmn.js} +1 -1
  30. package/dist/v18.cjs.js +1 -1
  31. package/dist/v18.es.js +1 -1
  32. package/dist/v19.cjs.js +1 -1
  33. package/dist/v19.es.js +1 -1
  34. package/package.json +5 -5
  35. package/src/lazy/data-fetch/prefetch.ts +18 -12
  36. package/src/remote/component.tsx +4 -1
  37. package/src/remote/create.tsx +2 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @module-federation/bridge-react
2
2
 
3
+ ## 0.18.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 8004e95: fix(bridge-react): correct createRemoteComponent warning info
8
+ - 765b448: fix(bridge-react): call preloadAssets after getting assets
9
+ - Updated dependencies [0bf3a3a]
10
+ - @module-federation/sdk@0.18.1
11
+ - @module-federation/bridge-shared@0.18.1
12
+
3
13
  ## 0.18.0
4
14
 
5
15
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { Component, createElement, createContext } from "react";
3
- import { L as LoggerInstance, R as RouterContext } from "./index-CqxytsLY.mjs";
3
+ import { L as LoggerInstance, R as RouterContext } from "./index-rAO0Wr0M.mjs";
4
4
  import { federationRuntime } from "./plugin.es.js";
5
5
  const ErrorBoundaryContext = createContext(null);
6
6
  const initialState = {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const React = require("react");
3
- const index = require("./index-C0fDZB5b.js");
3
+ const index = require("./index-eN2xRRXs.js");
4
4
  const plugin = require("./plugin.cjs.js");
5
5
  function _interopNamespaceDefault(e) {
6
6
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const lazyUtils = require("./utils-iEVlDmyk.js");
3
- const index_esm = require("./index.esm-j_1sIRzg.js");
2
+ const lazyUtils = require("./utils-vIpCrZmn.js");
3
+ const index_esm = require("./index.esm-Ju4RY-yW.js");
4
4
  function wrapSetTimeout(targetPromise, delay = 2e4, id) {
5
5
  if (targetPromise && typeof targetPromise.then === "function") {
6
6
  return new Promise((resolve, reject) => {
@@ -1,5 +1,5 @@
1
- import { D as DATA_FETCH_QUERY, l as logger, g as getDataFetchMap, i as initDataFetchMap, M as MF_DATA_FETCH_STATUS, f as fetchData, a as loadDataFetchModule } from "./utils-C4oPJV34.mjs";
2
- import { M as MANIFEST_EXT, S as SEPARATOR } from "./index.esm-BCeUd-x9.mjs";
1
+ import { D as DATA_FETCH_QUERY, l as logger, g as getDataFetchMap, i as initDataFetchMap, M as MF_DATA_FETCH_STATUS, f as fetchData, a as loadDataFetchModule } from "./utils-VSOJTX_o.mjs";
2
+ import { M as MANIFEST_EXT, S as SEPARATOR } from "./index.esm-CtI0uQUR.mjs";
3
3
  function wrapSetTimeout(targetPromise, delay = 2e4, id) {
4
4
  if (targetPromise && typeof targetPromise.then === "function") {
5
5
  return new Promise((resolve, reject) => {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const lazyUtils = require("./utils-iEVlDmyk.js");
4
- const prefetch = require("./prefetch-BdNDwnqI.js");
3
+ const lazyUtils = require("./utils-vIpCrZmn.js");
4
+ const prefetch = require("./prefetch-CzVHYHef.js");
5
5
  async function callDataFetch() {
6
6
  const dataFetch = globalThis[lazyUtils.DATA_FETCH_FUNCTION];
7
7
  if (dataFetch) {
@@ -1,7 +1,7 @@
1
- import { x as DATA_FETCH_FUNCTION } from "./utils-C4oPJV34.mjs";
2
- import { C, b, e, h, c, d, r } from "./utils-C4oPJV34.mjs";
3
- import { d as dataFetchFunction } from "./prefetch-DkCa_033.mjs";
4
- import { i, p } from "./prefetch-DkCa_033.mjs";
1
+ import { x as DATA_FETCH_FUNCTION } from "./utils-VSOJTX_o.mjs";
2
+ import { C, b, e, h, c, d, r } from "./utils-VSOJTX_o.mjs";
3
+ import { d as dataFetchFunction } from "./prefetch-CEqDjW2R.mjs";
4
+ import { i, p } from "./prefetch-CEqDjW2R.mjs";
5
5
  async function callDataFetch() {
6
6
  const dataFetch = globalThis[DATA_FETCH_FUNCTION];
7
7
  if (dataFetch) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const React = require("react");
3
- const index_esm = require("./index.esm-j_1sIRzg.js");
3
+ const index_esm = require("./index.esm-Ju4RY-yW.js");
4
4
  const RouterContext = React.createContext(null);
5
5
  const LoggerInstance = index_esm.createLogger(
6
6
  "[ Module Federation Bridge React ]"
@@ -1,5 +1,5 @@
1
1
  import React__default from "react";
2
- import { c as createLogger } from "./index.esm-BCeUd-x9.mjs";
2
+ import { c as createLogger } from "./index.esm-CtI0uQUR.mjs";
3
3
  const RouterContext = React__default.createContext(null);
4
4
  const LoggerInstance = createLogger(
5
5
  "[ Module Federation Bridge React ]"
package/dist/index.cjs.js CHANGED
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const bridgeBase = require("./bridge-base-UGCwcMnG.js");
3
+ const bridgeBase = require("./bridge-base-Ds850AOx.js");
4
4
  const ReactDOM = require("react-dom");
5
5
  const React = require("react");
6
- const index = require("./index-C0fDZB5b.js");
6
+ const index = require("./index-eN2xRRXs.js");
7
7
  const ReactRouterDOM = require("react-router-dom");
8
8
  const plugin = require("./plugin.cjs.js");
9
- const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-BqBbq96C.js");
10
- const lazyUtils = require("./utils-iEVlDmyk.js");
9
+ const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-CjgDjWep.js");
10
+ const lazyUtils = require("./utils-vIpCrZmn.js");
11
11
  const dataFetchUtils = require("./data-fetch-utils.cjs.js");
12
- const prefetch = require("./prefetch-BdNDwnqI.js");
12
+ const prefetch = require("./prefetch-CzVHYHef.js");
13
13
  function _interopNamespaceDefault(e2) {
14
14
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
15
15
  if (e2) {
@@ -70,6 +70,7 @@ const RemoteAppWrapper = React.forwardRef(function(props, ref) {
70
70
  className,
71
71
  style,
72
72
  fallback,
73
+ loading,
73
74
  ...resProps
74
75
  } = props;
75
76
  const instance = plugin.federationRuntime.instance;
@@ -131,7 +132,7 @@ const RemoteAppWrapper = React.forwardRef(function(props, ref) {
131
132
  (_f = (_e = (_d = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeRender) == null ? void 0 : _f.emit(renderProps);
132
133
  }, [initialized, ...Object.values(props)]);
133
134
  const rootComponentClassName = `${index.getRootDomDefaultClassName(moduleName)} ${className || ""}`;
134
- return /* @__PURE__ */ React.createElement("div", { className: rootComponentClassName, style, ref: rootRef });
135
+ return /* @__PURE__ */ React.createElement("div", { className: rootComponentClassName, style, ref: rootRef }, loading);
135
136
  });
136
137
  function withRouterData(WrappedComponent) {
137
138
  const Component = React.forwardRef(function(props, ref) {
@@ -229,6 +230,7 @@ function createLazyRemoteComponent(info) {
229
230
  providerInfo: exportFn,
230
231
  exportName: info.export || "default",
231
232
  fallback: info.fallback,
233
+ loading: info.loading,
232
234
  ref,
233
235
  ...props
234
236
  }
@@ -267,7 +269,7 @@ function createRemoteAppComponent(info) {
267
269
  }
268
270
  function createRemoteComponent(info) {
269
271
  index.LoggerInstance.warn(
270
- `createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!`
272
+ `createRemoteComponent is deprecated, please use createRemoteAppComponent instead!`
271
273
  );
272
274
  return createRemoteAppComponent(info);
273
275
  }
package/dist/index.es.js CHANGED
@@ -1,13 +1,13 @@
1
- import { c as createBaseBridgeComponent, E as ErrorBoundary } from "./bridge-base-BoshEggF.mjs";
1
+ import { c as createBaseBridgeComponent, E as ErrorBoundary } from "./bridge-base-BwHtOqw_.mjs";
2
2
  import ReactDOM from "react-dom";
3
3
  import React__default, { forwardRef, useContext, useState, useEffect, useRef } from "react";
4
- import { p as pathJoin, L as LoggerInstance, g as getRootDomDefaultClassName } from "./index-CqxytsLY.mjs";
4
+ import { p as pathJoin, L as LoggerInstance, g as getRootDomDefaultClassName } from "./index-rAO0Wr0M.mjs";
5
5
  import * as ReactRouterDOM from "react-router-dom";
6
6
  import { federationRuntime } from "./plugin.es.js";
7
- import { b, a, c, l } from "./lazy-load-component-plugin-bvcZL_K6.mjs";
8
- import { C, b as b2, E, e, h, c as c2, d, r, s } from "./utils-C4oPJV34.mjs";
7
+ import { b, a, c, l } from "./lazy-load-component-plugin-B2SUeYm-.mjs";
8
+ import { C, b as b2, E, e, h, c as c2, d, r, s } from "./utils-VSOJTX_o.mjs";
9
9
  import { callDataFetch } from "./data-fetch-utils.es.js";
10
- import { p } from "./prefetch-DkCa_033.mjs";
10
+ import { p } from "./prefetch-CEqDjW2R.mjs";
11
11
  function createReact16Or17Root(container) {
12
12
  return {
13
13
  render(children) {
@@ -51,6 +51,7 @@ const RemoteAppWrapper = forwardRef(function(props, ref) {
51
51
  className,
52
52
  style,
53
53
  fallback,
54
+ loading,
54
55
  ...resProps
55
56
  } = props;
56
57
  const instance = federationRuntime.instance;
@@ -112,7 +113,7 @@ const RemoteAppWrapper = forwardRef(function(props, ref) {
112
113
  (_f = (_e = (_d = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeRender) == null ? void 0 : _f.emit(renderProps);
113
114
  }, [initialized, ...Object.values(props)]);
114
115
  const rootComponentClassName = `${getRootDomDefaultClassName(moduleName)} ${className || ""}`;
115
- return /* @__PURE__ */ React__default.createElement("div", { className: rootComponentClassName, style, ref: rootRef });
116
+ return /* @__PURE__ */ React__default.createElement("div", { className: rootComponentClassName, style, ref: rootRef }, loading);
116
117
  });
117
118
  function withRouterData(WrappedComponent) {
118
119
  const Component = forwardRef(function(props, ref) {
@@ -210,6 +211,7 @@ function createLazyRemoteComponent(info) {
210
211
  providerInfo: exportFn,
211
212
  exportName: info.export || "default",
212
213
  fallback: info.fallback,
214
+ loading: info.loading,
213
215
  ref,
214
216
  ...props
215
217
  }
@@ -248,7 +250,7 @@ function createRemoteAppComponent(info) {
248
250
  }
249
251
  function createRemoteComponent(info) {
250
252
  LoggerInstance.warn(
251
- `createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!`
253
+ `createRemoteComponent is deprecated, please use createRemoteAppComponent instead!`
252
254
  );
253
255
  return createRemoteAppComponent(info);
254
256
  }
@@ -270,15 +270,22 @@ function loadScript(url2, info) {
270
270
  needAttach && document.head.appendChild(script2);
271
271
  });
272
272
  }
273
+ const sdkImportCache = /* @__PURE__ */ new Map();
273
274
  function importNodeModule(name) {
274
275
  if (!name) {
275
276
  throw new Error("import specifier is required");
276
277
  }
278
+ if (sdkImportCache.has(name)) {
279
+ return sdkImportCache.get(name);
280
+ }
277
281
  const importModule = new Function("name", `return import(name)`);
278
- return importModule(name).then((res2) => res2).catch((error) => {
282
+ const promise = importModule(name).then((res2) => res2).catch((error) => {
279
283
  console.error(`Error importing module ${name}:`, error);
284
+ sdkImportCache.delete(name);
280
285
  throw error;
281
286
  });
287
+ sdkImportCache.set(name, promise);
288
+ return promise;
282
289
  }
283
290
  const loadNodeFetch = async () => {
284
291
  const fetchModule = await importNodeModule("node-fetch");
@@ -386,7 +393,11 @@ const loadScriptNode = typeof ENV_TARGET === "undefined" || ENV_TARGET !== "web"
386
393
  } : (url2, info) => {
387
394
  throw new Error("loadScriptNode is disabled in non-Node.js environment");
388
395
  };
396
+ const esmModuleCache = /* @__PURE__ */ new Map();
389
397
  async function loadModule(url2, options) {
398
+ if (esmModuleCache.has(url2)) {
399
+ return esmModuleCache.get(url2);
400
+ }
390
401
  const { fetch: fetch1, vm: vm2 } = options;
391
402
  const response = await fetch1(url2);
392
403
  const code = await response.text();
@@ -397,6 +408,7 @@ async function loadModule(url2, options) {
397
408
  return loadModule(resolvedUrl, options);
398
409
  }
399
410
  });
411
+ esmModuleCache.set(url2, module);
400
412
  await module.link(async (specifier) => {
401
413
  const resolvedUrl = new URL(specifier, url2).href;
402
414
  const module2 = await loadModule(resolvedUrl, options);
@@ -271,15 +271,22 @@ function loadScript(url2, info) {
271
271
  needAttach && document.head.appendChild(script2);
272
272
  });
273
273
  }
274
+ const sdkImportCache = /* @__PURE__ */ new Map();
274
275
  function importNodeModule(name) {
275
276
  if (!name) {
276
277
  throw new Error("import specifier is required");
277
278
  }
279
+ if (sdkImportCache.has(name)) {
280
+ return sdkImportCache.get(name);
281
+ }
278
282
  const importModule = new Function("name", `return import(name)`);
279
- return importModule(name).then((res2) => res2).catch((error) => {
283
+ const promise = importModule(name).then((res2) => res2).catch((error) => {
280
284
  console.error(`Error importing module ${name}:`, error);
285
+ sdkImportCache.delete(name);
281
286
  throw error;
282
287
  });
288
+ sdkImportCache.set(name, promise);
289
+ return promise;
283
290
  }
284
291
  const loadNodeFetch = async () => {
285
292
  const fetchModule = await importNodeModule("node-fetch");
@@ -387,7 +394,11 @@ const loadScriptNode = typeof ENV_TARGET === "undefined" || ENV_TARGET !== "web"
387
394
  } : (url2, info) => {
388
395
  throw new Error("loadScriptNode is disabled in non-Node.js environment");
389
396
  };
397
+ const esmModuleCache = /* @__PURE__ */ new Map();
390
398
  async function loadModule(url2, options) {
399
+ if (esmModuleCache.has(url2)) {
400
+ return esmModuleCache.get(url2);
401
+ }
391
402
  const { fetch: fetch1, vm: vm2 } = options;
392
403
  const response = await fetch1(url2);
393
404
  const code = await response.text();
@@ -398,6 +409,7 @@ async function loadModule(url2, options) {
398
409
  return loadModule(resolvedUrl, options);
399
410
  }
400
411
  });
412
+ esmModuleCache.set(url2, module2);
401
413
  await module2.link(async (specifier) => {
402
414
  const resolvedUrl = new URL(specifier, url2).href;
403
415
  const module3 = await loadModule(resolvedUrl, options);
@@ -1,5 +1,5 @@
1
- import { i as injectDataFetch, p as prefetch } from "./prefetch-DkCa_033.mjs";
2
- import { i as initDataFetchMap, j as isDataLoaderExpose, k as getDataFetchInfo, m as getDataFetchMapKey, l as logger, n as getDataFetchItem, o as DATA_FETCH_CLIENT_SUFFIX, p as MF_DATA_FETCH_TYPE, q as isCSROnly, a as loadDataFetchModule, M as MF_DATA_FETCH_STATUS, g as getDataFetchMap, t as isServerEnv, u as getDataFetchIdWithErrorMsgs, v as DATA_FETCH_ERROR_PREFIX, E as ERROR_TYPE, w as wrapDataFetchId, L as LOAD_REMOTE_ERROR_PREFIX, x as DATA_FETCH_FUNCTION, y as getLoadedRemoteInfos, f as fetchData$1, z as setDataFetchItemLoadedStatus, F as FS_HREF } from "./utils-C4oPJV34.mjs";
1
+ import { i as injectDataFetch, p as prefetch } from "./prefetch-CEqDjW2R.mjs";
2
+ import { i as initDataFetchMap, j as isDataLoaderExpose, k as getDataFetchInfo, m as getDataFetchMapKey, l as logger, n as getDataFetchItem, o as DATA_FETCH_CLIENT_SUFFIX, p as MF_DATA_FETCH_TYPE, q as isCSROnly, a as loadDataFetchModule, M as MF_DATA_FETCH_STATUS, g as getDataFetchMap, t as isServerEnv, u as getDataFetchIdWithErrorMsgs, v as DATA_FETCH_ERROR_PREFIX, E as ERROR_TYPE, w as wrapDataFetchId, L as LOAD_REMOTE_ERROR_PREFIX, x as DATA_FETCH_FUNCTION, y as getLoadedRemoteInfos, f as fetchData$1, z as setDataFetchItemLoadedStatus, F as FS_HREF } from "./utils-VSOJTX_o.mjs";
3
3
  import React__default, { useRef, useState, Suspense, useEffect } from "react";
4
4
  const autoFetchData = () => {
5
5
  initDataFetchMap();
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const prefetch = require("./prefetch-BdNDwnqI.js");
3
- const lazyUtils = require("./utils-iEVlDmyk.js");
2
+ const prefetch = require("./prefetch-CzVHYHef.js");
3
+ const lazyUtils = require("./utils-vIpCrZmn.js");
4
4
  const React = require("react");
5
5
  const autoFetchData = () => {
6
6
  lazyUtils.initDataFetchMap();
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-BqBbq96C.js");
4
- require("./prefetch-BdNDwnqI.js");
3
+ const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-CjgDjWep.js");
4
+ require("./prefetch-CzVHYHef.js");
5
5
  exports.default = lazyLoadComponentPlugin.lazyLoadComponentPlugin;
6
6
  exports.lazyLoadComponentPlugin = lazyLoadComponentPlugin.lazyLoadComponentPlugin;
@@ -1,5 +1,5 @@
1
- import { l, l as l2 } from "./lazy-load-component-plugin-bvcZL_K6.mjs";
2
- import "./prefetch-DkCa_033.mjs";
1
+ import { l, l as l2 } from "./lazy-load-component-plugin-B2SUeYm-.mjs";
2
+ import "./prefetch-CEqDjW2R.mjs";
3
3
  export {
4
4
  l as default,
5
5
  l2 as lazyLoadComponentPlugin
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- require("./index.esm-j_1sIRzg.js");
4
- const lazyUtils = require("./utils-iEVlDmyk.js");
3
+ require("./index.esm-Ju4RY-yW.js");
4
+ const lazyUtils = require("./utils-vIpCrZmn.js");
5
5
  exports.callAllDowngrade = lazyUtils.callAllDowngrade;
6
6
  exports.callDowngrade = lazyUtils.callDowngrade;
7
7
  exports.fetchData = lazyUtils.fetchData;
@@ -1,5 +1,5 @@
1
- import "./index.esm-BCeUd-x9.mjs";
2
- import { G, H, f, J, I, u, k, n, g, m, B, y, i, q, j, t, a, z, s, w } from "./utils-C4oPJV34.mjs";
1
+ import "./index.esm-CtI0uQUR.mjs";
2
+ import { G, H, f, J, I, u, k, n, g, m, B, y, i, q, j, t, a, z, s, w } from "./utils-VSOJTX_o.mjs";
3
3
  export {
4
4
  G as callAllDowngrade,
5
5
  H as callDowngrade,
@@ -1,5 +1,5 @@
1
- import { x as DATA_FETCH_FUNCTION, F as FS_HREF, l as logger$1, g as getDataFetchMap, i as initDataFetchMap, n as getDataFetchItem, M as MF_DATA_FETCH_STATUS, p as MF_DATA_FETCH_TYPE, A as DOWNGRADE_KEY, B as getDowngradeTag, G as callAllDowngrade, H as callDowngrade, k as getDataFetchInfo, m as getDataFetchMapKey } from "./utils-C4oPJV34.mjs";
2
- import { b as isDebugMode, c as createLogger, d as createLink, e as createScript, i as isBrowserEnv, a as composeKeyWithSeparator, l as loadScriptNode, f as loadScript } from "./index.esm-BCeUd-x9.mjs";
1
+ import { x as DATA_FETCH_FUNCTION, F as FS_HREF, l as logger$1, g as getDataFetchMap, i as initDataFetchMap, n as getDataFetchItem, M as MF_DATA_FETCH_STATUS, p as MF_DATA_FETCH_TYPE, A as DOWNGRADE_KEY, B as getDowngradeTag, G as callAllDowngrade, H as callDowngrade, k as getDataFetchInfo, m as getDataFetchMapKey } from "./utils-VSOJTX_o.mjs";
2
+ import { b as isDebugMode, c as createLogger, d as createLink, e as createScript, i as isBrowserEnv, a as composeKeyWithSeparator, l as loadScriptNode, f as loadScript } from "./index.esm-CtI0uQUR.mjs";
3
3
  const dataFetchFunction = async function(options) {
4
4
  var _a, _b;
5
5
  const [id, data, downgrade] = options;
@@ -270,7 +270,7 @@ function getGlobalFederationConstructor() {
270
270
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
271
271
  if (isDebug) {
272
272
  CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
273
- CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.18.0";
273
+ CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.18.1";
274
274
  }
275
275
  }
276
276
  function getInfoWithoutType(target, key) {
@@ -1280,19 +1280,25 @@ async function prefetch(options) {
1280
1280
  });
1281
1281
  if (preloadComponentResource) {
1282
1282
  const remoteInfo = helpers.utils.getRemoteInfo(remote);
1283
- instance.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({
1284
- origin: instance,
1285
- preloadOptions: {
1283
+ Promise.resolve(
1284
+ instance.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({
1285
+ origin: instance,
1286
+ preloadOptions: {
1287
+ remote,
1288
+ preloadConfig: {
1289
+ nameOrAlias: remote.name,
1290
+ exposes: [expose]
1291
+ }
1292
+ },
1286
1293
  remote,
1287
- preloadConfig: {
1288
- nameOrAlias: remote.name,
1289
- exposes: [expose]
1290
- }
1291
- },
1292
- remote,
1293
- remoteInfo,
1294
- globalSnapshot,
1295
- remoteSnapshot
1294
+ remoteInfo,
1295
+ globalSnapshot,
1296
+ remoteSnapshot
1297
+ })
1298
+ ).then((assets) => {
1299
+ if (assets) {
1300
+ helpers.utils.preloadAssets(remoteInfo, instance, assets);
1301
+ }
1296
1302
  });
1297
1303
  }
1298
1304
  const dataFetchMap = getDataFetchMap();
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const lazyUtils = require("./utils-iEVlDmyk.js");
3
- const index_esm = require("./index.esm-j_1sIRzg.js");
2
+ const lazyUtils = require("./utils-vIpCrZmn.js");
3
+ const index_esm = require("./index.esm-Ju4RY-yW.js");
4
4
  const dataFetchFunction = async function(options) {
5
5
  var _a, _b;
6
6
  const [id, data, downgrade] = options;
@@ -271,7 +271,7 @@ function getGlobalFederationConstructor() {
271
271
  function setGlobalFederationConstructor(FederationConstructor, isDebug = index_esm.isDebugMode()) {
272
272
  if (isDebug) {
273
273
  CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
274
- CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.18.0";
274
+ CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.18.1";
275
275
  }
276
276
  }
277
277
  function getInfoWithoutType(target, key) {
@@ -1281,19 +1281,25 @@ async function prefetch(options) {
1281
1281
  });
1282
1282
  if (preloadComponentResource) {
1283
1283
  const remoteInfo = helpers.utils.getRemoteInfo(remote);
1284
- instance.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({
1285
- origin: instance,
1286
- preloadOptions: {
1284
+ Promise.resolve(
1285
+ instance.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({
1286
+ origin: instance,
1287
+ preloadOptions: {
1288
+ remote,
1289
+ preloadConfig: {
1290
+ nameOrAlias: remote.name,
1291
+ exposes: [expose]
1292
+ }
1293
+ },
1287
1294
  remote,
1288
- preloadConfig: {
1289
- nameOrAlias: remote.name,
1290
- exposes: [expose]
1291
- }
1292
- },
1293
- remote,
1294
- remoteInfo,
1295
- globalSnapshot,
1296
- remoteSnapshot
1295
+ remoteInfo,
1296
+ globalSnapshot,
1297
+ remoteSnapshot
1298
+ })
1299
+ ).then((assets) => {
1300
+ if (assets) {
1301
+ helpers.utils.preloadAssets(remoteInfo, instance, assets);
1302
+ }
1297
1303
  });
1298
1304
  }
1299
1305
  const dataFetchMap = lazyUtils.getDataFetchMap();
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const React = require("react");
4
4
  const ReactRouterDom$1 = require("react-router-dom/index.js");
5
- const index = require("./index-C0fDZB5b.js");
5
+ const index = require("./index-eN2xRRXs.js");
6
6
  const ReactRouterDom = require("react-router-dom/index.js");
7
7
  function _interopNamespaceDefault(e) {
8
8
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -1,6 +1,6 @@
1
1
  import React__default, { useContext } from "react";
2
2
  import * as ReactRouterDom$1 from "react-router-dom/index.js";
3
- import { R as RouterContext, L as LoggerInstance } from "./index-CqxytsLY.mjs";
3
+ import { R as RouterContext, L as LoggerInstance } from "./index-rAO0Wr0M.mjs";
4
4
  export * from "react-router-dom/index.js";
5
5
  function WraperRouter(props) {
6
6
  const { basename, ...propsRes } = props;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const React = require("react");
4
4
  const ReactRouterDom$1 = require("react-router-dom/dist/index.js");
5
- const index = require("./index-C0fDZB5b.js");
5
+ const index = require("./index-eN2xRRXs.js");
6
6
  const ReactRouterDom = require("react-router-dom/dist/index.js");
7
7
  function _interopNamespaceDefault(e) {
8
8
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -1,6 +1,6 @@
1
1
  import React__default, { useContext } from "react";
2
2
  import * as ReactRouterDom$1 from "react-router-dom/dist/index.js";
3
- import { R as RouterContext, L as LoggerInstance } from "./index-CqxytsLY.mjs";
3
+ import { R as RouterContext, L as LoggerInstance } from "./index-rAO0Wr0M.mjs";
4
4
  export * from "react-router-dom/dist/index.js";
5
5
  function WraperRouter(props) {
6
6
  const { basename, ...propsRes } = props;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const React = require("react");
4
4
  const ReactRouterDom = require("react-router-dom/");
5
- const index = require("./index-C0fDZB5b.js");
5
+ const index = require("./index-eN2xRRXs.js");
6
6
  function _interopNamespaceDefault(e) {
7
7
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
8
  if (e) {
package/dist/router.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import React__default, { useContext } from "react";
2
2
  import * as ReactRouterDom from "react-router-dom/";
3
3
  export * from "react-router-dom/";
4
- import { R as RouterContext, L as LoggerInstance } from "./index-CqxytsLY.mjs";
4
+ import { R as RouterContext, L as LoggerInstance } from "./index-rAO0Wr0M.mjs";
5
5
  function WrapperRouter(props) {
6
6
  const { basename, ...propsRes } = props;
7
7
  const routerContextProps = useContext(RouterContext) || {};
@@ -18,7 +18,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
18
18
  }
19
19
  });
20
20
  var _a, _constructing, _b, _c, _max, _maxSize, _dispose, _disposeAfter, _fetchMethod, _memoMethod, _size, _calculatedSize, _keyMap, _keyList, _valList, _next, _prev, _head, _tail, _free, _disposed, _sizes, _starts, _ttls, _hasDispose, _hasFetchMethod, _hasDisposeAfter, _LRUCache_instances, initializeTTLTracking_fn, _updateItemAge, _statusTTL, _setItemTTL, _isStale, initializeSizeTracking_fn, _removeItemSize, _addItemSize, _requireSize, indexes_fn, rindexes_fn, isValidIndex_fn, evict_fn, backgroundFetch_fn, isBackgroundFetch_fn, connect_fn, moveToTail_fn, delete_fn, clear_fn;
21
- import { c as createLogger, i as isBrowserEnv, a as composeKeyWithSeparator } from "./index.esm-BCeUd-x9.mjs";
21
+ import { c as createLogger, i as isBrowserEnv, a as composeKeyWithSeparator } from "./index.esm-CtI0uQUR.mjs";
22
22
  const PLUGIN_IDENTIFIER = "[ Module Federation React ]";
23
23
  const DOWNGRADE_KEY = "_mfSSRDowngrade";
24
24
  const DATA_FETCH_FUNCTION = "_mfDataFetch";
@@ -19,7 +19,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
19
19
  }
20
20
  });
21
21
  var _a, _constructing, _b, _c, _max, _maxSize, _dispose, _disposeAfter, _fetchMethod, _memoMethod, _size, _calculatedSize, _keyMap, _keyList, _valList, _next, _prev, _head, _tail, _free, _disposed, _sizes, _starts, _ttls, _hasDispose, _hasFetchMethod, _hasDisposeAfter, _LRUCache_instances, initializeTTLTracking_fn, _updateItemAge, _statusTTL, _setItemTTL, _isStale, initializeSizeTracking_fn, _removeItemSize, _addItemSize, _requireSize, indexes_fn, rindexes_fn, isValidIndex_fn, evict_fn, backgroundFetch_fn, isBackgroundFetch_fn, connect_fn, moveToTail_fn, delete_fn, clear_fn;
22
- const index_esm = require("./index.esm-j_1sIRzg.js");
22
+ const index_esm = require("./index.esm-Ju4RY-yW.js");
23
23
  const PLUGIN_IDENTIFIER = "[ Module Federation React ]";
24
24
  const DOWNGRADE_KEY = "_mfSSRDowngrade";
25
25
  const DATA_FETCH_FUNCTION = "_mfDataFetch";
package/dist/v18.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const client = require("react-dom/client");
4
- const bridgeBase = require("./bridge-base-UGCwcMnG.js");
4
+ const bridgeBase = require("./bridge-base-Ds850AOx.js");
5
5
  function createReact18Root(container, options) {
6
6
  return client.createRoot(container, options);
7
7
  }
package/dist/v18.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createRoot } from "react-dom/client";
2
- import { c as createBaseBridgeComponent } from "./bridge-base-BoshEggF.mjs";
2
+ import { c as createBaseBridgeComponent } from "./bridge-base-BwHtOqw_.mjs";
3
3
  function createReact18Root(container, options) {
4
4
  return createRoot(container, options);
5
5
  }
package/dist/v19.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const client = require("react-dom/client");
4
- const bridgeBase = require("./bridge-base-UGCwcMnG.js");
4
+ const bridgeBase = require("./bridge-base-Ds850AOx.js");
5
5
  function createReact19Root(container, options) {
6
6
  return client.createRoot(container, options);
7
7
  }
package/dist/v19.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createRoot } from "react-dom/client";
2
- import { c as createBaseBridgeComponent } from "./bridge-base-BoshEggF.mjs";
2
+ import { c as createBaseBridgeComponent } from "./bridge-base-BwHtOqw_.mjs";
3
3
  function createReact19Root(container, options) {
4
4
  return createRoot(container, options);
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/bridge-react",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "sideEffects": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -95,8 +95,8 @@
95
95
  "dependencies": {
96
96
  "react-error-boundary": "^4.1.2",
97
97
  "lru-cache": "^10.4.3",
98
- "@module-federation/bridge-shared": "0.18.0",
99
- "@module-federation/sdk": "0.18.0"
98
+ "@module-federation/bridge-shared": "0.18.1",
99
+ "@module-federation/sdk": "0.18.1"
100
100
  },
101
101
  "peerDependencies": {
102
102
  "react": ">=16.9.0",
@@ -118,8 +118,8 @@
118
118
  "vite": "^5.4.18",
119
119
  "vite-plugin-dts": "^4.3.0",
120
120
  "hono": "3.12.12",
121
- "@module-federation/runtime": "0.18.0",
122
- "@module-federation/runtime-core": "0.18.0"
121
+ "@module-federation/runtime": "0.18.1",
122
+ "@module-federation/runtime-core": "0.18.1"
123
123
  },
124
124
  "scripts": {
125
125
  "dev": "vite",
@@ -44,19 +44,25 @@ export async function prefetch(options: PrefetchOptions) {
44
44
  if (preloadComponentResource) {
45
45
  const remoteInfo = helpers.utils.getRemoteInfo(remote);
46
46
 
47
- instance.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({
48
- origin: instance,
49
- preloadOptions: {
50
- remote,
51
- preloadConfig: {
52
- nameOrAlias: remote.name,
53
- exposes: [expose],
47
+ Promise.resolve(
48
+ instance.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({
49
+ origin: instance,
50
+ preloadOptions: {
51
+ remote,
52
+ preloadConfig: {
53
+ nameOrAlias: remote.name,
54
+ exposes: [expose],
55
+ },
54
56
  },
55
- },
56
- remote,
57
- remoteInfo,
58
- globalSnapshot,
59
- remoteSnapshot,
57
+ remote,
58
+ remoteInfo,
59
+ globalSnapshot,
60
+ remoteSnapshot,
61
+ }),
62
+ ).then((assets) => {
63
+ if (assets) {
64
+ helpers.utils.preloadAssets(remoteInfo, instance, assets);
65
+ }
60
66
  });
61
67
  }
62
68
 
@@ -23,6 +23,7 @@ const RemoteAppWrapper = forwardRef(function (
23
23
  className,
24
24
  style,
25
25
  fallback,
26
+ loading,
26
27
  ...resProps
27
28
  } = props;
28
29
 
@@ -104,7 +105,9 @@ const RemoteAppWrapper = forwardRef(function (
104
105
  // bridge-remote-root
105
106
  const rootComponentClassName = `${getRootDomDefaultClassName(moduleName)} ${className || ''}`;
106
107
  return (
107
- <div className={rootComponentClassName} style={style} ref={rootRef}></div>
108
+ <div className={rootComponentClassName} style={style} ref={rootRef}>
109
+ {loading}
110
+ </div>
108
111
  );
109
112
  });
110
113
 
@@ -44,6 +44,7 @@ function createLazyRemoteComponent<
44
44
  providerInfo={exportFn}
45
45
  exportName={info.export || 'default'}
46
46
  fallback={info.fallback}
47
+ loading={info.loading}
47
48
  ref={ref}
48
49
  {...props}
49
50
  />
@@ -96,7 +97,7 @@ export function createRemoteComponent<
96
97
  E extends keyof T = keyof T,
97
98
  >(info: LazyRemoteComponentInfo<T, E>) {
98
99
  LoggerInstance.warn(
99
- `createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!`,
100
+ `createRemoteComponent is deprecated, please use createRemoteAppComponent instead!`,
100
101
  );
101
102
  return createRemoteAppComponent(info);
102
103
  }