@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,131 @@
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
+ var __objRest = (source, exclude) => {
18
+ var target = {};
19
+ for (var prop in source)
20
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
21
+ target[prop] = source[prop];
22
+ if (source != null && __getOwnPropSymbols)
23
+ for (var prop of __getOwnPropSymbols(source)) {
24
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
25
+ target[prop] = source[prop];
26
+ }
27
+ return target;
28
+ };
29
+ import { jsx, jsxs } from "react/jsx-runtime";
30
+ import { Client } from "@rsdoctor/types";
31
+ import { Segmented, Space, Tooltip, Typography } from "antd";
32
+ import { Graph } from "@rsdoctor/utils/common";
33
+ import { useState } from "react";
34
+ import { formatSize } from "../../utils";
35
+ import { Color } from "../../constants";
36
+ import { StatisticCard } from "./statistic";
37
+ const SizePercent = (_a) => {
38
+ var _b = _a, { baseline, current } = _b, rest = __objRest(_b, ["baseline", "current"]);
39
+ const diff = Graph.diffSize(baseline, current);
40
+ return /* @__PURE__ */ jsx(Percent, __spreadValues(__spreadValues({}, rest), diff));
41
+ };
42
+ const Percent = ({ percent, state, fontSize = 14 }) => {
43
+ const _percent = +percent.toFixed(2);
44
+ if (_percent > 0) {
45
+ const percentText = `${_percent}`;
46
+ if (state === Client.DoctorClientDiffState.Up) {
47
+ return /* @__PURE__ */ jsxs(Typography.Text, { strong: true, style: { fontSize, color: Color.Red }, children: [
48
+ "+",
49
+ percentText,
50
+ "%"
51
+ ] });
52
+ }
53
+ if (state === Client.DoctorClientDiffState.Down) {
54
+ return /* @__PURE__ */ jsxs(Typography.Text, { strong: true, style: { fontSize, color: Color.Green }, children: [
55
+ "-",
56
+ percentText,
57
+ "%"
58
+ ] });
59
+ }
60
+ }
61
+ return null;
62
+ };
63
+ const DiffCardContent = ({ data, formatter }) => {
64
+ const { percent, state, size } = data;
65
+ const { baseline, current } = size;
66
+ const bSize = formatter ? formatter(baseline, "baseline") : formatSize(baseline);
67
+ const cSize = formatter ? formatter(current, "current") : formatSize(current);
68
+ return /* @__PURE__ */ jsx(Space, { align: "start", children: /* @__PURE__ */ jsxs(Space, { direction: "vertical", style: { textAlign: "left" }, children: [
69
+ /* @__PURE__ */ jsxs(Space, { children: [
70
+ /* @__PURE__ */ jsx(Typography.Text, { style: { fontSize: 10, color: "inherit" }, keyboard: true, children: "Current" }),
71
+ /* @__PURE__ */ jsx(
72
+ Tooltip,
73
+ {
74
+ title: typeof cSize === "number" || typeof cSize === "string" ? `Value of Current is ${cSize}` : void 0,
75
+ children: /* @__PURE__ */ jsx(Typography.Text, { style: { fontSize: 16, color: "inherit" }, strong: true, children: cSize })
76
+ }
77
+ ),
78
+ /* @__PURE__ */ jsx(Percent, { percent, state })
79
+ ] }),
80
+ /* @__PURE__ */ jsxs(Space, { children: [
81
+ /* @__PURE__ */ jsx(Typography.Text, { style: { fontSize: 10, color: "inherit" }, keyboard: true, children: "Baseline" }),
82
+ /* @__PURE__ */ jsx(
83
+ Tooltip,
84
+ {
85
+ title: typeof bSize === "number" || typeof bSize === "string" ? `Value of Baseline is ${bSize}` : void 0,
86
+ children: /* @__PURE__ */ jsx(Typography.Text, { style: { fontSize: 14 }, type: "secondary", children: bSize })
87
+ }
88
+ )
89
+ ] })
90
+ ] }) });
91
+ };
92
+ const DiffCard = ({ titles, datas, formatter, showPercentInTitle }) => {
93
+ const [idx, setIdx] = useState(0);
94
+ return /* @__PURE__ */ jsx(
95
+ StatisticCard,
96
+ {
97
+ title: titles.length > 1 ? /* @__PURE__ */ jsx(
98
+ Segmented,
99
+ {
100
+ defaultValue: titles[idx],
101
+ options: showPercentInTitle ? titles.map((e, i) => {
102
+ const data = datas[i];
103
+ return {
104
+ label: /* @__PURE__ */ jsxs(Space, { children: [
105
+ /* @__PURE__ */ jsx(Typography.Text, { children: e }),
106
+ /* @__PURE__ */ jsx(Percent, { percent: data.percent, state: data.state })
107
+ ] }),
108
+ value: e
109
+ };
110
+ }) : titles,
111
+ onChange: (e) => {
112
+ setIdx(titles.indexOf(e));
113
+ },
114
+ size: "small",
115
+ style: { transition: "transform 0.3s ease" },
116
+ value: titles[idx] || titles[0]
117
+ }
118
+ ) : titles[idx],
119
+ value: /* @__PURE__ */ jsx(DiffCardContent, { data: datas[idx], formatter }),
120
+ statisticProps: {
121
+ style: { textAlign: "left" }
122
+ }
123
+ }
124
+ );
125
+ };
126
+ export {
127
+ DiffCard,
128
+ DiffCardContent,
129
+ Percent,
130
+ SizePercent
131
+ };
@@ -0,0 +1,7 @@
1
+ import { CardProps as CProps } from 'antd';
2
+ import React, { CSSProperties } from 'react';
3
+ export interface CardProps extends CProps {
4
+ collapsable?: boolean;
5
+ dividerStyle?: CSSProperties;
6
+ }
7
+ export declare const Card: React.FC<CardProps>;
@@ -0,0 +1,62 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ import { jsx, jsxs } from "react/jsx-runtime";
33
+ import { ColumnHeightOutlined, VerticalAlignMiddleOutlined } from "@ant-design/icons";
34
+ import { Card as C, Space, Button, Divider } from "antd";
35
+ import { useState } from "react";
36
+ const Card = (_a) => {
37
+ var _b = _a, { collapsable = false, children, title, dividerStyle } = _b, rest = __objRest(_b, ["collapsable", "children", "title", "dividerStyle"]);
38
+ const [collapsed, setCollapsed] = useState(false);
39
+ if (title && collapsable) {
40
+ return /* @__PURE__ */ jsx(
41
+ C,
42
+ __spreadProps(__spreadValues({}, rest), {
43
+ title: /* @__PURE__ */ jsxs(Space, { style: { fontSize: "inherit" }, children: [
44
+ /* @__PURE__ */ jsx(
45
+ Button,
46
+ {
47
+ icon: collapsed ? /* @__PURE__ */ jsx(ColumnHeightOutlined, {}) : /* @__PURE__ */ jsx(VerticalAlignMiddleOutlined, {}),
48
+ onClick: () => setCollapsed(!collapsed),
49
+ size: "small"
50
+ }
51
+ ),
52
+ title
53
+ ] }),
54
+ children: collapsed ? /* @__PURE__ */ jsx(Divider, { orientation: "center", style: dividerStyle, plain: true, children: /* @__PURE__ */ jsx(Button, { icon: /* @__PURE__ */ jsx(ColumnHeightOutlined, {}), type: "text", onClick: () => setCollapsed(!collapsed), children: "show more" }) }) : children
55
+ })
56
+ );
57
+ }
58
+ return /* @__PURE__ */ jsx(C, __spreadProps(__spreadValues({ title }, rest), { children }));
59
+ };
60
+ export {
61
+ Card
62
+ };
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ export interface SizeCardProps {
3
+ files: {
4
+ path: string;
5
+ size: number;
6
+ }[];
7
+ /**
8
+ * total size for origin files
9
+ */
10
+ total: number;
11
+ /**
12
+ * @default false
13
+ */
14
+ showProgress?: boolean;
15
+ }
16
+ export declare const SizeCard: React.FC<SizeCardProps>;
@@ -0,0 +1,71 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { ExceptionOutlined } from "@ant-design/icons";
3
+ import { Progress, Space, Tag, Tooltip, Typography } from "antd";
4
+ import { sumBy } from "lodash-es";
5
+ import { useMemo } from "react";
6
+ import { createFileStructures, formatSize } from "../../utils";
7
+ import { FileTree } from "../FileTree";
8
+ import { TextDrawer } from "../TextDrawer";
9
+ const height = 100;
10
+ const SizeCard = ({ files, total, showProgress = false }) => {
11
+ const sum = useMemo(() => {
12
+ return sumBy(files, (e) => e.size);
13
+ }, [files]);
14
+ const fileStructures = useMemo(() => {
15
+ return createFileStructures({
16
+ files: files.map((e) => e.path),
17
+ fileTitle(file, basename) {
18
+ const { size } = files.find((e) => e.path === file);
19
+ return /* @__PURE__ */ jsxs(Space, { children: [
20
+ /* @__PURE__ */ jsx(Typography.Text, { children: basename }),
21
+ /* @__PURE__ */ jsx(Tag, { color: "success", children: formatSize(size) })
22
+ ] });
23
+ }
24
+ });
25
+ }, [files]);
26
+ if (fileStructures.length === 0) {
27
+ return /* @__PURE__ */ jsx(Space, { style: { height, fontSize: 24 }, align: "center", children: "0" });
28
+ }
29
+ return /* @__PURE__ */ jsxs(Space, { style: { height }, align: "center", children: [
30
+ showProgress ? /* @__PURE__ */ jsx(
31
+ Progress,
32
+ {
33
+ type: "dashboard",
34
+ percent: +(sum / total * 100).toFixed(2),
35
+ strokeColor: { "0%": "#108ee9", "100%": "#87d068" },
36
+ width: 80
37
+ }
38
+ ) : null,
39
+ /* @__PURE__ */ jsx(
40
+ TextDrawer,
41
+ {
42
+ text: /* @__PURE__ */ jsx(Tooltip, { title: "Click to show the total files", children: /* @__PURE__ */ jsxs(Space, { style: { textAlign: showProgress ? "left" : "center" }, align: "end", children: [
43
+ /* @__PURE__ */ jsxs(Space, { direction: "vertical", children: [
44
+ /* @__PURE__ */ jsxs(Typography.Text, { style: { fontSize: 14 }, children: [
45
+ "Count:",
46
+ /* @__PURE__ */ jsxs(Typography.Text, { strong: true, children: [
47
+ " ",
48
+ files.length
49
+ ] })
50
+ ] }),
51
+ /* @__PURE__ */ jsx(Typography.Text, { style: { fontSize: 20 }, children: formatSize(sum) })
52
+ ] }),
53
+ /* @__PURE__ */ jsx(ExceptionOutlined, { style: { transform: "translateY(-3.5px)" } })
54
+ ] }) }),
55
+ buttonStyle: { height: "100%" },
56
+ buttonProps: { type: "text" },
57
+ children: /* @__PURE__ */ jsx(
58
+ FileTree,
59
+ {
60
+ treeData: fileStructures,
61
+ defaultExpandAll: true,
62
+ titleRender: (v) => /* @__PURE__ */ jsx(Typography.Text, { children: v.title })
63
+ }
64
+ )
65
+ }
66
+ )
67
+ ] });
68
+ };
69
+ export {
70
+ SizeCard
71
+ };
@@ -0,0 +1,16 @@
1
+ .statistic-card {
2
+ border-radius: 8px;
3
+ text-align: center;
4
+ padding: 24px;
5
+ }
6
+ .statistic-card-title {
7
+ font-size: 14px;
8
+ font-weight: 500;
9
+ }
10
+ .statistic-card-light {
11
+ background: #fff;
12
+ border: 1px solid #eee;
13
+ }
14
+ .statistic-card-dark {
15
+ background: rgb(20, 20, 20);
16
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { StatisticProps } from 'antd';
3
+ import './statistic.sass';
4
+ export interface StatisticCardProps {
5
+ title: string | React.ReactNode;
6
+ value: string | React.ReactNode;
7
+ statisticProps?: StatisticProps;
8
+ }
9
+ export declare const StatisticCard: React.FC<StatisticCardProps>;
@@ -0,0 +1,34 @@
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 } from "react/jsx-runtime";
18
+ import { Statistic } from "antd";
19
+ import "./statistic.css";
20
+ import { useTheme } from "../../utils";
21
+ const StatisticCard = ({ title, value, statisticProps }) => {
22
+ const { theme } = useTheme();
23
+ return /* @__PURE__ */ jsx("div", { className: ["statistic-card", `statistic-card-${theme}`].join(" "), children: /* @__PURE__ */ jsx(
24
+ Statistic,
25
+ __spreadValues({
26
+ title: /* @__PURE__ */ jsx("div", { className: "statistic-card-title", children: title }),
27
+ valueRender: () => value,
28
+ valueStyle: { fontSize: 24 }
29
+ }, statisticProps)
30
+ ) });
31
+ };
32
+ export {
33
+ StatisticCard
34
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { DurationMetric, ITraceEventData } from '../types';
3
+ export declare const TimelineCom: React.FC<{
4
+ loaderData?: DurationMetric[];
5
+ pluginsData?: ITraceEventData[];
6
+ formatterFn: Function;
7
+ chartType?: string;
8
+ }>;
@@ -0,0 +1,197 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import ReactECharts from "echarts-for-react";
4
+ import * as echarts from "echarts/core";
5
+ import dayjs from "dayjs";
6
+ import { groupBy } from "lodash-es";
7
+ const ColorMap = [
8
+ { color: "#DC2626" },
9
+ { color: "#FFE382" },
10
+ { color: "#7B66FF" },
11
+ { color: "#96EFFF" },
12
+ { color: "#E25E3E" },
13
+ { color: "#D0F288" },
14
+ { color: "#8ADAB2" },
15
+ { color: "#FFC5C5" },
16
+ { color: "#3876BF" }
17
+ ];
18
+ const TimelineCom = ({ loaderData, pluginsData, formatterFn, chartType = "normal" }) => {
19
+ const data = [];
20
+ let categories = [];
21
+ useMemo(() => {
22
+ if (!loaderData)
23
+ return;
24
+ const _categories = [];
25
+ loaderData.forEach((_l) => {
26
+ _categories.unshift(_l.n + " total");
27
+ _categories.unshift(_l.n);
28
+ });
29
+ loaderData.forEach(function(_loaderData, _i) {
30
+ var _a;
31
+ const typeItem = ColorMap[_i % 9];
32
+ data.push({
33
+ name: _loaderData.n + " total",
34
+ value: [_categories.indexOf(_loaderData.n + " total"), _loaderData.s, _loaderData.e, _loaderData.e - _loaderData.s],
35
+ itemStyle: {
36
+ normal: {
37
+ color: typeItem.color
38
+ }
39
+ }
40
+ });
41
+ if (!(_loaderData == null ? void 0 : _loaderData.c))
42
+ return;
43
+ for (let l = 0; l < ((_a = _loaderData == null ? void 0 : _loaderData.c) == null ? void 0 : _a.length); l++) {
44
+ data.push({
45
+ name: _loaderData.n,
46
+ value: [_categories.indexOf(_loaderData.n), _loaderData.c[l].s, _loaderData.c[l].e, _loaderData.c[l].e - _loaderData.c[l].s],
47
+ itemStyle: {
48
+ normal: {
49
+ color: ColorMap[Math.round(Math.random() * (ColorMap.length - 1))].color
50
+ }
51
+ },
52
+ ext: _loaderData.c[l].ext
53
+ });
54
+ }
55
+ });
56
+ categories = _categories.map((val, i) => {
57
+ if (i % 2 !== 0) {
58
+ return val.replace(" total", "");
59
+ } else {
60
+ return "";
61
+ }
62
+ });
63
+ }, [loaderData]);
64
+ useMemo(() => {
65
+ if (!pluginsData)
66
+ return;
67
+ const _pluginsData = groupBy(pluginsData, (e) => e.pid);
68
+ Object.keys(_pluginsData).reverse().forEach(function(key, i) {
69
+ _pluginsData[key].forEach((_plugin) => {
70
+ data.push({
71
+ name: String(_plugin.pid),
72
+ value: [i, _plugin.args.s, _plugin.args.e, _plugin.args.e - _plugin.args.s],
73
+ itemStyle: {
74
+ normal: {
75
+ color: ColorMap[Math.round(Math.random() * (ColorMap.length - 1))].color
76
+ }
77
+ },
78
+ ext: _plugin
79
+ });
80
+ });
81
+ categories.push(String(key.charAt(0).toUpperCase() + key.slice(1)));
82
+ });
83
+ }, [pluginsData]);
84
+ function renderItem(params, api) {
85
+ const categoryIndex = api.value(0);
86
+ const start = api.coord([api.value(1), categoryIndex]);
87
+ const end = api.coord([api.value(2), categoryIndex]);
88
+ const height = api.size([0, 1])[1] * 0.4;
89
+ const rectShape = echarts.graphic.clipRectByRect(
90
+ {
91
+ x: start[0],
92
+ y: chartType === "loader" ? start[1] - (categoryIndex % 2 !== 0 ? 0 : height) : start[1],
93
+ width: end[0] - start[0] || 5,
94
+ height
95
+ },
96
+ {
97
+ x: params.coordSys.x,
98
+ y: params.coordSys.y,
99
+ width: params.coordSys.width,
100
+ height: params.coordSys.height
101
+ }
102
+ );
103
+ return rectShape && {
104
+ type: "rect",
105
+ transition: ["shape"],
106
+ shape: rectShape,
107
+ style: api.style(),
108
+ enterFrom: {
109
+ style: { opacity: 0 },
110
+ x: 0
111
+ }
112
+ };
113
+ }
114
+ const option = {
115
+ tooltip: {
116
+ formatter: (raw) => {
117
+ return formatterFn(raw);
118
+ }
119
+ },
120
+ dataZoom: [
121
+ {
122
+ type: "slider",
123
+ filterMode: "weakFilter",
124
+ showDataShadow: false,
125
+ top: -10,
126
+ labelFormatter: ""
127
+ },
128
+ {
129
+ type: "inside",
130
+ filterMode: "weakFilter"
131
+ }
132
+ ],
133
+ grid: {
134
+ top: 10,
135
+ left: 0,
136
+ bottom: 10,
137
+ right: 0,
138
+ height: categories.length > 2 ? "auto" : chartType === "loader" ? categories.length * 150 : categories.length * 100,
139
+ containLabel: true
140
+ },
141
+ xAxis: {
142
+ position: "top",
143
+ splitLine: {
144
+ show: false
145
+ },
146
+ scale: true,
147
+ axisLine: {
148
+ show: false
149
+ },
150
+ axisLabel: {
151
+ formatter(val) {
152
+ return dayjs(val).format("HH:mm:ss");
153
+ }
154
+ }
155
+ },
156
+ yAxis: {
157
+ type: "category",
158
+ splitLine: {
159
+ interval: chartType === "loader" ? 1 : 0,
160
+ show: true
161
+ },
162
+ axisLabel: {
163
+ inside: true,
164
+ lineHeight: 20,
165
+ width: 100,
166
+ fontSize: 12,
167
+ color: "#000",
168
+ verticalAlign: "bottom"
169
+ },
170
+ axisLine: {
171
+ show: true
172
+ },
173
+ axisTick: {
174
+ show: false
175
+ },
176
+ data: categories
177
+ },
178
+ series: [
179
+ {
180
+ type: "custom",
181
+ renderItem,
182
+ itemStyle: {
183
+ opacity: 0.8
184
+ },
185
+ encode: {
186
+ x: [1, 2],
187
+ y: 0
188
+ },
189
+ data
190
+ }
191
+ ]
192
+ };
193
+ return /* @__PURE__ */ jsx(ReactECharts, { option, echarts, style: { width: "100%", minHeight: "400px" } });
194
+ };
195
+ export {
196
+ TimelineCom
197
+ };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import './loader.scss';
3
+ import './tooltips.scss';
4
+ import { CommonChartProps } from './common';
5
+ export declare const BootstrapChartContainer: React.FC<CommonChartProps>;
@@ -0,0 +1,44 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Space } from "antd";
3
+ import { BarChartOutlined } from "@ant-design/icons";
4
+ import { SDK } from "@rsdoctor/types";
5
+ import { TextDrawer } from "../TextDrawer";
6
+ import "./loader.css";
7
+ import "./tooltips.css";
8
+ import { CommonExecutionEmptyTips, CommonExecutionsChart } from "./common";
9
+ import { ServerAPIProvider } from "../Manifest";
10
+ import { Summary } from "@rsdoctor/utils/common";
11
+ const BootstrapChartContainer = ({ summary }) => {
12
+ const { costs = [] } = summary || {};
13
+ const target = costs.find((e) => e.name === Summary.SummaryCostsDataName.Bootstrap);
14
+ const hooks = [
15
+ "environment",
16
+ "afterEnvironment",
17
+ "entryOption",
18
+ "afterPlugins",
19
+ "afterResolvers",
20
+ "initialize",
21
+ "beforeRun",
22
+ "run",
23
+ "watchRun",
24
+ "normalModuleFactory",
25
+ "contextModuleFactory",
26
+ "beforeCompile"
27
+ ];
28
+ if (!target)
29
+ return null;
30
+ return /* @__PURE__ */ jsx(
31
+ TextDrawer,
32
+ {
33
+ drawerProps: { title: 'Chart of the "Bootstrap -> BeforeCompile" stage' },
34
+ text: /* @__PURE__ */ jsxs(Space, { children: [
35
+ "detail",
36
+ /* @__PURE__ */ jsx(BarChartOutlined, {})
37
+ ] }),
38
+ children: /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetPluginData, body: { hooks }, children: (res) => res && res.length ? /* @__PURE__ */ jsx(CommonExecutionsChart, { plugins: res }) : /* @__PURE__ */ jsx(CommonExecutionEmptyTips, {}) })
39
+ }
40
+ );
41
+ };
42
+ export {
43
+ BootstrapChartContainer
44
+ };
@@ -0,0 +1,13 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import React from 'react';
3
+ import './loader.scss';
4
+ import './tooltips.scss';
5
+ import { Metric } from './types';
6
+ export interface CommonChartProps {
7
+ summary: SDK.SummaryData;
8
+ }
9
+ export declare const CommonExecutionsChart: React.FC<{
10
+ plugins: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPluginData>;
11
+ defaultDatas?: Metric[];
12
+ }>;
13
+ export declare const CommonExecutionEmptyTips: React.FC;
@@ -0,0 +1,56 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Alert, Typography } from "antd";
3
+ import { useEffect, useRef, useState } from "react";
4
+ import { useTheme } from "../../utils";
5
+ import { TimelineCom } from "./TimelineCharts";
6
+ import "./loader.css";
7
+ import "./tooltips.css";
8
+ import { formatterForPlugins, processTrans } from "./utils";
9
+ const CommonExecutionsChart = ({ plugins, defaultDatas = [] }) => {
10
+ const { isDark } = useTheme();
11
+ const ref = useRef(null);
12
+ const [data, setData] = useState([]);
13
+ useEffect(() => {
14
+ const arr = [];
15
+ plugins.forEach((item) => {
16
+ item.data.forEach((el) => {
17
+ arr.push({
18
+ p: item.hook,
19
+ n: `${item.tapName}`,
20
+ s: el.startAt,
21
+ e: el.endAt
22
+ });
23
+ });
24
+ });
25
+ setData([
26
+ ...processTrans(defaultDatas),
27
+ ...processTrans(arr)
28
+ ]);
29
+ }, []);
30
+ return /* @__PURE__ */ jsx(
31
+ "div",
32
+ {
33
+ className: ["loader-chart-container", isDark ? "loader-chart-container_dark" : ""].join(" ").trim(),
34
+ ref,
35
+ style: { width: "100%", height: "600px" },
36
+ children: /* @__PURE__ */ jsx(TimelineCom, { pluginsData: data, formatterFn: formatterForPlugins })
37
+ }
38
+ );
39
+ };
40
+ const CommonExecutionEmptyTips = () => {
41
+ return /* @__PURE__ */ jsx(
42
+ Alert,
43
+ {
44
+ message: /* @__PURE__ */ jsxs(Typography.Text, { children: [
45
+ /* @__PURE__ */ jsx(Typography.Text, { children: "make sure that you have turn on " }),
46
+ /* @__PURE__ */ jsx(Typography.Text, { children: " in configuration for the Web Doctor plugin." })
47
+ ] }),
48
+ type: "info",
49
+ showIcon: true
50
+ }
51
+ );
52
+ };
53
+ export {
54
+ CommonExecutionEmptyTips,
55
+ CommonExecutionsChart
56
+ };