@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,4 @@
1
+ const CompileName = "Compile Analysis";
2
+ export {
3
+ CompileName
4
+ };
@@ -0,0 +1,12 @@
1
+ .header-switch .ant-switch-handle {
2
+ top: 1px !important;
3
+ }
4
+ .header-icon {
5
+ user-select: none;
6
+ }
7
+ .header-icon:hover {
8
+ color: #1668dc;
9
+ }
10
+ .header-icon:active {
11
+ color: #40a9ff;
12
+ }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import './header.sass';
3
+ export declare const Header: React.FC;
@@ -0,0 +1,87 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { TranslationOutlined } from "@ant-design/icons";
3
+ import { Col, Dropdown, Layout, Row, Typography } from "antd";
4
+ import { Language, Size } from "../../constants";
5
+ import {
6
+ useI18n,
7
+ useTheme
8
+ } from "../../utils";
9
+ import { OverlayAlertsWithButton } from "../Alerts";
10
+ import { BuilderSelect } from "./builder-select";
11
+ import { Menus } from "./menus";
12
+ import icon from "../../assets/icon.7509d763.svg";
13
+ import "./header.css";
14
+ const Header = () => {
15
+ const { i18n } = useI18n();
16
+ const { isLight } = useTheme();
17
+ const iconStyle = {
18
+ display: "inline-block",
19
+ fontSize: 20,
20
+ textAlign: "center",
21
+ verticalAlign: "middle",
22
+ cursor: "pointer",
23
+ width: 30,
24
+ transition: "all 0.3s ease"
25
+ };
26
+ const languages = [
27
+ { value: Language.Cn, label: "中文" },
28
+ { value: Language.En, label: "English" }
29
+ ];
30
+ return /* @__PURE__ */ jsx(
31
+ Layout.Header,
32
+ {
33
+ style: {
34
+ height: Size.NavBarHeight,
35
+ padding: 0,
36
+ paddingLeft: Size.BasePadding,
37
+ paddingRight: Size.BasePadding,
38
+ position: "fixed",
39
+ zIndex: 999,
40
+ width: "100%",
41
+ backgroundColor: isLight ? "#fff" : "#141414",
42
+ transition: "none"
43
+ },
44
+ children: /* @__PURE__ */ jsxs(Row, { justify: "space-between", align: "middle", style: { height: Size.NavBarHeight }, wrap: false, children: [
45
+ /* @__PURE__ */ jsx(Col, { style: { height: Size.NavBarHeight, lineHeight: `${Size.NavBarHeight + 2}px` }, children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", height: "100%" }, children: [
46
+ /* @__PURE__ */ jsx("img", { style: { height: 30 }, src: icon, className: "web-doctor-logo", alt: "logo" }),
47
+ /* @__PURE__ */ jsx(Typography.Text, { style: { color: "inherit", fontSize: 18, marginLeft: 4 }, children: "Rsdoctor" }),
48
+ /* @__PURE__ */ jsx(BuilderSelect, {})
49
+ ] }) }),
50
+ /* @__PURE__ */ jsx(Col, { flex: 1, children: /* @__PURE__ */ jsxs(
51
+ Row,
52
+ {
53
+ align: "middle",
54
+ justify: "end",
55
+ style: { height: Size.NavBarHeight },
56
+ wrap: false,
57
+ gutter: [Size.BasePadding / 3, 0],
58
+ children: [
59
+ /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsx(OverlayAlertsWithButton, {}) }),
60
+ /* @__PURE__ */ jsx(Menus, { style: { transition: "none" } }),
61
+ /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsx(
62
+ Dropdown,
63
+ {
64
+ overlayStyle: { zIndex: 1e3 },
65
+ menu: {
66
+ items: languages.map((e) => ({
67
+ label: e.label,
68
+ key: e.value,
69
+ onClick() {
70
+ i18n.changeLanguage(e.value);
71
+ }
72
+ })),
73
+ selectedKeys: [i18n.language]
74
+ },
75
+ children: /* @__PURE__ */ jsx(TranslationOutlined, { className: "header-icon", style: iconStyle })
76
+ }
77
+ ) })
78
+ ]
79
+ }
80
+ ) })
81
+ ] })
82
+ }
83
+ );
84
+ };
85
+ export {
86
+ Header
87
+ };
@@ -0,0 +1,5 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export interface LayoutProps {
3
+ children: JSX.Element;
4
+ }
5
+ export declare const Layout: (props: PropsWithChildren<LayoutProps>) => JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useEffect } from "react";
3
+ import { FloatButton, Layout as L } from "antd";
4
+ import { Size } from "../../constants";
5
+ import { Header } from "./header";
6
+ import { useLocale, useI18n } from "../../utils";
7
+ import { Progress } from "./progress";
8
+ const Layout = (props) => {
9
+ const locale = useLocale();
10
+ const { i18n } = useI18n();
11
+ const { children } = props;
12
+ useEffect(() => {
13
+ if (i18n.language !== locale) {
14
+ i18n.changeLanguage(locale);
15
+ }
16
+ }, [locale]);
17
+ return /* @__PURE__ */ jsxs(L, { children: [
18
+ /* @__PURE__ */ jsx(Header, {}),
19
+ /* @__PURE__ */ jsx(Progress, {}),
20
+ /* @__PURE__ */ jsxs(
21
+ L.Content,
22
+ {
23
+ style: { height: "100%", minHeight: "100vh", padding: Size.BasePadding, marginTop: Size.NavBarHeight },
24
+ children: [
25
+ children,
26
+ /* @__PURE__ */ jsx(FloatButton.BackTop, {})
27
+ ]
28
+ }
29
+ )
30
+ ] });
31
+ };
32
+ export {
33
+ Layout
34
+ };
@@ -0,0 +1,8 @@
1
+ import { Manifest } from '@rsdoctor/types';
2
+ import React from 'react';
3
+ export declare const Menus: React.FC<Omit<{
4
+ style?: React.CSSProperties | undefined;
5
+ routes: Manifest.DoctorManifestClientRoutes[];
6
+ }, "routes"> & Partial<{
7
+ body?: any;
8
+ }>>;
@@ -0,0 +1,155 @@
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 } from "react/jsx-runtime";
21
+ import {
22
+ ApiOutlined,
23
+ BarChartOutlined,
24
+ FolderViewOutlined,
25
+ MenuOutlined,
26
+ MonitorOutlined,
27
+ NodeIndexOutlined,
28
+ ToolOutlined
29
+ } from "@ant-design/icons";
30
+ import { Manifest, SDK } from "@rsdoctor/types";
31
+ import { Col, Grid, Menu, Typography } from "antd";
32
+ import { includes } from "lodash-es";
33
+ import { useLocation, useNavigate } from "react-router-dom";
34
+ import WebpackIcon from "../../assets/webpack.98604d64.svg";
35
+ import { Size } from "../../constants";
36
+ import * as OverallConstants from "../../pages/Overall/constants";
37
+ import { useI18n, hasBundle, hasCompile } from "../../utils";
38
+ import { withServerAPI } from "../Manifest";
39
+ import { BundleSize, LoaderFiles, PluginsAnalyze, ModuleResolve, LoaderTimeline } from "../../pages";
40
+ import { CompileName } from "./constants";
41
+ const BuilderSwitchName = "builder-switcher";
42
+ const MenusBase = (props) => {
43
+ const { t } = useI18n();
44
+ const { pathname } = useLocation();
45
+ const navigate = useNavigate();
46
+ const { routes: enableRoutes } = props;
47
+ const iconStyle = {
48
+ fontSize: 16
49
+ };
50
+ const customIconStyle = __spreadProps(__spreadValues({}, iconStyle), {
51
+ transform: "translateY(-2px)"
52
+ });
53
+ const items = [];
54
+ const { xxl } = Grid.useBreakpoint();
55
+ console.log("enableRoutes: ", enableRoutes);
56
+ if (includes(enableRoutes, Manifest.DoctorManifestClientRoutes.Overall)) {
57
+ items.push({
58
+ label: t(OverallConstants.name),
59
+ key: OverallConstants.route,
60
+ icon: /* @__PURE__ */ jsx(BarChartOutlined, { style: iconStyle }),
61
+ children: [],
62
+ onTitleClick(e) {
63
+ navigate(e.key);
64
+ }
65
+ });
66
+ }
67
+ if (hasCompile(enableRoutes)) {
68
+ items.push({
69
+ label: t(CompileName),
70
+ key: CompileName,
71
+ icon: /* @__PURE__ */ jsx(ToolOutlined, { style: iconStyle }),
72
+ children: [
73
+ includes(enableRoutes, Manifest.DoctorManifestClientRoutes.WebpackLoaders) && {
74
+ label: /* @__PURE__ */ jsx(Typography.Text, { style: { marginRight: 8 }, children: t(LoaderFiles.name) }),
75
+ key: LoaderFiles.route,
76
+ icon: /* @__PURE__ */ jsx("img", { src: WebpackIcon, alt: "", style: __spreadProps(__spreadValues({}, iconStyle), { width: 16 }) }),
77
+ children: [
78
+ {
79
+ label: t(LoaderTimeline.name),
80
+ key: LoaderTimeline.route,
81
+ icon: /* @__PURE__ */ jsx(BarChartOutlined, { style: iconStyle })
82
+ },
83
+ {
84
+ label: t(LoaderFiles.name),
85
+ key: LoaderFiles.route,
86
+ icon: /* @__PURE__ */ jsx(MonitorOutlined, { style: iconStyle })
87
+ }
88
+ ]
89
+ },
90
+ includes(enableRoutes, Manifest.DoctorManifestClientRoutes.ModuleResolve) && {
91
+ label: t(ModuleResolve.name),
92
+ key: ModuleResolve.route,
93
+ icon: /* @__PURE__ */ jsx(NodeIndexOutlined, { style: iconStyle })
94
+ },
95
+ includes(enableRoutes, Manifest.DoctorManifestClientRoutes.WebpackPlugins) && {
96
+ label: t(PluginsAnalyze.name),
97
+ key: PluginsAnalyze.route,
98
+ icon: /* @__PURE__ */ jsx(ApiOutlined, { style: iconStyle })
99
+ }
100
+ ].filter((e) => Boolean(e))
101
+ });
102
+ }
103
+ if (hasBundle(enableRoutes)) {
104
+ items.push({
105
+ label: t(BundleSize.name),
106
+ key: BundleSize.name,
107
+ icon: /* @__PURE__ */ jsx("span", { style: customIconStyle, children: "📦" }),
108
+ children: [
109
+ includes(enableRoutes, Manifest.DoctorManifestClientRoutes.BundleSize) && {
110
+ label: t(BundleSize.name),
111
+ key: BundleSize.route,
112
+ icon: /* @__PURE__ */ jsx(FolderViewOutlined, { style: iconStyle })
113
+ }
114
+ // TODO: Tree shaking menu
115
+ // includes(enableRoutes, Manifest.DoctorManifestClientRoutes.TreeShaking) && {
116
+ // label: t(TreeShakingConstants.name),
117
+ // key: TreeShakingConstants.route,
118
+ // icon: <ShakeOutlined style={iconStyle} />,
119
+ // },
120
+ ].filter((e) => Boolean(e))
121
+ });
122
+ }
123
+ const MenuComponent = /* @__PURE__ */ jsx(
124
+ Menu,
125
+ {
126
+ items,
127
+ mode: "horizontal",
128
+ onClick: (e) => {
129
+ if (!e.keyPath.includes(BuilderSwitchName)) {
130
+ navigate(e.key);
131
+ }
132
+ },
133
+ overflowedIndicator: /* @__PURE__ */ jsx(MenuOutlined, {}),
134
+ style: __spreadValues({ height: Size.NavBarHeight, lineHeight: `${Size.NavBarHeight}px` }, props.style),
135
+ selectedKeys: [pathname === "/" ? OverallConstants.route : pathname]
136
+ },
137
+ enableRoutes.join("")
138
+ );
139
+ if (items.length <= 2) {
140
+ return /* @__PURE__ */ jsx(Col, { children: MenuComponent });
141
+ }
142
+ if (xxl) {
143
+ return /* @__PURE__ */ jsx(Col, { children: MenuComponent });
144
+ }
145
+ return /* @__PURE__ */ jsx(Col, { xs: { span: 3 }, md: { span: 6 }, lg: { span: 10 }, xl: { span: 11 }, children: MenuComponent });
146
+ };
147
+ const Menus = withServerAPI({
148
+ api: SDK.ServerAPI.API.GetClientRoutes,
149
+ responsePropName: "routes",
150
+ Component: MenusBase,
151
+ fallbackComponent: () => null
152
+ });
153
+ export {
154
+ Menus
155
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { SDK } from '@rsdoctor/types';
3
+ export interface ProgressProps {
4
+ progress: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.APIExtends.GetCompileProgess>;
5
+ }
6
+ export declare const Progress: React.FC<Omit<ProgressProps, "progress"> & Partial<{
7
+ body?: any;
8
+ }>>;
@@ -0,0 +1,44 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Col, Progress as P, Row, Typography } from "antd";
3
+ import { SDK } from "@rsdoctor/types";
4
+ import { Size } from "../../constants";
5
+ import { withServerAPI } from "../Manifest";
6
+ const ProgressBase = ({ progress }) => {
7
+ if (!progress)
8
+ return null;
9
+ const { percentage = 1, message } = progress;
10
+ if (percentage >= 1)
11
+ return null;
12
+ const per = +(percentage * 100).toFixed(1);
13
+ return /* @__PURE__ */ jsx(
14
+ Row,
15
+ {
16
+ wrap: true,
17
+ style: {
18
+ width: "100%",
19
+ position: "fixed",
20
+ top: Size.NavBarHeight,
21
+ left: 1,
22
+ zIndex: 99
23
+ },
24
+ children: /* @__PURE__ */ jsx(Col, { span: Math.min(Math.floor(percentage * 24), 24), children: /* @__PURE__ */ jsx(
25
+ P,
26
+ {
27
+ percent: 100,
28
+ status: "active",
29
+ size: "small",
30
+ format: () => /* @__PURE__ */ jsx(Typography.Text, { style: { fontSize: 12 }, type: "secondary", children: `${per}% ${message}` })
31
+ }
32
+ ) })
33
+ }
34
+ );
35
+ };
36
+ const Progress = withServerAPI({
37
+ api: SDK.ServerAPI.APIExtends.GetCompileProgess,
38
+ responsePropName: "progress",
39
+ Component: ProgressBase,
40
+ fallbackComponent: () => null
41
+ });
42
+ export {
43
+ Progress
44
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { SDK } from '@rsdoctor/types';
3
+ export declare const LoaderFiles: React.FC<{
4
+ filetree: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileTree>;
5
+ cwd: string;
6
+ loaders: string[];
7
+ filename: string;
8
+ }>;
@@ -0,0 +1,187 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import React, { useMemo, useState } from "react";
3
+ import { endsWith, get, sumBy } from "lodash-es";
4
+ import { Card, Col, Descriptions, Divider, Drawer, Row, Space, Table, Tooltip, Typography } from "antd";
5
+ import { CloseCircleOutlined } from "@ant-design/icons";
6
+ import { Constants, SDK } from "@rsdoctor/types";
7
+ import { ServerAPIProvider } from "../../Manifest";
8
+ import { drawerWidth, Size } from "../../../constants";
9
+ import { createFileStructures, formatCosts, mapFileKey, filterLoader } from "../../../utils";
10
+ import { LoaderExecutions } from "../executions";
11
+ import { FileTree } from "../../FileTree";
12
+ import { Keyword } from "../../Keyword";
13
+ import { ECMAVersionDetectTag } from "../../worker/ecmaversion/client";
14
+ const LoaderFiles = (props) => {
15
+ const { cwd, filetree } = props;
16
+ const [drawerVisible, setDrawerVisible] = useState(false);
17
+ const [resourcePath, setResourcePath] = useState("");
18
+ const [loaderIndex, setLoaderIndex] = useState(0);
19
+ const [selectedNode, setSelectedNode] = useState(null);
20
+ const maxHeight = 700;
21
+ const filteredFiles = useMemo(
22
+ () => filetree.filter((e) => e.loaders.some((l) => filterLoader(e.path, l.loader, props.filename, props.loaders))),
23
+ [props.filename, props.loaders]
24
+ );
25
+ const inlinedResourcePathKey = "__RESOURCEPATH__";
26
+ const files = useMemo(() => {
27
+ return createFileStructures({
28
+ files: filteredFiles.map((e) => e.path),
29
+ cwd,
30
+ fileTitle(file, basename) {
31
+ const { loaders } = filetree.find((e) => e.path === file);
32
+ return /* @__PURE__ */ jsxs(
33
+ Space,
34
+ {
35
+ style: { wordBreak: "break-all" },
36
+ onClick: () => {
37
+ setLoaderIndex(0);
38
+ setResourcePath(file);
39
+ setDrawerVisible(true);
40
+ },
41
+ children: [
42
+ /* @__PURE__ */ jsx(Keyword, { text: basename, keyword: props.filename }),
43
+ endsWith(file, Constants.JSExtension) ? /* @__PURE__ */ jsx(
44
+ ServerAPIProvider,
45
+ {
46
+ api: SDK.ServerAPI.API.GetLoaderFileFirstInput,
47
+ body: { file },
48
+ fallbackComponent: () => null,
49
+ children: (res) => /* @__PURE__ */ jsx(ECMAVersionDetectTag, { code: res })
50
+ }
51
+ ) : null,
52
+ loaders.map((e, i) => {
53
+ const isError = e.errors && e.errors.length;
54
+ const key = `${file}_${e.loader}_${i}`;
55
+ return /* @__PURE__ */ jsx(Tooltip, { title: e.path, children: /* @__PURE__ */ jsxs(
56
+ Typography.Text,
57
+ {
58
+ code: true,
59
+ style: { color: isError ? "#f50" : "inherit" },
60
+ onClick: (ev) => {
61
+ ev.stopPropagation();
62
+ setResourcePath(file);
63
+ setLoaderIndex(i);
64
+ setDrawerVisible(true);
65
+ },
66
+ children: [
67
+ /* @__PURE__ */ jsx(Typography.Text, { style: { maxWidth: 135, color: "inherit" }, ellipsis: true, children: e.loader }),
68
+ /* @__PURE__ */ jsx(Divider, { type: "vertical" }),
69
+ isError ? /* @__PURE__ */ jsx(CloseCircleOutlined, {}) : /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: formatCosts(e.costs) })
70
+ ]
71
+ }
72
+ ) }, key);
73
+ })
74
+ ]
75
+ }
76
+ );
77
+ },
78
+ dirTitle(_dir, defaultTitle) {
79
+ return /* @__PURE__ */ jsx(Keyword, { text: defaultTitle, keyword: props.filename });
80
+ }
81
+ });
82
+ }, [filteredFiles]);
83
+ return /* @__PURE__ */ jsxs(Row, { style: { width: "100%" }, gutter: Size.BasePadding, children: [
84
+ /* @__PURE__ */ jsx(Col, { span: 14, children: /* @__PURE__ */ jsxs(
85
+ Card,
86
+ {
87
+ title: /* @__PURE__ */ jsxs(Typography.Text, { strong: true, children: [
88
+ "Total Files: ",
89
+ filteredFiles.length
90
+ ] }),
91
+ bodyStyle: { overflow: "scroll", maxHeight },
92
+ children: [
93
+ /* @__PURE__ */ jsx(
94
+ FileTree,
95
+ {
96
+ defaultExpandedKeys: mapFileKey(files, filteredFiles.length >= 100 ? 3 : 4, (node) => {
97
+ const resourcePath2 = get(node, inlinedResourcePathKey);
98
+ const isNodeModules = resourcePath2.indexOf("/node_modules/") > -1;
99
+ return !isNodeModules;
100
+ }),
101
+ treeData: files,
102
+ onSelect: (_e, info) => {
103
+ if (!info.node.isLeaf) {
104
+ setSelectedNode(info.node);
105
+ }
106
+ },
107
+ selectedKeys: selectedNode ? [selectedNode.key] : void 0,
108
+ expandAction: "click"
109
+ },
110
+ `${props.loaders.join("|")}_${props.filename}`
111
+ ),
112
+ /* @__PURE__ */ jsx(
113
+ Drawer,
114
+ {
115
+ open: drawerVisible,
116
+ onClose: () => setDrawerVisible(false),
117
+ maskClosable: true,
118
+ width: drawerWidth,
119
+ zIndex: 999,
120
+ bodyStyle: { padding: 0 },
121
+ children: drawerVisible ? /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetLoaderFileDetails, body: { path: resourcePath }, children: (data) => /* @__PURE__ */ jsx(LoaderExecutions, { data, cwd, index: loaderIndex }) }) : null
122
+ }
123
+ )
124
+ ]
125
+ }
126
+ ) }),
127
+ selectedNode ? /* @__PURE__ */ jsx(Col, { span: 10, children: /* @__PURE__ */ jsx(
128
+ Card,
129
+ {
130
+ title: /* @__PURE__ */ jsx(
131
+ Tooltip,
132
+ {
133
+ title: React.cloneElement(selectedNode.title, { style: { color: "#fff" } }),
134
+ children: /* @__PURE__ */ jsxs(Typography.Text, { children: [
135
+ 'Statistics of "',
136
+ selectedNode.title,
137
+ '"'
138
+ ] })
139
+ }
140
+ ),
141
+ children: /* @__PURE__ */ jsx(
142
+ ServerAPIProvider,
143
+ {
144
+ api: SDK.ServerAPI.API.GetLoaderFolderStatistics,
145
+ body: { folder: selectedNode[inlinedResourcePathKey] },
146
+ children: (tableData) => /* @__PURE__ */ jsx(
147
+ Table,
148
+ {
149
+ style: { width: "100%", maxHeight, overflowY: "scroll", wordBreak: "break-all" },
150
+ pagination: false,
151
+ bordered: true,
152
+ rowKey: (e) => e.loader,
153
+ columns: [
154
+ {
155
+ title: "Loader Name",
156
+ dataIndex: "loader"
157
+ },
158
+ {
159
+ title: "Files",
160
+ dataIndex: "files"
161
+ },
162
+ {
163
+ title: "Total Duration",
164
+ dataIndex: "costs",
165
+ render: (v) => /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: formatCosts(v) }),
166
+ sorter: (a, b) => a.costs - b.costs,
167
+ defaultSortOrder: "descend",
168
+ sortDirections: ["descend", "ascend"]
169
+ }
170
+ ],
171
+ dataSource: tableData,
172
+ footer: () => /* @__PURE__ */ jsxs(Descriptions, { title: "Total", bordered: true, layout: "vertical", size: "small", children: [
173
+ /* @__PURE__ */ jsx(Descriptions.Item, { label: "loaders", children: tableData.length }),
174
+ /* @__PURE__ */ jsx(Descriptions.Item, { label: "files", children: sumBy(tableData, (e) => e.files) }),
175
+ /* @__PURE__ */ jsx(Descriptions.Item, { label: "duration", children: /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: formatCosts(sumBy(tableData, (e) => e.costs)) }) })
176
+ ] })
177
+ }
178
+ )
179
+ }
180
+ )
181
+ }
182
+ ) }) : null
183
+ ] });
184
+ };
185
+ export {
186
+ LoaderFiles
187
+ };
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export declare const LoaderAnalysisBase: React.FC<{
3
+ cwd: string;
4
+ }>;
5
+ export declare const LoaderAnalysis: React.FC<Omit<{
6
+ cwd: string;
7
+ }, "cwd"> & Partial<{
8
+ body: {
9
+ key: import("@rsdoctor/types/dist/manifest").DoctorManifestMappingKeys;
10
+ };
11
+ }>>;
@@ -0,0 +1,23 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { SDK } from "@rsdoctor/types";
4
+ import { ServerAPIProvider, withServerAPI } from "../../Manifest";
5
+ import { LoaderFiles } from "./files";
6
+ import { LoaderCommonSelect } from "../../Select";
7
+ const LoaderAnalysisBase = ({ cwd }) => {
8
+ const [store, setStore] = useState({ filename: "", loaders: [] });
9
+ return /* @__PURE__ */ jsxs("div", { children: [
10
+ /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetLoaderNames, children: (loaderNames) => /* @__PURE__ */ jsx(LoaderCommonSelect, { onChange: (e) => setStore(e), loaderNames }) }),
11
+ /* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetLoaderFileTree, children: (filetree) => /* @__PURE__ */ jsx(LoaderFiles, { filename: store.filename, filetree, loaders: store.loaders, cwd }) })
12
+ ] });
13
+ };
14
+ const LoaderAnalysis = withServerAPI({
15
+ api: SDK.ServerAPI.API.LoadDataByKey,
16
+ body: { key: "root" },
17
+ responsePropName: "cwd",
18
+ Component: LoaderAnalysisBase
19
+ });
20
+ export {
21
+ LoaderAnalysis,
22
+ LoaderAnalysisBase
23
+ };
@@ -0,0 +1,13 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { SDK } from '@rsdoctor/types';
3
+ interface LoaderExecutionsProps {
4
+ cwd: string;
5
+ data: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileDetails>;
6
+ index?: number;
7
+ }
8
+ export declare const LoaderExecutions: ({
9
+ data,
10
+ cwd,
11
+ index
12
+ }: PropsWithChildren<LoaderExecutionsProps>) => JSX.Element;
13
+ export {};