@bundle-stats/ui 4.2.0-beta.4 → 4.2.0-beta.6

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.
Files changed (59) hide show
  1. package/lib/app/app.js +9 -3
  2. package/lib/app/app.js.map +1 -1
  3. package/lib/assets/icons.svg +9 -1
  4. package/lib/assets/icons.svg.js +6 -0
  5. package/lib/assets/icons.svg.js.map +1 -1
  6. package/lib/components/index.js +3 -3
  7. package/lib/components/index.js.map +1 -1
  8. package/lib/components/{duplicate-packages-insight → insights}/index.js +1 -1
  9. package/lib/components/insights/index.js.map +1 -0
  10. package/lib/components/insights/insights.js +58 -0
  11. package/lib/components/insights/insights.js.map +1 -0
  12. package/lib/components/insights/insights.module.css +34 -0
  13. package/lib/ui/icon/icon.js +2 -0
  14. package/lib/ui/icon/icon.js.map +1 -1
  15. package/lib-esm/app/app.js +10 -4
  16. package/lib-esm/app/app.js.map +1 -1
  17. package/lib-esm/assets/icons.svg +9 -1
  18. package/lib-esm/assets/icons.svg.js +6 -0
  19. package/lib-esm/assets/icons.svg.js.map +1 -1
  20. package/lib-esm/components/index.js +1 -1
  21. package/lib-esm/components/index.js.map +1 -1
  22. package/lib-esm/components/insights/index.js +2 -0
  23. package/lib-esm/components/insights/index.js.map +1 -0
  24. package/lib-esm/components/insights/insights.js +51 -0
  25. package/lib-esm/components/insights/insights.js.map +1 -0
  26. package/lib-esm/components/insights/insights.module.css +34 -0
  27. package/lib-esm/ui/icon/icon.js +2 -0
  28. package/lib-esm/ui/icon/icon.js.map +1 -1
  29. package/package.json +3 -3
  30. package/src/app/app.jsx +18 -8
  31. package/src/assets/icons/error.svg +6 -0
  32. package/src/assets/icons/info.svg +6 -0
  33. package/src/assets/icons.svg +9 -1
  34. package/src/assets/icons.svg.jsx +26 -0
  35. package/src/components/index.js +1 -1
  36. package/src/components/insights/index.ts +1 -0
  37. package/src/components/insights/insights.module.css +34 -0
  38. package/src/components/insights/insights.stories.tsx +53 -0
  39. package/src/components/insights/insights.tsx +101 -0
  40. package/src/ui/icon/icon.jsx +2 -0
  41. package/types/components/index.d.ts +1 -1
  42. package/types/components/insights/index.d.ts +1 -0
  43. package/types/components/insights/insights.d.ts +8 -0
  44. package/types/ui/icon/icon.d.ts +2 -0
  45. package/lib/components/duplicate-packages-insight/duplicate-packages-insight.js +0 -34
  46. package/lib/components/duplicate-packages-insight/duplicate-packages-insight.js.map +0 -1
  47. package/lib/components/duplicate-packages-insight/duplicate-packages-insight.module.css +0 -18
  48. package/lib/components/duplicate-packages-insight/index.js.map +0 -1
  49. package/lib-esm/components/duplicate-packages-insight/duplicate-packages-insight.js +0 -27
  50. package/lib-esm/components/duplicate-packages-insight/duplicate-packages-insight.js.map +0 -1
  51. package/lib-esm/components/duplicate-packages-insight/duplicate-packages-insight.module.css +0 -18
  52. package/lib-esm/components/duplicate-packages-insight/index.js +0 -2
  53. package/lib-esm/components/duplicate-packages-insight/index.js.map +0 -1
  54. package/src/components/duplicate-packages-insight/duplicate-packages-insight.module.css +0 -18
  55. package/src/components/duplicate-packages-insight/duplicate-packages-insight.stories.tsx +0 -66
  56. package/src/components/duplicate-packages-insight/duplicate-packages-insight.tsx +0 -86
  57. package/src/components/duplicate-packages-insight/index.ts +0 -1
  58. package/types/components/duplicate-packages-insight/duplicate-packages-insight.d.ts +0 -11
  59. package/types/components/duplicate-packages-insight/index.d.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bundle-stats/ui",
3
- "version": "4.2.0-beta.4",
3
+ "version": "4.2.0-beta.6",
4
4
  "description": "UI components for BundleStats projects.",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -82,11 +82,11 @@
82
82
  "react-router-dom": "^5.0.0"
83
83
  },
84
84
  "dependencies": {
85
- "@bundle-stats/utils": "^4.2.0-beta.4",
85
+ "@bundle-stats/utils": "^4.2.0-beta.6",
86
86
  "ariakit": "2.0.0-next.43",
87
87
  "modern-css-reset": "1.4.0",
88
88
  "query-string": "7.1.3",
89
89
  "use-query-params": "2.1.2"
90
90
  },
91
- "gitHead": "3aebbd2da0d16350e38bc52eafb1d6a9b6967a5c"
91
+ "gitHead": "fa5c0da7c8d6de3d6cd1cb42a581bdca55dccf31"
92
92
  }
package/src/app/app.jsx CHANGED
@@ -12,7 +12,6 @@ import {
12
12
  } from '../constants';
13
13
  import { Box } from '../layout/box';
14
14
  import { Container } from '../ui/container';
15
- import { DuplicatePackagesInsight } from '../components/duplicate-packages-insight';
16
15
  import { Summary } from '../components/summary';
17
16
  import { BundleAssets } from '../components/bundle-assets';
18
17
  import { BundleAssetsTotalsChartBars } from '../components/bundle-assets-totals-chart-bars';
@@ -22,11 +21,13 @@ import { Stack } from '../layout/stack';
22
21
  import { BundleAssetsTotalsTable } from '../components/bundle-assets-totals-table';
23
22
  import { BundleModules } from '../components/bundle-modules';
24
23
  import { BundlePackages } from '../components/bundle-packages';
24
+ import { Insights } from '../components/insights';
25
25
  import { TotalSizeTypeTitle } from '../components/total-size-type-title';
26
26
  import { QueryStateProvider, useComponentQueryState } from '../query-state';
27
27
  import I18N from '../i18n';
28
28
  import { Header } from './header';
29
29
  import css from './app.module.css';
30
+ import { MetricsTableTitle } from '../components';
30
31
 
31
32
  const ScrollToTop = () => {
32
33
  const { pathname } = useLocation();
@@ -68,18 +69,27 @@ JobsProvider.propTypes = {
68
69
 
69
70
  const OverviewContent = () => {
70
71
  const { jobs } = useContext(JobsContext);
72
+
71
73
  const duplicatePackagesInsight = jobs[0].insights?.webpack?.duplicatePackagesV3;
74
+ const newPackagesInsight = jobs[0].insights?.webpack?.newPackages;
75
+
76
+ console.info(duplicatePackagesInsight, newPackagesInsight);
72
77
 
73
78
  return (
74
79
  <Stack space="medium">
75
- {duplicatePackagesInsight && (
80
+ {(duplicatePackagesInsight || newPackagesInsight) && (
76
81
  <Container>
77
- <DuplicatePackagesInsight
78
- type={duplicatePackagesInsight.type}
79
- data={duplicatePackagesInsight.data}
80
- summary={jobs[0].summary.webpack?.duplicatePackagesCount}
81
- showDelta={jobs.length > 1}
82
- />
82
+ <Stack space="xsmall">
83
+ <MetricsTableTitle title="Insights" />
84
+ <Box padding="small" outline>
85
+ <Insights
86
+ duplicatePackages={duplicatePackagesInsight}
87
+ newPackages={newPackagesInsight}
88
+ summary={jobs[0].summary?.webpack}
89
+ showDelta={jobs.length > 1}
90
+ />
91
+ </Box>
92
+ </Stack>
83
93
  </Container>
84
94
  )}
85
95
  <Container>
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2
+ <circle cx="12" cy="12" r="10"></circle>
3
+ <line x1="12" y1="8" x2="12" y2="12"></line>
4
+ <line x1="12" y1="16" x2="12.01" y2="16"></line>
5
+
6
+ </svg>
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2
+ <circle cx="12" cy="12" r="10"></circle>
3
+ <line x1="12" y1="16" x2="12" y2="12"></line>
4
+ <line x1="12" y1="8" x2="12.01" y2="8"></line>
5
+
6
+ </svg>
@@ -1,4 +1,4 @@
1
- <svg width="16" height="16">
1
+ <svg width="0" height="0" style="position:absolute">
2
2
  <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-down" id="arrow" xmlns="http://www.w3.org/2000/svg">
3
3
  <path d="M12 5v14M19 12l-7 7-7-7"/>
4
4
  </symbol>
@@ -22,6 +22,10 @@
22
22
  <circle cx="12" cy="12" r="4"/>
23
23
  <path d="M1.05 12H7M17.01 12h5.95"/>
24
24
  </symbol>
25
+ <symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="error" xmlns="http://www.w3.org/2000/svg">
26
+ <circle cx="12" cy="12" r="10"/>
27
+ <path d="M12 8v4M12 16h.01"/>
28
+ </symbol>
25
29
  <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bar-chart" id="filter" xmlns="http://www.w3.org/2000/svg">
26
30
  <path d="M12 20V10M18 20V4M6 20v-4"/>
27
31
  </symbol>
@@ -29,6 +33,10 @@
29
33
  <circle cx="12" cy="12" r="10"/>
30
34
  <path d="M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3M12 17h.01"/>
31
35
  </symbol>
36
+ <symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="info" xmlns="http://www.w3.org/2000/svg">
37
+ <circle cx="12" cy="12" r="10"/>
38
+ <path d="M12 16v-4M12 8h.01"/>
39
+ </symbol>
32
40
  <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu" id="menu" xmlns="http://www.w3.org/2000/svg">
33
41
  <path d="M3 12h18M3 6h18M3 18h18"/>
34
42
  </symbol>
@@ -85,6 +85,19 @@ export const SvgIcons = (props) => (
85
85
  <circle cx="12" cy="12" r="4" />
86
86
  <path d="M1.05 12H7M17.01 12h5.95" />
87
87
  </symbol>
88
+ <symbol
89
+ fill="none"
90
+ stroke="currentColor"
91
+ stroke-width="2"
92
+ stroke-linecap="round"
93
+ stroke-linejoin="round"
94
+ viewBox="0 0 24 24"
95
+ id="error"
96
+ xmlns="http://www.w3.org/2000/svg"
97
+ >
98
+ <circle cx="12" cy="12" r="10" />
99
+ <path d="M12 8v4M12 16h.01" />
100
+ </symbol>
88
101
  <symbol
89
102
  viewBox="0 0 24 24"
90
103
  fill="none"
@@ -112,6 +125,19 @@ export const SvgIcons = (props) => (
112
125
  <circle cx="12" cy="12" r="10" />
113
126
  <path d="M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3M12 17h.01" />
114
127
  </symbol>
128
+ <symbol
129
+ fill="none"
130
+ stroke="currentColor"
131
+ stroke-width="2"
132
+ stroke-linecap="round"
133
+ stroke-linejoin="round"
134
+ viewBox="0 0 24 24"
135
+ id="info"
136
+ xmlns="http://www.w3.org/2000/svg"
137
+ >
138
+ <circle cx="12" cy="12" r="10" />
139
+ <path d="M12 16v-4M12 8h.01" />
140
+ </symbol>
115
141
  <symbol
116
142
  viewBox="0 0 24 24"
117
143
  fill="none"
@@ -5,8 +5,8 @@ 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 { DuplicatePackagesInsight } from './duplicate-packages-insight';
9
8
  export { Delta } from './delta';
9
+ export { Insights } from './insights';
10
10
  export { JobName } from './job-name';
11
11
  export { JobHeader } from './job-header';
12
12
  export { JobsHeader } from './jobs-header';
@@ -0,0 +1 @@
1
+ export * from './insights';
@@ -0,0 +1,34 @@
1
+ .icon {
2
+ outline: 3px solid transparent;
3
+ border-radius: 50%;
4
+ background: var(--color-highlight);
5
+ }
6
+
7
+ .error .icon {
8
+ outline-color: var(--color-red-50);
9
+ background: var(--color-red-50);
10
+ color: var(--color-danger);
11
+ }
12
+
13
+ .warning .icon {
14
+ outline-color: var(--color-yellow-100);
15
+ background: var(--color-yellow-100);
16
+ color: var(--color-warning-dark);
17
+ }
18
+
19
+ .info .icon {
20
+ outline-color: var(--color-highlight-info);
21
+ background: var(--color-highlight-info);
22
+ color: var(--color-info);
23
+ }
24
+
25
+ .entry {
26
+ color: inherit;
27
+ text-decoration: none;
28
+ }
29
+
30
+ .entry:hover,
31
+ .entry:active,
32
+ .entry:focus {
33
+ text-decoration: underline;
34
+ }
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+
3
+ import { getWrapperDecorator } from '../../stories';
4
+ import { Insights } from '.';
5
+
6
+ export default {
7
+ title: 'Components/Insights',
8
+ component: Insights,
9
+ decorators: [getWrapperDecorator()],
10
+ };
11
+
12
+ const Template = (props: any) => <Insights {...props} />;
13
+
14
+ export const Default = Template.bind({});
15
+
16
+ Default.args = {
17
+ duplicatePackages: {
18
+ type: 'error',
19
+ data: {
20
+ packages: { 'package-a': ['package-a', 'package-a~1'] },
21
+ text: 'Bundle introduced 1 and removed 2 duplicate packages',
22
+ },
23
+ },
24
+ newPackages: {
25
+ type: 'warning',
26
+ data: {
27
+ text: 'Bundle introduced 2 new packages: package-c, package-d',
28
+ packages: ['package-c', 'package-d'],
29
+ },
30
+ changes: true,
31
+ },
32
+ };
33
+
34
+ export const Info = Template.bind({});
35
+
36
+ Info.args = {
37
+ duplicatePackages: {
38
+ type: 'info',
39
+ data: {
40
+ packages: { 'package-a': ['package-a', 'package-a~1'] },
41
+ text: 'Bundle removed 1 duplicate packages',
42
+ },
43
+ changes: false,
44
+ },
45
+ newPackages: {
46
+ type: 'warning',
47
+ data: {
48
+ text: 'Bundle introduced 2 new packages: package-c, package-d',
49
+ packages: ['package-c', 'package-d'],
50
+ },
51
+ changes: true,
52
+ },
53
+ };
@@ -0,0 +1,101 @@
1
+ import React from 'react';
2
+ import cx from 'classnames';
3
+ import {
4
+ BUNDLE_PACKAGES_DUPLICATE,
5
+ BUNDLE_PACKAGES_COUNT,
6
+ InsightType,
7
+ JobInsight,
8
+ JobInsights as JobInsightsType,
9
+ } from '@bundle-stats/utils';
10
+
11
+ import { FlexStack } from '../../layout/flex-stack';
12
+ import { Stack } from '../../layout/stack';
13
+ import { Icon } from '../../ui/icon';
14
+ import { ComponentLink } from '../component-link';
15
+ // @ts-ignore
16
+ import css from './insights.module.css';
17
+
18
+ interface InsightEntry {
19
+ name: string;
20
+ insight: JobInsight;
21
+ link: any;
22
+ }
23
+
24
+ const normalizedInsights = ({
25
+ duplicatePackages,
26
+ newPackages,
27
+ }: Partial<JobInsightsType['webpack']>): Array<InsightEntry> => {
28
+ const insightsByLevel: Record<InsightType, Array<InsightEntry>> = {
29
+ [InsightType.ERROR]: [],
30
+ [InsightType.WARNING]: [],
31
+ [InsightType.INFO]: [],
32
+ };
33
+
34
+ if (duplicatePackages) {
35
+ insightsByLevel[duplicatePackages.type].push({
36
+ name: 'duplicatePackages',
37
+ insight: duplicatePackages,
38
+ link: BUNDLE_PACKAGES_DUPLICATE,
39
+ });
40
+ }
41
+
42
+ if (newPackages) {
43
+ insightsByLevel[newPackages.type].push({
44
+ name: 'newPackages',
45
+ insight: newPackages,
46
+ link: BUNDLE_PACKAGES_COUNT,
47
+ });
48
+ }
49
+
50
+ return [
51
+ ...(insightsByLevel[InsightType.ERROR] || []),
52
+ ...(insightsByLevel[InsightType.WARNING] || []),
53
+ ...(insightsByLevel[InsightType.INFO] || []),
54
+ ];
55
+ };
56
+
57
+ const InsightTypeIconMap = new Map([
58
+ [InsightType.ERROR, Icon.ICONS.ERROR],
59
+ [InsightType.WARNING, Icon.ICONS.WARNING],
60
+ [InsightType.INFO, Icon.ICONS.INFO],
61
+ ]);
62
+
63
+ interface InsightsProps extends React.HTMLAttributes<HTMLDivElement> {
64
+ duplicatePackages: any;
65
+ newPackages: any;
66
+ customComponentLink?: React.ElementType;
67
+ }
68
+
69
+ export const Insights = (props: InsightsProps) => {
70
+ const {
71
+ duplicatePackages,
72
+ newPackages,
73
+ customComponentLink: CustomComponentLink = ComponentLink,
74
+ ...restProps
75
+ } = props;
76
+
77
+ const insights = normalizedInsights({ duplicatePackages, newPackages });
78
+
79
+ return (
80
+ <Stack space="xxsmall" {...restProps}>
81
+ {insights.map(({ name, insight, link }) => {
82
+ const glyph = InsightTypeIconMap.get(insight.type);
83
+ const { text } = insight.data as { text: string };
84
+
85
+ return (
86
+ <FlexStack
87
+ key={name}
88
+ space="xxsmall"
89
+ alignItems="center"
90
+ as={CustomComponentLink}
91
+ {...link}
92
+ className={cx(css.entry, css[insight.type])}
93
+ >
94
+ {glyph && <Icon glyph={glyph} className={css.icon} />}
95
+ <span>{text}</span>
96
+ </FlexStack>
97
+ );
98
+ })}
99
+ </Stack>
100
+ );
101
+ };
@@ -11,7 +11,9 @@ const ICONS = {
11
11
  CLOSE: 'close',
12
12
  CLOCK: 'clock',
13
13
  COMMIT: 'commit',
14
+ ERROR: 'error',
14
15
  FILTER: 'filter',
16
+ INFO: 'info',
15
17
  HELP: 'help',
16
18
  MENU: 'menu',
17
19
  SORT: 'sort',
@@ -5,8 +5,8 @@ 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 { DuplicatePackagesInsight } from "./duplicate-packages-insight";
9
8
  export { Delta } from "./delta";
9
+ export { Insights } from "./insights";
10
10
  export { JobName } from "./job-name";
11
11
  export { JobHeader } from "./job-header";
12
12
  export { JobsHeader } from "./jobs-header";
@@ -0,0 +1 @@
1
+ export * from './insights';
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface InsightsProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ duplicatePackages: any;
4
+ newPackages: any;
5
+ customComponentLink?: React.ElementType;
6
+ }
7
+ export declare const Insights: (props: InsightsProps) => JSX.Element;
8
+ export {};
@@ -28,7 +28,9 @@ declare namespace ICONS {
28
28
  const CLOSE: string;
29
29
  const CLOCK: string;
30
30
  const COMMIT: string;
31
+ const ERROR: string;
31
32
  const FILTER: string;
33
+ const INFO: string;
32
34
  const HELP: string;
33
35
  const MENU: string;
34
36
  const SORT: string;
@@ -1,34 +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.DuplicatePackagesInsight = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const utils_1 = require("@bundle-stats/utils");
9
- const alert_1 = require("../../ui/alert");
10
- const component_link_1 = require("../component-link");
11
- const delta_1 = require("../delta");
12
- const duplicate_packages_insight_module_css_1 = __importDefault(require("./duplicate-packages-insight.module.css"));
13
- const AlertKindMap = new Map([
14
- [utils_1.InsightType.INFO, 'info'],
15
- [utils_1.InsightType.ERROR, 'danger'],
16
- [utils_1.InsightType.WARNING, 'warning'],
17
- ]);
18
- const DuplicatePackagesInsight = (props) => {
19
- const { type, data, summary, showDelta = true, customComponentLink: CustomComponentLink = component_link_1.ComponentLink, ...restProps } = props;
20
- const metric = (0, utils_1.getGlobalMetricType)('webpack.duplicatePackageCount');
21
- const metricRunInfo = (0, utils_1.getMetricRunInfo)(metric, summary.current, summary.baseline);
22
- const hasDuplicatePackages = metricRunInfo.value > 0 || (metricRunInfo && metricRunInfo.delta !== 0);
23
- return (react_1.default.createElement(alert_1.Alert, { kind: AlertKindMap.get(type), ...restProps },
24
- react_1.default.createElement("span", { className: duplicate_packages_insight_module_css_1.default.message }, data.text),
25
- hasDuplicatePackages && (react_1.default.createElement("span", { className: duplicate_packages_insight_module_css_1.default.metric },
26
- metricRunInfo.value,
27
- showDelta && typeof metricRunInfo.delta !== 'undefined' && (react_1.default.createElement(delta_1.Delta, { className: duplicate_packages_insight_module_css_1.default.delta, inverted: true, displayValue: metricRunInfo.displayDelta, deltaType: metricRunInfo.deltaType })))),
28
- react_1.default.createElement("span", { className: duplicate_packages_insight_module_css_1.default.link },
29
- hasDuplicatePackages &&
30
- (typeof metricRunInfo?.delta !== 'undefined' && metricRunInfo.delta !== 0 ? (react_1.default.createElement(CustomComponentLink, { ...utils_1.BUNDLE_PACKAGES_DUPLICATE_NEW }, "View duplicate packages")) : (react_1.default.createElement(CustomComponentLink, { ...utils_1.BUNDLE_PACKAGES_DUPLICATE }, "View duplicate packages"))),
31
- !hasDuplicatePackages && (react_1.default.createElement(CustomComponentLink, { ...utils_1.BUNDLE_PACKAGES_COUNT }, "View packages")))));
32
- };
33
- exports.DuplicatePackagesInsight = DuplicatePackagesInsight;
34
- //# sourceMappingURL=duplicate-packages-insight.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"duplicate-packages-insight.js","sourceRoot":"","sources":["../../../src/components/duplicate-packages-insight/duplicate-packages-insight.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,+CAS6B;AAE7B,0CAAuC;AACvC,sDAAkD;AAClD,oCAAiC;AAEjC,oHAA0D;AAU1D,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,CAAC,mBAAW,CAAC,IAAI,EAAE,MAAM,CAAC;IAC1B,CAAC,mBAAW,CAAC,KAAK,EAAE,QAAQ,CAAC;IAC7B,CAAC,mBAAW,CAAC,OAAO,EAAE,SAAS,CAAC;CACjC,CAAC,CAAC;AAEI,MAAM,wBAAwB,GAAG,CAAC,KAAoC,EAAE,EAAE;IAC/E,MAAM,EACJ,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,SAAS,GAAG,IAAI,EAChB,mBAAmB,EAAE,mBAAmB,GAAG,8BAAa,EACxD,GAAG,SAAS,EACb,GAAG,KAAK,CAAC;IAEV,MAAM,MAAM,GAAG,IAAA,2BAAmB,EAAC,+BAA+B,CAAC,CAAC;IAEpE,MAAM,aAAa,GAAG,IAAA,wBAAgB,EAAC,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAElF,MAAM,oBAAoB,GACxB,aAAa,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC;IAE1E,OAAO,CACL,8BAAC,aAAK,IAAC,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,KAAM,SAAS;QAChD,wCAAM,SAAS,EAAE,+CAAG,CAAC,OAAO,IAAG,IAAI,CAAC,IAAI,CAAQ;QAC/C,oBAAoB,IAAI,CACvB,wCAAM,SAAS,EAAE,+CAAG,CAAC,MAAM;YACxB,aAAa,CAAC,KAAK;YACnB,SAAS,IAAI,OAAO,aAAa,CAAC,KAAK,KAAK,WAAW,IAAI,CAC1D,8BAAC,aAAK,IACJ,SAAS,EAAE,+CAAG,CAAC,KAAK,EACpB,QAAQ,QACR,YAAY,EAAE,aAAa,CAAC,YAAsB,EAClD,SAAS,EAAE,aAAa,CAAC,SAAmB,GAC5C,CACH,CACI,CACR;QACD,wCAAM,SAAS,EAAE,+CAAG,CAAC,IAAI;YACtB,oBAAoB;gBACnB,CAAC,OAAO,aAAa,EAAE,KAAK,KAAK,WAAW,IAAI,aAAa,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAC1E,8BAAC,mBAAmB,OAAM,qCAAqC,8BAEzC,CACvB,CAAC,CAAC,CAAC,CACF,8BAAC,mBAAmB,OAAM,iCAAiC,8BAErC,CACvB,CAAC;YAEH,CAAC,oBAAoB,IAAI,CACxB,8BAAC,mBAAmB,OAAM,6BAA6B,oBAEjC,CACvB,CACI,CACD,CACT,CAAC;AACJ,CAAC,CAAC;AArDW,QAAA,wBAAwB,4BAqDnC"}
@@ -1,18 +0,0 @@
1
- .metric {
2
- font-weight: bold;
3
- }
4
-
5
- .metric::before,
6
- .link::before {
7
- content: '\00A0\2014\00A0';
8
- font-weight: normal;
9
- color: var(--color-text-ultra-light);
10
- }
11
-
12
- .delta {
13
- margin-left: var(--space-xxxsmall);
14
- padding: 1px 2px;
15
- vertical-align: super;
16
- font-size: 9px;
17
- line-height: 1;
18
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/duplicate-packages-insight/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C"}
@@ -1,27 +0,0 @@
1
- import React from 'react';
2
- import { BUNDLE_PACKAGES_DUPLICATE, BUNDLE_PACKAGES_DUPLICATE_NEW, BUNDLE_PACKAGES_COUNT, InsightType, getMetricRunInfo, getGlobalMetricType, } from '@bundle-stats/utils';
3
- import { Alert } from '../../ui/alert';
4
- import { ComponentLink } from '../component-link';
5
- import { Delta } from '../delta';
6
- import css from './duplicate-packages-insight.module.css';
7
- const AlertKindMap = new Map([
8
- [InsightType.INFO, 'info'],
9
- [InsightType.ERROR, 'danger'],
10
- [InsightType.WARNING, 'warning'],
11
- ]);
12
- export const DuplicatePackagesInsight = (props) => {
13
- const { type, data, summary, showDelta = true, customComponentLink: CustomComponentLink = ComponentLink, ...restProps } = props;
14
- const metric = getGlobalMetricType('webpack.duplicatePackageCount');
15
- const metricRunInfo = getMetricRunInfo(metric, summary.current, summary.baseline);
16
- const hasDuplicatePackages = metricRunInfo.value > 0 || (metricRunInfo && metricRunInfo.delta !== 0);
17
- return (React.createElement(Alert, { kind: AlertKindMap.get(type), ...restProps },
18
- React.createElement("span", { className: css.message }, data.text),
19
- hasDuplicatePackages && (React.createElement("span", { className: css.metric },
20
- metricRunInfo.value,
21
- showDelta && typeof metricRunInfo.delta !== 'undefined' && (React.createElement(Delta, { className: css.delta, inverted: true, displayValue: metricRunInfo.displayDelta, deltaType: metricRunInfo.deltaType })))),
22
- React.createElement("span", { className: css.link },
23
- hasDuplicatePackages &&
24
- (typeof (metricRunInfo === null || metricRunInfo === void 0 ? void 0 : metricRunInfo.delta) !== 'undefined' && metricRunInfo.delta !== 0 ? (React.createElement(CustomComponentLink, { ...BUNDLE_PACKAGES_DUPLICATE_NEW }, "View duplicate packages")) : (React.createElement(CustomComponentLink, { ...BUNDLE_PACKAGES_DUPLICATE }, "View duplicate packages"))),
25
- !hasDuplicatePackages && (React.createElement(CustomComponentLink, { ...BUNDLE_PACKAGES_COUNT }, "View packages")))));
26
- };
27
- //# sourceMappingURL=duplicate-packages-insight.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"duplicate-packages-insight.js","sourceRoot":"","sources":["../../../src/components/duplicate-packages-insight/duplicate-packages-insight.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,qBAAqB,EACrB,WAAW,EAEX,gBAAgB,EAEhB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,GAAG,MAAM,yCAAyC,CAAC;AAU1D,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC;IAC1B,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC;IAC7B,CAAC,WAAW,CAAC,OAAO,EAAE,SAAS,CAAC;CACjC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAoC,EAAE,EAAE;IAC/E,MAAM,EACJ,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,SAAS,GAAG,IAAI,EAChB,mBAAmB,EAAE,mBAAmB,GAAG,aAAa,EACxD,GAAG,SAAS,EACb,GAAG,KAAK,CAAC;IAEV,MAAM,MAAM,GAAG,mBAAmB,CAAC,+BAA+B,CAAC,CAAC;IAEpE,MAAM,aAAa,GAAG,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAElF,MAAM,oBAAoB,GACxB,aAAa,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC;IAE1E,OAAO,CACL,oBAAC,KAAK,IAAC,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,KAAM,SAAS;QAChD,8BAAM,SAAS,EAAE,GAAG,CAAC,OAAO,IAAG,IAAI,CAAC,IAAI,CAAQ;QAC/C,oBAAoB,IAAI,CACvB,8BAAM,SAAS,EAAE,GAAG,CAAC,MAAM;YACxB,aAAa,CAAC,KAAK;YACnB,SAAS,IAAI,OAAO,aAAa,CAAC,KAAK,KAAK,WAAW,IAAI,CAC1D,oBAAC,KAAK,IACJ,SAAS,EAAE,GAAG,CAAC,KAAK,EACpB,QAAQ,QACR,YAAY,EAAE,aAAa,CAAC,YAAsB,EAClD,SAAS,EAAE,aAAa,CAAC,SAAmB,GAC5C,CACH,CACI,CACR;QACD,8BAAM,SAAS,EAAE,GAAG,CAAC,IAAI;YACtB,oBAAoB;gBACnB,CAAC,OAAO,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,KAAK,CAAA,KAAK,WAAW,IAAI,aAAa,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAC1E,oBAAC,mBAAmB,OAAM,6BAAqC,8BAEzC,CACvB,CAAC,CAAC,CAAC,CACF,oBAAC,mBAAmB,OAAM,yBAAiC,8BAErC,CACvB,CAAC;YAEH,CAAC,oBAAoB,IAAI,CACxB,oBAAC,mBAAmB,OAAM,qBAA6B,oBAEjC,CACvB,CACI,CACD,CACT,CAAC;AACJ,CAAC,CAAC"}
@@ -1,18 +0,0 @@
1
- .metric {
2
- font-weight: bold;
3
- }
4
-
5
- .metric::before,
6
- .link::before {
7
- content: '\00A0\2014\00A0';
8
- font-weight: normal;
9
- color: var(--color-text-ultra-light);
10
- }
11
-
12
- .delta {
13
- margin-left: var(--space-xxxsmall);
14
- padding: 1px 2px;
15
- vertical-align: super;
16
- font-size: 9px;
17
- line-height: 1;
18
- }
@@ -1,2 +0,0 @@
1
- export * from './duplicate-packages-insight';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/duplicate-packages-insight/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
@@ -1,18 +0,0 @@
1
- .metric {
2
- font-weight: bold;
3
- }
4
-
5
- .metric::before,
6
- .link::before {
7
- content: '\00A0\2014\00A0';
8
- font-weight: normal;
9
- color: var(--color-text-ultra-light);
10
- }
11
-
12
- .delta {
13
- margin-left: var(--space-xxxsmall);
14
- padding: 1px 2px;
15
- vertical-align: super;
16
- font-size: 9px;
17
- line-height: 1;
18
- }
@@ -1,66 +0,0 @@
1
- import React from 'react';
2
- import { MemoryRouter } from 'react-router-dom';
3
- import { DuplicatePackagesInsight } from '.';
4
-
5
- export default {
6
- title: 'Components/DuplicatePackagesInsight',
7
- component: DuplicatePackagesInsight,
8
- };
9
-
10
- const Template = (props: any) => <MemoryRouter><DuplicatePackagesInsight {...props} /></MemoryRouter>;
11
-
12
- export const Default = Template.bind({});
13
-
14
- Default.args = {
15
- type: 'INFO',
16
- data: {
17
- packages: {},
18
- text: 'Bundle does not contain duplicate packages',
19
- },
20
- summary: {
21
- current: 0,
22
- baseline: 0,
23
- },
24
- };
25
-
26
- export const NewDuplicates = Template.bind({});
27
-
28
- NewDuplicates.args = {
29
- type: 'ERROR',
30
- data: {
31
- packages: {},
32
- text: 'Bundle introduced 2 duplicate packages',
33
- },
34
- summary: {
35
- current: 4,
36
- baseline: 2,
37
- },
38
- };
39
-
40
- export const NewDuplicatesAndRemovals = Template.bind({});
41
-
42
- NewDuplicatesAndRemovals.args = {
43
- type: 'ERROR',
44
- data: {
45
- packages: {},
46
- text: 'Bundle introduced 2 and removed 1 duplicate packages',
47
- },
48
- summary: {
49
- current: 4,
50
- baseline: 3,
51
- },
52
- };
53
-
54
- export const NoChangeDuplicates = Template.bind({});
55
-
56
- NoChangeDuplicates.args = {
57
- type: 'WARNING',
58
- data: {
59
- packages: {},
60
- text: 'Bundle contains 4 duplicate packages',
61
- },
62
- summary: {
63
- current: 4,
64
- baseline: 4,
65
- },
66
- };