@module-federation/devtools 0.0.0-next-20250926024003 → 0.0.0-perf-devtools-20260107043700
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/es/App.css +12 -0
- package/dist/es/App.js +330 -22
- package/dist/es/App.module.js +1 -1
- package/dist/es/App_module.css +291 -5
- package/dist/es/component/DependencyGraph/index.js +205 -0
- package/dist/es/component/DependencyGraph/index.module.js +5 -0
- package/dist/es/component/DependencyGraph/index_module.css +97 -0
- package/dist/es/component/{GraphItem → DependencyGraphItem}/index.js +15 -6
- package/dist/es/component/DependencyGraphItem/index.module.js +5 -0
- package/dist/es/component/DependencyGraphItem/index_module.css +95 -0
- package/dist/es/component/Form/index.js +191 -109
- package/dist/es/component/Form/index.module.js +1 -1
- package/dist/es/component/Form/index_module.css +179 -25
- package/dist/es/component/Layout/index.js +288 -51
- package/dist/es/component/Layout/index.module.js +1 -1
- package/dist/es/component/Layout/index_module.css +52 -32
- package/dist/es/component/ModuleInfo/index.js +289 -0
- package/dist/es/component/ModuleInfo/index.module.js +5 -0
- package/dist/es/component/ModuleInfo/index_module.css +183 -0
- package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.js +33 -0
- package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.module.js +5 -0
- package/dist/es/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
- package/dist/es/component/SharedDepsExplorer/index.js +506 -0
- package/dist/es/component/SharedDepsExplorer/index.module.js +5 -0
- package/dist/es/component/SharedDepsExplorer/index_module.css +457 -0
- package/dist/es/component/SharedDepsExplorer/share-utils.js +206 -0
- package/dist/es/template/constant.js +5 -19
- package/dist/es/utils/chrome/fast-refresh.js +80 -7
- package/dist/es/utils/chrome/index.js +91 -38
- package/dist/es/utils/chrome/messages.js +6 -0
- package/dist/es/utils/chrome/post-message-listener.js +2 -1
- package/dist/es/utils/chrome/post-message-start.js +10 -2
- package/dist/es/utils/chrome/storage.js +6 -1
- package/dist/es/utils/sdk/graph.js +25 -4
- package/dist/es/utils/sdk/index.js +9 -0
- package/dist/es/worker/index.js +168 -1
- package/dist/lib/App.css +12 -0
- package/dist/lib/App.js +321 -18
- package/dist/lib/App.module.js +1 -1
- package/dist/lib/App_module.css +291 -5
- package/dist/lib/component/DependencyGraph/index.js +227 -0
- package/dist/lib/component/{GraphItem → DependencyGraph}/index.module.js +1 -1
- package/dist/lib/component/DependencyGraph/index_module.css +97 -0
- package/dist/lib/component/{GraphItem → DependencyGraphItem}/index.js +18 -9
- package/dist/lib/component/{Graph → DependencyGraphItem}/index.module.js +1 -1
- package/dist/lib/component/DependencyGraphItem/index_module.css +95 -0
- package/dist/lib/component/Form/index.js +188 -107
- package/dist/lib/component/Form/index.module.js +1 -1
- package/dist/lib/component/Form/index_module.css +179 -25
- package/dist/lib/component/Layout/index.js +280 -48
- package/dist/lib/component/Layout/index.module.js +1 -1
- package/dist/lib/component/Layout/index_module.css +52 -32
- package/dist/lib/component/ModuleInfo/index.js +319 -0
- package/dist/lib/component/ModuleInfo/index.module.js +25 -0
- package/dist/lib/component/ModuleInfo/index_module.css +183 -0
- package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.js +63 -0
- package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.module.js +25 -0
- package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
- package/dist/lib/component/SharedDepsExplorer/index.js +513 -0
- package/dist/lib/component/SharedDepsExplorer/index.module.js +25 -0
- package/dist/lib/component/SharedDepsExplorer/index_module.css +457 -0
- package/dist/lib/component/SharedDepsExplorer/share-utils.js +237 -0
- package/dist/lib/template/constant.js +7 -17
- package/dist/lib/utils/chrome/fast-refresh.js +77 -8
- package/dist/lib/utils/chrome/index.js +94 -38
- package/dist/lib/utils/chrome/messages.js +31 -0
- package/dist/lib/utils/chrome/post-message-listener.js +2 -1
- package/dist/lib/utils/chrome/post-message-start.js +10 -2
- package/dist/lib/utils/chrome/storage.js +5 -0
- package/dist/lib/utils/sdk/graph.js +25 -4
- package/dist/lib/utils/sdk/index.js +10 -0
- package/dist/lib/worker/index.js +156 -1
- package/dist/types/src/App.d.ts +2 -1
- package/dist/types/src/component/{Graph → DependencyGraph}/index.d.ts +0 -1
- package/dist/types/src/component/{GraphItem → DependencyGraphItem}/index.d.ts +0 -1
- package/dist/types/src/component/Form/index.d.ts +2 -0
- package/dist/types/src/component/Layout/index.d.ts +0 -1
- package/dist/types/src/component/ModuleInfo/index.d.ts +8 -0
- package/dist/types/src/component/SharedDepsExplorer/FocusResultDisplay.d.ts +15 -0
- package/dist/types/src/component/SharedDepsExplorer/index.d.ts +6 -0
- package/dist/types/src/component/SharedDepsExplorer/share-utils.d.ts +44 -0
- package/dist/types/src/init.d.ts +0 -1
- package/dist/types/src/template/constant.d.ts +3 -5
- package/dist/types/src/utils/chrome/index.d.ts +5 -3
- package/dist/types/src/utils/chrome/messages.d.ts +2 -0
- package/dist/types/src/utils/chrome/storage.d.ts +5 -4
- package/dist/types/src/utils/sdk/graph.d.ts +2 -1
- package/dist/types/src/utils/sdk/index.d.ts +1 -0
- package/dist/types/src/utils/types/common.d.ts +4 -0
- package/dist/types/src/worker/index.d.ts +1 -0
- package/package.json +16 -14
- package/dist/es/component/Graph/index.js +0 -127
- package/dist/es/component/Graph/index.module.js +0 -5
- package/dist/es/component/Graph/index_module.css +0 -12
- package/dist/es/component/GraphItem/index.module.js +0 -5
- package/dist/es/component/GraphItem/index_module.css +0 -61
- package/dist/lib/component/Graph/index.js +0 -149
- package/dist/lib/component/Graph/index_module.css +0 -12
- package/dist/lib/component/GraphItem/index_module.css +0 -61
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1
20
|
var __async = (__this, __arguments, generator) => {
|
|
2
21
|
return new Promise((resolve, reject) => {
|
|
3
22
|
var fulfilled = (value) => {
|
|
@@ -18,15 +37,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
18
37
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
38
|
});
|
|
20
39
|
};
|
|
21
|
-
import {
|
|
22
|
-
import { useEffect, useState } from "react";
|
|
40
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
41
|
+
import { useEffect, useMemo, useState, useRef } from "react";
|
|
23
42
|
import { useDebounceFn, useUpdateEffect } from "ahooks";
|
|
24
43
|
import { Form } from "@arco-design/web-react";
|
|
25
44
|
import {
|
|
26
45
|
MODULE_DEVTOOL_IDENTIFIER
|
|
27
46
|
} from "@module-federation/sdk";
|
|
28
47
|
import FormComponent from "../Form";
|
|
29
|
-
import Dependency from "../Graph";
|
|
30
48
|
import {
|
|
31
49
|
getModuleInfo,
|
|
32
50
|
getScope,
|
|
@@ -35,6 +53,7 @@ import {
|
|
|
35
53
|
separateType,
|
|
36
54
|
reloadPage,
|
|
37
55
|
setChromeStorage,
|
|
56
|
+
getStorageValue,
|
|
38
57
|
mergeStorage,
|
|
39
58
|
removeStorageKey,
|
|
40
59
|
removeStorage,
|
|
@@ -46,10 +65,25 @@ import {
|
|
|
46
65
|
FormID,
|
|
47
66
|
statusInfo,
|
|
48
67
|
ENABLEHMR,
|
|
68
|
+
ENABLE_CLIP,
|
|
49
69
|
__ENABLE_FAST_REFRESH__,
|
|
50
70
|
BROWSER_ENV_KEY,
|
|
51
|
-
__FEDERATION_DEVTOOLS__
|
|
71
|
+
__FEDERATION_DEVTOOLS__,
|
|
72
|
+
__EAGER_SHARE__
|
|
52
73
|
} from "../../template/constant";
|
|
74
|
+
import styles from "./index.module";
|
|
75
|
+
const sortRulesForSignature = (rules) => [...rules].sort((a, b) => {
|
|
76
|
+
const keyCompare = (a.key || "").localeCompare(b.key || "");
|
|
77
|
+
if (keyCompare !== 0) {
|
|
78
|
+
return keyCompare;
|
|
79
|
+
}
|
|
80
|
+
return (a.value || "").localeCompare(b.value || "");
|
|
81
|
+
}).map((rule) => ({
|
|
82
|
+
key: rule.key || "",
|
|
83
|
+
value: rule.value || "",
|
|
84
|
+
checked: Boolean(rule.checked)
|
|
85
|
+
}));
|
|
86
|
+
const getEffectiveSignature = (rules) => rules.length ? JSON.stringify(sortRulesForSignature(rules)) : "";
|
|
53
87
|
const Layout = (props) => {
|
|
54
88
|
const {
|
|
55
89
|
moduleInfo,
|
|
@@ -59,57 +93,153 @@ const Layout = (props) => {
|
|
|
59
93
|
getVersion,
|
|
60
94
|
handleProxyAddress,
|
|
61
95
|
customValueValidate,
|
|
62
|
-
headerSlot
|
|
96
|
+
headerSlot,
|
|
97
|
+
onModuleInfoChange,
|
|
98
|
+
onModuleInfoReset,
|
|
99
|
+
tabId
|
|
63
100
|
} = props;
|
|
64
101
|
const { producer } = separateType(moduleInfo);
|
|
102
|
+
const producerKey = useMemo(() => producer.join("|"), [producer]);
|
|
65
103
|
const [condition, setCondition] = useState(statusInfo.processing);
|
|
66
104
|
const [formStatus, setFormStatus] = useState([]);
|
|
67
|
-
const [snapshot, setSnapshot] = useState(moduleInfo);
|
|
68
105
|
const [form] = Form.useForm();
|
|
69
106
|
const [enableHMR, setEnalbeHMR] = useState("disable");
|
|
107
|
+
const [enableClip, setEnableClip] = useState(() => {
|
|
108
|
+
try {
|
|
109
|
+
if (tabId) {
|
|
110
|
+
return localStorage.getItem(`${ENABLE_CLIP}_${tabId}`) === "true";
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
} catch (e) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
const lastFormSignatureRef = useRef("");
|
|
118
|
+
const lastEffectiveRulesRef = useRef("");
|
|
119
|
+
const lastRawRulesRef = useRef([]);
|
|
120
|
+
const lastEnableClipRef = useRef(enableClip);
|
|
121
|
+
const ensureFederationContext = () => {
|
|
122
|
+
if (!window.__FEDERATION__) {
|
|
123
|
+
window.__FEDERATION__ = {
|
|
124
|
+
originModuleInfo: moduleInfo || {},
|
|
125
|
+
moduleInfo: moduleInfo || {}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
if (!window.__FEDERATION__.originModuleInfo) {
|
|
129
|
+
window.__FEDERATION__.originModuleInfo = moduleInfo || {};
|
|
130
|
+
}
|
|
131
|
+
if (!window.__FEDERATION__.moduleInfo) {
|
|
132
|
+
window.__FEDERATION__.moduleInfo = moduleInfo || {};
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
ensureFederationContext();
|
|
137
|
+
window.__FEDERATION__.moduleInfo = JSON.parse(
|
|
138
|
+
JSON.stringify(moduleInfo || {})
|
|
139
|
+
);
|
|
140
|
+
window.__FEDERATION__.originModuleInfo = JSON.parse(
|
|
141
|
+
JSON.stringify(moduleInfo || {})
|
|
142
|
+
);
|
|
143
|
+
const rawRules = form.getFieldValue(proxyFormField) || [];
|
|
144
|
+
lastRawRulesRef.current = JSON.parse(JSON.stringify(rawRules));
|
|
145
|
+
}, [moduleInfo, form]);
|
|
146
|
+
const collectEffectiveRules = (rules, statusList) => {
|
|
147
|
+
return rules.reduce((memo, current, idx) => {
|
|
148
|
+
if (!(current == null ? void 0 : current.checked)) {
|
|
149
|
+
return memo;
|
|
150
|
+
}
|
|
151
|
+
const status = statusList[idx];
|
|
152
|
+
const keyValid = status ? status.keyStatus : Boolean(current.key);
|
|
153
|
+
const valueValid = status ? status.valueStatus : Boolean(current.value);
|
|
154
|
+
if (!keyValid || !valueValid) {
|
|
155
|
+
return memo;
|
|
156
|
+
}
|
|
157
|
+
const duplicate = JSON.parse(JSON.stringify(current));
|
|
158
|
+
if (handleProxyAddress) {
|
|
159
|
+
duplicate.value = handleProxyAddress(duplicate.value);
|
|
160
|
+
}
|
|
161
|
+
memo.push(duplicate);
|
|
162
|
+
return memo;
|
|
163
|
+
}, []);
|
|
164
|
+
};
|
|
165
|
+
const hasPendingRule = (rules, statusList) => {
|
|
166
|
+
return rules.some((rule, idx) => {
|
|
167
|
+
if (!(rule == null ? void 0 : rule.checked)) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
const status = statusList[idx];
|
|
171
|
+
if (!status) {
|
|
172
|
+
return Boolean(rule.key) && !rule.value;
|
|
173
|
+
}
|
|
174
|
+
return Boolean(status.keyStatus) && !status.valueStatus;
|
|
175
|
+
});
|
|
176
|
+
};
|
|
70
177
|
const { run } = useDebounceFn(
|
|
71
178
|
(formData) => __async(void 0, null, function* () {
|
|
179
|
+
ensureFederationContext();
|
|
72
180
|
window.__FEDERATION__.moduleInfo = JSON.parse(
|
|
73
181
|
JSON.stringify(window.__FEDERATION__.originModuleInfo)
|
|
74
182
|
);
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const value = handleProxyAddress(duplicate.value);
|
|
87
|
-
duplicate.value = value;
|
|
88
|
-
}
|
|
89
|
-
return [...memo, duplicate];
|
|
90
|
-
},
|
|
91
|
-
[]
|
|
92
|
-
);
|
|
183
|
+
const rawRules = formData[proxyFormField] || [];
|
|
184
|
+
const rawSignature = JSON.stringify(rawRules);
|
|
185
|
+
if (rawSignature === lastFormSignatureRef.current) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const effectiveRules = collectEffectiveRules(rawRules, formStatus);
|
|
189
|
+
const effectiveSignature = getEffectiveSignature(effectiveRules);
|
|
190
|
+
const pendingRule = hasPendingRule(rawRules, formStatus);
|
|
191
|
+
const hadPreviousEffective = lastEffectiveRulesRef.current !== "" && lastEffectiveRulesRef.current !== "[]";
|
|
192
|
+
const clipChanged = enableClip !== lastEnableClipRef.current;
|
|
193
|
+
lastEnableClipRef.current = enableClip;
|
|
93
194
|
try {
|
|
94
195
|
setCondition(statusInfo.processing);
|
|
95
|
-
if (!
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
196
|
+
if (!effectiveRules.length) {
|
|
197
|
+
if (pendingRule) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (hadPreviousEffective) {
|
|
201
|
+
yield removeStorage(MODULE_DEVTOOL_IDENTIFIER);
|
|
202
|
+
yield removeStorage(BROWSER_ENV_KEY);
|
|
203
|
+
yield removeStorageKey(__FEDERATION_DEVTOOLS__, "overrides");
|
|
204
|
+
yield injectScript(reloadPage, false);
|
|
205
|
+
setCondition(statusInfo.noProxy);
|
|
206
|
+
lastEffectiveRulesRef.current = "";
|
|
207
|
+
if (typeof onModuleInfoReset === "function") {
|
|
208
|
+
onModuleInfoReset();
|
|
209
|
+
} else {
|
|
210
|
+
onModuleInfoChange == null ? void 0 : onModuleInfoChange(window.__FEDERATION__.originModuleInfo);
|
|
211
|
+
}
|
|
212
|
+
} else {
|
|
213
|
+
setCondition(statusInfo.noProxy);
|
|
214
|
+
}
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
if (!clipChanged && effectiveSignature === lastEffectiveRulesRef.current) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (rawRules.every((rule) => !rule.value)) {
|
|
102
221
|
return;
|
|
103
222
|
}
|
|
104
|
-
const { moduleInfo: moduleInfo2, status, overrides } = handleSnapshot ? yield handleSnapshot(
|
|
223
|
+
const { moduleInfo: moduleInfo2, status, overrides } = handleSnapshot ? yield handleSnapshot(effectiveRules) : yield getModuleInfo(effectiveRules);
|
|
224
|
+
if (enableClip) {
|
|
225
|
+
Object.values(moduleInfo2).forEach((val) => {
|
|
226
|
+
if (val.modules) {
|
|
227
|
+
val.modules = [];
|
|
228
|
+
}
|
|
229
|
+
if (val.shared) {
|
|
230
|
+
val.shared = [];
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
105
234
|
const snapshotJson = JSON.stringify(moduleInfo2);
|
|
106
235
|
yield setStorage(MODULE_DEVTOOL_IDENTIFIER, snapshotJson);
|
|
107
236
|
yield setStorage(BROWSER_ENV_KEY);
|
|
108
237
|
yield mergeStorage(__FEDERATION_DEVTOOLS__, "overrides", overrides);
|
|
109
238
|
yield injectScript(reloadPage, false);
|
|
110
239
|
window.__FEDERATION__.moduleInfo = moduleInfo2;
|
|
111
|
-
|
|
240
|
+
onModuleInfoChange == null ? void 0 : onModuleInfoChange(moduleInfo2);
|
|
112
241
|
setCondition(statusInfo[status]);
|
|
242
|
+
lastEffectiveRulesRef.current = effectiveSignature;
|
|
113
243
|
} catch (e) {
|
|
114
244
|
console.log(e);
|
|
115
245
|
setCondition(statusInfo.error);
|
|
@@ -120,28 +250,81 @@ const Layout = (props) => {
|
|
|
120
250
|
}
|
|
121
251
|
);
|
|
122
252
|
useEffect(() => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
getScope().then((scope) => __async(void 0, null, function* () {
|
|
253
|
+
ensureFederationContext();
|
|
254
|
+
let cancelled = false;
|
|
255
|
+
const hydrateForm = () => __async(void 0, null, function* () {
|
|
127
256
|
var _a, _b, _c;
|
|
257
|
+
const scope = yield getScope();
|
|
128
258
|
const data = yield chrome.storage.sync.get([FormID]);
|
|
129
259
|
const config = (_a = data == null ? void 0 : data[FormID]) == null ? void 0 : _a[scope];
|
|
130
260
|
let storeData;
|
|
131
261
|
if (isObject(config)) {
|
|
132
262
|
storeData = JSON.parse(JSON.stringify(config));
|
|
133
|
-
|
|
134
|
-
(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
263
|
+
if (producer.length) {
|
|
264
|
+
storeData[proxyFormField] = (_b = storeData[proxyFormField]) == null ? void 0 : _b.filter(
|
|
265
|
+
(item) => producer.includes(item.key)
|
|
266
|
+
);
|
|
267
|
+
if (!((_c = storeData[proxyFormField]) == null ? void 0 : _c.length)) {
|
|
268
|
+
storeData = JSON.parse(JSON.stringify(defaultModuleData));
|
|
269
|
+
}
|
|
138
270
|
}
|
|
139
271
|
} else {
|
|
140
|
-
storeData = defaultModuleData;
|
|
272
|
+
storeData = JSON.parse(JSON.stringify(defaultModuleData));
|
|
141
273
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
274
|
+
let overridesApplied = false;
|
|
275
|
+
try {
|
|
276
|
+
const overridesState = yield getStorageValue(__FEDERATION_DEVTOOLS__);
|
|
277
|
+
if (typeof overridesState === "string" && overridesState) {
|
|
278
|
+
const parsedState = JSON.parse(overridesState);
|
|
279
|
+
const overrides = parsedState == null ? void 0 : parsedState.overrides;
|
|
280
|
+
if (isObject(overrides)) {
|
|
281
|
+
const overrideRules = Object.entries(overrides).map(([key, value]) => ({
|
|
282
|
+
key,
|
|
283
|
+
value: typeof value === "string" ? value : "",
|
|
284
|
+
checked: true
|
|
285
|
+
})).filter(
|
|
286
|
+
(rule) => Boolean(rule.key) && Boolean(rule.value)
|
|
287
|
+
);
|
|
288
|
+
const filteredRules = producer.length ? overrideRules.filter((rule) => producer.includes(rule.key)) : overrideRules;
|
|
289
|
+
if (filteredRules.length) {
|
|
290
|
+
storeData = __spreadProps(__spreadValues({}, storeData), {
|
|
291
|
+
[proxyFormField]: filteredRules
|
|
292
|
+
});
|
|
293
|
+
overridesApplied = true;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
} catch (error) {
|
|
298
|
+
console.warn(
|
|
299
|
+
"[MF Devtools] hydrate overrides from localStorage failed",
|
|
300
|
+
error
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
if (!cancelled) {
|
|
304
|
+
form.setFieldsValue(storeData);
|
|
305
|
+
lastFormSignatureRef.current = JSON.stringify(storeData);
|
|
306
|
+
const rules = Array.isArray(
|
|
307
|
+
storeData[proxyFormField]
|
|
308
|
+
) ? storeData[proxyFormField] : [];
|
|
309
|
+
const effectiveRules = collectEffectiveRules(rules, []);
|
|
310
|
+
lastEffectiveRulesRef.current = getEffectiveSignature(effectiveRules);
|
|
311
|
+
lastRawRulesRef.current = JSON.parse(JSON.stringify(rules));
|
|
312
|
+
setFormStatus(
|
|
313
|
+
rules.map((rule) => ({
|
|
314
|
+
keyStatus: Boolean(rule == null ? void 0 : rule.key),
|
|
315
|
+
valueStatus: Boolean(rule == null ? void 0 : rule.value)
|
|
316
|
+
}))
|
|
317
|
+
);
|
|
318
|
+
if (overridesApplied) {
|
|
319
|
+
setChromeStorage(storeData);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
hydrateForm();
|
|
324
|
+
return () => {
|
|
325
|
+
cancelled = true;
|
|
326
|
+
};
|
|
327
|
+
}, [moduleInfo, producerKey, form]);
|
|
145
328
|
useEffect(() => {
|
|
146
329
|
chrome.storage.sync.get([ENABLEHMR]).then((data) => {
|
|
147
330
|
const enable = data[ENABLEHMR];
|
|
@@ -154,9 +337,25 @@ const Layout = (props) => {
|
|
|
154
337
|
validateForm(form);
|
|
155
338
|
}, []);
|
|
156
339
|
useUpdateEffect(() => {
|
|
340
|
+
if (!producer.length) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
157
343
|
const formData = form.getFieldsValue();
|
|
344
|
+
const signature = JSON.stringify(formData);
|
|
345
|
+
if (signature === lastFormSignatureRef.current) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
lastFormSignatureRef.current = signature;
|
|
349
|
+
const effectiveRules = collectEffectiveRules(
|
|
350
|
+
formData[proxyFormField] || [],
|
|
351
|
+
formStatus
|
|
352
|
+
);
|
|
353
|
+
const effectiveSignature = getEffectiveSignature(effectiveRules);
|
|
354
|
+
if (effectiveSignature === lastEffectiveRulesRef.current) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
158
357
|
run(formData);
|
|
159
|
-
}, []);
|
|
358
|
+
}, [producerKey, formStatus]);
|
|
160
359
|
const validateForm = (form2) => {
|
|
161
360
|
setTimeout(() => {
|
|
162
361
|
form2.validate().catch(() => {
|
|
@@ -166,6 +365,11 @@ const Layout = (props) => {
|
|
|
166
365
|
};
|
|
167
366
|
const onValuesChange = (target, formData) => {
|
|
168
367
|
validateForm(form);
|
|
368
|
+
const signature = JSON.stringify(formData);
|
|
369
|
+
if (signature === lastFormSignatureRef.current) {
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
lastFormSignatureRef.current = signature;
|
|
169
373
|
setChromeStorage(formData);
|
|
170
374
|
run(formData);
|
|
171
375
|
};
|
|
@@ -178,11 +382,43 @@ const Layout = (props) => {
|
|
|
178
382
|
mergeStorage(__FEDERATION_DEVTOOLS__, __ENABLE_FAST_REFRESH__, on);
|
|
179
383
|
} else {
|
|
180
384
|
removeStorageKey(__FEDERATION_DEVTOOLS__, __ENABLE_FAST_REFRESH__);
|
|
385
|
+
removeStorageKey(__FEDERATION_DEVTOOLS__, __EAGER_SHARE__);
|
|
181
386
|
}
|
|
182
387
|
injectScript(reloadPage, false);
|
|
183
388
|
};
|
|
184
|
-
|
|
185
|
-
|
|
389
|
+
const onClipChange = (on) => {
|
|
390
|
+
setEnableClip(on);
|
|
391
|
+
try {
|
|
392
|
+
if (tabId) {
|
|
393
|
+
localStorage.setItem(`${ENABLE_CLIP}_${tabId}`, String(on));
|
|
394
|
+
}
|
|
395
|
+
} catch (e) {
|
|
396
|
+
console.error(e);
|
|
397
|
+
}
|
|
398
|
+
run(form.getFieldsValue());
|
|
399
|
+
};
|
|
400
|
+
const remotePreview = producer.map((id) => {
|
|
401
|
+
const [, name] = id.split(":");
|
|
402
|
+
return name || id;
|
|
403
|
+
}).filter(Boolean);
|
|
404
|
+
const previewList = remotePreview.slice(0, 4);
|
|
405
|
+
const extraCount = remotePreview.length > previewList.length ? remotePreview.length - previewList.length : 0;
|
|
406
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.wrapper, children: [
|
|
407
|
+
/* @__PURE__ */ jsxs("div", { className: styles.summaryCard, children: [
|
|
408
|
+
/* @__PURE__ */ jsxs("div", { className: styles.summaryHeader, children: [
|
|
409
|
+
/* @__PURE__ */ jsx("span", { className: styles.summaryTitle, children: "Remotes in scope" }),
|
|
410
|
+
/* @__PURE__ */ jsx("span", { className: styles.summaryHint, children: "Override manifests to verify integration without redeploying." })
|
|
411
|
+
] }),
|
|
412
|
+
/* @__PURE__ */ jsxs("div", { className: styles.chipGroup, children: [
|
|
413
|
+
previewList.length ? previewList.map((name) => /* @__PURE__ */ jsx("span", { className: styles.chip, children: name }, name)) : /* @__PURE__ */ jsx("span", { className: styles.chipPlaceholder, children: "Waiting for module map" }),
|
|
414
|
+
extraCount > 0 && /* @__PURE__ */ jsxs("span", { className: styles.moreChip, children: [
|
|
415
|
+
"+",
|
|
416
|
+
extraCount,
|
|
417
|
+
" more"
|
|
418
|
+
] })
|
|
419
|
+
] })
|
|
420
|
+
] }),
|
|
421
|
+
/* @__PURE__ */ jsx("section", { className: styles.formSection, children: /* @__PURE__ */ jsx(
|
|
186
422
|
Form,
|
|
187
423
|
{
|
|
188
424
|
form,
|
|
@@ -198,6 +434,8 @@ const Layout = (props) => {
|
|
|
198
434
|
validateForm: () => validateForm(form),
|
|
199
435
|
enableHMR,
|
|
200
436
|
onHMRChange,
|
|
437
|
+
enableClip,
|
|
438
|
+
onClipChange,
|
|
201
439
|
versionList,
|
|
202
440
|
setVersionList,
|
|
203
441
|
getVersion,
|
|
@@ -206,8 +444,7 @@ const Layout = (props) => {
|
|
|
206
444
|
}
|
|
207
445
|
)
|
|
208
446
|
}
|
|
209
|
-
)
|
|
210
|
-
/* @__PURE__ */ jsx(Dependency, { snapshot })
|
|
447
|
+
) })
|
|
211
448
|
] });
|
|
212
449
|
};
|
|
213
450
|
var Layout_default = Layout;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./index_module.css";
|
|
2
|
-
var index_module_default = { "
|
|
2
|
+
var index_module_default = { "wrapper": "wrapper_084ab", "summaryCard": "summaryCard_084ab", "summaryHeader": "summaryHeader_084ab", "summaryTitle": "summaryTitle_084ab", "summaryHint": "summaryHint_084ab", "chipGroup": "chipGroup_084ab", "chip": "chip_084ab", "moreChip": "moreChip_084ab", "chipPlaceholder": "chipPlaceholder_084ab", "formSection": "formSection_084ab" };
|
|
3
3
|
export {
|
|
4
4
|
index_module_default as default
|
|
5
5
|
};
|
|
@@ -1,48 +1,68 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
1
|
+
.wrapper_084ab {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 24px;
|
|
5
|
+
flex: 1 1;
|
|
3
6
|
}
|
|
4
7
|
|
|
5
|
-
.
|
|
8
|
+
.summaryCard_084ab {
|
|
9
|
+
padding: 18px 20px;
|
|
10
|
+
border: 1px solid rgba(228, 228, 231, 0.5);
|
|
6
11
|
display: flex;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
.card_084ab .appName_084ab {
|
|
11
|
-
margin: 1vh 0;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: 16px;
|
|
14
|
+
min-height: 110px;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
.
|
|
17
|
+
.summaryHeader_084ab {
|
|
15
18
|
display: flex;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
color: rgb(78, 89, 105);
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
gap: 6px;
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
|
|
23
|
+
.summaryTitle_084ab {
|
|
24
|
+
font-size: 16px;
|
|
25
|
+
font-weight: 600;
|
|
26
|
+
color: #1f2937;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.summaryHint_084ab {
|
|
30
|
+
font-size: 12px;
|
|
31
|
+
color: #4b5563;
|
|
22
32
|
}
|
|
23
33
|
|
|
24
|
-
.
|
|
34
|
+
.chipGroup_084ab {
|
|
25
35
|
display: flex;
|
|
26
36
|
align-items: center;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
.header_084ab .add_084ab {
|
|
30
|
-
margin: 0 0.5vw;
|
|
37
|
+
flex-wrap: wrap;
|
|
38
|
+
gap: 8px;
|
|
31
39
|
}
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
|
|
41
|
+
.chip_084ab,
|
|
42
|
+
.moreChip_084ab,
|
|
43
|
+
.chipPlaceholder_084ab {
|
|
44
|
+
padding: 6px 10px;
|
|
45
|
+
border-radius: 12px;
|
|
46
|
+
border: 1px solid rgba(228, 228, 231, 0.5);
|
|
47
|
+
background: rgba(255, 255, 255, 0.9);
|
|
48
|
+
font-size: 12px;
|
|
49
|
+
color: #1f2937;
|
|
50
|
+
letter-spacing: 0.02em;
|
|
34
51
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
52
|
+
|
|
53
|
+
.chipPlaceholder_084ab {
|
|
54
|
+
border-style: dashed;
|
|
55
|
+
color: #4b5563;
|
|
56
|
+
background: rgba(255, 255, 255, 0.9);
|
|
40
57
|
}
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
|
|
59
|
+
.moreChip_084ab {
|
|
60
|
+
background: rgba(243, 244, 246, 0.4);
|
|
61
|
+
border-color: rgba(228, 228, 231, 0.5);
|
|
43
62
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
63
|
+
|
|
64
|
+
.formSection_084ab {
|
|
65
|
+
padding: 22px 24px;
|
|
66
|
+
border: 1px solid rgba(228, 228, 231, 0.5);
|
|
67
|
+
background: rgba(255, 255, 255, 0.9);
|
|
48
68
|
}
|