@rsdoctor/components 0.3.11 → 0.4.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.
- package/dist/components/Alert/package-relation.d.ts +2 -2
- package/dist/components/Alert/package-relation.js +52 -56
- package/dist/components/Alerts/overlay.d.ts +1 -1
- package/dist/components/BundleDiff/DiffContainer/packages.d.ts +2 -2
- package/dist/components/BundleDiff/DiffContainer/row.d.ts +2 -2
- package/dist/components/BundleDiff/DiffContainer/types.d.ts +0 -1
- package/dist/components/BundleDiff/DiffServerAPIProvider/index.d.ts +0 -1
- package/dist/components/Charts/TimelineCharts/index.js +16 -2
- package/dist/components/CodeViewer/hightlight.js +24 -8
- package/dist/components/CodeViewer/viewer.d.ts +1 -0
- package/dist/components/CodeViewer/viewer.js +11 -3
- package/dist/components/Layout/menus.d.ts +1 -1
- package/dist/components/Loader/Analysis/files.js +76 -19
- package/dist/components/Loader/Analysis/index.js +16 -2
- package/dist/components/Loader/executions.d.ts +1 -1
- package/dist/components/Loader/executions.js +261 -116
- package/dist/components/Manifest/api.js +25 -11
- package/dist/config.d.ts +0 -1
- package/dist/pages/BundleSize/components/asset.js +11 -3
- package/dist/pages/BundleSize/components/index.js +2 -1
- package/dist/pages/BundleSize/config.d.ts +0 -1
- package/dist/pages/TreeShaking/editor.js +8 -5
- package/dist/pages/TreeShaking/index.js +1 -0
- package/dist/pages/TreeShaking/range.d.ts +282 -0
- package/dist/pages/TreeShaking/range.js +542 -0
- package/dist/pages/TreeShaking/utils.d.ts +1 -1
- package/dist/pages/TreeShaking/utils.js +1 -1
- package/dist/pages/WebpackLoaders/Analysis/index.js +1 -1
- package/dist/utils/data/brief.d.ts +11 -0
- package/dist/utils/data/brief.js +42 -0
- package/dist/utils/data/index.js +11 -0
- package/dist/utils/file.d.ts +0 -1
- package/dist/utils/hooks.d.ts +0 -1
- package/dist/utils/manifest.d.ts +2 -5
- package/dist/utils/monaco.js +6 -1
- package/dist/utils/request.d.ts +6 -6
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { SDK } from '@rsdoctor/types';
|
|
2
|
+
import { Rule, SDK } from '@rsdoctor/types';
|
|
3
3
|
import { PackageRelationAlertProps } from './types';
|
|
4
4
|
export declare const PackageRelationReasons: React.FC<{
|
|
5
5
|
data: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPackageRelationAlertDetails>;
|
|
@@ -10,7 +10,7 @@ export declare const PackageRelationReasonsWithServer: React.FC<Omit<{
|
|
|
10
10
|
cwd: string;
|
|
11
11
|
}, "data"> & Partial<{
|
|
12
12
|
body: {
|
|
13
|
-
id:
|
|
13
|
+
id: Rule.RuleStoreDataItem["id"];
|
|
14
14
|
target: SDK.PackageBasicData;
|
|
15
15
|
};
|
|
16
16
|
}>>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createElement } from "react";
|
|
3
2
|
import React, { useState } from "react";
|
|
4
3
|
import {
|
|
5
4
|
Space,
|
|
@@ -25,63 +24,60 @@ import { TextDrawer } from "../TextDrawer";
|
|
|
25
24
|
import { Title } from "../Title";
|
|
26
25
|
import { Size, Color } from "../../constants";
|
|
27
26
|
import { Badge as Bdg } from "../Badge";
|
|
28
|
-
import { FileHightLightViewer } from "../CodeViewer";
|
|
29
27
|
import { withServerAPI } from "../Manifest";
|
|
30
|
-
const
|
|
28
|
+
const TextDrawerWidth = "60%";
|
|
29
|
+
const PackageRelationReasons = ({ data }) => {
|
|
31
30
|
const [index, setIndex] = useState(0);
|
|
32
31
|
const { t } = useI18n();
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
) }),
|
|
83
|
-
/* @__PURE__ */ jsx(Col, { span: 12, style: { height: "100%" }, children: /* @__PURE__ */ createElement(FileHightLightViewer, { ...data[index], key: index, cwd }) })
|
|
84
|
-
] });
|
|
32
|
+
return /* @__PURE__ */ jsx(Row, { gutter: Size.BasePadding, wrap: false, align: "top", children: /* @__PURE__ */ jsx(Col, { span: 20, style: { height: "100%" }, children: /* @__PURE__ */ jsx(
|
|
33
|
+
Card,
|
|
34
|
+
{
|
|
35
|
+
title: `The reasons for importing this version`,
|
|
36
|
+
style: { height: "100%" },
|
|
37
|
+
extra: /* @__PURE__ */ jsx(
|
|
38
|
+
Popover,
|
|
39
|
+
{
|
|
40
|
+
content: /* @__PURE__ */ jsx(Typography.Text, { children: t("DuplicatePakCodeExplain") }),
|
|
41
|
+
children: /* @__PURE__ */ jsx("a", { href: "#", children: "Explain" })
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
bodyStyle: { overflow: "scroll" },
|
|
45
|
+
children: data.length ? /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
46
|
+
/* @__PURE__ */ jsx("div", { style: { marginBottom: Size.BasePadding }, children: /* @__PURE__ */ jsx(Typography.Text, { type: "secondary", strong: true, children: "Click the file path below to show the reason in code viewer." }) }),
|
|
47
|
+
/* @__PURE__ */ jsx(Timeline, { children: data.map((e, i) => {
|
|
48
|
+
const { dependency, module, relativePath } = e;
|
|
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
|
+
) }) });
|
|
85
81
|
};
|
|
86
82
|
const PackageRelationReasonsWithServer = withServerAPI({
|
|
87
83
|
Component: PackageRelationReasons,
|
|
@@ -226,7 +222,7 @@ const PackageRelationAlert = ({
|
|
|
226
222
|
{
|
|
227
223
|
text: "Show Relations",
|
|
228
224
|
buttonProps: { size: "small" },
|
|
229
|
-
drawerProps: { title: data.title },
|
|
225
|
+
drawerProps: { title: data.title, width: TextDrawerWidth },
|
|
230
226
|
children: /* @__PURE__ */ jsxs(Space, { direction: "vertical", className: "alert-space", children: [
|
|
231
227
|
/* @__PURE__ */ jsxs(Space, { style: { marginBottom: Size.BasePadding / 2 }, children: [
|
|
232
228
|
/* @__PURE__ */ jsx(Title, { text: name, upperFisrt: false }),
|
|
@@ -20,7 +20,7 @@ export declare const OverlayAlertsWithButton: React.FC<Omit<{
|
|
|
20
20
|
}>>;
|
|
21
21
|
export declare const OverlayAlertsWithTips: React.FC<Omit<{
|
|
22
22
|
alerts: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetOverlayAlerts>;
|
|
23
|
-
defaultOpen?: boolean
|
|
23
|
+
defaultOpen?: boolean;
|
|
24
24
|
}, "alerts"> & Partial<{
|
|
25
25
|
body?: any;
|
|
26
26
|
}>>;
|
|
@@ -10,8 +10,8 @@ export declare const getPackagesTableDataSource: ({ baseline, current, }: {
|
|
|
10
10
|
}) => {
|
|
11
11
|
updateType: UpdateType;
|
|
12
12
|
name: string;
|
|
13
|
-
baseline?: SDK.PackageData[]
|
|
14
|
-
current?: SDK.PackageData[]
|
|
13
|
+
baseline?: SDK.PackageData[];
|
|
14
|
+
current?: SDK.PackageData[];
|
|
15
15
|
}[];
|
|
16
16
|
export declare const Packages: React.FC<{
|
|
17
17
|
baseline: SDK.PackageGraphData;
|
|
@@ -2,8 +2,8 @@ import { ColumnGroupType, ColumnType } from 'antd/es/table/interface';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { BundleDiffComponentCardProps, BundleDiffTableAssetsData, BundleDiffTableModulesData } from './types';
|
|
4
4
|
export declare const ModuleHashPattern: RegExp;
|
|
5
|
-
export declare const getSizeColumnPropsForModuleRow: (key:
|
|
6
|
-
export declare const getTargetColumnPropsForModuleRow: (key:
|
|
5
|
+
export declare const getSizeColumnPropsForModuleRow: (key: "baseline" | "current", sizeKey: "parsedSize" | "sourceSize") => ColumnType<BundleDiffTableModulesData>;
|
|
6
|
+
export declare const getTargetColumnPropsForModuleRow: (key: "baseline" | "current", bMoudlesCount: number, cMoudlesCount: number) => ColumnGroupType<BundleDiffTableModulesData>;
|
|
7
7
|
export declare const ModuleRowForAsset: React.FC<{
|
|
8
8
|
data: BundleDiffTableAssetsData;
|
|
9
9
|
} & Pick<BundleDiffComponentCardProps, 'baseline' | 'current'>>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { SDK } from '@rsdoctor/types';
|
|
3
2
|
import { BundleDiffServerAPIProviderComponentCommonProps } from '../DiffContainer/types';
|
|
4
3
|
export declare const DiffServerAPIProvider: <T extends SDK.ServerAPI.API | SDK.ServerAPI.APIExtends>(props: BundleDiffServerAPIProviderComponentCommonProps<T>) => JSX.Element;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect, memo } from "react";
|
|
3
|
-
import
|
|
3
|
+
import ReactEChartsCore from "echarts-for-react/lib/core";
|
|
4
4
|
import * as echarts from "echarts/core";
|
|
5
|
+
import { CustomChart } from "echarts/charts";
|
|
6
|
+
import {
|
|
7
|
+
TooltipComponent,
|
|
8
|
+
GridComponent,
|
|
9
|
+
DataZoomComponent
|
|
10
|
+
} from "echarts/components";
|
|
11
|
+
import { CanvasRenderer } from "echarts/renderers";
|
|
5
12
|
import dayjs from "dayjs";
|
|
6
13
|
import { groupBy } from "lodash-es";
|
|
7
14
|
import { LITTLE_PALETTE_COLORS, PALETTE_COLORS } from "../constants";
|
|
@@ -10,6 +17,13 @@ const TimelineCom = memo(({ loaderData, pluginsData, formatterFn, chartType = "n
|
|
|
10
17
|
const data = [];
|
|
11
18
|
let categories = [];
|
|
12
19
|
const [optionsData, setOptinsData] = useState({});
|
|
20
|
+
echarts.use([
|
|
21
|
+
CustomChart,
|
|
22
|
+
TooltipComponent,
|
|
23
|
+
GridComponent,
|
|
24
|
+
DataZoomComponent,
|
|
25
|
+
CanvasRenderer
|
|
26
|
+
]);
|
|
13
27
|
useEffect(() => {
|
|
14
28
|
if (!loaderData)
|
|
15
29
|
return;
|
|
@@ -199,7 +213,7 @@ const TimelineCom = memo(({ loaderData, pluginsData, formatterFn, chartType = "n
|
|
|
199
213
|
setOptinsData(option);
|
|
200
214
|
}, [loaderData, pluginsData]);
|
|
201
215
|
return /* @__PURE__ */ jsx(
|
|
202
|
-
|
|
216
|
+
ReactEChartsCore,
|
|
203
217
|
{
|
|
204
218
|
option: optionsData,
|
|
205
219
|
echarts,
|
|
@@ -3,9 +3,19 @@ import { useRef } from "react";
|
|
|
3
3
|
import { Space, Card, Tooltip } from "antd";
|
|
4
4
|
import { InfoCircleOutlined } from "@ant-design/icons";
|
|
5
5
|
import Editor from "@monaco-editor/react";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
getOriginalLanguage,
|
|
8
|
+
beautifyModulePath,
|
|
9
|
+
getSelectionRange,
|
|
10
|
+
getRevealPositionForViewer
|
|
11
|
+
} from "../../utils";
|
|
7
12
|
import { CodeOpener } from "../Opener";
|
|
8
|
-
const FileHightLightViewer = ({
|
|
13
|
+
const FileHightLightViewer = ({
|
|
14
|
+
dependency,
|
|
15
|
+
module,
|
|
16
|
+
cwd,
|
|
17
|
+
moduleCode
|
|
18
|
+
}) => {
|
|
9
19
|
const editorRef = useRef(null);
|
|
10
20
|
if (!dependency)
|
|
11
21
|
return null;
|
|
@@ -14,12 +24,18 @@ const FileHightLightViewer = ({ dependency, module, cwd, moduleCode }) => {
|
|
|
14
24
|
const { start, end } = statements?.[0]?.position ? hasSourceRange ? statements[0].position.source : statements[0].position.transformed : { start: { line: 0, column: 0 }, end: { line: 0, column: 0 } };
|
|
15
25
|
const content = hasSourceRange ? moduleCode?.source : moduleCode?.transformed || moduleCode?.source;
|
|
16
26
|
const modulePath = module.path;
|
|
17
|
-
const handleEditorDidMount = (
|
|
18
|
-
editorRef.current =
|
|
19
|
-
const range = getSelectionRange(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
const handleEditorDidMount = (editor, monaco) => {
|
|
28
|
+
editorRef.current = editor;
|
|
29
|
+
const range = getSelectionRange(
|
|
30
|
+
{ start, end },
|
|
31
|
+
monaco.Range
|
|
32
|
+
);
|
|
33
|
+
const position = getRevealPositionForViewer(
|
|
34
|
+
range.startLineNumber,
|
|
35
|
+
range.startColumn
|
|
36
|
+
);
|
|
37
|
+
editor.revealPositionInCenter(position);
|
|
38
|
+
editor.deltaDecorations(
|
|
23
39
|
[],
|
|
24
40
|
[
|
|
25
41
|
{
|
|
@@ -7,6 +7,7 @@ interface CodeViewerProps {
|
|
|
7
7
|
defaultLine?: number;
|
|
8
8
|
ranges?: SDK.SourceRange[];
|
|
9
9
|
editorConfig?: editor.IStandaloneEditorConstructionOptions;
|
|
10
|
+
emptyReason?: string;
|
|
10
11
|
}
|
|
11
12
|
export declare const CodeViewer: React.FC<CodeViewerProps>;
|
|
12
13
|
export declare const CodeViewerWithDrawer: React.FC<CodeViewerProps>;
|
|
@@ -5,7 +5,15 @@ import { CodepenCircleOutlined } from "@ant-design/icons";
|
|
|
5
5
|
import { getOriginalLanguage, getSelectionRange } from "../../utils";
|
|
6
6
|
import { DefaultEditorConfig } from "./config";
|
|
7
7
|
import { TextDrawer } from "../TextDrawer";
|
|
8
|
-
|
|
8
|
+
import { Empty } from "antd";
|
|
9
|
+
const CodeViewer = ({
|
|
10
|
+
content,
|
|
11
|
+
ranges,
|
|
12
|
+
path,
|
|
13
|
+
defaultLine,
|
|
14
|
+
editorConfig = {},
|
|
15
|
+
emptyReason
|
|
16
|
+
}) => {
|
|
9
17
|
const handleEditorDidMount = (editor, monaco) => {
|
|
10
18
|
if (isNumber(defaultLine)) {
|
|
11
19
|
editor.revealLine(defaultLine);
|
|
@@ -22,7 +30,7 @@ const CodeViewer = ({ content, ranges, path, defaultLine, editorConfig = {} }) =
|
|
|
22
30
|
);
|
|
23
31
|
}
|
|
24
32
|
};
|
|
25
|
-
return /* @__PURE__ */ jsx(
|
|
33
|
+
return content ? /* @__PURE__ */ jsx(
|
|
26
34
|
Editor,
|
|
27
35
|
{
|
|
28
36
|
theme: "vs-dark",
|
|
@@ -33,7 +41,7 @@ const CodeViewer = ({ content, ranges, path, defaultLine, editorConfig = {} }) =
|
|
|
33
41
|
options: { ...DefaultEditorConfig, ...editorConfig },
|
|
34
42
|
onMount: handleEditorDidMount
|
|
35
43
|
}
|
|
36
|
-
);
|
|
44
|
+
) : /* @__PURE__ */ jsx(Empty, { description: emptyReason });
|
|
37
45
|
};
|
|
38
46
|
const CodeViewerWithDrawer = (props) => {
|
|
39
47
|
return /* @__PURE__ */ jsx(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Manifest } from '@rsdoctor/types';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export declare const Menus: React.FC<Omit<{
|
|
4
|
-
style?: React.CSSProperties
|
|
4
|
+
style?: React.CSSProperties;
|
|
5
5
|
routes: Manifest.RsdoctorManifestClientRoutes[];
|
|
6
6
|
}, "routes"> & Partial<{
|
|
7
7
|
body?: any;
|
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useCallback, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { endsWith, get, sumBy } from "lodash-es";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Card,
|
|
6
|
+
Col,
|
|
7
|
+
Descriptions,
|
|
8
|
+
Divider,
|
|
9
|
+
Drawer,
|
|
10
|
+
Row,
|
|
11
|
+
Space,
|
|
12
|
+
Table,
|
|
13
|
+
Tooltip,
|
|
14
|
+
Typography
|
|
15
|
+
} from "antd";
|
|
5
16
|
import { CloseCircleOutlined } from "@ant-design/icons";
|
|
6
17
|
import { Constants, SDK } from "@rsdoctor/types";
|
|
7
18
|
import { ServerAPIProvider } from "../../Manifest";
|
|
8
19
|
import { drawerWidth, Size } from "../../../constants";
|
|
9
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
createFileStructures,
|
|
22
|
+
formatCosts,
|
|
23
|
+
mapFileKey,
|
|
24
|
+
filterLoader,
|
|
25
|
+
useMonacoEditor
|
|
26
|
+
} from "../../../utils";
|
|
10
27
|
import { LoaderExecutions } from "../executions";
|
|
11
28
|
import { FileTree } from "../../FileTree";
|
|
12
29
|
import { Keyword } from "../../Keyword";
|
|
@@ -22,9 +39,13 @@ const LoaderFiles = (props) => {
|
|
|
22
39
|
const init = useCallback(async () => {
|
|
23
40
|
await initMonaco(monacoRef);
|
|
24
41
|
}, []);
|
|
25
|
-
const maxHeight =
|
|
42
|
+
const maxHeight = 800;
|
|
26
43
|
const filteredFiles = useMemo(
|
|
27
|
-
() => filetree.filter(
|
|
44
|
+
() => filetree.filter(
|
|
45
|
+
(e) => e.loaders.some(
|
|
46
|
+
(l) => filterLoader(e.path, l.loader, props.filename, props.loaders)
|
|
47
|
+
)
|
|
48
|
+
),
|
|
28
49
|
[props.filename, props.loaders]
|
|
29
50
|
);
|
|
30
51
|
const inlinedResourcePathKey = "__RESOURCEPATH__";
|
|
@@ -69,7 +90,14 @@ const LoaderFiles = (props) => {
|
|
|
69
90
|
setDrawerVisible(true);
|
|
70
91
|
},
|
|
71
92
|
children: [
|
|
72
|
-
/* @__PURE__ */ jsx(
|
|
93
|
+
/* @__PURE__ */ jsx(
|
|
94
|
+
Typography.Text,
|
|
95
|
+
{
|
|
96
|
+
style: { maxWidth: 135, color: "inherit" },
|
|
97
|
+
ellipsis: true,
|
|
98
|
+
children: e.loader
|
|
99
|
+
}
|
|
100
|
+
),
|
|
73
101
|
/* @__PURE__ */ jsx(Divider, { type: "vertical" }),
|
|
74
102
|
isError ? /* @__PURE__ */ jsx(CloseCircleOutlined, {}) : /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: formatCosts(e.costs) })
|
|
75
103
|
]
|
|
@@ -93,16 +121,20 @@ const LoaderFiles = (props) => {
|
|
|
93
121
|
"Total Files: ",
|
|
94
122
|
filteredFiles.length
|
|
95
123
|
] }),
|
|
96
|
-
bodyStyle: { overflow: "scroll", maxHeight },
|
|
124
|
+
bodyStyle: { overflow: "scroll", maxHeight, height: "40rem" },
|
|
97
125
|
children: [
|
|
98
126
|
/* @__PURE__ */ jsx(
|
|
99
127
|
FileTree,
|
|
100
128
|
{
|
|
101
|
-
defaultExpandedKeys: mapFileKey(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
129
|
+
defaultExpandedKeys: mapFileKey(
|
|
130
|
+
files,
|
|
131
|
+
filteredFiles.length >= 100 ? 3 : 4,
|
|
132
|
+
(node) => {
|
|
133
|
+
const resourcePath2 = get(node, inlinedResourcePathKey);
|
|
134
|
+
const isNodeModules = resourcePath2.indexOf("/node_modules/") > -1;
|
|
135
|
+
return !isNodeModules;
|
|
136
|
+
}
|
|
137
|
+
),
|
|
106
138
|
treeData: files,
|
|
107
139
|
onSelect: (_e, info) => {
|
|
108
140
|
init();
|
|
@@ -124,7 +156,14 @@ const LoaderFiles = (props) => {
|
|
|
124
156
|
width: drawerWidth,
|
|
125
157
|
zIndex: 999,
|
|
126
158
|
bodyStyle: { padding: 0 },
|
|
127
|
-
children: drawerVisible ? /* @__PURE__ */ jsx(
|
|
159
|
+
children: drawerVisible ? /* @__PURE__ */ jsx(
|
|
160
|
+
ServerAPIProvider,
|
|
161
|
+
{
|
|
162
|
+
api: SDK.ServerAPI.API.GetLoaderFileDetails,
|
|
163
|
+
body: { path: resourcePath },
|
|
164
|
+
children: (data) => /* @__PURE__ */ jsx(LoaderExecutions, { data, cwd, index: loaderIndex })
|
|
165
|
+
}
|
|
166
|
+
) : null
|
|
128
167
|
}
|
|
129
168
|
)
|
|
130
169
|
]
|
|
@@ -136,7 +175,10 @@ const LoaderFiles = (props) => {
|
|
|
136
175
|
title: /* @__PURE__ */ jsx(
|
|
137
176
|
Tooltip,
|
|
138
177
|
{
|
|
139
|
-
title: React.cloneElement(
|
|
178
|
+
title: React.cloneElement(
|
|
179
|
+
selectedNode.title,
|
|
180
|
+
{ style: { color: "#fff" } }
|
|
181
|
+
),
|
|
140
182
|
children: /* @__PURE__ */ jsxs(Typography.Text, { children: [
|
|
141
183
|
'Statistics of "',
|
|
142
184
|
selectedNode.title,
|
|
@@ -152,7 +194,13 @@ const LoaderFiles = (props) => {
|
|
|
152
194
|
children: (tableData) => /* @__PURE__ */ jsx(
|
|
153
195
|
Table,
|
|
154
196
|
{
|
|
155
|
-
style: {
|
|
197
|
+
style: {
|
|
198
|
+
width: "100%",
|
|
199
|
+
maxHeight,
|
|
200
|
+
height: "40rem",
|
|
201
|
+
overflowY: "scroll",
|
|
202
|
+
wordBreak: "break-all"
|
|
203
|
+
},
|
|
156
204
|
pagination: false,
|
|
157
205
|
bordered: true,
|
|
158
206
|
rowKey: (e) => e.loader,
|
|
@@ -175,11 +223,20 @@ const LoaderFiles = (props) => {
|
|
|
175
223
|
}
|
|
176
224
|
],
|
|
177
225
|
dataSource: tableData,
|
|
178
|
-
footer: () => /* @__PURE__ */ jsxs(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
226
|
+
footer: () => /* @__PURE__ */ jsxs(
|
|
227
|
+
Descriptions,
|
|
228
|
+
{
|
|
229
|
+
title: "Total",
|
|
230
|
+
bordered: true,
|
|
231
|
+
layout: "vertical",
|
|
232
|
+
size: "small",
|
|
233
|
+
children: [
|
|
234
|
+
/* @__PURE__ */ jsx(Descriptions.Item, { label: "loaders", children: tableData.length }),
|
|
235
|
+
/* @__PURE__ */ jsx(Descriptions.Item, { label: "files", children: sumBy(tableData, (e) => e.files) }),
|
|
236
|
+
/* @__PURE__ */ jsx(Descriptions.Item, { label: "duration", children: /* @__PURE__ */ jsx(Typography.Text, { strong: true, children: formatCosts(sumBy(tableData, (e) => e.costs)) }) })
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
)
|
|
183
240
|
}
|
|
184
241
|
)
|
|
185
242
|
}
|
|
@@ -7,8 +7,22 @@ import { LoaderCommonSelect } from "../../Select";
|
|
|
7
7
|
const LoaderAnalysisBase = ({ cwd }) => {
|
|
8
8
|
const [store, setStore] = useState({ filename: "", loaders: [] });
|
|
9
9
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
10
|
-
/* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetLoaderNames, children: (loaderNames) => /* @__PURE__ */ jsx(
|
|
11
|
-
|
|
10
|
+
/* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetLoaderNames, children: (loaderNames) => /* @__PURE__ */ jsx(
|
|
11
|
+
LoaderCommonSelect,
|
|
12
|
+
{
|
|
13
|
+
onChange: (e) => setStore(e),
|
|
14
|
+
loaderNames
|
|
15
|
+
}
|
|
16
|
+
) }),
|
|
17
|
+
/* @__PURE__ */ jsx(ServerAPIProvider, { api: SDK.ServerAPI.API.GetLoaderFileTree, children: (filetree) => /* @__PURE__ */ jsx(
|
|
18
|
+
LoaderFiles,
|
|
19
|
+
{
|
|
20
|
+
filename: store.filename,
|
|
21
|
+
filetree,
|
|
22
|
+
loaders: store.loaders,
|
|
23
|
+
cwd
|
|
24
|
+
}
|
|
25
|
+
) })
|
|
12
26
|
] });
|
|
13
27
|
};
|
|
14
28
|
const LoaderAnalysis = withServerAPI({
|
|
@@ -5,5 +5,5 @@ interface LoaderExecutionsProps {
|
|
|
5
5
|
data: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileDetails>;
|
|
6
6
|
index?: number;
|
|
7
7
|
}
|
|
8
|
-
export declare const LoaderExecutions: ({ data, cwd, index }: PropsWithChildren<LoaderExecutionsProps>) => JSX.Element;
|
|
8
|
+
export declare const LoaderExecutions: ({ data, cwd, index, }: PropsWithChildren<LoaderExecutionsProps>) => JSX.Element;
|
|
9
9
|
export {};
|