@rsdoctor/components 1.0.0-beta.0 → 1.0.0-beta.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/dist/components/Alerts/bundle-alert.js +10 -1
- package/dist/components/Alerts/collapse-cross-chunks.d.ts +6 -0
- package/dist/components/Alerts/collapse-cross-chunks.js +84 -0
- package/dist/components/Loader/Analysis/files.js +4 -25
- package/dist/components/Loader/Analysis/style_module.css +1 -1
- package/dist/pages/BundleSize/components/asset.js +4 -3
- package/dist/pages/BundleSize/components/index.js +142 -116
- package/dist/pages/BundleSize/components/index.module.js +1 -1
- package/dist/pages/BundleSize/components/index_module.css +29 -0
- package/dist/pages/BundleSize/components/search-modal.d.ts +2 -0
- package/dist/pages/BundleSize/components/search-modal.js +141 -0
- package/dist/pages/Overall/index.js +1 -1
- package/package.json +7 -7
|
@@ -7,6 +7,7 @@ import { AlertCollapse } from "./collapse";
|
|
|
7
7
|
import { CommonList } from "./list";
|
|
8
8
|
import styles from "./bundle-alert.module";
|
|
9
9
|
import { useState } from "react";
|
|
10
|
+
import { CrossChunksAlertCollapse } from "./collapse-cross-chunks";
|
|
10
11
|
const BundleAlert = ({
|
|
11
12
|
title,
|
|
12
13
|
dataSource,
|
|
@@ -21,6 +22,11 @@ const BundleAlert = ({
|
|
|
21
22
|
},
|
|
22
23
|
{
|
|
23
24
|
key: "E1002",
|
|
25
|
+
label: "Cross Chunks Package",
|
|
26
|
+
data: []
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
key: "E1005",
|
|
24
30
|
label: "Default Import Check",
|
|
25
31
|
data: []
|
|
26
32
|
},
|
|
@@ -75,7 +81,7 @@ const BundleAlert = ({
|
|
|
75
81
|
children = /* @__PURE__ */ jsx(AlertCollapse, { data: td.data, extraData });
|
|
76
82
|
break;
|
|
77
83
|
case "E1002":
|
|
78
|
-
children = /* @__PURE__ */ jsx(
|
|
84
|
+
children = /* @__PURE__ */ jsx(CrossChunksAlertCollapse, { data: td.data, extraData });
|
|
79
85
|
break;
|
|
80
86
|
case "E1003":
|
|
81
87
|
children = /* @__PURE__ */ jsx(CommonList, { data: td.data });
|
|
@@ -84,6 +90,9 @@ const BundleAlert = ({
|
|
|
84
90
|
description = /* @__PURE__ */ jsx("span", { children: "No ECMA Version Check Rules were found. Please refer to 「https://rsdoctor.dev/guide/usage/rule-config」." });
|
|
85
91
|
children = /* @__PURE__ */ jsx(ECMAVersionCheck, { data: td.data });
|
|
86
92
|
break;
|
|
93
|
+
case "E1005":
|
|
94
|
+
children = /* @__PURE__ */ jsx(CommonList, { data: td.data });
|
|
95
|
+
break;
|
|
87
96
|
default:
|
|
88
97
|
children = null;
|
|
89
98
|
break;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Rule } from '@rsdoctor/types';
|
|
2
|
+
import type { AlertProps } from '../Alert/types';
|
|
3
|
+
export declare const CrossChunksAlertCollapse: (props: {
|
|
4
|
+
data: Array<Rule.RuleStoreDataItem>;
|
|
5
|
+
extraData: Omit<AlertProps, "data">;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Icon from "@ant-design/icons";
|
|
3
|
+
import { Collapse, Space, Tag, Typography } from "antd";
|
|
4
|
+
import Overview from "../Overall/overview";
|
|
5
|
+
import styles from "./collapse.module";
|
|
6
|
+
import TotalSizeSvg from "../../common/svg/total-size.js";
|
|
7
|
+
const { Text } = Typography;
|
|
8
|
+
const { innerWidth } = window;
|
|
9
|
+
const LabelComponent = (props) => {
|
|
10
|
+
const { title, description, extra } = props;
|
|
11
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.label, children: [
|
|
12
|
+
/* @__PURE__ */ jsxs("div", { className: styles.labelContent, children: [
|
|
13
|
+
/* @__PURE__ */ jsx("div", { children: title }),
|
|
14
|
+
/* @__PURE__ */ jsx("div", { children: description })
|
|
15
|
+
] }),
|
|
16
|
+
/* @__PURE__ */ jsx("div", { children: extra })
|
|
17
|
+
] });
|
|
18
|
+
};
|
|
19
|
+
const CrossChunksAlertCollapse = (props) => {
|
|
20
|
+
const { data } = props;
|
|
21
|
+
const items = data.map((d) => {
|
|
22
|
+
const { package: dupPackage, chunks } = d;
|
|
23
|
+
const ChildComponent = () => {
|
|
24
|
+
return chunks.map(({ chunks: chunks2, module }) => {
|
|
25
|
+
return /* @__PURE__ */ jsx("div", { className: styles.collapseContainer, children: /* @__PURE__ */ jsx(
|
|
26
|
+
Overview,
|
|
27
|
+
{
|
|
28
|
+
style: { backgroundColor: "#fff" },
|
|
29
|
+
title: /* @__PURE__ */ jsxs(Space, { children: [
|
|
30
|
+
/* @__PURE__ */ jsx(Icon, { style: { fontSize: "18px" }, component: TotalSizeSvg }),
|
|
31
|
+
/* @__PURE__ */ jsxs(Text, { style: { width: innerWidth > 1500 ? 900 : 700 }, children: [
|
|
32
|
+
"Module:",
|
|
33
|
+
" ",
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
Text,
|
|
36
|
+
{
|
|
37
|
+
style: {
|
|
38
|
+
fontSize: 12,
|
|
39
|
+
color: "rgba(28, 31, 35, 0.6)",
|
|
40
|
+
fontWeight: 300
|
|
41
|
+
},
|
|
42
|
+
children: module.path
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
] })
|
|
46
|
+
] }),
|
|
47
|
+
description: /* @__PURE__ */ jsx("div", { className: styles.collapseChild, children: chunks2.map((chunk) => /* @__PURE__ */ jsxs("div", { style: { display: "flex" }, children: [
|
|
48
|
+
/* @__PURE__ */ jsx("div", { className: styles.attribute, children: "Chunk" }),
|
|
49
|
+
/* @__PURE__ */ jsx("div", { className: styles.iconContainer, children: /* @__PURE__ */ jsx("span", { className: styles.data, children: chunk.name }) })
|
|
50
|
+
] })) })
|
|
51
|
+
}
|
|
52
|
+
) });
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
key: d.code,
|
|
57
|
+
label: /* @__PURE__ */ jsx(
|
|
58
|
+
LabelComponent,
|
|
59
|
+
{
|
|
60
|
+
title: /* @__PURE__ */ jsx(Tag, { style: { backgroundColor: "#EAEDF1", borderRadius: "2px" }, children: /* @__PURE__ */ jsx(
|
|
61
|
+
"span",
|
|
62
|
+
{
|
|
63
|
+
className: styles.pkgName,
|
|
64
|
+
children: `${dupPackage.name}@${dupPackage.version}`
|
|
65
|
+
}
|
|
66
|
+
) }),
|
|
67
|
+
description: `has duplicates bundled into multiple chunks.`
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
children: /* @__PURE__ */ jsx(ChildComponent, {})
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
return /* @__PURE__ */ jsx(
|
|
74
|
+
Collapse,
|
|
75
|
+
{
|
|
76
|
+
style: { width: "100%" },
|
|
77
|
+
defaultActiveKey: ["E1005"],
|
|
78
|
+
items
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
export {
|
|
83
|
+
CrossChunksAlertCollapse
|
|
84
|
+
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useCallback, useMemo, useRef, useState } from "react";
|
|
3
|
-
import { get
|
|
3
|
+
import { get } from "lodash-es";
|
|
4
4
|
import {
|
|
5
5
|
Tag,
|
|
6
6
|
Card,
|
|
7
7
|
Col,
|
|
8
|
-
Descriptions,
|
|
9
8
|
Divider,
|
|
10
9
|
Drawer,
|
|
11
10
|
Row,
|
|
@@ -89,13 +88,7 @@ const LoaderFiles = (props) => {
|
|
|
89
88
|
width: innerWidth < 1500 ? innerWidth * 0.3 : innerWidth * 0.5
|
|
90
89
|
},
|
|
91
90
|
children: [
|
|
92
|
-
/* @__PURE__ */ jsx("div", { className: styles.keywords, children: /* @__PURE__ */ jsx(
|
|
93
|
-
Keyword,
|
|
94
|
-
{
|
|
95
|
-
text: basename.replace(/\[.*?\]/g, ""),
|
|
96
|
-
keyword: props.filename
|
|
97
|
-
}
|
|
98
|
-
) }),
|
|
91
|
+
/* @__PURE__ */ jsx("div", { className: styles.keywords, children: /* @__PURE__ */ jsx(Keyword, { text: basename.replace(/\[.*?\]/g, ""), keyword: "" }) }),
|
|
99
92
|
/* @__PURE__ */ jsx("div", { className: styles.dividerDiv, children: /* @__PURE__ */ jsx(Divider, { className: styles.divider, dashed: true }) })
|
|
100
93
|
]
|
|
101
94
|
}
|
|
@@ -171,7 +164,7 @@ const LoaderFiles = (props) => {
|
|
|
171
164
|
);
|
|
172
165
|
},
|
|
173
166
|
dirTitle(_dir, defaultTitle) {
|
|
174
|
-
return /* @__PURE__ */ jsx(Keyword, { text: defaultTitle, keyword:
|
|
167
|
+
return /* @__PURE__ */ jsx(Keyword, { text: defaultTitle, keyword: "" });
|
|
175
168
|
}
|
|
176
169
|
});
|
|
177
170
|
}, [filteredFiles]);
|
|
@@ -311,21 +304,7 @@ const LoaderFiles = (props) => {
|
|
|
311
304
|
sortDirections: ["descend", "ascend"]
|
|
312
305
|
}
|
|
313
306
|
],
|
|
314
|
-
dataSource: tableData
|
|
315
|
-
footer: () => /* @__PURE__ */ jsxs(
|
|
316
|
-
Descriptions,
|
|
317
|
-
{
|
|
318
|
-
title: "Total",
|
|
319
|
-
bordered: true,
|
|
320
|
-
layout: "vertical",
|
|
321
|
-
size: "small",
|
|
322
|
-
children: [
|
|
323
|
-
/* @__PURE__ */ jsx(Descriptions.Item, { label: "loaders", children: tableData.length }),
|
|
324
|
-
/* @__PURE__ */ jsx(Descriptions.Item, { label: "files", children: sumBy(tableData, (e) => e.files) }),
|
|
325
|
-
/* @__PURE__ */ jsx(Descriptions.Item, { label: "duration", children: /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: formatCosts(sumBy(tableData, (e) => e.costs)) }) })
|
|
326
|
-
]
|
|
327
|
-
}
|
|
328
|
-
)
|
|
307
|
+
dataSource: tableData
|
|
329
308
|
}
|
|
330
309
|
)
|
|
331
310
|
}
|
|
@@ -330,7 +330,7 @@ const AssetDetail = ({
|
|
|
330
330
|
);
|
|
331
331
|
return /* @__PURE__ */ jsxs("div", { className: styles["bundle-tree"], children: [
|
|
332
332
|
/* @__PURE__ */ jsxs("div", { className: styles.box, children: [
|
|
333
|
-
/* @__PURE__ */ jsx("div", { className: styles.keywords, children: /* @__PURE__ */ jsx(Keyword, { ellipsis: true, text: basename, keyword:
|
|
333
|
+
/* @__PURE__ */ jsx("div", { className: styles.keywords, children: /* @__PURE__ */ jsx(Keyword, { ellipsis: true, text: basename, keyword: "" }) }),
|
|
334
334
|
/* @__PURE__ */ jsx("div", { className: styles.dividerDiv, children: /* @__PURE__ */ jsx(Divider, { className: styles.divider, dashed: true }) })
|
|
335
335
|
] }),
|
|
336
336
|
/* @__PURE__ */ jsxs(Space, { children: [
|
|
@@ -444,7 +444,7 @@ const AssetDetail = ({
|
|
|
444
444
|
{
|
|
445
445
|
className: styles.bundle,
|
|
446
446
|
title: `Modules of "${asset.path}"`,
|
|
447
|
-
bodyStyle: {
|
|
447
|
+
bodyStyle: { minHeight: height },
|
|
448
448
|
size: "small",
|
|
449
449
|
children: [
|
|
450
450
|
includeModules.length ? /* @__PURE__ */ jsxs(Row, { children: [
|
|
@@ -486,7 +486,8 @@ const AssetDetail = ({
|
|
|
486
486
|
defaultExpandedKeys: expandedModulesKeys?.length ? expandedModulesKeys : fileStructures.length === 1 ? [fileStructures[0].key] : [],
|
|
487
487
|
treeData: fileStructures,
|
|
488
488
|
rootStyle: {
|
|
489
|
-
|
|
489
|
+
maxHeight: "500px",
|
|
490
|
+
overflow: "auto",
|
|
490
491
|
border: "1px solid rgba(235, 237, 241)",
|
|
491
492
|
padding: "14px 20px"
|
|
492
493
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import {
|
|
3
3
|
CodepenCircleOutlined,
|
|
4
4
|
DeploymentUnitOutlined,
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
} from "antd";
|
|
22
22
|
import { debounce, includes, sumBy } from "lodash-es";
|
|
23
23
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
24
|
+
import { SearchModal } from "./search-modal";
|
|
24
25
|
import { ServerAPIProvider, withServerAPI } from "../../../components/Manifest";
|
|
25
26
|
import { Badge as Bdg } from "../../../components/Badge";
|
|
26
27
|
import { FileTree } from "../../../components/FileTree";
|
|
@@ -34,7 +35,7 @@ import { AssetDetail } from "./asset";
|
|
|
34
35
|
import "./index.css";
|
|
35
36
|
import styles from "./index.module";
|
|
36
37
|
const { Option } = Select;
|
|
37
|
-
const cardBodyHeight =
|
|
38
|
+
const cardBodyHeight = 600;
|
|
38
39
|
const largeCardBodyHeight = 800;
|
|
39
40
|
const tabList = [
|
|
40
41
|
{
|
|
@@ -177,14 +178,7 @@ const WebpackModulesOverallBase = ({ errors, cwd, summary, entryPoints }) => {
|
|
|
177
178
|
setAssetPath(path);
|
|
178
179
|
},
|
|
179
180
|
children: [
|
|
180
|
-
/* @__PURE__ */ jsx(
|
|
181
|
-
Keyword,
|
|
182
|
-
{
|
|
183
|
-
text: basename,
|
|
184
|
-
keyword: inputAssetName,
|
|
185
|
-
className: styles.fileText
|
|
186
|
-
}
|
|
187
|
-
),
|
|
181
|
+
/* @__PURE__ */ jsx(Keyword, { text: basename, keyword: "", className: styles.fileText }),
|
|
188
182
|
/* @__PURE__ */ jsxs(Space, { size: "small", className: styles.assetsTag, children: [
|
|
189
183
|
/* @__PURE__ */ jsx(Divider, { type: "vertical" }),
|
|
190
184
|
/* @__PURE__ */ jsx(Typography.Text, { style: { color: "#4FD233" }, children: formatSize(size) }),
|
|
@@ -211,7 +205,7 @@ const WebpackModulesOverallBase = ({ errors, cwd, summary, entryPoints }) => {
|
|
|
211
205
|
setAssetName(value);
|
|
212
206
|
setDefaultExpandAll(false);
|
|
213
207
|
};
|
|
214
|
-
return /* @__PURE__ */ jsxs("div", { className: "bundle-size-card", children: [
|
|
208
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "bundle-size-card", children: [
|
|
215
209
|
/* @__PURE__ */ jsx(BundleCards, { cwd, errors, summary }),
|
|
216
210
|
/* @__PURE__ */ jsxs(
|
|
217
211
|
Card,
|
|
@@ -226,28 +220,35 @@ const WebpackModulesOverallBase = ({ errors, cwd, summary, entryPoints }) => {
|
|
|
226
220
|
},
|
|
227
221
|
children: [
|
|
228
222
|
/* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsx(Typography.Text, { code: true, children: "From: webpack-bundle-analyzer" }) }),
|
|
229
|
-
/* @__PURE__ */ jsx(
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
223
|
+
/* @__PURE__ */ jsx(
|
|
224
|
+
ServerAPIProvider,
|
|
225
|
+
{
|
|
226
|
+
api: SDK.ServerAPI.API.GetTileReportHtml,
|
|
227
|
+
body: {},
|
|
228
|
+
children: (data) => {
|
|
229
|
+
if (data && graphType === "tile") {
|
|
230
|
+
return /* @__PURE__ */ jsx(
|
|
231
|
+
"iframe",
|
|
232
|
+
{
|
|
233
|
+
srcDoc: data,
|
|
234
|
+
width: "100%",
|
|
235
|
+
height: largeCardBodyHeight,
|
|
236
|
+
style: { border: "none" }
|
|
237
|
+
}
|
|
238
|
+
);
|
|
238
239
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
240
|
+
return /* @__PURE__ */ jsx(
|
|
241
|
+
Empty,
|
|
242
|
+
{
|
|
243
|
+
description: /* @__PURE__ */ jsxs("div", { children: [
|
|
244
|
+
"Tile graph is disabled,",
|
|
245
|
+
/* @__PURE__ */ jsx("a", { href: "https://rsdoctor.dev/config/options/options#generatetilegraph", children: "see the documentation to learn how to enable." })
|
|
246
|
+
] })
|
|
247
|
+
}
|
|
248
|
+
);
|
|
248
249
|
}
|
|
249
|
-
|
|
250
|
-
|
|
250
|
+
}
|
|
251
|
+
)
|
|
251
252
|
]
|
|
252
253
|
}
|
|
253
254
|
),
|
|
@@ -261,89 +262,114 @@ const WebpackModulesOverallBase = ({ errors, cwd, summary, entryPoints }) => {
|
|
|
261
262
|
tabProps: {
|
|
262
263
|
size: "middle"
|
|
263
264
|
},
|
|
264
|
-
children: /* @__PURE__ */ jsxs(
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
/* @__PURE__ */
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
"
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
265
|
+
children: /* @__PURE__ */ jsxs(Space, { direction: "vertical", children: [
|
|
266
|
+
/* @__PURE__ */ jsxs(Row, { align: "middle", gutter: [Size.BasePadding, Size.BasePadding], children: [
|
|
267
|
+
entryPoints && entryPoints.length ? /* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsx(
|
|
268
|
+
Select,
|
|
269
|
+
{
|
|
270
|
+
mode: "multiple",
|
|
271
|
+
value: selectedEntryPoints.map((e) => e.name),
|
|
272
|
+
style: { minWidth: 230, width: "auto", maxWidth: 300 },
|
|
273
|
+
placeholder: "filter assets by entry point",
|
|
274
|
+
onChange: (name) => {
|
|
275
|
+
setEntryPoints(
|
|
276
|
+
name.map((e) => entryPoints.find((ep) => ep.name === e)).filter(Boolean)
|
|
277
|
+
);
|
|
278
|
+
},
|
|
279
|
+
allowClear: true,
|
|
280
|
+
onClear: () => {
|
|
281
|
+
setEntryPoints([]);
|
|
282
|
+
},
|
|
283
|
+
children: entryPoints.map((e) => {
|
|
284
|
+
return /* @__PURE__ */ jsx(Select.Option, { value: e.name, children: /* @__PURE__ */ jsx(Space, { children: /* @__PURE__ */ jsx(
|
|
285
|
+
Bdg,
|
|
286
|
+
{
|
|
287
|
+
label: e.name,
|
|
288
|
+
value: formatSize(e.size),
|
|
289
|
+
tooltip: e.name
|
|
290
|
+
}
|
|
291
|
+
) }) }, e.name);
|
|
292
|
+
})
|
|
293
|
+
}
|
|
294
|
+
) }) : null,
|
|
295
|
+
/* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsx(
|
|
296
|
+
KeywordInput,
|
|
297
|
+
{
|
|
298
|
+
placeholder: "search asset by keyword",
|
|
299
|
+
onChange: onSearch
|
|
300
|
+
}
|
|
301
|
+
) }),
|
|
302
|
+
/* @__PURE__ */ jsx(Col, { span: 6, children: /* @__PURE__ */ jsx(
|
|
303
|
+
InputNumber,
|
|
304
|
+
{
|
|
305
|
+
min: 0,
|
|
306
|
+
style: { width: "95%" },
|
|
307
|
+
addonBefore: /* @__PURE__ */ jsxs(Space, { children: [
|
|
308
|
+
/* @__PURE__ */ jsx(
|
|
309
|
+
Typography.Text,
|
|
310
|
+
{
|
|
311
|
+
style: { fontSize: 14, color: "inherit" },
|
|
312
|
+
children: "Asset Size"
|
|
313
|
+
}
|
|
314
|
+
),
|
|
315
|
+
/* @__PURE__ */ jsx(
|
|
316
|
+
Tooltip,
|
|
317
|
+
{
|
|
318
|
+
title: t(
|
|
319
|
+
"filter the output assets which size is greater than the input value"
|
|
320
|
+
),
|
|
321
|
+
style: { marginLeft: 3 },
|
|
322
|
+
children: /* @__PURE__ */ jsx(
|
|
323
|
+
InfoCircleOutlined,
|
|
324
|
+
{
|
|
325
|
+
style: { color: "rgba(0,0,0,.45)" }
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
}
|
|
329
|
+
)
|
|
330
|
+
] }),
|
|
331
|
+
onChange: (value) => onChangeAsset(Number(value)),
|
|
332
|
+
addonAfter: selectAfter("chunk")
|
|
333
|
+
}
|
|
334
|
+
) }),
|
|
335
|
+
/* @__PURE__ */ jsx(Col, { span: 6, children: /* @__PURE__ */ jsx(
|
|
336
|
+
InputNumber,
|
|
337
|
+
{
|
|
338
|
+
min: 0,
|
|
339
|
+
style: { width: "95%" },
|
|
340
|
+
addonBefore: /* @__PURE__ */ jsxs(Space, { children: [
|
|
341
|
+
/* @__PURE__ */ jsx(
|
|
342
|
+
Typography.Text,
|
|
343
|
+
{
|
|
344
|
+
style: { fontSize: 14, color: "inherit" },
|
|
345
|
+
children: "Module Size"
|
|
346
|
+
}
|
|
347
|
+
),
|
|
348
|
+
/* @__PURE__ */ jsx(
|
|
349
|
+
Tooltip,
|
|
350
|
+
{
|
|
351
|
+
title: t(
|
|
352
|
+
"filter the modules which size is greater than the input value"
|
|
353
|
+
),
|
|
354
|
+
style: { marginLeft: 3 },
|
|
355
|
+
children: /* @__PURE__ */ jsx(
|
|
356
|
+
InfoCircleOutlined,
|
|
357
|
+
{
|
|
358
|
+
style: { color: "rgba(0,0,0,.45)" }
|
|
359
|
+
}
|
|
360
|
+
)
|
|
361
|
+
}
|
|
362
|
+
)
|
|
363
|
+
] }),
|
|
364
|
+
onChange: (value) => {
|
|
365
|
+
onChangeModule(Number(value));
|
|
366
|
+
},
|
|
367
|
+
addonAfter: selectAfter("module")
|
|
368
|
+
}
|
|
369
|
+
) })
|
|
370
|
+
] }),
|
|
371
|
+
/* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsx(SearchModal, {}) }),
|
|
372
|
+
/* @__PURE__ */ jsx(Row, { align: "middle", gutter: [Size.BasePadding, Size.BasePadding], children: /* @__PURE__ */ jsx(Col, { span: 24, children: filteredAssets.length ? /* @__PURE__ */ jsxs(Row, { gutter: Size.BasePadding, children: [
|
|
347
373
|
/* @__PURE__ */ jsx(Col, { span: 6, children: /* @__PURE__ */ jsx(
|
|
348
374
|
Card,
|
|
349
375
|
{
|
|
@@ -426,11 +452,11 @@ const WebpackModulesOverallBase = ({ errors, cwd, summary, entryPoints }) => {
|
|
|
426
452
|
)
|
|
427
453
|
}
|
|
428
454
|
) })
|
|
429
|
-
] }) : /* @__PURE__ */ jsx(Empty, {}) })
|
|
455
|
+
] }) : /* @__PURE__ */ jsx(Empty, {}) }) })
|
|
430
456
|
] })
|
|
431
457
|
}
|
|
432
458
|
)
|
|
433
|
-
] });
|
|
459
|
+
] }) });
|
|
434
460
|
};
|
|
435
461
|
const WebpackModulesOverall = withServerAPI({
|
|
436
462
|
api: SDK.ServerAPI.API.GetProjectInfo,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./index_module.css";
|
|
2
|
-
var index_module_default = { "assets": "assets_0b14c", "assetBox": "assetBox_0b14c", "fileText": "fileText_0b14c", "bundle-tree": "bundle-tree_0b14c", "box": "box_0b14c", "keyword": "keyword_0b14c", "divider": "divider_0b14c", "dividerDiv": "dividerDiv_0b14c", "assetsTag": "assetsTag_0b14c", "bundle": "bundle_0b14c", "bundle-size-card": "bundle-size-card_0b14c", "ant-tabs-tab": "ant-tabs-tab_0b14c" };
|
|
2
|
+
var index_module_default = { "assets": "assets_0b14c", "assetBox": "assetBox_0b14c", "fileText": "fileText_0b14c", "bundle-tree": "bundle-tree_0b14c", "box": "box_0b14c", "keyword": "keyword_0b14c", "divider": "divider_0b14c", "dividerDiv": "dividerDiv_0b14c", "assetsTag": "assetsTag_0b14c", "bundle": "bundle_0b14c", "bundle-size-card": "bundle-size-card_0b14c", "ant-tabs-tab": "ant-tabs-tab_0b14c", "modal": "modal_0b14c", "search-btn": "search-btn_0b14c", "search-modal-list": "search-modal-list_0b14c" };
|
|
3
3
|
export {
|
|
4
4
|
index_module_default as default
|
|
5
5
|
};
|
|
@@ -79,4 +79,33 @@
|
|
|
79
79
|
|
|
80
80
|
.bundle-size-card_0b14c .ant-tabs-tab_0b14c {
|
|
81
81
|
margin-right: 20px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.modal_0b14c .ant-input-affix-wrapper {
|
|
85
|
+
padding: 4px 5px;
|
|
86
|
+
width: 490px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.search-btn_0b14c {
|
|
90
|
+
color: white;
|
|
91
|
+
}
|
|
92
|
+
.search-btn_0b14c > span {
|
|
93
|
+
position: relative;
|
|
94
|
+
}
|
|
95
|
+
.search-btn_0b14c::before {
|
|
96
|
+
content: "";
|
|
97
|
+
background: linear-gradient(135deg, #6253e1, #04befe);
|
|
98
|
+
position: absolute;
|
|
99
|
+
inset: -1px;
|
|
100
|
+
opacity: 1;
|
|
101
|
+
transition: all 0.3s;
|
|
102
|
+
border-radius: inherit;
|
|
103
|
+
}
|
|
104
|
+
.search-btn_0b14c:hover::before {
|
|
105
|
+
opacity: 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.search-modal-list_0b14c .ant-spin-container {
|
|
109
|
+
overflow: auto;
|
|
110
|
+
max-height: 30rem;
|
|
82
111
|
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
Modal,
|
|
6
|
+
Input,
|
|
7
|
+
Tabs,
|
|
8
|
+
List,
|
|
9
|
+
Skeleton,
|
|
10
|
+
Typography,
|
|
11
|
+
Empty
|
|
12
|
+
} from "antd";
|
|
13
|
+
import { ServerAPIProvider } from "../../../components";
|
|
14
|
+
import { SDK } from "@rsdoctor/types";
|
|
15
|
+
import styles from "./index.module";
|
|
16
|
+
const { Search } = Input;
|
|
17
|
+
const SearchModal = () => {
|
|
18
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
19
|
+
const [searchModule, setSearchModule] = useState("");
|
|
20
|
+
const [searchChunk, setSearchChunk] = useState("");
|
|
21
|
+
const onSearch = useCallback(
|
|
22
|
+
(...args) => {
|
|
23
|
+
const [value, _event] = args;
|
|
24
|
+
setSearchModule(value);
|
|
25
|
+
},
|
|
26
|
+
[]
|
|
27
|
+
);
|
|
28
|
+
const showModal = () => {
|
|
29
|
+
setIsModalOpen(true);
|
|
30
|
+
};
|
|
31
|
+
const handleOk = () => {
|
|
32
|
+
setIsModalOpen(false);
|
|
33
|
+
};
|
|
34
|
+
const handleCancel = () => {
|
|
35
|
+
setIsModalOpen(false);
|
|
36
|
+
};
|
|
37
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38
|
+
/* @__PURE__ */ jsx(Button, { className: styles["search-btn"], color: "cyan", onClick: showModal, children: "Search Module" }),
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
ServerAPIProvider,
|
|
41
|
+
{
|
|
42
|
+
api: SDK.ServerAPI.API.GetSearchModules,
|
|
43
|
+
body: { moduleName: String(searchModule) },
|
|
44
|
+
children: (assetsChunksList) => {
|
|
45
|
+
const defaultChunkId = Object.keys(assetsChunksList)[0];
|
|
46
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
47
|
+
Modal,
|
|
48
|
+
{
|
|
49
|
+
className: styles.modal,
|
|
50
|
+
title: "Search Modules",
|
|
51
|
+
onOk: handleOk,
|
|
52
|
+
onCancel: handleCancel,
|
|
53
|
+
open: isModalOpen,
|
|
54
|
+
width: "65rem",
|
|
55
|
+
footer: "",
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
Search,
|
|
59
|
+
{
|
|
60
|
+
placeholder: "input search module name",
|
|
61
|
+
allowClear: true,
|
|
62
|
+
onSearch,
|
|
63
|
+
style: { width: 500 }
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
defaultChunkId ? /* @__PURE__ */ jsx(
|
|
67
|
+
Tabs,
|
|
68
|
+
{
|
|
69
|
+
defaultActiveKey: defaultChunkId,
|
|
70
|
+
tabPosition: "top",
|
|
71
|
+
onChange: (value) => setSearchChunk(value),
|
|
72
|
+
items: Object.keys(assetsChunksList).map((chunk, _i) => {
|
|
73
|
+
const id = chunk;
|
|
74
|
+
return {
|
|
75
|
+
label: assetsChunksList[chunk],
|
|
76
|
+
key: id,
|
|
77
|
+
children: ModulesModal(
|
|
78
|
+
searchModule,
|
|
79
|
+
searchChunk || defaultChunkId
|
|
80
|
+
)
|
|
81
|
+
};
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
) : /* @__PURE__ */ jsx(Empty, { description: "No modules found." })
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
) });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
] });
|
|
92
|
+
};
|
|
93
|
+
const ModulesModal = (searchModule, chunk) => {
|
|
94
|
+
return /* @__PURE__ */ jsx(
|
|
95
|
+
ServerAPIProvider,
|
|
96
|
+
{
|
|
97
|
+
api: SDK.ServerAPI.API.GetSearchModuleInChunk,
|
|
98
|
+
body: { moduleName: String(searchModule), chunk },
|
|
99
|
+
children: (modules) => /* @__PURE__ */ jsx(Fragment, { children: modules?.length !== 0 ? /* @__PURE__ */ jsx(
|
|
100
|
+
List,
|
|
101
|
+
{
|
|
102
|
+
className: styles["search-modal-list"],
|
|
103
|
+
loading: !modules.length,
|
|
104
|
+
itemLayout: "horizontal",
|
|
105
|
+
pagination: { position: "bottom", align: "center" },
|
|
106
|
+
dataSource: modules,
|
|
107
|
+
renderItem: (item) => {
|
|
108
|
+
const itemPathArr = item.relativePath.split(searchModule);
|
|
109
|
+
return /* @__PURE__ */ jsx(List.Item, { children: /* @__PURE__ */ jsx(Skeleton, { avatar: true, title: false, loading: !item.path, active: true, children: /* @__PURE__ */ jsx(
|
|
110
|
+
List.Item.Meta,
|
|
111
|
+
{
|
|
112
|
+
description: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
113
|
+
/* @__PURE__ */ jsx(Typography.Text, { code: true, children: "Module:" }),
|
|
114
|
+
itemPathArr.map((cur, index) => {
|
|
115
|
+
if (index < itemPathArr.length - 1) {
|
|
116
|
+
return /* @__PURE__ */ jsxs(Typography.Text, { style: { fontWeight: 200 }, children: [
|
|
117
|
+
cur,
|
|
118
|
+
/* @__PURE__ */ jsx(
|
|
119
|
+
Typography.Text,
|
|
120
|
+
{
|
|
121
|
+
strong: true,
|
|
122
|
+
style: { fontWeight: 600 },
|
|
123
|
+
children: searchModule
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
] });
|
|
127
|
+
}
|
|
128
|
+
return /* @__PURE__ */ jsx(Typography.Text, { style: { fontWeight: 200 }, children: cur });
|
|
129
|
+
})
|
|
130
|
+
] })
|
|
131
|
+
}
|
|
132
|
+
) }) });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
) : /* @__PURE__ */ jsx(Empty, {}) })
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
};
|
|
139
|
+
export {
|
|
140
|
+
SearchModal
|
|
141
|
+
};
|
|
@@ -14,7 +14,7 @@ import style from "./index.module";
|
|
|
14
14
|
const Component = ({ project }) => {
|
|
15
15
|
const { summary, configs, root: cwd, envinfo, errors } = project;
|
|
16
16
|
return /* @__PURE__ */ jsx("div", { className: style.overall, children: /* @__PURE__ */ jsxs(Flex, { style: { width: "100%" }, children: [
|
|
17
|
-
/* @__PURE__ */ jsx("div", { style: { flex: 3, marginRight: "16px" }, children: /* @__PURE__ */ jsxs(ResponsiveLayout, { children: [
|
|
17
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 3, marginRight: "16px", maxWidth: "75%" }, children: /* @__PURE__ */ jsxs(ResponsiveLayout, { children: [
|
|
18
18
|
/* @__PURE__ */ jsx(
|
|
19
19
|
ProjectOverall,
|
|
20
20
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/components",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@ant-design/icons": "5.6.
|
|
44
|
-
"@rsbuild/plugin-check-syntax": "1.2.
|
|
45
|
-
"@monaco-editor/react": "4.
|
|
43
|
+
"@ant-design/icons": "5.6.1",
|
|
44
|
+
"@rsbuild/plugin-check-syntax": "1.2.2",
|
|
45
|
+
"@monaco-editor/react": "4.7.0",
|
|
46
46
|
"@types/lodash-es": "4.17.12",
|
|
47
47
|
"@types/node": "^16",
|
|
48
48
|
"@types/path-browserify": "1.0.3",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
"socket.io-client": "4.6.1",
|
|
72
72
|
"typescript": "^5.2.2",
|
|
73
73
|
"url-parse": "1.5.10",
|
|
74
|
-
"@rsdoctor/graph": "1.0.0-beta.
|
|
75
|
-
"@rsdoctor/types": "1.0.0-beta.
|
|
76
|
-
"@rsdoctor/utils": "1.0.0-beta.
|
|
74
|
+
"@rsdoctor/graph": "1.0.0-beta.1",
|
|
75
|
+
"@rsdoctor/types": "1.0.0-beta.1",
|
|
76
|
+
"@rsdoctor/utils": "1.0.0-beta.1"
|
|
77
77
|
},
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public",
|