@bundle-stats/utils 4.2.2 → 4.2.3-beta.1

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 (188) hide show
  1. package/README.md +15 -10
  2. package/lib/browsertime/metrics.js +22 -22
  3. package/lib/browsertime/metrics.js.map +1 -1
  4. package/lib/config/component-links.js +7 -1
  5. package/lib/config/component-links.js.map +1 -1
  6. package/lib/config/file-types.js +3 -3
  7. package/lib/config/file-types.js.map +1 -1
  8. package/lib/config/index.js +1 -2
  9. package/lib/config/index.js.map +1 -1
  10. package/lib/config/metric-types.js +28 -0
  11. package/lib/config/metric-types.js.map +1 -0
  12. package/lib/constants.js +23 -22
  13. package/lib/constants.js.map +1 -1
  14. package/lib/i18n.js +15 -10
  15. package/lib/i18n.js.map +1 -1
  16. package/lib/jobs/create-job.js +17 -7
  17. package/lib/jobs/create-job.js.map +1 -1
  18. package/lib/jobs/create-jobs.js.map +1 -1
  19. package/lib/lighthouse/metrics.js +13 -13
  20. package/lib/lighthouse/metrics.js.map +1 -1
  21. package/lib/report/add-row-metric-data.js +4 -4
  22. package/lib/report/add-row-metric-data.js.map +1 -1
  23. package/lib/report/compare-metrics.js +4 -1
  24. package/lib/report/compare-metrics.js.map +1 -1
  25. package/lib/report/create.js +17 -7
  26. package/lib/report/create.js.map +1 -1
  27. package/lib/report/get-metric-changed.js.map +1 -1
  28. package/lib/report/index.js +1 -0
  29. package/lib/report/index.js.map +1 -1
  30. package/lib/report/merge-metrics-by-key.js +1 -1
  31. package/lib/report/merge-metrics-by-key.js.map +1 -1
  32. package/lib/utils/component-links.js +191 -27
  33. package/lib/utils/component-links.js.map +1 -1
  34. package/lib/utils/date.js.map +1 -1
  35. package/lib/utils/delta.js +35 -30
  36. package/lib/utils/delta.js.map +1 -1
  37. package/lib/utils/format.js +5 -6
  38. package/lib/utils/format.js.map +1 -1
  39. package/lib/utils/insights.js.map +1 -1
  40. package/lib/utils/metrics.js +49 -32
  41. package/lib/utils/metrics.js.map +1 -1
  42. package/lib/webpack/compare.js +16 -12
  43. package/lib/webpack/compare.js.map +1 -1
  44. package/lib/webpack/extract/assets.js +7 -1
  45. package/lib/webpack/extract/assets.js.map +1 -1
  46. package/lib/webpack/extract/meta.js.map +1 -1
  47. package/lib/webpack/extract/modules-packages-duplicate.js +13 -8
  48. package/lib/webpack/extract/modules-packages-duplicate.js.map +1 -1
  49. package/lib/webpack/extract/modules-packages-new-insight.js.map +1 -1
  50. package/lib/webpack/extract/modules-packages.js +8 -1
  51. package/lib/webpack/extract/modules-packages.js.map +1 -1
  52. package/lib/webpack/extract/modules.js +45 -20
  53. package/lib/webpack/extract/modules.js.map +1 -1
  54. package/lib/webpack/metrics.js +35 -34
  55. package/lib/webpack/metrics.js.map +1 -1
  56. package/lib/webpack/selectors.js +40 -3
  57. package/lib/webpack/selectors.js.map +1 -1
  58. package/lib/webpack/types.js +1 -1
  59. package/lib/webpack/types.js.map +1 -1
  60. package/lib/webpack/utils.js +37 -25
  61. package/lib/webpack/utils.js.map +1 -1
  62. package/lib-esm/browsertime/metrics.js +22 -22
  63. package/lib-esm/browsertime/metrics.js.map +1 -1
  64. package/lib-esm/config/component-links.js +6 -0
  65. package/lib-esm/config/component-links.js.map +1 -1
  66. package/lib-esm/config/file-types.js +3 -3
  67. package/lib-esm/config/file-types.js.map +1 -1
  68. package/lib-esm/config/index.js +1 -2
  69. package/lib-esm/config/index.js.map +1 -1
  70. package/lib-esm/config/metric-types.js +25 -0
  71. package/lib-esm/config/metric-types.js.map +1 -0
  72. package/lib-esm/constants.js +19 -18
  73. package/lib-esm/constants.js.map +1 -1
  74. package/lib-esm/i18n.js +15 -10
  75. package/lib-esm/i18n.js.map +1 -1
  76. package/lib-esm/jobs/create-job.js.map +1 -1
  77. package/lib-esm/jobs/create-jobs.js.map +1 -1
  78. package/lib-esm/lighthouse/metrics.js +13 -13
  79. package/lib-esm/lighthouse/metrics.js.map +1 -1
  80. package/lib-esm/report/add-row-metric-data.js +4 -4
  81. package/lib-esm/report/add-row-metric-data.js.map +1 -1
  82. package/lib-esm/report/compare-metrics.js +4 -1
  83. package/lib-esm/report/compare-metrics.js.map +1 -1
  84. package/lib-esm/report/create.js.map +1 -1
  85. package/lib-esm/report/get-metric-changed.js.map +1 -1
  86. package/lib-esm/report/index.js +1 -0
  87. package/lib-esm/report/index.js.map +1 -1
  88. package/lib-esm/report/merge-metrics-by-key.js +1 -1
  89. package/lib-esm/report/merge-metrics-by-key.js.map +1 -1
  90. package/lib-esm/utils/component-links.js +185 -27
  91. package/lib-esm/utils/component-links.js.map +1 -1
  92. package/lib-esm/utils/date.js.map +1 -1
  93. package/lib-esm/utils/delta.js +32 -26
  94. package/lib-esm/utils/delta.js.map +1 -1
  95. package/lib-esm/utils/format.js.map +1 -1
  96. package/lib-esm/utils/insights.js.map +1 -1
  97. package/lib-esm/utils/metrics.js +44 -27
  98. package/lib-esm/utils/metrics.js.map +1 -1
  99. package/lib-esm/webpack/compare.js +7 -5
  100. package/lib-esm/webpack/compare.js.map +1 -1
  101. package/lib-esm/webpack/extract/assets.js +7 -1
  102. package/lib-esm/webpack/extract/assets.js.map +1 -1
  103. package/lib-esm/webpack/extract/meta.js.map +1 -1
  104. package/lib-esm/webpack/extract/modules-packages-duplicate.js +13 -8
  105. package/lib-esm/webpack/extract/modules-packages-duplicate.js.map +1 -1
  106. package/lib-esm/webpack/extract/modules-packages-new-insight.js.map +1 -1
  107. package/lib-esm/webpack/extract/modules-packages.js +8 -1
  108. package/lib-esm/webpack/extract/modules-packages.js.map +1 -1
  109. package/lib-esm/webpack/extract/modules.js +45 -20
  110. package/lib-esm/webpack/extract/modules.js.map +1 -1
  111. package/lib-esm/webpack/metrics.js +35 -34
  112. package/lib-esm/webpack/metrics.js.map +1 -1
  113. package/lib-esm/webpack/selectors.js +35 -1
  114. package/lib-esm/webpack/selectors.js.map +1 -1
  115. package/lib-esm/webpack/utils.js +37 -25
  116. package/lib-esm/webpack/utils.js.map +1 -1
  117. package/package.json +20 -22
  118. package/src/browsertime/metrics.js +22 -22
  119. package/src/config/component-links.js +7 -0
  120. package/src/config/file-types.js +3 -3
  121. package/src/config/index.js +1 -2
  122. package/src/config/metric-types.ts +25 -0
  123. package/src/constants.ts +94 -34
  124. package/src/i18n.js +15 -10
  125. package/src/lighthouse/metrics.js +13 -15
  126. package/src/report/add-row-metric-data.ts +42 -38
  127. package/src/report/compare-metrics.ts +7 -4
  128. package/src/report/create.ts +1 -1
  129. package/src/report/index.js +1 -0
  130. package/src/report/merge-metrics-by-key.ts +7 -5
  131. package/src/report/types.ts +17 -0
  132. package/src/utils/component-links.ts +276 -35
  133. package/src/utils/delta.ts +98 -0
  134. package/src/utils/metrics.ts +88 -0
  135. package/src/webpack/compare.ts +62 -0
  136. package/src/webpack/extract/assets.ts +13 -7
  137. package/src/webpack/extract/modules-packages-duplicate.ts +23 -15
  138. package/src/webpack/extract/modules-packages.ts +74 -61
  139. package/src/webpack/extract/modules.ts +66 -33
  140. package/src/webpack/{metrics.js → metrics.ts} +41 -39
  141. package/src/webpack/selectors.js +82 -9
  142. package/src/webpack/types.ts +13 -4
  143. package/src/webpack/utils.ts +173 -0
  144. package/types/browsertime/compare.d.ts +1 -1
  145. package/types/browsertime/metrics.d.ts +63 -43
  146. package/types/config/component-links.d.ts +26 -18
  147. package/types/config/file-types.d.ts +17 -17
  148. package/types/config/index.d.ts +1 -2
  149. package/types/config/metric-types.d.ts +2 -0
  150. package/types/constants.d.ts +52 -29
  151. package/types/i18n.d.ts +19 -14
  152. package/types/lighthouse/compare.d.ts +1 -1
  153. package/types/lighthouse/filter.d.ts +1 -1
  154. package/types/lighthouse/metrics.d.ts +36 -28
  155. package/types/report/add-row-metric-data.d.ts +1 -16
  156. package/types/report/compare-metrics.d.ts +1 -1
  157. package/types/report/index.d.ts +1 -0
  158. package/types/report/merge-metrics-by-key.d.ts +1 -1
  159. package/types/report/types.d.ts +12 -0
  160. package/types/utils/component-links.d.ts +24 -8
  161. package/types/utils/delta.d.ts +4 -6
  162. package/types/utils/metrics.d.ts +4 -3
  163. package/types/webpack/compare.d.ts +11 -14
  164. package/types/webpack/constants.d.ts +1 -1
  165. package/types/webpack/extract/assets-size-total-insight.d.ts +2 -2
  166. package/types/webpack/extract/modules-packages-duplicate.d.ts +3 -3
  167. package/types/webpack/extract/modules.d.ts +1 -1
  168. package/types/webpack/metrics.d.ts +7 -153
  169. package/types/webpack/selectors.d.ts +21 -7
  170. package/types/webpack/types.d.ts +4 -4
  171. package/types/webpack/utils.d.ts +8 -8
  172. package/CHANGELOG.md +0 -333
  173. package/lib/config/delta.js +0 -13
  174. package/lib/config/delta.js.map +0 -1
  175. package/lib/config/metrics.js +0 -32
  176. package/lib/config/metrics.js.map +0 -1
  177. package/lib-esm/config/delta.js +0 -10
  178. package/lib-esm/config/delta.js.map +0 -1
  179. package/lib-esm/config/metrics.js +0 -29
  180. package/lib-esm/config/metrics.js.map +0 -1
  181. package/src/config/delta.js +0 -11
  182. package/src/config/metrics.js +0 -35
  183. package/src/utils/delta.js +0 -94
  184. package/src/utils/metrics.js +0 -92
  185. package/src/webpack/compare.js +0 -81
  186. package/src/webpack/utils.js +0 -155
  187. package/types/config/delta.d.ts +0 -9
  188. package/types/config/metrics.d.ts +0 -35
@@ -1,35 +1,43 @@
1
1
  export const ASSET_ENTRY_TYPE: "et";
2
+ export const ASSET_CHUNK: "c";
2
3
  export const ASSET_FILE_TYPE: "ft";
3
4
  export const MODULE_CHUNK: "c";
4
5
  export const MODULE_FILE_TYPE: "mft";
5
6
  export const MODULE_SOURCE_TYPE: "mst";
6
7
  export namespace ASSET_FILTERS {
7
- const OTHER: string;
8
- const CHANGED: string;
9
- const ENTRY: string;
10
- const INITIAL: string;
11
- const CHUNK: string;
8
+ let OTHER: string;
9
+ let CHANGED: string;
10
+ let ENTRY: string;
11
+ let INITIAL: string;
12
+ let CHUNK: string;
12
13
  }
13
14
  export namespace MODULE_FILTERS {
14
- const CHANGED_1: string;
15
+ let CHANGED_1: string;
15
16
  export { CHANGED_1 as CHANGED };
16
- export const DUPLICATED: string;
17
- export const FIRST_PARTY: string;
18
- export const THIRD_PARTY: string;
17
+ export let DUPLICATED: string;
18
+ export let FIRST_PARTY: string;
19
+ export let THIRD_PARTY: string;
20
+ export let METRIC: string;
19
21
  }
20
22
  export namespace PACKAGE_FILTERS {
21
- const CHANGED_2: string;
23
+ let CHANGED_2: string;
22
24
  export { CHANGED_2 as CHANGED };
23
- export const DUPLICATE: string;
25
+ export let DUPLICATE: string;
24
26
  }
25
27
  export namespace SECTIONS {
26
- const TOTALS: string;
27
- const ASSETS: string;
28
- const MODULES: string;
29
- const PACKAGES: string;
28
+ let TOTALS: string;
29
+ let ASSETS: string;
30
+ let MODULES: string;
31
+ let PACKAGES: string;
30
32
  }
31
33
  export namespace COMPONENT {
32
- const BUNDLE_ASSETS: string;
33
- const BUNDLE_MODULES: string;
34
- const BUNDLE_PACKAGES: string;
34
+ let BUNDLE_ASSETS: string;
35
+ let BUNDLE_MODULES: string;
36
+ let BUNDLE_PACKAGES: string;
37
+ }
38
+ export namespace MODULE_SOURCE_TYPE_LABELS {
39
+ let FIRST_PARTY_1: string;
40
+ export { FIRST_PARTY_1 as FIRST_PARTY };
41
+ let THIRD_PARTY_1: string;
42
+ export { THIRD_PARTY_1 as THIRD_PARTY };
35
43
  }
@@ -6,40 +6,40 @@ export const FILE_TYPE_FONT: "FONT";
6
6
  export const FILE_TYPE_HTML: "HTML";
7
7
  export const FILE_TYPE_OTHER: "OTHER";
8
8
  export namespace FILE_TYPE_PATTERNS {
9
- const CSS: RegExp;
10
- const JS: RegExp;
11
- const IMG: RegExp;
12
- const MEDIA: RegExp;
13
- const FONT: RegExp;
14
- const HTML: RegExp;
9
+ let CSS: RegExp;
10
+ let JS: RegExp;
11
+ let IMG: RegExp;
12
+ let MEDIA: RegExp;
13
+ let FONT: RegExp;
14
+ let HTML: RegExp;
15
15
  }
16
16
  export namespace FILE_TYPE_LABELS {
17
- const CSS_1: string;
17
+ let CSS_1: string;
18
18
  export { CSS_1 as CSS };
19
- const JS_1: string;
19
+ let JS_1: string;
20
20
  export { JS_1 as JS };
21
- const IMG_1: string;
21
+ let IMG_1: string;
22
22
  export { IMG_1 as IMG };
23
- const MEDIA_1: string;
23
+ let MEDIA_1: string;
24
24
  export { MEDIA_1 as MEDIA };
25
- const FONT_1: string;
25
+ let FONT_1: string;
26
26
  export { FONT_1 as FONT };
27
- const HTML_1: string;
27
+ let HTML_1: string;
28
28
  export { HTML_1 as HTML };
29
- export const OTHER: string;
29
+ export let OTHER: string;
30
30
  }
31
31
  export const FILE_TYPES: string[];
32
32
  export namespace MODULE_SOURCE_PATTERNS {
33
- const CSS_2: RegExp;
33
+ let CSS_2: RegExp;
34
34
  export { CSS_2 as CSS };
35
- const JS_2: RegExp;
35
+ let JS_2: RegExp;
36
36
  export { JS_2 as JS };
37
37
  }
38
38
  export const MODULE_SOURCE_FILE_TYPES: string[];
39
39
  export namespace MODULE_DESTINATION_PATTERNS {
40
- const CSS_3: RegExp;
40
+ let CSS_3: RegExp;
41
41
  export { CSS_3 as CSS };
42
- const JS_3: RegExp;
42
+ let JS_3: RegExp;
43
43
  export { JS_3 as JS };
44
44
  }
45
45
  export const MODULE_DESTINATION_FILE_TYPES: string[];
@@ -1,6 +1,5 @@
1
1
  export * from "./component-links";
2
2
  export * from "./file-types";
3
- export * from "./metrics";
4
- export * from "./delta";
3
+ export * from "./metric-types";
5
4
  export const PACKAGES_SEPARATOR: ":";
6
5
  export const PACKAGE_ID_SEPARATOR: "~";
@@ -0,0 +1,2 @@
1
+ import { MetricTypes, MetricTypeConfig } from '../constants';
2
+ export declare const METRIC_TYPE_CONFIGS: Record<MetricTypes, MetricTypeConfig>;
@@ -9,42 +9,55 @@ export declare enum InsightType {
9
9
  INFO = "info",
10
10
  WARNING = "warning"
11
11
  }
12
- export declare enum MetricTypeType {
13
- METRIC_TYPE_NUMERIC = "METRIC_TYPE_NUMERIC",
14
- METRIC_TYPE_SCORE = "METRIC_TYPE_SCORE",
15
- METRIC_TYPE_FILE_SIZE = "METRIC_TYPE_FILE_SIZE",
16
- METRIC_TYPE_DURATION = "METRIC_TYPE_DURATION",
17
- METRIC_TYPE_PERCENTAGE = "METRIC_TYPE_PERCENTAGE"
12
+ export declare enum MetricTypes {
13
+ Numeric = "METRIC_TYPE_NUMERIC",
14
+ Score = "METRIC_TYPE_SCORE",
15
+ FileSize = "METRIC_TYPE_FILE_SIZE",
16
+ Duration = "METRIC_TYPE_DURATION",
17
+ Percentage = "METRIC_TYPE_PERCENTAGE"
18
18
  }
19
19
  export interface MetricTypeConfig {
20
- label: string;
21
- description: string;
22
- type: MetricTypeType;
23
- }
24
- export interface MetricType extends MetricTypeConfig {
25
- formatter: Function;
26
- biggerIsBetter: boolean;
27
- }
28
- export declare enum MetricRunInfoDeltaType {
29
- 'HIGH_NEGATIVE' = "HIGH_NEGATIVE",
30
- 'NEGATIVE' = "NEGATIVE",
31
- 'LOW_NEGATIVE' = "LOW_NEGATIVE",
32
- 'NO_CHANGE' = "NO_CHANGE",
33
- 'LOW_POSITIVE' = "LOW_POSITIVE",
34
- 'POSITIVE' = "POSITIVE",
35
- 'HIGH_POSITIVE' = "HIGH_POSITIVE"
20
+ biggerIsBetter?: boolean | null;
21
+ formatter: (value: number | null) => string;
36
22
  }
23
+ export interface MetricConfig {
24
+ label: string;
25
+ type: MetricTypes;
26
+ description?: string;
27
+ url?: string;
28
+ biggerIsBetter?: MetricTypeConfig['biggerIsBetter'];
29
+ skipDelta?: boolean;
30
+ }
31
+ export type Metric = MetricTypeConfig & MetricConfig;
32
+ export declare enum DeltaType {
33
+ HIGH_NEGATIVE = "HIGH_NEGATIVE",
34
+ NEGATIVE = "NEGATIVE",
35
+ LOW_NEGATIVE = "LOW_NEGATIVE",
36
+ NO_CHANGE = "NO_CHANGE",
37
+ CHANGE = "CHANGE",
38
+ LOW_POSITIVE = "LOW_POSITIVE",
39
+ POSITIVE = "POSITIVE",
40
+ HIGH_POSITIVE = "HIGH_POSITIVE"
41
+ }
42
+ export type MetricRunInfoDeltaType = `${DeltaType}`;
37
43
  export interface MetricRun {
38
44
  value: number;
39
45
  }
40
- export interface MetricRunInfo {
46
+ export interface MetricRunDelta {
47
+ delta: number;
48
+ deltaPercentage: number;
49
+ }
50
+ export interface MetricRunInfoBaseline {
41
51
  value: number;
42
52
  displayValue: string;
43
- delta?: number;
44
- deltaPercentage?: number;
45
- deltaType?: MetricRunInfoDeltaType;
46
- displayDelta?: string;
47
- displayDeltaPercentage?: string;
53
+ }
54
+ export interface MetricRunInfo extends MetricRunInfoBaseline {
55
+ delta: number;
56
+ deltaPercentage: number;
57
+ deltaType: MetricRunInfoDeltaType;
58
+ displayDelta: string;
59
+ displayDeltaPercentage: string;
60
+ regression?: boolean | null;
48
61
  }
49
62
  export type JobSection<T = object> = Record<Source, T>;
50
63
  export declare enum JobSectionId {
@@ -54,6 +67,15 @@ export declare enum JobSectionId {
54
67
  metrics = "metrics",
55
68
  rawData = "rawData"
56
69
  }
70
+ export interface WebpackChunk {
71
+ id: string;
72
+ name: string;
73
+ }
74
+ export interface JobMeta {
75
+ [Source.webpack]: {
76
+ chunks?: Array<WebpackChunk>;
77
+ };
78
+ }
57
79
  export interface JobSummaryItem {
58
80
  baseline: number;
59
81
  current: number;
@@ -66,6 +88,7 @@ export interface JobInsight<T = object> {
66
88
  }
67
89
  export interface JobInsightAssetsSizeTotalData {
68
90
  md: string;
91
+ text: string;
69
92
  info: MetricRunInfo;
70
93
  }
71
94
  export type JobInsightDuplicatePackagesData = Record<string, Array<string>>;
@@ -92,7 +115,7 @@ export interface JobInsightsInfo {
92
115
  export type JobMetricsSource = Record<string, MetricRun | Record<string, MetricRun>>;
93
116
  export type JobMetrics = JobSection<JobMetricsSource>;
94
117
  export interface JobData {
95
- [JobSectionId.meta]?: JobSection;
118
+ [JobSectionId.meta]?: JobMeta;
96
119
  [JobSectionId.insights]?: JobInsights;
97
120
  [JobSectionId.summary]?: JobSummary;
98
121
  [JobSectionId.metrics]?: JobMetrics;
package/types/i18n.d.ts CHANGED
@@ -1,20 +1,25 @@
1
1
  declare namespace _default {
2
- const COMPONENT_LINK_TOTALS: string;
3
- const COMPONENT_LINK_BUNDLE_ASSETS_INITIAL_JS: string;
4
- const COMPONENT_LINK_BUNDLE_ASSETS_INITIAL_CSS: string;
5
- const COMPONENT_LINK_BUNDLE_ASSETS_CACHE_INVALIDATION: string;
6
- const COMPONENT_LINK_BUNDLE_ASSETS_COUNT: string;
7
- const COMPONENT_LINK_BUNDLE_ASSETS_CHUNK_COUNT: string;
8
- const COMPONENT_LINK_MODULES: string;
9
- const COMPONENT_LINK_MODULES_DUPLICATE: string;
10
- const COMPONENT_LINK_CHUNK_MODULES: string;
11
- const COMPONENT_LINK_PACKAGES_COUNT: string;
12
- const COMPONENT_LINK_PACKAGES_CHANGED: string;
13
- const COMPONENT_LINK_PACKAGES_DUPLICATE: string;
14
- const COMPONENT_LINK_PACKAGES_DUPLICATE_CHANGED: string;
15
- const COMPONENT_LINK_VIEW_PACKAGE: string;
2
+ let COMPONENT_LINK_TOTALS: string;
3
+ let COMPONENT_LINK_BUNDLE_ASSET_DETAILS: string;
4
+ let COMPONENT_LINK_BUNDLE_ASSETS_INITIAL_JS: string;
5
+ let COMPONENT_LINK_BUNDLE_ASSETS_INITIAL_CSS: string;
6
+ let COMPONENT_LINK_BUNDLE_ASSETS_CACHE_INVALIDATION: string;
7
+ let COMPONENT_LINK_BUNDLE_ASSETS_COUNT: string;
8
+ let COMPONENT_LINK_BUNDLE_ASSETS_CHUNK_COUNT: string;
9
+ let COMPONENT_LINK_BUNDLE_ASSETS_CHUNKS: string;
10
+ let COMPONENT_LINK_MODULES: string;
11
+ let COMPONENT_LINK_MODULES_DUPLICATE: string;
12
+ function COMPONENT_LINK_MODULES_BY_FILE_TYPE(fileType: any): string;
13
+ function COMPONENT_LINK_MODULES_BY_SOURCE(source: any): string;
14
+ let COMPONENT_LINK_CHUNK_MODULES: string;
15
+ let COMPONENT_LINK_PACKAGES_COUNT: string;
16
+ let COMPONENT_LINK_PACKAGES_CHANGED: string;
17
+ let COMPONENT_LINK_PACKAGES_DUPLICATE: string;
18
+ let COMPONENT_LINK_PACKAGES_DUPLICATE_CHANGED: string;
19
+ let COMPONENT_LINK_VIEW_PACKAGE: string;
16
20
  function COMPONENT_LINK_BUNDLE_ASSETS_BY_FILE_TYPE({ label }: {
17
21
  label: any;
18
22
  }): string;
23
+ function COMPONENT_LINK_BUNDLE_ASSETS_BY_ENTRY_TYPE(assetType: any): string;
19
24
  }
20
25
  export default _default;
@@ -1 +1 @@
1
- export function compare(jobs: any): import("../report/types").ReportRow[];
1
+ export function compare(jobs: any): import("..").ReportMetricRow[];
@@ -1 +1 @@
1
- export function filter(source: Object): import('../constants').LighthouseSource;
1
+ export function filter(source: Object): import("../constants").LighthouseSource;
@@ -1,65 +1,73 @@
1
1
  export namespace metrics {
2
2
  namespace score {
3
- export const label: string;
4
- export { METRIC_TYPE_SCORE as type };
3
+ let label: string;
4
+ let type: MetricTypes;
5
5
  }
6
6
  namespace performanceScore {
7
- const label_1: string;
7
+ let label_1: string;
8
8
  export { label_1 as label };
9
- export { METRIC_TYPE_SCORE as type };
9
+ let type_1: MetricTypes;
10
+ export { type_1 as type };
10
11
  }
11
12
  namespace accessibilityScore {
12
- const label_2: string;
13
+ let label_2: string;
13
14
  export { label_2 as label };
14
- export { METRIC_TYPE_SCORE as type };
15
+ let type_2: MetricTypes;
16
+ export { type_2 as type };
15
17
  }
16
18
  namespace bestPracticesScore {
17
- const label_3: string;
19
+ let label_3: string;
18
20
  export { label_3 as label };
19
- export { METRIC_TYPE_SCORE as type };
21
+ let type_3: MetricTypes;
22
+ export { type_3 as type };
20
23
  }
21
24
  namespace seoScore {
22
- const label_4: string;
25
+ let label_4: string;
23
26
  export { label_4 as label };
24
- export { METRIC_TYPE_SCORE as type };
27
+ let type_4: MetricTypes;
28
+ export { type_4 as type };
25
29
  }
26
30
  namespace pwaScore {
27
- const label_5: string;
31
+ let label_5: string;
28
32
  export { label_5 as label };
29
- export { METRIC_TYPE_SCORE as type };
33
+ let type_5: MetricTypes;
34
+ export { type_5 as type };
30
35
  }
31
36
  namespace speedIndex {
32
- const label_6: string;
37
+ let label_6: string;
33
38
  export { label_6 as label };
34
- export { METRIC_TYPE_DURATION as type };
39
+ let type_6: MetricTypes;
40
+ export { type_6 as type };
35
41
  }
36
42
  namespace firstMeaningfulPaint {
37
- const label_7: string;
43
+ let label_7: string;
38
44
  export { label_7 as label };
39
- export { METRIC_TYPE_DURATION as type };
45
+ let type_7: MetricTypes;
46
+ export { type_7 as type };
40
47
  }
41
48
  namespace timeToFirstByte {
42
- const label_8: string;
49
+ let label_8: string;
43
50
  export { label_8 as label };
44
- export { METRIC_TYPE_DURATION as type };
51
+ let type_8: MetricTypes;
52
+ export { type_8 as type };
45
53
  }
46
54
  namespace firstInteractive {
47
- const label_9: string;
55
+ let label_9: string;
48
56
  export { label_9 as label };
49
- export { METRIC_TYPE_DURATION as type };
57
+ let type_9: MetricTypes;
58
+ export { type_9 as type };
50
59
  }
51
60
  namespace totalByteWeight {
52
- const label_10: string;
61
+ let label_10: string;
53
62
  export { label_10 as label };
54
- export { METRIC_TYPE_FILE_SIZE as type };
63
+ let type_10: MetricTypes;
64
+ export { type_10 as type };
55
65
  }
56
66
  namespace domSize {
57
- const label_11: string;
67
+ let label_11: string;
58
68
  export { label_11 as label };
59
- export { METRIC_TYPE_NUMERIC as type };
69
+ let type_11: MetricTypes;
70
+ export { type_11 as type };
60
71
  }
61
72
  }
62
- import { METRIC_TYPE_SCORE } from "../config/metrics";
63
- import { METRIC_TYPE_DURATION } from "../config/metrics";
64
- import { METRIC_TYPE_FILE_SIZE } from "../config/metrics";
65
- import { METRIC_TYPE_NUMERIC } from "../config/metrics";
73
+ import { MetricTypes } from '../constants';
@@ -1,17 +1,2 @@
1
1
  import * as types from './types';
2
- export declare const getAddRowMetricData: (metricType?: string) => (row: types.ReportRow) => {
3
- biggerIsBetter: any;
4
- label: any;
5
- changed: boolean;
6
- runs: ({
7
- value: number;
8
- displayValue: string;
9
- delta?: number | undefined;
10
- deltaPercentage?: number | undefined;
11
- deltaType?: import("..").MetricRunInfoDeltaType | undefined;
12
- displayDelta?: string | undefined;
13
- displayDeltaPercentage?: string | undefined;
14
- name?: string | undefined;
15
- } | null)[];
16
- key: string;
17
- };
2
+ export declare const getAddRowMetricData: (metricType?: string) => (row: types.ReportRow) => types.ReportMetricRow;
@@ -1,2 +1,2 @@
1
1
  import * as types from './types';
2
- export declare const compareMetrics: (jobs: Array<any>, selectMetrics: (job: any) => any, metricType: string, rowTransformers?: ((row: types.ReportRow) => types.ReportRow)[] | undefined) => types.ReportRow[];
2
+ export declare const compareMetrics: (jobs: Array<any>, selectMetrics: (job: any) => any, metricType?: string, rowTransformers?: Array<types.MetricReportRowTransformFn>) => Array<types.ReportMetricRow>;
@@ -3,3 +3,4 @@ export * from "./compare-metrics";
3
3
  export * from "./create";
4
4
  export * from "./get-metric-changed";
5
5
  export * from "./merge-metrics-by-key";
6
+ export * from "./types";
@@ -1,4 +1,4 @@
1
1
  import * as types from './types';
2
2
  type RunMetrics = Record<string, types.MetricValue>;
3
- export declare const mergeMetricsByKey: (runs: Array<RunMetrics>, rowTransformers?: ((row: types.ReportRow) => types.ReportRow)[] | undefined) => Array<types.ReportRow>;
3
+ export declare const mergeMetricsByKey: (runs: Array<RunMetrics>, rowTransformers?: Array<types.MetricReportRowTransformFn>) => Array<types.ReportRow>;
4
4
  export {};
@@ -1,3 +1,4 @@
1
+ import type { MetricRunInfo, MetricRunInfoBaseline, MetricTypeConfig } from '../constants';
1
2
  export interface MetricValue {
2
3
  value: number;
3
4
  name?: string;
@@ -6,3 +7,14 @@ export interface ReportRow {
6
7
  key: string;
7
8
  runs: Array<MetricValue | null>;
8
9
  }
10
+ export type ReportMetricRun = {
11
+ name?: MetricValue['name'];
12
+ } & (MetricRunInfo | MetricRunInfoBaseline);
13
+ export interface ReportMetricRow {
14
+ key: string;
15
+ label: string;
16
+ biggerIsBetter: MetricTypeConfig['biggerIsBetter'];
17
+ changed: boolean;
18
+ runs: Array<ReportMetricRun | null>;
19
+ }
20
+ export type MetricReportRowTransformFn = (row: ReportRow) => ReportMetricRow;
@@ -1,7 +1,13 @@
1
- export type ComponentLinkFilters = Record<string, boolean>;
1
+ import { QueryParamConfig } from 'serialize-query-params';
2
+ import { COMPONENT } from '../config/component-links';
3
+ export type ComponentLinkFilters = Record<string, boolean | string>;
2
4
  export interface ComponentLinkParams {
3
5
  search?: string;
4
- filters: ComponentLinkFilters;
6
+ entryId?: string;
7
+ metric?: string;
8
+ filters?: ComponentLinkFilters;
9
+ sortBy?: string;
10
+ direction?: string;
5
11
  }
6
12
  export interface ComponentLink {
7
13
  title: string;
@@ -21,21 +27,31 @@ export declare const BUNDLE_ASSETS_INITIAL_CSS: ComponentLink;
21
27
  export declare const BUNDLE_ASSETS_CACHE_INVALIDATION: ComponentLink;
22
28
  export declare const BUNDLE_ASSETS_COUNT: ComponentLink;
23
29
  export declare const BUNDLE_ASSETS_CHUNK_COUNT: ComponentLink;
30
+ export declare const getBundleAsset: (entryId: string) => ComponentLink;
31
+ export declare const getBundleAssetsByEntryType: (assetType: "entry" | "initial" | "chunk") => ComponentLink;
32
+ export declare const getBundleAssetsFileTypeComponentLink: (fileType: string, label?: string) => ComponentLink;
33
+ export declare const getBundleAssetsByChunk: (chunkIds: Array<string>, chunkId: string) => ComponentLink;
24
34
  export declare const BUNDLE_MODULES: ComponentLink;
25
35
  export declare const BUNDLE_MODULES_DUPLICATE: ComponentLink;
26
36
  export declare const getBundleModulesBySearch: (search: string) => ComponentLink;
27
37
  export declare const getBundleModulesByChunk: (chunkIds: Array<string>, chunkId: string, fileType?: string) => ComponentLink;
38
+ export declare const getBundleModulesByFileTpe: (fileType: string, fileTypeLabel?: string) => ComponentLink;
39
+ export declare const getBundleModulesBySource: (thirdParty: boolean, label?: string) => ComponentLink;
28
40
  export declare const BUNDLE_PACKAGES_COUNT: ComponentLink;
29
41
  export declare const BUNDLE_PACKAGES_CHANGED: ComponentLink;
30
42
  export declare const BUNDLE_PACKAGES_DUPLICATE: ComponentLink;
31
43
  export declare const BUNDLE_PACKAGES_DUPLICATE_CHANGED: ComponentLink;
32
- export declare const getBundleAssetsFileTypeComponentLink: (fileType: string, label: string) => ComponentLink;
33
44
  export declare const getBundlePackagesByNameComponentLink: (search: string) => ComponentLink;
34
- export declare const getComponentStateQueryString: (params?: {}) => string;
45
+ export declare const ComponentStateParam: QueryParamConfig<any, any>;
46
+ export declare const COMPONENT_STATE_META: {
47
+ readonly [COMPONENT.BUNDLE_ASSETS]: QueryParamConfig<any, any>;
48
+ readonly [COMPONENT.BUNDLE_MODULES]: QueryParamConfig<any, any>;
49
+ readonly [COMPONENT.BUNDLE_PACKAGES]: QueryParamConfig<any, any>;
50
+ };
51
+ type ComponentStateQueryStringParams = Record<string, ComponentLinkParams>;
52
+ export declare const getComponentStateQueryString: (params?: ComponentStateQueryStringParams) => string;
53
+ export declare const getComponentStateData: (queryString: string) => ComponentStateQueryStringParams;
35
54
  export declare const METRIC_COMPONENT_LINKS: Map<string, {
36
55
  link: ComponentLink;
37
- showDelta?: undefined;
38
- } | {
39
- link: ComponentLink;
40
- showDelta: boolean;
41
56
  }>;
57
+ export {};
@@ -1,6 +1,4 @@
1
- export function getDelta(baseline: any, current: any): {
2
- delta: any;
3
- deltaPercentage: number;
4
- };
5
- export function formatDelta(value: number, formatter: Function): string;
6
- export function getDeltaType(deltaValue: number, biggerIsBetter: boolean): string;
1
+ import type { MetricRun, MetricRunDelta, MetricRunInfoDeltaType, MetricTypeConfig } from '../constants';
2
+ export declare function getDelta(baseline?: MetricRun | null, current?: MetricRun | null): MetricRunDelta;
3
+ export declare function formatDelta(value: number, formatter: MetricTypeConfig['formatter']): string;
4
+ export declare function getDeltaType(deltaPercentageValue: number, biggerIsBetter?: MetricTypeConfig['biggerIsBetter']): MetricRunInfoDeltaType;
@@ -1,3 +1,4 @@
1
- export function createGetMetricType(metrics: Object): Function;
2
- export const getGlobalMetricType: Function;
3
- export function getMetricRunInfo(metric: import('../constants').MetricType, currentValue: number, baselineValue: number): import('../constants').MetricRunInfo;
1
+ import { MetricRunInfo, MetricRunInfoBaseline, Metric, MetricTypes, MetricTypeConfig } from '../constants';
2
+ export declare function createGetMetricType(metrics: Record<string, unknown>): (key: string, type?: MetricTypes) => Metric;
3
+ export declare function getGlobalMetricType(key: string, type?: MetricTypes): Metric;
4
+ export declare function getMetricRunInfo(metricType: MetricTypeConfig, current: number, baseline?: number): MetricRunInfo | MetricRunInfoBaseline;
@@ -1,14 +1,11 @@
1
- export namespace compareBySection {
2
- export { compareStats as stats };
3
- export { compareSizes as sizes };
4
- export { compareAssets as assets };
5
- export { compareModules as modules };
6
- export { comparePackages as packages };
7
- }
8
- export function compare(jobs: Object[]): Object;
9
- declare function compareStats(jobs: Object[], rowTransformers?: Function[] | undefined): Object[];
10
- declare function compareSizes(jobs: Object[], rowTransformers?: Function[] | undefined): Object[];
11
- declare function compareAssets(jobs: Object[], rowTransformers?: Function[] | undefined): Object[];
12
- declare function compareModules(jobs: Object[], rowTransformers?: Function[] | undefined): Object[];
13
- declare function comparePackages(jobs: Object[], rowTransformers?: Function[] | undefined): Object[];
14
- export {};
1
+ import { MetricReportRowTransformFn } from '../report/types';
2
+ export declare const compareModuleDuplicateSize: (jobs: Array<unknown>, rowTransformers?: Array<MetricReportRowTransformFn>) => import("..").ReportMetricRow[];
3
+ export declare const compareModuleTotalSize: (jobs: Array<unknown>, rowTransformers?: Array<MetricReportRowTransformFn>) => import("..").ReportMetricRow[];
4
+ export declare const compareBySection: {
5
+ stats: (jobs: Array<unknown>, rowTransformers?: Array<MetricReportRowTransformFn>) => import("..").ReportMetricRow[];
6
+ sizes: (jobs: Array<unknown>, rowTransformers?: Array<MetricReportRowTransformFn>) => import("..").ReportMetricRow[];
7
+ assets: (jobs: Array<unknown>, rowTransformers?: Array<MetricReportRowTransformFn>) => import("..").ReportMetricRow[];
8
+ modules: (jobs: Array<unknown>, rowTransformers?: Array<MetricReportRowTransformFn>) => import("..").ReportMetricRow[];
9
+ packages: (jobs: Array<unknown>, rowTransformers?: Array<MetricReportRowTransformFn>) => import("..").ReportMetricRow[];
10
+ };
11
+ export declare const compare: (jobs: Array<unknown>) => {};
@@ -7,4 +7,4 @@ export const SECTIONS: string[];
7
7
  export const SUMMARY_METRIC_PATHS: Metric[];
8
8
  export const MODULE_PATH_PACKAGES: RegExp;
9
9
  export const PACKAGE_PATH_NAME: RegExp;
10
- import { Metric } from "./types";
10
+ import { Metric } from './types';
@@ -5,9 +5,9 @@ export function extractAssetsSizeTotalInsight(_: any, currentExtractedData: any,
5
5
  data: {
6
6
  text: string;
7
7
  md: string;
8
- info: import("../../constants").MetricRunInfo;
8
+ info: import("../..").MetricRunInfoBaseline | import("../..").MetricRunInfo;
9
9
  };
10
10
  };
11
11
  };
12
12
  };
13
- import { InsightType } from "../../constants";
13
+ import { InsightType } from '../../constants';
@@ -1,13 +1,13 @@
1
1
  import { Job, JobInsight, JobInsightDuplicatePackagesV3Data, JobInsights, MetricRun } from '../../constants';
2
2
  interface ModulesPackagesDuplicateData {
3
- insights: {
3
+ insights?: {
4
4
  duplicatePackages?: JobInsights['webpack']['duplicatePackages'];
5
- duplicatePackagesV3: JobInsights['webpack']['duplicatePackagesV3'];
5
+ duplicatePackagesV3?: JobInsights['webpack']['duplicatePackagesV3'];
6
6
  };
7
7
  metrics: {
8
8
  duplicatePackagesCount: MetricRun;
9
9
  };
10
10
  }
11
- export declare const getDuplicatePackagesInsight: (duplicatePackagesMap: Record<string, Array<string>>, baselineDuplicatePackagesMap?: Record<string, Array<string>>) => JobInsight<JobInsightDuplicatePackagesV3Data>;
11
+ export declare const getDuplicatePackagesInsight: (duplicatePackagesMap: Record<string, Array<string>>, baselineDuplicatePackagesMap?: Record<string, Array<string>>) => JobInsight<JobInsightDuplicatePackagesV3Data> | null;
12
12
  export declare const extractModulesPackagesDuplicate: (_: any, currentExtractedData: any, baselineJob?: Job) => ModulesPackagesDuplicateData;
13
13
  export {};
@@ -1,3 +1,3 @@
1
1
  import { WebpackStatsFiltered } from '@bundle-stats/plugin-webpack-filter';
2
- import { MetricsModules } from '../types';
2
+ import type { MetricsModules } from '../types';
3
3
  export declare const extractModules: (webpackStats?: WebpackStatsFiltered) => MetricsModules;