@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.
- package/README.md +3 -0
- package/dist/es/App.css +6 -5
- package/dist/es/App.js +211 -63
- package/dist/es/App.module.js +1 -1
- package/dist/es/App_module.css +41 -39
- package/dist/es/component/DependencyGraph/index.js +11 -12
- package/dist/es/component/DependencyGraph/index_module.css +20 -17
- package/dist/es/component/DependencyGraphItem/index.js +23 -10
- package/dist/es/component/DependencyGraphItem/index_module.css +7 -7
- package/dist/es/component/Form/index.js +24 -31
- package/dist/es/component/Form/index.module.js +1 -1
- package/dist/es/component/Form/index_module.css +22 -25
- package/dist/es/component/LanguageSwitch.js +50 -0
- package/dist/es/component/Layout/index.js +27 -10
- package/dist/es/component/Layout/index_module.css +7 -7
- 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 +65 -41
- package/dist/es/component/ModuleInfo/index_module.css +12 -11
- package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.js +5 -3
- package/dist/es/component/SharedDepsExplorer/FocusResultDisplay_module.css +5 -5
- package/dist/es/component/SharedDepsExplorer/index.js +223 -96
- package/dist/es/component/SharedDepsExplorer/index_module.css +12 -2
- package/dist/es/component/SharedDepsExplorer/share-utils.js +21 -5
- 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/utils/chrome/fast-refresh.js +297 -173
- package/dist/es/utils/chrome/index.js +42 -22
- 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 +7 -0
- package/dist/es/utils/chrome/post-message-listener.js +22 -4
- package/dist/es/utils/chrome/post-message-start.js +4 -10
- package/dist/es/utils/chrome/post-message.js +12 -3
- package/dist/es/utils/chrome/resolve-basic-proxy-core.js +4 -0
- package/dist/es/utils/chrome/safe-post-message.js +124 -0
- package/dist/es/utils/chrome/snapshot-plugin.js +2 -36
- package/dist/es/utils/data/index.js +5 -25
- package/dist/es/utils/sdk/graph.js +25 -11
- package/dist/es/vendor/basic-proxy-core.js +155 -0
- package/dist/es/worker/index.js +27 -8
- package/dist/lib/App.css +6 -5
- package/dist/lib/App.js +208 -64
- package/dist/lib/App.module.js +1 -2
- package/dist/lib/App_module.css +41 -39
- package/dist/lib/component/DependencyGraph/index.js +11 -13
- package/dist/lib/component/DependencyGraph/index.module.js +0 -1
- package/dist/lib/component/DependencyGraph/index_module.css +20 -17
- package/dist/lib/component/DependencyGraphItem/index.js +23 -11
- package/dist/lib/component/DependencyGraphItem/index.module.js +0 -1
- package/dist/lib/component/DependencyGraphItem/index_module.css +7 -7
- package/dist/lib/component/Form/index.js +24 -32
- package/dist/lib/component/Form/index.module.js +1 -2
- package/dist/lib/component/Form/index_module.css +22 -25
- package/dist/lib/component/LanguageSwitch.js +79 -0
- package/dist/lib/component/Layout/index.js +27 -11
- package/dist/lib/component/Layout/index.module.js +0 -1
- package/dist/lib/component/Layout/index_module.css +7 -7
- 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 +65 -42
- package/dist/lib/component/ModuleInfo/index.module.js +0 -1
- package/dist/lib/component/ModuleInfo/index_module.css +12 -11
- package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.js +5 -4
- package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.module.js +0 -1
- package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay_module.css +5 -5
- package/dist/lib/component/SharedDepsExplorer/index.js +217 -95
- package/dist/lib/component/SharedDepsExplorer/index.module.js +0 -1
- package/dist/lib/component/SharedDepsExplorer/index_module.css +12 -2
- package/dist/lib/component/SharedDepsExplorer/share-utils.js +21 -6
- 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 +0 -1
- package/dist/lib/template/constant.js +0 -1
- package/dist/lib/template/index.js +0 -1
- package/dist/lib/utils/chrome/fast-refresh.js +250 -136
- package/dist/lib/utils/chrome/index.js +43 -23
- package/dist/lib/utils/chrome/messages.js +11 -3
- 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 +20 -0
- package/dist/lib/utils/chrome/post-message-init.js +0 -1
- package/dist/lib/utils/chrome/post-message-listener.js +19 -5
- package/dist/lib/utils/chrome/post-message-start.js +4 -11
- package/dist/lib/utils/chrome/post-message.js +12 -4
- package/dist/lib/utils/chrome/resolve-basic-proxy-core.js +27 -0
- package/dist/lib/utils/chrome/safe-post-message.js +147 -0
- package/dist/lib/utils/chrome/snapshot-plugin.js +5 -47
- package/dist/lib/utils/chrome/storage.js +0 -1
- package/dist/lib/utils/data/index.js +6 -29
- package/dist/lib/utils/index.js +0 -1
- package/dist/lib/utils/sdk/graph.js +25 -12
- package/dist/lib/utils/sdk/index.js +0 -1
- package/dist/lib/utils/types/common.js +0 -1
- package/dist/lib/utils/types/index.js +0 -1
- package/dist/lib/vendor/basic-proxy-core.js +147 -0
- package/dist/lib/worker/index.js +27 -9
- 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 +635 -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 +2 -0
- package/dist/types/src/component/Layout/index.d.ts +1 -1
- package/dist/types/src/component/LoadingTrace/index.d.ts +6 -0
- 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/component/SharedDepsExplorer/share-utils.d.ts +3 -2
- 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/template/constant.d.ts +1 -1
- package/dist/types/src/utils/chrome/index.d.ts +2 -1
- 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/override-remote.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 -1
- package/dist/types/src/utils/chrome/resolve-basic-proxy-core.d.ts +6 -0
- package/dist/types/src/utils/chrome/safe-post-message.d.ts +1 -0
- package/dist/types/src/utils/chrome/snapshot-plugin.d.ts +0 -3
- package/dist/types/src/utils/data/index.d.ts +1 -2
- package/dist/types/src/utils/sdk/graph.d.ts +1 -1
- package/dist/types/src/utils/sdk/index.d.ts +2 -2
- 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 +20 -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/resolve-basic-proxy-core.js +27 -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/install-deps.bash +7 -3
- package/package.json +47 -28
- 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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
__reExport(types_exports, require("./common"), module.exports);
|
|
18
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
19
|
+
0 && (module.exports = {
|
|
20
|
+
...require("./common")
|
|
21
|
+
});
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
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) => {
|
|
3
|
+
if (Object.prototype.hasOwnProperty.call(e, t)) {
|
|
4
|
+
e[t] = o;
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
Object.defineProperty(e, t, { value: o, configurable: false, writable: true });
|
|
8
|
+
}, g = (e = l()) => {
|
|
9
|
+
!e.__FEDERATION__ && e.__VMOK__ && d(e, "__FEDERATION__", e.__VMOK__), e.__FEDERATION__ || d(e, "__FEDERATION__", {}), e.__VMOK__ || d(e, "__VMOK__", e.__FEDERATION__);
|
|
10
|
+
let t = e.__FEDERATION__;
|
|
11
|
+
return Array.isArray(t.__GLOBAL_PLUGIN__) || (t.__GLOBAL_PLUGIN__ = []), y(t.moduleInfo) || (t.moduleInfo = {}), t;
|
|
12
|
+
}, p = (e, t) => {
|
|
13
|
+
if (!e)
|
|
14
|
+
return t;
|
|
15
|
+
try {
|
|
16
|
+
return JSON.parse(e);
|
|
17
|
+
} catch (o) {
|
|
18
|
+
return t;
|
|
19
|
+
}
|
|
20
|
+
}, x = (e = l()) => {
|
|
21
|
+
var t;
|
|
22
|
+
return e.localStorage || ((t = e.window) == null ? void 0 : t.localStorage);
|
|
23
|
+
}, M = (e = l()) => {
|
|
24
|
+
let t = x(e);
|
|
25
|
+
return t ? p(t.getItem(P), null) : null;
|
|
26
|
+
}, I = (e) => {
|
|
27
|
+
let t = {};
|
|
28
|
+
return y(e) && Object.keys(e).forEach((o) => {
|
|
29
|
+
typeof e[o] == "string" && e[o] && (t[o] = e[o]);
|
|
30
|
+
}), t;
|
|
31
|
+
}, N = (e = l()) => {
|
|
32
|
+
let t = x(e);
|
|
33
|
+
if (!t)
|
|
34
|
+
return {};
|
|
35
|
+
let o = p(t.getItem(f), {});
|
|
36
|
+
return y(o.overrides) ? I(o.overrides) : I(o);
|
|
37
|
+
}, S = (e) => e.indexOf("http://") === 0 || e.indexOf("https://") === 0 || e.indexOf("//") === 0, m = (e, t) => {
|
|
38
|
+
Reflect.deleteProperty(e, t);
|
|
39
|
+
}, T = (e) => {
|
|
40
|
+
let t = {}, o = [];
|
|
41
|
+
return Object.keys(e || {}).forEach((s) => {
|
|
42
|
+
var r;
|
|
43
|
+
let i = (r = e[s]) == null ? void 0 : r.remotesInfo;
|
|
44
|
+
if (i) {
|
|
45
|
+
let n = Object.keys(i);
|
|
46
|
+
n.length && (n.forEach((c) => {
|
|
47
|
+
let a = c;
|
|
48
|
+
c.indexOf(":") !== -1 && (a = c.split(":").pop()), o.indexOf(a) === -1 && o.push(c);
|
|
49
|
+
}), t[s] = e[s]);
|
|
50
|
+
}
|
|
51
|
+
}), { consumers: t, producer: o };
|
|
52
|
+
}, R = (e, t) => {
|
|
53
|
+
let o = Object.keys(t || {}).reduce((i, r) => (r.indexOf(":") !== -1 && (i[r.split(":")[1]] = t[r]), i), {}), s = O(e);
|
|
54
|
+
return Object.keys(e || {}).forEach((i) => {
|
|
55
|
+
let r = e[i];
|
|
56
|
+
r != null && r.remotesInfo && Object.keys(r.remotesInfo).forEach((n) => {
|
|
57
|
+
let c = n.split(":")[1], a = t[n] || o[n] || t[c] || o[c];
|
|
58
|
+
a && (s[i].remotesInfo[n].matchedVersion = a, s[`${n}:${a}`] = { remoteEntry: a, version: a });
|
|
59
|
+
});
|
|
60
|
+
}), s;
|
|
61
|
+
}, v = (e, t) => {
|
|
62
|
+
let o = null, s = O(e);
|
|
63
|
+
if (Object.keys(e || {}).forEach((r) => {
|
|
64
|
+
let n = s[r];
|
|
65
|
+
n && Array.isArray(n.consumerList) && n.consumerList.length > 0 && (o = n);
|
|
66
|
+
}), !o)
|
|
67
|
+
return s;
|
|
68
|
+
let i = o.consumerList;
|
|
69
|
+
for (let r = 0; r < i.length; r++) {
|
|
70
|
+
let n = "", c = i[r];
|
|
71
|
+
if (Object.keys(t || {}).find((_) => {
|
|
72
|
+
let u = _;
|
|
73
|
+
return _.indexOf(":") !== -1 && (u = _.split(":")[1]), c.indexOf(u) !== -1 ? (n = _, true) : false;
|
|
74
|
+
})) {
|
|
75
|
+
let _ = t[n], u = c.split(":");
|
|
76
|
+
u[u.length - 1] = _, i[r] = u.join(":"), s[`${n}:${_}`] = { remoteEntry: _, version: _ };
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return R(s, t);
|
|
80
|
+
}, F = (e = [], t) => {
|
|
81
|
+
var n;
|
|
82
|
+
let o = t || ((n = l().__FEDERATION__) == null ? void 0 : n.moduleInfo) || {}, s = {}, { consumers: i } = T(o), r = Object.keys(i).some((c) => {
|
|
83
|
+
var _;
|
|
84
|
+
let a = (_ = i[c]) == null ? void 0 : _.consumerList;
|
|
85
|
+
return Array.isArray(a) && a.length > 0;
|
|
86
|
+
});
|
|
87
|
+
return e.forEach((c) => {
|
|
88
|
+
c != null && c.key && (c != null && c.value) && (s[c.key] = c.value);
|
|
89
|
+
}), { status: "success", moduleInfo: r ? v(o, s) : R(o, s), overrides: s };
|
|
90
|
+
}, E = (e = l()) => {
|
|
91
|
+
let t = e, o = false;
|
|
92
|
+
return { name: h, beforeLoadRemoteSnapshot: (s) => {
|
|
93
|
+
var c;
|
|
94
|
+
let i = s == null ? void 0 : s.options;
|
|
95
|
+
if (i && i.inBrowser === false)
|
|
96
|
+
return;
|
|
97
|
+
let r = M(t);
|
|
98
|
+
if (!r || o)
|
|
99
|
+
return;
|
|
100
|
+
let n = g(t);
|
|
101
|
+
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");
|
|
102
|
+
} };
|
|
103
|
+
}, B = (e = l()) => {
|
|
104
|
+
let t = e;
|
|
105
|
+
return { name: L, beforeRegisterRemote: (o) => {
|
|
106
|
+
var s;
|
|
107
|
+
try {
|
|
108
|
+
let i = o == null ? void 0 : o.remote;
|
|
109
|
+
if (!i)
|
|
110
|
+
return o;
|
|
111
|
+
let r = N(t), n = r[i.name] || r[i.alias || ""];
|
|
112
|
+
if (!n)
|
|
113
|
+
return o;
|
|
114
|
+
S(n) ? (m(i, "version"), i.entry = n) : (m(i, "entry"), i.version = n);
|
|
115
|
+
} catch (i) {
|
|
116
|
+
(s = t.console) == null || s.error(i);
|
|
117
|
+
}
|
|
118
|
+
return o;
|
|
119
|
+
} };
|
|
120
|
+
}, b = (e = l()) => {
|
|
121
|
+
let t = g(e);
|
|
122
|
+
return [B(e), E(e)].forEach((s) => {
|
|
123
|
+
var r, n;
|
|
124
|
+
((r = t.__GLOBAL_PLUGIN__) == null ? void 0 : r.some((c) => c.name === s.name)) || (n = t.__GLOBAL_PLUGIN__) == null || n.push(s);
|
|
125
|
+
}), t.__GLOBAL_PLUGIN__ || [];
|
|
126
|
+
}, A = (e, t) => {
|
|
127
|
+
var r, n;
|
|
128
|
+
let o = g(e), s = t(e);
|
|
129
|
+
return ((r = o.__GLOBAL_PLUGIN__) == null ? void 0 : r.some((c) => c.name === s.name)) || (n = o.__GLOBAL_PLUGIN__) == null || n.push(s), s;
|
|
130
|
+
}, k = (e = l()) => A(e, B), D = (e = l()) => A(e, E), V = (e = l()) => {
|
|
131
|
+
let t = x(e);
|
|
132
|
+
if (!t)
|
|
133
|
+
return;
|
|
134
|
+
t.removeItem(P), t.removeItem(G);
|
|
135
|
+
let o = p(t.getItem(f), {});
|
|
136
|
+
y(o) && (m(o, "overrides"), Object.keys(o).length ? t.setItem(f, JSON.stringify(o)) : t.removeItem(f));
|
|
137
|
+
};
|
|
138
|
+
exports.calculateMicroAppSnapshot = v;
|
|
139
|
+
exports.calculateSnapshot = R;
|
|
140
|
+
exports.createOverridePlugin = B;
|
|
141
|
+
exports.createSnapshotPlugin = E;
|
|
142
|
+
exports.getModuleInfo = F;
|
|
143
|
+
exports.registerOverridePlugin = k;
|
|
144
|
+
exports.registerRuntimePlugins = b;
|
|
145
|
+
exports.registerSnapshotPlugin = D;
|
|
146
|
+
exports.resetProxyStorage = V;
|
|
147
|
+
exports.separateType = T;
|
|
@@ -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/install-deps.bash
CHANGED
|
@@ -3,14 +3,18 @@ if [ "$SKIP_DEVTOOLS_POSTINSTALL" = "true" ]; then
|
|
|
3
3
|
exit 0
|
|
4
4
|
fi
|
|
5
5
|
|
|
6
|
+
if [ "$GITHUB_ACTIONS" = "true" ] && [ "$RUN_DEVTOOLS_POSTINSTALL" != "true" ]; then
|
|
7
|
+
echo "Skipping devtools postinstall outside the devtools workflow."
|
|
8
|
+
exit 0
|
|
9
|
+
fi
|
|
10
|
+
|
|
6
11
|
if [ "$GITHUB_ACTIONS" = "true" ]; then
|
|
7
12
|
echo "Running in GitHub Actions environment."
|
|
8
13
|
# Only install if cache miss was reported by the cache action
|
|
9
14
|
if [ "$PLAYWRIGHT_CACHE_HIT" != "true" ]; then
|
|
10
|
-
echo "Playwright cache miss, installing dependencies and
|
|
11
|
-
npx playwright install-deps && npx playwright install
|
|
15
|
+
echo "Playwright cache miss, installing Chromium dependencies and browser..."
|
|
16
|
+
npx playwright install-deps && npx playwright install chromium
|
|
12
17
|
else
|
|
13
|
-
npx playwright install
|
|
14
18
|
echo "Using cached Playwright browsers."
|
|
15
19
|
fi
|
|
16
20
|
else
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/devtools",
|
|
3
|
-
"version": "0.0.0-perf-
|
|
3
|
+
"version": "0.0.0-perf-website-code-usage-20260914033703",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
],
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
|
-
"types": "./dist/types/App.d.ts",
|
|
17
|
+
"types": "./dist/types/src/App.d.ts",
|
|
18
18
|
"require": "./dist/lib/App.js",
|
|
19
19
|
"import": "./dist/es/App.js"
|
|
20
20
|
},
|
|
21
21
|
"./App": {
|
|
22
|
-
"types": "./dist/types/App.d.ts",
|
|
22
|
+
"types": "./dist/types/src/App.d.ts",
|
|
23
23
|
"require": "./dist/lib/App.js",
|
|
24
24
|
"import": "./dist/es/App.js"
|
|
25
25
|
}
|
|
@@ -37,53 +37,72 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@modern-js/runtime": "2.
|
|
40
|
+
"@modern-js/runtime": "2.70.8",
|
|
41
41
|
"@arco-design/web-react": "2.66.7",
|
|
42
|
-
"ahooks": "
|
|
43
|
-
"dagre": "
|
|
44
|
-
"react": "^19.2.0",
|
|
45
|
-
"react-dom": "^19.2.0",
|
|
42
|
+
"ahooks": "3.7.10",
|
|
43
|
+
"dagre": "0.8.5",
|
|
46
44
|
"reactflow": "11.11.4",
|
|
47
|
-
"echarts": "
|
|
48
|
-
"lucide-react": "
|
|
49
|
-
"echarts-for-react": "
|
|
50
|
-
"
|
|
45
|
+
"echarts": "6.1.0",
|
|
46
|
+
"lucide-react": "0.364.0",
|
|
47
|
+
"echarts-for-react": "3.0.5",
|
|
48
|
+
"i18next": "23.0.0",
|
|
49
|
+
"react-i18next": "15.0.0",
|
|
50
|
+
"@module-federation/observability-plugin": "0.0.0-perf-website-code-usage-20260914033703",
|
|
51
|
+
"@module-federation/sdk": "0.0.0-perf-website-code-usage-20260914033703"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"react": "^18 || ^19",
|
|
55
|
+
"react-dom": "^18 || ^19"
|
|
56
|
+
},
|
|
57
|
+
"peerDependenciesMeta": {
|
|
58
|
+
"react": {
|
|
59
|
+
"optional": true
|
|
60
|
+
},
|
|
61
|
+
"react-dom": {
|
|
62
|
+
"optional": true
|
|
63
|
+
}
|
|
51
64
|
},
|
|
52
65
|
"devDependencies": {
|
|
66
|
+
"react": "^19.2.0",
|
|
67
|
+
"react-dom": "^19.2.0",
|
|
53
68
|
"@modern-js-app/eslint-config": "2.59.0",
|
|
54
|
-
"@modern-js/app-tools": "2.
|
|
69
|
+
"@modern-js/app-tools": "2.70.8",
|
|
55
70
|
"@modern-js/eslint-config": "2.59.0",
|
|
56
|
-
"@modern-js/module-tools": "2.
|
|
57
|
-
"@modern-js/storybook": "2.
|
|
58
|
-
"@modern-js/tsconfig": "2.
|
|
59
|
-
"@playwright/test": "1.
|
|
71
|
+
"@modern-js/module-tools": "2.70.8",
|
|
72
|
+
"@modern-js/storybook": "2.70.8",
|
|
73
|
+
"@modern-js/tsconfig": "2.70.8",
|
|
74
|
+
"@playwright/test": "1.57.0",
|
|
60
75
|
"@types/chrome": "^0.0.272",
|
|
61
76
|
"@types/dagre": "^0.7.52",
|
|
62
|
-
"@types/
|
|
63
|
-
"@types/node": "~20.12.12",
|
|
77
|
+
"@types/node": "^20.19.5",
|
|
64
78
|
"@types/react": "^19.2.2",
|
|
65
79
|
"@types/react-dom": "^19.2.2",
|
|
66
80
|
"lint-staged": "~13.1.0",
|
|
67
81
|
"prettier": "~3.3.3",
|
|
82
|
+
"typescript": "7.0.2",
|
|
68
83
|
"rimraf": "~6.0.1",
|
|
69
|
-
"vitest": "
|
|
70
|
-
"@module-federation/runtime": "0.0.0-perf-
|
|
84
|
+
"vitest": "3.2.6",
|
|
85
|
+
"@module-federation/runtime": "0.0.0-perf-website-code-usage-20260914033703"
|
|
71
86
|
},
|
|
72
87
|
"scripts": {
|
|
73
88
|
"build:storybook": "storybook build",
|
|
74
89
|
"storybook": "storybook dev -p 6006",
|
|
75
90
|
"reset": "npx rimraf ./**/node_modules",
|
|
76
91
|
"dev": "modern-app dev",
|
|
77
|
-
"build": "modern-app build && node postpack.js",
|
|
92
|
+
"build:devtool": "modern-app build && node postpack.js",
|
|
93
|
+
"build": "npm run build:lib",
|
|
78
94
|
"build:debug": "DEBUG=true modern-app build && node postpack.js",
|
|
79
|
-
"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",
|
|
80
96
|
"release": "npm publish --tag canary",
|
|
81
|
-
"test": "
|
|
82
|
-
"test:e2e": "E2ETEST=true pnpm build && playwright test",
|
|
83
|
-
"test:e2e:ui": "E2ETEST=true
|
|
97
|
+
"test": "rstest",
|
|
98
|
+
"test:e2e": "node ../../scripts/ensure-playwright.js && E2ETEST=true pnpm build:devtool && playwright test",
|
|
99
|
+
"test:e2e:ui": "node ../../scripts/ensure-playwright.js && E2ETEST=true pnpm build:devtool && playwright test --ui",
|
|
84
100
|
"start": "modern-app start",
|
|
85
101
|
"serve": "modern-app serve",
|
|
86
|
-
"postinstall": "bash install-deps.bash"
|
|
102
|
+
"postinstall": "bash install-deps.bash",
|
|
103
|
+
"build:chrome-plugins": "pnpm -C . build",
|
|
104
|
+
"e2e:devtools": "pnpm -C . test:e2e",
|
|
105
|
+
"e2e:devtools:ui": "pnpm -C . test:e2e:ui"
|
|
87
106
|
},
|
|
88
|
-
"types": "./dist/
|
|
107
|
+
"types": "./dist/types/src/App.d.ts"
|
|
89
108
|
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
const calculateSnapshot = (originSnapshot, overrides) => {
|
|
2
|
-
const overridesWithoutType = Object.keys(overrides).reduce(
|
|
3
|
-
(memo, current) => {
|
|
4
|
-
if (current.includes(":")) {
|
|
5
|
-
const [, moduleId] = current.split(":");
|
|
6
|
-
memo[moduleId] = overrides[current];
|
|
7
|
-
}
|
|
8
|
-
return memo;
|
|
9
|
-
},
|
|
10
|
-
{}
|
|
11
|
-
);
|
|
12
|
-
const newSnapshot = JSON.parse(JSON.stringify(originSnapshot));
|
|
13
|
-
const moduleIds = Object.keys(originSnapshot);
|
|
14
|
-
moduleIds.forEach((moduleId) => {
|
|
15
|
-
const module = originSnapshot[moduleId];
|
|
16
|
-
if ("remotesInfo" in module) {
|
|
17
|
-
const remoteIds = Object.keys(module.remotesInfo);
|
|
18
|
-
remoteIds.forEach((id) => {
|
|
19
|
-
const [, splitId] = id.split(":");
|
|
20
|
-
const entry = overrides[id] || overridesWithoutType[id] || overrides[splitId] || overridesWithoutType[splitId];
|
|
21
|
-
if (entry) {
|
|
22
|
-
newSnapshot[moduleId].remotesInfo[id].matchedVersion = entry;
|
|
23
|
-
const customEntryId = `${id}:${entry}`;
|
|
24
|
-
newSnapshot[customEntryId] = {
|
|
25
|
-
remoteEntry: entry,
|
|
26
|
-
version: entry
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
return newSnapshot;
|
|
33
|
-
};
|
|
34
|
-
const calculateMicroAppSnapshot = (originSnapshot, overrides) => {
|
|
35
|
-
let masterApp = null;
|
|
36
|
-
const newSnapshot = JSON.parse(JSON.stringify(originSnapshot));
|
|
37
|
-
const moduleIds = Object.keys(originSnapshot);
|
|
38
|
-
moduleIds.forEach((moduleId) => {
|
|
39
|
-
const module = newSnapshot[moduleId];
|
|
40
|
-
if ("consumerList" in module && Array.isArray(module.consumerList) && module.consumerList.length > 0) {
|
|
41
|
-
masterApp = module;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
if (!masterApp) {
|
|
45
|
-
return newSnapshot;
|
|
46
|
-
}
|
|
47
|
-
const microApps = masterApp.consumerList;
|
|
48
|
-
const microAppsCount = microApps.length;
|
|
49
|
-
for (let i = 0; i < microAppsCount; i++) {
|
|
50
|
-
let overrideTarget = "";
|
|
51
|
-
const microApp = microApps[i];
|
|
52
|
-
const idWithVersion = Object.keys(overrides).find((id) => {
|
|
53
|
-
let target = id;
|
|
54
|
-
if (id.includes(":")) {
|
|
55
|
-
const [, name] = id.split(":");
|
|
56
|
-
target = name;
|
|
57
|
-
}
|
|
58
|
-
if (microApp.includes(target)) {
|
|
59
|
-
overrideTarget = id;
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
return false;
|
|
63
|
-
});
|
|
64
|
-
if (idWithVersion) {
|
|
65
|
-
const entry = overrides[overrideTarget];
|
|
66
|
-
const idArray = microApp.split(":");
|
|
67
|
-
idArray[idArray.length - 1] = entry;
|
|
68
|
-
microApps[i] = idArray.join(":");
|
|
69
|
-
const customEntryId = `${overrideTarget}:${entry}`;
|
|
70
|
-
newSnapshot[customEntryId] = {
|
|
71
|
-
remoteEntry: entry,
|
|
72
|
-
version: entry
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
const snapshot = calculateSnapshot(newSnapshot, overrides);
|
|
77
|
-
return snapshot;
|
|
78
|
-
};
|
|
79
|
-
export {
|
|
80
|
-
calculateMicroAppSnapshot,
|
|
81
|
-
calculateSnapshot
|
|
82
|
-
};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var snapshot_exports = {};
|
|
20
|
-
__export(snapshot_exports, {
|
|
21
|
-
calculateMicroAppSnapshot: () => calculateMicroAppSnapshot,
|
|
22
|
-
calculateSnapshot: () => calculateSnapshot
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(snapshot_exports);
|
|
25
|
-
const calculateSnapshot = (originSnapshot, overrides) => {
|
|
26
|
-
const overridesWithoutType = Object.keys(overrides).reduce(
|
|
27
|
-
(memo, current) => {
|
|
28
|
-
if (current.includes(":")) {
|
|
29
|
-
const [, moduleId] = current.split(":");
|
|
30
|
-
memo[moduleId] = overrides[current];
|
|
31
|
-
}
|
|
32
|
-
return memo;
|
|
33
|
-
},
|
|
34
|
-
{}
|
|
35
|
-
);
|
|
36
|
-
const newSnapshot = JSON.parse(JSON.stringify(originSnapshot));
|
|
37
|
-
const moduleIds = Object.keys(originSnapshot);
|
|
38
|
-
moduleIds.forEach((moduleId) => {
|
|
39
|
-
const module2 = originSnapshot[moduleId];
|
|
40
|
-
if ("remotesInfo" in module2) {
|
|
41
|
-
const remoteIds = Object.keys(module2.remotesInfo);
|
|
42
|
-
remoteIds.forEach((id) => {
|
|
43
|
-
const [, splitId] = id.split(":");
|
|
44
|
-
const entry = overrides[id] || overridesWithoutType[id] || overrides[splitId] || overridesWithoutType[splitId];
|
|
45
|
-
if (entry) {
|
|
46
|
-
newSnapshot[moduleId].remotesInfo[id].matchedVersion = entry;
|
|
47
|
-
const customEntryId = `${id}:${entry}`;
|
|
48
|
-
newSnapshot[customEntryId] = {
|
|
49
|
-
remoteEntry: entry,
|
|
50
|
-
version: entry
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
return newSnapshot;
|
|
57
|
-
};
|
|
58
|
-
const calculateMicroAppSnapshot = (originSnapshot, overrides) => {
|
|
59
|
-
let masterApp = null;
|
|
60
|
-
const newSnapshot = JSON.parse(JSON.stringify(originSnapshot));
|
|
61
|
-
const moduleIds = Object.keys(originSnapshot);
|
|
62
|
-
moduleIds.forEach((moduleId) => {
|
|
63
|
-
const module2 = newSnapshot[moduleId];
|
|
64
|
-
if ("consumerList" in module2 && Array.isArray(module2.consumerList) && module2.consumerList.length > 0) {
|
|
65
|
-
masterApp = module2;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
if (!masterApp) {
|
|
69
|
-
return newSnapshot;
|
|
70
|
-
}
|
|
71
|
-
const microApps = masterApp.consumerList;
|
|
72
|
-
const microAppsCount = microApps.length;
|
|
73
|
-
for (let i = 0; i < microAppsCount; i++) {
|
|
74
|
-
let overrideTarget = "";
|
|
75
|
-
const microApp = microApps[i];
|
|
76
|
-
const idWithVersion = Object.keys(overrides).find((id) => {
|
|
77
|
-
let target = id;
|
|
78
|
-
if (id.includes(":")) {
|
|
79
|
-
const [, name] = id.split(":");
|
|
80
|
-
target = name;
|
|
81
|
-
}
|
|
82
|
-
if (microApp.includes(target)) {
|
|
83
|
-
overrideTarget = id;
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
return false;
|
|
87
|
-
});
|
|
88
|
-
if (idWithVersion) {
|
|
89
|
-
const entry = overrides[overrideTarget];
|
|
90
|
-
const idArray = microApp.split(":");
|
|
91
|
-
idArray[idArray.length - 1] = entry;
|
|
92
|
-
microApps[i] = idArray.join(":");
|
|
93
|
-
const customEntryId = `${overrideTarget}:${entry}`;
|
|
94
|
-
newSnapshot[customEntryId] = {
|
|
95
|
-
remoteEntry: entry,
|
|
96
|
-
version: entry
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
const snapshot = calculateSnapshot(newSnapshot, overrides);
|
|
101
|
-
return snapshot;
|
|
102
|
-
};
|
|
103
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
104
|
-
0 && (module.exports = {
|
|
105
|
-
calculateMicroAppSnapshot,
|
|
106
|
-
calculateSnapshot
|
|
107
|
-
});
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { GlobalModuleInfo } from '@module-federation/sdk';
|
|
2
|
-
export declare const calculateSnapshot: (originSnapshot: GlobalModuleInfo, overrides: Record<string, string>) => any;
|
|
3
|
-
export declare const calculateMicroAppSnapshot: (originSnapshot: GlobalModuleInfo, overrides: Record<string, string>) => any;
|