@module-federation/devtools 0.22.0 → 0.23.0

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 (116) hide show
  1. package/dist/es/App.css +13 -0
  2. package/dist/es/App.js +461 -21
  3. package/dist/es/App.module.js +1 -1
  4. package/dist/es/App_module.css +293 -5
  5. package/dist/es/component/DependencyGraph/index.js +204 -0
  6. package/dist/es/component/DependencyGraph/index.module.js +5 -0
  7. package/dist/es/component/DependencyGraph/index_module.css +100 -0
  8. package/dist/es/component/{GraphItem → DependencyGraphItem}/index.js +20 -9
  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 +192 -117
  12. package/dist/es/component/Form/index.module.js +1 -1
  13. package/dist/es/component/Form/index_module.css +176 -25
  14. package/dist/es/component/LanguageSwitch.js +50 -0
  15. package/dist/es/component/Layout/index.js +296 -49
  16. package/dist/es/component/Layout/index.module.js +1 -1
  17. package/dist/es/component/Layout/index_module.css +52 -32
  18. package/dist/es/component/ModuleInfo/index.js +313 -0
  19. package/dist/es/component/ModuleInfo/index.module.js +5 -0
  20. package/dist/es/component/ModuleInfo/index_module.css +184 -0
  21. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.js +35 -0
  22. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.module.js +5 -0
  23. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
  24. package/dist/es/component/SharedDepsExplorer/index.js +495 -0
  25. package/dist/es/component/SharedDepsExplorer/index.module.js +5 -0
  26. package/dist/es/component/SharedDepsExplorer/index_module.css +467 -0
  27. package/dist/es/component/SharedDepsExplorer/share-utils.js +206 -0
  28. package/dist/es/component/ThemeToggle.js +19 -0
  29. package/dist/es/component/ThemeToggle.module.js +5 -0
  30. package/dist/es/component/ThemeToggle_module.css +12 -0
  31. package/dist/es/hooks/useDevtoolsTheme.js +77 -0
  32. package/dist/es/i18n/index.js +506 -0
  33. package/dist/es/template/constant.js +3 -19
  34. package/dist/es/utils/chrome/index.js +91 -38
  35. package/dist/es/utils/chrome/messages.js +6 -0
  36. package/dist/es/utils/chrome/override-remote.js +42 -0
  37. package/dist/es/utils/chrome/post-message-listener.js +2 -1
  38. package/dist/es/utils/chrome/post-message-start.js +10 -2
  39. package/dist/es/utils/chrome/storage.js +6 -1
  40. package/dist/es/utils/sdk/graph.js +25 -4
  41. package/dist/es/utils/sdk/index.js +9 -0
  42. package/dist/es/worker/index.js +168 -1
  43. package/dist/lib/App.css +13 -0
  44. package/dist/lib/App.js +451 -18
  45. package/dist/lib/App.module.js +1 -1
  46. package/dist/lib/App_module.css +293 -5
  47. package/dist/lib/component/DependencyGraph/index.js +226 -0
  48. package/dist/lib/component/{GraphItem → DependencyGraph}/index.module.js +1 -1
  49. package/dist/lib/component/DependencyGraph/index_module.css +100 -0
  50. package/dist/lib/component/{GraphItem → DependencyGraphItem}/index.js +23 -12
  51. package/dist/lib/component/{Graph → DependencyGraphItem}/index.module.js +1 -1
  52. package/dist/lib/component/DependencyGraphItem/index_module.css +95 -0
  53. package/dist/lib/component/Form/index.js +189 -115
  54. package/dist/lib/component/Form/index.module.js +1 -1
  55. package/dist/lib/component/Form/index_module.css +176 -25
  56. package/dist/lib/component/LanguageSwitch.js +80 -0
  57. package/dist/lib/component/Layout/index.js +290 -47
  58. package/dist/lib/component/Layout/index.module.js +1 -1
  59. package/dist/lib/component/Layout/index_module.css +52 -32
  60. package/dist/lib/component/ModuleInfo/index.js +343 -0
  61. package/dist/lib/component/ModuleInfo/index.module.js +25 -0
  62. package/dist/lib/component/ModuleInfo/index_module.css +184 -0
  63. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.js +65 -0
  64. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.module.js +25 -0
  65. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
  66. package/dist/lib/component/SharedDepsExplorer/index.js +502 -0
  67. package/dist/lib/component/SharedDepsExplorer/index.module.js +25 -0
  68. package/dist/lib/component/SharedDepsExplorer/index_module.css +467 -0
  69. package/dist/lib/component/SharedDepsExplorer/share-utils.js +237 -0
  70. package/dist/lib/component/ThemeToggle.js +49 -0
  71. package/dist/lib/component/ThemeToggle.module.js +25 -0
  72. package/dist/lib/component/ThemeToggle_module.css +12 -0
  73. package/dist/lib/hooks/useDevtoolsTheme.js +101 -0
  74. package/dist/lib/i18n/index.js +540 -0
  75. package/dist/lib/template/constant.js +4 -17
  76. package/dist/lib/utils/chrome/index.js +94 -38
  77. package/dist/lib/utils/chrome/messages.js +31 -0
  78. package/dist/lib/utils/chrome/override-remote.js +65 -0
  79. package/dist/lib/utils/chrome/post-message-listener.js +2 -1
  80. package/dist/lib/utils/chrome/post-message-start.js +10 -2
  81. package/dist/lib/utils/chrome/storage.js +5 -0
  82. package/dist/lib/utils/sdk/graph.js +25 -4
  83. package/dist/lib/utils/sdk/index.js +10 -0
  84. package/dist/lib/worker/index.js +156 -1
  85. package/dist/types/src/App.d.ts +2 -1
  86. package/dist/types/src/component/{Graph → DependencyGraph}/index.d.ts +0 -1
  87. package/dist/types/src/component/{GraphItem → DependencyGraphItem}/index.d.ts +0 -1
  88. package/dist/types/src/component/Form/index.d.ts +2 -0
  89. package/dist/types/src/component/LanguageSwitch.d.ts +2 -0
  90. package/dist/types/src/component/Layout/index.d.ts +0 -1
  91. package/dist/types/src/component/ModuleInfo/index.d.ts +8 -0
  92. package/dist/types/src/component/SharedDepsExplorer/FocusResultDisplay.d.ts +15 -0
  93. package/dist/types/src/component/SharedDepsExplorer/index.d.ts +6 -0
  94. package/dist/types/src/component/SharedDepsExplorer/share-utils.d.ts +44 -0
  95. package/dist/types/src/component/ThemeToggle.d.ts +8 -0
  96. package/dist/types/src/hooks/useDevtoolsTheme.d.ts +2 -0
  97. package/dist/types/src/i18n/index.d.ts +5 -0
  98. package/dist/types/src/init.d.ts +0 -1
  99. package/dist/types/src/template/constant.d.ts +2 -5
  100. package/dist/types/src/utils/chrome/index.d.ts +5 -3
  101. package/dist/types/src/utils/chrome/messages.d.ts +2 -0
  102. package/dist/types/src/utils/chrome/override-remote.d.ts +1 -0
  103. package/dist/types/src/utils/chrome/storage.d.ts +5 -4
  104. package/dist/types/src/utils/sdk/graph.d.ts +2 -1
  105. package/dist/types/src/utils/sdk/index.d.ts +1 -0
  106. package/dist/types/src/utils/types/common.d.ts +4 -0
  107. package/dist/types/src/worker/index.d.ts +1 -0
  108. package/package.json +18 -14
  109. package/dist/es/component/Graph/index.js +0 -127
  110. package/dist/es/component/Graph/index.module.js +0 -5
  111. package/dist/es/component/Graph/index_module.css +0 -12
  112. package/dist/es/component/GraphItem/index.module.js +0 -5
  113. package/dist/es/component/GraphItem/index_module.css +0 -61
  114. package/dist/lib/component/Graph/index.js +0 -149
  115. package/dist/lib/component/Graph/index_module.css +0 -12
  116. package/dist/lib/component/GraphItem/index_module.css +0 -61
package/dist/lib/App.js CHANGED
@@ -3,8 +3,22 @@ var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
8
22
  var __export = (target, all) => {
9
23
  for (var name in all)
10
24
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -26,6 +40,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
40
  mod
27
41
  ));
28
42
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
43
+ var __async = (__this, __arguments, generator) => {
44
+ return new Promise((resolve, reject) => {
45
+ var fulfilled = (value) => {
46
+ try {
47
+ step(generator.next(value));
48
+ } catch (e) {
49
+ reject(e);
50
+ }
51
+ };
52
+ var rejected = (value) => {
53
+ try {
54
+ step(generator.throw(value));
55
+ } catch (e) {
56
+ reject(e);
57
+ }
58
+ };
59
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
60
+ step((generator = generator.apply(__this, __arguments)).next());
61
+ });
62
+ };
29
63
  var App_exports = {};
30
64
  __export(App_exports, {
31
65
  default: () => App_default
@@ -33,15 +67,88 @@ __export(App_exports, {
33
67
  module.exports = __toCommonJS(App_exports);
34
68
  var import_jsx_runtime = require("react/jsx-runtime");
35
69
  var import_react = require("react");
70
+ var import_react_19_adapter = require("@arco-design/web-react/es/_util/react-19-adapter");
71
+ var import_App = require("./App.css");
36
72
  var import_web_react = require("@arco-design/web-react");
73
+ var import_react_i18next = require("react-i18next");
37
74
  var import_init = require("./init");
75
+ var import_icon = require("@arco-design/web-react/icon");
38
76
  var import_Layout = __toESM(require("./component/Layout"));
77
+ var import_DependencyGraph = __toESM(require("./component/DependencyGraph"));
78
+ var import_ModuleInfo = __toESM(require("./component/ModuleInfo"));
79
+ var import_SharedDepsExplorer = __toESM(require("./component/SharedDepsExplorer"));
80
+ var import_LanguageSwitch = __toESM(require("./component/LanguageSwitch"));
81
+ var import_ThemeToggle = __toESM(require("./component/ThemeToggle"));
39
82
  var import_utils = require("./utils");
83
+ var import_messages = require("./utils/chrome/messages");
84
+ var import_useDevtoolsTheme = require("./hooks/useDevtoolsTheme");
85
+ var import_i18n = __toESM(require("./i18n"));
40
86
  var import_arco = require("@arco-design/web-react/dist/css/arco.css");
41
- var import_App = __toESM(require("./App.module"));
42
- const { Content } = import_web_react.Layout;
43
- const App = (props) => {
44
- var _a;
87
+ var import_App2 = __toESM(require("./App.module"));
88
+ var import_ThemeToggle2 = __toESM(require("./component/ThemeToggle.module"));
89
+ const cloneModuleInfo = (info) => {
90
+ try {
91
+ return JSON.parse(JSON.stringify(info || {}));
92
+ } catch (error) {
93
+ console.warn("[MF Devtools] cloneModuleInfo failed", error);
94
+ return info || {};
95
+ }
96
+ };
97
+ const normalizeShareValue = (target, seen = /* @__PURE__ */ new WeakSet()) => {
98
+ if (typeof target === "function") {
99
+ const name = target.name ? `: ${target.name}` : "";
100
+ return `[Function${name}]`;
101
+ }
102
+ if (!target || typeof target !== "object") {
103
+ return target;
104
+ }
105
+ if (seen.has(target)) {
106
+ return "[Circular]";
107
+ }
108
+ seen.add(target);
109
+ if (target instanceof Map) {
110
+ const mapped = {};
111
+ target.forEach((value, key) => {
112
+ mapped[String(key)] = normalizeShareValue(value, seen);
113
+ });
114
+ return mapped;
115
+ }
116
+ if (target instanceof Set) {
117
+ const setItems = [];
118
+ target.forEach((value) => {
119
+ setItems.push(normalizeShareValue(value, seen));
120
+ });
121
+ return setItems;
122
+ }
123
+ if (Array.isArray(target)) {
124
+ return target.map((item) => normalizeShareValue(item, seen));
125
+ }
126
+ return Object.keys(target).reduce((memo, key) => {
127
+ memo[key] = normalizeShareValue(target[key], seen);
128
+ return memo;
129
+ }, {});
130
+ };
131
+ const buildShareSnapshot = (share) => {
132
+ const normalize = (value) => {
133
+ try {
134
+ return normalizeShareValue(value);
135
+ } catch (error) {
136
+ console.warn("[MF Devtools] normalize share snapshot failed", error);
137
+ return normalizeShareValue(value);
138
+ }
139
+ };
140
+ const scopes = normalize(share || {});
141
+ return scopes;
142
+ };
143
+ const NAV_ITEMS = [
144
+ { key: "moduleInfo", i18nKey: "app.nav.moduleInfo" },
145
+ { key: "proxy", i18nKey: "app.nav.proxy" },
146
+ { key: "dependency", i18nKey: "app.nav.dependency" },
147
+ { key: "share", i18nKey: "app.nav.share" },
148
+ { key: "performance", i18nKey: "app.nav.performance" }
149
+ ];
150
+ const THEME_STORAGE_KEY = "mf-devtools-theme";
151
+ const InnerApp = (props) => {
45
152
  const {
46
153
  versionList,
47
154
  setVersionList,
@@ -51,22 +158,348 @@ const App = (props) => {
51
158
  customValueValidate,
52
159
  headerSlot
53
160
  } = props;
54
- const [module2, setModule] = (0, import_react.useState)(((_a = window.__FEDERATION__) == null ? void 0 : _a.moduleInfo) || {});
161
+ const autoTheme = (0, import_useDevtoolsTheme.useDevtoolsTheme)();
162
+ const [userTheme, setUserTheme] = (0, import_react.useState)(null);
163
+ const effectiveTheme = userTheme != null ? userTheme : autoTheme;
164
+ const { t } = (0, import_react_i18next.useTranslation)();
165
+ const [moduleInfo, setModuleInfo] = (0, import_react.useState)(
166
+ () => {
167
+ var _a;
168
+ return cloneModuleInfo(((_a = window.__FEDERATION__) == null ? void 0 : _a.moduleInfo) || {});
169
+ }
170
+ );
171
+ const [shareInfo, setShareInfo] = (0, import_react.useState)(
172
+ () => {
173
+ var _a;
174
+ return buildShareSnapshot((_a = window.__FEDERATION__) == null ? void 0 : _a.__SHARE__);
175
+ }
176
+ );
177
+ const [inspectedTab, setInspectedTab] = (0, import_react.useState)(
178
+ window.targetTab
179
+ );
180
+ const [activePanel, setActivePanel] = (0, import_react.useState)("proxy");
181
+ const [selectedModuleId, setSelectedModuleId] = (0, import_react.useState)(null);
182
+ const [refreshing, setRefreshing] = (0, import_react.useState)(false);
183
+ const panelSyncReadyRef = (0, import_react.useRef)(false);
184
+ const applyModuleUpdate = (0, import_react.useCallback)((info) => {
185
+ var _a;
186
+ setModuleInfo(cloneModuleInfo(info));
187
+ const shareSnapshot = buildShareSnapshot(
188
+ (_a = window.__FEDERATION__) == null ? void 0 : _a.__SHARE__
189
+ );
190
+ setShareInfo(shareSnapshot);
191
+ panelSyncReadyRef.current = true;
192
+ }, []);
193
+ const { producer, consumers } = (0, import_react.useMemo)(
194
+ () => (0, import_utils.separateType)(moduleInfo),
195
+ [moduleInfo]
196
+ );
197
+ const moduleKeys = (0, import_react.useMemo)(() => Object.keys(moduleInfo || {}), [moduleInfo]);
198
+ const moduleCount = moduleKeys.length;
199
+ const consumerCount = (0, import_react.useMemo)(
200
+ () => Object.keys(consumers || {}).length,
201
+ [consumers]
202
+ );
203
+ const hasModule = moduleCount > 0 || process.env.NODE_ENV === "development";
55
204
  (0, import_react.useEffect)(() => {
56
- (0, import_utils.getGlobalModuleInfo)(setModule);
205
+ var _a;
206
+ if (typeof window === "undefined") {
207
+ return;
208
+ }
209
+ let cancelled = false;
210
+ const applyTheme = (value) => {
211
+ if (cancelled) {
212
+ return;
213
+ }
214
+ if (value === "light" || value === "dark") {
215
+ setUserTheme(value);
216
+ }
217
+ };
218
+ try {
219
+ const stored = window.localStorage.getItem(THEME_STORAGE_KEY);
220
+ if (stored === "light" || stored === "dark") {
221
+ applyTheme(stored);
222
+ return;
223
+ }
224
+ } catch (error) {
225
+ console.warn("[MF Devtools] read theme from localStorage failed", error);
226
+ }
227
+ try {
228
+ const chromeObj = window.chrome;
229
+ const storage = (_a = chromeObj == null ? void 0 : chromeObj.storage) == null ? void 0 : _a.sync;
230
+ if (storage && typeof storage.get === "function") {
231
+ storage.get([THEME_STORAGE_KEY], (result) => {
232
+ applyTheme(result == null ? void 0 : result[THEME_STORAGE_KEY]);
233
+ });
234
+ }
235
+ } catch (error) {
236
+ console.warn(
237
+ "[MF Devtools] read theme from chrome.storage.sync failed",
238
+ error
239
+ );
240
+ }
241
+ return () => {
242
+ cancelled = true;
243
+ };
57
244
  }, []);
58
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Layout, { className: import_App.default.layout, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, { className: import_App.default.content, children: Object.keys(module2).length > 0 || process.env.NODE_ENV === "development" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
59
- import_Layout.default,
245
+ (0, import_react.useEffect)(() => {
246
+ if (typeof document === "undefined") {
247
+ return;
248
+ }
249
+ const { body } = document;
250
+ if (!body) {
251
+ return;
252
+ }
253
+ if (effectiveTheme === "dark") {
254
+ body.setAttribute("arco-theme", "dark");
255
+ } else {
256
+ body.removeAttribute("arco-theme");
257
+ }
258
+ return () => {
259
+ body.removeAttribute("arco-theme");
260
+ };
261
+ }, [effectiveTheme]);
262
+ (0, import_react.useEffect)(() => {
263
+ if (!moduleKeys.length) {
264
+ setSelectedModuleId(null);
265
+ return;
266
+ }
267
+ if (!selectedModuleId || !moduleKeys.includes(selectedModuleId)) {
268
+ setSelectedModuleId(moduleKeys[0]);
269
+ }
270
+ }, [moduleKeys, selectedModuleId]);
271
+ (0, import_react.useEffect)(() => {
272
+ const bootstrap = () => __async(void 0, null, function* () {
273
+ const tab = yield (0, import_utils.syncActiveTab)();
274
+ setInspectedTab(tab || void 0);
275
+ const detach = yield (0, import_utils.getGlobalModuleInfo)(
276
+ (info) => applyModuleUpdate(info)
277
+ );
278
+ panelSyncReadyRef.current = true;
279
+ return detach;
280
+ });
281
+ const cleanupPromise = bootstrap();
282
+ return () => {
283
+ cleanupPromise.then((cleanup) => cleanup == null ? void 0 : cleanup());
284
+ };
285
+ }, [applyModuleUpdate]);
286
+ (0, import_react.useEffect)(() => {
287
+ const updateActiveTab = (tabId) => __async(void 0, null, function* () {
288
+ var _a, _b;
289
+ const tab = yield (0, import_utils.syncActiveTab)(tabId);
290
+ setInspectedTab(tab || void 0);
291
+ if ((_a = window.__FEDERATION__) == null ? void 0 : _a.moduleInfo) {
292
+ applyModuleUpdate(cloneModuleInfo((_b = window.__FEDERATION__) == null ? void 0 : _b.moduleInfo));
293
+ }
294
+ yield (0, import_utils.refreshModuleInfo)();
295
+ });
296
+ const onMessage = (message, _sender, _sendResponse) => {
297
+ if ((message == null ? void 0 : message.type) === import_messages.MESSAGE_ACTIVE_TAB_CHANGED) {
298
+ updateActiveTab(message.tabId);
299
+ }
300
+ };
301
+ chrome.runtime.onMessage.addListener(onMessage);
302
+ const onActivated = (activeInfo) => {
303
+ updateActiveTab(activeInfo.tabId);
304
+ };
305
+ chrome.tabs.onActivated.addListener(onActivated);
306
+ return () => {
307
+ chrome.runtime.onMessage.removeListener(onMessage);
308
+ chrome.tabs.onActivated.removeListener(onActivated);
309
+ };
310
+ }, [applyModuleUpdate]);
311
+ const handleRefresh = () => __async(void 0, null, function* () {
312
+ var _a, _b;
313
+ if (refreshing) {
314
+ return;
315
+ }
316
+ setRefreshing(true);
317
+ try {
318
+ yield (0, import_utils.refreshModuleInfo)();
319
+ if ((_a = window.__FEDERATION__) == null ? void 0 : _a.moduleInfo) {
320
+ applyModuleUpdate(cloneModuleInfo((_b = window.__FEDERATION__) == null ? void 0 : _b.moduleInfo));
321
+ }
322
+ } finally {
323
+ setRefreshing(false);
324
+ }
325
+ });
326
+ const handleThemeToggle = () => {
327
+ var _a;
328
+ const current = effectiveTheme;
329
+ const next = current === "dark" ? "light" : "dark";
330
+ setUserTheme(next);
331
+ if (typeof window !== "undefined") {
332
+ try {
333
+ window.localStorage.setItem(THEME_STORAGE_KEY, next);
334
+ } catch (error) {
335
+ console.warn(
336
+ "[MF Devtools] persist theme to localStorage failed",
337
+ error
338
+ );
339
+ }
340
+ try {
341
+ const chromeObj = window.chrome;
342
+ const storage = (_a = chromeObj == null ? void 0 : chromeObj.storage) == null ? void 0 : _a.sync;
343
+ if (storage && typeof storage.set === "function") {
344
+ storage.set({ [THEME_STORAGE_KEY]: next });
345
+ }
346
+ } catch (error) {
347
+ console.warn(
348
+ "[MF Devtools] persist theme to chrome.storage.sync failed",
349
+ error
350
+ );
351
+ }
352
+ }
353
+ };
354
+ const resetModuleInfo = (0, import_react.useCallback)(() => {
355
+ var _a;
356
+ const origin = ((_a = window.__FEDERATION__) == null ? void 0 : _a.originModuleInfo) || {};
357
+ applyModuleUpdate(cloneModuleInfo(origin));
358
+ }, [applyModuleUpdate]);
359
+ (0, import_react.useEffect)(() => {
360
+ const shouldAutoSync = activePanel === "proxy" || activePanel === "dependency" || activePanel === "share";
361
+ if (!shouldAutoSync || !panelSyncReadyRef.current) {
362
+ return;
363
+ }
364
+ let cancelled = false;
365
+ const syncPanelData = () => __async(void 0, null, function* () {
366
+ var _a, _b;
367
+ yield (0, import_utils.refreshModuleInfo)();
368
+ if (cancelled) {
369
+ return;
370
+ }
371
+ if ((_a = window.__FEDERATION__) == null ? void 0 : _a.moduleInfo) {
372
+ applyModuleUpdate(cloneModuleInfo((_b = window.__FEDERATION__) == null ? void 0 : _b.moduleInfo));
373
+ }
374
+ });
375
+ void syncPanelData();
376
+ return () => {
377
+ cancelled = true;
378
+ };
379
+ }, [activePanel, applyModuleUpdate]);
380
+ const renderContent = () => {
381
+ var _a;
382
+ switch (activePanel) {
383
+ case "moduleInfo":
384
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
385
+ import_ModuleInfo.default,
386
+ {
387
+ moduleInfo,
388
+ selectedModuleId,
389
+ onSelectModule: (id) => setSelectedModuleId(id)
390
+ }
391
+ );
392
+ case "proxy":
393
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
394
+ import_Layout.default,
395
+ {
396
+ moduleInfo,
397
+ versionList,
398
+ setVersionList,
399
+ getVersion,
400
+ handleSnapshot,
401
+ handleProxyAddress,
402
+ customValueValidate,
403
+ headerSlot,
404
+ onModuleInfoChange: applyModuleUpdate,
405
+ onModuleInfoReset: resetModuleInfo,
406
+ tabId: inspectedTab == null ? void 0 : inspectedTab.id
407
+ }
408
+ );
409
+ case "dependency":
410
+ return hasModule ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DependencyGraph.default, { snapshot: moduleInfo }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_App2.default.emptyState, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
411
+ import_web_react.Empty,
412
+ {
413
+ description: t("common.empty.noModuleInfo"),
414
+ className: import_App2.default.empty
415
+ }
416
+ ) });
417
+ case "share":
418
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
419
+ import_SharedDepsExplorer.default,
420
+ {
421
+ shareData: JSON.parse(
422
+ JSON.stringify((_a = window.__FEDERATION__) == null ? void 0 : _a.__SHARE__)
423
+ )
424
+ }
425
+ );
426
+ case "performance":
427
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_App2.default.placeholder, children: t("app.performance.placeholder") });
428
+ default:
429
+ return null;
430
+ }
431
+ };
432
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
433
+ "div",
60
434
  {
61
- moduleInfo: module2,
62
- versionList,
63
- setVersionList,
64
- getVersion,
65
- handleSnapshot,
66
- handleProxyAddress,
67
- customValueValidate,
68
- headerSlot
69
- }
70
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Empty, { description: "No ModuleInfo Detected" }) }) }) });
435
+ className: `${import_App2.default.shell} ${import_App2.default.overrideArco} ${effectiveTheme === "dark" ? "arco-theme-dark" : ""}`,
436
+ children: [
437
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("aside", { className: import_App2.default.sidebar, children: NAV_ITEMS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
438
+ "button",
439
+ {
440
+ type: "button",
441
+ className: `${import_App2.default.tabItem} ${activePanel === item.key ? import_App2.default.activeTab : ""}`,
442
+ onClick: () => setActivePanel(item.key),
443
+ children: t(item.i18nKey)
444
+ },
445
+ item.key
446
+ )) }),
447
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: import_App2.default.panel, children: [
448
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { className: import_App2.default.header, children: [
449
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_App2.default.headerTop, children: [
450
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_App2.default.branding, children: [
451
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_App2.default.logo, children: t("app.header.title") }),
452
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_App2.default.subtitle, children: t("app.header.subtitle") })
453
+ ] }),
454
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_App2.default.headerActions, children: [
455
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LanguageSwitch.default, {}),
456
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
457
+ import_ThemeToggle.default,
458
+ {
459
+ theme: effectiveTheme,
460
+ onToggle: handleThemeToggle
461
+ }
462
+ ),
463
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Tooltip, { content: t("app.header.refresh.tooltip"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
464
+ import_web_react.Button,
465
+ {
466
+ size: "default",
467
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconRefresh, {}),
468
+ loading: refreshing,
469
+ onClick: handleRefresh,
470
+ className: import_ThemeToggle2.default.themeToggle
471
+ }
472
+ ) })
473
+ ] })
474
+ ] }),
475
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_App2.default.meta, children: [
476
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_App2.default.scope, children: [
477
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_App2.default.scopeLabel, children: t("app.header.scope.label") }),
478
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Tag, { className: "common-tag", children: (inspectedTab == null ? void 0 : inspectedTab.title) || t("app.header.scope.waiting") })
479
+ ] }),
480
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_App2.default.stats, children: [
481
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_App2.default.statBlock, children: [
482
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_App2.default.statValue, children: moduleCount }),
483
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_App2.default.statLabel, children: t("app.header.stats.modules") })
484
+ ] }),
485
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_App2.default.statBlock, children: [
486
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_App2.default.statValue, children: producer.length }),
487
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_App2.default.statLabel, children: t("app.header.stats.remotes") })
488
+ ] }),
489
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_App2.default.statBlock, children: [
490
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_App2.default.statValue, children: consumerCount }),
491
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_App2.default.statLabel, children: t("app.header.stats.consumers") })
492
+ ] })
493
+ ] })
494
+ ] })
495
+ ] }),
496
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_App2.default.body, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_App2.default.content, children: renderContent() }) })
497
+ ] })
498
+ ]
499
+ }
500
+ );
501
+ };
502
+ const App = (props) => {
503
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_i18next.I18nextProvider, { i18n: import_i18n.default, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InnerApp, __spreadValues({}, props)) });
71
504
  };
72
505
  var App_default = App;
@@ -22,4 +22,4 @@ __export(App_module_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(App_module_exports);
24
24
  var import_App_module = require("./App_module.css");
25
- var App_module_default = { "layout": "layout_ae2ee", "content": "content_ae2ee" };
25
+ var App_module_default = { "shell": "shell_ae2ee", "sidebar": "sidebar_ae2ee", "tabItem": "tabItem_ae2ee", "activeTab": "activeTab_ae2ee", "panel": "panel_ae2ee", "header": "header_ae2ee", "headerTop": "headerTop_ae2ee", "branding": "branding_ae2ee", "logo": "logo_ae2ee", "subtitle": "subtitle_ae2ee", "meta": "meta_ae2ee", "scope": "scope_ae2ee", "scopeLabel": "scopeLabel_ae2ee", "stats": "stats_ae2ee", "statBlock": "statBlock_ae2ee", "statValue": "statValue_ae2ee", "statLabel": "statLabel_ae2ee", "body": "body_ae2ee", "content": "content_ae2ee", "emptyState": "emptyState_ae2ee", "empty": "empty_ae2ee", "placeholder": "placeholder_ae2ee", "overrideArco": "overrideArco_ae2ee" };