@bundle-stats/ui 3.1.4-alpha.0 → 3.2.1-alpha.0

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 (276) hide show
  1. package/.babelrc.js +3 -3
  2. package/CHANGELOG.md +18 -1
  3. package/lib/app/app.js +2 -1
  4. package/lib/app/app.stories.js +2 -1
  5. package/lib/assets/icons/arrow.svg +1 -0
  6. package/lib/assets/icons/cancel.svg +1 -0
  7. package/lib/assets/icons/clock.svg +1 -0
  8. package/lib/assets/icons/close.svg +1 -0
  9. package/lib/assets/icons/commit.svg +1 -0
  10. package/lib/assets/icons/filter.svg +1 -0
  11. package/lib/assets/icons/help.svg +1 -0
  12. package/lib/assets/icons/menu.svg +1 -0
  13. package/lib/{ui/icon/assets → assets/icons}/sort.svg +0 -0
  14. package/lib/assets/icons/warning.svg +1 -0
  15. package/lib/assets/icons.svg +1 -0
  16. package/lib/components/bundle-assets/bundle-assets.constants.js +1 -1
  17. package/lib/components/bundle-assets/bundle-assets.js +3 -3
  18. package/lib/components/bundle-assets/bundle-assets.stories.js +19 -7
  19. package/lib/components/bundle-assets/bundle-assets.utils.js +95 -28
  20. package/lib/components/bundle-assets/index.js +115 -4
  21. package/lib/components/bundle-modules/bundle-modules.constants.js +1 -1
  22. package/lib/components/bundle-modules/bundle-modules.js +3 -3
  23. package/lib/components/bundle-modules/bundle-modules.utils.js +152 -0
  24. package/lib/components/bundle-modules/index.js +135 -4
  25. package/lib/components/bundle-packages/bundle-packages.constants.js +1 -1
  26. package/lib/components/bundle-packages/bundle-packages.js +27 -7
  27. package/lib/components/bundle-packages/bundle-packages.module.css +5 -0
  28. package/lib/components/bundle-packages/{bundle-packages.container.js → bundle-packages.utils.js} +8 -42
  29. package/lib/components/bundle-packages/index.js +111 -3
  30. package/lib/components/duplicate-packages-warning/duplicate-packages-warning.js +7 -4
  31. package/lib/components/duplicate-packages-warning/duplicate-packages-warning.stories.js +4 -3
  32. package/lib/components/index.js +18 -18
  33. package/lib/components/metrics-table/metrics-table.js +3 -7
  34. package/lib/components/metrics-table-search/metrics-table-search.js +2 -1
  35. package/lib/components/metrics-table-search/metrics-table-search.module.css +2 -1
  36. package/lib/constants.js +1 -1
  37. package/lib/hooks/rows-filter.js +28 -0
  38. package/lib/hooks/rows-sort.js +54 -0
  39. package/lib/{hocs/with-search.js → hooks/search-params.js} +15 -64
  40. package/lib/layout/index.js +8 -8
  41. package/lib/ui/icon/icon.js +4 -191
  42. package/lib/ui/logo/logo.constants.js +1 -1
  43. package/lib/ui/popover/popover.js +3 -1
  44. package/lib/ui/popover/popover.module.css +3 -3
  45. package/lib/ui/sort-dropdown/sort-dropdown.js +12 -13
  46. package/lib/ui/sort-dropdown/sort-dropdown.stories.js +2 -2
  47. package/lib/ui/tooltip/tooltip.js +2 -1
  48. package/lib-esm/app/app.js +89 -108
  49. package/lib-esm/app/app.stories.js +50 -70
  50. package/lib-esm/app/header/header.js +19 -20
  51. package/lib-esm/assets/icons/arrow.svg +1 -0
  52. package/lib-esm/assets/icons/cancel.svg +1 -0
  53. package/lib-esm/assets/icons/clock.svg +1 -0
  54. package/lib-esm/assets/icons/close.svg +1 -0
  55. package/lib-esm/assets/icons/commit.svg +1 -0
  56. package/lib-esm/assets/icons/filter.svg +1 -0
  57. package/lib-esm/assets/icons/help.svg +1 -0
  58. package/lib-esm/assets/icons/menu.svg +1 -0
  59. package/lib-esm/{ui/icon/assets → assets/icons}/sort.svg +0 -0
  60. package/lib-esm/assets/icons/warning.svg +1 -0
  61. package/lib-esm/assets/icons.svg +1 -0
  62. package/lib-esm/components/asset-info/asset-info.js +20 -18
  63. package/lib-esm/components/asset-info/asset-info.stories.js +29 -33
  64. package/lib-esm/components/browsertime-table/browsertime-table.js +6 -4
  65. package/lib-esm/components/browsertime-table/browsertime-table.stories.js +9 -13
  66. package/lib-esm/components/bundle-assets/bundle-assets.constants.js +17 -15
  67. package/lib-esm/components/bundle-assets/bundle-assets.js +148 -151
  68. package/lib-esm/components/bundle-assets/bundle-assets.stories.js +58 -63
  69. package/lib-esm/components/bundle-assets/bundle-assets.utils.js +65 -21
  70. package/lib-esm/components/bundle-assets/index.js +89 -2
  71. package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +46 -51
  72. package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.stories.js +9 -13
  73. package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js +13 -13
  74. package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +13 -19
  75. package/lib-esm/components/bundle-modules/bundle-modules.constants.js +17 -15
  76. package/lib-esm/components/bundle-modules/bundle-modules.js +120 -133
  77. package/lib-esm/components/bundle-modules/bundle-modules.stories.js +46 -58
  78. package/lib-esm/components/bundle-modules/bundle-modules.utils.js +95 -0
  79. package/lib-esm/components/bundle-modules/index.js +111 -3
  80. package/lib-esm/components/bundle-packages/bundle-packages.constants.js +17 -15
  81. package/lib-esm/components/bundle-packages/bundle-packages.js +81 -77
  82. package/lib-esm/components/bundle-packages/bundle-packages.module.css +5 -0
  83. package/lib-esm/components/bundle-packages/bundle-packages.stories.js +34 -46
  84. package/lib-esm/components/bundle-packages/bundle-packages.utils.js +44 -0
  85. package/lib-esm/components/bundle-packages/index.js +87 -2
  86. package/lib-esm/components/component-link.js +9 -13
  87. package/lib-esm/components/delta/delta.js +7 -6
  88. package/lib-esm/components/delta/delta.stories.js +26 -38
  89. package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.js +15 -10
  90. package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.stories.js +20 -25
  91. package/lib-esm/components/job-header/job-header.js +14 -11
  92. package/lib-esm/components/job-header/job-header.stories.js +12 -18
  93. package/lib-esm/components/job-meta/job-meta.js +14 -18
  94. package/lib-esm/components/job-meta/job-meta.stories.js +10 -12
  95. package/lib-esm/components/job-name/job-name.js +11 -17
  96. package/lib-esm/components/job-name/job-name.stories.js +15 -23
  97. package/lib-esm/components/jobs-header/jobs-header.js +12 -12
  98. package/lib-esm/components/jobs-header/jobs-header.stories.js +80 -86
  99. package/lib-esm/components/lighthouse-table/lighthouse-table.js +6 -4
  100. package/lib-esm/components/lighthouse-table/lighthouse-table.stories.js +10 -14
  101. package/lib-esm/components/metric/metric.js +14 -19
  102. package/lib-esm/components/metric/metric.stories.js +36 -58
  103. package/lib-esm/components/metrics-table/metrics-table.js +128 -143
  104. package/lib-esm/components/metrics-table/metrics-table.stories.js +27 -35
  105. package/lib-esm/components/metrics-table-options/metrics-table-options.js +15 -20
  106. package/lib-esm/components/metrics-table-options/metrics-table-options.stories.js +6 -12
  107. package/lib-esm/components/metrics-table-search/metrics-table-search.js +17 -18
  108. package/lib-esm/components/metrics-table-search/metrics-table-search.module.css +2 -1
  109. package/lib-esm/components/metrics-table-search/metrics-table-search.stories.js +4 -9
  110. package/lib-esm/components/metrics-table-title/metrics-table-title.js +9 -7
  111. package/lib-esm/components/module-info/module-info.js +15 -13
  112. package/lib-esm/components/module-info/module-info.stories.js +20 -22
  113. package/lib-esm/components/summary/summary.js +38 -52
  114. package/lib-esm/components/summary/summary.stories.js +28 -46
  115. package/lib-esm/components/summary-item/summary-item.js +25 -29
  116. package/lib-esm/components/summary-item/summary-item.stories.js +40 -50
  117. package/lib-esm/components/total-size-type-title/total-size-type-title.js +14 -15
  118. package/lib-esm/constants.js +25 -30
  119. package/lib-esm/hooks/rows-filter.js +19 -0
  120. package/lib-esm/hooks/rows-sort.js +21 -0
  121. package/lib-esm/hooks/search-params.js +166 -0
  122. package/lib-esm/layout/box/box.js +12 -19
  123. package/lib-esm/layout/box/box.stories.js +34 -46
  124. package/lib-esm/layout/flex-stack/flex-stack.js +9 -12
  125. package/lib-esm/layout/flex-stack/flex-stack.stories.js +39 -49
  126. package/lib-esm/layout/footer/footer.js +34 -37
  127. package/lib-esm/layout/footer/footer.stories.js +7 -11
  128. package/lib-esm/layout/header/header.js +17 -24
  129. package/lib-esm/layout/header/header.stories.js +34 -43
  130. package/lib-esm/layout/stack/stack.js +8 -6
  131. package/lib-esm/layout/stack/stack.stories.js +39 -49
  132. package/lib-esm/layout/sub-header/sub-header.js +14 -12
  133. package/lib-esm/layout/sub-header/sub-header.stories.js +57 -69
  134. package/lib-esm/prototypes/typography.stories.js +48 -58
  135. package/lib-esm/query-state.js +13 -16
  136. package/lib-esm/stories/wrapper.js +14 -26
  137. package/lib-esm/ui/alert/alert.js +6 -4
  138. package/lib-esm/ui/alert/alert.stories.js +14 -24
  139. package/lib-esm/ui/container/container.js +9 -15
  140. package/lib-esm/ui/container/container.stories.js +15 -17
  141. package/lib-esm/ui/dropdown/dropdown.js +13 -11
  142. package/lib-esm/ui/dropdown/dropdown.stories.js +19 -26
  143. package/lib-esm/ui/empty-set/empty-set.js +12 -12
  144. package/lib-esm/ui/empty-set/empty-set.stories.js +11 -19
  145. package/lib-esm/ui/file-name/file-name.js +7 -8
  146. package/lib-esm/ui/file-name/file-name.stories.js +12 -16
  147. package/lib-esm/ui/filters/filters.container.js +52 -77
  148. package/lib-esm/ui/filters/filters.js +61 -89
  149. package/lib-esm/ui/filters/filters.stories.js +81 -100
  150. package/lib-esm/ui/filters/filters.utils.js +24 -28
  151. package/lib-esm/ui/filters/index.js +1 -1
  152. package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.js +67 -78
  153. package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.stories.js +67 -77
  154. package/lib-esm/ui/icon/icon.js +14 -206
  155. package/lib-esm/ui/icon/icon.stories.js +16 -24
  156. package/lib-esm/ui/input/input.js +6 -10
  157. package/lib-esm/ui/input/input.stories.js +8 -12
  158. package/lib-esm/ui/loader/loader.js +7 -13
  159. package/lib-esm/ui/loader/loader.stories.js +5 -9
  160. package/lib-esm/ui/logo/logo.constants.js +6 -6
  161. package/lib-esm/ui/logo/logo.js +14 -15
  162. package/lib-esm/ui/logo/logo.stories.js +14 -28
  163. package/lib-esm/ui/panels/panels.js +14 -27
  164. package/lib-esm/ui/panels/panels.stories.js +14 -16
  165. package/lib-esm/ui/popover/popover.js +13 -10
  166. package/lib-esm/ui/popover/popover.module.css +3 -3
  167. package/lib-esm/ui/popover/popover.stories.js +7 -11
  168. package/lib-esm/ui/skeleton/skeleton.js +6 -9
  169. package/lib-esm/ui/skeleton/skeleton.stories.js +2 -4
  170. package/lib-esm/ui/sort-dropdown/sort-dropdown.js +36 -39
  171. package/lib-esm/ui/sort-dropdown/sort-dropdown.stories.js +14 -16
  172. package/lib-esm/ui/table/table.js +25 -31
  173. package/lib-esm/ui/table/table.stories.js +84 -102
  174. package/lib-esm/ui/tabs/tabs.js +14 -25
  175. package/lib-esm/ui/tabs/tabs.stories.js +4 -6
  176. package/lib-esm/ui/toolbar/toolbar.js +7 -5
  177. package/lib-esm/ui/toolbar/toolbar.stories.js +11 -16
  178. package/lib-esm/ui/tooltip/tooltip.js +15 -17
  179. package/lib-esm/ui/tooltip/tooltip.stories.js +8 -12
  180. package/lib-esm/utils.js +15 -28
  181. package/package.json +19 -27
  182. package/src/app/app.jsx +4 -1
  183. package/src/assets/icons/arrow.svg +1 -0
  184. package/src/assets/icons/cancel.svg +1 -0
  185. package/src/assets/icons/clock.svg +1 -0
  186. package/src/assets/icons/close.svg +1 -0
  187. package/src/assets/icons/commit.svg +1 -0
  188. package/src/assets/icons/filter.svg +1 -0
  189. package/src/assets/icons/help.svg +1 -0
  190. package/src/assets/icons/menu.svg +1 -0
  191. package/src/{ui/icon/assets → assets/icons}/sort.svg +0 -0
  192. package/src/assets/icons/warning.svg +1 -0
  193. package/src/assets/icons.svg +1 -0
  194. package/src/components/bundle-assets/bundle-assets.jsx +3 -3
  195. package/src/components/bundle-assets/bundle-assets.utils.js +96 -17
  196. package/src/components/bundle-assets/index.jsx +89 -0
  197. package/src/components/bundle-modules/bundle-modules.jsx +3 -3
  198. package/src/components/bundle-modules/bundle-modules.utils.js +101 -0
  199. package/src/components/bundle-modules/index.jsx +107 -0
  200. package/src/components/bundle-packages/bundle-packages.jsx +21 -8
  201. package/src/components/bundle-packages/bundle-packages.module.css +5 -0
  202. package/src/components/bundle-packages/bundle-packages.utils.js +47 -0
  203. package/src/components/bundle-packages/index.jsx +84 -0
  204. package/src/components/duplicate-packages-warning/duplicate-packages-warning.jsx +9 -2
  205. package/src/components/metrics-table/metrics-table.jsx +2 -7
  206. package/src/components/metrics-table-search/metrics-table-search.jsx +1 -0
  207. package/src/components/metrics-table-search/metrics-table-search.module.css +2 -1
  208. package/src/hooks/rows-filter.js +16 -0
  209. package/src/hooks/rows-sort.js +24 -0
  210. package/src/hooks/search-params.js +153 -0
  211. package/src/ui/icon/icon.jsx +7 -42
  212. package/src/ui/popover/popover.jsx +1 -1
  213. package/src/ui/popover/popover.module.css +3 -3
  214. package/src/ui/sort-dropdown/sort-dropdown.jsx +11 -11
  215. package/src/ui/tooltip/tooltip.jsx +1 -1
  216. package/lib/components/bundle-assets/bundle-assets.container.js +0 -140
  217. package/lib/components/bundle-modules/bundle-modules.container.js +0 -222
  218. package/lib/hocs/with-custom-sort.js +0 -75
  219. package/lib/hocs/with-filtered-items.js +0 -54
  220. package/lib/ui/icon/assets/arrow.svg +0 -4
  221. package/lib/ui/icon/assets/branch.svg +0 -3
  222. package/lib/ui/icon/assets/cancel.svg +0 -4
  223. package/lib/ui/icon/assets/clock.svg +0 -3
  224. package/lib/ui/icon/assets/close.svg +0 -4
  225. package/lib/ui/icon/assets/commit.svg +0 -3
  226. package/lib/ui/icon/assets/filter.svg +0 -4
  227. package/lib/ui/icon/assets/help.svg +0 -4
  228. package/lib/ui/icon/assets/job.svg +0 -3
  229. package/lib/ui/icon/assets/menu.svg +0 -4
  230. package/lib/ui/icon/assets/package.svg +0 -3
  231. package/lib/ui/icon/assets/pull-request.svg +0 -3
  232. package/lib/ui/icon/assets/repository.svg +0 -3
  233. package/lib/ui/icon/assets/warning.svg +0 -4
  234. package/lib-esm/components/bundle-assets/bundle-assets.container.js +0 -119
  235. package/lib-esm/components/bundle-modules/bundle-modules.container.js +0 -175
  236. package/lib-esm/components/bundle-packages/bundle-packages.container.js +0 -91
  237. package/lib-esm/hocs/with-custom-sort.js +0 -43
  238. package/lib-esm/hocs/with-filtered-items.js +0 -35
  239. package/lib-esm/hocs/with-search.js +0 -214
  240. package/lib-esm/ui/icon/assets/arrow.svg +0 -4
  241. package/lib-esm/ui/icon/assets/branch.svg +0 -3
  242. package/lib-esm/ui/icon/assets/cancel.svg +0 -4
  243. package/lib-esm/ui/icon/assets/clock.svg +0 -3
  244. package/lib-esm/ui/icon/assets/close.svg +0 -4
  245. package/lib-esm/ui/icon/assets/commit.svg +0 -3
  246. package/lib-esm/ui/icon/assets/filter.svg +0 -4
  247. package/lib-esm/ui/icon/assets/help.svg +0 -4
  248. package/lib-esm/ui/icon/assets/job.svg +0 -3
  249. package/lib-esm/ui/icon/assets/menu.svg +0 -4
  250. package/lib-esm/ui/icon/assets/package.svg +0 -3
  251. package/lib-esm/ui/icon/assets/pull-request.svg +0 -3
  252. package/lib-esm/ui/icon/assets/repository.svg +0 -3
  253. package/lib-esm/ui/icon/assets/warning.svg +0 -4
  254. package/src/components/bundle-assets/bundle-assets.container.js +0 -146
  255. package/src/components/bundle-assets/index.js +0 -4
  256. package/src/components/bundle-modules/bundle-modules.container.js +0 -158
  257. package/src/components/bundle-modules/index.js +0 -4
  258. package/src/components/bundle-packages/bundle-packages.container.js +0 -93
  259. package/src/components/bundle-packages/index.js +0 -4
  260. package/src/hocs/with-custom-sort.jsx +0 -35
  261. package/src/hocs/with-filtered-items.jsx +0 -34
  262. package/src/hocs/with-search.jsx +0 -184
  263. package/src/ui/icon/assets/arrow.svg +0 -4
  264. package/src/ui/icon/assets/branch.svg +0 -3
  265. package/src/ui/icon/assets/cancel.svg +0 -4
  266. package/src/ui/icon/assets/clock.svg +0 -3
  267. package/src/ui/icon/assets/close.svg +0 -4
  268. package/src/ui/icon/assets/commit.svg +0 -3
  269. package/src/ui/icon/assets/filter.svg +0 -4
  270. package/src/ui/icon/assets/help.svg +0 -4
  271. package/src/ui/icon/assets/job.svg +0 -3
  272. package/src/ui/icon/assets/menu.svg +0 -4
  273. package/src/ui/icon/assets/package.svg +0 -3
  274. package/src/ui/icon/assets/pull-request.svg +0 -3
  275. package/src/ui/icon/assets/repository.svg +0 -3
  276. package/src/ui/icon/assets/warning.svg +0 -4
package/package.json CHANGED
@@ -1,15 +1,18 @@
1
1
  {
2
2
  "name": "@bundle-stats/ui",
3
- "version": "3.1.4-alpha.0",
3
+ "version": "3.2.1-alpha.0",
4
4
  "description": "UI components for BundleStats projects.",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
7
7
  "scripts": {
8
8
  "build": "npm run build-lib && npm run build-esm",
9
- "build-lib": "rm -fr ./lib && babel -D src -d lib --ignore **/__tests__/** --ignore /prototypes/** --presets=@babel/preset-env,@babel/preset-react",
10
- "build-esm": "rm -fr ./lib-esm && babel -D src -d lib-esm --ignore **/__tests__/** --ignore /prototypes/**",
9
+ "prebuild-lib": "rimraf ./lib",
10
+ "build-lib": "babel -D src -d lib --ignore **/__tests__/**/* --ignore /prototypes/** --presets=@babel/preset-env,@babel/preset-react",
11
+ "prebuild-esm": "rimraf ./lib-esm",
12
+ "build-esm": "babel -D src -d lib-esm --ignore **/__tests__/**/* --ignore /prototypes/**",
11
13
  "build-storybook": "npx build-storybook -c ./build/storybook",
12
14
  "generate-chart-colors": "node scripts/generate-chart-colors.js",
15
+ "generate-svg-sprite": "npx svg-sprite -s --si src/assets/icons/*.svg && mv symbol/svg/sprite.symbol.svg src/assets/icons.svg",
13
16
  "lint": "../../node_modules/.bin/eslint . --ext .jsx,.js",
14
17
  "start": "cross-env NODE_ENV=development start-storybook -c ./build/storybook -p 8080",
15
18
  "test": "npm run test:unit && npm run test:storyshots",
@@ -33,12 +36,9 @@
33
36
  },
34
37
  "homepage": "https://github.com/relative-ci/bundle-stats/blob/master/packages/ui#readme",
35
38
  "devDependencies": {
36
- "@babel/cli": "7.15.4",
37
- "@babel/core": "7.15.5",
38
- "@babel/plugin-proposal-class-properties": "7.14.5",
39
- "@babel/plugin-proposal-object-rest-spread": "7.15.6",
40
- "@babel/plugin-proposal-private-methods": "7.14.5",
41
- "@babel/preset-env": "7.15.6",
39
+ "@babel/cli": "7.15.7",
40
+ "@babel/core": "7.15.8",
41
+ "@babel/preset-env": "7.15.8",
42
42
  "@babel/preset-react": "7.14.5",
43
43
  "@simplyianm/babel-plugin-inline-react-svg": "1.2.0",
44
44
  "@storybook/addon-knobs": "6.3.1",
@@ -47,15 +47,13 @@
47
47
  "@storybook/react": "6.2.9",
48
48
  "babel-core": "7.0.0-bridge.0",
49
49
  "babel-jest": "26.6.3",
50
- "babel-loader": "8.2.2",
51
50
  "babel-plugin-lodash": "3.3.4",
52
51
  "babel-plugin-require-context-hook": "1.0.0",
53
- "chromatic": "5.9.2",
52
+ "chromatic": "6.0.5",
54
53
  "classnames": "2.3.1",
55
54
  "colormap": "2.3.2",
56
- "core-js": "3.15.2",
55
+ "core-js": "3.19.0",
57
56
  "cross-env": "7.0.3",
58
- "css-loader": "5.2.6",
59
57
  "enzyme": "3.11.0",
60
58
  "enzyme-adapter-react-16": "1.15.6",
61
59
  "enzyme-to-json": "3.6.2",
@@ -64,34 +62,28 @@
64
62
  "jest": "26.6.3",
65
63
  "jest-date-mock": "1.0.8",
66
64
  "lodash": "4.17.21",
67
- "markdown-loader-jest": "0.1.1",
68
65
  "prop-types": "15.7.2",
69
66
  "react": "16.14.0",
70
67
  "react-dom": "16.14.0",
71
68
  "react-router-dom": "5.3.0",
72
69
  "react-test-renderer": "16.14.0",
73
- "recompose": "0.30.0",
74
- "stats-webpack-plugin": "0.7.0",
75
- "style-loader": "2.0.0",
76
- "webpack": "4.46.0",
77
- "webpack-cli": "4.8.0"
70
+ "rimraf": "3.0.2"
78
71
  },
79
72
  "peerDependencies": {
80
73
  "classnames": "^2.2.6",
81
- "core-js": "^3.9.1",
82
- "lodash": "^4.17.11",
74
+ "core-js": "^3.16.2",
75
+ "lodash": "^4.17.21",
83
76
  "prop-types": "^15.7.2",
84
- "react": "^16.8.5",
85
- "react-dom": "^16.8.5",
86
- "react-router-dom": "^5.2.0",
87
- "recompose": "^0.30.0"
77
+ "react": "^16.14.0",
78
+ "react-dom": "^16.14.0",
79
+ "react-router-dom": "^5.3.0"
88
80
  },
89
81
  "dependencies": {
90
- "@bundle-stats/utils": "^3.1.4-alpha.0",
82
+ "@bundle-stats/utils": "^3.2.1-alpha.0",
91
83
  "date-fns": "^2.6.0",
92
84
  "query-string": "^7.0.0",
93
85
  "reakit": "^1.3.6",
94
86
  "use-query-params": "^1.2.2"
95
87
  },
96
- "gitHead": "903d336ce3f7a0bd060fbd1327b57c5783f133ff"
88
+ "gitHead": "fdb4b6931ebbc35ad469608725603cde5ecab9b7"
97
89
  }
package/src/app/app.jsx CHANGED
@@ -181,7 +181,10 @@ const AppComponent = ({ version, jobs }) => {
181
181
  <Stack space="large">
182
182
  {duplicatePackagesInsights && (
183
183
  <Container>
184
- <DuplicatePackagesWarning duplicatePackagesCount={duplicatePackagesCount} />
184
+ <DuplicatePackagesWarning
185
+ duplicatePackagesCount={duplicatePackagesCount}
186
+ showDelta={jobs.length > 1}
187
+ />
185
188
  </Container>
186
189
  )}
187
190
  <Container>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-down"><line x1="12" y1="5" x2="12" y2="19"></line><polyline points="19 12 12 19 5 12"></polyline></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x-circle"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-clock"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-git-commit"><circle cx="12" cy="12" r="4"></circle><line x1="1.05" y1="12" x2="7" y2="12"></line><line x1="17.01" y1="12" x2="22.96" y2="12"></line></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bar-chart" transform="rotate(-90deg)"><line x1="12" y1="20" x2="12" y2="10"></line><line x1="18" y1="20" x2="18" y2="4"></line><line x1="6" y1="20" x2="6" y2="16"></line></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-help-circle"><circle cx="12" cy="12" r="10"></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg>
File without changes
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-alert-triangle"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>
@@ -0,0 +1 @@
1
+ <svg width="16" height="16"><symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="afeather afeather-arrow-down" id="arrow" xmlns="http://www.w3.org/2000/svg"><path d="M12 5v14M19 12l-7 7-7-7"/></symbol><symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="bfeather bfeather-x-circle" id="cancel" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10"/><path d="M15 9l-6 6M9 9l6 6"/></symbol><symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="cfeather cfeather-clock" id="clock" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/></symbol><symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="dfeather dfeather-x" id="close" xmlns="http://www.w3.org/2000/svg"><path d="M18 6L6 18M6 6l12 12"/></symbol><symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="efeather efeather-git-commit" id="commit" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="4"/><path d="M1.05 12H7M17.01 12h5.95"/></symbol><symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ffeather ffeather-bar-chart" id="filter" xmlns="http://www.w3.org/2000/svg"><path d="M12 20V10M18 20V4M6 20v-4"/></symbol><symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="gfeather gfeather-help-circle" id="help" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3M12 17h.01"/></symbol><symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="hfeather hfeather-menu" id="menu" xmlns="http://www.w3.org/2000/svg"><path d="M3 12h18M3 6h18M3 18h18"/></symbol><symbol viewBox="0 0 24 24" fill="currentColor" id="sort" xmlns="http://www.w3.org/2000/svg"><path d="M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z"/><path d="M0 0h24v24H0z" fill="none"/></symbol><symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="jfeather jfeather-alert-triangle" id="warning" xmlns="http://www.w3.org/2000/svg"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0zM12 9v4M12 17h.01"/></symbol></svg>
@@ -124,7 +124,7 @@ export const BundleAssets = (props) => {
124
124
  totalRowCount,
125
125
  filters,
126
126
  hasActiveFilters,
127
- sortItems,
127
+ sortFields,
128
128
  sort,
129
129
  updateSort,
130
130
  search,
@@ -154,7 +154,7 @@ export const BundleAssets = (props) => {
154
154
  className={css.toolbar}
155
155
  renderActions={({ actionClassName }) => (
156
156
  <FlexStack space="xsmall" className={cx(css.dropdown, actionClassName)}>
157
- <SortDropdown items={sortItems} {...sort} onChange={updateSort} />
157
+ <SortDropdown fields={sortFields} {...sort} onChange={updateSort} />
158
158
  <MetricsTableOptions
159
159
  handleViewAll={resetAllFilters}
160
160
  handleResetFilters={resetFilters}
@@ -267,7 +267,7 @@ BundleAssets.propTypes = {
267
267
  changed: PropTypes.bool,
268
268
  }).isRequired,
269
269
  hasActiveFilters: PropTypes.bool,
270
- sortItems: PropTypes.shape({
270
+ sortFields: PropTypes.shape({
271
271
  [PropTypes.string]: PropTypes.shape({
272
272
  label: PropTypes.string,
273
273
  defaultDirection: PropTypes.bool,
@@ -1,17 +1,96 @@
1
- /**
2
- * Get a list of all chunkIds across assets and runs
3
- *
4
- * @param {Array<Object>} items
5
- * @return {Array<string|number>}
6
- */
7
- export const getAllChunkIds = (items) =>
8
- items.reduce((agg, item) => {
9
- const itemChunkIds = item.runs.map((run) => run?.chunkId).filter((chunkId) => typeof(chunkId) !== 'undefined');
10
-
11
- return itemChunkIds.reduce((itemAgg, chunkId) => {
12
- if (itemAgg.includes(chunkId)) {
13
- return itemAgg;
14
- }
15
- return [...itemAgg, chunkId];
16
- }, agg);
17
- }, []);
1
+ import { get } from 'lodash';
2
+ 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';
5
+
6
+ export const addRowAssetFlags = (row) => {
7
+ const { runs } = row;
8
+
9
+ const isEntry = runs.map((run) => run?.isEntry).includes(true);
10
+ const isInitial = runs.map((run) => run?.isInitial).includes(true);
11
+ const isChunk = runs.map((run) => run?.isChunk).includes(true);
12
+
13
+ const isAsset = !(isEntry || isInitial || isChunk);
14
+
15
+ return {
16
+ ...row,
17
+ isEntry,
18
+ isInitial,
19
+ isChunk,
20
+ isAsset,
21
+ };
22
+ };
23
+
24
+ export const getIsNotPredictive = (key, runs) =>
25
+ runs.reduce((agg, current, index) => {
26
+ if (agg) {
27
+ return agg;
28
+ }
29
+
30
+ if (index + 1 === runs.length) {
31
+ return agg;
32
+ }
33
+
34
+ if (
35
+ current &&
36
+ runs[index + 1] &&
37
+ current.delta !== 0 &&
38
+ key !== current.name &&
39
+ current.name === runs[index + 1].name
40
+ ) {
41
+ return true;
42
+ }
43
+
44
+ return agg;
45
+ }, false);
46
+
47
+ export const addRowIsNotPredictive = (row) => ({
48
+ ...row,
49
+ isNotPredictive: getIsNotPredictive(row.key, row.runs),
50
+ });
51
+
52
+ export const getRowFilter = (filters) => (item) => {
53
+ if (filters[ASSET_FILTERS.CHANGED] && !item.changed) {
54
+ return false;
55
+ }
56
+
57
+ if (
58
+ !(
59
+ (filters[`${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.ENTRY}`] && item.isEntry) ||
60
+ (filters[`${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.INITIAL}`] && item.isInitial) ||
61
+ (filters[`${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.CHUNK}`] && item.isChunk) ||
62
+ (filters[`${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.ASSET}`] && item.isAsset)
63
+ )
64
+ ) {
65
+ return false;
66
+ }
67
+
68
+ if (!filters[`${ASSET_FILE_TYPE}.${getFileType(item.key)}`]) {
69
+ return false;
70
+ }
71
+
72
+ return true;
73
+ };
74
+
75
+ export const getCustomSort = (sortId) => (item) => {
76
+ if (sortId === SORT_BY_NAME) {
77
+ return item.key;
78
+ }
79
+
80
+ if (sortId === SORT_BY_DELTA) {
81
+ return get(item, 'runs[0].deltaPercentage', 0);
82
+ }
83
+
84
+ if (sortId === SORT_BY_SIZE) {
85
+ return get(item, 'runs[0].value', 0);
86
+ }
87
+
88
+ return [
89
+ !item.isNotPredictive,
90
+ !item.changed,
91
+ !item.isInitial,
92
+ !item.isEntry,
93
+ !item.isChunk,
94
+ item.key,
95
+ ];
96
+ };
@@ -0,0 +1,89 @@
1
+ import React, { useMemo } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import * as webpack from '@bundle-stats/utils/lib-esm/webpack';
4
+ import { ASSET_FILTERS } from '@bundle-stats/utils';
5
+ import {
6
+ getAssetEntryTypeFilters,
7
+ getAssetFileTypeFilters,
8
+ } from '@bundle-stats/utils/lib-esm/utils/component-links';
9
+
10
+ import { useRowsFilter } from '../../hooks/rows-filter';
11
+ import { useRowsSort } from '../../hooks/rows-sort';
12
+ import { useSearchParams } from '../../hooks/search-params';
13
+ import { BundleAssets as BundleAssetsComponent } from './bundle-assets';
14
+ import { addRowAssetFlags, addRowIsNotPredictive, getRowFilter, getCustomSort } from './bundle-assets.utils';
15
+ import { SORT_BY } from './bundle-assets.constants';
16
+
17
+ export const BundleAssets = (props) => {
18
+ const { jobs, filters, search, setState, sortBy, direction, ...restProps } = props;
19
+
20
+ const { defaultFilters, allEntriesFilters } = useMemo(
21
+ () => ({
22
+ defaultFilters: {
23
+ [ASSET_FILTERS.CHANGED]: jobs?.length > 1,
24
+ ...getAssetEntryTypeFilters(true),
25
+ ...getAssetFileTypeFilters(true),
26
+ },
27
+ allEntriesFilters: {
28
+ [ASSET_FILTERS.CHANGED]: false,
29
+ ...getAssetEntryTypeFilters(true),
30
+ ...getAssetFileTypeFilters(true),
31
+ },
32
+ }),
33
+ [jobs],
34
+ );
35
+
36
+ const searchParams = useSearchParams({
37
+ search,
38
+ filters,
39
+ defaultFilters,
40
+ allEntriesFilters,
41
+ setState,
42
+ });
43
+
44
+ const { rows, totalRowCount } = useMemo(() => {
45
+ const result = webpack.compareBySection.assets(jobs, [addRowAssetFlags, addRowIsNotPredictive]);
46
+ return { rows: result, totalRowCount: result.length };
47
+ }, [jobs]);
48
+
49
+ const filteredRows = useRowsFilter({
50
+ rows,
51
+ searchPattern: searchParams.searchPattern,
52
+ filters: searchParams.filters,
53
+ getRowFilter,
54
+ });
55
+
56
+ const sortParams = useRowsSort({
57
+ rows: filteredRows,
58
+ sortFields: SORT_BY,
59
+ sortBy,
60
+ sortDirection: direction,
61
+ getCustomSort,
62
+ });
63
+
64
+ return (
65
+ <BundleAssetsComponent
66
+ jobs={jobs}
67
+ {...restProps}
68
+ {...searchParams}
69
+ {...sortParams}
70
+ totalRowCount={totalRowCount}
71
+ />
72
+ );
73
+ };
74
+
75
+ BundleAssets.propTypes = {
76
+ jobs: PropTypes.arrayOf(PropTypes.object).isRequired, // eslint-disable-line react/forbid-prop-types
77
+ filters: PropTypes.object, // eslint-disable-line react/forbid-prop-types
78
+ search: PropTypes.string,
79
+ sortBy: PropTypes.string,
80
+ direction: PropTypes.string,
81
+ setState: PropTypes.func.isRequired,
82
+ };
83
+
84
+ BundleAssets.defaultProps = {
85
+ filters: undefined,
86
+ search: undefined,
87
+ sortBy: undefined,
88
+ direction: undefined,
89
+ };
@@ -90,7 +90,7 @@ export const BundleModules = ({
90
90
  resetFilters,
91
91
  resetAllFilters,
92
92
  filters,
93
- sortItems,
93
+ sortFields,
94
94
  sort,
95
95
  updateSort,
96
96
  search,
@@ -173,7 +173,7 @@ export const BundleModules = ({
173
173
  <FlexStack space="xxsmall" className={cx(css.dropdown, actionClassName)}>
174
174
  <SortDropdown
175
175
  className={css.tableDropdown}
176
- items={sortItems}
176
+ fields={sortFields}
177
177
  onChange={updateSort}
178
178
  {...sort}
179
179
  />
@@ -262,7 +262,7 @@ BundleModules.propTypes = {
262
262
 
263
263
  hasActiveFilters: PropTypes.bool,
264
264
 
265
- sortItems: PropTypes.shape({
265
+ sortFields: PropTypes.shape({
266
266
  [PropTypes.string]: PropTypes.shape({
267
267
  label: PropTypes.string,
268
268
  defaultDirection: PropTypes.bool,
@@ -0,0 +1,101 @@
1
+ import { useMemo } from 'react';
2
+ import { get, intersection, merge } from 'lodash';
3
+ import { MODULE_PATH_PACKAGES } from '@bundle-stats/utils/lib-esm/webpack';
4
+ import {
5
+ MODULE_CHUNK,
6
+ MODULE_FILTERS,
7
+ MODULE_FILE_TYPE,
8
+ MODULE_SOURCE_TYPE,
9
+ getModuleSourceFileType,
10
+ } from '@bundle-stats/utils';
11
+
12
+ import { SORT_BY_NAME, SORT_BY_SIZE, SORT_BY_DELTA } from './bundle-modules.constants';
13
+
14
+ export const addRowSourceFlag = (row) => {
15
+ const { key } = row;
16
+ const thirdParty = Boolean(key.match(MODULE_PATH_PACKAGES));
17
+ return { ...row, thirdParty };
18
+ };
19
+
20
+ export const getCustomSort = (sortBy) => (item) => {
21
+ if (sortBy === SORT_BY_NAME) {
22
+ return item.key;
23
+ }
24
+
25
+ if (sortBy === SORT_BY_SIZE) {
26
+ return get(item, 'runs[0].value', 0);
27
+ }
28
+
29
+ if (sortBy === SORT_BY_DELTA) {
30
+ return get(item, 'runs[0].deltaPercentage', 0);
31
+ }
32
+
33
+ return [!item.changed, item.key];
34
+ };
35
+
36
+ export const getRowFilter = (filters) => (row) => {
37
+ // Skip not changed rows
38
+ if (filters[MODULE_FILTERS.CHANGED] && !row.changed) {
39
+ return false;
40
+ }
41
+
42
+ // Skip not matching source type
43
+ if (
44
+ !(
45
+ (filters[`${MODULE_SOURCE_TYPE}.${MODULE_FILTERS.FIRST_PARTY}`] && row.thirdParty === false) ||
46
+ (filters[`${MODULE_SOURCE_TYPE}.${MODULE_FILTERS.THIRD_PARTY}`] && row.thirdParty === true)
47
+ )
48
+ ) {
49
+ return false;
50
+ }
51
+
52
+ // Skip not matching source file types
53
+ const fileType = getModuleSourceFileType(row.key);
54
+ if (!filters[`${MODULE_FILE_TYPE}.${fileType}`]) {
55
+ return false;
56
+ }
57
+
58
+ return true;
59
+ };
60
+
61
+ export const useModuleFilterByChunk = ({ jobs, filters, chunkIds }) => {
62
+ const filteredJobs = useMemo(() => {
63
+ // List of chunkIds with filter value set to `true`
64
+ const includedChunkIds = chunkIds.reduce((agg, chunkId) => {
65
+ if (get(filters, `${MODULE_CHUNK}.${chunkId}`)) {
66
+ return [...agg, chunkId];
67
+ }
68
+
69
+ return agg;
70
+ }, []);
71
+
72
+ // If all the filters are included, return jobs as they are
73
+ if (includedChunkIds.length === chunkIds.length) {
74
+ return jobs;
75
+ }
76
+
77
+ const jobsWithFilteredData = jobs.map((job) => {
78
+ const { modules } = job?.metrics?.webpack || {};
79
+
80
+ const filteredModules = Object.entries(modules).reduce((agg, [moduleId, moduleEntry]) => {
81
+ const match = intersection(moduleEntry.chunkIds, includedChunkIds);
82
+
83
+ if (match.length > 0) {
84
+ agg[moduleId] = moduleEntry; // eslint-disable-line no-param-reassign
85
+ }
86
+
87
+ return agg;
88
+ }, {});
89
+
90
+ // Copy job data into a new object to prevent mutations of the original data
91
+ const newJob = merge({}, job);
92
+ newJob.metrics.webpack.modules = filteredModules;
93
+
94
+ return newJob;
95
+ });
96
+
97
+ return jobsWithFilteredData;
98
+ }, [jobs, filters, chunkIds]);
99
+
100
+ return filteredJobs;
101
+ };
@@ -0,0 +1,107 @@
1
+ import React, { useMemo } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { uniqBy, map } from 'lodash';
4
+ import {
5
+ getModuleChunkFilters,
6
+ getModuleSourceTypeFilters,
7
+ getModuleFileTypeFilters,
8
+ } from '@bundle-stats/utils';
9
+ import * as webpack from '@bundle-stats/utils/lib-esm/webpack';
10
+
11
+ import { useRowsFilter } from '../../hooks/rows-filter';
12
+ import { useRowsSort } from '../../hooks/rows-sort';
13
+ import { useSearchParams } from '../../hooks/search-params';
14
+ import { BundleModules as BundleModulesComponent } from './bundle-modules';
15
+ import {
16
+ addRowSourceFlag,
17
+ getRowFilter,
18
+ getCustomSort,
19
+ useModuleFilterByChunk,
20
+ } from './bundle-modules.utils';
21
+ import { SORT_BY } from './bundle-modules.constants';
22
+
23
+ export const BundleModules = (props) => {
24
+ const { jobs, filters, search, setState, sortBy, direction, ...restProps } = props;
25
+
26
+ const chunks = uniqBy(jobs.map((job) => job?.meta?.webpack?.chunks || []).flat(), ({ id }) => id);
27
+ const chunkIds = map(chunks, 'id');
28
+
29
+ const { defaultFilters, allEntriesFilters } = useMemo(
30
+ () => ({
31
+ defaultFilters: {
32
+ changed: jobs?.length > 1,
33
+ ...getModuleSourceTypeFilters(true),
34
+ ...getModuleChunkFilters(chunkIds, true),
35
+ ...getModuleFileTypeFilters(true),
36
+ },
37
+ allEntriesFilters: {
38
+ changed: false,
39
+ ...getModuleSourceTypeFilters(true),
40
+ ...getModuleChunkFilters(chunkIds, true),
41
+ ...getModuleFileTypeFilters(true),
42
+ },
43
+ }),
44
+ [jobs],
45
+ );
46
+
47
+ const searchParams = useSearchParams({
48
+ search,
49
+ filters,
50
+ defaultFilters,
51
+ allEntriesFilters,
52
+ setState,
53
+ });
54
+
55
+ const filteredJobsByChunkIds = useModuleFilterByChunk({
56
+ jobs,
57
+ filters: searchParams.filters,
58
+ chunkIds,
59
+ });
60
+
61
+ const { rows, totalRowCount } = useMemo(() => {
62
+ const result = webpack.compareBySection.modules(filteredJobsByChunkIds, [addRowSourceFlag]);
63
+ return { rows: result, totalRowCount: result.length };
64
+ }, [filteredJobsByChunkIds]);
65
+
66
+ const filteredRows = useRowsFilter({
67
+ rows,
68
+ searchPattern: searchParams.searchPattern,
69
+ filters: searchParams.filters,
70
+ getRowFilter,
71
+ });
72
+
73
+ const sortParams = useRowsSort({
74
+ rows: filteredRows,
75
+ sortFields: SORT_BY,
76
+ sortBy,
77
+ sortDirection: direction,
78
+ getCustomSort,
79
+ });
80
+
81
+ return (
82
+ <BundleModulesComponent
83
+ jobs={jobs}
84
+ chunks={chunks}
85
+ {...restProps}
86
+ {...searchParams}
87
+ {...sortParams}
88
+ totalRowCount={totalRowCount}
89
+ />
90
+ );
91
+ };
92
+
93
+ BundleModules.propTypes = {
94
+ jobs: PropTypes.arrayOf(PropTypes.object).isRequired, // eslint-disable-line react/forbid-prop-types
95
+ filters: PropTypes.object, // eslint-disable-line react/forbid-prop-types
96
+ search: PropTypes.string,
97
+ sortBy: PropTypes.string,
98
+ direction: PropTypes.string,
99
+ setState: PropTypes.func.isRequired,
100
+ };
101
+
102
+ BundleModules.defaultProps = {
103
+ filters: undefined,
104
+ search: undefined,
105
+ sortBy: undefined,
106
+ direction: undefined,
107
+ };