@bundle-stats/ui 3.2.0-beta.1 → 3.2.1-beta.10
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/.babelrc.js +3 -3
- package/CHANGELOG.md +11 -4
- package/lib/assets/icons/arrow.svg +1 -0
- package/lib/assets/icons/cancel.svg +1 -0
- package/lib/assets/icons/clock.svg +1 -0
- package/lib/assets/icons/close.svg +1 -0
- package/lib/assets/icons/commit.svg +1 -0
- package/lib/assets/icons/filter.svg +1 -0
- package/lib/assets/icons/help.svg +1 -0
- package/lib/assets/icons/menu.svg +1 -0
- package/lib/{ui/icon/assets → assets/icons}/sort.svg +0 -0
- package/lib/assets/icons/warning.svg +1 -0
- package/lib/assets/icons.svg +1 -0
- package/lib/components/browsertime-table/browsertime-table.stories.js +1 -0
- package/lib/components/bundle-assets/bundle-assets.js +3 -3
- package/lib/components/bundle-assets/bundle-assets.stories.js +19 -7
- package/lib/components/bundle-assets/bundle-assets.utils.js +95 -28
- package/lib/components/bundle-assets/index.js +115 -4
- package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +17 -18
- package/lib/components/bundle-modules/bundle-modules.js +3 -3
- package/lib/components/bundle-modules/bundle-modules.utils.js +152 -0
- package/lib/components/bundle-modules/index.js +135 -4
- package/lib/components/bundle-packages/bundle-packages.js +3 -3
- package/lib/components/bundle-packages/{bundle-packages.container.js → bundle-packages.utils.js} +8 -42
- package/lib/components/bundle-packages/index.js +111 -3
- package/lib/components/job-meta/job-meta.js +1 -1
- package/lib/components/metrics-table/metrics-table.js +3 -7
- package/lib/components/metrics-table-search/metrics-table-search.js +2 -1
- package/lib/components/metrics-table-search/metrics-table-search.module.css +2 -1
- package/lib/components/summary/summary.js +52 -34
- package/lib/hooks/rows-filter.js +28 -0
- package/lib/hooks/rows-sort.js +54 -0
- package/lib/{hocs/with-search.js → hooks/search-params.js} +16 -65
- package/lib/layout/box/box.js +2 -2
- package/lib/layout/stack/stack.js +13 -3
- package/lib/ui/icon/icon.js +4 -191
- package/lib/ui/sort-dropdown/sort-dropdown.js +12 -13
- package/lib/ui/sort-dropdown/sort-dropdown.stories.js +2 -2
- package/lib/utils.js +6 -3
- package/lib-esm/app/app.js +60 -70
- package/lib-esm/app/app.stories.js +50 -71
- package/lib-esm/app/header/header.js +5 -3
- package/lib-esm/assets/icons/arrow.svg +1 -0
- package/lib-esm/assets/icons/cancel.svg +1 -0
- package/lib-esm/assets/icons/clock.svg +1 -0
- package/lib-esm/assets/icons/close.svg +1 -0
- package/lib-esm/assets/icons/commit.svg +1 -0
- package/lib-esm/assets/icons/filter.svg +1 -0
- package/lib-esm/assets/icons/help.svg +1 -0
- package/lib-esm/assets/icons/menu.svg +1 -0
- package/lib-esm/{ui/icon/assets → assets/icons}/sort.svg +0 -0
- package/lib-esm/assets/icons/warning.svg +1 -0
- package/lib-esm/assets/icons.svg +1 -0
- package/lib-esm/components/asset-info/asset-info.js +21 -17
- package/lib-esm/components/asset-info/asset-info.stories.js +29 -33
- package/lib-esm/components/browsertime-table/browsertime-table.js +6 -4
- package/lib-esm/components/browsertime-table/browsertime-table.stories.js +11 -14
- package/lib-esm/components/bundle-assets/bundle-assets.constants.js +17 -15
- package/lib-esm/components/bundle-assets/bundle-assets.js +107 -97
- package/lib-esm/components/bundle-assets/bundle-assets.stories.js +58 -63
- package/lib-esm/components/bundle-assets/bundle-assets.utils.js +65 -21
- package/lib-esm/components/bundle-assets/index.js +89 -2
- package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +51 -53
- package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.stories.js +9 -13
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js +14 -13
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +13 -19
- package/lib-esm/components/bundle-modules/bundle-modules.constants.js +17 -15
- package/lib-esm/components/bundle-modules/bundle-modules.js +112 -110
- package/lib-esm/components/bundle-modules/bundle-modules.stories.js +46 -58
- package/lib-esm/components/bundle-modules/bundle-modules.utils.js +98 -0
- package/lib-esm/components/bundle-modules/index.js +114 -3
- package/lib-esm/components/bundle-packages/bundle-packages.constants.js +17 -15
- package/lib-esm/components/bundle-packages/bundle-packages.js +71 -69
- package/lib-esm/components/bundle-packages/bundle-packages.stories.js +34 -46
- package/lib-esm/components/bundle-packages/bundle-packages.utils.js +44 -0
- package/lib-esm/components/bundle-packages/index.js +87 -2
- package/lib-esm/components/component-link.js +10 -13
- package/lib-esm/components/delta/delta.js +8 -6
- package/lib-esm/components/delta/delta.stories.js +26 -38
- package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.js +11 -9
- package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.stories.js +20 -26
- package/lib-esm/components/job-header/job-header.js +14 -11
- package/lib-esm/components/job-header/job-header.stories.js +12 -18
- package/lib-esm/components/job-meta/job-meta.js +15 -18
- package/lib-esm/components/job-meta/job-meta.stories.js +10 -12
- package/lib-esm/components/job-name/job-name.js +9 -12
- package/lib-esm/components/job-name/job-name.stories.js +15 -23
- package/lib-esm/components/jobs-header/jobs-header.js +12 -12
- package/lib-esm/components/jobs-header/jobs-header.stories.js +80 -86
- package/lib-esm/components/lighthouse-table/lighthouse-table.js +6 -4
- package/lib-esm/components/lighthouse-table/lighthouse-table.stories.js +10 -14
- package/lib-esm/components/metric/metric.js +15 -19
- package/lib-esm/components/metric/metric.stories.js +36 -58
- package/lib-esm/components/metrics-table/metrics-table.js +128 -139
- package/lib-esm/components/metrics-table/metrics-table.stories.js +27 -35
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +16 -19
- package/lib-esm/components/metrics-table-options/metrics-table-options.stories.js +6 -12
- package/lib-esm/components/metrics-table-search/metrics-table-search.js +17 -18
- package/lib-esm/components/metrics-table-search/metrics-table-search.module.css +2 -1
- package/lib-esm/components/metrics-table-search/metrics-table-search.stories.js +4 -9
- package/lib-esm/components/metrics-table-title/metrics-table-title.js +9 -7
- package/lib-esm/components/module-info/module-info.js +15 -13
- package/lib-esm/components/module-info/module-info.stories.js +20 -22
- package/lib-esm/components/summary/summary.js +52 -36
- package/lib-esm/components/summary/summary.stories.js +31 -46
- package/lib-esm/components/summary-item/summary-item.js +27 -28
- package/lib-esm/components/summary-item/summary-item.stories.js +40 -50
- package/lib-esm/components/total-size-type-title/total-size-type-title.js +4 -2
- package/lib-esm/constants.js +25 -30
- package/lib-esm/hooks/rows-filter.js +20 -0
- package/lib-esm/hooks/rows-sort.js +22 -0
- package/lib-esm/hooks/search-params.js +170 -0
- package/lib-esm/layout/box/box.js +14 -21
- package/lib-esm/layout/box/box.stories.js +34 -46
- package/lib-esm/layout/flex-stack/flex-stack.js +9 -12
- package/lib-esm/layout/flex-stack/flex-stack.stories.js +39 -49
- package/lib-esm/layout/footer/footer.js +11 -11
- package/lib-esm/layout/footer/footer.stories.js +7 -11
- package/lib-esm/layout/header/header.js +10 -14
- package/lib-esm/layout/header/header.stories.js +50 -44
- package/lib-esm/layout/stack/stack.js +13 -8
- package/lib-esm/layout/stack/stack.stories.js +39 -49
- package/lib-esm/layout/sub-header/sub-header.js +14 -12
- package/lib-esm/layout/sub-header/sub-header.stories.js +57 -69
- package/lib-esm/prototypes/typography.stories.js +49 -58
- package/lib-esm/query-state.js +13 -16
- package/lib-esm/stories/wrapper.js +6 -12
- package/lib-esm/ui/alert/alert.js +6 -4
- package/lib-esm/ui/alert/alert.stories.js +14 -24
- package/lib-esm/ui/container/container.js +6 -9
- package/lib-esm/ui/container/container.stories.js +15 -17
- package/lib-esm/ui/dropdown/dropdown.js +13 -11
- package/lib-esm/ui/dropdown/dropdown.stories.js +22 -26
- package/lib-esm/ui/empty-set/empty-set.js +12 -12
- package/lib-esm/ui/empty-set/empty-set.stories.js +11 -19
- package/lib-esm/ui/file-name/file-name.js +6 -4
- package/lib-esm/ui/file-name/file-name.stories.js +12 -16
- package/lib-esm/ui/filters/filters.container.js +57 -76
- package/lib-esm/ui/filters/filters.js +71 -77
- package/lib-esm/ui/filters/filters.stories.js +82 -100
- package/lib-esm/ui/filters/filters.utils.js +26 -24
- package/lib-esm/ui/filters/index.js +1 -1
- package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.js +68 -78
- package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.stories.js +67 -77
- package/lib-esm/ui/icon/icon.js +13 -202
- package/lib-esm/ui/icon/icon.stories.js +16 -24
- package/lib-esm/ui/input/input.js +7 -10
- package/lib-esm/ui/input/input.stories.js +8 -12
- package/lib-esm/ui/loader/loader.js +6 -9
- package/lib-esm/ui/loader/loader.stories.js +5 -9
- package/lib-esm/ui/logo/logo.constants.js +6 -6
- package/lib-esm/ui/logo/logo.js +15 -15
- package/lib-esm/ui/logo/logo.stories.js +14 -22
- package/lib-esm/ui/panels/panels.js +13 -23
- package/lib-esm/ui/panels/panels.stories.js +14 -16
- package/lib-esm/ui/popover/popover.js +11 -9
- package/lib-esm/ui/popover/popover.stories.js +7 -11
- package/lib-esm/ui/skeleton/skeleton.js +6 -9
- package/lib-esm/ui/skeleton/skeleton.stories.js +2 -4
- package/lib-esm/ui/sort-dropdown/sort-dropdown.js +38 -38
- package/lib-esm/ui/sort-dropdown/sort-dropdown.stories.js +14 -16
- package/lib-esm/ui/table/table.js +26 -31
- package/lib-esm/ui/table/table.stories.js +84 -102
- package/lib-esm/ui/tabs/tabs.js +13 -21
- package/lib-esm/ui/tabs/tabs.stories.js +4 -6
- package/lib-esm/ui/toolbar/toolbar.js +7 -5
- package/lib-esm/ui/toolbar/toolbar.stories.js +14 -16
- package/lib-esm/ui/tooltip/tooltip.js +13 -16
- package/lib-esm/ui/tooltip/tooltip.stories.js +8 -12
- package/lib-esm/utils.js +20 -24
- package/package.json +30 -33
- package/src/assets/icons/arrow.svg +1 -0
- package/src/assets/icons/cancel.svg +1 -0
- package/src/assets/icons/clock.svg +1 -0
- package/src/assets/icons/close.svg +1 -0
- package/src/assets/icons/commit.svg +1 -0
- package/src/assets/icons/filter.svg +1 -0
- package/src/assets/icons/help.svg +1 -0
- package/src/assets/icons/menu.svg +1 -0
- package/src/{ui/icon/assets → assets/icons}/sort.svg +0 -0
- package/src/assets/icons/warning.svg +1 -0
- package/src/assets/icons.svg +1 -0
- package/src/components/bundle-assets/bundle-assets.jsx +3 -3
- package/src/components/bundle-assets/bundle-assets.utils.js +96 -17
- package/src/components/bundle-assets/index.jsx +89 -0
- package/src/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.jsx +15 -15
- package/src/components/bundle-modules/bundle-modules.jsx +3 -3
- package/src/components/bundle-modules/bundle-modules.utils.js +101 -0
- package/src/components/bundle-modules/index.jsx +107 -0
- package/src/components/bundle-packages/bundle-packages.jsx +3 -3
- package/src/components/bundle-packages/bundle-packages.utils.js +47 -0
- package/src/components/bundle-packages/index.jsx +84 -0
- package/src/components/job-meta/job-meta.jsx +1 -3
- package/src/components/metrics-table/metrics-table.jsx +2 -7
- package/src/components/metrics-table-search/metrics-table-search.jsx +1 -0
- package/src/components/metrics-table-search/metrics-table-search.module.css +2 -1
- package/src/components/summary/summary.jsx +26 -10
- package/src/hooks/rows-filter.js +16 -0
- package/src/hooks/rows-sort.js +24 -0
- package/src/hooks/search-params.js +153 -0
- package/src/layout/box/box.jsx +1 -1
- package/src/layout/stack/stack.jsx +2 -2
- package/src/ui/icon/icon.jsx +7 -42
- package/src/ui/sort-dropdown/sort-dropdown.jsx +11 -11
- package/src/utils.jsx +5 -3
- package/lib/components/bundle-assets/bundle-assets.container.js +0 -140
- package/lib/components/bundle-modules/bundle-modules.container.js +0 -222
- package/lib/hocs/with-custom-sort.js +0 -75
- package/lib/hocs/with-filtered-items.js +0 -54
- package/lib/ui/icon/assets/arrow.svg +0 -4
- package/lib/ui/icon/assets/branch.svg +0 -3
- package/lib/ui/icon/assets/cancel.svg +0 -4
- package/lib/ui/icon/assets/clock.svg +0 -3
- package/lib/ui/icon/assets/close.svg +0 -4
- package/lib/ui/icon/assets/commit.svg +0 -3
- package/lib/ui/icon/assets/filter.svg +0 -4
- package/lib/ui/icon/assets/help.svg +0 -4
- package/lib/ui/icon/assets/job.svg +0 -3
- package/lib/ui/icon/assets/menu.svg +0 -4
- package/lib/ui/icon/assets/package.svg +0 -3
- package/lib/ui/icon/assets/pull-request.svg +0 -3
- package/lib/ui/icon/assets/repository.svg +0 -3
- package/lib/ui/icon/assets/warning.svg +0 -4
- package/lib-esm/components/bundle-assets/bundle-assets.container.js +0 -119
- package/lib-esm/components/bundle-modules/bundle-modules.container.js +0 -175
- package/lib-esm/components/bundle-packages/bundle-packages.container.js +0 -91
- package/lib-esm/hocs/with-custom-sort.js +0 -43
- package/lib-esm/hocs/with-filtered-items.js +0 -35
- package/lib-esm/hocs/with-search.js +0 -214
- package/lib-esm/ui/icon/assets/arrow.svg +0 -4
- package/lib-esm/ui/icon/assets/branch.svg +0 -3
- package/lib-esm/ui/icon/assets/cancel.svg +0 -4
- package/lib-esm/ui/icon/assets/clock.svg +0 -3
- package/lib-esm/ui/icon/assets/close.svg +0 -4
- package/lib-esm/ui/icon/assets/commit.svg +0 -3
- package/lib-esm/ui/icon/assets/filter.svg +0 -4
- package/lib-esm/ui/icon/assets/help.svg +0 -4
- package/lib-esm/ui/icon/assets/job.svg +0 -3
- package/lib-esm/ui/icon/assets/menu.svg +0 -4
- package/lib-esm/ui/icon/assets/package.svg +0 -3
- package/lib-esm/ui/icon/assets/pull-request.svg +0 -3
- package/lib-esm/ui/icon/assets/repository.svg +0 -3
- package/lib-esm/ui/icon/assets/warning.svg +0 -4
- package/src/components/bundle-assets/bundle-assets.container.js +0 -146
- package/src/components/bundle-assets/index.js +0 -4
- package/src/components/bundle-modules/bundle-modules.container.js +0 -158
- package/src/components/bundle-modules/index.js +0 -4
- package/src/components/bundle-packages/bundle-packages.container.js +0 -93
- package/src/components/bundle-packages/index.js +0 -4
- package/src/hocs/with-custom-sort.jsx +0 -35
- package/src/hocs/with-filtered-items.jsx +0 -34
- package/src/hocs/with-search.jsx +0 -184
- package/src/ui/icon/assets/arrow.svg +0 -4
- package/src/ui/icon/assets/branch.svg +0 -3
- package/src/ui/icon/assets/cancel.svg +0 -4
- package/src/ui/icon/assets/clock.svg +0 -3
- package/src/ui/icon/assets/close.svg +0 -4
- package/src/ui/icon/assets/commit.svg +0 -3
- package/src/ui/icon/assets/filter.svg +0 -4
- package/src/ui/icon/assets/help.svg +0 -4
- package/src/ui/icon/assets/job.svg +0 -3
- package/src/ui/icon/assets/menu.svg +0 -4
- package/src/ui/icon/assets/package.svg +0 -3
- package/src/ui/icon/assets/pull-request.svg +0 -3
- package/src/ui/icon/assets/repository.svg +0 -3
- package/src/ui/icon/assets/warning.svg +0 -4
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import _noop from "lodash/noop";
|
|
2
|
-
import _merge from "lodash/merge";
|
|
3
|
-
import _isEqual from "lodash/isEqual";
|
|
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); }
|
|
6
|
-
|
|
7
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
8
|
-
|
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
10
|
-
|
|
11
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
-
|
|
13
|
-
import React, { useCallback, useEffect, useReducer } from 'react';
|
|
14
|
-
import PropTypes from 'prop-types';
|
|
15
|
-
var ACTION_SET_FILTERS = 'SET_FILTERS';
|
|
16
|
-
var ACTION_SET_SEARCH = 'SET_SEARCH';
|
|
17
|
-
var ACTION_RESET_DEFAULT = 'RESET_DEFAULT';
|
|
18
|
-
var ACTION_RESET_ALL = 'RESET_ALL';
|
|
19
|
-
var ACTION_SET = 'SET';
|
|
20
|
-
|
|
21
|
-
var getSearchPattern = function getSearchPattern(search) {
|
|
22
|
-
var searchPattern = new RegExp(/.*/);
|
|
23
|
-
|
|
24
|
-
if (!search || !search.trim()) {
|
|
25
|
-
return searchPattern;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
searchPattern = new RegExp(search, 'i');
|
|
30
|
-
} catch (err) {
|
|
31
|
-
// noop
|
|
32
|
-
console.error(err); // eslint-disable-line no-console
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return searchPattern;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
var getSearchReducer = function getSearchReducer(_ref) {
|
|
39
|
-
var defaultFilters = _ref.defaultFilters,
|
|
40
|
-
allEntriesFilters = _ref.allEntriesFilters,
|
|
41
|
-
setParentState = _ref.setParentState;
|
|
42
|
-
return function (state, action) {
|
|
43
|
-
var type = action.type,
|
|
44
|
-
payload = action.payload;
|
|
45
|
-
|
|
46
|
-
switch (type) {
|
|
47
|
-
case ACTION_SET_FILTERS:
|
|
48
|
-
{
|
|
49
|
-
setParentState({
|
|
50
|
-
filters: payload,
|
|
51
|
-
search: state.search
|
|
52
|
-
});
|
|
53
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
54
|
-
filters: payload
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
case ACTION_SET_SEARCH:
|
|
59
|
-
{
|
|
60
|
-
setParentState({
|
|
61
|
-
filters: state.filters,
|
|
62
|
-
search: payload
|
|
63
|
-
});
|
|
64
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
65
|
-
search: payload,
|
|
66
|
-
searchPattern: getSearchPattern(payload)
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
case ACTION_RESET_DEFAULT:
|
|
71
|
-
{
|
|
72
|
-
setParentState({
|
|
73
|
-
filters: defaultFilters,
|
|
74
|
-
search: ''
|
|
75
|
-
});
|
|
76
|
-
return {
|
|
77
|
-
filters: defaultFilters,
|
|
78
|
-
search: '',
|
|
79
|
-
searchPattern: getSearchPattern()
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
case ACTION_RESET_ALL:
|
|
84
|
-
{
|
|
85
|
-
setParentState({
|
|
86
|
-
filters: allEntriesFilters,
|
|
87
|
-
search: ''
|
|
88
|
-
});
|
|
89
|
-
return {
|
|
90
|
-
filters: allEntriesFilters,
|
|
91
|
-
search: '',
|
|
92
|
-
searchPattern: getSearchPattern()
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
case ACTION_SET:
|
|
97
|
-
{
|
|
98
|
-
return payload;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
default:
|
|
102
|
-
return state;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export var generateState = function generateState(filters, search) {
|
|
108
|
-
return {
|
|
109
|
-
filters: filters,
|
|
110
|
-
search: search,
|
|
111
|
-
searchPattern: getSearchPattern(search)
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
export var useSearch = function useSearch(_ref2) {
|
|
115
|
-
var setParentState = _ref2.setState,
|
|
116
|
-
parentSearch = _ref2.search,
|
|
117
|
-
parentFilters = _ref2.filters,
|
|
118
|
-
defaultFilters = _ref2.defaultFilters,
|
|
119
|
-
allEntriesFilters = _ref2.allEntriesFilters;
|
|
120
|
-
// When we pass custom filters, set the other flags to true(allEntries)
|
|
121
|
-
var initialFilters = parentFilters ? _merge({}, allEntriesFilters, parentFilters) : defaultFilters;
|
|
122
|
-
|
|
123
|
-
var _useReducer = useReducer(getSearchReducer({
|
|
124
|
-
defaultFilters: defaultFilters,
|
|
125
|
-
allEntriesFilters: allEntriesFilters,
|
|
126
|
-
setParentState: setParentState
|
|
127
|
-
}), generateState(initialFilters, parentSearch)),
|
|
128
|
-
_useReducer$ = _useReducer[0],
|
|
129
|
-
search = _useReducer$.search,
|
|
130
|
-
searchPattern = _useReducer$.searchPattern,
|
|
131
|
-
filters = _useReducer$.filters,
|
|
132
|
-
dispatch = _useReducer[1]; // Update state when the custom filters/search are changing - initial load or route updates
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
useEffect(function () {
|
|
136
|
-
// Run a deep comparison to prevent circular setState triggering
|
|
137
|
-
if (parentSearch === search || _isEqual(parentFilters, filters)) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
dispatch({
|
|
142
|
-
type: ACTION_SET,
|
|
143
|
-
payload: generateState(initialFilters, parentSearch)
|
|
144
|
-
});
|
|
145
|
-
}, [search, filters, parentFilters, parentSearch]);
|
|
146
|
-
var handleUpdateSearch = useCallback(function (newValue) {
|
|
147
|
-
dispatch({
|
|
148
|
-
type: ACTION_SET_SEARCH,
|
|
149
|
-
payload: newValue
|
|
150
|
-
});
|
|
151
|
-
}, []);
|
|
152
|
-
var handleUpdateFilters = useCallback(function (newFilters) {
|
|
153
|
-
dispatch({
|
|
154
|
-
type: ACTION_SET_FILTERS,
|
|
155
|
-
payload: newFilters
|
|
156
|
-
});
|
|
157
|
-
}, []);
|
|
158
|
-
var handleResetFilters = useCallback(function () {
|
|
159
|
-
dispatch({
|
|
160
|
-
type: ACTION_RESET_DEFAULT
|
|
161
|
-
});
|
|
162
|
-
}, []);
|
|
163
|
-
var handleResetAllFilters = useCallback(function () {
|
|
164
|
-
dispatch({
|
|
165
|
-
type: ACTION_RESET_ALL
|
|
166
|
-
});
|
|
167
|
-
}, []);
|
|
168
|
-
return {
|
|
169
|
-
search: search,
|
|
170
|
-
updateSearch: handleUpdateSearch,
|
|
171
|
-
searchPattern: searchPattern,
|
|
172
|
-
updateFilters: handleUpdateFilters,
|
|
173
|
-
resetFilters: handleResetFilters,
|
|
174
|
-
resetAllFilters: handleResetAllFilters,
|
|
175
|
-
filters: filters,
|
|
176
|
-
hasActiveFilters: !_isEqual(allEntriesFilters, filters)
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
export var withSearch = function withSearch() {
|
|
180
|
-
return function (BaseComponent) {
|
|
181
|
-
var WithSearch = function WithSearch(props) {
|
|
182
|
-
var allEntriesFilters = props.allEntriesFilters,
|
|
183
|
-
defaultFilters = props.defaultFilters,
|
|
184
|
-
filters = props.filters,
|
|
185
|
-
search = props.search,
|
|
186
|
-
setState = props.setState;
|
|
187
|
-
var searchProps = useSearch({
|
|
188
|
-
search: search,
|
|
189
|
-
filters: filters,
|
|
190
|
-
setState: setState,
|
|
191
|
-
defaultFilters: defaultFilters,
|
|
192
|
-
allEntriesFilters: allEntriesFilters
|
|
193
|
-
});
|
|
194
|
-
return /*#__PURE__*/React.createElement(BaseComponent, _extends({}, props, searchProps));
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
WithSearch.defaultProps = {
|
|
198
|
-
filters: null,
|
|
199
|
-
setState: _noop,
|
|
200
|
-
search: ''
|
|
201
|
-
};
|
|
202
|
-
WithSearch.propTypes = {
|
|
203
|
-
allEntriesFilters: PropTypes.object.isRequired,
|
|
204
|
-
// eslint-disable-line react/forbid-prop-types
|
|
205
|
-
defaultFilters: PropTypes.object.isRequired,
|
|
206
|
-
// eslint-disable-line react/forbid-prop-types
|
|
207
|
-
filters: PropTypes.object,
|
|
208
|
-
// eslint-disable-line react/forbid-prop-types
|
|
209
|
-
search: PropTypes.string,
|
|
210
|
-
setState: PropTypes.func
|
|
211
|
-
};
|
|
212
|
-
return WithSearch;
|
|
213
|
-
};
|
|
214
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 640 1024" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
|
2
|
-
<path d="M512 192c-70.625 0-128 57.344-128 128 0 47.219 25.875 88.062 64 110.281V448s0 128-128 128c-53.062 0-94.656 11.375-128 28.812V302.281c38.156-22.219 64-63.062 64-110.281 0-70.656-57.344-128-128-128S0 121.344 0 192c0 47.219 25.844 88.062 64 110.281V721.75C25.844 743.938 0 784.75 0 832c0 70.625 57.344 128 128 128s128-57.375 128-128c0-33.5-13.188-63.75-34.25-86.625C240.375 722.5 270.656 704 320 704c254 0 256-256 256-256v-17.719c38.125-22.219 64-63.062 64-110.281 0-70.656-57.375-128-128-128zm-384-64c35.406 0 64 28.594 64 64s-28.594 64-64 64-64-28.594-64-64 28.594-64 64-64zm0 768c-35.406 0-64-28.625-64-64 0-35.312 28.594-64 64-64s64 28.688 64 64c0 35.375-28.594 64-64 64zm384-512c-35.375 0-64-28.594-64-64s28.625-64 64-64 64 28.594 64 64-28.625 64-64 64z"/>
|
|
3
|
-
</svg>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="currentColor">
|
|
2
|
-
<path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"/>
|
|
3
|
-
<path d="M0 0h24v24H0z" fill="none"/>
|
|
4
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 896 1024" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
|
2
|
-
<path d="M694.875 448C666.375 337.781 567.125 256 448 256c-119.094 0-218.375 81.781-246.906 192H0v128h201.094C229.625 686.25 328.906 768 448 768c119.125 0 218.375-81.75 246.875-192H896V448H694.875zM448 640c-70.656 0-128-57.375-128-128 0-70.656 57.344-128 128-128 70.625 0 128 57.344 128 128 0 70.625-57.375 128-128 128z"/>
|
|
3
|
-
</svg>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
2
|
-
<path d="M0 0h24v24H0z" fill="none"/>
|
|
3
|
-
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"/>
|
|
4
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor">
|
|
2
|
-
<path d="M73.1 54.9c10.1 0 18.3 8.2 18.3 18.3s-8.2 18.3-18.3 18.3-18.3-8.2-18.3-18.3S63 54.9 73.1 54.9zM256 201.1c0 30.3-24.6 54.9-54.9 54.9h-128l54.9-54.9h23.2c6.3 10.9 18.1 18.3 31.7 18.3 20.2 0 36.6-16.4 36.6-36.6s-16.4-36.6-36.6-36.6c-13.5 0-25.4 7.4-31.7 18.3h-41.5L26.3 248C10.5 238.4 0 221 0 201.1V54.9C0 24.6 24.6 0 54.9 0v41.5C44 47.8 36.6 59.6 36.6 73.2c0 20.2 16.4 36.6 36.6 36.6 13.5 0 25.3-7.3 31.6-18.2l46.4-.1c6.3 10.9 18.1 18.3 31.7 18.3 20.2 0 36.6-16.4 36.6-36.6s-16.4-36.6-36.6-36.6c-13.5 0-25.4 7.4-31.7 18.3l-46.3.1c-3.2-5.6-7.9-10.2-13.4-13.5V0h109.7C231.4 0 256 24.6 256 54.9v146.2zm-91.4-18.2c0-10.1 8.2-18.3 18.3-18.3s18.3 8.2 18.3 18.3-8.2 18.3-18.3 18.3-18.3-8.2-18.3-18.3zm0-109.8c0-10.1 8.2-18.3 18.3-18.3s18.3 8.2 18.3 18.3-8.2 18.3-18.3 18.3-18.3-8.2-18.3-18.3z"/>
|
|
3
|
-
</svg>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
|
2
|
-
<path d="M0 0h24v24H0z" fill="none"/>
|
|
3
|
-
<path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>
|
|
4
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
|
2
|
-
<path d="M480 64L0 192v576l480 128 480-128V192L480 64zM63.875 720.934L63.5 288l384.498 102.533.001 432.833L63.875 720.934zM63.5 224l160.254-42.734L640 292.265v.135l-160 42.667L63.5 224zm832.625 496.934L512.001 823.366l.001-432.833L640 356.4v156l128-34.135V322.267L896.5 288l-.375 432.934zM768 258.267v-.125L351.734 147.138 480 112.934 896.5 224 768 258.267z"/>
|
|
3
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 768 1024" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
|
2
|
-
<path d="M128 64C57.344 64 0 121.344 0 192c0 47.219 25.906 88.062 64 110.281V721.75C25.906 743.938 0 784.75 0 832c0 70.625 57.344 128 128 128s128-57.375 128-128c0-47.25-25.844-88.062-64-110.25V302.281c38.156-22.219 64-63.062 64-110.281 0-70.656-57.344-128-128-128zm0 832c-35.312 0-64-28.625-64-64 0-35.312 28.688-64 64-64 35.406 0 64 28.688 64 64 0 35.375-28.594 64-64 64zm0-640c-35.312 0-64-28.594-64-64s28.688-64 64-64c35.406 0 64 28.594 64 64s-28.594 64-64 64zm576 465.75V320c0-192.5-192-192-192-192h-64V0L256 192l192 192V256h64c56.438 0 64 64 64 64v401.75c-38.125 22.188-64 62.938-64 110.25 0 70.625 57.375 128 128 128s128-57.375 128-128c0-47.25-25.875-88.062-64-110.25zM640 896c-35.312 0-64-28.625-64-64 0-35.312 28.688-64 64-64 35.375 0 64 28.688 64 64 0 35.375-28.625 64-64 64z"/>
|
|
3
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor">
|
|
2
|
-
<path d="M112 64H96v16h16V64zm0-32H96v16h16V32zm96-32H48S32 0 32 16v192c0 16 16 16 16 16h32v32l24-24 24 24v-32h80s16-.3 16-16V16c0-16-16-16-16-16zm0 192c0 15.4-16 16-16 16h-64v-16H80v16H64c-16 0-16-16-16-16v-16h160v16zm0-32H80V16h128.2l-.2 144zm-96-32H96v16h16v-16zm0-32H96v16h16V96z"/>
|
|
3
|
-
</svg>
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { compose, withProps } from 'recompose';
|
|
3
|
-
import { get } from 'lodash';
|
|
4
|
-
import * as webpack from '@bundle-stats/utils/lib-esm/webpack';
|
|
5
|
-
import {
|
|
6
|
-
ASSET_ENTRY_TYPE,
|
|
7
|
-
ASSET_FILE_TYPE,
|
|
8
|
-
ASSET_FILTERS,
|
|
9
|
-
getAssetEntryTypeFilters,
|
|
10
|
-
getAssetFileTypeFilters,
|
|
11
|
-
getFileType,
|
|
12
|
-
} from '@bundle-stats/utils';
|
|
13
|
-
|
|
14
|
-
import { withCustomSort } from '../../hocs/with-custom-sort';
|
|
15
|
-
import { withFilteredItems } from '../../hocs/with-filtered-items';
|
|
16
|
-
import { withSearch } from '../../hocs/with-search';
|
|
17
|
-
import {
|
|
18
|
-
SORT_BY_NAME,
|
|
19
|
-
SORT_BY_DELTA,
|
|
20
|
-
SORT_BY_SIZE,
|
|
21
|
-
SORT_BY,
|
|
22
|
-
} from './bundle-assets.constants';
|
|
23
|
-
|
|
24
|
-
const addRowAssetFlags = (row) => {
|
|
25
|
-
const { runs } = row;
|
|
26
|
-
|
|
27
|
-
const isEntry = runs.map((run) => run?.isEntry).includes(true);
|
|
28
|
-
const isInitial = runs.map((run) => run?.isInitial).includes(true);
|
|
29
|
-
const isChunk = runs.map((run) => run?.isChunk).includes(true);
|
|
30
|
-
|
|
31
|
-
const isAsset = !(isEntry || isInitial || isChunk);
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
...row,
|
|
35
|
-
isEntry,
|
|
36
|
-
isInitial,
|
|
37
|
-
isChunk,
|
|
38
|
-
isAsset,
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const getIsNotPredictive = (key, runs) =>
|
|
43
|
-
runs.reduce((agg, current, index) => {
|
|
44
|
-
if (agg) {
|
|
45
|
-
return agg;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (index + 1 === runs.length) {
|
|
49
|
-
return agg;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
current &&
|
|
54
|
-
runs[index + 1] &&
|
|
55
|
-
current.delta !== 0 &&
|
|
56
|
-
key !== current.name &&
|
|
57
|
-
current.name === runs[index + 1].name
|
|
58
|
-
) {
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return agg;
|
|
63
|
-
}, false);
|
|
64
|
-
|
|
65
|
-
const addRowIsNotPredictive = (row) => ({
|
|
66
|
-
...row,
|
|
67
|
-
isNotPredictive: getIsNotPredictive(row.key, row.runs),
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
const getRowFilter = (filters) => (item) => {
|
|
71
|
-
if (filters[ASSET_FILTERS.CHANGED] && !item.changed) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (
|
|
76
|
-
!(
|
|
77
|
-
(filters[`${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.ENTRY}`] && item.isEntry) ||
|
|
78
|
-
(filters[`${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.INITIAL}`] && item.isInitial) ||
|
|
79
|
-
(filters[`${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.CHUNK}`] && item.isChunk) ||
|
|
80
|
-
(filters[`${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.ASSET}`] && item.isAsset)
|
|
81
|
-
)
|
|
82
|
-
) {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (!filters[`${ASSET_FILE_TYPE}.${getFileType(item.key)}`]) {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return true;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const getCustomSort = (sortId) => (item) => {
|
|
94
|
-
if (sortId === SORT_BY_NAME) {
|
|
95
|
-
return item.key;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (sortId === SORT_BY_DELTA) {
|
|
99
|
-
return get(item, 'runs[0].deltaPercentage', 0);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (sortId === SORT_BY_SIZE) {
|
|
103
|
-
return get(item, 'runs[0].value', 0);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return [
|
|
107
|
-
!item.isNotPredictive,
|
|
108
|
-
!item.changed,
|
|
109
|
-
!item.isInitial,
|
|
110
|
-
!item.isEntry,
|
|
111
|
-
!item.isChunk,
|
|
112
|
-
item.key,
|
|
113
|
-
];
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export const enhance = compose(
|
|
117
|
-
withProps(({ jobs }) => {
|
|
118
|
-
const items = useMemo(
|
|
119
|
-
() => webpack.compareBySection.assets(jobs, [addRowAssetFlags, addRowIsNotPredictive]),
|
|
120
|
-
[jobs]
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
const defaultFilters = {
|
|
124
|
-
[ASSET_FILTERS.CHANGED]: jobs?.length > 1,
|
|
125
|
-
...getAssetEntryTypeFilters(true),
|
|
126
|
-
...getAssetFileTypeFilters(true),
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const allEntriesFilters = {
|
|
130
|
-
[ASSET_FILTERS.CHANGED]: false,
|
|
131
|
-
...getAssetEntryTypeFilters(true),
|
|
132
|
-
...getAssetFileTypeFilters(true),
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
return {
|
|
136
|
-
items,
|
|
137
|
-
totalRowCount: items.length,
|
|
138
|
-
defaultFilters,
|
|
139
|
-
allEntriesFilters,
|
|
140
|
-
};
|
|
141
|
-
}),
|
|
142
|
-
|
|
143
|
-
withSearch(),
|
|
144
|
-
withFilteredItems(getRowFilter),
|
|
145
|
-
withCustomSort({ sortItems: SORT_BY, getCustomSort }),
|
|
146
|
-
);
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { compose, withProps } from 'recompose';
|
|
3
|
-
import { get, map, max, merge, intersection, uniqBy } from 'lodash';
|
|
4
|
-
import * as webpack from '@bundle-stats/utils/lib-esm/webpack';
|
|
5
|
-
import {
|
|
6
|
-
MODULE_CHUNK,
|
|
7
|
-
MODULE_FILTERS,
|
|
8
|
-
MODULE_FILE_TYPE,
|
|
9
|
-
MODULE_SOURCE_TYPE,
|
|
10
|
-
getModuleChunkFilters,
|
|
11
|
-
getModuleSourceTypeFilters,
|
|
12
|
-
getModuleFileTypeFilters,
|
|
13
|
-
getModuleSourceFileType,
|
|
14
|
-
} from '@bundle-stats/utils';
|
|
15
|
-
|
|
16
|
-
import { withCustomSort } from '../../hocs/with-custom-sort';
|
|
17
|
-
import { withFilteredItems } from '../../hocs/with-filtered-items';
|
|
18
|
-
import { withSearch } from '../../hocs/with-search';
|
|
19
|
-
import { SORT_BY_NAME, SORT_BY_SIZE, SORT_BY_DELTA, SORT_BY } from './bundle-modules.constants';
|
|
20
|
-
|
|
21
|
-
const addRowSourceFlag = (row) => {
|
|
22
|
-
const { key } = row;
|
|
23
|
-
const thirdParty = Boolean(key.match(webpack.MODULE_PATH_PACKAGES));
|
|
24
|
-
return { ...row, thirdParty };
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const getCustomSort = (sortBy) => (item) => {
|
|
28
|
-
if (sortBy === SORT_BY_NAME) {
|
|
29
|
-
return item.key;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (sortBy === SORT_BY_SIZE) {
|
|
33
|
-
return get(item, 'runs[0].value', 0);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (sortBy === SORT_BY_DELTA) {
|
|
37
|
-
return get(item, 'runs[0].deltaPercentage', 0);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return [!item.changed, item.key];
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const getRowFilter = (filters) => (row) => {
|
|
44
|
-
// Skip not changed rows
|
|
45
|
-
if (filters[MODULE_FILTERS.CHANGED] && !row.changed) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Skip not matching source type
|
|
50
|
-
if (
|
|
51
|
-
!(
|
|
52
|
-
(filters[`${MODULE_SOURCE_TYPE}.${MODULE_FILTERS.FIRST_PARTY}`] && row.thirdParty === false) ||
|
|
53
|
-
(filters[`${MODULE_SOURCE_TYPE}.${MODULE_FILTERS.THIRD_PARTY}`] && row.thirdParty === true)
|
|
54
|
-
)
|
|
55
|
-
) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Skip not matching source file types
|
|
60
|
-
const fileType = getModuleSourceFileType(row.key);
|
|
61
|
-
if (!filters[`${MODULE_FILE_TYPE}.${fileType}`]) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return true;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export default compose(
|
|
69
|
-
withProps((props) => {
|
|
70
|
-
const { jobs } = props;
|
|
71
|
-
const chunks = uniqBy(
|
|
72
|
-
jobs.map((job) => job?.meta?.webpack?.chunks || []).flat(),
|
|
73
|
-
({ id }) => id,
|
|
74
|
-
);
|
|
75
|
-
const chunkIds = map(chunks, 'id');
|
|
76
|
-
|
|
77
|
-
const defaultFilters = {
|
|
78
|
-
changed: jobs?.length > 1,
|
|
79
|
-
...getModuleSourceTypeFilters(true),
|
|
80
|
-
...getModuleChunkFilters(chunkIds, true),
|
|
81
|
-
...getModuleFileTypeFilters(true),
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const allEntriesFilters = {
|
|
85
|
-
changed: false,
|
|
86
|
-
...getModuleSourceTypeFilters(true),
|
|
87
|
-
...getModuleChunkFilters(chunkIds, true),
|
|
88
|
-
...getModuleFileTypeFilters(true),
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
return {
|
|
92
|
-
defaultFilters,
|
|
93
|
-
allEntriesFilters,
|
|
94
|
-
chunks,
|
|
95
|
-
chunkIds,
|
|
96
|
-
};
|
|
97
|
-
}),
|
|
98
|
-
withSearch(),
|
|
99
|
-
withProps((props) => {
|
|
100
|
-
const { jobs, chunkIds, filters } = props;
|
|
101
|
-
|
|
102
|
-
// List of chunkIds with filter value set to `true`
|
|
103
|
-
const includedChunkIds = chunkIds.reduce((agg, chunkId) => {
|
|
104
|
-
if (get(filters, `${MODULE_CHUNK}.${chunkId}`)) {
|
|
105
|
-
return [...agg, chunkId];
|
|
106
|
-
}
|
|
107
|
-
return agg;
|
|
108
|
-
}, []);
|
|
109
|
-
|
|
110
|
-
// If all the filters are included, return jobs as they are
|
|
111
|
-
if (includedChunkIds.length === chunkIds.length) {
|
|
112
|
-
return { jobs };
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const jobsWithFilteredData = jobs.map((job) => {
|
|
116
|
-
const { modules } = job?.metrics?.webpack || {};
|
|
117
|
-
|
|
118
|
-
const filteredModules = Object.entries(modules).reduce((agg, [moduleId, moduleEntry]) => {
|
|
119
|
-
const match = intersection(moduleEntry.chunkIds, includedChunkIds);
|
|
120
|
-
|
|
121
|
-
if (match.length > 0) {
|
|
122
|
-
agg[moduleId] = moduleEntry; // eslint-disable-line no-param-reassign
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return agg;
|
|
126
|
-
}, {});
|
|
127
|
-
|
|
128
|
-
// Copy job data into a new object to prevent mutations of the original data
|
|
129
|
-
const newJob = merge({}, job);
|
|
130
|
-
newJob.metrics.webpack.modules = filteredModules;
|
|
131
|
-
|
|
132
|
-
return newJob;
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
return { jobs: jobsWithFilteredData };
|
|
136
|
-
}),
|
|
137
|
-
withProps(({ jobs }) => {
|
|
138
|
-
const { items, totalRowCount } = useMemo(
|
|
139
|
-
() => ({
|
|
140
|
-
items: webpack.compareBySection.modules(jobs, [addRowSourceFlag]),
|
|
141
|
-
/*
|
|
142
|
-
* total amount of rows depends on the way the modules are merged before any filtering.
|
|
143
|
-
* to avoid running an expensive operation before filtering, we just show the total amount of
|
|
144
|
-
* rows to be the max count between different runs
|
|
145
|
-
*/
|
|
146
|
-
totalRowCount: max(jobs.map((job) => Object.values(job?.metrics?.webpack?.modules || {}).length)),
|
|
147
|
-
}),
|
|
148
|
-
[jobs],
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
return {
|
|
152
|
-
totalRowCount,
|
|
153
|
-
items,
|
|
154
|
-
};
|
|
155
|
-
}),
|
|
156
|
-
withFilteredItems(getRowFilter),
|
|
157
|
-
withCustomSort({ sortItems: SORT_BY, getCustomSort }),
|
|
158
|
-
);
|