@rsdoctor/components 0.4.13 → 1.0.0-alpha.1
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.
- package/README.md +1 -1
- package/dist/common/imgs/connection-point.js +11 -0
- package/dist/common/imgs/webpack.js +11 -0
- package/dist/common/svg/bundle-size.js +11 -0
- package/dist/common/svg/error.js +10 -0
- package/dist/common/svg/file-css.js +11 -0
- package/dist/common/svg/file-html.js +11 -0
- package/dist/common/svg/file-image.js +11 -0
- package/dist/common/svg/file-js.js +11 -0
- package/dist/common/svg/file-unknown.js +11 -0
- package/dist/common/svg/file.js +10 -0
- package/dist/common/svg/files/css.js +11 -0
- package/dist/common/svg/files/html.js +11 -0
- package/dist/common/svg/files/image.js +11 -0
- package/dist/common/svg/files/js.js +11 -0
- package/dist/common/svg/files/unkown-file.js +11 -0
- package/dist/common/svg/loader/input.js +11 -0
- package/dist/common/svg/loader/output.js +12 -0
- package/dist/common/svg/loader/step.js +7 -0
- package/dist/common/svg/navbar/bundle-size-active.js +10 -0
- package/dist/common/svg/navbar/bundle-size-inactive.js +10 -0
- package/dist/common/svg/navbar/compile-analysis-active.js +11 -0
- package/dist/common/svg/navbar/compile-analysis-inactive.js +11 -0
- package/dist/common/svg/navbar/overall-active.js +11 -0
- package/dist/common/svg/navbar/overall-inactive.js +11 -0
- package/dist/common/svg/output.js +12 -0
- package/dist/common/svg/source-size.js +12 -0
- package/dist/common/svg/source.js +10 -0
- package/dist/common/svg/total-size.js +11 -0
- package/dist/common/svg/version.js +11 -0
- package/dist/components/Alert/ecma-version-check.d.ts +2 -0
- package/dist/components/Alert/ecma-version-check.js +69 -0
- package/dist/components/Alert/ecma-version-check.module.js +5 -0
- package/dist/components/Alert/ecma-version-check_module.css +23 -0
- package/dist/components/Alert/package-relation.d.ts +1 -2
- package/dist/components/Alert/package-relation.js +29 -59
- package/dist/components/Alert/package-relation.module.js +5 -0
- package/dist/components/Alert/package-relation_module.css +23 -0
- package/dist/components/Alert/types.d.ts +6 -1
- package/dist/components/Alerts/{common.d.ts → bundle-alert.d.ts} +3 -4
- package/dist/components/Alerts/bundle-alert.js +156 -0
- package/dist/components/Alerts/bundle-alert.module.js +5 -0
- package/dist/components/Alerts/bundle-alert_module.css +46 -0
- package/dist/components/Alerts/bundle.js +25 -6
- package/dist/components/Alerts/collapse.d.ts +6 -0
- package/dist/components/Alerts/collapse.js +209 -0
- package/dist/components/Alerts/collapse.module.js +5 -0
- package/dist/components/Alerts/collapse_module.css +71 -0
- package/dist/components/Alerts/compile.js +18 -5
- package/dist/components/Alerts/list.d.ts +4 -0
- package/dist/components/Alerts/list.js +25 -0
- package/dist/components/Alerts/list.module.js +5 -0
- package/dist/components/Alerts/list_module.css +5 -0
- package/dist/components/Alerts/overlay.js +67 -28
- package/dist/components/Alerts/overlay.module.js +5 -0
- package/dist/components/Alerts/overlay_module.css +11 -0
- package/dist/components/Card/index.d.ts +1 -1
- package/dist/components/Card/index.js +8 -18
- package/dist/components/Card/size.d.ts +1 -0
- package/dist/components/Card/size.js +99 -65
- package/dist/components/Card/size.module.js +5 -0
- package/dist/components/Card/size_module.css +34 -0
- package/dist/components/Card/statistic.d.ts +0 -2
- package/dist/components/Card/statistic.js +7 -5
- package/dist/components/Charts/TimelineCharts/index.d.ts +6 -1
- package/dist/components/Charts/TimelineCharts/index.js +208 -192
- package/dist/components/Charts/bootstrap.js +15 -10
- package/dist/components/Charts/common.d.ts +2 -0
- package/dist/components/Charts/common.js +18 -5
- package/dist/components/Charts/constants.d.ts +8 -1
- package/dist/components/Charts/constants.js +37 -41
- package/dist/components/Charts/done.js +14 -9
- package/dist/components/Charts/index.js +1 -1
- package/dist/components/Charts/loader.js +12 -2
- package/dist/components/Charts/minify.js +14 -9
- package/dist/components/Charts/utils.js +2 -2
- package/dist/components/CodeViewer/diff.js +8 -2
- package/dist/components/CodeViewer/viewer.js +0 -7
- package/dist/components/Configuration/builder.js +50 -36
- package/dist/components/Configuration/builder.module.js +5 -0
- package/dist/components/Configuration/builder_module.css +6 -0
- package/dist/components/FileTree/css.js +11 -0
- package/dist/components/FileTree/html.js +11 -0
- package/dist/components/FileTree/image.js +11 -0
- package/dist/components/FileTree/index.css +8 -0
- package/dist/components/FileTree/index.d.ts +1 -0
- package/dist/components/FileTree/index.js +65 -5
- package/dist/components/FileTree/js.js +11 -0
- package/dist/components/FileTree/unkown-file.js +11 -0
- package/dist/components/Form/keyword.js +3 -2
- package/dist/components/Keyword/index.js +38 -14
- package/dist/components/Keyword/style.module.js +5 -0
- package/dist/components/Keyword/style_module.css +5 -0
- package/dist/components/Layout/builder-select.js +37 -24
- package/dist/components/Layout/bundle-size-icon.js +10 -0
- package/dist/components/Layout/compile-icon.js +11 -0
- package/dist/components/Layout/header.css +7 -0
- package/dist/components/Layout/header.js +10 -17
- package/dist/components/Layout/menus.js +59 -64
- package/dist/components/Layout/overall-icon.js +10 -0
- package/dist/components/Layout/progress.js +2 -1
- package/dist/components/Loader/Analysis/files.js +187 -101
- package/dist/components/Loader/Analysis/index.js +34 -17
- package/dist/components/Loader/Analysis/input.js +11 -0
- package/dist/components/Loader/Analysis/output.js +12 -0
- package/dist/components/Loader/Analysis/style.module.js +5 -0
- package/dist/components/Loader/Analysis/style_module.css +73 -0
- package/dist/components/Loader/executions.js +95 -114
- package/dist/components/Loader/step.js +7 -0
- package/dist/components/Opener/code.js +2 -1
- package/dist/components/Overall/DataSummary.d.ts +8 -0
- package/dist/components/Overall/DataSummary.js +25 -0
- package/dist/components/Overall/DataSummary.module.js +5 -0
- package/dist/components/Overall/DataSummary_module.css +95 -0
- package/dist/components/Overall/bundle.d.ts +6 -1
- package/dist/components/Overall/bundle.js +208 -112
- package/dist/components/Overall/bundle.module.js +5 -0
- package/dist/components/Overall/bundle_module.css +67 -0
- package/dist/components/Overall/card_module.css +1 -4
- package/dist/components/Overall/compile.js +47 -41
- package/dist/components/Overall/compile.module.js +1 -1
- package/dist/components/Overall/compile_module.css +6 -0
- package/dist/components/Overall/help-center.d.ts +1 -0
- package/dist/components/Overall/help-center.js +86 -0
- package/dist/components/Overall/help-center.module.js +5 -0
- package/dist/components/Overall/help-center_module.css +35 -0
- package/dist/components/Overall/list.module.js +1 -1
- package/dist/components/Overall/list_module.css +14 -4
- package/dist/components/Overall/overview.d.ts +8 -0
- package/dist/components/Overall/overview.js +17 -0
- package/dist/components/Overall/overview.module.js +5 -0
- package/dist/components/Overall/overview_module.css +25 -0
- package/dist/components/Overall/project.d.ts +0 -1
- package/dist/components/Overall/project.js +101 -36
- package/dist/components/Overall/project.module.js +5 -0
- package/dist/components/Overall/project_module.css +19 -0
- package/dist/components/Select/index.css +6 -0
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/Select/index.js +7 -4
- package/dist/components/TextDrawer/index.d.ts +2 -1
- package/dist/components/TextDrawer/index.js +38 -27
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +0 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/pages/BundleSize/components/asset.js +106 -124
- package/dist/pages/BundleSize/components/card.module.js +5 -0
- package/dist/pages/BundleSize/components/card_module.css +54 -0
- package/dist/pages/BundleSize/components/cards.js +157 -47
- package/dist/pages/BundleSize/components/index.js +129 -121
- package/dist/pages/BundleSize/components/index.module.js +5 -0
- package/dist/pages/BundleSize/components/index_module.css +82 -0
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.css +13 -0
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.d.ts +1 -1
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.js +40 -63
- package/dist/pages/ModuleAnalyze/fileTree.d.ts +1 -0
- package/dist/pages/ModuleAnalyze/fileTree.js +36 -164
- package/dist/pages/ModuleAnalyze/index.css +7 -3
- package/dist/pages/ModuleAnalyze/index.d.ts +7 -1
- package/dist/pages/ModuleAnalyze/index.js +122 -45
- package/dist/pages/Overall/index.js +14 -9
- package/dist/pages/Overall/index.module.js +5 -0
- package/dist/pages/Overall/index_module.css +26 -0
- package/dist/pages/Overall/responsiveLayout.d.ts +6 -0
- package/dist/pages/Overall/responsiveLayout.js +9 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/modules.js +4 -4
- package/dist/pages/TreeShaking/editor.d.ts +3 -4
- package/dist/pages/TreeShaking/table.d.ts +3 -3
- package/dist/pages/TreeShaking/types.d.ts +2 -2
- package/dist/pages/TreeShaking/utils.d.ts +4 -5
- package/dist/pages/WebpackLoaders/Analysis/index.js +4 -1
- package/dist/pages/WebpackLoaders/Overall/index.js +8 -1
- package/dist/pages/WebpackPlugins/index.css +3 -0
- package/dist/pages/WebpackPlugins/index.d.ts +1 -0
- package/dist/pages/WebpackPlugins/index.js +61 -51
- package/dist/utils/data/brief.js +0 -2
- package/dist/utils/file.d.ts +4 -2
- package/dist/utils/file.js +40 -5
- package/dist/utils/i18n/cn.js +5 -0
- package/dist/utils/i18n/en.d.ts +5 -0
- package/dist/utils/i18n/en.js +5 -0
- package/package.json +8 -7
- package/dist/assets/connection-point.3b3c78ca.svg +0 -1
- package/dist/assets/webpack.98604d64.svg +0 -1
- package/dist/components/Alert/index.d.ts +0 -4
- package/dist/components/Alert/index.js +0 -34
- package/dist/components/Alert/link.d.ts +0 -3
- package/dist/components/Alert/link.js +0 -27
- package/dist/components/Alerts/common.js +0 -123
- package/dist/components/Card/statistic.css +0 -17
- package/dist/components/Overall/NumberButton.d.ts +0 -8
- package/dist/components/Overall/NumberButton.js +0 -29
- package/dist/components/Overall/NumberButton.module.js +0 -5
- package/dist/components/Overall/NumberButton_module.css +0 -70
- package/dist/components/Overall/bundle.module.css +0 -0
- package/dist/pages/Overall/responsiveGridList.d.ts +0 -6
- package/dist/pages/Overall/responsiveGridList.js +0 -28
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React, { useState } from "react";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import {
|
|
4
3
|
Space,
|
|
5
4
|
Alert,
|
|
@@ -10,74 +9,45 @@ import {
|
|
|
10
9
|
Row,
|
|
11
10
|
Col,
|
|
12
11
|
Timeline,
|
|
13
|
-
Card,
|
|
14
12
|
Tag,
|
|
15
13
|
Empty,
|
|
16
|
-
Popover,
|
|
17
14
|
Grid
|
|
18
15
|
} from "antd";
|
|
19
16
|
import { sumBy } from "lodash-es";
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
import {
|
|
18
|
+
ExpandAltOutlined,
|
|
19
|
+
InfoCircleOutlined,
|
|
20
|
+
DoubleRightOutlined
|
|
21
|
+
} from "@ant-design/icons";
|
|
22
|
+
import { useRuleIndexNavigate, formatSize } from "../../utils";
|
|
23
23
|
import { TextDrawer } from "../TextDrawer";
|
|
24
24
|
import { Title } from "../Title";
|
|
25
25
|
import { Size, Color } from "../../constants";
|
|
26
26
|
import { Badge as Bdg } from "../Badge";
|
|
27
27
|
import { withServerAPI } from "../Manifest";
|
|
28
|
+
import { Rule, SDK } from "@rsdoctor/types";
|
|
29
|
+
import styles from "./package-relation.module";
|
|
28
30
|
const TextDrawerWidth = "60%";
|
|
29
31
|
const PackageRelationReasons = ({ data }) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const { statements } = dependency;
|
|
50
|
-
const { start } = statements?.[0]?.position ? module.isPreferSource ? statements[0].position.source : statements[0].position.transformed : { start: { line: 0, column: 0 } };
|
|
51
|
-
const text = `${relativePath}:${start.line}:${start.column || 1}`;
|
|
52
|
-
return /* @__PURE__ */ jsx(
|
|
53
|
-
Timeline.Item,
|
|
54
|
-
{
|
|
55
|
-
style: { cursor: "pointer" },
|
|
56
|
-
dot: i === data.length - 1 ? void 0 : "⬇️",
|
|
57
|
-
children: /* @__PURE__ */ jsx(
|
|
58
|
-
Typography.Text,
|
|
59
|
-
{
|
|
60
|
-
copyable: { text: relativePath },
|
|
61
|
-
onClick: (e2) => {
|
|
62
|
-
e2.preventDefault();
|
|
63
|
-
e2.stopPropagation();
|
|
64
|
-
setIndex(i);
|
|
65
|
-
},
|
|
66
|
-
strong: i === index,
|
|
67
|
-
style: {
|
|
68
|
-
color: i === index ? Color.Blue : "inherit",
|
|
69
|
-
display: "block"
|
|
70
|
-
},
|
|
71
|
-
children: text
|
|
72
|
-
}
|
|
73
|
-
)
|
|
74
|
-
},
|
|
75
|
-
text
|
|
76
|
-
);
|
|
77
|
-
}) })
|
|
78
|
-
] }) : /* @__PURE__ */ jsx(Empty, { description: "This package no dependencies" })
|
|
79
|
-
}
|
|
80
|
-
) }) });
|
|
32
|
+
return /* @__PURE__ */ jsx(Row, { gutter: Size.BasePadding, wrap: false, align: "top", children: /* @__PURE__ */ jsx(Col, { style: { height: "100%", width: "100%" }, children: data.length ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Timeline, { style: { marginTop: "20px" }, children: data.map((e, i) => {
|
|
33
|
+
const { dependency, module, relativePath } = e;
|
|
34
|
+
const { statements } = dependency;
|
|
35
|
+
const { start } = statements?.[0]?.position ? module.isPreferSource ? statements[0].position.source : statements[0].position.transformed : { start: { line: 0, column: 0 } };
|
|
36
|
+
const text = `${relativePath}:${start.line}:${start.column || 1}`;
|
|
37
|
+
return /* @__PURE__ */ jsx(Timeline.Item, { style: { cursor: "default" }, children: /* @__PURE__ */ jsxs(Typography.Text, { children: [
|
|
38
|
+
/* @__PURE__ */ jsxs("div", { className: styles.filePath, children: [
|
|
39
|
+
text,
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
Typography.Paragraph,
|
|
42
|
+
{
|
|
43
|
+
copyable: { text: relativePath },
|
|
44
|
+
style: { position: "relative", top: "7px" }
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
] }),
|
|
48
|
+
i !== data.length - 1 ? /* @__PURE__ */ jsx(DoubleRightOutlined, { className: styles.arrow }) : null
|
|
49
|
+
] }) }, text);
|
|
50
|
+
}) }) }) : /* @__PURE__ */ jsx(Empty, { description: "This package no dependencies" }) }) });
|
|
81
51
|
};
|
|
82
52
|
const PackageRelationReasonsWithServer = withServerAPI({
|
|
83
53
|
Component: PackageRelationReasons,
|
|
@@ -216,7 +186,7 @@ const PackageRelationAlert = ({
|
|
|
216
186
|
);
|
|
217
187
|
}) }),
|
|
218
188
|
type: level === "warn" ? "info" : level,
|
|
219
|
-
action: /* @__PURE__ */ jsxs(
|
|
189
|
+
action: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
220
190
|
packages && packages.length > 0 ? /* @__PURE__ */ jsx(
|
|
221
191
|
TextDrawer,
|
|
222
192
|
{
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.dot_2bb66 {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.filePath_2bb66 {
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
align-items: center;
|
|
12
|
+
border: 1px solid #eaedf1;
|
|
13
|
+
padding: 5px 10px;
|
|
14
|
+
border-radius: 10px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.arrow_2bb66 {
|
|
18
|
+
position: relative;
|
|
19
|
+
top: 8px;
|
|
20
|
+
left: 50%;
|
|
21
|
+
transform: translateX(-50%) rotate(90deg);
|
|
22
|
+
color: #2994ff;
|
|
23
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Rule } from '@rsdoctor/types';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import type { CheckSyntax } from '@rsbuild/plugin-check-syntax';
|
|
3
4
|
export interface AlertProps extends Omit<PackageRelationAlertProps, 'data'> {
|
|
4
5
|
data: Rule.RuleStoreDataItem;
|
|
5
6
|
cwd: string;
|
|
@@ -23,6 +24,10 @@ export interface CodeViewAlertProps {
|
|
|
23
24
|
data: Rule.CodeViewRuleStoreData;
|
|
24
25
|
cwd: string;
|
|
25
26
|
}
|
|
27
|
+
type CheckSyntaxError = CheckSyntax['errors'] extends Array<infer T> ? T : false;
|
|
26
28
|
export interface LinkAlertProps {
|
|
27
|
-
data: Rule.
|
|
29
|
+
data: (Rule.RuleStoreDataItem & {
|
|
30
|
+
error?: CheckSyntaxError;
|
|
31
|
+
})[];
|
|
28
32
|
}
|
|
33
|
+
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Rule } from '@rsdoctor/types';
|
|
3
1
|
import { ViewMode } from '../../constants';
|
|
4
2
|
import { AlertProps } from '../Alert/types';
|
|
5
|
-
|
|
3
|
+
import type { Rule } from '@rsdoctor/types';
|
|
4
|
+
interface BundleAlertProps {
|
|
6
5
|
title: string;
|
|
7
6
|
cwd: string;
|
|
8
7
|
dataSource: Rule.RuleStoreDataItem[];
|
|
@@ -11,5 +10,5 @@ interface CommonAlertsContainerProps {
|
|
|
11
10
|
setViewMode(mode: ViewMode): void;
|
|
12
11
|
extraCom?: JSX.Element | undefined;
|
|
13
12
|
}
|
|
14
|
-
export declare const
|
|
13
|
+
export declare const BundleAlert: React.FC<BundleAlertProps>;
|
|
15
14
|
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Tabs, Empty, Tag } from "antd";
|
|
3
|
+
import { Card } from "../Card";
|
|
4
|
+
import { ECMAVersionCheck } from "../Alert/ecma-version-check";
|
|
5
|
+
import { Overview } from "../Overall/overview";
|
|
6
|
+
import { AlertCollapse } from "./collapse";
|
|
7
|
+
import { CommonList } from "./list";
|
|
8
|
+
import styles from "./bundle-alert.module";
|
|
9
|
+
import { useState } from "react";
|
|
10
|
+
const BundleAlert = ({
|
|
11
|
+
title,
|
|
12
|
+
dataSource,
|
|
13
|
+
extraData
|
|
14
|
+
}) => {
|
|
15
|
+
const [activekey, setActiveKey] = useState("E1001");
|
|
16
|
+
const tabData = [
|
|
17
|
+
{
|
|
18
|
+
key: "E1001",
|
|
19
|
+
label: "Duplicate Packages",
|
|
20
|
+
data: []
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: "E1002",
|
|
24
|
+
label: "Default Import Check",
|
|
25
|
+
data: []
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
key: "E1003",
|
|
29
|
+
label: "Loader Performance Optimization",
|
|
30
|
+
data: []
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
key: "E1004",
|
|
34
|
+
label: "ECMA Version Check",
|
|
35
|
+
data: []
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
dataSource.forEach((data) => {
|
|
39
|
+
const target = tabData.find((td) => td.key === data.code)?.data;
|
|
40
|
+
target?.push(data);
|
|
41
|
+
});
|
|
42
|
+
const tabItems = tabData.map((td) => {
|
|
43
|
+
const tagStyle = activekey === td.key ? {
|
|
44
|
+
border: "1px solid #91D5FF",
|
|
45
|
+
backgroundColor: "#E6F7FF"
|
|
46
|
+
} : {};
|
|
47
|
+
const tagTextStyle = activekey === td.key ? {
|
|
48
|
+
color: "#1890FF"
|
|
49
|
+
} : {};
|
|
50
|
+
const LabelComponent = () => /* @__PURE__ */ jsx(
|
|
51
|
+
Overview,
|
|
52
|
+
{
|
|
53
|
+
style: {
|
|
54
|
+
backgroundColor: "transparent",
|
|
55
|
+
paddingLeft: 0,
|
|
56
|
+
paddingRight: 0,
|
|
57
|
+
width: "100%"
|
|
58
|
+
},
|
|
59
|
+
title: /* @__PURE__ */ jsx("span", { className: styles.labelTitle, children: td.label }),
|
|
60
|
+
description: /* @__PURE__ */ jsxs("div", { className: styles.labelDescription, children: [
|
|
61
|
+
/* @__PURE__ */ jsx("span", { children: td.data.length }),
|
|
62
|
+
/* @__PURE__ */ jsx(
|
|
63
|
+
Tag,
|
|
64
|
+
{
|
|
65
|
+
style: { fontFamily: "Menlo", borderRadius: "2px", ...tagStyle },
|
|
66
|
+
children: /* @__PURE__ */ jsx("span", { style: { ...tagTextStyle }, children: td.key })
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
] })
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
let children, description;
|
|
73
|
+
switch (td.key) {
|
|
74
|
+
case "E1001":
|
|
75
|
+
children = /* @__PURE__ */ jsx(AlertCollapse, { data: td.data, extraData });
|
|
76
|
+
break;
|
|
77
|
+
case "E1002":
|
|
78
|
+
children = /* @__PURE__ */ jsx(CommonList, { data: td.data });
|
|
79
|
+
break;
|
|
80
|
+
case "E1003":
|
|
81
|
+
children = /* @__PURE__ */ jsx(CommonList, { data: td.data });
|
|
82
|
+
break;
|
|
83
|
+
case "E1004":
|
|
84
|
+
description = /* @__PURE__ */ jsx("span", { children: "No ECMA Version Check Rules were found. Please refer to 「https://rsdoctor.dev/guide/usage/rule-config」." });
|
|
85
|
+
children = /* @__PURE__ */ jsx(ECMAVersionCheck, { data: td.data });
|
|
86
|
+
break;
|
|
87
|
+
default:
|
|
88
|
+
children = null;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
if (!td.data.length) {
|
|
92
|
+
children = /* @__PURE__ */ jsx(Empty, { description, image: Empty.PRESENTED_IMAGE_SIMPLE });
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
key: td.key,
|
|
96
|
+
label: /* @__PURE__ */ jsx(LabelComponent, {}),
|
|
97
|
+
children: /* @__PURE__ */ jsx(
|
|
98
|
+
Card,
|
|
99
|
+
{
|
|
100
|
+
className: styles.card,
|
|
101
|
+
type: "inner",
|
|
102
|
+
title: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
Tag,
|
|
105
|
+
{
|
|
106
|
+
style: {
|
|
107
|
+
fontFamily: "Menlo",
|
|
108
|
+
fontWeight: "700",
|
|
109
|
+
fontSize: "13px",
|
|
110
|
+
backgroundColor: "#EAEDF1",
|
|
111
|
+
borderRadius: "2px"
|
|
112
|
+
},
|
|
113
|
+
children: td.key
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
/* @__PURE__ */ jsx("span", { children: td.label })
|
|
117
|
+
] }),
|
|
118
|
+
children
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
return /* @__PURE__ */ jsx(Card, { style: { width: "100%", borderRadius: "12px" }, children: /* @__PURE__ */ jsxs("div", { className: styles.container, children: [
|
|
124
|
+
/* @__PURE__ */ jsx("div", { className: styles.title, children: title }),
|
|
125
|
+
!dataSource.length ? /* @__PURE__ */ jsx(
|
|
126
|
+
"div",
|
|
127
|
+
{
|
|
128
|
+
style: {
|
|
129
|
+
minHeight: "480px",
|
|
130
|
+
display: "flex",
|
|
131
|
+
justifyContent: "center",
|
|
132
|
+
alignItems: "center"
|
|
133
|
+
},
|
|
134
|
+
children: /* @__PURE__ */ jsx(
|
|
135
|
+
Empty,
|
|
136
|
+
{
|
|
137
|
+
description: "No Bundle Alerts Data",
|
|
138
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
) : /* @__PURE__ */ jsx(
|
|
143
|
+
Tabs,
|
|
144
|
+
{
|
|
145
|
+
onChange: setActiveKey,
|
|
146
|
+
tabBarGutter: 10,
|
|
147
|
+
type: "card",
|
|
148
|
+
defaultActiveKey: "E1001",
|
|
149
|
+
items: tabItems
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
] }) });
|
|
153
|
+
};
|
|
154
|
+
export {
|
|
155
|
+
BundleAlert
|
|
156
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "./bundle-alert_module.css";
|
|
2
|
+
var bundle_alert_module_default = { "card": "card_f9725", "container": "container_f9725", "title": "title_f9725", "labelTitle": "labelTitle_f9725", "labelDescription": "labelDescription_f9725" };
|
|
3
|
+
export {
|
|
4
|
+
bundle_alert_module_default as default
|
|
5
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
.card_f9725 .ant-card-body {
|
|
2
|
+
padding: 0;
|
|
3
|
+
}
|
|
4
|
+
.card_f9725 .ant-collapse {
|
|
5
|
+
border-radius: 0;
|
|
6
|
+
border: none;
|
|
7
|
+
}
|
|
8
|
+
.card_f9725 .ant-collapse > .ant-collapse-item {
|
|
9
|
+
border-bottom: none;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.container_f9725 {
|
|
13
|
+
margin-top: -4px;
|
|
14
|
+
height: 100%;
|
|
15
|
+
}
|
|
16
|
+
.container_f9725 .ant-tabs-nav-list {
|
|
17
|
+
width: 100%;
|
|
18
|
+
}
|
|
19
|
+
.container_f9725 .ant-tabs-tab {
|
|
20
|
+
flex: 1 1;
|
|
21
|
+
}
|
|
22
|
+
.container_f9725 .ant-tabs-tab-btn {
|
|
23
|
+
width: 100%;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.title_f9725 {
|
|
27
|
+
height: 32px;
|
|
28
|
+
font-size: 16px;
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
line-height: 20px;
|
|
31
|
+
text-align: left;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.labelTitle_f9725 {
|
|
35
|
+
font-family: PingFang SC;
|
|
36
|
+
font-size: 12px;
|
|
37
|
+
font-weight: 400;
|
|
38
|
+
line-height: 20px;
|
|
39
|
+
text-align: left;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.labelDescription_f9725 {
|
|
43
|
+
display: flex;
|
|
44
|
+
justify-content: space-between;
|
|
45
|
+
align-items: center;
|
|
46
|
+
}
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
import { SDK } from "@rsdoctor/types";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
hasViewModeFromStorage,
|
|
6
|
+
useBundleAlertsByErrors,
|
|
7
|
+
useViewMode,
|
|
8
|
+
useI18n
|
|
9
|
+
} from "../../utils";
|
|
10
|
+
import { BundleAlert } from "./bundle-alert";
|
|
6
11
|
import { withServerAPI } from "../Manifest";
|
|
7
12
|
import { ViewMode } from "../../constants";
|
|
8
13
|
import { PackageRelationReasonsWithServer } from "../Alert/package-relation";
|
|
9
14
|
import { ConfigProvider } from "antd";
|
|
10
|
-
const BundleAlertsBase = ({
|
|
15
|
+
const BundleAlertsBase = ({
|
|
16
|
+
filter,
|
|
17
|
+
project
|
|
18
|
+
}) => {
|
|
11
19
|
const { errors, root: cwd } = project;
|
|
12
20
|
const bundleAlerts = useBundleAlertsByErrors(errors);
|
|
13
21
|
const { setBundleAlertsViewMode, viewMode, setViewMode } = useViewMode();
|
|
22
|
+
const { t } = useI18n();
|
|
14
23
|
const dataSource = filter ? bundleAlerts.filter(filter) : bundleAlerts;
|
|
15
24
|
useEffect(() => {
|
|
16
25
|
if (!hasViewModeFromStorage()) {
|
|
@@ -31,16 +40,26 @@ const BundleAlertsBase = ({ filter, project }) => {
|
|
|
31
40
|
colorInfoBg: "#e6f4ff57",
|
|
32
41
|
colorInfoBorder: "none"
|
|
33
42
|
}
|
|
43
|
+
},
|
|
44
|
+
token: {
|
|
45
|
+
padding: 16,
|
|
46
|
+
colorText: "rgba(0, 0, 0, 0.85)"
|
|
34
47
|
}
|
|
35
48
|
},
|
|
36
49
|
children: /* @__PURE__ */ jsx(
|
|
37
|
-
|
|
50
|
+
BundleAlert,
|
|
38
51
|
{
|
|
39
|
-
title: "Bundle Alerts",
|
|
52
|
+
title: t("Bundle Alerts"),
|
|
40
53
|
dataSource,
|
|
41
54
|
extraData: {
|
|
42
55
|
cwd,
|
|
43
|
-
getPackageRelationContentComponent: (res) => /* @__PURE__ */ jsx(
|
|
56
|
+
getPackageRelationContentComponent: (res) => /* @__PURE__ */ jsx(
|
|
57
|
+
PackageRelationReasonsWithServer,
|
|
58
|
+
{
|
|
59
|
+
body: { id: res.data.id, target: res.package.target },
|
|
60
|
+
cwd
|
|
61
|
+
}
|
|
62
|
+
)
|
|
44
63
|
},
|
|
45
64
|
viewMode: viewMode.bundleAlerts,
|
|
46
65
|
setViewMode: setBundleAlertsViewMode,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Rule } from '@rsdoctor/types';
|
|
2
|
+
import type { AlertProps } from '../Alert/types';
|
|
3
|
+
export declare const AlertCollapse: (props: {
|
|
4
|
+
data: Array<Rule.RuleStoreDataItem>;
|
|
5
|
+
extraData: Omit<AlertProps, "data">;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Collapse, Typography, Divider, Space, Tabs, Tag, Tooltip } from "antd";
|
|
3
|
+
import Icon from "@ant-design/icons";
|
|
4
|
+
import { sumBy } from "lodash-es";
|
|
5
|
+
import Overview from "../Overall/overview";
|
|
6
|
+
import { TextDrawer } from "../TextDrawer";
|
|
7
|
+
import { Title } from "../Title";
|
|
8
|
+
import { Size } from "../../constants";
|
|
9
|
+
import { formatSize } from "../../utils";
|
|
10
|
+
import BundleSizeSvg from "../../common/svg/bundle-size.js";
|
|
11
|
+
import SourceSizeSvg from "../../common/svg/source-size.js";
|
|
12
|
+
import TotalSizeSvg from "../../common/svg/total-size.js";
|
|
13
|
+
import VersionSvg from "../../common/svg/version.js";
|
|
14
|
+
import styles from "./collapse.module";
|
|
15
|
+
const { Paragraph, Text } = Typography;
|
|
16
|
+
const { innerWidth } = window;
|
|
17
|
+
const LabelComponent = (props) => {
|
|
18
|
+
const { title, description, extra } = props;
|
|
19
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.label, children: [
|
|
20
|
+
/* @__PURE__ */ jsxs("div", { className: styles.labelContent, children: [
|
|
21
|
+
/* @__PURE__ */ jsx("div", { children: title }),
|
|
22
|
+
/* @__PURE__ */ jsx("div", { children: description })
|
|
23
|
+
] }),
|
|
24
|
+
/* @__PURE__ */ jsx("div", { children: extra })
|
|
25
|
+
] });
|
|
26
|
+
};
|
|
27
|
+
const AlertCollapse = (props) => {
|
|
28
|
+
const { data, extraData } = props;
|
|
29
|
+
const items = data.map((d) => {
|
|
30
|
+
const { packages } = d;
|
|
31
|
+
const totalSize = sumBy(packages, (e) => e.targetSize.sourceSize);
|
|
32
|
+
const totalSizeStr = formatSize(totalSize);
|
|
33
|
+
const { name } = packages.find((e) => !!e.target.name).target;
|
|
34
|
+
const versions = packages.map((item) => item.target.version);
|
|
35
|
+
const ChildComponent = () => {
|
|
36
|
+
return packages.map((pkg, idx) => {
|
|
37
|
+
const version = pkg.target.version;
|
|
38
|
+
const root = pkg.target.root;
|
|
39
|
+
const sizeStr = formatSize(pkg.targetSize.sourceSize);
|
|
40
|
+
const parsedSizeStr = pkg.targetSize.parsedSize ? formatSize(pkg.targetSize.parsedSize) : null;
|
|
41
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.collapseContainer, children: [
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
43
|
+
Overview,
|
|
44
|
+
{
|
|
45
|
+
style: { backgroundColor: "#fff" },
|
|
46
|
+
title: /* @__PURE__ */ jsx(
|
|
47
|
+
Text,
|
|
48
|
+
{
|
|
49
|
+
style: { width: innerWidth > 1500 ? 900 : 700 },
|
|
50
|
+
ellipsis: {
|
|
51
|
+
tooltip: root
|
|
52
|
+
},
|
|
53
|
+
children: root
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
description: /* @__PURE__ */ jsxs("div", { className: styles.collapseChild, children: [
|
|
57
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
58
|
+
/* @__PURE__ */ jsx("div", { className: styles.attribute, children: "Version" }),
|
|
59
|
+
/* @__PURE__ */ jsxs("div", { className: styles.iconContainer, children: [
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
Icon,
|
|
62
|
+
{
|
|
63
|
+
style: { fontSize: "18px" },
|
|
64
|
+
component: VersionSvg
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
/* @__PURE__ */ jsxs("span", { className: styles.data, children: [
|
|
68
|
+
"v",
|
|
69
|
+
version
|
|
70
|
+
] })
|
|
71
|
+
] })
|
|
72
|
+
] }),
|
|
73
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
74
|
+
/* @__PURE__ */ jsx("div", { className: styles.attribute, children: "Source size" }),
|
|
75
|
+
/* @__PURE__ */ jsxs("div", { className: styles.iconContainer, children: [
|
|
76
|
+
/* @__PURE__ */ jsx(
|
|
77
|
+
Icon,
|
|
78
|
+
{
|
|
79
|
+
style: { fontSize: "18px" },
|
|
80
|
+
component: SourceSizeSvg
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ jsx("span", { className: styles.data, children: sizeStr })
|
|
84
|
+
] })
|
|
85
|
+
] }),
|
|
86
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
87
|
+
/* @__PURE__ */ jsx("div", { className: styles.attribute, children: "Bundle size" }),
|
|
88
|
+
/* @__PURE__ */ jsxs("div", { className: styles.iconContainer, children: [
|
|
89
|
+
/* @__PURE__ */ jsx(
|
|
90
|
+
Icon,
|
|
91
|
+
{
|
|
92
|
+
style: { fontSize: "18px" },
|
|
93
|
+
component: BundleSizeSvg
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
/* @__PURE__ */ jsx(
|
|
97
|
+
Tooltip,
|
|
98
|
+
{
|
|
99
|
+
title: `The bundle size of "${name}" is ${sizeStr}, this is after bundled, concatenated module cannot get bundled size. `,
|
|
100
|
+
children: /* @__PURE__ */ jsx("span", { className: styles.data, children: parsedSizeStr || "CONCATENATED" })
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
] })
|
|
104
|
+
] })
|
|
105
|
+
] }),
|
|
106
|
+
icon: /* @__PURE__ */ jsx(
|
|
107
|
+
Paragraph,
|
|
108
|
+
{
|
|
109
|
+
style: { position: "relative", top: "-10px" },
|
|
110
|
+
copyable: { text: root }
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
idx !== packages.length - 1 ? /* @__PURE__ */ jsx(Divider, { style: { margin: "10px 0" } }) : null
|
|
116
|
+
] });
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
return {
|
|
120
|
+
key: d.code,
|
|
121
|
+
label: /* @__PURE__ */ jsx(
|
|
122
|
+
LabelComponent,
|
|
123
|
+
{
|
|
124
|
+
title: /* @__PURE__ */ jsx(Tag, { style: { backgroundColor: "#EAEDF1", borderRadius: "2px" }, children: /* @__PURE__ */ jsx("span", { className: styles.pkgName, children: name }) }),
|
|
125
|
+
description: `${packages.length} versions was found`,
|
|
126
|
+
extra: /* @__PURE__ */ jsxs("div", { className: styles.extraContainer, children: [
|
|
127
|
+
/* @__PURE__ */ jsxs("div", { className: styles.iconContainer, children: [
|
|
128
|
+
/* @__PURE__ */ jsx(Icon, { style: { fontSize: "18px" }, component: TotalSizeSvg }),
|
|
129
|
+
/* @__PURE__ */ jsx("span", { className: styles.data, children: totalSizeStr })
|
|
130
|
+
] }),
|
|
131
|
+
packages && packages.length > 0 ? /* @__PURE__ */ jsx(
|
|
132
|
+
TextDrawer,
|
|
133
|
+
{
|
|
134
|
+
text: "Show Relations",
|
|
135
|
+
buttonProps: { size: "small" },
|
|
136
|
+
drawerProps: { title: d.title, width: "60%" },
|
|
137
|
+
children: /* @__PURE__ */ jsxs(
|
|
138
|
+
Space,
|
|
139
|
+
{
|
|
140
|
+
direction: "vertical",
|
|
141
|
+
className: "alert-space",
|
|
142
|
+
style: { width: "100%" },
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ jsxs(
|
|
145
|
+
Space,
|
|
146
|
+
{
|
|
147
|
+
style: {
|
|
148
|
+
marginBottom: Size.BasePadding / 2,
|
|
149
|
+
width: "100%"
|
|
150
|
+
},
|
|
151
|
+
children: [
|
|
152
|
+
/* @__PURE__ */ jsx(
|
|
153
|
+
Title,
|
|
154
|
+
{
|
|
155
|
+
text: /* @__PURE__ */ jsx(Tag, { style: { backgroundColor: "#EAEDF1" }, children: name }),
|
|
156
|
+
upperFirst: false
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ jsx(Typography.Text, { strong: true, children: versions.length }),
|
|
160
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: " versions found" })
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
),
|
|
164
|
+
/* @__PURE__ */ jsx(
|
|
165
|
+
Tabs,
|
|
166
|
+
{
|
|
167
|
+
size: "middle",
|
|
168
|
+
items: packages.map((pkg) => {
|
|
169
|
+
const { target, targetSize } = pkg;
|
|
170
|
+
return {
|
|
171
|
+
label: /* @__PURE__ */ jsxs(Space, { className: styles.drawerLabelTitle, children: [
|
|
172
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
173
|
+
"v",
|
|
174
|
+
target.version
|
|
175
|
+
] }),
|
|
176
|
+
/* @__PURE__ */ jsx(Tag, { className: styles.drawerLabelSize, children: formatSize(targetSize.sourceSize) })
|
|
177
|
+
] }),
|
|
178
|
+
key: `${target.root}${target.name}${target.version}`,
|
|
179
|
+
children: extraData.getPackageRelationContentComponent({
|
|
180
|
+
data: d,
|
|
181
|
+
package: pkg
|
|
182
|
+
})
|
|
183
|
+
};
|
|
184
|
+
})
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
) : null
|
|
192
|
+
] })
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
children: /* @__PURE__ */ jsx(ChildComponent, {})
|
|
196
|
+
};
|
|
197
|
+
});
|
|
198
|
+
return /* @__PURE__ */ jsx(
|
|
199
|
+
Collapse,
|
|
200
|
+
{
|
|
201
|
+
style: { width: "100%" },
|
|
202
|
+
defaultActiveKey: ["E1001"],
|
|
203
|
+
items
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
export {
|
|
208
|
+
AlertCollapse
|
|
209
|
+
};
|