sitespeed.io 35.7.4 → 36.0.0-alpha.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.
- package/.dockerignore +4 -1
- package/CHANGELOG.md +57 -0
- package/Dockerfile +10 -6
- package/Dockerfile-slim +9 -7
- package/LICENSE +1 -1
- package/bin/browsertimeWebPageReplay.js +1 -1
- package/lib/cli/cli.js +22 -25
- package/lib/core/logging.js +6 -98
- package/lib/core/queue.js +112 -0
- package/lib/core/queueHandler.js +20 -28
- package/lib/core/resultsStorage/pathToFolder.js +3 -3
- package/lib/core/resultsStorage/storageManager.js +7 -5
- package/lib/plugins/assets/index.js +1 -1
- package/lib/plugins/axe/axePostScript.cjs +4 -6
- package/lib/plugins/axe/index.js +2 -2
- package/lib/plugins/browsertime/analyzer.js +6 -7
- package/lib/plugins/browsertime/browsertimeAggregator.js +64 -42
- package/lib/plugins/browsertime/filmstrip.js +2 -2
- package/lib/plugins/browsertime/index.js +3 -3
- package/lib/plugins/budget/deprecatedVerify.js +2 -2
- package/lib/plugins/budget/index.js +2 -2
- package/lib/plugins/budget/json.js +2 -2
- package/lib/plugins/budget/junit.js +2 -2
- package/lib/plugins/budget/tap.js +2 -2
- package/lib/plugins/budget/verify.js +2 -2
- package/lib/plugins/coach/aggregator.js +7 -9
- package/lib/plugins/coach/index.js +2 -2
- package/lib/plugins/compare/helper.js +2 -2
- package/lib/plugins/compare/index.js +2 -2
- package/lib/plugins/crawler/index.js +3 -6
- package/lib/plugins/crux/index.js +2 -2
- package/lib/plugins/crux/send.js +2 -2
- package/lib/plugins/domains/aggregator.js +9 -11
- package/lib/plugins/domains/index.js +1 -1
- package/lib/plugins/gcs/index.js +17 -16
- package/lib/plugins/grafana/send-annotation.js +2 -2
- package/lib/plugins/graphite/data-generator.js +13 -17
- package/lib/plugins/graphite/index.js +4 -3
- package/lib/plugins/graphite/send-annotation.js +2 -2
- package/lib/plugins/graphite/sender.js +2 -2
- package/lib/plugins/html/dataCollector.js +8 -14
- package/lib/plugins/html/htmlBuilder.js +12 -10
- package/lib/plugins/html/index.js +2 -5
- package/lib/plugins/html/renderer.js +2 -2
- package/lib/plugins/html/setup/summaryBoxes.js +2 -2
- package/lib/plugins/html/templates/url/coach/technology.pug +10 -8
- package/lib/plugins/html/templates/url/includes/tabScripts.js +1 -1
- package/lib/plugins/influxdb/data-generator.js +6 -8
- package/lib/plugins/influxdb/index.js +3 -4
- package/lib/plugins/influxdb/send-annotation.js +2 -2
- package/lib/plugins/influxdb/send-annotationV2.js +2 -2
- package/lib/plugins/lateststorer/index.js +2 -5
- package/lib/plugins/matrix/index.js +2 -2
- package/lib/plugins/matrix/send.js +2 -2
- package/lib/plugins/messagelogger/index.js +4 -3
- package/lib/plugins/pagexray/index.js +2 -2
- package/lib/plugins/pagexray/pagexrayAggregator.js +11 -10
- package/lib/plugins/remove/index.js +2 -2
- package/lib/plugins/s3/index.js +29 -28
- package/lib/plugins/s3/limit.js +34 -0
- package/lib/plugins/scp/index.js +6 -10
- package/lib/plugins/slack/index.js +20 -21
- package/lib/plugins/sustainable/helper.js +1 -1
- package/lib/plugins/sustainable/index.js +35 -14
- package/lib/plugins/text/color.js +30 -0
- package/lib/plugins/text/textBuilder.js +50 -20
- package/lib/sitespeed.js +11 -15
- package/lib/support/fileUtil.js +40 -0
- package/lib/support/filterRegistry.js +4 -4
- package/lib/support/flattenMessage.js +2 -2
- package/lib/support/messageMaker.js +2 -2
- package/lib/support/metricsFilter.js +9 -16
- package/lib/support/osUtil.js +36 -0
- package/lib/support/util.js +24 -0
- package/npm-shrinkwrap.json +1244 -2685
- package/package.json +17 -35
- package/tools/postinstall.js +61 -0
- package/.github/CONTRIBUTING.md +0 -24
- package/.github/FUNDING.yml +0 -12
- package/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +0 -65
- package/.github/ISSUE_TEMPLATE/FEATURE_IMPROVEMENT.yml +0 -15
- package/.github/ISSUE_TEMPLATE/QUESTION.yml +0 -15
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -14
- package/.github/budget.json +0 -13
- package/.github/workflows/building-docker-autobuild.yml +0 -30
- package/.github/workflows/building-docker-release.yml +0 -76
- package/.github/workflows/crux-test.yml +0 -23
- package/.github/workflows/docker-scan.yml +0 -29
- package/.github/workflows/docker.yml +0 -39
- package/.github/workflows/linux.yml +0 -80
- package/.github/workflows/safari.yml +0 -30
- package/.github/workflows/sitespeed-io-action-example.yml +0 -22
- package/.github/workflows/unittests.yml +0 -41
- package/.github/workflows/windows.yml +0 -39
- package/.github/workflows/windowsFull.yml +0 -36
- package/.netlify +0 -1
- package/.spelling +0 -58
- package/Gemfile +0 -4
- package/Gemfile.lock +0 -53
- package/docs/README.md +0 -10
- package/lib/plugins/sustainable/data/url2green.json.gz +0 -0
- package/release/feed.js +0 -198
- package/release/friendlyNames.js +0 -9
- package/release/friendlyNamesBudget.js +0 -15
- package/wpr-record.log +0 -102
- package/wpr-replay.log +0 -96
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
const axe = require('axe-core').source;
|
|
2
|
-
const clone = require('lodash.clonedeep');
|
|
3
|
-
const log = require('intel').getLogger('sitespeedio.plugin.axe');
|
|
4
2
|
|
|
5
3
|
module.exports = async function runAxe(context) {
|
|
6
4
|
// Insert the axe source
|
|
7
5
|
await context.selenium.driver.executeScript(axe);
|
|
8
6
|
|
|
9
7
|
const runOptions = context.options.axe.run
|
|
10
|
-
?
|
|
8
|
+
? structuredClone(context.options.axe.run)
|
|
11
9
|
: {};
|
|
12
10
|
const configureOptions = context.options.axe
|
|
13
|
-
?
|
|
11
|
+
? structuredClone(context.options.axe)
|
|
14
12
|
: {};
|
|
15
13
|
delete configureOptions.run;
|
|
16
14
|
|
|
17
15
|
if (Object.keys(configureOptions).length > 0) {
|
|
18
|
-
log.info('Configure AXE with %j', configureOptions);
|
|
16
|
+
context.log.info('Configure AXE with %j', configureOptions);
|
|
19
17
|
}
|
|
20
18
|
await context.selenium.driver.executeScript(
|
|
21
19
|
`axe.configure(${JSON.stringify(configureOptions)});`,
|
|
@@ -23,7 +21,7 @@ module.exports = async function runAxe(context) {
|
|
|
23
21
|
);
|
|
24
22
|
|
|
25
23
|
if (runOptions) {
|
|
26
|
-
log.info('Run AXE with run options %j', runOptions);
|
|
24
|
+
context.log.info('Run AXE with run options %j', runOptions);
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
// Get the result from axe
|
package/lib/plugins/axe/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import
|
|
4
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
5
5
|
import axe from 'axe-core';
|
|
6
6
|
const { version: axeVersion } = axe;
|
|
7
7
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
|
8
|
-
const log =
|
|
8
|
+
const log = getLogger('sitespeedio.plugin.axe');
|
|
9
9
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
10
10
|
|
|
11
11
|
export default class AxePlugin extends SitespeedioPlugin {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import merge from 'lodash.merge';
|
|
3
|
-
import forEach from 'lodash.foreach';
|
|
4
3
|
import set from 'lodash.set';
|
|
5
4
|
import get from 'lodash.get';
|
|
6
5
|
import coach from 'coach-core';
|
|
7
6
|
import { BrowsertimeEngine, browserScripts } from 'browsertime';
|
|
8
7
|
const { getDomAdvice } = coach;
|
|
9
|
-
import
|
|
10
|
-
const log =
|
|
8
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
9
|
+
const log = getLogger('plugin.browsertime');
|
|
11
10
|
|
|
12
11
|
const defaultBrowsertimeOptions = {
|
|
13
12
|
statistics: true
|
|
@@ -141,9 +140,9 @@ function addExtraScripts(scriptsByCategory, pluginScripts) {
|
|
|
141
140
|
// For all different script in the array
|
|
142
141
|
for (let scripts of pluginScripts) {
|
|
143
142
|
// and then for all scripts in that category
|
|
144
|
-
|
|
143
|
+
for (const [name, script] of Object.entries(scripts.scripts)) {
|
|
145
144
|
set(scriptsByCategory, scripts.category + '.' + name, script);
|
|
146
|
-
}
|
|
145
|
+
}
|
|
147
146
|
}
|
|
148
147
|
return scriptsByCategory;
|
|
149
148
|
}
|
|
@@ -153,9 +152,9 @@ function setupAsynScripts(asyncScripts) {
|
|
|
153
152
|
// For all different script in the array
|
|
154
153
|
for (let scripts of asyncScripts) {
|
|
155
154
|
// and then for all scripts in that category
|
|
156
|
-
|
|
155
|
+
for (const [name, script] of Object.entries(scripts.scripts)) {
|
|
157
156
|
set(allAsyncScripts, scripts.category + '.' + name, script);
|
|
158
|
-
}
|
|
157
|
+
}
|
|
159
158
|
}
|
|
160
159
|
return allAsyncScripts;
|
|
161
160
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import forEach from 'lodash.foreach';
|
|
2
1
|
import { pushGroupStats, setStatsSummary } from '../../support/statsHelpers.js';
|
|
3
2
|
|
|
4
3
|
const timings = ['firstPaint', 'timeToDomContentFlushed'];
|
|
@@ -62,7 +61,7 @@ export class BrowsertimeAggregator {
|
|
|
62
61
|
);
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
for (const timing of timings) {
|
|
66
65
|
if (browsertimeRunData.timings[timing]) {
|
|
67
66
|
pushGroupStats(
|
|
68
67
|
this.statsPerType,
|
|
@@ -71,9 +70,11 @@ export class BrowsertimeAggregator {
|
|
|
71
70
|
browsertimeRunData.timings[timing]
|
|
72
71
|
);
|
|
73
72
|
}
|
|
74
|
-
}
|
|
73
|
+
}
|
|
75
74
|
|
|
76
|
-
|
|
75
|
+
for (const [name, value] of Object.entries(
|
|
76
|
+
browsertimeRunData.timings.navigationTiming
|
|
77
|
+
)) {
|
|
77
78
|
if (value) {
|
|
78
79
|
pushGroupStats(
|
|
79
80
|
this.statsPerType,
|
|
@@ -82,43 +83,47 @@ export class BrowsertimeAggregator {
|
|
|
82
83
|
value
|
|
83
84
|
);
|
|
84
85
|
}
|
|
85
|
-
}
|
|
86
|
+
}
|
|
86
87
|
|
|
87
|
-
|
|
88
|
+
for (const [name, value] of Object.entries(
|
|
89
|
+
browsertimeRunData.timings.pageTimings
|
|
90
|
+
)) {
|
|
88
91
|
pushGroupStats(
|
|
89
92
|
this.statsPerType,
|
|
90
93
|
this.groups[group],
|
|
91
94
|
['pageTimings', name],
|
|
92
95
|
value
|
|
93
96
|
);
|
|
94
|
-
}
|
|
97
|
+
}
|
|
95
98
|
|
|
96
|
-
|
|
99
|
+
for (const [name, value] of Object.entries(
|
|
100
|
+
browsertimeRunData.timings.paintTiming
|
|
101
|
+
)) {
|
|
97
102
|
pushGroupStats(
|
|
98
103
|
this.statsPerType,
|
|
99
104
|
this.groups[group],
|
|
100
105
|
['paintTiming', name],
|
|
101
106
|
value
|
|
102
107
|
);
|
|
103
|
-
}
|
|
108
|
+
}
|
|
104
109
|
|
|
105
|
-
|
|
110
|
+
for (const timing of browsertimeRunData.timings.userTimings.marks) {
|
|
106
111
|
pushGroupStats(
|
|
107
112
|
this.statsPerType,
|
|
108
113
|
this.groups[group],
|
|
109
114
|
['userTimings', 'marks', timing.name],
|
|
110
115
|
timing.startTime
|
|
111
116
|
);
|
|
112
|
-
}
|
|
117
|
+
}
|
|
113
118
|
|
|
114
|
-
|
|
119
|
+
for (const timing of browsertimeRunData.timings.userTimings.measures) {
|
|
115
120
|
pushGroupStats(
|
|
116
121
|
this.statsPerType,
|
|
117
122
|
this.groups[group],
|
|
118
123
|
['userTimings', 'measures', timing.name],
|
|
119
124
|
timing.duration
|
|
120
125
|
);
|
|
121
|
-
}
|
|
126
|
+
}
|
|
122
127
|
}
|
|
123
128
|
|
|
124
129
|
if (
|
|
@@ -134,28 +139,31 @@ export class BrowsertimeAggregator {
|
|
|
134
139
|
}
|
|
135
140
|
|
|
136
141
|
// pick up one level of custom metrics
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
this.statsPerType,
|
|
140
|
-
this.groups[group],
|
|
141
|
-
['custom', name],
|
|
142
|
-
value
|
|
143
|
-
);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
forEach(browsertimeRunData.visualMetrics, (value, name) => {
|
|
147
|
-
// Sometimes visual elements fails and gives us null values
|
|
148
|
-
// And skip VisualProgress, ContentfulSpeedIndexProgress and others
|
|
149
|
-
if (!name.includes('Progress') && value !== null) {
|
|
142
|
+
if (browsertimeRunData.custom) {
|
|
143
|
+
for (const [name, value] of Object.entries(browsertimeRunData.custom)) {
|
|
150
144
|
pushGroupStats(
|
|
151
145
|
this.statsPerType,
|
|
152
146
|
this.groups[group],
|
|
153
|
-
['
|
|
147
|
+
['custom', name],
|
|
154
148
|
value
|
|
155
149
|
);
|
|
156
150
|
}
|
|
157
|
-
}
|
|
151
|
+
}
|
|
158
152
|
|
|
153
|
+
if (browsertimeRunData.visualMetrics) {
|
|
154
|
+
for (const [name, value] of Object.entries(
|
|
155
|
+
browsertimeRunData.visualMetrics
|
|
156
|
+
)) {
|
|
157
|
+
if (!name.includes('Progress') && value !== null) {
|
|
158
|
+
pushGroupStats(
|
|
159
|
+
this.statsPerType,
|
|
160
|
+
this.groups[group],
|
|
161
|
+
['visualMetrics', name],
|
|
162
|
+
value
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
159
167
|
if (browsertimeRunData.cpu) {
|
|
160
168
|
if (browsertimeRunData.cpu.longTasks) {
|
|
161
169
|
pushGroupStats(
|
|
@@ -226,12 +234,22 @@ export class BrowsertimeAggregator {
|
|
|
226
234
|
summary.userTimings = {};
|
|
227
235
|
const marksData = {},
|
|
228
236
|
measuresData = {};
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
237
|
+
if (object.userTimings.marks) {
|
|
238
|
+
for (const [timingName, stats] of Object.entries(
|
|
239
|
+
object.userTimings.marks
|
|
240
|
+
)) {
|
|
241
|
+
setStatsSummary(marksData, timingName, stats);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (object.userTimings.measures) {
|
|
246
|
+
for (const [timingName, stats] of Object.entries(
|
|
247
|
+
object.userTimings.measures
|
|
248
|
+
)) {
|
|
249
|
+
setStatsSummary(measuresData, timingName, stats);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
235
253
|
summary.userTimings.marks = marksData;
|
|
236
254
|
summary.userTimings.measures = measuresData;
|
|
237
255
|
} else if ('cpu'.includes(name)) {
|
|
@@ -239,13 +257,17 @@ export class BrowsertimeAggregator {
|
|
|
239
257
|
const categories = {};
|
|
240
258
|
summary.cpu = {};
|
|
241
259
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
260
|
+
if (object.cpu.longTasks) {
|
|
261
|
+
for (const [name, stats] of Object.entries(object.cpu.longTasks)) {
|
|
262
|
+
setStatsSummary(longTasks, name, stats);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
245
265
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
266
|
+
if (object.cpu.categories) {
|
|
267
|
+
for (const [name, stats] of Object.entries(object.cpu.categories)) {
|
|
268
|
+
setStatsSummary(categories, name, stats);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
249
271
|
|
|
250
272
|
summary.cpu.longTasks = longTasks;
|
|
251
273
|
summary.cpu.categories = categories;
|
|
@@ -255,9 +277,9 @@ export class BrowsertimeAggregator {
|
|
|
255
277
|
summary.memory = memory.memory;
|
|
256
278
|
} else {
|
|
257
279
|
const categoryData = {};
|
|
258
|
-
|
|
280
|
+
for (const [timingName, stats] of Object.entries(object[name])) {
|
|
259
281
|
setStatsSummary(categoryData, timingName, stats);
|
|
260
|
-
}
|
|
282
|
+
}
|
|
261
283
|
summary[name] = categoryData;
|
|
262
284
|
}
|
|
263
285
|
return summary;
|
|
@@ -2,8 +2,8 @@ import { readdir as _readdir } from 'node:fs';
|
|
|
2
2
|
import { promisify } from 'node:util';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
const readdir = promisify(_readdir);
|
|
5
|
-
import
|
|
6
|
-
const log =
|
|
5
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
6
|
+
const log = getLogger('sitespeedio.plugin.browsertime');
|
|
7
7
|
|
|
8
8
|
function findFrame(videoFrames, time) {
|
|
9
9
|
let frame = videoFrames[0];
|
|
@@ -2,11 +2,10 @@ import { parse } from 'node:url';
|
|
|
2
2
|
|
|
3
3
|
import { default as _merge } from 'lodash.merge';
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
const log =
|
|
5
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
6
|
+
const log = getLogger('plugin.browsertime');
|
|
7
7
|
|
|
8
8
|
import dayjs from 'dayjs';
|
|
9
|
-
import isEmpty from 'lodash.isempty';
|
|
10
9
|
import get from 'lodash.get';
|
|
11
10
|
import { Stats } from 'fast-stats';
|
|
12
11
|
import coach from 'coach-core';
|
|
@@ -21,6 +20,7 @@ import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
|
|
21
20
|
|
|
22
21
|
import { summarizeStats } from '../../support/statsHelpers.js';
|
|
23
22
|
import { analyzeUrl } from './analyzer.js';
|
|
23
|
+
import { isEmpty } from '../../support/util.js';
|
|
24
24
|
|
|
25
25
|
import { BrowsertimeAggregator } from './browsertimeAggregator.js';
|
|
26
26
|
import { metricsPageSummary as DEFAULT_METRICS_PAGE_SUMMARY } from './default/metricsPageSummary.js';
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import get from 'lodash.get';
|
|
5
5
|
import { noop, size } from '../../support/helpers/index.js';
|
|
6
|
-
import
|
|
7
|
-
const log =
|
|
6
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
7
|
+
const log = getLogger('sitespeedio.plugin.budget');
|
|
8
8
|
|
|
9
9
|
function getItem(url, type, metric, value, limit, limitType) {
|
|
10
10
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
2
2
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
|
3
3
|
import { verify as deprecatedVerify } from './deprecatedVerify.js';
|
|
4
4
|
import { verify } from './verify.js';
|
|
@@ -6,7 +6,7 @@ import { writeTap } from './tap.js';
|
|
|
6
6
|
import { writeJunit } from './junit.js';
|
|
7
7
|
import { writeJson } from './json.js';
|
|
8
8
|
|
|
9
|
-
const log =
|
|
9
|
+
const log = getLogger('sitespeedio.plugin.budget');
|
|
10
10
|
|
|
11
11
|
export default class BudgetPlugin extends SitespeedioPlugin {
|
|
12
12
|
constructor(options, context, queue) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { writeFileSync } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
const log =
|
|
4
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
5
|
+
const log = getLogger('sitespeedio.plugin.budget');
|
|
6
6
|
|
|
7
7
|
export function writeJson(results, dir) {
|
|
8
8
|
const file = path.join(dir, 'budgetResult.json');
|
|
@@ -3,8 +3,8 @@ import { parse } from 'node:url';
|
|
|
3
3
|
|
|
4
4
|
import jrp from 'junit-report-builder';
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
const log =
|
|
6
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
7
|
+
const log = getLogger('sitespeedio.plugin.budget');
|
|
8
8
|
|
|
9
9
|
import merge from 'lodash.merge';
|
|
10
10
|
|
|
@@ -2,8 +2,8 @@ import path from 'node:path';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import { EOL } from 'node:os';
|
|
4
4
|
import tap from 'tape';
|
|
5
|
-
import
|
|
6
|
-
const log =
|
|
5
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
6
|
+
const log = getLogger('sitespeedio.plugin.budget');
|
|
7
7
|
|
|
8
8
|
export function writeTap(results, dir) {
|
|
9
9
|
const file = path.join(dir, 'budget.tap');
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import get from 'lodash.get';
|
|
5
5
|
import merge from 'lodash.merge';
|
|
6
|
-
import
|
|
7
|
-
const log =
|
|
6
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
7
|
+
const log = getLogger('sitespeedio.plugin.budget');
|
|
8
8
|
import friendlyNames from '../../support/friendlynames.js';
|
|
9
9
|
import { time } from '../../support/helpers/time.js';
|
|
10
10
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import forEach from 'lodash.foreach';
|
|
2
1
|
import { pushGroupStats, setStatsSummary } from '../../support/statsHelpers.js';
|
|
3
2
|
|
|
4
3
|
export class CoachAggregator {
|
|
@@ -20,11 +19,10 @@ export class CoachAggregator {
|
|
|
20
19
|
coachData.advice.score
|
|
21
20
|
);
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
for (const [categoryName, category] of Object.entries(coachData.advice)) {
|
|
24
23
|
if (category.score === undefined) {
|
|
25
|
-
|
|
24
|
+
continue;
|
|
26
25
|
}
|
|
27
|
-
// Push the score per category
|
|
28
26
|
pushGroupStats(
|
|
29
27
|
this.statsPerCategory,
|
|
30
28
|
this.groups[group],
|
|
@@ -32,15 +30,15 @@ export class CoachAggregator {
|
|
|
32
30
|
category.score
|
|
33
31
|
);
|
|
34
32
|
|
|
35
|
-
|
|
33
|
+
for (const [adviceName, advice] of Object.entries(category.adviceList)) {
|
|
36
34
|
pushGroupStats(
|
|
37
35
|
this.statsPerCategory,
|
|
38
36
|
this.groups[group],
|
|
39
37
|
[categoryName, adviceName],
|
|
40
38
|
advice.score
|
|
41
39
|
);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
44
42
|
}
|
|
45
43
|
summarize() {
|
|
46
44
|
if (Object.keys(this.statsPerCategory).length === 0) {
|
|
@@ -65,9 +63,9 @@ export class CoachAggregator {
|
|
|
65
63
|
} else {
|
|
66
64
|
const categoryData = {};
|
|
67
65
|
|
|
68
|
-
|
|
66
|
+
for (const [name, stats] of Object.entries(type[categoryName])) {
|
|
69
67
|
setStatsSummary(categoryData, name, stats);
|
|
70
|
-
}
|
|
68
|
+
}
|
|
71
69
|
|
|
72
70
|
summary[categoryName] = categoryData;
|
|
73
71
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
|
2
2
|
import { CoachAggregator } from './aggregator.js';
|
|
3
|
-
import
|
|
4
|
-
const log =
|
|
3
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
4
|
+
const log = getLogger('plugin.coach');
|
|
5
5
|
|
|
6
6
|
const DEFAULT_METRICS_RUN = [];
|
|
7
7
|
|
|
@@ -3,9 +3,9 @@ import path from 'node:path';
|
|
|
3
3
|
|
|
4
4
|
import { execa } from 'execa';
|
|
5
5
|
import { Stats } from 'fast-stats';
|
|
6
|
-
import
|
|
6
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
7
7
|
import { decimals } from '../../support/helpers/index.js';
|
|
8
|
-
const log =
|
|
8
|
+
const log = getLogger('sitespeedio.plugin.compare');
|
|
9
9
|
|
|
10
10
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
11
11
|
|
|
@@ -3,7 +3,7 @@ import { readFileSync } from 'node:fs';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
|
|
5
5
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
|
6
|
-
import
|
|
6
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
7
7
|
import merge from 'lodash.merge';
|
|
8
8
|
import get from 'lodash.get';
|
|
9
9
|
import dayjs from 'dayjs';
|
|
@@ -19,7 +19,7 @@ import { getBaseline, saveBaseline } from './baseline.js';
|
|
|
19
19
|
|
|
20
20
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
21
21
|
|
|
22
|
-
const log =
|
|
22
|
+
const log = getLogger('sitespeedio.plugin.compare');
|
|
23
23
|
const defaultConfig = {};
|
|
24
24
|
|
|
25
25
|
function urlToId(url, options) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import merge from 'lodash.merge';
|
|
3
|
-
import
|
|
3
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
4
4
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
|
5
5
|
|
|
6
|
-
const log =
|
|
6
|
+
const log = getLogger('sitespeedio.plugin.crawler');
|
|
7
7
|
import Crawler from 'simplecrawler';
|
|
8
8
|
import { throwIfMissing } from '../../support/util.js';
|
|
9
9
|
import { toArray } from '../../support/util.js';
|
|
@@ -60,10 +60,7 @@ export default class CrawlerPlugin extends SitespeedioPlugin {
|
|
|
60
60
|
for (let cookieParts of cookies) {
|
|
61
61
|
const parts = new Array(
|
|
62
62
|
cookieParts.slice(0, cookieParts.indexOf('=')),
|
|
63
|
-
cookieParts.slice(
|
|
64
|
-
cookieParts.indexOf('=') + 1,
|
|
65
|
-
cookieParts.length
|
|
66
|
-
)
|
|
63
|
+
cookieParts.slice(cookieParts.indexOf('=') + 1)
|
|
67
64
|
);
|
|
68
65
|
crawler.cookies.add(parts[0], parts[1]);
|
|
69
66
|
}
|
|
@@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
6
6
|
import merge from 'lodash.merge';
|
|
7
7
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ import { throwIfMissing } from '../../support/util.js';
|
|
|
11
11
|
import { repackage } from './repackage.js';
|
|
12
12
|
import { send } from './send.js';
|
|
13
13
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
14
|
-
const log =
|
|
14
|
+
const log = getLogger('plugin.crux');
|
|
15
15
|
|
|
16
16
|
const defaultConfig = {};
|
|
17
17
|
|
package/lib/plugins/crux/send.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { request as _request } from 'node:https';
|
|
2
|
-
import
|
|
3
|
-
const log =
|
|
2
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
3
|
+
const log = getLogger('plugin.crux');
|
|
4
4
|
|
|
5
5
|
export async function send(url, key, formFactor, shouldWeTestTheURL) {
|
|
6
6
|
let data = shouldWeTestTheURL ? { url } : { origin: url };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { parse } from 'node:url';
|
|
2
2
|
|
|
3
3
|
import { Stats } from 'fast-stats';
|
|
4
|
-
import
|
|
5
|
-
import isEmpty from 'lodash.isempty';
|
|
6
|
-
import reduce from 'lodash.reduce';
|
|
4
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
7
5
|
|
|
8
6
|
import { summarizeStats } from '../../support/statsHelpers.js';
|
|
9
7
|
|
|
10
|
-
const log =
|
|
8
|
+
const log = getLogger('sitespeedio.plugin.domains');
|
|
11
9
|
|
|
12
10
|
const timingNames = [
|
|
13
11
|
'blocked',
|
|
@@ -39,22 +37,22 @@ function getDomain(domainName) {
|
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
function calc(domains) {
|
|
42
|
-
return reduce(
|
|
43
|
-
|
|
44
|
-
(summary, domainStats, domainName) => {
|
|
40
|
+
return Object.entries(domains).reduce(
|
|
41
|
+
(summary, [domainName, domainStats]) => {
|
|
45
42
|
const domainSummary = {
|
|
46
43
|
requestCount: domainStats.requestCount,
|
|
47
44
|
domainName
|
|
48
45
|
};
|
|
49
46
|
|
|
50
47
|
const stats = summarizeStats(domainStats.totalTime);
|
|
51
|
-
if (
|
|
48
|
+
if (stats && Object.keys(stats).length > 0) {
|
|
52
49
|
domainSummary.totalTime = stats;
|
|
53
50
|
}
|
|
51
|
+
|
|
54
52
|
for (const name of timingNames) {
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
domainSummary[name] =
|
|
53
|
+
const stat = summarizeStats(domainStats[name]);
|
|
54
|
+
if (stat && Object.keys(stat).length > 0) {
|
|
55
|
+
domainSummary[name] = stat;
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import isEmpty from 'lodash.isempty';
|
|
2
1
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
|
3
2
|
import { DomainsAggregator } from './aggregator.js';
|
|
3
|
+
import { isEmpty } from '../../support/util.js';
|
|
4
4
|
|
|
5
5
|
export default class DomainsPlugin extends SitespeedioPlugin {
|
|
6
6
|
constructor(options, context, queue) {
|
package/lib/plugins/gcs/index.js
CHANGED
|
@@ -2,26 +2,25 @@ import path from 'node:path';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
|
|
4
4
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
// Documentation of @google-cloud/storage: https://cloud.google.com/nodejs/docs/reference/storage/2.3.x/Bucket#upload
|
|
7
7
|
import { Storage } from '@google-cloud/storage';
|
|
8
|
-
import
|
|
8
|
+
import { getLogger } from '@sitespeed.io/log';
|
|
9
9
|
import { throwIfMissing } from '../../support/util.js';
|
|
10
|
+
import { recursiveReaddir } from '../../support/fileUtil.js';
|
|
10
11
|
|
|
11
|
-
const log =
|
|
12
|
-
|
|
13
|
-
function ignoreDirectories(file, stats) {
|
|
14
|
-
return stats.isDirectory();
|
|
15
|
-
}
|
|
12
|
+
const log = getLogger('sitespeedio.plugin.gcs');
|
|
16
13
|
|
|
17
14
|
async function uploadLatestFiles(dir, gcsOptions, prefix) {
|
|
18
|
-
const
|
|
15
|
+
const config = {
|
|
19
16
|
projectId: gcsOptions.projectId,
|
|
20
17
|
keyFilename: gcsOptions.key
|
|
21
|
-
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const storage = new Storage(config);
|
|
22
21
|
const bucket = storage.bucket(gcsOptions.bucketname);
|
|
23
22
|
|
|
24
|
-
const files = await
|
|
23
|
+
const files = await recursiveReaddir(dir, true);
|
|
25
24
|
const promises = [];
|
|
26
25
|
|
|
27
26
|
for (let file of files) {
|
|
@@ -31,14 +30,17 @@ async function uploadLatestFiles(dir, gcsOptions, prefix) {
|
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
async function upload(dir, gcsOptions, prefix) {
|
|
34
|
-
const files = await
|
|
33
|
+
const files = await recursiveReaddir(dir, true);
|
|
35
34
|
const promises = [];
|
|
36
35
|
|
|
37
36
|
const storage = new Storage({
|
|
38
|
-
projectId: gcsOptions.projectId
|
|
39
|
-
keyFilename: gcsOptions.key
|
|
37
|
+
projectId: gcsOptions.projectId
|
|
40
38
|
});
|
|
41
39
|
|
|
40
|
+
if (gcsOptions.key) {
|
|
41
|
+
storage.keyFilename = gcsOptions.key;
|
|
42
|
+
}
|
|
43
|
+
|
|
42
44
|
const bucket = storage.bucket(gcsOptions.bucketname);
|
|
43
45
|
|
|
44
46
|
for (let file of files) {
|
|
@@ -71,9 +73,8 @@ async function uploadFile(
|
|
|
71
73
|
validation: 'crc32c',
|
|
72
74
|
gzip: !!gcsOptions.gzip,
|
|
73
75
|
metadata: {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
76
|
+
// eslint-disable-next-line unicorn/numeric-separators-style
|
|
77
|
+
cacheControl: 'public, max-age=' + (noCacheTime ? 0 : 31536000)
|
|
77
78
|
}
|
|
78
79
|
};
|
|
79
80
|
|