@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,10 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
9
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
8
25
|
var __export = (target, all) => {
|
|
9
26
|
for (var name in all)
|
|
10
27
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -57,9 +74,21 @@ var import_ahooks = require("ahooks");
|
|
|
57
74
|
var import_web_react = require("@arco-design/web-react");
|
|
58
75
|
var import_sdk = require("@module-federation/sdk");
|
|
59
76
|
var import_Form = __toESM(require("../Form"));
|
|
60
|
-
var import_Graph = __toESM(require("../Graph"));
|
|
61
77
|
var import_utils = require("../../utils");
|
|
62
78
|
var import_constant = require("../../template/constant");
|
|
79
|
+
var import_index = __toESM(require("./index.module"));
|
|
80
|
+
const sortRulesForSignature = (rules) => [...rules].sort((a, b) => {
|
|
81
|
+
const keyCompare = (a.key || "").localeCompare(b.key || "");
|
|
82
|
+
if (keyCompare !== 0) {
|
|
83
|
+
return keyCompare;
|
|
84
|
+
}
|
|
85
|
+
return (a.value || "").localeCompare(b.value || "");
|
|
86
|
+
}).map((rule) => ({
|
|
87
|
+
key: rule.key || "",
|
|
88
|
+
value: rule.value || "",
|
|
89
|
+
checked: Boolean(rule.checked)
|
|
90
|
+
}));
|
|
91
|
+
const getEffectiveSignature = (rules) => rules.length ? JSON.stringify(sortRulesForSignature(rules)) : "";
|
|
63
92
|
const Layout = (props) => {
|
|
64
93
|
const {
|
|
65
94
|
moduleInfo,
|
|
@@ -69,57 +98,153 @@ const Layout = (props) => {
|
|
|
69
98
|
getVersion,
|
|
70
99
|
handleProxyAddress,
|
|
71
100
|
customValueValidate,
|
|
72
|
-
headerSlot
|
|
101
|
+
headerSlot,
|
|
102
|
+
onModuleInfoChange,
|
|
103
|
+
onModuleInfoReset,
|
|
104
|
+
tabId
|
|
73
105
|
} = props;
|
|
74
106
|
const { producer } = (0, import_utils.separateType)(moduleInfo);
|
|
107
|
+
const producerKey = (0, import_react.useMemo)(() => producer.join("|"), [producer]);
|
|
75
108
|
const [condition, setCondition] = (0, import_react.useState)(import_constant.statusInfo.processing);
|
|
76
109
|
const [formStatus, setFormStatus] = (0, import_react.useState)([]);
|
|
77
|
-
const [snapshot, setSnapshot] = (0, import_react.useState)(moduleInfo);
|
|
78
110
|
const [form] = import_web_react.Form.useForm();
|
|
79
111
|
const [enableHMR, setEnalbeHMR] = (0, import_react.useState)("disable");
|
|
112
|
+
const [enableClip, setEnableClip] = (0, import_react.useState)(() => {
|
|
113
|
+
try {
|
|
114
|
+
if (tabId) {
|
|
115
|
+
return localStorage.getItem(`${import_constant.ENABLE_CLIP}_${tabId}`) === "true";
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
} catch (e) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
const lastFormSignatureRef = (0, import_react.useRef)("");
|
|
123
|
+
const lastEffectiveRulesRef = (0, import_react.useRef)("");
|
|
124
|
+
const lastRawRulesRef = (0, import_react.useRef)([]);
|
|
125
|
+
const lastEnableClipRef = (0, import_react.useRef)(enableClip);
|
|
126
|
+
const ensureFederationContext = () => {
|
|
127
|
+
if (!window.__FEDERATION__) {
|
|
128
|
+
window.__FEDERATION__ = {
|
|
129
|
+
originModuleInfo: moduleInfo || {},
|
|
130
|
+
moduleInfo: moduleInfo || {}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
if (!window.__FEDERATION__.originModuleInfo) {
|
|
134
|
+
window.__FEDERATION__.originModuleInfo = moduleInfo || {};
|
|
135
|
+
}
|
|
136
|
+
if (!window.__FEDERATION__.moduleInfo) {
|
|
137
|
+
window.__FEDERATION__.moduleInfo = moduleInfo || {};
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
(0, import_react.useEffect)(() => {
|
|
141
|
+
ensureFederationContext();
|
|
142
|
+
window.__FEDERATION__.moduleInfo = JSON.parse(
|
|
143
|
+
JSON.stringify(moduleInfo || {})
|
|
144
|
+
);
|
|
145
|
+
window.__FEDERATION__.originModuleInfo = JSON.parse(
|
|
146
|
+
JSON.stringify(moduleInfo || {})
|
|
147
|
+
);
|
|
148
|
+
const rawRules = form.getFieldValue(import_constant.proxyFormField) || [];
|
|
149
|
+
lastRawRulesRef.current = JSON.parse(JSON.stringify(rawRules));
|
|
150
|
+
}, [moduleInfo, form]);
|
|
151
|
+
const collectEffectiveRules = (rules, statusList) => {
|
|
152
|
+
return rules.reduce((memo, current, idx) => {
|
|
153
|
+
if (!(current == null ? void 0 : current.checked)) {
|
|
154
|
+
return memo;
|
|
155
|
+
}
|
|
156
|
+
const status = statusList[idx];
|
|
157
|
+
const keyValid = status ? status.keyStatus : Boolean(current.key);
|
|
158
|
+
const valueValid = status ? status.valueStatus : Boolean(current.value);
|
|
159
|
+
if (!keyValid || !valueValid) {
|
|
160
|
+
return memo;
|
|
161
|
+
}
|
|
162
|
+
const duplicate = JSON.parse(JSON.stringify(current));
|
|
163
|
+
if (handleProxyAddress) {
|
|
164
|
+
duplicate.value = handleProxyAddress(duplicate.value);
|
|
165
|
+
}
|
|
166
|
+
memo.push(duplicate);
|
|
167
|
+
return memo;
|
|
168
|
+
}, []);
|
|
169
|
+
};
|
|
170
|
+
const hasPendingRule = (rules, statusList) => {
|
|
171
|
+
return rules.some((rule, idx) => {
|
|
172
|
+
if (!(rule == null ? void 0 : rule.checked)) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
const status = statusList[idx];
|
|
176
|
+
if (!status) {
|
|
177
|
+
return Boolean(rule.key) && !rule.value;
|
|
178
|
+
}
|
|
179
|
+
return Boolean(status.keyStatus) && !status.valueStatus;
|
|
180
|
+
});
|
|
181
|
+
};
|
|
80
182
|
const { run } = (0, import_ahooks.useDebounceFn)(
|
|
81
183
|
(formData) => __async(void 0, null, function* () {
|
|
184
|
+
ensureFederationContext();
|
|
82
185
|
window.__FEDERATION__.moduleInfo = JSON.parse(
|
|
83
186
|
JSON.stringify(window.__FEDERATION__.originModuleInfo)
|
|
84
187
|
);
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const value = handleProxyAddress(duplicate.value);
|
|
97
|
-
duplicate.value = value;
|
|
98
|
-
}
|
|
99
|
-
return [...memo, duplicate];
|
|
100
|
-
},
|
|
101
|
-
[]
|
|
102
|
-
);
|
|
188
|
+
const rawRules = formData[import_constant.proxyFormField] || [];
|
|
189
|
+
const rawSignature = JSON.stringify(rawRules);
|
|
190
|
+
if (rawSignature === lastFormSignatureRef.current) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const effectiveRules = collectEffectiveRules(rawRules, formStatus);
|
|
194
|
+
const effectiveSignature = getEffectiveSignature(effectiveRules);
|
|
195
|
+
const pendingRule = hasPendingRule(rawRules, formStatus);
|
|
196
|
+
const hadPreviousEffective = lastEffectiveRulesRef.current !== "" && lastEffectiveRulesRef.current !== "[]";
|
|
197
|
+
const clipChanged = enableClip !== lastEnableClipRef.current;
|
|
198
|
+
lastEnableClipRef.current = enableClip;
|
|
103
199
|
try {
|
|
104
200
|
setCondition(import_constant.statusInfo.processing);
|
|
105
|
-
if (!
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
201
|
+
if (!effectiveRules.length) {
|
|
202
|
+
if (pendingRule) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (hadPreviousEffective) {
|
|
206
|
+
yield (0, import_utils.removeStorage)(import_sdk.MODULE_DEVTOOL_IDENTIFIER);
|
|
207
|
+
yield (0, import_utils.removeStorage)(import_constant.BROWSER_ENV_KEY);
|
|
208
|
+
yield (0, import_utils.removeStorageKey)(import_constant.__FEDERATION_DEVTOOLS__, "overrides");
|
|
209
|
+
yield (0, import_utils.injectScript)(import_utils.reloadPage, false);
|
|
210
|
+
setCondition(import_constant.statusInfo.noProxy);
|
|
211
|
+
lastEffectiveRulesRef.current = "";
|
|
212
|
+
if (typeof onModuleInfoReset === "function") {
|
|
213
|
+
onModuleInfoReset();
|
|
214
|
+
} else {
|
|
215
|
+
onModuleInfoChange == null ? void 0 : onModuleInfoChange(window.__FEDERATION__.originModuleInfo);
|
|
216
|
+
}
|
|
217
|
+
} else {
|
|
218
|
+
setCondition(import_constant.statusInfo.noProxy);
|
|
219
|
+
}
|
|
112
220
|
return;
|
|
113
221
|
}
|
|
114
|
-
|
|
222
|
+
if (!clipChanged && effectiveSignature === lastEffectiveRulesRef.current) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if (rawRules.every((rule) => !rule.value)) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const { moduleInfo: moduleInfo2, status, overrides } = handleSnapshot ? yield handleSnapshot(effectiveRules) : yield (0, import_utils.getModuleInfo)(effectiveRules);
|
|
229
|
+
if (enableClip) {
|
|
230
|
+
Object.values(moduleInfo2).forEach((val) => {
|
|
231
|
+
if (val.modules) {
|
|
232
|
+
val.modules = [];
|
|
233
|
+
}
|
|
234
|
+
if (val.shared) {
|
|
235
|
+
val.shared = [];
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
}
|
|
115
239
|
const snapshotJson = JSON.stringify(moduleInfo2);
|
|
116
240
|
yield (0, import_utils.setStorage)(import_sdk.MODULE_DEVTOOL_IDENTIFIER, snapshotJson);
|
|
117
241
|
yield (0, import_utils.setStorage)(import_constant.BROWSER_ENV_KEY);
|
|
118
242
|
yield (0, import_utils.mergeStorage)(import_constant.__FEDERATION_DEVTOOLS__, "overrides", overrides);
|
|
119
243
|
yield (0, import_utils.injectScript)(import_utils.reloadPage, false);
|
|
120
244
|
window.__FEDERATION__.moduleInfo = moduleInfo2;
|
|
121
|
-
|
|
245
|
+
onModuleInfoChange == null ? void 0 : onModuleInfoChange(moduleInfo2);
|
|
122
246
|
setCondition(import_constant.statusInfo[status]);
|
|
247
|
+
lastEffectiveRulesRef.current = effectiveSignature;
|
|
123
248
|
} catch (e) {
|
|
124
249
|
console.log(e);
|
|
125
250
|
setCondition(import_constant.statusInfo.error);
|
|
@@ -130,28 +255,81 @@ const Layout = (props) => {
|
|
|
130
255
|
}
|
|
131
256
|
);
|
|
132
257
|
(0, import_react.useEffect)(() => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
(0, import_utils.getScope)().then((scope) => __async(void 0, null, function* () {
|
|
258
|
+
ensureFederationContext();
|
|
259
|
+
let cancelled = false;
|
|
260
|
+
const hydrateForm = () => __async(void 0, null, function* () {
|
|
137
261
|
var _a, _b, _c;
|
|
262
|
+
const scope = yield (0, import_utils.getScope)();
|
|
138
263
|
const data = yield chrome.storage.sync.get([import_constant.FormID]);
|
|
139
264
|
const config = (_a = data == null ? void 0 : data[import_constant.FormID]) == null ? void 0 : _a[scope];
|
|
140
265
|
let storeData;
|
|
141
266
|
if ((0, import_utils.isObject)(config)) {
|
|
142
267
|
storeData = JSON.parse(JSON.stringify(config));
|
|
143
|
-
|
|
144
|
-
(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
268
|
+
if (producer.length) {
|
|
269
|
+
storeData[import_constant.proxyFormField] = (_b = storeData[import_constant.proxyFormField]) == null ? void 0 : _b.filter(
|
|
270
|
+
(item) => producer.includes(item.key)
|
|
271
|
+
);
|
|
272
|
+
if (!((_c = storeData[import_constant.proxyFormField]) == null ? void 0 : _c.length)) {
|
|
273
|
+
storeData = JSON.parse(JSON.stringify(import_constant.defaultModuleData));
|
|
274
|
+
}
|
|
148
275
|
}
|
|
149
276
|
} else {
|
|
150
|
-
storeData = import_constant.defaultModuleData;
|
|
277
|
+
storeData = JSON.parse(JSON.stringify(import_constant.defaultModuleData));
|
|
151
278
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
279
|
+
let overridesApplied = false;
|
|
280
|
+
try {
|
|
281
|
+
const overridesState = yield (0, import_utils.getStorageValue)(import_constant.__FEDERATION_DEVTOOLS__);
|
|
282
|
+
if (typeof overridesState === "string" && overridesState) {
|
|
283
|
+
const parsedState = JSON.parse(overridesState);
|
|
284
|
+
const overrides = parsedState == null ? void 0 : parsedState.overrides;
|
|
285
|
+
if ((0, import_utils.isObject)(overrides)) {
|
|
286
|
+
const overrideRules = Object.entries(overrides).map(([key, value]) => ({
|
|
287
|
+
key,
|
|
288
|
+
value: typeof value === "string" ? value : "",
|
|
289
|
+
checked: true
|
|
290
|
+
})).filter(
|
|
291
|
+
(rule) => Boolean(rule.key) && Boolean(rule.value)
|
|
292
|
+
);
|
|
293
|
+
const filteredRules = producer.length ? overrideRules.filter((rule) => producer.includes(rule.key)) : overrideRules;
|
|
294
|
+
if (filteredRules.length) {
|
|
295
|
+
storeData = __spreadProps(__spreadValues({}, storeData), {
|
|
296
|
+
[import_constant.proxyFormField]: filteredRules
|
|
297
|
+
});
|
|
298
|
+
overridesApplied = true;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
} catch (error) {
|
|
303
|
+
console.warn(
|
|
304
|
+
"[MF Devtools] hydrate overrides from localStorage failed",
|
|
305
|
+
error
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
if (!cancelled) {
|
|
309
|
+
form.setFieldsValue(storeData);
|
|
310
|
+
lastFormSignatureRef.current = JSON.stringify(storeData);
|
|
311
|
+
const rules = Array.isArray(
|
|
312
|
+
storeData[import_constant.proxyFormField]
|
|
313
|
+
) ? storeData[import_constant.proxyFormField] : [];
|
|
314
|
+
const effectiveRules = collectEffectiveRules(rules, []);
|
|
315
|
+
lastEffectiveRulesRef.current = getEffectiveSignature(effectiveRules);
|
|
316
|
+
lastRawRulesRef.current = JSON.parse(JSON.stringify(rules));
|
|
317
|
+
setFormStatus(
|
|
318
|
+
rules.map((rule) => ({
|
|
319
|
+
keyStatus: Boolean(rule == null ? void 0 : rule.key),
|
|
320
|
+
valueStatus: Boolean(rule == null ? void 0 : rule.value)
|
|
321
|
+
}))
|
|
322
|
+
);
|
|
323
|
+
if (overridesApplied) {
|
|
324
|
+
(0, import_utils.setChromeStorage)(storeData);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
hydrateForm();
|
|
329
|
+
return () => {
|
|
330
|
+
cancelled = true;
|
|
331
|
+
};
|
|
332
|
+
}, [moduleInfo, producerKey, form]);
|
|
155
333
|
(0, import_react.useEffect)(() => {
|
|
156
334
|
chrome.storage.sync.get([import_constant.ENABLEHMR]).then((data) => {
|
|
157
335
|
const enable = data[import_constant.ENABLEHMR];
|
|
@@ -164,9 +342,25 @@ const Layout = (props) => {
|
|
|
164
342
|
validateForm(form);
|
|
165
343
|
}, []);
|
|
166
344
|
(0, import_ahooks.useUpdateEffect)(() => {
|
|
345
|
+
if (!producer.length) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
167
348
|
const formData = form.getFieldsValue();
|
|
349
|
+
const signature = JSON.stringify(formData);
|
|
350
|
+
if (signature === lastFormSignatureRef.current) {
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
lastFormSignatureRef.current = signature;
|
|
354
|
+
const effectiveRules = collectEffectiveRules(
|
|
355
|
+
formData[import_constant.proxyFormField] || [],
|
|
356
|
+
formStatus
|
|
357
|
+
);
|
|
358
|
+
const effectiveSignature = getEffectiveSignature(effectiveRules);
|
|
359
|
+
if (effectiveSignature === lastEffectiveRulesRef.current) {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
168
362
|
run(formData);
|
|
169
|
-
}, []);
|
|
363
|
+
}, [producerKey, formStatus]);
|
|
170
364
|
const validateForm = (form2) => {
|
|
171
365
|
setTimeout(() => {
|
|
172
366
|
form2.validate().catch(() => {
|
|
@@ -176,6 +370,11 @@ const Layout = (props) => {
|
|
|
176
370
|
};
|
|
177
371
|
const onValuesChange = (target, formData) => {
|
|
178
372
|
validateForm(form);
|
|
373
|
+
const signature = JSON.stringify(formData);
|
|
374
|
+
if (signature === lastFormSignatureRef.current) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
lastFormSignatureRef.current = signature;
|
|
179
378
|
(0, import_utils.setChromeStorage)(formData);
|
|
180
379
|
run(formData);
|
|
181
380
|
};
|
|
@@ -188,11 +387,43 @@ const Layout = (props) => {
|
|
|
188
387
|
(0, import_utils.mergeStorage)(import_constant.__FEDERATION_DEVTOOLS__, import_constant.__ENABLE_FAST_REFRESH__, on);
|
|
189
388
|
} else {
|
|
190
389
|
(0, import_utils.removeStorageKey)(import_constant.__FEDERATION_DEVTOOLS__, import_constant.__ENABLE_FAST_REFRESH__);
|
|
390
|
+
(0, import_utils.removeStorageKey)(import_constant.__FEDERATION_DEVTOOLS__, import_constant.__EAGER_SHARE__);
|
|
191
391
|
}
|
|
192
392
|
(0, import_utils.injectScript)(import_utils.reloadPage, false);
|
|
193
393
|
};
|
|
194
|
-
|
|
195
|
-
|
|
394
|
+
const onClipChange = (on) => {
|
|
395
|
+
setEnableClip(on);
|
|
396
|
+
try {
|
|
397
|
+
if (tabId) {
|
|
398
|
+
localStorage.setItem(`${import_constant.ENABLE_CLIP}_${tabId}`, String(on));
|
|
399
|
+
}
|
|
400
|
+
} catch (e) {
|
|
401
|
+
console.error(e);
|
|
402
|
+
}
|
|
403
|
+
run(form.getFieldsValue());
|
|
404
|
+
};
|
|
405
|
+
const remotePreview = producer.map((id) => {
|
|
406
|
+
const [, name] = id.split(":");
|
|
407
|
+
return name || id;
|
|
408
|
+
}).filter(Boolean);
|
|
409
|
+
const previewList = remotePreview.slice(0, 4);
|
|
410
|
+
const extraCount = remotePreview.length > previewList.length ? remotePreview.length - previewList.length : 0;
|
|
411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.wrapper, children: [
|
|
412
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.summaryCard, children: [
|
|
413
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.summaryHeader, children: [
|
|
414
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.summaryTitle, children: "Remotes in scope" }),
|
|
415
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.summaryHint, children: "Override manifests to verify integration without redeploying." })
|
|
416
|
+
] }),
|
|
417
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.chipGroup, children: [
|
|
418
|
+
previewList.length ? previewList.map((name) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.chip, children: name }, name)) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.chipPlaceholder, children: "Waiting for module map" }),
|
|
419
|
+
extraCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: import_index.default.moreChip, children: [
|
|
420
|
+
"+",
|
|
421
|
+
extraCount,
|
|
422
|
+
" more"
|
|
423
|
+
] })
|
|
424
|
+
] })
|
|
425
|
+
] }),
|
|
426
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", { className: import_index.default.formSection, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
196
427
|
import_web_react.Form,
|
|
197
428
|
{
|
|
198
429
|
form,
|
|
@@ -208,6 +439,8 @@ const Layout = (props) => {
|
|
|
208
439
|
validateForm: () => validateForm(form),
|
|
209
440
|
enableHMR,
|
|
210
441
|
onHMRChange,
|
|
442
|
+
enableClip,
|
|
443
|
+
onClipChange,
|
|
211
444
|
versionList,
|
|
212
445
|
setVersionList,
|
|
213
446
|
getVersion,
|
|
@@ -216,8 +449,7 @@ const Layout = (props) => {
|
|
|
216
449
|
}
|
|
217
450
|
)
|
|
218
451
|
}
|
|
219
|
-
)
|
|
220
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Graph.default, { snapshot })
|
|
452
|
+
) })
|
|
221
453
|
] });
|
|
222
454
|
};
|
|
223
455
|
var Layout_default = Layout;
|
|
@@ -22,4 +22,4 @@ __export(index_module_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(index_module_exports);
|
|
24
24
|
var import_index_module = require("./index_module.css");
|
|
25
|
-
var index_module_default = { "
|
|
25
|
+
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" };
|
|
@@ -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
|
}
|