@bundle-stats/ui 4.2.0-beta.1 → 4.2.0-beta.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/lib/app/app.js +4 -5
- package/lib/app/app.js.map +1 -1
- 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/duplicate-packages-insight/duplicate-packages-insight.js +33 -0
- package/lib/components/duplicate-packages-insight/duplicate-packages-insight.js.map +1 -0
- package/lib/components/duplicate-packages-insight/duplicate-packages-insight.module.css +18 -0
- package/lib/components/{duplicate-packages-warning → duplicate-packages-insight}/index.js +1 -1
- package/lib/components/duplicate-packages-insight/index.js.map +1 -0
- package/lib/components/index.js +3 -3
- package/lib/components/job-header/job-header.js +1 -1
- package/lib/components/job-header/job-header.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/app/app.js +5 -5
- package/lib-esm/app/app.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/duplicate-packages-insight/duplicate-packages-insight.js +26 -0
- package/lib-esm/components/duplicate-packages-insight/duplicate-packages-insight.js.map +1 -0
- package/lib-esm/components/duplicate-packages-insight/duplicate-packages-insight.module.css +18 -0
- package/lib-esm/components/duplicate-packages-insight/index.js +2 -0
- package/lib-esm/components/duplicate-packages-insight/index.js.map +1 -0
- package/lib-esm/components/index.js +1 -1
- package/lib-esm/components/job-header/job-header.js +2 -2
- package/lib-esm/components/job-header/job-header.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 +19 -19
- package/src/app/app.jsx +7 -8
- 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/duplicate-packages-insight/duplicate-packages-insight.module.css +18 -0
- package/src/components/duplicate-packages-insight/duplicate-packages-insight.stories.tsx +66 -0
- package/src/components/duplicate-packages-insight/duplicate-packages-insight.tsx +84 -0
- package/src/components/duplicate-packages-insight/index.ts +1 -0
- package/src/components/index.js +1 -1
- package/src/components/job-header/job-header.jsx +2 -2
- 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.esm.json +1 -1
- package/tsconfig.json +3 -0
- package/tsconfig.lib.json +1 -1
- package/types/components/duplicate-packages-insight/duplicate-packages-insight.d.ts +11 -0
- package/types/components/duplicate-packages-insight/index.d.ts +1 -0
- package/types/components/index.d.ts +1 -1
- package/types/components/metrics-table/index.d.ts +1 -1
- package/types/components/metrics-table/metrics-table.d.ts +3 -1
- package/lib/components/duplicate-packages-warning/duplicate-packages-warning.js +0 -41
- package/lib/components/duplicate-packages-warning/duplicate-packages-warning.js.map +0 -1
- package/lib/components/duplicate-packages-warning/duplicate-packages-warning.module.css +0 -22
- package/lib/components/duplicate-packages-warning/index.js.map +0 -1
- package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.js +0 -34
- package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.js.map +0 -1
- package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.module.css +0 -22
- package/lib-esm/components/duplicate-packages-warning/index.js +0 -2
- package/lib-esm/components/duplicate-packages-warning/index.js.map +0 -1
- package/src/components/duplicate-packages-warning/duplicate-packages-warning.jsx +0 -60
- package/src/components/duplicate-packages-warning/duplicate-packages-warning.module.css +0 -22
- package/src/components/duplicate-packages-warning/index.js +0 -1
- package/src/components/metrics-table/index.js +0 -1
- package/types/components/duplicate-packages-warning/duplicate-packages-warning.d.ts +0 -21
- package/types/components/duplicate-packages-warning/index.d.ts +0 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
BUNDLE_PACKAGES_DUPLICATE,
|
|
4
|
+
BUNDLE_PACKAGES_DUPLICATE_NEW,
|
|
5
|
+
BUNDLE_PACKAGES_COUNT,
|
|
6
|
+
InsightType,
|
|
7
|
+
JobSummaryItem,
|
|
8
|
+
getMetricRunInfo,
|
|
9
|
+
JobInsightDuplicatePackagesV3Data,
|
|
10
|
+
getGlobalMetricType,
|
|
11
|
+
} from '@bundle-stats/utils';
|
|
12
|
+
|
|
13
|
+
import { Alert } from '../../ui/alert';
|
|
14
|
+
import { ComponentLink } from '../component-link';
|
|
15
|
+
import { Delta } from '../delta';
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
import css from './duplicate-packages-insight.module.css';
|
|
18
|
+
|
|
19
|
+
interface DuplicatePackagesInsightProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
20
|
+
type: InsightType;
|
|
21
|
+
data: JobInsightDuplicatePackagesV3Data;
|
|
22
|
+
summary: JobSummaryItem;
|
|
23
|
+
showDelta?: boolean;
|
|
24
|
+
customComponentLink?: React.FunctionComponent<React.HTMLAttributes<HTMLLinkElement>>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const AlertKindMap = new Map([
|
|
28
|
+
[InsightType.INFO, 'info'],
|
|
29
|
+
[InsightType.ERROR, 'danger'],
|
|
30
|
+
[InsightType.WARNING, 'warning'],
|
|
31
|
+
]);
|
|
32
|
+
|
|
33
|
+
export const DuplicatePackagesInsight = (props: DuplicatePackagesInsightProps) => {
|
|
34
|
+
const {
|
|
35
|
+
type,
|
|
36
|
+
data,
|
|
37
|
+
summary,
|
|
38
|
+
showDelta = true,
|
|
39
|
+
customComponentLink: CustomComponentLink = ComponentLink,
|
|
40
|
+
...restProps
|
|
41
|
+
} = props;
|
|
42
|
+
|
|
43
|
+
const metric = getGlobalMetricType('webpack.duplicatePackageCount');
|
|
44
|
+
|
|
45
|
+
const metricRunInfo = getMetricRunInfo(metric, summary.current, summary.baseline);
|
|
46
|
+
|
|
47
|
+
const hasDuplicatePackages =
|
|
48
|
+
metricRunInfo.value > 0 || (metricRunInfo && metricRunInfo.delta !== 0);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Alert kind={AlertKindMap.get(type)} {...restProps}>
|
|
52
|
+
<span className={css.message}>{data.text}</span>
|
|
53
|
+
{hasDuplicatePackages && (
|
|
54
|
+
<span className={css.metric}>
|
|
55
|
+
{metricRunInfo.value}
|
|
56
|
+
{showDelta && typeof metricRunInfo.delta !== 'undefined' && (
|
|
57
|
+
<Delta
|
|
58
|
+
className={css.delta}
|
|
59
|
+
inverted
|
|
60
|
+
displayValue={metricRunInfo.displayDelta as string}
|
|
61
|
+
deltaType={metricRunInfo.deltaType as string}
|
|
62
|
+
/>
|
|
63
|
+
)}
|
|
64
|
+
</span>
|
|
65
|
+
)}
|
|
66
|
+
<span className={css.link}>
|
|
67
|
+
{hasDuplicatePackages && metricRunInfo?.delta !== 0 ? (
|
|
68
|
+
<CustomComponentLink {...(BUNDLE_PACKAGES_DUPLICATE_NEW as any)}>
|
|
69
|
+
View duplicate packages
|
|
70
|
+
</CustomComponentLink>
|
|
71
|
+
) : (
|
|
72
|
+
<CustomComponentLink {...(BUNDLE_PACKAGES_DUPLICATE as any)}>
|
|
73
|
+
View duplicate packages
|
|
74
|
+
</CustomComponentLink>
|
|
75
|
+
)}
|
|
76
|
+
{!hasDuplicatePackages && (
|
|
77
|
+
<CustomComponentLink {...(BUNDLE_PACKAGES_COUNT as any)}>
|
|
78
|
+
View packages
|
|
79
|
+
</CustomComponentLink>
|
|
80
|
+
)}
|
|
81
|
+
</span>
|
|
82
|
+
</Alert>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './duplicate-packages-insight';
|
package/src/components/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export { BundleAssetsTotalsChartBars } from './bundle-assets-totals-chart-bars';
|
|
|
5
5
|
export { BundlePackages } from './bundle-packages';
|
|
6
6
|
export { BundleModules } from './bundle-modules';
|
|
7
7
|
export { ComponentLink } from './component-link';
|
|
8
|
-
export {
|
|
8
|
+
export { DuplicatePackagesInsight } from './duplicate-packages-insight';
|
|
9
9
|
export { Delta } from './delta';
|
|
10
10
|
export { JobName } from './job-name';
|
|
11
11
|
export { JobHeader } from './job-header';
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import get from 'lodash/get';
|
|
5
|
-
import {
|
|
5
|
+
import { Source, formatDateTime } from '@bundle-stats/utils';
|
|
6
6
|
|
|
7
7
|
import { FlexStack } from '../../layout/flex-stack';
|
|
8
8
|
import { Stack } from '../../layout/stack';
|
|
@@ -13,7 +13,7 @@ import css from './job-header.module.css';
|
|
|
13
13
|
export const JobHeader = (props) => {
|
|
14
14
|
const { className, tag, job, children } = props;
|
|
15
15
|
|
|
16
|
-
const { builtAt, hash } = get(job, `meta.${
|
|
16
|
+
const { builtAt, hash } = get(job, `meta.${Source.webpack}`, {});
|
|
17
17
|
const rootClassName = cx(css.root, className);
|
|
18
18
|
|
|
19
19
|
return (
|
|
@@ -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.esm.json
CHANGED
package/tsconfig.json
CHANGED
package/tsconfig.lib.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InsightType, JobSummaryItem, JobInsightDuplicatePackagesV3Data } from '@bundle-stats/utils';
|
|
3
|
+
interface DuplicatePackagesInsightProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
type: InsightType;
|
|
5
|
+
data: JobInsightDuplicatePackagesV3Data;
|
|
6
|
+
summary: JobSummaryItem;
|
|
7
|
+
showDelta?: boolean;
|
|
8
|
+
customComponentLink?: React.FunctionComponent<React.HTMLAttributes<HTMLLinkElement>>;
|
|
9
|
+
}
|
|
10
|
+
export declare const DuplicatePackagesInsight: (props: DuplicatePackagesInsightProps) => JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './duplicate-packages-insight';
|
|
@@ -5,7 +5,7 @@ export { BundleAssetsTotalsChartBars } from "./bundle-assets-totals-chart-bars";
|
|
|
5
5
|
export { BundlePackages } from "./bundle-packages";
|
|
6
6
|
export { BundleModules } from "./bundle-modules";
|
|
7
7
|
export { ComponentLink } from "./component-link";
|
|
8
|
-
export {
|
|
8
|
+
export { DuplicatePackagesInsight } from "./duplicate-packages-insight";
|
|
9
9
|
export { Delta } from "./delta";
|
|
10
10
|
export { JobName } from "./job-name";
|
|
11
11
|
export { JobHeader } from "./job-header";
|
|
@@ -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,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DuplicatePackagesWarning = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
9
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
10
|
-
const utils_1 = require("@bundle-stats/utils");
|
|
11
|
-
const alert_1 = require("../../ui/alert");
|
|
12
|
-
const component_link_1 = require("../component-link");
|
|
13
|
-
const delta_1 = require("../delta");
|
|
14
|
-
const duplicate_packages_warning_module_css_1 = __importDefault(require("./duplicate-packages-warning.module.css"));
|
|
15
|
-
const numberMetric = utils_1.METRIC_TYPES[utils_1.METRIC_TYPE_NUMERIC];
|
|
16
|
-
const DuplicatePackagesWarning = (props) => {
|
|
17
|
-
const { className, duplicatePackagesCount, customComponentLink: CustomComponentLink, showDelta, } = props;
|
|
18
|
-
const metricRunInfo = (0, utils_1.getMetricRunInfo)(numberMetric, duplicatePackagesCount.current, duplicatePackagesCount.baseline);
|
|
19
|
-
return (react_1.default.createElement(alert_1.Alert, { kind: "warning", className: (0, classnames_1.default)(duplicate_packages_warning_module_css_1.default.root, className) },
|
|
20
|
-
`Bundle contains `,
|
|
21
|
-
react_1.default.createElement(CustomComponentLink, { ...utils_1.BUNDLE_PACKAGES_DUPLICATE },
|
|
22
|
-
metricRunInfo.value,
|
|
23
|
-
showDelta && metricRunInfo.delta !== 0 && (react_1.default.createElement(delta_1.Delta, { className: duplicate_packages_warning_module_css_1.default.titleDelta, inverted: true, displayValue: metricRunInfo.displayDelta, deltaType: metricRunInfo.deltaType })),
|
|
24
|
-
` duplicate ${metricRunInfo.value === 1 ? 'package' : 'packages'}.`)));
|
|
25
|
-
};
|
|
26
|
-
exports.DuplicatePackagesWarning = DuplicatePackagesWarning;
|
|
27
|
-
exports.DuplicatePackagesWarning.propTypes = {
|
|
28
|
-
className: prop_types_1.default.string,
|
|
29
|
-
customComponentLink: prop_types_1.default.elementType,
|
|
30
|
-
duplicatePackagesCount: prop_types_1.default.shape({
|
|
31
|
-
current: prop_types_1.default.number,
|
|
32
|
-
baseline: prop_types_1.default.number,
|
|
33
|
-
}).isRequired,
|
|
34
|
-
showDelta: prop_types_1.default.bool,
|
|
35
|
-
};
|
|
36
|
-
exports.DuplicatePackagesWarning.defaultProps = {
|
|
37
|
-
className: '',
|
|
38
|
-
customComponentLink: component_link_1.ComponentLink,
|
|
39
|
-
showDelta: true,
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=duplicate-packages-warning.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"duplicate-packages-warning.js","sourceRoot":"","sources":["../../../src/components/duplicate-packages-warning/duplicate-packages-warning.jsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,4DAAmC;AACnC,4DAA4B;AAC5B,+CAAqH;AAErH,0CAAuC;AACvC,sDAAkD;AAClD,oCAAiC;AACjC,oHAA0D;AAE1D,MAAM,YAAY,GAAG,oBAAY,CAAC,2BAAmB,CAAC,CAAC;AAEhD,MAAM,wBAAwB,GAAG,CAAC,KAAK,EAAE,EAAE;IAChD,MAAM,EACJ,SAAS,EACT,sBAAsB,EACtB,mBAAmB,EAAE,mBAAmB,EACxC,SAAS,GACV,GAAG,KAAK,CAAC;IAEV,MAAM,aAAa,GAAG,IAAA,wBAAgB,EACpC,YAAY,EACZ,sBAAsB,CAAC,OAAO,EAC9B,sBAAsB,CAAC,QAAQ,CAChC,CAAC;IAEF,OAAO,CACL,8BAAC,aAAK,IAAC,IAAI,EAAC,SAAS,EAAC,SAAS,EAAE,IAAA,oBAAE,EAAC,+CAAG,CAAC,IAAI,EAAE,SAAS,CAAC;QACrD,kBAAkB;QACnB,8BAAC,mBAAmB,OAAK,iCAAyB;YAC/C,aAAa,CAAC,KAAK;YACnB,SAAS,IAAI,aAAa,CAAC,KAAK,KAAK,CAAC,IAAI,CACzC,8BAAC,aAAK,IACJ,SAAS,EAAE,+CAAG,CAAC,UAAU,EACzB,QAAQ,QACR,YAAY,EAAE,aAAa,CAAC,YAAY,EACxC,SAAS,EAAE,aAAa,CAAC,SAAS,GAClC,CACH;YACA,cAAc,aAAa,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,GAAG,CAChD,CAChB,CACT,CAAC;AACJ,CAAC,CAAC;AA/BW,QAAA,wBAAwB,4BA+BnC;AAEF,gCAAwB,CAAC,SAAS,GAAG;IACnC,SAAS,EAAE,oBAAS,CAAC,MAAM;IAC3B,mBAAmB,EAAE,oBAAS,CAAC,WAAW;IAC1C,sBAAsB,EAAE,oBAAS,CAAC,KAAK,CAAC;QACtC,OAAO,EAAE,oBAAS,CAAC,MAAM;QACzB,QAAQ,EAAE,oBAAS,CAAC,MAAM;KAC3B,CAAC,CAAC,UAAU;IACb,SAAS,EAAE,oBAAS,CAAC,IAAI;CAC1B,CAAC;AAEF,gCAAwB,CAAC,YAAY,GAAG;IACtC,SAAS,EAAE,EAAE;IACb,mBAAmB,EAAE,8BAAa;IAClC,SAAS,EAAE,IAAI;CAChB,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
.root a {
|
|
2
|
-
text-decoration: none;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.root a:hover,
|
|
6
|
-
.root a:active,
|
|
7
|
-
.root a:focus {
|
|
8
|
-
text-decoration: none;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.title {
|
|
12
|
-
margin-bottom: var(--space-xxsmall);
|
|
13
|
-
font-size: var(--size-medium);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.titleDelta {
|
|
17
|
-
margin-left: var(--space-xxxsmall);
|
|
18
|
-
padding: 1px 2px;
|
|
19
|
-
vertical-align: super;
|
|
20
|
-
font-size: 9px;
|
|
21
|
-
line-height: 1;
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/duplicate-packages-warning/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C"}
|