@rsdoctor/components 0.1.1 → 0.1.3
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/change.d.ts +2 -2
- package/dist/components/Alert/file-relation.d.ts +1 -1
- package/dist/components/Alert/index.d.ts +1 -1
- package/dist/components/Alert/link.d.ts +1 -1
- package/dist/components/Alert/package-relation.d.ts +9 -9
- package/dist/components/Alert/package-relation.js +188 -94
- package/dist/components/Alert/types.d.ts +15 -15
- package/dist/components/Alert/view.d.ts +1 -1
- package/dist/components/Alerts/bundle.d.ts +4 -4
- package/dist/components/Alerts/common.d.ts +8 -8
- package/dist/components/Alerts/common.js +46 -23
- package/dist/components/Alerts/compile.d.ts +4 -4
- package/dist/components/Alerts/index.d.ts +1 -1
- package/dist/components/Alerts/overlay.d.ts +12 -12
- package/dist/components/Badge/index.d.ts +13 -13
- package/dist/components/Card/diff.d.ts +11 -11
- package/dist/components/Card/index.d.ts +4 -4
- package/dist/components/Card/size.d.ts +16 -16
- package/dist/components/Card/statistic.d.ts +7 -7
- package/dist/components/Charts/TimelineCharts/index.d.ts +5 -5
- package/dist/components/Charts/TimelineCharts/index.js +31 -9
- package/dist/components/Charts/bootstrap.d.ts +1 -1
- package/dist/components/Charts/common.d.ts +4 -4
- package/dist/components/Charts/constants.d.ts +2 -0
- package/dist/components/Charts/constants.js +46 -0
- package/dist/components/Charts/done.d.ts +1 -1
- package/dist/components/Charts/index.d.ts +4 -4
- package/dist/components/Charts/loader.d.ts +1 -1
- package/dist/components/Charts/loader.js +55 -26
- package/dist/components/Charts/minify.d.ts +1 -1
- package/dist/components/Charts/types.d.ts +45 -45
- package/dist/components/Charts/utils.d.ts +5 -4
- package/dist/components/Charts/utils.js +32 -13
- package/dist/components/CodeViewer/config.d.ts +1 -1
- package/dist/components/CodeViewer/diff.d.ts +6 -6
- package/dist/components/CodeViewer/hightlight.d.ts +5 -5
- package/dist/components/CodeViewer/index.d.ts +1 -1
- package/dist/components/CodeViewer/viewer.d.ts +6 -6
- package/dist/components/Configuration/builder.d.ts +6 -6
- package/dist/components/Configuration/index.d.ts +1 -1
- package/dist/components/FileTree/index.d.ts +1 -1
- package/dist/components/Form/keyword.d.ts +10 -10
- package/dist/components/Keyword/index.d.ts +3 -3
- package/dist/components/Layout/builder-select.d.ts +1 -1
- package/dist/components/Layout/constants.d.ts +1 -1
- package/dist/components/Layout/header.d.ts +1 -1
- package/dist/components/Layout/index.d.ts +2 -2
- package/dist/components/Layout/menus.d.ts +4 -4
- package/dist/components/Layout/menus.js +42 -14
- package/dist/components/Layout/progress.d.ts +3 -3
- package/dist/components/Loader/Analysis/files.d.ts +5 -5
- package/dist/components/Loader/Analysis/index.d.ts +6 -6
- package/dist/components/Loader/executions.d.ts +5 -9
- package/dist/components/Manifest/api.d.ts +14 -21
- package/dist/components/Manifest/data.d.ts +1 -1
- package/dist/components/Manifest/index.d.ts +1 -1
- package/dist/components/Opener/code.d.ts +17 -25
- package/dist/components/Opener/index.d.ts +1 -1
- package/dist/components/Opener/vscode.d.ts +7 -12
- package/dist/components/Overall/NumberButton.d.ts +6 -12
- package/dist/components/Overall/bundle.d.ts +3 -3
- package/dist/components/Overall/compile.d.ts +2 -2
- package/dist/components/Overall/index.d.ts +1 -1
- package/dist/components/Overall/project.d.ts +5 -5
- package/dist/components/Plugins/webpack.d.ts +9 -9
- package/dist/components/Resolver/analysis.d.ts +7 -7
- package/dist/components/Select/index.d.ts +9 -9
- package/dist/components/Status/failed.d.ts +4 -4
- package/dist/components/Status/index.d.ts +1 -1
- package/dist/components/TextDrawer/duplicate.d.ts +7 -7
- package/dist/components/TextDrawer/index.d.ts +6 -6
- package/dist/components/Title/index.d.ts +11 -11
- package/dist/components/index.d.ts +1 -1
- package/dist/components/worker/ecmaversion/client.d.ts +4 -4
- package/dist/components/worker/ecmaversion/worker.d.ts +1 -1
- package/dist/components/worker/jsequal/client.d.ts +6 -6
- package/dist/components/worker/jsequal/worker.d.ts +1 -1
- package/dist/config.d.ts +13 -13
- package/dist/constants.d.ts +30 -30
- package/dist/index.d.ts +1 -1
- package/dist/pages/BundleSize/components/asset.d.ts +15 -15
- package/dist/pages/BundleSize/components/cards.d.ts +4 -4
- package/dist/pages/BundleSize/components/editor.d.ts +3 -3
- package/dist/pages/BundleSize/components/index.d.ts +7 -7
- package/dist/pages/BundleSize/config.d.ts +3 -3
- package/dist/pages/BundleSize/constants.d.ts +1 -1
- package/dist/pages/BundleSize/index.d.ts +1 -1
- package/dist/pages/ModuleAnalyze/chunks.d.ts +2 -2
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.d.ts +9 -9
- package/dist/pages/ModuleAnalyze/constants.d.ts +2 -2
- package/dist/pages/ModuleAnalyze/dependncy.d.ts +4 -4
- package/dist/pages/ModuleAnalyze/fileTree.d.ts +6 -6
- package/dist/pages/ModuleAnalyze/index.d.ts +4 -4
- package/dist/pages/ModuleAnalyze/utils/hooks.d.ts +16 -16
- package/dist/pages/ModuleAnalyze/utils/index.d.ts +1 -1
- package/dist/pages/ModuleResolve/constants.d.ts +1 -1
- package/dist/pages/ModuleResolve/index.d.ts +1 -1
- package/dist/pages/Overall/constants.d.ts +1 -1
- package/dist/pages/Overall/index.d.ts +4 -4
- package/dist/pages/Overall/index.js +19 -8
- package/dist/pages/Overall/responsiveGridList.d.ts +6 -0
- package/dist/pages/Overall/responsiveGridList.js +28 -0
- package/dist/pages/Resources/RuleIndex/constants.d.ts +1 -1
- package/dist/pages/Resources/RuleIndex/index.d.ts +1 -1
- package/dist/pages/WebpackLoaders/Analysis/constants.d.ts +1 -1
- package/dist/pages/WebpackLoaders/Analysis/index.d.ts +1 -1
- package/dist/pages/WebpackLoaders/Overall/constants.d.ts +1 -1
- package/dist/pages/WebpackLoaders/Overall/index.d.ts +1 -1
- package/dist/pages/WebpackLoaders/constants.d.ts +1 -1
- package/dist/pages/WebpackPlugins/constants.d.ts +1 -1
- package/dist/pages/WebpackPlugins/index.d.ts +1 -1
- package/dist/pages/index.d.ts +1 -1
- package/dist/utils/data/base.d.ts +21 -21
- package/dist/utils/data/index.d.ts +2 -2
- package/dist/utils/data/local.d.ts +11 -11
- package/dist/utils/data/remote.d.ts +7 -7
- package/dist/utils/file.d.ts +15 -21
- package/dist/utils/hooks.d.ts +4 -4
- package/dist/utils/i18n/cn.d.ts +1 -1
- package/dist/utils/i18n/en.d.ts +28 -28
- package/dist/utils/i18n/index.d.ts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/loader.d.ts +1 -1
- package/dist/utils/locale.d.ts +1 -1
- package/dist/utils/manifest.d.ts +17 -17
- package/dist/utils/monaco.d.ts +4 -4
- package/dist/utils/request.d.ts +13 -13
- package/dist/utils/routes.d.ts +1 -1
- package/dist/utils/size.d.ts +1 -1
- package/dist/utils/socket.d.ts +1 -1
- package/dist/utils/storage.d.ts +1 -1
- package/dist/utils/string.d.ts +1 -1
- package/dist/utils/time.d.ts +1 -1
- package/dist/utils/url.d.ts +1 -1
- package/dist/utils/worker/index.d.ts +1 -1
- package/dist/utils/worker/master.d.ts +3 -3
- package/dist/utils/worker/types.d.ts +3 -3
- package/dist/utils/worker/utils.d.ts +4 -6
- package/dist/utils/worker/worker.d.ts +11 -11
- package/package.json +4 -6
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare enum BadgeType {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
Default = "default",
|
|
4
|
+
Success = "success",
|
|
5
|
+
Warn = "warn",
|
|
6
|
+
Error = "error"
|
|
7
7
|
}
|
|
8
8
|
export declare const BadgeColorMap: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
default: string;
|
|
10
|
+
success: string;
|
|
11
|
+
warn: string;
|
|
12
|
+
error: string;
|
|
13
13
|
};
|
|
14
14
|
interface BadgeProps {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
label: string | number | React.ReactNode;
|
|
16
|
+
value: string | number | React.ReactNode;
|
|
17
|
+
type?: BadgeType | `${BadgeType}`;
|
|
18
|
+
tooltip?: true | string | React.ReactNode;
|
|
19
19
|
}
|
|
20
20
|
export declare const Badge: React.FC<BadgeProps>;
|
|
21
|
-
export {};
|
|
21
|
+
export {};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { Client } from '@rsdoctor/types';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export interface DiffCardProps extends Pick<DiffCardContentProps, 'formatter'> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
titles: Array<string> | [string | React.ReactNode];
|
|
5
|
+
datas: Array<DiffCardContentProps['data']>;
|
|
6
|
+
showPercentInTitle?: boolean;
|
|
7
7
|
}
|
|
8
8
|
export interface DiffCardContentProps {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
data: Client.RsdoctorClientAssetsDiffItem;
|
|
10
|
+
formatter?(v: number, target: 'baseline' | 'current'): number | string | React.ReactNode;
|
|
11
11
|
}
|
|
12
12
|
export interface PercentProps {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
percent: number;
|
|
14
|
+
state: Client.RsdoctorClientDiffState;
|
|
15
|
+
fontSize?: React.CSSProperties['fontSize'];
|
|
16
16
|
}
|
|
17
17
|
export declare const SizePercent: React.FC<{
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
baseline: number;
|
|
19
|
+
current: number;
|
|
20
20
|
} & Omit<PercentProps, 'percent' | 'state'>>;
|
|
21
21
|
export declare const Percent: React.FC<PercentProps>;
|
|
22
22
|
export declare const DiffCardContent: React.FC<DiffCardContentProps>;
|
|
23
|
-
export declare const DiffCard: React.FC<DiffCardProps>;
|
|
23
|
+
export declare const DiffCard: React.FC<DiffCardProps>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CardProps as CProps } from 'antd';
|
|
2
2
|
import React, { CSSProperties } from 'react';
|
|
3
3
|
export interface CardProps extends CProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
collapsable?: boolean;
|
|
5
|
+
dividerStyle?: CSSProperties;
|
|
6
|
+
defaultCollapsed?: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare const Card: React.FC<CardProps>;
|
|
8
|
+
export declare const Card: React.FC<CardProps>;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface SizeCardProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
files: {
|
|
4
|
+
path: string;
|
|
5
|
+
size: number;
|
|
6
|
+
}[];
|
|
7
|
+
/**
|
|
8
|
+
* total size for origin files
|
|
9
|
+
*/
|
|
10
|
+
total: number;
|
|
11
|
+
/**
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
showProgress?: boolean;
|
|
15
|
+
tagBgColor: string;
|
|
16
16
|
}
|
|
17
17
|
export interface bgColorType {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
bgColor: string;
|
|
19
|
+
tagBgColor: string;
|
|
20
20
|
}
|
|
21
|
-
export declare const SizeCard: React.FC<SizeCardProps>;
|
|
21
|
+
export declare const SizeCard: React.FC<SizeCardProps>;
|
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { StatisticProps } from 'antd';
|
|
3
3
|
import './statistic.sass';
|
|
4
4
|
export interface StatisticCardProps {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
title: string | React.ReactNode;
|
|
6
|
+
value: string | React.ReactNode;
|
|
7
|
+
statisticProps?: StatisticProps;
|
|
8
|
+
boxProps?: {
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
};
|
|
11
11
|
}
|
|
12
|
-
export declare const StatisticCard: React.FC<StatisticCardProps>;
|
|
12
|
+
export declare const StatisticCard: React.FC<StatisticCardProps>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DurationMetric, ITraceEventData } from '../types';
|
|
3
3
|
export declare const TimelineCom: React.FC<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}>;
|
|
4
|
+
loaderData?: DurationMetric[];
|
|
5
|
+
pluginsData?: ITraceEventData[];
|
|
6
|
+
formatterFn: Function;
|
|
7
|
+
chartType?: string;
|
|
8
|
+
}>;
|
|
@@ -4,7 +4,7 @@ import ReactECharts from "echarts-for-react";
|
|
|
4
4
|
import * as echarts from "echarts/core";
|
|
5
5
|
import dayjs from "dayjs";
|
|
6
6
|
import { groupBy } from "lodash-es";
|
|
7
|
-
import
|
|
7
|
+
import { LITTLE_PALETTE_COLORS, PALETTE_COLORS } from "../constants";
|
|
8
8
|
const LINE_HEIGHT = 60;
|
|
9
9
|
const TimelineCom = memo(({ loaderData, pluginsData, formatterFn, chartType = "normal" }) => {
|
|
10
10
|
const data = [];
|
|
@@ -21,10 +21,15 @@ const TimelineCom = memo(({ loaderData, pluginsData, formatterFn, chartType = "n
|
|
|
21
21
|
loaderData.forEach(function(_loaderData, _i) {
|
|
22
22
|
data.push({
|
|
23
23
|
name: _loaderData.n + " total",
|
|
24
|
-
value: [
|
|
24
|
+
value: [
|
|
25
|
+
_categories.indexOf(_loaderData.n + " total"),
|
|
26
|
+
_loaderData.s,
|
|
27
|
+
_loaderData.e,
|
|
28
|
+
_loaderData.e - _loaderData.s
|
|
29
|
+
],
|
|
25
30
|
itemStyle: {
|
|
26
31
|
normal: {
|
|
27
|
-
color:
|
|
32
|
+
color: LITTLE_PALETTE_COLORS[_i % 8]
|
|
28
33
|
}
|
|
29
34
|
}
|
|
30
35
|
});
|
|
@@ -33,10 +38,15 @@ const TimelineCom = memo(({ loaderData, pluginsData, formatterFn, chartType = "n
|
|
|
33
38
|
for (let l = 0; l < _loaderData?.c?.length; l++) {
|
|
34
39
|
data.push({
|
|
35
40
|
name: _loaderData.n,
|
|
36
|
-
value: [
|
|
41
|
+
value: [
|
|
42
|
+
_categories.indexOf(_loaderData.n),
|
|
43
|
+
_loaderData.c[l].s,
|
|
44
|
+
_loaderData.c[l].e,
|
|
45
|
+
_loaderData.c[l].e - _loaderData.c[l].s
|
|
46
|
+
],
|
|
37
47
|
itemStyle: {
|
|
38
48
|
normal: {
|
|
39
|
-
color:
|
|
49
|
+
color: PALETTE_COLORS[(l + _i) % 30]
|
|
40
50
|
}
|
|
41
51
|
},
|
|
42
52
|
ext: _loaderData.c[l].ext
|
|
@@ -56,13 +66,18 @@ const TimelineCom = memo(({ loaderData, pluginsData, formatterFn, chartType = "n
|
|
|
56
66
|
return;
|
|
57
67
|
const _pluginsData = groupBy(pluginsData, (e) => e.pid);
|
|
58
68
|
Object.keys(_pluginsData).reverse().forEach(function(key, i) {
|
|
59
|
-
_pluginsData[key].forEach((_plugin) => {
|
|
69
|
+
_pluginsData[key].forEach((_plugin, _i) => {
|
|
60
70
|
data.push({
|
|
61
71
|
name: String(_plugin.pid),
|
|
62
|
-
value: [
|
|
72
|
+
value: [
|
|
73
|
+
i,
|
|
74
|
+
_plugin.args.s,
|
|
75
|
+
_plugin.args.e,
|
|
76
|
+
_plugin.args.e - _plugin.args.s
|
|
77
|
+
],
|
|
63
78
|
itemStyle: {
|
|
64
79
|
normal: {
|
|
65
|
-
color:
|
|
80
|
+
color: PALETTE_COLORS[(_i + i) % 30]
|
|
66
81
|
}
|
|
67
82
|
},
|
|
68
83
|
ext: _plugin
|
|
@@ -183,7 +198,14 @@ const TimelineCom = memo(({ loaderData, pluginsData, formatterFn, chartType = "n
|
|
|
183
198
|
};
|
|
184
199
|
setOptinsData(option);
|
|
185
200
|
}, [loaderData, pluginsData]);
|
|
186
|
-
return /* @__PURE__ */ jsx(
|
|
201
|
+
return /* @__PURE__ */ jsx(
|
|
202
|
+
ReactECharts,
|
|
203
|
+
{
|
|
204
|
+
option: optionsData,
|
|
205
|
+
echarts,
|
|
206
|
+
style: { width: "100%", minHeight: "400px" }
|
|
207
|
+
}
|
|
208
|
+
);
|
|
187
209
|
});
|
|
188
210
|
export {
|
|
189
211
|
TimelineCom
|
|
@@ -2,4 +2,4 @@ import React from 'react';
|
|
|
2
2
|
import './loader.scss';
|
|
3
3
|
import './tooltips.scss';
|
|
4
4
|
import { CommonChartProps } from './common';
|
|
5
|
-
export declare const BootstrapChartContainer: React.FC<CommonChartProps>;
|
|
5
|
+
export declare const BootstrapChartContainer: React.FC<CommonChartProps>;
|
|
@@ -4,10 +4,10 @@ import './loader.scss';
|
|
|
4
4
|
import './tooltips.scss';
|
|
5
5
|
import { Metric } from './types';
|
|
6
6
|
export interface CommonChartProps {
|
|
7
|
-
|
|
7
|
+
summary: SDK.SummaryData;
|
|
8
8
|
}
|
|
9
9
|
export declare const CommonExecutionsChart: React.FC<{
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
plugins: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPluginData>;
|
|
11
|
+
defaultDatas?: Metric[];
|
|
12
12
|
}>;
|
|
13
|
-
export declare const CommonExecutionEmptyTips: React.FC;
|
|
13
|
+
export declare const CommonExecutionEmptyTips: React.FC;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const LITTLE_PALETTE_COLORS = [
|
|
2
|
+
"#a8071a",
|
|
3
|
+
"#ad6800",
|
|
4
|
+
"#237804",
|
|
5
|
+
"#006d75",
|
|
6
|
+
"#ad8b00",
|
|
7
|
+
"#ad4e00",
|
|
8
|
+
"#5b8c00",
|
|
9
|
+
"#003eb3"
|
|
10
|
+
];
|
|
11
|
+
const PALETTE_COLORS = [
|
|
12
|
+
"#4096ff",
|
|
13
|
+
"#69b1ff",
|
|
14
|
+
"#9e1068",
|
|
15
|
+
"#722ed1",
|
|
16
|
+
"#bae0ff",
|
|
17
|
+
"#d3adf7",
|
|
18
|
+
"#597ef7",
|
|
19
|
+
"#ffadd2",
|
|
20
|
+
"#c41d7f",
|
|
21
|
+
"#391085",
|
|
22
|
+
"#ffa940",
|
|
23
|
+
"#5c060b",
|
|
24
|
+
"#a81414",
|
|
25
|
+
"#ff7875",
|
|
26
|
+
"#ffd591",
|
|
27
|
+
"#ffe58f",
|
|
28
|
+
"#d3f261",
|
|
29
|
+
"#d4b106",
|
|
30
|
+
"#7cb305",
|
|
31
|
+
"#f4ffb8",
|
|
32
|
+
"#fa8c16",
|
|
33
|
+
"#0958d9",
|
|
34
|
+
"#fff3f0",
|
|
35
|
+
"#82090d",
|
|
36
|
+
"#ffbfb3",
|
|
37
|
+
"#f44336",
|
|
38
|
+
"#ff998a",
|
|
39
|
+
"#ff7161",
|
|
40
|
+
"#ffe2db",
|
|
41
|
+
"#cf2923"
|
|
42
|
+
];
|
|
43
|
+
export {
|
|
44
|
+
LITTLE_PALETTE_COLORS,
|
|
45
|
+
PALETTE_COLORS
|
|
46
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SDK } from '@rsdoctor/types';
|
|
3
3
|
export declare const LoaderChartBase: React.FC<{
|
|
4
|
-
|
|
4
|
+
project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
|
|
5
5
|
}>;
|
|
6
6
|
export declare const LoaderChart: React.FC<Omit<{
|
|
7
|
-
|
|
7
|
+
project: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>;
|
|
8
8
|
}, "project"> & Partial<{
|
|
9
|
-
|
|
10
|
-
}>>;
|
|
9
|
+
body?: any;
|
|
10
|
+
}>>;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
useCallback,
|
|
4
|
+
useMemo,
|
|
5
|
+
useRef,
|
|
6
|
+
useEffect,
|
|
7
|
+
useState
|
|
8
|
+
} from "react";
|
|
3
9
|
import { groupBy } from "lodash-es";
|
|
4
10
|
import { Empty } from "antd";
|
|
5
11
|
import "./loader.css";
|
|
@@ -7,12 +13,23 @@ import { useTheme } from "../../utils/manifest";
|
|
|
7
13
|
import { findLoaderTotalTiming } from "../../utils/loader";
|
|
8
14
|
import { beautifyPath } from "../../utils/file";
|
|
9
15
|
import { TimelineCom } from "./TimelineCharts";
|
|
10
|
-
import {
|
|
11
|
-
|
|
16
|
+
import {
|
|
17
|
+
renderTotalLoadersTooltip,
|
|
18
|
+
getTooltipHtmlForLoader,
|
|
19
|
+
useDebounceHook
|
|
20
|
+
} from "./utils";
|
|
21
|
+
const LoaderExecutionsChart = ({
|
|
22
|
+
loaders,
|
|
23
|
+
cwd
|
|
24
|
+
}) => {
|
|
12
25
|
const { isDark } = useTheme();
|
|
13
26
|
const ref = useRef(null);
|
|
14
27
|
const [data, setData] = useState([]);
|
|
15
|
-
const
|
|
28
|
+
const durationMetricData = useDebounceHook(data, 200);
|
|
29
|
+
const groupByLoader = useMemo(
|
|
30
|
+
() => groupBy(loaders, (e) => e.loader),
|
|
31
|
+
[loaders]
|
|
32
|
+
);
|
|
16
33
|
const formatterForLoader = useCallback((raw) => {
|
|
17
34
|
const { name, data: data2 } = raw;
|
|
18
35
|
const loaderName = name.replace(" total", "");
|
|
@@ -22,35 +39,47 @@ const LoaderExecutionsChart = ({ loaders, cwd }) => {
|
|
|
22
39
|
return renderTotalLoadersTooltip(loaderName, loaders, cwd);
|
|
23
40
|
}, []);
|
|
24
41
|
useEffect(() => {
|
|
25
|
-
const _data = Object.keys(groupByLoader).map(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
const _data = Object.keys(groupByLoader).map(
|
|
43
|
+
(loaderName) => {
|
|
44
|
+
const list = groupByLoader[loaderName] || [];
|
|
45
|
+
const { start, end } = findLoaderTotalTiming(list);
|
|
46
|
+
return {
|
|
47
|
+
p: loaderName,
|
|
48
|
+
n: loaderName,
|
|
49
|
+
s: start,
|
|
50
|
+
e: end,
|
|
51
|
+
c: list.map((e) => {
|
|
52
|
+
return {
|
|
53
|
+
p: loaderName,
|
|
54
|
+
// n: loaderName,
|
|
55
|
+
n: beautifyPath(e.resource, cwd),
|
|
56
|
+
s: e.startAt,
|
|
57
|
+
e: e.endAt,
|
|
58
|
+
ext: e
|
|
59
|
+
};
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
);
|
|
45
64
|
setData(_data);
|
|
46
65
|
}, [groupByLoader]);
|
|
47
66
|
return /* @__PURE__ */ jsx(Fragment, { children: data?.length ? /* @__PURE__ */ jsx(
|
|
48
67
|
"div",
|
|
49
68
|
{
|
|
50
|
-
className: [
|
|
69
|
+
className: [
|
|
70
|
+
"loader-chart-container",
|
|
71
|
+
isDark ? "loader-chart-container_dark" : ""
|
|
72
|
+
].join(" ").trim(),
|
|
51
73
|
ref,
|
|
52
74
|
style: { width: "100%", height: "600px" },
|
|
53
|
-
children: /* @__PURE__ */ jsx(
|
|
75
|
+
children: /* @__PURE__ */ jsx(
|
|
76
|
+
TimelineCom,
|
|
77
|
+
{
|
|
78
|
+
loaderData: durationMetricData,
|
|
79
|
+
formatterFn: formatterForLoader,
|
|
80
|
+
chartType: "loader"
|
|
81
|
+
}
|
|
82
|
+
)
|
|
54
83
|
}
|
|
55
84
|
) : /* @__PURE__ */ jsx(Empty, {}) });
|
|
56
85
|
};
|
|
@@ -1,61 +1,61 @@
|
|
|
1
1
|
import { SDK } from "@rsdoctor/types";
|
|
2
2
|
export interface ChartProps {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
loaders: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderChartData>;
|
|
4
|
+
cwd: string;
|
|
5
5
|
}
|
|
6
6
|
export interface CommonMetricPart<T extends string = string> {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
_n?: boolean;
|
|
8
|
+
_c?: string;
|
|
9
|
+
p: string;
|
|
10
|
+
n: T;
|
|
11
|
+
ext?: unknown;
|
|
12
12
|
}
|
|
13
13
|
export declare type Metric = DurationMetric;
|
|
14
14
|
export interface DurationMetric extends CommonMetricPart {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
_r?: [start: string, end: string];
|
|
16
|
+
s: number;
|
|
17
|
+
e: number;
|
|
18
|
+
c?: DurationMetric[];
|
|
19
19
|
}
|
|
20
20
|
export declare enum ETraceEventPhase {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
BEGIN = "B",
|
|
22
|
+
END = "E",
|
|
23
|
+
COMPLETE = "X",
|
|
24
|
+
INSTANT = "I",
|
|
25
|
+
MARK = "R"
|
|
26
26
|
}
|
|
27
27
|
type MicroSeconds = number;
|
|
28
28
|
type ProcessID = number | string;
|
|
29
29
|
type ArgsType = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
p: string;
|
|
31
|
+
n: string;
|
|
32
|
+
s: number;
|
|
33
|
+
e: number;
|
|
34
34
|
};
|
|
35
35
|
export interface ITraceEventData {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
36
|
+
/**
|
|
37
|
+
*Any arguments provided for the event. Some of the event types have required argument fields, otherwise, you can put any information you wish in here. The arguments are displayed in Trace Viewer when you view an event in the analysis section.
|
|
38
|
+
*/
|
|
39
|
+
args: ArgsType;
|
|
40
|
+
/**
|
|
41
|
+
* The name of the event, as displayed in Chart.
|
|
42
|
+
*/
|
|
43
|
+
name: string;
|
|
44
|
+
/**
|
|
45
|
+
* The event type. This is a single character which changes depending on the type of event being output.
|
|
46
|
+
*/
|
|
47
|
+
ph: ETraceEventPhase;
|
|
48
|
+
/**
|
|
49
|
+
* The process ID for the process that output this event.
|
|
50
|
+
*/
|
|
51
|
+
pid: ProcessID;
|
|
52
|
+
/**
|
|
53
|
+
* The tracing clock timestamp of the event. The timestamps are provided at microsecond granularity.
|
|
54
|
+
*/
|
|
55
|
+
ts: MicroSeconds;
|
|
56
|
+
/**
|
|
57
|
+
* specify the tracing clock duration of complete events in microseconds.
|
|
58
|
+
*/
|
|
59
|
+
dur?: MicroSeconds;
|
|
60
60
|
}
|
|
61
|
-
export {};
|
|
61
|
+
export {};
|
|
@@ -6,7 +6,8 @@ export declare function renderTotalLoadersTooltip(loaderName: string, loaders: S
|
|
|
6
6
|
export declare function transformDurationMetric(rawData: DurationMetric[]): ITraceEventData[];
|
|
7
7
|
export declare function processTrans(rawData: DurationMetric[]): ITraceEventData[];
|
|
8
8
|
export declare function formatterForPlugins(raw: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}): string;
|
|
9
|
+
data: {
|
|
10
|
+
ext: ITraceEventData;
|
|
11
|
+
};
|
|
12
|
+
}): string;
|
|
13
|
+
export declare function useDebounceHook(value: DurationMetric[], delay: number): DurationMetric[] | undefined;
|