@module-federation/bridge-react 2.8.0 → 2.8.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.
package/dist/base.cjs.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const createHelpers = require("./createHelpers-19BP0xtB.js");
4
- const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-FKp6nQa-.js");
4
+ const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-DBTxuAYf.js");
5
5
  const lazyUtils = require("./utils-5dGErM3C.js");
6
6
  const dataFetchUtils = require("./data-fetch-utils.cjs.js");
7
- const prefetch = require("./prefetch-D66kL1aM.js");
7
+ const prefetch = require("./prefetch-QJLnti7A.js");
8
8
  const createRemoteAppComponent = createHelpers.createRemoteAppComponentFactory(createHelpers.RemoteAppWrapper);
9
9
  const createRemoteComponent = createHelpers.createDeprecatedRemoteComponentFactory(
10
10
  createRemoteAppComponent
package/dist/base.es.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { c as createRemoteAppComponentFactory, a as createDeprecatedRemoteComponentFactory, R as RemoteAppWrapper } from "./createHelpers-BSHeKyd-.mjs";
2
2
  import { b } from "./createHelpers-BSHeKyd-.mjs";
3
- import { a, c, b as b2, l } from "./lazy-load-component-plugin-DEu-DfZt.mjs";
3
+ import { a, c, b as b2, l } from "./lazy-load-component-plugin-DlagtX0O.mjs";
4
4
  import { C, a as a2, E, c as c2, b as b3, d, g, r, s } from "./utils-BBP3hEeV.mjs";
5
5
  import { callDataFetch } from "./data-fetch-utils.es.js";
6
- import { p } from "./prefetch-CTZuFBqh.mjs";
6
+ import { p } from "./prefetch-BzCq3MT3.mjs";
7
7
  const createRemoteAppComponent = createRemoteAppComponentFactory(RemoteAppWrapper);
8
8
  const createRemoteComponent = createDeprecatedRemoteComponentFactory(
9
9
  createRemoteAppComponent
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const lazyUtils = require("./utils-5dGErM3C.js");
4
- const prefetch = require("./prefetch-D66kL1aM.js");
4
+ const prefetch = require("./prefetch-QJLnti7A.js");
5
5
  async function callDataFetch() {
6
6
  const dataFetch = globalThis[lazyUtils.DATA_FETCH_FUNCTION];
7
7
  if (dataFetch) {
@@ -1,7 +1,7 @@
1
1
  import { y as DATA_FETCH_FUNCTION } from "./utils-BBP3hEeV.mjs";
2
2
  import { C, a, c, b, d, g, r } from "./utils-BBP3hEeV.mjs";
3
- import { d as dataFetchFunction } from "./prefetch-CTZuFBqh.mjs";
4
- import { i, p } from "./prefetch-CTZuFBqh.mjs";
3
+ import { d as dataFetchFunction } from "./prefetch-BzCq3MT3.mjs";
4
+ import { i, p } from "./prefetch-BzCq3MT3.mjs";
5
5
  async function callDataFetch() {
6
6
  const dataFetch = globalThis[DATA_FETCH_FUNCTION];
7
7
  if (dataFetch) {
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-FKp6nQa-.js");
3
+ const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-DBTxuAYf.js");
4
4
  const lazyUtils = require("./utils-5dGErM3C.js");
5
5
  const dataFetchUtils = require("./data-fetch-utils.cjs.js");
6
- const prefetch = require("./prefetch-D66kL1aM.js");
6
+ const prefetch = require("./prefetch-QJLnti7A.js");
7
7
  exports.autoFetchDataPlugin = lazyLoadComponentPlugin.autoFetchData;
8
8
  exports.collectSSRAssets = lazyLoadComponentPlugin.collectSSRAssets;
9
9
  exports.createLazyComponent = lazyLoadComponentPlugin.createLazyComponent;
@@ -1,7 +1,7 @@
1
- import { a, c, b, l } from "./lazy-load-component-plugin-DEu-DfZt.mjs";
1
+ import { a, c, b, l } from "./lazy-load-component-plugin-DlagtX0O.mjs";
2
2
  import { C, a as a2, E, c as c2, b as b2, d, f, g, r, s } from "./utils-BBP3hEeV.mjs";
3
3
  import { callDataFetch } from "./data-fetch-utils.es.js";
4
- import { p } from "./prefetch-CTZuFBqh.mjs";
4
+ import { p } from "./prefetch-BzCq3MT3.mjs";
5
5
  export {
6
6
  C as CacheSize,
7
7
  a2 as CacheTime,
package/dist/index.cjs.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const createHelpers = require("./createHelpers-19BP0xtB.js");
4
- const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-FKp6nQa-.js");
4
+ const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-DBTxuAYf.js");
5
5
  const lazyUtils = require("./utils-5dGErM3C.js");
6
6
  const dataFetchUtils = require("./data-fetch-utils.cjs.js");
7
7
  const React = require("react");
8
8
  const ReactRouterDOM = require("react-router-dom");
9
9
  const index = require("./index-DbjGCKOr.js");
10
- const prefetch = require("./prefetch-D66kL1aM.js");
10
+ const prefetch = require("./prefetch-QJLnti7A.js");
11
11
  function _interopNamespaceDefault(e2) {
12
12
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
13
13
  if (e2) {
package/dist/index.es.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { R as RemoteAppWrapper, c as createRemoteAppComponentFactory, a as createDeprecatedRemoteComponentFactory } from "./createHelpers-BSHeKyd-.mjs";
2
2
  import { b } from "./createHelpers-BSHeKyd-.mjs";
3
- import { a, c, b as b2, l } from "./lazy-load-component-plugin-DEu-DfZt.mjs";
3
+ import { a, c, b as b2, l } from "./lazy-load-component-plugin-DlagtX0O.mjs";
4
4
  import { C, a as a2, E, c as c2, b as b3, d, g, r, s } from "./utils-BBP3hEeV.mjs";
5
5
  import { callDataFetch } from "./data-fetch-utils.es.js";
6
6
  import React__default, { forwardRef, useContext, useState, useEffect } from "react";
7
7
  import * as ReactRouterDOM from "react-router-dom";
8
8
  import { p as pathJoin, L as LoggerInstance } from "./index-Bs2NxD2z.mjs";
9
- import { p } from "./prefetch-CTZuFBqh.mjs";
9
+ import { p } from "./prefetch-BzCq3MT3.mjs";
10
10
  function e() {
11
11
  const t = new PopStateEvent("popstate", { state: window.history.state });
12
12
  window.dispatchEvent(t);
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const prefetch = require("./prefetch-D66kL1aM.js");
2
+ const prefetch = require("./prefetch-QJLnti7A.js");
3
3
  const lazyUtils = require("./utils-5dGErM3C.js");
4
4
  const React = require("react");
5
5
  const autoFetchData = () => {
@@ -1,4 +1,4 @@
1
- import { i as injectDataFetch, p as prefetch } from "./prefetch-CTZuFBqh.mjs";
1
+ import { i as injectDataFetch, p as prefetch } from "./prefetch-BzCq3MT3.mjs";
2
2
  import { i as initDataFetchMap, k as isDataLoaderExpose, m as getDataFetchInfo, n as getDataFetchMapKey, l as logger, o as getDataFetchItem, p as DATA_FETCH_CLIENT_SUFFIX, q as MF_DATA_FETCH_TYPE, t as isCSROnly, M as MF_DATA_FETCH_STATUS, j as loadDataFetchModule, e as getDataFetchMap, u as isServerEnv, v as getDataFetchIdWithErrorMsgs, w as DATA_FETCH_ERROR_PREFIX, E as ERROR_TYPE, x as wrapDataFetchId, L as LOAD_REMOTE_ERROR_PREFIX, y as DATA_FETCH_FUNCTION, z as getLoadedRemoteInfos, h as fetchData$1, A as setDataFetchItemLoadedStatus, F as FS_HREF } from "./utils-BBP3hEeV.mjs";
3
3
  import React__default, { useRef, useState, Suspense, useEffect } from "react";
4
4
  const autoFetchData = () => {
@@ -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-FKp6nQa-.js");
4
- require("./prefetch-D66kL1aM.js");
3
+ const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-DBTxuAYf.js");
4
+ require("./prefetch-QJLnti7A.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-DEu-DfZt.mjs";
2
- import "./prefetch-CTZuFBqh.mjs";
1
+ import { l, l as l2 } from "./lazy-load-component-plugin-DlagtX0O.mjs";
2
+ import "./prefetch-BzCq3MT3.mjs";
3
3
  export {
4
4
  l as default,
5
5
  l2 as lazyLoadComponentPlugin
@@ -621,6 +621,9 @@ const runtimeDescMap = {
621
621
  ...runtimeDescMap
622
622
  });
623
623
  const importCallback = ".then(callbacks[0]).catch(callbacks[1])";
624
+ function isEsmRemoteType(type) {
625
+ return type === "esm" || type === "module";
626
+ }
624
627
  async function loadEsmEntry({ entry, remoteEntryExports }) {
625
628
  return new Promise((resolve, reject) => {
626
629
  try {
@@ -688,29 +691,23 @@ async function loadEntryScript({ name, globalName, entry, remoteInfo, loaderHook
688
691
  }
689
692
  async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook, getEntryUrl, resourceContext }) {
690
693
  const { entry, entryGlobalName: globalName, name, type } = remoteInfo;
691
- switch (type) {
692
- case "esm":
693
- case "module":
694
- return loadEsmEntry({
695
- entry,
696
- remoteEntryExports
697
- });
698
- case "system":
699
- return loadSystemJsEntry({
700
- entry,
701
- remoteEntryExports
702
- });
703
- default:
704
- return loadEntryScript({
705
- entry,
706
- globalName,
707
- name,
708
- remoteInfo,
709
- loaderHook,
710
- getEntryUrl,
711
- resourceContext
712
- });
713
- }
694
+ if (isEsmRemoteType(type)) return loadEsmEntry({
695
+ entry,
696
+ remoteEntryExports
697
+ });
698
+ if (type === "system") return loadSystemJsEntry({
699
+ entry,
700
+ remoteEntryExports
701
+ });
702
+ return loadEntryScript({
703
+ entry,
704
+ globalName,
705
+ name,
706
+ remoteInfo,
707
+ loaderHook,
708
+ getEntryUrl,
709
+ resourceContext
710
+ });
714
711
  }
715
712
  async function loadEntryNode({ remoteInfo, loaderHook, resourceContext }) {
716
713
  const { entry, entryGlobalName: globalName, name, type } = remoteInfo;
@@ -969,7 +966,7 @@ function preloadAssets(remoteInfo, host, assets, useLinkPreload = true, baseCont
969
966
  results.push(waitForRemoteEntryPreload(host, remoteInfo, entryRemoteInfo, createResourceContext(baseContext, "remoteEntry")));
970
967
  });
971
968
  if (useLinkPreload) {
972
- const defaultAttrs = {
969
+ const defaultAttrs2 = {
973
970
  rel: "preload",
974
971
  as: "style"
975
972
  };
@@ -978,12 +975,12 @@ function preloadAssets(remoteInfo, host, assets, useLinkPreload = true, baseCont
978
975
  host,
979
976
  remoteInfo,
980
977
  url: cssUrl,
981
- attrs: defaultAttrs,
978
+ attrs: defaultAttrs2,
982
979
  context: createResourceContext(baseContext, "css")
983
980
  }));
984
981
  });
985
982
  } else {
986
- const defaultAttrs = {
983
+ const defaultAttrs2 = {
987
984
  rel: "stylesheet",
988
985
  type: "text/css"
989
986
  };
@@ -992,41 +989,39 @@ function preloadAssets(remoteInfo, host, assets, useLinkPreload = true, baseCont
992
989
  host,
993
990
  remoteInfo,
994
991
  url: cssUrl,
995
- attrs: defaultAttrs,
992
+ attrs: defaultAttrs2,
996
993
  needDeleteLink: false,
997
994
  context: createResourceContext(baseContext, "css")
998
995
  }));
999
996
  });
1000
997
  }
998
+ let preloadJsAsset = waitForScriptPreload;
999
+ let defaultAttrs = {
1000
+ fetchpriority: "high",
1001
+ type: "text/javascript"
1002
+ };
1001
1003
  if (useLinkPreload) {
1002
- const defaultAttrs = {
1004
+ preloadJsAsset = waitForLinkPreload;
1005
+ defaultAttrs = {
1003
1006
  rel: "preload",
1004
1007
  as: "script"
1005
1008
  };
1006
- jsAssetsWithoutEntry.forEach((jsUrl) => {
1007
- results.push(waitForLinkPreload({
1008
- host,
1009
- remoteInfo,
1010
- url: jsUrl,
1011
- attrs: defaultAttrs,
1012
- context: createResourceContext(baseContext, "js")
1013
- }));
1014
- });
1015
- } else {
1016
- const defaultAttrs = {
1017
- fetchpriority: "high",
1018
- type: (remoteInfo == null ? void 0 : remoteInfo.type) === "module" ? "module" : "text/javascript"
1009
+ } else if (isEsmRemoteType(remoteInfo.type)) {
1010
+ preloadJsAsset = waitForLinkPreload;
1011
+ defaultAttrs = {
1012
+ rel: "modulepreload",
1013
+ fetchpriority: "high"
1019
1014
  };
1020
- jsAssetsWithoutEntry.forEach((jsUrl) => {
1021
- results.push(waitForScriptPreload({
1022
- host,
1023
- remoteInfo,
1024
- url: jsUrl,
1025
- attrs: defaultAttrs,
1026
- context: createResourceContext(baseContext, "js")
1027
- }));
1028
- });
1029
1015
  }
1016
+ jsAssetsWithoutEntry.forEach((jsUrl) => {
1017
+ results.push(preloadJsAsset({
1018
+ host,
1019
+ remoteInfo,
1020
+ url: jsUrl,
1021
+ attrs: defaultAttrs,
1022
+ context: createResourceContext(baseContext, "js")
1023
+ }));
1024
+ });
1030
1025
  }
1031
1026
  return Promise.all(results);
1032
1027
  }
@@ -622,6 +622,9 @@ const runtimeDescMap = {
622
622
  ...runtimeDescMap
623
623
  });
624
624
  const importCallback = ".then(callbacks[0]).catch(callbacks[1])";
625
+ function isEsmRemoteType(type) {
626
+ return type === "esm" || type === "module";
627
+ }
625
628
  async function loadEsmEntry({ entry, remoteEntryExports }) {
626
629
  return new Promise((resolve, reject) => {
627
630
  try {
@@ -689,29 +692,23 @@ async function loadEntryScript({ name, globalName, entry, remoteInfo, loaderHook
689
692
  }
690
693
  async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook, getEntryUrl, resourceContext }) {
691
694
  const { entry, entryGlobalName: globalName, name, type } = remoteInfo;
692
- switch (type) {
693
- case "esm":
694
- case "module":
695
- return loadEsmEntry({
696
- entry,
697
- remoteEntryExports
698
- });
699
- case "system":
700
- return loadSystemJsEntry({
701
- entry,
702
- remoteEntryExports
703
- });
704
- default:
705
- return loadEntryScript({
706
- entry,
707
- globalName,
708
- name,
709
- remoteInfo,
710
- loaderHook,
711
- getEntryUrl,
712
- resourceContext
713
- });
714
- }
695
+ if (isEsmRemoteType(type)) return loadEsmEntry({
696
+ entry,
697
+ remoteEntryExports
698
+ });
699
+ if (type === "system") return loadSystemJsEntry({
700
+ entry,
701
+ remoteEntryExports
702
+ });
703
+ return loadEntryScript({
704
+ entry,
705
+ globalName,
706
+ name,
707
+ remoteInfo,
708
+ loaderHook,
709
+ getEntryUrl,
710
+ resourceContext
711
+ });
715
712
  }
716
713
  async function loadEntryNode({ remoteInfo, loaderHook, resourceContext }) {
717
714
  const { entry, entryGlobalName: globalName, name, type } = remoteInfo;
@@ -970,7 +967,7 @@ function preloadAssets(remoteInfo, host, assets, useLinkPreload = true, baseCont
970
967
  results.push(waitForRemoteEntryPreload(host, remoteInfo, entryRemoteInfo, createResourceContext(baseContext, "remoteEntry")));
971
968
  });
972
969
  if (useLinkPreload) {
973
- const defaultAttrs = {
970
+ const defaultAttrs2 = {
974
971
  rel: "preload",
975
972
  as: "style"
976
973
  };
@@ -979,12 +976,12 @@ function preloadAssets(remoteInfo, host, assets, useLinkPreload = true, baseCont
979
976
  host,
980
977
  remoteInfo,
981
978
  url: cssUrl,
982
- attrs: defaultAttrs,
979
+ attrs: defaultAttrs2,
983
980
  context: createResourceContext(baseContext, "css")
984
981
  }));
985
982
  });
986
983
  } else {
987
- const defaultAttrs = {
984
+ const defaultAttrs2 = {
988
985
  rel: "stylesheet",
989
986
  type: "text/css"
990
987
  };
@@ -993,41 +990,39 @@ function preloadAssets(remoteInfo, host, assets, useLinkPreload = true, baseCont
993
990
  host,
994
991
  remoteInfo,
995
992
  url: cssUrl,
996
- attrs: defaultAttrs,
993
+ attrs: defaultAttrs2,
997
994
  needDeleteLink: false,
998
995
  context: createResourceContext(baseContext, "css")
999
996
  }));
1000
997
  });
1001
998
  }
999
+ let preloadJsAsset = waitForScriptPreload;
1000
+ let defaultAttrs = {
1001
+ fetchpriority: "high",
1002
+ type: "text/javascript"
1003
+ };
1002
1004
  if (useLinkPreload) {
1003
- const defaultAttrs = {
1005
+ preloadJsAsset = waitForLinkPreload;
1006
+ defaultAttrs = {
1004
1007
  rel: "preload",
1005
1008
  as: "script"
1006
1009
  };
1007
- jsAssetsWithoutEntry.forEach((jsUrl) => {
1008
- results.push(waitForLinkPreload({
1009
- host,
1010
- remoteInfo,
1011
- url: jsUrl,
1012
- attrs: defaultAttrs,
1013
- context: createResourceContext(baseContext, "js")
1014
- }));
1015
- });
1016
- } else {
1017
- const defaultAttrs = {
1018
- fetchpriority: "high",
1019
- type: (remoteInfo == null ? void 0 : remoteInfo.type) === "module" ? "module" : "text/javascript"
1010
+ } else if (isEsmRemoteType(remoteInfo.type)) {
1011
+ preloadJsAsset = waitForLinkPreload;
1012
+ defaultAttrs = {
1013
+ rel: "modulepreload",
1014
+ fetchpriority: "high"
1020
1015
  };
1021
- jsAssetsWithoutEntry.forEach((jsUrl) => {
1022
- results.push(waitForScriptPreload({
1023
- host,
1024
- remoteInfo,
1025
- url: jsUrl,
1026
- attrs: defaultAttrs,
1027
- context: createResourceContext(baseContext, "js")
1028
- }));
1029
- });
1030
1016
  }
1017
+ jsAssetsWithoutEntry.forEach((jsUrl) => {
1018
+ results.push(preloadJsAsset({
1019
+ host,
1020
+ remoteInfo,
1021
+ url: jsUrl,
1022
+ attrs: defaultAttrs,
1023
+ context: createResourceContext(baseContext, "js")
1024
+ }));
1025
+ });
1031
1026
  }
1032
1027
  return Promise.all(results);
1033
1028
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/bridge-react",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "sideEffects": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -147,7 +147,7 @@
147
147
  }
148
148
  },
149
149
  "dependencies": {
150
- "@module-federation/sdk": "2.8.0"
150
+ "@module-federation/sdk": "2.8.1"
151
151
  },
152
152
  "peerDependencies": {
153
153
  "react": ">=16.9.0",
@@ -179,9 +179,9 @@
179
179
  "typescript": "7.0.2",
180
180
  "vite": "^5.4.21",
181
181
  "hono": "4.12.26",
182
- "@module-federation/bridge-shared": "2.8.0",
183
- "@module-federation/runtime": "2.8.0",
184
- "@module-federation/runtime-core": "2.8.0"
182
+ "@module-federation/runtime": "2.8.1",
183
+ "@module-federation/bridge-shared": "2.8.1",
184
+ "@module-federation/runtime-core": "2.8.1"
185
185
  },
186
186
  "scripts": {
187
187
  "dev": "vite",