@module-federation/devtools 0.0.0-next-20240425091022
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/LICENSE +21 -0
- package/README.md +30 -0
- package/dist/es/App.js +31 -0
- package/dist/es/App.module.js +5 -0
- package/dist/es/App_module.css +19 -0
- package/dist/es/component/Form/index.js +283 -0
- package/dist/es/component/Form/index.module.js +5 -0
- package/dist/es/component/Form/index_module.css +43 -0
- package/dist/es/component/Graph/index.js +127 -0
- package/dist/es/component/Graph/index.module.js +5 -0
- package/dist/es/component/Graph/index_module.css +12 -0
- package/dist/es/component/GraphItem/index.js +73 -0
- package/dist/es/component/GraphItem/index.module.js +5 -0
- package/dist/es/component/GraphItem/index_module.css +56 -0
- package/dist/es/component/Layout/index.js +207 -0
- package/dist/es/component/Layout/index.module.js +5 -0
- package/dist/es/component/Layout/index_module.css +48 -0
- package/dist/es/init.js +8 -0
- package/dist/es/template/constant.js +65 -0
- package/dist/es/template/index.js +1 -0
- package/dist/es/utils/chrome/fast-refresh-init.js +5 -0
- package/dist/es/utils/chrome/fast-refresh.js +113 -0
- package/dist/es/utils/chrome/index.js +211 -0
- package/dist/es/utils/chrome/post-message-init.js +5 -0
- package/dist/es/utils/chrome/post-message-listener.js +20 -0
- package/dist/es/utils/chrome/post-message-start.js +8 -0
- package/dist/es/utils/chrome/post-message.js +62 -0
- package/dist/es/utils/chrome/snapshot-plugin-init.js +5 -0
- package/dist/es/utils/chrome/snapshot-plugin.js +36 -0
- package/dist/es/utils/chrome/storage.js +45 -0
- package/dist/es/utils/data/index.js +79 -0
- package/dist/es/utils/data/snapshot.js +82 -0
- package/dist/es/utils/index.js +4 -0
- package/dist/es/utils/sdk/graph.js +148 -0
- package/dist/es/utils/sdk/index.js +55 -0
- package/dist/es/utils/types/common.js +0 -0
- package/dist/es/utils/types/index.js +1 -0
- package/dist/es/worker/index.js +1 -0
- package/dist/lib/App.js +61 -0
- package/dist/lib/App.module.js +25 -0
- package/dist/lib/App_module.css +19 -0
- package/dist/lib/component/Form/index.js +295 -0
- package/dist/lib/component/Form/index.module.js +25 -0
- package/dist/lib/component/Form/index_module.css +43 -0
- package/dist/lib/component/Graph/index.js +149 -0
- package/dist/lib/component/Graph/index.module.js +25 -0
- package/dist/lib/component/Graph/index_module.css +12 -0
- package/dist/lib/component/GraphItem/index.js +103 -0
- package/dist/lib/component/GraphItem/index.module.js +25 -0
- package/dist/lib/component/GraphItem/index_module.css +56 -0
- package/dist/lib/component/Layout/index.js +214 -0
- package/dist/lib/component/Layout/index.module.js +25 -0
- package/dist/lib/component/Layout/index_module.css +48 -0
- package/dist/lib/init.js +9 -0
- package/dist/lib/template/constant.js +95 -0
- package/dist/lib/template/index.js +22 -0
- package/dist/lib/utils/chrome/fast-refresh-init.js +6 -0
- package/dist/lib/utils/chrome/fast-refresh.js +114 -0
- package/dist/lib/utils/chrome/index.js +245 -0
- package/dist/lib/utils/chrome/post-message-init.js +6 -0
- package/dist/lib/utils/chrome/post-message-listener.js +21 -0
- package/dist/lib/utils/chrome/post-message-start.js +9 -0
- package/dist/lib/utils/chrome/post-message.js +83 -0
- package/dist/lib/utils/chrome/snapshot-plugin-init.js +6 -0
- package/dist/lib/utils/chrome/snapshot-plugin.js +59 -0
- package/dist/lib/utils/chrome/storage.js +67 -0
- package/dist/lib/utils/data/index.js +106 -0
- package/dist/lib/utils/data/snapshot.js +107 -0
- package/dist/lib/utils/index.js +28 -0
- package/dist/lib/utils/sdk/graph.js +171 -0
- package/dist/lib/utils/sdk/index.js +89 -0
- package/dist/lib/utils/types/common.js +16 -0
- package/dist/lib/utils/types/index.js +22 -0
- package/dist/lib/worker/index.js +2 -0
- package/dist/types/src/App.d.ts +6 -0
- package/dist/types/src/component/Form/index.d.ts +18 -0
- package/dist/types/src/component/Graph/index.d.ts +7 -0
- package/dist/types/src/component/GraphItem/index.d.ts +10 -0
- package/dist/types/src/component/Layout/index.d.ts +7 -0
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/init.d.ts +13 -0
- package/dist/types/src/template/constant.d.ts +23 -0
- package/dist/types/src/template/index.d.ts +1 -0
- package/dist/types/src/utils/chrome/fast-refresh-init.d.ts +1 -0
- package/dist/types/src/utils/chrome/fast-refresh.d.ts +1 -0
- package/dist/types/src/utils/chrome/index.d.ts +16 -0
- package/dist/types/src/utils/chrome/post-message-init.d.ts +1 -0
- package/dist/types/src/utils/chrome/post-message-listener.d.ts +0 -0
- package/dist/types/src/utils/chrome/post-message-start.d.ts +1 -0
- package/dist/types/src/utils/chrome/post-message.d.ts +1 -0
- package/dist/types/src/utils/chrome/snapshot-plugin-init.d.ts +1 -0
- package/dist/types/src/utils/chrome/snapshot-plugin.d.ts +4 -0
- package/dist/types/src/utils/chrome/storage.d.ts +4 -0
- package/dist/types/src/utils/data/index.d.ts +11 -0
- package/dist/types/src/utils/data/snapshot.d.ts +3 -0
- package/dist/types/src/utils/index.d.ts +4 -0
- package/dist/types/src/utils/sdk/graph.d.ts +44 -0
- package/dist/types/src/utils/sdk/index.d.ts +10 -0
- package/dist/types/src/utils/types/common.d.ts +15 -0
- package/dist/types/src/utils/types/index.d.ts +1 -0
- package/dist/types/src/worker/index.d.ts +0 -0
- package/dist/types/stories/index.stories.d.ts +9 -0
- package/install-deps.bash +8 -0
- package/package.json +85 -0
|
@@ -0,0 +1,67 @@
|
|
|
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 __async = (__this, __arguments, generator) => {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
var fulfilled = (value) => {
|
|
22
|
+
try {
|
|
23
|
+
step(generator.next(value));
|
|
24
|
+
} catch (e) {
|
|
25
|
+
reject(e);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var rejected = (value) => {
|
|
29
|
+
try {
|
|
30
|
+
step(generator.throw(value));
|
|
31
|
+
} catch (e) {
|
|
32
|
+
reject(e);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
36
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
var storage_exports = {};
|
|
40
|
+
__export(storage_exports, {
|
|
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
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
mergeStorage,
|
|
64
|
+
removeStorage,
|
|
65
|
+
removeStorageKey,
|
|
66
|
+
setStorage
|
|
67
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var __async = (__this, __arguments, generator) => {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
var fulfilled = (value) => {
|
|
23
|
+
try {
|
|
24
|
+
step(generator.next(value));
|
|
25
|
+
} catch (e) {
|
|
26
|
+
reject(e);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var rejected = (value) => {
|
|
30
|
+
try {
|
|
31
|
+
step(generator.throw(value));
|
|
32
|
+
} catch (e) {
|
|
33
|
+
reject(e);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
37
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
var data_exports = {};
|
|
41
|
+
__export(data_exports, {
|
|
42
|
+
getModuleInfo: () => getModuleInfo,
|
|
43
|
+
separateType: () => separateType
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(data_exports);
|
|
46
|
+
var import_snapshot = require("./snapshot");
|
|
47
|
+
__reExport(data_exports, require("./snapshot"), module.exports);
|
|
48
|
+
const separateType = (moduleInfo) => {
|
|
49
|
+
const consumers = {};
|
|
50
|
+
const producer = [];
|
|
51
|
+
Object.keys(moduleInfo).forEach((key) => {
|
|
52
|
+
var _a;
|
|
53
|
+
const remotesInfo = (_a = moduleInfo[key]) == null ? void 0 : _a.remotesInfo;
|
|
54
|
+
if (remotesInfo) {
|
|
55
|
+
const moduleIds = Object.keys(remotesInfo);
|
|
56
|
+
if (moduleIds.length) {
|
|
57
|
+
moduleIds.forEach((id) => {
|
|
58
|
+
let formatId = id;
|
|
59
|
+
if (id.includes(":")) {
|
|
60
|
+
formatId = id.split(":").pop();
|
|
61
|
+
}
|
|
62
|
+
const hasBeenAdded = producer.includes(formatId);
|
|
63
|
+
if (!hasBeenAdded) {
|
|
64
|
+
producer.push(id);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
consumers[key] = moduleInfo[key];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return {
|
|
72
|
+
consumers,
|
|
73
|
+
producer
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
const getModuleInfo = (proxyRules) => __async(void 0, null, function* () {
|
|
77
|
+
let freshModuleInfo;
|
|
78
|
+
const { moduleInfo } = window.__FEDERATION__;
|
|
79
|
+
const { consumers } = separateType(moduleInfo);
|
|
80
|
+
const overrides = {};
|
|
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
|
+
};
|
|
100
|
+
});
|
|
101
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
102
|
+
0 && (module.exports = {
|
|
103
|
+
getModuleInfo,
|
|
104
|
+
separateType,
|
|
105
|
+
...require("./snapshot")
|
|
106
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var utils_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(utils_exports);
|
|
18
|
+
__reExport(utils_exports, require("./chrome"), module.exports);
|
|
19
|
+
__reExport(utils_exports, require("./sdk"), module.exports);
|
|
20
|
+
__reExport(utils_exports, require("./data"), module.exports);
|
|
21
|
+
__reExport(utils_exports, require("./types"), module.exports);
|
|
22
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
23
|
+
0 && (module.exports = {
|
|
24
|
+
...require("./chrome"),
|
|
25
|
+
...require("./sdk"),
|
|
26
|
+
...require("./data"),
|
|
27
|
+
...require("./types")
|
|
28
|
+
});
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __export = (target, all) => {
|
|
21
|
+
for (var name in all)
|
|
22
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
23
|
+
};
|
|
24
|
+
var __copyProps = (to, from, except, desc) => {
|
|
25
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
26
|
+
for (let key of __getOwnPropNames(from))
|
|
27
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
28
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
29
|
+
}
|
|
30
|
+
return to;
|
|
31
|
+
};
|
|
32
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
|
+
var graph_exports = {};
|
|
34
|
+
__export(graph_exports, {
|
|
35
|
+
DependencyGraph: () => DependencyGraph,
|
|
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 splitModuleId = (target) => {
|
|
45
|
+
const array = target.split(":");
|
|
46
|
+
const { length } = array;
|
|
47
|
+
if (length === 1) {
|
|
48
|
+
return target;
|
|
49
|
+
} else if (length >= 3) {
|
|
50
|
+
if (array[length - 1].endsWith(".json") || array[length - 1].endsWith(".js")) {
|
|
51
|
+
const idx = array.findIndex((t) => t.startsWith("http"));
|
|
52
|
+
return array[idx - 1];
|
|
53
|
+
} else {
|
|
54
|
+
return array[1];
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
const nameOrVersion = array[length - 1];
|
|
58
|
+
if (nameOrVersion === "*" || nameOrVersion === "latest" || validateSemver(nameOrVersion)) {
|
|
59
|
+
return array[0];
|
|
60
|
+
} else {
|
|
61
|
+
return nameOrVersion;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
class DependencyGraph {
|
|
66
|
+
constructor(snapshot, initTarget) {
|
|
67
|
+
this.snapshot = snapshot;
|
|
68
|
+
this.initTarget = initTarget;
|
|
69
|
+
this.node = [];
|
|
70
|
+
this.edge = [];
|
|
71
|
+
this.graph = {};
|
|
72
|
+
this.identifyMap = /* @__PURE__ */ new Map();
|
|
73
|
+
this.handledModuleMap = /* @__PURE__ */ new Map();
|
|
74
|
+
}
|
|
75
|
+
createGraph(target = this.initTarget) {
|
|
76
|
+
const { snapshot } = this;
|
|
77
|
+
let remotesInfo;
|
|
78
|
+
const snapshotWithoutType = snapshot[target];
|
|
79
|
+
const snapshotWithType = snapshot[target];
|
|
80
|
+
if (snapshotWithoutType && "remotesInfo" in snapshotWithoutType) {
|
|
81
|
+
remotesInfo = snapshotWithoutType == null ? void 0 : snapshotWithoutType.remotesInfo;
|
|
82
|
+
}
|
|
83
|
+
if (snapshotWithType && "remotesInfo" in snapshotWithType) {
|
|
84
|
+
remotesInfo = snapshotWithType == null ? void 0 : snapshotWithType.remotesInfo;
|
|
85
|
+
}
|
|
86
|
+
if (!remotesInfo) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
Object.keys(remotesInfo).forEach((dep) => {
|
|
90
|
+
const { matchedVersion } = remotesInfo[dep];
|
|
91
|
+
let childId = dep;
|
|
92
|
+
if (matchedVersion && matchedVersion !== "") {
|
|
93
|
+
childId = `${childId}:${matchedVersion}`;
|
|
94
|
+
}
|
|
95
|
+
if (!this.graph[target]) {
|
|
96
|
+
this.graph[target] = {};
|
|
97
|
+
}
|
|
98
|
+
this.graph[childId] = {};
|
|
99
|
+
this.graph[target][childId] = this.graph[childId];
|
|
100
|
+
const handled = this.handledModuleMap.get(childId);
|
|
101
|
+
if (!handled) {
|
|
102
|
+
this.handledModuleMap.set(childId, true);
|
|
103
|
+
this.createGraph(childId);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
addNode(id, type, x, y, nodeData) {
|
|
108
|
+
this.node.push({
|
|
109
|
+
id,
|
|
110
|
+
type,
|
|
111
|
+
position: {
|
|
112
|
+
x,
|
|
113
|
+
y
|
|
114
|
+
},
|
|
115
|
+
data: __spreadValues({}, nodeData)
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
addEdge(id, source, target, type = "default") {
|
|
119
|
+
this.edge.push({
|
|
120
|
+
id,
|
|
121
|
+
source,
|
|
122
|
+
target,
|
|
123
|
+
markerEnd: {
|
|
124
|
+
type: import_reactflow.MarkerType.Arrow,
|
|
125
|
+
width: 30,
|
|
126
|
+
height: 30
|
|
127
|
+
},
|
|
128
|
+
type
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
run(targetGraph, target = this.initTarget, type, id = this.initTarget) {
|
|
132
|
+
var _a;
|
|
133
|
+
if (!targetGraph || !((_a = Object.keys(targetGraph)) == null ? void 0 : _a.length)) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const name = splitModuleId(target);
|
|
137
|
+
const targetWithoutType = name;
|
|
138
|
+
let info = name;
|
|
139
|
+
const remote = this.snapshot[target];
|
|
140
|
+
if (remote && ("version" in remote || "remoteEntry" in remote)) {
|
|
141
|
+
info += `:${remote.version || remote.remoteEntry}`;
|
|
142
|
+
}
|
|
143
|
+
if (!this.identifyMap.has(targetWithoutType)) {
|
|
144
|
+
this.identifyMap.set(targetWithoutType, this.identify());
|
|
145
|
+
}
|
|
146
|
+
this.addNode(id, type, 0, 0, {
|
|
147
|
+
info,
|
|
148
|
+
remote,
|
|
149
|
+
color: this.identifyMap.get(targetWithoutType)
|
|
150
|
+
});
|
|
151
|
+
const graphChilden = Object.keys(
|
|
152
|
+
targetGraph[targetWithoutType] || targetGraph[target] || {}
|
|
153
|
+
);
|
|
154
|
+
graphChilden.forEach((dep) => {
|
|
155
|
+
this.addEdge(id + dep, id, id + dep);
|
|
156
|
+
this.run(targetGraph[targetWithoutType], dep, type, id + dep);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
identify() {
|
|
160
|
+
const r = Math.floor(Math.random() * 255);
|
|
161
|
+
const g = Math.floor(Math.random() * 255);
|
|
162
|
+
const b = Math.floor(Math.random() * 255);
|
|
163
|
+
const color = `rgba(${r},${g},${b},0.8)`;
|
|
164
|
+
return color;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
168
|
+
0 && (module.exports = {
|
|
169
|
+
DependencyGraph,
|
|
170
|
+
validateSemver
|
|
171
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var sdk_exports = {};
|
|
21
|
+
__export(sdk_exports, {
|
|
22
|
+
definePropertyGlobalVal: () => definePropertyGlobalVal,
|
|
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 removeLocalStorage = (key) => {
|
|
38
|
+
const data = localStorage.getItem(key);
|
|
39
|
+
if (data) {
|
|
40
|
+
localStorage.removeItem(key);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const mergeLocalStorage = (target, key, value) => {
|
|
44
|
+
const str = localStorage.getItem(target);
|
|
45
|
+
const obj = JSON.parse(str || "{}");
|
|
46
|
+
obj[key] = value;
|
|
47
|
+
localStorage.setItem(target, JSON.stringify(obj));
|
|
48
|
+
};
|
|
49
|
+
const removeLocalStorageKey = (target, key) => {
|
|
50
|
+
const str = localStorage.getItem(target);
|
|
51
|
+
if (str) {
|
|
52
|
+
const obj = JSON.parse(str || "{}");
|
|
53
|
+
delete obj[key];
|
|
54
|
+
localStorage.setItem(target, JSON.stringify(obj));
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const isObject = (target) => Object.prototype.toString.call(target) === "[object Object]";
|
|
58
|
+
const reloadPage = () => {
|
|
59
|
+
var _a;
|
|
60
|
+
(_a = globalThis == null ? void 0 : globalThis.location) == null ? void 0 : _a.reload();
|
|
61
|
+
};
|
|
62
|
+
const validateCustom = (schema) => schema == null ? void 0 : schema.endsWith(".json");
|
|
63
|
+
const getUnpkgUrl = (pkg, version) => {
|
|
64
|
+
if (pkg === "react") {
|
|
65
|
+
return `https://unpkg.com/react@${version}/umd/react.development.js`;
|
|
66
|
+
} else if (pkg === "react-dom") {
|
|
67
|
+
return `https://unpkg.com/react-dom@${version}/umd/react-dom.development.js`;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const definePropertyGlobalVal = (target, key, val) => {
|
|
71
|
+
Object.defineProperty(target, key, {
|
|
72
|
+
value: val,
|
|
73
|
+
configurable: false,
|
|
74
|
+
writable: true
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
definePropertyGlobalVal,
|
|
80
|
+
getUnpkgUrl,
|
|
81
|
+
isObject,
|
|
82
|
+
mergeLocalStorage,
|
|
83
|
+
reloadPage,
|
|
84
|
+
removeLocalStorage,
|
|
85
|
+
removeLocalStorageKey,
|
|
86
|
+
setLocalStorage,
|
|
87
|
+
validateCustom,
|
|
88
|
+
...require("./graph")
|
|
89
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var common_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(common_exports);
|
|
@@ -0,0 +1,22 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
18
|
+
__reExport(types_exports, require("./common"), module.exports);
|
|
19
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require("./common")
|
|
22
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SetStateAction } from 'react';
|
|
2
|
+
import { FormInstance } from '@arco-design/web-react';
|
|
3
|
+
import { FormItemStatus, RootComponentProps } from '../../utils';
|
|
4
|
+
interface FormProps {
|
|
5
|
+
form: FormInstance<any, any, string | number | symbol>;
|
|
6
|
+
condition: {
|
|
7
|
+
status: string;
|
|
8
|
+
message: string;
|
|
9
|
+
color: string;
|
|
10
|
+
};
|
|
11
|
+
formStatus: Array<FormItemStatus>;
|
|
12
|
+
setFormStatus: React.Dispatch<SetStateAction<FormItemStatus[]>>;
|
|
13
|
+
validateForm: any;
|
|
14
|
+
enableHMR: string;
|
|
15
|
+
onHMRChange: (on: boolean) => void;
|
|
16
|
+
}
|
|
17
|
+
declare const FormComponent: (props: FormProps & RootComponentProps) => import("react").JSX.Element;
|
|
18
|
+
export default FormComponent;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { GlobalModuleInfo } from '@module-federation/sdk';
|
|
3
|
+
import { RootComponentProps } from '../../utils';
|
|
4
|
+
declare const Layout: (props: {
|
|
5
|
+
moduleInfo: GlobalModuleInfo;
|
|
6
|
+
} & RootComponentProps) => import("react").JSX.Element;
|
|
7
|
+
export default Layout;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|