@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,62 @@
1
+ .loader-tooltip-container {
2
+ white-space: normal;
3
+ word-wrap: break-word;
4
+ word-break: break-all;
5
+ min-width: 300px;
6
+ max-width: 400px;
7
+ padding: 12px;
8
+ }
9
+ .loader-tooltip-title {
10
+ font-size: 16px;
11
+ font-weight: 500;
12
+ padding-bottom: 4px;
13
+ display: block;
14
+ }
15
+ .loader-tooltip-description {
16
+ font-size: 14px;
17
+ padding-bottom: 4px;
18
+ display: block;
19
+ color: rgba(0, 0, 0, 0.4);
20
+ }
21
+ .loader-tooltip-item {
22
+ font-size: 12px;
23
+ font-weight: 400;
24
+ display: block;
25
+ list-style: none;
26
+ margin-top: 4px;
27
+ white-space: nowrap;
28
+ display: flex;
29
+ justify-content: flex-start;
30
+ align-items: baseline;
31
+ }
32
+ .loader-tooltip-item::before {
33
+ content: " ";
34
+ display: block;
35
+ width: 4px;
36
+ height: 4px;
37
+ border-radius: 50%;
38
+ background: #1677ff;
39
+ margin-right: 4px;
40
+ }
41
+ .loader-tooltip-item span {
42
+ display: inline-block;
43
+ word-break: break-all;
44
+ white-space: pre-wrap;
45
+ }
46
+ .loader-tooltip-item span:first-child {
47
+ margin: 0 0.2em;
48
+ padding: 1px 4px;
49
+ font-size: 90%;
50
+ background: rgba(150, 150, 150, 0.1);
51
+ border: 1px solid rgba(100, 100, 100, 0.2);
52
+ border-radius: 3px;
53
+ font-weight: 600;
54
+ font-family: monospace;
55
+ }
56
+ .loader-tooltip-item span:last-child {
57
+ flex: 1 1;
58
+ padding-left: 4px;
59
+ }
60
+ .loader-tooltip-textbold {
61
+ font-weight: 500;
62
+ }
@@ -0,0 +1,61 @@
1
+ import { SDK } from "@rsdoctor/types";
2
+ export interface ChartProps {
3
+ loaders: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderChartData>;
4
+ cwd: string;
5
+ }
6
+ export interface CommonMetricPart<T extends string = string> {
7
+ _n?: boolean;
8
+ _c?: string;
9
+ p: string;
10
+ n: T;
11
+ ext?: unknown;
12
+ }
13
+ export declare type Metric = DurationMetric;
14
+ export interface DurationMetric extends CommonMetricPart {
15
+ _r?: [start: string, end: string];
16
+ s: number;
17
+ e: number;
18
+ c?: DurationMetric[];
19
+ }
20
+ export declare enum ETraceEventPhase {
21
+ BEGIN = "B",
22
+ END = "E",
23
+ COMPLETE = "X",
24
+ INSTANT = "I",
25
+ MARK = "R"
26
+ }
27
+ type MicroSeconds = number;
28
+ type ProcessID = number | string;
29
+ type ArgsType = {
30
+ p: string;
31
+ n: string;
32
+ s: number;
33
+ e: number;
34
+ };
35
+ export interface ITraceEventData {
36
+ /**
37
+ *Any arguments provided for the event. Some of the event types have required argument fields, otherwise, you can put any information you wish in here. The arguments are displayed in Trace Viewer when you view an event in the analysis section.
38
+ */
39
+ args: ArgsType;
40
+ /**
41
+ * The name of the event, as displayed in Chart.
42
+ */
43
+ name: string;
44
+ /**
45
+ * The event type. This is a single character which changes depending on the type of event being output.
46
+ */
47
+ ph: ETraceEventPhase;
48
+ /**
49
+ * The process ID for the process that output this event.
50
+ */
51
+ pid: ProcessID;
52
+ /**
53
+ * The tracing clock timestamp of the event. The timestamps are provided at microsecond granularity.
54
+ */
55
+ ts: MicroSeconds;
56
+ /**
57
+ * specify the tracing clock duration of complete events in microseconds.
58
+ */
59
+ dur?: MicroSeconds;
60
+ }
61
+ export {};
@@ -0,0 +1,11 @@
1
+ var ETraceEventPhase = /* @__PURE__ */ ((ETraceEventPhase2) => {
2
+ ETraceEventPhase2["BEGIN"] = "B";
3
+ ETraceEventPhase2["END"] = "E";
4
+ ETraceEventPhase2["COMPLETE"] = "X";
5
+ ETraceEventPhase2["INSTANT"] = "I";
6
+ ETraceEventPhase2["MARK"] = "R";
7
+ return ETraceEventPhase2;
8
+ })(ETraceEventPhase || {});
9
+ export {
10
+ ETraceEventPhase
11
+ };
@@ -0,0 +1,13 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import './tooltips.scss';
3
+ import { DurationMetric, ITraceEventData } from './types';
4
+ export declare function getTooltipHtmlForLoader(loader: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderChartData>[0]): string;
5
+ export declare function renderTotalLoadersTooltip(loaderName: string, loaders: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderChartData>, cwd: string): string;
6
+ export declare function transformDurationMetric(rawData: DurationMetric[]): ITraceEventData[];
7
+ export declare function processTrans(rawData: DurationMetric[]): ITraceEventData[];
8
+ export declare function formatterForPlugins(raw: {
9
+ data: {
10
+ ext: ITraceEventData;
11
+ };
12
+ }): string;
13
+ export declare function useDebounceHook(value: DurationMetric[], delay: number): DurationMetric[] | undefined;
@@ -0,0 +1,206 @@
1
+ import { Loader } from "@rsdoctor/utils/common";
2
+ import dayjs from "dayjs";
3
+ import { maxBy, minBy } from "lodash-es";
4
+ import { formatCosts } from "../../utils";
5
+ import "./tooltips.css";
6
+ import { ETraceEventPhase } from "./types";
7
+ import { useEffect, useState } from "react";
8
+ function getTooltipHtmlForLoader(loader) {
9
+ return `
10
+ <div class="loader-tooltip-container">
11
+ <div class="loader-tooltip-title">${loader.loader}</div>
12
+ <li class="loader-tooltip-item">
13
+ <span>isPitch</span>
14
+ <span>${loader.isPitch}</span>
15
+ </li>
16
+ <li class="loader-tooltip-item">
17
+ <span>duration</span>
18
+ <span class="loader-tooltip-textbold">${formatCosts(loader.costs)}</span>
19
+ </li>
20
+ <li class="loader-tooltip-item">
21
+ <span>filepath</span>
22
+ <span>${loader.resource}</span>
23
+ </li>
24
+ <li class="loader-tooltip-item">
25
+ <span>start</span>
26
+ <span class="loader-tooltip-textbold">${dayjs(loader.startAt).format(
27
+ "YYYY/MM/DD HH:mm:ss"
28
+ )}</span>
29
+ </li>
30
+ <li class="loader-tooltip-item">
31
+ <span>end</span>
32
+ <span class="loader-tooltip-textbold">${dayjs(loader.endAt).format(
33
+ "YYYY/MM/DD HH:mm:ss"
34
+ )}</span>
35
+ </li>
36
+ </div>
37
+ `.trim();
38
+ }
39
+ function renderTotalLoadersTooltip(loaderName, loaders, cwd) {
40
+ const filter = (loader) => loader.loader === loaderName;
41
+ const filteredLoaders = loaders.filter(filter);
42
+ const resources = filteredLoaders.map((e) => e.resource);
43
+ const nodeModulesResources = resources.filter(
44
+ (e) => e.includes("/node_modules/")
45
+ );
46
+ const outsideResources = resources.filter((e) => !e.startsWith(cwd));
47
+ const start = minBy(filteredLoaders, (e) => e.startAt).startAt;
48
+ const end = maxBy(filteredLoaders, (e) => e.endAt).endAt;
49
+ const duration = Loader.getLoadersCosts(filter, loaders);
50
+ return `
51
+ <div class="loader-tooltip-container">
52
+ <div class="loader-tooltip-title">${loaderName}</div>
53
+ <li class="loader-tooltip-item">
54
+ <span>files</span>
55
+ <span class="loader-tooltip-textbold">${resources.length}</span>
56
+ </li>
57
+ <li class="loader-tooltip-item">
58
+ <span>files(node_modules)</span>
59
+ <span class="loader-tooltip-textbold">${nodeModulesResources.length}</span>
60
+ </li>
61
+ <li class="loader-tooltip-item">
62
+ <span>files(outside the cwd)</span>
63
+ <span class="loader-tooltip-textbold">${outsideResources.length}</span>
64
+ </li>
65
+ <li class="loader-tooltip-item">
66
+ <span>duration(estimated)</span>
67
+ <span class="loader-tooltip-textbold">${formatCosts(duration)}</span>
68
+ </li>
69
+ <li class="loader-tooltip-item">
70
+ <span>start(min)</span>
71
+ <span>${dayjs(start).format("YYYY/MM/DD HH:mm:ss")}</span>
72
+ </li>
73
+ <li class="loader-tooltip-item">
74
+ <span>end(max)</span>
75
+ <span>${dayjs(end).format("YYYY/MM/DD HH:mm:ss")}</span>
76
+ </li>
77
+ </div>
78
+ `.trim();
79
+ }
80
+ function transformDurationMetric(rawData) {
81
+ return rawData.reduce((acc, cur) => {
82
+ if (cur.c) {
83
+ const res = transformDurationMetric(cur.c);
84
+ acc.push(
85
+ {
86
+ name: cur.n,
87
+ ph: ETraceEventPhase.BEGIN,
88
+ pid: cur.p,
89
+ ts: cur.s,
90
+ args: cur
91
+ },
92
+ ...res,
93
+ {
94
+ name: cur.n,
95
+ ph: ETraceEventPhase.END,
96
+ pid: cur.p,
97
+ ts: cur.e,
98
+ args: cur
99
+ }
100
+ );
101
+ } else {
102
+ acc.push({
103
+ name: cur.n,
104
+ ph: ETraceEventPhase.BEGIN,
105
+ pid: cur.p,
106
+ ts: cur.s,
107
+ args: cur
108
+ });
109
+ acc.push({
110
+ name: cur.n,
111
+ ph: ETraceEventPhase.END,
112
+ pid: cur.p,
113
+ ts: cur.e,
114
+ args: cur
115
+ });
116
+ }
117
+ return acc;
118
+ }, []);
119
+ }
120
+ function processTrans(rawData) {
121
+ const processedData = rawData.sort((a, b) => a.s - b.s).reduce(
122
+ (prev, cur) => {
123
+ const ca = prev[cur.p];
124
+ if (ca) {
125
+ loop(ca, cur);
126
+ } else {
127
+ prev[cur.p] = [cur];
128
+ }
129
+ return prev;
130
+ },
131
+ {}
132
+ );
133
+ const data = Object.entries(processedData).reduce((prev, [_key, val]) => {
134
+ prev.push(...val);
135
+ return prev;
136
+ }, []);
137
+ return transformDurationMetric(data);
138
+ }
139
+ function loop(dur, target) {
140
+ const queue = [dur];
141
+ while (queue.length > 0) {
142
+ const floor = queue.shift() || [];
143
+ if (floor.length === 0)
144
+ return;
145
+ const curFloorLast = floor[floor.length - 1];
146
+ if (curFloorLast.e <= target.s) {
147
+ return floor.push(target);
148
+ }
149
+ let nextFloor;
150
+ for (let i = floor.length - 1; i >= 0; i--) {
151
+ const { c } = floor[i];
152
+ if (c) {
153
+ nextFloor = c;
154
+ }
155
+ }
156
+ if (nextFloor) {
157
+ queue.push(nextFloor);
158
+ } else {
159
+ curFloorLast.c = [target];
160
+ }
161
+ }
162
+ }
163
+ function formatterForPlugins(raw) {
164
+ const { ext } = raw.data;
165
+ return `
166
+ <div class="loader-tooltip-container">
167
+ <div class="loader-tooltip-title">[${ext.args.p}] ${ext.args.n}</div>
168
+ <li class="loader-tooltip-item">
169
+ <span>hook</span>
170
+ <span>${ext.args.p}</span>
171
+ </li>
172
+ <li class="loader-tooltip-item">
173
+ <span>tap name</span>
174
+ <span>${ext.args.n}</span>
175
+ </li>
176
+ <li class="loader-tooltip-item">
177
+ <span>start</span>
178
+ <span>${dayjs(ext.args.s).format("YYYY/MM/DD HH:mm:ss")}</span>
179
+ </li>
180
+ <li class="loader-tooltip-item">
181
+ <span>end</span>
182
+ <span>${dayjs(ext.args.e).format("YYYY/MM/DD HH:mm:ss")}</span>
183
+ </li>
184
+ <li class="loader-tooltip-item">
185
+ <span>duration</span>
186
+ <span>${formatCosts(ext.args.e - ext.args.s)}</span>
187
+ </li>
188
+ </div>
189
+ `.trim();
190
+ }
191
+ function useDebounceHook(value, delay) {
192
+ const [debounceValue, setDebounceValue] = useState(value);
193
+ useEffect(() => {
194
+ let timer = setTimeout(() => setDebounceValue(value), delay);
195
+ return () => clearTimeout(timer);
196
+ }, [value, delay]);
197
+ return debounceValue;
198
+ }
199
+ export {
200
+ formatterForPlugins,
201
+ getTooltipHtmlForLoader,
202
+ processTrans,
203
+ renderTotalLoadersTooltip,
204
+ transformDurationMetric,
205
+ useDebounceHook
206
+ };
@@ -0,0 +1,2 @@
1
+ import type { editor } from 'monaco-editor';
2
+ export declare const DefaultEditorConfig: editor.IStandaloneEditorConstructionOptions;
@@ -0,0 +1,18 @@
1
+ const DefaultEditorConfig = {
2
+ readOnly: true,
3
+ domReadOnly: true,
4
+ fontSize: 12,
5
+ renderValidationDecorations: "off",
6
+ hideCursorInOverviewRuler: true,
7
+ smoothScrolling: true,
8
+ wordWrap: "bounded",
9
+ colorDecorators: true,
10
+ codeLens: false,
11
+ cursorWidth: 0,
12
+ minimap: {
13
+ enabled: false
14
+ }
15
+ };
16
+ export {
17
+ DefaultEditorConfig
18
+ };
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { DiffEditorProps } from '@monaco-editor/react';
3
+ interface DiffViewerProps {
4
+ before: string;
5
+ after: string;
6
+ filepath: string;
7
+ className?: string;
8
+ editorProps?: DiffEditorProps;
9
+ }
10
+ export declare const DiffViewer: React.FC<DiffViewerProps>;
11
+ export {};
@@ -0,0 +1,35 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { DiffEditor } from "@monaco-editor/react";
3
+ import { Size } from "../../constants";
4
+ import { getModifiedLanguage, getOriginalLanguage } from "../../utils";
5
+ const DiffViewer = ({ before, after, filepath, className, editorProps }) => {
6
+ return /* @__PURE__ */ jsx(
7
+ DiffEditor,
8
+ {
9
+ className,
10
+ originalLanguage: getOriginalLanguage(filepath),
11
+ modifiedLanguage: getModifiedLanguage(filepath),
12
+ theme: "vs-dark",
13
+ original: before,
14
+ modified: after,
15
+ width: "100%",
16
+ ...editorProps,
17
+ options: {
18
+ readOnly: true,
19
+ originalEditable: false,
20
+ renderSideBySide: true,
21
+ renderIndicators: true,
22
+ lineDecorationsWidth: Size.BasePadding,
23
+ definitionLinkOpensInPeek: false,
24
+ domReadOnly: true,
25
+ fontSize: 14,
26
+ minimap: { enabled: false },
27
+ diffWordWrap: "on",
28
+ ...editorProps?.options
29
+ }
30
+ }
31
+ );
32
+ };
33
+ export {
34
+ DiffViewer
35
+ };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { SDK } from '@rsdoctor/types';
3
+ interface FileHightLightViewerProps {
4
+ cwd: string;
5
+ module: SDK.ModuleData;
6
+ dependency: SDK.DependencyData;
7
+ moduleCode: SDK.ModuleSource;
8
+ }
9
+ export declare const FileHightLightViewer: React.FC<FileHightLightViewerProps>;
10
+ export {};
@@ -0,0 +1,76 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useRef } from "react";
3
+ import { Space, Card, Tooltip } from "antd";
4
+ import { InfoCircleOutlined } from "@ant-design/icons";
5
+ import Editor from "@monaco-editor/react";
6
+ import { getOriginalLanguage, beautifyModulePath, getSelectionRange, getRevealPositionForViewer } from "../../utils";
7
+ import { CodeOpener } from "../Opener";
8
+ const FileHightLightViewer = ({ dependency, module, cwd, moduleCode }) => {
9
+ const editorRef = useRef(null);
10
+ if (!dependency)
11
+ return null;
12
+ const { statements } = dependency;
13
+ const hasSourceRange = Boolean(statements?.[0]?.position?.source);
14
+ const { start, end } = statements?.[0]?.position ? hasSourceRange ? statements[0].position.source : statements[0].position.transformed : { start: { line: 0, column: 0 }, end: { line: 0, column: 0 } };
15
+ const content = hasSourceRange ? moduleCode?.source : moduleCode?.transformed || moduleCode?.source;
16
+ const modulePath = module.path;
17
+ const handleEditorDidMount = (editor2, monaco) => {
18
+ editorRef.current = editor2;
19
+ const range = getSelectionRange({ start, end }, monaco.Range);
20
+ const position = getRevealPositionForViewer(range.startLineNumber, range.startColumn);
21
+ editor2.revealPositionInCenter(position);
22
+ editor2.deltaDecorations(
23
+ [],
24
+ [
25
+ {
26
+ range,
27
+ options: {
28
+ inlineClassName: "file-inline-decoration"
29
+ }
30
+ }
31
+ ]
32
+ );
33
+ };
34
+ return /* @__PURE__ */ jsx(
35
+ Card,
36
+ {
37
+ title: /* @__PURE__ */ jsxs(Space, { children: [
38
+ /* @__PURE__ */ jsx(Tooltip, { title: modulePath, zIndex: 99999, children: /* @__PURE__ */ jsx(InfoCircleOutlined, {}) }),
39
+ /* @__PURE__ */ jsx(
40
+ CodeOpener,
41
+ {
42
+ cwd,
43
+ url: modulePath,
44
+ label: beautifyModulePath(modulePath, cwd).alias,
45
+ loc: `${start.line}:${start.column || 1}`,
46
+ code: true,
47
+ disabled: true
48
+ }
49
+ )
50
+ ] }),
51
+ style: { height: "100%" },
52
+ children: /* @__PURE__ */ jsx(
53
+ Editor,
54
+ {
55
+ theme: "vs-dark",
56
+ language: getOriginalLanguage(modulePath),
57
+ value: content,
58
+ width: "100%",
59
+ height: window.innerHeight / 1.5,
60
+ options: {
61
+ readOnly: true,
62
+ domReadOnly: true,
63
+ fontSize: 14,
64
+ minimap: {
65
+ enabled: false
66
+ }
67
+ },
68
+ onMount: handleEditorDidMount
69
+ }
70
+ )
71
+ }
72
+ );
73
+ };
74
+ export {
75
+ FileHightLightViewer
76
+ };
@@ -0,0 +1,4 @@
1
+ export * from './diff';
2
+ export * from './hightlight';
3
+ export * from './viewer';
4
+ export * from './config';
@@ -0,0 +1,4 @@
1
+ export * from "./diff";
2
+ export * from "./hightlight";
3
+ export * from "./viewer";
4
+ export * from "./config";
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { SDK } from '@rsdoctor/types';
3
+ import type { editor } from 'monaco-editor';
4
+ interface CodeViewerProps {
5
+ path: string;
6
+ content: string;
7
+ defaultLine?: number;
8
+ ranges?: SDK.SourceRange[];
9
+ editorConfig?: editor.IStandaloneEditorConstructionOptions;
10
+ }
11
+ export declare const CodeViewer: React.FC<CodeViewerProps>;
12
+ export declare const CodeViewerWithDrawer: React.FC<CodeViewerProps>;
13
+ export {};
@@ -0,0 +1,60 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import Editor from "@monaco-editor/react";
3
+ import { isNumber } from "lodash-es";
4
+ import { CodepenCircleOutlined } from "@ant-design/icons";
5
+ import { getOriginalLanguage, getSelectionRange } from "../../utils";
6
+ import { DefaultEditorConfig } from "./config";
7
+ import { TextDrawer } from "../TextDrawer";
8
+ const CodeViewer = ({ content, ranges, path, defaultLine, editorConfig = {} }) => {
9
+ const handleEditorDidMount = (editor, monaco) => {
10
+ if (isNumber(defaultLine)) {
11
+ editor.revealLine(defaultLine);
12
+ }
13
+ if (ranges && ranges.length > 0) {
14
+ editor.deltaDecorations(
15
+ [],
16
+ ranges.map((range) => ({
17
+ range: getSelectionRange(range, monaco.Range),
18
+ options: {
19
+ inlineClassName: "file-inline-decoration"
20
+ }
21
+ }))
22
+ );
23
+ }
24
+ };
25
+ return /* @__PURE__ */ jsx(
26
+ Editor,
27
+ {
28
+ theme: "vs-dark",
29
+ language: getOriginalLanguage(path),
30
+ value: content,
31
+ width: "100%",
32
+ height: window.innerHeight / 1.5,
33
+ options: { ...DefaultEditorConfig, ...editorConfig },
34
+ onMount: handleEditorDidMount
35
+ }
36
+ );
37
+ };
38
+ const CodeViewerWithDrawer = (props) => {
39
+ return /* @__PURE__ */ jsx(
40
+ TextDrawer,
41
+ {
42
+ text: "",
43
+ buttonProps: {
44
+ size: "small",
45
+ icon: /* @__PURE__ */ jsx(CodepenCircleOutlined, {}),
46
+ type: "default"
47
+ },
48
+ buttonStyle: { padding: `0 4px` },
49
+ drawerProps: {
50
+ destroyOnClose: true,
51
+ title: `Code of "${props.path}"`
52
+ },
53
+ children: /* @__PURE__ */ jsx(CodeViewer, { ...props })
54
+ }
55
+ );
56
+ };
57
+ export {
58
+ CodeViewer,
59
+ CodeViewerWithDrawer
60
+ };
@@ -0,0 +1,13 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import React from 'react';
3
+ interface WebpackConfigurationViewerBaseProps {
4
+ defaultKeys?: string[];
5
+ configs: SDK.ConfigData;
6
+ }
7
+ export declare const WebpackConfigurationViewerBase: React.FC<WebpackConfigurationViewerBaseProps>;
8
+ export declare const WebpackConfigurationViewer: React.FC<Omit<WebpackConfigurationViewerBaseProps, "configs"> & Partial<{
9
+ body: {
10
+ key: import("@rsdoctor/types/dist/manifest").RsdoctorManifestMappingKeys;
11
+ };
12
+ }>>;
13
+ export {};
@@ -0,0 +1,67 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { SDK } from "@rsdoctor/types";
3
+ import { Divider, Row, Select, Space, Typography } from "antd";
4
+ import { pick } from "lodash-es";
5
+ import { useState } from "react";
6
+ import ReactJson from "react-json-view";
7
+ import { useWebpackConfigurationByConfigs } from "../../utils";
8
+ import { withServerAPI } from "../Manifest";
9
+ import { TextDrawer } from "../TextDrawer";
10
+ import { Title } from "../Title";
11
+ const WebpackConfigurationViewerBase = ({ defaultKeys, configs }) => {
12
+ const builderConfigData = useWebpackConfigurationByConfigs(configs || []);
13
+ if (!builderConfigData)
14
+ return null;
15
+ const { config, version, name } = builderConfigData;
16
+ const keys = Object.keys(config);
17
+ const [selectKeys, setSelectKeys] = useState(defaultKeys || keys);
18
+ return /* @__PURE__ */ jsx(TextDrawer, { text: "View Bundler Config", children: /* @__PURE__ */ jsxs(Row, { children: [
19
+ /* @__PURE__ */ jsx(Title, { text: `Bundler Config Viewer` }),
20
+ /* @__PURE__ */ jsx(Divider, {}),
21
+ /* @__PURE__ */ jsxs(Space, { children: [
22
+ /* @__PURE__ */ jsx(Typography.Text, { children: "Properties: " }),
23
+ /* @__PURE__ */ jsx(
24
+ Select,
25
+ {
26
+ dropdownStyle: { zIndex: 999 },
27
+ mode: "multiple",
28
+ allowClear: true,
29
+ value: selectKeys.length === keys.length ? [] : selectKeys,
30
+ style: { width: 350 },
31
+ dropdownMatchSelectWidth: true,
32
+ placeholder: "Show Selected Properties Only.",
33
+ onChange: (e) => {
34
+ setSelectKeys(e);
35
+ },
36
+ children: keys.map((e) => {
37
+ return /* @__PURE__ */ jsx(Select.Option, { label: e, value: e, children: e }, e);
38
+ })
39
+ }
40
+ )
41
+ ] }),
42
+ /* @__PURE__ */ jsx(Divider, {}),
43
+ /* @__PURE__ */ jsx(
44
+ ReactJson,
45
+ {
46
+ name: version && version !== "unknown" ? `${name}@${version}` : `webpack.config`,
47
+ theme: "monokai",
48
+ src: selectKeys.length === 0 ? config : pick(config, selectKeys),
49
+ displayDataTypes: false,
50
+ displayObjectSize: false
51
+ }
52
+ )
53
+ ] }) });
54
+ };
55
+ const WebpackConfigurationViewer = withServerAPI({
56
+ Component: WebpackConfigurationViewerBase,
57
+ api: SDK.ServerAPI.API.LoadDataByKey,
58
+ responsePropName: "configs",
59
+ body: {
60
+ key: "configs"
61
+ },
62
+ showSkeleton: false
63
+ });
64
+ export {
65
+ WebpackConfigurationViewer,
66
+ WebpackConfigurationViewerBase
67
+ };
@@ -0,0 +1 @@
1
+ export * from './builder';