sitespeed.io 21.4.0 → 22.0.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.
- package/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +65 -0
- package/.github/ISSUE_TEMPLATE/QUESTION.yml +15 -0
- package/.github/workflows/docker-scan.yml +3 -2
- package/.github/workflows/docker.yml +3 -2
- package/CHANGELOG.md +45 -1
- package/Dockerfile +4 -2
- package/Dockerfile-slim +20 -10
- package/lib/cli/cli.js +6 -0
- package/lib/core/pluginLoader.js +7 -3
- package/lib/plugins/crux/cli.js +6 -0
- package/lib/plugins/crux/index.js +148 -130
- package/lib/plugins/crux/pug/index.pug +57 -25
- package/lib/plugins/html/assets/css/index.min.css +1 -1
- package/lib/plugins/html/assets/js/chartist-plugin-legend.min.js +1 -0
- package/lib/plugins/html/renderer.js +1 -1
- package/lib/plugins/html/src/sass/components/chartistExtras.scss +70 -3
- package/lib/plugins/html/templates/layout.pug +1 -0
- package/lib/plugins/html/templates/url/iteration/index.pug +29 -16
- package/lib/plugins/html/templates/url/summary/index.pug +47 -12
- package/lib/plugins/html/templates/url/thirdparty/thirdPartyCookies.pug +2 -1
- package/npm-shrinkwrap.json +54 -54
- package/package.json +3 -3
- package/release.sh +4 -9
- package/.github/ISSUE_TEMPLATE.md +0 -9
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
name: Bug Report
|
|
2
|
+
description: File a bug report
|
|
3
|
+
labels: [bug]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: Thanks for reporting issues back to sitespeed.io!
|
|
8
|
+
- type: checkboxes
|
|
9
|
+
id: Reproducable
|
|
10
|
+
attributes:
|
|
11
|
+
label: Have you read the documentation?
|
|
12
|
+
description: Please double check that this question hasn't already answered in the [documentation](https://www.sitespeed.io/documentation/sitespeed.io/) (use the `Search`). Also please read [how to make a good bug report](https://www.sitespeed.io/documentation/sitespeed.io/bug-report/) and check [how to debug your script](https://www.sitespeed.io/documentation/sitespeed.io/scripting/#debug).
|
|
13
|
+
options:
|
|
14
|
+
- label: Yes, I've read the [how to make a reproducable bug guide](https://www.sitespeed.io/documentation/sitespeed.io/bug-report/)
|
|
15
|
+
required: true
|
|
16
|
+
- label: Yes, I've read the [how to debug my script guide](https://www.sitespeed.io/documentation/sitespeed.io/scripting/#debug)
|
|
17
|
+
required: false
|
|
18
|
+
- type: input
|
|
19
|
+
id: url
|
|
20
|
+
attributes:
|
|
21
|
+
label: URL
|
|
22
|
+
description: What URL did you run sitespeed.io on? If you can't share your URL please make a minimial repro to a public location (e.g. https://glitch.com/, http://jsbin.com/, etc)
|
|
23
|
+
placeholder: https://example.com
|
|
24
|
+
validations:
|
|
25
|
+
required: true
|
|
26
|
+
- type: textarea
|
|
27
|
+
id: whaw
|
|
28
|
+
attributes:
|
|
29
|
+
label: What are you trying to accomplish
|
|
30
|
+
description: A brief description of what you tried to do and what went wrong.
|
|
31
|
+
validations:
|
|
32
|
+
required: true
|
|
33
|
+
- type: dropdown
|
|
34
|
+
id: browser
|
|
35
|
+
attributes:
|
|
36
|
+
label: What browser did you use?
|
|
37
|
+
description: Extra bonus if you try the issue in multiple browsers
|
|
38
|
+
multiple: true
|
|
39
|
+
options:
|
|
40
|
+
- Chrome
|
|
41
|
+
- Firefox
|
|
42
|
+
- Edge
|
|
43
|
+
- Safari Mac OS
|
|
44
|
+
- Safari iOS
|
|
45
|
+
- Chrome Android
|
|
46
|
+
- Firefox Android
|
|
47
|
+
- Other
|
|
48
|
+
validations:
|
|
49
|
+
required: true
|
|
50
|
+
- type: textarea
|
|
51
|
+
id: how-to-reproduce
|
|
52
|
+
attributes:
|
|
53
|
+
label: How to reproduce
|
|
54
|
+
description: Please copy and paste how you run so we can reproduce. This will be automatically formatted into code, so no need for backticks. Remember to follow the [how to make a good bug report guide](https://www.sitespeed.io/documentation/sitespeed.io/bug-report/)!
|
|
55
|
+
render: shell
|
|
56
|
+
validations:
|
|
57
|
+
required: true
|
|
58
|
+
- type: textarea
|
|
59
|
+
id: logs
|
|
60
|
+
attributes:
|
|
61
|
+
label: Relevant log output
|
|
62
|
+
description: Please copy and paste any relevant log output (please DO NOT take a screenshot of the log output). This will be automatically formatted into code, so no need for backticks.
|
|
63
|
+
render: shell
|
|
64
|
+
validations:
|
|
65
|
+
required: false
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
name: Question
|
|
2
|
+
description: Ask a question about sitespeed.io
|
|
3
|
+
labels: [question]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
Ask a question about sitespeed.io
|
|
9
|
+
- type: textarea
|
|
10
|
+
id: your-question
|
|
11
|
+
attributes:
|
|
12
|
+
label: Your question
|
|
13
|
+
description: Please double check that this question hasn't already answered in the [documentation](https://www.sitespeed.io/documentation/sitespeed.io/) (use the `Search`) or [old GitHub issues](https://github.com/sitespeedio/sitespeed.io/issues?q=is%3Aissue+is%3Aclosed). You can also ask questions in the [sitespeed.io Slack channel](https://sitespeedio.herokuapp.com/). And if your question is more like a bug, please [use the bug report form](https://github.com/sitespeedio/sitespeed.io/issues/new?assignees=&labels=bug&template=BUG_REPORT.yml)
|
|
14
|
+
validations:
|
|
15
|
+
required: true
|
|
@@ -14,7 +14,8 @@ jobs:
|
|
|
14
14
|
|
|
15
15
|
- name: Build an image from Dockerfile
|
|
16
16
|
run: |
|
|
17
|
-
docker
|
|
17
|
+
docker buildx install
|
|
18
|
+
docker buildx build --load --platform linux/amd64 -t docker.io/sitespeedio/sitespeed.io:${{ github.sha }} .
|
|
18
19
|
|
|
19
20
|
- name: Run Trivy vulnerability scanner
|
|
20
21
|
uses: aquasecurity/trivy-action@master
|
|
@@ -24,4 +25,4 @@ jobs:
|
|
|
24
25
|
exit-code: '1'
|
|
25
26
|
ignore-unfixed: true
|
|
26
27
|
vuln-type: 'os,library'
|
|
27
|
-
severity: 'CRITICAL
|
|
28
|
+
severity: 'CRITICAL'
|
|
@@ -13,8 +13,9 @@ jobs:
|
|
|
13
13
|
- uses: actions/checkout@v2
|
|
14
14
|
- name: Build Docker containers
|
|
15
15
|
run: |
|
|
16
|
-
docker
|
|
17
|
-
docker build -t sitespeedio/sitespeed.io
|
|
16
|
+
docker buildx install
|
|
17
|
+
docker buildx build --load --platform linux/amd64 -t sitespeedio/sitespeed.io .
|
|
18
|
+
docker buildx build --load --platform linux/amd64 -t sitespeedio/sitespeed.io:slim --file Dockerfile-slim .
|
|
18
19
|
- name: Run test on default container for Chrome
|
|
19
20
|
run: docker run --rm sitespeedio/sitespeed.io https://www.sitespeed.io -n 1 -b chrome
|
|
20
21
|
- name: Run test on default container for Firefox
|
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,54 @@
|
|
|
1
1
|
# CHANGELOG - sitespeed.io (we use [semantic versioning](https://semver.org))
|
|
2
2
|
|
|
3
|
+
## 22.0.0 - 2022-02-07
|
|
4
|
+
|
|
5
|
+
### Breaking changes
|
|
6
|
+
* If you use the Lightouse plugin there's breaking changes:
|
|
7
|
+
|
|
8
|
+
In the new version we drop support for the following:
|
|
9
|
+
* Running multiple runs with Lighthouse.
|
|
10
|
+
* Using scripts to login the user (or whatever you need before you run your tests)
|
|
11
|
+
It's a couple of reasons why I remove those features:
|
|
12
|
+
* I been looking for a maintainer of the Lighthouse plugin for +1 year and I haven't found one. For me to be able to maintain it I want the plugin to be as simple as possible.
|
|
13
|
+
* I deeply regret merging the PR for adding multiple runs for Lighthouse. That PR goes against everything I know about measuring performance. Lighthouse is not built for getting correct performance metrics, it's built to help (Chrome) developers to get insights how they make the page "faster". Lets stick to the basics and keep it possible to get those recommendations from Lighthouse.
|
|
14
|
+
* Maybe someday Lighthouse will have support for user journeys, lets wait until that is officially supported and then I can check if it could be used in the plugin.
|
|
15
|
+
|
|
16
|
+
With the new release we also break how you configure Lighthouse. People has had problem with that since day 1. With the new version we support two new ways to configure Lighthouse:
|
|
17
|
+
- By configuration JSON file. `--lighthouse.config config.js`
|
|
18
|
+
- By Lightouse flags file. `--lighthouse.flags flag.json`
|
|
19
|
+
|
|
20
|
+
If you don't need to configure Lightouse you can use the default settings both for desktop and mobile. If you run without any settings, the plugin will use desktop settings. If you run with `--mobile`, `--android` or `--ios` the mobile settings will be used.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
* Build Docker containers for both amd64 and arm64 to make containers work on Mac M1. The arm container contains Firefox and Chromium. Thank you [whichfinder](https://github.com/whichfinder) and [Radu Micu](https://github.com/radum) for the help! Fixed in PR [#3554](https://github.com/sitespeedio/sitespeed.io/pull/3554).
|
|
24
|
+
* When plugins is loaded, there's a new extra last step where we try to load the plugin as a globally installed npm module [#3546](https://github.com/sitespeedio/sitespeed.io/pull/3546).
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
* Fix so that we do not display the same 3rd party cookie multiple times [#3545](https://github.com/sitespeedio/sitespeed.io/pull/3545).
|
|
28
|
+
* Updated Coach Core that includes the latest version of third party web and PageXray that find more fonts without mime type.
|
|
29
|
+
|
|
30
|
+
## 21.6.1 - 2022-01-24
|
|
31
|
+
### Fixed
|
|
32
|
+
* Updated to [Browsertime 14.18.1](https://github.com/sitespeedio/browsertime/blob/main/CHANGELOG.md#14181---2022-01-24) that makes the summary metric log message use median (instead of mean) and change a log message level to debug.
|
|
33
|
+
## 21.6.0 - 2022-01-24
|
|
34
|
+
### Added
|
|
35
|
+
* Updated to Edge stable release in the Docker container.
|
|
36
|
+
* Remove Crux distribution table and use pie charts instead [#3537](https://github.com/sitespeedio/sitespeed.io/pull/3537)
|
|
37
|
+
* Add extra sleep time between Crux calls to make sure to not overload the API limit [#3536](https://github.com/sitespeedio/sitespeed.io/pull/3536).
|
|
38
|
+
* Added extra Crux enable command line `--crux.enable` to enable Crux [#3538](https://github.com/sitespeedio/sitespeed.io/pull/3538). Its default value is `true` and you also need to supply the Crux key to run Crux. The reason for the new parameter is that you can now configure the key in your configuration JSON and set the enable to false and then you enable it with the CLI parameter when you actually need to run Crux.
|
|
39
|
+
* Show Crux-metrics on the Summary page [#3540](https://github.com/sitespeedio/sitespeed.io/pull/3540).
|
|
40
|
+
* Updated summary metrics tables with headings to make it easier to read [#3541](https://github.com/sitespeedio/sitespeed.io/pull/3541).
|
|
41
|
+
* Added [Browsertime 14.17.0](https://github.com/sitespeedio/browsertime/blob/main/CHANGELOG.md#14170---2022-01-23) with new Select and click.byName commands. With that Browsertime version you also need to have ffprobe installed when you run Visual Metrics but that should already be installed.
|
|
42
|
+
* Added [Browsertime 14.18.0](https://github.com/sitespeedio/browsertime/blob/main/CHANGELOG.md#14180---2022-01-24) with a fix for Firefox [#1698](https://github.com/sitespeedio/browsertime/issues/1698)
|
|
43
|
+
|
|
44
|
+
## 21.5.0 - 2022-01-14
|
|
45
|
+
### Added
|
|
46
|
+
* Upgraded to [Browsertime 14.15.0](https://github.com/sitespeedio/browsertime/blob/main/CHANGELOG.md#14150---2022-01-12) that adds support for `--appendToUserAgent` for Chrome/Edge/Firefox. And then Browsertime 14.16.0 that supports Geckodriver for Raspberry Pi.
|
|
3
47
|
## 21.4.0 - 2022-01-12
|
|
4
48
|
### Added
|
|
5
49
|
* Updated to a new build of WebPageReplay in the Docker container
|
|
6
50
|
* Updated the Ubuntu base image to latest version and latest NodeJS in the Docketr container.
|
|
7
|
-
* Upgraded
|
|
51
|
+
* Upgraded Browsertime [#3528](https://github.com/sitespeedio/sitespeed.io/pull/3528):
|
|
8
52
|
* Add support for Humble as connectivity engine for mobile phone testing. Make sure to setup Humble on a Raspberry Pi 4 and the choose engine with --connectivity.engine humble and set the URL to your instance --connectivity.humble.url http://raspberrypi.local:3000. Added in #1691.
|
|
9
53
|
* Upgraded to Chrome 97 and Edge 97 in the Docker container.
|
|
10
54
|
* Upgraded to Chromedriver 97.
|
package/Dockerfile
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
FROM sitespeedio/webbrowsers:chrome-
|
|
1
|
+
FROM sitespeedio/webbrowsers:chrome-98.0-firefox-94.0-edge-97.0-multi
|
|
2
|
+
|
|
3
|
+
ARG TARGETPLATFORM=linux/amd64
|
|
2
4
|
|
|
3
5
|
ENV SITESPEED_IO_BROWSERTIME__XVFB true
|
|
4
6
|
ENV SITESPEED_IO_BROWSERTIME__DOCKER true
|
|
5
7
|
|
|
6
|
-
COPY docker/webpagereplay/wpr /usr/local/bin/
|
|
8
|
+
COPY docker/webpagereplay/$TARGETPLATFORM/wpr /usr/local/bin/
|
|
7
9
|
COPY docker/webpagereplay/wpr_cert.pem /webpagereplay/certs/
|
|
8
10
|
COPY docker/webpagereplay/wpr_key.pem /webpagereplay/certs/
|
|
9
11
|
COPY docker/webpagereplay/deterministic.js /webpagereplay/scripts/deterministic.js
|
package/Dockerfile-slim
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
FROM node:
|
|
1
|
+
FROM node:16.13.2-bullseye-slim
|
|
2
|
+
|
|
3
|
+
ARG TARGETPLATFORM=linux/amd64
|
|
2
4
|
|
|
3
5
|
ENV SITESPEED_IO_BROWSERTIME__DOCKER true
|
|
4
6
|
ENV SITESPEED_IO_BROWSERTIME__VIDEO false
|
|
@@ -12,16 +14,24 @@ ENV PATH="/usr/local/bin:${PATH}"
|
|
|
12
14
|
|
|
13
15
|
RUN buildDeps='wget bzip2' && apt-get update && apt -y install $buildDeps && \
|
|
14
16
|
# Download and unpack the correct Firefox version
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
if [ "$TARGETPLATFORM" = "linux/amd64" ] ; \
|
|
18
|
+
then \
|
|
19
|
+
wget https://ftp.mozilla.org/pub/firefox/releases/${FIREFOX_VERSION}/linux-x86_64/en-US/firefox-${FIREFOX_VERSION}.tar.bz2 && \
|
|
20
|
+
tar -xjf firefox-${FIREFOX_VERSION}.tar.bz2 && \
|
|
21
|
+
rm firefox-${FIREFOX_VERSION}.tar.bz2 && \
|
|
22
|
+
mv firefox /opt/ && \
|
|
23
|
+
ln -s /opt/firefox/firefox /usr/local/bin/firefox && \
|
|
24
|
+
# Install dependencies for Firefox
|
|
25
|
+
apt-get install -y --no-install-recommends --no-install-suggests libxt6 \
|
|
26
|
+
`apt-cache depends firefox-esr | awk '/Depends:/{print$2}'`; \
|
|
27
|
+
elif [ "$TARGETPLATFORM" = "linux/arm64" ] ; \
|
|
28
|
+
then \
|
|
29
|
+
apt-get update && \
|
|
30
|
+
apt-get install -y firefox-esr; \
|
|
31
|
+
fi
|
|
32
|
+
|
|
23
33
|
# iproute2 = tc
|
|
24
|
-
|
|
34
|
+
RUN apt -y install tcpdump iproute2 ca-certificates sudo --no-install-recommends --no-install-suggests && \
|
|
25
35
|
# Cleanup
|
|
26
36
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $toolDeps \
|
|
27
37
|
&& rm -rf /var/lib/apt/lists/* /tmp/*
|
package/lib/cli/cli.js
CHANGED
|
@@ -391,6 +391,12 @@ module.exports.parseCommandLine = function parseCommandLine() {
|
|
|
391
391
|
'The full User Agent string, defaults to the User Agent used by the browsertime.browser option.',
|
|
392
392
|
group: 'Browser'
|
|
393
393
|
})
|
|
394
|
+
.option('browsertime.appendToUserAgent', {
|
|
395
|
+
alias: 'appendToUserAgent',
|
|
396
|
+
describe:
|
|
397
|
+
'Append a String to the user agent. Works in Chrome/Edge and Firefox.',
|
|
398
|
+
group: 'Browser'
|
|
399
|
+
})
|
|
394
400
|
.option('browsertime.preURL', {
|
|
395
401
|
alias: 'preURL',
|
|
396
402
|
describe:
|
package/lib/core/pluginLoader.js
CHANGED
|
@@ -66,9 +66,13 @@ module.exports = {
|
|
|
66
66
|
try {
|
|
67
67
|
plugins.push(require(path.resolve(process.cwd(), name)));
|
|
68
68
|
} catch (error) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
try {
|
|
70
|
+
plugins.push(require(name));
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error("Couldn't load plugin %s: %s", name, err); // eslint-disable-line no-console
|
|
73
|
+
// if it fails here, let it fail hard
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
78
|
}
|
package/lib/plugins/crux/cli.js
CHANGED
|
@@ -4,6 +4,12 @@ module.exports = {
|
|
|
4
4
|
'You need to use a key to get data from CrUx. Get the key from https://developers.google.com/web/tools/chrome-user-experience-report/api/guides/getting-started#APIKey',
|
|
5
5
|
group: 'CrUx'
|
|
6
6
|
},
|
|
7
|
+
enable: {
|
|
8
|
+
default: true,
|
|
9
|
+
describe:
|
|
10
|
+
'Enable the CrUx plugin. This is on by defauly but you also need the Crux key. If you chose to disable it with this key, set this to false and you can still use the CrUx key in your configuration.',
|
|
11
|
+
group: 'CrUx'
|
|
12
|
+
},
|
|
7
13
|
formFactor: {
|
|
8
14
|
default: 'ALL',
|
|
9
15
|
type: 'string',
|
|
@@ -23,6 +23,12 @@ const DEFAULT_METRICS_SUMMARY = [
|
|
|
23
23
|
'originLoadingExperience.*.CUMULATIVE_LAYOUT_SHIFT_SCORE.*'
|
|
24
24
|
];
|
|
25
25
|
|
|
26
|
+
function wait(ms) {
|
|
27
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const CRUX_WAIT_TIME = 300;
|
|
31
|
+
|
|
26
32
|
module.exports = {
|
|
27
33
|
name() {
|
|
28
34
|
return path.basename(__dirname);
|
|
@@ -30,159 +36,171 @@ module.exports = {
|
|
|
30
36
|
open(context, options) {
|
|
31
37
|
this.make = context.messageMaker('crux').make;
|
|
32
38
|
this.options = merge({}, defaultConfig, options.crux);
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
if (this.options.enable === true) {
|
|
40
|
+
this.testedOrigins = {};
|
|
41
|
+
throwIfMissing(options.crux, ['key'], 'crux');
|
|
42
|
+
this.formFactors = Array.isArray(this.options.formFactor)
|
|
43
|
+
? this.options.formFactor
|
|
44
|
+
: [this.options.formFactor];
|
|
45
|
+
this.pug = fs.readFileSync(
|
|
46
|
+
path.resolve(__dirname, 'pug', 'index.pug'),
|
|
47
|
+
'utf8'
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
if (this.options.collect === 'ALL' || this.options.collect === 'URL') {
|
|
51
|
+
context.filterRegistry.registerFilterForType(
|
|
52
|
+
DEFAULT_METRICS_PAGESUMMARY,
|
|
53
|
+
'crux.pageSummary'
|
|
54
|
+
);
|
|
55
|
+
}
|
|
42
56
|
|
|
43
|
-
if (this.options.collect === 'ALL' || this.options.collect === 'URL') {
|
|
44
57
|
context.filterRegistry.registerFilterForType(
|
|
45
|
-
|
|
46
|
-
'crux.
|
|
58
|
+
DEFAULT_METRICS_SUMMARY,
|
|
59
|
+
'crux.summary'
|
|
47
60
|
);
|
|
48
61
|
}
|
|
49
|
-
|
|
50
|
-
context.filterRegistry.registerFilterForType(
|
|
51
|
-
DEFAULT_METRICS_SUMMARY,
|
|
52
|
-
'crux.summary'
|
|
53
|
-
);
|
|
54
62
|
},
|
|
55
63
|
async processMessage(message, queue) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (originResult.originLoadingExperience[formFactor].error) {
|
|
98
|
-
log.info(
|
|
99
|
-
`${originResult.originLoadingExperience[formFactor].error.message} for domain ${url} using ${formFactor}`
|
|
64
|
+
if (this.options.enable === true) {
|
|
65
|
+
const make = this.make;
|
|
66
|
+
switch (message.type) {
|
|
67
|
+
case 'sitespeedio.setup': {
|
|
68
|
+
queue.postMessage(make('crux.setup'));
|
|
69
|
+
// Add the HTML pugs
|
|
70
|
+
queue.postMessage(
|
|
71
|
+
make('html.pug', {
|
|
72
|
+
id: 'crux',
|
|
73
|
+
name: 'CrUx',
|
|
74
|
+
pug: this.pug,
|
|
75
|
+
type: 'pageSummary'
|
|
76
|
+
})
|
|
77
|
+
);
|
|
78
|
+
queue.postMessage(
|
|
79
|
+
make('html.pug', {
|
|
80
|
+
id: 'crux',
|
|
81
|
+
name: 'CrUx',
|
|
82
|
+
pug: this.pug,
|
|
83
|
+
type: 'run'
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case 'url': {
|
|
89
|
+
let url = message.url;
|
|
90
|
+
let group = message.group;
|
|
91
|
+
const originResult = { originLoadingExperience: {} };
|
|
92
|
+
if (
|
|
93
|
+
!this.testedOrigins[group] &&
|
|
94
|
+
(this.options.collect === 'ALL' ||
|
|
95
|
+
this.options.collect === 'ORIGIN')
|
|
96
|
+
) {
|
|
97
|
+
this.testedOrigins[group] = true;
|
|
98
|
+
log.info(`Get CrUx data for domain ${group}`);
|
|
99
|
+
for (let formFactor of this.formFactors) {
|
|
100
|
+
originResult.originLoadingExperience[formFactor] = await send.get(
|
|
101
|
+
url,
|
|
102
|
+
this.options.key,
|
|
103
|
+
formFactor,
|
|
104
|
+
false
|
|
100
105
|
);
|
|
101
106
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
`${originResult.originLoadingExperience[formFactor].error.message} for domain ${url} using ${formFactor}`,
|
|
106
|
-
{
|
|
107
|
-
url
|
|
108
|
-
}
|
|
109
|
-
)
|
|
110
|
-
);
|
|
111
|
-
} else {
|
|
112
|
-
try {
|
|
113
|
-
originResult.originLoadingExperience[formFactor] = repackage(
|
|
114
|
-
originResult.originLoadingExperience[formFactor]
|
|
107
|
+
if (originResult.originLoadingExperience[formFactor].error) {
|
|
108
|
+
log.info(
|
|
109
|
+
`${originResult.originLoadingExperience[formFactor].error.message} for domain ${url} using ${formFactor}`
|
|
115
110
|
);
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
|
|
112
|
+
queue.postMessage(
|
|
113
|
+
make(
|
|
114
|
+
'error',
|
|
115
|
+
`${originResult.originLoadingExperience[formFactor].error.message} for domain ${url} using ${formFactor}`,
|
|
116
|
+
{
|
|
117
|
+
url
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
120
|
);
|
|
121
|
+
} else {
|
|
122
|
+
try {
|
|
123
|
+
originResult.originLoadingExperience[formFactor] = repackage(
|
|
124
|
+
originResult.originLoadingExperience[formFactor]
|
|
125
|
+
);
|
|
126
|
+
} catch (e) {
|
|
127
|
+
log.error(
|
|
128
|
+
'Could not repackage the JSON for origin from CrUx, is it broken? %j',
|
|
129
|
+
originResult.originLoadingExperience[formFactor]
|
|
130
|
+
);
|
|
131
|
+
}
|
|
121
132
|
}
|
|
133
|
+
await wait(CRUX_WAIT_TIME);
|
|
122
134
|
}
|
|
135
|
+
queue.postMessage(make('crux.summary', originResult, { group }));
|
|
123
136
|
}
|
|
124
|
-
queue.postMessage(make('crux.summary', originResult, { group }));
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (this.options.collect === 'ALL' || this.options.collect === 'URL') {
|
|
128
|
-
log.info(`Get CrUx data for url ${url}`);
|
|
129
|
-
const urlResult = { loadingExperience: {} };
|
|
130
|
-
for (let formFactor of this.formFactors) {
|
|
131
|
-
urlResult.loadingExperience[formFactor] = await send.get(
|
|
132
|
-
url,
|
|
133
|
-
this.options.key,
|
|
134
|
-
formFactor,
|
|
135
|
-
true
|
|
136
|
-
);
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
if (
|
|
139
|
+
this.options.collect === 'ALL' ||
|
|
140
|
+
this.options.collect === 'URL'
|
|
141
|
+
) {
|
|
142
|
+
log.info(`Get CrUx data for url ${url}`);
|
|
143
|
+
const urlResult = { loadingExperience: {} };
|
|
144
|
+
for (let formFactor of this.formFactors) {
|
|
145
|
+
urlResult.loadingExperience[formFactor] = await send.get(
|
|
146
|
+
url,
|
|
147
|
+
this.options.key,
|
|
148
|
+
formFactor,
|
|
149
|
+
true
|
|
141
150
|
);
|
|
142
151
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
`${urlResult.loadingExperience[formFactor].error.message} for ${url} using ${formFactor}`,
|
|
147
|
-
{
|
|
148
|
-
url
|
|
149
|
-
}
|
|
150
|
-
)
|
|
151
|
-
);
|
|
152
|
-
} else {
|
|
153
|
-
try {
|
|
154
|
-
urlResult.loadingExperience[formFactor] = repackage(
|
|
155
|
-
urlResult.loadingExperience[formFactor]
|
|
152
|
+
if (urlResult.loadingExperience[formFactor].error) {
|
|
153
|
+
log.info(
|
|
154
|
+
`${urlResult.loadingExperience[formFactor].error.message} for ${url} using ${formFactor}`
|
|
156
155
|
);
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
|
|
157
|
+
queue.postMessage(
|
|
158
|
+
make(
|
|
159
|
+
'error',
|
|
160
|
+
`${urlResult.loadingExperience[formFactor].error.message} for ${url} using ${formFactor}`,
|
|
161
|
+
{
|
|
162
|
+
url
|
|
163
|
+
}
|
|
164
|
+
)
|
|
161
165
|
);
|
|
166
|
+
} else {
|
|
167
|
+
try {
|
|
168
|
+
urlResult.loadingExperience[formFactor] = repackage(
|
|
169
|
+
urlResult.loadingExperience[formFactor]
|
|
170
|
+
);
|
|
171
|
+
} catch (e) {
|
|
172
|
+
log.error(
|
|
173
|
+
'Could not repackage the JSON from CrUx, is it broken? %j',
|
|
174
|
+
urlResult.loadingExperience[formFactor]
|
|
175
|
+
);
|
|
176
|
+
}
|
|
162
177
|
}
|
|
178
|
+
await wait(CRUX_WAIT_TIME);
|
|
163
179
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
originResult.originLoadingExperience;
|
|
180
|
+
// Attach origin result so we can show it in the HTML
|
|
181
|
+
urlResult.originLoadingExperience =
|
|
182
|
+
originResult.originLoadingExperience;
|
|
168
183
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
url,
|
|
172
|
-
group
|
|
173
|
-
})
|
|
174
|
-
);
|
|
175
|
-
} else {
|
|
176
|
-
queue.postMessage(
|
|
177
|
-
make(
|
|
178
|
-
'crux.pageSummary',
|
|
179
|
-
{ originLoadingExperience: originResult.originLoadingExperience },
|
|
180
|
-
{
|
|
184
|
+
queue.postMessage(
|
|
185
|
+
make('crux.pageSummary', urlResult, {
|
|
181
186
|
url,
|
|
182
187
|
group
|
|
183
|
-
}
|
|
184
|
-
)
|
|
185
|
-
|
|
188
|
+
})
|
|
189
|
+
);
|
|
190
|
+
} else {
|
|
191
|
+
queue.postMessage(
|
|
192
|
+
make(
|
|
193
|
+
'crux.pageSummary',
|
|
194
|
+
{
|
|
195
|
+
originLoadingExperience: originResult.originLoadingExperience
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
url,
|
|
199
|
+
group
|
|
200
|
+
}
|
|
201
|
+
)
|
|
202
|
+
);
|
|
203
|
+
}
|
|
186
204
|
}
|
|
187
205
|
}
|
|
188
206
|
}
|