@module-federation/devtools 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/App.css +13 -0
- package/dist/types/App.js +519 -0
- package/dist/types/App.module.js +24 -0
- package/dist/types/App_module.css +307 -0
- package/dist/types/component/DependencyGraph/index.js +225 -0
- package/dist/types/component/DependencyGraph/index.module.js +24 -0
- package/dist/types/component/DependencyGraph/index_module.css +100 -0
- package/dist/types/component/DependencyGraphItem/index.js +124 -0
- package/dist/types/component/DependencyGraphItem/index.module.js +24 -0
- package/dist/types/component/DependencyGraphItem/index_module.css +95 -0
- package/dist/types/component/Form/index.js +372 -0
- package/dist/types/component/Form/index.module.js +24 -0
- package/dist/types/component/Form/index_module.css +198 -0
- package/dist/types/component/LanguageSwitch.js +79 -0
- package/dist/types/component/Layout/index.js +471 -0
- package/dist/types/component/Layout/index.module.js +24 -0
- package/dist/types/component/Layout/index_module.css +68 -0
- package/dist/types/component/LoadingTrace/index.js +953 -0
- package/dist/types/component/LoadingTrace/index.module.js +24 -0
- package/dist/types/component/LoadingTrace/index_module.css +876 -0
- package/dist/types/component/ModuleInfo/index.js +342 -0
- package/dist/types/component/ModuleInfo/index.module.js +24 -0
- package/dist/types/component/ModuleInfo/index_module.css +184 -0
- package/dist/types/component/SharedDepsExplorer/FocusResultDisplay.js +64 -0
- package/dist/types/component/SharedDepsExplorer/FocusResultDisplay.module.js +24 -0
- package/dist/types/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
- package/dist/types/component/SharedDepsExplorer/index.js +638 -0
- package/dist/types/component/SharedDepsExplorer/index.module.js +24 -0
- package/dist/types/component/SharedDepsExplorer/index_module.css +467 -0
- package/dist/types/component/SharedDepsExplorer/share-utils.js +252 -0
- package/dist/types/component/ThemeToggle.js +48 -0
- package/dist/types/component/ThemeToggle.module.js +24 -0
- package/dist/types/component/ThemeToggle_module.css +12 -0
- package/dist/types/hooks/useDevtoolsTheme.js +100 -0
- package/dist/types/i18n/index.js +721 -0
- package/dist/types/init.js +8 -0
- package/dist/types/src/App.d.ts +1 -1
- package/dist/types/src/component/DependencyGraph/index.d.ts +1 -1
- package/dist/types/src/component/DependencyGraphItem/index.d.ts +1 -1
- package/dist/types/src/component/Form/index.d.ts +1 -1
- package/dist/types/src/component/LanguageSwitch.d.ts +1 -1
- package/dist/types/src/component/Layout/index.d.ts +1 -1
- package/dist/types/src/component/LoadingTrace/index.d.ts +1 -1
- package/dist/types/src/component/ModuleInfo/index.d.ts +1 -1
- package/dist/types/src/component/SharedDepsExplorer/index.d.ts +1 -1
- package/dist/types/src/i18n/index.d.ts +1 -1
- package/dist/types/src/template/constant.d.ts +1 -1
- package/dist/types/src/utils/chrome/observability.d.ts +1 -1
- package/dist/types/src/utils/data/index.d.ts +1 -1
- package/dist/types/stories/index.stories.d.ts +2 -1
- package/dist/types/template/constant.js +84 -0
- package/dist/types/template/index.js +21 -0
- package/dist/types/utils/chrome/fast-refresh.js +329 -0
- package/dist/types/utils/chrome/index.js +321 -0
- package/dist/types/utils/chrome/messages.js +39 -0
- package/dist/types/utils/chrome/observability-plugin.js +85 -0
- package/dist/types/utils/chrome/observability-shared.js +125 -0
- package/dist/types/utils/chrome/observability.js +233 -0
- package/dist/types/utils/chrome/override-remote.js +17 -0
- package/dist/types/utils/chrome/post-message-init.js +5 -0
- package/dist/types/utils/chrome/post-message-listener.js +36 -0
- package/dist/types/utils/chrome/post-message-start.js +10 -0
- package/dist/types/utils/chrome/post-message.js +91 -0
- package/dist/types/utils/chrome/safe-post-message.js +147 -0
- package/dist/types/utils/chrome/snapshot-plugin.js +17 -0
- package/dist/types/utils/chrome/storage.js +71 -0
- package/dist/types/utils/data/index.js +83 -0
- package/dist/types/utils/index.js +27 -0
- package/dist/types/utils/sdk/graph.js +213 -0
- package/dist/types/utils/sdk/index.js +104 -0
- package/dist/types/utils/types/common.js +15 -0
- package/dist/types/utils/types/index.js +21 -0
- package/dist/types/vendor/basic-proxy-core.js +147 -0
- package/dist/types/worker/index.js +175 -0
- package/package.json +6 -6
|
@@ -0,0 +1,233 @@
|
|
|
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 __async = (__this, __arguments, generator) => {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
var fulfilled = (value) => {
|
|
21
|
+
try {
|
|
22
|
+
step(generator.next(value));
|
|
23
|
+
} catch (e) {
|
|
24
|
+
reject(e);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var rejected = (value) => {
|
|
28
|
+
try {
|
|
29
|
+
step(generator.throw(value));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
reject(e);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
35
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
var observability_exports = {};
|
|
39
|
+
__export(observability_exports, {
|
|
40
|
+
applyObservabilityConfig: () => applyObservabilityConfig,
|
|
41
|
+
disableObservabilityConfig: () => disableObservabilityConfig,
|
|
42
|
+
getObservabilityReportScopeLabel: () => getObservabilityReportScopeLabel,
|
|
43
|
+
mergeObservabilityReports: () => mergeObservabilityReports,
|
|
44
|
+
readObservabilityConfig: () => readObservabilityConfig,
|
|
45
|
+
readObservabilitySnapshot: () => readObservabilitySnapshot,
|
|
46
|
+
reloadInspectedPage: () => reloadInspectedPage
|
|
47
|
+
});
|
|
48
|
+
module.exports = __toCommonJS(observability_exports);
|
|
49
|
+
var import_index = require("./index");
|
|
50
|
+
var import_messages = require("./messages");
|
|
51
|
+
var import_observability_shared = require("./observability-shared");
|
|
52
|
+
const USER_OBSERVABILITY_PLUGIN_NAME = "observability-plugin";
|
|
53
|
+
const CHROME_OBSERVABILITY_PLUGIN_NAME = "observability-plugin:chrome-extension";
|
|
54
|
+
const LEGACY_CHROME_OBSERVABILITY_PLUGIN_NAME = "observability-plugin-devtools";
|
|
55
|
+
const OBSERVABILITY_SNAPSHOT_CONTEXT = {
|
|
56
|
+
chromeScope: import_observability_shared.CHROME_OBSERVABILITY_SCOPE,
|
|
57
|
+
userPluginName: USER_OBSERVABILITY_PLUGIN_NAME,
|
|
58
|
+
chromePluginNames: [
|
|
59
|
+
CHROME_OBSERVABILITY_PLUGIN_NAME,
|
|
60
|
+
LEGACY_CHROME_OBSERVABILITY_PLUGIN_NAME
|
|
61
|
+
]
|
|
62
|
+
};
|
|
63
|
+
const readConfigFromPage = (storageKey) => {
|
|
64
|
+
var _a;
|
|
65
|
+
try {
|
|
66
|
+
const raw = (_a = window.localStorage) == null ? void 0 : _a.getItem(storageKey);
|
|
67
|
+
return raw ? JSON.parse(raw) : null;
|
|
68
|
+
} catch (e) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const writeConfigToPage = (storageKey, config) => {
|
|
73
|
+
var _a;
|
|
74
|
+
(_a = window.localStorage) == null ? void 0 : _a.setItem(storageKey, JSON.stringify(config));
|
|
75
|
+
return config;
|
|
76
|
+
};
|
|
77
|
+
const removeConfigFromPage = (storageKey) => {
|
|
78
|
+
var _a;
|
|
79
|
+
(_a = window.localStorage) == null ? void 0 : _a.removeItem(storageKey);
|
|
80
|
+
return true;
|
|
81
|
+
};
|
|
82
|
+
const reloadPage = () => {
|
|
83
|
+
var _a;
|
|
84
|
+
(_a = globalThis.location) == null ? void 0 : _a.reload();
|
|
85
|
+
};
|
|
86
|
+
const readSnapshotFromPage = (storageKey, context) => {
|
|
87
|
+
const chromeScope = typeof (context == null ? void 0 : context.chromeScope) === "string" ? context.chromeScope : "chrome_extension";
|
|
88
|
+
const userPluginName = typeof (context == null ? void 0 : context.userPluginName) === "string" ? context.userPluginName : "observability-plugin";
|
|
89
|
+
const chromePluginNames = Array.isArray(context == null ? void 0 : context.chromePluginNames) ? context.chromePluginNames : [
|
|
90
|
+
"observability-plugin:chrome-extension",
|
|
91
|
+
"observability-plugin-devtools"
|
|
92
|
+
];
|
|
93
|
+
const safeCopy = (value) => {
|
|
94
|
+
try {
|
|
95
|
+
return JSON.parse(JSON.stringify(value));
|
|
96
|
+
} catch (e) {
|
|
97
|
+
return void 0;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const rawConfig = (() => {
|
|
101
|
+
var _a;
|
|
102
|
+
try {
|
|
103
|
+
const raw = (_a = window.localStorage) == null ? void 0 : _a.getItem(storageKey);
|
|
104
|
+
return raw ? JSON.parse(raw) : null;
|
|
105
|
+
} catch (e) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
})();
|
|
109
|
+
const federation = window.__FEDERATION__ || window.__VMOK__;
|
|
110
|
+
const readers = (federation == null ? void 0 : federation.__OBSERVABILITY__) || {};
|
|
111
|
+
const reports = [];
|
|
112
|
+
const scopes = Object.keys(readers);
|
|
113
|
+
const isChromeObservabilityPluginName = (name) => chromePluginNames.includes(String(name));
|
|
114
|
+
const hasUserObservabilityPluginFromInstances = Array.isArray(
|
|
115
|
+
federation == null ? void 0 : federation.__INSTANCES__
|
|
116
|
+
) ? federation.__INSTANCES__.some((instance) => {
|
|
117
|
+
var _a;
|
|
118
|
+
const plugins = (_a = instance == null ? void 0 : instance.options) == null ? void 0 : _a.plugins;
|
|
119
|
+
if (!Array.isArray(plugins)) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
return plugins.some(
|
|
123
|
+
(plugin) => (plugin == null ? void 0 : plugin.name) === userPluginName && !isChromeObservabilityPluginName(plugin == null ? void 0 : plugin.name)
|
|
124
|
+
);
|
|
125
|
+
}) : false;
|
|
126
|
+
const hasUserObservabilityPluginFromReaders = scopes.some(
|
|
127
|
+
(scope) => scope !== chromeScope
|
|
128
|
+
);
|
|
129
|
+
scopes.forEach((scope) => {
|
|
130
|
+
const reader = readers[scope];
|
|
131
|
+
if (!reader || typeof reader.getReports !== "function") {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
const scopeReports = reader.getReports({ limit: 100 });
|
|
136
|
+
if (!Array.isArray(scopeReports)) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
scopeReports.forEach((report) => {
|
|
140
|
+
const copied = safeCopy(report);
|
|
141
|
+
if (copied == null ? void 0 : copied.traceId) {
|
|
142
|
+
copied.__scope = scope;
|
|
143
|
+
reports.push(copied);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
} catch (e) {
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
return {
|
|
150
|
+
config: rawConfig,
|
|
151
|
+
stored: Boolean(rawConfig),
|
|
152
|
+
scopes,
|
|
153
|
+
reports,
|
|
154
|
+
hasUserObservabilityPlugin: hasUserObservabilityPluginFromInstances || hasUserObservabilityPluginFromReaders
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
const readObservabilityConfig = () => __async(void 0, null, function* () {
|
|
158
|
+
const config = yield (0, import_index.injectScript)(
|
|
159
|
+
readConfigFromPage,
|
|
160
|
+
false,
|
|
161
|
+
import_messages.OBSERVABILITY_DEVTOOLS_STORAGE_KEY
|
|
162
|
+
);
|
|
163
|
+
return (0, import_observability_shared.normalizeObservabilityDevtoolsConfig)(
|
|
164
|
+
config || import_observability_shared.DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG
|
|
165
|
+
);
|
|
166
|
+
});
|
|
167
|
+
const applyObservabilityConfig = (config) => __async(void 0, null, function* () {
|
|
168
|
+
return (0, import_index.injectScript)(
|
|
169
|
+
writeConfigToPage,
|
|
170
|
+
false,
|
|
171
|
+
import_messages.OBSERVABILITY_DEVTOOLS_STORAGE_KEY,
|
|
172
|
+
(0, import_observability_shared.normalizeObservabilityDevtoolsConfig)(config)
|
|
173
|
+
);
|
|
174
|
+
});
|
|
175
|
+
const disableObservabilityConfig = () => __async(void 0, null, function* () {
|
|
176
|
+
return (0, import_index.injectScript)(removeConfigFromPage, false, import_messages.OBSERVABILITY_DEVTOOLS_STORAGE_KEY);
|
|
177
|
+
});
|
|
178
|
+
const reloadInspectedPage = () => __async(void 0, null, function* () {
|
|
179
|
+
return (0, import_index.injectScript)(reloadPage, false);
|
|
180
|
+
});
|
|
181
|
+
const readObservabilitySnapshot = () => __async(void 0, null, function* () {
|
|
182
|
+
const snapshot = yield (0, import_index.injectScript)(
|
|
183
|
+
readSnapshotFromPage,
|
|
184
|
+
true,
|
|
185
|
+
import_messages.OBSERVABILITY_DEVTOOLS_STORAGE_KEY,
|
|
186
|
+
OBSERVABILITY_SNAPSHOT_CONTEXT
|
|
187
|
+
);
|
|
188
|
+
return {
|
|
189
|
+
config: (0, import_observability_shared.normalizeObservabilityDevtoolsConfig)(
|
|
190
|
+
(snapshot == null ? void 0 : snapshot.config) || import_observability_shared.DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG
|
|
191
|
+
),
|
|
192
|
+
stored: Boolean(snapshot == null ? void 0 : snapshot.stored),
|
|
193
|
+
scopes: Array.isArray(snapshot == null ? void 0 : snapshot.scopes) ? snapshot.scopes : [],
|
|
194
|
+
reports: Array.isArray(snapshot == null ? void 0 : snapshot.reports) ? snapshot.reports : [],
|
|
195
|
+
hasUserObservabilityPlugin: Boolean(snapshot == null ? void 0 : snapshot.hasUserObservabilityPlugin)
|
|
196
|
+
};
|
|
197
|
+
});
|
|
198
|
+
const mergeObservabilityReports = (currentReports, incomingReports) => {
|
|
199
|
+
const merged = /* @__PURE__ */ new Map();
|
|
200
|
+
currentReports.forEach((report) => {
|
|
201
|
+
if (report.traceId) {
|
|
202
|
+
merged.set(report.traceId, report);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
incomingReports.forEach((report) => {
|
|
206
|
+
if (report.traceId) {
|
|
207
|
+
merged.set(report.traceId, report);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
return Array.from(merged.values()).sort((left, right) => {
|
|
211
|
+
if ((right.updatedAt || 0) !== (left.updatedAt || 0)) {
|
|
212
|
+
return (right.updatedAt || 0) - (left.updatedAt || 0);
|
|
213
|
+
}
|
|
214
|
+
return (right.startedAt || 0) - (left.startedAt || 0);
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
const getObservabilityReportScopeLabel = (report) => {
|
|
218
|
+
const scope = report.__scope;
|
|
219
|
+
if (!scope || scope === import_observability_shared.CHROME_OBSERVABILITY_SCOPE) {
|
|
220
|
+
return void 0;
|
|
221
|
+
}
|
|
222
|
+
return `custom: ${scope}`;
|
|
223
|
+
};
|
|
224
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
225
|
+
0 && (module.exports = {
|
|
226
|
+
applyObservabilityConfig,
|
|
227
|
+
disableObservabilityConfig,
|
|
228
|
+
getObservabilityReportScopeLabel,
|
|
229
|
+
mergeObservabilityReports,
|
|
230
|
+
readObservabilityConfig,
|
|
231
|
+
readObservabilitySnapshot,
|
|
232
|
+
reloadInspectedPage
|
|
233
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var override_remote_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(override_remote_exports);
|
|
16
|
+
const basicProxyCore = require("../../vendor/basic-proxy-core.js");
|
|
17
|
+
basicProxyCore.registerOverridePlugin(globalThis);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var import_safe_post_message = require("./safe-post-message");
|
|
2
|
+
var import_messages = require("./messages");
|
|
3
|
+
const isModuleInfoPayload = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
4
|
+
const getMessageData = (data) => Boolean(data) && typeof data === "object" ? data : {};
|
|
5
|
+
if (window.moduleHandler) {
|
|
6
|
+
window.removeEventListener("message", window.moduleHandler);
|
|
7
|
+
} else {
|
|
8
|
+
window.moduleHandler = (event) => {
|
|
9
|
+
const { origin } = event;
|
|
10
|
+
const data = getMessageData(event.data);
|
|
11
|
+
if ((data == null ? void 0 : data.source) === import_messages.OBSERVABILITY_DEVTOOLS_SOURCE) {
|
|
12
|
+
chrome.runtime.sendMessage({
|
|
13
|
+
type: import_messages.MESSAGE_OBSERVABILITY_DEVTOOLS_EVENT,
|
|
14
|
+
origin,
|
|
15
|
+
data: (0, import_safe_post_message.sanitizePostMessagePayload)(data)
|
|
16
|
+
}).catch(() => {
|
|
17
|
+
return false;
|
|
18
|
+
});
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (!isModuleInfoPayload(data.moduleInfo)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
chrome.runtime.sendMessage({
|
|
25
|
+
origin,
|
|
26
|
+
data: (0, import_safe_post_message.sanitizePostMessagePayload)({
|
|
27
|
+
moduleInfo: data.moduleInfo,
|
|
28
|
+
updateModule: data.updateModule,
|
|
29
|
+
share: data.share
|
|
30
|
+
})
|
|
31
|
+
}).catch(() => {
|
|
32
|
+
return false;
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
window.addEventListener("message", window.moduleHandler);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var import_safe_post_message = require("./safe-post-message");
|
|
2
|
+
var _a, _b;
|
|
3
|
+
const moduleInfo = (_a = window == null ? void 0 : window.__FEDERATION__) == null ? void 0 : _a.moduleInfo;
|
|
4
|
+
window.postMessage(
|
|
5
|
+
(0, import_safe_post_message.sanitizePostMessagePayload)({
|
|
6
|
+
moduleInfo,
|
|
7
|
+
share: (_b = window == null ? void 0 : window.__FEDERATION__) == null ? void 0 : _b.__SHARE__
|
|
8
|
+
}),
|
|
9
|
+
"*"
|
|
10
|
+
);
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
var __copyProps = (to, from, except, desc) => {
|
|
34
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
35
|
+
for (let key of __getOwnPropNames(from))
|
|
36
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
37
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
38
|
+
}
|
|
39
|
+
return to;
|
|
40
|
+
};
|
|
41
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
42
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
43
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
44
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
45
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
46
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
47
|
+
mod
|
|
48
|
+
));
|
|
49
|
+
var import_helpers = __toESM(require("@module-federation/runtime/helpers"));
|
|
50
|
+
var import_sdk = require("../sdk");
|
|
51
|
+
var import_safe_post_message = require("./safe-post-message");
|
|
52
|
+
var _a;
|
|
53
|
+
const getModuleInfo = () => {
|
|
54
|
+
return {
|
|
55
|
+
name: "mf-devtool-getModuleInfo-plugin",
|
|
56
|
+
loadRemoteSnapshot(_a2) {
|
|
57
|
+
var _b = _a2, {
|
|
58
|
+
options,
|
|
59
|
+
moduleInfo,
|
|
60
|
+
remoteSnapshot
|
|
61
|
+
} = _b, res = __objRest(_b, [
|
|
62
|
+
"options",
|
|
63
|
+
"moduleInfo",
|
|
64
|
+
"remoteSnapshot"
|
|
65
|
+
]);
|
|
66
|
+
const globalSnapshot = import_helpers.default.global.getGlobalSnapshot();
|
|
67
|
+
if (!options || options.inBrowser) {
|
|
68
|
+
window.postMessage(
|
|
69
|
+
(0, import_safe_post_message.sanitizePostMessagePayload)({
|
|
70
|
+
moduleInfo: globalSnapshot,
|
|
71
|
+
updateModule: moduleInfo
|
|
72
|
+
}),
|
|
73
|
+
"*"
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
return __spreadValues({
|
|
77
|
+
options,
|
|
78
|
+
moduleInfo,
|
|
79
|
+
remoteSnapshot
|
|
80
|
+
}, res);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
if (!(window == null ? void 0 : window.__FEDERATION__)) {
|
|
85
|
+
(0, import_sdk.definePropertyGlobalVal)(window, "__FEDERATION__", {});
|
|
86
|
+
(0, import_sdk.definePropertyGlobalVal)(window, "__VMOK__", window.__FEDERATION__);
|
|
87
|
+
}
|
|
88
|
+
if (!(window == null ? void 0 : window.__FEDERATION__.__GLOBAL_PLUGIN__)) {
|
|
89
|
+
window.__FEDERATION__.__GLOBAL_PLUGIN__ = [];
|
|
90
|
+
}
|
|
91
|
+
(_a = window.__FEDERATION__.__GLOBAL_PLUGIN__) == null ? void 0 : _a.push(getModuleInfo());
|
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
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 __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);
|
|
@@ -0,0 +1,71 @@
|
|
|
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 __async = (__this, __arguments, generator) => {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
var fulfilled = (value) => {
|
|
21
|
+
try {
|
|
22
|
+
step(generator.next(value));
|
|
23
|
+
} catch (e) {
|
|
24
|
+
reject(e);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var rejected = (value) => {
|
|
28
|
+
try {
|
|
29
|
+
step(generator.throw(value));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
reject(e);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
35
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
var storage_exports = {};
|
|
39
|
+
__export(storage_exports, {
|
|
40
|
+
getStorageValue: () => getStorageValue,
|
|
41
|
+
mergeStorage: () => mergeStorage,
|
|
42
|
+
removeStorage: () => removeStorage,
|
|
43
|
+
removeStorageKey: () => removeStorageKey,
|
|
44
|
+
setStorage: () => setStorage
|
|
45
|
+
});
|
|
46
|
+
module.exports = __toCommonJS(storage_exports);
|
|
47
|
+
var import_sdk = require("../sdk");
|
|
48
|
+
var import_index = require("./index");
|
|
49
|
+
const mergeStorage = (...args) => __async(void 0, null, function* () {
|
|
50
|
+
return (0, import_index.injectScript)(import_sdk.mergeLocalStorage, false, ...args);
|
|
51
|
+
});
|
|
52
|
+
const removeStorageKey = (...args) => __async(void 0, null, function* () {
|
|
53
|
+
return (0, import_index.injectScript)(import_sdk.removeLocalStorageKey, false, ...args);
|
|
54
|
+
});
|
|
55
|
+
const removeStorage = (...args) => __async(void 0, null, function* () {
|
|
56
|
+
return (0, import_index.injectScript)(import_sdk.removeLocalStorage, false, ...args);
|
|
57
|
+
});
|
|
58
|
+
const setStorage = (...args) => __async(void 0, null, function* () {
|
|
59
|
+
return (0, import_index.injectScript)(import_sdk.setLocalStorage, false, ...args);
|
|
60
|
+
});
|
|
61
|
+
const getStorageValue = (...args) => __async(void 0, null, function* () {
|
|
62
|
+
return (0, import_index.injectScript)(import_sdk.getLocalStorage, false, ...args);
|
|
63
|
+
});
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
getStorageValue,
|
|
67
|
+
mergeStorage,
|
|
68
|
+
removeStorage,
|
|
69
|
+
removeStorageKey,
|
|
70
|
+
setStorage
|
|
71
|
+
});
|