@module-federation/bridge-react 0.0.0-feat-operate-openruntime-20260722064424 → 0.0.0-feat-operate-openruntime-20260726083609
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 +3 -3
- package/dist/base.es.js +4 -4
- package/dist/bridge-base-CWH2jrzc.js +194 -0
- package/dist/bridge-base-Dicrf12A.mjs +178 -0
- package/dist/{createHelpers-BPY96on1.mjs → createHelpers-BhiAn2Z-.mjs} +27 -99
- package/dist/{createHelpers-DHiqow5q.js → createHelpers-DyjMKnYB.js} +27 -99
- package/dist/data-fetch-utils.cjs.js +1 -1
- package/dist/data-fetch-utils.es.js +2 -2
- package/dist/data-fetch.cjs.js +2 -2
- package/dist/data-fetch.es.js +2 -2
- package/dist/index.cjs.js +29 -39
- package/dist/index.es.js +26 -36
- package/dist/{lazy-load-component-plugin-B_RQ-mN9.mjs → lazy-load-component-plugin-CvVuo5ya.mjs} +1 -1
- package/dist/{lazy-load-component-plugin-FvvIc-xn.js → lazy-load-component-plugin-CxGI0r0V.js} +1 -1
- package/dist/lazy-load-component-plugin.cjs.js +2 -2
- package/dist/lazy-load-component-plugin.es.js +2 -2
- package/dist/{prefetch-BlQAQI2q.js → prefetch-_kTu3xdD.js} +63 -246
- package/dist/{prefetch-DHsOOiLM.mjs → prefetch-n6QIENVB.mjs} +63 -246
- package/dist/types.d.ts +2 -2
- package/dist/v18.cjs.js +1 -1
- package/dist/v18.es.js +1 -1
- package/dist/v19.cjs.js +1 -1
- package/dist/v19.es.js +1 -1
- package/package.json +5 -5
- package/dist/bridge-base-DEyVXKxz.mjs +0 -367
- package/dist/bridge-base-DG7XFfCC.js +0 -383
package/dist/base.cjs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const createHelpers = require("./createHelpers-
|
|
4
|
-
const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-
|
|
3
|
+
const createHelpers = require("./createHelpers-DyjMKnYB.js");
|
|
4
|
+
const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-CxGI0r0V.js");
|
|
5
5
|
const lazyUtils = require("./utils-5dGErM3C.js");
|
|
6
6
|
const dataFetchUtils = require("./data-fetch-utils.cjs.js");
|
|
7
|
-
const prefetch = require("./prefetch-
|
|
7
|
+
const prefetch = require("./prefetch-_kTu3xdD.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
|
-
import { c as createRemoteAppComponentFactory, a as createDeprecatedRemoteComponentFactory, R as RemoteAppWrapper } from "./createHelpers-
|
|
2
|
-
import { b } from "./createHelpers-
|
|
3
|
-
import { a, c, b as b2, l } from "./lazy-load-component-plugin-
|
|
1
|
+
import { c as createRemoteAppComponentFactory, a as createDeprecatedRemoteComponentFactory, R as RemoteAppWrapper } from "./createHelpers-BhiAn2Z-.mjs";
|
|
2
|
+
import { b } from "./createHelpers-BhiAn2Z-.mjs";
|
|
3
|
+
import { a, c, b as b2, l } from "./lazy-load-component-plugin-CvVuo5ya.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-
|
|
6
|
+
import { p } from "./prefetch-n6QIENVB.mjs";
|
|
7
7
|
const createRemoteAppComponent = createRemoteAppComponentFactory(RemoteAppWrapper);
|
|
8
8
|
const createRemoteComponent = createDeprecatedRemoteComponentFactory(
|
|
9
9
|
createRemoteAppComponent
|
|
@@ -0,0 +1,194 @@
|
|
|
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);
|
|
5
|
+
const React = require("react");
|
|
6
|
+
const index = require("./index-DbjGCKOr.js");
|
|
7
|
+
const plugin = require("./plugin.cjs.js");
|
|
8
|
+
function _interopNamespaceDefault(e) {
|
|
9
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
10
|
+
if (e) {
|
|
11
|
+
for (const k in e) {
|
|
12
|
+
if (k !== "default") {
|
|
13
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: () => e[k]
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
n.default = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
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);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
static getDerivedStateFromError(error) {
|
|
37
|
+
return { didCatch: true, error };
|
|
38
|
+
}
|
|
39
|
+
render() {
|
|
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
|
+
);
|
|
48
|
+
}
|
|
49
|
+
return this.props.children;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function createBaseBridgeComponent({
|
|
53
|
+
createRoot,
|
|
54
|
+
defaultRootOptions,
|
|
55
|
+
...bridgeInfo
|
|
56
|
+
}) {
|
|
57
|
+
return () => {
|
|
58
|
+
const rootMap = /* @__PURE__ */ new Map();
|
|
59
|
+
const instance = plugin.federationRuntime.instance;
|
|
60
|
+
index.LoggerInstance.debug(
|
|
61
|
+
`createBridgeComponent instance from props >>>`,
|
|
62
|
+
instance
|
|
63
|
+
);
|
|
64
|
+
const RawComponent = (info) => {
|
|
65
|
+
const { appInfo, propsInfo, ...restProps } = info;
|
|
66
|
+
const { moduleName, memoryRoute, basename = "/" } = appInfo;
|
|
67
|
+
return /* @__PURE__ */ React__namespace.createElement(index.RouterContext.Provider, { value: { moduleName, basename, memoryRoute } }, /* @__PURE__ */ React__namespace.createElement(
|
|
68
|
+
bridgeInfo.rootComponent,
|
|
69
|
+
{
|
|
70
|
+
...propsInfo,
|
|
71
|
+
basename,
|
|
72
|
+
...restProps
|
|
73
|
+
}
|
|
74
|
+
));
|
|
75
|
+
};
|
|
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
|
+
};
|
|
82
|
+
const BridgeWrapper = ({
|
|
83
|
+
basename,
|
|
84
|
+
moduleName,
|
|
85
|
+
memoryRoute,
|
|
86
|
+
propsInfo
|
|
87
|
+
}) => /* @__PURE__ */ React__namespace.createElement(ErrorBoundary, { FallbackComponent: DefaultFallback }, /* @__PURE__ */ React__namespace.createElement(
|
|
88
|
+
RawComponent,
|
|
89
|
+
{
|
|
90
|
+
appInfo: {
|
|
91
|
+
moduleName,
|
|
92
|
+
basename,
|
|
93
|
+
memoryRoute
|
|
94
|
+
},
|
|
95
|
+
propsInfo
|
|
96
|
+
}
|
|
97
|
+
));
|
|
98
|
+
return {
|
|
99
|
+
async render(info) {
|
|
100
|
+
var _a, _b, _c, _d, _e, _f;
|
|
101
|
+
index.LoggerInstance.debug(`createBridgeComponent render Info`, info);
|
|
102
|
+
const {
|
|
103
|
+
moduleName,
|
|
104
|
+
dom,
|
|
105
|
+
basename,
|
|
106
|
+
memoryRoute,
|
|
107
|
+
rootOptions,
|
|
108
|
+
...propsInfo
|
|
109
|
+
} = info;
|
|
110
|
+
const operationContext = {
|
|
111
|
+
side: "producer",
|
|
112
|
+
framework: "react",
|
|
113
|
+
operation: rootMap.has(dom) ? "update" : "render",
|
|
114
|
+
target: dom,
|
|
115
|
+
moduleName,
|
|
116
|
+
reason: "direct"
|
|
117
|
+
};
|
|
118
|
+
const mergedRootOptions = {
|
|
119
|
+
...defaultRootOptions,
|
|
120
|
+
...rootOptions
|
|
121
|
+
};
|
|
122
|
+
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(
|
|
123
|
+
info,
|
|
124
|
+
operationContext
|
|
125
|
+
)) || {};
|
|
126
|
+
const rootComponentWithErrorBoundary = /* @__PURE__ */ React__namespace.createElement(
|
|
127
|
+
BridgeWrapper,
|
|
128
|
+
{
|
|
129
|
+
basename,
|
|
130
|
+
moduleName,
|
|
131
|
+
memoryRoute,
|
|
132
|
+
propsInfo: {
|
|
133
|
+
...omitHostFallback(propsInfo),
|
|
134
|
+
basename,
|
|
135
|
+
...beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
let renderResult;
|
|
140
|
+
if (bridgeInfo.render) {
|
|
141
|
+
renderResult = await Promise.resolve(
|
|
142
|
+
bridgeInfo.render(rootComponentWithErrorBoundary, dom)
|
|
143
|
+
);
|
|
144
|
+
rootMap.set(dom, renderResult);
|
|
145
|
+
} else {
|
|
146
|
+
let root = rootMap.get(dom);
|
|
147
|
+
if (!root && createRoot) {
|
|
148
|
+
root = createRoot(dom, mergedRootOptions);
|
|
149
|
+
rootMap.set(dom, root);
|
|
150
|
+
}
|
|
151
|
+
if (root && "render" in root) {
|
|
152
|
+
root.render(rootComponentWithErrorBoundary);
|
|
153
|
+
}
|
|
154
|
+
renderResult = root;
|
|
155
|
+
}
|
|
156
|
+
((_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, {
|
|
157
|
+
context: operationContext,
|
|
158
|
+
result: renderResult
|
|
159
|
+
})) || {};
|
|
160
|
+
},
|
|
161
|
+
destroy(info) {
|
|
162
|
+
var _a, _b, _c, _d, _e, _f;
|
|
163
|
+
const { dom } = info;
|
|
164
|
+
index.LoggerInstance.debug(`createBridgeComponent destroy Info`, info);
|
|
165
|
+
const root = rootMap.get(dom);
|
|
166
|
+
const operationContext = {
|
|
167
|
+
side: "producer",
|
|
168
|
+
framework: "react",
|
|
169
|
+
operation: "destroy",
|
|
170
|
+
target: dom,
|
|
171
|
+
moduleName: info.moduleName,
|
|
172
|
+
reason: "direct"
|
|
173
|
+
};
|
|
174
|
+
(_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeDestroy) == null ? void 0 : _c.emit(
|
|
175
|
+
info,
|
|
176
|
+
operationContext
|
|
177
|
+
);
|
|
178
|
+
if (root) {
|
|
179
|
+
if ("unmount" in root) {
|
|
180
|
+
root.unmount();
|
|
181
|
+
} else {
|
|
182
|
+
index.LoggerInstance.warn("Root does not have unmount method");
|
|
183
|
+
}
|
|
184
|
+
rootMap.delete(dom);
|
|
185
|
+
}
|
|
186
|
+
(_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, {
|
|
187
|
+
context: operationContext
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
exports.ErrorBoundary = ErrorBoundary;
|
|
194
|
+
exports.createBaseBridgeComponent = createBaseBridgeComponent;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { L as LoggerInstance, R as RouterContext } from "./index-Bs2NxD2z.mjs";
|
|
6
|
+
import { federationRuntime } from "./plugin.es.js";
|
|
7
|
+
const initialState = { didCatch: false, error: null };
|
|
8
|
+
class ErrorBoundary extends React.Component {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
__publicField(this, "state", initialState);
|
|
12
|
+
__publicField(this, "resetErrorBoundary", (..._args) => {
|
|
13
|
+
if (this.state.didCatch) {
|
|
14
|
+
this.setState(initialState);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
static getDerivedStateFromError(error) {
|
|
19
|
+
return { didCatch: true, error };
|
|
20
|
+
}
|
|
21
|
+
render() {
|
|
22
|
+
if (this.state.didCatch) {
|
|
23
|
+
return /* @__PURE__ */ React.createElement(
|
|
24
|
+
this.props.FallbackComponent,
|
|
25
|
+
{
|
|
26
|
+
error: this.state.error,
|
|
27
|
+
resetErrorBoundary: this.resetErrorBoundary
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
return this.props.children;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function createBaseBridgeComponent({
|
|
35
|
+
createRoot,
|
|
36
|
+
defaultRootOptions,
|
|
37
|
+
...bridgeInfo
|
|
38
|
+
}) {
|
|
39
|
+
return () => {
|
|
40
|
+
const rootMap = /* @__PURE__ */ new Map();
|
|
41
|
+
const instance = federationRuntime.instance;
|
|
42
|
+
LoggerInstance.debug(
|
|
43
|
+
`createBridgeComponent instance from props >>>`,
|
|
44
|
+
instance
|
|
45
|
+
);
|
|
46
|
+
const RawComponent = (info) => {
|
|
47
|
+
const { appInfo, propsInfo, ...restProps } = info;
|
|
48
|
+
const { moduleName, memoryRoute, basename = "/" } = appInfo;
|
|
49
|
+
return /* @__PURE__ */ React.createElement(RouterContext.Provider, { value: { moduleName, basename, memoryRoute } }, /* @__PURE__ */ React.createElement(
|
|
50
|
+
bridgeInfo.rootComponent,
|
|
51
|
+
{
|
|
52
|
+
...propsInfo,
|
|
53
|
+
basename,
|
|
54
|
+
...restProps
|
|
55
|
+
}
|
|
56
|
+
));
|
|
57
|
+
};
|
|
58
|
+
const DefaultFallback = ({ error }) => /* @__PURE__ */ React.createElement("div", { role: "alert" }, /* @__PURE__ */ React.createElement("p", null, "Something went wrong:"), /* @__PURE__ */ React.createElement("pre", { style: { color: "red" } }, error instanceof Error ? error.message : String(error)));
|
|
59
|
+
const omitHostFallback = (props) => {
|
|
60
|
+
const nextProps = { ...props };
|
|
61
|
+
delete nextProps.fallback;
|
|
62
|
+
return nextProps;
|
|
63
|
+
};
|
|
64
|
+
const BridgeWrapper = ({
|
|
65
|
+
basename,
|
|
66
|
+
moduleName,
|
|
67
|
+
memoryRoute,
|
|
68
|
+
propsInfo
|
|
69
|
+
}) => /* @__PURE__ */ React.createElement(ErrorBoundary, { FallbackComponent: DefaultFallback }, /* @__PURE__ */ React.createElement(
|
|
70
|
+
RawComponent,
|
|
71
|
+
{
|
|
72
|
+
appInfo: {
|
|
73
|
+
moduleName,
|
|
74
|
+
basename,
|
|
75
|
+
memoryRoute
|
|
76
|
+
},
|
|
77
|
+
propsInfo
|
|
78
|
+
}
|
|
79
|
+
));
|
|
80
|
+
return {
|
|
81
|
+
async render(info) {
|
|
82
|
+
var _a, _b, _c, _d, _e, _f;
|
|
83
|
+
LoggerInstance.debug(`createBridgeComponent render Info`, info);
|
|
84
|
+
const {
|
|
85
|
+
moduleName,
|
|
86
|
+
dom,
|
|
87
|
+
basename,
|
|
88
|
+
memoryRoute,
|
|
89
|
+
rootOptions,
|
|
90
|
+
...propsInfo
|
|
91
|
+
} = info;
|
|
92
|
+
const operationContext = {
|
|
93
|
+
side: "producer",
|
|
94
|
+
framework: "react",
|
|
95
|
+
operation: rootMap.has(dom) ? "update" : "render",
|
|
96
|
+
target: dom,
|
|
97
|
+
moduleName,
|
|
98
|
+
reason: "direct"
|
|
99
|
+
};
|
|
100
|
+
const mergedRootOptions = {
|
|
101
|
+
...defaultRootOptions,
|
|
102
|
+
...rootOptions
|
|
103
|
+
};
|
|
104
|
+
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(
|
|
105
|
+
info,
|
|
106
|
+
operationContext
|
|
107
|
+
)) || {};
|
|
108
|
+
const rootComponentWithErrorBoundary = /* @__PURE__ */ React.createElement(
|
|
109
|
+
BridgeWrapper,
|
|
110
|
+
{
|
|
111
|
+
basename,
|
|
112
|
+
moduleName,
|
|
113
|
+
memoryRoute,
|
|
114
|
+
propsInfo: {
|
|
115
|
+
...omitHostFallback(propsInfo),
|
|
116
|
+
basename,
|
|
117
|
+
...beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
let renderResult;
|
|
122
|
+
if (bridgeInfo.render) {
|
|
123
|
+
renderResult = await Promise.resolve(
|
|
124
|
+
bridgeInfo.render(rootComponentWithErrorBoundary, dom)
|
|
125
|
+
);
|
|
126
|
+
rootMap.set(dom, renderResult);
|
|
127
|
+
} else {
|
|
128
|
+
let root = rootMap.get(dom);
|
|
129
|
+
if (!root && createRoot) {
|
|
130
|
+
root = createRoot(dom, mergedRootOptions);
|
|
131
|
+
rootMap.set(dom, root);
|
|
132
|
+
}
|
|
133
|
+
if (root && "render" in root) {
|
|
134
|
+
root.render(rootComponentWithErrorBoundary);
|
|
135
|
+
}
|
|
136
|
+
renderResult = root;
|
|
137
|
+
}
|
|
138
|
+
((_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, {
|
|
139
|
+
context: operationContext,
|
|
140
|
+
result: renderResult
|
|
141
|
+
})) || {};
|
|
142
|
+
},
|
|
143
|
+
destroy(info) {
|
|
144
|
+
var _a, _b, _c, _d, _e, _f;
|
|
145
|
+
const { dom } = info;
|
|
146
|
+
LoggerInstance.debug(`createBridgeComponent destroy Info`, info);
|
|
147
|
+
const root = rootMap.get(dom);
|
|
148
|
+
const operationContext = {
|
|
149
|
+
side: "producer",
|
|
150
|
+
framework: "react",
|
|
151
|
+
operation: "destroy",
|
|
152
|
+
target: dom,
|
|
153
|
+
moduleName: info.moduleName,
|
|
154
|
+
reason: "direct"
|
|
155
|
+
};
|
|
156
|
+
(_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeDestroy) == null ? void 0 : _c.emit(
|
|
157
|
+
info,
|
|
158
|
+
operationContext
|
|
159
|
+
);
|
|
160
|
+
if (root) {
|
|
161
|
+
if ("unmount" in root) {
|
|
162
|
+
root.unmount();
|
|
163
|
+
} else {
|
|
164
|
+
LoggerInstance.warn("Root does not have unmount method");
|
|
165
|
+
}
|
|
166
|
+
rootMap.delete(dom);
|
|
167
|
+
}
|
|
168
|
+
(_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, {
|
|
169
|
+
context: operationContext
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
export {
|
|
176
|
+
ErrorBoundary as E,
|
|
177
|
+
createBaseBridgeComponent as c
|
|
178
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as createBaseBridgeComponent,
|
|
1
|
+
import { c as createBaseBridgeComponent, E as ErrorBoundary } from "./bridge-base-Dicrf12A.mjs";
|
|
2
2
|
import ReactDOM from "react-dom";
|
|
3
3
|
import { L as LoggerInstance, g as getRootDomDefaultClassName } from "./index-Bs2NxD2z.mjs";
|
|
4
4
|
import React__default, { forwardRef, useRef, useState, useEffect } from "react";
|
|
@@ -49,8 +49,6 @@ const RemoteAppWrapper = forwardRef(function(props, ref) {
|
|
|
49
49
|
const rootRef = ref && "current" in ref ? ref : useRef(null);
|
|
50
50
|
const renderDom = useRef(null);
|
|
51
51
|
const providerInfoRef = useRef(null);
|
|
52
|
-
const [bridgeId] = useState(l);
|
|
53
|
-
const hasRenderedRef = useRef(false);
|
|
54
52
|
const [initialized, setInitialized] = useState(false);
|
|
55
53
|
LoggerInstance.debug(`RemoteAppWrapper instance from props >>>`, instance);
|
|
56
54
|
useEffect(() => {
|
|
@@ -59,7 +57,7 @@ const RemoteAppWrapper = forwardRef(function(props, ref) {
|
|
|
59
57
|
providerInfoRef.current = providerReturn;
|
|
60
58
|
setInitialized(true);
|
|
61
59
|
return () => {
|
|
62
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
60
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
63
61
|
if ((_a = providerInfoRef.current) == null ? void 0 : _a.destroy) {
|
|
64
62
|
LoggerInstance.debug(
|
|
65
63
|
`createRemoteAppComponent LazyComponent destroy >>>`,
|
|
@@ -73,60 +71,25 @@ const RemoteAppWrapper = forwardRef(function(props, ref) {
|
|
|
73
71
|
fallback,
|
|
74
72
|
...resProps
|
|
75
73
|
};
|
|
76
|
-
const operationContext =
|
|
74
|
+
const operationContext = {
|
|
77
75
|
side: "consumer",
|
|
78
76
|
framework: "react",
|
|
79
77
|
operation: "destroy",
|
|
80
|
-
|
|
78
|
+
target: renderDom.current || void 0,
|
|
81
79
|
moduleName,
|
|
82
80
|
reason: "unmount"
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
instance,
|
|
87
|
-
"beforeBridgeOperation",
|
|
81
|
+
};
|
|
82
|
+
(_d = (_c = (_b = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _b.lifecycle) == null ? void 0 : _c.beforeBridgeDestroy) == null ? void 0 : _d.emit(
|
|
83
|
+
destroyInfo,
|
|
88
84
|
operationContext
|
|
89
85
|
);
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
);
|
|
98
|
-
if (result && typeof result.then === "function") {
|
|
99
|
-
void result.then(
|
|
100
|
-
() => I(
|
|
101
|
-
instance,
|
|
102
|
-
"afterBridgeOperation",
|
|
103
|
-
w(operationContext, "success")
|
|
104
|
-
),
|
|
105
|
-
(error) => {
|
|
106
|
-
I(
|
|
107
|
-
instance,
|
|
108
|
-
"afterBridgeOperation",
|
|
109
|
-
w(operationContext, "error", error)
|
|
110
|
-
);
|
|
111
|
-
throw error;
|
|
112
|
-
}
|
|
113
|
-
);
|
|
114
|
-
} else {
|
|
115
|
-
I(
|
|
116
|
-
instance,
|
|
117
|
-
"afterBridgeOperation",
|
|
118
|
-
w(operationContext, "success")
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
} catch (error) {
|
|
122
|
-
I(
|
|
123
|
-
instance,
|
|
124
|
-
"afterBridgeOperation",
|
|
125
|
-
w(operationContext, "error", error)
|
|
126
|
-
);
|
|
127
|
-
throw error;
|
|
128
|
-
}
|
|
129
|
-
hasRenderedRef.current = false;
|
|
86
|
+
providerInfoRef.current.destroy({
|
|
87
|
+
moduleName,
|
|
88
|
+
dom: renderDom.current
|
|
89
|
+
});
|
|
90
|
+
(_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, {
|
|
91
|
+
context: operationContext
|
|
92
|
+
});
|
|
130
93
|
}
|
|
131
94
|
};
|
|
132
95
|
}, [moduleName]);
|
|
@@ -142,57 +105,22 @@ const RemoteAppWrapper = forwardRef(function(props, ref) {
|
|
|
142
105
|
...resProps
|
|
143
106
|
};
|
|
144
107
|
renderDom.current = rootRef.current;
|
|
145
|
-
const operationContext =
|
|
108
|
+
const operationContext = {
|
|
146
109
|
side: "consumer",
|
|
147
110
|
framework: "react",
|
|
148
|
-
operation:
|
|
149
|
-
|
|
150
|
-
moduleName
|
|
151
|
-
|
|
111
|
+
operation: "render",
|
|
112
|
+
target: renderDom.current || void 0,
|
|
113
|
+
moduleName
|
|
114
|
+
};
|
|
115
|
+
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(
|
|
116
|
+
renderProps,
|
|
117
|
+
operationContext
|
|
118
|
+
)) || {};
|
|
119
|
+
renderProps = { ...renderProps, ...beforeBridgeRenderRes.extraProps };
|
|
120
|
+
providerInfoRef.current.render(renderProps);
|
|
121
|
+
(_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, {
|
|
122
|
+
context: operationContext
|
|
152
123
|
});
|
|
153
|
-
h(renderProps, operationContext);
|
|
154
|
-
I(instance, "beforeBridgeOperation", operationContext);
|
|
155
|
-
try {
|
|
156
|
-
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(
|
|
157
|
-
renderProps
|
|
158
|
-
)) || {};
|
|
159
|
-
renderProps = { ...renderProps, ...beforeBridgeRenderRes.extraProps };
|
|
160
|
-
h(renderProps, operationContext);
|
|
161
|
-
I(instance, "bridgeRenderInvoked", operationContext);
|
|
162
|
-
const result = providerInfoRef.current.render(renderProps);
|
|
163
|
-
hasRenderedRef.current = true;
|
|
164
|
-
(_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);
|
|
165
|
-
if (result && typeof result.then === "function") {
|
|
166
|
-
void result.then(
|
|
167
|
-
() => I(
|
|
168
|
-
instance,
|
|
169
|
-
"afterBridgeOperation",
|
|
170
|
-
w(operationContext, "success")
|
|
171
|
-
),
|
|
172
|
-
(error) => {
|
|
173
|
-
I(
|
|
174
|
-
instance,
|
|
175
|
-
"afterBridgeOperation",
|
|
176
|
-
w(operationContext, "error", error)
|
|
177
|
-
);
|
|
178
|
-
throw error;
|
|
179
|
-
}
|
|
180
|
-
);
|
|
181
|
-
} else {
|
|
182
|
-
I(
|
|
183
|
-
instance,
|
|
184
|
-
"afterBridgeOperation",
|
|
185
|
-
w(operationContext, "success")
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
} catch (error) {
|
|
189
|
-
I(
|
|
190
|
-
instance,
|
|
191
|
-
"afterBridgeOperation",
|
|
192
|
-
w(operationContext, "error", error)
|
|
193
|
-
);
|
|
194
|
-
throw error;
|
|
195
|
-
}
|
|
196
124
|
}, [initialized, ...Object.values(props)]);
|
|
197
125
|
const rootComponentClassName = `${getRootDomDefaultClassName(moduleName)} ${className || ""}`;
|
|
198
126
|
return /* @__PURE__ */ React__default.createElement("div", { className: rootComponentClassName, style, ref: rootRef }, loading);
|