@module-federation/devtools 0.22.0 → 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.
Files changed (100) hide show
  1. package/dist/es/App.css +12 -0
  2. package/dist/es/App.js +330 -22
  3. package/dist/es/App.module.js +1 -1
  4. package/dist/es/App_module.css +291 -5
  5. package/dist/es/component/DependencyGraph/index.js +205 -0
  6. package/dist/es/component/DependencyGraph/index.module.js +5 -0
  7. package/dist/es/component/DependencyGraph/index_module.css +97 -0
  8. package/dist/es/component/{GraphItem → DependencyGraphItem}/index.js +15 -6
  9. package/dist/es/component/DependencyGraphItem/index.module.js +5 -0
  10. package/dist/es/component/DependencyGraphItem/index_module.css +95 -0
  11. package/dist/es/component/Form/index.js +191 -109
  12. package/dist/es/component/Form/index.module.js +1 -1
  13. package/dist/es/component/Form/index_module.css +179 -25
  14. package/dist/es/component/Layout/index.js +300 -49
  15. package/dist/es/component/Layout/index.module.js +1 -1
  16. package/dist/es/component/Layout/index_module.css +52 -32
  17. package/dist/es/component/ModuleInfo/index.js +289 -0
  18. package/dist/es/component/ModuleInfo/index.module.js +5 -0
  19. package/dist/es/component/ModuleInfo/index_module.css +183 -0
  20. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.js +33 -0
  21. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.module.js +5 -0
  22. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
  23. package/dist/es/component/SharedDepsExplorer/index.js +506 -0
  24. package/dist/es/component/SharedDepsExplorer/index.module.js +5 -0
  25. package/dist/es/component/SharedDepsExplorer/index_module.css +457 -0
  26. package/dist/es/component/SharedDepsExplorer/share-utils.js +206 -0
  27. package/dist/es/template/constant.js +3 -19
  28. package/dist/es/utils/chrome/index.js +91 -38
  29. package/dist/es/utils/chrome/messages.js +6 -0
  30. package/dist/es/utils/chrome/override-remote.js +42 -0
  31. package/dist/es/utils/chrome/post-message-listener.js +2 -1
  32. package/dist/es/utils/chrome/post-message-start.js +10 -2
  33. package/dist/es/utils/chrome/storage.js +6 -1
  34. package/dist/es/utils/sdk/graph.js +25 -4
  35. package/dist/es/utils/sdk/index.js +9 -0
  36. package/dist/es/worker/index.js +168 -1
  37. package/dist/lib/App.css +12 -0
  38. package/dist/lib/App.js +321 -18
  39. package/dist/lib/App.module.js +1 -1
  40. package/dist/lib/App_module.css +291 -5
  41. package/dist/lib/component/DependencyGraph/index.js +227 -0
  42. package/dist/lib/component/{GraphItem → DependencyGraph}/index.module.js +1 -1
  43. package/dist/lib/component/DependencyGraph/index_module.css +97 -0
  44. package/dist/lib/component/{GraphItem → DependencyGraphItem}/index.js +18 -9
  45. package/dist/lib/component/{Graph → DependencyGraphItem}/index.module.js +1 -1
  46. package/dist/lib/component/DependencyGraphItem/index_module.css +95 -0
  47. package/dist/lib/component/Form/index.js +188 -107
  48. package/dist/lib/component/Form/index.module.js +1 -1
  49. package/dist/lib/component/Form/index_module.css +179 -25
  50. package/dist/lib/component/Layout/index.js +294 -47
  51. package/dist/lib/component/Layout/index.module.js +1 -1
  52. package/dist/lib/component/Layout/index_module.css +52 -32
  53. package/dist/lib/component/ModuleInfo/index.js +319 -0
  54. package/dist/lib/component/ModuleInfo/index.module.js +25 -0
  55. package/dist/lib/component/ModuleInfo/index_module.css +183 -0
  56. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.js +63 -0
  57. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.module.js +25 -0
  58. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
  59. package/dist/lib/component/SharedDepsExplorer/index.js +513 -0
  60. package/dist/lib/component/SharedDepsExplorer/index.module.js +25 -0
  61. package/dist/lib/component/SharedDepsExplorer/index_module.css +457 -0
  62. package/dist/lib/component/SharedDepsExplorer/share-utils.js +237 -0
  63. package/dist/lib/template/constant.js +4 -17
  64. package/dist/lib/utils/chrome/index.js +94 -38
  65. package/dist/lib/utils/chrome/messages.js +31 -0
  66. package/dist/lib/utils/chrome/override-remote.js +65 -0
  67. package/dist/lib/utils/chrome/post-message-listener.js +2 -1
  68. package/dist/lib/utils/chrome/post-message-start.js +10 -2
  69. package/dist/lib/utils/chrome/storage.js +5 -0
  70. package/dist/lib/utils/sdk/graph.js +25 -4
  71. package/dist/lib/utils/sdk/index.js +10 -0
  72. package/dist/lib/worker/index.js +156 -1
  73. package/dist/types/src/App.d.ts +2 -1
  74. package/dist/types/src/component/{Graph → DependencyGraph}/index.d.ts +0 -1
  75. package/dist/types/src/component/{GraphItem → DependencyGraphItem}/index.d.ts +0 -1
  76. package/dist/types/src/component/Form/index.d.ts +2 -0
  77. package/dist/types/src/component/Layout/index.d.ts +0 -1
  78. package/dist/types/src/component/ModuleInfo/index.d.ts +8 -0
  79. package/dist/types/src/component/SharedDepsExplorer/FocusResultDisplay.d.ts +15 -0
  80. package/dist/types/src/component/SharedDepsExplorer/index.d.ts +6 -0
  81. package/dist/types/src/component/SharedDepsExplorer/share-utils.d.ts +44 -0
  82. package/dist/types/src/init.d.ts +0 -1
  83. package/dist/types/src/template/constant.d.ts +2 -5
  84. package/dist/types/src/utils/chrome/index.d.ts +5 -3
  85. package/dist/types/src/utils/chrome/messages.d.ts +2 -0
  86. package/dist/types/src/utils/chrome/override-remote.d.ts +1 -0
  87. package/dist/types/src/utils/chrome/storage.d.ts +5 -4
  88. package/dist/types/src/utils/sdk/graph.d.ts +2 -1
  89. package/dist/types/src/utils/sdk/index.d.ts +1 -0
  90. package/dist/types/src/utils/types/common.d.ts +4 -0
  91. package/dist/types/src/worker/index.d.ts +1 -0
  92. package/package.json +11 -9
  93. package/dist/es/component/Graph/index.js +0 -127
  94. package/dist/es/component/Graph/index.module.js +0 -5
  95. package/dist/es/component/Graph/index_module.css +0 -12
  96. package/dist/es/component/GraphItem/index.module.js +0 -5
  97. package/dist/es/component/GraphItem/index_module.css +0 -61
  98. package/dist/lib/component/Graph/index.js +0 -149
  99. package/dist/lib/component/Graph/index_module.css +0 -12
  100. 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,164 @@ 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 filterFormData = formData[import_constant.proxyFormField].reduce(
86
- (memo, current, idx) => {
87
- if (!formStatus[idx]) {
88
- return memo;
89
- }
90
- const { keyStatus, valueStatus } = formStatus[idx];
91
- if (!keyStatus || !valueStatus || !current.checked) {
92
- return memo;
93
- }
94
- const duplicate = JSON.parse(JSON.stringify(current));
95
- if (handleProxyAddress) {
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 (!filterFormData.length) {
106
- yield (0, import_utils.removeStorage)(import_sdk.MODULE_DEVTOOL_IDENTIFIER);
107
- yield (0, import_utils.removeStorage)(import_constant.BROWSER_ENV_KEY);
108
- yield (0, import_utils.removeStorageKey)(import_constant.__FEDERATION_DEVTOOLS__, "overrides");
109
- yield (0, import_utils.injectScript)(import_utils.reloadPage, false);
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
+ }
110
220
  setCondition(import_constant.statusInfo.noProxy);
111
- setSnapshot(window.__FEDERATION__.originModuleInfo);
112
221
  return;
113
222
  }
114
- const { moduleInfo: moduleInfo2, status, overrides } = handleSnapshot ? yield handleSnapshot(filterFormData) : yield (0, import_utils.getModuleInfo)(filterFormData);
223
+ if (!clipChanged && effectiveSignature === lastEffectiveRulesRef.current) {
224
+ if (hadPreviousEffective) {
225
+ setCondition(import_constant.statusInfo.success);
226
+ } else {
227
+ setCondition(import_constant.statusInfo.noProxy);
228
+ }
229
+ return;
230
+ }
231
+ if (rawRules.every((rule) => !rule.value)) {
232
+ if (hadPreviousEffective) {
233
+ setCondition(import_constant.statusInfo.success);
234
+ } else {
235
+ setCondition(import_constant.statusInfo.noProxy);
236
+ }
237
+ return;
238
+ }
239
+ const { moduleInfo: moduleInfo2, status, overrides } = handleSnapshot ? yield handleSnapshot(effectiveRules) : yield (0, import_utils.getModuleInfo)(effectiveRules);
240
+ if (enableClip) {
241
+ Object.values(moduleInfo2).forEach((val) => {
242
+ if (val.modules) {
243
+ val.modules = [];
244
+ }
245
+ if (val.shared) {
246
+ val.shared = [];
247
+ }
248
+ });
249
+ }
115
250
  const snapshotJson = JSON.stringify(moduleInfo2);
116
251
  yield (0, import_utils.setStorage)(import_sdk.MODULE_DEVTOOL_IDENTIFIER, snapshotJson);
117
252
  yield (0, import_utils.setStorage)(import_constant.BROWSER_ENV_KEY);
118
253
  yield (0, import_utils.mergeStorage)(import_constant.__FEDERATION_DEVTOOLS__, "overrides", overrides);
119
254
  yield (0, import_utils.injectScript)(import_utils.reloadPage, false);
120
255
  window.__FEDERATION__.moduleInfo = moduleInfo2;
121
- setSnapshot(moduleInfo2);
256
+ onModuleInfoChange == null ? void 0 : onModuleInfoChange(moduleInfo2);
122
257
  setCondition(import_constant.statusInfo[status]);
258
+ lastEffectiveRulesRef.current = effectiveSignature;
123
259
  } catch (e) {
124
260
  console.log(e);
125
261
  setCondition(import_constant.statusInfo.error);
@@ -130,28 +266,86 @@ const Layout = (props) => {
130
266
  }
131
267
  );
132
268
  (0, import_react.useEffect)(() => {
133
- setSnapshot(moduleInfo);
134
- }, [moduleInfo]);
135
- (0, import_react.useEffect)(() => {
136
- (0, import_utils.getScope)().then((scope) => __async(void 0, null, function* () {
269
+ ensureFederationContext();
270
+ let cancelled = false;
271
+ const hydrateForm = () => __async(void 0, null, function* () {
137
272
  var _a, _b, _c;
273
+ const scope = yield (0, import_utils.getScope)();
138
274
  const data = yield chrome.storage.sync.get([import_constant.FormID]);
139
275
  const config = (_a = data == null ? void 0 : data[import_constant.FormID]) == null ? void 0 : _a[scope];
140
276
  let storeData;
141
277
  if ((0, import_utils.isObject)(config)) {
142
278
  storeData = JSON.parse(JSON.stringify(config));
143
- storeData[import_constant.proxyFormField] = (_b = storeData[import_constant.proxyFormField]) == null ? void 0 : _b.filter(
144
- (item) => producer.includes(item.key)
145
- );
146
- if (!((_c = storeData[import_constant.proxyFormField]) == null ? void 0 : _c.length)) {
147
- storeData = import_constant.defaultModuleData;
279
+ if (producer.length) {
280
+ storeData[import_constant.proxyFormField] = (_b = storeData[import_constant.proxyFormField]) == null ? void 0 : _b.filter(
281
+ (item) => producer.includes(item.key)
282
+ );
283
+ if (!((_c = storeData[import_constant.proxyFormField]) == null ? void 0 : _c.length)) {
284
+ storeData = JSON.parse(JSON.stringify(import_constant.defaultModuleData));
285
+ }
148
286
  }
149
287
  } else {
150
- storeData = import_constant.defaultModuleData;
288
+ storeData = JSON.parse(JSON.stringify(import_constant.defaultModuleData));
151
289
  }
152
- form.setFieldsValue(storeData);
153
- }));
154
- }, []);
290
+ let overridesApplied = false;
291
+ try {
292
+ const overridesState = yield (0, import_utils.getStorageValue)(import_constant.__FEDERATION_DEVTOOLS__);
293
+ if (typeof overridesState === "string" && overridesState) {
294
+ const parsedState = JSON.parse(overridesState);
295
+ const overrides = parsedState == null ? void 0 : parsedState.overrides;
296
+ if ((0, import_utils.isObject)(overrides)) {
297
+ const overrideRules = Object.entries(overrides).map(([key, value]) => ({
298
+ key,
299
+ value: typeof value === "string" ? value : "",
300
+ checked: true
301
+ })).filter(
302
+ (rule) => Boolean(rule.key) && Boolean(rule.value)
303
+ );
304
+ const filteredRules = producer.length ? overrideRules.filter((rule) => producer.includes(rule.key)) : overrideRules;
305
+ if (filteredRules.length) {
306
+ storeData = __spreadProps(__spreadValues({}, storeData), {
307
+ [import_constant.proxyFormField]: filteredRules
308
+ });
309
+ overridesApplied = true;
310
+ }
311
+ }
312
+ }
313
+ } catch (error) {
314
+ console.warn(
315
+ "[MF Devtools] hydrate overrides from localStorage failed",
316
+ error
317
+ );
318
+ }
319
+ if (!cancelled) {
320
+ form.setFieldsValue(storeData);
321
+ lastFormSignatureRef.current = JSON.stringify(storeData);
322
+ const rules = Array.isArray(
323
+ storeData[import_constant.proxyFormField]
324
+ ) ? storeData[import_constant.proxyFormField] : [];
325
+ const effectiveRules = collectEffectiveRules(rules, []);
326
+ lastEffectiveRulesRef.current = getEffectiveSignature(effectiveRules);
327
+ lastRawRulesRef.current = JSON.parse(JSON.stringify(rules));
328
+ setFormStatus(
329
+ rules.map((rule) => ({
330
+ keyStatus: Boolean(rule == null ? void 0 : rule.key),
331
+ valueStatus: Boolean(rule == null ? void 0 : rule.value)
332
+ }))
333
+ );
334
+ if (overridesApplied) {
335
+ (0, import_utils.setChromeStorage)(storeData);
336
+ }
337
+ if (effectiveRules.length) {
338
+ setCondition(import_constant.statusInfo.success);
339
+ } else {
340
+ setCondition(import_constant.statusInfo.noProxy);
341
+ }
342
+ }
343
+ });
344
+ hydrateForm();
345
+ return () => {
346
+ cancelled = true;
347
+ };
348
+ }, [moduleInfo, producerKey, form]);
155
349
  (0, import_react.useEffect)(() => {
156
350
  chrome.storage.sync.get([import_constant.ENABLEHMR]).then((data) => {
157
351
  const enable = data[import_constant.ENABLEHMR];
@@ -164,9 +358,25 @@ const Layout = (props) => {
164
358
  validateForm(form);
165
359
  }, []);
166
360
  (0, import_ahooks.useUpdateEffect)(() => {
361
+ if (!producer.length) {
362
+ return;
363
+ }
167
364
  const formData = form.getFieldsValue();
365
+ const signature = JSON.stringify(formData);
366
+ if (signature === lastFormSignatureRef.current) {
367
+ return;
368
+ }
369
+ lastFormSignatureRef.current = signature;
370
+ const effectiveRules = collectEffectiveRules(
371
+ formData[import_constant.proxyFormField] || [],
372
+ formStatus
373
+ );
374
+ const effectiveSignature = getEffectiveSignature(effectiveRules);
375
+ if (effectiveSignature === lastEffectiveRulesRef.current) {
376
+ return;
377
+ }
168
378
  run(formData);
169
- }, []);
379
+ }, [producerKey, formStatus]);
170
380
  const validateForm = (form2) => {
171
381
  setTimeout(() => {
172
382
  form2.validate().catch(() => {
@@ -176,6 +386,11 @@ const Layout = (props) => {
176
386
  };
177
387
  const onValuesChange = (target, formData) => {
178
388
  validateForm(form);
389
+ const signature = JSON.stringify(formData);
390
+ if (signature === lastFormSignatureRef.current) {
391
+ return;
392
+ }
393
+ lastFormSignatureRef.current = signature;
179
394
  (0, import_utils.setChromeStorage)(formData);
180
395
  run(formData);
181
396
  };
@@ -192,8 +407,39 @@ const Layout = (props) => {
192
407
  }
193
408
  (0, import_utils.injectScript)(import_utils.reloadPage, false);
194
409
  };
195
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
196
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
410
+ const onClipChange = (on) => {
411
+ setEnableClip(on);
412
+ try {
413
+ if (tabId) {
414
+ localStorage.setItem(`${import_constant.ENABLE_CLIP}_${tabId}`, String(on));
415
+ }
416
+ } catch (e) {
417
+ console.error(e);
418
+ }
419
+ run(form.getFieldsValue());
420
+ };
421
+ const remotePreview = producer.map((id) => {
422
+ const [, name] = id.split(":");
423
+ return name || id;
424
+ }).filter(Boolean);
425
+ const previewList = remotePreview.slice(0, 4);
426
+ const extraCount = remotePreview.length > previewList.length ? remotePreview.length - previewList.length : 0;
427
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.wrapper, children: [
428
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.summaryCard, children: [
429
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.summaryHeader, children: [
430
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.summaryTitle, children: "Remotes in scope" }),
431
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.summaryHint, children: "Override manifests to verify integration without redeploying." })
432
+ ] }),
433
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.chipGroup, children: [
434
+ 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" }),
435
+ extraCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: import_index.default.moreChip, children: [
436
+ "+",
437
+ extraCount,
438
+ " more"
439
+ ] })
440
+ ] })
441
+ ] }),
442
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", { className: import_index.default.formSection, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
197
443
  import_web_react.Form,
198
444
  {
199
445
  form,
@@ -209,6 +455,8 @@ const Layout = (props) => {
209
455
  validateForm: () => validateForm(form),
210
456
  enableHMR,
211
457
  onHMRChange,
458
+ enableClip,
459
+ onClipChange,
212
460
  versionList,
213
461
  setVersionList,
214
462
  getVersion,
@@ -217,8 +465,7 @@ const Layout = (props) => {
217
465
  }
218
466
  )
219
467
  }
220
- ),
221
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Graph.default, { snapshot })
468
+ ) })
222
469
  ] });
223
470
  };
224
471
  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 = { "select": "select_084ab", "card": "card_084ab", "appName": "appName_084ab", "tagContainer": "tagContainer_084ab", "tag": "tag_084ab", "header": "header_084ab", "add": "add_084ab", "title": "title_084ab", "status": "status_084ab", "switch": "switch_084ab", "badge": "badge_084ab" };
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
- .select_084ab {
2
- margin-top: 1vh;
1
+ .wrapper_084ab {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 24px;
5
+ flex: 1 1;
3
6
  }
4
7
 
5
- .card_084ab {
8
+ .summaryCard_084ab {
9
+ padding: 18px 20px;
10
+ border: 1px solid rgba(228, 228, 231, 0.5);
6
11
  display: flex;
7
- height: 4vh;
8
- align-items: center;
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
- .tagContainer_084ab {
17
+ .summaryHeader_084ab {
15
18
  display: flex;
16
- align-items: center;
17
- margin-bottom: 1vh;
18
- color: rgb(78, 89, 105);
19
+ flex-direction: column;
20
+ gap: 6px;
19
21
  }
20
- .tagContainer_084ab .tag_084ab {
21
- margin-left: 1vw;
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
- .header_084ab {
34
+ .chipGroup_084ab {
25
35
  display: flex;
26
36
  align-items: center;
27
- margin: 1vh 0;
28
- }
29
- .header_084ab .add_084ab {
30
- margin: 0 0.5vw;
37
+ flex-wrap: wrap;
38
+ gap: 8px;
31
39
  }
32
- .header_084ab .title_084ab {
33
- margin: 0 0.5vw;
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
- .header_084ab .status_084ab {
36
- display: flex;
37
- flex: 1 1;
38
- justify-content: flex-end;
39
- align-items: center;
52
+
53
+ .chipPlaceholder_084ab {
54
+ border-style: dashed;
55
+ color: #4b5563;
56
+ background: rgba(255, 255, 255, 0.9);
40
57
  }
41
- .header_084ab .status_084ab .switch_084ab {
42
- margin-left: 0.5vw;
58
+
59
+ .moreChip_084ab {
60
+ background: rgba(243, 244, 246, 0.4);
61
+ border-color: rgba(228, 228, 231, 0.5);
43
62
  }
44
- .header_084ab .badge_084ab {
45
- display: flex;
46
- transform: scale(1.6);
47
- margin: 0 0.6vw;
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
  }