@rsdoctor/components 1.3.12 → 1.3.13-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Charts/TreeMap.d.ts +5 -1
- package/dist/components/Charts/TreeMap.mjs +538 -212
- package/dist/components/Charts/TreeMap.mjs.map +1 -1
- package/dist/components/Charts/constants.d.ts +1 -10
- package/dist/components/Charts/constants.mjs +13 -60
- package/dist/components/Charts/constants.mjs.map +1 -1
- package/dist/components/Charts/treemap.module.mjs +32 -4
- package/dist/components/Charts/treemap.module.mjs.map +1 -1
- package/dist/components/Charts/treemap_module.css +193 -39
- package/dist/components/Charts/treemap_module.css.map +1 -1
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.mjs +37 -14
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.mjs.map +1 -1
- package/dist/pages/ModuleAnalyze/fileTree.d.ts +3 -0
- package/dist/pages/ModuleAnalyze/fileTree.mjs +80 -35
- package/dist/pages/ModuleAnalyze/fileTree.mjs.map +1 -1
- package/dist/pages/ModuleAnalyze/index.css +47 -0
- package/dist/pages/ModuleAnalyze/index.css.map +1 -1
- package/dist/pages/ModuleAnalyze/index.d.ts +1 -2
- package/dist/pages/ModuleAnalyze/index.mjs +69 -65
- package/dist/pages/ModuleAnalyze/index.mjs.map +1 -1
- package/dist/pages/ModuleAnalyze/utils/hooks.mjs +6 -5
- package/dist/pages/ModuleAnalyze/utils/hooks.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { MinusCircleOutlined, PlusCircleOutlined, RightSquareOutlined } from "@ant-design/icons";
|
|
3
3
|
import { Popover, Space, Typography } from "antd";
|
|
4
|
-
import { useCallback } from "react";
|
|
4
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
5
5
|
import react_hyper_tree, { useTreeState } from "react-hyper-tree";
|
|
6
6
|
import { ModuleGraphListContext } from "../../BundleSize/config.mjs";
|
|
7
7
|
import "./fileTreeCom.css";
|
|
8
8
|
import { getFileCom } from "../../../components/FileTree/index.mjs";
|
|
9
9
|
const prefix = 'file-tree-com';
|
|
10
10
|
const FileTree = (props)=>{
|
|
11
|
-
const { treeData, needJumpto = false,
|
|
11
|
+
const { treeData, needJumpto = false, defaultOpenFather = 0 } = props;
|
|
12
12
|
const { required, handlers } = useTreeState({
|
|
13
13
|
id: `${prefix}-tree`,
|
|
14
14
|
data: treeData || [],
|
|
15
|
-
defaultOpened,
|
|
15
|
+
defaultOpened: false,
|
|
16
16
|
multipleSelect: false,
|
|
17
17
|
refreshAsyncNodes: true
|
|
18
18
|
});
|
|
19
|
+
const expandedNodes = useRef(new Set());
|
|
20
|
+
useEffect(()=>{
|
|
21
|
+
expandedNodes.current.clear();
|
|
22
|
+
}, [
|
|
23
|
+
treeData
|
|
24
|
+
]);
|
|
19
25
|
const renderNode = useCallback(({ node, onToggle })=>{
|
|
20
|
-
|
|
26
|
+
if ('object' != typeof node.data || null === node.data || Array.isArray(node.data)) return null;
|
|
27
|
+
const hasChildren = 'function' == typeof node.data.getChildren || Array.isArray(node.data.children) && node.data.children.length > 0;
|
|
28
|
+
if (defaultOpenFather > 0 && 'number' == typeof node.data.level && node.data.level < defaultOpenFather && hasChildren) {
|
|
29
|
+
const nodeId = node.id;
|
|
30
|
+
if (!expandedNodes.current.has(nodeId)) {
|
|
31
|
+
expandedNodes.current.add(nodeId);
|
|
32
|
+
requestAnimationFrame(()=>{
|
|
33
|
+
handlers.setOpen(nodeId, true);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
21
37
|
const Icon = getFileCom(node.data.name);
|
|
22
38
|
return /*#__PURE__*/ jsx("div", {
|
|
23
39
|
className: `${prefix}-titles-box`,
|
|
@@ -33,15 +49,18 @@ const FileTree = (props)=>{
|
|
|
33
49
|
onClick: onToggle,
|
|
34
50
|
children: /*#__PURE__*/ jsxs(Space, {
|
|
35
51
|
children: [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
(()=>{
|
|
53
|
+
const hasChildren = 'function' == typeof node.data.getChildren || Array.isArray(node.data.children) && node.data.children.length > 0;
|
|
54
|
+
return !node.options.opened && hasChildren ? /*#__PURE__*/ jsx(PlusCircleOutlined, {
|
|
55
|
+
style: {
|
|
56
|
+
color: 'lightblue'
|
|
57
|
+
}
|
|
58
|
+
}) : /*#__PURE__*/ jsx(MinusCircleOutlined, {
|
|
59
|
+
style: {
|
|
60
|
+
color: 'lightblue'
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
})(),
|
|
45
64
|
Icon,
|
|
46
65
|
/*#__PURE__*/ jsx(Popover, {
|
|
47
66
|
content: /*#__PURE__*/ jsx(Fragment, {
|
|
@@ -78,7 +97,11 @@ const FileTree = (props)=>{
|
|
|
78
97
|
})
|
|
79
98
|
})
|
|
80
99
|
}, node.data.name);
|
|
81
|
-
}, [
|
|
100
|
+
}, [
|
|
101
|
+
handlers,
|
|
102
|
+
defaultOpenFather,
|
|
103
|
+
needJumpto
|
|
104
|
+
]);
|
|
82
105
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
83
106
|
children: /*#__PURE__*/ jsx(react_hyper_tree, {
|
|
84
107
|
...required,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages/ModuleAnalyze/components/fileTreeCom.mjs","sources":["../../../../src/pages/ModuleAnalyze/components/fileTreeCom.tsx"],"sourcesContent":["import {\n MinusCircleOutlined,\n PlusCircleOutlined,\n RightSquareOutlined,\n} from '@ant-design/icons';\nimport { Popover, Space, Typography } from 'antd';\nimport React, { useCallback } from 'react';\nimport Tree, { DefaultNodeProps, useTreeState } from 'react-hyper-tree';\n\nimport { ModuleGraphListContext } from '../../BundleSize/config';\nimport { NewTreeNodeType } from '../utils/hooks';\nimport './fileTreeCom.scss';\nimport { getFileCom } from 'src/components/FileTree';\n\nconst prefix = 'file-tree-com';\n\ntype FileTreeProps = {\n treeData: NewTreeNodeType[];\n needCode?: boolean;\n needShowAllTree?: boolean;\n needJumpto?: boolean;\n defaultOpened?: boolean;\n defaultOpenFather?: number;\n cwd: string;\n selectedChunk?: string;\n};\n\nexport const FileTree: React.FC<FileTreeProps> = (props) => {\n const {
|
|
1
|
+
{"version":3,"file":"pages/ModuleAnalyze/components/fileTreeCom.mjs","sources":["../../../../src/pages/ModuleAnalyze/components/fileTreeCom.tsx"],"sourcesContent":["import {\n MinusCircleOutlined,\n PlusCircleOutlined,\n RightSquareOutlined,\n} from '@ant-design/icons';\nimport { Popover, Space, Typography } from 'antd';\nimport React, { useCallback, useEffect, useRef } from 'react';\nimport Tree, { DefaultNodeProps, useTreeState } from 'react-hyper-tree';\n\nimport { ModuleGraphListContext } from '../../BundleSize/config';\nimport { NewTreeNodeType } from '../utils/hooks';\nimport './fileTreeCom.scss';\nimport { getFileCom } from 'src/components/FileTree';\n\nconst prefix = 'file-tree-com';\n\ntype FileTreeProps = {\n treeData: NewTreeNodeType[];\n needCode?: boolean;\n needShowAllTree?: boolean;\n needJumpto?: boolean;\n defaultOpened?: boolean;\n defaultOpenFather?: number;\n cwd: string;\n selectedChunk?: string;\n};\n\nexport const FileTree: React.FC<FileTreeProps> = (props) => {\n const { treeData, needJumpto = false, defaultOpenFather = 0 } = props;\n\n const { required, handlers } = useTreeState({\n id: `${prefix}-tree`,\n data: treeData || [],\n defaultOpened: false,\n multipleSelect: false,\n refreshAsyncNodes: true,\n });\n\n const expandedNodes = useRef<Set<string | number>>(new Set());\n\n useEffect(() => {\n expandedNodes.current.clear();\n }, [treeData]);\n\n const renderNode = useCallback(\n ({ node, onToggle }: DefaultNodeProps) => {\n if (\n typeof node.data !== 'object' ||\n node.data === null ||\n Array.isArray(node.data)\n ) {\n return null;\n }\n\n const hasChildren =\n typeof node.data.getChildren === 'function' ||\n (Array.isArray(node.data.children) && node.data.children.length > 0);\n\n if (\n defaultOpenFather > 0 &&\n typeof node.data.level === 'number' &&\n node.data.level < defaultOpenFather &&\n hasChildren\n ) {\n const nodeId = node.id;\n if (!expandedNodes.current.has(nodeId)) {\n expandedNodes.current.add(nodeId);\n requestAnimationFrame(() => {\n handlers.setOpen(nodeId, true);\n });\n }\n }\n\n const Icon = getFileCom(node.data.name);\n\n return (\n <div className={`${prefix}-titles-box`} key={node.data.name}>\n <div className={`${prefix}-titles`}>\n <Space direction=\"vertical\">\n <div className={`${prefix}-node-title`}>\n <Space>\n <div onClick={onToggle}>\n <Space>\n {(() => {\n const hasChildren =\n typeof node.data.getChildren === 'function' ||\n (Array.isArray(node.data.children) &&\n node.data.children.length > 0);\n return !node.options.opened && hasChildren ? (\n <PlusCircleOutlined style={{ color: 'lightblue' }} />\n ) : (\n <MinusCircleOutlined style={{ color: 'lightblue' }} />\n );\n })()}\n {Icon}\n <Popover\n key={`${node.data.name}popover`}\n content={\n <>\n {node.data.__RESOURCEPATH__ ? (\n <Typography.Text\n key={`${node.data.name}-popover-path`}\n code\n >\n {node.data.__RESOURCEPATH__}\n </Typography.Text>\n ) : (\n <></>\n )}\n </>\n }\n title=\"INFO\"\n trigger=\"hover\"\n >\n <Typography.Text>{node.data.name}</Typography.Text>\n </Popover>\n </Space>\n </div>\n <Space>\n {needJumpto && (\n <ModuleGraphListContext.Consumer>\n {({ moduleJumpList, setModuleJumpList }) => {\n return (\n <RightSquareOutlined\n onClick={() => {\n const _list = [...moduleJumpList];\n _list.push(+node.id);\n setModuleJumpList(_list);\n }}\n />\n );\n }}\n </ModuleGraphListContext.Consumer>\n )}\n </Space>\n </Space>\n </div>\n </Space>\n </div>\n </div>\n );\n },\n [handlers, defaultOpenFather, needJumpto],\n );\n\n return (\n <>\n <Tree\n {...required}\n {...handlers}\n horizontalLineStyles={{\n stroke: '#c4c4c4',\n strokeWidth: 2,\n strokeDasharray: '1 1',\n }}\n verticalLineStyles={{\n stroke: '#c4c4c4',\n strokeWidth: 2,\n strokeDasharray: '1 1',\n }}\n draggable={false}\n depthGap={14}\n gapMode={'padding'}\n disableLines={false}\n disableTransitions={true}\n disableHorizontalLines={false}\n disableVerticalLines={false}\n verticalLineTopOffset={0}\n verticalLineOffset={5}\n renderNode={renderNode}\n />\n </>\n );\n};\n"],"names":["prefix","FileTree","props","treeData","needJumpto","defaultOpenFather","required","handlers","useTreeState","expandedNodes","useRef","Set","useEffect","renderNode","useCallback","node","onToggle","Array","hasChildren","nodeId","requestAnimationFrame","Icon","getFileCom","Space","PlusCircleOutlined","MinusCircleOutlined","Popover","Typography","ModuleGraphListContext","moduleJumpList","setModuleJumpList","RightSquareOutlined","_list","Tree"],"mappings":";;;;;;;;AAcA,MAAMA,SAAS;AAaR,MAAMC,WAAoC,CAACC;IAChD,MAAM,EAAEC,QAAQ,EAAEC,aAAa,KAAK,EAAEC,oBAAoB,CAAC,EAAE,GAAGH;IAEhE,MAAM,EAAEI,QAAQ,EAAEC,QAAQ,EAAE,GAAGC,aAAa;QAC1C,IAAI,GAAGR,OAAO,KAAK,CAAC;QACpB,MAAMG,YAAY,EAAE;QACpB,eAAe;QACf,gBAAgB;QAChB,mBAAmB;IACrB;IAEA,MAAMM,gBAAgBC,OAA6B,IAAIC;IAEvDC,UAAU;QACRH,cAAc,OAAO,CAAC,KAAK;IAC7B,GAAG;QAACN;KAAS;IAEb,MAAMU,aAAaC,YACjB,CAAC,EAAEC,IAAI,EAAEC,QAAQ,EAAoB;QACnC,IACE,AAAqB,YAArB,OAAOD,KAAK,IAAI,IAChBA,AAAc,SAAdA,KAAK,IAAI,IACTE,MAAM,OAAO,CAACF,KAAK,IAAI,GAEvB,OAAO;QAGT,MAAMG,cACJ,AAAiC,cAAjC,OAAOH,KAAK,IAAI,CAAC,WAAW,IAC3BE,MAAM,OAAO,CAACF,KAAK,IAAI,CAAC,QAAQ,KAAKA,KAAK,IAAI,CAAC,QAAQ,CAAC,MAAM,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AC,kBAMvC;;gDAIN,OAAM;gDACN,SAAQ;0DAER,kBAACY,WAAW,IAAI;8DAAEZ,KAAK,IAAI,CAAC,IAAI;;+CAlB3B,GAAGA,KAAK,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;;;;8CAsBrC,IAACQ,OAAKA;8CACHnB,cAAc,WAAdA,GACC,IAACwB,uBAAuB,QAAQ;kDAC7B,CAAC,EAAEC,cAAc,EAAEC,iBAAiB,EAAE,GAC9B,WAAP,GACE,IAACC,qBAAmBA;gDAClB,SAAS;oDACP,MAAMC,QAAQ;2DAAIH;qDAAe;oDACjCG,MAAM,IAAI,CAAC,CAACjB,KAAK,EAAE;oDACnBe,kBAAkBE;gDACpB;;;;;;;;;WApDuBjB,KAAK,IAAI,CAAC,IAAI;IAiE/D,GACA;QAACR;QAAUF;QAAmBD;KAAW;IAG3C,OAAO,WAAP,GACE;kBACE,kBAAC6B,kBAAIA;YACF,GAAG3B,QAAQ;YACX,GAAGC,QAAQ;YACZ,sBAAsB;gBACpB,QAAQ;gBACR,aAAa;gBACb,iBAAiB;YACnB;YACA,oBAAoB;gBAClB,QAAQ;gBACR,aAAa;gBACb,iBAAiB;YACnB;YACA,WAAW;YACX,UAAU;YACV,SAAS;YACT,cAAc;YACd,oBAAoB;YACpB,wBAAwB;YACxB,sBAAsB;YACtB,uBAAuB;YACvB,oBAAoB;YACpB,YAAYM;;;AAIpB"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { SDK } from '@rsdoctor/types';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
export declare const BailoutReasonCard: React.FC<{
|
|
4
|
+
reasons?: string[];
|
|
5
|
+
}>;
|
|
3
6
|
export declare const ModuleFilesTree: React.FC<{
|
|
4
7
|
modules: SDK.ModuleData[];
|
|
5
8
|
dependencies: SDK.DependencyData[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Col, Empty, Popover,
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Card, Col, Empty, Popover, Typography } from "antd";
|
|
3
|
+
import { useEffect, useMemo, useState } from "react";
|
|
4
4
|
import { Size } from "../../constants.mjs";
|
|
5
5
|
import { FileTree } from "./components/fileTreeCom.mjs";
|
|
6
6
|
import { clsNamePrefix } from "./constants.mjs";
|
|
@@ -8,6 +8,57 @@ import dependency from "./dependency.mjs";
|
|
|
8
8
|
import { getImporteds } from "./utils/index.mjs";
|
|
9
9
|
import { useCreateFileTreeData } from "./utils/hooks.mjs";
|
|
10
10
|
import { TabList } from "./index.mjs";
|
|
11
|
+
const BailoutReasonCard = ({ reasons })=>{
|
|
12
|
+
if (!reasons || !reasons.length) return null;
|
|
13
|
+
return /*#__PURE__*/ jsxs(Card, {
|
|
14
|
+
className: `${clsNamePrefix}-bailout-card`,
|
|
15
|
+
bordered: false,
|
|
16
|
+
bodyStyle: {
|
|
17
|
+
padding: 20
|
|
18
|
+
},
|
|
19
|
+
children: [
|
|
20
|
+
/*#__PURE__*/ jsx(Typography.Text, {
|
|
21
|
+
strong: true,
|
|
22
|
+
className: `${clsNamePrefix}-bailout-card-title`,
|
|
23
|
+
children: "Bailout Reasons"
|
|
24
|
+
}),
|
|
25
|
+
/*#__PURE__*/ jsx("div", {
|
|
26
|
+
className: `${clsNamePrefix}-bailout-card-list`,
|
|
27
|
+
style: {
|
|
28
|
+
maxHeight: 156,
|
|
29
|
+
overflowY: 'auto'
|
|
30
|
+
},
|
|
31
|
+
children: reasons.map((reason, index)=>/*#__PURE__*/ jsxs("div", {
|
|
32
|
+
className: `${clsNamePrefix}-bailout-card-item`,
|
|
33
|
+
children: [
|
|
34
|
+
/*#__PURE__*/ jsx(Popover, {
|
|
35
|
+
content: reason,
|
|
36
|
+
trigger: "hover",
|
|
37
|
+
children: /*#__PURE__*/ jsx(Typography.Paragraph, {
|
|
38
|
+
ellipsis: {
|
|
39
|
+
rows: 1
|
|
40
|
+
},
|
|
41
|
+
className: `${clsNamePrefix}-bailout-card-text`,
|
|
42
|
+
style: {
|
|
43
|
+
marginBottom: 0
|
|
44
|
+
},
|
|
45
|
+
children: reason
|
|
46
|
+
})
|
|
47
|
+
}),
|
|
48
|
+
/*#__PURE__*/ jsxs(Typography.Text, {
|
|
49
|
+
type: "secondary",
|
|
50
|
+
className: `${clsNamePrefix}-bailout-card-meta`,
|
|
51
|
+
children: [
|
|
52
|
+
"#",
|
|
53
|
+
String(index + 1).padStart(2, '0')
|
|
54
|
+
]
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
}, `${reason}-${index}`))
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
};
|
|
11
62
|
const ModuleFilesTree = (props)=>{
|
|
12
63
|
const { curModule, modules, dependencies, cwd, activeTabKey, selectedChunk = '' } = props;
|
|
13
64
|
const [importedModules, setImportedModules] = useState([]);
|
|
@@ -19,19 +70,19 @@ const ModuleFilesTree = (props)=>{
|
|
|
19
70
|
curModule,
|
|
20
71
|
modules
|
|
21
72
|
]);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
73
|
+
const mainContent = useMemo(()=>{
|
|
74
|
+
if (activeTabKey === TabList[TabList.Reasons]) return importedModules ? /*#__PURE__*/ jsx(FileTree, {
|
|
75
|
+
cwd: cwd,
|
|
76
|
+
treeData: fileStructures,
|
|
77
|
+
needCode: true,
|
|
78
|
+
needShowAllTree: true,
|
|
79
|
+
needJumpto: true,
|
|
80
|
+
selectedChunk: selectedChunk,
|
|
81
|
+
defaultOpenFather: 1
|
|
82
|
+
}) : /*#__PURE__*/ jsx(Empty, {
|
|
83
|
+
className: `${clsNamePrefix}-empty`
|
|
84
|
+
});
|
|
85
|
+
return /*#__PURE__*/ jsx("div", {
|
|
35
86
|
className: `${clsNamePrefix}-file-tree`,
|
|
36
87
|
style: {
|
|
37
88
|
padding: Size.BasePadding / 2
|
|
@@ -49,26 +100,20 @@ const ModuleFilesTree = (props)=>{
|
|
|
49
100
|
className: `${clsNamePrefix}-empty`
|
|
50
101
|
})
|
|
51
102
|
})
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
children: reason.length > 120 ? `${reason.slice(0, 120)}...` : reason
|
|
65
|
-
})
|
|
66
|
-
})
|
|
67
|
-
}, reason)
|
|
68
|
-
}))
|
|
69
|
-
})
|
|
103
|
+
});
|
|
104
|
+
}, [
|
|
105
|
+
activeTabKey,
|
|
106
|
+
curModule,
|
|
107
|
+
dependencies,
|
|
108
|
+
fileStructures,
|
|
109
|
+
importedModules,
|
|
110
|
+
cwd,
|
|
111
|
+
selectedChunk
|
|
112
|
+
]);
|
|
113
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
114
|
+
children: mainContent
|
|
70
115
|
});
|
|
71
116
|
};
|
|
72
|
-
export { ModuleFilesTree };
|
|
117
|
+
export { BailoutReasonCard, ModuleFilesTree };
|
|
73
118
|
|
|
74
119
|
//# sourceMappingURL=fileTree.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages/ModuleAnalyze/fileTree.mjs","sources":["../../../src/pages/ModuleAnalyze/fileTree.tsx"],"sourcesContent":["import { SDK } from '@rsdoctor/types';\nimport { Col, Empty,
|
|
1
|
+
{"version":3,"file":"pages/ModuleAnalyze/fileTree.mjs","sources":["../../../src/pages/ModuleAnalyze/fileTree.tsx"],"sourcesContent":["import { SDK } from '@rsdoctor/types';\nimport { Card, Col, Empty, Popover, Typography } from 'antd';\nimport React, { useEffect, useMemo, useState } from 'react';\nimport { Size } from 'src/constants';\nimport { FileTree } from './components/fileTreeCom';\nimport { clsNamePrefix } from './constants';\nimport DependencyTree from './dependency';\nimport { getImporteds } from './utils';\nimport { useCreateFileTreeData } from './utils/hooks';\nimport { TabList } from './index';\n\nexport const BailoutReasonCard: React.FC<{ reasons?: string[] }> = ({\n reasons,\n}) => {\n if (!reasons || !reasons.length) {\n return null;\n }\n return (\n <Card\n className={`${clsNamePrefix}-bailout-card`}\n bordered={false}\n bodyStyle={{ padding: 20 }}\n >\n <Typography.Text strong className={`${clsNamePrefix}-bailout-card-title`}>\n Bailout Reasons\n </Typography.Text>\n <div\n className={`${clsNamePrefix}-bailout-card-list`}\n style={{ maxHeight: 156, overflowY: 'auto' }}\n >\n {reasons.map((reason, index) => (\n <div\n className={`${clsNamePrefix}-bailout-card-item`}\n key={`${reason}-${index}`}\n >\n <Popover content={reason} trigger=\"hover\">\n <Typography.Paragraph\n ellipsis={{ rows: 1 }}\n className={`${clsNamePrefix}-bailout-card-text`}\n style={{ marginBottom: 0 }}\n >\n {reason}\n </Typography.Paragraph>\n </Popover>\n <Typography.Text\n type=\"secondary\"\n className={`${clsNamePrefix}-bailout-card-meta`}\n >\n #{String(index + 1).padStart(2, '0')}\n </Typography.Text>\n </div>\n ))}\n </div>\n </Card>\n );\n};\n\nexport const ModuleFilesTree: React.FC<{\n modules: SDK.ModuleData[];\n dependencies: SDK.DependencyData[];\n curModule: SDK.ModuleData;\n cwd: string;\n selectedChunk: string;\n activeTabKey: string;\n}> = (props) => {\n const {\n curModule,\n modules,\n dependencies,\n cwd,\n activeTabKey,\n selectedChunk = '',\n } = props;\n const [importedModules, setImportedModules] = useState(\n [] as SDK.ModuleData[],\n );\n\n const { data: fileStructures } = useCreateFileTreeData(\n modules,\n importedModules,\n curModule,\n );\n\n useEffect(() => {\n const importeds = getImporteds(curModule, modules);\n setImportedModules(importeds);\n }, [curModule, modules]);\n\n const mainContent = useMemo(() => {\n if (activeTabKey === TabList[TabList.Reasons]) {\n return importedModules ? (\n <FileTree\n cwd={cwd}\n treeData={fileStructures}\n needCode={true}\n needShowAllTree={true}\n needJumpto={true}\n selectedChunk={selectedChunk}\n defaultOpenFather={1}\n />\n ) : (\n <Empty className={`${clsNamePrefix}-empty`} />\n );\n }\n\n return (\n <div\n className={`${clsNamePrefix}-file-tree`}\n style={{ padding: Size.BasePadding / 2 }}\n >\n <Col span={24} style={{ marginTop: Size.BasePadding / 2 }}>\n {curModule ? (\n <DependencyTree\n module={curModule}\n dependencies={dependencies}\n cwd={cwd}\n />\n ) : (\n <Empty className={`${clsNamePrefix}-empty`} />\n )}\n </Col>\n </div>\n );\n }, [\n activeTabKey,\n curModule,\n dependencies,\n fileStructures,\n importedModules,\n cwd,\n selectedChunk,\n ]);\n\n return <>{mainContent}</>;\n};\n"],"names":["BailoutReasonCard","reasons","Card","clsNamePrefix","Typography","reason","index","Popover","String","ModuleFilesTree","props","curModule","modules","dependencies","cwd","activeTabKey","selectedChunk","importedModules","setImportedModules","useState","fileStructures","useCreateFileTreeData","useEffect","importeds","getImporteds","mainContent","useMemo","TabList","FileTree","Empty","Size","Col","DependencyTree"],"mappings":";;;;;;;;;;AAWO,MAAMA,oBAAsD,CAAC,EAClEC,OAAO,EACR;IACC,IAAI,CAACA,WAAW,CAACA,QAAQ,MAAM,EAC7B,OAAO;IAET,OAAO,WAAP,GACE,KAACC,MAAIA;QACH,WAAW,GAAGC,cAAc,aAAa,CAAC;QAC1C,UAAU;QACV,WAAW;YAAE,SAAS;QAAG;;0BAEzB,IAACC,WAAW,IAAI;gBAAC,QAAM;gBAAC,WAAW,GAAGD,cAAc,mBAAmB,CAAC;0BAAE;;0BAG1E,IAAC;gBACC,WAAW,GAAGA,cAAc,kBAAkB,CAAC;gBAC/C,OAAO;oBAAE,WAAW;oBAAK,WAAW;gBAAO;0BAE1CF,QAAQ,GAAG,CAAC,CAACI,QAAQC,QAAAA,WAAAA,GACpB,KAAC;wBACC,WAAW,GAAGH,cAAc,kB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AAG;gBAAE;0BACrDnB,YAAY,WAAZA,GACC,IAACqB,YAAcA;oBACb,QAAQrB;oBACR,cAAcE;oBACd,KAAKC;mCAGP,IAACe,OAAKA;oBAAC,WAAW,GAAG1B,cAAc,MAAM,CAAC;;;;IAKpD,GAAG;QACDY;QACAJ;QACAE;QACAO;QACAH;QACAH;QACAE;KACD;IAED,OAAO,WAAP,GAAO;kBAAGS;;AACZ"}
|
|
@@ -16,5 +16,52 @@
|
|
|
16
16
|
line-height: 30px;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
.module-analyze-bailout-card {
|
|
20
|
+
box-shadow: none;
|
|
21
|
+
background: #fff;
|
|
22
|
+
border: 1px solid #0505050f;
|
|
23
|
+
border-radius: 8px;
|
|
24
|
+
margin-top: 16px;
|
|
25
|
+
margin-bottom: 24px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.module-analyze-bailout-card-title {
|
|
29
|
+
color: #1c1f23cc;
|
|
30
|
+
margin-bottom: 12px;
|
|
31
|
+
font-size: 14px;
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
display: inline-block;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.module-analyze-bailout-card-list {
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
gap: 8px;
|
|
39
|
+
display: flex;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.module-analyze-bailout-card-item {
|
|
43
|
+
border-bottom: 1px solid #161a2314;
|
|
44
|
+
justify-content: space-between;
|
|
45
|
+
align-items: center;
|
|
46
|
+
padding: 6px 0;
|
|
47
|
+
display: flex;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.module-analyze-bailout-card-item:last-child {
|
|
51
|
+
border-bottom: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.module-analyze-bailout-card-text {
|
|
55
|
+
color: #1c1f23cc;
|
|
56
|
+
max-width: calc(100% - 70px);
|
|
57
|
+
font-size: 12px;
|
|
58
|
+
font-weight: 400;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.module-analyze-bailout-card-meta {
|
|
62
|
+
color: #1c1f2373;
|
|
63
|
+
font-size: 12px;
|
|
64
|
+
}
|
|
65
|
+
|
|
19
66
|
|
|
20
67
|
/*# sourceMappingURL=index.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://./src/pages/ModuleAnalyze/index.scss"],"names":[],"mappings":"AADA;EAEE,aAAa;EACb,gBAAgB;AAClB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,sBAAsB;EACtB,aAAa;AACf;;AAEA;EACE,iBAAiB;AACnB","sourcesContent":[".module-analyze-file-tree{width:\"100%\";min-height:50em}.module-analyze-file-tree .module-analyze-empty{margin-top:20%}.module-analyze-box{display:flex;flex-direction:column}.file-tree-com-titles-box{line-height:30px}"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack://./src/pages/ModuleAnalyze/index.scss"],"names":[],"mappings":"AADA;EAEE,aAAa;EACb,gBAAgB;AAClB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,sBAAsB;EACtB,aAAa;AACf;;AAEA;EACE,iBAAiB;AACnB;;AAEA;EACE,gBAAgB;EAChB,gBAAgB;EAChB,2BAA2B;EAC3B,kBAAkB;EAClB,gBAAgB;EAChB,mBAAmB;AACrB;;AAEA;EACE,gBAAgB;EAChB,mBAAmB;EACnB,eAAe;EACf,gBAAgB;EAChB,qBAAqB;AACvB;;AAEA;EACE,sBAAsB;EACtB,QAAQ;EACR,aAAa;AACf;;AAEA;EACE,kCAAkC;EAClC,8BAA8B;EAC9B,mBAAmB;EACnB,cAAc;EACd,aAAa;AACf;;AAEA;EACE,mBAAmB;AACrB;;AAEA;EACE,gBAAgB;EAChB,4BAA4B;EAC5B,eAAe;EACf,gBAAgB;AAClB;;AAEA;EACE,gBAAgB;EAChB,eAAe;AACjB","sourcesContent":[".module-analyze-file-tree{width:\"100%\";min-height:50em}.module-analyze-file-tree .module-analyze-empty{margin-top:20%}.module-analyze-box{display:flex;flex-direction:column}.file-tree-com-titles-box{line-height:30px}.module-analyze-bailout-card{margin-top:16px;border-radius:8px;border:1px solid rgba(5,5,5,.06);box-shadow:none;background:#fff;margin-bottom:24px}.module-analyze-bailout-card-title{display:inline-block;font-size:14px;margin-bottom:12px;color:rgba(28,31,35,.8);font-weight:600}.module-analyze-bailout-card-list{display:flex;flex-direction:column;gap:8px}.module-analyze-bailout-card-item{display:flex;align-items:center;justify-content:space-between;padding:6px 0;border-bottom:1px solid rgba(22,26,35,.08)}.module-analyze-bailout-card-item:last-child{border-bottom:none}.module-analyze-bailout-card-text{max-width:calc(100% - 70px);font-weight:400;font-size:12px;color:rgba(28,31,35,.8)}.module-analyze-bailout-card-meta{font-size:12px;color:rgba(28,31,35,.45)}"],"sourceRoot":""}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { SDK } from "@rsdoctor/types";
|
|
3
|
-
import { Badge, Card,
|
|
3
|
+
import { Badge, Card, Drawer, Popover, Space, Typography } from "antd";
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { ServerAPIProvider } from "../../components/Manifest/index.mjs";
|
|
6
6
|
import { getShortPath } from "../../utils/index.mjs";
|
|
7
7
|
import { ModuleGraphListContext } from "../BundleSize/config.mjs";
|
|
8
|
-
import { ModuleFilesTree } from "./fileTree.mjs";
|
|
8
|
+
import { BailoutReasonCard, ModuleFilesTree } from "./fileTree.mjs";
|
|
9
9
|
import "./index.css";
|
|
10
10
|
import { drawerWidth } from "../../constants.mjs";
|
|
11
11
|
import { LeftSquareOutlined, QuestionCircleOutlined, RightSquareTwoTone } from "@ant-design/icons";
|
|
12
12
|
var ModuleAnalyze_TabList = /*#__PURE__*/ function(TabList) {
|
|
13
13
|
TabList[TabList["Reasons"] = 0] = "Reasons";
|
|
14
14
|
TabList[TabList["Dependencies"] = 1] = "Dependencies";
|
|
15
|
-
TabList[TabList["BailoutReason"] = 2] = "BailoutReason";
|
|
16
15
|
return TabList;
|
|
17
16
|
}({});
|
|
18
17
|
const tabslist = [
|
|
@@ -23,10 +22,6 @@ const tabslist = [
|
|
|
23
22
|
{
|
|
24
23
|
key: ModuleAnalyze_TabList[1],
|
|
25
24
|
label: ModuleAnalyze_TabList[1]
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
key: ModuleAnalyze_TabList[2],
|
|
29
|
-
label: ModuleAnalyze_TabList[2]
|
|
30
25
|
}
|
|
31
26
|
];
|
|
32
27
|
const ModuleAnalyzeComponent = ({ modules, cwd, moduleId, show, setShow })=>{
|
|
@@ -61,65 +56,74 @@ const ModuleAnalyzeComponent = ({ modules, cwd, moduleId, show, setShow })=>{
|
|
|
61
56
|
api: SDK.ServerAPI.API.GetAllChunkGraph,
|
|
62
57
|
body: {},
|
|
63
58
|
children: (_chunks)=>/*#__PURE__*/ jsx(ModuleGraphListContext.Consumer, {
|
|
64
|
-
children: ({ moduleJumpList, setModuleJumpList })=>/*#__PURE__*/
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
padding: '10px 0px'
|
|
85
|
-
},
|
|
86
|
-
children: [
|
|
87
|
-
/*#__PURE__*/ jsx(LeftSquareOutlined, {
|
|
88
|
-
onClick: ()=>{
|
|
89
|
-
const _list = [
|
|
90
|
-
...moduleJumpList.slice(0, -1)
|
|
91
|
-
];
|
|
92
|
-
setModuleJumpList(_list);
|
|
59
|
+
children: ({ moduleJumpList, setModuleJumpList })=>/*#__PURE__*/ jsxs(Fragment, {
|
|
60
|
+
children: [
|
|
61
|
+
/*#__PURE__*/ jsx("div", {
|
|
62
|
+
style: {
|
|
63
|
+
marginTop: 16
|
|
64
|
+
},
|
|
65
|
+
children: /*#__PURE__*/ jsx(BailoutReasonCard, {
|
|
66
|
+
reasons: module.bailoutReason
|
|
67
|
+
})
|
|
68
|
+
}),
|
|
69
|
+
/*#__PURE__*/ jsx(Card, {
|
|
70
|
+
style: {
|
|
71
|
+
minHeight: 400
|
|
72
|
+
},
|
|
73
|
+
tabList: tabslist,
|
|
74
|
+
activeTabKey: activeTabKey,
|
|
75
|
+
tabProps: {
|
|
76
|
+
size: 'small',
|
|
77
|
+
style: {
|
|
78
|
+
fontSize: 12
|
|
93
79
|
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
80
|
+
},
|
|
81
|
+
onTabChange: (k)=>setActiveTabKey(k),
|
|
82
|
+
styles: {
|
|
83
|
+
title: {
|
|
84
|
+
paddingTop: 0
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
title: /*#__PURE__*/ jsxs(Space, {
|
|
88
|
+
style: {
|
|
89
|
+
padding: '10px 0px'
|
|
90
|
+
},
|
|
91
|
+
children: [
|
|
92
|
+
/*#__PURE__*/ jsx(LeftSquareOutlined, {
|
|
93
|
+
onClick: ()=>{
|
|
94
|
+
const _list = [
|
|
95
|
+
...moduleJumpList.slice(0, -1)
|
|
96
|
+
];
|
|
97
|
+
setModuleJumpList(_list);
|
|
98
|
+
}
|
|
99
|
+
}),
|
|
100
|
+
/*#__PURE__*/ jsx(Typography.Text, {
|
|
101
|
+
style: {
|
|
102
|
+
fontSize: 14,
|
|
103
|
+
color: 'rgba(28, 31, 35, 0.8)'
|
|
104
|
+
},
|
|
105
|
+
children: "Current Module Imported Reasons Tree"
|
|
106
|
+
}),
|
|
107
|
+
/*#__PURE__*/ jsx(Popover, {
|
|
108
|
+
content: /*#__PURE__*/ jsx("div", {
|
|
109
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
110
|
+
children: [
|
|
111
|
+
/*#__PURE__*/ jsx(Badge, {
|
|
112
|
+
status: "success",
|
|
113
|
+
text: " "
|
|
114
|
+
}),
|
|
115
|
+
/*#__PURE__*/ jsx(RightSquareTwoTone, {}),
|
|
116
|
+
/*#__PURE__*/ jsx(Typography.Text, {
|
|
117
|
+
children: ': Jump button, click to jump to the Module dependency analysis page of this module.'
|
|
118
|
+
})
|
|
119
|
+
]
|
|
109
120
|
})
|
|
110
|
-
|
|
121
|
+
}),
|
|
122
|
+
title: "Usage",
|
|
123
|
+
children: /*#__PURE__*/ jsx(QuestionCircleOutlined, {})
|
|
111
124
|
})
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
children: /*#__PURE__*/ jsx(QuestionCircleOutlined, {})
|
|
115
|
-
})
|
|
116
|
-
]
|
|
117
|
-
}),
|
|
118
|
-
children: /*#__PURE__*/ jsx(Row, {
|
|
119
|
-
justify: "start",
|
|
120
|
-
align: "middle",
|
|
121
|
-
children: /*#__PURE__*/ jsx(Col, {
|
|
122
|
-
span: 24,
|
|
125
|
+
]
|
|
126
|
+
}),
|
|
123
127
|
children: /*#__PURE__*/ jsx(ModuleFilesTree, {
|
|
124
128
|
curModule: module,
|
|
125
129
|
modules: modules,
|
|
@@ -129,7 +133,7 @@ const ModuleAnalyzeComponent = ({ modules, cwd, moduleId, show, setShow })=>{
|
|
|
129
133
|
activeTabKey: activeTabKey
|
|
130
134
|
})
|
|
131
135
|
})
|
|
132
|
-
|
|
136
|
+
]
|
|
133
137
|
})
|
|
134
138
|
})
|
|
135
139
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages/ModuleAnalyze/index.mjs","sources":["../../../src/pages/ModuleAnalyze/index.tsx"],"sourcesContent":["import { SDK } from '@rsdoctor/types';\nimport {
|
|
1
|
+
{"version":3,"file":"pages/ModuleAnalyze/index.mjs","sources":["../../../src/pages/ModuleAnalyze/index.tsx"],"sourcesContent":["import { SDK } from '@rsdoctor/types';\nimport { Badge, Card, Drawer, Popover, Space, Typography } from 'antd';\nimport React, { useState } from 'react';\nimport { ServerAPIProvider } from 'src/components/Manifest';\nimport { getShortPath } from 'src/utils';\nimport { ModuleGraphListContext } from '../BundleSize/config';\nimport { ModuleFilesTree, BailoutReasonCard } from './fileTree';\nimport './index.scss';\nimport { drawerWidth } from '../../constants';\nimport {\n LeftSquareOutlined,\n QuestionCircleOutlined,\n RightSquareTwoTone,\n} from '@ant-design/icons';\n\nexport enum TabList {\n Reasons,\n Dependencies,\n}\n\nconst tabslist = [\n {\n key: TabList[TabList.Reasons],\n label: TabList[TabList.Reasons],\n },\n {\n key: TabList[TabList.Dependencies],\n label: TabList[TabList.Dependencies],\n },\n] as unknown as { key: string; label: string }[];\n\nexport const ModuleAnalyzeComponent: React.FC<{\n modules: SDK.ModuleData[];\n cwd: string;\n moduleId: string | number;\n show: boolean;\n setShow: (arg: boolean) => void;\n}> = ({ modules, cwd, moduleId, show, setShow }) => {\n const [selectedChunk, _setSelectedChunk] = useState('' as string);\n const [activeTabKey, setActiveTabKey] = useState(TabList[TabList.Reasons]);\n\n return (\n <ServerAPIProvider\n api={SDK.ServerAPI.API.GetModuleDetails}\n body={{ moduleId: +moduleId }}\n >\n {({ module, dependencies }) => {\n return (\n <Drawer\n title={\n <div className=\"module-analyze-box\">\n <Typography.Text>{getShortPath(module.path)}</Typography.Text>\n <Typography.Text\n style={{ fontSize: 12, color: 'rgba(0, 0, 0, 0.45)' }}\n >\n {`Current Module: ${module.path}`}\n </Typography.Text>\n </div>\n }\n open={show}\n maskClosable\n width={drawerWidth * 0.8}\n onClose={() => setShow(false)}\n >\n <ServerAPIProvider\n api={SDK.ServerAPI.API.GetAllChunkGraph}\n body={{}}\n >\n {(_chunks) => {\n return (\n <ModuleGraphListContext.Consumer>\n {({ moduleJumpList, setModuleJumpList }) => {\n return (\n <>\n <div style={{ marginTop: 16 }}>\n <BailoutReasonCard reasons={module.bailoutReason} />\n </div>\n <Card\n style={{ minHeight: 400 }}\n tabList={tabslist}\n activeTabKey={activeTabKey}\n tabProps={{\n size: 'small',\n style: {\n fontSize: 12,\n },\n }}\n onTabChange={(k) => setActiveTabKey(k)}\n styles={{\n title: { paddingTop: 0 },\n }}\n title={\n <Space style={{ padding: '10px 0px' }}>\n <LeftSquareOutlined\n onClick={() => {\n const _list = [\n ...moduleJumpList.slice(0, -1),\n ];\n setModuleJumpList(_list);\n }}\n />\n <Typography.Text\n style={{\n fontSize: 14,\n color: 'rgba(28, 31, 35, 0.8)',\n }}\n >\n Current Module Imported Reasons Tree\n </Typography.Text>\n <Popover\n content={\n <div>\n <div>\n <Badge status=\"success\" text=\" \" />\n <RightSquareTwoTone />\n <Typography.Text>\n {\n ': Jump button, click to jump to the Module dependency analysis page of this module.'\n }\n </Typography.Text>\n </div>\n </div>\n }\n title=\"Usage\"\n >\n <QuestionCircleOutlined />\n </Popover>\n </Space>\n }\n >\n <ModuleFilesTree\n curModule={module}\n modules={modules}\n dependencies={dependencies}\n cwd={cwd}\n selectedChunk={selectedChunk}\n activeTabKey={activeTabKey}\n />\n </Card>\n </>\n );\n }}\n </ModuleGraphListContext.Consumer>\n );\n }}\n </ServerAPIProvider>\n </Drawer>\n );\n }}\n </ServerAPIProvider>\n );\n};\n"],"names":["TabList","tabslist","ModuleAnalyzeComponent","modules","cwd","moduleId","show","setShow","selectedChunk","_setSelectedChunk","useState","activeTabKey","setActiveTabKey","ServerAPIProvider","SDK","module","dependencies","Drawer","Typography","getShortPath","drawerWidth","_chunks","ModuleGraphListContext","moduleJumpList","setModuleJumpList","BailoutReasonCard","Card","k","Space","LeftSquareOutlined","_list","Popover","Badge","RightSquareTwoTone","QuestionCircleOutlined","ModuleFilesTree"],"mappings":";;;;;;;;;;;AAeO,IAAKA,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