@bundle-stats/utils 4.7.5-alpha.0 → 4.7.5-beta.2
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/component-links.js +1 -7
- package/lib/utils/component-links.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 +25 -24
- 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/component-links.js +1 -7
- package/lib-esm/utils/component-links.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 +25 -24
- package/lib-esm/webpack/metrics.js.map +1 -1
- package/package.json +5 -5
- 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/component-links.ts +1 -7
- 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.js → metrics.ts} +30 -29
- 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/component-links.d.ts +0 -4
- package/types/utils/delta.d.ts +4 -6
- package/types/utils/metrics.d.ts +4 -3
- package/types/webpack/metrics.d.ts +7 -153
- 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
package/lib-esm/utils/delta.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import round from 'lodash/round';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const currentValue = (current && current.value) || 0;
|
|
2
|
+
export function getDelta(baseline, current) {
|
|
3
|
+
const baselineValue = (baseline === null || baseline === void 0 ? void 0 : baseline.value) || 0;
|
|
4
|
+
const currentValue = (current === null || current === void 0 ? void 0 : current.value) || 0;
|
|
6
5
|
if (baselineValue === currentValue) {
|
|
7
6
|
return {
|
|
8
7
|
delta: 0,
|
|
@@ -19,11 +18,15 @@ export const getDelta = (baseline, current) => {
|
|
|
19
18
|
delta: currentValue - baselineValue,
|
|
20
19
|
deltaPercentage: round((currentValue / baselineValue) * 100 - 100, 8),
|
|
21
20
|
};
|
|
22
|
-
}
|
|
23
|
-
export
|
|
24
|
-
let sign =
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
}
|
|
22
|
+
export function formatDelta(value, formatter) {
|
|
23
|
+
let sign = '';
|
|
24
|
+
if (value > 0) {
|
|
25
|
+
sign = '+';
|
|
26
|
+
}
|
|
27
|
+
else if (value < 0) {
|
|
28
|
+
sign = '-';
|
|
29
|
+
}
|
|
27
30
|
let absValue = Math.abs(value);
|
|
28
31
|
if (absValue > 0 && absValue < 0.01) {
|
|
29
32
|
sign = `~${sign}`;
|
|
@@ -33,26 +36,26 @@ export const formatDelta = (value, formatter) => {
|
|
|
33
36
|
absValue = round(absValue, 2);
|
|
34
37
|
}
|
|
35
38
|
return `${sign}${formatter(absValue)}`;
|
|
36
|
-
}
|
|
37
|
-
export
|
|
38
|
-
if (
|
|
39
|
-
return
|
|
39
|
+
}
|
|
40
|
+
export function getDeltaType(deltaPercentageValue, biggerIsBetter) {
|
|
41
|
+
if (deltaPercentageValue < -50) {
|
|
42
|
+
return biggerIsBetter ? 'HIGH_NEGATIVE' : 'HIGH_POSITIVE';
|
|
43
|
+
}
|
|
44
|
+
if (deltaPercentageValue < -5) {
|
|
45
|
+
return biggerIsBetter ? 'NEGATIVE' : 'POSITIVE';
|
|
40
46
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (absDiff <= 5) {
|
|
44
|
-
level = DELTA_TYPE_LEVEL_LOW;
|
|
47
|
+
if (deltaPercentageValue < 0) {
|
|
48
|
+
return biggerIsBetter ? 'LOW_NEGATIVE' : 'LOW_POSITIVE';
|
|
45
49
|
}
|
|
46
|
-
if (
|
|
47
|
-
|
|
50
|
+
if (deltaPercentageValue === 0) {
|
|
51
|
+
return 'NO_CHANGE';
|
|
48
52
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
type = DELTA_TYPE_POSITIVE;
|
|
53
|
+
if (deltaPercentageValue <= 5) {
|
|
54
|
+
return biggerIsBetter ? 'LOW_POSITIVE' : 'LOW_NEGATIVE';
|
|
52
55
|
}
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
if (deltaPercentageValue <= 50) {
|
|
57
|
+
return biggerIsBetter ? 'POSITIVE' : 'NEGATIVE';
|
|
55
58
|
}
|
|
56
|
-
return
|
|
57
|
-
}
|
|
59
|
+
return biggerIsBetter ? 'HIGH_POSITIVE' : 'HIGH_NEGATIVE';
|
|
60
|
+
}
|
|
58
61
|
//# sourceMappingURL=delta.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delta.js","sourceRoot":"","sources":["../../src/utils/delta.
|
|
1
|
+
{"version":3,"file":"delta.js","sourceRoot":"","sources":["../../src/utils/delta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,cAAc,CAAC;AASjC,MAAM,UAAU,QAAQ,CAAC,QAA2B,EAAE,OAA0B;IAC9E,MAAM,aAAa,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,KAAI,CAAC,CAAC;IAC3C,MAAM,YAAY,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,KAAI,CAAC,CAAC;IAEzC,IAAI,aAAa,KAAK,YAAY,EAAE;QAClC,OAAO;YACL,KAAK,EAAE,CAAC;YACR,eAAe,EAAE,CAAC;SACnB,CAAC;KACH;IAED,IAAI,aAAa,KAAK,CAAC,EAAE;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AC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC;KACzD;IAED,IAAI,oBAAoB,KAAK,CAAC,EAAE;QAC9B,OAAO,WAAW,CAAC;KACpB;IAED,IAAI,oBAAoB,IAAI,CAAC,EAAE;QAC7B,OAAO,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC;KACzD;IAED,IAAI,oBAAoB,IAAI,EAAE,EAAE;QAC9B,OAAO,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;KACjD;IAED,OAAO,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC;AAC5D,CAAC"}
|
package/lib-esm/utils/metrics.js
CHANGED
|
@@ -1,40 +1,56 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { formatPercentage } from './format';
|
|
2
|
+
import { MetricTypes } from '../constants';
|
|
3
|
+
import { METRIC_TYPE_CONFIGS } from '../config';
|
|
5
4
|
import { metrics as webpackMetricTypes } from '../webpack/metrics';
|
|
6
5
|
import { metrics as lighthouseMetricTypes } from '../lighthouse/metrics';
|
|
7
6
|
import { metrics as browsertimeMeticTypes } from '../browsertime/metrics';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
import { formatPercentage } from './format';
|
|
8
|
+
import { formatDelta, getDelta, getDeltaType } from './delta';
|
|
9
|
+
export function createGetMetricType(metrics) {
|
|
10
|
+
return function getMetricType(key, type) {
|
|
11
|
+
const metric = get(metrics, key);
|
|
12
|
+
if (metric === null || metric === void 0 ? void 0 : metric.type) {
|
|
13
|
+
return {
|
|
14
|
+
...METRIC_TYPE_CONFIGS[metric.type],
|
|
15
|
+
...metric,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const resolvedType = type || MetricTypes.Numeric;
|
|
11
19
|
return {
|
|
12
|
-
...
|
|
13
|
-
|
|
20
|
+
...METRIC_TYPE_CONFIGS[resolvedType],
|
|
21
|
+
type: resolvedType,
|
|
22
|
+
label: key,
|
|
14
23
|
};
|
|
15
|
-
}
|
|
16
|
-
const resolvedType = type || METRIC_TYPE_NUMERIC;
|
|
17
|
-
return {
|
|
18
|
-
...METRIC_TYPES[resolvedType],
|
|
19
|
-
type: resolvedType,
|
|
20
|
-
label: key,
|
|
21
24
|
};
|
|
22
|
-
}
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
}
|
|
26
|
+
export function getGlobalMetricType(key, type) {
|
|
27
|
+
const getMetricType = createGetMetricType({
|
|
28
|
+
webpack: webpackMetricTypes,
|
|
29
|
+
lighthouse: lighthouseMetricTypes,
|
|
30
|
+
browsertime: browsertimeMeticTypes,
|
|
31
|
+
});
|
|
32
|
+
return getMetricType(key, type);
|
|
33
|
+
}
|
|
34
|
+
export function getMetricRunInfo(metricType, current, baseline) {
|
|
35
|
+
const { formatter, biggerIsBetter } = metricType;
|
|
30
36
|
const runInfo = {
|
|
31
|
-
value:
|
|
32
|
-
displayValue: formatter(
|
|
37
|
+
value: current,
|
|
38
|
+
displayValue: formatter(current),
|
|
33
39
|
};
|
|
34
|
-
if (typeof
|
|
40
|
+
if (typeof baseline === 'undefined') {
|
|
35
41
|
return runInfo;
|
|
36
42
|
}
|
|
37
|
-
const { delta, deltaPercentage } = getDelta({ value:
|
|
43
|
+
const { delta, deltaPercentage } = getDelta({ value: baseline }, { value: current });
|
|
44
|
+
let regression;
|
|
45
|
+
if (biggerIsBetter === null) {
|
|
46
|
+
regression = null;
|
|
47
|
+
}
|
|
48
|
+
else if ((biggerIsBetter === true && delta > 0) || (biggerIsBetter === false && delta < 0)) {
|
|
49
|
+
regression = false;
|
|
50
|
+
}
|
|
51
|
+
else if ((biggerIsBetter === false && delta > 0) || (biggerIsBetter === true && delta < 0)) {
|
|
52
|
+
regression = true;
|
|
53
|
+
}
|
|
38
54
|
return {
|
|
39
55
|
...runInfo,
|
|
40
56
|
delta,
|
|
@@ -42,6 +58,7 @@ export const getMetricRunInfo = (metric, currentValue, baselineValue) => {
|
|
|
42
58
|
displayDelta: formatDelta(delta, formatter),
|
|
43
59
|
displayDeltaPercentage: formatDelta(deltaPercentage, formatPercentage),
|
|
44
60
|
deltaType: getDeltaType(deltaPercentage, biggerIsBetter),
|
|
61
|
+
regression,
|
|
45
62
|
};
|
|
46
|
-
}
|
|
63
|
+
}
|
|
47
64
|
//# sourceMappingURL=metrics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/utils/metrics.
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/utils/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B,OAAO,EAAyB,WAAW,EAAkC,MAAM,cAAc,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE9D,MAAM,UAAU,mBAAmB,CAAC,OAAgC;IAClE,OAAO,SAAS,aAAa,CAAC,GAAW,EAAE,IAAkB;QAC3D,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,CAAiB,CAAC;QAEjD,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,EAAE;YAChB,OAAO;gBACL,GAAG,mB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SAAM,IAAI,CAAC,cAAc,KAAK,KAAK,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,cAAc,KAAK,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE;QAC5F,UAAU,GAAG,IAAI,CAAC;KACnB;IAED,OAAO;QACL,GAAG,OAAO;QACV,KAAK;QACL,eAAe;QACf,YAAY,EAAE,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC;QAC3C,sBAAsB,EAAE,WAAW,CAAC,eAAe,EAAE,gBAAgB,CAAC;QACtE,SAAS,EAAE,YAAY,CAAC,eAAe,EAAE,cAAc,CAAC;QACxD,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MetricTypes } from '../constants';
|
|
2
2
|
import { compareMetrics } from '../report/compare-metrics';
|
|
3
3
|
import { SECTION_WEBPACK_STATS, SECTION_WEBPACK_SIZES, SECTION_WEBPACK_ASSETS, SECTION_WEBPACK_MODULES, SECTION_WEBPACK_PACKAGES, SECTIONS, } from './constants';
|
|
4
4
|
import { selectors } from './selectors';
|
|
5
5
|
const compareStats = (jobs, rowTransformers) => compareMetrics(jobs, selectors.stats, undefined, rowTransformers);
|
|
6
6
|
const compareSizes = (jobs, rowTransformers) => compareMetrics(jobs, selectors.sizes, undefined, rowTransformers);
|
|
7
|
-
const compareAssets = (jobs, rowTransformers) => compareMetrics(jobs, selectors.assets,
|
|
8
|
-
const compareModules = (jobs, rowTransformers) => compareMetrics(jobs, selectors.modules,
|
|
9
|
-
const comparePackages = (jobs, rowTransformers) => compareMetrics(jobs, selectors.packages,
|
|
7
|
+
const compareAssets = (jobs, rowTransformers) => compareMetrics(jobs, selectors.assets, MetricTypes.FileSize, rowTransformers);
|
|
8
|
+
const compareModules = (jobs, rowTransformers) => compareMetrics(jobs, selectors.modules, MetricTypes.FileSize, rowTransformers);
|
|
9
|
+
const comparePackages = (jobs, rowTransformers) => compareMetrics(jobs, selectors.packages, MetricTypes.FileSize, rowTransformers);
|
|
10
10
|
export const compareBySection = {
|
|
11
11
|
[SECTION_WEBPACK_STATS]: compareStats,
|
|
12
12
|
[SECTION_WEBPACK_SIZES]: compareSizes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../src/webpack/compare.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../src/webpack/compare.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,QAAQ,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAUxC,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE,EAAE,CAC7C,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;AAUpE,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE,EAAE,CAC7C,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;AAUpE,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE,EAAE,CAC9C,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;AAShF,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE,EAAE,CAC/C,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,OAAO,EAAE,WAAW,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;AAUjF,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE,EAAE,CAChD,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;AAElF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,CAAC,qBAAqB,CAAC,EAAE,YAAY;IACrC,CAAC,qBAAqB,CAAC,EAAE,YAAY;IACrC,CAAC,sBAAsB,CAAC,EAAE,aAAa;IACvC,CAAC,uBAAuB,CAAC,EAAE,cAAc;IACzC,CAAC,wBAAwB,CAAC,EAAE,eAAe;CAC5C,CAAC;AAQF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,EAAE,CAC9B,QAAQ,CAAC,MAAM,CACf,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;IACnB,GAAG,GAAG;IACN,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;CAC/C,CAAC,EACF,EAAE,CACH,CAAC"}
|
|
@@ -1,109 +1,110 @@
|
|
|
1
|
-
import { METRIC_TYPE_FILE_SIZE, METRIC_TYPE_NUMERIC, METRIC_TYPE_PERCENTAGE, } from '../config/metrics';
|
|
2
1
|
import { FILE_TYPE_LABELS } from '../config/file-types';
|
|
3
2
|
import { Metric } from './types';
|
|
3
|
+
import { MetricTypes } from '../constants';
|
|
4
4
|
export const metrics = {
|
|
5
5
|
[Metric.BUNDLE_SIZE]: {
|
|
6
6
|
label: 'Bundle Size',
|
|
7
7
|
description: 'The total file size of the assets generated or processed by the bundler',
|
|
8
8
|
url: 'https://relative-ci.com/documentation/metrics-and-data#assets',
|
|
9
|
-
type:
|
|
9
|
+
type: MetricTypes.FileSize,
|
|
10
10
|
},
|
|
11
11
|
[Metric.INITIAL_SIZE_JS]: {
|
|
12
12
|
label: 'Initial JS',
|
|
13
13
|
description: 'The total file size of the JavaScript initial chunks',
|
|
14
14
|
url: 'https://relative-ci.com/documentation/metrics-and-data#assets',
|
|
15
|
-
type:
|
|
15
|
+
type: MetricTypes.FileSize,
|
|
16
16
|
},
|
|
17
17
|
[Metric.INITIAL_SIZE_CSS]: {
|
|
18
18
|
label: 'Initial CSS',
|
|
19
19
|
description: 'The total file size of the CSS initial chunks',
|
|
20
20
|
url: 'https://relative-ci.com/documentation/metrics-and-data#assets',
|
|
21
|
-
type:
|
|
21
|
+
type: MetricTypes.FileSize,
|
|
22
22
|
},
|
|
23
23
|
[Metric.CACHE_INVALIDATION]: {
|
|
24
24
|
label: 'Cache Invalidation',
|
|
25
25
|
description: 'The ratio between the total of the changed assets and the total file size(Bundle Size)',
|
|
26
26
|
url: 'https://relative-ci.com/documentation/metrics-and-data#assets',
|
|
27
|
-
type:
|
|
28
|
-
biggerIsBetter:
|
|
27
|
+
type: MetricTypes.Percentage,
|
|
28
|
+
biggerIsBetter: null,
|
|
29
|
+
skipDelta: true,
|
|
29
30
|
},
|
|
30
31
|
[Metric.CHUNK_COUNT]: {
|
|
31
32
|
label: 'Chunks',
|
|
32
33
|
description: 'The total number of chunks generated by the bundler',
|
|
33
34
|
url: 'https://relative-ci.com/documentation/metrics-and-data#assets',
|
|
34
|
-
type:
|
|
35
|
-
biggerIsBetter:
|
|
35
|
+
type: MetricTypes.Numeric,
|
|
36
|
+
biggerIsBetter: null,
|
|
36
37
|
},
|
|
37
38
|
[Metric.ASSET_COUNT]: {
|
|
38
39
|
label: 'Assets',
|
|
39
40
|
description: 'Total number of assets generated or produced by the bundler',
|
|
40
41
|
url: 'https://relative-ci.com/documentation/metrics-and-data#assets',
|
|
41
|
-
type:
|
|
42
|
-
biggerIsBetter:
|
|
42
|
+
type: MetricTypes.Numeric,
|
|
43
|
+
biggerIsBetter: null,
|
|
43
44
|
},
|
|
44
45
|
[Metric.MODULE_COUNT]: {
|
|
45
46
|
label: 'Modules',
|
|
46
47
|
description: 'The total number of bundled modules',
|
|
47
48
|
url: 'https://relative-ci.com/documentation/metrics-and-data#modules-1',
|
|
48
|
-
type:
|
|
49
|
-
biggerIsBetter:
|
|
49
|
+
type: MetricTypes.Numeric,
|
|
50
|
+
biggerIsBetter: null,
|
|
50
51
|
},
|
|
51
52
|
[Metric.DUPLICATE_MODULES_COUNT]: {
|
|
52
53
|
label: 'Duplicate Modules',
|
|
53
54
|
description: 'The total number of modules that belong to more than one chunk',
|
|
54
55
|
url: 'https://relative-ci.com/documentation/metrics-and-data#modules-1',
|
|
55
|
-
type:
|
|
56
|
-
biggerIsBetter:
|
|
56
|
+
type: MetricTypes.Numeric,
|
|
57
|
+
biggerIsBetter: null,
|
|
57
58
|
},
|
|
58
59
|
[Metric.DUPLICATE_CODE]: {
|
|
59
60
|
label: 'Duplicate Code',
|
|
60
61
|
description: 'The percentage of total duplicate module size from the total module size',
|
|
61
62
|
url: 'https://relative-ci.com/documentation/metrics-and-data#modules-1',
|
|
62
|
-
type:
|
|
63
|
+
type: MetricTypes.Percentage,
|
|
63
64
|
biggerIsBetter: false,
|
|
64
65
|
},
|
|
65
66
|
[Metric.PACKAGE_COUNT]: {
|
|
66
67
|
label: 'Packages',
|
|
67
68
|
description: 'The total number of bundled packages',
|
|
68
69
|
url: 'https://relative-ci.com/documentation/metrics-and-data#packages',
|
|
69
|
-
type:
|
|
70
|
+
type: MetricTypes.Numeric,
|
|
70
71
|
biggerIsBetter: false,
|
|
71
72
|
},
|
|
72
73
|
[Metric.DUPLICATE_PACKAGES_COUNT]: {
|
|
73
74
|
label: 'Duplicate Packages',
|
|
74
75
|
description: 'The total number of duplicate packages',
|
|
75
76
|
url: 'https://relative-ci.com/documentation/metrics-and-data#packages',
|
|
76
|
-
type:
|
|
77
|
+
type: MetricTypes.Numeric,
|
|
77
78
|
biggerIsBetter: false,
|
|
78
79
|
},
|
|
79
80
|
sizes: {
|
|
80
81
|
[Metric.TOTAL_SIZE_JS]: {
|
|
81
82
|
label: FILE_TYPE_LABELS.JS,
|
|
82
|
-
type:
|
|
83
|
+
type: MetricTypes.FileSize,
|
|
83
84
|
},
|
|
84
85
|
[Metric.TOTAL_SIZE_CSS]: {
|
|
85
86
|
label: FILE_TYPE_LABELS.CSS,
|
|
86
|
-
type:
|
|
87
|
+
type: MetricTypes.FileSize,
|
|
87
88
|
},
|
|
88
89
|
[Metric.TOTAL_SIZE_IMG]: {
|
|
89
90
|
label: FILE_TYPE_LABELS.IMG,
|
|
90
|
-
type:
|
|
91
|
+
type: MetricTypes.FileSize,
|
|
91
92
|
},
|
|
92
93
|
[Metric.TOTAL_SIZE_MEDIA]: {
|
|
93
94
|
label: FILE_TYPE_LABELS.MEDIA,
|
|
94
|
-
type:
|
|
95
|
+
type: MetricTypes.FileSize,
|
|
95
96
|
},
|
|
96
97
|
[Metric.TOTAL_SIZE_FONT]: {
|
|
97
98
|
label: FILE_TYPE_LABELS.FONT,
|
|
98
|
-
type:
|
|
99
|
+
type: MetricTypes.FileSize,
|
|
99
100
|
},
|
|
100
101
|
[Metric.TOTAL_SIZE_HTML]: {
|
|
101
102
|
label: FILE_TYPE_LABELS.HTML,
|
|
102
|
-
type:
|
|
103
|
+
type: MetricTypes.FileSize,
|
|
103
104
|
},
|
|
104
105
|
[Metric.TOTAL_SIZE_OTHER]: {
|
|
105
106
|
label: FILE_TYPE_LABELS.OTHER,
|
|
106
|
-
type:
|
|
107
|
+
type: MetricTypes.FileSize,
|
|
107
108
|
},
|
|
108
109
|
},
|
|
109
110
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/webpack/metrics.
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/webpack/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,WAAW,EAAgB,MAAM,cAAc,CAAC;AAMzD,MAAM,CAAC,MAAM,OAAO,GAAmB;IAC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E,gBAAgB,CAAC,KAAK;YAC7B,IAAI,EAAE,WAAW,CAAC,QAAQ;SAC3B;QACD,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE;YACxB,KAAK,EAAE,gBAAgB,CAAC,IAAI;YAC5B,IAAI,EAAE,WAAW,CAAC,QAAQ;SAC3B;QACD,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE;YACxB,KAAK,EAAE,gBAAgB,CAAC,IAAI;YAC5B,IAAI,EAAE,WAAW,CAAC,QAAQ;SAC3B;QACD,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE;YACzB,KAAK,EAAE,gBAAgB,CAAC,KAAK;YAC7B,IAAI,EAAE,WAAW,CAAC,QAAQ;SAC3B;KACF;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bundle-stats/utils",
|
|
3
|
-
"version": "4.7.5-
|
|
3
|
+
"version": "4.7.5-beta.2",
|
|
4
4
|
"description": "BundleStats utils",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-esm/index.js",
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/relative-ci/bundle-stats/blob/master/packages/utils#readme",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@bundle-stats/plugin-webpack-filter": "
|
|
39
|
-
"@bundle-stats/plugin-webpack-validate": "
|
|
38
|
+
"@bundle-stats/plugin-webpack-filter": "4.7.5-beta.2",
|
|
39
|
+
"@bundle-stats/plugin-webpack-validate": "4.7.5-beta.2",
|
|
40
40
|
"query-string": "7.1.3",
|
|
41
41
|
"serialize-query-params": "2.0.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/jest": "29.5.5",
|
|
45
45
|
"@types/lodash": "4.14.199",
|
|
46
|
-
"core-js": "3.
|
|
46
|
+
"core-js": "3.33.0",
|
|
47
47
|
"jest": "29.7.0",
|
|
48
48
|
"jest-cli": "29.7.0",
|
|
49
49
|
"jest-date-mock": "1.0.8",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"core-js": "^3.0.0",
|
|
58
58
|
"lodash": "^4.0.0"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "6951344bec146a9c223c64796addf8d9af4a0468"
|
|
61
61
|
}
|
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MetricTypes } from '../constants';
|
|
2
2
|
|
|
3
3
|
export const metrics = {
|
|
4
4
|
firstPaint: {
|
|
5
5
|
label: 'First Paint',
|
|
6
|
-
type:
|
|
6
|
+
type: MetricTypes.Duration,
|
|
7
7
|
},
|
|
8
8
|
fullyLoaded: {
|
|
9
9
|
label: 'Fully Loaded',
|
|
10
|
-
type:
|
|
10
|
+
type: MetricTypes.Duration,
|
|
11
11
|
},
|
|
12
12
|
backEndTime: {
|
|
13
13
|
label: 'BackEnd Time',
|
|
14
|
-
type:
|
|
14
|
+
type: MetricTypes.Duration,
|
|
15
15
|
},
|
|
16
16
|
domContentLoadedTime: {
|
|
17
17
|
label: 'DOM Content Loaded Time',
|
|
18
|
-
type:
|
|
18
|
+
type: MetricTypes.Duration,
|
|
19
19
|
},
|
|
20
20
|
domInteractiveTime: {
|
|
21
21
|
label: 'DOM Interactive Time',
|
|
22
|
-
type:
|
|
22
|
+
type: MetricTypes.Duration,
|
|
23
23
|
},
|
|
24
24
|
domainLookupTime: {
|
|
25
25
|
label: 'Domain Lookup Time',
|
|
26
|
-
type:
|
|
26
|
+
type: MetricTypes.Duration,
|
|
27
27
|
},
|
|
28
28
|
frontEndTime: {
|
|
29
29
|
label: 'FrontEnd Time',
|
|
30
|
-
type:
|
|
30
|
+
type: MetricTypes.Duration,
|
|
31
31
|
},
|
|
32
32
|
pageDownloadTime: {
|
|
33
33
|
label: 'Page Download Time',
|
|
34
|
-
type:
|
|
34
|
+
type: MetricTypes.Duration,
|
|
35
35
|
},
|
|
36
36
|
pageLoadTime: {
|
|
37
37
|
label: 'Page Load Time',
|
|
38
|
-
type:
|
|
38
|
+
type: MetricTypes.Duration,
|
|
39
39
|
},
|
|
40
40
|
redirectionTime: {
|
|
41
41
|
label: 'Redirection Time',
|
|
42
|
-
type:
|
|
42
|
+
type: MetricTypes.Duration,
|
|
43
43
|
},
|
|
44
44
|
serverConnectionTime: {
|
|
45
45
|
label: 'Server Connection Time',
|
|
46
|
-
type:
|
|
46
|
+
type: MetricTypes.Duration,
|
|
47
47
|
},
|
|
48
48
|
serverResponseTime: {
|
|
49
49
|
label: 'Server Response Time',
|
|
50
|
-
type:
|
|
50
|
+
type: MetricTypes.Duration,
|
|
51
51
|
},
|
|
52
52
|
firstContentfulPaint: {
|
|
53
53
|
label: 'First Contentful Paint',
|
|
54
|
-
type:
|
|
54
|
+
type: MetricTypes.Duration,
|
|
55
55
|
},
|
|
56
56
|
rumSpeedIndex: {
|
|
57
57
|
label: 'RUM Speed Index',
|
|
58
|
-
type:
|
|
58
|
+
type: MetricTypes.Duration,
|
|
59
59
|
},
|
|
60
60
|
firstVisualChange: {
|
|
61
61
|
label: 'First Visual Change',
|
|
62
|
-
type:
|
|
62
|
+
type: MetricTypes.Duration,
|
|
63
63
|
},
|
|
64
64
|
lastVisualChange: {
|
|
65
65
|
label: 'Last Visual Change',
|
|
66
|
-
type:
|
|
66
|
+
type: MetricTypes.Duration,
|
|
67
67
|
},
|
|
68
68
|
perceptualSpeedIndex: {
|
|
69
69
|
label: 'Perceptual SpeedIndex',
|
|
70
|
-
type:
|
|
70
|
+
type: MetricTypes.Duration,
|
|
71
71
|
},
|
|
72
72
|
speedIndex: {
|
|
73
73
|
label: 'Speed Index',
|
|
74
|
-
type:
|
|
74
|
+
type: MetricTypes.Duration,
|
|
75
75
|
},
|
|
76
76
|
visualComplete85: {
|
|
77
77
|
label: 'Visual Complete 85',
|
|
78
|
-
type:
|
|
78
|
+
type: MetricTypes.Duration,
|
|
79
79
|
},
|
|
80
80
|
visualComplete95: {
|
|
81
81
|
label: 'Visual Complete 95',
|
|
82
|
-
type:
|
|
82
|
+
type: MetricTypes.Duration,
|
|
83
83
|
},
|
|
84
84
|
visualComplete99: {
|
|
85
85
|
label: 'Visual Complete 99',
|
|
86
|
-
type:
|
|
86
|
+
type: MetricTypes.Duration,
|
|
87
87
|
},
|
|
88
88
|
};
|
package/src/config/index.js
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { formatNumber, formatDuration, formatFileSize, formatPercentage } from '../utils/format';
|
|
2
|
+
import { MetricTypes, MetricTypeConfig } from '../constants';
|
|
3
|
+
|
|
4
|
+
export const METRIC_TYPE_CONFIGS: Record<MetricTypes, MetricTypeConfig> = {
|
|
5
|
+
[MetricTypes.Numeric]: {
|
|
6
|
+
biggerIsBetter: false,
|
|
7
|
+
formatter: formatNumber,
|
|
8
|
+
},
|
|
9
|
+
[MetricTypes.Score]: {
|
|
10
|
+
biggerIsBetter: true,
|
|
11
|
+
formatter: formatNumber,
|
|
12
|
+
},
|
|
13
|
+
[MetricTypes.Duration]: {
|
|
14
|
+
biggerIsBetter: false,
|
|
15
|
+
formatter: formatDuration,
|
|
16
|
+
},
|
|
17
|
+
[MetricTypes.FileSize]: {
|
|
18
|
+
biggerIsBetter: false,
|
|
19
|
+
formatter: formatFileSize,
|
|
20
|
+
},
|
|
21
|
+
[MetricTypes.Percentage]: {
|
|
22
|
+
biggerIsBetter: true,
|
|
23
|
+
formatter: formatPercentage,
|
|
24
|
+
},
|
|
25
|
+
};
|