@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,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __export = (target, all) => {
|
|
26
|
+
for (var name in all)
|
|
27
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
28
|
+
};
|
|
29
|
+
var __copyProps = (to, from, except, desc) => {
|
|
30
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
31
|
+
for (let key of __getOwnPropNames(from))
|
|
32
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
33
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
34
|
+
}
|
|
35
|
+
return to;
|
|
36
|
+
};
|
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
38
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
39
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
40
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
41
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
42
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
43
|
+
mod
|
|
44
|
+
));
|
|
45
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
46
|
+
var Graph_exports = {};
|
|
47
|
+
__export(Graph_exports, {
|
|
48
|
+
default: () => Graph_default
|
|
49
|
+
});
|
|
50
|
+
module.exports = __toCommonJS(Graph_exports);
|
|
51
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
|
+
var import_react = require("react");
|
|
53
|
+
var import_reactflow = __toESM(require("reactflow"));
|
|
54
|
+
var import_dagre = __toESM(require("dagre"));
|
|
55
|
+
var import_graph = require("../../utils/sdk/graph");
|
|
56
|
+
var import_GraphItem = __toESM(require("../GraphItem"));
|
|
57
|
+
var import_utils = require("../../utils");
|
|
58
|
+
var import_index = __toESM(require("./index.module"));
|
|
59
|
+
var import_style = require("reactflow/dist/style.css");
|
|
60
|
+
const nodeWidth = 400;
|
|
61
|
+
const nodeHeight = 300;
|
|
62
|
+
const nodeTypes = { graphItem: import_GraphItem.default };
|
|
63
|
+
const Graph = (props) => {
|
|
64
|
+
const [nodes, setNodes, onNodesChange] = (0, import_reactflow.useNodesState)([]);
|
|
65
|
+
const [edges, setEdges, onEdgesChange] = (0, import_reactflow.useEdgesState)([]);
|
|
66
|
+
const { snapshot } = props;
|
|
67
|
+
const { moduleInfo } = window.__FEDERATION__;
|
|
68
|
+
const { consumers } = (0, import_utils.separateType)(moduleInfo);
|
|
69
|
+
(0, import_react.useEffect)(() => {
|
|
70
|
+
const dagreGraph = new import_dagre.default.graphlib.Graph();
|
|
71
|
+
dagreGraph.setDefaultEdgeLabel(() => ({}));
|
|
72
|
+
const getLayoutedElements = (nodes2, edges2, direction = "TB") => {
|
|
73
|
+
dagreGraph.setGraph({ rankdir: direction });
|
|
74
|
+
nodes2.forEach((node) => {
|
|
75
|
+
dagreGraph.setNode(node.id, { width: nodeWidth, height: nodeHeight });
|
|
76
|
+
});
|
|
77
|
+
edges2.forEach((edge) => {
|
|
78
|
+
dagreGraph.setEdge(edge.source, edge.target);
|
|
79
|
+
});
|
|
80
|
+
import_dagre.default.layout(dagreGraph);
|
|
81
|
+
nodes2.forEach((node) => {
|
|
82
|
+
const nodeWithPosition = dagreGraph.node(node.id);
|
|
83
|
+
node.position = {
|
|
84
|
+
x: nodeWithPosition.x - nodeWidth / 2,
|
|
85
|
+
y: nodeWithPosition.y - nodeHeight / 2
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
return { nodes: nodes2, edges: edges2 };
|
|
89
|
+
};
|
|
90
|
+
let nodeSet = [];
|
|
91
|
+
let edgeSet = [];
|
|
92
|
+
for (const consumer in consumers) {
|
|
93
|
+
const moduleGraph = new import_graph.DependencyGraph(snapshot, consumer);
|
|
94
|
+
moduleGraph.createGraph();
|
|
95
|
+
moduleGraph.run(moduleGraph.graph, consumer, "graphItem");
|
|
96
|
+
nodeSet = [...nodeSet, ...moduleGraph.node];
|
|
97
|
+
edgeSet = [...edgeSet, ...moduleGraph.edge];
|
|
98
|
+
}
|
|
99
|
+
if (!nodeSet.length) {
|
|
100
|
+
nodeSet.push({
|
|
101
|
+
id: "1",
|
|
102
|
+
type: "graphItem",
|
|
103
|
+
position: {
|
|
104
|
+
x: 0,
|
|
105
|
+
y: 0
|
|
106
|
+
},
|
|
107
|
+
data: {
|
|
108
|
+
color: "lightgreen"
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
const { nodes: layoutedNodes, edges: layoutedEdges } = getLayoutedElements(
|
|
113
|
+
nodeSet,
|
|
114
|
+
edgeSet
|
|
115
|
+
);
|
|
116
|
+
setNodes(layoutedNodes);
|
|
117
|
+
setEdges(layoutedEdges);
|
|
118
|
+
setTimeout(() => {
|
|
119
|
+
const element = document.getElementsByClassName(
|
|
120
|
+
"react-flow__controls-fitview"
|
|
121
|
+
)[0];
|
|
122
|
+
element == null ? void 0 : element.click();
|
|
123
|
+
}, 50);
|
|
124
|
+
}, [snapshot]);
|
|
125
|
+
const onConnect = (0, import_react.useCallback)(
|
|
126
|
+
(params) => setEdges(
|
|
127
|
+
(eds) => (0, import_reactflow.addEdge)(
|
|
128
|
+
__spreadProps(__spreadValues({}, params), { type: import_reactflow.ConnectionLineType.SmoothStep, animated: true }),
|
|
129
|
+
eds
|
|
130
|
+
)
|
|
131
|
+
),
|
|
132
|
+
[]
|
|
133
|
+
);
|
|
134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.depWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
135
|
+
import_reactflow.default,
|
|
136
|
+
{
|
|
137
|
+
className: import_index.default.graph,
|
|
138
|
+
nodes,
|
|
139
|
+
edges,
|
|
140
|
+
onNodesChange,
|
|
141
|
+
onEdgesChange,
|
|
142
|
+
onConnect,
|
|
143
|
+
nodeTypes,
|
|
144
|
+
fitView: true,
|
|
145
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_reactflow.Controls, {})
|
|
146
|
+
}
|
|
147
|
+
) });
|
|
148
|
+
};
|
|
149
|
+
var Graph_default = Graph;
|
|
@@ -0,0 +1,25 @@
|
|
|
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 index_module_exports = {};
|
|
20
|
+
__export(index_module_exports, {
|
|
21
|
+
default: () => index_module_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(index_module_exports);
|
|
24
|
+
var import_index_module = require("./index_module.css");
|
|
25
|
+
var index_module_default = { "depWrapper": "depWrapper_613b1", "table": "table_613b1", "graph": "graph_613b1" };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var GraphItem_exports = {};
|
|
30
|
+
__export(GraphItem_exports, {
|
|
31
|
+
default: () => GraphItem_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(GraphItem_exports);
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_reactflow = require("reactflow");
|
|
37
|
+
var import_index = __toESM(require("./index.module"));
|
|
38
|
+
var import_style = require("reactflow/dist/style.css");
|
|
39
|
+
const GraphItem = (props) => {
|
|
40
|
+
const [shareds, setShareds] = (0, import_react.useState)([]);
|
|
41
|
+
const [exposes, setExposes] = (0, import_react.useState)([]);
|
|
42
|
+
let name;
|
|
43
|
+
let version;
|
|
44
|
+
const { info = "", color, remote } = props.data;
|
|
45
|
+
const infoArray = info.split(":");
|
|
46
|
+
if (info.endsWith(".json") || info.endsWith(".js")) {
|
|
47
|
+
name = infoArray.shift();
|
|
48
|
+
version = infoArray.join(":");
|
|
49
|
+
} else {
|
|
50
|
+
[name, version] = infoArray;
|
|
51
|
+
}
|
|
52
|
+
const isEntryType = (version == null ? void 0 : version.startsWith("http")) || (version == null ? void 0 : version.startsWith("//"));
|
|
53
|
+
(0, import_react.useEffect)(() => {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
let exposes2;
|
|
56
|
+
let shareds2;
|
|
57
|
+
if (isEntryType) {
|
|
58
|
+
fetch(version).then((response) => response.json()).then((json) => {
|
|
59
|
+
exposes2 = json.exposes.map((expose) => expose.path) || [];
|
|
60
|
+
shareds2 = json.shared.map(
|
|
61
|
+
(share) => `${share.name}:${share.version}`
|
|
62
|
+
) || [];
|
|
63
|
+
setExposes(exposes2);
|
|
64
|
+
setShareds(shareds2);
|
|
65
|
+
});
|
|
66
|
+
} else {
|
|
67
|
+
exposes2 = ((_a = remote == null ? void 0 : remote.modules) == null ? void 0 : _a.map(
|
|
68
|
+
(item) => item.modulePath
|
|
69
|
+
)) || [];
|
|
70
|
+
shareds2 = ((_b = remote == null ? void 0 : remote.shared) == null ? void 0 : _b.map(
|
|
71
|
+
(item) => `${item.sharedName}:${item.version}`
|
|
72
|
+
)) || [];
|
|
73
|
+
setExposes(exposes2);
|
|
74
|
+
setShareds(shareds2);
|
|
75
|
+
}
|
|
76
|
+
}, []);
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { background: color }, className: import_index.default.Wrapper, children: [
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_reactflow.Handle, { type: "target", position: import_reactflow.Position.Top }),
|
|
79
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.container, children: [
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.group, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.name, children: name }) }),
|
|
81
|
+
version && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.info, children: [
|
|
82
|
+
exposes.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default["expose-container"], children: [
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.type, children: "Expose" }),
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: exposes.map((expose, index) => {
|
|
85
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.item, children: expose }, index);
|
|
86
|
+
}) })
|
|
87
|
+
] }) : null,
|
|
88
|
+
shareds.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default["expose-container"], children: [
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.type, children: "Shared" }),
|
|
90
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: shareds.map((shared, index) => {
|
|
91
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.item, children: shared }, index);
|
|
92
|
+
}) })
|
|
93
|
+
] }) : null,
|
|
94
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.type, children: isEntryType ? "Entry" : "Version" }),
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.item, children: version })
|
|
97
|
+
] })
|
|
98
|
+
] })
|
|
99
|
+
] }),
|
|
100
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_reactflow.Handle, { type: "source", position: import_reactflow.Position.Bottom, id: "source" })
|
|
101
|
+
] });
|
|
102
|
+
};
|
|
103
|
+
var GraphItem_default = GraphItem;
|
|
@@ -0,0 +1,25 @@
|
|
|
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 index_module_exports = {};
|
|
20
|
+
__export(index_module_exports, {
|
|
21
|
+
default: () => index_module_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(index_module_exports);
|
|
24
|
+
var import_index_module = require("./index_module.css");
|
|
25
|
+
var index_module_default = { "Wrapper": "Wrapper_2fa4f", "container": "container_2fa4f", "group": "group_2fa4f", "name": "name_2fa4f", "info": "info_2fa4f", "expose-container": "expose-container_2fa4f", "type": "type_2fa4f", "item": "item_2fa4f" };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.Wrapper_2fa4f {
|
|
2
|
+
display: flex;
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
border-radius: 10px;
|
|
5
|
+
margin: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
width: 300px;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
}
|
|
10
|
+
.Wrapper_2fa4f .container_2fa4f {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 100%;
|
|
15
|
+
margin: 0;
|
|
16
|
+
padding: 0;
|
|
17
|
+
}
|
|
18
|
+
.Wrapper_2fa4f .container_2fa4f .group_2fa4f {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
margin-bottom: 3px;
|
|
22
|
+
width: 100%;
|
|
23
|
+
padding: 5px 0;
|
|
24
|
+
}
|
|
25
|
+
.Wrapper_2fa4f .container_2fa4f .group_2fa4f .name_2fa4f {
|
|
26
|
+
color: white;
|
|
27
|
+
text-align: center;
|
|
28
|
+
margin: 0 auto;
|
|
29
|
+
}
|
|
30
|
+
.Wrapper_2fa4f .container_2fa4f .info_2fa4f {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
background-color: white;
|
|
34
|
+
margin: 0 4px 4px 4px;
|
|
35
|
+
padding: 10px;
|
|
36
|
+
border-radius: 0 0 5px 5px;
|
|
37
|
+
font-size: 12px;
|
|
38
|
+
}
|
|
39
|
+
.Wrapper_2fa4f .container_2fa4f .info_2fa4f .expose-container_2fa4f {
|
|
40
|
+
display: flex;
|
|
41
|
+
margin-bottom: 5px;
|
|
42
|
+
}
|
|
43
|
+
.Wrapper_2fa4f .container_2fa4f .info_2fa4f .type_2fa4f {
|
|
44
|
+
font-weight: bold;
|
|
45
|
+
margin-right: 10px;
|
|
46
|
+
}
|
|
47
|
+
.Wrapper_2fa4f .container_2fa4f .info_2fa4f .item_2fa4f {
|
|
48
|
+
display: inline-block;
|
|
49
|
+
padding: 5px;
|
|
50
|
+
background: lightgray;
|
|
51
|
+
border-radius: 15px;
|
|
52
|
+
font-size: 8px;
|
|
53
|
+
margin-right: 5px;
|
|
54
|
+
margin-bottom: 5px;
|
|
55
|
+
font-weight: 300;
|
|
56
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var __async = (__this, __arguments, generator) => {
|
|
30
|
+
return new Promise((resolve, reject) => {
|
|
31
|
+
var fulfilled = (value) => {
|
|
32
|
+
try {
|
|
33
|
+
step(generator.next(value));
|
|
34
|
+
} catch (e) {
|
|
35
|
+
reject(e);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var rejected = (value) => {
|
|
39
|
+
try {
|
|
40
|
+
step(generator.throw(value));
|
|
41
|
+
} catch (e) {
|
|
42
|
+
reject(e);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
46
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
var Layout_exports = {};
|
|
50
|
+
__export(Layout_exports, {
|
|
51
|
+
default: () => Layout_default
|
|
52
|
+
});
|
|
53
|
+
module.exports = __toCommonJS(Layout_exports);
|
|
54
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
55
|
+
var import_react = require("react");
|
|
56
|
+
var import_ahooks = require("ahooks");
|
|
57
|
+
var import_web_react = require("@arco-design/web-react");
|
|
58
|
+
var import_sdk = require("@module-federation/sdk");
|
|
59
|
+
var import_Form = __toESM(require("../Form"));
|
|
60
|
+
var import_Graph = __toESM(require("../Graph"));
|
|
61
|
+
var import_utils = require("../../utils");
|
|
62
|
+
var import_constant = require("../../template/constant");
|
|
63
|
+
const Layout = (props) => {
|
|
64
|
+
const {
|
|
65
|
+
moduleInfo,
|
|
66
|
+
handleSnapshot,
|
|
67
|
+
versionList,
|
|
68
|
+
setVersionList,
|
|
69
|
+
getVersion
|
|
70
|
+
} = props;
|
|
71
|
+
const { producer } = (0, import_utils.separateType)(moduleInfo);
|
|
72
|
+
const [condition, setCondition] = (0, import_react.useState)(import_constant.statusInfo.processing);
|
|
73
|
+
const [formStatus, setFormStatus] = (0, import_react.useState)([]);
|
|
74
|
+
const [snapshot, setSnapshot] = (0, import_react.useState)(moduleInfo);
|
|
75
|
+
const [form] = import_web_react.Form.useForm();
|
|
76
|
+
const [enableHMR, setEnalbeHMR] = (0, import_react.useState)("disable");
|
|
77
|
+
const { run } = (0, import_ahooks.useDebounceFn)(
|
|
78
|
+
(formData) => __async(void 0, null, function* () {
|
|
79
|
+
window.__FEDERATION__.moduleInfo = JSON.parse(
|
|
80
|
+
JSON.stringify(window.__FEDERATION__.originModuleInfo)
|
|
81
|
+
);
|
|
82
|
+
const filterFormData = formData[import_constant.proxyFormField].reduce(
|
|
83
|
+
(memo, current, idx) => {
|
|
84
|
+
if (!formStatus[idx]) {
|
|
85
|
+
return memo;
|
|
86
|
+
}
|
|
87
|
+
const { keyStatus, valueStatus } = formStatus[idx];
|
|
88
|
+
if (!keyStatus || !valueStatus || !current.checked) {
|
|
89
|
+
return memo;
|
|
90
|
+
}
|
|
91
|
+
const duplicate = JSON.parse(JSON.stringify(current));
|
|
92
|
+
return [...memo, duplicate];
|
|
93
|
+
},
|
|
94
|
+
[]
|
|
95
|
+
);
|
|
96
|
+
try {
|
|
97
|
+
setCondition(import_constant.statusInfo.processing);
|
|
98
|
+
if (!filterFormData.length) {
|
|
99
|
+
yield (0, import_utils.removeStorage)(import_sdk.MODULE_DEVTOOL_IDENTIFIER);
|
|
100
|
+
yield (0, import_utils.removeStorage)(import_constant.BROWSER_ENV_KEY);
|
|
101
|
+
yield (0, import_utils.removeStorageKey)(import_constant.__FEDERATION_DEVTOOLS__, "overrides");
|
|
102
|
+
yield (0, import_utils.injectScript)(import_utils.reloadPage, false);
|
|
103
|
+
setCondition(import_constant.statusInfo.noProxy);
|
|
104
|
+
setSnapshot(window.__FEDERATION__.originModuleInfo);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const { moduleInfo: moduleInfo2, status, overrides } = handleSnapshot ? yield handleSnapshot(filterFormData) : yield (0, import_utils.getModuleInfo)(filterFormData);
|
|
108
|
+
const snapshotJson = JSON.stringify(moduleInfo2);
|
|
109
|
+
yield (0, import_utils.setStorage)(import_sdk.MODULE_DEVTOOL_IDENTIFIER, snapshotJson);
|
|
110
|
+
yield (0, import_utils.setStorage)(import_constant.BROWSER_ENV_KEY);
|
|
111
|
+
yield (0, import_utils.mergeStorage)(import_constant.__FEDERATION_DEVTOOLS__, "overrides", overrides);
|
|
112
|
+
yield (0, import_utils.injectScript)(import_utils.reloadPage, false);
|
|
113
|
+
window.__FEDERATION__.moduleInfo = moduleInfo2;
|
|
114
|
+
setSnapshot(moduleInfo2);
|
|
115
|
+
setCondition(import_constant.statusInfo[status]);
|
|
116
|
+
} catch (e) {
|
|
117
|
+
console.log(e);
|
|
118
|
+
setCondition(import_constant.statusInfo.error);
|
|
119
|
+
}
|
|
120
|
+
}),
|
|
121
|
+
{
|
|
122
|
+
wait: 700
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
(0, import_react.useEffect)(() => {
|
|
126
|
+
setSnapshot(moduleInfo);
|
|
127
|
+
}, [moduleInfo]);
|
|
128
|
+
(0, import_react.useEffect)(() => {
|
|
129
|
+
(0, import_utils.getScope)().then((scope) => __async(void 0, null, function* () {
|
|
130
|
+
var _a, _b, _c;
|
|
131
|
+
const data = yield chrome.storage.sync.get([import_constant.FormID]);
|
|
132
|
+
const config = (_a = data == null ? void 0 : data[import_constant.FormID]) == null ? void 0 : _a[scope];
|
|
133
|
+
let storeData;
|
|
134
|
+
if ((0, import_utils.isObject)(config)) {
|
|
135
|
+
storeData = JSON.parse(JSON.stringify(config));
|
|
136
|
+
storeData[import_constant.proxyFormField] = (_b = storeData[import_constant.proxyFormField]) == null ? void 0 : _b.filter(
|
|
137
|
+
(item) => producer.includes(item.key)
|
|
138
|
+
);
|
|
139
|
+
if (!((_c = storeData[import_constant.proxyFormField]) == null ? void 0 : _c.length)) {
|
|
140
|
+
storeData = import_constant.defaultModuleData;
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
storeData = import_constant.defaultModuleData;
|
|
144
|
+
}
|
|
145
|
+
form.setFieldsValue(storeData);
|
|
146
|
+
}));
|
|
147
|
+
}, []);
|
|
148
|
+
(0, import_react.useEffect)(() => {
|
|
149
|
+
chrome.storage.sync.get([import_constant.ENABLEHMR]).then((data) => {
|
|
150
|
+
const enable = data[import_constant.ENABLEHMR];
|
|
151
|
+
if (typeof enable === "boolean") {
|
|
152
|
+
onHMRChange(enable);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}, []);
|
|
156
|
+
(0, import_react.useEffect)(() => {
|
|
157
|
+
validateForm(form);
|
|
158
|
+
}, []);
|
|
159
|
+
(0, import_ahooks.useUpdateEffect)(() => {
|
|
160
|
+
const formData = form.getFieldsValue();
|
|
161
|
+
run(formData);
|
|
162
|
+
}, []);
|
|
163
|
+
const validateForm = (form2) => {
|
|
164
|
+
setTimeout(() => {
|
|
165
|
+
form2.validate().catch(() => {
|
|
166
|
+
console.log("Invalid proxy rules");
|
|
167
|
+
});
|
|
168
|
+
}, 50);
|
|
169
|
+
};
|
|
170
|
+
const onValuesChange = (target, formData) => {
|
|
171
|
+
validateForm(form);
|
|
172
|
+
(0, import_utils.setChromeStorage)(formData);
|
|
173
|
+
run(formData);
|
|
174
|
+
};
|
|
175
|
+
const onHMRChange = (on) => {
|
|
176
|
+
setEnalbeHMR(on ? "enable" : "disable");
|
|
177
|
+
chrome.storage.sync.set({
|
|
178
|
+
[import_constant.ENABLEHMR]: on
|
|
179
|
+
});
|
|
180
|
+
if (on) {
|
|
181
|
+
(0, import_utils.mergeStorage)(import_constant.__FEDERATION_DEVTOOLS__, import_constant.__ENABLE_FAST_REFRESH__, on);
|
|
182
|
+
} else {
|
|
183
|
+
(0, import_utils.removeStorageKey)(import_constant.__FEDERATION_DEVTOOLS__, import_constant.__ENABLE_FAST_REFRESH__);
|
|
184
|
+
}
|
|
185
|
+
(0, import_utils.injectScript)(import_utils.reloadPage, false);
|
|
186
|
+
};
|
|
187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
188
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
189
|
+
import_web_react.Form,
|
|
190
|
+
{
|
|
191
|
+
form,
|
|
192
|
+
onValuesChange: (value, formData) => onValuesChange(value, formData),
|
|
193
|
+
initialValues: import_constant.defaultModuleData,
|
|
194
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
195
|
+
import_Form.default,
|
|
196
|
+
{
|
|
197
|
+
form,
|
|
198
|
+
condition,
|
|
199
|
+
formStatus,
|
|
200
|
+
setFormStatus,
|
|
201
|
+
validateForm: () => validateForm(form),
|
|
202
|
+
enableHMR,
|
|
203
|
+
onHMRChange,
|
|
204
|
+
versionList,
|
|
205
|
+
setVersionList,
|
|
206
|
+
getVersion
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
),
|
|
211
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Graph.default, { snapshot })
|
|
212
|
+
] });
|
|
213
|
+
};
|
|
214
|
+
var Layout_default = Layout;
|
|
@@ -0,0 +1,25 @@
|
|
|
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 index_module_exports = {};
|
|
20
|
+
__export(index_module_exports, {
|
|
21
|
+
default: () => index_module_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(index_module_exports);
|
|
24
|
+
var import_index_module = require("./index_module.css");
|
|
25
|
+
var index_module_default = { "select": "select_084ab", "card": "card_084ab", "appName": "appName_084ab", "tagContainer": "tagContainer_084ab", "tag": "tag_084ab", "header": "header_084ab", "add": "add_084ab", "title": "title_084ab", "status": "status_084ab", "switch": "switch_084ab", "badge": "badge_084ab" };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
.select_084ab {
|
|
2
|
+
margin-top: 1vh;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.card_084ab {
|
|
6
|
+
display: flex;
|
|
7
|
+
height: 4vh;
|
|
8
|
+
align-items: center;
|
|
9
|
+
}
|
|
10
|
+
.card_084ab .appName_084ab {
|
|
11
|
+
margin: 1vh 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.tagContainer_084ab {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
margin-bottom: 1vh;
|
|
18
|
+
color: rgb(78, 89, 105);
|
|
19
|
+
}
|
|
20
|
+
.tagContainer_084ab .tag_084ab {
|
|
21
|
+
margin-left: 1vw;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.header_084ab {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
margin: 1vh 0;
|
|
28
|
+
}
|
|
29
|
+
.header_084ab .add_084ab {
|
|
30
|
+
margin: 0 0.5vw;
|
|
31
|
+
}
|
|
32
|
+
.header_084ab .title_084ab {
|
|
33
|
+
margin: 0 0.5vw;
|
|
34
|
+
}
|
|
35
|
+
.header_084ab .status_084ab {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex: 1 1;
|
|
38
|
+
justify-content: flex-end;
|
|
39
|
+
align-items: center;
|
|
40
|
+
}
|
|
41
|
+
.header_084ab .status_084ab .switch_084ab {
|
|
42
|
+
margin-left: 0.5vw;
|
|
43
|
+
}
|
|
44
|
+
.header_084ab .badge_084ab {
|
|
45
|
+
display: flex;
|
|
46
|
+
transform: scale(1.6);
|
|
47
|
+
margin: 0 0.6vw;
|
|
48
|
+
}
|