@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,47 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useEffect } from "react";
3
+ import { SDK } from "@rsdoctor/types";
4
+ import { hasViewModeFromStorage, useBundleAlertsByErrors, useViewMode } from "../../utils";
5
+ import { CommonAlertsContainer } from "./common";
6
+ import { withServerAPI } from "../Manifest";
7
+ import { ViewMode } from "../../constants";
8
+ import { PackageRelationReasonsWithServer } from "../Alert/package-relation";
9
+ const BundleAlertsBase = ({ filter, project }) => {
10
+ const { errors, root: cwd } = project;
11
+ const bundleAlerts = useBundleAlertsByErrors(errors);
12
+ const { setBundleAlertsViewMode, viewMode, setViewMode } = useViewMode();
13
+ const dataSource = filter ? bundleAlerts.filter(filter) : bundleAlerts;
14
+ useEffect(() => {
15
+ if (!hasViewModeFromStorage()) {
16
+ setViewMode(
17
+ {
18
+ bundleAlerts: bundleAlerts.length >= 5 ? ViewMode.Group : ViewMode.List
19
+ },
20
+ false
21
+ );
22
+ }
23
+ }, []);
24
+ return /* @__PURE__ */ jsx(
25
+ CommonAlertsContainer,
26
+ {
27
+ title: "Bundle Alerts",
28
+ dataSource,
29
+ extraData: {
30
+ cwd,
31
+ getPackageRelationContentComponent: (res) => /* @__PURE__ */ jsx(PackageRelationReasonsWithServer, { body: { id: res.data.id, target: res.package.target }, cwd })
32
+ },
33
+ viewMode: viewMode.bundleAlerts,
34
+ setViewMode: setBundleAlertsViewMode,
35
+ cwd
36
+ }
37
+ );
38
+ };
39
+ const BundleAlerts = withServerAPI({
40
+ api: SDK.ServerAPI.API.GetProjectInfo,
41
+ responsePropName: "project",
42
+ Component: BundleAlertsBase
43
+ });
44
+ export {
45
+ BundleAlerts,
46
+ BundleAlertsBase
47
+ };
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { Rule } from '@rsdoctor/types';
3
+ import { ViewMode } from '../../constants';
4
+ import { AlertProps } from '../Alert/types';
5
+ interface CommonAlertsContainerProps {
6
+ title: string;
7
+ cwd: string;
8
+ dataSource: Rule.RuleStoreDataItem[];
9
+ extraData: Omit<AlertProps, 'data'>;
10
+ viewMode: ViewMode;
11
+ setViewMode(mode: ViewMode): void;
12
+ extraCom?: JSX.Element | undefined;
13
+ }
14
+ export declare const CommonAlertsContainer: React.FC<CommonAlertsContainerProps>;
15
+ export {};
@@ -0,0 +1,106 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ import { jsx, jsxs } from "react/jsx-runtime";
18
+ import { Collapse, Space, Radio, Typography, Tooltip } from "antd";
19
+ import { useMemo } from "react";
20
+ import { AppstoreOutlined, UnorderedListOutlined } from "@ant-design/icons";
21
+ import { Rule } from "@rsdoctor/types";
22
+ import { groupBy, values } from "lodash-es";
23
+ import { Size, ViewMode } from "../../constants";
24
+ import { Alert } from "../Alert";
25
+ import { Card } from "../Card";
26
+ import { Badge as Bdg } from "../Badge";
27
+ const LevelMap = {
28
+ warn: 1,
29
+ error: 2
30
+ };
31
+ const CommonAlertsList = ({ dataSource, extraData }) => {
32
+ const _dataSource = useMemo(
33
+ () => dataSource.slice().sort((a, b) => {
34
+ return LevelMap[b.level] - LevelMap[a.level];
35
+ }),
36
+ [dataSource]
37
+ );
38
+ return /* @__PURE__ */ jsx(Space, { direction: "vertical", style: { wordBreak: "break-all", width: "100%" }, children: _dataSource.map((err, i) => {
39
+ return /* @__PURE__ */ jsx(Alert, __spreadValues({ data: err }, extraData), i);
40
+ }) });
41
+ };
42
+ const CommonAlertsGroup = ({ dataSource, extraData }) => {
43
+ const _dataSource = useMemo(() => values(groupBy(dataSource, (e) => e.code)), [dataSource]);
44
+ return /* @__PURE__ */ jsx(Space, { direction: "vertical", style: { wordBreak: "break-all", width: "100%" }, children: /* @__PURE__ */ jsx(Collapse, { children: _dataSource.map((el) => {
45
+ var _a;
46
+ const [first] = el;
47
+ return /* @__PURE__ */ jsx(
48
+ Collapse.Panel,
49
+ {
50
+ header: /* @__PURE__ */ jsxs(Space, { children: [
51
+ /* @__PURE__ */ jsx(Typography.Text, { code: true, strong: true, style: { cursor: "pointer" }, children: first.code }),
52
+ /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: ((_a = Rule.RuleErrorMap[first.code]) == null ? void 0 : _a.title) || first.title }),
53
+ /* @__PURE__ */ jsx(Bdg, { label: "count", value: el.length, type: "error" })
54
+ ] }),
55
+ children: /* @__PURE__ */ jsx(Space, { direction: "vertical", size: 16, children: el.map((err, i) => {
56
+ return /* @__PURE__ */ jsx(Alert, __spreadValues({ data: err }, extraData), i);
57
+ }) })
58
+ },
59
+ first.code
60
+ );
61
+ }) }) });
62
+ };
63
+ const CommonAlertsContainer = ({
64
+ title,
65
+ dataSource,
66
+ extraData,
67
+ viewMode,
68
+ setViewMode,
69
+ extraCom
70
+ }) => {
71
+ if (!dataSource.length)
72
+ return null;
73
+ return /* @__PURE__ */ jsx(
74
+ Card,
75
+ {
76
+ title,
77
+ style: { marginTop: Size.BasePadding },
78
+ collapsable: true,
79
+ extra: extraCom || /* @__PURE__ */ jsx(
80
+ Radio.Group,
81
+ {
82
+ options: [
83
+ {
84
+ label: /* @__PURE__ */ jsx(Tooltip, { title: "display by list", children: /* @__PURE__ */ jsx(UnorderedListOutlined, {}) }),
85
+ value: ViewMode.List
86
+ },
87
+ {
88
+ label: /* @__PURE__ */ jsx(Tooltip, { title: "display by group", children: /* @__PURE__ */ jsx(AppstoreOutlined, {}) }),
89
+ value: ViewMode.Group
90
+ }
91
+ ],
92
+ value: viewMode,
93
+ optionType: "button",
94
+ size: "small",
95
+ onChange: (v) => {
96
+ setViewMode(v.target.value);
97
+ }
98
+ }
99
+ ),
100
+ children: viewMode === ViewMode.List ? /* @__PURE__ */ jsx(CommonAlertsList, { dataSource, extraData }) : /* @__PURE__ */ jsx(CommonAlertsGroup, { dataSource, extraData })
101
+ }
102
+ );
103
+ };
104
+ export {
105
+ CommonAlertsContainer
106
+ };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { Rule, SDK } from '@rsdoctor/types';
3
+ interface CompileAlertsProps {
4
+ filter?(alert: Rule.RuleStoreDataItem): boolean;
5
+ project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
6
+ }
7
+ export declare const CompileAlerts: React.FC<Omit<CompileAlertsProps, "project"> & Partial<{
8
+ body?: any;
9
+ }>>;
10
+ export {};
@@ -0,0 +1,46 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useEffect } from "react";
3
+ import { SDK } from "@rsdoctor/types";
4
+ import { hasViewModeFromStorage, useCompileAlertsByErrors, useViewMode } from "../../utils";
5
+ import { CommonAlertsContainer } from "./common";
6
+ import { withServerAPI } from "../Manifest";
7
+ import { ViewMode } from "../../constants";
8
+ import { PackageRelationReasonsWithServer } from "../Alert/package-relation";
9
+ const CompileAlertsBase = ({ filter, project }) => {
10
+ const { root: cwd, errors } = project;
11
+ const compileAlerts = useCompileAlertsByErrors(errors);
12
+ const { setCompileAlertsViewMode, viewMode, setViewMode } = useViewMode();
13
+ const dataSource = filter ? compileAlerts.filter(filter) : compileAlerts;
14
+ useEffect(() => {
15
+ if (!hasViewModeFromStorage()) {
16
+ setViewMode(
17
+ {
18
+ compileAlerts: compileAlerts.length >= 5 ? ViewMode.Group : ViewMode.List
19
+ },
20
+ false
21
+ );
22
+ }
23
+ }, []);
24
+ return /* @__PURE__ */ jsx(
25
+ CommonAlertsContainer,
26
+ {
27
+ title: "Compile Alerts",
28
+ dataSource,
29
+ extraData: {
30
+ cwd,
31
+ getPackageRelationContentComponent: (res) => /* @__PURE__ */ jsx(PackageRelationReasonsWithServer, { body: { id: res.data.id, target: res.package.target }, cwd })
32
+ },
33
+ viewMode: viewMode.compileAlerts,
34
+ setViewMode: setCompileAlertsViewMode,
35
+ cwd
36
+ }
37
+ );
38
+ };
39
+ const CompileAlerts = withServerAPI({
40
+ api: SDK.ServerAPI.API.GetProjectInfo,
41
+ responsePropName: "project",
42
+ Component: CompileAlertsBase
43
+ });
44
+ export {
45
+ CompileAlerts
46
+ };
@@ -0,0 +1,3 @@
1
+ export * from './bundle';
2
+ export * from './compile';
3
+ export * from './overlay';
@@ -0,0 +1,3 @@
1
+ export * from "./bundle";
2
+ export * from "./compile";
3
+ export * from "./overlay";
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { SDK } from '@rsdoctor/types';
3
+ import 'rc-dialog/assets/index.css';
4
+ export declare const OverlayAlertsModal: React.FC<{
5
+ alerts: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetOverlayAlerts>;
6
+ open: boolean;
7
+ onClose(): void;
8
+ }>;
9
+ export declare const OverlayAlertsTips: React.FC<{
10
+ alerts: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetOverlayAlerts>;
11
+ defaultOpen?: boolean;
12
+ }>;
13
+ export declare const OverlayAlertsButton: React.FC<{
14
+ alerts: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetOverlayAlerts>;
15
+ }>;
16
+ export declare const OverlayAlertsWithButton: React.FC<Omit<{
17
+ alerts: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetOverlayAlerts>;
18
+ }, "alerts"> & Partial<{
19
+ body?: any;
20
+ }>>;
21
+ export declare const OverlayAlertsWithTips: React.FC<Omit<{
22
+ alerts: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetOverlayAlerts>;
23
+ defaultOpen?: boolean | undefined;
24
+ }, "alerts"> & Partial<{
25
+ body?: any;
26
+ }>>;
@@ -0,0 +1,154 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import React, { useState } from "react";
3
+ import { SDK } from "@rsdoctor/types";
4
+ import { Alert, Button, Col, Collapse, Row, Tag, Typography } from "antd";
5
+ import { BugOutlined, CloseCircleOutlined, DownOutlined, RightOutlined } from "@ant-design/icons";
6
+ import Dialog from "rc-dialog";
7
+ import Ansi from "ansi-to-react";
8
+ import { withServerAPI } from "../Manifest";
9
+ import { Size, Color } from "../../constants";
10
+ import "rc-dialog/assets/index.css";
11
+ function getOverlayAlertsMessage(alerts) {
12
+ let warns = 0;
13
+ let errors = 0;
14
+ alerts.forEach((item) => {
15
+ if (item.level === "warn") {
16
+ warns++;
17
+ } else {
18
+ errors++;
19
+ }
20
+ });
21
+ const suffixText = warns !== 0 && errors !== 0 ? "problems" : warns === 0 ? "errors" : "warns";
22
+ const fontSize = 16;
23
+ return {
24
+ title: `${alerts.length} compiled ${suffixText}`,
25
+ detail: /* @__PURE__ */ jsxs(Typography.Text, { strong: true, style: { color: "#fff", marginBottom: 0 }, children: [
26
+ /* @__PURE__ */ jsx(Typography.Text, { style: { color: "inherit", fontSize }, children: "Compiled with " }),
27
+ /* @__PURE__ */ jsxs(Typography.Text, { strong: true, style: { color: Color.Red, fontSize }, children: [
28
+ errors,
29
+ " errors"
30
+ ] }),
31
+ /* @__PURE__ */ jsx(Typography.Text, { style: { color: "inherit", fontSize }, children: " and " }),
32
+ /* @__PURE__ */ jsxs(Typography.Text, { strong: true, style: { color: Color.Yellow, fontSize }, children: [
33
+ warns,
34
+ " warnings"
35
+ ] })
36
+ ] }),
37
+ warns,
38
+ errors
39
+ };
40
+ }
41
+ const OverlayAlertsModal = ({ alerts = [], open, onClose }) => {
42
+ if (!alerts.length)
43
+ return null;
44
+ return /* @__PURE__ */ jsxs(
45
+ Dialog,
46
+ {
47
+ visible: open,
48
+ onClose: () => onClose(),
49
+ style: { width: "100%", height: "100%", margin: 0, zIndex: 1e3 },
50
+ closable: false,
51
+ modalRender: (e) => {
52
+ return React.cloneElement(e, {
53
+ style: {
54
+ background: "rgba(0, 0, 0, 0.7)",
55
+ color: "#fff",
56
+ height: "100%",
57
+ overflow: "scroll",
58
+ borderRadius: 0
59
+ }
60
+ });
61
+ },
62
+ children: [
63
+ /* @__PURE__ */ jsxs(Row, { justify: "space-between", align: "middle", children: [
64
+ getOverlayAlertsMessage(alerts).detail,
65
+ /* @__PURE__ */ jsx(
66
+ Button,
67
+ {
68
+ onClick: () => onClose(),
69
+ type: "text",
70
+ style: { color: "#fff" },
71
+ size: "large",
72
+ icon: /* @__PURE__ */ jsx(CloseCircleOutlined, {})
73
+ }
74
+ )
75
+ ] }),
76
+ /* @__PURE__ */ jsx(Row, { gutter: [0, Size.BasePadding], children: alerts.map((e) => {
77
+ return /* @__PURE__ */ jsx(Col, { span: 24, style: { whiteSpace: "pre-wrap", lineHeight: `16px`, fontSize: 14 }, children: /* @__PURE__ */ jsx(
78
+ Collapse,
79
+ {
80
+ ghost: true,
81
+ style: { background: "#000" },
82
+ defaultActiveKey: [e.id],
83
+ expandIcon: (e2) => {
84
+ return e2.isActive ? /* @__PURE__ */ jsx(DownOutlined, { style: { color: "#fff" } }) : /* @__PURE__ */ jsx(RightOutlined, { style: { color: "#fff" } });
85
+ },
86
+ children: /* @__PURE__ */ jsx(
87
+ Collapse.Panel,
88
+ {
89
+ header: /* @__PURE__ */ jsxs("div", { style: { color: "#fff" }, children: [
90
+ e.level === "warn" ? /* @__PURE__ */ jsx(Tag, { color: Color.Yellow, children: "WARNING" }) : /* @__PURE__ */ jsx(Tag, { color: Color.Red, children: "ERROR" }),
91
+ /* @__PURE__ */ jsx(Ansi, { children: e.description || e.title })
92
+ ] }),
93
+ children: /* @__PURE__ */ jsx("div", { style: { color: "#fff" }, children: /* @__PURE__ */ jsx(Ansi, { children: e.stack }) })
94
+ },
95
+ e.id
96
+ )
97
+ }
98
+ ) }, e.id);
99
+ }) })
100
+ ]
101
+ }
102
+ );
103
+ };
104
+ const OverlayAlertsTips = ({ alerts = [], defaultOpen = alerts.length > 0 }) => {
105
+ if (!alerts.length)
106
+ return null;
107
+ const [open, setOpen] = useState(defaultOpen);
108
+ return /* @__PURE__ */ jsxs(React.Fragment, { children: [
109
+ /* @__PURE__ */ jsx(
110
+ Alert,
111
+ {
112
+ banner: true,
113
+ message: React.cloneElement(getOverlayAlertsMessage(alerts).detail, {
114
+ style: {
115
+ color: "#000"
116
+ }
117
+ }),
118
+ icon: /* @__PURE__ */ jsx(BugOutlined, {}),
119
+ action: /* @__PURE__ */ jsx(Button, { onClick: () => setOpen(true), size: "small", children: "More" })
120
+ }
121
+ ),
122
+ /* @__PURE__ */ jsx(OverlayAlertsModal, { alerts, open, onClose: () => setOpen(false) })
123
+ ] });
124
+ };
125
+ const OverlayAlertsButton = ({ alerts = [] }) => {
126
+ if (!alerts.length)
127
+ return null;
128
+ const { errors } = getOverlayAlertsMessage(alerts);
129
+ const defaultOpen = errors > 0;
130
+ const [open, setOpen] = useState(defaultOpen);
131
+ return /* @__PURE__ */ jsxs(React.Fragment, { children: [
132
+ /* @__PURE__ */ jsx(Button, { icon: /* @__PURE__ */ jsx(BugOutlined, {}), danger: true, size: "small", onClick: () => setOpen(!open), children: getOverlayAlertsMessage(alerts).title }),
133
+ /* @__PURE__ */ jsx(OverlayAlertsModal, { alerts, open, onClose: () => setOpen(false) })
134
+ ] });
135
+ };
136
+ const OverlayAlertsWithButton = withServerAPI({
137
+ api: SDK.ServerAPI.API.GetOverlayAlerts,
138
+ Component: OverlayAlertsButton,
139
+ responsePropName: "alerts",
140
+ fallbackComponent: () => null
141
+ });
142
+ const OverlayAlertsWithTips = withServerAPI({
143
+ api: SDK.ServerAPI.API.GetOverlayAlerts,
144
+ Component: OverlayAlertsTips,
145
+ responsePropName: "alerts",
146
+ fallbackComponent: () => null
147
+ });
148
+ export {
149
+ OverlayAlertsButton,
150
+ OverlayAlertsModal,
151
+ OverlayAlertsTips,
152
+ OverlayAlertsWithButton,
153
+ OverlayAlertsWithTips
154
+ };
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export declare enum BadgeType {
3
+ Default = "default",
4
+ Success = "success",
5
+ Warn = "warn",
6
+ Error = "error",
7
+ }
8
+ export declare const BadgeColorMap: {
9
+ default: string;
10
+ success: string;
11
+ warn: string;
12
+ error: string;
13
+ };
14
+ interface BadgeProps {
15
+ label: string | number | React.ReactNode;
16
+ value: string | number | React.ReactNode;
17
+ type?: BadgeType | `${BadgeType}`;
18
+ tooltip?: true | string | React.ReactNode;
19
+ }
20
+ export declare const Badge: React.FC<BadgeProps>;
21
+ export {};
@@ -0,0 +1,105 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import { jsx, jsxs } from "react/jsx-runtime";
21
+ import { Tooltip } from "antd";
22
+ import { Color } from "../../constants";
23
+ var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
24
+ BadgeType2["Default"] = "default";
25
+ BadgeType2["Success"] = "success";
26
+ BadgeType2["Warn"] = "warn";
27
+ BadgeType2["Error"] = "error";
28
+ return BadgeType2;
29
+ })(BadgeType || {});
30
+ const BadgeColorMap = {
31
+ ["default" /* Default */]: "linear-gradient(to bottom, #1182c2, #0273b4)",
32
+ ["success" /* Success */]: "linear-gradient(to bottom, #4dc71f, #3fb911)",
33
+ ["warn" /* Warn */]: "linear-gradient(to bottom, #d9b32f, #c9a319)",
34
+ ["error" /* Error */]: `linear-gradient(to bottom, #da644e, ${Color.Red})`
35
+ };
36
+ const Badge = ({ label, value, type = "default", tooltip }) => {
37
+ const height = 22;
38
+ const borderRadius = 4;
39
+ const commonStyle = {
40
+ height: "100%",
41
+ lineHeight: `${height}px`,
42
+ width: "auto",
43
+ display: "inline-block",
44
+ boxSizing: "border-box",
45
+ padding: `0 6px`,
46
+ color: "#fff",
47
+ fontSize: 12,
48
+ textAlign: "center",
49
+ verticalAlign: "middle"
50
+ };
51
+ const Content = /* @__PURE__ */ jsxs(
52
+ "div",
53
+ {
54
+ style: {
55
+ height,
56
+ margin: 0,
57
+ padding: 0,
58
+ boxSizing: "border-box",
59
+ borderRadius: 4,
60
+ fontSize: 0,
61
+ whiteSpace: "nowrap",
62
+ textOverflow: "ellipsis",
63
+ overflow: "hidden",
64
+ display: "flex",
65
+ justifyContent: "flex-start",
66
+ alignItems: "center"
67
+ },
68
+ children: [
69
+ /* @__PURE__ */ jsx(
70
+ "div",
71
+ {
72
+ style: __spreadProps(__spreadValues({}, commonStyle), {
73
+ borderTopLeftRadius: borderRadius,
74
+ borderBottomLeftRadius: borderRadius,
75
+ background: "linear-gradient(to bottom, #5d5d5d, #4f4f4f)"
76
+ }),
77
+ children: label
78
+ }
79
+ ),
80
+ /* @__PURE__ */ jsx(
81
+ "div",
82
+ {
83
+ style: __spreadProps(__spreadValues({}, commonStyle), {
84
+ borderTopRightRadius: borderRadius,
85
+ borderBottomRightRadius: borderRadius,
86
+ overflow: "hidden",
87
+ textOverflow: "ellipsis",
88
+ background: BadgeColorMap[type] || BadgeColorMap["default" /* Default */]
89
+ }),
90
+ children: value
91
+ }
92
+ )
93
+ ]
94
+ }
95
+ );
96
+ if (tooltip) {
97
+ return /* @__PURE__ */ jsx(Tooltip, { title: tooltip === true ? value : tooltip, placement: "topLeft", children: Content });
98
+ }
99
+ return Content;
100
+ };
101
+ export {
102
+ Badge,
103
+ BadgeColorMap,
104
+ BadgeType
105
+ };
@@ -0,0 +1,23 @@
1
+ import { Client } from '@rsdoctor/types';
2
+ import React from 'react';
3
+ export interface DiffCardProps extends Pick<DiffCardContentProps, 'formatter'> {
4
+ titles: Array<string> | [string | React.ReactNode];
5
+ datas: Array<DiffCardContentProps['data']>;
6
+ showPercentInTitle?: boolean;
7
+ }
8
+ export interface DiffCardContentProps {
9
+ data: Client.DoctorClientAssetsDiffItem;
10
+ formatter?(v: number, target: 'baseline' | 'current'): number | string | React.ReactNode;
11
+ }
12
+ export interface PercentProps {
13
+ percent: number;
14
+ state: Client.DoctorClientDiffState;
15
+ fontSize?: React.CSSProperties['fontSize'];
16
+ }
17
+ export declare const SizePercent: React.FC<{
18
+ baseline: number;
19
+ current: number;
20
+ } & Omit<PercentProps, 'percent' | 'state'>>;
21
+ export declare const Percent: React.FC<PercentProps>;
22
+ export declare const DiffCardContent: React.FC<DiffCardContentProps>;
23
+ export declare const DiffCard: React.FC<DiffCardProps>;