@module-federation/devtools 2.4.0 → 2.5.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/README.md +3 -0
- package/dist/es/App.js +17 -2
- package/dist/es/App_module.css +3 -3
- 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/i18n/index.js +178 -0
- package/dist/es/utils/chrome/index.js +3 -4
- package/dist/es/utils/chrome/messages.js +7 -1
- 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 -42
- package/dist/es/utils/chrome/post-message-listener.js +14 -0
- package/dist/es/utils/chrome/snapshot-plugin.js +2 -36
- package/dist/es/utils/data/index.js +5 -25
- package/dist/es/vendor/basic-proxy-core.js +155 -0
- package/dist/es/worker/index.js +27 -8
- package/dist/lib/App.js +17 -2
- package/dist/lib/App_module.css +3 -3
- package/dist/lib/component/LoadingTrace/index.js +954 -0
- package/dist/lib/component/LoadingTrace/index.module.js +25 -0
- package/dist/lib/component/LoadingTrace/index_module.css +876 -0
- package/dist/lib/i18n/index.js +178 -0
- package/dist/lib/utils/chrome/index.js +3 -4
- package/dist/lib/utils/chrome/messages.js +11 -2
- package/dist/lib/utils/chrome/observability-plugin.js +86 -0
- package/dist/lib/utils/chrome/observability-shared.js +126 -0
- package/dist/lib/utils/chrome/observability.js +234 -0
- package/dist/lib/utils/chrome/override-remote.js +5 -52
- package/dist/lib/utils/chrome/post-message-listener.js +11 -0
- package/dist/lib/utils/chrome/snapshot-plugin.js +5 -46
- package/dist/lib/utils/data/index.js +6 -28
- package/dist/lib/vendor/basic-proxy-core.js +147 -0
- package/dist/lib/worker/index.js +27 -8
- package/dist/types/src/component/LoadingTrace/index.d.ts +6 -0
- package/dist/types/src/utils/chrome/messages.d.ts +3 -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/snapshot-plugin.d.ts +0 -3
- package/dist/types/src/utils/data/index.d.ts +0 -1
- package/package.json +4 -3
- package/dist/es/utils/data/snapshot.js +0 -82
- package/dist/lib/utils/data/snapshot.js +0 -107
- package/dist/types/src/utils/data/snapshot.d.ts +0 -3
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import { sanitizePostMessagePayload } from "./safe-post-message";
|
|
2
|
+
import {
|
|
3
|
+
MESSAGE_OBSERVABILITY_DEVTOOLS_EVENT,
|
|
4
|
+
OBSERVABILITY_DEVTOOLS_SOURCE
|
|
5
|
+
} from "./messages";
|
|
2
6
|
if (window.moduleHandler) {
|
|
3
7
|
window.removeEventListener("message", window.moduleHandler);
|
|
4
8
|
} else {
|
|
5
9
|
window.moduleHandler = (event) => {
|
|
6
10
|
const { origin, data } = event;
|
|
11
|
+
if ((data == null ? void 0 : data.source) === OBSERVABILITY_DEVTOOLS_SOURCE) {
|
|
12
|
+
chrome.runtime.sendMessage({
|
|
13
|
+
type: MESSAGE_OBSERVABILITY_DEVTOOLS_EVENT,
|
|
14
|
+
origin,
|
|
15
|
+
data: sanitizePostMessagePayload(data)
|
|
16
|
+
}).catch(() => {
|
|
17
|
+
return false;
|
|
18
|
+
});
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
7
21
|
if (!data.moduleInfo) {
|
|
8
22
|
return;
|
|
9
23
|
}
|
|
@@ -1,36 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import runtimeHelpers from "@module-federation/runtime/helpers";
|
|
4
|
-
import { definePropertyGlobalVal } from "../sdk";
|
|
5
|
-
const chromeDevtoolsPlugin = function() {
|
|
6
|
-
return {
|
|
7
|
-
name: "mf-chrome-devtools-inject-snapshot-plugin",
|
|
8
|
-
beforeLoadRemoteSnapshot({ options }) {
|
|
9
|
-
const { nativeGlobal } = runtimeHelpers.global;
|
|
10
|
-
if (!options || options.inBrowser) {
|
|
11
|
-
const realLocalStorage = nativeGlobal.localStorage || localStorage;
|
|
12
|
-
const debugModuleInfoStr = realLocalStorage.getItem(
|
|
13
|
-
MODULE_DEVTOOL_IDENTIFIER
|
|
14
|
-
);
|
|
15
|
-
if (debugModuleInfoStr && !nativeGlobal.__INIT_VMOK_CHROME_DEVTOOL_PLUGIN__) {
|
|
16
|
-
const chromeDevtoolSnapshot = JSON.parse(debugModuleInfoStr);
|
|
17
|
-
if (chromeDevtoolSnapshot) {
|
|
18
|
-
runtimeHelpers.global.addGlobalSnapshot(chromeDevtoolSnapshot);
|
|
19
|
-
nativeGlobal.__INIT_VMOK_CHROME_DEVTOOL_PLUGIN__ = true;
|
|
20
|
-
console.warn(
|
|
21
|
-
"[Module Federation Devtools]: You are using the chrome devtool to proxy online module"
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
if (!(window == null ? void 0 : window.__FEDERATION__)) {
|
|
30
|
-
definePropertyGlobalVal(window, "__FEDERATION__", {});
|
|
31
|
-
definePropertyGlobalVal(window, "__VMOK__", window.__FEDERATION__);
|
|
32
|
-
}
|
|
33
|
-
if (!(window == null ? void 0 : window.__FEDERATION__.__GLOBAL_PLUGIN__)) {
|
|
34
|
-
window.__FEDERATION__.__GLOBAL_PLUGIN__ = [];
|
|
35
|
-
}
|
|
36
|
-
(_a = window.__FEDERATION__.__GLOBAL_PLUGIN__) == null ? void 0 : _a.push(chromeDevtoolsPlugin());
|
|
1
|
+
const basicProxyCore = require("../../vendor/basic-proxy-core.js");
|
|
2
|
+
basicProxyCore.registerSnapshotPlugin(globalThis);
|
|
@@ -18,7 +18,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
18
18
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
const basicProxyCore = require("../../vendor/basic-proxy-core.js");
|
|
22
22
|
const separateType = (moduleInfo) => {
|
|
23
23
|
const consumers = {};
|
|
24
24
|
const producer = [];
|
|
@@ -48,31 +48,11 @@ const separateType = (moduleInfo) => {
|
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
const getModuleInfo = (proxyRules) => __async(void 0, null, function* () {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const isMicroMode = Object.keys(consumers).some((moduleId) => {
|
|
56
|
-
const subApps = consumers[moduleId].consumerList;
|
|
57
|
-
return Array.isArray(subApps) && subApps.length;
|
|
58
|
-
});
|
|
59
|
-
proxyRules.forEach((rule) => {
|
|
60
|
-
const { key, value } = rule;
|
|
61
|
-
overrides[key] = value;
|
|
62
|
-
});
|
|
63
|
-
if (isMicroMode) {
|
|
64
|
-
freshModuleInfo = calculateMicroAppSnapshot(moduleInfo, overrides);
|
|
65
|
-
} else {
|
|
66
|
-
freshModuleInfo = calculateSnapshot(moduleInfo, overrides);
|
|
67
|
-
}
|
|
68
|
-
console.debug("New Snapshot: ", freshModuleInfo);
|
|
69
|
-
return {
|
|
70
|
-
status: "success",
|
|
71
|
-
moduleInfo: freshModuleInfo,
|
|
72
|
-
overrides
|
|
73
|
-
};
|
|
51
|
+
return basicProxyCore.getModuleInfo(
|
|
52
|
+
proxyRules,
|
|
53
|
+
window.__FEDERATION__.moduleInfo
|
|
54
|
+
);
|
|
74
55
|
});
|
|
75
|
-
export * from "./snapshot";
|
|
76
56
|
export {
|
|
77
57
|
getModuleInfo,
|
|
78
58
|
separateType
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
3
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
4
|
+
};
|
|
5
|
+
var require_basic_proxy_core = __commonJS({
|
|
6
|
+
"src/vendor/basic-proxy-core.js"(exports) {
|
|
7
|
+
var P = "__MF_DEVTOOLS_MODULE_INFO__", f = "__MF_DEVTOOLS__", G = "MF_ENV", h = "mf-chrome-devtools-inject-snapshot-plugin", L = "mf-chrome-devtools-override-remotes-plugin", l = () => globalThis, y = (e) => Object.prototype.toString.call(e) === "[object Object]", O = (e) => JSON.parse(JSON.stringify(e || {})), d = (e, t, o) => {
|
|
8
|
+
if (Object.prototype.hasOwnProperty.call(e, t)) {
|
|
9
|
+
e[t] = o;
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(e, t, { value: o, configurable: false, writable: true });
|
|
13
|
+
}, g = (e = l()) => {
|
|
14
|
+
!e.__FEDERATION__ && e.__VMOK__ && d(e, "__FEDERATION__", e.__VMOK__), e.__FEDERATION__ || d(e, "__FEDERATION__", {}), e.__VMOK__ || d(e, "__VMOK__", e.__FEDERATION__);
|
|
15
|
+
let t = e.__FEDERATION__;
|
|
16
|
+
return Array.isArray(t.__GLOBAL_PLUGIN__) || (t.__GLOBAL_PLUGIN__ = []), y(t.moduleInfo) || (t.moduleInfo = {}), t;
|
|
17
|
+
}, p = (e, t) => {
|
|
18
|
+
if (!e)
|
|
19
|
+
return t;
|
|
20
|
+
try {
|
|
21
|
+
return JSON.parse(e);
|
|
22
|
+
} catch (o) {
|
|
23
|
+
return t;
|
|
24
|
+
}
|
|
25
|
+
}, x = (e = l()) => {
|
|
26
|
+
var t;
|
|
27
|
+
return e.localStorage || ((t = e.window) == null ? void 0 : t.localStorage);
|
|
28
|
+
}, M = (e = l()) => {
|
|
29
|
+
let t = x(e);
|
|
30
|
+
return t ? p(t.getItem(P), null) : null;
|
|
31
|
+
}, I = (e) => {
|
|
32
|
+
let t = {};
|
|
33
|
+
return y(e) && Object.keys(e).forEach((o) => {
|
|
34
|
+
typeof e[o] == "string" && e[o] && (t[o] = e[o]);
|
|
35
|
+
}), t;
|
|
36
|
+
}, N = (e = l()) => {
|
|
37
|
+
let t = x(e);
|
|
38
|
+
if (!t)
|
|
39
|
+
return {};
|
|
40
|
+
let o = p(t.getItem(f), {});
|
|
41
|
+
return y(o.overrides) ? I(o.overrides) : I(o);
|
|
42
|
+
}, S = (e) => e.indexOf("http://") === 0 || e.indexOf("https://") === 0 || e.indexOf("//") === 0, m = (e, t) => {
|
|
43
|
+
Reflect.deleteProperty(e, t);
|
|
44
|
+
}, T = (e) => {
|
|
45
|
+
let t = {}, o = [];
|
|
46
|
+
return Object.keys(e || {}).forEach((s) => {
|
|
47
|
+
var r;
|
|
48
|
+
let i = (r = e[s]) == null ? void 0 : r.remotesInfo;
|
|
49
|
+
if (i) {
|
|
50
|
+
let n = Object.keys(i);
|
|
51
|
+
n.length && (n.forEach((c) => {
|
|
52
|
+
let a = c;
|
|
53
|
+
c.indexOf(":") !== -1 && (a = c.split(":").pop()), o.indexOf(a) === -1 && o.push(c);
|
|
54
|
+
}), t[s] = e[s]);
|
|
55
|
+
}
|
|
56
|
+
}), { consumers: t, producer: o };
|
|
57
|
+
}, R = (e, t) => {
|
|
58
|
+
let o = Object.keys(t || {}).reduce((i, r) => (r.indexOf(":") !== -1 && (i[r.split(":")[1]] = t[r]), i), {}), s = O(e);
|
|
59
|
+
return Object.keys(e || {}).forEach((i) => {
|
|
60
|
+
let r = e[i];
|
|
61
|
+
r != null && r.remotesInfo && Object.keys(r.remotesInfo).forEach((n) => {
|
|
62
|
+
let c = n.split(":")[1], a = t[n] || o[n] || t[c] || o[c];
|
|
63
|
+
a && (s[i].remotesInfo[n].matchedVersion = a, s[`${n}:${a}`] = { remoteEntry: a, version: a });
|
|
64
|
+
});
|
|
65
|
+
}), s;
|
|
66
|
+
}, v = (e, t) => {
|
|
67
|
+
let o = null, s = O(e);
|
|
68
|
+
if (Object.keys(e || {}).forEach((r) => {
|
|
69
|
+
let n = s[r];
|
|
70
|
+
n && Array.isArray(n.consumerList) && n.consumerList.length > 0 && (o = n);
|
|
71
|
+
}), !o)
|
|
72
|
+
return s;
|
|
73
|
+
let i = o.consumerList;
|
|
74
|
+
for (let r = 0; r < i.length; r++) {
|
|
75
|
+
let n = "", c = i[r];
|
|
76
|
+
if (Object.keys(t || {}).find((_) => {
|
|
77
|
+
let u = _;
|
|
78
|
+
return _.indexOf(":") !== -1 && (u = _.split(":")[1]), c.indexOf(u) !== -1 ? (n = _, true) : false;
|
|
79
|
+
})) {
|
|
80
|
+
let _ = t[n], u = c.split(":");
|
|
81
|
+
u[u.length - 1] = _, i[r] = u.join(":"), s[`${n}:${_}`] = { remoteEntry: _, version: _ };
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return R(s, t);
|
|
85
|
+
}, F = (e = [], t) => {
|
|
86
|
+
var n;
|
|
87
|
+
let o = t || ((n = l().__FEDERATION__) == null ? void 0 : n.moduleInfo) || {}, s = {}, { consumers: i } = T(o), r = Object.keys(i).some((c) => {
|
|
88
|
+
var _;
|
|
89
|
+
let a = (_ = i[c]) == null ? void 0 : _.consumerList;
|
|
90
|
+
return Array.isArray(a) && a.length > 0;
|
|
91
|
+
});
|
|
92
|
+
return e.forEach((c) => {
|
|
93
|
+
c != null && c.key && (c != null && c.value) && (s[c.key] = c.value);
|
|
94
|
+
}), { status: "success", moduleInfo: r ? v(o, s) : R(o, s), overrides: s };
|
|
95
|
+
}, E = (e = l()) => {
|
|
96
|
+
let t = e, o = false;
|
|
97
|
+
return { name: h, beforeLoadRemoteSnapshot: (s) => {
|
|
98
|
+
var c;
|
|
99
|
+
let i = s == null ? void 0 : s.options;
|
|
100
|
+
if (i && i.inBrowser === false)
|
|
101
|
+
return;
|
|
102
|
+
let r = M(t);
|
|
103
|
+
if (!r || o)
|
|
104
|
+
return;
|
|
105
|
+
let n = g(t);
|
|
106
|
+
n.moduleInfo = Object.assign({}, n.moduleInfo || {}, r), o = true, (c = t.console) == null || c.warn("[Module Federation Devtools]: You are using the chrome devtool to proxy online module");
|
|
107
|
+
} };
|
|
108
|
+
}, B = (e = l()) => {
|
|
109
|
+
let t = e;
|
|
110
|
+
return { name: L, beforeRegisterRemote: (o) => {
|
|
111
|
+
var s;
|
|
112
|
+
try {
|
|
113
|
+
let i = o == null ? void 0 : o.remote;
|
|
114
|
+
if (!i)
|
|
115
|
+
return o;
|
|
116
|
+
let r = N(t), n = r[i.name] || r[i.alias || ""];
|
|
117
|
+
if (!n)
|
|
118
|
+
return o;
|
|
119
|
+
S(n) ? (m(i, "version"), i.entry = n) : (m(i, "entry"), i.version = n);
|
|
120
|
+
} catch (i) {
|
|
121
|
+
(s = t.console) == null || s.error(i);
|
|
122
|
+
}
|
|
123
|
+
return o;
|
|
124
|
+
} };
|
|
125
|
+
}, b = (e = l()) => {
|
|
126
|
+
let t = g(e);
|
|
127
|
+
return [B(e), E(e)].forEach((s) => {
|
|
128
|
+
var r, n;
|
|
129
|
+
((r = t.__GLOBAL_PLUGIN__) == null ? void 0 : r.some((c) => c.name === s.name)) || (n = t.__GLOBAL_PLUGIN__) == null || n.push(s);
|
|
130
|
+
}), t.__GLOBAL_PLUGIN__ || [];
|
|
131
|
+
}, A = (e, t) => {
|
|
132
|
+
var r, n;
|
|
133
|
+
let o = g(e), s = t(e);
|
|
134
|
+
return ((r = o.__GLOBAL_PLUGIN__) == null ? void 0 : r.some((c) => c.name === s.name)) || (n = o.__GLOBAL_PLUGIN__) == null || n.push(s), s;
|
|
135
|
+
}, k = (e = l()) => A(e, B), D = (e = l()) => A(e, E), V = (e = l()) => {
|
|
136
|
+
let t = x(e);
|
|
137
|
+
if (!t)
|
|
138
|
+
return;
|
|
139
|
+
t.removeItem(P), t.removeItem(G);
|
|
140
|
+
let o = p(t.getItem(f), {});
|
|
141
|
+
y(o) && (m(o, "overrides"), Object.keys(o).length ? t.setItem(f, JSON.stringify(o)) : t.removeItem(f));
|
|
142
|
+
};
|
|
143
|
+
exports.calculateMicroAppSnapshot = v;
|
|
144
|
+
exports.calculateSnapshot = R;
|
|
145
|
+
exports.createOverridePlugin = B;
|
|
146
|
+
exports.createSnapshotPlugin = E;
|
|
147
|
+
exports.getModuleInfo = F;
|
|
148
|
+
exports.registerOverridePlugin = k;
|
|
149
|
+
exports.registerRuntimePlugins = b;
|
|
150
|
+
exports.registerSnapshotPlugin = D;
|
|
151
|
+
exports.resetProxyStorage = V;
|
|
152
|
+
exports.separateType = T;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
export default require_basic_proxy_core();
|
package/dist/es/worker/index.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
1
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
+
var __spreadValues = (a, b) => {
|
|
8
|
+
for (var prop in b || (b = {}))
|
|
9
|
+
if (__hasOwnProp.call(b, prop))
|
|
10
|
+
__defNormalProp(a, prop, b[prop]);
|
|
11
|
+
if (__getOwnPropSymbols)
|
|
12
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
+
if (__propIsEnum.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
}
|
|
16
|
+
return a;
|
|
17
|
+
};
|
|
2
18
|
var __commonJS = (cb, mod) => function __require() {
|
|
3
19
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
4
20
|
};
|
|
@@ -40,12 +56,12 @@ var require_worker = __commonJS({
|
|
|
40
56
|
});
|
|
41
57
|
return activeTab == null ? void 0 : activeTab.id;
|
|
42
58
|
});
|
|
43
|
-
const broadcastActiveTab = (tabId) => {
|
|
59
|
+
const broadcastActiveTab = (tabId, payload) => {
|
|
44
60
|
try {
|
|
45
|
-
chrome.runtime.sendMessage({
|
|
61
|
+
chrome.runtime.sendMessage(__spreadValues({
|
|
46
62
|
type: MESSAGE_ACTIVE_TAB_CHANGED,
|
|
47
63
|
tabId
|
|
48
|
-
});
|
|
64
|
+
}, payload));
|
|
49
65
|
} catch (error) {
|
|
50
66
|
console.warn(
|
|
51
67
|
"[Module Federation Devtools] Failed to broadcast active tab",
|
|
@@ -70,11 +86,11 @@ var require_worker = __commonJS({
|
|
|
70
86
|
if (sidePanel.open) {
|
|
71
87
|
yield sidePanel.open({ tabId: targetTabId });
|
|
72
88
|
}
|
|
73
|
-
broadcastActiveTab(targetTabId);
|
|
89
|
+
broadcastActiveTab(targetTabId, { reason: "side-panel" });
|
|
74
90
|
if (sidePanel.getOptions) {
|
|
75
91
|
try {
|
|
76
92
|
const options = yield sidePanel.getOptions({ tabId: targetTabId });
|
|
77
|
-
broadcastActiveTab(targetTabId);
|
|
93
|
+
broadcastActiveTab(targetTabId, { reason: "side-panel" });
|
|
78
94
|
return options;
|
|
79
95
|
} catch (error) {
|
|
80
96
|
console.warn("[Module Federation Devtools] getOptions failed", error);
|
|
@@ -121,7 +137,7 @@ var require_worker = __commonJS({
|
|
|
121
137
|
return;
|
|
122
138
|
}
|
|
123
139
|
try {
|
|
124
|
-
broadcastActiveTab(tabId);
|
|
140
|
+
broadcastActiveTab(tabId, { reason: "activated" });
|
|
125
141
|
} catch (error) {
|
|
126
142
|
console.warn(
|
|
127
143
|
"[Module Federation Devtools] Failed to handle tab activation",
|
|
@@ -130,12 +146,15 @@ var require_worker = __commonJS({
|
|
|
130
146
|
}
|
|
131
147
|
}));
|
|
132
148
|
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
|
|
133
|
-
if (changeInfo.status !== "complete") {
|
|
149
|
+
if (changeInfo.status !== "loading" && changeInfo.status !== "complete") {
|
|
134
150
|
return;
|
|
135
151
|
}
|
|
136
152
|
if (tab == null ? void 0 : tab.active) {
|
|
137
153
|
try {
|
|
138
|
-
broadcastActiveTab(tabId
|
|
154
|
+
broadcastActiveTab(tabId, {
|
|
155
|
+
reason: "updated",
|
|
156
|
+
status: changeInfo.status
|
|
157
|
+
});
|
|
139
158
|
} catch (error) {
|
|
140
159
|
console.warn(
|
|
141
160
|
"[Module Federation Devtools] Failed to handle tab update",
|
package/dist/lib/App.js
CHANGED
|
@@ -77,6 +77,7 @@ var import_Layout = __toESM(require("./component/Layout"));
|
|
|
77
77
|
var import_DependencyGraph = __toESM(require("./component/DependencyGraph"));
|
|
78
78
|
var import_ModuleInfo = __toESM(require("./component/ModuleInfo"));
|
|
79
79
|
var import_SharedDepsExplorer = __toESM(require("./component/SharedDepsExplorer"));
|
|
80
|
+
var import_LoadingTrace = __toESM(require("./component/LoadingTrace"));
|
|
80
81
|
var import_LanguageSwitch = __toESM(require("./component/LanguageSwitch"));
|
|
81
82
|
var import_ThemeToggle = __toESM(require("./component/ThemeToggle"));
|
|
82
83
|
var import_utils = require("./utils");
|
|
@@ -145,6 +146,7 @@ const NAV_ITEMS = [
|
|
|
145
146
|
{ key: "proxy", i18nKey: "app.nav.proxy" },
|
|
146
147
|
{ key: "dependency", i18nKey: "app.nav.dependency" },
|
|
147
148
|
{ key: "share", i18nKey: "app.nav.share" },
|
|
149
|
+
{ key: "loadingTrace", i18nKey: "app.nav.loadingTrace" },
|
|
148
150
|
{ key: "performance", i18nKey: "app.nav.performance" }
|
|
149
151
|
];
|
|
150
152
|
const THEME_STORAGE_KEY = "mf-devtools-theme";
|
|
@@ -177,6 +179,7 @@ const InnerApp = (props) => {
|
|
|
177
179
|
const [inspectedTab, setInspectedTab] = (0, import_react.useState)(
|
|
178
180
|
window.targetTab
|
|
179
181
|
);
|
|
182
|
+
const [inspectedTabRefreshKey, setInspectedTabRefreshKey] = (0, import_react.useState)(0);
|
|
180
183
|
const [activePanel, setActivePanel] = (0, import_react.useState)("proxy");
|
|
181
184
|
const [selectedModuleId, setSelectedModuleId] = (0, import_react.useState)(null);
|
|
182
185
|
const [refreshing, setRefreshing] = (0, import_react.useState)(false);
|
|
@@ -284,10 +287,14 @@ const InnerApp = (props) => {
|
|
|
284
287
|
};
|
|
285
288
|
}, [applyModuleUpdate]);
|
|
286
289
|
(0, import_react.useEffect)(() => {
|
|
287
|
-
const updateActiveTab = (tabId) => __async(void 0, null, function* () {
|
|
290
|
+
const updateActiveTab = (tabId, options) => __async(void 0, null, function* () {
|
|
288
291
|
var _a, _b;
|
|
289
292
|
const tab = yield (0, import_utils.syncActiveTab)(tabId);
|
|
290
293
|
setInspectedTab(tab || void 0);
|
|
294
|
+
if ((options == null ? void 0 : options.status) === "loading") {
|
|
295
|
+
setInspectedTabRefreshKey((key) => key + 1);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
291
298
|
if ((_a = window.__FEDERATION__) == null ? void 0 : _a.moduleInfo) {
|
|
292
299
|
applyModuleUpdate(cloneModuleInfo((_b = window.__FEDERATION__) == null ? void 0 : _b.moduleInfo));
|
|
293
300
|
}
|
|
@@ -295,7 +302,7 @@ const InnerApp = (props) => {
|
|
|
295
302
|
});
|
|
296
303
|
const onMessage = (message, _sender, _sendResponse) => {
|
|
297
304
|
if ((message == null ? void 0 : message.type) === import_messages.MESSAGE_ACTIVE_TAB_CHANGED) {
|
|
298
|
-
updateActiveTab(message.tabId);
|
|
305
|
+
updateActiveTab(message.tabId, { status: message.status });
|
|
299
306
|
}
|
|
300
307
|
};
|
|
301
308
|
chrome.runtime.onMessage.addListener(onMessage);
|
|
@@ -423,6 +430,14 @@ const InnerApp = (props) => {
|
|
|
423
430
|
)
|
|
424
431
|
}
|
|
425
432
|
);
|
|
433
|
+
case "loadingTrace":
|
|
434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
435
|
+
import_LoadingTrace.default,
|
|
436
|
+
{
|
|
437
|
+
tabId: inspectedTab == null ? void 0 : inspectedTab.id,
|
|
438
|
+
resetKey: inspectedTabRefreshKey
|
|
439
|
+
}
|
|
440
|
+
);
|
|
426
441
|
case "performance":
|
|
427
442
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_App2.default.placeholder, children: t("app.performance.placeholder") });
|
|
428
443
|
default:
|
package/dist/lib/App_module.css
CHANGED
|
@@ -76,10 +76,10 @@ body[arco-theme=dark] {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
.activeTab_ae2ee {
|
|
79
|
-
border-color: rgba(
|
|
80
|
-
background: linear-gradient(135deg, rgba(
|
|
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
81
|
color: var(--color-text-1, #1e293b);
|
|
82
|
-
box-shadow: 0 12px 28px rgba(
|
|
82
|
+
box-shadow: 0 12px 28px rgba(24, 24, 27, 0.14);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
.panel_ae2ee {
|