@module-federation/bridge-react 0.0.0-perf-devtools-20260108034446 → 0.0.0-perf-website-code-usage-20260914033703

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 (161) hide show
  1. package/dist/base.cjs.js +4 -4
  2. package/dist/base.d.ts +8 -311
  3. package/dist/base.es.js +11 -11
  4. package/dist/{bridge-base-CPSTBjEp.mjs → bridge-base-CHnL6Q9P.mjs} +63 -103
  5. package/dist/{bridge-base-RStDxH71.js → bridge-base-DSYKAGGD.js} +63 -102
  6. package/dist/{createHelpers-Ui5pt7je.mjs → createHelpers-D3Sg5lKp.mjs} +32 -17
  7. package/dist/{createHelpers-B_L612IN.js → createHelpers-D6thyyLv.js} +30 -15
  8. package/dist/data-fetch-server-middleware.cjs.js +4 -4
  9. package/dist/data-fetch-server-middleware.d.ts +1 -15
  10. package/dist/data-fetch-server-middleware.es.js +2 -2
  11. package/dist/data-fetch-utils.cjs.js +2 -2
  12. package/dist/data-fetch-utils.d.ts +1 -81
  13. package/dist/data-fetch-utils.es.js +7 -7
  14. package/dist/data-fetch.cjs.js +22 -0
  15. package/dist/data-fetch.d.ts +4 -0
  16. package/dist/data-fetch.es.js +22 -0
  17. package/dist/error-boundary.d.ts +17 -0
  18. package/dist/error-boundary.spec.d.ts +1 -0
  19. package/dist/{index-DyQNwY2M.mjs → index-Bs2NxD2z.mjs} +1 -1
  20. package/dist/{index-DRSBaSu3.js → index-DbjGCKOr.js} +2 -2
  21. package/dist/index.cjs.js +27 -6
  22. package/dist/index.d.ts +12 -299
  23. package/dist/index.es.js +34 -13
  24. package/dist/lazy/AwaitDataFetch.d.ts +24 -0
  25. package/dist/lazy/HydratedStylesheetAssets.d.ts +4 -0
  26. package/dist/lazy/constant.d.ts +26 -0
  27. package/dist/lazy/createLazyComponent.d.ts +28 -0
  28. package/dist/lazy/data-fetch/cache.d.ts +34 -0
  29. package/dist/lazy/data-fetch/cache.spec.d.ts +1 -0
  30. package/dist/lazy/data-fetch/call-data-fetch.d.ts +1 -0
  31. package/dist/lazy/data-fetch/data-fetch-server-middleware.d.ts +3 -0
  32. package/{src/lazy/data-fetch/index.ts → dist/lazy/data-fetch/index.d.ts} +1 -11
  33. package/dist/lazy/data-fetch/inject-data-fetch.d.ts +4 -0
  34. package/dist/lazy/data-fetch/prefetch.d.ts +9 -0
  35. package/dist/lazy/data-fetch/runtime-plugin.d.ts +3 -0
  36. package/dist/lazy/index.d.ts +9 -0
  37. package/dist/lazy/logger.d.ts +2 -0
  38. package/dist/lazy/types.d.ts +60 -0
  39. package/dist/lazy/utils.d.ts +48 -0
  40. package/dist/lazy/wrapNoSSR.d.ts +9 -0
  41. package/dist/{lazy-load-component-plugin-BvnyaA6i.js → lazy-load-component-plugin-DSURjnZ0.js} +170 -44
  42. package/dist/{lazy-load-component-plugin-CVcFMRce.mjs → lazy-load-component-plugin-NZphPG7_.mjs} +174 -48
  43. package/dist/lazy-load-component-plugin.cjs.js +2 -2
  44. package/dist/lazy-load-component-plugin.d.ts +2 -16
  45. package/dist/lazy-load-component-plugin.es.js +2 -2
  46. package/dist/lazy-utils.cjs.js +2 -2
  47. package/dist/lazy-utils.d.ts +1 -149
  48. package/dist/lazy-utils.es.js +19 -19
  49. package/dist/logger-DwWkXsWl.mjs +139 -0
  50. package/dist/logger-Dxblx6P-.js +138 -0
  51. package/dist/plugin.d.ts +2 -22
  52. package/dist/plugins/lazy-load-component-plugin.d.ts +12 -0
  53. package/dist/plugins/lazy-load-component-plugin.spec.d.ts +1 -0
  54. package/dist/prefetch-Bxf6DSx_.js +1477 -0
  55. package/dist/prefetch-TKq_EK_q.mjs +1478 -0
  56. package/dist/provider/context.d.ts +3 -0
  57. package/dist/provider/plugin.d.ts +7 -0
  58. package/dist/provider/versions/bridge-base.d.ts +5 -0
  59. package/dist/provider/versions/legacy.d.ts +26 -0
  60. package/dist/provider/versions/v18.d.ts +19 -0
  61. package/dist/provider/versions/v19.d.ts +21 -0
  62. package/dist/remote/RemoteAppWrapper.d.ts +7 -0
  63. package/dist/remote/base-component/create.d.ts +9 -0
  64. package/dist/remote/base-component/index.d.ts +5 -0
  65. package/dist/remote/createHelpers.d.ts +17 -0
  66. package/dist/remote/router-component/component.d.ts +8 -0
  67. package/dist/remote/router-component/create.d.ts +9 -0
  68. package/dist/remote/router-component/index.d.ts +5 -0
  69. package/dist/router/default.d.ts +7 -0
  70. package/dist/router/v5.d.ts +4 -0
  71. package/dist/router/v6.d.ts +7 -0
  72. package/dist/router/v7.d.ts +6 -0
  73. package/dist/router-v5.cjs.js +5 -3
  74. package/dist/router-v5.d.ts +1 -18
  75. package/dist/router-v5.es.js +5 -3
  76. package/dist/router-v6.cjs.js +1 -1
  77. package/dist/router-v6.d.ts +1 -20
  78. package/dist/router-v6.es.js +1 -1
  79. package/dist/router-v7.cjs.js +5 -3
  80. package/dist/router-v7.d.ts +1 -20
  81. package/dist/router-v7.es.js +5 -3
  82. package/dist/router.cjs.js +1 -1
  83. package/dist/router.d.ts +1 -20
  84. package/dist/router.es.js +1 -1
  85. package/dist/shared/size-limited-cache.d.ts +29 -0
  86. package/dist/shared/size-limited-cache.spec.d.ts +1 -0
  87. package/dist/size-limited-cache.cjs.js +82 -0
  88. package/dist/size-limited-cache.d.ts +1 -0
  89. package/dist/size-limited-cache.es.js +82 -0
  90. package/dist/types.d.ts +137 -0
  91. package/dist/utils/index.d.ts +4 -0
  92. package/dist/utils-5dGErM3C.js +588 -0
  93. package/dist/utils-BBP3hEeV.mjs +589 -0
  94. package/dist/v18.cjs.js +1 -1
  95. package/dist/v18.d.ts +3 -114
  96. package/dist/v18.es.js +1 -1
  97. package/dist/v19.cjs.js +1 -1
  98. package/dist/v19.d.ts +3 -115
  99. package/dist/v19.es.js +1 -1
  100. package/package.json +35 -14
  101. package/CHANGELOG.md +0 -735
  102. package/__tests__/bridge.spec.tsx +0 -160
  103. package/__tests__/createLazyComponent.spec.tsx +0 -209
  104. package/__tests__/prefetch.spec.ts +0 -156
  105. package/__tests__/router.spec.tsx +0 -82
  106. package/__tests__/setupTests.ts +0 -8
  107. package/__tests__/util.ts +0 -36
  108. package/dist/index.esm-BWaKho-8.js +0 -491
  109. package/dist/index.esm-CPwSeCvw.mjs +0 -492
  110. package/dist/prefetch-CK3EZdY4.mjs +0 -1273
  111. package/dist/prefetch-MiXeF8KH.js +0 -1272
  112. package/dist/utils-dUgb9Jkm.mjs +0 -2016
  113. package/dist/utils-tM9yE73c.js +0 -2015
  114. package/jest.config.ts +0 -21
  115. package/project.json +0 -23
  116. package/src/base.ts +0 -50
  117. package/src/index.ts +0 -50
  118. package/src/lazy/AwaitDataFetch.tsx +0 -215
  119. package/src/lazy/constant.ts +0 -30
  120. package/src/lazy/createLazyComponent.tsx +0 -411
  121. package/src/lazy/data-fetch/cache.ts +0 -291
  122. package/src/lazy/data-fetch/call-data-fetch.ts +0 -13
  123. package/src/lazy/data-fetch/data-fetch-server-middleware.ts +0 -196
  124. package/src/lazy/data-fetch/inject-data-fetch.ts +0 -109
  125. package/src/lazy/data-fetch/prefetch.ts +0 -112
  126. package/src/lazy/data-fetch/runtime-plugin.ts +0 -115
  127. package/src/lazy/index.ts +0 -35
  128. package/src/lazy/logger.ts +0 -6
  129. package/src/lazy/types.ts +0 -75
  130. package/src/lazy/utils.ts +0 -372
  131. package/src/lazy/wrapNoSSR.tsx +0 -10
  132. package/src/modern-app-env.d.ts +0 -2
  133. package/src/plugins/lazy-load-component-plugin.spec.ts +0 -21
  134. package/src/plugins/lazy-load-component-plugin.ts +0 -57
  135. package/src/provider/context.tsx +0 -4
  136. package/src/provider/plugin.ts +0 -22
  137. package/src/provider/versions/bridge-base.tsx +0 -150
  138. package/src/provider/versions/legacy.ts +0 -87
  139. package/src/provider/versions/v18.ts +0 -47
  140. package/src/provider/versions/v19.ts +0 -48
  141. package/src/remote/RemoteAppWrapper.tsx +0 -108
  142. package/src/remote/base-component/create.tsx +0 -23
  143. package/src/remote/base-component/index.tsx +0 -10
  144. package/src/remote/createHelpers.tsx +0 -130
  145. package/src/remote/router-component/component.tsx +0 -104
  146. package/src/remote/router-component/create.tsx +0 -23
  147. package/src/remote/router-component/index.tsx +0 -10
  148. package/src/router/default.tsx +0 -73
  149. package/src/router/v5.tsx +0 -43
  150. package/src/router/v6.tsx +0 -74
  151. package/src/router/v7.tsx +0 -75
  152. package/src/types.ts +0 -147
  153. package/src/utils/index.ts +0 -44
  154. package/src/v18.ts +0 -9
  155. package/src/v19.ts +0 -9
  156. package/tsconfig.json +0 -42
  157. package/tsconfig.node.json +0 -11
  158. package/tsconfig.spec.json +0 -26
  159. package/vite.config.ts +0 -112
  160. package/vitest.config.ts +0 -27
  161. /package/{src/remote/base-component/component.tsx → dist/remote/base-component/component.d.ts} +0 -0
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
2
5
  const React = require("react");
3
- const index = require("./index-DRSBaSu3.js");
6
+ const index = require("./index-DbjGCKOr.js");
4
7
  const plugin = require("./plugin.cjs.js");
5
8
  function _interopNamespaceDefault(e) {
6
9
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -19,101 +22,33 @@ function _interopNamespaceDefault(e) {
19
22
  return Object.freeze(n);
20
23
  }
21
24
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
22
- const ErrorBoundaryContext = React.createContext(null);
23
- const initialState = {
24
- didCatch: false,
25
- error: null
26
- };
27
- class ErrorBoundary extends React.Component {
28
- constructor(props) {
29
- super(props);
30
- this.resetErrorBoundary = this.resetErrorBoundary.bind(this);
31
- this.state = initialState;
32
- }
33
- static getDerivedStateFromError(error) {
34
- return {
35
- didCatch: true,
36
- error
37
- };
38
- }
39
- resetErrorBoundary() {
40
- const {
41
- error
42
- } = this.state;
43
- if (error !== null) {
44
- var _this$props$onReset, _this$props;
45
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
46
- args[_key] = arguments[_key];
25
+ const initialState = { didCatch: false, error: null };
26
+ class ErrorBoundary extends React__namespace.Component {
27
+ constructor() {
28
+ super(...arguments);
29
+ __publicField(this, "state", initialState);
30
+ __publicField(this, "resetErrorBoundary", (..._args) => {
31
+ if (this.state.didCatch) {
32
+ this.setState(initialState);
47
33
  }
48
- (_this$props$onReset = (_this$props = this.props).onReset) === null || _this$props$onReset === void 0 ? void 0 : _this$props$onReset.call(_this$props, {
49
- args,
50
- reason: "imperative-api"
51
- });
52
- this.setState(initialState);
53
- }
54
- }
55
- componentDidCatch(error, info) {
56
- var _this$props$onError, _this$props2;
57
- (_this$props$onError = (_this$props2 = this.props).onError) === null || _this$props$onError === void 0 ? void 0 : _this$props$onError.call(_this$props2, error, info);
34
+ });
58
35
  }
59
- componentDidUpdate(prevProps, prevState) {
60
- const {
61
- didCatch
62
- } = this.state;
63
- const {
64
- resetKeys
65
- } = this.props;
66
- if (didCatch && prevState.error !== null && hasArrayChanged(prevProps.resetKeys, resetKeys)) {
67
- var _this$props$onReset2, _this$props3;
68
- (_this$props$onReset2 = (_this$props3 = this.props).onReset) === null || _this$props$onReset2 === void 0 ? void 0 : _this$props$onReset2.call(_this$props3, {
69
- next: resetKeys,
70
- prev: prevProps.resetKeys,
71
- reason: "keys"
72
- });
73
- this.setState(initialState);
74
- }
36
+ static getDerivedStateFromError(error) {
37
+ return { didCatch: true, error };
75
38
  }
76
39
  render() {
77
- const {
78
- children,
79
- fallbackRender,
80
- FallbackComponent,
81
- fallback
82
- } = this.props;
83
- const {
84
- didCatch,
85
- error
86
- } = this.state;
87
- let childToRender = children;
88
- if (didCatch) {
89
- const props = {
90
- error,
91
- resetErrorBoundary: this.resetErrorBoundary
92
- };
93
- if (typeof fallbackRender === "function") {
94
- childToRender = fallbackRender(props);
95
- } else if (FallbackComponent) {
96
- childToRender = React.createElement(FallbackComponent, props);
97
- } else if (fallback !== void 0) {
98
- childToRender = fallback;
99
- } else {
100
- throw error;
101
- }
40
+ if (this.state.didCatch) {
41
+ return /* @__PURE__ */ React__namespace.createElement(
42
+ this.props.FallbackComponent,
43
+ {
44
+ error: this.state.error,
45
+ resetErrorBoundary: this.resetErrorBoundary
46
+ }
47
+ );
102
48
  }
103
- return React.createElement(ErrorBoundaryContext.Provider, {
104
- value: {
105
- didCatch,
106
- error,
107
- resetErrorBoundary: this.resetErrorBoundary
108
- }
109
- }, childToRender);
49
+ return this.props.children;
110
50
  }
111
51
  }
112
- function hasArrayChanged() {
113
- let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
114
- let b = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
115
- return a.length !== b.length || a.some((item, index2) => !Object.is(item, b[index2]));
116
- }
117
52
  function createBaseBridgeComponent({
118
53
  createRoot,
119
54
  defaultRootOptions,
@@ -138,14 +73,18 @@ function createBaseBridgeComponent({
138
73
  }
139
74
  ));
140
75
  };
141
- const DefaultFallback = ({ error }) => /* @__PURE__ */ React__namespace.createElement("div", { role: "alert" }, /* @__PURE__ */ React__namespace.createElement("p", null, "Something went wrong:"), /* @__PURE__ */ React__namespace.createElement("pre", { style: { color: "red" } }, error.message));
76
+ const DefaultFallback = ({ error }) => /* @__PURE__ */ React__namespace.createElement("div", { role: "alert" }, /* @__PURE__ */ React__namespace.createElement("p", null, "Something went wrong:"), /* @__PURE__ */ React__namespace.createElement("pre", { style: { color: "red" } }, error instanceof Error ? error.message : String(error)));
77
+ const omitHostFallback = (props) => {
78
+ const nextProps = { ...props };
79
+ delete nextProps.fallback;
80
+ return nextProps;
81
+ };
142
82
  const BridgeWrapper = ({
143
83
  basename,
144
84
  moduleName,
145
85
  memoryRoute,
146
- propsInfo,
147
- fallback
148
- }) => /* @__PURE__ */ React__namespace.createElement(ErrorBoundary, { FallbackComponent: fallback || DefaultFallback }, /* @__PURE__ */ React__namespace.createElement(
86
+ propsInfo
87
+ }) => /* @__PURE__ */ React__namespace.createElement(ErrorBoundary, { FallbackComponent: DefaultFallback }, /* @__PURE__ */ React__namespace.createElement(
149
88
  RawComponent,
150
89
  {
151
90
  appInfo: {
@@ -165,33 +104,41 @@ function createBaseBridgeComponent({
165
104
  dom,
166
105
  basename,
167
106
  memoryRoute,
168
- fallback,
169
107
  rootOptions,
170
108
  ...propsInfo
171
109
  } = info;
110
+ const operationContext = {
111
+ side: "producer",
112
+ framework: "react",
113
+ operation: rootMap.has(dom) ? "update" : "render",
114
+ reason: "direct"
115
+ };
172
116
  const mergedRootOptions = {
173
117
  ...defaultRootOptions,
174
118
  ...rootOptions
175
119
  };
176
- const beforeBridgeRenderRes = ((_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeRender) == null ? void 0 : _c.emit(info)) || {};
120
+ const beforeBridgeRenderRes = ((_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeRender) == null ? void 0 : _c.emit(
121
+ info,
122
+ operationContext
123
+ )) || {};
177
124
  const rootComponentWithErrorBoundary = /* @__PURE__ */ React__namespace.createElement(
178
125
  BridgeWrapper,
179
126
  {
180
127
  basename,
181
128
  moduleName,
182
129
  memoryRoute,
183
- fallback,
184
130
  propsInfo: {
185
- ...propsInfo,
131
+ ...omitHostFallback(propsInfo),
186
132
  basename,
187
133
  ...beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps
188
134
  }
189
135
  }
190
136
  );
191
137
  if (bridgeInfo.render) {
192
- await Promise.resolve(
138
+ const root = await Promise.resolve(
193
139
  bridgeInfo.render(rootComponentWithErrorBoundary, dom)
194
- ).then((root) => rootMap.set(dom, root));
140
+ );
141
+ rootMap.set(dom, root);
195
142
  } else {
196
143
  let root = rootMap.get(dom);
197
144
  if (!root && createRoot) {
@@ -202,13 +149,25 @@ function createBaseBridgeComponent({
202
149
  root.render(rootComponentWithErrorBoundary);
203
150
  }
204
151
  }
205
- ((_f = (_e = (_d = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeRender) == null ? void 0 : _f.emit(info)) || {};
152
+ ((_f = (_e = (_d = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeRender) == null ? void 0 : _f.emit(info, {
153
+ context: operationContext
154
+ })) || {};
206
155
  },
207
156
  destroy(info) {
208
- var _a, _b, _c;
157
+ var _a, _b, _c, _d, _e, _f;
209
158
  const { dom } = info;
210
159
  index.LoggerInstance.debug(`createBridgeComponent destroy Info`, info);
211
160
  const root = rootMap.get(dom);
161
+ const operationContext = {
162
+ side: "producer",
163
+ framework: "react",
164
+ operation: "destroy",
165
+ reason: "direct"
166
+ };
167
+ (_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeDestroy) == null ? void 0 : _c.emit(
168
+ info,
169
+ operationContext
170
+ );
212
171
  if (root) {
213
172
  if ("unmount" in root) {
214
173
  root.unmount();
@@ -217,7 +176,9 @@ function createBaseBridgeComponent({
217
176
  }
218
177
  rootMap.delete(dom);
219
178
  }
220
- (_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.afterBridgeDestroy) == null ? void 0 : _c.emit(info);
179
+ (_f = (_e = (_d = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _d.lifecycle) == null ? void 0 : _e.afterBridgeDestroy) == null ? void 0 : _f.emit(info, {
180
+ context: operationContext
181
+ });
221
182
  }
222
183
  };
223
184
  };
@@ -1,6 +1,6 @@
1
- import { c as createBaseBridgeComponent, E as ErrorBoundary } from "./bridge-base-CPSTBjEp.mjs";
1
+ import { c as createBaseBridgeComponent, E as ErrorBoundary } from "./bridge-base-CHnL6Q9P.mjs";
2
2
  import ReactDOM from "react-dom";
3
- import { L as LoggerInstance, g as getRootDomDefaultClassName } from "./index-DyQNwY2M.mjs";
3
+ import { L as LoggerInstance, g as getRootDomDefaultClassName } from "./index-Bs2NxD2z.mjs";
4
4
  import React__default, { forwardRef, useRef, useState, useEffect } from "react";
5
5
  import { federationRuntime } from "./plugin.es.js";
6
6
  function createReact16Or17Root(container) {
@@ -57,31 +57,36 @@ const RemoteAppWrapper = forwardRef(function(props, ref) {
57
57
  providerInfoRef.current = providerReturn;
58
58
  setInitialized(true);
59
59
  return () => {
60
- var _a, _b, _c, _d, _e, _f, _g, _h;
60
+ var _a, _b, _c, _d, _e, _f, _g;
61
61
  if ((_a = providerInfoRef.current) == null ? void 0 : _a.destroy) {
62
62
  LoggerInstance.debug(
63
63
  `createRemoteAppComponent LazyComponent destroy >>>`,
64
64
  { moduleName, basename, dom: renderDom.current }
65
65
  );
66
- (_d = (_c = (_b = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _b.lifecycle) == null ? void 0 : _c.beforeBridgeDestroy) == null ? void 0 : _d.emit({
66
+ const destroyInfo = {
67
67
  moduleName,
68
68
  dom: renderDom.current,
69
69
  basename,
70
70
  memoryRoute,
71
71
  fallback,
72
72
  ...resProps
73
- });
74
- (_e = providerInfoRef.current) == null ? void 0 : _e.destroy({
73
+ };
74
+ const operationContext = {
75
+ side: "consumer",
76
+ framework: "react",
77
+ operation: "destroy",
78
+ reason: "unmount"
79
+ };
80
+ (_d = (_c = (_b = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _b.lifecycle) == null ? void 0 : _c.beforeBridgeDestroy) == null ? void 0 : _d.emit(
81
+ destroyInfo,
82
+ operationContext
83
+ );
84
+ providerInfoRef.current.destroy({
75
85
  moduleName,
76
86
  dom: renderDom.current
77
87
  });
78
- (_h = (_g = (_f = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _f.lifecycle) == null ? void 0 : _g.afterBridgeDestroy) == null ? void 0 : _h.emit({
79
- moduleName,
80
- dom: renderDom.current,
81
- basename,
82
- memoryRoute,
83
- fallback,
84
- ...resProps
88
+ (_g = (_f = (_e = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _e.lifecycle) == null ? void 0 : _f.afterBridgeDestroy) == null ? void 0 : _g.emit(destroyInfo, {
89
+ context: operationContext
85
90
  });
86
91
  }
87
92
  };
@@ -98,10 +103,20 @@ const RemoteAppWrapper = forwardRef(function(props, ref) {
98
103
  ...resProps
99
104
  };
100
105
  renderDom.current = rootRef.current;
101
- const beforeBridgeRenderRes = ((_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeRender) == null ? void 0 : _c.emit(renderProps)) || {};
106
+ const operationContext = {
107
+ side: "consumer",
108
+ framework: "react",
109
+ operation: "render"
110
+ };
111
+ const beforeBridgeRenderRes = ((_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeRender) == null ? void 0 : _c.emit(
112
+ renderProps,
113
+ operationContext
114
+ )) || {};
102
115
  renderProps = { ...renderProps, ...beforeBridgeRenderRes.extraProps };
103
116
  providerInfoRef.current.render(renderProps);
104
- (_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);
117
+ (_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, {
118
+ context: operationContext
119
+ });
105
120
  }, [initialized, ...Object.values(props)]);
106
121
  const rootComponentClassName = `${getRootDomDefaultClassName(moduleName)} ${className || ""}`;
107
122
  return /* @__PURE__ */ React__default.createElement("div", { className: rootComponentClassName, style, ref: rootRef }, loading);
@@ -185,7 +200,7 @@ function createDeprecatedRemoteComponentFactory(createFn) {
185
200
  }
186
201
  export {
187
202
  RemoteAppWrapper as R,
188
- createRemoteAppComponentFactory as a,
203
+ createDeprecatedRemoteComponentFactory as a,
189
204
  createBridgeComponent as b,
190
- createDeprecatedRemoteComponentFactory as c
205
+ createRemoteAppComponentFactory as c
191
206
  };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
- const bridgeBase = require("./bridge-base-RStDxH71.js");
2
+ const bridgeBase = require("./bridge-base-DSYKAGGD.js");
3
3
  const ReactDOM = require("react-dom");
4
- const index = require("./index-DRSBaSu3.js");
4
+ const index = require("./index-DbjGCKOr.js");
5
5
  const React = require("react");
6
6
  const plugin = require("./plugin.cjs.js");
7
7
  function createReact16Or17Root(container) {
@@ -58,31 +58,36 @@ const RemoteAppWrapper = React.forwardRef(function(props, ref) {
58
58
  providerInfoRef.current = providerReturn;
59
59
  setInitialized(true);
60
60
  return () => {
61
- var _a, _b, _c, _d, _e, _f, _g, _h;
61
+ var _a, _b, _c, _d, _e, _f, _g;
62
62
  if ((_a = providerInfoRef.current) == null ? void 0 : _a.destroy) {
63
63
  index.LoggerInstance.debug(
64
64
  `createRemoteAppComponent LazyComponent destroy >>>`,
65
65
  { moduleName, basename, dom: renderDom.current }
66
66
  );
67
- (_d = (_c = (_b = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _b.lifecycle) == null ? void 0 : _c.beforeBridgeDestroy) == null ? void 0 : _d.emit({
67
+ const destroyInfo = {
68
68
  moduleName,
69
69
  dom: renderDom.current,
70
70
  basename,
71
71
  memoryRoute,
72
72
  fallback,
73
73
  ...resProps
74
- });
75
- (_e = providerInfoRef.current) == null ? void 0 : _e.destroy({
74
+ };
75
+ const operationContext = {
76
+ side: "consumer",
77
+ framework: "react",
78
+ operation: "destroy",
79
+ reason: "unmount"
80
+ };
81
+ (_d = (_c = (_b = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _b.lifecycle) == null ? void 0 : _c.beforeBridgeDestroy) == null ? void 0 : _d.emit(
82
+ destroyInfo,
83
+ operationContext
84
+ );
85
+ providerInfoRef.current.destroy({
76
86
  moduleName,
77
87
  dom: renderDom.current
78
88
  });
79
- (_h = (_g = (_f = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _f.lifecycle) == null ? void 0 : _g.afterBridgeDestroy) == null ? void 0 : _h.emit({
80
- moduleName,
81
- dom: renderDom.current,
82
- basename,
83
- memoryRoute,
84
- fallback,
85
- ...resProps
89
+ (_g = (_f = (_e = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _e.lifecycle) == null ? void 0 : _f.afterBridgeDestroy) == null ? void 0 : _g.emit(destroyInfo, {
90
+ context: operationContext
86
91
  });
87
92
  }
88
93
  };
@@ -99,10 +104,20 @@ const RemoteAppWrapper = React.forwardRef(function(props, ref) {
99
104
  ...resProps
100
105
  };
101
106
  renderDom.current = rootRef.current;
102
- const beforeBridgeRenderRes = ((_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeRender) == null ? void 0 : _c.emit(renderProps)) || {};
107
+ const operationContext = {
108
+ side: "consumer",
109
+ framework: "react",
110
+ operation: "render"
111
+ };
112
+ const beforeBridgeRenderRes = ((_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeRender) == null ? void 0 : _c.emit(
113
+ renderProps,
114
+ operationContext
115
+ )) || {};
103
116
  renderProps = { ...renderProps, ...beforeBridgeRenderRes.extraProps };
104
117
  providerInfoRef.current.render(renderProps);
105
- (_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);
118
+ (_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, {
119
+ context: operationContext
120
+ });
106
121
  }, [initialized, ...Object.values(props)]);
107
122
  const rootComponentClassName = `${index.getRootDomDefaultClassName(moduleName)} ${className || ""}`;
108
123
  return /* @__PURE__ */ React.createElement("div", { className: rootComponentClassName, style, ref: rootRef }, loading);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const lazyUtils = require("./utils-tM9yE73c.js");
3
- const index_esm = require("./index.esm-BWaKho-8.js");
2
+ const lazyUtils = require("./utils-5dGErM3C.js");
3
+ const logger = require("./logger-Dxblx6P-.js");
4
4
  function wrapSetTimeout(targetPromise, delay = 2e4, id) {
5
5
  if (targetPromise && typeof targetPromise.then === "function") {
6
6
  return new Promise((resolve, reject) => {
@@ -98,7 +98,7 @@ const dataFetchServerMiddleware = async (ctx, next) => {
98
98
  entryGlobalName: remoteInfo.globalName
99
99
  }
100
100
  ]);
101
- } else if (!("entry" in remote) || !remote.entry.includes(index_esm.MANIFEST_EXT)) {
101
+ } else if (!("entry" in remote) || !remote.entry.includes(logger.MANIFEST_EXT)) {
102
102
  const { hostGlobalSnapshot, remoteSnapshot } = hostInstance2.snapshotHandler.getGlobalRemoteInfo(remoteInfo);
103
103
  lazyUtils.logger.debug(
104
104
  "find hostGlobalSnapshot: ",
@@ -140,7 +140,7 @@ const dataFetchServerMiddleware = async (ctx, next) => {
140
140
  return ctx.json(res);
141
141
  }
142
142
  }
143
- const remoteId = dataFetchKey.split(index_esm.SEPARATOR)[0];
143
+ const remoteId = dataFetchKey.split(logger.SEPARATOR)[0];
144
144
  const hostInstance = globalThis.__FEDERATION__.__INSTANCES__[0];
145
145
  if (!hostInstance) {
146
146
  throw new Error("host instance not found!");
@@ -1,15 +1 @@
1
- import { MiddlewareHandler } from 'hono';
2
-
3
- declare const dataFetchServerMiddleware: MiddlewareHandler;
4
- export default dataFetchServerMiddleware;
5
-
6
- export { }
7
-
8
-
9
- declare module '@module-federation/runtime-core' {
10
- interface ModuleFederation {
11
- createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
12
- prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
13
- collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
14
- }
15
- }
1
+ export { default } from './lazy/data-fetch/data-fetch-server-middleware';
@@ -1,5 +1,5 @@
1
- import { D as DATA_FETCH_QUERY, l as logger, e as getDataFetchMap, i as initDataFetchMap, M as MF_DATA_FETCH_STATUS, f as fetchData, h as loadDataFetchModule } from "./utils-dUgb9Jkm.mjs";
2
- import { M as MANIFEST_EXT, S as SEPARATOR } from "./index.esm-CPwSeCvw.mjs";
1
+ import { D as DATA_FETCH_QUERY, l as logger, e as getDataFetchMap, i as initDataFetchMap, M as MF_DATA_FETCH_STATUS, h as fetchData, j as loadDataFetchModule } from "./utils-BBP3hEeV.mjs";
2
+ import { M as MANIFEST_EXT, S as SEPARATOR } from "./logger-DwWkXsWl.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-tM9yE73c.js");
4
- const prefetch = require("./prefetch-MiXeF8KH.js");
3
+ const lazyUtils = require("./utils-5dGErM3C.js");
4
+ const prefetch = require("./prefetch-Bxf6DSx_.js");
5
5
  async function callDataFetch() {
6
6
  const dataFetch = globalThis[lazyUtils.DATA_FETCH_FUNCTION];
7
7
  if (dataFetch) {
@@ -1,81 +1 @@
1
- import { getInstance } from '@module-federation/runtime';
2
-
3
- export declare function cache<T>(fn: DataFetch<T>, options?: CacheOptions): DataFetch<T>;
4
-
5
- declare interface CacheConfig {
6
- maxSize?: number;
7
- unstable_shouldDisable?: ({ request, }: {
8
- request: Request;
9
- }) => boolean | Promise<boolean>;
10
- }
11
-
12
- declare interface CacheOptions {
13
- tag?: string | string[];
14
- maxAge?: number;
15
- revalidate?: number;
16
- getKey?: <Args extends any[]>(...args: Args) => string;
17
- onCache?: (info: CacheStatsInfo) => boolean;
18
- }
19
-
20
- export declare const CacheSize: {
21
- readonly KB: 1024;
22
- readonly MB: number;
23
- readonly GB: number;
24
- };
25
-
26
- export declare interface CacheStatsInfo {
27
- status: CacheStatus;
28
- key: string | symbol;
29
- params: DataFetchParams;
30
- result: any;
31
- }
32
-
33
- export declare type CacheStatus = 'hit' | 'stale' | 'miss';
34
-
35
- export declare const CacheTime: {
36
- readonly SECOND: 1000;
37
- readonly MINUTE: number;
38
- readonly HOUR: number;
39
- readonly DAY: number;
40
- readonly WEEK: number;
41
- readonly MONTH: number;
42
- };
43
-
44
- export declare function callDataFetch(): Promise<void>;
45
-
46
- export declare function clearStore(): void;
47
-
48
- export declare function configureCache(config: CacheConfig): void;
49
-
50
- declare type DataFetch<T> = (params: DataFetchParams) => Promise<T>;
51
-
52
- declare type DataFetchParams = {
53
- isDowngrade: boolean;
54
- _id?: string;
55
- } & Record<string, unknown>;
56
-
57
- export declare function generateKey(dataFetchOptions: DataFetchParams): string;
58
-
59
- export declare function injectDataFetch(): void;
60
-
61
- export declare function prefetch(options: PrefetchOptions): Promise<void>;
62
-
63
- export declare type PrefetchOptions = {
64
- id: string;
65
- instance: ReturnType<typeof getInstance>;
66
- dataFetchParams?: DataFetchParams;
67
- preloadComponentResource?: boolean;
68
- };
69
-
70
- export declare function revalidateTag(tag: string): void;
71
-
72
- export { }
73
-
74
-
75
- declare module '@module-federation/runtime-core' {
76
- interface ModuleFederation {
77
- createLazyComponent<T, E extends keyof T>(options: Omit<CreateLazyComponentOptions<T, E>, 'instance'>): ReturnType<typeof createLazyComponent<T, E>>;
78
- prefetch(options: Omit<PrefetchOptions, 'instance'>): ReturnType<typeof prefetch>;
79
- collectSSRAssets(options: Omit<Parameters<typeof collectSSRAssets>[0], 'instance'>): ReturnType<typeof collectSSRAssets>;
80
- }
81
- }
1
+ export * from './lazy/data-fetch';
@@ -1,7 +1,7 @@
1
- import { x as DATA_FETCH_FUNCTION } from "./utils-dUgb9Jkm.mjs";
2
- import { C, a, b, d, c, g, r } from "./utils-dUgb9Jkm.mjs";
3
- import { d as dataFetchFunction } from "./prefetch-CK3EZdY4.mjs";
4
- import { i, p } from "./prefetch-CK3EZdY4.mjs";
1
+ import { y as DATA_FETCH_FUNCTION } from "./utils-BBP3hEeV.mjs";
2
+ import { C, a, c, b, d, g, r } from "./utils-BBP3hEeV.mjs";
3
+ import { d as dataFetchFunction } from "./prefetch-TKq_EK_q.mjs";
4
+ import { i, p } from "./prefetch-TKq_EK_q.mjs";
5
5
  async function callDataFetch() {
6
6
  const dataFetch = globalThis[DATA_FETCH_FUNCTION];
7
7
  if (dataFetch) {
@@ -15,10 +15,10 @@ async function callDataFetch() {
15
15
  export {
16
16
  C as CacheSize,
17
17
  a as CacheTime,
18
- b as cache,
18
+ c as cache,
19
19
  callDataFetch,
20
- d as clearStore,
21
- c as configureCache,
20
+ b as clearStore,
21
+ d as configureCache,
22
22
  g as generateKey,
23
23
  i as injectDataFetch,
24
24
  p as prefetch,
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-DSURjnZ0.js");
4
+ const lazyUtils = require("./utils-5dGErM3C.js");
5
+ const dataFetchUtils = require("./data-fetch-utils.cjs.js");
6
+ const prefetch = require("./prefetch-Bxf6DSx_.js");
7
+ exports.autoFetchDataPlugin = lazyLoadComponentPlugin.autoFetchData;
8
+ exports.collectSSRAssets = lazyLoadComponentPlugin.collectSSRAssets;
9
+ exports.createLazyComponent = lazyLoadComponentPlugin.createLazyComponent;
10
+ exports.lazyLoadComponentPlugin = lazyLoadComponentPlugin.lazyLoadComponentPlugin;
11
+ exports.CacheSize = lazyUtils.CacheSize;
12
+ exports.CacheTime = lazyUtils.CacheTime;
13
+ exports.ERROR_TYPE = lazyUtils.ERROR_TYPE;
14
+ exports.cache = lazyUtils.cache;
15
+ exports.clearStore = lazyUtils.clearStore;
16
+ exports.configureCache = lazyUtils.configureCache;
17
+ exports.flushDataFetch = lazyUtils.flushDataFetch;
18
+ exports.generateKey = lazyUtils.generateKey;
19
+ exports.revalidateTag = lazyUtils.revalidateTag;
20
+ exports.setSSREnv = lazyUtils.setSSREnv;
21
+ exports.callDataFetch = dataFetchUtils.callDataFetch;
22
+ exports.prefetch = prefetch.prefetch;
@@ -0,0 +1,4 @@
1
+ export { ERROR_TYPE, createLazyComponent, collectSSRAssets, callDataFetch, setSSREnv, autoFetchDataPlugin, CacheSize, CacheTime, configureCache, generateKey, cache, revalidateTag, clearStore, prefetch, } from './lazy';
2
+ export { lazyLoadComponentPlugin } from './plugins/lazy-load-component-plugin';
3
+ export { flushDataFetch } from './lazy/utils';
4
+ export type { DataFetchParams, NoSSRRemoteInfo, CollectSSRAssetsOptions, CreateLazyComponentOptions, CacheStatus, CacheStatsInfo, PrefetchOptions, } from './lazy';
@@ -0,0 +1,22 @@
1
+ import { a, c, b, l } from "./lazy-load-component-plugin-NZphPG7_.mjs";
2
+ import { C, a as a2, E, c as c2, b as b2, d, f, g, r, s } from "./utils-BBP3hEeV.mjs";
3
+ import { callDataFetch } from "./data-fetch-utils.es.js";
4
+ import { p } from "./prefetch-TKq_EK_q.mjs";
5
+ export {
6
+ C as CacheSize,
7
+ a2 as CacheTime,
8
+ E as ERROR_TYPE,
9
+ a as autoFetchDataPlugin,
10
+ c2 as cache,
11
+ callDataFetch,
12
+ b2 as clearStore,
13
+ c as collectSSRAssets,
14
+ d as configureCache,
15
+ b as createLazyComponent,
16
+ f as flushDataFetch,
17
+ g as generateKey,
18
+ l as lazyLoadComponentPlugin,
19
+ p as prefetch,
20
+ r as revalidateTag,
21
+ s as setSSREnv
22
+ };
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import type { ErrorFallbackProps } from './types';
3
+ type ErrorBoundaryProps = {
4
+ children: React.ReactNode;
5
+ FallbackComponent: React.ComponentType<ErrorFallbackProps>;
6
+ };
7
+ type ErrorBoundaryState = {
8
+ didCatch: boolean;
9
+ error: Error | null;
10
+ };
11
+ export declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
12
+ state: ErrorBoundaryState;
13
+ static getDerivedStateFromError(error: Error): ErrorBoundaryState;
14
+ private resetErrorBoundary;
15
+ render(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
16
+ }
17
+ export {};
@@ -0,0 +1 @@
1
+ export {};