@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-present Bytedance, Inc. and its affiliates.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # Rsdoctor
2
+
3
+ Rsdoctor is a tool for diagnosing and analyzing the build process and build artifacts to help developers quickly identify and solve problems.
4
+
5
+ It also supports Webpack and Rspack builders, as well as various build frameworks, such as Rsbuild.
6
+
7
+ ## Documentation
8
+
9
+ ## Contributing
10
+
11
+ Please read the [Contributing Guide](https://github.com/web-infra-dev/rsdoctor/blob/main/CONTRIBUTING.md).
12
+
13
+ ## License
14
+
15
+ Rsdoctor is [MIT licensed](https://github.com/web-infra-dev/rsdoctor/blob/main/LICENSE).
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5 24L43 24" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M28 4H20C18.8954 4 18 4.89543 18 6V14C18 15.1046 18.8954 16 20 16H28C29.1046 16 30 15.1046 30 14V6C30 4.89543 29.1046 4 28 4Z" fill="none" stroke="#333" stroke-width="4" stroke-linejoin="round"/><path d="M16 32H8C6.89543 32 6 32.8954 6 34V42C6 43.1046 6.89543 44 8 44H16C17.1046 44 18 43.1046 18 42V34C18 32.8954 17.1046 32 16 32Z" fill="none" stroke="#333" stroke-width="4" stroke-linejoin="round"/><path d="M40 32H32C30.8954 32 30 32.8954 30 34V42C30 43.1046 30.8954 44 32 44H40C41.1046 44 42 43.1046 42 42V34C42 32.8954 41.1046 32 40 32Z" fill="none" stroke="#333" stroke-width="4" stroke-linejoin="round"/><path d="M24 24V16" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M36 32V24" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 32V24" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg>
@@ -0,0 +1,21 @@
1
+ <svg width="106.000000" height="113.000000" viewBox="0 0 106 113" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
+ <rect id="画板 934" width="106.000000" height="113.000000" fill="#FFFFFF" fill-opacity="0.035"/>
3
+ <g clip-path="url(#clip111_45)">
4
+ <rect id="矩形 2176" x="22.500000" y="10.500000" rx="3.000000" width="6.000000" height="11.000000" fill="#0F0D0D"/>
5
+ <rect id="矩形 2176" x="22.500000" y="10.500000" rx="3.000000" width="6.000000" height="11.000000" fill="#736C6C"/>
6
+ <rect id="矩形 2176" x="22.500000" y="10.500000" rx="3.000000" width="6.000000" height="11.000000" stroke="#000000" stroke-linejoin="bevel"/>
7
+ <rect id="矩形 2176" x="49.500000" y="10.500000" rx="3.000000" width="6.000000" height="11.000000" fill="#0F0D0D"/>
8
+ <rect id="矩形 2176" x="49.500000" y="10.500000" rx="3.000000" width="6.000000" height="11.000000" fill="#736C6C"/>
9
+ <rect id="矩形 2176" x="49.500000" y="10.500000" rx="3.000000" width="6.000000" height="11.000000" stroke="#000000" stroke-linejoin="bevel"/>
10
+ <path id="矢量 943" d="M24.0938 15.8218C24.0938 15.8218 14 11.3477 14 23.2773C14 35.207 26.1123 70 26.1123 70L41 70" stroke="#000000" stroke-width="5.000000"/>
11
+ <path id="矢量 943" d="M53.9062 15.8218C53.9062 15.8218 64 11.3477 64 23.2773C64 35.207 51.8877 70 51.8877 70L37 70" stroke="#000000" stroke-width="5.000000"/>
12
+ <path id="矢量 945" d="M40 83.0723C40 94.0781 48.9219 103 59.9277 103L70 103C81.0459 103 90 94.0459 90 83L90 48" stroke="#000000" stroke-width="5.000000"/>
13
+ <ellipse id="椭圆 54" cx="90.000000" cy="41.500000" rx="11.000000" ry="8.500000" fill="#5092FF"/>
14
+ <path id="矢量 946" d="M27 72C31.9609 80.7266 34.5361 81.2817 39.4443 80.9219C44.7744 81.2124 47.4326 79.7798 51 72" stroke="#000000" stroke-width="5.000000"/>
15
+ </g>
16
+ <defs>
17
+ <clipPath id="clip111_45">
18
+ <rect id="画板 934" width="106.000000" height="113.000000" fill="white"/>
19
+ </clipPath>
20
+ </defs>
21
+ </svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1200 1200" xmlns="http://www.w3.org/2000/svg"><path d="m600 0 530.3 300v600l-530.3 300-530.3-300v-600z" fill="#fff"/><path d="m1035.6 879.3-418.1 236.5v-184.2l260.5-143.3zm28.6-25.9v-494.6l-153 88.3v317.9zm-901.5 25.9 418.1 236.5v-184.2l-260.5-143.3zm-28.6-25.9v-494.6l153 88.3v317.9zm17.9-526.6 428.8-242.6v178.1l-274.7 151.1-2.1 1.2zm894.3 0-428.8-242.6v178.1l274.7 151.1 2.1 1.2z" fill="#8ed6fb"/><path d="m580.8 889.7-257-141.3v-280l257 148.4zm36.7 0 257-141.3v-280l-257 148.4zm-276.3-453.7 258-141.9 258 141.9-258 149z" fill="#1c78c0"/></svg>
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { CodeChangeAlertProps } from './types';
3
+ interface FixedProps {
4
+ setIsFixed(val: boolean): void;
5
+ }
6
+ export declare const CodeChangeDrawerContent: React.FC<CodeChangeAlertProps & FixedProps>;
7
+ export declare const CodeChangeAlert: React.FC<CodeChangeAlertProps>;
8
+ export {};
@@ -0,0 +1,94 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import axios from "axios";
4
+ import { Space, Alert, Button, Typography, Divider, Popconfirm, Row, Col } from "antd";
5
+ import { InfoCircleOutlined, CheckOutlined } from "@ant-design/icons";
6
+ import { SDK } from "@rsdoctor/types";
7
+ import { useRuleIndexNavigate } from "../../utils";
8
+ import { TextDrawer } from "../TextDrawer";
9
+ import { Title } from "../Title";
10
+ import { CodeOpener } from "../Opener";
11
+ import { DiffViewer } from "../CodeViewer";
12
+ const CodeChangeDrawerContent = ({ data, setIsFixed, cwd }) => {
13
+ const { file, id } = data;
14
+ const { path, line, isFixed, actual, expected } = file;
15
+ const applyFix = () => {
16
+ axios.post(SDK.ServerAPI.API.ApplyErrorFix, { id }).then(() => {
17
+ setIsFixed(true);
18
+ });
19
+ };
20
+ const FixButton = () => {
21
+ return /* @__PURE__ */ jsx(
22
+ Popconfirm,
23
+ {
24
+ title: `Did you confirm to apply the change i the area below ?`,
25
+ onConfirm: applyFix,
26
+ okText: "Yes",
27
+ cancelText: "Cancel",
28
+ zIndex: 99999,
29
+ disabled: isFixed,
30
+ placement: "bottom",
31
+ children: /* @__PURE__ */ jsx(Button, { type: "primary", size: "small", icon: isFixed ? /* @__PURE__ */ jsx(CheckOutlined, {}) : void 0, disabled: isFixed, children: isFixed ? "Fix Applied" : "Apply Fix" })
32
+ }
33
+ );
34
+ };
35
+ return /* @__PURE__ */ jsxs(Space, { direction: "vertical", className: "alert-space", children: [
36
+ /* @__PURE__ */ jsxs("div", { children: [
37
+ /* @__PURE__ */ jsx(Title, { text: isFixed ? "Fix History" : "Suggest Fix" }),
38
+ /* @__PURE__ */ jsx("span", { className: "code-change-tag-list", children: /* @__PURE__ */ jsx(FixButton, {}) })
39
+ ] }),
40
+ /* @__PURE__ */ jsx(CodeOpener, { cwd, url: path, loc: String(line), code: true, disabled: true }),
41
+ /* @__PURE__ */ jsxs(Row, { children: [
42
+ /* @__PURE__ */ jsx(Col, { span: 12, children: /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: "Before" }) }),
43
+ /* @__PURE__ */ jsx(Col, { span: 12, children: /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: "After" }) })
44
+ ] }),
45
+ /* @__PURE__ */ jsx(DiffViewer, { className: "full-space", filepath: path, before: actual, after: expected })
46
+ ] });
47
+ };
48
+ const CodeChangeAlert = ({ data, cwd }) => {
49
+ var _a;
50
+ const { title, description = "", level, code, file } = data;
51
+ const [isFixed, setIsFixed] = useState((_a = file.isFixed) != null ? _a : false);
52
+ const navigate = useRuleIndexNavigate(code, data.link);
53
+ const fixFile = (val) => {
54
+ setIsFixed(val);
55
+ file.isFixed = val;
56
+ };
57
+ const Description = /* @__PURE__ */ jsxs(Space, { direction: "vertical", children: [
58
+ /* @__PURE__ */ jsx(Typography.Text, { children: description }),
59
+ /* @__PURE__ */ jsxs(Space, { children: [
60
+ /* @__PURE__ */ jsx(Typography.Text, { children: "File:" }),
61
+ /* @__PURE__ */ jsx(Typography.Text, { strong: true, code: true, children: file.path }),
62
+ /* @__PURE__ */ jsx(Typography.Text, { children: "in line" }),
63
+ /* @__PURE__ */ jsx(Typography.Text, { strong: true, code: true, children: file.line })
64
+ ] })
65
+ ] });
66
+ return /* @__PURE__ */ jsx(
67
+ Alert,
68
+ {
69
+ showIcon: true,
70
+ message: /* @__PURE__ */ jsxs(Space, { children: [
71
+ /* @__PURE__ */ jsx(Typography.Text, { code: true, strong: true, onClick: navigate, style: { cursor: "pointer" }, children: /* @__PURE__ */ jsx("a", { children: code }) }),
72
+ /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: title })
73
+ ] }),
74
+ description: Description,
75
+ type: isFixed ? "success" : level === "warn" ? "warning" : level,
76
+ action: /* @__PURE__ */ jsxs(Space, { children: [
77
+ /* @__PURE__ */ jsx(
78
+ TextDrawer,
79
+ {
80
+ text: isFixed ? "Fixed | Show Fix History" : "Show Fix Suggestion",
81
+ buttonProps: { size: "small" },
82
+ children: /* @__PURE__ */ jsx(CodeChangeDrawerContent, { data, setIsFixed: fixFile, cwd })
83
+ }
84
+ ),
85
+ /* @__PURE__ */ jsx(Divider, { type: "vertical" }),
86
+ /* @__PURE__ */ jsx(Button, { type: "link", onClick: navigate, size: "small", children: /* @__PURE__ */ jsx(InfoCircleOutlined, {}) })
87
+ ] })
88
+ }
89
+ );
90
+ };
91
+ export {
92
+ CodeChangeAlert,
93
+ CodeChangeDrawerContent
94
+ };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { FileRelationAlertProps } from './types';
3
+ export declare const FileRelationAlert: React.FC<FileRelationAlertProps>;
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Alert } from "antd";
3
+ const FileRelationAlert = ({ data }) => {
4
+ const { description = "", level } = data;
5
+ return /* @__PURE__ */ jsx(Alert, { type: level === "warn" ? "warning" : level, description });
6
+ };
7
+ export {
8
+ FileRelationAlert
9
+ };
@@ -0,0 +1,29 @@
1
+ .file-inline-decoration {
2
+ cursor: pointer;
3
+ text-decoration: underline;
4
+ background: rgb(77, 112, 151);
5
+ }
6
+ .alert-space,
7
+ .full-space {
8
+ width: 100%;
9
+ height: 100%;
10
+ }
11
+ .alert-space > *:last-child,
12
+ .full-space > *:last-child {
13
+ flex-grow: 1;
14
+ }
15
+ .full-space {
16
+ flex-grow: 1;
17
+ }
18
+ .code-change-tag-list {
19
+ margin-left: 10px;
20
+ }
21
+ .tabs-space {
22
+ width: 100%;
23
+ height: 100%;
24
+ }
25
+ .tabs-space .ant-tabs-content,
26
+ .tabs-space .ant-tabs-tabpane {
27
+ width: 100%;
28
+ height: 100%;
29
+ }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { AlertProps } from './types';
3
+ import './index.sass';
4
+ export declare const Alert: React.FC<AlertProps>;
@@ -0,0 +1,37 @@
1
+ import { Fragment, jsx } from "react/jsx-runtime";
2
+ import { LinkRuleAlert } from "./link";
3
+ import { FileRelationAlert } from "./file-relation";
4
+ import { PackageRelationAlert } from "./package-relation";
5
+ import { CodeChangeAlert } from "./change";
6
+ import { CodeViewAlert } from "./view";
7
+ import "./index.css";
8
+ const Alert = (props) => {
9
+ const { data, cwd = "" } = props;
10
+ if (data.type === "file-relation") {
11
+ return /* @__PURE__ */ jsx(FileRelationAlert, { data });
12
+ }
13
+ if (data.type === "code-view") {
14
+ return /* @__PURE__ */ jsx(CodeViewAlert, { data, cwd });
15
+ }
16
+ if (data.type === "code-change") {
17
+ return /* @__PURE__ */ jsx(CodeChangeAlert, { data, cwd });
18
+ }
19
+ if (data.type === "emo") {
20
+ return /* @__PURE__ */ jsx(Fragment, {});
21
+ }
22
+ if (data.type === "package-relation") {
23
+ const { getPackageRelationContentComponent } = props;
24
+ return /* @__PURE__ */ jsx(
25
+ PackageRelationAlert,
26
+ {
27
+ data,
28
+ cwd,
29
+ getPackageRelationContentComponent
30
+ }
31
+ );
32
+ }
33
+ return /* @__PURE__ */ jsx(LinkRuleAlert, { data });
34
+ };
35
+ export {
36
+ Alert
37
+ };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { LinkAlertProps } from './types';
3
+ export declare const LinkRuleAlert: React.FC<LinkAlertProps>;
@@ -0,0 +1,27 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Alert, Button, Space, Typography } from "antd";
3
+ import { InfoCircleOutlined } from "@ant-design/icons";
4
+ import { useRuleIndexNavigate } from "../../utils";
5
+ const LinkRuleAlert = ({ data }) => {
6
+ const { title, description = "", level, code } = data;
7
+ const navigate = useRuleIndexNavigate(code, data.link);
8
+ return /* @__PURE__ */ jsx(
9
+ Alert,
10
+ {
11
+ showIcon: true,
12
+ message: /* @__PURE__ */ jsxs(Space, { children: [
13
+ /* @__PURE__ */ jsx(Typography.Text, { code: true, strong: true, onClick: navigate, style: { cursor: "pointer" }, children: /* @__PURE__ */ jsx("a", { children: code }) }),
14
+ /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: title })
15
+ ] }),
16
+ description: /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: description } }),
17
+ type: level === "warn" ? "warning" : level,
18
+ action: /* @__PURE__ */ jsxs(Button, { type: "link", onClick: navigate, size: "small", children: [
19
+ "More",
20
+ /* @__PURE__ */ jsx(InfoCircleOutlined, {})
21
+ ] })
22
+ }
23
+ );
24
+ };
25
+ export {
26
+ LinkRuleAlert
27
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { SDK } from '@rsdoctor/types';
3
+ import { PackageRelationAlertProps } from './types';
4
+ export declare const PackageRelationReasons: React.FC<{
5
+ data: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPackageRelationAlertDetails>;
6
+ cwd: string;
7
+ }>;
8
+ export declare const PackageRelationReasonsWithServer: React.FC<Omit<{
9
+ data: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPackageRelationAlertDetails>;
10
+ cwd: string;
11
+ }, "data"> & Partial<{
12
+ body: {
13
+ id: string | number;
14
+ target: SDK.PackageBasicData;
15
+ };
16
+ }>>;
17
+ export declare const PackageRelationAlert: React.FC<PackageRelationAlertProps>;
@@ -0,0 +1,206 @@
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
+ import { jsx, jsxs } from "react/jsx-runtime";
21
+ import { createElement } from "react";
22
+ import React, { useState } from "react";
23
+ import { Space, Alert, Button, Typography, Divider, Tabs, Row, Col, Timeline, Card, Tag, Empty, Popover } from "antd";
24
+ import { sumBy } from "lodash-es";
25
+ import { Rule, SDK } from "@rsdoctor/types";
26
+ import { ExpandAltOutlined, InfoCircleOutlined } from "@ant-design/icons";
27
+ import { useRuleIndexNavigate, formatSize, useI18n } from "../../utils";
28
+ import { TextDrawer } from "../TextDrawer";
29
+ import { Title } from "../Title";
30
+ import { Size, Color } from "../../constants";
31
+ import { Badge as Bdg } from "../Badge";
32
+ import { FileHightLightViewer } from "../CodeViewer";
33
+ import { withServerAPI } from "../Manifest";
34
+ const PackageRelationReasons = ({ data, cwd }) => {
35
+ const [index, setIndex] = useState(0);
36
+ const { t } = useI18n();
37
+ return /* @__PURE__ */ jsxs(Row, { gutter: Size.BasePadding, wrap: false, align: "top", children: [
38
+ /* @__PURE__ */ jsx(Col, { span: 12, style: { height: "100%" }, children: /* @__PURE__ */ jsx(
39
+ Card,
40
+ {
41
+ title: `The reasons for importing this version`,
42
+ style: { height: "100%" },
43
+ extra: /* @__PURE__ */ jsx(Popover, { content: /* @__PURE__ */ jsx(Typography.Text, { children: t("DuplicatePakCodeExplain") }), children: /* @__PURE__ */ jsx("a", { href: "#", children: "Explain" }) }),
44
+ bodyStyle: { overflow: "scroll" },
45
+ children: data.length ? /* @__PURE__ */ jsxs(React.Fragment, { children: [
46
+ /* @__PURE__ */ jsx("div", { style: { marginBottom: Size.BasePadding }, children: /* @__PURE__ */ jsx(Typography.Text, { type: "secondary", strong: true, children: "Click the file path below to show the reason in code viewer." }) }),
47
+ /* @__PURE__ */ jsx(Timeline, { children: data.map((e, i) => {
48
+ const { dependency, module, relativePath } = e;
49
+ const { statements } = dependency;
50
+ const { start } = module.isPreferSource ? statements[0].position.source : statements[0].position.transformed;
51
+ const text = `${relativePath}:${start.line}:${start.column || 1}`;
52
+ return /* @__PURE__ */ jsx(
53
+ Timeline.Item,
54
+ {
55
+ style: { cursor: "pointer" },
56
+ dot: i === data.length - 1 ? void 0 : "⬇️",
57
+ children: /* @__PURE__ */ jsx(
58
+ Typography.Text,
59
+ {
60
+ copyable: { text: relativePath },
61
+ onClick: (e2) => {
62
+ e2.preventDefault();
63
+ e2.stopPropagation();
64
+ setIndex(i);
65
+ },
66
+ strong: i === index,
67
+ style: { color: i === index ? Color.Blue : "inherit", display: "block" },
68
+ children: text
69
+ }
70
+ )
71
+ },
72
+ text
73
+ );
74
+ }) })
75
+ ] }) : /* @__PURE__ */ jsx(Empty, { description: "This package no dependencies" })
76
+ }
77
+ ) }),
78
+ /* @__PURE__ */ jsx(Col, { span: 12, style: { height: "100%" }, children: /* @__PURE__ */ createElement(FileHightLightViewer, __spreadProps(__spreadValues({}, data[index]), { key: index, cwd })) })
79
+ ] });
80
+ };
81
+ const PackageRelationReasonsWithServer = withServerAPI({
82
+ Component: PackageRelationReasons,
83
+ api: SDK.ServerAPI.API.GetPackageRelationAlertDetails,
84
+ responsePropName: "data"
85
+ });
86
+ const PackageRelationAlert = ({
87
+ data,
88
+ getPackageRelationContentComponent
89
+ }) => {
90
+ var _a;
91
+ const { level, code, packages } = data;
92
+ const navigate = useRuleIndexNavigate(code, data.link);
93
+ const totalSize = sumBy(packages, (e) => e.targetSize.sourceSize);
94
+ const totalSizeStr = formatSize(totalSize);
95
+ const { name } = packages.find((e) => !!e.target.name).target;
96
+ const versions = packages.map((item) => item.target.version);
97
+ return /* @__PURE__ */ jsx(
98
+ Alert,
99
+ {
100
+ showIcon: true,
101
+ message: /* @__PURE__ */ jsxs(Space, { children: [
102
+ /* @__PURE__ */ jsx(Typography.Text, { code: true, strong: true, onClick: navigate, style: { cursor: "pointer" }, children: /* @__PURE__ */ jsx("a", { children: code }) }),
103
+ /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: ((_a = Rule.RuleErrorMap[code]) == null ? void 0 : _a.title) || data.title }),
104
+ /* @__PURE__ */ jsx(Divider, { type: "vertical" }),
105
+ /* @__PURE__ */ jsxs(Typography.Text, { children: [
106
+ /* @__PURE__ */ jsx(Typography.Text, { strong: true, code: true, children: name }),
107
+ /* @__PURE__ */ jsxs(Typography.Text, { strong: true, children: [
108
+ " ",
109
+ data.packages.length
110
+ ] }),
111
+ /* @__PURE__ */ jsx(Typography.Text, { children: " versions was found" })
112
+ ] }),
113
+ /* @__PURE__ */ jsx(Divider, { type: "vertical" }),
114
+ /* @__PURE__ */ jsx(
115
+ Bdg,
116
+ {
117
+ label: "total size",
118
+ value: totalSizeStr,
119
+ type: "error",
120
+ tooltip: `total size of ${data.packages.length} versions is ${totalSizeStr}`
121
+ }
122
+ )
123
+ ] }),
124
+ description: /* @__PURE__ */ jsx(Space, { direction: "vertical", wrap: false, children: data.packages.map(({ target: el, targetSize: size }) => {
125
+ const sizeStr = formatSize(size.sourceSize);
126
+ const parsedSizeStr = size.parsedSize ? formatSize(size.parsedSize) : null;
127
+ const name2 = `${el.name}@${el.version}`;
128
+ return /* @__PURE__ */ jsxs(Space, { style: { wordBreak: "break-all" }, align: "center", children: [
129
+ /* @__PURE__ */ jsx(Typography.Text, { style: { marginLeft: 4 }, children: "└" }),
130
+ /* @__PURE__ */ jsx(Bdg, { label: el.name, value: `v${el.version}`, tooltip: name2 }),
131
+ /* @__PURE__ */ jsx(Divider, { type: "vertical" }),
132
+ /* @__PURE__ */ jsx(
133
+ Bdg,
134
+ {
135
+ label: /* @__PURE__ */ jsxs("div", { color: "rgb(255, 255, 255)", children: [
136
+ "Source Size ",
137
+ /* @__PURE__ */ jsx(InfoCircleOutlined, {})
138
+ ] }),
139
+ value: sizeStr,
140
+ tooltip: `The bundle size of "${name2}" is ${sizeStr}, this is source size.`,
141
+ type: "error"
142
+ }
143
+ ),
144
+ /* @__PURE__ */ jsx(
145
+ Bdg,
146
+ {
147
+ label: "Bundled size",
148
+ value: parsedSizeStr || "CONCATENATED",
149
+ tooltip: `The bundle size of "${name2}" is ${sizeStr}, this is after bundled, concatenated module cannot get bundled size. `,
150
+ type: "error"
151
+ }
152
+ ),
153
+ /* @__PURE__ */ jsx(Divider, { type: "vertical" }),
154
+ /* @__PURE__ */ jsx(
155
+ Typography.Paragraph,
156
+ {
157
+ style: { marginBottom: 0 },
158
+ copyable: { text: el.root },
159
+ ellipsis: { rows: 2, expandable: true, symbol: /* @__PURE__ */ jsx(ExpandAltOutlined, {}), tooltip: el.root },
160
+ code: true,
161
+ children: el.root
162
+ }
163
+ )
164
+ ] }, el.version);
165
+ }) }),
166
+ type: level === "warn" ? "warning" : level,
167
+ action: /* @__PURE__ */ jsxs(React.Fragment, { children: [
168
+ packages && packages.length > 0 ? /* @__PURE__ */ jsx(TextDrawer, { text: "Show Relations", buttonProps: { size: "small" }, drawerProps: { title: data.title }, children: /* @__PURE__ */ jsxs(Space, { direction: "vertical", className: "alert-space", children: [
169
+ /* @__PURE__ */ jsxs(Space, { style: { marginBottom: Size.BasePadding / 2 }, children: [
170
+ /* @__PURE__ */ jsx(Title, { text: name, upperFisrt: false }),
171
+ /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: versions.length }),
172
+ /* @__PURE__ */ jsx(Typography.Text, { children: " versions was found: " }),
173
+ versions.map((e) => /* @__PURE__ */ jsx(Typography.Text, { strong: true, code: true, children: e }, e))
174
+ ] }),
175
+ /* @__PURE__ */ jsx(
176
+ Tabs,
177
+ {
178
+ type: "card",
179
+ size: "middle",
180
+ className: "tabs-space",
181
+ defaultActiveKey: versions[0],
182
+ items: packages.map((pkg) => {
183
+ const { target, targetSize } = pkg;
184
+ return {
185
+ label: /* @__PURE__ */ jsxs(Space, { children: [
186
+ /* @__PURE__ */ jsx(Typography.Text, { children: `${name}@${target.version}` }),
187
+ /* @__PURE__ */ jsx(Tag, { color: Color.Red, children: formatSize(targetSize.sourceSize) })
188
+ ] }),
189
+ key: `${target.root}${target.name}${target.version}`,
190
+ children: getPackageRelationContentComponent({ data, package: pkg })
191
+ };
192
+ })
193
+ }
194
+ )
195
+ ] }) }) : null,
196
+ /* @__PURE__ */ jsx(Divider, { type: "vertical" }),
197
+ /* @__PURE__ */ jsx(Button, { type: "link", onClick: navigate, size: "small", icon: /* @__PURE__ */ jsx(InfoCircleOutlined, {}) })
198
+ ] })
199
+ }
200
+ );
201
+ };
202
+ export {
203
+ PackageRelationAlert,
204
+ PackageRelationReasons,
205
+ PackageRelationReasonsWithServer
206
+ };
@@ -0,0 +1,31 @@
1
+ import { Rule } from '@rsdoctor/types';
2
+ import React from 'react';
3
+ export interface AlertProps extends Omit<PackageRelationAlertProps, 'data'> {
4
+ data: Rule.RuleStoreDataItem;
5
+ cwd: string;
6
+ }
7
+ export interface PackageRelationAlertProps {
8
+ data: Rule.PackageRelationDiffRuleStoreData;
9
+ getPackageRelationContentComponent: React.FC<{
10
+ data: Rule.PackageRelationDiffRuleStoreData;
11
+ package: Rule.PackageRelationData;
12
+ }>;
13
+ cwd: string;
14
+ }
15
+ export interface FileRelationAlertProps {
16
+ data: Rule.FileRelationRuleStoreData;
17
+ }
18
+ export interface CodeChangeAlertProps {
19
+ data: Rule.CodeChangeRuleStoreData;
20
+ cwd: string;
21
+ }
22
+ export interface CodeViewAlertProps {
23
+ data: Rule.CodeViewRuleStoreData;
24
+ cwd: string;
25
+ }
26
+ export interface LinkAlertProps {
27
+ data: Rule.LinkRuleStoreData;
28
+ }
29
+ export interface EMOAlertProps {
30
+ data: Rule.EMORuleStoreData;
31
+ }
File without changes
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { CodeViewAlertProps } from './types';
3
+ export declare const CodeViewDrawerContent: React.FC<CodeViewAlertProps>;
4
+ export declare const CodeViewAlert: React.FC<CodeViewAlertProps>;
@@ -0,0 +1,59 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { isNumber } from "lodash-es";
3
+ import { Space, Alert, Button, Typography, Divider } from "antd";
4
+ import { InfoCircleOutlined } from "@ant-design/icons";
5
+ import { useRuleIndexNavigate } from "../../utils";
6
+ import { TextDrawer } from "../TextDrawer";
7
+ import { Title } from "../Title";
8
+ import { CodeOpener } from "../Opener";
9
+ import { CodeViewer } from "../CodeViewer";
10
+ const CodeViewDrawerContent = ({ data, cwd }) => {
11
+ const { file } = data;
12
+ const { path, ranges } = file;
13
+ const line = ranges == null ? void 0 : ranges[0].start.line;
14
+ return /* @__PURE__ */ jsxs(Space, { direction: "vertical", className: "alert-space", children: [
15
+ /* @__PURE__ */ jsx(Title, { text: "Code Viewer" }),
16
+ /* @__PURE__ */ jsx(CodeOpener, { cwd, url: path, loc: isNumber(line) ? String(line) : void 0, code: true, disabled: true }),
17
+ /* @__PURE__ */ jsx(CodeViewer, { path: file.path, content: file.content, ranges, defaultLine: line })
18
+ ] });
19
+ };
20
+ const CodeViewAlert = ({ data, cwd }) => {
21
+ var _a;
22
+ const { title, description = "", level, code, file } = data;
23
+ const navigate = useRuleIndexNavigate(code, data.link);
24
+ const startLine = (_a = file.ranges) == null ? void 0 : _a[0].start.line;
25
+ const Description = /* @__PURE__ */ jsxs(Space, { direction: "vertical", children: [
26
+ /* @__PURE__ */ jsx(Typography.Text, { children: description }),
27
+ /* @__PURE__ */ jsxs(Space, { children: [
28
+ /* @__PURE__ */ jsx(Typography.Text, { children: "File:" }),
29
+ /* @__PURE__ */ jsx(Typography.Text, { strong: true, code: true, children: file.path }),
30
+ isNumber(startLine) ? /* @__PURE__ */ jsxs(Fragment, { children: [
31
+ /* @__PURE__ */ jsx(Typography.Text, { children: "in line" }),
32
+ /* @__PURE__ */ jsx(Typography.Text, { strong: true, code: true, children: startLine })
33
+ ] }) : ""
34
+ ] })
35
+ ] });
36
+ return /* @__PURE__ */ jsx(
37
+ Alert,
38
+ {
39
+ showIcon: true,
40
+ message: /* @__PURE__ */ jsxs(Space, { children: [
41
+ /* @__PURE__ */ jsx(Typography.Text, { code: true, strong: true, onClick: navigate, style: { cursor: "pointer" }, children: /* @__PURE__ */ jsx("a", { children: code }) }),
42
+ /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: title })
43
+ ] }),
44
+ description: Description,
45
+ type: level === "warn" ? "warning" : level,
46
+ action: /* @__PURE__ */ jsxs(Space, { children: [
47
+ /* @__PURE__ */ jsx(TextDrawer, { text: "Show Source Code", buttonProps: { size: "small" }, children: /* @__PURE__ */ jsx(CodeViewDrawerContent, { data, cwd }) }),
48
+ /* @__PURE__ */ jsxs(Fragment, { children: [
49
+ /* @__PURE__ */ jsx(Divider, { type: "vertical" }),
50
+ /* @__PURE__ */ jsx(Button, { type: "link", onClick: navigate, size: "small", icon: /* @__PURE__ */ jsx(InfoCircleOutlined, {}) })
51
+ ] })
52
+ ] })
53
+ }
54
+ );
55
+ };
56
+ export {
57
+ CodeViewAlert,
58
+ CodeViewDrawerContent
59
+ };
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Rule, SDK } from '@rsdoctor/types';
3
+ interface BundleAlertsProps {
4
+ filter?(alert: Rule.RuleStoreDataItem): boolean;
5
+ project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
6
+ }
7
+ export declare const BundleAlertsBase: React.FC<BundleAlertsProps>;
8
+ export declare const BundleAlerts: React.FC<Omit<BundleAlertsProps, "project"> & Partial<{
9
+ body?: any;
10
+ }>>;
11
+ export {};