@module-federation/devtools 0.21.6 → 0.22.1
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 +300 -49
- 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 +3 -19
- package/dist/es/utils/chrome/index.js +91 -38
- package/dist/es/utils/chrome/messages.js +6 -0
- package/dist/es/utils/chrome/override-remote.js +42 -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 +294 -47
- 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 +4 -17
- package/dist/lib/utils/chrome/index.js +94 -38
- package/dist/lib/utils/chrome/messages.js +31 -0
- package/dist/lib/utils/chrome/override-remote.js +65 -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 +2 -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/override-remote.d.ts +1 -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,11 +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
71
|
__FEDERATION_DEVTOOLS__,
|
|
52
72
|
__EAGER_SHARE__
|
|
53
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)) : "";
|
|
54
87
|
const Layout = (props) => {
|
|
55
88
|
const {
|
|
56
89
|
moduleInfo,
|
|
@@ -60,57 +93,164 @@ const Layout = (props) => {
|
|
|
60
93
|
getVersion,
|
|
61
94
|
handleProxyAddress,
|
|
62
95
|
customValueValidate,
|
|
63
|
-
headerSlot
|
|
96
|
+
headerSlot,
|
|
97
|
+
onModuleInfoChange,
|
|
98
|
+
onModuleInfoReset,
|
|
99
|
+
tabId
|
|
64
100
|
} = props;
|
|
65
101
|
const { producer } = separateType(moduleInfo);
|
|
102
|
+
const producerKey = useMemo(() => producer.join("|"), [producer]);
|
|
66
103
|
const [condition, setCondition] = useState(statusInfo.processing);
|
|
67
104
|
const [formStatus, setFormStatus] = useState([]);
|
|
68
|
-
const [snapshot, setSnapshot] = useState(moduleInfo);
|
|
69
105
|
const [form] = Form.useForm();
|
|
70
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
|
+
};
|
|
71
177
|
const { run } = useDebounceFn(
|
|
72
178
|
(formData) => __async(void 0, null, function* () {
|
|
179
|
+
ensureFederationContext();
|
|
73
180
|
window.__FEDERATION__.moduleInfo = JSON.parse(
|
|
74
181
|
JSON.stringify(window.__FEDERATION__.originModuleInfo)
|
|
75
182
|
);
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const value = handleProxyAddress(duplicate.value);
|
|
88
|
-
duplicate.value = value;
|
|
89
|
-
}
|
|
90
|
-
return [...memo, duplicate];
|
|
91
|
-
},
|
|
92
|
-
[]
|
|
93
|
-
);
|
|
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;
|
|
94
194
|
try {
|
|
95
195
|
setCondition(statusInfo.processing);
|
|
96
|
-
if (!
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
+
}
|
|
101
215
|
setCondition(statusInfo.noProxy);
|
|
102
|
-
setSnapshot(window.__FEDERATION__.originModuleInfo);
|
|
103
216
|
return;
|
|
104
217
|
}
|
|
105
|
-
|
|
218
|
+
if (!clipChanged && effectiveSignature === lastEffectiveRulesRef.current) {
|
|
219
|
+
if (hadPreviousEffective) {
|
|
220
|
+
setCondition(statusInfo.success);
|
|
221
|
+
} else {
|
|
222
|
+
setCondition(statusInfo.noProxy);
|
|
223
|
+
}
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (rawRules.every((rule) => !rule.value)) {
|
|
227
|
+
if (hadPreviousEffective) {
|
|
228
|
+
setCondition(statusInfo.success);
|
|
229
|
+
} else {
|
|
230
|
+
setCondition(statusInfo.noProxy);
|
|
231
|
+
}
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
const { moduleInfo: moduleInfo2, status, overrides } = handleSnapshot ? yield handleSnapshot(effectiveRules) : yield getModuleInfo(effectiveRules);
|
|
235
|
+
if (enableClip) {
|
|
236
|
+
Object.values(moduleInfo2).forEach((val) => {
|
|
237
|
+
if (val.modules) {
|
|
238
|
+
val.modules = [];
|
|
239
|
+
}
|
|
240
|
+
if (val.shared) {
|
|
241
|
+
val.shared = [];
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}
|
|
106
245
|
const snapshotJson = JSON.stringify(moduleInfo2);
|
|
107
246
|
yield setStorage(MODULE_DEVTOOL_IDENTIFIER, snapshotJson);
|
|
108
247
|
yield setStorage(BROWSER_ENV_KEY);
|
|
109
248
|
yield mergeStorage(__FEDERATION_DEVTOOLS__, "overrides", overrides);
|
|
110
249
|
yield injectScript(reloadPage, false);
|
|
111
250
|
window.__FEDERATION__.moduleInfo = moduleInfo2;
|
|
112
|
-
|
|
251
|
+
onModuleInfoChange == null ? void 0 : onModuleInfoChange(moduleInfo2);
|
|
113
252
|
setCondition(statusInfo[status]);
|
|
253
|
+
lastEffectiveRulesRef.current = effectiveSignature;
|
|
114
254
|
} catch (e) {
|
|
115
255
|
console.log(e);
|
|
116
256
|
setCondition(statusInfo.error);
|
|
@@ -121,28 +261,86 @@ const Layout = (props) => {
|
|
|
121
261
|
}
|
|
122
262
|
);
|
|
123
263
|
useEffect(() => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
getScope().then((scope) => __async(void 0, null, function* () {
|
|
264
|
+
ensureFederationContext();
|
|
265
|
+
let cancelled = false;
|
|
266
|
+
const hydrateForm = () => __async(void 0, null, function* () {
|
|
128
267
|
var _a, _b, _c;
|
|
268
|
+
const scope = yield getScope();
|
|
129
269
|
const data = yield chrome.storage.sync.get([FormID]);
|
|
130
270
|
const config = (_a = data == null ? void 0 : data[FormID]) == null ? void 0 : _a[scope];
|
|
131
271
|
let storeData;
|
|
132
272
|
if (isObject(config)) {
|
|
133
273
|
storeData = JSON.parse(JSON.stringify(config));
|
|
134
|
-
|
|
135
|
-
(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
274
|
+
if (producer.length) {
|
|
275
|
+
storeData[proxyFormField] = (_b = storeData[proxyFormField]) == null ? void 0 : _b.filter(
|
|
276
|
+
(item) => producer.includes(item.key)
|
|
277
|
+
);
|
|
278
|
+
if (!((_c = storeData[proxyFormField]) == null ? void 0 : _c.length)) {
|
|
279
|
+
storeData = JSON.parse(JSON.stringify(defaultModuleData));
|
|
280
|
+
}
|
|
139
281
|
}
|
|
140
282
|
} else {
|
|
141
|
-
storeData = defaultModuleData;
|
|
283
|
+
storeData = JSON.parse(JSON.stringify(defaultModuleData));
|
|
142
284
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
285
|
+
let overridesApplied = false;
|
|
286
|
+
try {
|
|
287
|
+
const overridesState = yield getStorageValue(__FEDERATION_DEVTOOLS__);
|
|
288
|
+
if (typeof overridesState === "string" && overridesState) {
|
|
289
|
+
const parsedState = JSON.parse(overridesState);
|
|
290
|
+
const overrides = parsedState == null ? void 0 : parsedState.overrides;
|
|
291
|
+
if (isObject(overrides)) {
|
|
292
|
+
const overrideRules = Object.entries(overrides).map(([key, value]) => ({
|
|
293
|
+
key,
|
|
294
|
+
value: typeof value === "string" ? value : "",
|
|
295
|
+
checked: true
|
|
296
|
+
})).filter(
|
|
297
|
+
(rule) => Boolean(rule.key) && Boolean(rule.value)
|
|
298
|
+
);
|
|
299
|
+
const filteredRules = producer.length ? overrideRules.filter((rule) => producer.includes(rule.key)) : overrideRules;
|
|
300
|
+
if (filteredRules.length) {
|
|
301
|
+
storeData = __spreadProps(__spreadValues({}, storeData), {
|
|
302
|
+
[proxyFormField]: filteredRules
|
|
303
|
+
});
|
|
304
|
+
overridesApplied = true;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
} catch (error) {
|
|
309
|
+
console.warn(
|
|
310
|
+
"[MF Devtools] hydrate overrides from localStorage failed",
|
|
311
|
+
error
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
if (!cancelled) {
|
|
315
|
+
form.setFieldsValue(storeData);
|
|
316
|
+
lastFormSignatureRef.current = JSON.stringify(storeData);
|
|
317
|
+
const rules = Array.isArray(
|
|
318
|
+
storeData[proxyFormField]
|
|
319
|
+
) ? storeData[proxyFormField] : [];
|
|
320
|
+
const effectiveRules = collectEffectiveRules(rules, []);
|
|
321
|
+
lastEffectiveRulesRef.current = getEffectiveSignature(effectiveRules);
|
|
322
|
+
lastRawRulesRef.current = JSON.parse(JSON.stringify(rules));
|
|
323
|
+
setFormStatus(
|
|
324
|
+
rules.map((rule) => ({
|
|
325
|
+
keyStatus: Boolean(rule == null ? void 0 : rule.key),
|
|
326
|
+
valueStatus: Boolean(rule == null ? void 0 : rule.value)
|
|
327
|
+
}))
|
|
328
|
+
);
|
|
329
|
+
if (overridesApplied) {
|
|
330
|
+
setChromeStorage(storeData);
|
|
331
|
+
}
|
|
332
|
+
if (effectiveRules.length) {
|
|
333
|
+
setCondition(statusInfo.success);
|
|
334
|
+
} else {
|
|
335
|
+
setCondition(statusInfo.noProxy);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
hydrateForm();
|
|
340
|
+
return () => {
|
|
341
|
+
cancelled = true;
|
|
342
|
+
};
|
|
343
|
+
}, [moduleInfo, producerKey, form]);
|
|
146
344
|
useEffect(() => {
|
|
147
345
|
chrome.storage.sync.get([ENABLEHMR]).then((data) => {
|
|
148
346
|
const enable = data[ENABLEHMR];
|
|
@@ -155,9 +353,25 @@ const Layout = (props) => {
|
|
|
155
353
|
validateForm(form);
|
|
156
354
|
}, []);
|
|
157
355
|
useUpdateEffect(() => {
|
|
356
|
+
if (!producer.length) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
158
359
|
const formData = form.getFieldsValue();
|
|
360
|
+
const signature = JSON.stringify(formData);
|
|
361
|
+
if (signature === lastFormSignatureRef.current) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
lastFormSignatureRef.current = signature;
|
|
365
|
+
const effectiveRules = collectEffectiveRules(
|
|
366
|
+
formData[proxyFormField] || [],
|
|
367
|
+
formStatus
|
|
368
|
+
);
|
|
369
|
+
const effectiveSignature = getEffectiveSignature(effectiveRules);
|
|
370
|
+
if (effectiveSignature === lastEffectiveRulesRef.current) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
159
373
|
run(formData);
|
|
160
|
-
}, []);
|
|
374
|
+
}, [producerKey, formStatus]);
|
|
161
375
|
const validateForm = (form2) => {
|
|
162
376
|
setTimeout(() => {
|
|
163
377
|
form2.validate().catch(() => {
|
|
@@ -167,6 +381,11 @@ const Layout = (props) => {
|
|
|
167
381
|
};
|
|
168
382
|
const onValuesChange = (target, formData) => {
|
|
169
383
|
validateForm(form);
|
|
384
|
+
const signature = JSON.stringify(formData);
|
|
385
|
+
if (signature === lastFormSignatureRef.current) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
lastFormSignatureRef.current = signature;
|
|
170
389
|
setChromeStorage(formData);
|
|
171
390
|
run(formData);
|
|
172
391
|
};
|
|
@@ -183,8 +402,39 @@ const Layout = (props) => {
|
|
|
183
402
|
}
|
|
184
403
|
injectScript(reloadPage, false);
|
|
185
404
|
};
|
|
186
|
-
|
|
187
|
-
|
|
405
|
+
const onClipChange = (on) => {
|
|
406
|
+
setEnableClip(on);
|
|
407
|
+
try {
|
|
408
|
+
if (tabId) {
|
|
409
|
+
localStorage.setItem(`${ENABLE_CLIP}_${tabId}`, String(on));
|
|
410
|
+
}
|
|
411
|
+
} catch (e) {
|
|
412
|
+
console.error(e);
|
|
413
|
+
}
|
|
414
|
+
run(form.getFieldsValue());
|
|
415
|
+
};
|
|
416
|
+
const remotePreview = producer.map((id) => {
|
|
417
|
+
const [, name] = id.split(":");
|
|
418
|
+
return name || id;
|
|
419
|
+
}).filter(Boolean);
|
|
420
|
+
const previewList = remotePreview.slice(0, 4);
|
|
421
|
+
const extraCount = remotePreview.length > previewList.length ? remotePreview.length - previewList.length : 0;
|
|
422
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.wrapper, children: [
|
|
423
|
+
/* @__PURE__ */ jsxs("div", { className: styles.summaryCard, children: [
|
|
424
|
+
/* @__PURE__ */ jsxs("div", { className: styles.summaryHeader, children: [
|
|
425
|
+
/* @__PURE__ */ jsx("span", { className: styles.summaryTitle, children: "Remotes in scope" }),
|
|
426
|
+
/* @__PURE__ */ jsx("span", { className: styles.summaryHint, children: "Override manifests to verify integration without redeploying." })
|
|
427
|
+
] }),
|
|
428
|
+
/* @__PURE__ */ jsxs("div", { className: styles.chipGroup, children: [
|
|
429
|
+
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" }),
|
|
430
|
+
extraCount > 0 && /* @__PURE__ */ jsxs("span", { className: styles.moreChip, children: [
|
|
431
|
+
"+",
|
|
432
|
+
extraCount,
|
|
433
|
+
" more"
|
|
434
|
+
] })
|
|
435
|
+
] })
|
|
436
|
+
] }),
|
|
437
|
+
/* @__PURE__ */ jsx("section", { className: styles.formSection, children: /* @__PURE__ */ jsx(
|
|
188
438
|
Form,
|
|
189
439
|
{
|
|
190
440
|
form,
|
|
@@ -200,6 +450,8 @@ const Layout = (props) => {
|
|
|
200
450
|
validateForm: () => validateForm(form),
|
|
201
451
|
enableHMR,
|
|
202
452
|
onHMRChange,
|
|
453
|
+
enableClip,
|
|
454
|
+
onClipChange,
|
|
203
455
|
versionList,
|
|
204
456
|
setVersionList,
|
|
205
457
|
getVersion,
|
|
@@ -208,8 +460,7 @@ const Layout = (props) => {
|
|
|
208
460
|
}
|
|
209
461
|
)
|
|
210
462
|
}
|
|
211
|
-
)
|
|
212
|
-
/* @__PURE__ */ jsx(Dependency, { snapshot })
|
|
463
|
+
) })
|
|
213
464
|
] });
|
|
214
465
|
};
|
|
215
466
|
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
|
}
|