@bundle-stats/utils 3.4.0-alpha.3 → 3.4.0-beta.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 (88) hide show
  1. package/lib/transformers/budgets-insights.js +100 -52
  2. package/lib/transformers/budgets-insights.js.map +1 -1
  3. package/lib/types.js +3 -0
  4. package/lib/types.js.map +1 -0
  5. package/lib/webpack/extract/assets.js +11 -7
  6. package/lib/webpack/extract/assets.js.map +1 -1
  7. package/lib/webpack/metrics.js +1 -1
  8. package/lib/webpack/metrics.js.map +1 -1
  9. package/lib-esm/transformers/budgets-insights.js +98 -49
  10. package/lib-esm/transformers/budgets-insights.js.map +1 -1
  11. package/lib-esm/types.js +2 -0
  12. package/lib-esm/types.js.map +1 -0
  13. package/lib-esm/webpack/extract/assets.js +11 -7
  14. package/lib-esm/webpack/extract/assets.js.map +1 -1
  15. package/lib-esm/webpack/metrics.js +1 -1
  16. package/lib-esm/webpack/metrics.js.map +1 -1
  17. package/package.json +12 -12
  18. package/src/transformers/budgets-insights.ts +144 -75
  19. package/src/types.ts +14 -0
  20. package/src/webpack/extract/{assets.js → assets.ts} +41 -12
  21. package/src/webpack/metrics.ts +1 -1
  22. package/types/browsertime/compare.d.ts +1 -0
  23. package/types/browsertime/constants.d.ts +1 -0
  24. package/types/browsertime/extract.d.ts +6 -0
  25. package/types/browsertime/filter.d.ts +1 -0
  26. package/types/browsertime/index.d.ts +6 -0
  27. package/types/browsertime/metrics.d.ts +107 -0
  28. package/types/browsertime/selectors.d.ts +1 -0
  29. package/types/config/component-links.d.ts +35 -0
  30. package/types/config/delta.d.ts +9 -0
  31. package/types/config/file-types.d.ts +45 -0
  32. package/types/config/index.d.ts +11 -0
  33. package/types/config/insights.d.ts +4 -0
  34. package/types/config/metrics.d.ts +35 -0
  35. package/types/constants.d.ts +165 -0
  36. package/types/i18n.d.ts +16 -0
  37. package/types/index.d.ts +7 -0
  38. package/types/jobs/create-job.d.ts +1 -0
  39. package/types/jobs/create-jobs.d.ts +1 -0
  40. package/types/jobs/create-summary.d.ts +1 -0
  41. package/types/jobs/index.d.ts +2 -0
  42. package/types/lighthouse/compare.d.ts +1 -0
  43. package/types/lighthouse/constants.d.ts +1 -0
  44. package/types/lighthouse/extract/audits.d.ts +6 -0
  45. package/types/lighthouse/extract/category-scores.d.ts +6 -0
  46. package/types/lighthouse/extract/index.d.ts +1 -0
  47. package/types/lighthouse/extract/score-category-scores.d.ts +10 -0
  48. package/types/lighthouse/filter.d.ts +1 -0
  49. package/types/lighthouse/index.d.ts +6 -0
  50. package/types/lighthouse/metrics.d.ts +65 -0
  51. package/types/lighthouse/selectors.d.ts +1 -0
  52. package/types/polyfills.d.ts +1 -0
  53. package/types/report/add-row-metric-data.d.ts +8 -0
  54. package/types/report/compare-metrics.d.ts +2 -0
  55. package/types/report/create.d.ts +14 -0
  56. package/types/report/get-metric-changed.d.ts +2 -0
  57. package/types/report/index.d.ts +5 -0
  58. package/types/report/merge-metrics-by-key.d.ts +4 -0
  59. package/types/report/types.d.ts +8 -0
  60. package/types/transformers/budgets-insights.d.ts +34 -0
  61. package/types/transformers/index.d.ts +1 -0
  62. package/types/types.d.ts +9 -0
  63. package/types/utils/component-links.d.ts +193 -0
  64. package/types/utils/date.d.ts +2 -0
  65. package/types/utils/delta.d.ts +6 -0
  66. package/types/utils/file-types.d.ts +4 -0
  67. package/types/utils/format.d.ts +5 -0
  68. package/types/utils/index.d.ts +6 -0
  69. package/types/utils/metrics.d.ts +3 -0
  70. package/types/webpack/compare.d.ts +14 -0
  71. package/types/webpack/constants.d.ts +33 -0
  72. package/types/webpack/extract/assets-cache-invalidation.d.ts +7 -0
  73. package/types/webpack/extract/assets-chunk-count.d.ts +7 -0
  74. package/types/webpack/extract/assets-count.d.ts +7 -0
  75. package/types/webpack/extract/assets-size-total-insight.d.ts +12 -0
  76. package/types/webpack/extract/assets-size.d.ts +11 -0
  77. package/types/webpack/extract/assets.d.ts +11 -0
  78. package/types/webpack/extract/index.d.ts +1 -0
  79. package/types/webpack/extract/meta.d.ts +6 -0
  80. package/types/webpack/extract/modules-count.d.ts +7 -0
  81. package/types/webpack/extract/modules-packages-count.d.ts +7 -0
  82. package/types/webpack/extract/modules-packages-duplicate.d.ts +21 -0
  83. package/types/webpack/extract/modules-packages.d.ts +7 -0
  84. package/types/webpack/extract/modules.d.ts +2 -0
  85. package/types/webpack/index.d.ts +8 -0
  86. package/types/webpack/metrics.d.ts +116 -0
  87. package/types/webpack/selectors.d.ts +41 -0
  88. package/types/webpack/utils.d.ts +8 -0
@@ -1,5 +1,7 @@
1
1
  import get from 'lodash/get';
2
+ import template from 'lodash/template';
2
3
 
4
+ import * as types from '../types';
3
5
  import { InsightType } from '../constants';
4
6
  import { getGlobalMetricType } from '../utils';
5
7
 
@@ -12,132 +14,199 @@ interface Options {
12
14
  budgets?: Array<OptionBudgetMetric>;
13
15
  }
14
16
 
15
- interface BudgetInsight {
17
+ interface BudgetInsightMetricData {
16
18
  currentValue: number;
17
19
  budgetValue: number;
18
20
  failed: boolean;
19
21
  }
20
22
 
21
- interface BudgetInsightInfo {
23
+ interface BudgetInsightMetric {
24
+ /** Metric budget insight type */
22
25
  type: InsightType;
23
26
  message: {
24
- template: string;
25
- data: Record<string, unknown>;
26
- };
27
- source: {
28
- metricId: string;
29
- budgetInsight: BudgetInsight;
27
+ text: string;
28
+ md: string;
30
29
  };
30
+ /** Metric budget check data */
31
+ data: BudgetInsightMetricData;
31
32
  }
32
33
 
33
- interface BudgetInsights {
34
- [metricId: string]: BudgetInsight;
34
+ interface BudgetInsight extends types.Insight {
35
+ data: {
36
+ [metricId: string]: BudgetInsightMetric;
37
+ };
35
38
  }
36
39
 
37
40
  interface BudgetsInsightsOutput {
38
41
  insights: {
39
- budgets: BudgetInsights;
42
+ budgets: BudgetInsight;
40
43
  };
41
44
  }
42
45
 
43
- export const getExtract =
44
- (source: string) => (
45
- _: unknown,
46
- currentExtractedData: any,
47
- __: unknown,
48
- options: Options = {},
49
- ): BudgetsInsightsOutput | null => {
50
- const { budgets: budgetsOptions } = options;
46
+ const resolveType = (insights: Array<[string, BudgetInsightMetric]>): InsightType => {
47
+ if (insights.find(([_, { type }]) => type === InsightType.ERROR)) {
48
+ return InsightType.ERROR;
49
+ }
51
50
 
52
- if (!budgetsOptions) {
53
- return null;
54
- }
51
+ if (insights.find(([_, { type }]) => type === InsightType.WARNING)) {
52
+ return InsightType.WARNING;
53
+ }
55
54
 
56
- const insights: Array<[string, BudgetInsight]> = [];
55
+ return InsightType.SUCCESS;
56
+ };
57
57
 
58
- budgetsOptions.forEach((budgetOption) => {
59
- const { metric: budgetMetricId, value: budgetValue } = budgetOption;
60
- const currentValue = get(currentExtractedData, `metrics.${budgetMetricId}.value`);
61
- const metric = getGlobalMetricType(`${source}.${budgetMetricId}`);
58
+ // 3/3 budget checks passed
59
+ // 2/3 budget checks failed
60
+ // 1 failed, 1 warning, 2 success
62
61
 
63
- if (!currentValue) {
64
- return;
65
- }
62
+ const budgetInsightTemplate = template(
63
+ '<%= count %>/<%= total %> budget checks <%= status %>'
64
+ );
66
65
 
67
- const isValueOverBudget = currentValue > budgetValue;
66
+ const resolveStatus = (failedCount: number, warningCount: number): string => {
67
+ if (failedCount) {
68
+ return 'failed';
69
+ }
68
70
 
69
- const budgetInsight = {
70
- currentValue,
71
- budgetValue,
72
- failed: metric.biggerIsBetter ? !isValueOverBudget : isValueOverBudget,
73
- };
71
+ if (warningCount) {
72
+ return 'warned';
73
+ }
74
74
 
75
- insights.push([budgetMetricId, budgetInsight]);
76
- });
75
+ return 'passed';
76
+ };
77
77
 
78
- if (insights.length === 0) {
79
- return null;
80
- }
78
+ const getMessage = (insights: Array<[string, BudgetInsightMetric]>) => {
79
+ const total = insights.length;
80
+ const failedCount = insights.filter(([___, insight]) => insight.type === InsightType.ERROR).length;
81
+ const warningCount = insights.filter(([___, insight]) => insight.type === InsightType.WARNING).length;
82
+ const count = failedCount || warningCount || total;
83
+ const status = resolveStatus(failedCount, warningCount);
81
84
 
82
- return {
83
- insights: {
84
- budgets: Object.fromEntries(insights),
85
- },
86
- };
85
+ return {
86
+ text: budgetInsightTemplate({
87
+ count,
88
+ total,
89
+ status,
90
+ }),
91
+ md: budgetInsightTemplate({
92
+ count: `**${count}**`,
93
+ total: `**${total}**`,
94
+ status,
95
+ }),
87
96
  };
97
+ };
98
+
99
+ const budgetInsightMetricTemplate = template(
100
+ // Add escapes for (|) to avoid lodash.template syntax errors
101
+ // eslint-disable-next-line no-useless-escape
102
+ '<%= metricLabel %> is <%= diffLabel %> budget \(<%= currentValue %> / <%= budgetValue %>\)',
103
+ );
88
104
 
89
- const resolveDiffLabel = (budgetInsight: BudgetInsight): string => {
90
- const { currentValue, budgetValue } = budgetInsight;
105
+ const resolveDiffLabel = (metricBudgetInsight: BudgetInsightMetricData): string => {
106
+ const { currentValue, budgetValue } = metricBudgetInsight;
91
107
 
92
108
  if (currentValue > budgetValue) {
93
- return 'over';
109
+ return 'above';
94
110
  }
95
111
 
96
112
  if (currentValue < budgetValue) {
97
- return 'under';
113
+ return 'below';
98
114
  }
99
115
 
100
116
  return 'equal with';
101
117
  };
102
118
 
103
- const resolveType = (budgetInsight: BudgetInsight): InsightType => {
104
- if (budgetInsight.failed) {
119
+ const resolveBudgetInsightMetricType = (metricBudgetInsight: BudgetInsightMetricData): InsightType => {
120
+ if (metricBudgetInsight.failed) {
105
121
  return InsightType.ERROR;
106
122
  }
107
123
 
108
- if (budgetInsight.currentValue === budgetInsight.budgetValue) {
124
+ if (metricBudgetInsight.currentValue === metricBudgetInsight.budgetValue) {
109
125
  return InsightType.WARNING;
110
126
  }
111
127
 
112
128
  return InsightType.SUCCESS;
113
129
  };
114
130
 
115
- // Add escapes for (|) to avoid lodash.template syntax errors
116
- // eslint-disable-next-line no-useless-escape
117
- export const INFO_MESSAGE_TEMPLATE = '<%= metricLabel %> value \(<%= currentValue %>\) is <%= diffLabel %> <%= budgetValue %> budget';
131
+ export const getExtract =
132
+ (source: string) => (
133
+ _: unknown,
134
+ currentExtractedData: any,
135
+ __: unknown,
136
+ options: Options = {},
137
+ ): BudgetsInsightsOutput | null => {
138
+ const { budgets: budgetsOptions } = options;
139
+
140
+ if (!budgetsOptions) {
141
+ return null;
142
+ }
118
143
 
119
- export const getInfo = (globalMetricId: string, budgetInsight: BudgetInsight): BudgetInsightInfo => {
120
- const metric = getGlobalMetricType(globalMetricId);
144
+ const insights: Array<[string, BudgetInsightMetric]> = [];
121
145
 
122
- const diffLabel = resolveDiffLabel(budgetInsight);
123
- const type = resolveType(budgetInsight);
124
- const currentValue = metric.formatter(budgetInsight.currentValue);
125
- const budgetValue = metric.formatter(budgetInsight.budgetValue);
146
+ budgetsOptions.forEach((budgetOption) => {
147
+ const { metric: sourceMetricId, value: budgetValue } = budgetOption;
148
+ const currentValue = get(currentExtractedData, `metrics.${sourceMetricId}.value`);
149
+ const metricData = getGlobalMetricType(`${source}.${sourceMetricId}`);
126
150
 
127
- return {
128
- type,
129
- message: {
130
- template: INFO_MESSAGE_TEMPLATE,
131
- data: {
132
- metricLabel: metric.label,
133
- diffLabel,
151
+ if (!currentValue) {
152
+ return;
153
+ }
154
+
155
+ const isValueOverBudget = currentValue > budgetValue;
156
+ const failed = metricData.biggerIsBetter ? !isValueOverBudget : isValueOverBudget;
157
+
158
+ const budgetInsightMetricData = {
134
159
  currentValue,
135
160
  budgetValue,
161
+ failed,
162
+ };
163
+
164
+ // Message template data
165
+ const diffLabel = resolveDiffLabel(budgetInsightMetricData);
166
+ const type = resolveBudgetInsightMetricType(budgetInsightMetricData);
167
+ const currentFormattedValue = metricData.formatter(currentValue);
168
+ const budgetFormattedValue = metricData.formatter(budgetValue);
169
+
170
+ const messageText = budgetInsightMetricTemplate({
171
+ metricLabel: metricData.label,
172
+ currentValue: currentFormattedValue,
173
+ diffLabel,
174
+ budgetValue: budgetFormattedValue,
175
+ });
176
+ const messageMd = budgetInsightMetricTemplate({
177
+ metricLabel: `**${metricData.label}**`,
178
+ currentValue: `**${currentFormattedValue}**`,
179
+ diffLabel,
180
+ budgetValue: `**${budgetFormattedValue}**`,
181
+ });
182
+
183
+ insights.push([
184
+ sourceMetricId,
185
+ {
186
+ type,
187
+ message: {
188
+ text: messageText,
189
+ md: messageMd,
190
+ },
191
+ data: budgetInsightMetricData,
192
+ },
193
+ ]);
194
+ });
195
+
196
+ if (insights.length === 0) {
197
+ return null;
198
+ }
199
+
200
+ const type = resolveType(insights);
201
+ const message = getMessage(insights);
202
+
203
+ return {
204
+ insights: {
205
+ budgets: {
206
+ type,
207
+ message,
208
+ data: Object.fromEntries(insights),
209
+ },
136
210
  },
137
- },
138
- source: {
139
- metricId: globalMetricId,
140
- budgetInsight,
141
- },
211
+ };
142
212
  };
143
- };
package/src/types.ts ADDED
@@ -0,0 +1,14 @@
1
+ import * as constants from './constants';
2
+
3
+ /** Insight v2 structure */
4
+ export interface Insight {
5
+ type: constants.InsightType;
6
+ message: {
7
+ /** Insight message text format */
8
+ text: string;
9
+ /** Insight message markdown format */
10
+ md: string;
11
+ };
12
+ /** Insight specific data */
13
+ data: unknown;
14
+ }
@@ -1,17 +1,46 @@
1
- import get from 'lodash/get';
2
1
  import isEmpty from 'lodash/isEmpty';
3
2
 
4
3
  import { getAssetName, normalizeChunkId } from '../utils';
5
4
 
6
5
  const IGNORE_PATTERN = /\.(map|LICENSE\.txt)$/;
7
6
 
8
- export const extractAssets = (webpackStats) => {
9
- const webpackAssets = get(webpackStats, 'assets', []);
10
- const webpackChunks = get(webpackStats, 'chunks', []);
11
- const webpackEntrypoints = get(webpackStats, 'entrypoints', {});
7
+ interface WebpackStatsAsset {
8
+ name: string;
9
+ size: number;
10
+ }
12
11
 
13
- const entryItems = Object.values(webpackEntrypoints)
14
- .map(({ assets: items }) => items)
12
+ interface WebpackStatsEntrypointAsset {
13
+ name: string;
14
+ }
15
+
16
+ interface WebpackStatsEntrypoint {
17
+ // Webpack 5 provides { name, size }
18
+ assets: Array<WebpackStatsEntrypointAsset | string>;
19
+ }
20
+
21
+ type WebpackStatsEntrypoints = Record<string, WebpackStatsEntrypoint>;
22
+
23
+ interface WebpackStatsChunk {
24
+ id: string;
25
+ entry: boolean;
26
+ initial: boolean;
27
+ files: Array<string>;
28
+ names: Array<string>;
29
+ }
30
+
31
+ export const extractAssets = (webpackStats: any) => {
32
+ const webpackAssets: Array<WebpackStatsAsset> = webpackStats?.assets || [];
33
+ const webpackChunks: Array<WebpackStatsChunk> = webpackStats?.chunks || [];
34
+ const webpackEntrypoints: WebpackStatsEntrypoints = webpackStats?.entrypoints || {};
35
+
36
+ const entrypointsAssets = Object.values(webpackEntrypoints)
37
+ .map(({ assets: items }) => items.map((item) => {
38
+ if (typeof item === 'object') {
39
+ return item.name;
40
+ }
41
+
42
+ return item;
43
+ }))
15
44
  .flat();
16
45
 
17
46
  const initialItems = webpackChunks
@@ -43,7 +72,7 @@ export const extractAssets = (webpackStats) => {
43
72
  [normalizedName]: {
44
73
  name: baseName,
45
74
  value: size,
46
- isEntry: entryItems.includes(name),
75
+ isEntry: entrypointsAssets.includes(name),
47
76
  isInitial: initialItems.includes(name),
48
77
  isChunk: Boolean(assetChunk),
49
78
  ...(assetChunk ? { chunkId: assetChunk.id } : {}),
@@ -57,10 +86,10 @@ export const extractAssets = (webpackStats) => {
57
86
  },
58
87
  ...(!isEmpty(normalizedChunks)
59
88
  ? {
60
- meta: {
61
- chunks: normalizedChunks.map(({ id, name }) => ({ id, name })),
62
- },
63
- }
89
+ meta: {
90
+ chunks: normalizedChunks.map(({ id, name }) => ({ id, name })),
91
+ },
92
+ }
64
93
  : {}),
65
94
  };
66
95
  };
@@ -64,7 +64,7 @@ export const metrics = {
64
64
  },
65
65
  [MetricId.DuplicateCode]: {
66
66
  label: 'Duplicate Code',
67
- description: 'The percentage of duplicate module total size',
67
+ description: 'The percentage of total duplicate module size from the total module size.',
68
68
  url: 'https://relative-ci.com/documentation/metrics-and-data#modules-1',
69
69
  type: METRIC_TYPE_PERCENTAGE,
70
70
  biggerIsBetter: false,
@@ -0,0 +1 @@
1
+ export function compare(jobs: any): import("../report/types").ReportRow[];
@@ -0,0 +1 @@
1
+ export const SUMMARY_METRIC_PATHS: string[];
@@ -0,0 +1,6 @@
1
+ export function extract(browsertimeSource: any): {
2
+ metrics: {};
3
+ };
4
+ export type BrowsertimeMetricsRes = {
5
+ metrics: any;
6
+ };
@@ -0,0 +1 @@
1
+ export function filter(browsertimeSource: Object): any;
@@ -0,0 +1,6 @@
1
+ export * from "./compare";
2
+ export * from "./constants";
3
+ export * from "./extract";
4
+ export * from "./filter";
5
+ export * from "./metrics";
6
+ export * from "./selectors";
@@ -0,0 +1,107 @@
1
+ export namespace metrics {
2
+ namespace firstPaint {
3
+ export const label: string;
4
+ export { METRIC_TYPE_DURATION as type };
5
+ }
6
+ namespace fullyLoaded {
7
+ const label_1: string;
8
+ export { label_1 as label };
9
+ export { METRIC_TYPE_DURATION as type };
10
+ }
11
+ namespace backEndTime {
12
+ const label_2: string;
13
+ export { label_2 as label };
14
+ export { METRIC_TYPE_DURATION as type };
15
+ }
16
+ namespace domContentLoadedTime {
17
+ const label_3: string;
18
+ export { label_3 as label };
19
+ export { METRIC_TYPE_DURATION as type };
20
+ }
21
+ namespace domInteractiveTime {
22
+ const label_4: string;
23
+ export { label_4 as label };
24
+ export { METRIC_TYPE_DURATION as type };
25
+ }
26
+ namespace domainLookupTime {
27
+ const label_5: string;
28
+ export { label_5 as label };
29
+ export { METRIC_TYPE_DURATION as type };
30
+ }
31
+ namespace frontEndTime {
32
+ const label_6: string;
33
+ export { label_6 as label };
34
+ export { METRIC_TYPE_DURATION as type };
35
+ }
36
+ namespace pageDownloadTime {
37
+ const label_7: string;
38
+ export { label_7 as label };
39
+ export { METRIC_TYPE_DURATION as type };
40
+ }
41
+ namespace pageLoadTime {
42
+ const label_8: string;
43
+ export { label_8 as label };
44
+ export { METRIC_TYPE_DURATION as type };
45
+ }
46
+ namespace redirectionTime {
47
+ const label_9: string;
48
+ export { label_9 as label };
49
+ export { METRIC_TYPE_DURATION as type };
50
+ }
51
+ namespace serverConnectionTime {
52
+ const label_10: string;
53
+ export { label_10 as label };
54
+ export { METRIC_TYPE_DURATION as type };
55
+ }
56
+ namespace serverResponseTime {
57
+ const label_11: string;
58
+ export { label_11 as label };
59
+ export { METRIC_TYPE_DURATION as type };
60
+ }
61
+ namespace firstContentfulPaint {
62
+ const label_12: string;
63
+ export { label_12 as label };
64
+ export { METRIC_TYPE_DURATION as type };
65
+ }
66
+ namespace rumSpeedIndex {
67
+ const label_13: string;
68
+ export { label_13 as label };
69
+ export { METRIC_TYPE_DURATION as type };
70
+ }
71
+ namespace firstVisualChange {
72
+ const label_14: string;
73
+ export { label_14 as label };
74
+ export { METRIC_TYPE_DURATION as type };
75
+ }
76
+ namespace lastVisualChange {
77
+ const label_15: string;
78
+ export { label_15 as label };
79
+ export { METRIC_TYPE_DURATION as type };
80
+ }
81
+ namespace perceptualSpeedIndex {
82
+ const label_16: string;
83
+ export { label_16 as label };
84
+ export { METRIC_TYPE_DURATION as type };
85
+ }
86
+ namespace speedIndex {
87
+ const label_17: string;
88
+ export { label_17 as label };
89
+ export { METRIC_TYPE_DURATION as type };
90
+ }
91
+ namespace visualComplete85 {
92
+ const label_18: string;
93
+ export { label_18 as label };
94
+ export { METRIC_TYPE_DURATION as type };
95
+ }
96
+ namespace visualComplete95 {
97
+ const label_19: string;
98
+ export { label_19 as label };
99
+ export { METRIC_TYPE_DURATION as type };
100
+ }
101
+ namespace visualComplete99 {
102
+ const label_20: string;
103
+ export { label_20 as label };
104
+ export { METRIC_TYPE_DURATION as type };
105
+ }
106
+ }
107
+ import { METRIC_TYPE_DURATION } from "../config/metrics";
@@ -0,0 +1 @@
1
+ export function selectors(job: any): {};
@@ -0,0 +1,35 @@
1
+ export const ASSET_ENTRY_TYPE: "et";
2
+ export const ASSET_FILE_TYPE: "ft";
3
+ export const MODULE_CHUNK: "c";
4
+ export const MODULE_FILE_TYPE: "mft";
5
+ export const MODULE_SOURCE_TYPE: "mst";
6
+ export namespace ASSET_FILTERS {
7
+ const ASSET: string;
8
+ const CHANGED: string;
9
+ const ENTRY: string;
10
+ const INITIAL: string;
11
+ const CHUNK: string;
12
+ }
13
+ export namespace MODULE_FILTERS {
14
+ const CHANGED_1: string;
15
+ export { CHANGED_1 as CHANGED };
16
+ export const DUPLICATED: string;
17
+ export const FIRST_PARTY: string;
18
+ export const THIRD_PARTY: string;
19
+ }
20
+ export namespace PACKAGE_FILTERS {
21
+ const CHANGED_2: string;
22
+ export { CHANGED_2 as CHANGED };
23
+ export const DUPLICATE: string;
24
+ }
25
+ export namespace SECTIONS {
26
+ const TOTALS: string;
27
+ const ASSETS: string;
28
+ const MODULES: string;
29
+ const PACKAGES: string;
30
+ }
31
+ export namespace COMPONENT {
32
+ const BUNDLE_ASSETS: string;
33
+ const BUNDLE_MODULES: string;
34
+ const BUNDLE_PACKAGES: string;
35
+ }
@@ -0,0 +1,9 @@
1
+ export const DELTA_TYPE_NEGATIVE: "NEGATIVE";
2
+ export const DELTA_TYPE_NO_CHANGE: "NO_CHANGE";
3
+ export const DELTA_TYPE_POSITIVE: "POSITIVE";
4
+ export const DELTA_TYPE_LEVEL_LOW: "LOW";
5
+ export const DELTA_TYPE_LEVEL_HIGH: "HIGH";
6
+ export const DELTA_TYPE_LOW_NEGATIVE: string;
7
+ export const DELTA_TYPE_HIGH_NEGATIVE: string;
8
+ export const DELTA_TYPE_LOW_POSITIVE: string;
9
+ export const DELTA_TYPE_HIGH_POSITIVE: string;
@@ -0,0 +1,45 @@
1
+ export const FILE_TYPE_CSS: "CSS";
2
+ export const FILE_TYPE_JS: "JS";
3
+ export const FILE_TYPE_IMG: "IMG";
4
+ export const FILE_TYPE_MEDIA: "MEDIA";
5
+ export const FILE_TYPE_FONT: "FONT";
6
+ export const FILE_TYPE_HTML: "HTML";
7
+ export const FILE_TYPE_OTHER: "OTHER";
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;
15
+ }
16
+ export namespace FILE_TYPE_LABELS {
17
+ const CSS_1: string;
18
+ export { CSS_1 as CSS };
19
+ const JS_1: string;
20
+ export { JS_1 as JS };
21
+ const IMG_1: string;
22
+ export { IMG_1 as IMG };
23
+ const MEDIA_1: string;
24
+ export { MEDIA_1 as MEDIA };
25
+ const FONT_1: string;
26
+ export { FONT_1 as FONT };
27
+ const HTML_1: string;
28
+ export { HTML_1 as HTML };
29
+ export const OTHER: string;
30
+ }
31
+ export const FILE_TYPES: string[];
32
+ export namespace MODULE_SOURCE_PATTERNS {
33
+ const CSS_2: RegExp;
34
+ export { CSS_2 as CSS };
35
+ const JS_2: RegExp;
36
+ export { JS_2 as JS };
37
+ }
38
+ export const MODULE_SOURCE_FILE_TYPES: string[];
39
+ export namespace MODULE_DESTINATION_PATTERNS {
40
+ const CSS_3: RegExp;
41
+ export { CSS_3 as CSS };
42
+ const JS_3: RegExp;
43
+ export { JS_3 as JS };
44
+ }
45
+ export const MODULE_DESTINATION_FILE_TYPES: string[];
@@ -0,0 +1,11 @@
1
+ export * from "./component-links";
2
+ export * from "./file-types";
3
+ export * from "./insights";
4
+ export * from "./metrics";
5
+ export * from "./delta";
6
+ export const PACKAGES_SEPARATOR: ":";
7
+ export const PACKAGE_ID_SEPARATOR: "~";
8
+ export const SOURCE_PATH_WEBPACK_STATS: "webpack";
9
+ export const SOURCE_PATH_LIGHTHOUSE: "lighthouse";
10
+ export const SOURCE_PATH_BROWSERTIME: "browsertime";
11
+ export const SOURCE_PATHS: string[];
@@ -0,0 +1,4 @@
1
+ export const INSIGHT_ERROR: "ERROR";
2
+ export const INSIGHT_INFO: "INFO";
3
+ export const INSIGHT_WARNING: "WARNING";
4
+ export const INSIGHTS: string[];
@@ -0,0 +1,35 @@
1
+ export const METRIC_TYPE_FILE_SIZE: "METRIC_TYPE_FILE_SIZE";
2
+ export const METRIC_TYPE_DURATION: "METRIC_TYPE_DURATION";
3
+ export const METRIC_TYPE_NUMERIC: "METRIC_TYPE_NUMERIC";
4
+ export const METRIC_TYPE_SCORE: "METRIC_TYPE_SCORE";
5
+ export const METRIC_TYPE_PERCENTAGE: "METRIC_TYPE_PERCENTAGE";
6
+ export namespace METRIC_TYPES {
7
+ namespace METRIC_TYPE_NUMERIC {
8
+ export const biggerIsBetter: boolean;
9
+ export { formatNumber as formatter };
10
+ }
11
+ namespace METRIC_TYPE_SCORE {
12
+ const biggerIsBetter_1: boolean;
13
+ export { biggerIsBetter_1 as biggerIsBetter };
14
+ export { formatNumber as formatter };
15
+ }
16
+ namespace METRIC_TYPE_DURATION {
17
+ const biggerIsBetter_2: boolean;
18
+ export { biggerIsBetter_2 as biggerIsBetter };
19
+ export { formatDuration as formatter };
20
+ }
21
+ namespace METRIC_TYPE_FILE_SIZE {
22
+ const biggerIsBetter_3: boolean;
23
+ export { biggerIsBetter_3 as biggerIsBetter };
24
+ export { formatFileSize as formatter };
25
+ }
26
+ namespace METRIC_TYPE_PERCENTAGE {
27
+ const biggerIsBetter_4: boolean;
28
+ export { biggerIsBetter_4 as biggerIsBetter };
29
+ export { formatPercentage as formatter };
30
+ }
31
+ }
32
+ import { formatNumber } from "../utils/format";
33
+ import { formatDuration } from "../utils/format";
34
+ import { formatFileSize } from "../utils/format";
35
+ import { formatPercentage } from "../utils/format";