@modern-js/plugin-garfish 2.68.19-alpha.1 → 2.68.19-alpha.2
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.
|
@@ -96,8 +96,9 @@ function getAppInstance(options, appInfo, manifest) {
|
|
|
96
96
|
const previousPropsRef = (0, import_react.useRef)(props);
|
|
97
97
|
const propsUpdateCounterRef = (0, import_react.useRef)(0);
|
|
98
98
|
const domId = (0, import_util.generateSubAppContainerKey)(appInfo);
|
|
99
|
-
const [{ component: SubModuleComponent }, setSubModuleComponent] = (0, import_react.useState)({
|
|
100
|
-
component: null
|
|
99
|
+
const [{ component: SubModuleComponent, isFromJupiter }, setSubModuleComponent] = (0, import_react.useState)({
|
|
100
|
+
component: null,
|
|
101
|
+
isFromJupiter: false
|
|
101
102
|
});
|
|
102
103
|
const [propsUpdateKey, setPropsUpdateKey] = (0, import_react.useState)(0);
|
|
103
104
|
const context = (0, import_react.useContext)(import_runtime.RuntimeReactContext);
|
|
@@ -184,19 +185,10 @@ or directly pass the "basename":
|
|
|
184
185
|
}
|
|
185
186
|
});
|
|
186
187
|
if (!deepEqualExcludeFunctions(prevPropsForCompare, currentPropsForCompare)) {
|
|
187
|
-
var _appRef_current;
|
|
188
188
|
previousPropsRef.current = props;
|
|
189
189
|
propsRef.current = props;
|
|
190
190
|
propsUpdateCounterRef.current += 1;
|
|
191
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
192
|
}
|
|
201
193
|
}, [
|
|
202
194
|
props,
|
|
@@ -221,13 +213,15 @@ or directly pass the "basename":
|
|
|
221
213
|
customLoader: (provider) => {
|
|
222
214
|
const { render, destroy, SubModuleComponent: SubModuleComponent2, jupiter_submodule_app_key } = provider;
|
|
223
215
|
const SubComponent = SubModuleComponent2 || jupiter_submodule_app_key;
|
|
216
|
+
const isFromJupiter2 = !SubModuleComponent2 && !!jupiter_submodule_app_key;
|
|
224
217
|
const componetRenderMode = manifest === null || manifest === void 0 ? void 0 : manifest.componentRender;
|
|
225
218
|
return {
|
|
226
219
|
mount: (...props2) => {
|
|
227
220
|
if (componetRenderMode && SubComponent) {
|
|
228
221
|
if (componentSetterRegistry.current) {
|
|
229
222
|
componentSetterRegistry.current({
|
|
230
|
-
component: SubComponent
|
|
223
|
+
component: SubComponent,
|
|
224
|
+
isFromJupiter: isFromJupiter2
|
|
231
225
|
});
|
|
232
226
|
} else {
|
|
233
227
|
(0, import_util.logger)(`[Garfish] MicroApp for "${appInfo.name}" tried to mount, but no active component setter was found.`);
|
|
@@ -326,13 +320,16 @@ or directly pass the "basename":
|
|
|
326
320
|
...renderProps,
|
|
327
321
|
_garfishPropsUpdateKey: propsUpdateKey
|
|
328
322
|
};
|
|
329
|
-
const componentKey = `${appInfo.name}-${propsUpdateKey}`;
|
|
323
|
+
const componentKey = isFromJupiter ? void 0 : `${appInfo.name}-${propsUpdateKey}`;
|
|
330
324
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
331
325
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
332
326
|
id: domId,
|
|
333
327
|
children: SubModuleComponent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SubModuleComponent, {
|
|
328
|
+
...componentKey ? {
|
|
329
|
+
key: componentKey
|
|
330
|
+
} : {},
|
|
334
331
|
...finalRenderProps
|
|
335
|
-
}
|
|
332
|
+
})
|
|
336
333
|
})
|
|
337
334
|
});
|
|
338
335
|
}
|
|
@@ -95,8 +95,9 @@ function getAppInstance(options, appInfo, manifest) {
|
|
|
95
95
|
var propsUpdateCounterRef = useRef(0);
|
|
96
96
|
var domId = generateSubAppContainerKey(appInfo);
|
|
97
97
|
var _useState = _sliced_to_array(useState({
|
|
98
|
-
component: null
|
|
99
|
-
|
|
98
|
+
component: null,
|
|
99
|
+
isFromJupiter: false
|
|
100
|
+
}), 2), _useState_ = _useState[0], SubModuleComponent = _useState_.component, isFromJupiter = _useState_.isFromJupiter, setSubModuleComponent = _useState[1];
|
|
100
101
|
var _useState1 = _sliced_to_array(useState(0), 2), propsUpdateKey = _useState1[0], setPropsUpdateKey = _useState1[1];
|
|
101
102
|
var context = useContext(RuntimeReactContext);
|
|
102
103
|
var _props_useRouteMatch;
|
|
@@ -176,21 +177,12 @@ or directly pass the "basename":
|
|
|
176
177
|
}
|
|
177
178
|
});
|
|
178
179
|
if (!deepEqualExcludeFunctions(prevPropsForCompare, currentPropsForCompare)) {
|
|
179
|
-
var _appRef_current;
|
|
180
180
|
previousPropsRef.current = props;
|
|
181
181
|
propsRef.current = props;
|
|
182
182
|
propsUpdateCounterRef.current += 1;
|
|
183
183
|
setPropsUpdateKey(function(prev) {
|
|
184
184
|
return prev + 1;
|
|
185
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
186
|
}
|
|
195
187
|
}, [
|
|
196
188
|
props,
|
|
@@ -216,6 +208,7 @@ or directly pass the "basename":
|
|
|
216
208
|
customLoader: function(provider) {
|
|
217
209
|
var render = provider.render, destroy = provider.destroy, SubModuleComponent2 = provider.SubModuleComponent, jupiter_submodule_app_key = provider.jupiter_submodule_app_key;
|
|
218
210
|
var SubComponent = SubModuleComponent2 || jupiter_submodule_app_key;
|
|
211
|
+
var isFromJupiter2 = !SubModuleComponent2 && !!jupiter_submodule_app_key;
|
|
219
212
|
var componetRenderMode = manifest === null || manifest === void 0 ? void 0 : manifest.componentRender;
|
|
220
213
|
return {
|
|
221
214
|
mount: function() {
|
|
@@ -225,7 +218,8 @@ or directly pass the "basename":
|
|
|
225
218
|
if (componetRenderMode && SubComponent) {
|
|
226
219
|
if (componentSetterRegistry.current) {
|
|
227
220
|
componentSetterRegistry.current({
|
|
228
|
-
component: SubComponent
|
|
221
|
+
component: SubComponent,
|
|
222
|
+
isFromJupiter: isFromJupiter2
|
|
229
223
|
});
|
|
230
224
|
} else {
|
|
231
225
|
logger('[Garfish] MicroApp for "'.concat(appInfo.name, '" tried to mount, but no active component setter was found.'));
|
|
@@ -378,11 +372,13 @@ or directly pass the "basename":
|
|
|
378
372
|
var finalRenderProps = _object_spread_props(_object_spread({}, renderProps), {
|
|
379
373
|
_garfishPropsUpdateKey: propsUpdateKey
|
|
380
374
|
});
|
|
381
|
-
var componentKey = "".concat(appInfo.name, "-").concat(propsUpdateKey);
|
|
375
|
+
var componentKey = isFromJupiter ? void 0 : "".concat(appInfo.name, "-").concat(propsUpdateKey);
|
|
382
376
|
return /* @__PURE__ */ _jsx(_Fragment, {
|
|
383
377
|
children: /* @__PURE__ */ _jsx("div", {
|
|
384
378
|
id: domId,
|
|
385
|
-
children: SubModuleComponent && /* @__PURE__ */ _jsx(SubModuleComponent, _object_spread({},
|
|
379
|
+
children: SubModuleComponent && /* @__PURE__ */ _jsx(SubModuleComponent, _object_spread({}, componentKey ? {
|
|
380
|
+
key: componentKey
|
|
381
|
+
} : {}, finalRenderProps))
|
|
386
382
|
})
|
|
387
383
|
});
|
|
388
384
|
}
|
|
@@ -62,8 +62,9 @@ function getAppInstance(options, appInfo, manifest) {
|
|
|
62
62
|
const previousPropsRef = useRef(props);
|
|
63
63
|
const propsUpdateCounterRef = useRef(0);
|
|
64
64
|
const domId = generateSubAppContainerKey(appInfo);
|
|
65
|
-
const [{ component: SubModuleComponent }, setSubModuleComponent] = useState({
|
|
66
|
-
component: null
|
|
65
|
+
const [{ component: SubModuleComponent, isFromJupiter }, setSubModuleComponent] = useState({
|
|
66
|
+
component: null,
|
|
67
|
+
isFromJupiter: false
|
|
67
68
|
});
|
|
68
69
|
const [propsUpdateKey, setPropsUpdateKey] = useState(0);
|
|
69
70
|
const context = useContext(RuntimeReactContext);
|
|
@@ -150,19 +151,10 @@ or directly pass the "basename":
|
|
|
150
151
|
}
|
|
151
152
|
});
|
|
152
153
|
if (!deepEqualExcludeFunctions(prevPropsForCompare, currentPropsForCompare)) {
|
|
153
|
-
var _appRef_current;
|
|
154
154
|
previousPropsRef.current = props;
|
|
155
155
|
propsRef.current = props;
|
|
156
156
|
propsUpdateCounterRef.current += 1;
|
|
157
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
158
|
}
|
|
167
159
|
}, [
|
|
168
160
|
props,
|
|
@@ -187,13 +179,15 @@ or directly pass the "basename":
|
|
|
187
179
|
customLoader: (provider) => {
|
|
188
180
|
const { render, destroy, SubModuleComponent: SubModuleComponent2, jupiter_submodule_app_key } = provider;
|
|
189
181
|
const SubComponent = SubModuleComponent2 || jupiter_submodule_app_key;
|
|
182
|
+
const isFromJupiter2 = !SubModuleComponent2 && !!jupiter_submodule_app_key;
|
|
190
183
|
const componetRenderMode = manifest === null || manifest === void 0 ? void 0 : manifest.componentRender;
|
|
191
184
|
return {
|
|
192
185
|
mount: (...props2) => {
|
|
193
186
|
if (componetRenderMode && SubComponent) {
|
|
194
187
|
if (componentSetterRegistry.current) {
|
|
195
188
|
componentSetterRegistry.current({
|
|
196
|
-
component: SubComponent
|
|
189
|
+
component: SubComponent,
|
|
190
|
+
isFromJupiter: isFromJupiter2
|
|
197
191
|
});
|
|
198
192
|
} else {
|
|
199
193
|
logger(`[Garfish] MicroApp for "${appInfo.name}" tried to mount, but no active component setter was found.`);
|
|
@@ -292,13 +286,16 @@ or directly pass the "basename":
|
|
|
292
286
|
...renderProps,
|
|
293
287
|
_garfishPropsUpdateKey: propsUpdateKey
|
|
294
288
|
};
|
|
295
|
-
const componentKey = `${appInfo.name}-${propsUpdateKey}`;
|
|
289
|
+
const componentKey = isFromJupiter ? void 0 : `${appInfo.name}-${propsUpdateKey}`;
|
|
296
290
|
return /* @__PURE__ */ _jsx(_Fragment, {
|
|
297
291
|
children: /* @__PURE__ */ _jsx("div", {
|
|
298
292
|
id: domId,
|
|
299
293
|
children: SubModuleComponent && /* @__PURE__ */ _jsx(SubModuleComponent, {
|
|
294
|
+
...componentKey ? {
|
|
295
|
+
key: componentKey
|
|
296
|
+
} : {},
|
|
300
297
|
...finalRenderProps
|
|
301
|
-
}
|
|
298
|
+
})
|
|
302
299
|
})
|
|
303
300
|
});
|
|
304
301
|
}
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.68.19-alpha.
|
|
18
|
+
"version": "2.68.19-alpha.2",
|
|
19
19
|
"jsnext:source": "./src/cli/index.ts",
|
|
20
20
|
"types": "./dist/types/cli/index.d.ts",
|
|
21
21
|
"typesVersions": {
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"debug": "4.3.7",
|
|
70
70
|
"garfish": "^1.8.1",
|
|
71
71
|
"react-loadable": "^5.5.0",
|
|
72
|
-
"@modern-js/
|
|
72
|
+
"@modern-js/plugin-v2": "2.68.18",
|
|
73
73
|
"@modern-js/runtime-utils": "2.68.18",
|
|
74
|
-
"@modern-js/
|
|
74
|
+
"@modern-js/utils": "2.68.18"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"@modern-js/runtime": "^2.68.18",
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"@modern-js/core": "2.68.18",
|
|
99
99
|
"@modern-js/plugin-router-v5": "2.68.18",
|
|
100
100
|
"@modern-js/types": "2.68.18",
|
|
101
|
-
"@
|
|
102
|
-
"@
|
|
101
|
+
"@modern-js/runtime": "2.68.18",
|
|
102
|
+
"@scripts/jest-config": "2.66.0"
|
|
103
103
|
},
|
|
104
104
|
"sideEffects": false,
|
|
105
105
|
"publishConfig": {
|