sitespeed.io 36.2.3 → 36.2.4

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
+ ## 36.2.4 - 2025-02-02
4
+ ### Fixed
5
+ * The GitHub actions tests on Windows was broken. I think GitHub changed their setup: Suddenly the path to plugins was broken. Rerunning old test that used to work, failed with the same code on our side. It's fixed by [#4426](https://github.com/sitespeedio/sitespeed.io/pull/4426).
6
+
7
+ * We have had issues with parsing Android configuration because of the `--android` flag to enable Android tests. The problem was that in some cases the internal configuration object become an Array (instead of an object) and that made some objects to do not work. The PR [#4422](https://github.com/sitespeedio/sitespeed.io/pull/4422) removes `--android` from the cli help, however it will still work as before.
8
+
9
+ * Fix so API calls also looks for `--android.enabled` to know if you want to test on Android [#4427](https://github.com/sitespeedio/sitespeed.io/pull/4427).
10
+
3
11
  ## 36.2.3 - 2025-01-30
4
12
  ### Fixed
5
13
  * Even better handling of missing runtime settings [#4420](https://github.com/sitespeedio/sitespeed.io/pull/4420).
package/bin/sitespeed.js CHANGED
@@ -46,7 +46,10 @@ async function api(options) {
46
46
 
47
47
  if (apiOptions.mobile) {
48
48
  apiOptions.api.testType = 'emulatedMobile';
49
- } else if (apiOptions.android) {
49
+ } else if (
50
+ apiOptions.android === true ||
51
+ apiOptions.android.enabled === true
52
+ ) {
50
53
  apiOptions.api.testType = 'android';
51
54
  } else if (apiOptions.safari && apiOptions.safari.ios) {
52
55
  apiOptions.api.testType = 'ios';
package/lib/cli/cli.js CHANGED
@@ -25,6 +25,10 @@ const version = require('../../package.json').version;
25
25
 
26
26
  const configFiles = ['.sitespeed.io.json'];
27
27
 
28
+ function fixAndroidArgs(args) {
29
+ return args.map(arg => (arg === '--android' ? '--android.enabled' : arg));
30
+ }
31
+
28
32
  if (process.argv.includes('--config')) {
29
33
  const index = process.argv.indexOf('--config');
30
34
  configFiles.unshift(process.argv[index + 1]);
@@ -214,11 +218,8 @@ function validateInput(argv) {
214
218
  }
215
219
 
216
220
  export async function parseCommandLine() {
217
- let argvFix = process.argv.map(arg =>
218
- arg === '--android' ? '--android.enabled' : arg
219
- );
220
-
221
- let yargsInstance = yargs(hideBin(argvFix));
221
+ const fixedArgs = fixAndroidArgs(hideBin(process.argv));
222
+ const yargsInstance = yargs(fixedArgs);
222
223
  let parsed = yargsInstance
223
224
  .parserConfiguration({
224
225
  'camel-case-expansion': false,
@@ -860,8 +861,8 @@ export async function parseCommandLine() {
860
861
  'Process name of the Activity hosting the WebView. If not given, the process name is assumed to be the same as chrome.android.package.',
861
862
  group: 'Chrome'
862
863
  })
863
- .option('browsertime.android', {
864
- alias: 'android',
864
+ .option('browsertime.android.enabled', {
865
+ alias: ['android.enabled'],
865
866
  type: 'boolean',
866
867
  default: false,
867
868
  describe:
@@ -2194,7 +2195,7 @@ export async function parseCommandLine() {
2194
2195
 
2195
2196
  if (argv.ios) {
2196
2197
  set(argv, 'safari.ios', true);
2197
- } else if (argv.android && argv.browser === 'chrome') {
2198
+ } else if (argv.android.enabled === true && argv.browser === 'chrome') {
2198
2199
  // Default to Chrome Android.
2199
2200
  set(
2200
2201
  argv,
@@ -1,10 +1,12 @@
1
1
  import path from 'node:path';
2
2
  import { readdir as _readdir } from 'node:fs';
3
3
  import { promisify } from 'node:util';
4
+ import { fileURLToPath, pathToFileURL } from 'node:url';
4
5
 
5
6
  import { importGlobalSilent } from 'import-global';
6
7
  const readdir = promisify(_readdir);
7
- const __dirname = path.dirname(import.meta.url);
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
8
10
 
9
11
  const defaultPlugins = new Set([
10
12
  'browsertime',
@@ -49,7 +51,7 @@ export async function parsePluginNames(options) {
49
51
  return pluginNames;
50
52
  };
51
53
 
52
- const files = await readdir(new URL(pluginsDir));
54
+ const files = await readdir(pluginsDir);
53
55
 
54
56
  const builtins = files.map(name => path.basename(name, '.js'));
55
57
  // eslint-disable-next-line unicorn/no-array-callback-reference
@@ -60,9 +62,9 @@ export async function loadPlugins(pluginNames, options, context, queue) {
60
62
  const plugins = [];
61
63
  for (let name of pluginNames) {
62
64
  try {
63
- let { default: plugin } = await import(
64
- path.join(pluginsDir, name, 'index.js')
65
- );
65
+ const pluginPath = path.join(pluginsDir, name, 'index.js');
66
+ const pluginUrl = pathToFileURL(pluginPath).href;
67
+ let { default: plugin } = await import(pluginUrl);
66
68
  let p = new plugin(options, context, queue);
67
69
  plugins.push(p);
68
70
  } catch (error_) {
package/lib/sitespeed.js CHANGED
@@ -51,92 +51,98 @@ function runOptionalFunction(objects, fN) {
51
51
  }
52
52
 
53
53
  export async function run(options) {
54
- const url = options.urls[0];
55
- const timestamp = options.utc ? dayjs.utc() : dayjs();
56
- const { storageManager, resultUrls } = resultsStorage(
57
- url,
58
- timestamp,
59
- options
60
- );
61
-
62
- if (
63
- options.browsertime &&
64
- options.browsertime.tcpdump &&
65
- !env.SSLKEYLOGFILE
66
- ) {
67
- env.SSLKEYLOGFILE = path.join(
68
- storageManager.getBaseDir(),
69
- 'SSLKEYLOGFILE.txt'
54
+ try {
55
+ const url = options.urls[0];
56
+ const timestamp = options.utc ? dayjs.utc() : dayjs();
57
+ const { storageManager, resultUrls } = resultsStorage(
58
+ url,
59
+ timestamp,
60
+ options
70
61
  );
71
- }
72
- configure(options);
73
-
74
- // Tell the world what we are using
75
- log.info(
76
- 'Versions OS: %s nodejs: %s sitespeed.io: %s browsertime: %s coach: %s',
77
- platform() + ' ' + release(),
78
- version,
79
- packageJson.version,
80
- packageJson.dependencies.browsertime,
81
- packageJson.dependencies['coach-core']
82
- );
83
-
84
- log.debug('Running with options: %:2j', options);
85
62
 
86
- let pluginNames = await parsePluginNames(options);
87
-
88
- const plugins = options.plugins;
89
-
90
- // Deprecated setup
91
- if (plugins) {
92
- if (plugins.disable) {
93
- log.warn('--plugins.disable is deprecated, use plugins.remove instead.');
94
- plugins.remove = plugins.disable;
95
- }
96
- if (plugins.load) {
97
- log.warn('--plugins.load is deprecated, use plugins.add instead.');
98
- plugins.add = plugins.load;
63
+ if (
64
+ options.browsertime &&
65
+ options.browsertime.tcpdump &&
66
+ !env.SSLKEYLOGFILE
67
+ ) {
68
+ env.SSLKEYLOGFILE = path.join(
69
+ storageManager.getBaseDir(),
70
+ 'SSLKEYLOGFILE.txt'
71
+ );
99
72
  }
73
+ configure(options);
74
+
75
+ // Tell the world what we are using
76
+ log.info(
77
+ 'Versions OS: %s nodejs: %s sitespeed.io: %s browsertime: %s coach: %s',
78
+ platform() + ' ' + release(),
79
+ version,
80
+ packageJson.version,
81
+ packageJson.dependencies.browsertime,
82
+ packageJson.dependencies['coach-core']
83
+ );
100
84
 
101
- // Finalize the plugins that we wanna run
102
- // First we add the new ones and then remove, that means remove
103
- // always wins
104
- pluginNames = [...new Set([...pluginNames, ...toArray(plugins.add)])];
85
+ log.debug('Running with options: %:2j', options);
86
+
87
+ let pluginNames = await parsePluginNames(options);
88
+
89
+ const plugins = options.plugins;
90
+
91
+ // Deprecated setup
92
+ if (plugins) {
93
+ if (plugins.disable) {
94
+ log.warn(
95
+ '--plugins.disable is deprecated, use plugins.remove instead.'
96
+ );
97
+ plugins.remove = plugins.disable;
98
+ }
99
+ if (plugins.load) {
100
+ log.warn('--plugins.load is deprecated, use plugins.add instead.');
101
+ plugins.add = plugins.load;
102
+ }
103
+
104
+ // Finalize the plugins that we wanna run
105
+ // First we add the new ones and then remove, that means remove
106
+ // always wins
107
+ pluginNames = [...new Set([...pluginNames, ...toArray(plugins.add)])];
108
+
109
+ const removeSet = new Set(toArray(plugins.remove));
110
+ pluginNames = pluginNames.filter(name => !removeSet.has(name));
111
+
112
+ if (plugins.list) {
113
+ log.info(
114
+ 'The following plugins are enabled: %s',
115
+ pluginNames.join(', ')
116
+ );
117
+ }
118
+ }
105
119
 
106
- const removeSet = new Set(toArray(plugins.remove));
107
- pluginNames = pluginNames.filter(name => !removeSet.has(name));
120
+ // This is the contect where we wanna run our tests
121
+ const context = {
122
+ storageManager,
123
+ resultUrls,
124
+ timestamp,
125
+ budget: budgetResult,
126
+ name: url,
127
+ log,
128
+ getLogger,
129
+ messageMaker,
130
+ statsHelpers,
131
+ filterRegistry
132
+ };
133
+ const queueHandler = new QueueHandler(options);
134
+ const runningPlugins = await loadPlugins(
135
+ pluginNames,
136
+ options,
137
+ context,
138
+ queueHandler
139
+ );
140
+ const urlSources = [options.multi ? scriptSource : urlSource];
141
+ const allPlugins = [...runningPlugins];
142
+ queueHandler.setup(runningPlugins);
108
143
 
109
- if (plugins.list) {
110
- log.info('The following plugins are enabled: %s', pluginNames.join(', '));
111
- }
112
- }
144
+ // Open/start each and every plugin
113
145
 
114
- // This is the contect where we wanna run our tests
115
- const context = {
116
- storageManager,
117
- resultUrls,
118
- timestamp,
119
- budget: budgetResult,
120
- name: url,
121
- log,
122
- getLogger,
123
- messageMaker,
124
- statsHelpers,
125
- filterRegistry
126
- };
127
- const queueHandler = new QueueHandler(options);
128
- const runningPlugins = await loadPlugins(
129
- pluginNames,
130
- options,
131
- context,
132
- queueHandler
133
- );
134
- const urlSources = [options.multi ? scriptSource : urlSource];
135
- const allPlugins = [...runningPlugins];
136
- queueHandler.setup(runningPlugins);
137
-
138
- // Open/start each and every plugin
139
- try {
140
146
  await Promise.all(
141
147
  runOptionalFunction(allPlugins, 'open', context, options)
142
148
  );
@@ -180,7 +186,7 @@ export async function run(options) {
180
186
  timestamp: timestamp.format()
181
187
  };
182
188
  } catch (error) {
183
- log.error(error);
189
+ log.error(error.stack);
184
190
  throw error;
185
191
  }
186
192
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "sitespeed.io",
3
- "version": "36.2.3",
3
+ "version": "36.2.4",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "sitespeed.io",
9
- "version": "36.2.3",
9
+ "version": "36.2.4",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
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": "36.2.3",
8
+ "version": "36.2.4",
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",
package/docs/README.md DELETED
@@ -1,10 +0,0 @@
1
- Documentation for sitespeed.io
2
- ================
3
-
4
- First make sure you have Bundler: <code>gem install bundler</code>
5
-
6
- If you run on a Mac OS make sure you have xcode-select installed: <code>xcode-select --install</code>
7
-
8
- To run it locally: <code>bundle install && bundle exec jekyll serve --baseurl ''</code>
9
-
10
- Checkout http://localhost:4000/