@rsdoctor/components 0.0.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/dist/assets/connection-point.3b3c78ca.svg +1 -0
  4. package/dist/assets/icon.7509d763.svg +21 -0
  5. package/dist/assets/webpack.98604d64.svg +1 -0
  6. package/dist/components/Alert/change.d.ts +8 -0
  7. package/dist/components/Alert/change.js +94 -0
  8. package/dist/components/Alert/file-relation.d.ts +3 -0
  9. package/dist/components/Alert/file-relation.js +9 -0
  10. package/dist/components/Alert/index.css +29 -0
  11. package/dist/components/Alert/index.d.ts +4 -0
  12. package/dist/components/Alert/index.js +37 -0
  13. package/dist/components/Alert/link.d.ts +3 -0
  14. package/dist/components/Alert/link.js +27 -0
  15. package/dist/components/Alert/package-relation.d.ts +17 -0
  16. package/dist/components/Alert/package-relation.js +206 -0
  17. package/dist/components/Alert/types.d.ts +31 -0
  18. package/dist/components/Alert/types.js +0 -0
  19. package/dist/components/Alert/view.d.ts +4 -0
  20. package/dist/components/Alert/view.js +59 -0
  21. package/dist/components/Alerts/bundle.d.ts +11 -0
  22. package/dist/components/Alerts/bundle.js +47 -0
  23. package/dist/components/Alerts/common.d.ts +15 -0
  24. package/dist/components/Alerts/common.js +106 -0
  25. package/dist/components/Alerts/compile.d.ts +10 -0
  26. package/dist/components/Alerts/compile.js +46 -0
  27. package/dist/components/Alerts/index.d.ts +3 -0
  28. package/dist/components/Alerts/index.js +3 -0
  29. package/dist/components/Alerts/overlay.d.ts +26 -0
  30. package/dist/components/Alerts/overlay.js +154 -0
  31. package/dist/components/Badge/index.d.ts +21 -0
  32. package/dist/components/Badge/index.js +105 -0
  33. package/dist/components/Card/diff.d.ts +23 -0
  34. package/dist/components/Card/diff.js +131 -0
  35. package/dist/components/Card/index.d.ts +7 -0
  36. package/dist/components/Card/index.js +62 -0
  37. package/dist/components/Card/size.d.ts +16 -0
  38. package/dist/components/Card/size.js +71 -0
  39. package/dist/components/Card/statistic.css +16 -0
  40. package/dist/components/Card/statistic.d.ts +9 -0
  41. package/dist/components/Card/statistic.js +34 -0
  42. package/dist/components/Charts/TimelineCharts/index.d.ts +8 -0
  43. package/dist/components/Charts/TimelineCharts/index.js +197 -0
  44. package/dist/components/Charts/bootstrap.d.ts +5 -0
  45. package/dist/components/Charts/bootstrap.js +44 -0
  46. package/dist/components/Charts/common.d.ts +13 -0
  47. package/dist/components/Charts/common.js +56 -0
  48. package/dist/components/Charts/done.d.ts +5 -0
  49. package/dist/components/Charts/done.js +45 -0
  50. package/dist/components/Charts/index.d.ts +10 -0
  51. package/dist/components/Charts/index.js +37 -0
  52. package/dist/components/Charts/loader.css +31 -0
  53. package/dist/components/Charts/loader.d.ts +4 -0
  54. package/dist/components/Charts/loader.js +68 -0
  55. package/dist/components/Charts/minify.d.ts +5 -0
  56. package/dist/components/Charts/minify.js +37 -0
  57. package/dist/components/Charts/tooltips.css +62 -0
  58. package/dist/components/Charts/types.d.ts +61 -0
  59. package/dist/components/Charts/types.js +11 -0
  60. package/dist/components/Charts/utils.d.ts +13 -0
  61. package/dist/components/Charts/utils.js +203 -0
  62. package/dist/components/CodeViewer/config.d.ts +2 -0
  63. package/dist/components/CodeViewer/config.js +18 -0
  64. package/dist/components/CodeViewer/diff.d.ts +11 -0
  65. package/dist/components/CodeViewer/diff.js +53 -0
  66. package/dist/components/CodeViewer/hightlight.d.ts +10 -0
  67. package/dist/components/CodeViewer/hightlight.js +76 -0
  68. package/dist/components/CodeViewer/index.d.ts +4 -0
  69. package/dist/components/CodeViewer/index.js +4 -0
  70. package/dist/components/CodeViewer/viewer.d.ts +13 -0
  71. package/dist/components/CodeViewer/viewer.js +76 -0
  72. package/dist/components/Configuration/index.d.ts +1 -0
  73. package/dist/components/Configuration/index.js +1 -0
  74. package/dist/components/Configuration/webpack.d.ts +13 -0
  75. package/dist/components/Configuration/webpack.js +70 -0
  76. package/dist/components/FileTree/index.css +58 -0
  77. package/dist/components/FileTree/index.d.ts +4 -0
  78. package/dist/components/FileTree/index.js +53 -0
  79. package/dist/components/Form/keyword.d.ts +14 -0
  80. package/dist/components/Form/keyword.js +76 -0
  81. package/dist/components/Keyword/index.d.ts +6 -0
  82. package/dist/components/Keyword/index.js +68 -0
  83. package/dist/components/Layout/builder-select.d.ts +2 -0
  84. package/dist/components/Layout/builder-select.js +50 -0
  85. package/dist/components/Layout/constants.d.ts +1 -0
  86. package/dist/components/Layout/constants.js +4 -0
  87. package/dist/components/Layout/header.css +12 -0
  88. package/dist/components/Layout/header.d.ts +3 -0
  89. package/dist/components/Layout/header.js +87 -0
  90. package/dist/components/Layout/index.d.ts +5 -0
  91. package/dist/components/Layout/index.js +34 -0
  92. package/dist/components/Layout/menus.d.ts +8 -0
  93. package/dist/components/Layout/menus.js +155 -0
  94. package/dist/components/Layout/progress.d.ts +8 -0
  95. package/dist/components/Layout/progress.js +44 -0
  96. package/dist/components/Loader/Analysis/files.d.ts +8 -0
  97. package/dist/components/Loader/Analysis/files.js +187 -0
  98. package/dist/components/Loader/Analysis/index.d.ts +11 -0
  99. package/dist/components/Loader/Analysis/index.js +23 -0
  100. package/dist/components/Loader/executions.d.ts +13 -0
  101. package/dist/components/Loader/executions.js +221 -0
  102. package/dist/components/Manifest/api.d.ts +41 -0
  103. package/dist/components/Manifest/api.js +157 -0
  104. package/dist/components/Manifest/data.d.ts +8 -0
  105. package/dist/components/Manifest/data.js +81 -0
  106. package/dist/components/Manifest/index.d.ts +2 -0
  107. package/dist/components/Manifest/index.js +2 -0
  108. package/dist/components/Opener/code.d.ts +28 -0
  109. package/dist/components/Opener/code.js +69 -0
  110. package/dist/components/Opener/index.d.ts +2 -0
  111. package/dist/components/Opener/index.js +2 -0
  112. package/dist/components/Opener/vscode.d.ts +16 -0
  113. package/dist/components/Opener/vscode.js +57 -0
  114. package/dist/components/Overall/NumberButton.d.ts +14 -0
  115. package/dist/components/Overall/NumberButton.js +29 -0
  116. package/dist/components/Overall/NumberButton.module.js +5 -0
  117. package/dist/components/Overall/NumberButton_module.css +70 -0
  118. package/dist/components/Overall/bundle.d.ts +6 -0
  119. package/dist/components/Overall/bundle.js +167 -0
  120. package/dist/components/Overall/bundle.module.css +0 -0
  121. package/dist/components/Overall/card.module.js +5 -0
  122. package/dist/components/Overall/card_module.css +6 -0
  123. package/dist/components/Overall/compile.d.ts +5 -0
  124. package/dist/components/Overall/compile.js +68 -0
  125. package/dist/components/Overall/compile.module.js +5 -0
  126. package/dist/components/Overall/compile_module.css +4 -0
  127. package/dist/components/Overall/index.d.ts +3 -0
  128. package/dist/components/Overall/index.js +3 -0
  129. package/dist/components/Overall/list.module.js +5 -0
  130. package/dist/components/Overall/list_module.css +7 -0
  131. package/dist/components/Overall/project.d.ts +8 -0
  132. package/dist/components/Overall/project.js +73 -0
  133. package/dist/components/Plugins/webpack.d.ts +18 -0
  134. package/dist/components/Plugins/webpack.js +76 -0
  135. package/dist/components/Resolver/analysis.d.ts +15 -0
  136. package/dist/components/Resolver/analysis.js +160 -0
  137. package/dist/components/Select/index.d.ts +15 -0
  138. package/dist/components/Select/index.js +68 -0
  139. package/dist/components/Status/failed.d.ts +9 -0
  140. package/dist/components/Status/failed.js +33 -0
  141. package/dist/components/Status/index.d.ts +1 -0
  142. package/dist/components/Status/index.js +1 -0
  143. package/dist/components/TextDrawer/duplicate.d.ts +17 -0
  144. package/dist/components/TextDrawer/duplicate.js +107 -0
  145. package/dist/components/TextDrawer/index.d.ts +11 -0
  146. package/dist/components/TextDrawer/index.js +55 -0
  147. package/dist/components/Title/index.d.ts +15 -0
  148. package/dist/components/Title/index.js +10 -0
  149. package/dist/components/index.d.ts +8 -0
  150. package/dist/components/index.js +11 -0
  151. package/dist/components/worker/ecmaversion/client.d.ts +10 -0
  152. package/dist/components/worker/ecmaversion/client.js +61 -0
  153. package/dist/components/worker/ecmaversion/worker.d.ts +1 -0
  154. package/dist/components/worker/ecmaversion/worker.js +13 -0
  155. package/dist/components/worker/jsequal/client.d.ts +11 -0
  156. package/dist/components/worker/jsequal/client.js +39 -0
  157. package/dist/components/worker/jsequal/worker.d.ts +1 -0
  158. package/dist/components/worker/jsequal/worker.js +52 -0
  159. package/dist/config.d.ts +19 -0
  160. package/dist/config.js +39 -0
  161. package/dist/constants.d.ts +48 -0
  162. package/dist/constants.js +71 -0
  163. package/dist/index.d.ts +3 -0
  164. package/dist/index.js +6 -0
  165. package/dist/pages/BundleSize/components/asset.d.ts +26 -0
  166. package/dist/pages/BundleSize/components/asset.js +405 -0
  167. package/dist/pages/BundleSize/components/cards.d.ts +7 -0
  168. package/dist/pages/BundleSize/components/cards.js +154 -0
  169. package/dist/pages/BundleSize/components/editor.d.ts +5 -0
  170. package/dist/pages/BundleSize/components/editor.js +38 -0
  171. package/dist/pages/BundleSize/components/index.css +20 -0
  172. package/dist/pages/BundleSize/components/index.d.ts +16 -0
  173. package/dist/pages/BundleSize/components/index.js +314 -0
  174. package/dist/pages/BundleSize/config.d.ts +7 -0
  175. package/dist/pages/BundleSize/config.js +9 -0
  176. package/dist/pages/BundleSize/constants.d.ts +5 -0
  177. package/dist/pages/BundleSize/constants.js +9 -0
  178. package/dist/pages/BundleSize/index.d.ts +3 -0
  179. package/dist/pages/BundleSize/index.js +11 -0
  180. package/dist/pages/ModuleAnalyze/chunks.d.ts +6 -0
  181. package/dist/pages/ModuleAnalyze/chunks.js +48 -0
  182. package/dist/pages/ModuleAnalyze/components/fileTreeCom.css +88 -0
  183. package/dist/pages/ModuleAnalyze/components/fileTreeCom.d.ts +15 -0
  184. package/dist/pages/ModuleAnalyze/components/fileTreeCom.js +138 -0
  185. package/dist/pages/ModuleAnalyze/constants.d.ts +7 -0
  186. package/dist/pages/ModuleAnalyze/constants.js +14 -0
  187. package/dist/pages/ModuleAnalyze/dependncy.d.ts +9 -0
  188. package/dist/pages/ModuleAnalyze/dependncy.js +31 -0
  189. package/dist/pages/ModuleAnalyze/fileTree.d.ts +9 -0
  190. package/dist/pages/ModuleAnalyze/fileTree.js +125 -0
  191. package/dist/pages/ModuleAnalyze/index.css +10 -0
  192. package/dist/pages/ModuleAnalyze/index.d.ts +8 -0
  193. package/dist/pages/ModuleAnalyze/index.js +64 -0
  194. package/dist/pages/ModuleAnalyze/utils/hooks.d.ts +21 -0
  195. package/dist/pages/ModuleAnalyze/utils/hooks.js +65 -0
  196. package/dist/pages/ModuleAnalyze/utils/index.d.ts +3 -0
  197. package/dist/pages/ModuleAnalyze/utils/index.js +36 -0
  198. package/dist/pages/ModuleResolve/constants.d.ts +3 -0
  199. package/dist/pages/ModuleResolve/constants.js +7 -0
  200. package/dist/pages/ModuleResolve/index.d.ts +3 -0
  201. package/dist/pages/ModuleResolve/index.js +19 -0
  202. package/dist/pages/Overall/constants.d.ts +3 -0
  203. package/dist/pages/Overall/constants.js +7 -0
  204. package/dist/pages/Overall/index.d.ts +9 -0
  205. package/dist/pages/Overall/index.js +28 -0
  206. package/dist/pages/WebpackLoaders/Analysis/constants.d.ts +3 -0
  207. package/dist/pages/WebpackLoaders/Analysis/constants.js +7 -0
  208. package/dist/pages/WebpackLoaders/Analysis/index.d.ts +3 -0
  209. package/dist/pages/WebpackLoaders/Analysis/index.js +19 -0
  210. package/dist/pages/WebpackLoaders/Overall/constants.d.ts +3 -0
  211. package/dist/pages/WebpackLoaders/Overall/constants.js +7 -0
  212. package/dist/pages/WebpackLoaders/Overall/index.d.ts +3 -0
  213. package/dist/pages/WebpackLoaders/Overall/index.js +11 -0
  214. package/dist/pages/WebpackLoaders/constants.d.ts +2 -0
  215. package/dist/pages/WebpackLoaders/constants.js +6 -0
  216. package/dist/pages/WebpackPlugins/constants.d.ts +3 -0
  217. package/dist/pages/WebpackPlugins/constants.js +7 -0
  218. package/dist/pages/WebpackPlugins/index.d.ts +3 -0
  219. package/dist/pages/WebpackPlugins/index.js +79 -0
  220. package/dist/pages/index.d.ts +7 -0
  221. package/dist/pages/index.js +16 -0
  222. package/dist/utils/data/base.d.ts +24 -0
  223. package/dist/utils/data/base.js +70 -0
  224. package/dist/utils/data/index.d.ts +5 -0
  225. package/dist/utils/data/index.js +66 -0
  226. package/dist/utils/data/local.d.ts +14 -0
  227. package/dist/utils/data/local.js +106 -0
  228. package/dist/utils/data/remote.d.ts +10 -0
  229. package/dist/utils/data/remote.js +70 -0
  230. package/dist/utils/file.d.ts +39 -0
  231. package/dist/utils/file.js +154 -0
  232. package/dist/utils/hooks.d.ts +30 -0
  233. package/dist/utils/hooks.js +256 -0
  234. package/dist/utils/i18n/cn.d.ts +3 -0
  235. package/dist/utils/i18n/cn.js +33 -0
  236. package/dist/utils/i18n/en.d.ts +30 -0
  237. package/dist/utils/i18n/en.js +33 -0
  238. package/dist/utils/i18n/index.d.ts +2 -0
  239. package/dist/utils/i18n/index.js +34 -0
  240. package/dist/utils/index.d.ts +16 -0
  241. package/dist/utils/index.js +16 -0
  242. package/dist/utils/loader.d.ts +7 -0
  243. package/dist/utils/loader.js +29 -0
  244. package/dist/utils/locale.d.ts +2 -0
  245. package/dist/utils/locale.js +9 -0
  246. package/dist/utils/manifest.d.ts +27 -0
  247. package/dist/utils/manifest.js +54 -0
  248. package/dist/utils/monaco.d.ts +9 -0
  249. package/dist/utils/monaco.js +48 -0
  250. package/dist/utils/request.d.ts +23 -0
  251. package/dist/utils/request.js +162 -0
  252. package/dist/utils/routes.d.ts +3 -0
  253. package/dist/utils/routes.js +14 -0
  254. package/dist/utils/size.d.ts +2 -0
  255. package/dist/utils/size.js +24 -0
  256. package/dist/utils/socket.d.ts +2 -0
  257. package/dist/utils/socket.js +20 -0
  258. package/dist/utils/storage.d.ts +13 -0
  259. package/dist/utils/storage.js +70 -0
  260. package/dist/utils/string.d.ts +2 -0
  261. package/dist/utils/string.js +14 -0
  262. package/dist/utils/time.d.ts +3 -0
  263. package/dist/utils/time.js +7 -0
  264. package/dist/utils/url.d.ts +6 -0
  265. package/dist/utils/url.js +89 -0
  266. package/dist/utils/worker/index.d.ts +4 -0
  267. package/dist/utils/worker/index.js +4 -0
  268. package/dist/utils/worker/master.d.ts +8 -0
  269. package/dist/utils/worker/master.js +18 -0
  270. package/dist/utils/worker/types.d.ts +9 -0
  271. package/dist/utils/worker/types.js +0 -0
  272. package/dist/utils/worker/utils.d.ts +9 -0
  273. package/dist/utils/worker/utils.js +29 -0
  274. package/dist/utils/worker/worker.d.ts +13 -0
  275. package/dist/utils/worker/worker.js +38 -0
  276. package/package.json +87 -0
@@ -0,0 +1,167 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { Space, Typography, Tag, Row, Col, Descriptions } from "antd";
3
+ import { useMemo } from "react";
4
+ import { Client, SDK } from "@rsdoctor/types";
5
+ import { ExceptionOutlined } from "@ant-design/icons";
6
+ import { useNavigate } from "react-router-dom";
7
+ import { createFileStructures, formatSize, useDuplicatePackagesByErrors, useI18n } from "../../utils";
8
+ import { DuplicatePackageDrawerWithServer, TextDrawer } from "../TextDrawer";
9
+ import { Card } from "../Card";
10
+ import { ServerAPIProvider } from "../Manifest";
11
+ import { FileTree } from "../FileTree";
12
+ import listStyles from "./list.module";
13
+ import cardStyles from "./card.module";
14
+ import numberButtonStyles from "./NumberButton.module";
15
+ import { NumberButton } from "./NumberButton";
16
+ const getFilesWithDrawer = (data) => {
17
+ const fileStructures = useMemo(() => {
18
+ if (!data.files.length)
19
+ return [];
20
+ return createFileStructures({
21
+ files: data.files.map((e) => e.path),
22
+ fileTitle(file, basename) {
23
+ const { size, initial } = data.files.find((e) => e.path === file);
24
+ return /* @__PURE__ */ jsxs(Space, { children: [
25
+ /* @__PURE__ */ jsx(Typography.Text, { children: basename }),
26
+ /* @__PURE__ */ jsx(Tag, { color: "success", style: { marginRight: 0 }, children: formatSize(size) }),
27
+ initial ? /* @__PURE__ */ jsx(Tag, { color: "cyan", children: "initial" }) : null
28
+ ] });
29
+ }
30
+ });
31
+ }, [data.files]);
32
+ return /* @__PURE__ */ jsx(Fragment, { children: data.files.length ? /* @__PURE__ */ jsx(
33
+ TextDrawer,
34
+ {
35
+ buttonProps: {
36
+ size: "small"
37
+ },
38
+ buttonStyle: {
39
+ fontSize: "inherit"
40
+ },
41
+ text: /* @__PURE__ */ jsxs(Fragment, { children: [
42
+ data.count,
43
+ " ",
44
+ /* @__PURE__ */ jsx(ExceptionOutlined, {})
45
+ ] }),
46
+ children: /* @__PURE__ */ jsx(FileTree, { treeData: fileStructures, defaultExpandAll: true })
47
+ }
48
+ ) : data.count });
49
+ };
50
+ const BundleDescriptions = ({ res }) => {
51
+ const items = [
52
+ {
53
+ key: "total-files-count",
54
+ label: "Total files",
55
+ children: res.all.total.count
56
+ },
57
+ {
58
+ key: "total-files-size",
59
+ label: "",
60
+ children: ""
61
+ },
62
+ {
63
+ key: "js-files-count",
64
+ label: "JS files",
65
+ children: getFilesWithDrawer(res.js.total)
66
+ },
67
+ {
68
+ key: "js-files-size",
69
+ label: "JS size",
70
+ children: formatSize(res.js.total.size)
71
+ },
72
+ {
73
+ key: "css-files-count",
74
+ label: "CSS files",
75
+ children: getFilesWithDrawer(res.css.total)
76
+ },
77
+ {
78
+ key: "css-files-size",
79
+ label: "CSS size",
80
+ children: formatSize(res.css.total.size)
81
+ },
82
+ {
83
+ key: "font-files-count",
84
+ label: "Font files",
85
+ children: getFilesWithDrawer(res.fonts.total)
86
+ },
87
+ {
88
+ key: "font-files-size",
89
+ label: "Font size",
90
+ children: formatSize(res.fonts.total.size)
91
+ },
92
+ {
93
+ key: "html-files-count",
94
+ label: "HTML files",
95
+ children: getFilesWithDrawer(res.html.total)
96
+ },
97
+ {
98
+ key: "html-files-size",
99
+ label: "HTML size",
100
+ children: formatSize(res.html.total.size)
101
+ },
102
+ {
103
+ key: "image-files-count",
104
+ label: "Image files",
105
+ children: getFilesWithDrawer(res.imgs.total)
106
+ },
107
+ {
108
+ key: "image-files-size",
109
+ label: "Image size",
110
+ children: formatSize(res.imgs.total.size)
111
+ },
112
+ {
113
+ key: "media-files-count",
114
+ label: "Media files",
115
+ children: getFilesWithDrawer(res.media.total)
116
+ },
117
+ {
118
+ key: "media-files-size",
119
+ label: "Media size",
120
+ children: formatSize(res.media.total.size)
121
+ }
122
+ ];
123
+ return /* @__PURE__ */ jsx(Descriptions, { className: listStyles.root, size: "small", column: 2, items });
124
+ };
125
+ const BundleOverall = ({ errors, cwd }) => {
126
+ const { t } = useI18n();
127
+ const navigate = useNavigate();
128
+ const duplicatePackages = useDuplicatePackagesByErrors(errors);
129
+ return /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetAssetsSummary, body: { withFileContent: false }, children: (res) => {
130
+ const totalSizeStr = formatSize(res.all.total.size);
131
+ return /* @__PURE__ */ jsxs(Card, { title: t("Bundle Overall"), className: cardStyles.card, children: [
132
+ /* @__PURE__ */ jsxs(Row, { gutter: 16, children: [
133
+ /* @__PURE__ */ jsx(Col, { span: 12, className: numberButtonStyles.container, children: /* @__PURE__ */ jsx(
134
+ NumberButton,
135
+ {
136
+ theme: "success",
137
+ number: totalSizeStr,
138
+ description: "Total Size",
139
+ numberFontSize: "30px",
140
+ onClick: () => {
141
+ navigate(Client.DoctorClientRoutes.BundleSize);
142
+ }
143
+ }
144
+ ) }),
145
+ /* @__PURE__ */ jsx(Col, { span: 12, className: numberButtonStyles.container, children: /* @__PURE__ */ jsx(
146
+ DuplicatePackageDrawerWithServer,
147
+ {
148
+ cwd,
149
+ duplicatePackages,
150
+ button: /* @__PURE__ */ jsx(
151
+ NumberButton,
152
+ {
153
+ theme: duplicatePackages.length === 0 ? "success" : "warning",
154
+ number: duplicatePackages.length,
155
+ description: "Duplicate Packages"
156
+ }
157
+ )
158
+ }
159
+ ) })
160
+ ] }),
161
+ /* @__PURE__ */ jsx(BundleDescriptions, { res })
162
+ ] });
163
+ } });
164
+ };
165
+ export {
166
+ BundleOverall
167
+ };
File without changes
@@ -0,0 +1,5 @@
1
+ import "./card_module.css";
2
+ var card_module_default = { "card": "card_3bba1" };
3
+ export {
4
+ card_module_default as default
5
+ };
@@ -0,0 +1,6 @@
1
+ .card_3bba1 {
2
+ min-height: 440px;
3
+ }
4
+ .card_3bba1 .ant-card-body {
5
+ padding-bottom: 16px;
6
+ }
@@ -0,0 +1,5 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import React from 'react';
3
+ export declare const CompileOverall: React.FC<{
4
+ summary: SDK.SummaryData;
5
+ }>;
@@ -0,0 +1,68 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Summary } from "@rsdoctor/utils/common";
3
+ import { Divider, Progress, Space, Typography } from "antd";
4
+ import { formatCosts, useI18n } from "../../utils";
5
+ import { Card } from "../Card";
6
+ import { BootstrapChartContainer } from "../Charts/bootstrap";
7
+ import { DoneChartContainer } from "../Charts/done";
8
+ import { MinifyChartContainer } from "../Charts/minify";
9
+ import cardStyles from "./card.module";
10
+ import styles from "./compile.module";
11
+ const Stage = ({ children, name, showDivider = true }) => {
12
+ return /* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
13
+ /* @__PURE__ */ jsx(Typography.Text, { style: { color: "inherit" }, children: name }),
14
+ showDivider ? /* @__PURE__ */ jsx(Divider, { type: "vertical" }) : null,
15
+ children
16
+ ] });
17
+ };
18
+ const getProgressColor = (percent) => {
19
+ if (percent < 33.3) {
20
+ return { "0%": "#95de64", "100%": "#5cdbd3" };
21
+ }
22
+ return { "0%": "#ff9c6e", "100%": "#ff7875" };
23
+ };
24
+ const CompileOverall = ({ summary }) => {
25
+ var _a;
26
+ const { t } = useI18n();
27
+ if (!((_a = summary == null ? void 0 : summary.costs) == null ? void 0 : _a.length))
28
+ return null;
29
+ const maxCosts = Math.max(...summary.costs.map((item) => item.costs));
30
+ return /* @__PURE__ */ jsx(Card, { title: t("Compile Overall"), className: cardStyles.card, children: /* @__PURE__ */ jsx(Space, { style: { wordBreak: "break-all", width: "100%" }, size: 20, direction: "vertical", children: summary.costs.map((e) => {
31
+ const { name, costs } = e;
32
+ const percent = costs * 100 / maxCosts;
33
+ const ProgressBar = /* @__PURE__ */ jsx(
34
+ Progress,
35
+ {
36
+ className: styles.progress,
37
+ percent,
38
+ status: "normal",
39
+ strokeColor: getProgressColor(percent),
40
+ format: () => formatCosts(costs)
41
+ }
42
+ );
43
+ switch (name) {
44
+ case Summary.SummaryCostsDataName.Bootstrap:
45
+ return /* @__PURE__ */ jsxs(Stage, { name: "Bootstrap ~ BeforeCompile", children: [
46
+ /* @__PURE__ */ jsx(BootstrapChartContainer, { summary }),
47
+ ProgressBar
48
+ ] }, name);
49
+ case Summary.SummaryCostsDataName.Compile:
50
+ return /* @__PURE__ */ jsx(Stage, { name: "Compile", showDivider: false, children: ProgressBar }, name);
51
+ case Summary.SummaryCostsDataName.Done:
52
+ return /* @__PURE__ */ jsxs(Stage, { name: "AfterCompile ~ Done", children: [
53
+ /* @__PURE__ */ jsx(DoneChartContainer, { summary }),
54
+ ProgressBar
55
+ ] }, name);
56
+ case Summary.SummaryCostsDataName.Minify:
57
+ return /* @__PURE__ */ jsxs(Stage, { name: "Minify", children: [
58
+ /* @__PURE__ */ jsx(MinifyChartContainer, { summary }),
59
+ ProgressBar
60
+ ] }, name);
61
+ default:
62
+ return null;
63
+ }
64
+ }) }) });
65
+ };
66
+ export {
67
+ CompileOverall
68
+ };
@@ -0,0 +1,5 @@
1
+ import "./compile_module.css";
2
+ var compile_module_default = { "progress": "progress_61324" };
3
+ export {
4
+ compile_module_default as default
5
+ };
@@ -0,0 +1,4 @@
1
+ .progress_61324 .ant-progress-text {
2
+ opacity: 0.8;
3
+ font-size: 13px;
4
+ }
@@ -0,0 +1,3 @@
1
+ export * from './bundle';
2
+ export * from './compile';
3
+ export * from './project';
@@ -0,0 +1,3 @@
1
+ export * from "./bundle";
2
+ export * from "./compile";
3
+ export * from "./project";
@@ -0,0 +1,5 @@
1
+ import "./list_module.css";
2
+ var list_module_default = { "root": "root_17e15" };
3
+ export {
4
+ list_module_default as default
5
+ };
@@ -0,0 +1,7 @@
1
+ .root_17e15 .ant-descriptions-item-label,
2
+ .root_17e15 .ant-descriptions-item-content {
3
+ font-size: 13px;
4
+ }
5
+ .root_17e15 .ant-descriptions-item {
6
+ padding-bottom: 6px !important;
7
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { SDK } from '@rsdoctor/types';
3
+ export declare const ProjectOverall: React.FC<{
4
+ configs: SDK.ConfigData;
5
+ cwd: string;
6
+ envinfo: SDK.EnvInfo;
7
+ alerts: SDK.ErrorsData;
8
+ }>;
@@ -0,0 +1,73 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Space, Row, Col, Descriptions } from "antd";
3
+ import { filter } from "lodash-es";
4
+ import { useI18n } from "../../utils";
5
+ import { WebpackConfigurationViewer } from "../Configuration";
6
+ import { Card } from "../Card";
7
+ import listStyles from "./list.module";
8
+ import cardStyles from "./card.module";
9
+ import numberButtonStyles from "./NumberButton.module";
10
+ import { TextDrawer } from "../TextDrawer";
11
+ import { BundleAlerts, CompileAlerts, OverlayAlertsWithTips } from "../Alerts";
12
+ import { NumberButton } from "./NumberButton";
13
+ const ProjectOverall = ({ configs = [], cwd, envinfo, alerts = [] }) => {
14
+ const { t } = useI18n();
15
+ const warns = filter(alerts, (e) => e.level === "warn").length;
16
+ const errors = alerts.length - warns;
17
+ const items = [
18
+ ...Object.keys(envinfo).map((key) => {
19
+ const regexp = /Version$/;
20
+ const isVersion = regexp.test(key);
21
+ return {
22
+ key,
23
+ label: isVersion ? key.replace(regexp, "") : key,
24
+ children: envinfo ? envinfo[key] : void 0
25
+ };
26
+ }),
27
+ ...configs.filter((item) => !!item.version).map((config) => {
28
+ const { name, version } = config;
29
+ return {
30
+ key: name,
31
+ label: name,
32
+ children: version
33
+ };
34
+ }),
35
+ {
36
+ key: "cwd",
37
+ label: "cwd",
38
+ children: cwd
39
+ }
40
+ ];
41
+ return /* @__PURE__ */ jsxs(Card, { title: t("Project Overall"), extra: /* @__PURE__ */ jsx(WebpackConfigurationViewer, {}), className: cardStyles.card, children: [
42
+ /* @__PURE__ */ jsxs(Row, { gutter: 16, children: [
43
+ /* @__PURE__ */ jsx(Col, { span: 12, className: numberButtonStyles.container, children: /* @__PURE__ */ jsx(
44
+ TextDrawer,
45
+ {
46
+ button: /* @__PURE__ */ jsx(NumberButton, { theme: errors === 0 ? "success" : "error", number: errors, description: "Errors" }),
47
+ drawerProps: { title: "Errors List" },
48
+ children: /* @__PURE__ */ jsxs(Space, { direction: "vertical", style: { width: "100%" }, children: [
49
+ /* @__PURE__ */ jsx(OverlayAlertsWithTips, { defaultOpen: false }),
50
+ /* @__PURE__ */ jsx(BundleAlerts, { filter: (r) => r.level === "error" }),
51
+ /* @__PURE__ */ jsx(CompileAlerts, { filter: (r) => r.level === "error" })
52
+ ] })
53
+ }
54
+ ) }),
55
+ /* @__PURE__ */ jsx(Col, { span: 12, className: numberButtonStyles.container, children: /* @__PURE__ */ jsx(
56
+ TextDrawer,
57
+ {
58
+ button: /* @__PURE__ */ jsx(NumberButton, { theme: warns === 0 ? "success" : "warning", number: warns, description: "Warnings" }),
59
+ drawerProps: { title: "Warnings List" },
60
+ children: /* @__PURE__ */ jsxs(Space, { direction: "vertical", style: { width: "100%" }, children: [
61
+ /* @__PURE__ */ jsx(OverlayAlertsWithTips, { defaultOpen: false }),
62
+ /* @__PURE__ */ jsx(BundleAlerts, { filter: (r) => r.level === "warn" }),
63
+ /* @__PURE__ */ jsx(CompileAlerts, { filter: (r) => r.level === "warn" })
64
+ ] })
65
+ }
66
+ ) })
67
+ ] }),
68
+ /* @__PURE__ */ jsx(Descriptions, { className: listStyles.root, items, size: "small", column: 1 })
69
+ ] });
70
+ };
71
+ export {
72
+ ProjectOverall
73
+ };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { SDK } from '@rsdoctor/types';
3
+ interface WebpackPluginsTableDataItem {
4
+ tapName: string;
5
+ hook: string;
6
+ key: string;
7
+ hookData: SDK.PluginHookData[];
8
+ }
9
+ export interface WebpackPluginsDataTableProps {
10
+ dataSource: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPluginData>;
11
+ }
12
+ export declare function useWebpackPluginsDataSource(plugin: SDK.PluginData, selectedTapNames: string[], selectedHooks: string[]): {
13
+ dataSource: WebpackPluginsTableDataItem[];
14
+ tapNames: string[];
15
+ hooks: string[];
16
+ };
17
+ export declare const WebpackPluginsDataTable: React.FC<WebpackPluginsDataTableProps>;
18
+ export {};
@@ -0,0 +1,76 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { Table, Tooltip } from "antd";
4
+ import { flatten, includes, map, sumBy, uniq, values } from "lodash-es";
5
+ import { formatCosts } from "../../utils";
6
+ function useWebpackPluginsDataSource(plugin, selectedTapNames, selectedHooks) {
7
+ const tapNames = useMemo(() => uniq(map(flatten(values(plugin)), (e) => e.tapName)), [plugin]);
8
+ const hooks = useMemo(() => Object.keys(plugin), [plugin]);
9
+ const dataSource = useMemo(() => {
10
+ if (!tapNames.length)
11
+ return [];
12
+ return tapNames.reduce((total, tapName) => {
13
+ if (selectedTapNames.length && !includes(selectedTapNames, tapName)) {
14
+ return total;
15
+ }
16
+ hooks.forEach((hook) => {
17
+ if (selectedHooks.length && !includes(selectedHooks, hook)) {
18
+ return;
19
+ }
20
+ const hookData = plugin[hook].filter((e) => e.tapName === tapName);
21
+ if (hookData.length === 0)
22
+ return;
23
+ total.push({
24
+ tapName,
25
+ hook,
26
+ key: `${tapName}${hook}`,
27
+ hookData
28
+ });
29
+ });
30
+ return total;
31
+ }, []);
32
+ }, [plugin, selectedTapNames, selectedHooks]);
33
+ return {
34
+ dataSource,
35
+ tapNames,
36
+ hooks
37
+ };
38
+ }
39
+ const WebpackPluginsDataTable = ({ dataSource }) => {
40
+ return /* @__PURE__ */ jsx(
41
+ Table,
42
+ {
43
+ dataSource,
44
+ rowKey: (v) => `${v.tapName}_${v.hook}`,
45
+ columns: [
46
+ {
47
+ title: `Plugin Tap Name`,
48
+ render: (_v, r) => r.tapName
49
+ },
50
+ {
51
+ title: `Hook`,
52
+ render: (_v, r) => r.hook
53
+ },
54
+ {
55
+ title: "calls",
56
+ render: (_v, r) => /* @__PURE__ */ jsx(Tooltip, { title: `"${r.hook}" has been called ${r.data.length} times by "${r.tapName}"`, children: r.data.length }),
57
+ sorter(a, b) {
58
+ return a.data.length - b.data.length;
59
+ }
60
+ },
61
+ {
62
+ title: "duration(total)",
63
+ render: (_v, r) => formatCosts(sumBy(r.data, (e) => e.costs)),
64
+ sorter(a, b) {
65
+ return sumBy(a.data, (e) => e.costs) - sumBy(b.data, (e) => e.costs);
66
+ },
67
+ defaultSortOrder: "descend"
68
+ }
69
+ ]
70
+ }
71
+ );
72
+ };
73
+ export {
74
+ WebpackPluginsDataTable,
75
+ useWebpackPluginsDataSource
76
+ };
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { SDK } from '@rsdoctor/types';
3
+ export declare const ResolverFiles: React.FC<{
4
+ filename: string;
5
+ cwd: string;
6
+ resolver: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetResolverFileTree>;
7
+ }>;
8
+ export declare const ResolverAnalysisBase: React.FC<{
9
+ project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
10
+ }>;
11
+ export declare const ResolverAnalysis: React.FC<Omit<{
12
+ project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
13
+ }, "project"> & Partial<{
14
+ body?: any;
15
+ }>>;
@@ -0,0 +1,160 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ import { jsx, jsxs } from "react/jsx-runtime";
18
+ import React, { useMemo, useState } from "react";
19
+ import { get, map } from "lodash-es";
20
+ import { Button, Card, Col, Row, Space, Table, Typography } from "antd";
21
+ import { CloseCircleOutlined, FileSearchOutlined, MenuFoldOutlined, MenuUnfoldOutlined } from "@ant-design/icons";
22
+ import { Resolver } from "@rsdoctor/utils/common";
23
+ import { SDK } from "@rsdoctor/types";
24
+ import { Size } from "../../constants";
25
+ import { createFileStructures, formatCosts, mapFileKey } from "../../utils";
26
+ import { FileTree } from "../FileTree";
27
+ import { KeywordInput } from "../Form/keyword";
28
+ import { DiffViewer } from "../CodeViewer";
29
+ import { ServerAPIProvider, withServerAPI } from "../Manifest";
30
+ const height = 735;
31
+ const ResolverDetailsPanel = ({
32
+ filepath,
33
+ before,
34
+ after,
35
+ resolvers
36
+ }) => {
37
+ const [collapsed, setCollapsed] = useState(false);
38
+ return /* @__PURE__ */ jsxs(React.Fragment, { children: [
39
+ /* @__PURE__ */ jsx(Col, { flex: 1, children: /* @__PURE__ */ jsx(Card, { title: "Resolve Diff Viewer", children: /* @__PURE__ */ jsx(DiffViewer, { filepath, before, after, editorProps: { height } }) }) }),
40
+ /* @__PURE__ */ jsx(Col, { span: collapsed ? 2 : 7, children: /* @__PURE__ */ jsx(
41
+ Card,
42
+ {
43
+ title: collapsed ? "..." : "Resolve Details",
44
+ extra: /* @__PURE__ */ jsx(
45
+ Button,
46
+ {
47
+ onClick: () => setCollapsed(!collapsed),
48
+ size: "small",
49
+ icon: collapsed ? /* @__PURE__ */ jsx(MenuFoldOutlined, {}) : /* @__PURE__ */ jsx(MenuUnfoldOutlined, {})
50
+ }
51
+ ),
52
+ style: collapsed ? { width: 80 } : void 0,
53
+ children: collapsed ? null : /* @__PURE__ */ jsx(
54
+ Table,
55
+ {
56
+ style: { width: "100%", height, overflowY: "scroll", wordBreak: "break-all" },
57
+ size: "small",
58
+ pagination: false,
59
+ bordered: true,
60
+ rowKey: (e) => e.request,
61
+ columns: [
62
+ {
63
+ title: "Source Code",
64
+ width: 200,
65
+ render: (_v, r) => /* @__PURE__ */ jsx(Typography.Text, { copyable: true, children: /* @__PURE__ */ jsx(Typography.Text, { code: true, strong: true, children: r.request }) })
66
+ },
67
+ {
68
+ title: "Duration",
69
+ width: 80,
70
+ render: (_v, r) => /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: formatCosts(r.costs) }),
71
+ sorter: (a, b) => a.costs - b.costs,
72
+ sortDirections: ["descend", "ascend"]
73
+ },
74
+ {
75
+ title: "Resolve Result",
76
+ render: (_v, r) => {
77
+ if (Resolver.isResolveSuccessData(r))
78
+ return /* @__PURE__ */ jsx(Typography.Text, { copyable: true, children: r.result });
79
+ return /* @__PURE__ */ jsx(CloseCircleOutlined, { style: { color: "#f50" } });
80
+ }
81
+ }
82
+ ],
83
+ dataSource: resolvers
84
+ }
85
+ )
86
+ }
87
+ ) })
88
+ ] });
89
+ };
90
+ const ResolverFiles = (props) => {
91
+ const { resolver, cwd } = props;
92
+ const [filepath, setFilepath] = useState("");
93
+ const inlinedResourcePathKey = "__RESOURCEPATH__";
94
+ const n = "/node_modules/";
95
+ const paths = useMemo(() => {
96
+ return map(resolver, (e) => e.issuerPath).filter(Boolean);
97
+ }, [resolver]);
98
+ const filterPaths = useMemo(() => {
99
+ return paths.filter((e) => props.filename ? e.indexOf(props.filename) > -1 : true);
100
+ }, [props.filename, paths]);
101
+ const allNodeModules = filterPaths.length && filterPaths.every((e) => e.indexOf(n) > -1);
102
+ const files = useMemo(() => {
103
+ return createFileStructures({
104
+ files: filterPaths.length ? filterPaths : paths,
105
+ cwd,
106
+ fileTitle(file, basename) {
107
+ return /* @__PURE__ */ jsx("div", { onClick: () => setFilepath(file), children: basename });
108
+ }
109
+ });
110
+ }, [props.filename]);
111
+ return /* @__PURE__ */ jsxs(Row, { justify: "start", align: "top", wrap: false, gutter: Size.BasePadding, children: [
112
+ /* @__PURE__ */ jsx(Col, { span: 7, children: /* @__PURE__ */ jsx(Card, { title: "Files", children: /* @__PURE__ */ jsx(
113
+ FileTree,
114
+ {
115
+ style: { width: "100%", height, overflow: "scroll" },
116
+ treeData: files,
117
+ defaultExpandedKeys: mapFileKey(
118
+ files,
119
+ allNodeModules ? 1 : 4,
120
+ allNodeModules ? void 0 : (node) => {
121
+ const resourcePath = get(node, inlinedResourcePathKey);
122
+ const isNodeModules = resourcePath.indexOf(n) > -1;
123
+ if (filterPaths.length && filterPaths.every((e) => e.indexOf(n) > -1)) {
124
+ return true;
125
+ }
126
+ return !isNodeModules;
127
+ }
128
+ )
129
+ },
130
+ `tree_${props.filename}`
131
+ ) }) }),
132
+ filepath && /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetResolverFileDetails, body: { filepath }, children: (resolvers) => /* @__PURE__ */ jsx(ResolverDetailsPanel, __spreadValues({}, resolvers)) })
133
+ ] });
134
+ };
135
+ const ResolverAnalysisBase = ({ project }) => {
136
+ const { root: cwd } = project;
137
+ const [filename, setFilename] = useState("");
138
+ return /* @__PURE__ */ jsxs("div", { style: { width: "100%" }, children: [
139
+ /* @__PURE__ */ jsx(Space, { style: { marginTop: Size.BasePadding, marginBottom: Size.BasePadding }, children: /* @__PURE__ */ jsx(
140
+ KeywordInput,
141
+ {
142
+ icon: /* @__PURE__ */ jsx(FileSearchOutlined, {}),
143
+ label: "Filename",
144
+ placeholder: "search filename by keyword",
145
+ onChange: (e) => setFilename(e)
146
+ }
147
+ ) }),
148
+ /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetResolverFileTree, children: (resolver) => /* @__PURE__ */ jsx(ResolverFiles, { filename, resolver, cwd }) })
149
+ ] });
150
+ };
151
+ const ResolverAnalysis = withServerAPI({
152
+ api: SDK.ServerAPI.API.GetProjectInfo,
153
+ responsePropName: "project",
154
+ Component: ResolverAnalysisBase
155
+ });
156
+ export {
157
+ ResolverAnalysis,
158
+ ResolverAnalysisBase,
159
+ ResolverFiles
160
+ };
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ interface LoaderNamesSelectProps {
3
+ style?: React.CSSProperties;
4
+ onChange: (loaders: string[]) => void;
5
+ loaderNames: string[];
6
+ }
7
+ export declare const LoaderNamesSelect: React.FC<LoaderNamesSelectProps>;
8
+ export declare const LoaderCommonSelect: React.FC<{
9
+ onChange(value: {
10
+ loaders: string[];
11
+ filename: string;
12
+ }): void;
13
+ loaderNames: string[];
14
+ }>;
15
+ export {};