@module-federation/devtools 2.7.0 → 2.8.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.
- package/dist/types/App.css +13 -0
- package/dist/types/App.js +519 -0
- package/dist/types/App.module.js +24 -0
- package/dist/types/App_module.css +307 -0
- package/dist/types/component/DependencyGraph/index.js +225 -0
- package/dist/types/component/DependencyGraph/index.module.js +24 -0
- package/dist/types/component/DependencyGraph/index_module.css +100 -0
- package/dist/types/component/DependencyGraphItem/index.js +124 -0
- package/dist/types/component/DependencyGraphItem/index.module.js +24 -0
- package/dist/types/component/DependencyGraphItem/index_module.css +95 -0
- package/dist/types/component/Form/index.js +372 -0
- package/dist/types/component/Form/index.module.js +24 -0
- package/dist/types/component/Form/index_module.css +198 -0
- package/dist/types/component/LanguageSwitch.js +79 -0
- package/dist/types/component/Layout/index.js +471 -0
- package/dist/types/component/Layout/index.module.js +24 -0
- package/dist/types/component/Layout/index_module.css +68 -0
- package/dist/types/component/LoadingTrace/index.js +953 -0
- package/dist/types/component/LoadingTrace/index.module.js +24 -0
- package/dist/types/component/LoadingTrace/index_module.css +876 -0
- package/dist/types/component/ModuleInfo/index.js +342 -0
- package/dist/types/component/ModuleInfo/index.module.js +24 -0
- package/dist/types/component/ModuleInfo/index_module.css +184 -0
- package/dist/types/component/SharedDepsExplorer/FocusResultDisplay.js +64 -0
- package/dist/types/component/SharedDepsExplorer/FocusResultDisplay.module.js +24 -0
- package/dist/types/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
- package/dist/types/component/SharedDepsExplorer/index.js +638 -0
- package/dist/types/component/SharedDepsExplorer/index.module.js +24 -0
- package/dist/types/component/SharedDepsExplorer/index_module.css +467 -0
- package/dist/types/component/SharedDepsExplorer/share-utils.js +252 -0
- package/dist/types/component/ThemeToggle.js +48 -0
- package/dist/types/component/ThemeToggle.module.js +24 -0
- package/dist/types/component/ThemeToggle_module.css +12 -0
- package/dist/types/hooks/useDevtoolsTheme.js +100 -0
- package/dist/types/i18n/index.js +721 -0
- package/dist/types/init.js +8 -0
- package/dist/types/src/App.d.ts +1 -1
- package/dist/types/src/component/DependencyGraph/index.d.ts +1 -1
- package/dist/types/src/component/DependencyGraphItem/index.d.ts +1 -1
- package/dist/types/src/component/Form/index.d.ts +1 -1
- package/dist/types/src/component/LanguageSwitch.d.ts +1 -1
- package/dist/types/src/component/Layout/index.d.ts +1 -1
- package/dist/types/src/component/LoadingTrace/index.d.ts +1 -1
- package/dist/types/src/component/ModuleInfo/index.d.ts +1 -1
- package/dist/types/src/component/SharedDepsExplorer/index.d.ts +1 -1
- package/dist/types/src/i18n/index.d.ts +1 -1
- package/dist/types/src/template/constant.d.ts +1 -1
- package/dist/types/src/utils/chrome/observability.d.ts +1 -1
- package/dist/types/src/utils/data/index.d.ts +1 -1
- package/dist/types/stories/index.stories.d.ts +2 -1
- package/dist/types/template/constant.js +84 -0
- package/dist/types/template/index.js +21 -0
- package/dist/types/utils/chrome/fast-refresh.js +329 -0
- package/dist/types/utils/chrome/index.js +321 -0
- package/dist/types/utils/chrome/messages.js +39 -0
- package/dist/types/utils/chrome/observability-plugin.js +85 -0
- package/dist/types/utils/chrome/observability-shared.js +125 -0
- package/dist/types/utils/chrome/observability.js +233 -0
- package/dist/types/utils/chrome/override-remote.js +17 -0
- package/dist/types/utils/chrome/post-message-init.js +5 -0
- package/dist/types/utils/chrome/post-message-listener.js +36 -0
- package/dist/types/utils/chrome/post-message-start.js +10 -0
- package/dist/types/utils/chrome/post-message.js +91 -0
- package/dist/types/utils/chrome/safe-post-message.js +147 -0
- package/dist/types/utils/chrome/snapshot-plugin.js +17 -0
- package/dist/types/utils/chrome/storage.js +71 -0
- package/dist/types/utils/data/index.js +83 -0
- package/dist/types/utils/index.js +27 -0
- package/dist/types/utils/sdk/graph.js +213 -0
- package/dist/types/utils/sdk/index.js +104 -0
- package/dist/types/utils/types/common.js +15 -0
- package/dist/types/utils/types/index.js +21 -0
- package/dist/types/vendor/basic-proxy-core.js +147 -0
- package/dist/types/worker/index.js +175 -0
- package/package.json +6 -6
|
@@ -0,0 +1,175 @@
|
|
|
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
|
+
var import_messages = require("../utils/chrome/messages");
|
|
38
|
+
const SIDE_PANEL_PATH = "html/main/index.html";
|
|
39
|
+
const getSidePanel = () => chrome == null ? void 0 : chrome.sidePanel;
|
|
40
|
+
const resolveTabId = (tabId) => __async(exports, null, function* () {
|
|
41
|
+
if (typeof tabId === "number") {
|
|
42
|
+
return tabId;
|
|
43
|
+
}
|
|
44
|
+
const [activeTab] = yield chrome.tabs.query({
|
|
45
|
+
active: true,
|
|
46
|
+
lastFocusedWindow: true
|
|
47
|
+
});
|
|
48
|
+
return activeTab == null ? void 0 : activeTab.id;
|
|
49
|
+
});
|
|
50
|
+
const broadcastActiveTab = (tabId, payload) => {
|
|
51
|
+
try {
|
|
52
|
+
chrome.runtime.sendMessage(__spreadValues({
|
|
53
|
+
type: import_messages.MESSAGE_ACTIVE_TAB_CHANGED,
|
|
54
|
+
tabId
|
|
55
|
+
}, payload));
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.warn(
|
|
58
|
+
"[Module Federation Devtools] Failed to broadcast active tab",
|
|
59
|
+
error
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const openSidePanel = (tabId) => __async(exports, null, function* () {
|
|
64
|
+
const sidePanel = getSidePanel();
|
|
65
|
+
if (!sidePanel) {
|
|
66
|
+
throw new Error("sidePanel api not available");
|
|
67
|
+
}
|
|
68
|
+
const targetTabId = yield resolveTabId(tabId);
|
|
69
|
+
if (typeof targetTabId !== "number") {
|
|
70
|
+
throw new Error("No active tab available");
|
|
71
|
+
}
|
|
72
|
+
yield sidePanel.setOptions({
|
|
73
|
+
tabId: targetTabId,
|
|
74
|
+
path: SIDE_PANEL_PATH,
|
|
75
|
+
enabled: true
|
|
76
|
+
});
|
|
77
|
+
if (sidePanel.open) {
|
|
78
|
+
yield sidePanel.open({ tabId: targetTabId });
|
|
79
|
+
}
|
|
80
|
+
broadcastActiveTab(targetTabId, { reason: "side-panel" });
|
|
81
|
+
if (sidePanel.getOptions) {
|
|
82
|
+
try {
|
|
83
|
+
const options = yield sidePanel.getOptions({ tabId: targetTabId });
|
|
84
|
+
broadcastActiveTab(targetTabId, { reason: "side-panel" });
|
|
85
|
+
return options;
|
|
86
|
+
} catch (error) {
|
|
87
|
+
console.warn("[Module Federation Devtools] getOptions failed", error);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
path: SIDE_PANEL_PATH,
|
|
92
|
+
enabled: true
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
chrome.runtime.onInstalled.addListener(() => {
|
|
96
|
+
const sidePanel = getSidePanel();
|
|
97
|
+
if (sidePanel == null ? void 0 : sidePanel.setPanelBehavior) {
|
|
98
|
+
sidePanel.setPanelBehavior({ openPanelOnActionClick: true }).catch((error) => {
|
|
99
|
+
console.warn(
|
|
100
|
+
"[Module Federation Devtools] setPanelBehavior failed",
|
|
101
|
+
error
|
|
102
|
+
);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
chrome.action.onClicked.addListener((tab) => __async(exports, null, function* () {
|
|
107
|
+
try {
|
|
108
|
+
yield openSidePanel(tab.id);
|
|
109
|
+
} catch (error) {
|
|
110
|
+
console.warn(
|
|
111
|
+
"[Module Federation Devtools] Failed to open side panel",
|
|
112
|
+
error
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
}));
|
|
116
|
+
chrome.runtime.onMessage.addListener((message, _sender, sendResponse) => {
|
|
117
|
+
if ((message == null ? void 0 : message.type) === import_messages.MESSAGE_OPEN_SIDE_PANEL) {
|
|
118
|
+
openSidePanel(message.tabId).then((options) => sendResponse({ ok: true, options })).catch(
|
|
119
|
+
(error) => sendResponse({ ok: false, message: String(error) })
|
|
120
|
+
);
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
return void 0;
|
|
124
|
+
});
|
|
125
|
+
chrome.tabs.onActivated.addListener((activeInfo) => __async(exports, null, function* () {
|
|
126
|
+
const tabId = activeInfo == null ? void 0 : activeInfo.tabId;
|
|
127
|
+
if (typeof tabId !== "number") {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
broadcastActiveTab(tabId, { reason: "activated" });
|
|
132
|
+
} catch (error) {
|
|
133
|
+
console.warn(
|
|
134
|
+
"[Module Federation Devtools] Failed to handle tab activation",
|
|
135
|
+
error
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
}));
|
|
139
|
+
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
|
|
140
|
+
if (changeInfo.status !== "loading" && changeInfo.status !== "complete") {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (tab == null ? void 0 : tab.active) {
|
|
144
|
+
try {
|
|
145
|
+
broadcastActiveTab(tabId, {
|
|
146
|
+
reason: "updated",
|
|
147
|
+
status: changeInfo.status
|
|
148
|
+
});
|
|
149
|
+
} catch (error) {
|
|
150
|
+
console.warn(
|
|
151
|
+
"[Module Federation Devtools] Failed to handle tab update",
|
|
152
|
+
error
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
chrome.tabs.onRemoved.addListener((tabId) => __async(exports, null, function* () {
|
|
158
|
+
try {
|
|
159
|
+
const FormID = "FormID";
|
|
160
|
+
const data = yield chrome.storage.sync.get(FormID);
|
|
161
|
+
const storeData = data[FormID];
|
|
162
|
+
if (storeData == null ? void 0 : storeData[String(tabId)]) {
|
|
163
|
+
delete storeData[String(tabId)];
|
|
164
|
+
yield chrome.storage.sync.set({
|
|
165
|
+
[FormID]: storeData
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
} catch (error) {
|
|
169
|
+
console.warn(
|
|
170
|
+
"[Module Federation Devtools] Failed to handle tab removal",
|
|
171
|
+
error
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
}));
|
|
175
|
+
console.log("Module Federation Worker ready");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/devtools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"echarts-for-react": "3.0.5",
|
|
48
48
|
"i18next": "23.0.0",
|
|
49
49
|
"react-i18next": "15.0.0",
|
|
50
|
-
"@module-federation/
|
|
51
|
-
"@module-federation/
|
|
50
|
+
"@module-federation/sdk": "2.8.0",
|
|
51
|
+
"@module-federation/observability-plugin": "2.5.4"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"react": "^18 || ^19",
|
|
@@ -79,10 +79,10 @@
|
|
|
79
79
|
"@types/react-dom": "^19.2.2",
|
|
80
80
|
"lint-staged": "~13.1.0",
|
|
81
81
|
"prettier": "~3.3.3",
|
|
82
|
-
"typescript": "
|
|
82
|
+
"typescript": "7.0.2",
|
|
83
83
|
"rimraf": "~6.0.1",
|
|
84
84
|
"vitest": "1.2.2",
|
|
85
|
-
"@module-federation/runtime": "2.
|
|
85
|
+
"@module-federation/runtime": "2.8.0"
|
|
86
86
|
},
|
|
87
87
|
"scripts": {
|
|
88
88
|
"build:storybook": "storybook build",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"build:devtool": "modern-app build && node postpack.js",
|
|
93
93
|
"build": "npm run build:lib",
|
|
94
94
|
"build:debug": "DEBUG=true modern-app build && node postpack.js",
|
|
95
|
-
"build:lib": "rm -rf dist && modern-module build -c modern.lib.config.ts",
|
|
95
|
+
"build:lib": "rm -rf dist && modern-module build -c modern.lib.config.ts && tsc -p tsconfig.lib.json",
|
|
96
96
|
"release": "npm publish --tag canary",
|
|
97
97
|
"test": "rstest",
|
|
98
98
|
"test:e2e": "node ../../scripts/ensure-playwright.js && E2ETEST=true pnpm build:devtool && playwright test",
|