@bundle-stats/ui 3.4.0-beta.0 → 4.0.0-alpha.9

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 (139) hide show
  1. package/lib/app/app.js +6 -21
  2. package/lib/app/app.stories.js +1 -22
  3. package/lib/assets/icons.svg +0 -8
  4. package/lib/components/asset-info/asset-info.js +1 -1
  5. package/lib/components/bundle-assets/bundle-assets.js +1 -1
  6. package/lib/components/bundle-assets/index.js +1 -1
  7. package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +1 -1
  8. package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.js +8 -43
  9. package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +2 -2
  10. package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +1 -20
  11. package/lib/components/bundle-modules/bundle-modules.js +1 -1
  12. package/lib/components/bundle-modules/index.js +1 -1
  13. package/lib/components/bundle-packages/bundle-packages.js +1 -1
  14. package/lib/components/bundle-packages/index.js +1 -1
  15. package/lib/components/component-link.js +1 -1
  16. package/lib/components/index.js +0 -8
  17. package/lib/components/job-meta/job-meta.js +1 -1
  18. package/lib/components/job-name/job-name.js +1 -1
  19. package/lib/components/metrics-table/metrics-table.js +1 -1
  20. package/lib/components/metrics-table-options/metrics-table-options.js +1 -1
  21. package/lib/components/module-info/module-info.js +1 -1
  22. package/lib/components/summary/summary.js +8 -13
  23. package/lib/components/summary/summary.stories.js +1 -58
  24. package/lib/components/summary-item/summary-item.js +6 -21
  25. package/lib/components/summary-item/summary-item.module.css +0 -6
  26. package/lib/components/summary-item/summary-item.stories.js +53 -65
  27. package/lib/constants.js +4 -4
  28. package/lib/layout/box/box.js +1 -1
  29. package/lib/layout/flex-stack/flex-stack.js +1 -1
  30. package/lib/layout/footer/footer.js +1 -1
  31. package/lib/layout/separator.js +1 -1
  32. package/lib/layout/stack/stack.js +1 -1
  33. package/lib/query-state.js +1 -1
  34. package/lib/ui/alert/alert.js +3 -13
  35. package/lib/ui/container/container.js +1 -1
  36. package/lib/ui/filters/filters.container.js +3 -3
  37. package/lib/ui/filters/filters.js +1 -1
  38. package/lib/ui/horizontal-bar-chart/horizontal-bar-chart.js +2 -2
  39. package/lib/ui/hover-card/hover-card.js +1 -1
  40. package/lib/ui/hover-card/hover-card.stories.js +1 -1
  41. package/lib/ui/icon/icon.js +1 -3
  42. package/lib/ui/input/input.js +1 -1
  43. package/lib/ui/loader/loader.js +1 -1
  44. package/lib/ui/logo/logo.js +1 -1
  45. package/lib/ui/panels/panels.js +1 -1
  46. package/lib/ui/skeleton/skeleton.js +1 -1
  47. package/lib/ui/sort-dropdown/sort-dropdown.js +1 -1
  48. package/lib/ui/tag/tag.js +1 -1
  49. package/lib/ui/tooltip/tooltip.js +1 -1
  50. package/lib-esm/app/app.js +6 -20
  51. package/lib-esm/app/app.stories.js +1 -22
  52. package/lib-esm/assets/icons.svg +0 -8
  53. package/lib-esm/components/asset-info/asset-info.js +1 -1
  54. package/lib-esm/components/bundle-assets/bundle-assets.js +1 -1
  55. package/lib-esm/components/bundle-assets/bundle-assets.utils.js +1 -0
  56. package/lib-esm/components/bundle-assets/index.js +1 -1
  57. package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +1 -1
  58. package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js +8 -24
  59. package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +2 -2
  60. package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +0 -18
  61. package/lib-esm/components/bundle-modules/bundle-modules.js +1 -1
  62. package/lib-esm/components/bundle-modules/index.js +1 -1
  63. package/lib-esm/components/bundle-packages/bundle-packages.js +1 -1
  64. package/lib-esm/components/bundle-packages/bundle-packages.utils.js +1 -0
  65. package/lib-esm/components/bundle-packages/index.js +1 -1
  66. package/lib-esm/components/component-link.js +1 -1
  67. package/lib-esm/components/index.js +0 -1
  68. package/lib-esm/components/job-meta/job-meta.js +1 -1
  69. package/lib-esm/components/job-name/job-name.js +1 -1
  70. package/lib-esm/components/metrics-table/metrics-table.js +1 -1
  71. package/lib-esm/components/metrics-table-options/metrics-table-options.js +1 -1
  72. package/lib-esm/components/module-info/module-info.js +1 -1
  73. package/lib-esm/components/summary/summary.js +9 -12
  74. package/lib-esm/components/summary/summary.stories.js +1 -56
  75. package/lib-esm/components/summary-item/summary-item.js +5 -18
  76. package/lib-esm/components/summary-item/summary-item.module.css +0 -6
  77. package/lib-esm/components/summary-item/summary-item.stories.js +38 -64
  78. package/lib-esm/constants.js +4 -4
  79. package/lib-esm/layout/box/box.js +1 -1
  80. package/lib-esm/layout/flex-stack/flex-stack.js +1 -1
  81. package/lib-esm/layout/footer/footer.js +1 -1
  82. package/lib-esm/layout/separator.js +1 -1
  83. package/lib-esm/layout/stack/stack.js +1 -1
  84. package/lib-esm/query-state.js +1 -1
  85. package/lib-esm/ui/alert/alert.js +3 -6
  86. package/lib-esm/ui/container/container.js +1 -1
  87. package/lib-esm/ui/filters/filters.container.js +1 -1
  88. package/lib-esm/ui/filters/filters.js +2 -1
  89. package/lib-esm/ui/hover-card/hover-card.js +1 -1
  90. package/lib-esm/ui/hover-card/hover-card.stories.js +1 -1
  91. package/lib-esm/ui/icon/icon.js +1 -3
  92. package/lib-esm/ui/input/input.js +1 -1
  93. package/lib-esm/ui/loader/loader.js +1 -1
  94. package/lib-esm/ui/logo/logo.js +1 -1
  95. package/lib-esm/ui/panels/panels.js +1 -1
  96. package/lib-esm/ui/skeleton/skeleton.js +1 -1
  97. package/lib-esm/ui/sort-dropdown/sort-dropdown.js +1 -1
  98. package/lib-esm/ui/tag/tag.js +1 -1
  99. package/lib-esm/ui/tooltip/tooltip.js +1 -1
  100. package/package.json +22 -22
  101. package/src/app/app.jsx +5 -12
  102. package/src/assets/icons.svg +0 -8
  103. package/src/components/bundle-assets-totals-table/bundle-assets-totals-table.jsx +13 -27
  104. package/src/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +2 -2
  105. package/src/components/index.js +0 -1
  106. package/src/components/summary/summary.jsx +7 -8
  107. package/src/components/summary-item/summary-item.jsx +3 -10
  108. package/src/components/summary-item/summary-item.module.css +0 -6
  109. package/src/constants.js +11 -7
  110. package/src/ui/alert/alert.jsx +2 -7
  111. package/src/ui/icon/icon.jsx +0 -2
  112. package/lib/assets/icons/alert-circle.svg +0 -1
  113. package/lib/assets/icons/check-circle.svg +0 -1
  114. package/lib/components/budget-info/budget-info.js +0 -74
  115. package/lib/components/budget-info/budget-info.module.css +0 -40
  116. package/lib/components/budget-info/budget-info.stories.js +0 -59
  117. package/lib/components/budget-info/index.js +0 -18
  118. package/lib/components/budget-insights/budget-insights.js +0 -162
  119. package/lib/components/budget-insights/budget-insights.module.css +0 -61
  120. package/lib/components/budget-insights/budget-insights.stories.js +0 -165
  121. package/lib/components/budget-insights/index.js +0 -18
  122. package/lib-esm/assets/icons/alert-circle.svg +0 -1
  123. package/lib-esm/assets/icons/check-circle.svg +0 -1
  124. package/lib-esm/components/budget-info/budget-info.js +0 -57
  125. package/lib-esm/components/budget-info/budget-info.module.css +0 -40
  126. package/lib-esm/components/budget-info/budget-info.stories.js +0 -45
  127. package/lib-esm/components/budget-info/index.js +0 -1
  128. package/lib-esm/components/budget-insights/budget-insights.js +0 -112
  129. package/lib-esm/components/budget-insights/budget-insights.module.css +0 -61
  130. package/lib-esm/components/budget-insights/budget-insights.stories.js +0 -144
  131. package/lib-esm/components/budget-insights/index.js +0 -1
  132. package/src/assets/icons/alert-circle.svg +0 -1
  133. package/src/assets/icons/check-circle.svg +0 -1
  134. package/src/components/budget-info/budget-info.jsx +0 -55
  135. package/src/components/budget-info/budget-info.module.css +0 -40
  136. package/src/components/budget-info/index.js +0 -1
  137. package/src/components/budget-insights/budget-insights.jsx +0 -124
  138. package/src/components/budget-insights/budget-insights.module.css +0 -61
  139. package/src/components/budget-insights/index.js +0 -1
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React, { useContext, useEffect, useMemo } from 'react';
4
4
  import PropTypes from 'prop-types';
@@ -8,7 +8,6 @@ import { METRICS_WEBPACK_ASSETS, METRICS_WEBPACK_GENERAL, METRICS_WEBPACK_MODULE
8
8
  import { Box } from '../layout/box';
9
9
  import { Container } from '../ui/container';
10
10
  import { DuplicatePackagesWarning } from '../components/duplicate-packages-warning';
11
- import { BudgetInsights } from '../components/budget-insights';
12
11
  import { Summary } from '../components/summary';
13
12
  import { BundleAssets } from '../components/bundle-assets';
14
13
  import { BundleAssetsTotalsChartBars } from '../components/bundle-assets-totals-chart-bars';
@@ -84,8 +83,6 @@ JobsProvider.propTypes = {
84
83
  };
85
84
 
86
85
  const OverviewContent = () => {
87
- var _jobs$0$insights, _jobs$0$insights$webp;
88
-
89
86
  const {
90
87
  jobs
91
88
  } = useContext(JobsContext);
@@ -95,15 +92,10 @@ const OverviewContent = () => {
95
92
  const duplicatePackagesInsights = Boolean(duplicatePackagesCount.current || duplicatePackagesCount.baseline);
96
93
  return /*#__PURE__*/React.createElement(Stack, {
97
94
  space: "medium"
98
- }, duplicatePackagesInsights && /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Stack, {
99
- space: "small"
100
- }, /*#__PURE__*/React.createElement(DuplicatePackagesWarning, {
95
+ }, duplicatePackagesInsights && /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(DuplicatePackagesWarning, {
101
96
  duplicatePackagesCount: duplicatePackagesCount,
102
97
  showDelta: jobs.length > 1
103
- }), /*#__PURE__*/React.createElement(BudgetInsights, {
104
- source: "webpack",
105
- budgets: (_jobs$0$insights = jobs[0].insights) == null ? void 0 : (_jobs$0$insights$webp = _jobs$0$insights.webpack) == null ? void 0 : _jobs$0$insights$webp.budgets
106
- }))), /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Stack, {
98
+ })), /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Stack, {
107
99
  space: "small"
108
100
  }, /*#__PURE__*/React.createElement(TotalSizeTypeTitle, null), /*#__PURE__*/React.createElement(BundleAssetsTotalsChartBars, {
109
101
  jobs: jobs
@@ -114,7 +106,7 @@ const OverviewContent = () => {
114
106
  };
115
107
 
116
108
  const AssetsContent = () => {
117
- var _jobs$, _jobs$0$insights2, _jobs$0$insights2$web;
109
+ var _jobs$;
118
110
 
119
111
  const [bundleStatsState, bundleStatsSetState] = useComponentQueryState(COMPONENT.BUNDLE_ASSETS);
120
112
  const {
@@ -125,7 +117,6 @@ const AssetsContent = () => {
125
117
  }, /*#__PURE__*/React.createElement(Summary, {
126
118
  keys: METRICS_WEBPACK_ASSETS,
127
119
  data: jobs == null ? void 0 : (_jobs$ = jobs[0]) == null ? void 0 : _jobs$.summary,
128
- budgets: (_jobs$0$insights2 = jobs[0].insights) == null ? void 0 : (_jobs$0$insights2$web = _jobs$0$insights2.webpack) == null ? void 0 : _jobs$0$insights2$web.budgets,
129
120
  showSummaryItemDelta: (jobs == null ? void 0 : jobs.length) !== 1
130
121
  }), /*#__PURE__*/React.createElement(Box, {
131
122
  outline: true
@@ -136,7 +127,7 @@ const AssetsContent = () => {
136
127
  };
137
128
 
138
129
  const ModulesContent = () => {
139
- var _jobs$2, _jobs$0$insights3, _jobs$0$insights3$web;
130
+ var _jobs$2;
140
131
 
141
132
  const [bundleModulesState, bundleModulesSetState] = useComponentQueryState(COMPONENT.BUNDLE_MODULES);
142
133
  const {
@@ -147,7 +138,6 @@ const ModulesContent = () => {
147
138
  }, /*#__PURE__*/React.createElement(Summary, {
148
139
  keys: METRICS_WEBPACK_MODULES,
149
140
  data: jobs == null ? void 0 : (_jobs$2 = jobs[0]) == null ? void 0 : _jobs$2.summary,
150
- budgets: (_jobs$0$insights3 = jobs[0].insights) == null ? void 0 : (_jobs$0$insights3$web = _jobs$0$insights3.webpack) == null ? void 0 : _jobs$0$insights3$web.budgets,
151
141
  showSummaryItemDelta: (jobs == null ? void 0 : jobs.length) !== 1
152
142
  }), /*#__PURE__*/React.createElement(Box, {
153
143
  outline: true
@@ -158,7 +148,7 @@ const ModulesContent = () => {
158
148
  };
159
149
 
160
150
  const PackagesContent = () => {
161
- var _jobs$3, _jobs$0$insights4, _jobs$0$insights4$web;
151
+ var _jobs$3;
162
152
 
163
153
  const [bundlePackagesState, bundlePackagesSetState] = useComponentQueryState(COMPONENT.BUNDLE_PACKAGES);
164
154
  const {
@@ -169,7 +159,6 @@ const PackagesContent = () => {
169
159
  }, /*#__PURE__*/React.createElement(Summary, {
170
160
  keys: METRICS_WEBPACK_PACKAGES,
171
161
  data: jobs == null ? void 0 : (_jobs$3 = jobs[0]) == null ? void 0 : _jobs$3.summary,
172
- budgets: (_jobs$0$insights4 = jobs[0].insights) == null ? void 0 : (_jobs$0$insights4$web = _jobs$0$insights4.webpack) == null ? void 0 : _jobs$0$insights4$web.budgets,
173
162
  showSummaryItemDelta: (jobs == null ? void 0 : jobs.length) !== 1
174
163
  }), /*#__PURE__*/React.createElement(Box, {
175
164
  outline: true
@@ -181,8 +170,6 @@ const PackagesContent = () => {
181
170
  };
182
171
 
183
172
  const AppComponent = _ref3 => {
184
- var _jobs$0$insights5, _jobs$0$insights5$web;
185
-
186
173
  let {
187
174
  version,
188
175
  jobs
@@ -207,7 +194,6 @@ const AppComponent = _ref3 => {
207
194
  size: "large",
208
195
  keys: METRICS_WEBPACK_GENERAL,
209
196
  data: jobs[0].summary,
210
- budgets: (_jobs$0$insights5 = jobs[0].insights) == null ? void 0 : (_jobs$0$insights5$web = _jobs$0$insights5.webpack) == null ? void 0 : _jobs$0$insights5$web.budgets,
211
197
  showSummaryItemDelta: jobs.length !== 1
212
198
  })), /*#__PURE__*/React.createElement(Container, {
213
199
  className: css.tabsContainer
@@ -28,28 +28,7 @@ const JOBS = createJobs([CURRENT_SOURCE, BASELINE_SOURCE], {
28
28
  webpack: {
29
29
  budgets: [{
30
30
  metric: 'totalSizeByTypeALL',
31
- value: 2 * 1024 * 1024
32
- }, {
33
- metric: 'totalInitialSizeJS',
34
- value: 512 * 1024
35
- }, {
36
- metric: 'totalInitialSizeCSS',
37
- value: 50 * 1024
38
- }, {
39
- metric: 'chunkCount',
40
- value: 50
41
- }, {
42
- metric: 'moduleCount',
43
- value: 2000
44
- }, {
45
- metric: 'duplicatePackagesCount',
46
- value: 5
47
- }, {
48
- metric: 'sizes.totalSizeByTypeJS',
49
- value: 2 * 1024 * 1024
50
- }, {
51
- metric: 'sizes.totalSizeByTypeCSS',
52
- value: 20 * 1024
31
+ value: 1024 * 1024
53
32
  }]
54
33
  }
55
34
  });
@@ -1,8 +1,4 @@
1
1
  <svg width="16" height="16">
2
- <symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-alert-circle" viewBox="0 0 24 24" id="alert-circle" xmlns="http://www.w3.org/2000/svg">
3
- <circle cx="12" cy="12" r="10"/>
4
- <path d="M12 8v4M12 16h.01"/>
5
- </symbol>
6
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">
7
3
  <path d="M12 5v14M19 12l-7 7-7-7"/>
8
4
  </symbol>
@@ -14,10 +10,6 @@
14
10
  <circle cx="12" cy="12" r="10"/>
15
11
  <path d="M15 9l-6 6M9 9l6 6"/>
16
12
  </symbol>
17
- <symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-circle" viewBox="0 0 24 24" id="check-circle" xmlns="http://www.w3.org/2000/svg">
18
- <path d="M22 11.08V12a10 10 0 11-5.93-9.14"/>
19
- <path d="M22 4L12 14.01l-3-3"/>
20
- </symbol>
21
13
  <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-clock" id="clock" xmlns="http://www.w3.org/2000/svg">
22
14
  <circle cx="12" cy="12" r="10"/>
23
15
  <path d="M12 6v6l4 2"/>
@@ -1,7 +1,7 @@
1
1
  import _map from "lodash/map";
2
2
  import _find from "lodash/find";
3
3
 
4
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
5
 
6
6
  import React from 'react';
7
7
  import PropTypes from 'prop-types';
@@ -1,7 +1,7 @@
1
1
  import _map from "lodash/map";
2
2
  import _get from "lodash/get";
3
3
 
4
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
5
 
6
6
  import React, { useCallback, useMemo, useState } from 'react';
7
7
  import PropTypes from 'prop-types';
@@ -1,4 +1,5 @@
1
1
  import _get from "lodash/get";
2
+ import "core-js/modules/es.array.includes.js";
2
3
  import { ASSET_ENTRY_TYPE, ASSET_FILE_TYPE, ASSET_FILTERS, getFileType } from '@bundle-stats/utils';
3
4
  import { SORT_BY_NAME, SORT_BY_DELTA, SORT_BY_SIZE } from './bundle-assets.constants';
4
5
  export const addRowAssetFlags = row => {
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React, { useMemo } from 'react';
4
4
  import PropTypes from 'prop-types';
@@ -3,7 +3,7 @@ import _max from "lodash/max";
3
3
  import _map from "lodash/map";
4
4
  import _get from "lodash/get";
5
5
 
6
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
7
7
 
8
8
  import React from 'react';
9
9
  import PropTypes from 'prop-types';
@@ -1,51 +1,35 @@
1
- import _get from "lodash/get";
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
-
5
- import React, { useCallback, useMemo } from 'react';
3
+ import React from 'react';
6
4
  import PropTypes from 'prop-types';
7
5
  import { getBundleAssetsFileTypeComponentLink } from '@bundle-stats/utils';
8
6
  import * as webpack from '@bundle-stats/utils/lib-esm/webpack';
9
7
  import { ASSETS_SIZES_FILE_TYPE_MAP } from '../../constants';
10
- import { FlexStack } from '../../layout/flex-stack';
11
8
  import { MetricsTable } from '../metrics-table';
12
9
  import { ComponentLink } from '../component-link';
13
- import { BudgetInfo } from '../budget-info';
14
- import css from './bundle-assets-totals-table.module.css';
15
10
  export const BundleAssetsTotalsTable = _ref => {
16
- var _jobs$0$insights, _jobs$0$insights$webp, _jobs$0$insights$webp2;
17
-
18
11
  let {
19
12
  className,
20
13
  jobs,
21
14
  customComponentLink: CustomComponentLink,
22
15
  ...restProps
23
16
  } = _ref;
24
- const items = useMemo(() => webpack.compareBySection.sizes(jobs), [jobs]);
25
- const budgets = (_jobs$0$insights = jobs[0].insights) == null ? void 0 : (_jobs$0$insights$webp = _jobs$0$insights.webpack) == null ? void 0 : (_jobs$0$insights$webp2 = _jobs$0$insights$webp.budgets) == null ? void 0 : _jobs$0$insights$webp2.data;
26
- const renderRowHeader = useCallback(item => {
17
+ const items = webpack.compareBySection.sizes(jobs);
18
+
19
+ const renderRowHeader = item => {
27
20
  const fileType = ASSETS_SIZES_FILE_TYPE_MAP[item.key];
28
21
  const {
29
22
  section,
30
23
  title,
31
24
  params
32
25
  } = getBundleAssetsFileTypeComponentLink(fileType, item.label);
33
- const [_, ...metricSlugs] = item.key.split('.');
34
- const metricKey = metricSlugs.join('.');
35
-
36
- const budget = _get(budgets, metricKey);
37
-
38
26
  return /*#__PURE__*/React.createElement(CustomComponentLink, {
39
27
  section: section,
40
28
  title: title,
41
29
  params: params
42
- }, /*#__PURE__*/React.createElement(FlexStack, {
43
- space: "xxxsmall",
44
- className: css.itemTitleText
45
- }, /*#__PURE__*/React.createElement("span", null, item.label), budget && /*#__PURE__*/React.createElement(BudgetInfo, {
46
- budgetInsight: budget
47
- })));
48
- }, [CustomComponentLink]);
30
+ }, item.label);
31
+ };
32
+
49
33
  return /*#__PURE__*/React.createElement(MetricsTable, _extends({
50
34
  className: className,
51
35
  runs: jobs,
@@ -1,3 +1,3 @@
1
- .itemTitleText {
2
- align-items: center;
1
+ .title {
2
+ color: var(--color-text-light);
3
3
  }
@@ -31,22 +31,4 @@ EmptyBaseline.args = {
31
31
  jobs: createJobs([{
32
32
  webpack: currentStats
33
33
  }, null])
34
- };
35
- export const WithBudgets = Template.bind();
36
- WithBudgets.args = {
37
- jobs: createJobs([{
38
- webpack: currentStats
39
- }, {
40
- webpack: baselineStats
41
- }], {
42
- webpack: {
43
- budgets: [{
44
- metric: 'sizes.totalSizeByTypeJS',
45
- value: 2 * 1024 * 1024
46
- }, {
47
- metric: 'sizes.totalSizeByTypeCSS',
48
- value: 20 * 1024
49
- }]
50
- }
51
- })
52
34
  };
@@ -2,7 +2,7 @@ import _map from "lodash/map";
2
2
  import _isEmpty from "lodash/isEmpty";
3
3
  import _get from "lodash/get";
4
4
 
5
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
6
 
7
7
  import React, { useCallback, useMemo, useState } from 'react';
8
8
  import PropTypes from 'prop-types';
@@ -1,7 +1,7 @@
1
1
  import _map from "lodash/map";
2
2
  import _uniqBy from "lodash/uniqBy";
3
3
 
4
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
5
 
6
6
  import React, { useMemo } from 'react';
7
7
  import PropTypes from 'prop-types';
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React, { useCallback, useMemo, useState } from 'react';
4
4
  import PropTypes from 'prop-types';
@@ -1,6 +1,7 @@
1
1
  import _uniq from "lodash/uniq";
2
2
  import _flatten from "lodash/flatten";
3
3
  import _get from "lodash/get";
4
+ import "core-js/modules/es.array.includes.js";
4
5
  import { PACKAGE_FILTERS } from '@bundle-stats/utils';
5
6
  import { SORT_BY_NAME, SORT_BY_DELTA, SORT_BY_SIZE } from './bundle-packages.constants'; // Get a list of duplicate packages across jobs
6
7
 
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React, { useMemo } from 'react';
4
4
  import PropTypes from 'prop-types';
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React from 'react';
4
4
  import PropTypes from 'prop-types';
@@ -4,7 +4,6 @@ export { BundleAssetsTotalsTable } from './bundle-assets-totals-table';
4
4
  export { BundleAssetsTotalsChartBars } from './bundle-assets-totals-chart-bars';
5
5
  export { BundlePackages } from './bundle-packages';
6
6
  export { BundleModules } from './bundle-modules';
7
- export { BudgetInsights } from './budget-insights';
8
7
  export { ComponentLink } from './component-link';
9
8
  export { DuplicatePackagesWarning } from './duplicate-packages-warning';
10
9
  export { Delta } from './delta';
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React from 'react';
4
4
  import PropTypes from 'prop-types';
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React from 'react';
4
4
  import PropTypes from 'prop-types';
@@ -2,7 +2,7 @@ import _sum from "lodash/sum";
2
2
  import _isEmpty from "lodash/isEmpty";
3
3
  import _get from "lodash/get";
4
4
 
5
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
6
 
7
7
  import React, { useMemo } from 'react';
8
8
  import PropTypes from 'prop-types';
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React from 'react';
4
4
  import PropTypes from 'prop-types';
@@ -2,7 +2,7 @@ import _noop from "lodash/noop";
2
2
  import _find from "lodash/find";
3
3
  import _isEmpty from "lodash/isEmpty";
4
4
 
5
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
6
 
7
7
  import React from 'react';
8
8
  import PropTypes from 'prop-types';
@@ -1,7 +1,8 @@
1
1
  import _get from "lodash/get";
2
2
 
3
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
5
+ import "core-js/modules/es.array.includes.js";
5
6
  import React from 'react';
6
7
  import PropTypes from 'prop-types';
7
8
  import cx from 'classnames';
@@ -12,16 +13,12 @@ import { FlexStack } from '../../layout/flex-stack';
12
13
  import { ComponentLink } from '../component-link';
13
14
  import { SummaryItem } from '../summary-item';
14
15
  import css from './summary.module.css';
15
-
16
- const getSourceMetricId = fullMetricId => fullMetricId.split('.').slice(1).join('.');
17
-
18
16
  export const Summary = _ref => {
19
17
  let {
20
18
  className,
21
19
  size,
22
20
  keys,
23
21
  data,
24
- budgets,
25
22
  loading,
26
23
  showSummaryItemDelta,
27
24
  summaryItemLink: SummaryItemCustomLink
@@ -33,7 +30,7 @@ export const Summary = _ref => {
33
30
  className: css.items
34
31
  }, Array.from(METRIC_COMPONENT_LINKS).filter(_ref2 => {
35
32
  let [metricId] = _ref2;
36
- return keys.includes(getSourceMetricId(metricId));
33
+ return keys.includes(metricId);
37
34
  }).map(_ref3 => {
38
35
  let [metricId, metricOptions] = _ref3;
39
36
  return /*#__PURE__*/React.createElement(SummaryItem, _extends({
@@ -44,7 +41,6 @@ export const Summary = _ref => {
44
41
  size: size,
45
42
  id: metricId,
46
43
  data: _get(data, metricId),
47
- budget: _get(budgets, ['data', getSourceMetricId(metricId)]),
48
44
  loading: loading,
49
45
  showMetricDescription: true,
50
46
  showDelta: showSummaryItemDelta && metricOptions.showDelta !== false
@@ -54,7 +50,6 @@ export const Summary = _ref => {
54
50
  Summary.defaultProps = {
55
51
  className: '',
56
52
  data: null,
57
- budgets: null,
58
53
  loading: false,
59
54
  size: '',
60
55
  keys: METRICS_WEBPACK_GENERAL,
@@ -65,10 +60,12 @@ Summary.propTypes = {
65
60
  className: PropTypes.string,
66
61
  size: PropTypes.string,
67
62
  keys: PropTypes.arrayOf(PropTypes.string),
68
- data: PropTypes.object,
69
- // eslint-disable-line react/forbid-prop-types
70
- budgets: PropTypes.object,
71
- // eslint-disable-line react/forbid-prop-types
63
+ data: PropTypes.shape({
64
+ [PropTypes.string]: PropTypes.shape({
65
+ baseline: PropTypes.number,
66
+ current: PropTypes.number
67
+ })
68
+ }),
72
69
  loading: PropTypes.bool,
73
70
  showSummaryItemDelta: PropTypes.bool,
74
71
  summaryItemLink: PropTypes.elementType
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React from 'react';
4
4
  import { storiesOf } from '@storybook/react';
@@ -21,61 +21,6 @@ stories.addDecorator(getWrapperDecorator());
21
21
  stories.add('default', () => /*#__PURE__*/React.createElement(Summary, {
22
22
  data: MULTIPLE_JOBS[0].summary
23
23
  }));
24
- stories.add('budgets', () => /*#__PURE__*/React.createElement(Summary, {
25
- data: MULTIPLE_JOBS[0].summary,
26
- budgets: {
27
- data: {
28
- totalSizeByTypeALL: {
29
- type: 'ERROR',
30
- message: {
31
- text: 'Metric is over the budget',
32
- md: 'Metric is over the budget'
33
- },
34
- data: {
35
- currentValue: MULTIPLE_JOBS[0].summary.webpack.totalSizeByTypeALL.current,
36
- budgetValue: 1024 * 1024,
37
- failed: false
38
- }
39
- },
40
- totalInitialSizeJS: {
41
- type: 'WARNING',
42
- message: {
43
- text: 'Metric is over the budget',
44
- md: 'Metric is over the budget'
45
- },
46
- data: {
47
- currentValue: MULTIPLE_JOBS[0].summary.webpack.totalInitialSizeJS.current,
48
- budgetValue: 512 * 1024,
49
- failed: true
50
- }
51
- },
52
- totalInitialSizeCSS: {
53
- type: 'SUCCESS',
54
- message: {
55
- text: 'Metric is under the budget',
56
- md: 'Metric is under the budget'
57
- },
58
- data: {
59
- currentValue: MULTIPLE_JOBS[0].summary.webpack.totalInitialSizeCSS.current,
60
- budgetValue: 50 * 1024,
61
- failed: false
62
- }
63
- },
64
- chunkCount: {
65
- type: 'SUCCESS',
66
- message: {
67
- text: 'Metric is under the budget',
68
- md: 'Metric is under the budget'
69
- },
70
- data: {
71
- currentValue: MULTIPLE_JOBS[0].summary.webpack.chunkCount.current,
72
- budgetValue: 50,
73
- failed: false
74
- }
75
- }
76
- }
77
- }
78
- }));
79
24
  stories.add('custom keys', () => /*#__PURE__*/React.createElement(Summary, {
80
25
  keys: METRICS_WEBPACK_ASSETS,
81
26
  data: MULTIPLE_JOBS[0].summary
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React from 'react';
4
4
  import PropTypes from 'prop-types';
@@ -6,11 +6,9 @@ import cx from 'classnames';
6
6
  import { getGlobalMetricType, getMetricRunInfo } from '@bundle-stats/utils';
7
7
  import { HoverCard } from '../../ui/hover-card';
8
8
  import { Skeleton } from '../../ui/skeleton';
9
- import { FlexStack } from '../../layout/flex-stack';
10
9
  import { Stack } from '../../layout/stack';
11
10
  import { Metric } from '../metric';
12
11
  import { Delta } from '../delta';
13
- import { BudgetInfo } from '../budget-info';
14
12
  import css from './summary-item.module.css';
15
13
 
16
14
  const MetricInfo = _ref => {
@@ -44,7 +42,6 @@ export const SummaryItem = _ref2 => {
44
42
  loading,
45
43
  showDelta,
46
44
  showMetricDescription,
47
- budget,
48
45
  ...props
49
46
  } = _ref2;
50
47
  const {
@@ -62,16 +59,11 @@ export const SummaryItem = _ref2 => {
62
59
  space: "xxsmall",
63
60
  as: Component,
64
61
  className: rootClassName
65
- }, props), /*#__PURE__*/React.createElement(FlexStack, {
66
- space: "xxxsmall",
67
- as: "h3",
62
+ }, props), /*#__PURE__*/React.createElement("h3", {
68
63
  className: css.title
69
64
  }, showMetricDescriptionTooltip ? /*#__PURE__*/React.createElement(HoverCard, {
70
65
  label: metric.label
71
- }, /*#__PURE__*/React.createElement(MetricInfo, metric)) : metric.label, budget && /*#__PURE__*/React.createElement(BudgetInfo, {
72
- className: css.budgetInfo,
73
- budgetInsight: budget
74
- })), !loading ? /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Metric, {
66
+ }, /*#__PURE__*/React.createElement(MetricInfo, metric)) : metric.label), !loading ? /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Metric, {
75
67
  className: css.currentMetric,
76
68
  value: current,
77
69
  formatter: metric.formatter,
@@ -98,8 +90,7 @@ SummaryItem.defaultProps = {
98
90
  size: 'medium',
99
91
  loading: false,
100
92
  showMetricDescription: false,
101
- showDelta: true,
102
- budget: undefined
93
+ showDelta: true
103
94
  };
104
95
  SummaryItem.propTypes = {
105
96
  /** Adopted child class name */
@@ -125,9 +116,5 @@ SummaryItem.propTypes = {
125
116
  showMetricDescription: PropTypes.bool,
126
117
 
127
118
  /** Show delta */
128
- showDelta: PropTypes.bool,
129
-
130
- /** Budget insight data */
131
- budget: PropTypes.object // eslint-disable-line react/forbid-prop-types
132
-
119
+ showDelta: PropTypes.bool
133
120
  };
@@ -1,10 +1,4 @@
1
- .root {
2
- position: relative;
3
- padding-right: var(--space-xlarge);
4
- }
5
-
6
1
  .title {
7
- align-items: center;
8
2
  color: var(--color-text-ultra-light);
9
3
  font-weight: bold;
10
4
  font-size: var(--size-xsmall);