@module-federation/bridge-react 0.0.0-feat-operate-openruntime-20260722064424 → 0.0.0-feat-operate-openruntime-20260726151341
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-CHnL6Q9P.mjs +171 -0
- package/dist/bridge-base-DSYKAGGD.js +187 -0
- package/dist/{createHelpers-BPY96on1.mjs → createHelpers-D3Sg5lKp.mjs} +24 -100
- package/dist/{createHelpers-DHiqow5q.js → createHelpers-D6thyyLv.js} +24 -100
- 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 +28 -39
- package/dist/index.es.js +25 -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-D6thyyLv.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-D3Sg5lKp.mjs";
|
|
2
|
+
import { b } from "./createHelpers-D3Sg5lKp.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,171 @@
|
|
|
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
|
+
reason: "direct"
|
|
97
|
+
};
|
|
98
|
+
const mergedRootOptions = {
|
|
99
|
+
...defaultRootOptions,
|
|
100
|
+
...rootOptions
|
|
101
|
+
};
|
|
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(
|
|
103
|
+
info,
|
|
104
|
+
operationContext
|
|
105
|
+
)) || {};
|
|
106
|
+
const rootComponentWithErrorBoundary = /* @__PURE__ */ React.createElement(
|
|
107
|
+
BridgeWrapper,
|
|
108
|
+
{
|
|
109
|
+
basename,
|
|
110
|
+
moduleName,
|
|
111
|
+
memoryRoute,
|
|
112
|
+
propsInfo: {
|
|
113
|
+
...omitHostFallback(propsInfo),
|
|
114
|
+
basename,
|
|
115
|
+
...beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
if (bridgeInfo.render) {
|
|
120
|
+
const root = await Promise.resolve(
|
|
121
|
+
bridgeInfo.render(rootComponentWithErrorBoundary, dom)
|
|
122
|
+
);
|
|
123
|
+
rootMap.set(dom, root);
|
|
124
|
+
} else {
|
|
125
|
+
let root = rootMap.get(dom);
|
|
126
|
+
if (!root && createRoot) {
|
|
127
|
+
root = createRoot(dom, mergedRootOptions);
|
|
128
|
+
rootMap.set(dom, root);
|
|
129
|
+
}
|
|
130
|
+
if (root && "render" in root) {
|
|
131
|
+
root.render(rootComponentWithErrorBoundary);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
((_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, {
|
|
135
|
+
context: operationContext
|
|
136
|
+
})) || {};
|
|
137
|
+
},
|
|
138
|
+
destroy(info) {
|
|
139
|
+
var _a, _b, _c, _d, _e, _f;
|
|
140
|
+
const { dom } = info;
|
|
141
|
+
LoggerInstance.debug(`createBridgeComponent destroy Info`, info);
|
|
142
|
+
const root = rootMap.get(dom);
|
|
143
|
+
const operationContext = {
|
|
144
|
+
side: "producer",
|
|
145
|
+
framework: "react",
|
|
146
|
+
operation: "destroy",
|
|
147
|
+
reason: "direct"
|
|
148
|
+
};
|
|
149
|
+
(_c = (_b = (_a = instance == null ? void 0 : instance.bridgeHook) == null ? void 0 : _a.lifecycle) == null ? void 0 : _b.beforeBridgeDestroy) == null ? void 0 : _c.emit(
|
|
150
|
+
info,
|
|
151
|
+
operationContext
|
|
152
|
+
);
|
|
153
|
+
if (root) {
|
|
154
|
+
if ("unmount" in root) {
|
|
155
|
+
root.unmount();
|
|
156
|
+
} else {
|
|
157
|
+
LoggerInstance.warn("Root does not have unmount method");
|
|
158
|
+
}
|
|
159
|
+
rootMap.delete(dom);
|
|
160
|
+
}
|
|
161
|
+
(_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, {
|
|
162
|
+
context: operationContext
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
export {
|
|
169
|
+
ErrorBoundary as E,
|
|
170
|
+
createBaseBridgeComponent as c
|
|
171
|
+
};
|
|
@@ -0,0 +1,187 @@
|
|
|
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
|
+
reason: "direct"
|
|
115
|
+
};
|
|
116
|
+
const mergedRootOptions = {
|
|
117
|
+
...defaultRootOptions,
|
|
118
|
+
...rootOptions
|
|
119
|
+
};
|
|
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
|
+
)) || {};
|
|
124
|
+
const rootComponentWithErrorBoundary = /* @__PURE__ */ React__namespace.createElement(
|
|
125
|
+
BridgeWrapper,
|
|
126
|
+
{
|
|
127
|
+
basename,
|
|
128
|
+
moduleName,
|
|
129
|
+
memoryRoute,
|
|
130
|
+
propsInfo: {
|
|
131
|
+
...omitHostFallback(propsInfo),
|
|
132
|
+
basename,
|
|
133
|
+
...beforeBridgeRenderRes == null ? void 0 : beforeBridgeRenderRes.extraProps
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
if (bridgeInfo.render) {
|
|
138
|
+
const root = await Promise.resolve(
|
|
139
|
+
bridgeInfo.render(rootComponentWithErrorBoundary, dom)
|
|
140
|
+
);
|
|
141
|
+
rootMap.set(dom, root);
|
|
142
|
+
} else {
|
|
143
|
+
let root = rootMap.get(dom);
|
|
144
|
+
if (!root && createRoot) {
|
|
145
|
+
root = createRoot(dom, mergedRootOptions);
|
|
146
|
+
rootMap.set(dom, root);
|
|
147
|
+
}
|
|
148
|
+
if (root && "render" in root) {
|
|
149
|
+
root.render(rootComponentWithErrorBoundary);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
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
|
+
})) || {};
|
|
155
|
+
},
|
|
156
|
+
destroy(info) {
|
|
157
|
+
var _a, _b, _c, _d, _e, _f;
|
|
158
|
+
const { dom } = info;
|
|
159
|
+
index.LoggerInstance.debug(`createBridgeComponent destroy Info`, info);
|
|
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
|
+
);
|
|
171
|
+
if (root) {
|
|
172
|
+
if ("unmount" in root) {
|
|
173
|
+
root.unmount();
|
|
174
|
+
} else {
|
|
175
|
+
index.LoggerInstance.warn("Root does not have unmount method");
|
|
176
|
+
}
|
|
177
|
+
rootMap.delete(dom);
|
|
178
|
+
}
|
|
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
|
+
});
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
exports.ErrorBoundary = ErrorBoundary;
|
|
187
|
+
exports.createBaseBridgeComponent = createBaseBridgeComponent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as createBaseBridgeComponent,
|
|
1
|
+
import { c as createBaseBridgeComponent, E as ErrorBoundary } from "./bridge-base-CHnL6Q9P.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,23 @@ 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
|
-
bridgeId,
|
|
81
|
-
moduleName,
|
|
82
78
|
reason: "unmount"
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
instance,
|
|
87
|
-
"beforeBridgeOperation",
|
|
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,
|
|
88
82
|
operationContext
|
|
89
83
|
);
|
|
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;
|
|
84
|
+
providerInfoRef.current.destroy({
|
|
85
|
+
moduleName,
|
|
86
|
+
dom: renderDom.current
|
|
87
|
+
});
|
|
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
|
|
90
|
+
});
|
|
130
91
|
}
|
|
131
92
|
};
|
|
132
93
|
}, [moduleName]);
|
|
@@ -142,57 +103,20 @@ const RemoteAppWrapper = forwardRef(function(props, ref) {
|
|
|
142
103
|
...resProps
|
|
143
104
|
};
|
|
144
105
|
renderDom.current = rootRef.current;
|
|
145
|
-
const operationContext =
|
|
106
|
+
const operationContext = {
|
|
146
107
|
side: "consumer",
|
|
147
108
|
framework: "react",
|
|
148
|
-
operation:
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
+
)) || {};
|
|
115
|
+
renderProps = { ...renderProps, ...beforeBridgeRenderRes.extraProps };
|
|
116
|
+
providerInfoRef.current.render(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
|
|
152
119
|
});
|
|
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
120
|
}, [initialized, ...Object.values(props)]);
|
|
197
121
|
const rootComponentClassName = `${getRootDomDefaultClassName(moduleName)} ${className || ""}`;
|
|
198
122
|
return /* @__PURE__ */ React__default.createElement("div", { className: rootComponentClassName, style, ref: rootRef }, loading);
|