lighthouse 9.2.0-dev.20220122 → 9.2.0-dev.20220126
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/lighthouse-cli/bin.js +0 -4
- package/lighthouse-cli/cli-flags.js +22 -8
- package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +2 -1
- package/lighthouse-core/gather/gatherers/inspector-issues.js +2 -5
- package/lighthouse-core/runner.js +13 -0
- package/package.json +7 -9
- package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +0 -1
- package/types/artifacts.d.ts +0 -1
package/lighthouse-cli/bin.js
CHANGED
|
@@ -24,7 +24,6 @@ import url from 'url';
|
|
|
24
24
|
import module from 'module';
|
|
25
25
|
|
|
26
26
|
import log from 'lighthouse-logger';
|
|
27
|
-
import updateNotifier from 'update-notifier';
|
|
28
27
|
|
|
29
28
|
import * as commands from './commands/commands.js';
|
|
30
29
|
import * as Printer from './printer.js';
|
|
@@ -51,9 +50,6 @@ function isDev() {
|
|
|
51
50
|
* @return {Promise<LH.RunnerResult|void>}
|
|
52
51
|
*/
|
|
53
52
|
async function begin() {
|
|
54
|
-
// Tell user if there's a newer version of LH.
|
|
55
|
-
updateNotifier({pkg}).notify();
|
|
56
|
-
|
|
57
53
|
const cliFlags = getFlags();
|
|
58
54
|
|
|
59
55
|
// Process terminating command
|
|
@@ -178,7 +178,6 @@ function getFlags(manualArgv, options = {}) {
|
|
|
178
178
|
},
|
|
179
179
|
'enable-error-reporting': {
|
|
180
180
|
type: 'boolean',
|
|
181
|
-
default: undefined, // Explicitly `undefined` so prompted by default.
|
|
182
181
|
describe: 'Enables error reporting, overriding any saved preference. --no-enable-error-reporting will do the opposite. More: https://git.io/vFFTO',
|
|
183
182
|
},
|
|
184
183
|
'gather-mode': {
|
|
@@ -343,19 +342,26 @@ function getFlags(manualArgv, options = {}) {
|
|
|
343
342
|
|
|
344
343
|
// Augmenting yargs type with auto-camelCasing breaks in tsc@4.1.2 and @types/yargs@15.0.11,
|
|
345
344
|
// so for now cast to add yarg's camelCase properties to type.
|
|
346
|
-
const argv = parser.argv;
|
|
345
|
+
const argv = /** @type {Awaited<typeof parser.argv>} */ (parser.argv);
|
|
347
346
|
const cliFlags = /** @type {typeof argv & CamelCasify<typeof argv>} */ (argv);
|
|
348
347
|
|
|
348
|
+
// yargs will return `undefined` for options that have a `coerce` function but
|
|
349
|
+
// are not actually present in the user input. Instead of passing properties
|
|
350
|
+
// explicitly set to undefined, delete them from the flags object.
|
|
351
|
+
for (const [k, v] of Object.entries(cliFlags)) {
|
|
352
|
+
if (v === undefined) delete cliFlags[k];
|
|
353
|
+
}
|
|
354
|
+
|
|
349
355
|
return cliFlags;
|
|
350
356
|
}
|
|
351
357
|
|
|
352
358
|
/**
|
|
353
359
|
* Support comma-separated values for some array flags by splitting on any ',' found.
|
|
354
360
|
* @param {Array<string>=} strings
|
|
355
|
-
* @return {Array<string
|
|
361
|
+
* @return {Array<string>=}
|
|
356
362
|
*/
|
|
357
363
|
function splitCommaSeparatedValues(strings) {
|
|
358
|
-
if (!strings) return
|
|
364
|
+
if (!strings) return;
|
|
359
365
|
|
|
360
366
|
return strings.flatMap(value => value.split(','));
|
|
361
367
|
}
|
|
@@ -365,7 +371,9 @@ function splitCommaSeparatedValues(strings) {
|
|
|
365
371
|
* @return {boolean|string|undefined}
|
|
366
372
|
*/
|
|
367
373
|
function coerceOptionalStringBoolean(value) {
|
|
368
|
-
if (
|
|
374
|
+
if (value === undefined) return;
|
|
375
|
+
|
|
376
|
+
if (typeof value !== 'string' && typeof value !== 'boolean') {
|
|
369
377
|
throw new Error('Invalid value: Argument must be a string or a boolean');
|
|
370
378
|
}
|
|
371
379
|
return value;
|
|
@@ -399,9 +407,11 @@ function coerceOutput(values) {
|
|
|
399
407
|
* allowlist specific locales. Why? So we can support the user who requests 'es-MX' (unsupported)
|
|
400
408
|
* and we'll fall back to 'es' (supported).
|
|
401
409
|
* @param {unknown} value
|
|
402
|
-
* @return {LH.Locale}
|
|
410
|
+
* @return {LH.Locale|undefined}
|
|
403
411
|
*/
|
|
404
412
|
function coerceLocale(value) {
|
|
413
|
+
if (value === undefined) return;
|
|
414
|
+
|
|
405
415
|
if (typeof value !== 'string') throw new Error(`Invalid value: Argument 'locale' must be a string`);
|
|
406
416
|
return /** @type {LH.Locale} */ (value);
|
|
407
417
|
}
|
|
@@ -431,9 +441,11 @@ function coerceExtraHeaders(value) {
|
|
|
431
441
|
/**
|
|
432
442
|
* Take yarg's unchecked object value and ensure it's proper throttling settings.
|
|
433
443
|
* @param {unknown} value
|
|
434
|
-
* @return {LH.ThrottlingSettings}
|
|
444
|
+
* @return {LH.ThrottlingSettings|undefined}
|
|
435
445
|
*/
|
|
436
446
|
function coerceThrottling(value) {
|
|
447
|
+
if (value === undefined) return;
|
|
448
|
+
|
|
437
449
|
if (!isObjectOfUnknownValues(value)) {
|
|
438
450
|
throw new Error(`Invalid value: Argument 'throttling' must be an object, specified per-property ('throttling.rttMs', 'throttling.throughputKbps', etc)`);
|
|
439
451
|
}
|
|
@@ -465,9 +477,11 @@ function coerceThrottling(value) {
|
|
|
465
477
|
/**
|
|
466
478
|
* Take yarg's unchecked object value and ensure it is a proper LH.screenEmulationSettings.
|
|
467
479
|
* @param {unknown} value
|
|
468
|
-
* @return {Partial<LH.ScreenEmulationSettings
|
|
480
|
+
* @return {Partial<LH.ScreenEmulationSettings>|undefined}
|
|
469
481
|
*/
|
|
470
482
|
function coerceScreenEmulation(value) {
|
|
483
|
+
if (value === undefined) return;
|
|
484
|
+
|
|
471
485
|
if (!isObjectOfUnknownValues(value)) {
|
|
472
486
|
throw new Error(`Invalid value: Argument 'screenEmulation' must be an object, specified per-property ('screenEmulation.width', 'screenEmulation.deviceScaleFactor', etc)`);
|
|
473
487
|
}
|
|
@@ -175,7 +175,8 @@ async function begin() {
|
|
|
175
175
|
|
|
176
176
|
// Augmenting yargs type with auto-camelCasing breaks in tsc@4.1.2 and @types/yargs@15.0.11,
|
|
177
177
|
// so for now cast to add yarg's camelCase properties to type.
|
|
178
|
-
const argv =
|
|
178
|
+
const argv =
|
|
179
|
+
/** @type {Awaited<typeof rawArgv> & CamelCasify<Awaited<typeof rawArgv>>} */ (rawArgv);
|
|
179
180
|
|
|
180
181
|
const jobs = Number.isFinite(argv.jobs) ? argv.jobs : undefined;
|
|
181
182
|
const retries = Number.isFinite(argv.retries) ? argv.retries : undefined;
|
|
@@ -75,14 +75,11 @@ class InspectorIssues extends FRGatherer {
|
|
|
75
75
|
sameSiteCookieIssue: [],
|
|
76
76
|
sharedArrayBufferIssue: [],
|
|
77
77
|
twaQualityEnforcement: [],
|
|
78
|
-
wasmCrossOriginModuleSharingIssue: [],
|
|
79
78
|
};
|
|
80
79
|
const keys = /** @type {Array<keyof LH.Artifacts['InspectorIssues']>} */(Object.keys(artifact));
|
|
81
80
|
for (const key of keys) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
/** @type {`${key}Details` | `wasmCrossOriginModuleSharingIssue`} */
|
|
85
|
-
const detailsKey = (key === 'wasmCrossOriginModuleSharingIssue' ? `${key}` : `${key}Details`);
|
|
81
|
+
/** @type {`${key}Details`} */
|
|
82
|
+
const detailsKey = `${key}Details`;
|
|
86
83
|
const allDetails = this._issues.map(issue => issue.details[detailsKey]);
|
|
87
84
|
for (const detail of allDetails) {
|
|
88
85
|
if (!detail) {
|
|
@@ -263,6 +263,19 @@ class Runner {
|
|
|
263
263
|
const normalizedGatherSettings = Object.assign({}, artifacts.settings, overrides);
|
|
264
264
|
const normalizedAuditSettings = Object.assign({}, settings, overrides);
|
|
265
265
|
|
|
266
|
+
// First, try each key individually so we can print which key differed.
|
|
267
|
+
const keys = new Set([
|
|
268
|
+
...Object.keys(normalizedGatherSettings),
|
|
269
|
+
...Object.keys(normalizedAuditSettings),
|
|
270
|
+
]);
|
|
271
|
+
for (const k of keys) {
|
|
272
|
+
if (!isDeepEqual(normalizedGatherSettings[k], normalizedAuditSettings[k])) {
|
|
273
|
+
throw new Error(
|
|
274
|
+
`Cannot change settings between gathering and auditing. Difference found at: ${k}`);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Call `isDeepEqual` on the entire thing, just in case something was missed.
|
|
266
279
|
if (!isDeepEqual(normalizedGatherSettings, normalizedAuditSettings)) {
|
|
267
280
|
throw new Error('Cannot change settings between gathering and auditing');
|
|
268
281
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse",
|
|
3
|
-
"version": "9.2.0-dev.
|
|
3
|
+
"version": "9.2.0-dev.20220126",
|
|
4
4
|
"description": "Automated auditing, performance metrics, and best practices for the web.",
|
|
5
5
|
"main": "./lighthouse-core/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -125,10 +125,9 @@
|
|
|
125
125
|
"@types/resize-observer-browser": "^0.1.1",
|
|
126
126
|
"@types/semver": "^5.5.0",
|
|
127
127
|
"@types/tabulator-tables": "^4.9.1",
|
|
128
|
-
"@types/update-notifier": "^4.1.0",
|
|
129
128
|
"@types/ws": "^7.0.0",
|
|
130
|
-
"@types/yargs": "^
|
|
131
|
-
"@types/yargs-parser": "^
|
|
129
|
+
"@types/yargs": "^17.0.8",
|
|
130
|
+
"@types/yargs-parser": "^20.2.1",
|
|
132
131
|
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
|
133
132
|
"@typescript-eslint/parser": "^5.6.0",
|
|
134
133
|
"acorn": "^8.5.0",
|
|
@@ -142,7 +141,7 @@
|
|
|
142
141
|
"cpy": "^8.1.2",
|
|
143
142
|
"cross-env": "^7.0.2",
|
|
144
143
|
"csv-validator": "^0.0.3",
|
|
145
|
-
"devtools-protocol": "0.0.
|
|
144
|
+
"devtools-protocol": "0.0.963043",
|
|
146
145
|
"es-main": "^1.0.2",
|
|
147
146
|
"eslint": "^8.4.1",
|
|
148
147
|
"eslint-config-google": "^0.14.0",
|
|
@@ -210,13 +209,12 @@
|
|
|
210
209
|
"semver": "^5.3.0",
|
|
211
210
|
"speedline-core": "^1.4.3",
|
|
212
211
|
"third-party-web": "^0.12.7",
|
|
213
|
-
"update-notifier": "^4.1.0",
|
|
214
212
|
"ws": "^7.0.0",
|
|
215
|
-
"yargs": "^
|
|
216
|
-
"yargs-parser": "^
|
|
213
|
+
"yargs": "^17.3.1",
|
|
214
|
+
"yargs-parser": "^21.0.0"
|
|
217
215
|
},
|
|
218
216
|
"resolutions": {
|
|
219
|
-
"puppeteer/**/devtools-protocol": "0.0.
|
|
217
|
+
"puppeteer/**/devtools-protocol": "0.0.963043"
|
|
220
218
|
},
|
|
221
219
|
"repository": "GoogleChrome/lighthouse",
|
|
222
220
|
"keywords": [
|
package/types/artifacts.d.ts
CHANGED
|
@@ -568,7 +568,6 @@ declare module Artifacts {
|
|
|
568
568
|
sameSiteCookieIssue: LH.Crdp.Audits.SameSiteCookieIssueDetails[];
|
|
569
569
|
sharedArrayBufferIssue: LH.Crdp.Audits.SharedArrayBufferIssueDetails[];
|
|
570
570
|
twaQualityEnforcement: LH.Crdp.Audits.TrustedWebActivityIssueDetails[];
|
|
571
|
-
wasmCrossOriginModuleSharingIssue: LH.Crdp.Audits.WasmCrossOriginModuleSharingIssueDetails[];
|
|
572
571
|
}
|
|
573
572
|
|
|
574
573
|
// Computed artifact types below.
|