@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,147 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var safe_post_message_exports = {};
|
|
19
|
+
__export(safe_post_message_exports, {
|
|
20
|
+
sanitizePostMessagePayload: () => sanitizePostMessagePayload
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(safe_post_message_exports);
|
|
23
|
+
const FUNCTION_PLACEHOLDER = "function(){}";
|
|
24
|
+
const UNDEFINED_PLACEHOLDER = "[undefined]";
|
|
25
|
+
const CIRCULAR_PLACEHOLDER = "[circular]";
|
|
26
|
+
const NON_SERIALIZABLE_PLACEHOLDER = "[unserializable]";
|
|
27
|
+
const toStringTag = (value) => Object.prototype.toString.call(value).slice(8, -1);
|
|
28
|
+
const isPlainObject = (value) => {
|
|
29
|
+
if (!value || typeof value !== "object") {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
const proto = Object.getPrototypeOf(value);
|
|
33
|
+
return proto === Object.prototype || proto === null;
|
|
34
|
+
};
|
|
35
|
+
const sanitizeValue = (value, seen) => {
|
|
36
|
+
if (value === null || typeof value === "string" || typeof value === "number") {
|
|
37
|
+
return Number.isNaN(value) ? "[NaN]" : value;
|
|
38
|
+
}
|
|
39
|
+
if (typeof value === "boolean") {
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
if (typeof value === "function") {
|
|
43
|
+
return FUNCTION_PLACEHOLDER;
|
|
44
|
+
}
|
|
45
|
+
if (typeof value === "undefined") {
|
|
46
|
+
return UNDEFINED_PLACEHOLDER;
|
|
47
|
+
}
|
|
48
|
+
if (typeof value === "bigint" || typeof value === "symbol") {
|
|
49
|
+
return String(value);
|
|
50
|
+
}
|
|
51
|
+
if (!(value instanceof Object)) {
|
|
52
|
+
return NON_SERIALIZABLE_PLACEHOLDER;
|
|
53
|
+
}
|
|
54
|
+
if (seen.has(value)) {
|
|
55
|
+
return CIRCULAR_PLACEHOLDER;
|
|
56
|
+
}
|
|
57
|
+
if (Array.isArray(value)) {
|
|
58
|
+
const next2 = [];
|
|
59
|
+
seen.set(value, next2);
|
|
60
|
+
value.forEach((item, index) => {
|
|
61
|
+
next2[index] = sanitizeValue(item, seen);
|
|
62
|
+
});
|
|
63
|
+
return next2;
|
|
64
|
+
}
|
|
65
|
+
if (value instanceof Date) {
|
|
66
|
+
return value.toISOString();
|
|
67
|
+
}
|
|
68
|
+
if (value instanceof RegExp) {
|
|
69
|
+
return value.toString();
|
|
70
|
+
}
|
|
71
|
+
if (value instanceof Error) {
|
|
72
|
+
const next2 = {
|
|
73
|
+
name: value.name,
|
|
74
|
+
message: value.message,
|
|
75
|
+
stack: value.stack || ""
|
|
76
|
+
};
|
|
77
|
+
seen.set(value, next2);
|
|
78
|
+
return next2;
|
|
79
|
+
}
|
|
80
|
+
if (value instanceof Map) {
|
|
81
|
+
const next2 = [];
|
|
82
|
+
seen.set(value, next2);
|
|
83
|
+
next2.push(
|
|
84
|
+
...Array.from(value.entries()).map(([key, item]) => [
|
|
85
|
+
sanitizeValue(key, seen),
|
|
86
|
+
sanitizeValue(item, seen)
|
|
87
|
+
])
|
|
88
|
+
);
|
|
89
|
+
return next2;
|
|
90
|
+
}
|
|
91
|
+
if (value instanceof Set) {
|
|
92
|
+
const next2 = [];
|
|
93
|
+
seen.set(value, next2);
|
|
94
|
+
next2.push(
|
|
95
|
+
...Array.from(value.values()).map((item) => sanitizeValue(item, seen))
|
|
96
|
+
);
|
|
97
|
+
return next2;
|
|
98
|
+
}
|
|
99
|
+
if (ArrayBuffer.isView(value)) {
|
|
100
|
+
return Array.from(new Uint8Array(value.buffer));
|
|
101
|
+
}
|
|
102
|
+
if (value instanceof ArrayBuffer) {
|
|
103
|
+
return Array.from(new Uint8Array(value));
|
|
104
|
+
}
|
|
105
|
+
if (typeof Node !== "undefined" && value instanceof Node) {
|
|
106
|
+
return `[${toStringTag(value)}]`;
|
|
107
|
+
}
|
|
108
|
+
if (typeof Window !== "undefined" && value instanceof Window) {
|
|
109
|
+
return "[Window]";
|
|
110
|
+
}
|
|
111
|
+
if (typeof Document !== "undefined" && value instanceof Document) {
|
|
112
|
+
return "[Document]";
|
|
113
|
+
}
|
|
114
|
+
const next = {};
|
|
115
|
+
seen.set(value, next);
|
|
116
|
+
const entries = isPlainObject(value) ? Object.keys(value).map((key) => {
|
|
117
|
+
try {
|
|
118
|
+
return [key, value[key]];
|
|
119
|
+
} catch (_error) {
|
|
120
|
+
return [key, NON_SERIALIZABLE_PLACEHOLDER];
|
|
121
|
+
}
|
|
122
|
+
}) : Reflect.ownKeys(value).map((key) => {
|
|
123
|
+
try {
|
|
124
|
+
return [
|
|
125
|
+
String(key),
|
|
126
|
+
value[key]
|
|
127
|
+
];
|
|
128
|
+
} catch (_error) {
|
|
129
|
+
return [String(key), NON_SERIALIZABLE_PLACEHOLDER];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
entries.forEach(([key, item]) => {
|
|
133
|
+
try {
|
|
134
|
+
next[key] = sanitizeValue(item, seen);
|
|
135
|
+
} catch (_error) {
|
|
136
|
+
next[key] = NON_SERIALIZABLE_PLACEHOLDER;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
return next;
|
|
140
|
+
};
|
|
141
|
+
const sanitizePostMessagePayload = (payload) => {
|
|
142
|
+
return sanitizeValue(payload, /* @__PURE__ */ new WeakMap());
|
|
143
|
+
};
|
|
144
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
145
|
+
0 && (module.exports = {
|
|
146
|
+
sanitizePostMessagePayload
|
|
147
|
+
});
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
1
|
var __defProp = Object.defineProperty;
|
|
4
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
5
|
var __copyProps = (to, from, except, desc) => {
|
|
9
6
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -13,47 +10,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
10
|
}
|
|
14
11
|
return to;
|
|
15
12
|
};
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var import_sdk = require("@module-federation/sdk");
|
|
25
|
-
var import_helpers = __toESM(require("@module-federation/runtime/helpers"));
|
|
26
|
-
var import_sdk2 = require("../sdk");
|
|
27
|
-
var _a;
|
|
28
|
-
const chromeDevtoolsPlugin = function() {
|
|
29
|
-
return {
|
|
30
|
-
name: "mf-chrome-devtools-inject-snapshot-plugin",
|
|
31
|
-
beforeLoadRemoteSnapshot({ options }) {
|
|
32
|
-
const { nativeGlobal } = import_helpers.default.global;
|
|
33
|
-
if (!options || options.inBrowser) {
|
|
34
|
-
const realLocalStorage = nativeGlobal.localStorage || localStorage;
|
|
35
|
-
const debugModuleInfoStr = realLocalStorage.getItem(
|
|
36
|
-
import_sdk.MODULE_DEVTOOL_IDENTIFIER
|
|
37
|
-
);
|
|
38
|
-
if (debugModuleInfoStr && !nativeGlobal.__INIT_VMOK_CHROME_DEVTOOL_PLUGIN__) {
|
|
39
|
-
const chromeDevtoolSnapshot = JSON.parse(debugModuleInfoStr);
|
|
40
|
-
if (chromeDevtoolSnapshot) {
|
|
41
|
-
import_helpers.default.global.addGlobalSnapshot(chromeDevtoolSnapshot);
|
|
42
|
-
nativeGlobal.__INIT_VMOK_CHROME_DEVTOOL_PLUGIN__ = true;
|
|
43
|
-
console.warn(
|
|
44
|
-
"[Module Federation Devtools]: You are using the chrome devtool to proxy online module"
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
if (!(window == null ? void 0 : window.__FEDERATION__)) {
|
|
53
|
-
(0, import_sdk2.definePropertyGlobalVal)(window, "__FEDERATION__", {});
|
|
54
|
-
(0, import_sdk2.definePropertyGlobalVal)(window, "__VMOK__", window.__FEDERATION__);
|
|
55
|
-
}
|
|
56
|
-
if (!(window == null ? void 0 : window.__FEDERATION__.__GLOBAL_PLUGIN__)) {
|
|
57
|
-
window.__FEDERATION__.__GLOBAL_PLUGIN__ = [];
|
|
58
|
-
}
|
|
59
|
-
(_a = window.__FEDERATION__.__GLOBAL_PLUGIN__) == null ? void 0 : _a.push(chromeDevtoolsPlugin());
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var snapshot_plugin_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(snapshot_plugin_exports);
|
|
16
|
+
const basicProxyCore = require("../../vendor/basic-proxy-core.js");
|
|
17
|
+
basicProxyCore.registerSnapshotPlugin(globalThis);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -15,7 +14,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
14
|
}
|
|
16
15
|
return to;
|
|
17
16
|
};
|
|
18
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
18
|
var __async = (__this, __arguments, generator) => {
|
|
21
19
|
return new Promise((resolve, reject) => {
|
|
@@ -43,8 +41,7 @@ __export(data_exports, {
|
|
|
43
41
|
separateType: () => separateType
|
|
44
42
|
});
|
|
45
43
|
module.exports = __toCommonJS(data_exports);
|
|
46
|
-
|
|
47
|
-
__reExport(data_exports, require("./snapshot"), module.exports);
|
|
44
|
+
const basicProxyCore = require("../../vendor/basic-proxy-core.js");
|
|
48
45
|
const separateType = (moduleInfo) => {
|
|
49
46
|
const consumers = {};
|
|
50
47
|
const producer = [];
|
|
@@ -74,33 +71,13 @@ const separateType = (moduleInfo) => {
|
|
|
74
71
|
};
|
|
75
72
|
};
|
|
76
73
|
const getModuleInfo = (proxyRules) => __async(void 0, null, function* () {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const isMicroMode = Object.keys(consumers).some((moduleId) => {
|
|
82
|
-
const subApps = consumers[moduleId].consumerList;
|
|
83
|
-
return Array.isArray(subApps) && subApps.length;
|
|
84
|
-
});
|
|
85
|
-
proxyRules.forEach((rule) => {
|
|
86
|
-
const { key, value } = rule;
|
|
87
|
-
overrides[key] = value;
|
|
88
|
-
});
|
|
89
|
-
if (isMicroMode) {
|
|
90
|
-
freshModuleInfo = (0, import_snapshot.calculateMicroAppSnapshot)(moduleInfo, overrides);
|
|
91
|
-
} else {
|
|
92
|
-
freshModuleInfo = (0, import_snapshot.calculateSnapshot)(moduleInfo, overrides);
|
|
93
|
-
}
|
|
94
|
-
console.debug("New Snapshot: ", freshModuleInfo);
|
|
95
|
-
return {
|
|
96
|
-
status: "success",
|
|
97
|
-
moduleInfo: freshModuleInfo,
|
|
98
|
-
overrides
|
|
99
|
-
};
|
|
74
|
+
return basicProxyCore.getModuleInfo(
|
|
75
|
+
proxyRules,
|
|
76
|
+
window.__FEDERATION__.moduleInfo
|
|
77
|
+
);
|
|
100
78
|
});
|
|
101
79
|
// Annotate the CommonJS export names for ESM import in node:
|
|
102
80
|
0 && (module.exports = {
|
|
103
81
|
getModuleInfo,
|
|
104
|
-
separateType
|
|
105
|
-
...require("./snapshot")
|
|
82
|
+
separateType
|
|
106
83
|
});
|
package/dist/lib/utils/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -43,26 +42,38 @@ const validateSemver = (schema) => {
|
|
|
43
42
|
return reg.test(schema);
|
|
44
43
|
};
|
|
45
44
|
const validatePort = (schema) => !isNaN(Number(schema));
|
|
46
|
-
const
|
|
45
|
+
const isEntrySegment = (segment) => segment.startsWith("http") || segment.startsWith("//");
|
|
46
|
+
const parseModuleId = (target) => {
|
|
47
47
|
const array = target.split(":");
|
|
48
48
|
const { length } = array;
|
|
49
|
+
const result = {
|
|
50
|
+
name: target,
|
|
51
|
+
version: ""
|
|
52
|
+
};
|
|
49
53
|
if (length === 1) {
|
|
50
|
-
return
|
|
54
|
+
return result;
|
|
51
55
|
} else if (length >= 3) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return
|
|
56
|
+
const idx = array.findIndex(isEntrySegment);
|
|
57
|
+
if (idx > 0) {
|
|
58
|
+
result.name = array[idx - 1];
|
|
59
|
+
result.version = array.slice(idx).join(":");
|
|
60
|
+
return result;
|
|
57
61
|
}
|
|
62
|
+
result.name = array[1];
|
|
63
|
+
result.version = array.slice(2).join(":");
|
|
64
|
+
return result;
|
|
58
65
|
} else {
|
|
59
66
|
const nameOrVersion = array[length - 1];
|
|
60
|
-
if (nameOrVersion === "*" || nameOrVersion === "latest" || validateSemver(nameOrVersion)) {
|
|
61
|
-
|
|
67
|
+
if (nameOrVersion === "*" || nameOrVersion === "latest" || validateSemver(nameOrVersion) || isEntrySegment(nameOrVersion) || nameOrVersion.endsWith(".json") || nameOrVersion.endsWith(".js")) {
|
|
68
|
+
result.name = array[0];
|
|
69
|
+
result.version = nameOrVersion;
|
|
70
|
+
return result;
|
|
62
71
|
} else {
|
|
63
|
-
|
|
72
|
+
result.name = nameOrVersion;
|
|
73
|
+
return result;
|
|
64
74
|
}
|
|
65
75
|
}
|
|
76
|
+
return result;
|
|
66
77
|
};
|
|
67
78
|
class DependencyGraph {
|
|
68
79
|
constructor(snapshot, initTarget) {
|
|
@@ -135,12 +146,14 @@ class DependencyGraph {
|
|
|
135
146
|
if (!targetGraph || !((_a = Object.keys(targetGraph)) == null ? void 0 : _a.length)) {
|
|
136
147
|
return;
|
|
137
148
|
}
|
|
138
|
-
const name =
|
|
149
|
+
const { name, version } = parseModuleId(target);
|
|
139
150
|
const targetWithoutType = name;
|
|
140
151
|
let info = name;
|
|
141
152
|
const remote = this.snapshot[target];
|
|
142
153
|
if (remote && ("version" in remote || "remoteEntry" in remote)) {
|
|
143
154
|
info += `:${remote.version || remote.remoteEntry}`;
|
|
155
|
+
} else if (version) {
|
|
156
|
+
info += `:${version}`;
|
|
144
157
|
}
|
|
145
158
|
if (!this.identifyMap.has(targetWithoutType)) {
|
|
146
159
|
this.identifyMap.set(targetWithoutType, this.identify());
|
|
@@ -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;
|
package/dist/lib/worker/index.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
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
|
+
};
|
|
2
17
|
var __async = (__this, __arguments, generator) => {
|
|
3
18
|
return new Promise((resolve, reject) => {
|
|
4
19
|
var fulfilled = (value) => {
|
|
@@ -32,12 +47,12 @@ const resolveTabId = (tabId) => __async(exports, null, function* () {
|
|
|
32
47
|
});
|
|
33
48
|
return activeTab == null ? void 0 : activeTab.id;
|
|
34
49
|
});
|
|
35
|
-
const broadcastActiveTab = (tabId) => {
|
|
50
|
+
const broadcastActiveTab = (tabId, payload) => {
|
|
36
51
|
try {
|
|
37
|
-
chrome.runtime.sendMessage({
|
|
52
|
+
chrome.runtime.sendMessage(__spreadValues({
|
|
38
53
|
type: import_messages.MESSAGE_ACTIVE_TAB_CHANGED,
|
|
39
54
|
tabId
|
|
40
|
-
});
|
|
55
|
+
}, payload));
|
|
41
56
|
} catch (error) {
|
|
42
57
|
console.warn(
|
|
43
58
|
"[Module Federation Devtools] Failed to broadcast active tab",
|
|
@@ -62,11 +77,11 @@ const openSidePanel = (tabId) => __async(exports, null, function* () {
|
|
|
62
77
|
if (sidePanel.open) {
|
|
63
78
|
yield sidePanel.open({ tabId: targetTabId });
|
|
64
79
|
}
|
|
65
|
-
broadcastActiveTab(targetTabId);
|
|
80
|
+
broadcastActiveTab(targetTabId, { reason: "side-panel" });
|
|
66
81
|
if (sidePanel.getOptions) {
|
|
67
82
|
try {
|
|
68
83
|
const options = yield sidePanel.getOptions({ tabId: targetTabId });
|
|
69
|
-
broadcastActiveTab(targetTabId);
|
|
84
|
+
broadcastActiveTab(targetTabId, { reason: "side-panel" });
|
|
70
85
|
return options;
|
|
71
86
|
} catch (error) {
|
|
72
87
|
console.warn("[Module Federation Devtools] getOptions failed", error);
|
|
@@ -113,7 +128,7 @@ chrome.tabs.onActivated.addListener((activeInfo) => __async(exports, null, funct
|
|
|
113
128
|
return;
|
|
114
129
|
}
|
|
115
130
|
try {
|
|
116
|
-
broadcastActiveTab(tabId);
|
|
131
|
+
broadcastActiveTab(tabId, { reason: "activated" });
|
|
117
132
|
} catch (error) {
|
|
118
133
|
console.warn(
|
|
119
134
|
"[Module Federation Devtools] Failed to handle tab activation",
|
|
@@ -122,12 +137,15 @@ chrome.tabs.onActivated.addListener((activeInfo) => __async(exports, null, funct
|
|
|
122
137
|
}
|
|
123
138
|
}));
|
|
124
139
|
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
|
|
125
|
-
if (changeInfo.status !== "complete") {
|
|
140
|
+
if (changeInfo.status !== "loading" && changeInfo.status !== "complete") {
|
|
126
141
|
return;
|
|
127
142
|
}
|
|
128
143
|
if (tab == null ? void 0 : tab.active) {
|
|
129
144
|
try {
|
|
130
|
-
broadcastActiveTab(tabId
|
|
145
|
+
broadcastActiveTab(tabId, {
|
|
146
|
+
reason: "updated",
|
|
147
|
+
status: changeInfo.status
|
|
148
|
+
});
|
|
131
149
|
} catch (error) {
|
|
132
150
|
console.warn(
|
|
133
151
|
"[Module Federation Devtools] Failed to handle tab update",
|
|
@@ -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
|
+
}
|