@rsdoctor/components 1.3.5-beta.0 → 1.3.6
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/Alert/ecma-version-check.mjs +2 -2
- package/dist/components/Alert/ecma-version-check.mjs.map +1 -1
- package/dist/components/Alert/package-relation.mjs +2 -4
- package/dist/components/Alert/package-relation.mjs.map +1 -1
- package/dist/components/Alert/view.mjs +2 -3
- package/dist/components/Alert/view.mjs.map +1 -1
- package/dist/components/Alerts/bundle-alert.mjs +2 -3
- package/dist/components/Alerts/bundle-alert.mjs.map +1 -1
- package/dist/components/Charts/TimelineCharts/index.mjs +3 -4
- package/dist/components/Charts/TimelineCharts/index.mjs.map +1 -1
- package/dist/components/Charts/TreeMap.mjs +2 -3
- package/dist/components/Charts/TreeMap.mjs.map +1 -1
- package/dist/components/Charts/index.mjs +1 -1
- package/dist/components/Charts/index.mjs.map +1 -1
- package/dist/components/Charts/loader.mjs +2 -2
- package/dist/components/Charts/loader.mjs.map +1 -1
- package/dist/components/FileTree/index.mjs +2 -2
- package/dist/components/FileTree/index.mjs.map +1 -1
- package/dist/components/Loader/Analysis/files.mjs +32 -36
- package/dist/components/Loader/Analysis/files.mjs.map +1 -1
- package/dist/components/Loader/executions.mjs +1 -2
- package/dist/components/Loader/executions.mjs.map +1 -1
- package/dist/components/Overall/bundle_module.css +1 -0
- package/dist/components/Overall/bundle_module.css.map +1 -1
- package/dist/components/Overall/compile.mjs +1 -2
- package/dist/components/Overall/compile.mjs.map +1 -1
- package/dist/components/Overall/help-center_module.css +2 -0
- package/dist/components/Overall/help-center_module.css.map +1 -1
- package/dist/components/Overall/list_module.css +2 -12
- package/dist/components/Overall/list_module.css.map +1 -1
- package/dist/components/Overall/project_module.css +1 -0
- package/dist/components/Overall/project_module.css.map +1 -1
- package/dist/components/Select/index.mjs +1 -1
- package/dist/components/Select/index.mjs.map +1 -1
- package/dist/components/base/CodeViewer/index.mjs +1 -2
- package/dist/components/base/CodeViewer/index.mjs.map +1 -1
- package/dist/components/base/CodeViewer/utils.mjs +1 -1
- package/dist/components/base/CodeViewer/utils.mjs.map +1 -1
- package/dist/components/base/DiffViewer/index.mjs +1 -2
- package/dist/components/base/DiffViewer/index.mjs.map +1 -1
- package/dist/pages/BundleSize/components/asset.mjs +5 -12
- package/dist/pages/BundleSize/components/asset.mjs.map +1 -1
- package/dist/pages/BundleSize/components/cards.mjs +2 -2
- package/dist/pages/BundleSize/components/cards.mjs.map +1 -1
- package/dist/pages/BundleSize/components/index_module.css +2 -6
- package/dist/pages/BundleSize/components/index_module.css.map +1 -1
- package/dist/pages/BundleSize/components/search-modal.mjs +5 -5
- package/dist/pages/BundleSize/components/search-modal.mjs.map +1 -1
- package/dist/pages/ModuleAnalyze/chunks.mjs +1 -1
- package/dist/pages/ModuleAnalyze/chunks.mjs.map +1 -1
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.mjs +1 -2
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.mjs.map +1 -1
- package/dist/pages/ModuleAnalyze/fileTree.mjs +1 -2
- package/dist/pages/ModuleAnalyze/fileTree.mjs.map +1 -1
- package/dist/pages/ModuleAnalyze/utils/hooks.mjs +5 -8
- package/dist/pages/ModuleAnalyze/utils/hooks.mjs.map +1 -1
- package/dist/pages/ModuleAnalyze/utils/index.mjs +2 -4
- package/dist/pages/ModuleAnalyze/utils/index.mjs.map +1 -1
- package/dist/pages/Resources/BundleDiff/DiffContainer/assets.mjs +4 -7
- package/dist/pages/Resources/BundleDiff/DiffContainer/assets.mjs.map +1 -1
- package/dist/pages/Resources/BundleDiff/DiffContainer/modules.mjs +13 -16
- package/dist/pages/Resources/BundleDiff/DiffContainer/modules.mjs.map +1 -1
- package/dist/pages/Resources/BundleDiff/DiffContainer/row.mjs +15 -35
- package/dist/pages/Resources/BundleDiff/DiffContainer/row.mjs.map +1 -1
- package/dist/pages/Resources/BundleDiff/DiffServerAPIProvider/index.mjs +3 -4
- package/dist/pages/Resources/BundleDiff/DiffServerAPIProvider/index.mjs.map +1 -1
- package/dist/pages/TreeShaking/editor.mjs +2 -4
- package/dist/pages/TreeShaking/editor.mjs.map +1 -1
- package/dist/pages/TreeShaking/index.css +4 -28
- package/dist/pages/TreeShaking/index.css.map +1 -1
- package/dist/pages/TreeShaking/index.mjs +1 -1
- package/dist/pages/TreeShaking/index.mjs.map +1 -1
- package/dist/pages/TreeShaking/table.mjs +3 -3
- package/dist/pages/TreeShaking/table.mjs.map +1 -1
- package/dist/utils/file.mjs +8 -9
- package/dist/utils/file.mjs.map +1 -1
- package/dist/utils/hooks.mjs +1 -5
- package/dist/utils/hooks.mjs.map +1 -1
- package/dist/utils/loader.mjs +1 -1
- package/dist/utils/loader.mjs.map +1 -1
- package/dist/utils/request.mjs +1 -2
- package/dist/utils/request.mjs.map +1 -1
- package/dist/utils/url.mjs +2 -2
- package/dist/utils/url.mjs.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/FileTree/index.mjs","sources":["webpack://@rsdoctor/components/./src/components/FileTree/index.tsx"],"sourcesContent":["import React from 'react';\nimport { Space, theme } from 'antd';\nimport {\n FileOutlined,\n FolderOpenTwoTone,\n FolderTwoTone,\n RightOutlined,\n} from '@ant-design/icons';\nimport Tree, { TreeProps } from 'rc-tree';\nimport CSSIcon from 'src/common/svg/files/css.svg';\nimport HtmlIcon from 'src/common/svg/files/html.svg';\nimport IMGIcon from 'src/common/svg/files/image.svg';\nimport JSIcon from 'src/common/svg/files/js.svg';\nimport FileIcon from 'src/common/svg/files/unkown-file.svg';\n\nimport './index.sass';\nimport { useTheme } from '../../utils';\nimport path from 'path';\n\nconst { useToken } = theme;\n\nfunction getFileType(filename: string) {\n const extension = path.extname(filename).slice(1).toLowerCase();\n\n switch (extension) {\n case 'js':\n case 'jsx':\n case 'ts':\n case 'mjs':\n case 'cjs':\n case 'mts':\n case 'cts':\n return <JSIcon />;\n case 'tsx':\n return <FileIcon />;\n case 'css':\n case 'scss':\n case 'sass':\n case 'less':\n case 'styl':\n case 'stylus':\n return <CSSIcon />;\n case 'html':\n return <HtmlIcon />;\n case 'png':\n case 'jpg':\n case 'jpeg':\n case 'gif':\n case 'svg':\n case 'bmp':\n case 'webp':\n case 'ico':\n case 'apng':\n case 'avif':\n case 'tif':\n case 'tiff':\n case 'jfif':\n case 'pjpeg':\n case 'pjp':\n return <IMGIcon />;\n default:\n return <FileIcon />;\n }\n}\n\nexport function getFileCom(filename: string) {\n const fileIcon = getFileType(filename);\n return <div className=\"file-icon\">{fileIcon}</div>;\n}\n\nexport const FileTree: React.FC<Partial<TreeProps>> = (props) => {\n const { isDark } = useTheme();\n\n const { token } = useToken();\n const color = isDark ? token.colorWhite : token.colorText;\n const style = { fontSize: token.fontSize };\n\n return (\n <Tree\n checkable={false}\n selectable={true}\n switcherIcon={({ data, expanded }) => {\n if (data?.children) {\n return (\n <Space style={{ color }}>\n <RightOutlined\n twoToneColor={color}\n className={`file-tree-switcher-arrow ${expanded ? 'file-tree-switcher-arrow-expand' : ''}`}\n style={style}\n />\n {expanded ? <FolderOpenTwoTone /> : <FolderTwoTone />}\n </Space>\n );\n }\n if (data?.key && typeof data.key === 'string') {\n return getFileCom(data.key);\n }\n return <FileOutlined />;\n }}\n expandAction=\"click\"\n {...props}\n />\n );\n};\n"],"names":["useToken","theme","getFileType","filename","extension","path","JSIcon","FileIcon","CSSIcon","HtmlIcon","IMGIcon","getFileCom","fileIcon","FileTree","props","isDark","useTheme","token","color","style","Tree","data","expanded","Space","RightOutlined","FolderOpenTwoTone","FolderTwoTone","FileOutlined"],"mappings":";;;;;;;;;;;;;AAmBA,MAAM,EAAEA,QAAQ,EAAE,GAAGC;AAErB,SAASC,YAAYC,QAAgB;IACnC,MAAMC,YAAYC,KAAK,OAAO,CAACF,UAAU,KAAK,CAAC,GAAG,WAAW;IAE7D,OAAQC;QACN,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;YACH,OAAO,WAAP,GAAO,IAACE,IAAMA,CAAAA;QAChB,KAAK;YACH,OAAO,WAAP,GAAO,IAACC,aAAQA,CAAAA;QAClB,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;YACH,OAAO,WAAP,GAAO,IAACC,KAAOA,CAAAA;QACjB,KAAK;YACH,OAAO,WAAP,GAAO,IAACC,MAAQA,CAAAA;QAClB,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;YACH,OAAO,WAAP,GAAO,IAACC,aAAOA,CAAAA;QACjB;YACE,OAAO,WAAP,GAAO,IAACH,aAAQA,CAAAA;IACpB;AACF;AAEO,SAASI,WAAWR,QAAgB;IACzC,MAAMS,WAAWV,YAAYC;IAC7B,OAAO,WAAP,GAAO,IAAC;QAAI,WAAU;kBAAaS;;AACrC;AAEO,MAAMC,WAAyC,CAACC;IACrD,MAAM,EAAEC,MAAM,EAAE,GAAGC;IAEnB,MAAM,EAAEC,KAAK,EAAE,GAAGjB;IAClB,MAAMkB,QAAQH,SAASE,MAAM,UAAU,GAAGA,MAAM,SAAS;IACzD,MAAME,QAAQ;QAAE,UAAUF,MAAM,QAAQ;IAAC;IAEzC,OAAO,WAAP,GACE,IAACG,SAAIA;QACH,WAAW;QACX,YAAY;QACZ,cAAc,CAAC,EAAEC,IAAI,EAAEC,QAAQ,EAAE;YAC/B,IAAID,
|
|
1
|
+
{"version":3,"file":"components/FileTree/index.mjs","sources":["webpack://@rsdoctor/components/./src/components/FileTree/index.tsx"],"sourcesContent":["import React from 'react';\nimport { Space, theme } from 'antd';\nimport {\n FileOutlined,\n FolderOpenTwoTone,\n FolderTwoTone,\n RightOutlined,\n} from '@ant-design/icons';\nimport Tree, { TreeProps } from 'rc-tree';\nimport CSSIcon from 'src/common/svg/files/css.svg';\nimport HtmlIcon from 'src/common/svg/files/html.svg';\nimport IMGIcon from 'src/common/svg/files/image.svg';\nimport JSIcon from 'src/common/svg/files/js.svg';\nimport FileIcon from 'src/common/svg/files/unkown-file.svg';\n\nimport './index.sass';\nimport { useTheme } from '../../utils';\nimport path from 'path';\n\nconst { useToken } = theme;\n\nfunction getFileType(filename: string) {\n const extension = path.extname(filename).slice(1).toLowerCase();\n\n switch (extension) {\n case 'js':\n case 'jsx':\n case 'ts':\n case 'mjs':\n case 'cjs':\n case 'mts':\n case 'cts':\n return <JSIcon />;\n case 'tsx':\n return <FileIcon />;\n case 'css':\n case 'scss':\n case 'sass':\n case 'less':\n case 'styl':\n case 'stylus':\n return <CSSIcon />;\n case 'html':\n return <HtmlIcon />;\n case 'png':\n case 'jpg':\n case 'jpeg':\n case 'gif':\n case 'svg':\n case 'bmp':\n case 'webp':\n case 'ico':\n case 'apng':\n case 'avif':\n case 'tif':\n case 'tiff':\n case 'jfif':\n case 'pjpeg':\n case 'pjp':\n return <IMGIcon />;\n default:\n return <FileIcon />;\n }\n}\n\nexport function getFileCom(filename: string) {\n const fileIcon = getFileType(filename);\n return <div className=\"file-icon\">{fileIcon}</div>;\n}\n\nexport const FileTree: React.FC<Partial<TreeProps>> = (props) => {\n const { isDark } = useTheme();\n\n const { token } = useToken();\n const color = isDark ? token.colorWhite : token.colorText;\n const style = { fontSize: token.fontSize };\n\n return (\n <Tree\n checkable={false}\n selectable={true}\n switcherIcon={({ data, expanded }) => {\n if (data?.children) {\n return (\n <Space style={{ color }}>\n <RightOutlined\n twoToneColor={color}\n className={`file-tree-switcher-arrow ${expanded ? 'file-tree-switcher-arrow-expand' : ''}`}\n style={style}\n />\n {expanded ? <FolderOpenTwoTone /> : <FolderTwoTone />}\n </Space>\n );\n }\n if (data?.key && typeof data.key === 'string') {\n return getFileCom(data.key);\n }\n return <FileOutlined />;\n }}\n expandAction=\"click\"\n {...props}\n />\n );\n};\n"],"names":["useToken","theme","getFileType","filename","extension","path","JSIcon","FileIcon","CSSIcon","HtmlIcon","IMGIcon","getFileCom","fileIcon","FileTree","props","isDark","useTheme","token","color","style","Tree","data","expanded","Space","RightOutlined","FolderOpenTwoTone","FolderTwoTone","FileOutlined"],"mappings":";;;;;;;;;;;;;AAmBA,MAAM,EAAEA,QAAQ,EAAE,GAAGC;AAErB,SAASC,YAAYC,QAAgB;IACnC,MAAMC,YAAYC,KAAK,OAAO,CAACF,UAAU,KAAK,CAAC,GAAG,WAAW;IAE7D,OAAQC;QACN,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;YACH,OAAO,WAAP,GAAO,IAACE,IAAMA,CAAAA;QAChB,KAAK;YACH,OAAO,WAAP,GAAO,IAACC,aAAQA,CAAAA;QAClB,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;YACH,OAAO,WAAP,GAAO,IAACC,KAAOA,CAAAA;QACjB,KAAK;YACH,OAAO,WAAP,GAAO,IAACC,MAAQA,CAAAA;QAClB,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;YACH,OAAO,WAAP,GAAO,IAACC,aAAOA,CAAAA;QACjB;YACE,OAAO,WAAP,GAAO,IAACH,aAAQA,CAAAA;IACpB;AACF;AAEO,SAASI,WAAWR,QAAgB;IACzC,MAAMS,WAAWV,YAAYC;IAC7B,OAAO,WAAP,GAAO,IAAC;QAAI,WAAU;kBAAaS;;AACrC;AAEO,MAAMC,WAAyC,CAACC;IACrD,MAAM,EAAEC,MAAM,EAAE,GAAGC;IAEnB,MAAM,EAAEC,KAAK,EAAE,GAAGjB;IAClB,MAAMkB,QAAQH,SAASE,MAAM,UAAU,GAAGA,MAAM,SAAS;IACzD,MAAME,QAAQ;QAAE,UAAUF,MAAM,QAAQ;IAAC;IAEzC,OAAO,WAAP,GACE,IAACG,SAAIA;QACH,WAAW;QACX,YAAY;QACZ,cAAc,CAAC,EAAEC,IAAI,EAAEC,QAAQ,EAAE;YAC/B,IAAID,MAAM,UACR,OAAO,WAAP,GACE,KAACE,OAAKA;gBAAC,OAAO;oBAAEL;gBAAM;;kCACpB,IAACM,eAAaA;wBACZ,cAAcN;wBACd,WAAW,CAAC,yBAAyB,EAAEI,WAAW,oCAAoC,IAAI;wBAC1F,OAAOH;;oBAERG,WAAW,WAAXA,GAAW,IAACG,mBAAiBA,CAAAA,KAAAA,WAAAA,GAAM,IAACC,eAAaA,CAAAA;;;YAIxD,IAAIL,MAAM,OAAO,AAAoB,YAApB,OAAOA,KAAK,GAAG,EAC9B,OAAOV,WAAWU,KAAK,GAAG;YAE5B,OAAO,WAAP,GAAO,IAACM,cAAYA,CAAAA;QACtB;QACA,cAAa;QACZ,GAAGb,KAAK;;AAGf"}
|
|
@@ -19,7 +19,7 @@ const LoaderFiles = (props)=>{
|
|
|
19
19
|
const [loaderIndex, setLoaderIndex] = useState(0);
|
|
20
20
|
const [selectedNode, setSelectedNode] = useState(null);
|
|
21
21
|
const maxHeight = 800;
|
|
22
|
-
const filteredFiles = useMemo(()=>filetree.filter((e)=>e.loaders.some((l)=>filterLoader(e.path, l.loader, props.filename, props.loaders, e.layer,
|
|
22
|
+
const filteredFiles = useMemo(()=>filetree.filter((e)=>e.loaders.some((l)=>filterLoader(e.path, l.loader, props.filename, props.loaders, e.layer, props?.layer))), [
|
|
23
23
|
props.filename,
|
|
24
24
|
props.loaders,
|
|
25
25
|
props.layer
|
|
@@ -74,44 +74,40 @@ const LoaderFiles = (props)=>{
|
|
|
74
74
|
loaders.slice(0, ADDITION_LOADER_NUMBER).map((e, i)=>{
|
|
75
75
|
const isError = e.errors && e.errors.length;
|
|
76
76
|
const key = `${file}_${e.loader}_${i}`;
|
|
77
|
-
if (i <= ADDITION_LOADER_NUMBER) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
})
|
|
107
|
-
}, key);
|
|
108
|
-
}
|
|
77
|
+
if (i <= ADDITION_LOADER_NUMBER) return /*#__PURE__*/ jsx(Tooltip, {
|
|
78
|
+
title: e.path,
|
|
79
|
+
children: /*#__PURE__*/ jsxs(Typography.Text, {
|
|
80
|
+
className: style_module.textBox,
|
|
81
|
+
style: {
|
|
82
|
+
color: isError ? '#f50' : 'inherit'
|
|
83
|
+
},
|
|
84
|
+
onClick: (ev)=>{
|
|
85
|
+
ev.stopPropagation();
|
|
86
|
+
setResourcePath(file);
|
|
87
|
+
setLoaderIndex(i);
|
|
88
|
+
setDrawerVisible(true);
|
|
89
|
+
},
|
|
90
|
+
children: [
|
|
91
|
+
/*#__PURE__*/ jsx(Typography.Text, {
|
|
92
|
+
className: style_module.text,
|
|
93
|
+
ellipsis: true,
|
|
94
|
+
children: e.loader.match(/([^/]+-loader)/g)?.[0] || e.loader
|
|
95
|
+
}),
|
|
96
|
+
/*#__PURE__*/ jsx(Divider, {
|
|
97
|
+
type: "vertical"
|
|
98
|
+
}),
|
|
99
|
+
isError ? /*#__PURE__*/ jsx(CloseCircleOutlined, {}) : /*#__PURE__*/ jsx(Typography.Text, {
|
|
100
|
+
className: style_module.text,
|
|
101
|
+
children: formatCosts(e.costs)
|
|
102
|
+
})
|
|
103
|
+
]
|
|
104
|
+
})
|
|
105
|
+
}, key);
|
|
109
106
|
}),
|
|
110
|
-
|
|
107
|
+
additionalLoaders?.length ? /*#__PURE__*/ jsx(Popover, {
|
|
111
108
|
content: /*#__PURE__*/ jsx(List, {
|
|
112
109
|
dataSource: additionalLoaders,
|
|
113
110
|
renderItem: (e, i)=>{
|
|
114
|
-
var _e_loader_match;
|
|
115
111
|
const isError = e.errors && e.errors.length;
|
|
116
112
|
const key = `${file}_${e.loader}_${i + ADDITION_LOADER_NUMBER}`;
|
|
117
113
|
return /*#__PURE__*/ jsx(List.Item, {
|
|
@@ -136,7 +132,7 @@ const LoaderFiles = (props)=>{
|
|
|
136
132
|
/*#__PURE__*/ jsx(Typography.Text, {
|
|
137
133
|
className: style_module.text,
|
|
138
134
|
ellipsis: true,
|
|
139
|
-
children:
|
|
135
|
+
children: e.loader.match(/([^/]+-loader)/g)?.[0] || e.loader
|
|
140
136
|
}),
|
|
141
137
|
/*#__PURE__*/ jsx(Divider, {
|
|
142
138
|
type: "vertical"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/Loader/Analysis/files.mjs","sources":["webpack://@rsdoctor/components/./src/components/Loader/Analysis/files.tsx"],"sourcesContent":["import { CloseCircleOutlined } from '@ant-design/icons';\nimport { SDK } from '@rsdoctor/types';\nimport {\n Card,\n Col,\n Divider,\n Drawer,\n List,\n Popover,\n Row,\n Space,\n Table,\n Tag,\n Tooltip,\n Typography,\n} from 'antd';\nimport { get } from 'es-toolkit/compat';\nimport React, { useMemo, useState } from 'react';\nimport { drawerWidth, Size } from '../../../constants';\nimport {\n createFileStructures,\n DataNode,\n filterLoader,\n formatCosts,\n mapFileKey,\n} from '../../../utils';\nimport { FileTree } from '../../FileTree';\nimport { Keyword } from '../../Keyword';\nimport { ServerAPIProvider } from '../../Manifest';\nimport { LoaderExecutions } from '../executions';\nimport styles from './style.module.scss';\n\nconst ADDITION_LOADER_NUMBER = 3;\n\nexport const LoaderFiles: React.FC<{\n filetree: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileTree>;\n cwd: string;\n loaders: string[];\n filename: string;\n layer?: string;\n}> = (props) => {\n const { cwd, filetree } = props;\n const [drawerVisible, setDrawerVisible] = useState(false);\n const [resourcePath, setResourcePath] = useState('');\n const [loaderIndex, setLoaderIndex] = useState(0);\n const [selectedNode, setSelectedNode] = useState<DataNode | null>(null);\n\n const maxHeight = 800;\n\n const filteredFiles = useMemo(\n () =>\n filetree.filter((e) =>\n e.loaders.some((l) =>\n filterLoader(\n e.path,\n l.loader,\n props.filename,\n props.loaders,\n e.layer,\n props?.layer,\n ),\n ),\n ),\n [props.filename, props.loaders, props.layer],\n );\n\n const inlinedResourcePathKey = '__RESOURCEPATH__';\n\n const files = useMemo(() => {\n return createFileStructures({\n files: filteredFiles.map((e) => e.path),\n cwd,\n fileTitle(file, basename) {\n const { loaders, layer } = filetree.find((e) => e.path === file)!;\n\n const additionalLoaders: (Pick<\n SDK.LoaderTransformData,\n 'path' | 'loader' | 'errors'\n > & { costs: number })[] = [];\n\n loaders.forEach(\n (l, i) => i > ADDITION_LOADER_NUMBER && additionalLoaders.push(l),\n );\n\n return (\n <div\n style={{\n wordBreak: 'break-all',\n display: 'flex',\n cursor: 'pointer',\n }}\n onClick={() => {\n setLoaderIndex(0);\n setResourcePath(file);\n setDrawerVisible(true);\n }}\n >\n <div className={styles.box}>\n <div className={styles.keywords}>\n <Keyword text={basename.replace(/\\[.*?\\]/g, '')} keyword={''} />\n </div>\n </div>\n <div className={styles.dividerDiv} style={{ flex: 1 }}>\n <Divider className={styles.divider} dashed />\n </div>\n\n {layer && (\n <Tag color=\"cyan\" bordered={false}>\n {layer}\n </Tag>\n )}\n <Space>\n {loaders.slice(0, ADDITION_LOADER_NUMBER).map((e, i) => {\n const isError = e.errors && e.errors.length;\n const key = `${file}_${e.loader}_${i}`;\n if (i <= ADDITION_LOADER_NUMBER) {\n return (\n <Tooltip title={e.path} key={key}>\n <Typography.Text\n className={styles.textBox}\n style={{ color: isError ? '#f50' : 'inherit' }}\n onClick={(ev) => {\n ev.stopPropagation();\n setResourcePath(file);\n setLoaderIndex(i);\n setDrawerVisible(true);\n }}\n >\n <Typography.Text className={styles.text} ellipsis>\n {e.loader.match(/([^/]+-loader)/g)?.[0] || e.loader}\n </Typography.Text>\n <Divider type=\"vertical\" />\n {isError ? (\n <CloseCircleOutlined />\n ) : (\n <Typography.Text className={styles.text}>\n {formatCosts(e.costs)}\n </Typography.Text>\n )}\n </Typography.Text>\n </Tooltip>\n );\n }\n })}\n {additionalLoaders?.length ? (\n <Popover\n content={\n <List\n dataSource={additionalLoaders}\n renderItem={(e, i) => {\n const isError = e.errors && e.errors.length;\n const key = `${file}_${e.loader}_${i + ADDITION_LOADER_NUMBER}`;\n\n return (\n <List.Item>\n <Tooltip title={e.path} key={key}>\n <div style={{ paddingBottom: 5 }}>\n <Typography.Text\n className={styles.textBox}\n style={{\n color: isError ? '#f50' : 'inherit',\n }}\n onClick={(ev) => {\n ev.stopPropagation();\n setResourcePath(file);\n setLoaderIndex(i);\n setDrawerVisible(true);\n }}\n >\n <Typography.Text\n className={styles.text}\n ellipsis\n >\n {e.loader.match(/([^/]+-loader)/g)?.[0] ||\n e.loader}\n </Typography.Text>\n <Divider type=\"vertical\" />\n <Typography.Text className={styles.text}>\n {formatCosts(e.costs)}\n </Typography.Text>\n </Typography.Text>\n </div>\n </Tooltip>\n </List.Item>\n );\n }}\n />\n }\n >\n <div className={styles.textBox}>\n <Typography.Text>···</Typography.Text>\n </div>\n </Popover>\n ) : (\n <></>\n )}\n </Space>\n </div>\n );\n },\n dirTitle(_dir, defaultTitle) {\n return (\n <div style={{ display: 'flex', cursor: 'pointer' }}>\n <Keyword text={defaultTitle} keyword={''} />\n </div>\n );\n },\n });\n }, [filteredFiles]);\n\n return (\n <Row style={{ width: '100%', marginLeft: 0 }} gutter={Size.BasePadding}>\n <Col span={24}>\n <Card\n title={\n <Space>\n <Typography.Text strong>Files</Typography.Text>\n <Typography.Text\n style={{\n fontSize: 12,\n fontWeight: 400,\n color: '#1C1F2399',\n opacity: 0.6,\n }}\n >\n Total Files: {filteredFiles.length}\n </Typography.Text>\n </Space>\n }\n bodyStyle={{\n overflow: 'auto',\n maxHeight,\n minHeight: '40rem',\n padding: 14,\n }}\n >\n <FileTree\n defaultExpandedKeys={mapFileKey(\n files,\n filteredFiles.length >= 100 ? 3 : 4,\n (node) => {\n const resourcePath: string = get(node, inlinedResourcePathKey)!;\n const isNodeModules =\n resourcePath.indexOf('/node_modules/') > -1;\n\n return !isNodeModules;\n },\n )}\n treeData={files}\n key={`${props.loaders.join('|')}_${props.filename}`}\n onSelect={(_e, info) => {\n if (!info.node.isLeaf) {\n setSelectedNode(info.node);\n }\n }}\n selectedKeys={selectedNode ? [selectedNode.key] : undefined}\n expandAction=\"click\"\n />\n <Drawer\n open={drawerVisible}\n onClose={() => setDrawerVisible(false)}\n maskClosable\n width={drawerWidth}\n zIndex={999}\n bodyStyle={{ padding: 0 }}\n >\n {drawerVisible ? (\n <ServerAPIProvider\n api={SDK.ServerAPI.API.GetLoaderFileDetails}\n body={{ path: resourcePath }}\n >\n {(data) => (\n <LoaderExecutions data={data} cwd={cwd} index={loaderIndex} />\n )}\n </ServerAPIProvider>\n ) : null}\n </Drawer>\n </Card>\n </Col>\n\n <Drawer\n open={!!selectedNode}\n onClose={() => setSelectedNode(null)}\n maskClosable\n width={drawerWidth}\n zIndex={999}\n bodyStyle={{ padding: 0 }}\n >\n {selectedNode && (\n <Row>\n <Col span={24}>\n <Card\n title={\n <Tooltip\n title={React.cloneElement(\n selectedNode.title as React.ReactElement,\n { style: { color: '#fff' } },\n )}\n >\n <Typography.Text>\n {`Statistics of`}\n {selectedNode.title as React.ReactNode}\n </Typography.Text>\n </Tooltip>\n }\n >\n <ServerAPIProvider\n api={SDK.ServerAPI.API.GetLoaderFolderStatistics}\n body={{ folder: selectedNode[inlinedResourcePathKey] }}\n >\n {(tableData) => (\n <Table\n style={{\n width: '100%',\n maxHeight,\n height: '40rem',\n overflowY: 'scroll',\n wordBreak: 'break-all',\n }}\n pagination={false}\n bordered\n rowKey={(e) => e.loader}\n columns={[\n {\n title: 'Loader Name',\n dataIndex: 'loader',\n },\n {\n title: 'Files',\n dataIndex: 'files',\n },\n {\n title: 'Total Duration',\n dataIndex: 'costs',\n render: (v) => (\n <Typography.Text strong>\n {formatCosts(v)}\n </Typography.Text>\n ),\n sorter: (a, b) => a.costs - b.costs,\n defaultSortOrder: 'descend',\n sortDirections: ['descend', 'ascend'],\n },\n ]}\n dataSource={tableData!}\n />\n )}\n </ServerAPIProvider>\n </Card>\n </Col>\n </Row>\n )}\n </Drawer>\n </Row>\n );\n};\n"],"names":["ADDITION_LOADER_NUMBER","LoaderFiles","props","cwd","filetree","drawerVisible","setDrawerVisible","useState","resourcePath","setResourcePath","loaderIndex","setLoaderIndex","selectedNode","setSelectedNode","maxHeight","filteredFiles","useMemo","e","l","filterLoader","inlinedResourcePathKey","files","createFileStructures","file","basename","loaders","layer","additionalLoaders","i","styles","Keyword","Divider","Tag","Space","isError","key","_e_loader_match","Tooltip","Typography","ev","CloseCircleOutlined","formatCosts","Popover","List","_dir","defaultTitle","Row","Size","Col","Card","FileTree","mapFileKey","node","get","isNodeModules","_e","info","undefined","Drawer","drawerWidth","ServerAPIProvider","SDK","data","LoaderExecutions","React","tableData","Table","v","a","b"],"mappings":";;;;;;;;;;;;;AAgCA,MAAMA,yBAAyB;AAExB,MAAMC,cAMR,CAACC;IACJ,MAAM,EAAEC,GAAG,EAAEC,QAAQ,EAAE,GAAGF;IAC1B,MAAM,CAACG,eAAeC,iBAAiB,GAAGC,SAAS;IACnD,MAAM,CAACC,cAAcC,gBAAgB,GAAGF,SAAS;IACjD,MAAM,CAACG,aAAaC,eAAe,GAAGJ,SAAS;IAC/C,MAAM,CAACK,cAAcC,gBAAgB,GAAGN,SAA0B;IAElE,MAAMO,YAAY;IAElB,MAAMC,gBAAgBC,QACpB,IACEZ,SAAS,MAAM,CAAC,CAACa,IACfA,EAAE,OAAO,CAAC,IA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C,gBAAgB,WAAhBA,GACC,IAACkC,KAAGA;8BACF,kBAACE,KAAGA;wBAAC,MAAM;kCACT,kBAACC,MAAIA;4BACH,qBACE,IAACZ,SAAOA;gCACN,qBAAO2B,MAAAA,YAAkB,CACvBpD,aAAa,KAAK,EAClB;oCAAE,OAAO;wCAAE,OAAO;oCAAO;gCAAE;0CAG7B,mBAAC0B,WAAW,IAAI;;wCACb;wCACA1B,aAAa,KAAK;;;;sCAKzB,kBAACgD,mBAAiBA;gCAChB,KAAKC,IAAI,SAAS,CAAC,GAAG,CAAC,yBAAyB;gCAChD,MAAM;oCAAE,QAAQjD,YAAY,CAACQ,uBAAuB;gCAAC;0CAEpD,CAAC6C,YAAAA,WAAAA,GACA,IAACC,OAAKA;wCACJ,OAAO;4CACL,OAAO;4CACPpD;4CACA,QAAQ;4CACR,WAAW;4CACX,WAAW;wCACb;wCACA,YAAY;wCACZ,UAAQ;wCACR,QAAQ,CAACG,IAAMA,EAAE,MAAM;wCACvB,SAAS;4CACP;gDACE,OAAO;gDACP,WAAW;4CACb;4CACA;gDACE,OAAO;gDACP,WAAW;4CACb;4CACA;gDACE,OAAO;gDACP,WAAW;gDACX,QAAQ,CAACkD,IAAAA,WAAAA,GACP,IAAC7B,WAAW,IAAI;wDAAC,QAAM;kEACpBG,YAAY0B;;gDAGjB,QAAQ,CAACC,GAAGC,IAAMD,EAAE,KAAK,GAAGC,EAAE,KAAK;gDACnC,kBAAkB;gDAClB,gBAAgB;oDAAC;oDAAW;iDAAS;4CACvC;yCACD;wCACD,YAAYJ;;;;;;;;;AAWlC"}
|
|
1
|
+
{"version":3,"file":"components/Loader/Analysis/files.mjs","sources":["webpack://@rsdoctor/components/./src/components/Loader/Analysis/files.tsx"],"sourcesContent":["import { CloseCircleOutlined } from '@ant-design/icons';\nimport { SDK } from '@rsdoctor/types';\nimport {\n Card,\n Col,\n Divider,\n Drawer,\n List,\n Popover,\n Row,\n Space,\n Table,\n Tag,\n Tooltip,\n Typography,\n} from 'antd';\nimport { get } from 'es-toolkit/compat';\nimport React, { useMemo, useState } from 'react';\nimport { drawerWidth, Size } from '../../../constants';\nimport {\n createFileStructures,\n DataNode,\n filterLoader,\n formatCosts,\n mapFileKey,\n} from '../../../utils';\nimport { FileTree } from '../../FileTree';\nimport { Keyword } from '../../Keyword';\nimport { ServerAPIProvider } from '../../Manifest';\nimport { LoaderExecutions } from '../executions';\nimport styles from './style.module.scss';\n\nconst ADDITION_LOADER_NUMBER = 3;\n\nexport const LoaderFiles: React.FC<{\n filetree: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileTree>;\n cwd: string;\n loaders: string[];\n filename: string;\n layer?: string;\n}> = (props) => {\n const { cwd, filetree } = props;\n const [drawerVisible, setDrawerVisible] = useState(false);\n const [resourcePath, setResourcePath] = useState('');\n const [loaderIndex, setLoaderIndex] = useState(0);\n const [selectedNode, setSelectedNode] = useState<DataNode | null>(null);\n\n const maxHeight = 800;\n\n const filteredFiles = useMemo(\n () =>\n filetree.filter((e) =>\n e.loaders.some((l) =>\n filterLoader(\n e.path,\n l.loader,\n props.filename,\n props.loaders,\n e.layer,\n props?.layer,\n ),\n ),\n ),\n [props.filename, props.loaders, props.layer],\n );\n\n const inlinedResourcePathKey = '__RESOURCEPATH__';\n\n const files = useMemo(() => {\n return createFileStructures({\n files: filteredFiles.map((e) => e.path),\n cwd,\n fileTitle(file, basename) {\n const { loaders, layer } = filetree.find((e) => e.path === file)!;\n\n const additionalLoaders: (Pick<\n SDK.LoaderTransformData,\n 'path' | 'loader' | 'errors'\n > & { costs: number })[] = [];\n\n loaders.forEach(\n (l, i) => i > ADDITION_LOADER_NUMBER && additionalLoaders.push(l),\n );\n\n return (\n <div\n style={{\n wordBreak: 'break-all',\n display: 'flex',\n cursor: 'pointer',\n }}\n onClick={() => {\n setLoaderIndex(0);\n setResourcePath(file);\n setDrawerVisible(true);\n }}\n >\n <div className={styles.box}>\n <div className={styles.keywords}>\n <Keyword text={basename.replace(/\\[.*?\\]/g, '')} keyword={''} />\n </div>\n </div>\n <div className={styles.dividerDiv} style={{ flex: 1 }}>\n <Divider className={styles.divider} dashed />\n </div>\n\n {layer && (\n <Tag color=\"cyan\" bordered={false}>\n {layer}\n </Tag>\n )}\n <Space>\n {loaders.slice(0, ADDITION_LOADER_NUMBER).map((e, i) => {\n const isError = e.errors && e.errors.length;\n const key = `${file}_${e.loader}_${i}`;\n if (i <= ADDITION_LOADER_NUMBER) {\n return (\n <Tooltip title={e.path} key={key}>\n <Typography.Text\n className={styles.textBox}\n style={{ color: isError ? '#f50' : 'inherit' }}\n onClick={(ev) => {\n ev.stopPropagation();\n setResourcePath(file);\n setLoaderIndex(i);\n setDrawerVisible(true);\n }}\n >\n <Typography.Text className={styles.text} ellipsis>\n {e.loader.match(/([^/]+-loader)/g)?.[0] || e.loader}\n </Typography.Text>\n <Divider type=\"vertical\" />\n {isError ? (\n <CloseCircleOutlined />\n ) : (\n <Typography.Text className={styles.text}>\n {formatCosts(e.costs)}\n </Typography.Text>\n )}\n </Typography.Text>\n </Tooltip>\n );\n }\n })}\n {additionalLoaders?.length ? (\n <Popover\n content={\n <List\n dataSource={additionalLoaders}\n renderItem={(e, i) => {\n const isError = e.errors && e.errors.length;\n const key = `${file}_${e.loader}_${i + ADDITION_LOADER_NUMBER}`;\n\n return (\n <List.Item>\n <Tooltip title={e.path} key={key}>\n <div style={{ paddingBottom: 5 }}>\n <Typography.Text\n className={styles.textBox}\n style={{\n color: isError ? '#f50' : 'inherit',\n }}\n onClick={(ev) => {\n ev.stopPropagation();\n setResourcePath(file);\n setLoaderIndex(i);\n setDrawerVisible(true);\n }}\n >\n <Typography.Text\n className={styles.text}\n ellipsis\n >\n {e.loader.match(/([^/]+-loader)/g)?.[0] ||\n e.loader}\n </Typography.Text>\n <Divider type=\"vertical\" />\n <Typography.Text className={styles.text}>\n {formatCosts(e.costs)}\n </Typography.Text>\n </Typography.Text>\n </div>\n </Tooltip>\n </List.Item>\n );\n }}\n />\n }\n >\n <div className={styles.textBox}>\n <Typography.Text>···</Typography.Text>\n </div>\n </Popover>\n ) : (\n <></>\n )}\n </Space>\n </div>\n );\n },\n dirTitle(_dir, defaultTitle) {\n return (\n <div style={{ display: 'flex', cursor: 'pointer' }}>\n <Keyword text={defaultTitle} keyword={''} />\n </div>\n );\n },\n });\n }, [filteredFiles]);\n\n return (\n <Row style={{ width: '100%', marginLeft: 0 }} gutter={Size.BasePadding}>\n <Col span={24}>\n <Card\n title={\n <Space>\n <Typography.Text strong>Files</Typography.Text>\n <Typography.Text\n style={{\n fontSize: 12,\n fontWeight: 400,\n color: '#1C1F2399',\n opacity: 0.6,\n }}\n >\n Total Files: {filteredFiles.length}\n </Typography.Text>\n </Space>\n }\n bodyStyle={{\n overflow: 'auto',\n maxHeight,\n minHeight: '40rem',\n padding: 14,\n }}\n >\n <FileTree\n defaultExpandedKeys={mapFileKey(\n files,\n filteredFiles.length >= 100 ? 3 : 4,\n (node) => {\n const resourcePath: string = get(node, inlinedResourcePathKey)!;\n const isNodeModules =\n resourcePath.indexOf('/node_modules/') > -1;\n\n return !isNodeModules;\n },\n )}\n treeData={files}\n key={`${props.loaders.join('|')}_${props.filename}`}\n onSelect={(_e, info) => {\n if (!info.node.isLeaf) {\n setSelectedNode(info.node);\n }\n }}\n selectedKeys={selectedNode ? [selectedNode.key] : undefined}\n expandAction=\"click\"\n />\n <Drawer\n open={drawerVisible}\n onClose={() => setDrawerVisible(false)}\n maskClosable\n width={drawerWidth}\n zIndex={999}\n bodyStyle={{ padding: 0 }}\n >\n {drawerVisible ? (\n <ServerAPIProvider\n api={SDK.ServerAPI.API.GetLoaderFileDetails}\n body={{ path: resourcePath }}\n >\n {(data) => (\n <LoaderExecutions data={data} cwd={cwd} index={loaderIndex} />\n )}\n </ServerAPIProvider>\n ) : null}\n </Drawer>\n </Card>\n </Col>\n\n <Drawer\n open={!!selectedNode}\n onClose={() => setSelectedNode(null)}\n maskClosable\n width={drawerWidth}\n zIndex={999}\n bodyStyle={{ padding: 0 }}\n >\n {selectedNode && (\n <Row>\n <Col span={24}>\n <Card\n title={\n <Tooltip\n title={React.cloneElement(\n selectedNode.title as React.ReactElement,\n { style: { color: '#fff' } },\n )}\n >\n <Typography.Text>\n {`Statistics of`}\n {selectedNode.title as React.ReactNode}\n </Typography.Text>\n </Tooltip>\n }\n >\n <ServerAPIProvider\n api={SDK.ServerAPI.API.GetLoaderFolderStatistics}\n body={{ folder: selectedNode[inlinedResourcePathKey] }}\n >\n {(tableData) => (\n <Table\n style={{\n width: '100%',\n maxHeight,\n height: '40rem',\n overflowY: 'scroll',\n wordBreak: 'break-all',\n }}\n pagination={false}\n bordered\n rowKey={(e) => e.loader}\n columns={[\n {\n title: 'Loader Name',\n dataIndex: 'loader',\n },\n {\n title: 'Files',\n dataIndex: 'files',\n },\n {\n title: 'Total Duration',\n dataIndex: 'costs',\n render: (v) => (\n <Typography.Text strong>\n {formatCosts(v)}\n </Typography.Text>\n ),\n sorter: (a, b) => a.costs - b.costs,\n defaultSortOrder: 'descend',\n sortDirections: ['descend', 'ascend'],\n },\n ]}\n dataSource={tableData!}\n />\n )}\n </ServerAPIProvider>\n </Card>\n </Col>\n </Row>\n )}\n </Drawer>\n </Row>\n );\n};\n"],"names":["ADDITION_LOADER_NUMBER","LoaderFiles","props","cwd","filetree","drawerVisible","setDrawerVisible","useState","resourcePath","setResourcePath","loaderIndex","setLoaderIndex","selectedNode","setSelectedNode","maxHeight","filteredFiles","useMemo","e","l","filterLoader","inlinedResourcePathKey","files","createFileStructures","file","basename","loaders","layer","additionalLoaders","i","styles","Keyword","Divider","Tag","Space","isError","key","Tooltip","Typography","ev","CloseCircleOutlined","formatCosts","Popover","List","_dir","defaultTitle","Row","Size","Col","Card","FileTree","mapFileKey","node","get","isNodeModules","_e","info","undefined","Drawer","drawerWidth","ServerAPIProvider","SDK","data","LoaderExecutions","React","tableData","Table","v","a","b"],"mappings":";;;;;;;;;;;;;AAgCA,MAAMA,yBAAyB;AAExB,MAA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AAC7C;gBACR,SAAS,IAAMC,gBAAgB;gBAC/B,cAAY;gBACZ,OAAO6C;gBACP,QAAQ;gBACR,WAAW;oBAAE,SAAS;gBAAE;0BAEvB9C,gBAAgB,WAAhBA,GACC,IAACiC,KAAGA;8BACF,kBAACE,KAAGA;wBAAC,MAAM;kCACT,kBAACC,MAAIA;4BACH,qBACE,IAACZ,SAAOA;gCACN,qBAAO2B,MAAAA,YAAkB,CACvBnD,aAAa,KAAK,EAClB;oCAAE,OAAO;wCAAE,OAAO;oCAAO;gCAAE;0CAG7B,mBAACyB,WAAW,IAAI;;wCACb;wCACAzB,aAAa,KAAK;;;;sCAKzB,kBAAC+C,mBAAiBA;gCAChB,KAAKC,IAAI,SAAS,CAAC,GAAG,CAAC,yBAAyB;gCAChD,MAAM;oCAAE,QAAQhD,YAAY,CAACQ,uBAAuB;gCAAC;0CAEpD,CAAC4C,YAAAA,WAAAA,GACA,IAACC,OAAKA;wCACJ,OAAO;4CACL,OAAO;4CACPnD;4CACA,QAAQ;4CACR,WAAW;4CACX,WAAW;wCACb;wCACA,YAAY;wCACZ,UAAQ;wCACR,QAAQ,CAACG,IAAMA,EAAE,MAAM;wCACvB,SAAS;4CACP;gDACE,OAAO;gDACP,WAAW;4CACb;4CACA;gDACE,OAAO;gDACP,WAAW;4CACb;4CACA;gDACE,OAAO;gDACP,WAAW;gDACX,QAAQ,CAACiD,IAAAA,WAAAA,GACP,IAAC7B,WAAW,IAAI;wDAAC,QAAM;kEACpBG,YAAY0B;;gDAGjB,QAAQ,CAACC,GAAGC,IAAMD,EAAE,KAAK,GAAGC,EAAE,KAAK;gDACnC,kBAAkB;gDAClB,gBAAgB;oDAAC;oDAAW;iDAAS;4CACvC;yCACD;wCACD,YAAYJ;;;;;;;;;AAWlC"}
|
|
@@ -193,7 +193,6 @@ const LoaderExecutions = ({ data, cwd, index })=>{
|
|
|
193
193
|
marginTop: Size.BasePadding
|
|
194
194
|
},
|
|
195
195
|
children: loaders.map((e, i, arr)=>{
|
|
196
|
-
var _costs_match;
|
|
197
196
|
const { loader, isPitch } = e;
|
|
198
197
|
const costs = formatCosts(e.costs);
|
|
199
198
|
return /*#__PURE__*/ jsxs(Timeline.Item, {
|
|
@@ -237,7 +236,7 @@ const LoaderExecutions = ({ data, cwd, index })=>{
|
|
|
237
236
|
style: {
|
|
238
237
|
color: '#000'
|
|
239
238
|
},
|
|
240
|
-
children:
|
|
239
|
+
children: costs.match(/[0-9]*\.?[0-9]+/g)?.[0]
|
|
241
240
|
}),
|
|
242
241
|
" ",
|
|
243
242
|
/*#__PURE__*/ jsx(Typography.Text, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/Loader/executions.mjs","sources":["webpack://@rsdoctor/components/./src/components/Loader/executions.tsx"],"sourcesContent":["import { ClockCircleTwoTone } from '@ant-design/icons';\nimport { SDK } from '@rsdoctor/types';\nimport {\n Col,\n Divider,\n Empty,\n List,\n Row,\n Space,\n Tabs,\n Tag,\n Timeline,\n Tooltip,\n Typography,\n} from 'antd';\nimport dayjs from 'dayjs';\nimport { PropsWithChildren, useCallback, useState } from 'react';\nimport InputIcon from 'src/common/svg/loader/input.svg';\nimport OutputIcon from 'src/common/svg/loader/output.svg';\nimport StepIcon from 'src/common/svg/loader/step.svg';\nimport { Size } from '../../constants';\nimport { beautifyPath, formatCosts, useTheme } from '../../utils';\nimport { CodeViewer, DiffViewer } from '../base';\nimport { Card } from '../Card';\nimport { CodeOpener } from '../Opener';\nimport { Title } from '../Title';\nimport styles from './Analysis/style.module.scss';\n\ninterface LoaderExecutionsProps {\n cwd: string;\n data: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileDetails>;\n index?: number;\n}\n\nconst LoaderPropsItem = ({\n loader,\n resource,\n cwd,\n}: {\n loader: SDK.LoaderTransformData & {\n costs: number;\n };\n resource: SDK.ResourceData;\n cwd: string;\n}): JSX.Element => {\n return (\n <Card\n title={'Loader Details'}\n style={{ border: 'none' }}\n extra={\n <Tag icon={<ClockCircleTwoTone />} color=\"default\">\n {dayjs(loader.startAt).format('YYYY-MM-DD HH:mm:ss')}\n </Tag>\n }\n >\n <Space direction=\"vertical\" style={{ width: '100%' }}>\n {loader.isPitch ? <Typography.Text code>pitch</Typography.Text> : null}\n <List size=\"large\" bordered>\n <List.Item>\n <Typography.Text strong>{'File Path'}</Typography.Text>\n <div>{beautifyPath(resource.path, cwd)}</div>\n </List.Item>\n <List.Item>\n <Typography.Text strong>{'Resource Path'}</Typography.Text>\n <CodeOpener cwd={cwd} url={resource.path} loc=\"\" disabled />\n </List.Item>\n <List.Item>\n <Typography.Text strong>{'Resource Query'}</Typography.Text>\n <div>{resource.queryRaw || '-'}</div>\n </List.Item>\n <List.Item>\n <Typography.Text strong>{'Duration'}</Typography.Text>\n <div>{formatCosts(loader.costs)}</div>\n </List.Item>\n <List.Item>\n <Typography.Text strong>{'Loader'}</Typography.Text>\n <div>\n <Typography.Text code>{loader.loader}</Typography.Text>\n </div>\n </List.Item>\n <List.Item>\n <Typography.Text strong>{'Loader Index'}</Typography.Text>\n <div>{`${loader.loaderIndex}`}</div>\n </List.Item>\n <List.Item>\n <Typography.Text strong>{'Loader Path'}</Typography.Text>\n <CodeOpener cwd={cwd} url={loader.path} loc=\"\" disabled />\n </List.Item>\n <List.Item>\n <div style={{ width: 180 }}>\n <Typography.Text strong>{'Options'}</Typography.Text>\n </div>\n <Divider type=\"vertical\" />\n <Typography.Paragraph\n ellipsis={{\n rows: 2,\n expandable: true,\n symbol: 'more',\n }}\n copyable\n >\n {JSON.stringify(loader.options || '-')}\n </Typography.Paragraph>\n </List.Item>\n </List>\n </Space>\n </Card>\n );\n};\n\nexport const LoaderExecutions = ({\n data,\n cwd,\n index,\n}: PropsWithChildren<LoaderExecutionsProps>): JSX.Element => {\n const { loaders, resource } = data;\n const [currentIndex, setCurrentIndex] = useState(index || 0);\n const { theme } = useTheme();\n const isLight = theme === 'light';\n const loader = loaders[currentIndex];\n const before = loader.input || '';\n const leftSpan = 5;\n const hasError = loader.errors && loader.errors.length;\n const [activeKey, setActiveKey] = useState('loaderDetails');\n const onChange = useCallback((key: string) => {\n setActiveKey(key);\n }, []);\n\n return (\n <Row className={styles.executions} style={{ height: '100%' }}>\n <Col\n span={leftSpan}\n style={{\n borderRight: isLight ? `1px solid #f0f0f0` : undefined,\n padding: Size.BasePadding,\n }}\n >\n <Space direction=\"vertical\" style={{ width: '100%' }}>\n <Title text=\"Executions\" />\n <Timeline mode=\"left\" style={{ marginTop: Size.BasePadding }}>\n {loaders.map((e, i, arr) => {\n const { loader, isPitch } = e;\n const costs = formatCosts(e.costs);\n return (\n <Timeline.Item\n dot={\n isPitch ? (\n <Tag style={{ marginLeft: 1, fontWeight: 500 }}>\n pitch\n </Tag>\n ) : (\n <ClockCircleTwoTone />\n )\n }\n style={{ paddingBottom: 10, textAlign: 'center' }}\n key={i}\n >\n <Row align=\"middle\" justify=\"space-between\" gutter={[0, 10]}>\n <Col span={24} className={styles.timeline}>\n <Tooltip title={loader} trigger=\"hover\">\n <div\n className={`${styles.box} ${currentIndex === i ? styles.selected : ''}`}\n onClick={() => {\n setCurrentIndex(i);\n }}\n style={{ textAlign: 'left' }}\n >\n <div>\n <Typography.Text style={{ color: '#000' }}>\n {costs.match(/[0-9]*\\.?[0-9]+/g)?.[0]}\n </Typography.Text>\n {` `}\n <Typography.Text\n style={{ color: 'rgba(0,0,0,0.45)' }}\n >\n {costs.match(/[a-zA-Z]+/g)}\n </Typography.Text>\n </div>\n <Typography.Text\n style={{ color: 'rgba(0,0,0,0.65)' }}\n className={styles.loader}\n >\n {loader}\n </Typography.Text>\n </div>\n </Tooltip>\n </Col>\n </Row>\n {i === arr.length - 1 ? null : (\n <div style={{ paddingTop: 10 }}>\n <StepIcon />\n </div>\n )}\n </Timeline.Item>\n );\n })}\n </Timeline>\n </Space>\n </Col>\n <Col span={24 - leftSpan} style={{ height: '100%' }}>\n <Tabs\n type=\"card\"\n defaultActiveKey=\"loaderDetails\"\n activeKey={activeKey}\n items={[\n {\n label: 'Loader Props',\n key: 'loaderProps',\n children: (\n <LoaderPropsItem\n loader={loader}\n resource={resource}\n cwd={cwd}\n />\n ),\n },\n {\n label: 'Loader Details',\n key: 'loaderDetails',\n children: (\n <div style={{ height: '100%' }}>\n {hasError ? (\n <Col span={24} style={{ height: '53%', minHeight: 400 }}>\n <div\n style={{\n padding: Size.BasePadding,\n borderTop: `1px solid ${isLight ? '#f0f0f0' : 'rgba(253, 253, 253, 0.12)'}`,\n borderBottom: `1px solid ${isLight ? '#f0f0f0' : 'rgba(253, 253, 253, 0.12)'}`,\n }}\n >\n <Title\n text={`the error stack of [${loader.loader}] ${loader.isPitch ? 'pitch' : ''}`}\n />\n </div>\n <div style={{ height: '90%' }}>\n <CodeViewer\n code={loader.errors[0].message}\n lang=\"javascript\"\n />\n </div>\n </Col>\n ) : (\n <Col span={24} style={{ height: '53%', minHeight: 400 }}>\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n padding: Size.BasePadding,\n borderBottom: `1px solid ${isLight ? '#f0f0f0' : 'rgba(253, 253, 253, 0.12)'}`,\n }}\n >\n <Title\n text={\n <>\n {`the result of [${loader.loader}] ${loader.isPitch ? 'pitch' : ''}`}\n {!loader.isPitch && (\n <span style={{ fontWeight: 400 }}>\n (\n <InputIcon\n style={{\n verticalAlign: 'middle',\n margin: '0 2px',\n }}\n />\n Input ⟷\n <OutputIcon\n style={{\n verticalAlign: 'middle',\n position: 'relative',\n top: -2,\n }}\n />\n Output)\n </span>\n )}\n </>\n }\n />\n <div style={{ flex: 1 }} />\n </div>\n {loader.isPitch ? (\n loader.result ? (\n <div style={{ height: '90%' }}>\n <CodeViewer\n isEmbed\n code={loader.result}\n filePath={resource.path}\n />\n </div>\n ) : (\n <Empty\n description={\n 'No loader result. If you use the Brief Mode, there will not have loader results.'\n }\n />\n )\n ) : (\n <div style={{ minHeight: '700px' }}>\n <div style={{ height: '40rem', overflow: 'hidden' }}>\n {!loader.result && !before ? (\n <Empty\n description={\n 'No loader result. If you use the Brief Mode, there will not have loader results.'\n }\n />\n ) : (\n <DiffViewer\n isEmbed\n original={before}\n modified={loader.result || ''}\n originalFilePath={resource.path}\n modifiedFilePath={resource.path}\n />\n )}\n </div>\n </div>\n )}\n </Col>\n )}\n </div>\n ),\n },\n ]}\n onChange={onChange}\n />\n </Col>\n </Row>\n );\n};\n"],"names":["LoaderPropsItem","loader","resource","cwd","Card","Tag","ClockCircleTwoTone","dayjs","Space","Typography","List","beautifyPath","CodeOpener","formatCosts","Divider","JSON","LoaderExecutions","data","index","loaders","currentIndex","setCurrentIndex","useState","theme","useTheme","isLight","before","leftSpan","hasError","activeKey","setActiveKey","onChange","useCallback","key","Row","styles","Col","undefined","Size","Title","Timeline","e","i","arr","_costs_match","isPitch","costs","Tooltip","StepIcon","Tabs","CodeViewer","InputIcon","OutputIcon","Empty","DiffViewer"],"mappings":";;;;;;;;;;;;;;;AAkCA,MAAMA,kBAAkB,CAAC,EACvBC,MAAM,EACNC,QAAQ,EACRC,GAAG,EAOJ,GACQ,WAAP,GACE,IAACC,MAAIA;QACH,OAAO;QACP,OAAO;YAAE,QAAQ;QAAO;QACxB,qBACE,IAACC,KAAGA;YAAC,oBAAM,IAACC,oBAAkBA,CAAAA;YAAK,OAAM;sBACtCC,MAAMN,OAAO,OAAO,EAAE,MAAM,CAAC;;kBAIlC,mBAACO,OAAKA;YAAC,WAAU;YAAW,OAAO;gBAAE,OAAO;YAAO;;gBAChDP,OAAO,OAAO,GAAG,WAAH,GAAG,IAACQ,WAAW,IAAI;oBAAC,MAAI;8BAAC;qBAA0B;8BAClE,KAACC,MAAIA;oBAAC,MAAK;oBAAQ,UAAQ;;sCACzB,KAACA,KAAK,IAAI;;8CACR,IAACD,WAAW,IAAI;oCAAC,QAAM;8CAAE;;8CACzB,IAAC;8CAAKE,aAAaT,SAAS,IAAI,EAAEC;;;;sCAEpC,KAACO,KAAK,IAAI;;8CACR,IAACD,WAAW,IAAI;oCAAC,QAA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;4CAAI,OAAO;gDAAE,QAAQ;4CAAM;sDAC1B,kBAACiD,YAAUA;gDACT,SAAO;gDACP,MAAMjD,OAAO,MAAM;gDACnB,UAAUC,SAAS,IAAI;;2DAI3B,IAACmD,OAAKA;4CACJ,aACE;2DAKN,IAAC;4CAAI,OAAO;gDAAE,WAAW;4CAAQ;sDAC/B,kBAAC;gDAAI,OAAO;oDAAE,QAAQ;oDAAS,UAAU;gDAAS;0DAC/C,AAACpD,OAAO,MAAM,IAAKyB,S,cAOlB,IAAC4B,YAAUA;oDACT,SAAO;oDACP,UAAU5B;oDACV,UAAUzB,OAAO,MAAM,IAAI;oDAC3B,kBAAkBC,SAAS,IAAI;oDAC/B,kBAAkBA,SAAS,IAAI;qDAZN,WAATwB,GAClB,IAAC2B,OAAKA;oDACJ,aACE;;;;;;;wBAmBtB;qBACD;oBACD,UAAUtB;;;;;AAKpB"}
|
|
1
|
+
{"version":3,"file":"components/Loader/executions.mjs","sources":["webpack://@rsdoctor/components/./src/components/Loader/executions.tsx"],"sourcesContent":["import { ClockCircleTwoTone } from '@ant-design/icons';\nimport { SDK } from '@rsdoctor/types';\nimport {\n Col,\n Divider,\n Empty,\n List,\n Row,\n Space,\n Tabs,\n Tag,\n Timeline,\n Tooltip,\n Typography,\n} from 'antd';\nimport dayjs from 'dayjs';\nimport { PropsWithChildren, useCallback, useState } from 'react';\nimport InputIcon from 'src/common/svg/loader/input.svg';\nimport OutputIcon from 'src/common/svg/loader/output.svg';\nimport StepIcon from 'src/common/svg/loader/step.svg';\nimport { Size } from '../../constants';\nimport { beautifyPath, formatCosts, useTheme } from '../../utils';\nimport { CodeViewer, DiffViewer } from '../base';\nimport { Card } from '../Card';\nimport { CodeOpener } from '../Opener';\nimport { Title } from '../Title';\nimport styles from './Analysis/style.module.scss';\n\ninterface LoaderExecutionsProps {\n cwd: string;\n data: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileDetails>;\n index?: number;\n}\n\nconst LoaderPropsItem = ({\n loader,\n resource,\n cwd,\n}: {\n loader: SDK.LoaderTransformData & {\n costs: number;\n };\n resource: SDK.ResourceData;\n cwd: string;\n}): JSX.Element => {\n return (\n <Card\n title={'Loader Details'}\n style={{ border: 'none' }}\n extra={\n <Tag icon={<ClockCircleTwoTone />} color=\"default\">\n {dayjs(loader.startAt).format('YYYY-MM-DD HH:mm:ss')}\n </Tag>\n }\n >\n <Space direction=\"vertical\" style={{ width: '100%' }}>\n {loader.isPitch ? <Typography.Text code>pitch</Typography.Text> : null}\n <List size=\"large\" bordered>\n <List.Item>\n <Typography.Text strong>{'File Path'}</Typography.Text>\n <div>{beautifyPath(resource.path, cwd)}</div>\n </List.Item>\n <List.Item>\n <Typography.Text strong>{'Resource Path'}</Typography.Text>\n <CodeOpener cwd={cwd} url={resource.path} loc=\"\" disabled />\n </List.Item>\n <List.Item>\n <Typography.Text strong>{'Resource Query'}</Typography.Text>\n <div>{resource.queryRaw || '-'}</div>\n </List.Item>\n <List.Item>\n <Typography.Text strong>{'Duration'}</Typography.Text>\n <div>{formatCosts(loader.costs)}</div>\n </List.Item>\n <List.Item>\n <Typography.Text strong>{'Loader'}</Typography.Text>\n <div>\n <Typography.Text code>{loader.loader}</Typography.Text>\n </div>\n </List.Item>\n <List.Item>\n <Typography.Text strong>{'Loader Index'}</Typography.Text>\n <div>{`${loader.loaderIndex}`}</div>\n </List.Item>\n <List.Item>\n <Typography.Text strong>{'Loader Path'}</Typography.Text>\n <CodeOpener cwd={cwd} url={loader.path} loc=\"\" disabled />\n </List.Item>\n <List.Item>\n <div style={{ width: 180 }}>\n <Typography.Text strong>{'Options'}</Typography.Text>\n </div>\n <Divider type=\"vertical\" />\n <Typography.Paragraph\n ellipsis={{\n rows: 2,\n expandable: true,\n symbol: 'more',\n }}\n copyable\n >\n {JSON.stringify(loader.options || '-')}\n </Typography.Paragraph>\n </List.Item>\n </List>\n </Space>\n </Card>\n );\n};\n\nexport const LoaderExecutions = ({\n data,\n cwd,\n index,\n}: PropsWithChildren<LoaderExecutionsProps>): JSX.Element => {\n const { loaders, resource } = data;\n const [currentIndex, setCurrentIndex] = useState(index || 0);\n const { theme } = useTheme();\n const isLight = theme === 'light';\n const loader = loaders[currentIndex];\n const before = loader.input || '';\n const leftSpan = 5;\n const hasError = loader.errors && loader.errors.length;\n const [activeKey, setActiveKey] = useState('loaderDetails');\n const onChange = useCallback((key: string) => {\n setActiveKey(key);\n }, []);\n\n return (\n <Row className={styles.executions} style={{ height: '100%' }}>\n <Col\n span={leftSpan}\n style={{\n borderRight: isLight ? `1px solid #f0f0f0` : undefined,\n padding: Size.BasePadding,\n }}\n >\n <Space direction=\"vertical\" style={{ width: '100%' }}>\n <Title text=\"Executions\" />\n <Timeline mode=\"left\" style={{ marginTop: Size.BasePadding }}>\n {loaders.map((e, i, arr) => {\n const { loader, isPitch } = e;\n const costs = formatCosts(e.costs);\n return (\n <Timeline.Item\n dot={\n isPitch ? (\n <Tag style={{ marginLeft: 1, fontWeight: 500 }}>\n pitch\n </Tag>\n ) : (\n <ClockCircleTwoTone />\n )\n }\n style={{ paddingBottom: 10, textAlign: 'center' }}\n key={i}\n >\n <Row align=\"middle\" justify=\"space-between\" gutter={[0, 10]}>\n <Col span={24} className={styles.timeline}>\n <Tooltip title={loader} trigger=\"hover\">\n <div\n className={`${styles.box} ${currentIndex === i ? styles.selected : ''}`}\n onClick={() => {\n setCurrentIndex(i);\n }}\n style={{ textAlign: 'left' }}\n >\n <div>\n <Typography.Text style={{ color: '#000' }}>\n {costs.match(/[0-9]*\\.?[0-9]+/g)?.[0]}\n </Typography.Text>\n {` `}\n <Typography.Text\n style={{ color: 'rgba(0,0,0,0.45)' }}\n >\n {costs.match(/[a-zA-Z]+/g)}\n </Typography.Text>\n </div>\n <Typography.Text\n style={{ color: 'rgba(0,0,0,0.65)' }}\n className={styles.loader}\n >\n {loader}\n </Typography.Text>\n </div>\n </Tooltip>\n </Col>\n </Row>\n {i === arr.length - 1 ? null : (\n <div style={{ paddingTop: 10 }}>\n <StepIcon />\n </div>\n )}\n </Timeline.Item>\n );\n })}\n </Timeline>\n </Space>\n </Col>\n <Col span={24 - leftSpan} style={{ height: '100%' }}>\n <Tabs\n type=\"card\"\n defaultActiveKey=\"loaderDetails\"\n activeKey={activeKey}\n items={[\n {\n label: 'Loader Props',\n key: 'loaderProps',\n children: (\n <LoaderPropsItem\n loader={loader}\n resource={resource}\n cwd={cwd}\n />\n ),\n },\n {\n label: 'Loader Details',\n key: 'loaderDetails',\n children: (\n <div style={{ height: '100%' }}>\n {hasError ? (\n <Col span={24} style={{ height: '53%', minHeight: 400 }}>\n <div\n style={{\n padding: Size.BasePadding,\n borderTop: `1px solid ${isLight ? '#f0f0f0' : 'rgba(253, 253, 253, 0.12)'}`,\n borderBottom: `1px solid ${isLight ? '#f0f0f0' : 'rgba(253, 253, 253, 0.12)'}`,\n }}\n >\n <Title\n text={`the error stack of [${loader.loader}] ${loader.isPitch ? 'pitch' : ''}`}\n />\n </div>\n <div style={{ height: '90%' }}>\n <CodeViewer\n code={loader.errors[0].message}\n lang=\"javascript\"\n />\n </div>\n </Col>\n ) : (\n <Col span={24} style={{ height: '53%', minHeight: 400 }}>\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n padding: Size.BasePadding,\n borderBottom: `1px solid ${isLight ? '#f0f0f0' : 'rgba(253, 253, 253, 0.12)'}`,\n }}\n >\n <Title\n text={\n <>\n {`the result of [${loader.loader}] ${loader.isPitch ? 'pitch' : ''}`}\n {!loader.isPitch && (\n <span style={{ fontWeight: 400 }}>\n (\n <InputIcon\n style={{\n verticalAlign: 'middle',\n margin: '0 2px',\n }}\n />\n Input ⟷\n <OutputIcon\n style={{\n verticalAlign: 'middle',\n position: 'relative',\n top: -2,\n }}\n />\n Output)\n </span>\n )}\n </>\n }\n />\n <div style={{ flex: 1 }} />\n </div>\n {loader.isPitch ? (\n loader.result ? (\n <div style={{ height: '90%' }}>\n <CodeViewer\n isEmbed\n code={loader.result}\n filePath={resource.path}\n />\n </div>\n ) : (\n <Empty\n description={\n 'No loader result. If you use the Brief Mode, there will not have loader results.'\n }\n />\n )\n ) : (\n <div style={{ minHeight: '700px' }}>\n <div style={{ height: '40rem', overflow: 'hidden' }}>\n {!loader.result && !before ? (\n <Empty\n description={\n 'No loader result. If you use the Brief Mode, there will not have loader results.'\n }\n />\n ) : (\n <DiffViewer\n isEmbed\n original={before}\n modified={loader.result || ''}\n originalFilePath={resource.path}\n modifiedFilePath={resource.path}\n />\n )}\n </div>\n </div>\n )}\n </Col>\n )}\n </div>\n ),\n },\n ]}\n onChange={onChange}\n />\n </Col>\n </Row>\n );\n};\n"],"names":["LoaderPropsItem","loader","resource","cwd","Card","Tag","ClockCircleTwoTone","dayjs","Space","Typography","List","beautifyPath","CodeOpener","formatCosts","Divider","JSON","LoaderExecutions","data","index","loaders","currentIndex","setCurrentIndex","useState","theme","useTheme","isLight","before","leftSpan","hasError","activeKey","setActiveKey","onChange","useCallback","key","Row","styles","Col","undefined","Size","Title","Timeline","e","i","arr","isPitch","costs","Tooltip","StepIcon","Tabs","CodeViewer","InputIcon","OutputIcon","Empty","DiffViewer"],"mappings":";;;;;;;;;;;;;;;AAkCA,MAAMA,kBAAkB,CAAC,EACvBC,MAAM,EACNC,QAAQ,EACRC,GAAG,EAOJ,GACQ,WAAP,GACE,IAACC,MAAIA;QACH,OAAO;QACP,OAAO;YAAE,QAAQ;QAAO;QACxB,qBACE,IAACC,KAAGA;YAAC,oBAAM,IAACC,oBAAkBA,CAAAA;YAAK,OAAM;sBACtCC,MAAMN,OAAO,OAAO,EAAE,MAAM,CAAC;;kBAIlC,mBAACO,OAAKA;YAAC,WAAU;YAAW,OAAO;gBAAE,OAAO;YAAO;;gBAChDP,OAAO,OAAO,GAAG,WAAH,GAAG,IAACQ,WAAW,IAAI;oBAAC,MAAI;8BAAC;qBAA0B;8BAClE,KAACC,MAAIA;oBAAC,MAAK;oBAAQ,UAAQ;;sCACzB,KAACA,KAAK,IAAI;;8CACR,IAACD,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AO;wDAAE,MAAM;oDAAE;;;;wCAEvBlD,OAAO,OAAO,GACbA,OAAO,MAAM,GAAG,WAAH,GACX,IAAC;4CAAI,OAAO;gDAAE,QAAQ;4CAAM;sDAC1B,kBAACgD,YAAUA;gDACT,SAAO;gDACP,MAAMhD,OAAO,MAAM;gDACnB,UAAUC,SAAS,IAAI;;2DAI3B,IAACkD,OAAKA;4CACJ,aACE;2DAKN,IAAC;4CAAI,OAAO;gDAAE,WAAW;4CAAQ;sDAC/B,kBAAC;gDAAI,OAAO;oDAAE,QAAQ;oDAAS,UAAU;gDAAS;0DAC/C,AAACnD,OAAO,MAAM,IAAKyB,S,cAOlB,IAAC2B,YAAUA;oDACT,SAAO;oDACP,UAAU3B;oDACV,UAAUzB,OAAO,MAAM,IAAI;oDAC3B,kBAAkBC,SAAS,IAAI;oDAC/B,kBAAkBA,SAAS,IAAI;qDAZN,WAATwB,GAClB,IAAC0B,OAAKA;oDACJ,aACE;;;;;;;wBAmBtB;qBACD;oBACD,UAAUrB;;;;;AAKpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://./src/components/Overall/bundle.module.scss"],"names":[],"mappings":"AADA;EAEE,gBAAgB;EAChB,8BAA8B;EAC9B,mBAAmB;EACnB,YAAY;EACZ,eAAe;EACf,gBAAgB;EAChB,iBAAiB;EACjB,aAAa;EACb,kBAAkB;EAClB,UAAU;AACZ;;AAEA;EACE,mBAAmB;AACrB;;AAEA;EACE,WAAW;EACX,iBAAiB;EACjB,eAAe;EACf,gBAAgB;EAChB,iBAAiB;AACnB;;AAEA;EACE;IACE,eAAe;EACjB;AACF;;AAEA;EACE,WAAW;EACX,eAAe;EACf,gBAAgB;EAChB,iBAAiB;AACnB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,iCAAiC;EACjC,OAAO;EACP,qBAAqB;EACrB,2BAA2B;AAC7B;;AAEA;EACE,qBAAqB;EACrB,qBAAqB;EACrB,eAAe;AACjB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,gBAAgB;EAChB,kCAAkC;EAClC,8BAA8B;EAC9B,gBAAgB;EAChB,eAAe;EACf,gBAAgB;EAChB,iBAAiB;AACnB","sourcesContent":[".title{height:40px;display:flex;justify-content:space-between;align-items:center;font-size:16px;font-weight:500;line-height:20px;text-align:left;position:relative;top:-10px}.column{margin-bottom:14px}.description{font-size:20px;font-weight:500;line-height:32px;margin-right:5px;color:#000}@media(max-width: 1500px){.description{font-size:16px}}.unit{font-size:12px;font-weight:400;line-height:32px;color:#000}.treeContainer{display:flex}.treeContainer .line{border-bottom:1px dashed #e5e6eb;flex:1;transform:translateY(-45%);margin:0 15px 0 10px}.treeContainer .treeTitle{word-wrap:break-word;word-break:break-all;flex-wrap:wrap}.treeContainer .icon{font-size:16px}.treeContainer .tag{height:23px}.label{font-size:12px;font-weight:400;line-height:20px;text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none;color:rgba(0,0,0,.6509803922)}"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack://./src/components/Overall/bundle.module.scss"],"names":[],"mappings":"AADA;EAEE,gBAAgB;EAChB,8BAA8B;EAC9B,mBAAmB;EACnB,YAAY;EACZ,eAAe;EACf,gBAAgB;EAChB,iBAAiB;EACjB,aAAa;EACb,kBAAkB;EAClB,UAAU;AACZ;;AAEA;EACE,mBAAmB;AACrB;;AAEA;EACE,WAAW;EACX,iBAAiB;EACjB,eAAe;EACf,gBAAgB;EAChB,iBAAiB;AACnB;;AAEA;EACE;IACE,eAAe;EACjB;AACF;;AAEA;EACE,WAAW;EACX,eAAe;EACf,gBAAgB;EAChB,iBAAiB;AACnB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,iCAAiC;EACjC,OAAO;EACP,qBAAqB;EACrB,2BAA2B;AAC7B;;AAEA;EACE,qBAAqB;EACrB,qBAAqB;EACrB,eAAe;AACjB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,gBAAgB;EAChB,kCAAkC;EAClC,sCAAsC;EACtC,8BAA8B;EAC9B,gBAAgB;EAChB,eAAe;EACf,gBAAgB;EAChB,iBAAiB;AACnB","sourcesContent":[".title{height:40px;display:flex;justify-content:space-between;align-items:center;font-size:16px;font-weight:500;line-height:20px;text-align:left;position:relative;top:-10px}.column{margin-bottom:14px}.description{font-size:20px;font-weight:500;line-height:32px;margin-right:5px;color:#000}@media(max-width: 1500px){.description{font-size:16px}}.unit{font-size:12px;font-weight:400;line-height:32px;color:#000}.treeContainer{display:flex}.treeContainer .line{border-bottom:1px dashed #e5e6eb;flex:1;transform:translateY(-45%);margin:0 15px 0 10px}.treeContainer .treeTitle{word-wrap:break-word;word-break:break-all;flex-wrap:wrap}.treeContainer .icon{font-size:16px}.treeContainer .tag{height:23px}.label{font-size:12px;font-weight:400;line-height:20px;text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none;color:rgba(0,0,0,.6509803922)}"],"sourceRoot":""}
|
|
@@ -27,9 +27,8 @@ const Stage = ({ children, name, showDivider = true })=>/*#__PURE__*/ jsxs(Typog
|
|
|
27
27
|
]
|
|
28
28
|
});
|
|
29
29
|
const CompileOverall = ({ summary })=>{
|
|
30
|
-
var _summary_costs;
|
|
31
30
|
const { t } = useI18n();
|
|
32
|
-
if (!
|
|
31
|
+
if (!summary?.costs?.length) return null;
|
|
33
32
|
const maxCosts = Math.max(...summary.costs.map((item)=>item.costs));
|
|
34
33
|
return /*#__PURE__*/ jsx(Card, {
|
|
35
34
|
className: card_module.card,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/Overall/compile.mjs","sources":["webpack://@rsdoctor/components/./src/components/Overall/compile.tsx"],"sourcesContent":["import { SDK } from '@rsdoctor/types';\nimport { Summary } from '@rsdoctor/utils/common';\nimport { Divider, Progress, Space, Typography } from 'antd';\nimport React from 'react';\nimport { formatCosts, useI18n } from '../../utils';\nimport { Card } from '../Card';\nimport { BootstrapChartContainer } from '../Charts/bootstrap';\nimport { DoneChartContainer } from '../Charts/done';\nimport { MinifyChartContainer } from '../Charts/minify';\n\nimport cardStyles from './card.module.scss';\nimport styles from './compile.module.scss';\n\nconst Stage: React.FC<\n React.PropsWithChildren<{\n name: string;\n showDivider?: boolean;\n }>\n> = ({ children, name, showDivider = true }) => {\n return (\n <Typography.Text style={{ color: 'inherit' }}>\n <Typography.Text style={{ color: 'inherit' }}>{name}</Typography.Text>\n {showDivider ? <Divider type=\"vertical\" /> : null}\n {children}\n </Typography.Text>\n );\n};\n\nexport const CompileOverall: React.FC<{ summary: SDK.SummaryData }> = ({\n summary,\n}) => {\n const { t } = useI18n();\n\n if (!summary?.costs?.length) return null;\n\n const maxCosts = Math.max(...summary.costs.map((item) => item.costs));\n\n return (\n <Card className={cardStyles.card}>\n <div>\n <Space\n style={{ wordBreak: 'break-all', width: '100%', marginTop: '0' }}\n size={20}\n direction=\"vertical\"\n >\n <div className={styles.title}>{t('Compile Overall')}</div>\n {summary.costs.map((e) => {\n const { name, costs } = e;\n const percent = (costs * 100) / maxCosts;\n\n const ProgressBar = (\n <Progress\n className={styles.progress}\n percent={percent}\n status=\"normal\"\n format={() => formatCosts(costs)}\n />\n );\n\n switch (name) {\n case Summary.SummaryCostsDataName.Bootstrap:\n return (\n <Stage name=\"Bootstrap ~ BeforeCompile\" key={name}>\n <BootstrapChartContainer summary={summary} />\n {ProgressBar}\n </Stage>\n );\n case Summary.SummaryCostsDataName.Compile:\n return (\n <Stage name=\"Compile\" key={name} showDivider={false}>\n {ProgressBar}\n </Stage>\n );\n case Summary.SummaryCostsDataName.Done:\n return (\n <Stage name=\"AfterCompile ~ Done\" key={name}>\n <DoneChartContainer summary={summary} />\n {ProgressBar}\n </Stage>\n );\n case Summary.SummaryCostsDataName.Minify:\n return (\n <Stage name=\"Minify\" key={name}>\n <MinifyChartContainer summary={summary} />\n {ProgressBar}\n </Stage>\n );\n\n default:\n return null;\n }\n })}\n </Space>\n </div>\n </Card>\n );\n};\n"],"names":["Stage","children","name","showDivider","Typography","Divider","CompileOverall","summary","
|
|
1
|
+
{"version":3,"file":"components/Overall/compile.mjs","sources":["webpack://@rsdoctor/components/./src/components/Overall/compile.tsx"],"sourcesContent":["import { SDK } from '@rsdoctor/types';\nimport { Summary } from '@rsdoctor/utils/common';\nimport { Divider, Progress, Space, Typography } from 'antd';\nimport React from 'react';\nimport { formatCosts, useI18n } from '../../utils';\nimport { Card } from '../Card';\nimport { BootstrapChartContainer } from '../Charts/bootstrap';\nimport { DoneChartContainer } from '../Charts/done';\nimport { MinifyChartContainer } from '../Charts/minify';\n\nimport cardStyles from './card.module.scss';\nimport styles from './compile.module.scss';\n\nconst Stage: React.FC<\n React.PropsWithChildren<{\n name: string;\n showDivider?: boolean;\n }>\n> = ({ children, name, showDivider = true }) => {\n return (\n <Typography.Text style={{ color: 'inherit' }}>\n <Typography.Text style={{ color: 'inherit' }}>{name}</Typography.Text>\n {showDivider ? <Divider type=\"vertical\" /> : null}\n {children}\n </Typography.Text>\n );\n};\n\nexport const CompileOverall: React.FC<{ summary: SDK.SummaryData }> = ({\n summary,\n}) => {\n const { t } = useI18n();\n\n if (!summary?.costs?.length) return null;\n\n const maxCosts = Math.max(...summary.costs.map((item) => item.costs));\n\n return (\n <Card className={cardStyles.card}>\n <div>\n <Space\n style={{ wordBreak: 'break-all', width: '100%', marginTop: '0' }}\n size={20}\n direction=\"vertical\"\n >\n <div className={styles.title}>{t('Compile Overall')}</div>\n {summary.costs.map((e) => {\n const { name, costs } = e;\n const percent = (costs * 100) / maxCosts;\n\n const ProgressBar = (\n <Progress\n className={styles.progress}\n percent={percent}\n status=\"normal\"\n format={() => formatCosts(costs)}\n />\n );\n\n switch (name) {\n case Summary.SummaryCostsDataName.Bootstrap:\n return (\n <Stage name=\"Bootstrap ~ BeforeCompile\" key={name}>\n <BootstrapChartContainer summary={summary} />\n {ProgressBar}\n </Stage>\n );\n case Summary.SummaryCostsDataName.Compile:\n return (\n <Stage name=\"Compile\" key={name} showDivider={false}>\n {ProgressBar}\n </Stage>\n );\n case Summary.SummaryCostsDataName.Done:\n return (\n <Stage name=\"AfterCompile ~ Done\" key={name}>\n <DoneChartContainer summary={summary} />\n {ProgressBar}\n </Stage>\n );\n case Summary.SummaryCostsDataName.Minify:\n return (\n <Stage name=\"Minify\" key={name}>\n <MinifyChartContainer summary={summary} />\n {ProgressBar}\n </Stage>\n );\n\n default:\n return null;\n }\n })}\n </Space>\n </div>\n </Card>\n );\n};\n"],"names":["Stage","children","name","showDivider","Typography","Divider","CompileOverall","summary","t","useI18n","maxCosts","Math","item","Card","cardStyles","Space","styles","e","costs","percent","ProgressBar","Progress","formatCosts","Summary","BootstrapChartContainer","DoneChartContainer","MinifyChartContainer"],"mappings":";;;;;;;;;;;AAaA,MAAMA,QAKF,CAAC,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,cAAc,IAAI,EAAE,GAClC,WAAP,GACE,KAACC,WAAW,IAAI;QAAC,OAAO;YAAE,OAAO;QAAU;;0BACzC,IAACA,WAAW,IAAI;gBAAC,OAAO;oBAAE,OAAO;gBAAU;0BAAIF;;YAC9CC,cAAc,WAAdA,GAAc,IAACE,SAAOA;gBAAC,MAAK;iBAAgB;YAC5CJ;;;AAKA,MAAMK,iBAAyD,CAAC,EACrEC,OAAO,EACR;IACC,MAAM,EAAEC,CAAC,EAAE,GAAGC;IAEd,IAAI,CAACF,SAAS,OAAO,QAAQ,OAAO;IAEpC,MAAMG,WAAWC,KAAK,GAAG,IAAIJ,QAAQ,KAAK,CAAC,GAAG,CAAC,CAACK,OAASA,KAAK,KAAK;IAEnE,OAAO,WAAP,GACE,IAACC,MAAIA;QAAC,WAAWC,YAAAA,IAAe;kBAC9B,kBAAC;sBACC,mBAACC,OAAKA;gBACJ,OAAO;oBAAE,WAAW;oBAAa,OAAO;oBAAQ,WAAW;gBAAI;gBAC/D,MAAM;gBACN,WAAU;;kCAEV,IAAC;wBAAI,WAAWC,eAAAA,KAAY;kCAAGR,EAAE;;oBAChCD,QAAQ,KAAK,CAAC,GAAG,CAAC,CAACU;wBAClB,MAAM,EAAEf,IAAI,EAAEgB,KAAK,EAAE,GAAGD;wBACxB,MAAME,UAAWD,AAAQ,MAARA,QAAeR;wBAEhC,MAAMU,cAAc,WAAdA,GACJ,IAACC,UAAQA;4BACP,WAAWL,eAAAA,QAAe;4BAC1B,SAASG;4BACT,QAAO;4BACP,QAAQ,IAAMG,YAAYJ;;wBAI9B,OAAQhB;4BACN,KAAKqB,QAAQ,oBAAoB,CAAC,SAAS;gCACzC,OAAO,WAAP,GACE,KAACvB,OAAAA;oCAAM,MAAK;;sDACV,IAACwB,yBAAuBA;4CAAC,SAASjB;;wCACjCa;;mCAF0ClB;4BAKjD,KAAKqB,QAAQ,oBAAoB,CAAC,OAAO;gCACvC,OAAO,WAAP,GACE,IAACvB,OAAAA;oCAAM,MAAK;oCAAqB,aAAa;8CAC3CoB;mCADwBlB;4BAI/B,KAAKqB,QAAQ,oBAAoB,CAAC,IAAI;gCACpC,OAAO,WAAP,GACE,KAACvB,OAAAA;oCAAM,MAAK;;sDACV,IAACyB,oBAAkBA;4CAAC,SAASlB;;wCAC5Ba;;mCAFoClB;4BAK3C,KAAKqB,QAAQ,oBAAoB,CAAC,MAAM;gCACtC,OAAO,WAAP,GACE,KAACvB,OAAAA;oCAAM,MAAK;;sDACV,IAAC0B,sBAAoBA;4CAAC,SAASnB;;wCAC9Ba;;mCAFuBlB;4BAM9B;gCACE,OAAO;wBACX;oBACF;;;;;AAKV"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
.title-dP_KVY {
|
|
2
2
|
text-align: left;
|
|
3
3
|
text-underline-position: from-font;
|
|
4
|
+
-webkit-text-decoration-skip-ink: none;
|
|
4
5
|
text-decoration-skip-ink: none;
|
|
5
6
|
justify-content: space-between;
|
|
6
7
|
align-items: center;
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
cursor: pointer;
|
|
24
25
|
text-align: left;
|
|
25
26
|
text-underline-position: from-font;
|
|
27
|
+
-webkit-text-decoration-skip-ink: none;
|
|
26
28
|
text-decoration-skip-ink: none;
|
|
27
29
|
width: 48%;
|
|
28
30
|
font-size: 14px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://./src/components/Overall/help-center.module.scss"],"names":[],"mappings":"AADA;EAEE,gBAAgB;EAChB,kCAAkC;EAClC,8BAA8B;EAC9B,8BAA8B;EAC9B,mBAAmB;EACnB,YAAY;EACZ,eAAe;EACf,gBAAgB;EAChB,iBAAiB;EACjB,aAAa;EACb,kBAAkB;EAClB,UAAU;AACZ;;AAEA;EACE,eAAe;EACf,8BAA8B;EAC9B,aAAa;AACf;;AAEA;EACE,eAAe;EACf,gBAAgB;EAChB,kCAAkC;EAClC,8BAA8B;EAC9B,UAAU;EACV,eAAe;EACf,gBAAgB;EAChB,iBAAiB;EACjB,qBAAqB;AACvB;;AAEA;EACE,cAAc;AAChB","sourcesContent":[".title{display:flex;align-items:center;justify-content:space-between;position:relative;height:36px;position:relative;top:-12px;font-size:16px;font-weight:500;line-height:20px;text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}.container{display:flex;justify-content:space-between;flex-wrap:wrap}.container .content{cursor:pointer;width:48%;transition:color .5s ease;font-size:14px;font-weight:400;line-height:16px;text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}.container .content:hover{color:#1677ff}"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack://./src/components/Overall/help-center.module.scss"],"names":[],"mappings":"AADA;EAEE,gBAAgB;EAChB,kCAAkC;EAClC,sCAAsC;EACtC,8BAA8B;EAC9B,8BAA8B;EAC9B,mBAAmB;EACnB,YAAY;EACZ,eAAe;EACf,gBAAgB;EAChB,iBAAiB;EACjB,aAAa;EACb,kBAAkB;EAClB,UAAU;AACZ;;AAEA;EACE,eAAe;EACf,8BAA8B;EAC9B,aAAa;AACf;;AAEA;EACE,eAAe;EACf,gBAAgB;EAChB,kCAAkC;EAClC,sCAAsC;EACtC,8BAA8B;EAC9B,UAAU;EACV,eAAe;EACf,gBAAgB;EAChB,iBAAiB;EACjB,qBAAqB;AACvB;;AAEA;EACE,cAAc;AAChB","sourcesContent":[".title{display:flex;align-items:center;justify-content:space-between;position:relative;height:36px;position:relative;top:-12px;font-size:16px;font-weight:500;line-height:20px;text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}.container{display:flex;justify-content:space-between;flex-wrap:wrap}.container .content{cursor:pointer;width:48%;transition:color .5s ease;font-size:14px;font-weight:400;line-height:16px;text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}.container .content:hover{color:#1677ff}"],"sourceRoot":""}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
.projectOverall-T7onhG .ant-descriptions-item-label {
|
|
2
|
-
color: #000000a6;
|
|
3
|
-
font-size: 13px;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.projectOverall-T7onhG .ant-descriptions-item-content {
|
|
1
|
+
:is(.projectOverall-T7onhG .ant-descriptions-item-label, .projectOverall-T7onhG .ant-descriptions-item-content) {
|
|
7
2
|
color: #000000a6;
|
|
8
3
|
font-size: 13px;
|
|
9
4
|
}
|
|
@@ -12,12 +7,7 @@
|
|
|
12
7
|
padding-bottom: 10px !important;
|
|
13
8
|
}
|
|
14
9
|
|
|
15
|
-
.bundleOverall-Ay7WmZ .ant-descriptions-item-label {
|
|
16
|
-
color: #000000a6;
|
|
17
|
-
font-size: 13px;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.bundleOverall-Ay7WmZ .ant-descriptions-item-content {
|
|
10
|
+
:is(.bundleOverall-Ay7WmZ .ant-descriptions-item-label, .bundleOverall-Ay7WmZ .ant-descriptions-item-content) {
|
|
21
11
|
color: #000000a6;
|
|
22
12
|
font-size: 13px;
|
|
23
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://./src/components/Overall/list.module.scss"],"names":[],"mappings":"AADA;EAEE,gBAAgB;EAChB,eAAe;AACjB;;AAEA;EACE
|
|
1
|
+
{"version":3,"sources":["webpack://./src/components/Overall/list.module.scss"],"names":[],"mappings":"AADA;EAEE,gBAAgB;EAChB,eAAe;AACjB;;AAEA;EACE,+BAA+B;AACjC;;AAEA;EACE,gBAAgB;EAChB,eAAe;AACjB;;AAEA;EACE,4BAA4B;AAC9B","sourcesContent":[".projectOverall :global(.ant-descriptions-item-label),.projectOverall :global(.ant-descriptions-item-content){font-size:13px;color:rgba(0,0,0,.6509803922)}.projectOverall :global(.ant-descriptions-item){padding-bottom:10px !important}.bundleOverall :global(.ant-descriptions-item-label),.bundleOverall :global(.ant-descriptions-item-content){font-size:13px;color:rgba(0,0,0,.6509803922)}.bundleOverall :global(.ant-descriptions-item){padding-bottom:0px !important}"],"sourceRoot":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://./src/components/Overall/project.module.scss"],"names":[],"mappings":"AADA;EAEE,mBAAmB;EACnB,aAAa;AACf;;AAEA;EACE,8BAA8B;EAC9B,mBAAmB;EACnB,oBAAoB;EACpB,aAAa;AACf;;AAEA;EACE,gBAAgB;EAChB,kCAAkC;EAClC,8BAA8B;EAC9B,eAAe;EACf,gBAAgB;EAChB,iBAAiB;AACnB","sourcesContent":[".overview{display:flex;margin-bottom:19px}.title{display:flex;justify-content:space-between;align-items:center;padding-bottom:20px}.title .left{font-size:16px;font-weight:500;line-height:24px;text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack://./src/components/Overall/project.module.scss"],"names":[],"mappings":"AADA;EAEE,mBAAmB;EACnB,aAAa;AACf;;AAEA;EACE,8BAA8B;EAC9B,mBAAmB;EACnB,oBAAoB;EACpB,aAAa;AACf;;AAEA;EACE,gBAAgB;EAChB,kCAAkC;EAClC,sCAAsC;EACtC,8BAA8B;EAC9B,eAAe;EACf,gBAAgB;EAChB,iBAAiB;AACnB","sourcesContent":[".overview{display:flex;margin-bottom:19px}.title{display:flex;justify-content:space-between;align-items:center;padding-bottom:20px}.title .left{font-size:16px;font-weight:500;line-height:24px;text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}"],"sourceRoot":""}
|
|
@@ -77,7 +77,7 @@ const LoaderLayerSelect = ({ onChange, layers })=>{
|
|
|
77
77
|
setLayer(e);
|
|
78
78
|
onChange(e);
|
|
79
79
|
},
|
|
80
|
-
children:
|
|
80
|
+
children: layers?.length ? layers?.map((e)=>/*#__PURE__*/ jsx(Select.Option, {
|
|
81
81
|
label: e,
|
|
82
82
|
value: e,
|
|
83
83
|
children: e
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/Select/index.mjs","sources":["webpack://@rsdoctor/components/./src/components/Select/index.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { Button, Col, Input, Row, Select, Typography } from 'antd';\nimport { FileSearchOutlined, SelectOutlined } from '@ant-design/icons';\nimport { KeywordInput } from '../Form/keyword';\nimport { Size } from 'src/constants';\nimport { ServerAPIProvider } from '../Manifest';\nimport { SDK } from '@rsdoctor/types';\nimport './index.scss';\n\ninterface LoaderNamesSelectProps {\n style?: React.CSSProperties;\n onChange: (loaders: string[]) => void;\n loaderNames: string[];\n}\n\nexport type ISelectLoaderProps = {\n loaders: string[];\n filename: string;\n layer?: string;\n};\n\nexport const LoaderNamesSelect: React.FC<LoaderNamesSelectProps> = ({\n style,\n onChange,\n loaderNames,\n}) => {\n const [selectLoaders, setSelectLoaders] = useState([]);\n\n const labelStyle: React.CSSProperties = { width: 120 };\n\n return (\n <Input.Group compact style={style}>\n <Button style={labelStyle}>\n <SelectOutlined />\n <Typography.Text>Loaders</Typography.Text>\n </Button>\n <Select\n mode=\"multiple\"\n allowClear\n defaultValue={selectLoaders}\n className=\"loader-select\"\n style={{ width: 300 }}\n popupMatchSelectWidth={300}\n placeholder={'select loaders'}\n onChange={(e) => {\n setSelectLoaders(e);\n onChange(e);\n }}\n >\n {loaderNames.map((e) => {\n return (\n <Select.Option key={e} label={e} value={e}>\n {e}\n </Select.Option>\n );\n })}\n </Select>\n </Input.Group>\n );\n};\n\nconst LoaderLayerSelect: React.FC<{\n onChange(value: string): void;\n layers: string[];\n}> = ({ onChange, layers }) => {\n const [layer, setLayer] = useState('');\n const labelStyle: React.CSSProperties = { width: 120 };\n\n return (\n <Input.Group compact>\n <Button style={labelStyle}>\n <SelectOutlined />\n <Typography.Text>Layers</Typography.Text>\n </Button>\n <Select\n allowClear\n className=\"layer-select\"\n style={{ width: 150 }}\n defaultValue={layer}\n placeholder={'select layer'}\n onChange={(e) => {\n setLayer(e);\n onChange(e);\n }}\n >\n {layers?.length ? (\n layers?.map((e) => {\n return (\n <Select.Option key={e} label={e} value={e}>\n {e}\n </Select.Option>\n );\n })\n ) : (\n <></>\n )}\n </Select>\n </Input.Group>\n );\n};\n\nexport const LoaderCommonSelect: React.FC<{\n onChange(value: ISelectLoaderProps): void;\n loaderNames: string[];\n}> = ({ onChange, loaderNames }) => {\n const [selectLoaders, setSelectLoaders] = useState<string[]>([]);\n const [filename, setFilename] = useState('');\n const [layer, setLayer] = useState('');\n\n useEffect(() => {\n onChange({ loaders: selectLoaders, filename, layer });\n }, [selectLoaders, filename, layer]);\n\n return (\n <Row style={{ marginBottom: Size.BasePadding, marginLeft: 10 }}>\n <Col>\n <LoaderNamesSelect\n loaderNames={loaderNames}\n style={{ marginRight: Size.BasePadding }}\n onChange={(e) => {\n setSelectLoaders(e);\n }}\n />\n </Col>\n <Col>\n <KeywordInput\n icon={<FileSearchOutlined />}\n style={{ marginRight: Size.BasePadding }}\n label=\"Filename\"\n placeholder=\"search filename by keyword\"\n onChange={(e) => {\n setFilename(e);\n }}\n />\n </Col>\n <Col>\n <ServerAPIProvider api={SDK.ServerAPI.API.GetLayers}>\n {(layers) =>\n layers.length ? (\n <LoaderLayerSelect\n layers={layers}\n onChange={(e) => {\n setLayer(e);\n }}\n />\n ) : (\n <></>\n )\n }\n </ServerAPIProvider>\n </Col>\n </Row>\n );\n};\n"],"names":["LoaderNamesSelect","style","onChange","loaderNames","selectLoaders","setSelectLoaders","useState","labelStyle","Input","Button","SelectOutlined","Typography","Select","e","LoaderLayerSelect","layers","layer","setLayer","LoaderCommonSelect","filename","setFilename","useEffect","Row","Size","Col","KeywordInput","FileSearchOutlined","ServerAPIProvider","SDK"],"mappings":";;;;;;;;;AAqBO,MAAMA,oBAAsD,CAAC,EAClEC,KAAK,EACLC,QAAQ,EACRC,WAAW,EACZ;IACC,MAAM,CAACC,eAAeC,iBAAiB,GAAGC,SAAS,EAAE;IAErD,MAAMC,aAAkC;QAAE,OAAO;IAAI;IAErD,OAAO,WAAP,GACE,KAACC,MAAM,KAAK;QAAC,SAAO;QAAC,OAAOP;;0BAC1B,KAACQ,QAAMA;gBAAC,OAAOF;;kCACb,IAACG,gBAAcA,CAAAA;kCACf,IAACC,WAAW,IAAI;kCAAC;;;;0BAEnB,IAACC,QAAMA;gBACL,MAAK;gBACL,YAAU;gBACV,cAAcR;gBACd,WAAU;gBACV,OAAO;oBAAE,OAAO;gBAAI;gBACpB,uBAAuB;gBACvB,aAAa;gBACb,UAAU,CAACS;oBACTR,iBAAiBQ;oBACjBX,SAASW;gBACX;0BAECV,YAAY,GAAG,CAAC,CAACU,IACT,WAAP,GACE,IAACD,OAAO,MAAM;wBAAS,OAAOC;wBAAG,OAAOA;kCACrCA;uBADiBA;;;;AAQhC;AAEA,MAAMC,oBAGD,CAAC,EAAEZ,QAAQ,EAAEa,MAAM,EAAE;IACxB,MAAM,CAACC,OAAOC,SAAS,GAAGX,SAAS;IACnC,MAAMC,aAAkC;QAAE,OAAO;IAAI;IAErD,OAAO,WAAP,GACE,KAACC,MAAM,KAAK;QAAC,SAAO;;0BAClB,KAACC,QAAMA;gBAAC,OAAOF;;kCACb,IAACG,gBAAcA,CAAAA;kCACf,IAACC,WAAW,IAAI;kCAAC;;;;0BAEnB,IAACC,QAAMA;gBACL,YAAU;gBACV,WAAU;gBACV,OAAO;oBAAE,OAAO;gBAAI;gBACpB,cAAcI;gBACd,aAAa;gBACb,UAAU,CAACH;oBACTI,SAASJ;oBACTX,SAASW;gBACX;0BAECE,
|
|
1
|
+
{"version":3,"file":"components/Select/index.mjs","sources":["webpack://@rsdoctor/components/./src/components/Select/index.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { Button, Col, Input, Row, Select, Typography } from 'antd';\nimport { FileSearchOutlined, SelectOutlined } from '@ant-design/icons';\nimport { KeywordInput } from '../Form/keyword';\nimport { Size } from 'src/constants';\nimport { ServerAPIProvider } from '../Manifest';\nimport { SDK } from '@rsdoctor/types';\nimport './index.scss';\n\ninterface LoaderNamesSelectProps {\n style?: React.CSSProperties;\n onChange: (loaders: string[]) => void;\n loaderNames: string[];\n}\n\nexport type ISelectLoaderProps = {\n loaders: string[];\n filename: string;\n layer?: string;\n};\n\nexport const LoaderNamesSelect: React.FC<LoaderNamesSelectProps> = ({\n style,\n onChange,\n loaderNames,\n}) => {\n const [selectLoaders, setSelectLoaders] = useState([]);\n\n const labelStyle: React.CSSProperties = { width: 120 };\n\n return (\n <Input.Group compact style={style}>\n <Button style={labelStyle}>\n <SelectOutlined />\n <Typography.Text>Loaders</Typography.Text>\n </Button>\n <Select\n mode=\"multiple\"\n allowClear\n defaultValue={selectLoaders}\n className=\"loader-select\"\n style={{ width: 300 }}\n popupMatchSelectWidth={300}\n placeholder={'select loaders'}\n onChange={(e) => {\n setSelectLoaders(e);\n onChange(e);\n }}\n >\n {loaderNames.map((e) => {\n return (\n <Select.Option key={e} label={e} value={e}>\n {e}\n </Select.Option>\n );\n })}\n </Select>\n </Input.Group>\n );\n};\n\nconst LoaderLayerSelect: React.FC<{\n onChange(value: string): void;\n layers: string[];\n}> = ({ onChange, layers }) => {\n const [layer, setLayer] = useState('');\n const labelStyle: React.CSSProperties = { width: 120 };\n\n return (\n <Input.Group compact>\n <Button style={labelStyle}>\n <SelectOutlined />\n <Typography.Text>Layers</Typography.Text>\n </Button>\n <Select\n allowClear\n className=\"layer-select\"\n style={{ width: 150 }}\n defaultValue={layer}\n placeholder={'select layer'}\n onChange={(e) => {\n setLayer(e);\n onChange(e);\n }}\n >\n {layers?.length ? (\n layers?.map((e) => {\n return (\n <Select.Option key={e} label={e} value={e}>\n {e}\n </Select.Option>\n );\n })\n ) : (\n <></>\n )}\n </Select>\n </Input.Group>\n );\n};\n\nexport const LoaderCommonSelect: React.FC<{\n onChange(value: ISelectLoaderProps): void;\n loaderNames: string[];\n}> = ({ onChange, loaderNames }) => {\n const [selectLoaders, setSelectLoaders] = useState<string[]>([]);\n const [filename, setFilename] = useState('');\n const [layer, setLayer] = useState('');\n\n useEffect(() => {\n onChange({ loaders: selectLoaders, filename, layer });\n }, [selectLoaders, filename, layer]);\n\n return (\n <Row style={{ marginBottom: Size.BasePadding, marginLeft: 10 }}>\n <Col>\n <LoaderNamesSelect\n loaderNames={loaderNames}\n style={{ marginRight: Size.BasePadding }}\n onChange={(e) => {\n setSelectLoaders(e);\n }}\n />\n </Col>\n <Col>\n <KeywordInput\n icon={<FileSearchOutlined />}\n style={{ marginRight: Size.BasePadding }}\n label=\"Filename\"\n placeholder=\"search filename by keyword\"\n onChange={(e) => {\n setFilename(e);\n }}\n />\n </Col>\n <Col>\n <ServerAPIProvider api={SDK.ServerAPI.API.GetLayers}>\n {(layers) =>\n layers.length ? (\n <LoaderLayerSelect\n layers={layers}\n onChange={(e) => {\n setLayer(e);\n }}\n />\n ) : (\n <></>\n )\n }\n </ServerAPIProvider>\n </Col>\n </Row>\n );\n};\n"],"names":["LoaderNamesSelect","style","onChange","loaderNames","selectLoaders","setSelectLoaders","useState","labelStyle","Input","Button","SelectOutlined","Typography","Select","e","LoaderLayerSelect","layers","layer","setLayer","LoaderCommonSelect","filename","setFilename","useEffect","Row","Size","Col","KeywordInput","FileSearchOutlined","ServerAPIProvider","SDK"],"mappings":";;;;;;;;;AAqBO,MAAMA,oBAAsD,CAAC,EAClE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EAAEhB,QAAQ,EAAEC,WAAW,EAAE;IAC7B,MAAM,CAACC,eAAeC,iBAAiB,GAAGC,SAAmB,EAAE;IAC/D,MAAM,CAACa,UAAUC,YAAY,GAAGd,SAAS;IACzC,MAAM,CAACU,OAAOC,SAAS,GAAGX,SAAS;IAEnCe,UAAU;QACRnB,SAAS;YAAE,SAASE;YAAee;YAAUH;QAAM;IACrD,GAAG;QAACZ;QAAee;QAAUH;KAAM;IAEnC,OAAO,WAAP,GACE,KAACM,KAAGA;QAAC,OAAO;YAAE,cAAcC,KAAK,WAAW;YAAE,YAAY;QAAG;;0BAC3D,IAACC,KAAGA;0BACF,kBAACxB,mBAAAA;oBACC,aAAaG;oBACb,OAAO;wBAAE,aAAaoB,KAAK,WAAW;oBAAC;oBACvC,UAAU,CAACV;wBACTR,iBAAiBQ;oBACnB;;;0BAGJ,IAACW,KAAGA;0BACF,kBAACC,cAAYA;oBACX,oBAAM,IAACC,oBAAkBA,CAAAA;oBACzB,OAAO;wBAAE,aAAaH,KAAK,WAAW;oBAAC;oBACvC,OAAM;oBACN,aAAY;oBACZ,UAAU,CAACV;wBACTO,YAAYP;oBACd;;;0BAGJ,IAACW,KAAGA;0BACF,kBAACG,mBAAiBA;oBAAC,KAAKC,IAAI,SAAS,CAAC,GAAG,CAAC,SAAS;8BAChD,CAACb,SACAA,OAAO,MAAM,GAAG,WAAH,GACX,IAACD,mBAAAA;4BACC,QAAQC;4BACR,UAAU,CAACF;gCACTI,SAASJ;4BACX;2CAGF;;;;;AAOd"}
|
|
@@ -30,8 +30,7 @@ function CodeViewer({ className, style, code = '', lang, filePath = '', defaultL
|
|
|
30
30
|
}, []);
|
|
31
31
|
const theme = isLightTheme ? 'vs-light' : 'vs-dark';
|
|
32
32
|
useEffect(()=>()=>{
|
|
33
|
-
|
|
34
|
-
null == (_editor_current = editor.current) || _editor_current.setModel(null);
|
|
33
|
+
editor.current?.setModel(null);
|
|
35
34
|
}, []);
|
|
36
35
|
return /*#__PURE__*/ jsxs("div", {
|
|
37
36
|
className: clsx('monaco-component', 'code-viewer', index_module["code-viewer"], isEmbed && index_module.embed, className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/base/CodeViewer/index.mjs","sources":["webpack://@rsdoctor/components/./src/components/base/CodeViewer/index.tsx"],"sourcesContent":["import { Editor, Monaco, OnMount } from '@monaco-editor/react';\nimport clsx from 'clsx';\nimport { editor } from 'monaco-editor';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { CodeViewerProps } from './interface';\nimport {\n defineMonacoOptions,\n editorShowRange,\n getFileName,\n getFilePathFormat,\n} from './utils';\n\nimport { Checkbox } from 'antd';\nimport styles from './index.module.scss';\nimport { Lodash } from '@rsdoctor/utils/common';\n\nexport function CodeViewer({\n className,\n style,\n code = '',\n lang,\n filePath = '',\n defaultLine,\n ranges,\n isEmbed = false,\n headerVisible = true,\n isLightTheme = true,\n}: CodeViewerProps) {\n const editor = useRef<editor.IStandaloneCodeEditor>();\n const monaco = useRef<Monaco>();\n const language = useMemo(\n () => lang || getFilePathFormat(filePath) || 'plaintext',\n [lang, filePath],\n );\n const [isWordWrap, setIsWordWrap] = useState(true);\n const options = useMemo(\n () => defineMonacoOptions({ wordWrap: isWordWrap ? 'on' : 'off' }),\n [isWordWrap],\n );\n const onEditorMount = useCallback<OnMount>((editorInstance, monacoVal) => {\n editor.current = editorInstance;\n monaco.current = monacoVal;\n\n editorShowRange(editorInstance, monacoVal, ranges);\n if (Lodash.isNumber(defaultLine)) {\n setTimeout(() => {\n editorInstance.revealLine(defaultLine);\n });\n }\n }, []);\n\n const theme = isLightTheme ? 'vs-light' : 'vs-dark';\n\n useEffect(\n () => () => {\n editor.current?.setModel(null);\n },\n [],\n );\n\n return (\n <div\n className={clsx(\n 'monaco-component',\n 'code-viewer',\n styles['code-viewer'],\n isEmbed && styles['embed'],\n className,\n )}\n style={style}\n >\n {headerVisible && Boolean(filePath) && (\n <div className={styles['header']}>\n <div>{getFileName(filePath)}</div>\n <div style={{ flex: 1 }} />\n <div>\n <Checkbox\n className={styles['text']}\n title=\"side-by-side\"\n checked={isWordWrap}\n onChange={(evt) => {\n setIsWordWrap(evt.target.checked);\n }}\n >\n word-wrap\n </Checkbox>\n </div>\n </div>\n )}\n <div className={clsx(styles['content'], 'editor-wrap')}>\n <Editor\n theme={theme}\n language={language}\n value={code}\n options={options}\n onMount={onEditorMount}\n />\n </div>\n </div>\n );\n}\n\nexport type { CodeViewerProps } from './interface';\nexport { useCodeDrawer } from './useCodeDrawer';\nexport { defineMonacoOptions } from './utils';\n"],"names":["CodeViewer","className","style","code","lang","filePath","defaultLine","ranges","isEmbed","headerVisible","isLightTheme","editor","useRef","monaco","language","useMemo","getFilePathFormat","isWordWrap","setIsWordWrap","useState","options","defineMonacoOptions","onEditorMount","useCallback","editorInstance","monacoVal","editorShowRange","Lodash","setTimeout","theme","useEffect","
|
|
1
|
+
{"version":3,"file":"components/base/CodeViewer/index.mjs","sources":["webpack://@rsdoctor/components/./src/components/base/CodeViewer/index.tsx"],"sourcesContent":["import { Editor, Monaco, OnMount } from '@monaco-editor/react';\nimport clsx from 'clsx';\nimport { editor } from 'monaco-editor';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { CodeViewerProps } from './interface';\nimport {\n defineMonacoOptions,\n editorShowRange,\n getFileName,\n getFilePathFormat,\n} from './utils';\n\nimport { Checkbox } from 'antd';\nimport styles from './index.module.scss';\nimport { Lodash } from '@rsdoctor/utils/common';\n\nexport function CodeViewer({\n className,\n style,\n code = '',\n lang,\n filePath = '',\n defaultLine,\n ranges,\n isEmbed = false,\n headerVisible = true,\n isLightTheme = true,\n}: CodeViewerProps) {\n const editor = useRef<editor.IStandaloneCodeEditor>();\n const monaco = useRef<Monaco>();\n const language = useMemo(\n () => lang || getFilePathFormat(filePath) || 'plaintext',\n [lang, filePath],\n );\n const [isWordWrap, setIsWordWrap] = useState(true);\n const options = useMemo(\n () => defineMonacoOptions({ wordWrap: isWordWrap ? 'on' : 'off' }),\n [isWordWrap],\n );\n const onEditorMount = useCallback<OnMount>((editorInstance, monacoVal) => {\n editor.current = editorInstance;\n monaco.current = monacoVal;\n\n editorShowRange(editorInstance, monacoVal, ranges);\n if (Lodash.isNumber(defaultLine)) {\n setTimeout(() => {\n editorInstance.revealLine(defaultLine);\n });\n }\n }, []);\n\n const theme = isLightTheme ? 'vs-light' : 'vs-dark';\n\n useEffect(\n () => () => {\n editor.current?.setModel(null);\n },\n [],\n );\n\n return (\n <div\n className={clsx(\n 'monaco-component',\n 'code-viewer',\n styles['code-viewer'],\n isEmbed && styles['embed'],\n className,\n )}\n style={style}\n >\n {headerVisible && Boolean(filePath) && (\n <div className={styles['header']}>\n <div>{getFileName(filePath)}</div>\n <div style={{ flex: 1 }} />\n <div>\n <Checkbox\n className={styles['text']}\n title=\"side-by-side\"\n checked={isWordWrap}\n onChange={(evt) => {\n setIsWordWrap(evt.target.checked);\n }}\n >\n word-wrap\n </Checkbox>\n </div>\n </div>\n )}\n <div className={clsx(styles['content'], 'editor-wrap')}>\n <Editor\n theme={theme}\n language={language}\n value={code}\n options={options}\n onMount={onEditorMount}\n />\n </div>\n </div>\n );\n}\n\nexport type { CodeViewerProps } from './interface';\nexport { useCodeDrawer } from './useCodeDrawer';\nexport { defineMonacoOptions } from './utils';\n"],"names":["CodeViewer","className","style","code","lang","filePath","defaultLine","ranges","isEmbed","headerVisible","isLightTheme","editor","useRef","monaco","language","useMemo","getFilePathFormat","isWordWrap","setIsWordWrap","useState","options","defineMonacoOptions","onEditorMount","useCallback","editorInstance","monacoVal","editorShowRange","Lodash","setTimeout","theme","useEffect","clsx","styles","Boolean","getFileName","Checkbox","evt","Editor"],"mappings":";;;;;;;;;AAgBO,SAASA,WAAW,EACzBC,SAAS,EACTC,KAAK,EACLC,OAAO,EAAE,EACTC,IAAI,EACJC,WAAW,EAAE,EACbC,WAAW,EACXC,MAAM,EACNC,UAAU,KAAK,EACfC,gBAAgB,IAAI,E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;AAKnB"}
|
|
@@ -117,7 +117,7 @@ function getFileName(filePath) {
|
|
|
117
117
|
function getSelectionRange(source, Range) {
|
|
118
118
|
const { start, end } = source;
|
|
119
119
|
const { line = 1, column = 0 } = start;
|
|
120
|
-
return new Range(line, column + 1,
|
|
120
|
+
return new Range(line, column + 1, end?.line ?? line, (end?.column ?? 9999) + 1);
|
|
121
121
|
}
|
|
122
122
|
function editorShowRange(editor, monaco, ranges) {
|
|
123
123
|
if (!ranges || 0 === ranges.length) return;
|