@rsdoctor/components 0.0.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/dist/assets/connection-point.3b3c78ca.svg +1 -0
  4. package/dist/assets/icon.7509d763.svg +21 -0
  5. package/dist/assets/webpack.98604d64.svg +1 -0
  6. package/dist/components/Alert/change.d.ts +8 -0
  7. package/dist/components/Alert/change.js +94 -0
  8. package/dist/components/Alert/file-relation.d.ts +3 -0
  9. package/dist/components/Alert/file-relation.js +9 -0
  10. package/dist/components/Alert/index.css +29 -0
  11. package/dist/components/Alert/index.d.ts +4 -0
  12. package/dist/components/Alert/index.js +37 -0
  13. package/dist/components/Alert/link.d.ts +3 -0
  14. package/dist/components/Alert/link.js +27 -0
  15. package/dist/components/Alert/package-relation.d.ts +17 -0
  16. package/dist/components/Alert/package-relation.js +206 -0
  17. package/dist/components/Alert/types.d.ts +31 -0
  18. package/dist/components/Alert/types.js +0 -0
  19. package/dist/components/Alert/view.d.ts +4 -0
  20. package/dist/components/Alert/view.js +59 -0
  21. package/dist/components/Alerts/bundle.d.ts +11 -0
  22. package/dist/components/Alerts/bundle.js +47 -0
  23. package/dist/components/Alerts/common.d.ts +15 -0
  24. package/dist/components/Alerts/common.js +106 -0
  25. package/dist/components/Alerts/compile.d.ts +10 -0
  26. package/dist/components/Alerts/compile.js +46 -0
  27. package/dist/components/Alerts/index.d.ts +3 -0
  28. package/dist/components/Alerts/index.js +3 -0
  29. package/dist/components/Alerts/overlay.d.ts +26 -0
  30. package/dist/components/Alerts/overlay.js +154 -0
  31. package/dist/components/Badge/index.d.ts +21 -0
  32. package/dist/components/Badge/index.js +105 -0
  33. package/dist/components/Card/diff.d.ts +23 -0
  34. package/dist/components/Card/diff.js +131 -0
  35. package/dist/components/Card/index.d.ts +7 -0
  36. package/dist/components/Card/index.js +62 -0
  37. package/dist/components/Card/size.d.ts +16 -0
  38. package/dist/components/Card/size.js +71 -0
  39. package/dist/components/Card/statistic.css +16 -0
  40. package/dist/components/Card/statistic.d.ts +9 -0
  41. package/dist/components/Card/statistic.js +34 -0
  42. package/dist/components/Charts/TimelineCharts/index.d.ts +8 -0
  43. package/dist/components/Charts/TimelineCharts/index.js +197 -0
  44. package/dist/components/Charts/bootstrap.d.ts +5 -0
  45. package/dist/components/Charts/bootstrap.js +44 -0
  46. package/dist/components/Charts/common.d.ts +13 -0
  47. package/dist/components/Charts/common.js +56 -0
  48. package/dist/components/Charts/done.d.ts +5 -0
  49. package/dist/components/Charts/done.js +45 -0
  50. package/dist/components/Charts/index.d.ts +10 -0
  51. package/dist/components/Charts/index.js +37 -0
  52. package/dist/components/Charts/loader.css +31 -0
  53. package/dist/components/Charts/loader.d.ts +4 -0
  54. package/dist/components/Charts/loader.js +68 -0
  55. package/dist/components/Charts/minify.d.ts +5 -0
  56. package/dist/components/Charts/minify.js +37 -0
  57. package/dist/components/Charts/tooltips.css +62 -0
  58. package/dist/components/Charts/types.d.ts +61 -0
  59. package/dist/components/Charts/types.js +11 -0
  60. package/dist/components/Charts/utils.d.ts +13 -0
  61. package/dist/components/Charts/utils.js +203 -0
  62. package/dist/components/CodeViewer/config.d.ts +2 -0
  63. package/dist/components/CodeViewer/config.js +18 -0
  64. package/dist/components/CodeViewer/diff.d.ts +11 -0
  65. package/dist/components/CodeViewer/diff.js +53 -0
  66. package/dist/components/CodeViewer/hightlight.d.ts +10 -0
  67. package/dist/components/CodeViewer/hightlight.js +76 -0
  68. package/dist/components/CodeViewer/index.d.ts +4 -0
  69. package/dist/components/CodeViewer/index.js +4 -0
  70. package/dist/components/CodeViewer/viewer.d.ts +13 -0
  71. package/dist/components/CodeViewer/viewer.js +76 -0
  72. package/dist/components/Configuration/index.d.ts +1 -0
  73. package/dist/components/Configuration/index.js +1 -0
  74. package/dist/components/Configuration/webpack.d.ts +13 -0
  75. package/dist/components/Configuration/webpack.js +70 -0
  76. package/dist/components/FileTree/index.css +58 -0
  77. package/dist/components/FileTree/index.d.ts +4 -0
  78. package/dist/components/FileTree/index.js +53 -0
  79. package/dist/components/Form/keyword.d.ts +14 -0
  80. package/dist/components/Form/keyword.js +76 -0
  81. package/dist/components/Keyword/index.d.ts +6 -0
  82. package/dist/components/Keyword/index.js +68 -0
  83. package/dist/components/Layout/builder-select.d.ts +2 -0
  84. package/dist/components/Layout/builder-select.js +50 -0
  85. package/dist/components/Layout/constants.d.ts +1 -0
  86. package/dist/components/Layout/constants.js +4 -0
  87. package/dist/components/Layout/header.css +12 -0
  88. package/dist/components/Layout/header.d.ts +3 -0
  89. package/dist/components/Layout/header.js +87 -0
  90. package/dist/components/Layout/index.d.ts +5 -0
  91. package/dist/components/Layout/index.js +34 -0
  92. package/dist/components/Layout/menus.d.ts +8 -0
  93. package/dist/components/Layout/menus.js +155 -0
  94. package/dist/components/Layout/progress.d.ts +8 -0
  95. package/dist/components/Layout/progress.js +44 -0
  96. package/dist/components/Loader/Analysis/files.d.ts +8 -0
  97. package/dist/components/Loader/Analysis/files.js +187 -0
  98. package/dist/components/Loader/Analysis/index.d.ts +11 -0
  99. package/dist/components/Loader/Analysis/index.js +23 -0
  100. package/dist/components/Loader/executions.d.ts +13 -0
  101. package/dist/components/Loader/executions.js +221 -0
  102. package/dist/components/Manifest/api.d.ts +41 -0
  103. package/dist/components/Manifest/api.js +157 -0
  104. package/dist/components/Manifest/data.d.ts +8 -0
  105. package/dist/components/Manifest/data.js +81 -0
  106. package/dist/components/Manifest/index.d.ts +2 -0
  107. package/dist/components/Manifest/index.js +2 -0
  108. package/dist/components/Opener/code.d.ts +28 -0
  109. package/dist/components/Opener/code.js +69 -0
  110. package/dist/components/Opener/index.d.ts +2 -0
  111. package/dist/components/Opener/index.js +2 -0
  112. package/dist/components/Opener/vscode.d.ts +16 -0
  113. package/dist/components/Opener/vscode.js +57 -0
  114. package/dist/components/Overall/NumberButton.d.ts +14 -0
  115. package/dist/components/Overall/NumberButton.js +29 -0
  116. package/dist/components/Overall/NumberButton.module.js +5 -0
  117. package/dist/components/Overall/NumberButton_module.css +70 -0
  118. package/dist/components/Overall/bundle.d.ts +6 -0
  119. package/dist/components/Overall/bundle.js +167 -0
  120. package/dist/components/Overall/bundle.module.css +0 -0
  121. package/dist/components/Overall/card.module.js +5 -0
  122. package/dist/components/Overall/card_module.css +6 -0
  123. package/dist/components/Overall/compile.d.ts +5 -0
  124. package/dist/components/Overall/compile.js +68 -0
  125. package/dist/components/Overall/compile.module.js +5 -0
  126. package/dist/components/Overall/compile_module.css +4 -0
  127. package/dist/components/Overall/index.d.ts +3 -0
  128. package/dist/components/Overall/index.js +3 -0
  129. package/dist/components/Overall/list.module.js +5 -0
  130. package/dist/components/Overall/list_module.css +7 -0
  131. package/dist/components/Overall/project.d.ts +8 -0
  132. package/dist/components/Overall/project.js +73 -0
  133. package/dist/components/Plugins/webpack.d.ts +18 -0
  134. package/dist/components/Plugins/webpack.js +76 -0
  135. package/dist/components/Resolver/analysis.d.ts +15 -0
  136. package/dist/components/Resolver/analysis.js +160 -0
  137. package/dist/components/Select/index.d.ts +15 -0
  138. package/dist/components/Select/index.js +68 -0
  139. package/dist/components/Status/failed.d.ts +9 -0
  140. package/dist/components/Status/failed.js +33 -0
  141. package/dist/components/Status/index.d.ts +1 -0
  142. package/dist/components/Status/index.js +1 -0
  143. package/dist/components/TextDrawer/duplicate.d.ts +17 -0
  144. package/dist/components/TextDrawer/duplicate.js +107 -0
  145. package/dist/components/TextDrawer/index.d.ts +11 -0
  146. package/dist/components/TextDrawer/index.js +55 -0
  147. package/dist/components/Title/index.d.ts +15 -0
  148. package/dist/components/Title/index.js +10 -0
  149. package/dist/components/index.d.ts +8 -0
  150. package/dist/components/index.js +11 -0
  151. package/dist/components/worker/ecmaversion/client.d.ts +10 -0
  152. package/dist/components/worker/ecmaversion/client.js +61 -0
  153. package/dist/components/worker/ecmaversion/worker.d.ts +1 -0
  154. package/dist/components/worker/ecmaversion/worker.js +13 -0
  155. package/dist/components/worker/jsequal/client.d.ts +11 -0
  156. package/dist/components/worker/jsequal/client.js +39 -0
  157. package/dist/components/worker/jsequal/worker.d.ts +1 -0
  158. package/dist/components/worker/jsequal/worker.js +52 -0
  159. package/dist/config.d.ts +19 -0
  160. package/dist/config.js +39 -0
  161. package/dist/constants.d.ts +48 -0
  162. package/dist/constants.js +71 -0
  163. package/dist/index.d.ts +3 -0
  164. package/dist/index.js +6 -0
  165. package/dist/pages/BundleSize/components/asset.d.ts +26 -0
  166. package/dist/pages/BundleSize/components/asset.js +405 -0
  167. package/dist/pages/BundleSize/components/cards.d.ts +7 -0
  168. package/dist/pages/BundleSize/components/cards.js +154 -0
  169. package/dist/pages/BundleSize/components/editor.d.ts +5 -0
  170. package/dist/pages/BundleSize/components/editor.js +38 -0
  171. package/dist/pages/BundleSize/components/index.css +20 -0
  172. package/dist/pages/BundleSize/components/index.d.ts +16 -0
  173. package/dist/pages/BundleSize/components/index.js +314 -0
  174. package/dist/pages/BundleSize/config.d.ts +7 -0
  175. package/dist/pages/BundleSize/config.js +9 -0
  176. package/dist/pages/BundleSize/constants.d.ts +5 -0
  177. package/dist/pages/BundleSize/constants.js +9 -0
  178. package/dist/pages/BundleSize/index.d.ts +3 -0
  179. package/dist/pages/BundleSize/index.js +11 -0
  180. package/dist/pages/ModuleAnalyze/chunks.d.ts +6 -0
  181. package/dist/pages/ModuleAnalyze/chunks.js +48 -0
  182. package/dist/pages/ModuleAnalyze/components/fileTreeCom.css +88 -0
  183. package/dist/pages/ModuleAnalyze/components/fileTreeCom.d.ts +15 -0
  184. package/dist/pages/ModuleAnalyze/components/fileTreeCom.js +138 -0
  185. package/dist/pages/ModuleAnalyze/constants.d.ts +7 -0
  186. package/dist/pages/ModuleAnalyze/constants.js +14 -0
  187. package/dist/pages/ModuleAnalyze/dependncy.d.ts +9 -0
  188. package/dist/pages/ModuleAnalyze/dependncy.js +31 -0
  189. package/dist/pages/ModuleAnalyze/fileTree.d.ts +9 -0
  190. package/dist/pages/ModuleAnalyze/fileTree.js +125 -0
  191. package/dist/pages/ModuleAnalyze/index.css +10 -0
  192. package/dist/pages/ModuleAnalyze/index.d.ts +8 -0
  193. package/dist/pages/ModuleAnalyze/index.js +64 -0
  194. package/dist/pages/ModuleAnalyze/utils/hooks.d.ts +21 -0
  195. package/dist/pages/ModuleAnalyze/utils/hooks.js +65 -0
  196. package/dist/pages/ModuleAnalyze/utils/index.d.ts +3 -0
  197. package/dist/pages/ModuleAnalyze/utils/index.js +36 -0
  198. package/dist/pages/ModuleResolve/constants.d.ts +3 -0
  199. package/dist/pages/ModuleResolve/constants.js +7 -0
  200. package/dist/pages/ModuleResolve/index.d.ts +3 -0
  201. package/dist/pages/ModuleResolve/index.js +19 -0
  202. package/dist/pages/Overall/constants.d.ts +3 -0
  203. package/dist/pages/Overall/constants.js +7 -0
  204. package/dist/pages/Overall/index.d.ts +9 -0
  205. package/dist/pages/Overall/index.js +28 -0
  206. package/dist/pages/WebpackLoaders/Analysis/constants.d.ts +3 -0
  207. package/dist/pages/WebpackLoaders/Analysis/constants.js +7 -0
  208. package/dist/pages/WebpackLoaders/Analysis/index.d.ts +3 -0
  209. package/dist/pages/WebpackLoaders/Analysis/index.js +19 -0
  210. package/dist/pages/WebpackLoaders/Overall/constants.d.ts +3 -0
  211. package/dist/pages/WebpackLoaders/Overall/constants.js +7 -0
  212. package/dist/pages/WebpackLoaders/Overall/index.d.ts +3 -0
  213. package/dist/pages/WebpackLoaders/Overall/index.js +11 -0
  214. package/dist/pages/WebpackLoaders/constants.d.ts +2 -0
  215. package/dist/pages/WebpackLoaders/constants.js +6 -0
  216. package/dist/pages/WebpackPlugins/constants.d.ts +3 -0
  217. package/dist/pages/WebpackPlugins/constants.js +7 -0
  218. package/dist/pages/WebpackPlugins/index.d.ts +3 -0
  219. package/dist/pages/WebpackPlugins/index.js +79 -0
  220. package/dist/pages/index.d.ts +7 -0
  221. package/dist/pages/index.js +16 -0
  222. package/dist/utils/data/base.d.ts +24 -0
  223. package/dist/utils/data/base.js +70 -0
  224. package/dist/utils/data/index.d.ts +5 -0
  225. package/dist/utils/data/index.js +66 -0
  226. package/dist/utils/data/local.d.ts +14 -0
  227. package/dist/utils/data/local.js +106 -0
  228. package/dist/utils/data/remote.d.ts +10 -0
  229. package/dist/utils/data/remote.js +70 -0
  230. package/dist/utils/file.d.ts +39 -0
  231. package/dist/utils/file.js +154 -0
  232. package/dist/utils/hooks.d.ts +30 -0
  233. package/dist/utils/hooks.js +256 -0
  234. package/dist/utils/i18n/cn.d.ts +3 -0
  235. package/dist/utils/i18n/cn.js +33 -0
  236. package/dist/utils/i18n/en.d.ts +30 -0
  237. package/dist/utils/i18n/en.js +33 -0
  238. package/dist/utils/i18n/index.d.ts +2 -0
  239. package/dist/utils/i18n/index.js +34 -0
  240. package/dist/utils/index.d.ts +16 -0
  241. package/dist/utils/index.js +16 -0
  242. package/dist/utils/loader.d.ts +7 -0
  243. package/dist/utils/loader.js +29 -0
  244. package/dist/utils/locale.d.ts +2 -0
  245. package/dist/utils/locale.js +9 -0
  246. package/dist/utils/manifest.d.ts +27 -0
  247. package/dist/utils/manifest.js +54 -0
  248. package/dist/utils/monaco.d.ts +9 -0
  249. package/dist/utils/monaco.js +48 -0
  250. package/dist/utils/request.d.ts +23 -0
  251. package/dist/utils/request.js +162 -0
  252. package/dist/utils/routes.d.ts +3 -0
  253. package/dist/utils/routes.js +14 -0
  254. package/dist/utils/size.d.ts +2 -0
  255. package/dist/utils/size.js +24 -0
  256. package/dist/utils/socket.d.ts +2 -0
  257. package/dist/utils/socket.js +20 -0
  258. package/dist/utils/storage.d.ts +13 -0
  259. package/dist/utils/storage.js +70 -0
  260. package/dist/utils/string.d.ts +2 -0
  261. package/dist/utils/string.js +14 -0
  262. package/dist/utils/time.d.ts +3 -0
  263. package/dist/utils/time.js +7 -0
  264. package/dist/utils/url.d.ts +6 -0
  265. package/dist/utils/url.js +89 -0
  266. package/dist/utils/worker/index.d.ts +4 -0
  267. package/dist/utils/worker/index.js +4 -0
  268. package/dist/utils/worker/master.d.ts +8 -0
  269. package/dist/utils/worker/master.js +18 -0
  270. package/dist/utils/worker/types.d.ts +9 -0
  271. package/dist/utils/worker/types.js +0 -0
  272. package/dist/utils/worker/utils.d.ts +9 -0
  273. package/dist/utils/worker/utils.js +29 -0
  274. package/dist/utils/worker/worker.d.ts +13 -0
  275. package/dist/utils/worker/worker.js +38 -0
  276. package/package.json +87 -0
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { CommonChartProps } from './common';
3
+ import './loader.scss';
4
+ import './tooltips.scss';
5
+ export declare const DoneChartContainer: React.FC<CommonChartProps>;
@@ -0,0 +1,45 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Divider, Space } from "antd";
3
+ import { BarChartOutlined } from "@ant-design/icons";
4
+ import { SDK } from "@rsdoctor/types";
5
+ import { Summary } from "@rsdoctor/utils/common";
6
+ import { TextDrawer } from "../TextDrawer";
7
+ import { Card } from "../Card";
8
+ import { CommonExecutionsChart, CommonExecutionEmptyTips } from "./common";
9
+ import { WebpackPluginsDataTable } from "../Plugins/webpack";
10
+ import { ServerAPIProvider } from "../Manifest";
11
+ import "./loader.css";
12
+ import "./tooltips.css";
13
+ const DoneChartContainer = ({ summary }) => {
14
+ const { costs = [] } = summary || {};
15
+ const target = costs.find((e) => e.name === Summary.SummaryCostsDataName.Done);
16
+ const hooks = [
17
+ "afterCompile",
18
+ "shouldEmit",
19
+ "emit",
20
+ "afterEmit",
21
+ "assetEmitted",
22
+ "done"
23
+ ];
24
+ const suffix = 'of the "AfterCompile -> Done" stage';
25
+ if (!target)
26
+ return null;
27
+ return /* @__PURE__ */ jsx(
28
+ TextDrawer,
29
+ {
30
+ drawerProps: { title: `Details ${suffix}` },
31
+ text: /* @__PURE__ */ jsxs(Space, { children: [
32
+ "detail",
33
+ /* @__PURE__ */ jsx(BarChartOutlined, {})
34
+ ] }),
35
+ children: /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetPluginData, body: { hooks }, children: (res) => res && res.length ? /* @__PURE__ */ jsxs(Space, { direction: "vertical", style: { width: "100%" }, children: [
36
+ /* @__PURE__ */ jsx(Card, { title: `Plugin DataSource of ${suffix}`, collapsable: true, children: /* @__PURE__ */ jsx(WebpackPluginsDataTable, { dataSource: res }) }),
37
+ /* @__PURE__ */ jsx(Divider, {}),
38
+ /* @__PURE__ */ jsx(Card, { title: `Chart ${suffix}`, children: /* @__PURE__ */ jsx(CommonExecutionsChart, { plugins: res }) })
39
+ ] }) : /* @__PURE__ */ jsx(CommonExecutionEmptyTips, {}) })
40
+ }
41
+ );
42
+ };
43
+ export {
44
+ DoneChartContainer
45
+ };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { SDK } from '@rsdoctor/types';
3
+ export declare const LoaderChartBase: React.FC<{
4
+ project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
5
+ }>;
6
+ export declare const LoaderChart: React.FC<Omit<{
7
+ project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
8
+ }, "project"> & Partial<{
9
+ body?: any;
10
+ }>>;
@@ -0,0 +1,37 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Space } from "antd";
4
+ import { SDK } from "@rsdoctor/types";
5
+ import { LoaderCommonSelect } from "../Select";
6
+ import { ServerAPIProvider, withServerAPI } from "../Manifest";
7
+ import { LoaderExecutionsChart } from "./loader";
8
+ import { filterLoader } from "../../utils/loader";
9
+ var ChartDimension = /* @__PURE__ */ ((ChartDimension2) => {
10
+ ChartDimension2[ChartDimension2["Loader"] = 0] = "Loader";
11
+ ChartDimension2[ChartDimension2["Process"] = 1] = "Process";
12
+ return ChartDimension2;
13
+ })(ChartDimension || {});
14
+ const LoaderChartBase = ({ project }) => {
15
+ const { root: cwd } = project;
16
+ const [store, setStore] = useState({ filename: "", loaders: [] });
17
+ const [dimension, setDimension] = useState(0 /* Loader */);
18
+ return /* @__PURE__ */ jsxs(Space, { direction: "vertical", style: { width: "100%" }, children: [
19
+ /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetLoaderNames, children: (loaderNames) => /* @__PURE__ */ jsx(LoaderCommonSelect, { onChange: setStore, loaderNames }) }),
20
+ /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetLoaderChartData, children: (res) => {
21
+ const loaders = res.filter((el) => filterLoader(el.resource, el.loader, store.filename, store.loaders));
22
+ return dimension === 0 /* Loader */ ? /* @__PURE__ */ jsx(LoaderExecutionsChart, { loaders, cwd }) : (
23
+ // <ProcessExecutionsChart loaders={loaders} cwd={cwd} pid={pid} />
24
+ /* @__PURE__ */ jsx(Fragment, {})
25
+ );
26
+ } })
27
+ ] });
28
+ };
29
+ const LoaderChart = withServerAPI({
30
+ api: SDK.ServerAPI.API.GetProjectInfo,
31
+ responsePropName: "project",
32
+ Component: LoaderChartBase
33
+ });
34
+ export {
35
+ LoaderChart,
36
+ LoaderChartBase
37
+ };
@@ -0,0 +1,31 @@
1
+ .loader-chart-container .x-axis .tick text {
2
+ transform: translate(28px, 10px) rotate(0) !important;
3
+ font-size: 12px;
4
+ font-weight: 500;
5
+ }
6
+ .loader-chart-container:nth-child(2) text {
7
+ transform: translate(52px, 10px) rotate(0) !important;
8
+ }
9
+ .loader-chart-container:last-child text {
10
+ transform: translate(5px, 10px) rotate(0) !important;
11
+ }
12
+ .loader-chart-container .area .civ {
13
+ transform: translateY(5px);
14
+ }
15
+ .loader-chart-container .area .civ .label-text {
16
+ font-weight: 500;
17
+ font-size: 12px !important;
18
+ transform: translate(8px, 0px);
19
+ }
20
+ .loader-chart-container .area .civ path[fill="#000000"] {
21
+ display: none;
22
+ }
23
+ .loader-chart-container .pia-metrics-y-label {
24
+ display: none;
25
+ }
26
+ .loader-chart-container .pia-metrics-y-label .triangle {
27
+ display: none;
28
+ }
29
+ .loader-chart-container_dark .area .civ .label-text {
30
+ fill: #fff !important;
31
+ }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import './loader.scss';
3
+ import { ChartProps } from './types';
4
+ export declare const LoaderExecutionsChart: React.FC<ChartProps>;
@@ -0,0 +1,68 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useCallback, useMemo, useRef } from "react";
3
+ import { groupBy } from "lodash-es";
4
+ import { Empty } from "antd";
5
+ import "./loader.css";
6
+ import { useTheme } from "../../utils/manifest";
7
+ import { findLoaderTotalTiming } from "../../utils/loader";
8
+ import { beautifyPath } from "../../utils/file";
9
+ import { TimelineCom } from "./TimelineCharts";
10
+ import { renderTotalLoadersTooltip, getTooltipHtmlForLoader } from "./utils";
11
+ const LoaderExecutionsChart = ({ loaders, cwd }) => {
12
+ const { isDark } = useTheme();
13
+ const ref = useRef(null);
14
+ const groupByLoader = useMemo(() => groupBy(loaders, (e) => e.loader), [loaders]);
15
+ const formatterForLoader = useCallback((raw) => {
16
+ const { name, data: data2 } = raw;
17
+ const loaderName = name.replace(" total", "");
18
+ if (data2 == null ? void 0 : data2.ext) {
19
+ return getTooltipHtmlForLoader(data2.ext);
20
+ }
21
+ return renderTotalLoadersTooltip(loaderName, loaders, cwd);
22
+ }, []);
23
+ const data = useMemo(() => {
24
+ return Object.keys(groupByLoader).map((loaderName) => {
25
+ const list = groupByLoader[loaderName] || [];
26
+ if (list.length === 1) {
27
+ const { startAt, endAt } = list[0];
28
+ return {
29
+ p: loaderName,
30
+ n: loaderName,
31
+ s: startAt,
32
+ e: endAt
33
+ };
34
+ }
35
+ const { start, end } = findLoaderTotalTiming(list);
36
+ return {
37
+ p: loaderName,
38
+ n: loaderName,
39
+ s: start,
40
+ e: end,
41
+ c: list.map((e) => {
42
+ return {
43
+ p: loaderName,
44
+ // n: loaderName,
45
+ n: beautifyPath(e.resource, cwd),
46
+ s: e.startAt,
47
+ e: e.endAt,
48
+ ext: e
49
+ };
50
+ })
51
+ };
52
+ });
53
+ }, [groupByLoader]);
54
+ if (!data.length)
55
+ return /* @__PURE__ */ jsx(Empty, {});
56
+ return /* @__PURE__ */ jsx(
57
+ "div",
58
+ {
59
+ className: ["loader-chart-container", isDark ? "loader-chart-container_dark" : ""].join(" ").trim(),
60
+ ref,
61
+ style: { width: "100%", height: "600px" },
62
+ children: /* @__PURE__ */ jsx(TimelineCom, { loaderData: data, formatterFn: formatterForLoader, chartType: "loader" })
63
+ }
64
+ );
65
+ };
66
+ export {
67
+ LoaderExecutionsChart
68
+ };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { CommonChartProps } from './common';
3
+ import './loader.scss';
4
+ import './tooltips.scss';
5
+ export declare const MinifyChartContainer: React.FC<CommonChartProps>;
@@ -0,0 +1,37 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { BarChartOutlined } from "@ant-design/icons";
3
+ import { SDK } from "@rsdoctor/types";
4
+ import { Divider, Space } from "antd";
5
+ import { TextDrawer } from "../TextDrawer";
6
+ import { Summary } from "@rsdoctor/utils/common";
7
+ import { Card } from "../Card";
8
+ import { ServerAPIProvider } from "../Manifest";
9
+ import { WebpackPluginsDataTable } from "../Plugins/webpack";
10
+ import { CommonExecutionEmptyTips, CommonExecutionsChart } from "./common";
11
+ import "./loader.css";
12
+ import "./tooltips.css";
13
+ const MinifyChartContainer = ({ summary }) => {
14
+ const hooks = ["processAssets", "optimizeChunkAssets"];
15
+ const { costs = [] } = summary || {};
16
+ const target = costs.find((e) => e.name === Summary.SummaryCostsDataName.Minify);
17
+ if (!target)
18
+ return null;
19
+ return /* @__PURE__ */ jsx(
20
+ TextDrawer,
21
+ {
22
+ drawerProps: { title: 'Details of the "Minify" stage' },
23
+ text: /* @__PURE__ */ jsxs(Space, { children: [
24
+ "detail",
25
+ /* @__PURE__ */ jsx(BarChartOutlined, {})
26
+ ] }),
27
+ children: /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetPluginData, body: { hooks }, children: (res) => res && res.length ? /* @__PURE__ */ jsxs(Space, { direction: "vertical", style: { width: "100%" }, children: [
28
+ /* @__PURE__ */ jsx(Card, { title: 'Plugin DataSource of the "Minify"', collapsable: true, children: /* @__PURE__ */ jsx(WebpackPluginsDataTable, { dataSource: res }) }),
29
+ /* @__PURE__ */ jsx(Divider, {}),
30
+ /* @__PURE__ */ jsx(Card, { title: 'Chart of the "Minify"', children: /* @__PURE__ */ jsx(CommonExecutionsChart, { plugins: res }) })
31
+ ] }) : /* @__PURE__ */ jsx(CommonExecutionEmptyTips, {}) })
32
+ }
33
+ );
34
+ };
35
+ export {
36
+ MinifyChartContainer
37
+ };
@@ -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 replaceSlashWithNewline(input: string): string;
7
+ export declare function transformDurationMetric(rawData: DurationMetric[]): ITraceEventData[];
8
+ export declare function processTrans(rawData: DurationMetric[]): ITraceEventData[];
9
+ export declare function formatterForPlugins(raw: {
10
+ data: {
11
+ ext: ITraceEventData;
12
+ };
13
+ }): string;
@@ -0,0 +1,203 @@
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
+ function getTooltipHtmlForLoader(loader) {
8
+ return `
9
+ <div class="loader-tooltip-container">
10
+ <div class="loader-tooltip-title">${loader.loader}</div>
11
+ <li class="loader-tooltip-item">
12
+ <span>isPitch</span>
13
+ <span>${loader.isPitch}</span>
14
+ </li>
15
+ <li class="loader-tooltip-item">
16
+ <span>duration</span>
17
+ <span class="loader-tooltip-textbold">${formatCosts(loader.costs)}</span>
18
+ </li>
19
+ <li class="loader-tooltip-item">
20
+ <span>filepath</span>
21
+ <span>${loader.resource}</span>
22
+ </li>
23
+ <li class="loader-tooltip-item">
24
+ <span>start</span>
25
+ <span class="loader-tooltip-textbold">${dayjs(loader.startAt).format("YYYY/MM/DD HH:mm:ss")}</span>
26
+ </li>
27
+ <li class="loader-tooltip-item">
28
+ <span>end</span>
29
+ <span class="loader-tooltip-textbold">${dayjs(loader.endAt).format("YYYY/MM/DD HH:mm:ss")}</span>
30
+ </li>
31
+ </div>
32
+ `.trim();
33
+ }
34
+ function renderTotalLoadersTooltip(loaderName, loaders, cwd) {
35
+ const filter = (loader) => loader.loader === loaderName;
36
+ const filteredLoaders = loaders.filter(filter);
37
+ const resources = filteredLoaders.map((e) => e.resource);
38
+ const nodeModulesResources = resources.filter((e) => e.includes("/node_modules/"));
39
+ const outsideResources = resources.filter((e) => !e.startsWith(cwd));
40
+ const start = minBy(filteredLoaders, (e) => e.startAt).startAt;
41
+ const end = maxBy(filteredLoaders, (e) => e.endAt).endAt;
42
+ const duration = Loader.getLoadersCosts(filter, loaders);
43
+ return `
44
+ <div class="loader-tooltip-container">
45
+ <div class="loader-tooltip-title">${loaderName}</div>
46
+ <li class="loader-tooltip-item">
47
+ <span>files</span>
48
+ <span class="loader-tooltip-textbold">${resources.length}</span>
49
+ </li>
50
+ <li class="loader-tooltip-item">
51
+ <span>files(node_modules)</span>
52
+ <span class="loader-tooltip-textbold">${nodeModulesResources.length}</span>
53
+ </li>
54
+ <li class="loader-tooltip-item">
55
+ <span>files(outside the cwd)</span>
56
+ <span class="loader-tooltip-textbold">${outsideResources.length}</span>
57
+ </li>
58
+ <li class="loader-tooltip-item">
59
+ <span>duration(estimated)</span>
60
+ <span class="loader-tooltip-textbold">${formatCosts(duration)}</span>
61
+ </li>
62
+ <li class="loader-tooltip-item">
63
+ <span>start(min)</span>
64
+ <span>${dayjs(start).format("YYYY/MM/DD HH:mm:ss")}</span>
65
+ </li>
66
+ <li class="loader-tooltip-item">
67
+ <span>end(max)</span>
68
+ <span>${dayjs(end).format("YYYY/MM/DD HH:mm:ss")}</span>
69
+ </li>
70
+ </div>
71
+ `.trim();
72
+ }
73
+ function replaceSlashWithNewline(input) {
74
+ let result = "";
75
+ for (let i = 0; i < input.length; i++) {
76
+ if (input[i] === "/") {
77
+ if (true) {
78
+ result += "/\n";
79
+ } else {
80
+ result += "/";
81
+ }
82
+ } else {
83
+ result += input[i];
84
+ }
85
+ }
86
+ return result;
87
+ }
88
+ function transformDurationMetric(rawData) {
89
+ return rawData.reduce((acc, cur) => {
90
+ if (cur.c) {
91
+ const res = transformDurationMetric(cur.c);
92
+ acc.push(
93
+ {
94
+ name: cur.n,
95
+ ph: ETraceEventPhase.BEGIN,
96
+ pid: cur.p,
97
+ ts: cur.s,
98
+ args: cur
99
+ },
100
+ ...res,
101
+ {
102
+ name: cur.n,
103
+ ph: ETraceEventPhase.END,
104
+ pid: cur.p,
105
+ ts: cur.e,
106
+ args: cur
107
+ }
108
+ );
109
+ } else {
110
+ acc.push({
111
+ name: cur.n,
112
+ ph: ETraceEventPhase.BEGIN,
113
+ pid: cur.p,
114
+ ts: cur.s,
115
+ args: cur
116
+ });
117
+ acc.push({
118
+ name: cur.n,
119
+ ph: ETraceEventPhase.END,
120
+ pid: cur.p,
121
+ ts: cur.e,
122
+ args: cur
123
+ });
124
+ }
125
+ return acc;
126
+ }, []);
127
+ }
128
+ function processTrans(rawData) {
129
+ const processedData = rawData.sort((a, b) => a.s - b.s).reduce((prev, cur) => {
130
+ const ca = prev[cur.p];
131
+ if (ca) {
132
+ loop(ca, cur);
133
+ } else {
134
+ prev[cur.p] = [cur];
135
+ }
136
+ return prev;
137
+ }, {});
138
+ const data = Object.entries(processedData).reduce((prev, [_key, val]) => {
139
+ prev.push(...val);
140
+ return prev;
141
+ }, []);
142
+ return transformDurationMetric(data);
143
+ }
144
+ function loop(dur, target) {
145
+ const queue = [dur];
146
+ while (queue.length > 0) {
147
+ const floor = queue.shift() || [];
148
+ if (floor.length === 0)
149
+ return;
150
+ const curFloorLast = floor[floor.length - 1];
151
+ if (curFloorLast.e <= target.s) {
152
+ return floor.push(target);
153
+ }
154
+ let nextFloor;
155
+ for (let i = floor.length - 1; i >= 0; i--) {
156
+ const { c } = floor[i];
157
+ if (c) {
158
+ nextFloor = c;
159
+ }
160
+ }
161
+ if (nextFloor) {
162
+ queue.push(nextFloor);
163
+ } else {
164
+ curFloorLast.c = [target];
165
+ }
166
+ }
167
+ }
168
+ function formatterForPlugins(raw) {
169
+ const { ext } = raw.data;
170
+ return `
171
+ <div class="loader-tooltip-container">
172
+ <div class="loader-tooltip-title">[${ext.args.p}] ${ext.args.n}</div>
173
+ <li class="loader-tooltip-item">
174
+ <span>hook</span>
175
+ <span>${ext.args.p}</span>
176
+ </li>
177
+ <li class="loader-tooltip-item">
178
+ <span>tap name</span>
179
+ <span>${ext.args.n}</span>
180
+ </li>
181
+ <li class="loader-tooltip-item">
182
+ <span>start</span>
183
+ <span>${dayjs(ext.args.s).format("YYYY/MM/DD HH:mm:ss")}</span>
184
+ </li>
185
+ <li class="loader-tooltip-item">
186
+ <span>end</span>
187
+ <span>${dayjs(ext.args.e).format("YYYY/MM/DD HH:mm:ss")}</span>
188
+ </li>
189
+ <li class="loader-tooltip-item">
190
+ <span>duration</span>
191
+ <span>${formatCosts(ext.args.e - ext.args.s)}</span>
192
+ </li>
193
+ </div>
194
+ `.trim();
195
+ }
196
+ export {
197
+ formatterForPlugins,
198
+ getTooltipHtmlForLoader,
199
+ processTrans,
200
+ renderTotalLoadersTooltip,
201
+ replaceSlashWithNewline,
202
+ transformDurationMetric
203
+ };
@@ -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 {};