@module-federation/devtools 2.4.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/es/App.js +17 -2
- package/dist/es/App_module.css +3 -3
- package/dist/es/component/LoadingTrace/index.js +944 -0
- package/dist/es/component/LoadingTrace/index.module.js +5 -0
- package/dist/es/component/LoadingTrace/index_module.css +876 -0
- package/dist/es/i18n/index.js +178 -0
- package/dist/es/utils/chrome/index.js +3 -4
- package/dist/es/utils/chrome/messages.js +7 -1
- package/dist/es/utils/chrome/observability-plugin.js +93 -0
- package/dist/es/utils/chrome/observability-shared.js +99 -0
- package/dist/es/utils/chrome/observability.js +208 -0
- package/dist/es/utils/chrome/override-remote.js +2 -42
- package/dist/es/utils/chrome/post-message-listener.js +14 -0
- package/dist/es/utils/chrome/snapshot-plugin.js +2 -36
- package/dist/es/utils/data/index.js +5 -25
- package/dist/es/vendor/basic-proxy-core.js +155 -0
- package/dist/es/worker/index.js +27 -8
- package/dist/lib/App.js +17 -2
- package/dist/lib/App_module.css +3 -3
- package/dist/lib/component/LoadingTrace/index.js +954 -0
- package/dist/lib/component/LoadingTrace/index.module.js +25 -0
- package/dist/lib/component/LoadingTrace/index_module.css +876 -0
- package/dist/lib/i18n/index.js +178 -0
- package/dist/lib/utils/chrome/index.js +3 -4
- package/dist/lib/utils/chrome/messages.js +11 -2
- package/dist/lib/utils/chrome/observability-plugin.js +86 -0
- package/dist/lib/utils/chrome/observability-shared.js +126 -0
- package/dist/lib/utils/chrome/observability.js +234 -0
- package/dist/lib/utils/chrome/override-remote.js +5 -52
- package/dist/lib/utils/chrome/post-message-listener.js +11 -0
- package/dist/lib/utils/chrome/snapshot-plugin.js +5 -46
- package/dist/lib/utils/data/index.js +6 -28
- package/dist/lib/vendor/basic-proxy-core.js +147 -0
- package/dist/lib/worker/index.js +27 -8
- package/dist/types/src/component/LoadingTrace/index.d.ts +6 -0
- package/dist/types/src/utils/chrome/messages.d.ts +3 -0
- package/dist/types/src/utils/chrome/observability-plugin.d.ts +1 -0
- package/dist/types/src/utils/chrome/observability-shared.d.ts +41 -0
- package/dist/types/src/utils/chrome/observability.d.ts +110 -0
- package/dist/types/src/utils/chrome/snapshot-plugin.d.ts +0 -3
- package/dist/types/src/utils/data/index.d.ts +0 -1
- package/package.json +4 -3
- package/dist/es/utils/data/snapshot.js +0 -82
- package/dist/lib/utils/data/snapshot.js +0 -107
- package/dist/types/src/utils/data/snapshot.d.ts +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type ObservabilityDevtoolsLevel = 'error' | 'summary' | 'verbose';
|
|
2
|
+
export type ObservabilityDevtoolsMode = 'development' | 'production';
|
|
3
|
+
export interface ObservabilityDevtoolsConfig {
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
level: ObservabilityDevtoolsLevel;
|
|
6
|
+
maxEvents: number;
|
|
7
|
+
console: boolean;
|
|
8
|
+
browser: {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
scope: string;
|
|
11
|
+
mode: ObservabilityDevtoolsMode;
|
|
12
|
+
};
|
|
13
|
+
trace: {
|
|
14
|
+
printStart: boolean;
|
|
15
|
+
};
|
|
16
|
+
react: {
|
|
17
|
+
injectLoadedCallback: boolean;
|
|
18
|
+
remoteIds: string[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare const CHROME_OBSERVABILITY_SCOPE = "chrome_extension";
|
|
22
|
+
export declare const DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG: ObservabilityDevtoolsConfig;
|
|
23
|
+
export declare const normalizeObservabilityDevtoolsConfig: (value?: Partial<ObservabilityDevtoolsConfig> | Record<string, unknown> | null) => ObservabilityDevtoolsConfig;
|
|
24
|
+
export declare const createObservabilityPluginOptions: (config: ObservabilityDevtoolsConfig) => {
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
level: ObservabilityDevtoolsLevel;
|
|
27
|
+
maxEvents: number;
|
|
28
|
+
console: boolean;
|
|
29
|
+
browser: {
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
scope: string;
|
|
32
|
+
mode: ObservabilityDevtoolsMode;
|
|
33
|
+
};
|
|
34
|
+
trace: {
|
|
35
|
+
printStart: boolean;
|
|
36
|
+
};
|
|
37
|
+
devtools: {
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
source: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type ObservabilityDevtoolsConfig } from './observability-shared';
|
|
2
|
+
export interface ObservabilityDevtoolsEvent {
|
|
3
|
+
traceId: string;
|
|
4
|
+
timestamp: number;
|
|
5
|
+
phase: string;
|
|
6
|
+
status: string;
|
|
7
|
+
requestId?: string;
|
|
8
|
+
lifecycle?: string;
|
|
9
|
+
message?: string;
|
|
10
|
+
runtimeVersion?: string;
|
|
11
|
+
remote?: {
|
|
12
|
+
name?: string;
|
|
13
|
+
entry?: string;
|
|
14
|
+
alias?: string;
|
|
15
|
+
};
|
|
16
|
+
shared?: {
|
|
17
|
+
name?: string;
|
|
18
|
+
shareScope?: string[];
|
|
19
|
+
requiredVersion?: string | false;
|
|
20
|
+
selectedVersion?: string;
|
|
21
|
+
availableVersions?: string[];
|
|
22
|
+
provider?: string;
|
|
23
|
+
reason?: string;
|
|
24
|
+
};
|
|
25
|
+
expose?: string;
|
|
26
|
+
duration?: number;
|
|
27
|
+
errorCode?: string;
|
|
28
|
+
errorName?: string;
|
|
29
|
+
errorMessage?: string;
|
|
30
|
+
ownerHint?: string;
|
|
31
|
+
recovered?: boolean;
|
|
32
|
+
cached?: boolean;
|
|
33
|
+
loadedBefore?: ObservabilityDevtoolsLoadedBefore;
|
|
34
|
+
}
|
|
35
|
+
export interface ObservabilityDevtoolsLoadedBefore {
|
|
36
|
+
producer: boolean;
|
|
37
|
+
expose: boolean;
|
|
38
|
+
consumers: Array<{
|
|
39
|
+
name?: string;
|
|
40
|
+
remoteEntryExports?: boolean;
|
|
41
|
+
containerInitialized?: boolean;
|
|
42
|
+
exposes?: string[];
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
45
|
+
export interface ObservabilityDevtoolsReport {
|
|
46
|
+
traceId: string;
|
|
47
|
+
status: string;
|
|
48
|
+
requestId?: string;
|
|
49
|
+
hostName?: string;
|
|
50
|
+
runtimeVersion?: string;
|
|
51
|
+
remote?: {
|
|
52
|
+
name?: string;
|
|
53
|
+
entry?: string;
|
|
54
|
+
alias?: string;
|
|
55
|
+
};
|
|
56
|
+
shared?: {
|
|
57
|
+
name?: string;
|
|
58
|
+
shareScope?: string[];
|
|
59
|
+
requiredVersion?: string | false;
|
|
60
|
+
selectedVersion?: string;
|
|
61
|
+
availableVersions?: string[];
|
|
62
|
+
provider?: string;
|
|
63
|
+
reason?: string;
|
|
64
|
+
};
|
|
65
|
+
expose?: string;
|
|
66
|
+
startedAt: number;
|
|
67
|
+
updatedAt: number;
|
|
68
|
+
duration: number;
|
|
69
|
+
failedPhase?: string;
|
|
70
|
+
errorCode?: string;
|
|
71
|
+
errorName?: string;
|
|
72
|
+
errorMessage?: string;
|
|
73
|
+
ownerHint?: string;
|
|
74
|
+
loadedBefore?: ObservabilityDevtoolsLoadedBefore;
|
|
75
|
+
events: ObservabilityDevtoolsEvent[];
|
|
76
|
+
summary?: {
|
|
77
|
+
outcome?: string;
|
|
78
|
+
runtimeLoaded?: boolean;
|
|
79
|
+
sharedResolved?: boolean;
|
|
80
|
+
componentLoaded?: boolean;
|
|
81
|
+
loadCompleted?: boolean;
|
|
82
|
+
recovered?: boolean;
|
|
83
|
+
lastPhase?: string;
|
|
84
|
+
};
|
|
85
|
+
diagnosis?: {
|
|
86
|
+
title?: string;
|
|
87
|
+
ownerHint?: string;
|
|
88
|
+
errorCode?: string;
|
|
89
|
+
actions?: Array<{
|
|
90
|
+
title?: string;
|
|
91
|
+
detail?: string;
|
|
92
|
+
}>;
|
|
93
|
+
warnings?: string[];
|
|
94
|
+
};
|
|
95
|
+
__scope?: string;
|
|
96
|
+
}
|
|
97
|
+
export interface ObservabilityDevtoolsSnapshot {
|
|
98
|
+
config: ObservabilityDevtoolsConfig;
|
|
99
|
+
stored: boolean;
|
|
100
|
+
scopes: string[];
|
|
101
|
+
reports: ObservabilityDevtoolsReport[];
|
|
102
|
+
hasUserObservabilityPlugin: boolean;
|
|
103
|
+
}
|
|
104
|
+
export declare const readObservabilityConfig: () => Promise<ObservabilityDevtoolsConfig>;
|
|
105
|
+
export declare const applyObservabilityConfig: (config: ObservabilityDevtoolsConfig) => Promise<any>;
|
|
106
|
+
export declare const disableObservabilityConfig: () => Promise<any>;
|
|
107
|
+
export declare const reloadInspectedPage: () => Promise<any>;
|
|
108
|
+
export declare const readObservabilitySnapshot: () => Promise<ObservabilityDevtoolsSnapshot>;
|
|
109
|
+
export declare const mergeObservabilityReports: (currentReports: ObservabilityDevtoolsReport[], incomingReports: ObservabilityDevtoolsReport[]) => ObservabilityDevtoolsReport[];
|
|
110
|
+
export declare const getObservabilityReportScopeLabel: (report: Pick<ObservabilityDevtoolsReport, "__scope">) => string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/devtools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"echarts-for-react": "3.0.5",
|
|
48
48
|
"i18next": "23.0.0",
|
|
49
49
|
"react-i18next": "15.0.0",
|
|
50
|
-
"@module-federation/sdk": "2.
|
|
50
|
+
"@module-federation/sdk": "2.5.1",
|
|
51
|
+
"@module-federation/observability-plugin": "2.5.1"
|
|
51
52
|
},
|
|
52
53
|
"peerDependencies": {
|
|
53
54
|
"react": "^18 || ^19",
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
"typescript": "5.9.3",
|
|
83
84
|
"rimraf": "~6.0.1",
|
|
84
85
|
"vitest": "1.2.2",
|
|
85
|
-
"@module-federation/runtime": "2.
|
|
86
|
+
"@module-federation/runtime": "2.5.1"
|
|
86
87
|
},
|
|
87
88
|
"scripts": {
|
|
88
89
|
"build:storybook": "storybook build",
|
|
@@ -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;
|