@rsdoctor/components 0.0.0-next-20240620044732

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 (330) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +22 -0
  3. package/dist/assets/connection-point.3b3c78ca.svg +1 -0
  4. package/dist/assets/webpack.98604d64.svg +1 -0
  5. package/dist/components/Alert/change.d.ts +8 -0
  6. package/dist/components/Alert/change.js +93 -0
  7. package/dist/components/Alert/file-relation.d.ts +3 -0
  8. package/dist/components/Alert/file-relation.js +9 -0
  9. package/dist/components/Alert/index.css +32 -0
  10. package/dist/components/Alert/index.d.ts +4 -0
  11. package/dist/components/Alert/index.js +37 -0
  12. package/dist/components/Alert/link.d.ts +3 -0
  13. package/dist/components/Alert/link.js +27 -0
  14. package/dist/components/Alert/package-relation.d.ts +17 -0
  15. package/dist/components/Alert/package-relation.js +281 -0
  16. package/dist/components/Alert/types.d.ts +31 -0
  17. package/dist/components/Alert/types.js +0 -0
  18. package/dist/components/Alert/view.d.ts +4 -0
  19. package/dist/components/Alert/view.js +58 -0
  20. package/dist/components/Alerts/bundle.d.ts +11 -0
  21. package/dist/components/Alerts/bundle.js +61 -0
  22. package/dist/components/Alerts/common.d.ts +15 -0
  23. package/dist/components/Alerts/common.js +112 -0
  24. package/dist/components/Alerts/compile.d.ts +10 -0
  25. package/dist/components/Alerts/compile.js +46 -0
  26. package/dist/components/Alerts/index.d.ts +3 -0
  27. package/dist/components/Alerts/index.js +3 -0
  28. package/dist/components/Alerts/overlay.d.ts +26 -0
  29. package/dist/components/Alerts/overlay.js +154 -0
  30. package/dist/components/Badge/index.d.ts +21 -0
  31. package/dist/components/Badge/index.js +87 -0
  32. package/dist/components/BundleDiff/DiffContainer/assets.d.ts +7 -0
  33. package/dist/components/BundleDiff/DiffContainer/assets.js +507 -0
  34. package/dist/components/BundleDiff/DiffContainer/cards.d.ts +3 -0
  35. package/dist/components/BundleDiff/DiffContainer/cards.js +156 -0
  36. package/dist/components/BundleDiff/DiffContainer/changes.d.ts +15 -0
  37. package/dist/components/BundleDiff/DiffContainer/changes.js +69 -0
  38. package/dist/components/BundleDiff/DiffContainer/constants.d.ts +11 -0
  39. package/dist/components/BundleDiff/DiffContainer/constants.js +17 -0
  40. package/dist/components/BundleDiff/DiffContainer/diff.d.ts +23 -0
  41. package/dist/components/BundleDiff/DiffContainer/diff.js +114 -0
  42. package/dist/components/BundleDiff/DiffContainer/index.d.ts +3 -0
  43. package/dist/components/BundleDiff/DiffContainer/index.js +180 -0
  44. package/dist/components/BundleDiff/DiffContainer/modules.d.ts +8 -0
  45. package/dist/components/BundleDiff/DiffContainer/modules.js +302 -0
  46. package/dist/components/BundleDiff/DiffContainer/overview.d.ts +5 -0
  47. package/dist/components/BundleDiff/DiffContainer/overview.js +178 -0
  48. package/dist/components/BundleDiff/DiffContainer/packages.d.ts +19 -0
  49. package/dist/components/BundleDiff/DiffContainer/packages.js +330 -0
  50. package/dist/components/BundleDiff/DiffContainer/row.d.ts +9 -0
  51. package/dist/components/BundleDiff/DiffContainer/row.js +369 -0
  52. package/dist/components/BundleDiff/DiffContainer/types.d.ts +45 -0
  53. package/dist/components/BundleDiff/DiffContainer/types.js +0 -0
  54. package/dist/components/BundleDiff/DiffContainer/utils.d.ts +2 -0
  55. package/dist/components/BundleDiff/DiffContainer/utils.js +24 -0
  56. package/dist/components/BundleDiff/DiffServerAPIProvider/index.d.ts +4 -0
  57. package/dist/components/BundleDiff/DiffServerAPIProvider/index.js +37 -0
  58. package/dist/components/BundleDiff/constants.d.ts +11 -0
  59. package/dist/components/BundleDiff/constants.js +19 -0
  60. package/dist/components/BundleDiff/index.d.ts +1 -0
  61. package/dist/components/BundleDiff/index.js +1 -0
  62. package/dist/components/Card/diff.d.ts +24 -0
  63. package/dist/components/Card/diff.js +116 -0
  64. package/dist/components/Card/index.d.ts +9 -0
  65. package/dist/components/Card/index.js +50 -0
  66. package/dist/components/Card/size.d.ts +21 -0
  67. package/dist/components/Card/size.js +79 -0
  68. package/dist/components/Card/statistic.css +17 -0
  69. package/dist/components/Card/statistic.d.ts +12 -0
  70. package/dist/components/Card/statistic.js +19 -0
  71. package/dist/components/Charts/TimelineCharts/index.d.ts +8 -0
  72. package/dist/components/Charts/TimelineCharts/index.js +212 -0
  73. package/dist/components/Charts/bootstrap.d.ts +5 -0
  74. package/dist/components/Charts/bootstrap.js +44 -0
  75. package/dist/components/Charts/common.d.ts +13 -0
  76. package/dist/components/Charts/common.js +56 -0
  77. package/dist/components/Charts/constants.d.ts +2 -0
  78. package/dist/components/Charts/constants.js +46 -0
  79. package/dist/components/Charts/done.d.ts +5 -0
  80. package/dist/components/Charts/done.js +45 -0
  81. package/dist/components/Charts/index.d.ts +10 -0
  82. package/dist/components/Charts/index.js +37 -0
  83. package/dist/components/Charts/loader.css +31 -0
  84. package/dist/components/Charts/loader.d.ts +4 -0
  85. package/dist/components/Charts/loader.js +88 -0
  86. package/dist/components/Charts/minify.d.ts +5 -0
  87. package/dist/components/Charts/minify.js +37 -0
  88. package/dist/components/Charts/tooltips.css +62 -0
  89. package/dist/components/Charts/types.d.ts +61 -0
  90. package/dist/components/Charts/types.js +11 -0
  91. package/dist/components/Charts/utils.d.ts +13 -0
  92. package/dist/components/Charts/utils.js +206 -0
  93. package/dist/components/CodeViewer/config.d.ts +2 -0
  94. package/dist/components/CodeViewer/config.js +18 -0
  95. package/dist/components/CodeViewer/diff.d.ts +11 -0
  96. package/dist/components/CodeViewer/diff.js +35 -0
  97. package/dist/components/CodeViewer/hightlight.d.ts +10 -0
  98. package/dist/components/CodeViewer/hightlight.js +76 -0
  99. package/dist/components/CodeViewer/index.d.ts +4 -0
  100. package/dist/components/CodeViewer/index.js +4 -0
  101. package/dist/components/CodeViewer/viewer.d.ts +13 -0
  102. package/dist/components/CodeViewer/viewer.js +60 -0
  103. package/dist/components/Configuration/builder.d.ts +13 -0
  104. package/dist/components/Configuration/builder.js +67 -0
  105. package/dist/components/Configuration/index.d.ts +1 -0
  106. package/dist/components/Configuration/index.js +1 -0
  107. package/dist/components/FileTree/index.css +58 -0
  108. package/dist/components/FileTree/index.d.ts +4 -0
  109. package/dist/components/FileTree/index.js +42 -0
  110. package/dist/components/Form/keyword.d.ts +14 -0
  111. package/dist/components/Form/keyword.js +60 -0
  112. package/dist/components/Keyword/index.d.ts +6 -0
  113. package/dist/components/Keyword/index.js +36 -0
  114. package/dist/components/Layout/builder-select.d.ts +2 -0
  115. package/dist/components/Layout/builder-select.js +50 -0
  116. package/dist/components/Layout/constants.d.ts +1 -0
  117. package/dist/components/Layout/constants.js +4 -0
  118. package/dist/components/Layout/header.css +12 -0
  119. package/dist/components/Layout/header.d.ts +3 -0
  120. package/dist/components/Layout/header.js +86 -0
  121. package/dist/components/Layout/index.d.ts +5 -0
  122. package/dist/components/Layout/index.js +34 -0
  123. package/dist/components/Layout/menus.d.ts +8 -0
  124. package/dist/components/Layout/menus.js +167 -0
  125. package/dist/components/Layout/progress.d.ts +8 -0
  126. package/dist/components/Layout/progress.js +44 -0
  127. package/dist/components/Loader/Analysis/files.d.ts +8 -0
  128. package/dist/components/Loader/Analysis/files.js +193 -0
  129. package/dist/components/Loader/Analysis/index.d.ts +11 -0
  130. package/dist/components/Loader/Analysis/index.js +23 -0
  131. package/dist/components/Loader/executions.d.ts +9 -0
  132. package/dist/components/Loader/executions.js +199 -0
  133. package/dist/components/Manifest/api.d.ts +34 -0
  134. package/dist/components/Manifest/api.js +127 -0
  135. package/dist/components/Manifest/data.d.ts +8 -0
  136. package/dist/components/Manifest/data.js +65 -0
  137. package/dist/components/Manifest/index.d.ts +2 -0
  138. package/dist/components/Manifest/index.js +2 -0
  139. package/dist/components/Opener/code.d.ts +20 -0
  140. package/dist/components/Opener/code.js +78 -0
  141. package/dist/components/Opener/index.d.ts +2 -0
  142. package/dist/components/Opener/index.js +2 -0
  143. package/dist/components/Opener/vscode.d.ts +11 -0
  144. package/dist/components/Opener/vscode.js +42 -0
  145. package/dist/components/Overall/NumberButton.d.ts +8 -0
  146. package/dist/components/Overall/NumberButton.js +29 -0
  147. package/dist/components/Overall/NumberButton.module.js +5 -0
  148. package/dist/components/Overall/NumberButton_module.css +70 -0
  149. package/dist/components/Overall/bundle.d.ts +6 -0
  150. package/dist/components/Overall/bundle.js +167 -0
  151. package/dist/components/Overall/bundle.module.css +0 -0
  152. package/dist/components/Overall/card.module.js +5 -0
  153. package/dist/components/Overall/card_module.css +6 -0
  154. package/dist/components/Overall/compile.d.ts +5 -0
  155. package/dist/components/Overall/compile.js +67 -0
  156. package/dist/components/Overall/compile.module.js +5 -0
  157. package/dist/components/Overall/compile_module.css +4 -0
  158. package/dist/components/Overall/index.d.ts +3 -0
  159. package/dist/components/Overall/index.js +3 -0
  160. package/dist/components/Overall/list.module.js +5 -0
  161. package/dist/components/Overall/list_module.css +7 -0
  162. package/dist/components/Overall/project.d.ts +8 -0
  163. package/dist/components/Overall/project.js +73 -0
  164. package/dist/components/Plugins/webpack.d.ts +18 -0
  165. package/dist/components/Plugins/webpack.js +76 -0
  166. package/dist/components/Resolver/analysis.d.ts +15 -0
  167. package/dist/components/Resolver/analysis.js +144 -0
  168. package/dist/components/Select/index.d.ts +15 -0
  169. package/dist/components/Select/index.js +68 -0
  170. package/dist/components/Status/failed.d.ts +9 -0
  171. package/dist/components/Status/failed.js +33 -0
  172. package/dist/components/Status/index.d.ts +1 -0
  173. package/dist/components/Status/index.js +1 -0
  174. package/dist/components/TextDrawer/duplicate.d.ts +17 -0
  175. package/dist/components/TextDrawer/duplicate.js +69 -0
  176. package/dist/components/TextDrawer/index.d.ts +11 -0
  177. package/dist/components/TextDrawer/index.js +36 -0
  178. package/dist/components/Title/index.d.ts +15 -0
  179. package/dist/components/Title/index.js +10 -0
  180. package/dist/components/index.d.ts +12 -0
  181. package/dist/components/index.js +15 -0
  182. package/dist/components/worker/ecmaversion/client.d.ts +10 -0
  183. package/dist/components/worker/ecmaversion/client.js +60 -0
  184. package/dist/components/worker/ecmaversion/worker.d.ts +1 -0
  185. package/dist/components/worker/ecmaversion/worker.js +13 -0
  186. package/dist/components/worker/jsequal/client.d.ts +11 -0
  187. package/dist/components/worker/jsequal/client.js +38 -0
  188. package/dist/components/worker/jsequal/worker.d.ts +1 -0
  189. package/dist/components/worker/jsequal/worker.js +23 -0
  190. package/dist/config.d.ts +19 -0
  191. package/dist/config.js +25 -0
  192. package/dist/constants.d.ts +50 -0
  193. package/dist/constants.js +75 -0
  194. package/dist/index.d.ts +3 -0
  195. package/dist/index.js +6 -0
  196. package/dist/pages/BundleSize/components/asset.d.ts +26 -0
  197. package/dist/pages/BundleSize/components/asset.js +545 -0
  198. package/dist/pages/BundleSize/components/cards.d.ts +7 -0
  199. package/dist/pages/BundleSize/components/cards.js +143 -0
  200. package/dist/pages/BundleSize/components/editor.d.ts +5 -0
  201. package/dist/pages/BundleSize/components/editor.js +38 -0
  202. package/dist/pages/BundleSize/components/index.css +20 -0
  203. package/dist/pages/BundleSize/components/index.d.ts +16 -0
  204. package/dist/pages/BundleSize/components/index.js +366 -0
  205. package/dist/pages/BundleSize/config.d.ts +7 -0
  206. package/dist/pages/BundleSize/config.js +9 -0
  207. package/dist/pages/BundleSize/constants.d.ts +5 -0
  208. package/dist/pages/BundleSize/constants.js +9 -0
  209. package/dist/pages/BundleSize/index.d.ts +3 -0
  210. package/dist/pages/BundleSize/index.js +11 -0
  211. package/dist/pages/ModuleAnalyze/chunks.d.ts +6 -0
  212. package/dist/pages/ModuleAnalyze/chunks.js +48 -0
  213. package/dist/pages/ModuleAnalyze/components/fileTreeCom.css +97 -0
  214. package/dist/pages/ModuleAnalyze/components/fileTreeCom.d.ts +15 -0
  215. package/dist/pages/ModuleAnalyze/components/fileTreeCom.js +120 -0
  216. package/dist/pages/ModuleAnalyze/constants.d.ts +7 -0
  217. package/dist/pages/ModuleAnalyze/constants.js +14 -0
  218. package/dist/pages/ModuleAnalyze/dependncy.d.ts +9 -0
  219. package/dist/pages/ModuleAnalyze/dependncy.js +31 -0
  220. package/dist/pages/ModuleAnalyze/fileTree.d.ts +9 -0
  221. package/dist/pages/ModuleAnalyze/fileTree.js +125 -0
  222. package/dist/pages/ModuleAnalyze/index.css +10 -0
  223. package/dist/pages/ModuleAnalyze/index.d.ts +8 -0
  224. package/dist/pages/ModuleAnalyze/index.js +64 -0
  225. package/dist/pages/ModuleAnalyze/utils/hooks.d.ts +21 -0
  226. package/dist/pages/ModuleAnalyze/utils/hooks.js +62 -0
  227. package/dist/pages/ModuleAnalyze/utils/index.d.ts +3 -0
  228. package/dist/pages/ModuleAnalyze/utils/index.js +34 -0
  229. package/dist/pages/ModuleResolve/constants.d.ts +3 -0
  230. package/dist/pages/ModuleResolve/constants.js +7 -0
  231. package/dist/pages/ModuleResolve/index.d.ts +3 -0
  232. package/dist/pages/ModuleResolve/index.js +19 -0
  233. package/dist/pages/Overall/constants.d.ts +3 -0
  234. package/dist/pages/Overall/constants.js +7 -0
  235. package/dist/pages/Overall/index.d.ts +9 -0
  236. package/dist/pages/Overall/index.js +39 -0
  237. package/dist/pages/Overall/responsiveGridList.d.ts +6 -0
  238. package/dist/pages/Overall/responsiveGridList.js +28 -0
  239. package/dist/pages/Resources/RuleIndex/constants.d.ts +3 -0
  240. package/dist/pages/Resources/RuleIndex/constants.js +7 -0
  241. package/dist/pages/Resources/RuleIndex/index.d.ts +3 -0
  242. package/dist/pages/Resources/RuleIndex/index.js +53 -0
  243. package/dist/pages/TreeShaking/constants.d.ts +3 -0
  244. package/dist/pages/TreeShaking/constants.js +7 -0
  245. package/dist/pages/TreeShaking/editor.d.ts +12 -0
  246. package/dist/pages/TreeShaking/editor.js +110 -0
  247. package/dist/pages/TreeShaking/index.css +74 -0
  248. package/dist/pages/TreeShaking/index.d.ts +8 -0
  249. package/dist/pages/TreeShaking/index.js +177 -0
  250. package/dist/pages/TreeShaking/open-tag.d.ts +11 -0
  251. package/dist/pages/TreeShaking/open-tag.js +43 -0
  252. package/dist/pages/TreeShaking/space.d.ts +1 -0
  253. package/dist/pages/TreeShaking/space.js +16 -0
  254. package/dist/pages/TreeShaking/table.d.ts +13 -0
  255. package/dist/pages/TreeShaking/table.js +319 -0
  256. package/dist/pages/TreeShaking/types.d.ts +3 -0
  257. package/dist/pages/TreeShaking/types.js +0 -0
  258. package/dist/pages/TreeShaking/utils.d.ts +7 -0
  259. package/dist/pages/TreeShaking/utils.js +147 -0
  260. package/dist/pages/WebpackLoaders/Analysis/constants.d.ts +3 -0
  261. package/dist/pages/WebpackLoaders/Analysis/constants.js +7 -0
  262. package/dist/pages/WebpackLoaders/Analysis/index.d.ts +3 -0
  263. package/dist/pages/WebpackLoaders/Analysis/index.js +19 -0
  264. package/dist/pages/WebpackLoaders/Overall/constants.d.ts +3 -0
  265. package/dist/pages/WebpackLoaders/Overall/constants.js +7 -0
  266. package/dist/pages/WebpackLoaders/Overall/index.d.ts +3 -0
  267. package/dist/pages/WebpackLoaders/Overall/index.js +11 -0
  268. package/dist/pages/WebpackLoaders/constants.d.ts +2 -0
  269. package/dist/pages/WebpackLoaders/constants.js +6 -0
  270. package/dist/pages/WebpackPlugins/constants.d.ts +3 -0
  271. package/dist/pages/WebpackPlugins/constants.js +7 -0
  272. package/dist/pages/WebpackPlugins/index.d.ts +3 -0
  273. package/dist/pages/WebpackPlugins/index.js +79 -0
  274. package/dist/pages/index.d.ts +9 -0
  275. package/dist/pages/index.js +20 -0
  276. package/dist/utils/data/base.d.ts +24 -0
  277. package/dist/utils/data/base.js +48 -0
  278. package/dist/utils/data/index.d.ts +5 -0
  279. package/dist/utils/data/index.js +44 -0
  280. package/dist/utils/data/local.d.ts +14 -0
  281. package/dist/utils/data/local.js +86 -0
  282. package/dist/utils/data/remote.d.ts +10 -0
  283. package/dist/utils/data/remote.js +52 -0
  284. package/dist/utils/file.d.ts +33 -0
  285. package/dist/utils/file.js +154 -0
  286. package/dist/utils/hooks.d.ts +31 -0
  287. package/dist/utils/hooks.js +216 -0
  288. package/dist/utils/i18n/cn.d.ts +3 -0
  289. package/dist/utils/i18n/cn.js +33 -0
  290. package/dist/utils/i18n/en.d.ts +30 -0
  291. package/dist/utils/i18n/en.js +33 -0
  292. package/dist/utils/i18n/index.d.ts +2 -0
  293. package/dist/utils/i18n/index.js +34 -0
  294. package/dist/utils/index.d.ts +16 -0
  295. package/dist/utils/index.js +16 -0
  296. package/dist/utils/loader.d.ts +7 -0
  297. package/dist/utils/loader.js +34 -0
  298. package/dist/utils/locale.d.ts +2 -0
  299. package/dist/utils/locale.js +9 -0
  300. package/dist/utils/manifest.d.ts +27 -0
  301. package/dist/utils/manifest.js +54 -0
  302. package/dist/utils/monaco.d.ts +12 -0
  303. package/dist/utils/monaco.js +71 -0
  304. package/dist/utils/request.d.ts +27 -0
  305. package/dist/utils/request.js +130 -0
  306. package/dist/utils/routes.d.ts +3 -0
  307. package/dist/utils/routes.js +14 -0
  308. package/dist/utils/size.d.ts +2 -0
  309. package/dist/utils/size.js +24 -0
  310. package/dist/utils/socket.d.ts +2 -0
  311. package/dist/utils/socket.js +21 -0
  312. package/dist/utils/storage.d.ts +13 -0
  313. package/dist/utils/storage.js +70 -0
  314. package/dist/utils/string.d.ts +2 -0
  315. package/dist/utils/string.js +14 -0
  316. package/dist/utils/time.d.ts +3 -0
  317. package/dist/utils/time.js +7 -0
  318. package/dist/utils/url.d.ts +7 -0
  319. package/dist/utils/url.js +75 -0
  320. package/dist/utils/worker/index.d.ts +4 -0
  321. package/dist/utils/worker/index.js +4 -0
  322. package/dist/utils/worker/master.d.ts +8 -0
  323. package/dist/utils/worker/master.js +18 -0
  324. package/dist/utils/worker/types.d.ts +9 -0
  325. package/dist/utils/worker/types.js +0 -0
  326. package/dist/utils/worker/utils.d.ts +7 -0
  327. package/dist/utils/worker/utils.js +29 -0
  328. package/dist/utils/worker/worker.d.ts +13 -0
  329. package/dist/utils/worker/worker.js +38 -0
  330. package/package.json +92 -0
@@ -0,0 +1,69 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import React, { useState } from "react";
3
+ import { Col, Row, Typography, Segmented } from "antd";
4
+ import { DiffOutlined } from "@ant-design/icons";
5
+ import { DiffViewer } from "@rsdoctor/components";
6
+ import { TextDrawer } from "@rsdoctor/components";
7
+ import { Size } from "../../../constants";
8
+ const ViewChangesContent = ({
9
+ file,
10
+ data
11
+ }) => {
12
+ const [group, setGroup] = useState(data[0].group);
13
+ const match = data.find((e) => e.group === group);
14
+ return /* @__PURE__ */ jsxs(
15
+ Row,
16
+ {
17
+ wrap: true,
18
+ gutter: [Size.BasePadding, Size.BasePadding],
19
+ style: { height: "100%" },
20
+ children: [
21
+ data.length > 1 ? /* @__PURE__ */ jsx(Col, { span: 24, children: /* @__PURE__ */ jsx(
22
+ Segmented,
23
+ {
24
+ style: { marginTop: Size.BasePadding },
25
+ value: group,
26
+ options: data.map((e) => e.group),
27
+ onChange: (e) => setGroup(e)
28
+ }
29
+ ) }) : null,
30
+ match ? /* @__PURE__ */ jsxs(React.Fragment, { children: [
31
+ /* @__PURE__ */ jsx(Col, { span: 12, children: /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: match.baselineTitle || "Baseline" }) }),
32
+ /* @__PURE__ */ jsx(Col, { span: 12, children: /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: match.currentTitle || "Current" }) }),
33
+ /* @__PURE__ */ jsx(Col, { span: 24, children: /* @__PURE__ */ jsx(
34
+ DiffViewer,
35
+ {
36
+ filepath: file,
37
+ before: match.baseline || "",
38
+ after: match.current || "",
39
+ editorProps: {
40
+ // eslint-disable-next-line financial/no-float-calculation
41
+ height: Math.floor(window.innerHeight / 1.25)
42
+ }
43
+ }
44
+ ) })
45
+ ] }, group) : null
46
+ ]
47
+ }
48
+ );
49
+ };
50
+ const ViewChanges = ({ text = "View Changes", ...props }) => {
51
+ return /* @__PURE__ */ jsx(
52
+ TextDrawer,
53
+ {
54
+ text,
55
+ buttonProps: {
56
+ size: "small",
57
+ icon: /* @__PURE__ */ jsx(DiffOutlined, {})
58
+ },
59
+ drawerProps: {
60
+ destroyOnClose: true,
61
+ title: `Content diff for "${props.file}"`
62
+ },
63
+ children: /* @__PURE__ */ jsx(ViewChangesContent, { ...props })
64
+ }
65
+ );
66
+ };
67
+ export {
68
+ ViewChanges
69
+ };
@@ -0,0 +1,11 @@
1
+ export declare enum UpdateType {
2
+ New = "New",
3
+ Changed = "Changed",
4
+ Deleted = "Deleted",
5
+ NotChanged = "Not Changed"
6
+ }
7
+ export declare enum SortType {
8
+ Name = "Sorted by Name",
9
+ Size = "Sorted by Size",
10
+ Delta = "Sorted by Delta"
11
+ }
@@ -0,0 +1,17 @@
1
+ var UpdateType = /* @__PURE__ */ ((UpdateType2) => {
2
+ UpdateType2["New"] = "New";
3
+ UpdateType2["Changed"] = "Changed";
4
+ UpdateType2["Deleted"] = "Deleted";
5
+ UpdateType2["NotChanged"] = "Not Changed";
6
+ return UpdateType2;
7
+ })(UpdateType || {});
8
+ var SortType = /* @__PURE__ */ ((SortType2) => {
9
+ SortType2["Name"] = "Sorted by Name";
10
+ SortType2["Size"] = "Sorted by Size";
11
+ SortType2["Delta"] = "Sorted by Delta";
12
+ return SortType2;
13
+ })(SortType || {});
14
+ export {
15
+ SortType,
16
+ UpdateType
17
+ };
@@ -0,0 +1,23 @@
1
+ import { Client } from '@rsdoctor/types';
2
+ import React from 'react';
3
+ export interface DiffCardProps extends Pick<DiffCardContentProps, 'formatter'> {
4
+ titles: Array<string> | [string | React.ReactNode];
5
+ datas: Array<DiffCardContentProps['data']>;
6
+ showPercentInTitle?: boolean;
7
+ }
8
+ export interface DiffCardContentProps {
9
+ data: Client.RsdoctorClientAssetsDiffItem;
10
+ formatter?(v: number, target: 'baseline' | 'current'): number | string | React.ReactNode;
11
+ }
12
+ export interface PercentProps {
13
+ percent: number;
14
+ state: Client.RsdoctorClientDiffState;
15
+ fontSize?: React.CSSProperties['fontSize'];
16
+ }
17
+ export declare const SizePercent: React.FC<{
18
+ baseline: number;
19
+ current: number;
20
+ } & Omit<PercentProps, 'percent' | 'state'>>;
21
+ export declare const Percent: React.FC<PercentProps>;
22
+ export declare const DiffCardContent: React.FC<DiffCardContentProps>;
23
+ export declare const DiffCard: React.FC<DiffCardProps>;
@@ -0,0 +1,114 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Client } from "@rsdoctor/types";
3
+ import { Segmented, Space, Tooltip, Typography } from "antd";
4
+ import { Graph } from "@rsdoctor/utils/common";
5
+ import { useState } from "react";
6
+ import { Color } from "../../../constants";
7
+ import { StatisticCard } from "../../Card";
8
+ import { formatSize } from "../../../utils";
9
+ const SizePercent = ({ baseline, current, ...rest }) => {
10
+ const diff = Graph.diffSize(baseline, current);
11
+ return /* @__PURE__ */ jsx(Percent, { ...rest, ...diff });
12
+ };
13
+ const Percent = ({
14
+ percent,
15
+ state,
16
+ fontSize = 14
17
+ }) => {
18
+ const _percent = +percent.toFixed(2);
19
+ if (_percent > 0) {
20
+ const percentText = `${_percent}`;
21
+ if (state === Client.RsdoctorClientDiffState.Up) {
22
+ return /* @__PURE__ */ jsxs(Typography.Text, { strong: true, style: { fontSize, color: Color.Red }, children: [
23
+ "+",
24
+ percentText,
25
+ "%"
26
+ ] });
27
+ }
28
+ if (state === Client.RsdoctorClientDiffState.Down) {
29
+ return /* @__PURE__ */ jsxs(Typography.Text, { strong: true, style: { fontSize, color: Color.Green }, children: [
30
+ "-",
31
+ percentText,
32
+ "%"
33
+ ] });
34
+ }
35
+ }
36
+ return null;
37
+ };
38
+ const DiffCardContent = ({
39
+ data,
40
+ formatter
41
+ }) => {
42
+ const { percent, state, size } = data;
43
+ const { baseline, current } = size;
44
+ const bSize = formatter ? formatter(baseline, "baseline") : formatSize(baseline);
45
+ const cSize = formatter ? formatter(current, "current") : formatSize(current);
46
+ return /* @__PURE__ */ jsx(Space, { align: "start", children: /* @__PURE__ */ jsxs(Space, { direction: "vertical", style: { textAlign: "left" }, children: [
47
+ /* @__PURE__ */ jsxs(Space, { children: [
48
+ /* @__PURE__ */ jsx(Typography.Text, { style: { fontSize: 10, color: "inherit" }, keyboard: true, children: "Current" }),
49
+ /* @__PURE__ */ jsx(
50
+ Tooltip,
51
+ {
52
+ title: typeof cSize === "number" || typeof cSize === "string" ? `Value of Current is ${cSize}` : void 0,
53
+ children: /* @__PURE__ */ jsx(Typography.Text, { style: { fontSize: 16, color: "inherit" }, strong: true, children: cSize })
54
+ }
55
+ ),
56
+ /* @__PURE__ */ jsx(Percent, { percent, state })
57
+ ] }),
58
+ /* @__PURE__ */ jsxs(Space, { children: [
59
+ /* @__PURE__ */ jsx(Typography.Text, { style: { fontSize: 10, color: "inherit" }, keyboard: true, children: "Baseline" }),
60
+ /* @__PURE__ */ jsx(
61
+ Tooltip,
62
+ {
63
+ title: typeof bSize === "number" || typeof bSize === "string" ? `Value of Baseline is ${bSize}` : void 0,
64
+ children: /* @__PURE__ */ jsx(Typography.Text, { style: { fontSize: 14 }, type: "secondary", children: bSize })
65
+ }
66
+ )
67
+ ] })
68
+ ] }) });
69
+ };
70
+ const DiffCard = ({
71
+ titles,
72
+ datas,
73
+ formatter,
74
+ showPercentInTitle
75
+ }) => {
76
+ const [idx, setIdx] = useState(0);
77
+ return /* @__PURE__ */ jsx(
78
+ StatisticCard,
79
+ {
80
+ title: titles.length > 1 ? /* @__PURE__ */ jsx(
81
+ Segmented,
82
+ {
83
+ defaultValue: titles[idx],
84
+ options: showPercentInTitle ? titles.map((e, i) => {
85
+ const data = datas[i];
86
+ return {
87
+ label: /* @__PURE__ */ jsxs(Space, { children: [
88
+ /* @__PURE__ */ jsx(Typography.Text, { children: e }),
89
+ /* @__PURE__ */ jsx(Percent, { percent: data.percent, state: data.state })
90
+ ] }),
91
+ value: e
92
+ };
93
+ }) : titles,
94
+ onChange: (e) => {
95
+ setIdx(titles.indexOf(e));
96
+ },
97
+ size: "small",
98
+ style: { transition: "transform 0.3s ease" },
99
+ value: titles[idx] || titles[0]
100
+ }
101
+ ) : titles[idx],
102
+ value: /* @__PURE__ */ jsx(DiffCardContent, { data: datas[idx], formatter }),
103
+ statisticProps: {
104
+ style: { textAlign: "left" }
105
+ }
106
+ }
107
+ );
108
+ };
109
+ export {
110
+ DiffCard,
111
+ DiffCardContent,
112
+ Percent,
113
+ SizePercent
114
+ };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { BundleDiffContainerProps } from './types';
3
+ export declare const DiffContainer: React.FC<BundleDiffContainerProps>;
@@ -0,0 +1,180 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import {
3
+ Button,
4
+ Card,
5
+ Divider,
6
+ FloatButton,
7
+ Popconfirm,
8
+ Space,
9
+ Tabs,
10
+ Tooltip,
11
+ Typography
12
+ } from "antd";
13
+ import { useEffect } from "react";
14
+ import { Graph } from "@rsdoctor/utils/common";
15
+ import { InfoCircleOutlined, LogoutOutlined } from "@ant-design/icons";
16
+ import { SDK } from "@rsdoctor/types";
17
+ import { DiffCards } from "./cards";
18
+ import { Overview } from "./overview";
19
+ import { Assets } from "./assets";
20
+ import { Modules } from "./modules";
21
+ import { Packages } from "./packages";
22
+ import { DiffServerAPIProvider } from "../DiffServerAPIProvider";
23
+ import { Size } from "../../../constants";
24
+ const DiffContainer = ({
25
+ manifests
26
+ }) => {
27
+ useEffect(() => {
28
+ console.log("BundleDiff Webpack Manifests: ", manifests);
29
+ }, [manifests]);
30
+ return /* @__PURE__ */ jsx(
31
+ DiffServerAPIProvider,
32
+ {
33
+ api: SDK.ServerAPI.API.GetBundleDiffSummary,
34
+ manifests,
35
+ children: (baselineSummary, currentSummary) => {
36
+ const onlyBaseline = baselineSummary.chunkGraph === currentSummary.chunkGraph;
37
+ const baselineChunkGraph = baselineSummary.chunkGraph;
38
+ const currentChunkGraph = onlyBaseline ? baselineChunkGraph : currentSummary.chunkGraph;
39
+ const assetsDiffResult = Graph.getAssetsDiffResult(
40
+ baselineChunkGraph,
41
+ currentChunkGraph
42
+ );
43
+ return /* @__PURE__ */ jsxs("div", { children: [
44
+ /* @__PURE__ */ jsxs(FloatButton.Group, { children: [
45
+ /* @__PURE__ */ jsx(
46
+ Tooltip,
47
+ {
48
+ placement: "leftBottom",
49
+ title: /* @__PURE__ */ jsx(Space, { direction: "vertical", children: [
50
+ { title: "Baseline", data: baselineSummary },
51
+ { title: "Current", data: currentSummary }
52
+ ].map(({ title, data }) => {
53
+ return /* @__PURE__ */ jsx(Card, { size: "small", children: /* @__PURE__ */ jsxs(Space, { direction: "vertical", children: [
54
+ /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: title }),
55
+ /* @__PURE__ */ jsxs(Space, { style: { fontSize: 10 }, children: [
56
+ /* @__PURE__ */ jsx(
57
+ Typography.Text,
58
+ {
59
+ style: {
60
+ fontSize: "inherit",
61
+ width: 30,
62
+ display: "inline-block"
63
+ },
64
+ children: "Hash"
65
+ }
66
+ ),
67
+ /* @__PURE__ */ jsx(Divider, { type: "vertical" }),
68
+ /* @__PURE__ */ jsx(
69
+ Typography.Text,
70
+ {
71
+ type: "secondary",
72
+ style: { fontSize: "inherit" },
73
+ children: data.hash || "-"
74
+ }
75
+ )
76
+ ] }),
77
+ data.cloudManifestUrl ? /* @__PURE__ */ jsx(
78
+ Button,
79
+ {
80
+ type: "link",
81
+ size: "small",
82
+ style: { padding: 0, fontSize: 10 },
83
+ onClick: () => window.open(data.cloudManifestUrl),
84
+ children: "Open File"
85
+ }
86
+ ) : null
87
+ ] }) }, title);
88
+ }) }),
89
+ children: /* @__PURE__ */ jsx(FloatButton, { icon: /* @__PURE__ */ jsx(InfoCircleOutlined, {}) })
90
+ }
91
+ ),
92
+ /* @__PURE__ */ jsx(
93
+ Popconfirm,
94
+ {
95
+ title: /* @__PURE__ */ jsxs(Typography.Text, { children: [
96
+ "Are you sure to",
97
+ /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: " re-upload " }),
98
+ "json files for bundle diff?"
99
+ ] }),
100
+ onConfirm: () => {
101
+ },
102
+ okText: "Yes",
103
+ cancelText: "Cancel",
104
+ placement: "topLeft",
105
+ trigger: "hover",
106
+ children: /* @__PURE__ */ jsx(FloatButton, { icon: /* @__PURE__ */ jsx(LogoutOutlined, {}) })
107
+ }
108
+ ),
109
+ /* @__PURE__ */ jsx(FloatButton.BackTop, {})
110
+ ] }),
111
+ /* @__PURE__ */ jsx(
112
+ DiffCards,
113
+ {
114
+ baseline: baselineSummary,
115
+ current: currentSummary,
116
+ onlyBaseline,
117
+ assetsDiffResult
118
+ }
119
+ ),
120
+ /* @__PURE__ */ jsx(
121
+ Tabs,
122
+ {
123
+ defaultActiveKey: "Overview",
124
+ tabBarStyle: { marginBottom: Size.BasePadding / 3 },
125
+ items: [
126
+ {
127
+ label: "Overview",
128
+ key: "Overview",
129
+ children: /* @__PURE__ */ jsx(Overview, { assetsDiffResult })
130
+ },
131
+ {
132
+ label: "Assets",
133
+ key: "Assets",
134
+ children: /* @__PURE__ */ jsx(
135
+ Assets,
136
+ {
137
+ outputFilename: baselineSummary.outputFilename,
138
+ baseline: baselineSummary,
139
+ current: currentSummary
140
+ }
141
+ )
142
+ },
143
+ {
144
+ label: "Modules",
145
+ key: "Modules",
146
+ children: /* @__PURE__ */ jsx(
147
+ Modules,
148
+ {
149
+ baseline: baselineSummary,
150
+ current: currentSummary,
151
+ onlyBaseline,
152
+ assetsDiffResult
153
+ }
154
+ )
155
+ },
156
+ {
157
+ label: "Packages",
158
+ key: "Packages",
159
+ children: /* @__PURE__ */ jsx(
160
+ Packages,
161
+ {
162
+ baseline: baselineSummary.packageGraph,
163
+ current: currentSummary.packageGraph
164
+ }
165
+ )
166
+ }
167
+ ].map((el) => ({
168
+ ...el,
169
+ label: /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: el.label })
170
+ }))
171
+ }
172
+ )
173
+ ] });
174
+ }
175
+ }
176
+ );
177
+ };
178
+ export {
179
+ DiffContainer
180
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { BundleDiffComponentCardProps, BundleDiffTableModulesData } from './types';
3
+ import { UpdateType } from './constants';
4
+ export declare function getUpdateType(e: BundleDiffTableModulesData): UpdateType;
5
+ export declare const FileUpdateTypeTag: React.FC<{
6
+ type: UpdateType;
7
+ }>;
8
+ export declare const Modules: React.FC<BundleDiffComponentCardProps>;