@module-federation/devtools 0.0.0-perf-devtools-20260107043700 → 0.0.0-perf-website-code-usage-20260914033703

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 (203) hide show
  1. package/README.md +3 -0
  2. package/dist/es/App.css +6 -5
  3. package/dist/es/App.js +211 -63
  4. package/dist/es/App.module.js +1 -1
  5. package/dist/es/App_module.css +41 -39
  6. package/dist/es/component/DependencyGraph/index.js +11 -12
  7. package/dist/es/component/DependencyGraph/index_module.css +20 -17
  8. package/dist/es/component/DependencyGraphItem/index.js +23 -10
  9. package/dist/es/component/DependencyGraphItem/index_module.css +7 -7
  10. package/dist/es/component/Form/index.js +24 -31
  11. package/dist/es/component/Form/index.module.js +1 -1
  12. package/dist/es/component/Form/index_module.css +22 -25
  13. package/dist/es/component/LanguageSwitch.js +50 -0
  14. package/dist/es/component/Layout/index.js +27 -10
  15. package/dist/es/component/Layout/index_module.css +7 -7
  16. package/dist/es/component/LoadingTrace/index.js +944 -0
  17. package/dist/es/component/LoadingTrace/index.module.js +5 -0
  18. package/dist/es/component/LoadingTrace/index_module.css +876 -0
  19. package/dist/es/component/ModuleInfo/index.js +65 -41
  20. package/dist/es/component/ModuleInfo/index_module.css +12 -11
  21. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.js +5 -3
  22. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay_module.css +5 -5
  23. package/dist/es/component/SharedDepsExplorer/index.js +223 -96
  24. package/dist/es/component/SharedDepsExplorer/index_module.css +12 -2
  25. package/dist/es/component/SharedDepsExplorer/share-utils.js +21 -5
  26. package/dist/es/component/ThemeToggle.js +19 -0
  27. package/dist/es/component/ThemeToggle.module.js +5 -0
  28. package/dist/es/component/ThemeToggle_module.css +12 -0
  29. package/dist/es/hooks/useDevtoolsTheme.js +77 -0
  30. package/dist/es/i18n/index.js +688 -0
  31. package/dist/es/utils/chrome/fast-refresh.js +297 -173
  32. package/dist/es/utils/chrome/index.js +42 -22
  33. package/dist/es/utils/chrome/messages.js +7 -1
  34. package/dist/es/utils/chrome/observability-plugin.js +93 -0
  35. package/dist/es/utils/chrome/observability-shared.js +99 -0
  36. package/dist/es/utils/chrome/observability.js +208 -0
  37. package/dist/es/utils/chrome/override-remote.js +7 -0
  38. package/dist/es/utils/chrome/post-message-listener.js +22 -4
  39. package/dist/es/utils/chrome/post-message-start.js +4 -10
  40. package/dist/es/utils/chrome/post-message.js +12 -3
  41. package/dist/es/utils/chrome/resolve-basic-proxy-core.js +4 -0
  42. package/dist/es/utils/chrome/safe-post-message.js +124 -0
  43. package/dist/es/utils/chrome/snapshot-plugin.js +2 -36
  44. package/dist/es/utils/data/index.js +5 -25
  45. package/dist/es/utils/sdk/graph.js +25 -11
  46. package/dist/es/vendor/basic-proxy-core.js +155 -0
  47. package/dist/es/worker/index.js +27 -8
  48. package/dist/lib/App.css +6 -5
  49. package/dist/lib/App.js +208 -64
  50. package/dist/lib/App.module.js +1 -2
  51. package/dist/lib/App_module.css +41 -39
  52. package/dist/lib/component/DependencyGraph/index.js +11 -13
  53. package/dist/lib/component/DependencyGraph/index.module.js +0 -1
  54. package/dist/lib/component/DependencyGraph/index_module.css +20 -17
  55. package/dist/lib/component/DependencyGraphItem/index.js +23 -11
  56. package/dist/lib/component/DependencyGraphItem/index.module.js +0 -1
  57. package/dist/lib/component/DependencyGraphItem/index_module.css +7 -7
  58. package/dist/lib/component/Form/index.js +24 -32
  59. package/dist/lib/component/Form/index.module.js +1 -2
  60. package/dist/lib/component/Form/index_module.css +22 -25
  61. package/dist/lib/component/LanguageSwitch.js +79 -0
  62. package/dist/lib/component/Layout/index.js +27 -11
  63. package/dist/lib/component/Layout/index.module.js +0 -1
  64. package/dist/lib/component/Layout/index_module.css +7 -7
  65. package/dist/lib/component/LoadingTrace/index.js +953 -0
  66. package/dist/lib/component/LoadingTrace/index.module.js +24 -0
  67. package/dist/lib/component/LoadingTrace/index_module.css +876 -0
  68. package/dist/lib/component/ModuleInfo/index.js +65 -42
  69. package/dist/lib/component/ModuleInfo/index.module.js +0 -1
  70. package/dist/lib/component/ModuleInfo/index_module.css +12 -11
  71. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.js +5 -4
  72. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.module.js +0 -1
  73. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay_module.css +5 -5
  74. package/dist/lib/component/SharedDepsExplorer/index.js +217 -95
  75. package/dist/lib/component/SharedDepsExplorer/index.module.js +0 -1
  76. package/dist/lib/component/SharedDepsExplorer/index_module.css +12 -2
  77. package/dist/lib/component/SharedDepsExplorer/share-utils.js +21 -6
  78. package/dist/lib/component/ThemeToggle.js +48 -0
  79. package/dist/lib/component/ThemeToggle.module.js +24 -0
  80. package/dist/lib/component/ThemeToggle_module.css +12 -0
  81. package/dist/lib/hooks/useDevtoolsTheme.js +100 -0
  82. package/dist/lib/i18n/index.js +721 -0
  83. package/dist/lib/init.js +0 -1
  84. package/dist/lib/template/constant.js +0 -1
  85. package/dist/lib/template/index.js +0 -1
  86. package/dist/lib/utils/chrome/fast-refresh.js +250 -136
  87. package/dist/lib/utils/chrome/index.js +43 -23
  88. package/dist/lib/utils/chrome/messages.js +11 -3
  89. package/dist/lib/utils/chrome/observability-plugin.js +85 -0
  90. package/dist/lib/utils/chrome/observability-shared.js +125 -0
  91. package/dist/lib/utils/chrome/observability.js +233 -0
  92. package/dist/lib/utils/chrome/override-remote.js +20 -0
  93. package/dist/lib/utils/chrome/post-message-init.js +0 -1
  94. package/dist/lib/utils/chrome/post-message-listener.js +19 -5
  95. package/dist/lib/utils/chrome/post-message-start.js +4 -11
  96. package/dist/lib/utils/chrome/post-message.js +12 -4
  97. package/dist/lib/utils/chrome/resolve-basic-proxy-core.js +27 -0
  98. package/dist/lib/utils/chrome/safe-post-message.js +147 -0
  99. package/dist/lib/utils/chrome/snapshot-plugin.js +5 -47
  100. package/dist/lib/utils/chrome/storage.js +0 -1
  101. package/dist/lib/utils/data/index.js +6 -29
  102. package/dist/lib/utils/index.js +0 -1
  103. package/dist/lib/utils/sdk/graph.js +25 -12
  104. package/dist/lib/utils/sdk/index.js +0 -1
  105. package/dist/lib/utils/types/common.js +0 -1
  106. package/dist/lib/utils/types/index.js +0 -1
  107. package/dist/lib/vendor/basic-proxy-core.js +147 -0
  108. package/dist/lib/worker/index.js +27 -9
  109. package/dist/types/App.css +13 -0
  110. package/dist/types/App.js +519 -0
  111. package/dist/types/App.module.js +24 -0
  112. package/dist/types/App_module.css +307 -0
  113. package/dist/types/component/DependencyGraph/index.js +225 -0
  114. package/dist/types/component/DependencyGraph/index.module.js +24 -0
  115. package/dist/types/component/DependencyGraph/index_module.css +100 -0
  116. package/dist/types/component/DependencyGraphItem/index.js +124 -0
  117. package/dist/types/component/DependencyGraphItem/index.module.js +24 -0
  118. package/dist/types/component/DependencyGraphItem/index_module.css +95 -0
  119. package/dist/types/component/Form/index.js +372 -0
  120. package/dist/types/component/Form/index.module.js +24 -0
  121. package/dist/types/component/Form/index_module.css +198 -0
  122. package/dist/types/component/LanguageSwitch.js +79 -0
  123. package/dist/types/component/Layout/index.js +471 -0
  124. package/dist/types/component/Layout/index.module.js +24 -0
  125. package/dist/types/component/Layout/index_module.css +68 -0
  126. package/dist/types/component/LoadingTrace/index.js +953 -0
  127. package/dist/types/component/LoadingTrace/index.module.js +24 -0
  128. package/dist/types/component/LoadingTrace/index_module.css +876 -0
  129. package/dist/types/component/ModuleInfo/index.js +342 -0
  130. package/dist/types/component/ModuleInfo/index.module.js +24 -0
  131. package/dist/types/component/ModuleInfo/index_module.css +184 -0
  132. package/dist/types/component/SharedDepsExplorer/FocusResultDisplay.js +64 -0
  133. package/dist/types/component/SharedDepsExplorer/FocusResultDisplay.module.js +24 -0
  134. package/dist/types/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
  135. package/dist/types/component/SharedDepsExplorer/index.js +635 -0
  136. package/dist/types/component/SharedDepsExplorer/index.module.js +24 -0
  137. package/dist/types/component/SharedDepsExplorer/index_module.css +467 -0
  138. package/dist/types/component/SharedDepsExplorer/share-utils.js +252 -0
  139. package/dist/types/component/ThemeToggle.js +48 -0
  140. package/dist/types/component/ThemeToggle.module.js +24 -0
  141. package/dist/types/component/ThemeToggle_module.css +12 -0
  142. package/dist/types/hooks/useDevtoolsTheme.js +100 -0
  143. package/dist/types/i18n/index.js +721 -0
  144. package/dist/types/init.js +8 -0
  145. package/dist/types/src/App.d.ts +1 -1
  146. package/dist/types/src/component/DependencyGraph/index.d.ts +1 -1
  147. package/dist/types/src/component/DependencyGraphItem/index.d.ts +1 -1
  148. package/dist/types/src/component/Form/index.d.ts +1 -1
  149. package/dist/types/src/component/LanguageSwitch.d.ts +2 -0
  150. package/dist/types/src/component/Layout/index.d.ts +1 -1
  151. package/dist/types/src/component/LoadingTrace/index.d.ts +6 -0
  152. package/dist/types/src/component/ModuleInfo/index.d.ts +1 -1
  153. package/dist/types/src/component/SharedDepsExplorer/index.d.ts +1 -1
  154. package/dist/types/src/component/SharedDepsExplorer/share-utils.d.ts +3 -2
  155. package/dist/types/src/component/ThemeToggle.d.ts +8 -0
  156. package/dist/types/src/hooks/useDevtoolsTheme.d.ts +2 -0
  157. package/dist/types/src/i18n/index.d.ts +5 -0
  158. package/dist/types/src/template/constant.d.ts +1 -1
  159. package/dist/types/src/utils/chrome/index.d.ts +2 -1
  160. package/dist/types/src/utils/chrome/messages.d.ts +3 -0
  161. package/dist/types/src/utils/chrome/observability-plugin.d.ts +1 -0
  162. package/dist/types/src/utils/chrome/observability-shared.d.ts +41 -0
  163. package/dist/types/src/utils/chrome/observability.d.ts +110 -0
  164. package/dist/types/src/utils/chrome/override-remote.d.ts +1 -0
  165. package/dist/types/src/utils/chrome/post-message-listener.d.ts +1 -0
  166. package/dist/types/src/utils/chrome/post-message-start.d.ts +1 -1
  167. package/dist/types/src/utils/chrome/resolve-basic-proxy-core.d.ts +6 -0
  168. package/dist/types/src/utils/chrome/safe-post-message.d.ts +1 -0
  169. package/dist/types/src/utils/chrome/snapshot-plugin.d.ts +0 -3
  170. package/dist/types/src/utils/data/index.d.ts +1 -2
  171. package/dist/types/src/utils/sdk/graph.d.ts +1 -1
  172. package/dist/types/src/utils/sdk/index.d.ts +2 -2
  173. package/dist/types/stories/index.stories.d.ts +2 -1
  174. package/dist/types/template/constant.js +84 -0
  175. package/dist/types/template/index.js +21 -0
  176. package/dist/types/utils/chrome/fast-refresh.js +329 -0
  177. package/dist/types/utils/chrome/index.js +321 -0
  178. package/dist/types/utils/chrome/messages.js +39 -0
  179. package/dist/types/utils/chrome/observability-plugin.js +85 -0
  180. package/dist/types/utils/chrome/observability-shared.js +125 -0
  181. package/dist/types/utils/chrome/observability.js +233 -0
  182. package/dist/types/utils/chrome/override-remote.js +20 -0
  183. package/dist/types/utils/chrome/post-message-init.js +5 -0
  184. package/dist/types/utils/chrome/post-message-listener.js +36 -0
  185. package/dist/types/utils/chrome/post-message-start.js +10 -0
  186. package/dist/types/utils/chrome/post-message.js +91 -0
  187. package/dist/types/utils/chrome/resolve-basic-proxy-core.js +27 -0
  188. package/dist/types/utils/chrome/safe-post-message.js +147 -0
  189. package/dist/types/utils/chrome/snapshot-plugin.js +17 -0
  190. package/dist/types/utils/chrome/storage.js +71 -0
  191. package/dist/types/utils/data/index.js +83 -0
  192. package/dist/types/utils/index.js +27 -0
  193. package/dist/types/utils/sdk/graph.js +213 -0
  194. package/dist/types/utils/sdk/index.js +104 -0
  195. package/dist/types/utils/types/common.js +15 -0
  196. package/dist/types/utils/types/index.js +21 -0
  197. package/dist/types/vendor/basic-proxy-core.js +147 -0
  198. package/dist/types/worker/index.js +175 -0
  199. package/install-deps.bash +7 -3
  200. package/package.json +47 -28
  201. package/dist/es/utils/data/snapshot.js +0 -82
  202. package/dist/lib/utils/data/snapshot.js +0 -107
  203. package/dist/types/src/utils/data/snapshot.d.ts +0 -3
package/README.md CHANGED
@@ -4,5 +4,8 @@
4
4
 
5
5
  - Proxy online Module Federation remote module to local
6
6
  - Let proxied remote module get hmr
7
+ - Inject the Chrome-specific observability runtime plugin from the Loading Trace
8
+ tab, receive page events through `window.postMessage`, and export collected
9
+ loading reports
7
10
 
8
11
  https://module-federation.io/
package/dist/es/App.css CHANGED
@@ -1,12 +1,13 @@
1
1
  .loaded-status-tag {
2
- color: white !important;
3
- background-color: black !important;
2
+ color: var(--color-bg-1, white) !important;
3
+ background-color: var(--color-neutral-10, black) !important;
4
4
  }
5
5
  .reused-status-tag {
6
6
  background-color: greenyellow !important;
7
+ color: black !important;
7
8
  }
8
9
  .common-tag {
9
- color: rgb(113 113 122 / var(--tw-text-opacity)) !important;
10
- background-color: #fff !important;
11
- border-color: rgba(228, 228, 231, 0.5) !important;
10
+ color: var(--color-text-2, #71717a) !important;
11
+ background-color: var(--color-bg-1, #ffffff) !important;
12
+ border-color: var(--color-border-2, rgba(228, 228, 231, 0.5)) !important;
12
13
  }
package/dist/es/App.js CHANGED
@@ -1,3 +1,19 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
1
17
  var __async = (__this, __arguments, generator) => {
2
18
  return new Promise((resolve, reject) => {
3
19
  var fulfilled = (value) => {
@@ -23,26 +39,35 @@ import { useState, useEffect, useMemo, useCallback, useRef } from "react";
23
39
  import "@arco-design/web-react/es/_util/react-19-adapter";
24
40
  import "./App.css";
25
41
  import { Empty, Tag, Button, Tooltip } from "@arco-design/web-react";
42
+ import { I18nextProvider, useTranslation } from "react-i18next";
26
43
  import "./init";
44
+ import { IconRefresh } from "@arco-design/web-react/icon";
27
45
  import ProxyLayout from "./component/Layout";
28
46
  import Dependency from "./component/DependencyGraph";
29
47
  import ModuleInfo from "./component/ModuleInfo";
30
48
  import SharedDepsExplorer from "./component/SharedDepsExplorer";
49
+ import LoadingTrace from "./component/LoadingTrace";
50
+ import LanguageSwitch from "./component/LanguageSwitch";
51
+ import ThemeToggle from "./component/ThemeToggle";
31
52
  import {
32
53
  getGlobalModuleInfo,
54
+ normalizeModuleInfoPayload,
33
55
  refreshModuleInfo,
34
56
  separateType,
35
57
  syncActiveTab
36
58
  } from "./utils";
37
59
  import { MESSAGE_ACTIVE_TAB_CHANGED } from "./utils/chrome/messages";
60
+ import { useDevtoolsTheme } from "./hooks/useDevtoolsTheme";
61
+ import i18n from "./i18n";
38
62
  import "@arco-design/web-react/dist/css/arco.css";
39
63
  import styles from "./App.module";
64
+ import btnStyles from "./component/ThemeToggle.module";
40
65
  const cloneModuleInfo = (info) => {
41
66
  try {
42
- return JSON.parse(JSON.stringify(info || {}));
67
+ return normalizeModuleInfoPayload(info);
43
68
  } catch (error) {
44
69
  console.warn("[MF Devtools] cloneModuleInfo failed", error);
45
- return info || {};
70
+ return {};
46
71
  }
47
72
  };
48
73
  const normalizeShareValue = (target, seen = /* @__PURE__ */ new WeakSet()) => {
@@ -92,13 +117,15 @@ const buildShareSnapshot = (share) => {
92
117
  return scopes;
93
118
  };
94
119
  const NAV_ITEMS = [
95
- { key: "moduleInfo", label: "Module info" },
96
- { key: "proxy", label: "Proxy" },
97
- { key: "dependency", label: "Dependency graph" },
98
- { key: "share", label: "Shared" },
99
- { key: "performance", label: "Performance" }
120
+ { key: "moduleInfo", i18nKey: "app.nav.moduleInfo" },
121
+ { key: "proxy", i18nKey: "app.nav.proxy" },
122
+ { key: "dependency", i18nKey: "app.nav.dependency" },
123
+ { key: "share", i18nKey: "app.nav.share" },
124
+ { key: "loadingTrace", i18nKey: "app.nav.loadingTrace" },
125
+ { key: "performance", i18nKey: "app.nav.performance" }
100
126
  ];
101
- const App = (props) => {
127
+ const THEME_STORAGE_KEY = "mf-devtools-theme";
128
+ const InnerApp = (props) => {
102
129
  const {
103
130
  versionList,
104
131
  setVersionList,
@@ -108,6 +135,10 @@ const App = (props) => {
108
135
  customValueValidate,
109
136
  headerSlot
110
137
  } = props;
138
+ const autoTheme = useDevtoolsTheme();
139
+ const [userTheme, setUserTheme] = useState(null);
140
+ const effectiveTheme = userTheme != null ? userTheme : autoTheme;
141
+ const { t } = useTranslation();
111
142
  const [moduleInfo, setModuleInfo] = useState(
112
143
  () => {
113
144
  var _a;
@@ -123,6 +154,7 @@ const App = (props) => {
123
154
  const [inspectedTab, setInspectedTab] = useState(
124
155
  window.targetTab
125
156
  );
157
+ const [inspectedTabRefreshKey, setInspectedTabRefreshKey] = useState(0);
126
158
  const [activePanel, setActivePanel] = useState("proxy");
127
159
  const [selectedModuleId, setSelectedModuleId] = useState(null);
128
160
  const [refreshing, setRefreshing] = useState(false);
@@ -147,6 +179,64 @@ const App = (props) => {
147
179
  [consumers]
148
180
  );
149
181
  const hasModule = moduleCount > 0 || process.env.NODE_ENV === "development";
182
+ useEffect(() => {
183
+ var _a;
184
+ if (typeof window === "undefined") {
185
+ return;
186
+ }
187
+ let cancelled = false;
188
+ const applyTheme = (value) => {
189
+ if (cancelled) {
190
+ return;
191
+ }
192
+ if (value === "light" || value === "dark") {
193
+ setUserTheme(value);
194
+ }
195
+ };
196
+ try {
197
+ const stored = window.localStorage.getItem(THEME_STORAGE_KEY);
198
+ if (stored === "light" || stored === "dark") {
199
+ applyTheme(stored);
200
+ return;
201
+ }
202
+ } catch (error) {
203
+ console.warn("[MF Devtools] read theme from localStorage failed", error);
204
+ }
205
+ try {
206
+ const chromeObj = window.chrome;
207
+ const storage = (_a = chromeObj == null ? void 0 : chromeObj.storage) == null ? void 0 : _a.sync;
208
+ if (storage && typeof storage.get === "function") {
209
+ storage.get([THEME_STORAGE_KEY], (result) => {
210
+ applyTheme(result == null ? void 0 : result[THEME_STORAGE_KEY]);
211
+ });
212
+ }
213
+ } catch (error) {
214
+ console.warn(
215
+ "[MF Devtools] read theme from chrome.storage.sync failed",
216
+ error
217
+ );
218
+ }
219
+ return () => {
220
+ cancelled = true;
221
+ };
222
+ }, []);
223
+ useEffect(() => {
224
+ if (typeof document === "undefined") {
225
+ return;
226
+ }
227
+ const { body } = document;
228
+ if (!body) {
229
+ return;
230
+ }
231
+ if (effectiveTheme === "dark") {
232
+ body.setAttribute("arco-theme", "dark");
233
+ } else {
234
+ body.removeAttribute("arco-theme");
235
+ }
236
+ return () => {
237
+ body.removeAttribute("arco-theme");
238
+ };
239
+ }, [effectiveTheme]);
150
240
  useEffect(() => {
151
241
  if (!moduleKeys.length) {
152
242
  setSelectedModuleId(null);
@@ -172,10 +262,14 @@ const App = (props) => {
172
262
  };
173
263
  }, [applyModuleUpdate]);
174
264
  useEffect(() => {
175
- const updateActiveTab = (tabId) => __async(void 0, null, function* () {
265
+ const updateActiveTab = (tabId, options) => __async(void 0, null, function* () {
176
266
  var _a, _b;
177
267
  const tab = yield syncActiveTab(tabId);
178
268
  setInspectedTab(tab || void 0);
269
+ if ((options == null ? void 0 : options.status) === "loading") {
270
+ setInspectedTabRefreshKey((key) => key + 1);
271
+ return;
272
+ }
179
273
  if ((_a = window.__FEDERATION__) == null ? void 0 : _a.moduleInfo) {
180
274
  applyModuleUpdate(cloneModuleInfo((_b = window.__FEDERATION__) == null ? void 0 : _b.moduleInfo));
181
275
  }
@@ -183,7 +277,7 @@ const App = (props) => {
183
277
  });
184
278
  const onMessage = (message, _sender, _sendResponse) => {
185
279
  if ((message == null ? void 0 : message.type) === MESSAGE_ACTIVE_TAB_CHANGED) {
186
- updateActiveTab(message.tabId);
280
+ updateActiveTab(message.tabId, { status: message.status });
187
281
  }
188
282
  };
189
283
  chrome.runtime.onMessage.addListener(onMessage);
@@ -211,6 +305,34 @@ const App = (props) => {
211
305
  setRefreshing(false);
212
306
  }
213
307
  });
308
+ const handleThemeToggle = () => {
309
+ var _a;
310
+ const current = effectiveTheme;
311
+ const next = current === "dark" ? "light" : "dark";
312
+ setUserTheme(next);
313
+ if (typeof window !== "undefined") {
314
+ try {
315
+ window.localStorage.setItem(THEME_STORAGE_KEY, next);
316
+ } catch (error) {
317
+ console.warn(
318
+ "[MF Devtools] persist theme to localStorage failed",
319
+ error
320
+ );
321
+ }
322
+ try {
323
+ const chromeObj = window.chrome;
324
+ const storage = (_a = chromeObj == null ? void 0 : chromeObj.storage) == null ? void 0 : _a.sync;
325
+ if (storage && typeof storage.set === "function") {
326
+ storage.set({ [THEME_STORAGE_KEY]: next });
327
+ }
328
+ } catch (error) {
329
+ console.warn(
330
+ "[MF Devtools] persist theme to chrome.storage.sync failed",
331
+ error
332
+ );
333
+ }
334
+ }
335
+ };
214
336
  const resetModuleInfo = useCallback(() => {
215
337
  var _a;
216
338
  const origin = ((_a = window.__FEDERATION__) == null ? void 0 : _a.originModuleInfo) || {};
@@ -270,7 +392,7 @@ const App = (props) => {
270
392
  return hasModule ? /* @__PURE__ */ jsx(Dependency, { snapshot: moduleInfo }) : /* @__PURE__ */ jsx("div", { className: styles.emptyState, children: /* @__PURE__ */ jsx(
271
393
  Empty,
272
394
  {
273
- description: "No ModuleInfo Detected",
395
+ description: t("common.empty.noModuleInfo"),
274
396
  className: styles.empty
275
397
  }
276
398
  ) });
@@ -283,66 +405,92 @@ const App = (props) => {
283
405
  )
284
406
  }
285
407
  );
408
+ case "loadingTrace":
409
+ return /* @__PURE__ */ jsx(
410
+ LoadingTrace,
411
+ {
412
+ tabId: inspectedTab == null ? void 0 : inspectedTab.id,
413
+ resetKey: inspectedTabRefreshKey
414
+ }
415
+ );
286
416
  case "performance":
287
- return /* @__PURE__ */ jsx("div", { className: styles.placeholder, children: "WIP..." });
417
+ return /* @__PURE__ */ jsx("div", { className: styles.placeholder, children: t("app.performance.placeholder") });
288
418
  default:
289
419
  return null;
290
420
  }
291
421
  };
292
- return /* @__PURE__ */ jsxs("div", { className: `${styles.shell} ${styles.overrideArco}`, children: [
293
- /* @__PURE__ */ jsx("aside", { className: styles.sidebar, children: NAV_ITEMS.map((item) => /* @__PURE__ */ jsx(
294
- "button",
295
- {
296
- type: "button",
297
- className: `${styles.tabItem} ${activePanel === item.key ? styles.activeTab : ""}`,
298
- onClick: () => setActivePanel(item.key),
299
- children: item.label
300
- },
301
- item.key
302
- )) }),
303
- /* @__PURE__ */ jsxs("section", { className: styles.panel, children: [
304
- /* @__PURE__ */ jsxs("header", { className: styles.header, children: [
305
- /* @__PURE__ */ jsxs("div", { className: styles.headerTop, children: [
306
- /* @__PURE__ */ jsxs("div", { className: styles.branding, children: [
307
- /* @__PURE__ */ jsx("span", { className: styles.logo, children: "Module Federation" }),
308
- /* @__PURE__ */ jsx("span", { className: styles.subtitle, children: "DevTools Companion" })
309
- ] }),
310
- /* @__PURE__ */ jsx(Tooltip, { content: "重新同步当前页面的 Federation 信息", children: /* @__PURE__ */ jsx(
311
- Button,
312
- {
313
- size: "mini",
314
- type: "primary",
315
- loading: refreshing,
316
- onClick: handleRefresh,
317
- className: styles.refresh,
318
- children: "Refresh"
319
- }
320
- ) })
321
- ] }),
322
- /* @__PURE__ */ jsxs("div", { className: styles.meta, children: [
323
- /* @__PURE__ */ jsxs("div", { className: styles.scope, children: [
324
- /* @__PURE__ */ jsx("span", { className: styles.scopeLabel, children: "Focus Tab" }),
325
- /* @__PURE__ */ jsx(Tag, { className: "common-tag", children: (inspectedTab == null ? void 0 : inspectedTab.title) || "Waiting for target" })
326
- ] }),
327
- /* @__PURE__ */ jsxs("div", { className: styles.stats, children: [
328
- /* @__PURE__ */ jsxs("div", { className: styles.statBlock, children: [
329
- /* @__PURE__ */ jsx("span", { className: styles.statValue, children: moduleCount }),
330
- /* @__PURE__ */ jsx("span", { className: styles.statLabel, children: "Modules" })
331
- ] }),
332
- /* @__PURE__ */ jsxs("div", { className: styles.statBlock, children: [
333
- /* @__PURE__ */ jsx("span", { className: styles.statValue, children: producer.length }),
334
- /* @__PURE__ */ jsx("span", { className: styles.statLabel, children: "Remotes" })
422
+ return /* @__PURE__ */ jsxs(
423
+ "div",
424
+ {
425
+ className: `${styles.shell} ${styles.overrideArco} ${effectiveTheme === "dark" ? "arco-theme-dark" : ""}`,
426
+ children: [
427
+ /* @__PURE__ */ jsx("aside", { className: styles.sidebar, children: NAV_ITEMS.map((item) => /* @__PURE__ */ jsx(
428
+ "button",
429
+ {
430
+ type: "button",
431
+ className: `${styles.tabItem} ${activePanel === item.key ? styles.activeTab : ""}`,
432
+ onClick: () => setActivePanel(item.key),
433
+ children: t(item.i18nKey)
434
+ },
435
+ item.key
436
+ )) }),
437
+ /* @__PURE__ */ jsxs("section", { className: styles.panel, children: [
438
+ /* @__PURE__ */ jsxs("header", { className: styles.header, children: [
439
+ /* @__PURE__ */ jsxs("div", { className: styles.headerTop, children: [
440
+ /* @__PURE__ */ jsxs("div", { className: styles.branding, children: [
441
+ /* @__PURE__ */ jsx("span", { className: styles.logo, children: t("app.header.title") }),
442
+ /* @__PURE__ */ jsx("span", { className: styles.subtitle, children: t("app.header.subtitle") })
443
+ ] }),
444
+ /* @__PURE__ */ jsxs("div", { className: styles.headerActions, children: [
445
+ /* @__PURE__ */ jsx(LanguageSwitch, {}),
446
+ /* @__PURE__ */ jsx(
447
+ ThemeToggle,
448
+ {
449
+ theme: effectiveTheme,
450
+ onToggle: handleThemeToggle
451
+ }
452
+ ),
453
+ /* @__PURE__ */ jsx(Tooltip, { content: t("app.header.refresh.tooltip"), children: /* @__PURE__ */ jsx(
454
+ Button,
455
+ {
456
+ size: "default",
457
+ icon: /* @__PURE__ */ jsx(IconRefresh, {}),
458
+ loading: refreshing,
459
+ onClick: handleRefresh,
460
+ className: btnStyles.themeToggle
461
+ }
462
+ ) })
463
+ ] })
335
464
  ] }),
336
- /* @__PURE__ */ jsxs("div", { className: styles.statBlock, children: [
337
- /* @__PURE__ */ jsx("span", { className: styles.statValue, children: consumerCount }),
338
- /* @__PURE__ */ jsx("span", { className: styles.statLabel, children: "Consumers" })
465
+ /* @__PURE__ */ jsxs("div", { className: styles.meta, children: [
466
+ /* @__PURE__ */ jsxs("div", { className: styles.scope, children: [
467
+ /* @__PURE__ */ jsx("span", { className: styles.scopeLabel, children: t("app.header.scope.label") }),
468
+ /* @__PURE__ */ jsx(Tag, { className: "common-tag", children: (inspectedTab == null ? void 0 : inspectedTab.title) || t("app.header.scope.waiting") })
469
+ ] }),
470
+ /* @__PURE__ */ jsxs("div", { className: styles.stats, children: [
471
+ /* @__PURE__ */ jsxs("div", { className: styles.statBlock, children: [
472
+ /* @__PURE__ */ jsx("span", { className: styles.statValue, children: moduleCount }),
473
+ /* @__PURE__ */ jsx("span", { className: styles.statLabel, children: t("app.header.stats.modules") })
474
+ ] }),
475
+ /* @__PURE__ */ jsxs("div", { className: styles.statBlock, children: [
476
+ /* @__PURE__ */ jsx("span", { className: styles.statValue, children: producer.length }),
477
+ /* @__PURE__ */ jsx("span", { className: styles.statLabel, children: t("app.header.stats.remotes") })
478
+ ] }),
479
+ /* @__PURE__ */ jsxs("div", { className: styles.statBlock, children: [
480
+ /* @__PURE__ */ jsx("span", { className: styles.statValue, children: consumerCount }),
481
+ /* @__PURE__ */ jsx("span", { className: styles.statLabel, children: t("app.header.stats.consumers") })
482
+ ] })
483
+ ] })
339
484
  ] })
340
- ] })
485
+ ] }),
486
+ /* @__PURE__ */ jsx("div", { className: styles.body, children: /* @__PURE__ */ jsx("div", { className: styles.content, children: renderContent() }) })
341
487
  ] })
342
- ] }),
343
- /* @__PURE__ */ jsx("div", { className: styles.body, children: /* @__PURE__ */ jsx("div", { className: styles.content, children: renderContent() }) })
344
- ] })
345
- ] });
488
+ ]
489
+ }
490
+ );
491
+ };
492
+ const App = (props) => {
493
+ return /* @__PURE__ */ jsx(I18nextProvider, { i18n, children: /* @__PURE__ */ jsx(InnerApp, __spreadValues({}, props)) });
346
494
  };
347
495
  var App_default = App;
348
496
  export {
@@ -1,5 +1,5 @@
1
1
  import "./App_module.css";
2
- 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", "refresh": "refresh_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" };
2
+ 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" };
3
3
  export {
4
4
  App_module_default as default
5
5
  };
@@ -10,7 +10,7 @@
10
10
  flex: 1 1;
11
11
  }
12
12
  .arco-empty {
13
- color: #4b5563;
13
+ color: var(--color-text-2, #4b5563);
14
14
  }
15
15
  .arco-select, .arco-input {
16
16
  background: transparent;
@@ -20,6 +20,12 @@
20
20
  border: 1px solid rgba(34, 197, 94, 0.35);
21
21
  color: #4b5563;
22
22
  }
23
+ body {
24
+ --form-control-alpha: 0.9;
25
+ }
26
+ body[arco-theme=dark] {
27
+ --form-control-alpha: 0.1;
28
+ }
23
29
 
24
30
  .shell_ae2ee {
25
31
  width: 100%;
@@ -41,8 +47,8 @@
41
47
  gap: 12px;
42
48
  padding: clamp(18px, 2.5vw, 24px) clamp(14px, 2vw, 18px);
43
49
  border-radius: 22px;
44
- border: 1px solid rgba(148, 163, 184, 0.18);
45
- background: rgba(255, 255, 255, 0.95);
50
+ border: 1px solid var(--color-border-1, rgba(148, 163, 184, 0.18));
51
+ background: var(--color-bg-2, rgba(255, 255, 255, 0.95));
46
52
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.08), 0 1px 0 rgba(0, 0, 0, 0.05) inset;
47
53
  box-sizing: border-box;
48
54
  }
@@ -54,8 +60,8 @@
54
60
  border: 1px solid transparent;
55
61
  border-radius: 12px;
56
62
  padding: 10px 12px;
57
- background: rgba(249, 250, 251, 0.8);
58
- color: rgba(55, 65, 81, 0.9);
63
+ background: var(--color-bg-2, rgba(249, 250, 251, 0.8));
64
+ color: var(--color-text-2, rgba(55, 65, 81, 0.9));
59
65
  font-size: 13px;
60
66
  letter-spacing: 0.04em;
61
67
  text-transform: uppercase;
@@ -66,14 +72,14 @@
66
72
 
67
73
  .tabItem_ae2ee:hover {
68
74
  border-color: rgba(37, 49, 48, 0.45);
69
- color: #1e293b;
75
+ color: var(--color-text-1, #1e293b);
70
76
  }
71
77
 
72
78
  .activeTab_ae2ee {
73
- border-color: rgba(99, 102, 241, 0.65);
74
- background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.1));
75
- color: #1e293b;
76
- box-shadow: 0 12px 28px rgba(30, 64, 175, 0.25);
79
+ border-color: rgba(24, 24, 27, 0.28);
80
+ background: linear-gradient(135deg, rgba(24, 24, 27, 0.08), rgba(113, 113, 122, 0.08));
81
+ color: var(--color-text-1, #1e293b);
82
+ box-shadow: 0 12px 28px rgba(24, 24, 27, 0.14);
77
83
  }
78
84
 
79
85
  .panel_ae2ee {
@@ -82,8 +88,8 @@
82
88
  width: 100%;
83
89
  max-width: 1120px;
84
90
  min-height: calc(100vh - 56px);
85
- background: rgba(255, 255, 255, 0.98);
86
- border: 1px solid rgba(0, 0, 0, 0.08);
91
+ background: var(--color-bg-1, rgba(255, 255, 255, 0.98));
92
+ border: 1px solid var(--color-border-2, rgba(0, 0, 0, 0.08));
87
93
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.06), 0 2px 0 rgba(0, 0, 0, 0.04) inset;
88
94
  border-radius: 22px;
89
95
  padding: clamp(20px, 3vw, 32px);
@@ -91,7 +97,7 @@
91
97
  flex-direction: column;
92
98
  gap: 28px;
93
99
  box-sizing: border-box;
94
- color: #1f2937;
100
+ color: var(--color-text-1, #1f2937);
95
101
  }
96
102
 
97
103
  .header_ae2ee {
@@ -113,25 +119,17 @@
113
119
  gap: 4px;
114
120
  }
115
121
 
116
- .refresh_ae2ee .arco-btn-primary {
117
- background: linear-gradient(135deg, rgba(34, 197, 94, 0.8), rgba(22, 163, 74, 0.7));
118
- border-color: rgba(34, 197, 94, 0.65);
119
- }
120
- .refresh_ae2ee .arco-btn-primary:hover {
121
- background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(22, 163, 74, 0.85));
122
- }
123
-
124
122
  .logo_ae2ee {
125
123
  font-size: 20px;
126
124
  font-weight: 600;
127
125
  letter-spacing: 0.02em;
128
- color: #1e293b;
126
+ color: var(--color-text-1, #1e293b);
129
127
  }
130
128
 
131
129
  .subtitle_ae2ee {
132
130
  font-size: 12px;
133
131
  font-weight: 500;
134
- color: rgba(75, 85, 99, 0.8);
132
+ color: var(--color-text-2, rgba(75, 85, 99, 0.8));
135
133
  text-transform: uppercase;
136
134
  letter-spacing: 0.12em;
137
135
  }
@@ -153,7 +151,7 @@
153
151
 
154
152
  .scopeLabel_ae2ee {
155
153
  font-size: 12px;
156
- color: rgba(75, 85, 99, 0.85);
154
+ color: var(--color-text-2, rgba(75, 85, 99, 0.85));
157
155
  text-transform: uppercase;
158
156
  letter-spacing: 0.08em;
159
157
  }
@@ -172,7 +170,7 @@
172
170
  min-width: 80px;
173
171
  padding: 12px 14px;
174
172
  border-radius: 14px;
175
- background: linear-gradient(140deg, rgba(243, 244, 246, 0.8) 0%, rgba(229, 231, 235, 0.6) 100%);
173
+ background: linear-gradient(140deg, rgba(243, 244, 246, 0) 0%, rgba(229, 231, 235, 0.1) 100%);
176
174
  border: 1px solid rgba(203, 213, 225, 0.4);
177
175
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
178
176
  }
@@ -180,13 +178,13 @@
180
178
  .statValue_ae2ee {
181
179
  font-size: 22px;
182
180
  font-weight: 600;
183
- color: #1e293b;
181
+ color: var(--color-text-1, #1e293b);
184
182
  line-height: 1.1;
185
183
  }
186
184
 
187
185
  .statLabel_ae2ee {
188
186
  font-size: 11px;
189
- color: rgba(75, 85, 99, 0.88);
187
+ color: var(--color-text-2, rgba(75, 85, 99, 0.88));
190
188
  letter-spacing: 0.04em;
191
189
  text-transform: uppercase;
192
190
  }
@@ -251,7 +249,7 @@
251
249
  justify-content: center;
252
250
  border-radius: 18px;
253
251
  border: 1px dashed rgba(203, 213, 225, 0.4);
254
- background: rgba(255, 255, 255, 0.8);
252
+ background: var(--color-bg-2, rgba(255, 255, 255, 0.8));
255
253
  padding: 32px;
256
254
  }
257
255
 
@@ -266,8 +264,8 @@
266
264
  justify-content: center;
267
265
  border-radius: 18px;
268
266
  border: 1px dashed rgba(203, 213, 225, 0.4);
269
- background: rgba(255, 255, 255, 0.8);
270
- color: rgba(75, 85, 99, 0.75);
267
+ background: var(--color-bg-2, rgba(255, 255, 255, 0.8));
268
+ color: var(--color-text-2, rgba(75, 85, 99, 0.75));
271
269
  font-size: 14px;
272
270
  letter-spacing: 0.08em;
273
271
  text-transform: uppercase;
@@ -275,18 +273,18 @@
275
273
 
276
274
  .overrideArco_ae2ee .arco-input-inner-wrapper,
277
275
  .overrideArco_ae2ee .arco-select-view {
278
- background-color: #fff !important;
279
- border-color: rgba(228, 228, 231, 0.5) !important;
276
+ background-color: var(--color-bg-1, #fff) !important;
277
+ border-color: var(--color-border-2, rgba(228, 228, 231, 0.5)) !important;
280
278
  }
281
279
  .overrideArco_ae2ee .arco-input-inner-wrapper:hover,
282
280
  .overrideArco_ae2ee .arco-select-view:hover {
283
- background-color: #fff !important;
284
- border-color: rgba(228, 228, 231, 0.5) !important;
281
+ background-color: var(--color-bg-1, #fff) !important;
282
+ border-color: var(--color-border-2, rgba(228, 228, 231, 0.5)) !important;
285
283
  }
286
284
  .overrideArco_ae2ee .arco-input-inner-wrapper:focus-within,
287
285
  .overrideArco_ae2ee .arco-select-view-focus {
288
- background-color: #fff !important;
289
- border-color: rgba(228, 228, 231, 0.5) !important;
286
+ background-color: var(--color-bg-1, #fff) !important;
287
+ border-color: var(--color-border-2, rgba(228, 228, 231, 0.5)) !important;
290
288
  }
291
289
  .overrideArco_ae2ee .arco-collapse-item .arco-collapse-item-icon-hover {
292
290
  top: 25% !important;
@@ -296,10 +294,14 @@
296
294
  }
297
295
 
298
296
  .arco-table-th {
299
- background-color: rgb(250 250 250/var(--tw-bg-opacity)) !important;
300
- border-bottom-color: rgb(228 228 231/var(--tw-border-opacity)) !important;
297
+ background-color: var(--color-bg-2, rgb(250 250 250/var(--tw-bg-opacity))) !important;
298
+ border-bottom-color: var(--color-border-2, rgb(228 228 231/var(--tw-border-opacity))) !important;
301
299
  }
302
300
 
303
301
  .arco-table-td {
304
- border-bottom-color: rgba(228, 228, 231, 0.5) !important;
302
+ border-bottom-color: var(--color-border-2, rgba(228, 228, 231, 0.5)) !important;
303
+ }
304
+
305
+ .shell_ae2ee.arco-theme-dark {
306
+ background: radial-gradient(circle at 10% 20%, rgba(15, 23, 42, 0.9) 0%, rgba(15, 23, 42, 0.98) 55%), linear-gradient(135deg, var(--color-bg-1, #020617) 0%, var(--color-bg-2, #020617) 100%);
305
307
  }