sitespeed.io 34.2.0 → 34.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG - sitespeed.io (we use [semantic versioning](https://semver.org))
2
2
 
3
+ ## 34.2.2 - 2024-06-18
4
+ ### Fixed
5
+ * Make it possible to disable the API. In some cases where you extends another configuration file, you could end up in a API loop where the API calls the API [#4191](https://github.com/sitespeedio/sitespeed.io/pull/4191).
6
+
7
+ ## 34.2.1 - 2024-06-17
8
+ ### Fixed
9
+ * API: safer parsing if something fail to get better error messages [#4188](https://github.com/sitespeedio/sitespeed.io/pull/4188).
10
+
3
11
  ## 34.2.0 - 2024-06-14
4
12
 
5
13
  ### Added
package/bin/sitespeed.js CHANGED
@@ -132,7 +132,7 @@ async function start() {
132
132
 
133
133
  let options = parsed.options;
134
134
 
135
- if (options.api && options.api.hostname) {
135
+ if (options.api && options.api.hostname && !options.disableAPI) {
136
136
  api(options);
137
137
  } else {
138
138
  try {
package/lib/api/send.js CHANGED
@@ -24,13 +24,21 @@ export async function addTest(hostname, options) {
24
24
  let data = [];
25
25
  res.on('data', chunk => data.push(chunk));
26
26
  res.on('end', () => {
27
- return res.statusCode === 200
28
- ? resolve(Buffer.concat(data).toString('utf8'))
29
- : reject(JSON.parse(Buffer.concat(data).toString('utf8')));
27
+ if (res.statusCode === 200) {
28
+ return resolve(Buffer.concat(data).toString('utf8'));
29
+ } else {
30
+ try {
31
+ return reject(JSON.parse(Buffer.concat(data).toString('utf8')));
32
+ } catch {
33
+ return reject({
34
+ message:
35
+ 'Could parse result:' + Buffer.concat(data).toString('utf8')
36
+ });
37
+ }
38
+ }
30
39
  });
31
40
  });
32
41
  request.on('error', error => {
33
- console.log('onERror');
34
42
  reject({ message: error.toString() });
35
43
  });
36
44
  request.write(JSON.stringify(postData));
@@ -69,9 +77,18 @@ export async function get(testId, hostname, options) {
69
77
  });
70
78
 
71
79
  res.on('end', () => {
72
- return res.statusCode === 200
73
- ? resolve(JSON.parse(Buffer.concat(data).toString('utf8')))
74
- : reject(JSON.parse(Buffer.concat(data).toString('utf8')));
80
+ if (res.statusCode === 200) {
81
+ return resolve(JSON.parse(Buffer.concat(data).toString('utf8')));
82
+ } else {
83
+ try {
84
+ return reject(JSON.parse(Buffer.concat(data).toString('utf8')));
85
+ } catch {
86
+ return reject({
87
+ message:
88
+ 'Could parse result:' + Buffer.concat(data).toString('utf8')
89
+ });
90
+ }
91
+ }
75
92
  });
76
93
  })
77
94
  .on('error', () => {
package/lib/cli/cli.js CHANGED
@@ -2034,9 +2034,14 @@ export async function parseCommandLine() {
2034
2034
  describe:
2035
2035
  'Give your test a slug. The slug is used when you send the metrics to your data storage to identify the test and the folder of the tests. The max length of the slug is 200 characters and it can only contain a-z A-Z 0-9 and -_ characters.'
2036
2036
  })
2037
+ .option('disableAPI', {
2038
+ default: false,
2039
+ type: 'boolean'
2040
+ })
2037
2041
  .help('h')
2038
2042
  .alias('help', 'h')
2039
2043
  .config(config)
2044
+ .hide('disableAPI')
2040
2045
  .alias('version', 'V')
2041
2046
  .version(version)
2042
2047
  .coerce('budget', function (argument) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "sitespeed.io",
3
- "version": "34.2.0",
3
+ "version": "34.2.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "sitespeed.io",
9
- "version": "34.2.0",
9
+ "version": "34.2.2",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-s3": "3.564.0",
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "sitespeed.io": "./bin/sitespeed.js",
6
6
  "sitespeed.io-wpr": "./bin/browsertimeWebPageReplay.js"
7
7
  },
8
- "version": "34.2.0",
8
+ "version": "34.2.2",
9
9
  "description": "sitespeed.io is an open-source tool for comprehensive web performance analysis, enabling you to test, monitor, and optimize your website’s speed using real browsers in various environments.",
10
10
  "keywords": [
11
11
  "performance",