@rsdoctor/components 0.4.3 → 0.4.4
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/common.js +16 -5
- package/dist/pages/Resources/BundleDiff/DiffContainer/assets.d.ts +7 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/assets.js +505 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/cards.d.ts +3 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/cards.js +156 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/changes.d.ts +15 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/changes.js +69 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/constants.d.ts +11 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/constants.js +17 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/index.d.ts +3 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/index.js +180 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/modules.d.ts +8 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/modules.js +303 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/overview.d.ts +5 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/overview.js +178 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/packages.d.ts +19 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/packages.js +331 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/row.d.ts +9 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/row.js +377 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/types.d.ts +44 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/types.js +0 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/utils.d.ts +2 -0
- package/dist/pages/Resources/BundleDiff/DiffContainer/utils.js +24 -0
- package/dist/pages/Resources/BundleDiff/DiffServerAPIProvider/index.d.ts +3 -0
- package/dist/pages/Resources/BundleDiff/DiffServerAPIProvider/index.js +36 -0
- package/dist/pages/Resources/BundleDiff/constants.d.ts +11 -0
- package/dist/pages/Resources/BundleDiff/constants.js +19 -0
- package/dist/pages/Resources/BundleDiff/index.d.ts +3 -0
- package/dist/pages/Resources/BundleDiff/index.js +9 -0
- package/dist/pages/index.d.ts +1 -0
- package/dist/pages/index.js +2 -0
- package/package.json +5 -5
|
@@ -3,7 +3,7 @@ import { Collapse, Space, Radio, Typography, Tooltip } from "antd";
|
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { AppstoreOutlined, UnorderedListOutlined } from "@ant-design/icons";
|
|
5
5
|
import { Rule } from "@rsdoctor/types";
|
|
6
|
-
import { groupBy, values } from "lodash-es";
|
|
6
|
+
import { groupBy, sumBy, values } from "lodash-es";
|
|
7
7
|
import { Size, ViewMode } from "../../constants";
|
|
8
8
|
import { Alert } from "../Alert";
|
|
9
9
|
import { Card } from "../Card";
|
|
@@ -37,10 +37,21 @@ const CommonAlertsGroup = ({
|
|
|
37
37
|
dataSource,
|
|
38
38
|
extraData
|
|
39
39
|
}) => {
|
|
40
|
-
const _dataSource = useMemo(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
const _dataSource = useMemo(() => {
|
|
41
|
+
const sortedDataSource = dataSource.toSorted((a, b) => {
|
|
42
|
+
let sizeA = 0;
|
|
43
|
+
let sizeB = 0;
|
|
44
|
+
if (a.type === "package-relation") {
|
|
45
|
+
sizeA = sumBy(a.packages, (e) => e.targetSize.sourceSize);
|
|
46
|
+
}
|
|
47
|
+
if (b.type === "package-relation") {
|
|
48
|
+
sizeB = sumBy(b.packages, (e) => e.targetSize.sourceSize);
|
|
49
|
+
}
|
|
50
|
+
return sizeB - sizeA;
|
|
51
|
+
});
|
|
52
|
+
const groups = groupBy(sortedDataSource, (e) => e.code);
|
|
53
|
+
return values(groups);
|
|
54
|
+
}, [dataSource]);
|
|
44
55
|
return /* @__PURE__ */ jsx(
|
|
45
56
|
Space,
|
|
46
57
|
{
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SDK } from '@rsdoctor/types';
|
|
3
|
+
export declare const Assets: React.FC<{
|
|
4
|
+
outputFilename: string;
|
|
5
|
+
baseline: SDK.ServerAPI.ResponseTypes[SDK.ServerAPI.API.GetBundleDiffSummary];
|
|
6
|
+
current: SDK.ServerAPI.ResponseTypes[SDK.ServerAPI.API.GetBundleDiffSummary];
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
Col,
|
|
6
|
+
Divider,
|
|
7
|
+
Row,
|
|
8
|
+
Select,
|
|
9
|
+
Space,
|
|
10
|
+
Table,
|
|
11
|
+
Tag,
|
|
12
|
+
Tooltip,
|
|
13
|
+
Typography
|
|
14
|
+
} from "antd";
|
|
15
|
+
import { flatten, includes, keys, sumBy, values } from "lodash-es";
|
|
16
|
+
import {
|
|
17
|
+
CheckSquareOutlined,
|
|
18
|
+
InfoCircleOutlined,
|
|
19
|
+
MinusSquareOutlined,
|
|
20
|
+
PlusSquareOutlined,
|
|
21
|
+
SortAscendingOutlined,
|
|
22
|
+
FileSearchOutlined,
|
|
23
|
+
AppstoreAddOutlined
|
|
24
|
+
} from "@ant-design/icons";
|
|
25
|
+
import { Constants, Client } from "@rsdoctor/types";
|
|
26
|
+
import { formatPercent, formatSize } from "../../../../utils";
|
|
27
|
+
import { Color, Size } from "../../../../constants";
|
|
28
|
+
import { Percent, SizePercent } from "../../../../components/Card/diff";
|
|
29
|
+
import { KeywordInput } from "../../../../components/Form/keyword";
|
|
30
|
+
import { ModuleRowForAsset } from "./row";
|
|
31
|
+
import { ViewChanges } from "./changes";
|
|
32
|
+
import { UpdateType, SortType } from "./constants";
|
|
33
|
+
import { formatDiffSize } from "./utils";
|
|
34
|
+
import { Graph } from "@rsdoctor/utils/common";
|
|
35
|
+
const fileTypes = {
|
|
36
|
+
JS: [Constants.JSExtension],
|
|
37
|
+
CSS: [Constants.CSSExtension],
|
|
38
|
+
HTML: [Constants.HtmlExtension],
|
|
39
|
+
Imgs: Constants.ImgExtensions,
|
|
40
|
+
Fonts: Constants.FontExtensions,
|
|
41
|
+
Media: Constants.MediaExtensions,
|
|
42
|
+
Others: []
|
|
43
|
+
};
|
|
44
|
+
const definedExtensions = flatten(values(fileTypes));
|
|
45
|
+
const Name = ({ data: r }) => {
|
|
46
|
+
const name = /* @__PURE__ */ jsxs(Space, { children: [
|
|
47
|
+
/* @__PURE__ */ jsx(Typography.Text, { strong: true, children: r.alias }),
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
Tooltip,
|
|
50
|
+
{
|
|
51
|
+
title: /* @__PURE__ */ jsxs(Space, { style: { color: "inherit" }, direction: "vertical", children: [
|
|
52
|
+
r.current ? /* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
|
|
53
|
+
"Current realpath: ",
|
|
54
|
+
r.current.path
|
|
55
|
+
] }) : null,
|
|
56
|
+
r.baseline ? /* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
|
|
57
|
+
"Baseline realpath: ",
|
|
58
|
+
r.baseline.path
|
|
59
|
+
] }) : null
|
|
60
|
+
] }),
|
|
61
|
+
children: /* @__PURE__ */ jsx(InfoCircleOutlined, {})
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
] });
|
|
65
|
+
if (r.baseline && !r.current) {
|
|
66
|
+
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
67
|
+
/* @__PURE__ */ jsx(MinusSquareOutlined, { style: { color: Color.Red } }),
|
|
68
|
+
name
|
|
69
|
+
] });
|
|
70
|
+
}
|
|
71
|
+
if (!r.baseline && r.current) {
|
|
72
|
+
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
73
|
+
/* @__PURE__ */ jsx(PlusSquareOutlined, { style: { color: Color.Green } }),
|
|
74
|
+
name
|
|
75
|
+
] });
|
|
76
|
+
}
|
|
77
|
+
if (r.baseline && r.current) {
|
|
78
|
+
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
79
|
+
/* @__PURE__ */ jsx(CheckSquareOutlined, { style: { color: Color.Yellow } }),
|
|
80
|
+
name
|
|
81
|
+
] });
|
|
82
|
+
}
|
|
83
|
+
return name;
|
|
84
|
+
};
|
|
85
|
+
const Assets = ({ baseline, current, outputFilename }) => {
|
|
86
|
+
const bOutPutFileName = outputFilename;
|
|
87
|
+
const [keyword, setKeyword] = useState();
|
|
88
|
+
const [selectedFileTypes, setSelectedFileTypes] = useState([]);
|
|
89
|
+
const [selectedUpdateTypes, setSelectedUpdateTypes] = useState(
|
|
90
|
+
[]
|
|
91
|
+
);
|
|
92
|
+
const [selectedSortType, setSelectedSortType] = useState(
|
|
93
|
+
SortType.Size
|
|
94
|
+
);
|
|
95
|
+
const [selectedBAsset, setSelectedBAsset] = useState(null);
|
|
96
|
+
const [selectedCAsset, setSelectedCAsset] = useState(null);
|
|
97
|
+
const { assets: bAssets } = baseline.chunkGraph;
|
|
98
|
+
const { assets: cAssets } = current.chunkGraph;
|
|
99
|
+
const dataSource = useMemo(() => {
|
|
100
|
+
const res = {};
|
|
101
|
+
if (selectedBAsset && selectedCAsset) {
|
|
102
|
+
res.choose = {
|
|
103
|
+
alias: `${selectedBAsset}
|
|
104
|
+
${selectedCAsset}`,
|
|
105
|
+
current: cAssets.find((c) => c.path === selectedCAsset),
|
|
106
|
+
baseline: bAssets.find((b) => b.path === selectedBAsset)
|
|
107
|
+
};
|
|
108
|
+
return values(res);
|
|
109
|
+
}
|
|
110
|
+
bAssets.forEach((asset) => {
|
|
111
|
+
const alias = Graph.formatAssetName(asset.path, bOutPutFileName);
|
|
112
|
+
if (!res[alias]) {
|
|
113
|
+
res[alias] = {
|
|
114
|
+
alias,
|
|
115
|
+
baseline: asset
|
|
116
|
+
};
|
|
117
|
+
} else {
|
|
118
|
+
console.warn("[Baseline Asset Exists]: ", asset, res);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
cAssets.forEach((asset) => {
|
|
122
|
+
const alias = Graph.formatAssetName(asset.path, bOutPutFileName);
|
|
123
|
+
if (!res[alias]) {
|
|
124
|
+
res[alias] = { alias };
|
|
125
|
+
}
|
|
126
|
+
res[alias].current = asset;
|
|
127
|
+
});
|
|
128
|
+
return values(res);
|
|
129
|
+
}, [bAssets, cAssets, selectedBAsset, selectedCAsset]);
|
|
130
|
+
const filteredDataSource = useMemo(() => {
|
|
131
|
+
let list = dataSource.slice();
|
|
132
|
+
if (keyword) {
|
|
133
|
+
list = list.filter((e) => e.alias.indexOf(keyword) > -1);
|
|
134
|
+
}
|
|
135
|
+
if (selectedFileTypes.length) {
|
|
136
|
+
const exts = flatten(
|
|
137
|
+
selectedFileTypes.map((e) => fileTypes[e])
|
|
138
|
+
);
|
|
139
|
+
const hasOthers = selectedFileTypes.indexOf("Others") > -1;
|
|
140
|
+
list = list.filter((e) => {
|
|
141
|
+
const asset = e.baseline || e.current;
|
|
142
|
+
if (Graph.isAssetMatchExtensions(asset, exts)) {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
if (hasOthers) {
|
|
146
|
+
return !Graph.isAssetMatchExtensions(asset, definedExtensions);
|
|
147
|
+
}
|
|
148
|
+
return false;
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
if (selectedUpdateTypes.length) {
|
|
152
|
+
list = list.filter((e) => {
|
|
153
|
+
if (e.baseline && !e.current) {
|
|
154
|
+
return includes(selectedUpdateTypes, UpdateType.Deleted);
|
|
155
|
+
}
|
|
156
|
+
if (!e.baseline && e.current) {
|
|
157
|
+
return includes(selectedUpdateTypes, UpdateType.New);
|
|
158
|
+
}
|
|
159
|
+
if (e.baseline && e.current) {
|
|
160
|
+
if (e.baseline.size === e.current.size) {
|
|
161
|
+
return includes(selectedUpdateTypes, UpdateType.NotChanged);
|
|
162
|
+
}
|
|
163
|
+
return includes(selectedUpdateTypes, UpdateType.Changed);
|
|
164
|
+
}
|
|
165
|
+
return false;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
if (selectedSortType) {
|
|
169
|
+
if (selectedSortType === SortType.Name) {
|
|
170
|
+
list.sort((a, b) => {
|
|
171
|
+
return a.alias.localeCompare(b.alias);
|
|
172
|
+
});
|
|
173
|
+
} else {
|
|
174
|
+
const { prev, others } = list.reduce(
|
|
175
|
+
(t, c) => {
|
|
176
|
+
if (c.current) {
|
|
177
|
+
if (c.baseline) {
|
|
178
|
+
t.prev.unshift(c);
|
|
179
|
+
} else {
|
|
180
|
+
t.prev.push(c);
|
|
181
|
+
}
|
|
182
|
+
} else {
|
|
183
|
+
t.others.push(c);
|
|
184
|
+
}
|
|
185
|
+
return t;
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
prev: [],
|
|
189
|
+
others: []
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
list = [
|
|
193
|
+
...prev.sort((a, b) => {
|
|
194
|
+
if (b.current && a.current) {
|
|
195
|
+
if (selectedSortType === SortType.Delta) {
|
|
196
|
+
const { percent: percentA } = Graph.diffAssetsByExtensions(
|
|
197
|
+
baseline.chunkGraph,
|
|
198
|
+
current.chunkGraph,
|
|
199
|
+
(asset) => Graph.formatAssetName(asset.path, bOutPutFileName) === a.alias
|
|
200
|
+
);
|
|
201
|
+
const { percent: percentB } = Graph.diffAssetsByExtensions(
|
|
202
|
+
baseline.chunkGraph,
|
|
203
|
+
current.chunkGraph,
|
|
204
|
+
(asset) => Graph.formatAssetName(asset.path, bOutPutFileName) === b.alias
|
|
205
|
+
);
|
|
206
|
+
return percentB - percentA;
|
|
207
|
+
}
|
|
208
|
+
return b.current.size - a.current.size;
|
|
209
|
+
}
|
|
210
|
+
return -1;
|
|
211
|
+
}),
|
|
212
|
+
...others
|
|
213
|
+
];
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return list;
|
|
217
|
+
}, [
|
|
218
|
+
dataSource,
|
|
219
|
+
keyword,
|
|
220
|
+
selectedFileTypes,
|
|
221
|
+
selectedUpdateTypes,
|
|
222
|
+
selectedSortType
|
|
223
|
+
]);
|
|
224
|
+
const cSize = useMemo(
|
|
225
|
+
() => sumBy(filteredDataSource, (e) => e.current ? e.current.size : 0) || 0,
|
|
226
|
+
[filteredDataSource]
|
|
227
|
+
);
|
|
228
|
+
const bSize = useMemo(
|
|
229
|
+
() => sumBy(filteredDataSource, (e) => e.baseline ? e.baseline.size : 0) || 0,
|
|
230
|
+
[filteredDataSource]
|
|
231
|
+
);
|
|
232
|
+
return /* @__PURE__ */ jsxs(Row, { gutter: [Size.BasePadding, Size.BasePadding], children: [
|
|
233
|
+
/* @__PURE__ */ jsxs(Col, { span: 24, children: [
|
|
234
|
+
/* @__PURE__ */ jsxs(Space, { wrap: true, children: [
|
|
235
|
+
/* @__PURE__ */ jsx(
|
|
236
|
+
KeywordInput,
|
|
237
|
+
{
|
|
238
|
+
icon: /* @__PURE__ */ jsx(FileSearchOutlined, {}),
|
|
239
|
+
label: "",
|
|
240
|
+
labelStyle: { width: 45 },
|
|
241
|
+
placeholder: "Search by file name",
|
|
242
|
+
onChange: (e) => {
|
|
243
|
+
setKeyword(e);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
),
|
|
247
|
+
/* @__PURE__ */ jsx(
|
|
248
|
+
Select,
|
|
249
|
+
{
|
|
250
|
+
mode: "multiple",
|
|
251
|
+
placeholder: "Filter by file type",
|
|
252
|
+
style: { width: 250 },
|
|
253
|
+
options: keys(fileTypes).map((e) => ({ label: e, value: e })),
|
|
254
|
+
allowClear: true,
|
|
255
|
+
onChange: (e) => {
|
|
256
|
+
setSelectedFileTypes(e);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
),
|
|
260
|
+
/* @__PURE__ */ jsx(
|
|
261
|
+
Select,
|
|
262
|
+
{
|
|
263
|
+
mode: "multiple",
|
|
264
|
+
placeholder: "Filter by file changed type",
|
|
265
|
+
style: { width: 200 },
|
|
266
|
+
options: values(UpdateType).map((e) => ({ label: e, value: e })),
|
|
267
|
+
allowClear: true,
|
|
268
|
+
onChange: (e) => {
|
|
269
|
+
setSelectedUpdateTypes(e);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
),
|
|
273
|
+
/* @__PURE__ */ jsx(
|
|
274
|
+
Select,
|
|
275
|
+
{
|
|
276
|
+
suffixIcon: /* @__PURE__ */ jsx(SortAscendingOutlined, {}),
|
|
277
|
+
options: values(SortType).map((e) => ({ label: e, value: e })),
|
|
278
|
+
value: selectedSortType,
|
|
279
|
+
onChange: (e) => {
|
|
280
|
+
setSelectedSortType(e);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
)
|
|
284
|
+
] }),
|
|
285
|
+
/* @__PURE__ */ jsxs(Row, { style: { marginTop: 10 }, gutter: [6, 6], children: [
|
|
286
|
+
/* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsx(Button, { children: "Select Baseline Asset and Current Asset to Diff " }) }),
|
|
287
|
+
/* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsx(
|
|
288
|
+
Select,
|
|
289
|
+
{
|
|
290
|
+
allowClear: true,
|
|
291
|
+
placeholder: "select baseline assets",
|
|
292
|
+
showSearch: true,
|
|
293
|
+
style: { width: 300 },
|
|
294
|
+
options: values(baseline.chunkGraph.assets).map((e) => ({
|
|
295
|
+
label: e.path,
|
|
296
|
+
value: e.path
|
|
297
|
+
})),
|
|
298
|
+
onChange: (e) => setSelectedBAsset(e)
|
|
299
|
+
}
|
|
300
|
+
) }),
|
|
301
|
+
/* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsx(
|
|
302
|
+
Select,
|
|
303
|
+
{
|
|
304
|
+
allowClear: true,
|
|
305
|
+
placeholder: "select current assets",
|
|
306
|
+
showSearch: true,
|
|
307
|
+
style: { width: 300 },
|
|
308
|
+
options: values(current.chunkGraph.assets).map((e) => ({
|
|
309
|
+
label: e.path,
|
|
310
|
+
value: e.path
|
|
311
|
+
})),
|
|
312
|
+
onChange: (e) => setSelectedCAsset(e)
|
|
313
|
+
}
|
|
314
|
+
) })
|
|
315
|
+
] })
|
|
316
|
+
] }),
|
|
317
|
+
/* @__PURE__ */ jsx(Col, { span: 24, children: /* @__PURE__ */ jsx(
|
|
318
|
+
Table,
|
|
319
|
+
{
|
|
320
|
+
bordered: true,
|
|
321
|
+
sticky: { offsetHeader: 54 },
|
|
322
|
+
pagination: {
|
|
323
|
+
pageSize: 20,
|
|
324
|
+
size: "small"
|
|
325
|
+
},
|
|
326
|
+
dataSource: filteredDataSource,
|
|
327
|
+
rowKey: (e) => e.alias,
|
|
328
|
+
expandable: {
|
|
329
|
+
expandedRowRender: (r) => {
|
|
330
|
+
return /* @__PURE__ */ jsx("div", { style: { margin: Size.BasePadding / 3 }, children: /* @__PURE__ */ jsx(
|
|
331
|
+
ModuleRowForAsset,
|
|
332
|
+
{
|
|
333
|
+
data: r,
|
|
334
|
+
baseline,
|
|
335
|
+
current
|
|
336
|
+
}
|
|
337
|
+
) });
|
|
338
|
+
},
|
|
339
|
+
columnTitle: /* @__PURE__ */ jsx(
|
|
340
|
+
Tooltip,
|
|
341
|
+
{
|
|
342
|
+
title: "Click to expand row to see the modules which the chunk contains",
|
|
343
|
+
placement: "left",
|
|
344
|
+
children: /* @__PURE__ */ jsx(AppstoreAddOutlined, { style: { cursor: "pointer" } })
|
|
345
|
+
}
|
|
346
|
+
)
|
|
347
|
+
},
|
|
348
|
+
columns: [
|
|
349
|
+
{
|
|
350
|
+
title: /* @__PURE__ */ jsxs(
|
|
351
|
+
Tooltip,
|
|
352
|
+
{
|
|
353
|
+
title: /* @__PURE__ */ jsxs(Space, { direction: "vertical", children: [
|
|
354
|
+
/* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
|
|
355
|
+
"filtered assets is ",
|
|
356
|
+
filteredDataSource.length
|
|
357
|
+
] }),
|
|
358
|
+
/* @__PURE__ */ jsxs(Typography.Text, { style: { color: "inherit" }, children: [
|
|
359
|
+
"total assets is ",
|
|
360
|
+
dataSource.length
|
|
361
|
+
] })
|
|
362
|
+
] }),
|
|
363
|
+
children: [
|
|
364
|
+
/* @__PURE__ */ jsx(Typography.Text, { strong: true, children: "Assets" }),
|
|
365
|
+
/* @__PURE__ */ jsx(Divider, { type: "vertical" }),
|
|
366
|
+
/* @__PURE__ */ jsxs(
|
|
367
|
+
Typography.Text,
|
|
368
|
+
{
|
|
369
|
+
type: "secondary",
|
|
370
|
+
style: { fontSize: 10, fontWeight: 400, marginRight: 4 },
|
|
371
|
+
children: [
|
|
372
|
+
filteredDataSource.length,
|
|
373
|
+
"/",
|
|
374
|
+
dataSource.length
|
|
375
|
+
]
|
|
376
|
+
}
|
|
377
|
+
),
|
|
378
|
+
/* @__PURE__ */ jsx(InfoCircleOutlined, {})
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
),
|
|
382
|
+
render: (_v, r) => /* @__PURE__ */ jsx(Name, { data: r })
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
title: () => {
|
|
386
|
+
const cs = formatSize(cSize);
|
|
387
|
+
const diff = Graph.diffSize(bSize, cSize);
|
|
388
|
+
return /* @__PURE__ */ jsxs(
|
|
389
|
+
Tooltip,
|
|
390
|
+
{
|
|
391
|
+
title: `Current size is ${cs}, Delta is ${formatPercent(diff.percent)}`,
|
|
392
|
+
children: [
|
|
393
|
+
/* @__PURE__ */ jsx(Typography.Text, { strong: true, children: "Current" }),
|
|
394
|
+
/* @__PURE__ */ jsx(Divider, { type: "vertical" }),
|
|
395
|
+
/* @__PURE__ */ jsxs(
|
|
396
|
+
Typography.Text,
|
|
397
|
+
{
|
|
398
|
+
style: { fontSize: 10, fontWeight: 400, marginRight: 4 },
|
|
399
|
+
children: [
|
|
400
|
+
/* @__PURE__ */ jsx(
|
|
401
|
+
Typography.Text,
|
|
402
|
+
{
|
|
403
|
+
style: { fontSize: "inherit", marginRight: 8 },
|
|
404
|
+
children: cs
|
|
405
|
+
}
|
|
406
|
+
),
|
|
407
|
+
/* @__PURE__ */ jsx(
|
|
408
|
+
SizePercent,
|
|
409
|
+
{
|
|
410
|
+
fontSize: "inherit",
|
|
411
|
+
baseline: bSize,
|
|
412
|
+
current: cSize
|
|
413
|
+
}
|
|
414
|
+
),
|
|
415
|
+
formatDiffSize(
|
|
416
|
+
bSize,
|
|
417
|
+
cSize,
|
|
418
|
+
bSize > cSize ? Client.RsdoctorClientDiffState.Down : Client.RsdoctorClientDiffState.Up,
|
|
419
|
+
{ fontSize: 10, fontWeight: 400, marginLeft: 4 }
|
|
420
|
+
)
|
|
421
|
+
]
|
|
422
|
+
}
|
|
423
|
+
),
|
|
424
|
+
/* @__PURE__ */ jsx(InfoCircleOutlined, {})
|
|
425
|
+
]
|
|
426
|
+
}
|
|
427
|
+
);
|
|
428
|
+
},
|
|
429
|
+
render: (_v, r) => {
|
|
430
|
+
if (r.current) {
|
|
431
|
+
const { percent, state } = Graph.diffAssetsByExtensions(
|
|
432
|
+
baseline.chunkGraph,
|
|
433
|
+
current.chunkGraph,
|
|
434
|
+
(asset) => Graph.formatAssetName(asset.path, bOutPutFileName) === r.alias
|
|
435
|
+
);
|
|
436
|
+
const isInitial = Graph.isInitialAsset(
|
|
437
|
+
r.current,
|
|
438
|
+
current.chunkGraph.chunks
|
|
439
|
+
);
|
|
440
|
+
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
441
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: formatSize(r.current.size) }),
|
|
442
|
+
/* @__PURE__ */ jsx(Percent, { percent, state }),
|
|
443
|
+
isInitial ? /* @__PURE__ */ jsx(Tag, { color: Color.Blue, children: "initial" }) : null
|
|
444
|
+
] });
|
|
445
|
+
}
|
|
446
|
+
return "-";
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
title: () => {
|
|
451
|
+
const bs = formatSize(bSize);
|
|
452
|
+
return /* @__PURE__ */ jsxs(Tooltip, { title: `Baseline size is ${bs}`, children: [
|
|
453
|
+
/* @__PURE__ */ jsx(Typography.Text, { strong: true, children: "Baseline" }),
|
|
454
|
+
/* @__PURE__ */ jsx(Divider, { type: "vertical" }),
|
|
455
|
+
/* @__PURE__ */ jsx(
|
|
456
|
+
Typography.Text,
|
|
457
|
+
{
|
|
458
|
+
style: { fontSize: 10, fontWeight: 400, marginRight: 4 },
|
|
459
|
+
children: bs
|
|
460
|
+
}
|
|
461
|
+
),
|
|
462
|
+
/* @__PURE__ */ jsx(InfoCircleOutlined, {})
|
|
463
|
+
] });
|
|
464
|
+
},
|
|
465
|
+
render: (_v, r) => {
|
|
466
|
+
if (r.baseline) {
|
|
467
|
+
const isInitial = Graph.isInitialAsset(
|
|
468
|
+
r.baseline,
|
|
469
|
+
baseline.chunkGraph.chunks
|
|
470
|
+
);
|
|
471
|
+
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
472
|
+
/* @__PURE__ */ jsx(Typography.Text, { children: formatSize(r.baseline.size) }),
|
|
473
|
+
isInitial ? /* @__PURE__ */ jsx(Tag, { color: Color.Blue, children: "initial" }) : null
|
|
474
|
+
] });
|
|
475
|
+
}
|
|
476
|
+
return "-";
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
title: "Actions",
|
|
481
|
+
key: "actions",
|
|
482
|
+
render: (_v, r) => {
|
|
483
|
+
return /* @__PURE__ */ jsx(
|
|
484
|
+
ViewChanges,
|
|
485
|
+
{
|
|
486
|
+
file: r.alias,
|
|
487
|
+
data: [
|
|
488
|
+
{
|
|
489
|
+
baseline: r.baseline?.content,
|
|
490
|
+
current: r.current?.content,
|
|
491
|
+
group: "assets"
|
|
492
|
+
}
|
|
493
|
+
]
|
|
494
|
+
}
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
]
|
|
499
|
+
}
|
|
500
|
+
) })
|
|
501
|
+
] });
|
|
502
|
+
};
|
|
503
|
+
export {
|
|
504
|
+
Assets
|
|
505
|
+
};
|