@module-federation/devtools 0.0.0-chore-bump-node-22-20260710161714

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 (164) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/dist/es/App.css +13 -0
  4. package/dist/es/App.js +498 -0
  5. package/dist/es/App.module.js +5 -0
  6. package/dist/es/App_module.css +307 -0
  7. package/dist/es/component/DependencyGraph/index.js +204 -0
  8. package/dist/es/component/DependencyGraph/index.module.js +5 -0
  9. package/dist/es/component/DependencyGraph/index_module.css +100 -0
  10. package/dist/es/component/DependencyGraphItem/index.js +95 -0
  11. package/dist/es/component/DependencyGraphItem/index.module.js +5 -0
  12. package/dist/es/component/DependencyGraphItem/index_module.css +95 -0
  13. package/dist/es/component/Form/index.js +363 -0
  14. package/dist/es/component/Form/index.module.js +5 -0
  15. package/dist/es/component/Form/index_module.css +198 -0
  16. package/dist/es/component/LanguageSwitch.js +50 -0
  17. package/dist/es/component/Layout/index.js +470 -0
  18. package/dist/es/component/Layout/index.module.js +5 -0
  19. package/dist/es/component/Layout/index_module.css +68 -0
  20. package/dist/es/component/LoadingTrace/index.js +944 -0
  21. package/dist/es/component/LoadingTrace/index.module.js +5 -0
  22. package/dist/es/component/LoadingTrace/index_module.css +876 -0
  23. package/dist/es/component/ModuleInfo/index.js +313 -0
  24. package/dist/es/component/ModuleInfo/index.module.js +5 -0
  25. package/dist/es/component/ModuleInfo/index_module.css +184 -0
  26. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.js +35 -0
  27. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.module.js +5 -0
  28. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
  29. package/dist/es/component/SharedDepsExplorer/index.js +636 -0
  30. package/dist/es/component/SharedDepsExplorer/index.module.js +5 -0
  31. package/dist/es/component/SharedDepsExplorer/index_module.css +467 -0
  32. package/dist/es/component/SharedDepsExplorer/share-utils.js +222 -0
  33. package/dist/es/component/ThemeToggle.js +19 -0
  34. package/dist/es/component/ThemeToggle.module.js +5 -0
  35. package/dist/es/component/ThemeToggle_module.css +12 -0
  36. package/dist/es/hooks/useDevtoolsTheme.js +77 -0
  37. package/dist/es/i18n/index.js +688 -0
  38. package/dist/es/init.js +8 -0
  39. package/dist/es/template/constant.js +51 -0
  40. package/dist/es/template/index.js +1 -0
  41. package/dist/es/utils/chrome/fast-refresh.js +342 -0
  42. package/dist/es/utils/chrome/index.js +284 -0
  43. package/dist/es/utils/chrome/messages.js +12 -0
  44. package/dist/es/utils/chrome/observability-plugin.js +93 -0
  45. package/dist/es/utils/chrome/observability-shared.js +99 -0
  46. package/dist/es/utils/chrome/observability.js +208 -0
  47. package/dist/es/utils/chrome/override-remote.js +2 -0
  48. package/dist/es/utils/chrome/post-message-init.js +5 -0
  49. package/dist/es/utils/chrome/post-message-listener.js +39 -0
  50. package/dist/es/utils/chrome/post-message-start.js +10 -0
  51. package/dist/es/utils/chrome/post-message.js +71 -0
  52. package/dist/es/utils/chrome/safe-post-message.js +124 -0
  53. package/dist/es/utils/chrome/snapshot-plugin.js +2 -0
  54. package/dist/es/utils/chrome/storage.js +50 -0
  55. package/dist/es/utils/data/index.js +59 -0
  56. package/dist/es/utils/index.js +4 -0
  57. package/dist/es/utils/sdk/graph.js +190 -0
  58. package/dist/es/utils/sdk/index.js +70 -0
  59. package/dist/es/utils/types/common.js +0 -0
  60. package/dist/es/utils/types/index.js +1 -0
  61. package/dist/es/vendor/basic-proxy-core.js +155 -0
  62. package/dist/es/worker/index.js +187 -0
  63. package/dist/lib/App.css +13 -0
  64. package/dist/lib/App.js +519 -0
  65. package/dist/lib/App.module.js +24 -0
  66. package/dist/lib/App_module.css +307 -0
  67. package/dist/lib/component/DependencyGraph/index.js +225 -0
  68. package/dist/lib/component/DependencyGraph/index.module.js +24 -0
  69. package/dist/lib/component/DependencyGraph/index_module.css +100 -0
  70. package/dist/lib/component/DependencyGraphItem/index.js +124 -0
  71. package/dist/lib/component/DependencyGraphItem/index.module.js +24 -0
  72. package/dist/lib/component/DependencyGraphItem/index_module.css +95 -0
  73. package/dist/lib/component/Form/index.js +372 -0
  74. package/dist/lib/component/Form/index.module.js +24 -0
  75. package/dist/lib/component/Form/index_module.css +198 -0
  76. package/dist/lib/component/LanguageSwitch.js +79 -0
  77. package/dist/lib/component/Layout/index.js +471 -0
  78. package/dist/lib/component/Layout/index.module.js +24 -0
  79. package/dist/lib/component/Layout/index_module.css +68 -0
  80. package/dist/lib/component/LoadingTrace/index.js +953 -0
  81. package/dist/lib/component/LoadingTrace/index.module.js +24 -0
  82. package/dist/lib/component/LoadingTrace/index_module.css +876 -0
  83. package/dist/lib/component/ModuleInfo/index.js +342 -0
  84. package/dist/lib/component/ModuleInfo/index.module.js +24 -0
  85. package/dist/lib/component/ModuleInfo/index_module.css +184 -0
  86. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.js +64 -0
  87. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.module.js +24 -0
  88. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
  89. package/dist/lib/component/SharedDepsExplorer/index.js +638 -0
  90. package/dist/lib/component/SharedDepsExplorer/index.module.js +24 -0
  91. package/dist/lib/component/SharedDepsExplorer/index_module.css +467 -0
  92. package/dist/lib/component/SharedDepsExplorer/share-utils.js +252 -0
  93. package/dist/lib/component/ThemeToggle.js +48 -0
  94. package/dist/lib/component/ThemeToggle.module.js +24 -0
  95. package/dist/lib/component/ThemeToggle_module.css +12 -0
  96. package/dist/lib/hooks/useDevtoolsTheme.js +100 -0
  97. package/dist/lib/i18n/index.js +721 -0
  98. package/dist/lib/init.js +8 -0
  99. package/dist/lib/template/constant.js +84 -0
  100. package/dist/lib/template/index.js +21 -0
  101. package/dist/lib/utils/chrome/fast-refresh.js +329 -0
  102. package/dist/lib/utils/chrome/index.js +321 -0
  103. package/dist/lib/utils/chrome/messages.js +39 -0
  104. package/dist/lib/utils/chrome/observability-plugin.js +85 -0
  105. package/dist/lib/utils/chrome/observability-shared.js +125 -0
  106. package/dist/lib/utils/chrome/observability.js +233 -0
  107. package/dist/lib/utils/chrome/override-remote.js +17 -0
  108. package/dist/lib/utils/chrome/post-message-init.js +5 -0
  109. package/dist/lib/utils/chrome/post-message-listener.js +36 -0
  110. package/dist/lib/utils/chrome/post-message-start.js +10 -0
  111. package/dist/lib/utils/chrome/post-message.js +91 -0
  112. package/dist/lib/utils/chrome/safe-post-message.js +147 -0
  113. package/dist/lib/utils/chrome/snapshot-plugin.js +17 -0
  114. package/dist/lib/utils/chrome/storage.js +71 -0
  115. package/dist/lib/utils/data/index.js +83 -0
  116. package/dist/lib/utils/index.js +27 -0
  117. package/dist/lib/utils/sdk/graph.js +213 -0
  118. package/dist/lib/utils/sdk/index.js +104 -0
  119. package/dist/lib/utils/types/common.js +15 -0
  120. package/dist/lib/utils/types/index.js +21 -0
  121. package/dist/lib/vendor/basic-proxy-core.js +147 -0
  122. package/dist/lib/worker/index.js +175 -0
  123. package/dist/types/src/App.d.ts +7 -0
  124. package/dist/types/src/component/DependencyGraph/index.d.ts +6 -0
  125. package/dist/types/src/component/DependencyGraphItem/index.d.ts +9 -0
  126. package/dist/types/src/component/Form/index.d.ts +21 -0
  127. package/dist/types/src/component/LanguageSwitch.d.ts +2 -0
  128. package/dist/types/src/component/Layout/index.d.ts +15 -0
  129. package/dist/types/src/component/LoadingTrace/index.d.ts +6 -0
  130. package/dist/types/src/component/ModuleInfo/index.d.ts +8 -0
  131. package/dist/types/src/component/SharedDepsExplorer/FocusResultDisplay.d.ts +15 -0
  132. package/dist/types/src/component/SharedDepsExplorer/index.d.ts +6 -0
  133. package/dist/types/src/component/SharedDepsExplorer/share-utils.d.ts +45 -0
  134. package/dist/types/src/component/ThemeToggle.d.ts +8 -0
  135. package/dist/types/src/hooks/useDevtoolsTheme.d.ts +2 -0
  136. package/dist/types/src/i18n/index.d.ts +5 -0
  137. package/dist/types/src/index.d.ts +1 -0
  138. package/dist/types/src/init.d.ts +12 -0
  139. package/dist/types/src/template/constant.d.ts +21 -0
  140. package/dist/types/src/template/index.d.ts +1 -0
  141. package/dist/types/src/utils/chrome/fast-refresh.d.ts +1 -0
  142. package/dist/types/src/utils/chrome/index.d.ts +19 -0
  143. package/dist/types/src/utils/chrome/messages.d.ts +5 -0
  144. package/dist/types/src/utils/chrome/observability-plugin.d.ts +1 -0
  145. package/dist/types/src/utils/chrome/observability-shared.d.ts +41 -0
  146. package/dist/types/src/utils/chrome/observability.d.ts +110 -0
  147. package/dist/types/src/utils/chrome/override-remote.d.ts +1 -0
  148. package/dist/types/src/utils/chrome/post-message-init.d.ts +1 -0
  149. package/dist/types/src/utils/chrome/post-message-listener.d.ts +1 -0
  150. package/dist/types/src/utils/chrome/post-message-start.d.ts +1 -0
  151. package/dist/types/src/utils/chrome/post-message.d.ts +1 -0
  152. package/dist/types/src/utils/chrome/safe-post-message.d.ts +1 -0
  153. package/dist/types/src/utils/chrome/snapshot-plugin.d.ts +1 -0
  154. package/dist/types/src/utils/chrome/storage.d.ts +5 -0
  155. package/dist/types/src/utils/data/index.d.ts +10 -0
  156. package/dist/types/src/utils/index.d.ts +4 -0
  157. package/dist/types/src/utils/sdk/graph.d.ts +46 -0
  158. package/dist/types/src/utils/sdk/index.d.ts +11 -0
  159. package/dist/types/src/utils/types/common.d.ts +22 -0
  160. package/dist/types/src/utils/types/index.d.ts +1 -0
  161. package/dist/types/src/worker/index.d.ts +1 -0
  162. package/dist/types/stories/index.stories.d.ts +9 -0
  163. package/install-deps.bash +23 -0
  164. package/package.json +108 -0
@@ -0,0 +1,471 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __export = (target, all) => {
25
+ for (var name in all)
26
+ __defProp(target, name, { get: all[name], enumerable: true });
27
+ };
28
+ var __copyProps = (to, from, except, desc) => {
29
+ if (from && typeof from === "object" || typeof from === "function") {
30
+ for (let key of __getOwnPropNames(from))
31
+ if (!__hasOwnProp.call(to, key) && key !== except)
32
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
33
+ }
34
+ return to;
35
+ };
36
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
37
+ // If the importer is in node compatibility mode or this is not an ESM
38
+ // file that has been converted to a CommonJS file using a Babel-
39
+ // compatible transform (i.e. "__esModule" has not been set), then set
40
+ // "default" to the CommonJS "module.exports" for node compatibility.
41
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
42
+ mod
43
+ ));
44
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
45
+ var __async = (__this, __arguments, generator) => {
46
+ return new Promise((resolve, reject) => {
47
+ var fulfilled = (value) => {
48
+ try {
49
+ step(generator.next(value));
50
+ } catch (e) {
51
+ reject(e);
52
+ }
53
+ };
54
+ var rejected = (value) => {
55
+ try {
56
+ step(generator.throw(value));
57
+ } catch (e) {
58
+ reject(e);
59
+ }
60
+ };
61
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
62
+ step((generator = generator.apply(__this, __arguments)).next());
63
+ });
64
+ };
65
+ var Layout_exports = {};
66
+ __export(Layout_exports, {
67
+ default: () => Layout_default
68
+ });
69
+ module.exports = __toCommonJS(Layout_exports);
70
+ var import_jsx_runtime = require("react/jsx-runtime");
71
+ var import_react = require("react");
72
+ var import_ahooks = require("ahooks");
73
+ var import_web_react = require("@arco-design/web-react");
74
+ var import_react_i18next = require("react-i18next");
75
+ var import_sdk = require("@module-federation/sdk");
76
+ var import_Form = __toESM(require("../Form"));
77
+ var import_utils = require("../../utils");
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)) : "";
92
+ const Layout = (props) => {
93
+ const {
94
+ moduleInfo,
95
+ handleSnapshot,
96
+ versionList,
97
+ setVersionList,
98
+ getVersion,
99
+ handleProxyAddress,
100
+ customValueValidate,
101
+ headerSlot,
102
+ onModuleInfoChange,
103
+ onModuleInfoReset,
104
+ tabId
105
+ } = props;
106
+ const { t } = (0, import_react_i18next.useTranslation)();
107
+ const { producer } = (0, import_utils.separateType)(moduleInfo);
108
+ const producerKey = (0, import_react.useMemo)(() => producer.join("|"), [producer]);
109
+ const [condition, setCondition] = (0, import_react.useState)(import_constant.statusInfo.processing);
110
+ const [formStatus, setFormStatus] = (0, import_react.useState)([]);
111
+ const [form] = import_web_react.Form.useForm();
112
+ const [enableHMR, setEnalbeHMR] = (0, import_react.useState)("disable");
113
+ const [enableClip, setEnableClip] = (0, import_react.useState)(() => {
114
+ try {
115
+ if (tabId) {
116
+ return localStorage.getItem(`${import_constant.ENABLE_CLIP}_${tabId}`) === "true";
117
+ }
118
+ return false;
119
+ } catch (e) {
120
+ return false;
121
+ }
122
+ });
123
+ const lastFormSignatureRef = (0, import_react.useRef)("");
124
+ const lastEffectiveRulesRef = (0, import_react.useRef)("");
125
+ const lastRawRulesRef = (0, import_react.useRef)([]);
126
+ const lastEnableClipRef = (0, import_react.useRef)(enableClip);
127
+ const ensureFederationContext = () => {
128
+ if (!window.__FEDERATION__) {
129
+ window.__FEDERATION__ = {
130
+ __GLOBAL_PLUGIN__: [],
131
+ __INSTANCES__: [],
132
+ __SHARE__: {},
133
+ __MANIFEST_LOADING__: {},
134
+ __PRELOADED_MAP__: /* @__PURE__ */ new Map(),
135
+ originModuleInfo: moduleInfo || {},
136
+ moduleInfo: moduleInfo || {}
137
+ };
138
+ }
139
+ if (!window.__FEDERATION__.originModuleInfo) {
140
+ window.__FEDERATION__.originModuleInfo = moduleInfo || {};
141
+ }
142
+ if (!window.__FEDERATION__.moduleInfo) {
143
+ window.__FEDERATION__.moduleInfo = moduleInfo || {};
144
+ }
145
+ };
146
+ (0, import_react.useEffect)(() => {
147
+ ensureFederationContext();
148
+ window.__FEDERATION__.moduleInfo = JSON.parse(
149
+ JSON.stringify(moduleInfo || {})
150
+ );
151
+ window.__FEDERATION__.originModuleInfo = JSON.parse(
152
+ JSON.stringify(moduleInfo || {})
153
+ );
154
+ const rawRules = form.getFieldValue(import_constant.proxyFormField) || [];
155
+ lastRawRulesRef.current = JSON.parse(JSON.stringify(rawRules));
156
+ }, [moduleInfo, form]);
157
+ const collectEffectiveRules = (rules, statusList) => {
158
+ return rules.reduce((memo, current, idx) => {
159
+ if (!(current == null ? void 0 : current.checked)) {
160
+ return memo;
161
+ }
162
+ const status = statusList[idx];
163
+ const keyValid = status ? status.keyStatus : Boolean(current.key);
164
+ const valueValid = status ? status.valueStatus : Boolean(current.value);
165
+ if (!keyValid || !valueValid) {
166
+ return memo;
167
+ }
168
+ const duplicate = JSON.parse(JSON.stringify(current));
169
+ if (handleProxyAddress) {
170
+ duplicate.value = handleProxyAddress(duplicate.value);
171
+ }
172
+ memo.push(duplicate);
173
+ return memo;
174
+ }, []);
175
+ };
176
+ const hasPendingRule = (rules, statusList) => {
177
+ return rules.some((rule, idx) => {
178
+ if (!(rule == null ? void 0 : rule.checked)) {
179
+ return false;
180
+ }
181
+ const status = statusList[idx];
182
+ if (!status) {
183
+ return Boolean(rule.key) && !rule.value;
184
+ }
185
+ return Boolean(status.keyStatus) && !status.valueStatus;
186
+ });
187
+ };
188
+ const { run } = (0, import_ahooks.useDebounceFn)(
189
+ (formData) => __async(void 0, null, function* () {
190
+ ensureFederationContext();
191
+ window.__FEDERATION__.moduleInfo = JSON.parse(
192
+ JSON.stringify(window.__FEDERATION__.originModuleInfo)
193
+ );
194
+ const rawRules = formData[import_constant.proxyFormField] || [];
195
+ const rawSignature = JSON.stringify(rawRules);
196
+ if (rawSignature === lastFormSignatureRef.current) {
197
+ return;
198
+ }
199
+ const effectiveRules = collectEffectiveRules(rawRules, formStatus);
200
+ const effectiveSignature = getEffectiveSignature(effectiveRules);
201
+ const pendingRule = hasPendingRule(rawRules, formStatus);
202
+ const hadPreviousEffective = lastEffectiveRulesRef.current !== "" && lastEffectiveRulesRef.current !== "[]";
203
+ const clipChanged = enableClip !== lastEnableClipRef.current;
204
+ lastEnableClipRef.current = enableClip;
205
+ try {
206
+ setCondition(import_constant.statusInfo.processing);
207
+ if (!effectiveRules.length) {
208
+ if (pendingRule) {
209
+ return;
210
+ }
211
+ if (hadPreviousEffective) {
212
+ yield (0, import_utils.removeStorage)(import_sdk.MODULE_DEVTOOL_IDENTIFIER);
213
+ yield (0, import_utils.removeStorage)(import_constant.BROWSER_ENV_KEY);
214
+ yield (0, import_utils.removeStorageKey)(import_constant.__FEDERATION_DEVTOOLS__, "overrides");
215
+ yield (0, import_utils.injectScript)(import_utils.reloadPage, false);
216
+ setCondition(import_constant.statusInfo.noProxy);
217
+ lastEffectiveRulesRef.current = "";
218
+ if (typeof onModuleInfoReset === "function") {
219
+ onModuleInfoReset();
220
+ } else {
221
+ onModuleInfoChange == null ? void 0 : onModuleInfoChange(window.__FEDERATION__.originModuleInfo);
222
+ }
223
+ } else {
224
+ setCondition(import_constant.statusInfo.noProxy);
225
+ }
226
+ setCondition(import_constant.statusInfo.noProxy);
227
+ return;
228
+ }
229
+ if (!clipChanged && effectiveSignature === lastEffectiveRulesRef.current) {
230
+ if (hadPreviousEffective) {
231
+ setCondition(import_constant.statusInfo.success);
232
+ } else {
233
+ setCondition(import_constant.statusInfo.noProxy);
234
+ }
235
+ return;
236
+ }
237
+ if (rawRules.every((rule) => !rule.value)) {
238
+ if (hadPreviousEffective) {
239
+ setCondition(import_constant.statusInfo.success);
240
+ } else {
241
+ setCondition(import_constant.statusInfo.noProxy);
242
+ }
243
+ return;
244
+ }
245
+ const { moduleInfo: moduleInfo2, status, overrides } = handleSnapshot ? yield handleSnapshot(effectiveRules) : yield (0, import_utils.getModuleInfo)(effectiveRules);
246
+ if (enableClip) {
247
+ Object.values(moduleInfo2).forEach((val) => {
248
+ if (val.modules) {
249
+ val.modules = [];
250
+ }
251
+ if (val.shared) {
252
+ val.shared = [];
253
+ }
254
+ });
255
+ }
256
+ const snapshotJson = JSON.stringify(moduleInfo2);
257
+ yield (0, import_utils.setStorage)(import_sdk.MODULE_DEVTOOL_IDENTIFIER, snapshotJson);
258
+ yield (0, import_utils.setStorage)(import_constant.BROWSER_ENV_KEY);
259
+ yield (0, import_utils.mergeStorage)(import_constant.__FEDERATION_DEVTOOLS__, "overrides", overrides);
260
+ yield (0, import_utils.injectScript)(import_utils.reloadPage, false);
261
+ window.__FEDERATION__.moduleInfo = moduleInfo2;
262
+ onModuleInfoChange == null ? void 0 : onModuleInfoChange(moduleInfo2);
263
+ setCondition(import_constant.statusInfo[status]);
264
+ lastEffectiveRulesRef.current = effectiveSignature;
265
+ } catch (e) {
266
+ console.log(e);
267
+ setCondition(import_constant.statusInfo.error);
268
+ }
269
+ }),
270
+ {
271
+ wait: 700
272
+ }
273
+ );
274
+ (0, import_react.useEffect)(() => {
275
+ ensureFederationContext();
276
+ let cancelled = false;
277
+ const hydrateForm = () => __async(void 0, null, function* () {
278
+ var _a, _b, _c;
279
+ const scope = yield (0, import_utils.getScope)();
280
+ const data = yield chrome.storage.sync.get([import_constant.FormID]);
281
+ const config = (_a = data == null ? void 0 : data[import_constant.FormID]) == null ? void 0 : _a[scope];
282
+ let storeData;
283
+ if ((0, import_utils.isObject)(config)) {
284
+ storeData = JSON.parse(JSON.stringify(config));
285
+ if (producer.length) {
286
+ storeData[import_constant.proxyFormField] = (_b = storeData[import_constant.proxyFormField]) == null ? void 0 : _b.filter(
287
+ (item) => producer.includes(item.key)
288
+ );
289
+ if (!((_c = storeData[import_constant.proxyFormField]) == null ? void 0 : _c.length)) {
290
+ storeData = JSON.parse(JSON.stringify(import_constant.defaultModuleData));
291
+ }
292
+ }
293
+ } else {
294
+ storeData = JSON.parse(JSON.stringify(import_constant.defaultModuleData));
295
+ }
296
+ let overridesApplied = false;
297
+ try {
298
+ const overridesState = yield (0, import_utils.getStorageValue)(import_constant.__FEDERATION_DEVTOOLS__);
299
+ if (typeof overridesState === "string" && overridesState) {
300
+ const parsedState = JSON.parse(overridesState);
301
+ const overrides = parsedState == null ? void 0 : parsedState.overrides;
302
+ if ((0, import_utils.isObject)(overrides)) {
303
+ const overrideRules = Object.entries(overrides).map(([key, value]) => ({
304
+ key,
305
+ value: typeof value === "string" ? value : "",
306
+ checked: true
307
+ })).filter(
308
+ (rule) => Boolean(rule.key) && Boolean(rule.value)
309
+ );
310
+ const filteredRules = producer.length ? overrideRules.filter((rule) => producer.includes(rule.key)) : overrideRules;
311
+ if (filteredRules.length) {
312
+ storeData = __spreadProps(__spreadValues({}, storeData), {
313
+ [import_constant.proxyFormField]: filteredRules
314
+ });
315
+ overridesApplied = true;
316
+ }
317
+ }
318
+ }
319
+ } catch (error) {
320
+ console.warn(
321
+ "[MF Devtools] hydrate overrides from localStorage failed",
322
+ error
323
+ );
324
+ }
325
+ if (!cancelled) {
326
+ form.setFieldsValue(storeData);
327
+ lastFormSignatureRef.current = JSON.stringify(storeData);
328
+ const rules = Array.isArray(
329
+ storeData[import_constant.proxyFormField]
330
+ ) ? storeData[import_constant.proxyFormField] : [];
331
+ const effectiveRules = collectEffectiveRules(rules, []);
332
+ lastEffectiveRulesRef.current = getEffectiveSignature(effectiveRules);
333
+ lastRawRulesRef.current = JSON.parse(JSON.stringify(rules));
334
+ setFormStatus(
335
+ rules.map((rule) => ({
336
+ keyStatus: Boolean(rule == null ? void 0 : rule.key),
337
+ valueStatus: Boolean(rule == null ? void 0 : rule.value)
338
+ }))
339
+ );
340
+ if (overridesApplied) {
341
+ (0, import_utils.setChromeStorage)(storeData);
342
+ }
343
+ if (effectiveRules.length) {
344
+ setCondition(import_constant.statusInfo.success);
345
+ } else {
346
+ setCondition(import_constant.statusInfo.noProxy);
347
+ }
348
+ }
349
+ });
350
+ hydrateForm();
351
+ return () => {
352
+ cancelled = true;
353
+ };
354
+ }, [moduleInfo, producerKey, form]);
355
+ (0, import_react.useEffect)(() => {
356
+ chrome.storage.sync.get([import_constant.ENABLEHMR]).then((data) => {
357
+ const enable = data[import_constant.ENABLEHMR];
358
+ if (typeof enable === "boolean") {
359
+ onHMRChange(enable);
360
+ }
361
+ });
362
+ }, []);
363
+ (0, import_react.useEffect)(() => {
364
+ validateForm(form);
365
+ }, []);
366
+ (0, import_ahooks.useUpdateEffect)(() => {
367
+ if (!producer.length) {
368
+ return;
369
+ }
370
+ const formData = form.getFieldsValue();
371
+ const signature = JSON.stringify(formData);
372
+ if (signature === lastFormSignatureRef.current) {
373
+ return;
374
+ }
375
+ lastFormSignatureRef.current = signature;
376
+ const effectiveRules = collectEffectiveRules(
377
+ formData[import_constant.proxyFormField] || [],
378
+ formStatus
379
+ );
380
+ const effectiveSignature = getEffectiveSignature(effectiveRules);
381
+ if (effectiveSignature === lastEffectiveRulesRef.current) {
382
+ return;
383
+ }
384
+ run(formData);
385
+ }, [producerKey, formStatus]);
386
+ const validateForm = (form2) => {
387
+ setTimeout(() => {
388
+ form2.validate().catch(() => {
389
+ console.log("Invalid proxy rules");
390
+ });
391
+ }, 50);
392
+ };
393
+ const onValuesChange = (target, formData) => {
394
+ validateForm(form);
395
+ const signature = JSON.stringify(formData);
396
+ if (signature === lastFormSignatureRef.current) {
397
+ return;
398
+ }
399
+ lastFormSignatureRef.current = signature;
400
+ (0, import_utils.setChromeStorage)(formData);
401
+ run(formData);
402
+ };
403
+ const onHMRChange = (on) => {
404
+ setEnalbeHMR(on ? "enable" : "disable");
405
+ chrome.storage.sync.set({
406
+ [import_constant.ENABLEHMR]: on
407
+ });
408
+ if (on) {
409
+ (0, import_utils.mergeStorage)(import_constant.__FEDERATION_DEVTOOLS__, import_constant.__ENABLE_FAST_REFRESH__, on);
410
+ } else {
411
+ (0, import_utils.removeStorageKey)(import_constant.__FEDERATION_DEVTOOLS__, import_constant.__ENABLE_FAST_REFRESH__);
412
+ (0, import_utils.removeStorageKey)(import_constant.__FEDERATION_DEVTOOLS__, import_constant.__EAGER_SHARE__);
413
+ }
414
+ (0, import_utils.injectScript)(import_utils.reloadPage, false);
415
+ };
416
+ const onClipChange = (on) => {
417
+ setEnableClip(on);
418
+ try {
419
+ if (tabId) {
420
+ localStorage.setItem(`${import_constant.ENABLE_CLIP}_${tabId}`, String(on));
421
+ }
422
+ } catch (e) {
423
+ console.error(e);
424
+ }
425
+ run(form.getFieldsValue());
426
+ };
427
+ const remotePreview = producer.map((id) => {
428
+ const [, name] = id.split(":");
429
+ return name || id;
430
+ }).filter(Boolean);
431
+ const previewList = remotePreview.slice(0, 4);
432
+ const extraCount = remotePreview.length > previewList.length ? remotePreview.length - previewList.length : 0;
433
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.wrapper, children: [
434
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.summaryCard, children: [
435
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.summaryHeader, children: [
436
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.summaryTitle, children: t("layout.summary.title") }),
437
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.summaryHint, children: t("layout.summary.hint") })
438
+ ] }),
439
+ 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: t("layout.summary.placeholder") }),
440
+ extraCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.moreChip, children: t("layout.summary.more", { count: extraCount }) })
441
+ ] }),
442
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", { className: import_index.default.formSection, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
443
+ import_web_react.Form,
444
+ {
445
+ form,
446
+ onValuesChange: (value, formData) => onValuesChange(value, formData),
447
+ initialValues: import_constant.defaultModuleData,
448
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
449
+ import_Form.default,
450
+ {
451
+ form,
452
+ condition,
453
+ formStatus,
454
+ setFormStatus,
455
+ validateForm: () => validateForm(form),
456
+ enableHMR,
457
+ onHMRChange,
458
+ enableClip,
459
+ onClipChange,
460
+ versionList,
461
+ setVersionList,
462
+ getVersion,
463
+ customValueValidate,
464
+ headerSlot
465
+ }
466
+ )
467
+ }
468
+ ) })
469
+ ] });
470
+ };
471
+ var Layout_default = Layout;
@@ -0,0 +1,24 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var index_module_exports = {};
19
+ __export(index_module_exports, {
20
+ default: () => index_module_default
21
+ });
22
+ module.exports = __toCommonJS(index_module_exports);
23
+ var import_index_module = require("./index_module.css");
24
+ 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" };
@@ -0,0 +1,68 @@
1
+ .wrapper_084ab {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 24px;
5
+ flex: 1 1;
6
+ }
7
+
8
+ .summaryCard_084ab {
9
+ padding: 18px 20px;
10
+ border: 1px solid rgba(228, 228, 231, 0.5);
11
+ display: flex;
12
+ flex-direction: column;
13
+ gap: 16px;
14
+ min-height: 110px;
15
+ }
16
+
17
+ .summaryHeader_084ab {
18
+ display: flex;
19
+ flex-direction: column;
20
+ gap: 6px;
21
+ }
22
+
23
+ .summaryTitle_084ab {
24
+ font-size: 16px;
25
+ font-weight: 600;
26
+ color: var(--color-text-1, #1f2937);
27
+ }
28
+
29
+ .summaryHint_084ab {
30
+ font-size: 12px;
31
+ color: var(--color-text-2, #4b5563);
32
+ }
33
+
34
+ .chipGroup_084ab {
35
+ display: flex;
36
+ align-items: center;
37
+ flex-wrap: wrap;
38
+ gap: 8px;
39
+ }
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: var(--color-bg-1, rgba(255, 255, 255, 0.9));
48
+ font-size: 12px;
49
+ color: var(--color-text-1, #1f2937);
50
+ letter-spacing: 0.02em;
51
+ }
52
+
53
+ .chipPlaceholder_084ab {
54
+ border-style: dashed;
55
+ color: var(--color-text-2, #4b5563);
56
+ background: var(--color-bg-1, rgba(255, 255, 255, 0.9));
57
+ }
58
+
59
+ .moreChip_084ab {
60
+ background: rgba(243, 244, 246, 0.4);
61
+ border-color: rgba(228, 228, 231, 0.5);
62
+ }
63
+
64
+ .formSection_084ab {
65
+ padding: 22px 24px;
66
+ border: 1px solid rgba(228, 228, 231, 0.5);
67
+ background: var(--color-bg-1, rgba(255, 255, 255, 0.9));
68
+ }