@bundle-stats/ui 4.2.0-beta.1 → 4.3.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/lib/components/bundle-assets/bundle-assets.module.css +1 -1
- package/lib/components/bundle-assets/bundle-assets.utils.js +1 -1
- package/lib/components/bundle-assets/bundle-assets.utils.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.js +2 -1
- package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.module.css +0 -4
- package/lib/components/bundle-modules/bundle-modules.utils.js +1 -1
- package/lib/components/bundle-modules/bundle-modules.utils.js.map +1 -1
- package/lib/components/bundle-modules/index.js +8 -2
- package/lib/components/bundle-modules/index.js.map +1 -1
- package/lib/components/bundle-packages/bundle-packages.utils.js +1 -1
- package/lib/components/bundle-packages/bundle-packages.utils.js.map +1 -1
- package/lib/components/metrics-table/index.js +19 -3
- package/lib/components/metrics-table/index.js.map +1 -1
- package/lib/components/metrics-table/metrics-table.js +13 -3
- package/lib/components/metrics-table/metrics-table.js.map +1 -1
- package/lib/components/metrics-table/metrics-table.module.css +27 -0
- package/lib/components/module-info/module-info.js +16 -24
- package/lib/components/module-info/module-info.js.map +1 -1
- package/lib/components/module-info/module-info.module.css +8 -27
- package/lib/components/summary-item/summary-item.js +1 -1
- package/lib/components/summary-item/summary-item.js.map +1 -1
- package/lib/components/summary-item/summary-item.module.css +5 -0
- package/lib/css/variables.css +2 -2
- package/lib/hooks/search-params.js +11 -2
- package/lib/hooks/search-params.js.map +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.module.css +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.utils.js +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.utils.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.js +2 -1
- package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.module.css +0 -4
- package/lib-esm/components/bundle-modules/bundle-modules.utils.js +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.utils.js.map +1 -1
- package/lib-esm/components/bundle-modules/index.js +8 -2
- package/lib-esm/components/bundle-modules/index.js.map +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.utils.js +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.utils.js.map +1 -1
- package/lib-esm/components/metrics-table/index.js +6 -1
- package/lib-esm/components/metrics-table/index.js.map +1 -1
- package/lib-esm/components/metrics-table/metrics-table.js +13 -3
- package/lib-esm/components/metrics-table/metrics-table.js.map +1 -1
- package/lib-esm/components/metrics-table/metrics-table.module.css +27 -0
- package/lib-esm/components/module-info/module-info.js +17 -25
- package/lib-esm/components/module-info/module-info.js.map +1 -1
- package/lib-esm/components/module-info/module-info.module.css +8 -27
- package/lib-esm/components/summary-item/summary-item.js +1 -1
- package/lib-esm/components/summary-item/summary-item.js.map +1 -1
- package/lib-esm/components/summary-item/summary-item.module.css +5 -0
- package/lib-esm/css/variables.css +2 -2
- package/lib-esm/hooks/search-params.js +12 -3
- package/lib-esm/hooks/search-params.js.map +1 -1
- package/package.json +17 -17
- package/src/components/bundle-assets/bundle-assets.module.css +1 -1
- package/src/components/bundle-assets/bundle-assets.utils.js +1 -1
- package/src/components/bundle-modules/bundle-modules.jsx +9 -11
- package/src/components/bundle-modules/bundle-modules.module.css +0 -4
- package/src/components/bundle-modules/bundle-modules.utils.js +1 -1
- package/src/components/bundle-modules/index.jsx +15 -2
- package/src/components/bundle-packages/bundle-packages.utils.js +1 -1
- package/src/components/metrics-table/index.jsx +11 -0
- package/src/components/metrics-table/metrics-table.jsx +42 -5
- package/src/components/metrics-table/metrics-table.module.css +27 -0
- package/src/components/module-info/module-info.jsx +25 -55
- package/src/components/module-info/module-info.module.css +8 -27
- package/src/components/summary-item/summary-item.jsx +1 -1
- package/src/components/summary-item/summary-item.module.css +5 -0
- package/src/css/variables.css +2 -2
- package/src/hooks/search-params.js +23 -11
- package/tsconfig.json +3 -0
- package/types/components/metrics-table/index.d.ts +1 -1
- package/types/components/metrics-table/metrics-table.d.ts +3 -1
- package/src/components/metrics-table/index.js +0 -1
|
@@ -107,17 +107,15 @@ const RowHeader = ({ row, chunks, labels, CustomComponentLink }) => {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
return (
|
|
110
|
-
<HoverCard label={content}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
/>
|
|
120
|
-
)}
|
|
110
|
+
<HoverCard label={content}>
|
|
111
|
+
<ModuleInfo
|
|
112
|
+
className={css.namePopover}
|
|
113
|
+
item={row}
|
|
114
|
+
chunks={chunks}
|
|
115
|
+
chunkIds={chunkIds}
|
|
116
|
+
labels={labels}
|
|
117
|
+
customComponentLink={CustomComponentLink}
|
|
118
|
+
/>
|
|
121
119
|
</HoverCard>
|
|
122
120
|
);
|
|
123
121
|
};
|
|
@@ -24,8 +24,21 @@ import { SORT_BY } from './bundle-modules.constants';
|
|
|
24
24
|
export const BundleModules = (props) => {
|
|
25
25
|
const { jobs, filters, search, setState, sortBy, direction, ...restProps } = props;
|
|
26
26
|
|
|
27
|
-
const
|
|
28
|
-
|
|
27
|
+
const { chunks, chunkIds } = useMemo(
|
|
28
|
+
() => {
|
|
29
|
+
const bundleChunks = uniqBy(
|
|
30
|
+
jobs.map((job) => job?.meta?.webpack?.chunks || []).flat(),
|
|
31
|
+
({ id }) => id
|
|
32
|
+
);
|
|
33
|
+
const bundleChunkIds = bundleChunks?.map(({ id }) => id);
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
chunks: bundleChunks,
|
|
37
|
+
chunkIds: bundleChunkIds,
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
[jobs],
|
|
41
|
+
);
|
|
29
42
|
|
|
30
43
|
const { defaultFilters, allEntriesFilters } = useMemo(
|
|
31
44
|
() => ({
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { MetricsTable as BaseComponent } from './metrics-table';
|
|
4
|
+
|
|
5
|
+
export const MetricsTable = (props) => {
|
|
6
|
+
const [showAllItems, setShowAllItems] = useState(false);
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<BaseComponent {...props} showAllItems={showAllItems} setShowAllItems={setShowAllItems} />
|
|
10
|
+
);
|
|
11
|
+
};
|
|
@@ -12,6 +12,7 @@ import { JobName } from '../job-name';
|
|
|
12
12
|
import styles from './metrics-table.module.css';
|
|
13
13
|
|
|
14
14
|
const METRIC_TYPE_DATA = getGlobalMetricType(null, METRIC_TYPE_FILE_SIZE);
|
|
15
|
+
const VISIBLE_COUNT = 500;
|
|
15
16
|
|
|
16
17
|
const getRowsRunTotal = (rows, runIndex) => sum(rows.map((row) => row?.runs?.[runIndex]?.value || 0));
|
|
17
18
|
|
|
@@ -164,6 +165,8 @@ export const MetricsTable = ({
|
|
|
164
165
|
showHeaderSum,
|
|
165
166
|
headerRows,
|
|
166
167
|
title,
|
|
168
|
+
showAllItems,
|
|
169
|
+
setShowAllItems,
|
|
167
170
|
...restProps
|
|
168
171
|
}) => {
|
|
169
172
|
const { headers, columnClassNames } = useMemo(() => {
|
|
@@ -183,6 +186,11 @@ export const MetricsTable = ({
|
|
|
183
186
|
showHeaderSum && styles.showHeaderSum,
|
|
184
187
|
);
|
|
185
188
|
|
|
189
|
+
const showEmpty = isEmpty(items);
|
|
190
|
+
const showItems = !showEmpty;
|
|
191
|
+
const hasHiddenItems = items?.length > VISIBLE_COUNT;
|
|
192
|
+
const visibleItems = !hasHiddenItems || showAllItems ? items : items?.slice(0, VISIBLE_COUNT);
|
|
193
|
+
|
|
186
194
|
return (
|
|
187
195
|
<Table className={rootClassName} compact {...restProps}>
|
|
188
196
|
<Table.THead>
|
|
@@ -201,17 +209,46 @@ export const MetricsTable = ({
|
|
|
201
209
|
})}
|
|
202
210
|
</Table.THead>
|
|
203
211
|
<Table.TBody>
|
|
204
|
-
{
|
|
205
|
-
items.map((item) => (
|
|
206
|
-
<MetricsTableRow key={item.key} item={item} renderRowHeader={renderRowHeader} />
|
|
207
|
-
))
|
|
208
|
-
) : (
|
|
212
|
+
{showEmpty && (
|
|
209
213
|
<Table.Tr>
|
|
210
214
|
<Table.Td className={styles.empty} colSpan={columnClassNames?.length || 1}>
|
|
211
215
|
{emptyMessage}
|
|
212
216
|
</Table.Td>
|
|
213
217
|
</Table.Tr>
|
|
214
218
|
)}
|
|
219
|
+
|
|
220
|
+
{showItems && (
|
|
221
|
+
<>
|
|
222
|
+
{visibleItems.map((item) => (
|
|
223
|
+
<MetricsTableRow key={item.key} item={item} renderRowHeader={renderRowHeader} />
|
|
224
|
+
))}
|
|
225
|
+
|
|
226
|
+
{hasHiddenItems && (
|
|
227
|
+
<Table.Tr>
|
|
228
|
+
<Table.Td className={styles.showAllItems} colSpan={columnClassNames?.length || 1}>
|
|
229
|
+
{showAllItems ? (
|
|
230
|
+
<button
|
|
231
|
+
onClick={() => setShowAllItems(false)}
|
|
232
|
+
type="button"
|
|
233
|
+
className={styles.showAllItemsButton}
|
|
234
|
+
>
|
|
235
|
+
Show less
|
|
236
|
+
</button>
|
|
237
|
+
) : (
|
|
238
|
+
<button
|
|
239
|
+
onClick={() => setShowAllItems(true)}
|
|
240
|
+
type="button"
|
|
241
|
+
className={styles.showAllItemsButton}
|
|
242
|
+
>
|
|
243
|
+
Show all
|
|
244
|
+
</button>
|
|
245
|
+
)
|
|
246
|
+
}
|
|
247
|
+
</Table.Td>
|
|
248
|
+
</Table.Tr>
|
|
249
|
+
)}
|
|
250
|
+
</>
|
|
251
|
+
)}
|
|
215
252
|
</Table.TBody>
|
|
216
253
|
</Table>
|
|
217
254
|
);
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
width: 100%;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
.tableHeaderRunMetric {
|
|
19
|
+
text-transform: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
18
22
|
.root .value {
|
|
19
23
|
padding-left: var(--space-large);
|
|
20
24
|
text-align: right;
|
|
@@ -67,6 +71,29 @@
|
|
|
67
71
|
text-align: center;
|
|
68
72
|
}
|
|
69
73
|
|
|
74
|
+
.root .showAllItems {
|
|
75
|
+
background: none !important;
|
|
76
|
+
text-align: center;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** show all */
|
|
80
|
+
.showAllItemsButton {
|
|
81
|
+
appearance: none;
|
|
82
|
+
background: none;
|
|
83
|
+
margin: 0;
|
|
84
|
+
border: 0;
|
|
85
|
+
padding: var(--space-xxxsmall);
|
|
86
|
+
color: var(--color-primary);
|
|
87
|
+
text-decoration: underline;
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.showAllItemsButton:hover,
|
|
92
|
+
.showAllItemsButton:focus,
|
|
93
|
+
.showAllItemsButton:active {
|
|
94
|
+
color: var(--color-primary-dark);
|
|
95
|
+
}
|
|
96
|
+
|
|
70
97
|
/** Breakpoints */
|
|
71
98
|
.root tr {
|
|
72
99
|
display: flex;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import cx from 'classnames';
|
|
4
3
|
import isEmpty from 'lodash/isEmpty';
|
|
5
4
|
import noop from 'lodash/noop';
|
|
6
|
-
import { getBundleModulesByChunk
|
|
5
|
+
import { getBundleModulesByChunk } from '@bundle-stats/utils';
|
|
7
6
|
|
|
8
7
|
import { Stack } from '../../layout/stack';
|
|
9
|
-
import { FlexStack } from '../../layout/flex-stack';
|
|
10
8
|
import { FileName } from '../../ui/file-name';
|
|
11
|
-
import { Tag } from '../../ui/tag';
|
|
12
9
|
import { ComponentLink } from '../component-link';
|
|
13
10
|
import css from './module-info.module.css';
|
|
14
11
|
|
|
@@ -24,34 +21,25 @@ export const ModuleInfo = (props) => {
|
|
|
24
21
|
} = props;
|
|
25
22
|
|
|
26
23
|
return (
|
|
27
|
-
<Stack space="
|
|
28
|
-
{item.runs.map((run, index) =>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<FlexStack space="xxxsmall" alignItems="center" as="h4" className={css.title}>
|
|
32
|
-
<span>{labels[index]}</span>
|
|
33
|
-
<Tag className={css.titleTag}>{index === 0 ? 'current' : 'baseline'}</Tag>
|
|
34
|
-
</FlexStack>
|
|
35
|
-
<FileName className={css.fileName} as="code" name={run?.name || '-'} />
|
|
36
|
-
</Stack>
|
|
24
|
+
<Stack space="xsmall" className={className}>
|
|
25
|
+
{item.runs.map((run, index) => {
|
|
26
|
+
const TitleComponent = index !== 0 ? 'h4' : 'h3';
|
|
27
|
+
const key = `module-info-${run?.name || index}-${index}`;
|
|
37
28
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{run.chunkIds.map((chunkId) => {
|
|
47
|
-
const chunk = chunks?.find(({ id }) => id === chunkId);
|
|
29
|
+
return (
|
|
30
|
+
<Stack space="xxxsmall" key={key}>
|
|
31
|
+
<TitleComponent>{labels[index]}</TitleComponent>
|
|
32
|
+
{index === 0 && !isEmpty(run?.chunkIds) && (
|
|
33
|
+
<div className={css.chunks}>
|
|
34
|
+
<span className={css.chunksTitle}>Chunks:</span>
|
|
35
|
+
{run.chunkIds.map((chunkId) => {
|
|
36
|
+
const chunk = chunks?.find(({ id }) => id === chunkId);
|
|
48
37
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
if (!chunk) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
52
41
|
|
|
53
|
-
|
|
54
|
-
<li>
|
|
42
|
+
return (
|
|
55
43
|
<CustomComponentLink
|
|
56
44
|
{...getBundleModulesByChunk(chunkIds, chunkId)}
|
|
57
45
|
onClick={onClick}
|
|
@@ -59,33 +47,15 @@ export const ModuleInfo = (props) => {
|
|
|
59
47
|
>
|
|
60
48
|
{chunk.name}
|
|
61
49
|
</CustomComponentLink>
|
|
62
|
-
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
</Stack>
|
|
67
|
-
)}
|
|
50
|
+
);
|
|
51
|
+
})}
|
|
52
|
+
</div>
|
|
53
|
+
)}
|
|
68
54
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
{run.reasons.map((reason) => (
|
|
74
|
-
<li key={reason}>
|
|
75
|
-
<CustomComponentLink
|
|
76
|
-
{...getBundleModulesBySearch(`^${reason}$`)}
|
|
77
|
-
onClick={onClick}
|
|
78
|
-
className={css.reasonLink}
|
|
79
|
-
>
|
|
80
|
-
<FileName name={reason} className={css.reason} />
|
|
81
|
-
</CustomComponentLink>
|
|
82
|
-
</li>
|
|
83
|
-
))}
|
|
84
|
-
</ul>
|
|
85
|
-
</Stack>
|
|
86
|
-
)}
|
|
87
|
-
</Stack>
|
|
88
|
-
))}
|
|
55
|
+
<FileName className={css.fileName} as="code" name={run?.name || '-'} />
|
|
56
|
+
</Stack>
|
|
57
|
+
);
|
|
58
|
+
})}
|
|
89
59
|
</Stack>
|
|
90
60
|
);
|
|
91
61
|
};
|
|
@@ -1,40 +1,21 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
background: var(--color-highlight);
|
|
4
|
-
color: var(--color-text-light);
|
|
1
|
+
.chunksTitle {
|
|
2
|
+
margin-right: var(--space-xxxsmall);
|
|
5
3
|
}
|
|
6
4
|
|
|
7
|
-
.
|
|
8
|
-
|
|
5
|
+
.chunksItems {
|
|
6
|
+
display: inline;
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
.chunksItem {
|
|
12
10
|
overflow-wrap: break-word;
|
|
13
11
|
}
|
|
14
12
|
|
|
13
|
+
.chunksItem + .chunksItem {
|
|
14
|
+
margin-left: var(--space-xxxsmall);
|
|
15
|
+
}
|
|
16
|
+
|
|
15
17
|
.fileName {
|
|
16
18
|
max-width: 100%;
|
|
17
19
|
padding: 2px;
|
|
18
20
|
background: var(--color-highlight-warning);
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
.reasonLink {
|
|
22
|
-
text-decoration: underline;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.reasonLink .reason {
|
|
26
|
-
text-decoration: inherit;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.reason {
|
|
30
|
-
display: inline;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.list {
|
|
34
|
-
padding: 0 0 0 var(--space-small);
|
|
35
|
-
list-style: outside;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.list li::marker {
|
|
39
|
-
color: var(--color-text-ultra-light);
|
|
40
|
-
}
|
|
@@ -63,7 +63,7 @@ export const SummaryItem = ({
|
|
|
63
63
|
const rootClassName = cx(css.root, className, css[size], showDelta && css.showDelta);
|
|
64
64
|
|
|
65
65
|
return (
|
|
66
|
-
<Stack space="
|
|
66
|
+
<Stack space="xxsmall" as={Component} className={rootClassName} {...props}>
|
|
67
67
|
<FlexStack space="xxxsmall" alignItems="center" as="h3" className={css.title}>
|
|
68
68
|
<span>
|
|
69
69
|
{metric.label}
|
package/src/css/variables.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useLayoutEffect, useReducer } from 'react';
|
|
1
|
+
import { useCallback, useLayoutEffect, useMemo, useReducer } from 'react';
|
|
2
2
|
import isEqual from 'lodash/isEqual';
|
|
3
3
|
import merge from 'lodash/merge';
|
|
4
4
|
|
|
@@ -150,14 +150,26 @@ export const useSearchParams = ({
|
|
|
150
150
|
dispatch({ type: ACTION_RESET_ALL });
|
|
151
151
|
}, [dispatch]);
|
|
152
152
|
|
|
153
|
-
return
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
153
|
+
return useMemo(
|
|
154
|
+
() => ({
|
|
155
|
+
search,
|
|
156
|
+
searchPattern,
|
|
157
|
+
filters,
|
|
158
|
+
hasActiveFilters: !isEqual(allEntriesFilters, filters),
|
|
159
|
+
updateSearch: handleUpdateSearch,
|
|
160
|
+
updateFilters: handleUpdateFilters,
|
|
161
|
+
resetFilters: handleResetFilters,
|
|
162
|
+
resetAllFilters: handleResetAllFilters,
|
|
163
|
+
}),
|
|
164
|
+
[
|
|
165
|
+
search,
|
|
166
|
+
searchPattern,
|
|
167
|
+
filters,
|
|
168
|
+
allEntriesFilters,
|
|
169
|
+
handleUpdateSearch,
|
|
170
|
+
handleUpdateFilters,
|
|
171
|
+
handleResetFilters,
|
|
172
|
+
handleResetAllFilters,
|
|
173
|
+
],
|
|
174
|
+
);
|
|
163
175
|
};
|
package/tsconfig.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export function MetricsTable(props: any): JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function MetricsTable({ className, renderRowHeader, runs, items, emptyMessage, showHeaderSum, headerRows, title, ...restProps }: {
|
|
1
|
+
export function MetricsTable({ className, renderRowHeader, runs, items, emptyMessage, showHeaderSum, headerRows, title, showAllItems, setShowAllItems, ...restProps }: {
|
|
2
2
|
[x: string]: any;
|
|
3
3
|
className: any;
|
|
4
4
|
renderRowHeader: any;
|
|
@@ -8,6 +8,8 @@ export function MetricsTable({ className, renderRowHeader, runs, items, emptyMes
|
|
|
8
8
|
showHeaderSum: any;
|
|
9
9
|
headerRows: any;
|
|
10
10
|
title: any;
|
|
11
|
+
showAllItems: any;
|
|
12
|
+
setShowAllItems: any;
|
|
11
13
|
}): JSX.Element;
|
|
12
14
|
export namespace MetricsTable {
|
|
13
15
|
namespace defaultProps {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './metrics-table';
|