@bundle-stats/utils 4.7.5-beta.0 → 4.7.5-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browsertime/metrics.js +22 -22
- package/lib/browsertime/metrics.js.map +1 -1
- package/lib/config/index.js +1 -2
- package/lib/config/index.js.map +1 -1
- package/lib/config/metric-types.js +28 -0
- package/lib/config/metric-types.js.map +1 -0
- package/lib/constants.js +9 -19
- package/lib/constants.js.map +1 -1
- package/lib/lighthouse/metrics.js +13 -13
- package/lib/lighthouse/metrics.js.map +1 -1
- package/lib/report/add-row-metric-data.js +2 -2
- package/lib/report/add-row-metric-data.js.map +1 -1
- package/lib/report/create.js.map +1 -1
- package/lib/utils/delta.js +29 -26
- package/lib/utils/delta.js.map +1 -1
- package/lib/utils/metrics.js +47 -29
- package/lib/utils/metrics.js.map +1 -1
- package/lib/webpack/compare.js +11 -11
- package/lib/webpack/compare.js.map +1 -1
- package/lib/webpack/metrics.js +23 -23
- package/lib/webpack/metrics.js.map +1 -1
- package/lib-esm/browsertime/metrics.js +22 -22
- package/lib-esm/browsertime/metrics.js.map +1 -1
- package/lib-esm/config/index.js +1 -2
- package/lib-esm/config/index.js.map +1 -1
- package/lib-esm/config/metric-types.js +25 -0
- package/lib-esm/config/metric-types.js.map +1 -0
- package/lib-esm/constants.js +8 -18
- package/lib-esm/constants.js.map +1 -1
- package/lib-esm/lighthouse/metrics.js +13 -13
- package/lib-esm/lighthouse/metrics.js.map +1 -1
- package/lib-esm/report/add-row-metric-data.js +2 -2
- package/lib-esm/report/add-row-metric-data.js.map +1 -1
- package/lib-esm/report/create.js.map +1 -1
- package/lib-esm/utils/delta.js +29 -26
- package/lib-esm/utils/delta.js.map +1 -1
- package/lib-esm/utils/metrics.js +44 -27
- package/lib-esm/utils/metrics.js.map +1 -1
- package/lib-esm/webpack/compare.js +4 -4
- package/lib-esm/webpack/compare.js.map +1 -1
- package/lib-esm/webpack/metrics.js +24 -24
- package/lib-esm/webpack/metrics.js.map +1 -1
- package/package.json +4 -4
- package/src/browsertime/metrics.js +22 -22
- package/src/config/index.js +1 -2
- package/src/config/metric-types.ts +25 -0
- package/src/constants.ts +64 -28
- package/src/lighthouse/metrics.js +13 -15
- package/src/report/add-row-metric-data.ts +3 -2
- package/src/report/create.ts +1 -1
- package/src/utils/delta.ts +91 -0
- package/src/utils/metrics.ts +81 -0
- package/src/webpack/compare.js +19 -12
- package/src/webpack/metrics.ts +26 -41
- package/types/browsertime/metrics.d.ts +43 -23
- package/types/config/index.d.ts +1 -2
- package/types/config/metric-types.d.ts +2 -0
- package/types/constants.d.ts +24 -22
- package/types/lighthouse/metrics.d.ts +25 -17
- package/types/report/add-row-metric-data.d.ts +4 -3
- package/types/utils/delta.d.ts +4 -6
- package/types/utils/metrics.d.ts +4 -3
- package/types/webpack/metrics.d.ts +3 -11
- package/types/webpack/utils.d.ts +1 -1
- package/lib/config/delta.js +0 -13
- package/lib/config/delta.js.map +0 -1
- package/lib/config/metrics.js +0 -32
- package/lib/config/metrics.js.map +0 -1
- package/lib-esm/config/delta.js +0 -10
- package/lib-esm/config/delta.js.map +0 -1
- package/lib-esm/config/metrics.js +0 -29
- package/lib-esm/config/metrics.js.map +0 -1
- package/src/config/delta.js +0 -11
- package/src/config/metrics.js +0 -31
- package/src/utils/delta.js +0 -94
- package/src/utils/metrics.js +0 -92
- package/types/config/delta.d.ts +0 -9
- package/types/config/metrics.d.ts +0 -6
|
@@ -1,55 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
METRIC_TYPE_SCORE, METRIC_TYPE_DURATION, METRIC_TYPE_FILE_SIZE, METRIC_TYPE_NUMERIC,
|
|
3
|
-
} from '../config/metrics';
|
|
1
|
+
import { MetricTypes } from '../constants';
|
|
4
2
|
|
|
5
3
|
export const metrics = {
|
|
6
4
|
score: {
|
|
7
5
|
label: 'Score',
|
|
8
|
-
type:
|
|
6
|
+
type: MetricTypes.Score,
|
|
9
7
|
},
|
|
10
8
|
performanceScore: {
|
|
11
9
|
label: 'Performance',
|
|
12
|
-
type:
|
|
10
|
+
type: MetricTypes.Score,
|
|
13
11
|
},
|
|
14
12
|
accessibilityScore: {
|
|
15
13
|
label: 'Accessibility',
|
|
16
|
-
type:
|
|
14
|
+
type: MetricTypes.Score,
|
|
17
15
|
},
|
|
18
16
|
bestPracticesScore: {
|
|
19
17
|
label: 'Best Practices',
|
|
20
|
-
type:
|
|
18
|
+
type: MetricTypes.Score,
|
|
21
19
|
},
|
|
22
20
|
seoScore: {
|
|
23
21
|
label: 'SEO',
|
|
24
|
-
type:
|
|
22
|
+
type: MetricTypes.Score,
|
|
25
23
|
},
|
|
26
24
|
pwaScore: {
|
|
27
25
|
label: 'PWA',
|
|
28
|
-
type:
|
|
26
|
+
type: MetricTypes.Score,
|
|
29
27
|
},
|
|
30
28
|
|
|
31
29
|
speedIndex: {
|
|
32
30
|
label: 'Perceptual Speed Index',
|
|
33
|
-
type:
|
|
31
|
+
type: MetricTypes.Duration,
|
|
34
32
|
},
|
|
35
33
|
firstMeaningfulPaint: {
|
|
36
34
|
label: 'First Meaningful Paint',
|
|
37
|
-
type:
|
|
35
|
+
type: MetricTypes.Duration,
|
|
38
36
|
},
|
|
39
37
|
timeToFirstByte: {
|
|
40
38
|
label: 'Time To First Byte',
|
|
41
|
-
type:
|
|
39
|
+
type: MetricTypes.Duration,
|
|
42
40
|
},
|
|
43
41
|
firstInteractive: {
|
|
44
42
|
label: 'First Interactive',
|
|
45
|
-
type:
|
|
43
|
+
type: MetricTypes.Duration,
|
|
46
44
|
},
|
|
47
45
|
totalByteWeight: {
|
|
48
46
|
label: 'Total Weight',
|
|
49
|
-
type:
|
|
47
|
+
type: MetricTypes.FileSize,
|
|
50
48
|
},
|
|
51
49
|
domSize: {
|
|
52
50
|
label: 'DOM Size',
|
|
53
|
-
type:
|
|
51
|
+
type: MetricTypes.Numeric,
|
|
54
52
|
},
|
|
55
53
|
};
|
|
@@ -3,6 +3,7 @@ import get from 'lodash/get';
|
|
|
3
3
|
import { getGlobalMetricType, getMetricRunInfo } from '../utils/metrics';
|
|
4
4
|
import { getMetricChanged } from './get-metric-changed';
|
|
5
5
|
import * as types from './types';
|
|
6
|
+
import { MetricTypes } from '../constants';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Add row metric diff data
|
|
@@ -15,7 +16,7 @@ export const getAddRowMetricData = (metricType?: string) => (row: types.ReportRo
|
|
|
15
16
|
// - if the key is not matching an existing metric, use the default metricType
|
|
16
17
|
const metric = getGlobalMetricType(
|
|
17
18
|
key,
|
|
18
|
-
typeof metricType === 'string'
|
|
19
|
+
typeof metricType === 'string' ? (metricType as MetricTypes) : undefined, // explicit, avoid passing of map cb params
|
|
19
20
|
);
|
|
20
21
|
const { biggerIsBetter, label } = metric;
|
|
21
22
|
|
|
@@ -28,7 +29,7 @@ export const getAddRowMetricData = (metricType?: string) => (row: types.ReportRo
|
|
|
28
29
|
metric,
|
|
29
30
|
run.value,
|
|
30
31
|
// Get baseline value only if not the latest run
|
|
31
|
-
|
|
32
|
+
index + 1 < runs.length ? get(runs, [index + 1, 'value'], 0) : undefined,
|
|
32
33
|
);
|
|
33
34
|
|
|
34
35
|
return {
|
package/src/report/create.ts
CHANGED
|
@@ -44,7 +44,7 @@ export const createReport = (jobs: Array<Job>): Report => {
|
|
|
44
44
|
return Object.assign(data, { label: metric.label });
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
summary[sourceId] = summaryEntries;
|
|
47
|
+
summary[sourceId] = summaryEntries as any;
|
|
48
48
|
}, {});
|
|
49
49
|
|
|
50
50
|
const sectionsData = webpack.compare(jobs);
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import round from 'lodash/round';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
MetricRun,
|
|
5
|
+
MetricRunDelta,
|
|
6
|
+
MetricRunInfoDeltaType,
|
|
7
|
+
MetricTypeConfig,
|
|
8
|
+
} from '../constants';
|
|
9
|
+
|
|
10
|
+
export function getDelta(baseline?: MetricRun | null, current?: MetricRun | null): MetricRunDelta {
|
|
11
|
+
const baselineValue = baseline?.value || 0;
|
|
12
|
+
const currentValue = current?.value || 0;
|
|
13
|
+
|
|
14
|
+
if (baselineValue === currentValue) {
|
|
15
|
+
return {
|
|
16
|
+
delta: 0,
|
|
17
|
+
deltaPercentage: 0,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (baselineValue === 0) {
|
|
22
|
+
return {
|
|
23
|
+
delta: currentValue,
|
|
24
|
+
deltaPercentage: 100,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
delta: currentValue - baselineValue,
|
|
30
|
+
deltaPercentage: round((currentValue / baselineValue) * 100 - 100, 8),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Format delta output
|
|
36
|
+
*/
|
|
37
|
+
export function formatDelta(value: number, formatter: MetricTypeConfig['formatter']): string {
|
|
38
|
+
let sign = '';
|
|
39
|
+
|
|
40
|
+
if (value > 0) {
|
|
41
|
+
sign = '+';
|
|
42
|
+
} else if (value < 0) {
|
|
43
|
+
sign = '-';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let absValue = Math.abs(value);
|
|
47
|
+
|
|
48
|
+
if (absValue > 0 && absValue < 0.01) {
|
|
49
|
+
sign = `~${sign}`;
|
|
50
|
+
absValue = 0.01;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (absValue > 0.01) {
|
|
54
|
+
absValue = round(absValue, 2);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return `${sign}${formatter(absValue)}`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Get delta type
|
|
62
|
+
*/
|
|
63
|
+
export function getDeltaType(
|
|
64
|
+
deltaPercentageValue: number,
|
|
65
|
+
biggerIsBetter?: MetricTypeConfig['biggerIsBetter'],
|
|
66
|
+
): MetricRunInfoDeltaType {
|
|
67
|
+
if (deltaPercentageValue < -50) {
|
|
68
|
+
return biggerIsBetter ? 'HIGH_NEGATIVE' : 'HIGH_POSITIVE';
|
|
69
|
+
}
|
|
70
|
+
if (deltaPercentageValue < -5) {
|
|
71
|
+
return biggerIsBetter ? 'NEGATIVE' : 'POSITIVE';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (deltaPercentageValue < 0) {
|
|
75
|
+
return biggerIsBetter ? 'LOW_NEGATIVE' : 'LOW_POSITIVE';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (deltaPercentageValue === 0) {
|
|
79
|
+
return 'NO_CHANGE';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (deltaPercentageValue <= 5) {
|
|
83
|
+
return biggerIsBetter ? 'LOW_POSITIVE' : 'LOW_NEGATIVE';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (deltaPercentageValue <= 50) {
|
|
87
|
+
return biggerIsBetter ? 'POSITIVE' : 'NEGATIVE';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return biggerIsBetter ? 'HIGH_POSITIVE' : 'HIGH_NEGATIVE';
|
|
91
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import get from 'lodash/get';
|
|
2
|
+
|
|
3
|
+
import { MetricRunInfo, Metric, MetricTypes, MetricConfig, MetricTypeConfig } from '../constants';
|
|
4
|
+
import { METRIC_TYPE_CONFIGS } from '../config';
|
|
5
|
+
import { metrics as webpackMetricTypes } from '../webpack/metrics';
|
|
6
|
+
import { metrics as lighthouseMetricTypes } from '../lighthouse/metrics';
|
|
7
|
+
import { metrics as browsertimeMeticTypes } from '../browsertime/metrics';
|
|
8
|
+
import { formatPercentage } from './format';
|
|
9
|
+
import { formatDelta, getDelta, getDeltaType } from './delta';
|
|
10
|
+
|
|
11
|
+
export function createGetMetricType(metrics: Record<string, unknown>) {
|
|
12
|
+
return function getMetricType(key: string, type?: MetricTypes): Metric {
|
|
13
|
+
const metric = get(metrics, key) as MetricConfig;
|
|
14
|
+
|
|
15
|
+
if (metric?.type) {
|
|
16
|
+
return {
|
|
17
|
+
...METRIC_TYPE_CONFIGS[metric.type],
|
|
18
|
+
...metric,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const resolvedType = type || MetricTypes.Numeric;
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
...METRIC_TYPE_CONFIGS[resolvedType],
|
|
26
|
+
type: resolvedType,
|
|
27
|
+
label: key,
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function getGlobalMetricType(key: string, type?: MetricTypes): Metric {
|
|
33
|
+
const getMetricType = createGetMetricType({
|
|
34
|
+
webpack: webpackMetricTypes,
|
|
35
|
+
lighthouse: lighthouseMetricTypes,
|
|
36
|
+
browsertime: browsertimeMeticTypes,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return getMetricType(key, type);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function getMetricRunInfo(
|
|
43
|
+
metricType: MetricTypeConfig,
|
|
44
|
+
current: number,
|
|
45
|
+
baseline?: number,
|
|
46
|
+
): MetricRunInfo {
|
|
47
|
+
const { formatter, biggerIsBetter } = metricType;
|
|
48
|
+
|
|
49
|
+
const runInfo = {
|
|
50
|
+
value: current,
|
|
51
|
+
displayValue: formatter(current),
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// Skip computing delta fields when the baseline is missing
|
|
55
|
+
if (typeof baseline === 'undefined') {
|
|
56
|
+
return runInfo;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const { delta, deltaPercentage } = getDelta({ value: baseline }, { value: current });
|
|
60
|
+
|
|
61
|
+
// Resolve regression/improvement flag
|
|
62
|
+
let regression;
|
|
63
|
+
|
|
64
|
+
if (biggerIsBetter === null) {
|
|
65
|
+
regression = null;
|
|
66
|
+
} else if ((biggerIsBetter === true && delta > 0) || (biggerIsBetter === false && delta < 0)) {
|
|
67
|
+
regression = false;
|
|
68
|
+
} else if ((biggerIsBetter === false && delta > 0) || (biggerIsBetter === true && delta < 0)) {
|
|
69
|
+
regression = true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
...runInfo,
|
|
74
|
+
delta,
|
|
75
|
+
deltaPercentage,
|
|
76
|
+
displayDelta: formatDelta(delta, formatter),
|
|
77
|
+
displayDeltaPercentage: formatDelta(deltaPercentage, formatPercentage),
|
|
78
|
+
deltaType: getDeltaType(deltaPercentage, biggerIsBetter),
|
|
79
|
+
regression,
|
|
80
|
+
};
|
|
81
|
+
}
|
package/src/webpack/compare.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MetricTypes } from '../constants';
|
|
2
2
|
import { compareMetrics } from '../report/compare-metrics';
|
|
3
3
|
import {
|
|
4
4
|
SECTION_WEBPACK_STATS,
|
|
@@ -18,9 +18,8 @@ import { selectors } from './selectors';
|
|
|
18
18
|
*
|
|
19
19
|
* @return {Object[]} Compared stats metrics
|
|
20
20
|
*/
|
|
21
|
-
const compareStats = (jobs, rowTransformers) =>
|
|
22
|
-
jobs, selectors.stats, undefined, rowTransformers
|
|
23
|
-
);
|
|
21
|
+
const compareStats = (jobs, rowTransformers) =>
|
|
22
|
+
compareMetrics(jobs, selectors.stats, undefined, rowTransformers);
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
25
|
* Compare size metrics
|
|
@@ -30,7 +29,8 @@ const compareStats = (jobs, rowTransformers) => compareMetrics(
|
|
|
30
29
|
*
|
|
31
30
|
* @return {Object[]} Compared size metrics
|
|
32
31
|
*/
|
|
33
|
-
const compareSizes = (jobs, rowTransformers) =>
|
|
32
|
+
const compareSizes = (jobs, rowTransformers) =>
|
|
33
|
+
compareMetrics(jobs, selectors.sizes, undefined, rowTransformers);
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Compare asset metrics
|
|
@@ -40,7 +40,8 @@ const compareSizes = (jobs, rowTransformers) => compareMetrics(jobs, selectors.s
|
|
|
40
40
|
*
|
|
41
41
|
* @return {Object[]} Compared asset metrics
|
|
42
42
|
*/
|
|
43
|
-
const compareAssets = (jobs, rowTransformers) =>
|
|
43
|
+
const compareAssets = (jobs, rowTransformers) =>
|
|
44
|
+
compareMetrics(jobs, selectors.assets, MetricTypes.FileSize, rowTransformers);
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
47
|
* Compare all modules
|
|
@@ -49,7 +50,8 @@ const compareAssets = (jobs, rowTransformers) => compareMetrics(jobs, selectors.
|
|
|
49
50
|
* @param {Array<Function>} [rowTransformers]
|
|
50
51
|
* @return {Object[]} Compared module metrics
|
|
51
52
|
*/
|
|
52
|
-
const compareModules = (jobs, rowTransformers) =>
|
|
53
|
+
const compareModules = (jobs, rowTransformers) =>
|
|
54
|
+
compareMetrics(jobs, selectors.modules, MetricTypes.FileSize, rowTransformers);
|
|
53
55
|
|
|
54
56
|
/**
|
|
55
57
|
* Compare package metrics
|
|
@@ -59,7 +61,8 @@ const compareModules = (jobs, rowTransformers) => compareMetrics(jobs, selectors
|
|
|
59
61
|
*
|
|
60
62
|
* @return {Object[]} Compared package metrics
|
|
61
63
|
*/
|
|
62
|
-
const comparePackages = (jobs, rowTransformers) =>
|
|
64
|
+
const comparePackages = (jobs, rowTransformers) =>
|
|
65
|
+
compareMetrics(jobs, selectors.packages, MetricTypes.FileSize, rowTransformers);
|
|
63
66
|
|
|
64
67
|
export const compareBySection = {
|
|
65
68
|
[SECTION_WEBPACK_STATS]: compareStats,
|
|
@@ -75,7 +78,11 @@ export const compareBySection = {
|
|
|
75
78
|
* @param {Object[]} jobs - List of jobs to compare
|
|
76
79
|
* @return {Object} Compared metrics by section
|
|
77
80
|
*/
|
|
78
|
-
export const compare = (jobs) =>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
export const compare = (jobs) =>
|
|
82
|
+
SECTIONS.reduce(
|
|
83
|
+
(agg, sectionId) => ({
|
|
84
|
+
...agg,
|
|
85
|
+
[sectionId]: compareBySection[sectionId](jobs),
|
|
86
|
+
}),
|
|
87
|
+
{},
|
|
88
|
+
);
|
package/src/webpack/metrics.ts
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
import { FILE_TYPE_LABELS } from '../config/file-types';
|
|
2
2
|
import { Metric } from './types';
|
|
3
|
-
import {
|
|
3
|
+
import { MetricTypes, MetricConfig } from '../constants';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
description?: string;
|
|
8
|
-
url?: string;
|
|
9
|
-
type: MetricTypeType;
|
|
10
|
-
/**
|
|
11
|
-
* Increased values are regressions, decreased values are improvements
|
|
12
|
-
*/
|
|
13
|
-
biggerIsBetter?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Do not show the delta
|
|
16
|
-
*/
|
|
17
|
-
skipDelta?: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
type WebpackMetrics = Partial<Record<Metric, WebpackMetricConfig>> & {
|
|
21
|
-
sizes: Partial<Record<Metric, WebpackMetricConfig>>;
|
|
5
|
+
type WebpackMetrics = Partial<Record<Metric, MetricConfig>> & {
|
|
6
|
+
sizes: Partial<Record<Metric, MetricConfig>>;
|
|
22
7
|
};
|
|
23
8
|
|
|
24
9
|
export const metrics: WebpackMetrics = {
|
|
@@ -26,106 +11,106 @@ export const metrics: WebpackMetrics = {
|
|
|
26
11
|
label: 'Bundle Size',
|
|
27
12
|
description: 'The total file size of the assets generated or processed by the bundler',
|
|
28
13
|
url: 'https://relative-ci.com/documentation/metrics-and-data#assets',
|
|
29
|
-
type:
|
|
14
|
+
type: MetricTypes.FileSize,
|
|
30
15
|
},
|
|
31
16
|
[Metric.INITIAL_SIZE_JS]: {
|
|
32
17
|
label: 'Initial JS',
|
|
33
18
|
description: 'The total file size of the JavaScript initial chunks',
|
|
34
19
|
url: 'https://relative-ci.com/documentation/metrics-and-data#assets',
|
|
35
|
-
type:
|
|
20
|
+
type: MetricTypes.FileSize,
|
|
36
21
|
},
|
|
37
22
|
[Metric.INITIAL_SIZE_CSS]: {
|
|
38
23
|
label: 'Initial CSS',
|
|
39
24
|
description: 'The total file size of the CSS initial chunks',
|
|
40
25
|
url: 'https://relative-ci.com/documentation/metrics-and-data#assets',
|
|
41
|
-
type:
|
|
26
|
+
type: MetricTypes.FileSize,
|
|
42
27
|
},
|
|
43
28
|
[Metric.CACHE_INVALIDATION]: {
|
|
44
29
|
label: 'Cache Invalidation',
|
|
45
30
|
description:
|
|
46
31
|
'The ratio between the total of the changed assets and the total file size(Bundle Size)',
|
|
47
32
|
url: 'https://relative-ci.com/documentation/metrics-and-data#assets',
|
|
48
|
-
type:
|
|
49
|
-
biggerIsBetter:
|
|
33
|
+
type: MetricTypes.Percentage,
|
|
34
|
+
biggerIsBetter: null,
|
|
50
35
|
skipDelta: true,
|
|
51
36
|
},
|
|
52
37
|
[Metric.CHUNK_COUNT]: {
|
|
53
38
|
label: 'Chunks',
|
|
54
39
|
description: 'The total number of chunks generated by the bundler',
|
|
55
40
|
url: 'https://relative-ci.com/documentation/metrics-and-data#assets',
|
|
56
|
-
type:
|
|
57
|
-
biggerIsBetter:
|
|
41
|
+
type: MetricTypes.Numeric,
|
|
42
|
+
biggerIsBetter: null,
|
|
58
43
|
},
|
|
59
44
|
[Metric.ASSET_COUNT]: {
|
|
60
45
|
label: 'Assets',
|
|
61
46
|
description: 'Total number of assets generated or produced by the bundler',
|
|
62
47
|
url: 'https://relative-ci.com/documentation/metrics-and-data#assets',
|
|
63
|
-
type:
|
|
64
|
-
biggerIsBetter:
|
|
48
|
+
type: MetricTypes.Numeric,
|
|
49
|
+
biggerIsBetter: null,
|
|
65
50
|
},
|
|
66
51
|
[Metric.MODULE_COUNT]: {
|
|
67
52
|
label: 'Modules',
|
|
68
53
|
description: 'The total number of bundled modules',
|
|
69
54
|
url: 'https://relative-ci.com/documentation/metrics-and-data#modules-1',
|
|
70
|
-
type:
|
|
71
|
-
biggerIsBetter:
|
|
55
|
+
type: MetricTypes.Numeric,
|
|
56
|
+
biggerIsBetter: null,
|
|
72
57
|
},
|
|
73
58
|
[Metric.DUPLICATE_MODULES_COUNT]: {
|
|
74
59
|
label: 'Duplicate Modules',
|
|
75
60
|
description: 'The total number of modules that belong to more than one chunk',
|
|
76
61
|
url: 'https://relative-ci.com/documentation/metrics-and-data#modules-1',
|
|
77
|
-
type:
|
|
78
|
-
biggerIsBetter:
|
|
62
|
+
type: MetricTypes.Numeric,
|
|
63
|
+
biggerIsBetter: null,
|
|
79
64
|
},
|
|
80
65
|
[Metric.DUPLICATE_CODE]: {
|
|
81
66
|
label: 'Duplicate Code',
|
|
82
67
|
description: 'The percentage of total duplicate module size from the total module size',
|
|
83
68
|
url: 'https://relative-ci.com/documentation/metrics-and-data#modules-1',
|
|
84
|
-
type:
|
|
69
|
+
type: MetricTypes.Percentage,
|
|
85
70
|
biggerIsBetter: false,
|
|
86
71
|
},
|
|
87
72
|
[Metric.PACKAGE_COUNT]: {
|
|
88
73
|
label: 'Packages',
|
|
89
74
|
description: 'The total number of bundled packages',
|
|
90
75
|
url: 'https://relative-ci.com/documentation/metrics-and-data#packages',
|
|
91
|
-
type:
|
|
76
|
+
type: MetricTypes.Numeric,
|
|
92
77
|
biggerIsBetter: false,
|
|
93
78
|
},
|
|
94
79
|
[Metric.DUPLICATE_PACKAGES_COUNT]: {
|
|
95
80
|
label: 'Duplicate Packages',
|
|
96
81
|
description: 'The total number of duplicate packages',
|
|
97
82
|
url: 'https://relative-ci.com/documentation/metrics-and-data#packages',
|
|
98
|
-
type:
|
|
83
|
+
type: MetricTypes.Numeric,
|
|
99
84
|
biggerIsBetter: false,
|
|
100
85
|
},
|
|
101
86
|
sizes: {
|
|
102
87
|
[Metric.TOTAL_SIZE_JS]: {
|
|
103
88
|
label: FILE_TYPE_LABELS.JS,
|
|
104
|
-
type:
|
|
89
|
+
type: MetricTypes.FileSize,
|
|
105
90
|
},
|
|
106
91
|
[Metric.TOTAL_SIZE_CSS]: {
|
|
107
92
|
label: FILE_TYPE_LABELS.CSS,
|
|
108
|
-
type:
|
|
93
|
+
type: MetricTypes.FileSize,
|
|
109
94
|
},
|
|
110
95
|
[Metric.TOTAL_SIZE_IMG]: {
|
|
111
96
|
label: FILE_TYPE_LABELS.IMG,
|
|
112
|
-
type:
|
|
97
|
+
type: MetricTypes.FileSize,
|
|
113
98
|
},
|
|
114
99
|
[Metric.TOTAL_SIZE_MEDIA]: {
|
|
115
100
|
label: FILE_TYPE_LABELS.MEDIA,
|
|
116
|
-
type:
|
|
101
|
+
type: MetricTypes.FileSize,
|
|
117
102
|
},
|
|
118
103
|
[Metric.TOTAL_SIZE_FONT]: {
|
|
119
104
|
label: FILE_TYPE_LABELS.FONT,
|
|
120
|
-
type:
|
|
105
|
+
type: MetricTypes.FileSize,
|
|
121
106
|
},
|
|
122
107
|
[Metric.TOTAL_SIZE_HTML]: {
|
|
123
108
|
label: FILE_TYPE_LABELS.HTML,
|
|
124
|
-
type:
|
|
109
|
+
type: MetricTypes.FileSize,
|
|
125
110
|
},
|
|
126
111
|
[Metric.TOTAL_SIZE_OTHER]: {
|
|
127
112
|
label: FILE_TYPE_LABELS.OTHER,
|
|
128
|
-
type:
|
|
113
|
+
type: MetricTypes.FileSize,
|
|
129
114
|
},
|
|
130
115
|
},
|
|
131
116
|
};
|
|
@@ -1,107 +1,127 @@
|
|
|
1
1
|
export namespace metrics {
|
|
2
2
|
namespace firstPaint {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
let label: string;
|
|
4
|
+
let type: MetricTypes;
|
|
5
5
|
}
|
|
6
6
|
namespace fullyLoaded {
|
|
7
7
|
let label_1: string;
|
|
8
8
|
export { label_1 as label };
|
|
9
|
-
|
|
9
|
+
let type_1: MetricTypes;
|
|
10
|
+
export { type_1 as type };
|
|
10
11
|
}
|
|
11
12
|
namespace backEndTime {
|
|
12
13
|
let label_2: string;
|
|
13
14
|
export { label_2 as label };
|
|
14
|
-
|
|
15
|
+
let type_2: MetricTypes;
|
|
16
|
+
export { type_2 as type };
|
|
15
17
|
}
|
|
16
18
|
namespace domContentLoadedTime {
|
|
17
19
|
let label_3: string;
|
|
18
20
|
export { label_3 as label };
|
|
19
|
-
|
|
21
|
+
let type_3: MetricTypes;
|
|
22
|
+
export { type_3 as type };
|
|
20
23
|
}
|
|
21
24
|
namespace domInteractiveTime {
|
|
22
25
|
let label_4: string;
|
|
23
26
|
export { label_4 as label };
|
|
24
|
-
|
|
27
|
+
let type_4: MetricTypes;
|
|
28
|
+
export { type_4 as type };
|
|
25
29
|
}
|
|
26
30
|
namespace domainLookupTime {
|
|
27
31
|
let label_5: string;
|
|
28
32
|
export { label_5 as label };
|
|
29
|
-
|
|
33
|
+
let type_5: MetricTypes;
|
|
34
|
+
export { type_5 as type };
|
|
30
35
|
}
|
|
31
36
|
namespace frontEndTime {
|
|
32
37
|
let label_6: string;
|
|
33
38
|
export { label_6 as label };
|
|
34
|
-
|
|
39
|
+
let type_6: MetricTypes;
|
|
40
|
+
export { type_6 as type };
|
|
35
41
|
}
|
|
36
42
|
namespace pageDownloadTime {
|
|
37
43
|
let label_7: string;
|
|
38
44
|
export { label_7 as label };
|
|
39
|
-
|
|
45
|
+
let type_7: MetricTypes;
|
|
46
|
+
export { type_7 as type };
|
|
40
47
|
}
|
|
41
48
|
namespace pageLoadTime {
|
|
42
49
|
let label_8: string;
|
|
43
50
|
export { label_8 as label };
|
|
44
|
-
|
|
51
|
+
let type_8: MetricTypes;
|
|
52
|
+
export { type_8 as type };
|
|
45
53
|
}
|
|
46
54
|
namespace redirectionTime {
|
|
47
55
|
let label_9: string;
|
|
48
56
|
export { label_9 as label };
|
|
49
|
-
|
|
57
|
+
let type_9: MetricTypes;
|
|
58
|
+
export { type_9 as type };
|
|
50
59
|
}
|
|
51
60
|
namespace serverConnectionTime {
|
|
52
61
|
let label_10: string;
|
|
53
62
|
export { label_10 as label };
|
|
54
|
-
|
|
63
|
+
let type_10: MetricTypes;
|
|
64
|
+
export { type_10 as type };
|
|
55
65
|
}
|
|
56
66
|
namespace serverResponseTime {
|
|
57
67
|
let label_11: string;
|
|
58
68
|
export { label_11 as label };
|
|
59
|
-
|
|
69
|
+
let type_11: MetricTypes;
|
|
70
|
+
export { type_11 as type };
|
|
60
71
|
}
|
|
61
72
|
namespace firstContentfulPaint {
|
|
62
73
|
let label_12: string;
|
|
63
74
|
export { label_12 as label };
|
|
64
|
-
|
|
75
|
+
let type_12: MetricTypes;
|
|
76
|
+
export { type_12 as type };
|
|
65
77
|
}
|
|
66
78
|
namespace rumSpeedIndex {
|
|
67
79
|
let label_13: string;
|
|
68
80
|
export { label_13 as label };
|
|
69
|
-
|
|
81
|
+
let type_13: MetricTypes;
|
|
82
|
+
export { type_13 as type };
|
|
70
83
|
}
|
|
71
84
|
namespace firstVisualChange {
|
|
72
85
|
let label_14: string;
|
|
73
86
|
export { label_14 as label };
|
|
74
|
-
|
|
87
|
+
let type_14: MetricTypes;
|
|
88
|
+
export { type_14 as type };
|
|
75
89
|
}
|
|
76
90
|
namespace lastVisualChange {
|
|
77
91
|
let label_15: string;
|
|
78
92
|
export { label_15 as label };
|
|
79
|
-
|
|
93
|
+
let type_15: MetricTypes;
|
|
94
|
+
export { type_15 as type };
|
|
80
95
|
}
|
|
81
96
|
namespace perceptualSpeedIndex {
|
|
82
97
|
let label_16: string;
|
|
83
98
|
export { label_16 as label };
|
|
84
|
-
|
|
99
|
+
let type_16: MetricTypes;
|
|
100
|
+
export { type_16 as type };
|
|
85
101
|
}
|
|
86
102
|
namespace speedIndex {
|
|
87
103
|
let label_17: string;
|
|
88
104
|
export { label_17 as label };
|
|
89
|
-
|
|
105
|
+
let type_17: MetricTypes;
|
|
106
|
+
export { type_17 as type };
|
|
90
107
|
}
|
|
91
108
|
namespace visualComplete85 {
|
|
92
109
|
let label_18: string;
|
|
93
110
|
export { label_18 as label };
|
|
94
|
-
|
|
111
|
+
let type_18: MetricTypes;
|
|
112
|
+
export { type_18 as type };
|
|
95
113
|
}
|
|
96
114
|
namespace visualComplete95 {
|
|
97
115
|
let label_19: string;
|
|
98
116
|
export { label_19 as label };
|
|
99
|
-
|
|
117
|
+
let type_19: MetricTypes;
|
|
118
|
+
export { type_19 as type };
|
|
100
119
|
}
|
|
101
120
|
namespace visualComplete99 {
|
|
102
121
|
let label_20: string;
|
|
103
122
|
export { label_20 as label };
|
|
104
|
-
|
|
123
|
+
let type_20: MetricTypes;
|
|
124
|
+
export { type_20 as type };
|
|
105
125
|
}
|
|
106
126
|
}
|
|
107
|
-
import {
|
|
127
|
+
import { MetricTypes } from '../constants';
|
package/types/config/index.d.ts
CHANGED