@module-federation/devtools 2.6.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/es/App.js +3 -2
- package/dist/es/component/DependencyGraphItem/index.js +18 -7
- package/dist/es/utils/chrome/index.js +37 -17
- package/dist/es/utils/chrome/post-message-listener.js +5 -2
- package/dist/es/utils/sdk/graph.js +25 -11
- package/dist/lib/App.js +2 -3
- package/dist/lib/App.module.js +0 -1
- package/dist/lib/component/DependencyGraph/index.js +0 -1
- package/dist/lib/component/DependencyGraph/index.module.js +0 -1
- package/dist/lib/component/DependencyGraphItem/index.js +18 -8
- package/dist/lib/component/DependencyGraphItem/index.module.js +0 -1
- package/dist/lib/component/Form/index.js +0 -1
- package/dist/lib/component/Form/index.module.js +0 -1
- package/dist/lib/component/LanguageSwitch.js +0 -1
- package/dist/lib/component/Layout/index.js +0 -1
- package/dist/lib/component/Layout/index.module.js +0 -1
- package/dist/lib/component/LoadingTrace/index.js +0 -1
- package/dist/lib/component/LoadingTrace/index.module.js +0 -1
- package/dist/lib/component/ModuleInfo/index.js +0 -1
- package/dist/lib/component/ModuleInfo/index.module.js +0 -1
- package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.js +0 -1
- package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.module.js +0 -1
- package/dist/lib/component/SharedDepsExplorer/index.js +0 -1
- package/dist/lib/component/SharedDepsExplorer/index.module.js +0 -1
- package/dist/lib/component/SharedDepsExplorer/share-utils.js +0 -1
- package/dist/lib/component/ThemeToggle.js +0 -1
- package/dist/lib/component/ThemeToggle.module.js +0 -1
- package/dist/lib/hooks/useDevtoolsTheme.js +0 -1
- package/dist/lib/i18n/index.js +0 -1
- 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 +0 -1
- package/dist/lib/utils/chrome/index.js +38 -18
- package/dist/lib/utils/chrome/messages.js +0 -1
- package/dist/lib/utils/chrome/observability-plugin.js +0 -1
- package/dist/lib/utils/chrome/observability-shared.js +0 -1
- package/dist/lib/utils/chrome/observability.js +0 -1
- package/dist/lib/utils/chrome/override-remote.js +0 -1
- package/dist/lib/utils/chrome/post-message-init.js +0 -1
- package/dist/lib/utils/chrome/post-message-listener.js +5 -3
- package/dist/lib/utils/chrome/post-message-start.js +0 -1
- package/dist/lib/utils/chrome/post-message.js +0 -1
- package/dist/lib/utils/chrome/safe-post-message.js +0 -1
- package/dist/lib/utils/chrome/snapshot-plugin.js +0 -1
- package/dist/lib/utils/chrome/storage.js +0 -1
- package/dist/lib/utils/data/index.js +0 -1
- 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/worker/index.js +0 -1
- 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/component/SharedDepsExplorer/share-utils.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/index.d.ts +2 -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/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 +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 +8 -9
|
@@ -0,0 +1,83 @@
|
|
|
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 data_exports = {};
|
|
39
|
+
__export(data_exports, {
|
|
40
|
+
getModuleInfo: () => getModuleInfo,
|
|
41
|
+
separateType: () => separateType
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(data_exports);
|
|
44
|
+
const basicProxyCore = require("../../vendor/basic-proxy-core.js");
|
|
45
|
+
const separateType = (moduleInfo) => {
|
|
46
|
+
const consumers = {};
|
|
47
|
+
const producer = [];
|
|
48
|
+
Object.keys(moduleInfo).forEach((key) => {
|
|
49
|
+
var _a;
|
|
50
|
+
const remotesInfo = (_a = moduleInfo[key]) == null ? void 0 : _a.remotesInfo;
|
|
51
|
+
if (remotesInfo) {
|
|
52
|
+
const moduleIds = Object.keys(remotesInfo);
|
|
53
|
+
if (moduleIds.length) {
|
|
54
|
+
moduleIds.forEach((id) => {
|
|
55
|
+
let formatId = id;
|
|
56
|
+
if (id.includes(":")) {
|
|
57
|
+
formatId = id.split(":").pop();
|
|
58
|
+
}
|
|
59
|
+
const hasBeenAdded = producer.includes(formatId);
|
|
60
|
+
if (!hasBeenAdded) {
|
|
61
|
+
producer.push(id);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
consumers[key] = moduleInfo[key];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return {
|
|
69
|
+
consumers,
|
|
70
|
+
producer
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
const getModuleInfo = (proxyRules) => __async(void 0, null, function* () {
|
|
74
|
+
return basicProxyCore.getModuleInfo(
|
|
75
|
+
proxyRules,
|
|
76
|
+
window.__FEDERATION__.moduleInfo
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
+
0 && (module.exports = {
|
|
81
|
+
getModuleInfo,
|
|
82
|
+
separateType
|
|
83
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
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 utils_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(utils_exports);
|
|
17
|
+
__reExport(utils_exports, require("./chrome"), module.exports);
|
|
18
|
+
__reExport(utils_exports, require("./sdk"), module.exports);
|
|
19
|
+
__reExport(utils_exports, require("./data"), module.exports);
|
|
20
|
+
__reExport(utils_exports, require("./types"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("./chrome"),
|
|
24
|
+
...require("./sdk"),
|
|
25
|
+
...require("./data"),
|
|
26
|
+
...require("./types")
|
|
27
|
+
});
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __export = (target, all) => {
|
|
20
|
+
for (var name in all)
|
|
21
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
22
|
+
};
|
|
23
|
+
var __copyProps = (to, from, except, desc) => {
|
|
24
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
25
|
+
for (let key of __getOwnPropNames(from))
|
|
26
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
27
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
28
|
+
}
|
|
29
|
+
return to;
|
|
30
|
+
};
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
var graph_exports = {};
|
|
33
|
+
__export(graph_exports, {
|
|
34
|
+
DependencyGraph: () => DependencyGraph,
|
|
35
|
+
validatePort: () => validatePort,
|
|
36
|
+
validateSemver: () => validateSemver
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(graph_exports);
|
|
39
|
+
var import_reactflow = require("reactflow");
|
|
40
|
+
const validateSemver = (schema) => {
|
|
41
|
+
const reg = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(\.(0|[1-9]\d*))?(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/gm;
|
|
42
|
+
return reg.test(schema);
|
|
43
|
+
};
|
|
44
|
+
const validatePort = (schema) => !isNaN(Number(schema));
|
|
45
|
+
const isEntrySegment = (segment) => segment.startsWith("http") || segment.startsWith("//");
|
|
46
|
+
const parseModuleId = (target) => {
|
|
47
|
+
const array = target.split(":");
|
|
48
|
+
const { length } = array;
|
|
49
|
+
const result = {
|
|
50
|
+
name: target,
|
|
51
|
+
version: ""
|
|
52
|
+
};
|
|
53
|
+
if (length === 1) {
|
|
54
|
+
return result;
|
|
55
|
+
} else if (length >= 3) {
|
|
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;
|
|
61
|
+
}
|
|
62
|
+
result.name = array[1];
|
|
63
|
+
result.version = array.slice(2).join(":");
|
|
64
|
+
return result;
|
|
65
|
+
} else {
|
|
66
|
+
const nameOrVersion = array[length - 1];
|
|
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;
|
|
71
|
+
} else {
|
|
72
|
+
result.name = nameOrVersion;
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
};
|
|
78
|
+
class DependencyGraph {
|
|
79
|
+
constructor(snapshot, initTarget) {
|
|
80
|
+
this.snapshot = snapshot;
|
|
81
|
+
this.initTarget = initTarget;
|
|
82
|
+
this.node = [];
|
|
83
|
+
this.edge = [];
|
|
84
|
+
this.graph = {};
|
|
85
|
+
this.identifyMap = /* @__PURE__ */ new Map();
|
|
86
|
+
this.handledModuleMap = /* @__PURE__ */ new Map();
|
|
87
|
+
}
|
|
88
|
+
createGraph(target = this.initTarget) {
|
|
89
|
+
const { snapshot } = this;
|
|
90
|
+
let remotesInfo;
|
|
91
|
+
const snapshotWithoutType = snapshot[target];
|
|
92
|
+
const snapshotWithType = snapshot[target];
|
|
93
|
+
if (snapshotWithoutType && "remotesInfo" in snapshotWithoutType) {
|
|
94
|
+
remotesInfo = snapshotWithoutType == null ? void 0 : snapshotWithoutType.remotesInfo;
|
|
95
|
+
}
|
|
96
|
+
if (snapshotWithType && "remotesInfo" in snapshotWithType) {
|
|
97
|
+
remotesInfo = snapshotWithType == null ? void 0 : snapshotWithType.remotesInfo;
|
|
98
|
+
}
|
|
99
|
+
if (!remotesInfo) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
Object.entries(remotesInfo).forEach(([dep, remoteInfo]) => {
|
|
103
|
+
const { matchedVersion } = remoteInfo;
|
|
104
|
+
let childId = dep;
|
|
105
|
+
if (matchedVersion && matchedVersion !== "") {
|
|
106
|
+
childId = `${childId}:${matchedVersion}`;
|
|
107
|
+
}
|
|
108
|
+
if (!this.graph[target]) {
|
|
109
|
+
this.graph[target] = {};
|
|
110
|
+
}
|
|
111
|
+
this.graph[childId] = {};
|
|
112
|
+
this.graph[target][childId] = this.graph[childId];
|
|
113
|
+
const handled = this.handledModuleMap.get(childId);
|
|
114
|
+
if (!handled) {
|
|
115
|
+
this.handledModuleMap.set(childId, true);
|
|
116
|
+
this.createGraph(childId);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
addNode(id, type, x, y, nodeData) {
|
|
121
|
+
this.node.push({
|
|
122
|
+
id,
|
|
123
|
+
type,
|
|
124
|
+
position: {
|
|
125
|
+
x,
|
|
126
|
+
y
|
|
127
|
+
},
|
|
128
|
+
data: __spreadValues({}, nodeData)
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
addEdge(id, source, target, type = "default") {
|
|
132
|
+
this.edge.push({
|
|
133
|
+
id,
|
|
134
|
+
source,
|
|
135
|
+
target,
|
|
136
|
+
markerEnd: {
|
|
137
|
+
type: import_reactflow.MarkerType.Arrow,
|
|
138
|
+
width: 30,
|
|
139
|
+
height: 30
|
|
140
|
+
},
|
|
141
|
+
type
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
run(targetGraph, target = this.initTarget, type, id = this.initTarget, depth = 0, maxDepth = Infinity) {
|
|
145
|
+
var _a;
|
|
146
|
+
if (!targetGraph || !((_a = Object.keys(targetGraph)) == null ? void 0 : _a.length)) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const { name, version } = parseModuleId(target);
|
|
150
|
+
const targetWithoutType = name;
|
|
151
|
+
let info = name;
|
|
152
|
+
const remote = this.snapshot[target];
|
|
153
|
+
if (remote && ("version" in remote || "remoteEntry" in remote)) {
|
|
154
|
+
info += `:${remote.version || remote.remoteEntry}`;
|
|
155
|
+
} else if (version) {
|
|
156
|
+
info += `:${version}`;
|
|
157
|
+
}
|
|
158
|
+
if (!this.identifyMap.has(targetWithoutType)) {
|
|
159
|
+
this.identifyMap.set(targetWithoutType, this.identify());
|
|
160
|
+
}
|
|
161
|
+
this.addNode(id, type, 0, 0, {
|
|
162
|
+
info,
|
|
163
|
+
remote,
|
|
164
|
+
color: this.identifyMap.get(targetWithoutType)
|
|
165
|
+
});
|
|
166
|
+
const graphChilden = Object.keys(
|
|
167
|
+
targetGraph[targetWithoutType] || targetGraph[target] || {}
|
|
168
|
+
);
|
|
169
|
+
graphChilden.forEach((dep) => {
|
|
170
|
+
if (depth + 1 > maxDepth) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
this.addEdge(id + dep, id, id + dep);
|
|
174
|
+
this.run(
|
|
175
|
+
targetGraph[targetWithoutType] || targetGraph[target],
|
|
176
|
+
dep,
|
|
177
|
+
type,
|
|
178
|
+
id + dep,
|
|
179
|
+
depth + 1,
|
|
180
|
+
maxDepth
|
|
181
|
+
);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
identify() {
|
|
185
|
+
const r = Math.floor(Math.random() * 255);
|
|
186
|
+
const g = Math.floor(Math.random() * 255);
|
|
187
|
+
const b = Math.floor(Math.random() * 255);
|
|
188
|
+
const color = `rgba(${r},${g},${b},0.8)`;
|
|
189
|
+
return color;
|
|
190
|
+
}
|
|
191
|
+
calculateDepth(target = this.initTarget, visited = /* @__PURE__ */ new Set()) {
|
|
192
|
+
if (visited.has(target)) {
|
|
193
|
+
return 0;
|
|
194
|
+
}
|
|
195
|
+
visited.add(target);
|
|
196
|
+
const children = this.graph[target] ? Object.keys(this.graph[target]) : [];
|
|
197
|
+
if (children.length === 0) {
|
|
198
|
+
visited.delete(target);
|
|
199
|
+
return 0;
|
|
200
|
+
}
|
|
201
|
+
const maxChildDepth = Math.max(
|
|
202
|
+
...children.map((child) => this.calculateDepth(child, visited))
|
|
203
|
+
);
|
|
204
|
+
visited.delete(target);
|
|
205
|
+
return 1 + maxChildDepth;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
209
|
+
0 && (module.exports = {
|
|
210
|
+
DependencyGraph,
|
|
211
|
+
validatePort,
|
|
212
|
+
validateSemver
|
|
213
|
+
});
|
|
@@ -0,0 +1,104 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var sdk_exports = {};
|
|
20
|
+
__export(sdk_exports, {
|
|
21
|
+
definePropertyGlobalVal: () => definePropertyGlobalVal,
|
|
22
|
+
getLocalStorage: () => getLocalStorage,
|
|
23
|
+
getUnpkgUrl: () => getUnpkgUrl,
|
|
24
|
+
isObject: () => isObject,
|
|
25
|
+
mergeLocalStorage: () => mergeLocalStorage,
|
|
26
|
+
reloadPage: () => reloadPage,
|
|
27
|
+
removeLocalStorage: () => removeLocalStorage,
|
|
28
|
+
removeLocalStorageKey: () => removeLocalStorageKey,
|
|
29
|
+
setLocalStorage: () => setLocalStorage,
|
|
30
|
+
validateCustom: () => validateCustom
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(sdk_exports);
|
|
33
|
+
__reExport(sdk_exports, require("./graph"), module.exports);
|
|
34
|
+
const setLocalStorage = (key, value) => {
|
|
35
|
+
localStorage.setItem(key, value);
|
|
36
|
+
};
|
|
37
|
+
const getLocalStorage = (key) => {
|
|
38
|
+
try {
|
|
39
|
+
return localStorage.getItem(key);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.warn("[MF Devtools] getLocalStorage failed", error);
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const removeLocalStorage = (key) => {
|
|
46
|
+
const data = localStorage.getItem(key);
|
|
47
|
+
if (data) {
|
|
48
|
+
localStorage.removeItem(key);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const mergeLocalStorage = (target, key, value) => {
|
|
52
|
+
const str = localStorage.getItem(target);
|
|
53
|
+
const obj = JSON.parse(str || "{}");
|
|
54
|
+
obj[key] = value;
|
|
55
|
+
localStorage.setItem(target, JSON.stringify(obj));
|
|
56
|
+
};
|
|
57
|
+
const removeLocalStorageKey = (target, key) => {
|
|
58
|
+
const str = localStorage.getItem(target);
|
|
59
|
+
if (str) {
|
|
60
|
+
const obj = JSON.parse(str || "{}");
|
|
61
|
+
delete obj[key];
|
|
62
|
+
localStorage.setItem(target, JSON.stringify(obj));
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const isObject = (target) => Object.prototype.toString.call(target) === "[object Object]";
|
|
66
|
+
const reloadPage = () => {
|
|
67
|
+
var _a;
|
|
68
|
+
(_a = globalThis == null ? void 0 : globalThis.location) == null ? void 0 : _a.reload();
|
|
69
|
+
};
|
|
70
|
+
const validateCustom = (schema) => schema == null ? void 0 : schema.endsWith(".json");
|
|
71
|
+
const getUnpkgUrl = (pkg, version) => {
|
|
72
|
+
if (pkg === "react") {
|
|
73
|
+
return `https://unpkg.com/react@${version}/umd/react.development.js`;
|
|
74
|
+
} else if (pkg === "react-dom") {
|
|
75
|
+
return `https://unpkg.com/react-dom@${version}/umd/react-dom.development.js`;
|
|
76
|
+
} else if (pkg === "vue") {
|
|
77
|
+
if ((version || "").split(".")[0] === "3") {
|
|
78
|
+
return `https://unpkg.com/vue@${version}/dist/vue.global.js`;
|
|
79
|
+
} else {
|
|
80
|
+
return `https://unpkg.com/vue@${version}/dist/vue.common.dev.js`;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const definePropertyGlobalVal = (target, key, val) => {
|
|
85
|
+
Object.defineProperty(target, key, {
|
|
86
|
+
value: val,
|
|
87
|
+
configurable: false,
|
|
88
|
+
writable: true
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
92
|
+
0 && (module.exports = {
|
|
93
|
+
definePropertyGlobalVal,
|
|
94
|
+
getLocalStorage,
|
|
95
|
+
getUnpkgUrl,
|
|
96
|
+
isObject,
|
|
97
|
+
mergeLocalStorage,
|
|
98
|
+
reloadPage,
|
|
99
|
+
removeLocalStorage,
|
|
100
|
+
removeLocalStorageKey,
|
|
101
|
+
setLocalStorage,
|
|
102
|
+
validateCustom,
|
|
103
|
+
...require("./graph")
|
|
104
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
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 common_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(common_exports);
|
|
@@ -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;
|