@modern-js/plugin-garfish 2.68.19-alpha.1 → 2.68.19
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/cjs/runtime/utils/apps.js +7 -101
- package/dist/esm/runtime/utils/apps.js +6 -121
- package/dist/esm-node/runtime/utils/apps.js +7 -101
- package/package.json +11 -11
|
@@ -55,35 +55,6 @@ function pathJoin(...args) {
|
|
|
55
55
|
}, "");
|
|
56
56
|
return res || "/";
|
|
57
57
|
}
|
|
58
|
-
function deepEqualExcludeFunctions(prev, next) {
|
|
59
|
-
if (prev === next)
|
|
60
|
-
return true;
|
|
61
|
-
if (!prev || !next)
|
|
62
|
-
return false;
|
|
63
|
-
if (typeof prev !== "object" || typeof next !== "object")
|
|
64
|
-
return false;
|
|
65
|
-
const prevKeys = Object.keys(prev).filter((key) => typeof prev[key] !== "function");
|
|
66
|
-
const nextKeys = Object.keys(next).filter((key) => typeof next[key] !== "function");
|
|
67
|
-
if (prevKeys.length !== nextKeys.length)
|
|
68
|
-
return false;
|
|
69
|
-
for (const key of prevKeys) {
|
|
70
|
-
if (!nextKeys.includes(key))
|
|
71
|
-
return false;
|
|
72
|
-
const prevVal = prev[key];
|
|
73
|
-
const nextVal = next[key];
|
|
74
|
-
if (typeof prevVal === "function" || typeof nextVal === "function") {
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
if (typeof prevVal === "object" && typeof nextVal === "object") {
|
|
78
|
-
if (!deepEqualExcludeFunctions(prevVal, nextVal)) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
} else if (prevVal !== nextVal) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
58
|
function getAppInstance(options, appInfo, manifest) {
|
|
88
59
|
const componentSetterRegistry = {
|
|
89
60
|
current: null
|
|
@@ -92,14 +63,10 @@ function getAppInstance(options, appInfo, manifest) {
|
|
|
92
63
|
var _context_router, _context_router1, _context_router2, _context_router3, _context_router4;
|
|
93
64
|
const appRef = (0, import_react.useRef)(null);
|
|
94
65
|
const locationHrefRef = (0, import_react.useRef)("");
|
|
95
|
-
const propsRef = (0, import_react.useRef)(props);
|
|
96
|
-
const previousPropsRef = (0, import_react.useRef)(props);
|
|
97
|
-
const propsUpdateCounterRef = (0, import_react.useRef)(0);
|
|
98
66
|
const domId = (0, import_util.generateSubAppContainerKey)(appInfo);
|
|
99
67
|
const [{ component: SubModuleComponent }, setSubModuleComponent] = (0, import_react.useState)({
|
|
100
68
|
component: null
|
|
101
69
|
});
|
|
102
|
-
const [propsUpdateKey, setPropsUpdateKey] = (0, import_react.useState)(0);
|
|
103
70
|
const context = (0, import_react.useContext)(import_runtime.RuntimeReactContext);
|
|
104
71
|
var _props_useRouteMatch;
|
|
105
72
|
const useRouteMatch = (_props_useRouteMatch = props.useRouteMatch) !== null && _props_useRouteMatch !== void 0 ? _props_useRouteMatch : context === null || context === void 0 ? void 0 : (_context_router = context.router) === null || _context_router === void 0 ? void 0 : _context_router.useRouteMatch;
|
|
@@ -166,45 +133,9 @@ or directly pass the "basename":
|
|
|
166
133
|
}, [
|
|
167
134
|
locationPathname
|
|
168
135
|
]);
|
|
169
|
-
(0, import_react.useEffect)(() => {
|
|
170
|
-
const prevPropsForCompare = {
|
|
171
|
-
...previousPropsRef.current
|
|
172
|
-
};
|
|
173
|
-
const currentPropsForCompare = {
|
|
174
|
-
...props
|
|
175
|
-
};
|
|
176
|
-
Object.keys(prevPropsForCompare).forEach((key) => {
|
|
177
|
-
if (typeof prevPropsForCompare[key] === "function") {
|
|
178
|
-
delete prevPropsForCompare[key];
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
Object.keys(currentPropsForCompare).forEach((key) => {
|
|
182
|
-
if (typeof currentPropsForCompare[key] === "function") {
|
|
183
|
-
delete currentPropsForCompare[key];
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
if (!deepEqualExcludeFunctions(prevPropsForCompare, currentPropsForCompare)) {
|
|
187
|
-
var _appRef_current;
|
|
188
|
-
previousPropsRef.current = props;
|
|
189
|
-
propsRef.current = props;
|
|
190
|
-
propsUpdateCounterRef.current += 1;
|
|
191
|
-
setPropsUpdateKey((prev) => prev + 1);
|
|
192
|
-
if ((_appRef_current = appRef.current) === null || _appRef_current === void 0 ? void 0 : _appRef_current.mounted) {
|
|
193
|
-
window.dispatchEvent(new CustomEvent("garfishPropsUpdated", {
|
|
194
|
-
detail: {
|
|
195
|
-
appName: appInfo.name,
|
|
196
|
-
props
|
|
197
|
-
}
|
|
198
|
-
}));
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}, [
|
|
202
|
-
props,
|
|
203
|
-
appInfo.name
|
|
204
|
-
]);
|
|
205
136
|
(0, import_react.useEffect)(() => {
|
|
206
137
|
componentSetterRegistry.current = setSubModuleComponent;
|
|
207
|
-
const { setLoadingState
|
|
138
|
+
const { setLoadingState, ...userProps } = props;
|
|
208
139
|
const loadAppOptions = {
|
|
209
140
|
cache: true,
|
|
210
141
|
insulationVariable: [
|
|
@@ -248,7 +179,7 @@ or directly pass the "basename":
|
|
|
248
179
|
};
|
|
249
180
|
}
|
|
250
181
|
};
|
|
251
|
-
|
|
182
|
+
setLoadingState({
|
|
252
183
|
isLoading: true,
|
|
253
184
|
error: null
|
|
254
185
|
});
|
|
@@ -262,7 +193,7 @@ or directly pass the "basename":
|
|
|
262
193
|
throw new Error(`MicroApp Garfish.loadApp "${appInfo.name}" result is null`);
|
|
263
194
|
}
|
|
264
195
|
appRef.current = appInstance;
|
|
265
|
-
|
|
196
|
+
setLoadingState({
|
|
266
197
|
isLoading: false
|
|
267
198
|
});
|
|
268
199
|
if (appInstance.mounted && appInstance.appInfo.cache) {
|
|
@@ -279,7 +210,7 @@ or directly pass the "basename":
|
|
|
279
210
|
await (appInstance === null || appInstance === void 0 ? void 0 : appInstance.mount());
|
|
280
211
|
}
|
|
281
212
|
} catch (error) {
|
|
282
|
-
|
|
213
|
+
setLoadingState({
|
|
283
214
|
isLoading: true,
|
|
284
215
|
error
|
|
285
216
|
});
|
|
@@ -301,38 +232,13 @@ or directly pass the "basename":
|
|
|
301
232
|
}
|
|
302
233
|
}
|
|
303
234
|
};
|
|
304
|
-
}, [
|
|
305
|
-
basename,
|
|
306
|
-
domId,
|
|
307
|
-
appInfo.name
|
|
308
|
-
]);
|
|
309
|
-
(0, import_react.useEffect)(() => {
|
|
310
|
-
var _appRef_current;
|
|
311
|
-
if ((_appRef_current = appRef.current) === null || _appRef_current === void 0 ? void 0 : _appRef_current.appInfo) {
|
|
312
|
-
const { setLoadingState: setLoadingState2, ...updatedProps } = props;
|
|
313
|
-
const updatedPropsWithKey = {
|
|
314
|
-
...appInfo.props,
|
|
315
|
-
...updatedProps,
|
|
316
|
-
_garfishPropsUpdateKey: propsUpdateKey
|
|
317
|
-
};
|
|
318
|
-
appRef.current.appInfo.props = updatedPropsWithKey;
|
|
319
|
-
}
|
|
320
|
-
}, [
|
|
321
|
-
propsUpdateKey,
|
|
322
|
-
props
|
|
323
|
-
]);
|
|
324
|
-
const { setLoadingState, ...renderProps } = props;
|
|
325
|
-
const finalRenderProps = {
|
|
326
|
-
...renderProps,
|
|
327
|
-
_garfishPropsUpdateKey: propsUpdateKey
|
|
328
|
-
};
|
|
329
|
-
const componentKey = `${appInfo.name}-${propsUpdateKey}`;
|
|
235
|
+
}, []);
|
|
330
236
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
331
237
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
332
238
|
id: domId,
|
|
333
239
|
children: SubModuleComponent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SubModuleComponent, {
|
|
334
|
-
...
|
|
335
|
-
}
|
|
240
|
+
...props
|
|
241
|
+
})
|
|
336
242
|
})
|
|
337
243
|
});
|
|
338
244
|
}
|
|
@@ -4,7 +4,6 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
|
4
4
|
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
|
|
5
5
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
6
6
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
7
|
-
import { _ as _type_of } from "@swc/helpers/_/_type_of";
|
|
8
7
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
9
8
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
10
9
|
import { RuntimeReactContext } from "@meta/runtime";
|
|
@@ -32,56 +31,6 @@ function pathJoin() {
|
|
|
32
31
|
}, "");
|
|
33
32
|
return res || "/";
|
|
34
33
|
}
|
|
35
|
-
function deepEqualExcludeFunctions(prev, next) {
|
|
36
|
-
if (prev === next)
|
|
37
|
-
return true;
|
|
38
|
-
if (!prev || !next)
|
|
39
|
-
return false;
|
|
40
|
-
if ((typeof prev === "undefined" ? "undefined" : _type_of(prev)) !== "object" || (typeof next === "undefined" ? "undefined" : _type_of(next)) !== "object")
|
|
41
|
-
return false;
|
|
42
|
-
var prevKeys = Object.keys(prev).filter(function(key2) {
|
|
43
|
-
return typeof prev[key2] !== "function";
|
|
44
|
-
});
|
|
45
|
-
var nextKeys = Object.keys(next).filter(function(key2) {
|
|
46
|
-
return typeof next[key2] !== "function";
|
|
47
|
-
});
|
|
48
|
-
if (prevKeys.length !== nextKeys.length)
|
|
49
|
-
return false;
|
|
50
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
51
|
-
try {
|
|
52
|
-
for (var _iterator = prevKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
53
|
-
var key = _step.value;
|
|
54
|
-
if (!nextKeys.includes(key))
|
|
55
|
-
return false;
|
|
56
|
-
var prevVal = prev[key];
|
|
57
|
-
var nextVal = next[key];
|
|
58
|
-
if (typeof prevVal === "function" || typeof nextVal === "function") {
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
if ((typeof prevVal === "undefined" ? "undefined" : _type_of(prevVal)) === "object" && (typeof nextVal === "undefined" ? "undefined" : _type_of(nextVal)) === "object") {
|
|
62
|
-
if (!deepEqualExcludeFunctions(prevVal, nextVal)) {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
} else if (prevVal !== nextVal) {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
} catch (err) {
|
|
70
|
-
_didIteratorError = true;
|
|
71
|
-
_iteratorError = err;
|
|
72
|
-
} finally {
|
|
73
|
-
try {
|
|
74
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
75
|
-
_iterator.return();
|
|
76
|
-
}
|
|
77
|
-
} finally {
|
|
78
|
-
if (_didIteratorError) {
|
|
79
|
-
throw _iteratorError;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
34
|
function getAppInstance(options, appInfo, manifest) {
|
|
86
35
|
var componentSetterRegistry = {
|
|
87
36
|
current: null
|
|
@@ -90,14 +39,10 @@ function getAppInstance(options, appInfo, manifest) {
|
|
|
90
39
|
var _context_router, _context_router1, _context_router2, _context_router3, _context_router4;
|
|
91
40
|
var appRef = useRef(null);
|
|
92
41
|
var locationHrefRef = useRef("");
|
|
93
|
-
var propsRef = useRef(props);
|
|
94
|
-
var previousPropsRef = useRef(props);
|
|
95
|
-
var propsUpdateCounterRef = useRef(0);
|
|
96
42
|
var domId = generateSubAppContainerKey(appInfo);
|
|
97
43
|
var _useState = _sliced_to_array(useState({
|
|
98
44
|
component: null
|
|
99
45
|
}), 2), _useState_ = _useState[0], SubModuleComponent = _useState_.component, setSubModuleComponent = _useState[1];
|
|
100
|
-
var _useState1 = _sliced_to_array(useState(0), 2), propsUpdateKey = _useState1[0], setPropsUpdateKey = _useState1[1];
|
|
101
46
|
var context = useContext(RuntimeReactContext);
|
|
102
47
|
var _props_useRouteMatch;
|
|
103
48
|
var useRouteMatch = (_props_useRouteMatch = props.useRouteMatch) !== null && _props_useRouteMatch !== void 0 ? _props_useRouteMatch : context === null || context === void 0 ? void 0 : (_context_router = context.router) === null || _context_router === void 0 ? void 0 : _context_router.useRouteMatch;
|
|
@@ -162,46 +107,12 @@ or directly pass the "basename":
|
|
|
162
107
|
}, [
|
|
163
108
|
locationPathname
|
|
164
109
|
]);
|
|
165
|
-
useEffect(function() {
|
|
166
|
-
var prevPropsForCompare = _object_spread({}, previousPropsRef.current);
|
|
167
|
-
var currentPropsForCompare = _object_spread({}, props);
|
|
168
|
-
Object.keys(prevPropsForCompare).forEach(function(key2) {
|
|
169
|
-
if (typeof prevPropsForCompare[key2] === "function") {
|
|
170
|
-
delete prevPropsForCompare[key2];
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
Object.keys(currentPropsForCompare).forEach(function(key2) {
|
|
174
|
-
if (typeof currentPropsForCompare[key2] === "function") {
|
|
175
|
-
delete currentPropsForCompare[key2];
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
if (!deepEqualExcludeFunctions(prevPropsForCompare, currentPropsForCompare)) {
|
|
179
|
-
var _appRef_current;
|
|
180
|
-
previousPropsRef.current = props;
|
|
181
|
-
propsRef.current = props;
|
|
182
|
-
propsUpdateCounterRef.current += 1;
|
|
183
|
-
setPropsUpdateKey(function(prev) {
|
|
184
|
-
return prev + 1;
|
|
185
|
-
});
|
|
186
|
-
if ((_appRef_current = appRef.current) === null || _appRef_current === void 0 ? void 0 : _appRef_current.mounted) {
|
|
187
|
-
window.dispatchEvent(new CustomEvent("garfishPropsUpdated", {
|
|
188
|
-
detail: {
|
|
189
|
-
appName: appInfo.name,
|
|
190
|
-
props
|
|
191
|
-
}
|
|
192
|
-
}));
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}, [
|
|
196
|
-
props,
|
|
197
|
-
appInfo.name
|
|
198
|
-
]);
|
|
199
110
|
useEffect(function() {
|
|
200
111
|
var renderApp = function renderApp2() {
|
|
201
112
|
return _renderApp.apply(this, arguments);
|
|
202
113
|
};
|
|
203
114
|
componentSetterRegistry.current = setSubModuleComponent;
|
|
204
|
-
var
|
|
115
|
+
var setLoadingState = props.setLoadingState, userProps = _object_without_properties(props, [
|
|
205
116
|
"setLoadingState"
|
|
206
117
|
]);
|
|
207
118
|
var loadAppOptions = _object_spread_props(_object_spread({
|
|
@@ -249,7 +160,7 @@ or directly pass the "basename":
|
|
|
249
160
|
};
|
|
250
161
|
}
|
|
251
162
|
});
|
|
252
|
-
|
|
163
|
+
setLoadingState({
|
|
253
164
|
isLoading: true,
|
|
254
165
|
error: null
|
|
255
166
|
});
|
|
@@ -278,7 +189,7 @@ or directly pass the "basename":
|
|
|
278
189
|
throw new Error('MicroApp Garfish.loadApp "'.concat(appInfo.name, '" result is null'));
|
|
279
190
|
}
|
|
280
191
|
appRef.current = appInstance;
|
|
281
|
-
|
|
192
|
+
setLoadingState({
|
|
282
193
|
isLoading: false
|
|
283
194
|
});
|
|
284
195
|
if (!(appInstance.mounted && appInstance.appInfo.cache))
|
|
@@ -319,7 +230,7 @@ or directly pass the "basename":
|
|
|
319
230
|
];
|
|
320
231
|
case 6:
|
|
321
232
|
error = _state.sent();
|
|
322
|
-
|
|
233
|
+
setLoadingState({
|
|
323
234
|
isLoading: true,
|
|
324
235
|
error
|
|
325
236
|
});
|
|
@@ -352,37 +263,11 @@ or directly pass the "basename":
|
|
|
352
263
|
}
|
|
353
264
|
}
|
|
354
265
|
};
|
|
355
|
-
}, [
|
|
356
|
-
basename,
|
|
357
|
-
domId,
|
|
358
|
-
appInfo.name
|
|
359
|
-
]);
|
|
360
|
-
useEffect(function() {
|
|
361
|
-
var _appRef_current;
|
|
362
|
-
if ((_appRef_current = appRef.current) === null || _appRef_current === void 0 ? void 0 : _appRef_current.appInfo) {
|
|
363
|
-
var setLoadingState2 = props.setLoadingState, updatedProps = _object_without_properties(props, [
|
|
364
|
-
"setLoadingState"
|
|
365
|
-
]);
|
|
366
|
-
var updatedPropsWithKey = _object_spread_props(_object_spread({}, appInfo.props, updatedProps), {
|
|
367
|
-
_garfishPropsUpdateKey: propsUpdateKey
|
|
368
|
-
});
|
|
369
|
-
appRef.current.appInfo.props = updatedPropsWithKey;
|
|
370
|
-
}
|
|
371
|
-
}, [
|
|
372
|
-
propsUpdateKey,
|
|
373
|
-
props
|
|
374
|
-
]);
|
|
375
|
-
var setLoadingState = props.setLoadingState, renderProps = _object_without_properties(props, [
|
|
376
|
-
"setLoadingState"
|
|
377
|
-
]);
|
|
378
|
-
var finalRenderProps = _object_spread_props(_object_spread({}, renderProps), {
|
|
379
|
-
_garfishPropsUpdateKey: propsUpdateKey
|
|
380
|
-
});
|
|
381
|
-
var componentKey = "".concat(appInfo.name, "-").concat(propsUpdateKey);
|
|
266
|
+
}, []);
|
|
382
267
|
return /* @__PURE__ */ _jsx(_Fragment, {
|
|
383
268
|
children: /* @__PURE__ */ _jsx("div", {
|
|
384
269
|
id: domId,
|
|
385
|
-
children: SubModuleComponent && /* @__PURE__ */ _jsx(SubModuleComponent, _object_spread({},
|
|
270
|
+
children: SubModuleComponent && /* @__PURE__ */ _jsx(SubModuleComponent, _object_spread({}, props))
|
|
386
271
|
})
|
|
387
272
|
});
|
|
388
273
|
}
|
|
@@ -21,35 +21,6 @@ function pathJoin(...args) {
|
|
|
21
21
|
}, "");
|
|
22
22
|
return res || "/";
|
|
23
23
|
}
|
|
24
|
-
function deepEqualExcludeFunctions(prev, next) {
|
|
25
|
-
if (prev === next)
|
|
26
|
-
return true;
|
|
27
|
-
if (!prev || !next)
|
|
28
|
-
return false;
|
|
29
|
-
if (typeof prev !== "object" || typeof next !== "object")
|
|
30
|
-
return false;
|
|
31
|
-
const prevKeys = Object.keys(prev).filter((key) => typeof prev[key] !== "function");
|
|
32
|
-
const nextKeys = Object.keys(next).filter((key) => typeof next[key] !== "function");
|
|
33
|
-
if (prevKeys.length !== nextKeys.length)
|
|
34
|
-
return false;
|
|
35
|
-
for (const key of prevKeys) {
|
|
36
|
-
if (!nextKeys.includes(key))
|
|
37
|
-
return false;
|
|
38
|
-
const prevVal = prev[key];
|
|
39
|
-
const nextVal = next[key];
|
|
40
|
-
if (typeof prevVal === "function" || typeof nextVal === "function") {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
if (typeof prevVal === "object" && typeof nextVal === "object") {
|
|
44
|
-
if (!deepEqualExcludeFunctions(prevVal, nextVal)) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
} else if (prevVal !== nextVal) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
24
|
function getAppInstance(options, appInfo, manifest) {
|
|
54
25
|
const componentSetterRegistry = {
|
|
55
26
|
current: null
|
|
@@ -58,14 +29,10 @@ function getAppInstance(options, appInfo, manifest) {
|
|
|
58
29
|
var _context_router, _context_router1, _context_router2, _context_router3, _context_router4;
|
|
59
30
|
const appRef = useRef(null);
|
|
60
31
|
const locationHrefRef = useRef("");
|
|
61
|
-
const propsRef = useRef(props);
|
|
62
|
-
const previousPropsRef = useRef(props);
|
|
63
|
-
const propsUpdateCounterRef = useRef(0);
|
|
64
32
|
const domId = generateSubAppContainerKey(appInfo);
|
|
65
33
|
const [{ component: SubModuleComponent }, setSubModuleComponent] = useState({
|
|
66
34
|
component: null
|
|
67
35
|
});
|
|
68
|
-
const [propsUpdateKey, setPropsUpdateKey] = useState(0);
|
|
69
36
|
const context = useContext(RuntimeReactContext);
|
|
70
37
|
var _props_useRouteMatch;
|
|
71
38
|
const useRouteMatch = (_props_useRouteMatch = props.useRouteMatch) !== null && _props_useRouteMatch !== void 0 ? _props_useRouteMatch : context === null || context === void 0 ? void 0 : (_context_router = context.router) === null || _context_router === void 0 ? void 0 : _context_router.useRouteMatch;
|
|
@@ -132,45 +99,9 @@ or directly pass the "basename":
|
|
|
132
99
|
}, [
|
|
133
100
|
locationPathname
|
|
134
101
|
]);
|
|
135
|
-
useEffect(() => {
|
|
136
|
-
const prevPropsForCompare = {
|
|
137
|
-
...previousPropsRef.current
|
|
138
|
-
};
|
|
139
|
-
const currentPropsForCompare = {
|
|
140
|
-
...props
|
|
141
|
-
};
|
|
142
|
-
Object.keys(prevPropsForCompare).forEach((key) => {
|
|
143
|
-
if (typeof prevPropsForCompare[key] === "function") {
|
|
144
|
-
delete prevPropsForCompare[key];
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
Object.keys(currentPropsForCompare).forEach((key) => {
|
|
148
|
-
if (typeof currentPropsForCompare[key] === "function") {
|
|
149
|
-
delete currentPropsForCompare[key];
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
if (!deepEqualExcludeFunctions(prevPropsForCompare, currentPropsForCompare)) {
|
|
153
|
-
var _appRef_current;
|
|
154
|
-
previousPropsRef.current = props;
|
|
155
|
-
propsRef.current = props;
|
|
156
|
-
propsUpdateCounterRef.current += 1;
|
|
157
|
-
setPropsUpdateKey((prev) => prev + 1);
|
|
158
|
-
if ((_appRef_current = appRef.current) === null || _appRef_current === void 0 ? void 0 : _appRef_current.mounted) {
|
|
159
|
-
window.dispatchEvent(new CustomEvent("garfishPropsUpdated", {
|
|
160
|
-
detail: {
|
|
161
|
-
appName: appInfo.name,
|
|
162
|
-
props
|
|
163
|
-
}
|
|
164
|
-
}));
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}, [
|
|
168
|
-
props,
|
|
169
|
-
appInfo.name
|
|
170
|
-
]);
|
|
171
102
|
useEffect(() => {
|
|
172
103
|
componentSetterRegistry.current = setSubModuleComponent;
|
|
173
|
-
const { setLoadingState
|
|
104
|
+
const { setLoadingState, ...userProps } = props;
|
|
174
105
|
const loadAppOptions = {
|
|
175
106
|
cache: true,
|
|
176
107
|
insulationVariable: [
|
|
@@ -214,7 +145,7 @@ or directly pass the "basename":
|
|
|
214
145
|
};
|
|
215
146
|
}
|
|
216
147
|
};
|
|
217
|
-
|
|
148
|
+
setLoadingState({
|
|
218
149
|
isLoading: true,
|
|
219
150
|
error: null
|
|
220
151
|
});
|
|
@@ -228,7 +159,7 @@ or directly pass the "basename":
|
|
|
228
159
|
throw new Error(`MicroApp Garfish.loadApp "${appInfo.name}" result is null`);
|
|
229
160
|
}
|
|
230
161
|
appRef.current = appInstance;
|
|
231
|
-
|
|
162
|
+
setLoadingState({
|
|
232
163
|
isLoading: false
|
|
233
164
|
});
|
|
234
165
|
if (appInstance.mounted && appInstance.appInfo.cache) {
|
|
@@ -245,7 +176,7 @@ or directly pass the "basename":
|
|
|
245
176
|
await (appInstance === null || appInstance === void 0 ? void 0 : appInstance.mount());
|
|
246
177
|
}
|
|
247
178
|
} catch (error) {
|
|
248
|
-
|
|
179
|
+
setLoadingState({
|
|
249
180
|
isLoading: true,
|
|
250
181
|
error
|
|
251
182
|
});
|
|
@@ -267,38 +198,13 @@ or directly pass the "basename":
|
|
|
267
198
|
}
|
|
268
199
|
}
|
|
269
200
|
};
|
|
270
|
-
}, [
|
|
271
|
-
basename,
|
|
272
|
-
domId,
|
|
273
|
-
appInfo.name
|
|
274
|
-
]);
|
|
275
|
-
useEffect(() => {
|
|
276
|
-
var _appRef_current;
|
|
277
|
-
if ((_appRef_current = appRef.current) === null || _appRef_current === void 0 ? void 0 : _appRef_current.appInfo) {
|
|
278
|
-
const { setLoadingState: setLoadingState2, ...updatedProps } = props;
|
|
279
|
-
const updatedPropsWithKey = {
|
|
280
|
-
...appInfo.props,
|
|
281
|
-
...updatedProps,
|
|
282
|
-
_garfishPropsUpdateKey: propsUpdateKey
|
|
283
|
-
};
|
|
284
|
-
appRef.current.appInfo.props = updatedPropsWithKey;
|
|
285
|
-
}
|
|
286
|
-
}, [
|
|
287
|
-
propsUpdateKey,
|
|
288
|
-
props
|
|
289
|
-
]);
|
|
290
|
-
const { setLoadingState, ...renderProps } = props;
|
|
291
|
-
const finalRenderProps = {
|
|
292
|
-
...renderProps,
|
|
293
|
-
_garfishPropsUpdateKey: propsUpdateKey
|
|
294
|
-
};
|
|
295
|
-
const componentKey = `${appInfo.name}-${propsUpdateKey}`;
|
|
201
|
+
}, []);
|
|
296
202
|
return /* @__PURE__ */ _jsx(_Fragment, {
|
|
297
203
|
children: /* @__PURE__ */ _jsx("div", {
|
|
298
204
|
id: domId,
|
|
299
205
|
children: SubModuleComponent && /* @__PURE__ */ _jsx(SubModuleComponent, {
|
|
300
|
-
...
|
|
301
|
-
}
|
|
206
|
+
...props
|
|
207
|
+
})
|
|
302
208
|
})
|
|
303
209
|
});
|
|
304
210
|
}
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.68.19
|
|
18
|
+
"version": "2.68.19",
|
|
19
19
|
"jsnext:source": "./src/cli/index.ts",
|
|
20
20
|
"types": "./dist/types/cli/index.d.ts",
|
|
21
21
|
"typesVersions": {
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
"debug": "4.3.7",
|
|
70
70
|
"garfish": "^1.8.1",
|
|
71
71
|
"react-loadable": "^5.5.0",
|
|
72
|
-
"@modern-js/
|
|
73
|
-
"@modern-js/runtime-utils": "2.68.
|
|
74
|
-
"@modern-js/
|
|
72
|
+
"@modern-js/plugin-v2": "2.68.19",
|
|
73
|
+
"@modern-js/runtime-utils": "2.68.19",
|
|
74
|
+
"@modern-js/utils": "2.68.19"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@modern-js/runtime": "^2.68.
|
|
77
|
+
"@modern-js/runtime": "^2.68.19",
|
|
78
78
|
"react": ">=17",
|
|
79
79
|
"react-dom": ">=17"
|
|
80
80
|
},
|
|
@@ -93,13 +93,13 @@
|
|
|
93
93
|
"react-dom": "^18.3.1",
|
|
94
94
|
"react-router-dom": "6.27.0",
|
|
95
95
|
"typescript": "^5",
|
|
96
|
-
"@modern-js/app-tools": "2.68.
|
|
97
|
-
"@
|
|
98
|
-
"@modern-js/core": "2.68.
|
|
99
|
-
"@modern-js/
|
|
100
|
-
"@modern-js/types": "2.68.
|
|
96
|
+
"@modern-js/app-tools": "2.68.19",
|
|
97
|
+
"@modern-js/plugin-router-v5": "2.68.19",
|
|
98
|
+
"@modern-js/core": "2.68.19",
|
|
99
|
+
"@modern-js/runtime": "2.68.19",
|
|
100
|
+
"@modern-js/types": "2.68.19",
|
|
101
101
|
"@scripts/jest-config": "2.66.0",
|
|
102
|
-
"@
|
|
102
|
+
"@scripts/build": "2.66.0"
|
|
103
103
|
},
|
|
104
104
|
"sideEffects": false,
|
|
105
105
|
"publishConfig": {
|