@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.
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/es/App.css +13 -0
- package/dist/es/App.js +498 -0
- package/dist/es/App.module.js +5 -0
- package/dist/es/App_module.css +307 -0
- package/dist/es/component/DependencyGraph/index.js +204 -0
- package/dist/es/component/DependencyGraph/index.module.js +5 -0
- package/dist/es/component/DependencyGraph/index_module.css +100 -0
- package/dist/es/component/DependencyGraphItem/index.js +95 -0
- package/dist/es/component/DependencyGraphItem/index.module.js +5 -0
- package/dist/es/component/DependencyGraphItem/index_module.css +95 -0
- package/dist/es/component/Form/index.js +363 -0
- package/dist/es/component/Form/index.module.js +5 -0
- package/dist/es/component/Form/index_module.css +198 -0
- package/dist/es/component/LanguageSwitch.js +50 -0
- package/dist/es/component/Layout/index.js +470 -0
- package/dist/es/component/Layout/index.module.js +5 -0
- package/dist/es/component/Layout/index_module.css +68 -0
- package/dist/es/component/LoadingTrace/index.js +944 -0
- package/dist/es/component/LoadingTrace/index.module.js +5 -0
- package/dist/es/component/LoadingTrace/index_module.css +876 -0
- package/dist/es/component/ModuleInfo/index.js +313 -0
- package/dist/es/component/ModuleInfo/index.module.js +5 -0
- package/dist/es/component/ModuleInfo/index_module.css +184 -0
- package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.js +35 -0
- package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.module.js +5 -0
- package/dist/es/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
- package/dist/es/component/SharedDepsExplorer/index.js +636 -0
- package/dist/es/component/SharedDepsExplorer/index.module.js +5 -0
- package/dist/es/component/SharedDepsExplorer/index_module.css +467 -0
- package/dist/es/component/SharedDepsExplorer/share-utils.js +222 -0
- package/dist/es/component/ThemeToggle.js +19 -0
- package/dist/es/component/ThemeToggle.module.js +5 -0
- package/dist/es/component/ThemeToggle_module.css +12 -0
- package/dist/es/hooks/useDevtoolsTheme.js +77 -0
- package/dist/es/i18n/index.js +688 -0
- package/dist/es/init.js +8 -0
- package/dist/es/template/constant.js +51 -0
- package/dist/es/template/index.js +1 -0
- package/dist/es/utils/chrome/fast-refresh.js +342 -0
- package/dist/es/utils/chrome/index.js +284 -0
- package/dist/es/utils/chrome/messages.js +12 -0
- package/dist/es/utils/chrome/observability-plugin.js +93 -0
- package/dist/es/utils/chrome/observability-shared.js +99 -0
- package/dist/es/utils/chrome/observability.js +208 -0
- package/dist/es/utils/chrome/override-remote.js +2 -0
- package/dist/es/utils/chrome/post-message-init.js +5 -0
- package/dist/es/utils/chrome/post-message-listener.js +39 -0
- package/dist/es/utils/chrome/post-message-start.js +10 -0
- package/dist/es/utils/chrome/post-message.js +71 -0
- package/dist/es/utils/chrome/safe-post-message.js +124 -0
- package/dist/es/utils/chrome/snapshot-plugin.js +2 -0
- package/dist/es/utils/chrome/storage.js +50 -0
- package/dist/es/utils/data/index.js +59 -0
- package/dist/es/utils/index.js +4 -0
- package/dist/es/utils/sdk/graph.js +190 -0
- package/dist/es/utils/sdk/index.js +70 -0
- package/dist/es/utils/types/common.js +0 -0
- package/dist/es/utils/types/index.js +1 -0
- package/dist/es/vendor/basic-proxy-core.js +155 -0
- package/dist/es/worker/index.js +187 -0
- package/dist/lib/App.css +13 -0
- package/dist/lib/App.js +519 -0
- package/dist/lib/App.module.js +24 -0
- package/dist/lib/App_module.css +307 -0
- package/dist/lib/component/DependencyGraph/index.js +225 -0
- package/dist/lib/component/DependencyGraph/index.module.js +24 -0
- package/dist/lib/component/DependencyGraph/index_module.css +100 -0
- package/dist/lib/component/DependencyGraphItem/index.js +124 -0
- package/dist/lib/component/DependencyGraphItem/index.module.js +24 -0
- package/dist/lib/component/DependencyGraphItem/index_module.css +95 -0
- package/dist/lib/component/Form/index.js +372 -0
- package/dist/lib/component/Form/index.module.js +24 -0
- package/dist/lib/component/Form/index_module.css +198 -0
- package/dist/lib/component/LanguageSwitch.js +79 -0
- package/dist/lib/component/Layout/index.js +471 -0
- package/dist/lib/component/Layout/index.module.js +24 -0
- package/dist/lib/component/Layout/index_module.css +68 -0
- package/dist/lib/component/LoadingTrace/index.js +953 -0
- package/dist/lib/component/LoadingTrace/index.module.js +24 -0
- package/dist/lib/component/LoadingTrace/index_module.css +876 -0
- package/dist/lib/component/ModuleInfo/index.js +342 -0
- package/dist/lib/component/ModuleInfo/index.module.js +24 -0
- package/dist/lib/component/ModuleInfo/index_module.css +184 -0
- package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.js +64 -0
- package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.module.js +24 -0
- package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
- package/dist/lib/component/SharedDepsExplorer/index.js +638 -0
- package/dist/lib/component/SharedDepsExplorer/index.module.js +24 -0
- package/dist/lib/component/SharedDepsExplorer/index_module.css +467 -0
- package/dist/lib/component/SharedDepsExplorer/share-utils.js +252 -0
- package/dist/lib/component/ThemeToggle.js +48 -0
- package/dist/lib/component/ThemeToggle.module.js +24 -0
- package/dist/lib/component/ThemeToggle_module.css +12 -0
- package/dist/lib/hooks/useDevtoolsTheme.js +100 -0
- package/dist/lib/i18n/index.js +721 -0
- package/dist/lib/init.js +8 -0
- package/dist/lib/template/constant.js +84 -0
- package/dist/lib/template/index.js +21 -0
- package/dist/lib/utils/chrome/fast-refresh.js +329 -0
- package/dist/lib/utils/chrome/index.js +321 -0
- package/dist/lib/utils/chrome/messages.js +39 -0
- package/dist/lib/utils/chrome/observability-plugin.js +85 -0
- package/dist/lib/utils/chrome/observability-shared.js +125 -0
- package/dist/lib/utils/chrome/observability.js +233 -0
- package/dist/lib/utils/chrome/override-remote.js +17 -0
- package/dist/lib/utils/chrome/post-message-init.js +5 -0
- package/dist/lib/utils/chrome/post-message-listener.js +36 -0
- package/dist/lib/utils/chrome/post-message-start.js +10 -0
- package/dist/lib/utils/chrome/post-message.js +91 -0
- package/dist/lib/utils/chrome/safe-post-message.js +147 -0
- package/dist/lib/utils/chrome/snapshot-plugin.js +17 -0
- package/dist/lib/utils/chrome/storage.js +71 -0
- package/dist/lib/utils/data/index.js +83 -0
- package/dist/lib/utils/index.js +27 -0
- package/dist/lib/utils/sdk/graph.js +213 -0
- package/dist/lib/utils/sdk/index.js +104 -0
- package/dist/lib/utils/types/common.js +15 -0
- package/dist/lib/utils/types/index.js +21 -0
- package/dist/lib/vendor/basic-proxy-core.js +147 -0
- package/dist/lib/worker/index.js +175 -0
- package/dist/types/src/App.d.ts +7 -0
- package/dist/types/src/component/DependencyGraph/index.d.ts +6 -0
- package/dist/types/src/component/DependencyGraphItem/index.d.ts +9 -0
- package/dist/types/src/component/Form/index.d.ts +21 -0
- package/dist/types/src/component/LanguageSwitch.d.ts +2 -0
- package/dist/types/src/component/Layout/index.d.ts +15 -0
- package/dist/types/src/component/LoadingTrace/index.d.ts +6 -0
- package/dist/types/src/component/ModuleInfo/index.d.ts +8 -0
- package/dist/types/src/component/SharedDepsExplorer/FocusResultDisplay.d.ts +15 -0
- package/dist/types/src/component/SharedDepsExplorer/index.d.ts +6 -0
- package/dist/types/src/component/SharedDepsExplorer/share-utils.d.ts +45 -0
- package/dist/types/src/component/ThemeToggle.d.ts +8 -0
- package/dist/types/src/hooks/useDevtoolsTheme.d.ts +2 -0
- package/dist/types/src/i18n/index.d.ts +5 -0
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/init.d.ts +12 -0
- package/dist/types/src/template/constant.d.ts +21 -0
- package/dist/types/src/template/index.d.ts +1 -0
- package/dist/types/src/utils/chrome/fast-refresh.d.ts +1 -0
- package/dist/types/src/utils/chrome/index.d.ts +19 -0
- package/dist/types/src/utils/chrome/messages.d.ts +5 -0
- package/dist/types/src/utils/chrome/observability-plugin.d.ts +1 -0
- package/dist/types/src/utils/chrome/observability-shared.d.ts +41 -0
- package/dist/types/src/utils/chrome/observability.d.ts +110 -0
- package/dist/types/src/utils/chrome/override-remote.d.ts +1 -0
- package/dist/types/src/utils/chrome/post-message-init.d.ts +1 -0
- package/dist/types/src/utils/chrome/post-message-listener.d.ts +1 -0
- package/dist/types/src/utils/chrome/post-message-start.d.ts +1 -0
- package/dist/types/src/utils/chrome/post-message.d.ts +1 -0
- package/dist/types/src/utils/chrome/safe-post-message.d.ts +1 -0
- package/dist/types/src/utils/chrome/snapshot-plugin.d.ts +1 -0
- package/dist/types/src/utils/chrome/storage.d.ts +5 -0
- package/dist/types/src/utils/data/index.d.ts +10 -0
- package/dist/types/src/utils/index.d.ts +4 -0
- package/dist/types/src/utils/sdk/graph.d.ts +46 -0
- package/dist/types/src/utils/sdk/index.d.ts +11 -0
- package/dist/types/src/utils/types/common.d.ts +22 -0
- package/dist/types/src/utils/types/index.d.ts +1 -0
- package/dist/types/src/worker/index.d.ts +1 -0
- package/dist/types/stories/index.stories.d.ts +9 -0
- package/install-deps.bash +23 -0
- package/package.json +108 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 ScriptedAlchemy LLC (Zack Jackson) Zhou Shaw (zhouxiao)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Module Federation Chrome Devtools
|
|
2
|
+
|
|
3
|
+
## Ability
|
|
4
|
+
|
|
5
|
+
- Proxy online Module Federation remote module to local
|
|
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
|
|
10
|
+
|
|
11
|
+
https://module-federation.io/
|
package/dist/es/App.css
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
.loaded-status-tag {
|
|
2
|
+
color: var(--color-bg-1, white) !important;
|
|
3
|
+
background-color: var(--color-neutral-10, black) !important;
|
|
4
|
+
}
|
|
5
|
+
.reused-status-tag {
|
|
6
|
+
background-color: greenyellow !important;
|
|
7
|
+
color: black !important;
|
|
8
|
+
}
|
|
9
|
+
.common-tag {
|
|
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;
|
|
13
|
+
}
|
package/dist/es/App.js
ADDED
|
@@ -0,0 +1,498 @@
|
|
|
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
|
+
};
|
|
17
|
+
var __async = (__this, __arguments, generator) => {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
var fulfilled = (value) => {
|
|
20
|
+
try {
|
|
21
|
+
step(generator.next(value));
|
|
22
|
+
} catch (e) {
|
|
23
|
+
reject(e);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var rejected = (value) => {
|
|
27
|
+
try {
|
|
28
|
+
step(generator.throw(value));
|
|
29
|
+
} catch (e) {
|
|
30
|
+
reject(e);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
34
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
38
|
+
import { useState, useEffect, useMemo, useCallback, useRef } from "react";
|
|
39
|
+
import "@arco-design/web-react/es/_util/react-19-adapter";
|
|
40
|
+
import "./App.css";
|
|
41
|
+
import { Empty, Tag, Button, Tooltip } from "@arco-design/web-react";
|
|
42
|
+
import { I18nextProvider, useTranslation } from "react-i18next";
|
|
43
|
+
import "./init";
|
|
44
|
+
import { IconRefresh } from "@arco-design/web-react/icon";
|
|
45
|
+
import ProxyLayout from "./component/Layout";
|
|
46
|
+
import Dependency from "./component/DependencyGraph";
|
|
47
|
+
import ModuleInfo from "./component/ModuleInfo";
|
|
48
|
+
import SharedDepsExplorer from "./component/SharedDepsExplorer";
|
|
49
|
+
import LoadingTrace from "./component/LoadingTrace";
|
|
50
|
+
import LanguageSwitch from "./component/LanguageSwitch";
|
|
51
|
+
import ThemeToggle from "./component/ThemeToggle";
|
|
52
|
+
import {
|
|
53
|
+
getGlobalModuleInfo,
|
|
54
|
+
normalizeModuleInfoPayload,
|
|
55
|
+
refreshModuleInfo,
|
|
56
|
+
separateType,
|
|
57
|
+
syncActiveTab
|
|
58
|
+
} from "./utils";
|
|
59
|
+
import { MESSAGE_ACTIVE_TAB_CHANGED } from "./utils/chrome/messages";
|
|
60
|
+
import { useDevtoolsTheme } from "./hooks/useDevtoolsTheme";
|
|
61
|
+
import i18n from "./i18n";
|
|
62
|
+
import "@arco-design/web-react/dist/css/arco.css";
|
|
63
|
+
import styles from "./App.module";
|
|
64
|
+
import btnStyles from "./component/ThemeToggle.module";
|
|
65
|
+
const cloneModuleInfo = (info) => {
|
|
66
|
+
try {
|
|
67
|
+
return normalizeModuleInfoPayload(info);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.warn("[MF Devtools] cloneModuleInfo failed", error);
|
|
70
|
+
return {};
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const normalizeShareValue = (target, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
74
|
+
if (typeof target === "function") {
|
|
75
|
+
const name = target.name ? `: ${target.name}` : "";
|
|
76
|
+
return `[Function${name}]`;
|
|
77
|
+
}
|
|
78
|
+
if (!target || typeof target !== "object") {
|
|
79
|
+
return target;
|
|
80
|
+
}
|
|
81
|
+
if (seen.has(target)) {
|
|
82
|
+
return "[Circular]";
|
|
83
|
+
}
|
|
84
|
+
seen.add(target);
|
|
85
|
+
if (target instanceof Map) {
|
|
86
|
+
const mapped = {};
|
|
87
|
+
target.forEach((value, key) => {
|
|
88
|
+
mapped[String(key)] = normalizeShareValue(value, seen);
|
|
89
|
+
});
|
|
90
|
+
return mapped;
|
|
91
|
+
}
|
|
92
|
+
if (target instanceof Set) {
|
|
93
|
+
const setItems = [];
|
|
94
|
+
target.forEach((value) => {
|
|
95
|
+
setItems.push(normalizeShareValue(value, seen));
|
|
96
|
+
});
|
|
97
|
+
return setItems;
|
|
98
|
+
}
|
|
99
|
+
if (Array.isArray(target)) {
|
|
100
|
+
return target.map((item) => normalizeShareValue(item, seen));
|
|
101
|
+
}
|
|
102
|
+
return Object.keys(target).reduce((memo, key) => {
|
|
103
|
+
memo[key] = normalizeShareValue(target[key], seen);
|
|
104
|
+
return memo;
|
|
105
|
+
}, {});
|
|
106
|
+
};
|
|
107
|
+
const buildShareSnapshot = (share) => {
|
|
108
|
+
const normalize = (value) => {
|
|
109
|
+
try {
|
|
110
|
+
return normalizeShareValue(value);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
console.warn("[MF Devtools] normalize share snapshot failed", error);
|
|
113
|
+
return normalizeShareValue(value);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const scopes = normalize(share || {});
|
|
117
|
+
return scopes;
|
|
118
|
+
};
|
|
119
|
+
const NAV_ITEMS = [
|
|
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" }
|
|
126
|
+
];
|
|
127
|
+
const THEME_STORAGE_KEY = "mf-devtools-theme";
|
|
128
|
+
const InnerApp = (props) => {
|
|
129
|
+
const {
|
|
130
|
+
versionList,
|
|
131
|
+
setVersionList,
|
|
132
|
+
getVersion,
|
|
133
|
+
handleSnapshot,
|
|
134
|
+
handleProxyAddress,
|
|
135
|
+
customValueValidate,
|
|
136
|
+
headerSlot
|
|
137
|
+
} = props;
|
|
138
|
+
const autoTheme = useDevtoolsTheme();
|
|
139
|
+
const [userTheme, setUserTheme] = useState(null);
|
|
140
|
+
const effectiveTheme = userTheme != null ? userTheme : autoTheme;
|
|
141
|
+
const { t } = useTranslation();
|
|
142
|
+
const [moduleInfo, setModuleInfo] = useState(
|
|
143
|
+
() => {
|
|
144
|
+
var _a;
|
|
145
|
+
return cloneModuleInfo(((_a = window.__FEDERATION__) == null ? void 0 : _a.moduleInfo) || {});
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
const [shareInfo, setShareInfo] = useState(
|
|
149
|
+
() => {
|
|
150
|
+
var _a;
|
|
151
|
+
return buildShareSnapshot((_a = window.__FEDERATION__) == null ? void 0 : _a.__SHARE__);
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
const [inspectedTab, setInspectedTab] = useState(
|
|
155
|
+
window.targetTab
|
|
156
|
+
);
|
|
157
|
+
const [inspectedTabRefreshKey, setInspectedTabRefreshKey] = useState(0);
|
|
158
|
+
const [activePanel, setActivePanel] = useState("proxy");
|
|
159
|
+
const [selectedModuleId, setSelectedModuleId] = useState(null);
|
|
160
|
+
const [refreshing, setRefreshing] = useState(false);
|
|
161
|
+
const panelSyncReadyRef = useRef(false);
|
|
162
|
+
const applyModuleUpdate = useCallback((info) => {
|
|
163
|
+
var _a;
|
|
164
|
+
setModuleInfo(cloneModuleInfo(info));
|
|
165
|
+
const shareSnapshot = buildShareSnapshot(
|
|
166
|
+
(_a = window.__FEDERATION__) == null ? void 0 : _a.__SHARE__
|
|
167
|
+
);
|
|
168
|
+
setShareInfo(shareSnapshot);
|
|
169
|
+
panelSyncReadyRef.current = true;
|
|
170
|
+
}, []);
|
|
171
|
+
const { producer, consumers } = useMemo(
|
|
172
|
+
() => separateType(moduleInfo),
|
|
173
|
+
[moduleInfo]
|
|
174
|
+
);
|
|
175
|
+
const moduleKeys = useMemo(() => Object.keys(moduleInfo || {}), [moduleInfo]);
|
|
176
|
+
const moduleCount = moduleKeys.length;
|
|
177
|
+
const consumerCount = useMemo(
|
|
178
|
+
() => Object.keys(consumers || {}).length,
|
|
179
|
+
[consumers]
|
|
180
|
+
);
|
|
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]);
|
|
240
|
+
useEffect(() => {
|
|
241
|
+
if (!moduleKeys.length) {
|
|
242
|
+
setSelectedModuleId(null);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (!selectedModuleId || !moduleKeys.includes(selectedModuleId)) {
|
|
246
|
+
setSelectedModuleId(moduleKeys[0]);
|
|
247
|
+
}
|
|
248
|
+
}, [moduleKeys, selectedModuleId]);
|
|
249
|
+
useEffect(() => {
|
|
250
|
+
const bootstrap = () => __async(void 0, null, function* () {
|
|
251
|
+
const tab = yield syncActiveTab();
|
|
252
|
+
setInspectedTab(tab || void 0);
|
|
253
|
+
const detach = yield getGlobalModuleInfo(
|
|
254
|
+
(info) => applyModuleUpdate(info)
|
|
255
|
+
);
|
|
256
|
+
panelSyncReadyRef.current = true;
|
|
257
|
+
return detach;
|
|
258
|
+
});
|
|
259
|
+
const cleanupPromise = bootstrap();
|
|
260
|
+
return () => {
|
|
261
|
+
cleanupPromise.then((cleanup) => cleanup == null ? void 0 : cleanup());
|
|
262
|
+
};
|
|
263
|
+
}, [applyModuleUpdate]);
|
|
264
|
+
useEffect(() => {
|
|
265
|
+
const updateActiveTab = (tabId, options) => __async(void 0, null, function* () {
|
|
266
|
+
var _a, _b;
|
|
267
|
+
const tab = yield syncActiveTab(tabId);
|
|
268
|
+
setInspectedTab(tab || void 0);
|
|
269
|
+
if ((options == null ? void 0 : options.status) === "loading") {
|
|
270
|
+
setInspectedTabRefreshKey((key) => key + 1);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
if ((_a = window.__FEDERATION__) == null ? void 0 : _a.moduleInfo) {
|
|
274
|
+
applyModuleUpdate(cloneModuleInfo((_b = window.__FEDERATION__) == null ? void 0 : _b.moduleInfo));
|
|
275
|
+
}
|
|
276
|
+
yield refreshModuleInfo();
|
|
277
|
+
});
|
|
278
|
+
const onMessage = (message, _sender, _sendResponse) => {
|
|
279
|
+
if ((message == null ? void 0 : message.type) === MESSAGE_ACTIVE_TAB_CHANGED) {
|
|
280
|
+
updateActiveTab(message.tabId, { status: message.status });
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
chrome.runtime.onMessage.addListener(onMessage);
|
|
284
|
+
const onActivated = (activeInfo) => {
|
|
285
|
+
updateActiveTab(activeInfo.tabId);
|
|
286
|
+
};
|
|
287
|
+
chrome.tabs.onActivated.addListener(onActivated);
|
|
288
|
+
return () => {
|
|
289
|
+
chrome.runtime.onMessage.removeListener(onMessage);
|
|
290
|
+
chrome.tabs.onActivated.removeListener(onActivated);
|
|
291
|
+
};
|
|
292
|
+
}, [applyModuleUpdate]);
|
|
293
|
+
const handleRefresh = () => __async(void 0, null, function* () {
|
|
294
|
+
var _a, _b;
|
|
295
|
+
if (refreshing) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
setRefreshing(true);
|
|
299
|
+
try {
|
|
300
|
+
yield refreshModuleInfo();
|
|
301
|
+
if ((_a = window.__FEDERATION__) == null ? void 0 : _a.moduleInfo) {
|
|
302
|
+
applyModuleUpdate(cloneModuleInfo((_b = window.__FEDERATION__) == null ? void 0 : _b.moduleInfo));
|
|
303
|
+
}
|
|
304
|
+
} finally {
|
|
305
|
+
setRefreshing(false);
|
|
306
|
+
}
|
|
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
|
+
};
|
|
336
|
+
const resetModuleInfo = useCallback(() => {
|
|
337
|
+
var _a;
|
|
338
|
+
const origin = ((_a = window.__FEDERATION__) == null ? void 0 : _a.originModuleInfo) || {};
|
|
339
|
+
applyModuleUpdate(cloneModuleInfo(origin));
|
|
340
|
+
}, [applyModuleUpdate]);
|
|
341
|
+
useEffect(() => {
|
|
342
|
+
const shouldAutoSync = activePanel === "proxy" || activePanel === "dependency" || activePanel === "share";
|
|
343
|
+
if (!shouldAutoSync || !panelSyncReadyRef.current) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
let cancelled = false;
|
|
347
|
+
const syncPanelData = () => __async(void 0, null, function* () {
|
|
348
|
+
var _a, _b;
|
|
349
|
+
yield refreshModuleInfo();
|
|
350
|
+
if (cancelled) {
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
if ((_a = window.__FEDERATION__) == null ? void 0 : _a.moduleInfo) {
|
|
354
|
+
applyModuleUpdate(cloneModuleInfo((_b = window.__FEDERATION__) == null ? void 0 : _b.moduleInfo));
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
void syncPanelData();
|
|
358
|
+
return () => {
|
|
359
|
+
cancelled = true;
|
|
360
|
+
};
|
|
361
|
+
}, [activePanel, applyModuleUpdate]);
|
|
362
|
+
const renderContent = () => {
|
|
363
|
+
var _a;
|
|
364
|
+
switch (activePanel) {
|
|
365
|
+
case "moduleInfo":
|
|
366
|
+
return /* @__PURE__ */ jsx(
|
|
367
|
+
ModuleInfo,
|
|
368
|
+
{
|
|
369
|
+
moduleInfo,
|
|
370
|
+
selectedModuleId,
|
|
371
|
+
onSelectModule: (id) => setSelectedModuleId(id)
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
case "proxy":
|
|
375
|
+
return /* @__PURE__ */ jsx(
|
|
376
|
+
ProxyLayout,
|
|
377
|
+
{
|
|
378
|
+
moduleInfo,
|
|
379
|
+
versionList,
|
|
380
|
+
setVersionList,
|
|
381
|
+
getVersion,
|
|
382
|
+
handleSnapshot,
|
|
383
|
+
handleProxyAddress,
|
|
384
|
+
customValueValidate,
|
|
385
|
+
headerSlot,
|
|
386
|
+
onModuleInfoChange: applyModuleUpdate,
|
|
387
|
+
onModuleInfoReset: resetModuleInfo,
|
|
388
|
+
tabId: inspectedTab == null ? void 0 : inspectedTab.id
|
|
389
|
+
}
|
|
390
|
+
);
|
|
391
|
+
case "dependency":
|
|
392
|
+
return hasModule ? /* @__PURE__ */ jsx(Dependency, { snapshot: moduleInfo }) : /* @__PURE__ */ jsx("div", { className: styles.emptyState, children: /* @__PURE__ */ jsx(
|
|
393
|
+
Empty,
|
|
394
|
+
{
|
|
395
|
+
description: t("common.empty.noModuleInfo"),
|
|
396
|
+
className: styles.empty
|
|
397
|
+
}
|
|
398
|
+
) });
|
|
399
|
+
case "share":
|
|
400
|
+
return /* @__PURE__ */ jsx(
|
|
401
|
+
SharedDepsExplorer,
|
|
402
|
+
{
|
|
403
|
+
shareData: JSON.parse(
|
|
404
|
+
JSON.stringify((_a = window.__FEDERATION__) == null ? void 0 : _a.__SHARE__)
|
|
405
|
+
)
|
|
406
|
+
}
|
|
407
|
+
);
|
|
408
|
+
case "loadingTrace":
|
|
409
|
+
return /* @__PURE__ */ jsx(
|
|
410
|
+
LoadingTrace,
|
|
411
|
+
{
|
|
412
|
+
tabId: inspectedTab == null ? void 0 : inspectedTab.id,
|
|
413
|
+
resetKey: inspectedTabRefreshKey
|
|
414
|
+
}
|
|
415
|
+
);
|
|
416
|
+
case "performance":
|
|
417
|
+
return /* @__PURE__ */ jsx("div", { className: styles.placeholder, children: t("app.performance.placeholder") });
|
|
418
|
+
default:
|
|
419
|
+
return null;
|
|
420
|
+
}
|
|
421
|
+
};
|
|
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
|
+
] })
|
|
464
|
+
] }),
|
|
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
|
+
] })
|
|
484
|
+
] })
|
|
485
|
+
] }),
|
|
486
|
+
/* @__PURE__ */ jsx("div", { className: styles.body, children: /* @__PURE__ */ jsx("div", { className: styles.content, children: renderContent() }) })
|
|
487
|
+
] })
|
|
488
|
+
]
|
|
489
|
+
}
|
|
490
|
+
);
|
|
491
|
+
};
|
|
492
|
+
const App = (props) => {
|
|
493
|
+
return /* @__PURE__ */ jsx(I18nextProvider, { i18n, children: /* @__PURE__ */ jsx(InnerApp, __spreadValues({}, props)) });
|
|
494
|
+
};
|
|
495
|
+
var App_default = App;
|
|
496
|
+
export {
|
|
497
|
+
App_default as default
|
|
498
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
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", "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
|
+
export {
|
|
4
|
+
App_module_default as default
|
|
5
|
+
};
|