lighthouse 8.6.0 → 9.0.0-dev.20211118
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 +121 -0
- package/dist/report/bundle.esm.js +6009 -0
- package/dist/report/flow.js +98 -25
- package/dist/report/standalone.js +41 -35
- package/flow-report/.eslintrc.cjs +2 -0
- package/flow-report/assets/standalone-flow-template.html +3 -4
- package/flow-report/assets/styles.css +108 -31
- package/flow-report/src/app.tsx +25 -28
- package/flow-report/src/common.tsx +28 -15
- package/flow-report/src/header.tsx +12 -13
- package/flow-report/src/help-dialog.tsx +3 -4
- package/flow-report/src/i18n/i18n.tsx +57 -16
- package/flow-report/src/i18n/ui-strings.js +50 -0
- package/flow-report/src/icons.tsx +36 -8
- package/flow-report/src/sidebar/flow.tsx +3 -3
- package/flow-report/src/sidebar/sidebar.tsx +35 -14
- package/flow-report/src/summary/category.tsx +97 -24
- package/flow-report/src/summary/summary.tsx +21 -14
- package/flow-report/src/topbar.tsx +13 -12
- package/flow-report/src/util.ts +61 -27
- package/flow-report/src/wrappers/category-score.tsx +9 -27
- package/flow-report/src/wrappers/markdown.tsx +18 -0
- package/flow-report/src/wrappers/report.tsx +26 -37
- package/flow-report/standalone-flow.tsx +5 -4
- package/flow-report/test/common-test.tsx +32 -17
- package/flow-report/test/flow-report-pptr-test.ts +46 -0
- package/flow-report/test/header-test.tsx +6 -6
- package/flow-report/test/setup/env-setup.ts +11 -5
- package/flow-report/test/sidebar/sidebar-test.tsx +43 -1
- package/flow-report/test/summary/category-test.tsx +114 -21
- package/flow-report/test/summary/summary-test.tsx +4 -7
- package/flow-report/test/topbar-test.tsx +15 -14
- package/flow-report/test/util-test.tsx +69 -11
- package/flow-report/test/wrappers/category-score-test.tsx +84 -0
- package/flow-report/test/wrappers/markdown-test.tsx +17 -0
- package/flow-report/tsconfig.json +1 -0
- package/jest.config.js +4 -2
- package/lighthouse-cli/.eslintrc.cjs +2 -0
- package/lighthouse-cli/cli-flags.js +1 -1
- package/lighthouse-cli/run.js +1 -1
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +4 -2
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js +1 -1
- package/lighthouse-cli/test/smokehouse/smokehouse.js +1 -1
- package/lighthouse-core/audits/accessibility/axe-audit.js +7 -1
- package/lighthouse-core/audits/audit.js +1 -1
- package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +2 -0
- package/lighthouse-core/audits/byte-efficiency/modern-image-formats.js +4 -2
- package/lighthouse-core/audits/byte-efficiency/offscreen-images.js +11 -10
- package/lighthouse-core/audits/byte-efficiency/uses-optimized-images.js +5 -3
- package/lighthouse-core/audits/byte-efficiency/uses-responsive-images-snapshot.js +2 -1
- package/lighthouse-core/audits/byte-efficiency/uses-responsive-images.js +2 -1
- package/lighthouse-core/audits/deprecations.js +33 -11
- package/lighthouse-core/audits/dobetterweb/uses-http2.js +27 -11
- package/lighthouse-core/audits/errors-in-console.js +0 -2
- package/lighthouse-core/audits/image-aspect-ratio.js +5 -5
- package/lighthouse-core/audits/image-size-responsive.js +6 -6
- package/lighthouse-core/audits/installable-manifest.js +16 -7
- package/lighthouse-core/audits/preload-lcp-image.js +7 -5
- package/lighthouse-core/audits/script-treemap-data.js +1 -1
- package/lighthouse-core/audits/unsized-images.js +2 -3
- package/lighthouse-core/computed/image-records.js +4 -3
- package/lighthouse-core/computed/metrics/lantern-total-blocking-time.js +3 -4
- package/lighthouse-core/computed/metrics/tbt-utils.js +57 -0
- package/lighthouse-core/computed/metrics/total-blocking-time.js +3 -53
- package/lighthouse-core/computed/resource-summary.js +1 -1
- package/lighthouse-core/config/config-helpers.js +21 -10
- package/lighthouse-core/config/constants.js +3 -4
- package/lighthouse-core/config/default-config.js +61 -71
- package/lighthouse-core/fraggle-rock/config/config.js +1 -1
- package/lighthouse-core/fraggle-rock/config/default-config.js +4 -5
- package/lighthouse-core/fraggle-rock/gather/base-gatherer.js +6 -1
- package/lighthouse-core/fraggle-rock/gather/session.js +3 -4
- package/lighthouse-core/gather/connections/cri.js +1 -1
- package/lighthouse-core/gather/driver/storage.js +0 -1
- package/lighthouse-core/gather/driver.js +3 -7
- package/lighthouse-core/gather/fetcher.js +4 -7
- package/lighthouse-core/gather/gather-runner.js +29 -6
- package/lighthouse-core/gather/gatherers/accessibility.js +27 -0
- package/lighthouse-core/gather/gatherers/dobetterweb/response-compression.js +1 -0
- package/lighthouse-core/gather/gatherers/image-elements.js +0 -3
- package/lighthouse-core/gather/gatherers/inspector-issues.js +5 -0
- package/lighthouse-core/lib/asset-saver.js +7 -4
- package/lighthouse-core/lib/emulation.js +45 -1
- package/lighthouse-core/lib/i18n/i18n.js +19 -8
- package/lighthouse-core/lib/lh-env.js +2 -0
- package/lighthouse-core/lib/page-functions.js +2 -1
- package/lighthouse-core/lib/proto-preprocessor.js +14 -2
- package/lighthouse-core/lib/statistics.js +26 -39
- package/lighthouse-core/lib/tappable-rects.js +8 -15
- package/lighthouse-core/lib/url-shim.js +1 -1
- package/lighthouse-core/runner.js +1 -1
- package/lighthouse-core/util-commonjs.js +65 -46
- package/package.json +27 -17
- package/readme.md +3 -3
- package/report/.eslintrc.cjs +2 -0
- package/report/README.md +1 -1
- package/report/assets/standalone-template.html +2 -3
- package/report/assets/styles.css +362 -256
- package/report/assets/templates.html +21 -76
- package/report/clients/bundle.js +1 -0
- package/report/clients/standalone.js +6 -15
- package/report/generator/README.md +1 -1
- package/report/renderer/api.js +66 -0
- package/report/renderer/category-renderer.js +76 -22
- package/report/renderer/components.js +59 -110
- package/report/renderer/crc-details-renderer.js +15 -12
- package/report/renderer/dom.js +16 -1
- package/report/renderer/drop-down-menu.js +2 -2
- package/report/renderer/element-screenshot-renderer.js +8 -8
- package/report/renderer/features-util.js +1 -1
- package/report/renderer/open-tab.js +9 -3
- package/report/renderer/performance-category-renderer.js +55 -34
- package/report/renderer/pwa-category-renderer.js +0 -10
- package/report/renderer/report-renderer.js +92 -44
- package/report/renderer/report-ui-features.js +36 -33
- package/report/renderer/swap-locale-feature.js +3 -3
- package/report/renderer/topbar-features.js +53 -48
- package/report/renderer/util.js +66 -46
- package/report/test/clients/bundle-test.js +70 -0
- package/report/test/renderer/category-renderer-test.js +76 -3
- package/report/test/renderer/i18n-test.js +0 -7
- package/report/test/renderer/performance-category-renderer-test.js +51 -14
- package/report/test/renderer/pwa-category-renderer-test.js +6 -6
- package/report/test/renderer/report-renderer-axe-test.js +11 -13
- package/report/test/renderer/report-renderer-test.js +52 -22
- package/report/test/renderer/report-ui-features-test.js +20 -10
- package/report/test/renderer/text-encoding-test.js +1 -1
- package/report/test/renderer/util-test.js +35 -31
- package/report/test-assets/faux-psi-template.html +3 -11
- package/report/test-assets/faux-psi.js +26 -22
- package/report/types/html-renderer.d.ts +2 -0
- package/report/types/report-renderer.d.ts +28 -0
- package/shared/localization/format.js +64 -30
- package/shared/localization/locales/ar-XB.json +72 -75
- package/shared/localization/locales/ar.json +72 -75
- package/shared/localization/locales/bg.json +72 -75
- package/shared/localization/locales/ca.json +72 -75
- package/shared/localization/locales/cs.json +89 -92
- package/shared/localization/locales/da.json +72 -75
- package/shared/localization/locales/de.json +89 -92
- package/shared/localization/locales/el.json +72 -75
- package/shared/localization/locales/en-GB.json +72 -75
- package/shared/localization/locales/en-US.json +78 -75
- package/shared/localization/locales/en-XA.json +72 -75
- package/shared/localization/locales/en-XL.json +78 -75
- package/shared/localization/locales/es-419.json +90 -93
- package/shared/localization/locales/es.json +90 -93
- package/shared/localization/locales/fi.json +72 -75
- package/shared/localization/locales/fil.json +72 -75
- package/shared/localization/locales/fr.json +89 -92
- package/shared/localization/locales/he.json +73 -76
- package/shared/localization/locales/hi.json +72 -75
- package/shared/localization/locales/hr.json +72 -75
- package/shared/localization/locales/hu.json +89 -92
- package/shared/localization/locales/id.json +89 -92
- package/shared/localization/locales/it.json +89 -92
- package/shared/localization/locales/ja.json +89 -92
- package/shared/localization/locales/ko.json +89 -92
- package/shared/localization/locales/lt.json +89 -92
- package/shared/localization/locales/lv.json +95 -98
- package/shared/localization/locales/nl.json +89 -92
- package/shared/localization/locales/no.json +72 -75
- package/shared/localization/locales/pl.json +72 -75
- package/shared/localization/locales/pt-PT.json +72 -75
- package/shared/localization/locales/pt.json +89 -92
- package/shared/localization/locales/ro.json +90 -93
- package/shared/localization/locales/ru.json +89 -92
- package/shared/localization/locales/sk.json +89 -92
- package/shared/localization/locales/sl.json +89 -92
- package/shared/localization/locales/sr-Latn.json +89 -92
- package/shared/localization/locales/sr.json +89 -92
- package/shared/localization/locales/sv.json +72 -75
- package/shared/localization/locales/ta.json +89 -92
- package/shared/localization/locales/te.json +89 -92
- package/shared/localization/locales/th.json +89 -92
- package/shared/localization/locales/tr.json +89 -92
- package/shared/localization/locales/uk.json +92 -95
- package/shared/localization/locales/vi.json +89 -92
- package/shared/localization/locales/zh-HK.json +89 -92
- package/shared/localization/locales/zh-TW.json +89 -92
- package/shared/localization/locales/zh.json +89 -92
- package/shared/localization/locales.js +6 -0
- package/shared/test/localization/format-test.js +45 -9
- package/shared/test/localization/swap-locale-test.js +0 -12
- package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +19 -11
- package/third-party/chromium-synchronization/installability-errors-test.js +3 -2
- package/third-party/download-content-shell/download-content-shell.js +2 -2
- package/third-party/download-content-shell/utils.js +0 -24
- package/third-party/snyk/snapshot.json +4 -1
- package/tsconfig-all.json +2 -2
- package/tsconfig.json +0 -1
- package/types/artifacts.d.ts +7 -7
- package/types/enquirer.d.ts +3 -1
- package/types/lhr/audit-details.d.ts +6 -5
- package/types/lhr/flow.d.ts +3 -2
- package/types/lhr/lhr.d.ts +1 -1
- package/types/node.d.ts +5 -5
- package/types/rollup-plugin-postprocess.d.ts +10 -0
- package/flow-report/src/wrappers/report-renderer.tsx +0 -46
- package/lighthouse-core/audits/dobetterweb/appcache-manifest.js +0 -67
- package/lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js +0 -96
- package/lighthouse-core/audits/redirects-http.js +0 -59
- package/lighthouse-core/gather/gatherers/dobetterweb/appcache.js +0 -34
- package/lighthouse-core/gather/gatherers/http-redirect.js +0 -46
- package/lighthouse-core/lib/i18n/locales/en-US.ctc.json +0 -6699
- package/lighthouse-core/lib/i18n/locales/en-XL.ctc.json +0 -6672
- package/report/clients/psi.js +0 -158
- package/report/test/clients/psi-test.js +0 -143
- package/shared/localization/locales/en-US.ctc.json +0 -6877
- package/shared/localization/locales/en-XL.ctc.json +0 -6852
|
@@ -42,6 +42,10 @@ const listOfTlds = [
|
|
|
42
42
|
];
|
|
43
43
|
|
|
44
44
|
class Util {
|
|
45
|
+
/** @type {I18n<typeof UIStrings>} */
|
|
46
|
+
// @ts-expect-error: Is set in report renderer.
|
|
47
|
+
static i18n = null;
|
|
48
|
+
|
|
45
49
|
static get PASS_THRESHOLD() {
|
|
46
50
|
return PASS_THRESHOLD;
|
|
47
51
|
}
|
|
@@ -107,6 +111,23 @@ class Util {
|
|
|
107
111
|
/** @type {Map<string, Array<LH.ReportResult.AuditRef>>} */
|
|
108
112
|
const relevantAuditToMetricsMap = new Map();
|
|
109
113
|
|
|
114
|
+
// This backcompat converts old LHRs (<9.0.0) to use the new "hidden" group.
|
|
115
|
+
// Old LHRs used "no group" to identify audits that should be hidden in performance instead of the "hidden" group.
|
|
116
|
+
// Newer LHRs use "no group" to identify opportunities and diagnostics whose groups are assigned by details type.
|
|
117
|
+
const [majorVersion] = clone.lighthouseVersion.split('.').map(Number);
|
|
118
|
+
const perfCategory = clone.categories['performance'];
|
|
119
|
+
if (majorVersion < 9 && perfCategory) {
|
|
120
|
+
if (!clone.categoryGroups) clone.categoryGroups = {};
|
|
121
|
+
clone.categoryGroups['hidden'] = {title: ''};
|
|
122
|
+
for (const auditRef of perfCategory.auditRefs) {
|
|
123
|
+
if (!auditRef.group) {
|
|
124
|
+
auditRef.group = 'hidden';
|
|
125
|
+
} else if (['load-opportunities', 'diagnostics'].includes(auditRef.group)) {
|
|
126
|
+
delete auditRef.group;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
110
131
|
for (const category of Object.values(clone.categories)) {
|
|
111
132
|
// Make basic lookup table for relevantAudits
|
|
112
133
|
category.auditRefs.forEach(metricRef => {
|
|
@@ -170,6 +191,8 @@ class Util {
|
|
|
170
191
|
|
|
171
192
|
/**
|
|
172
193
|
* Convert a score to a rating label.
|
|
194
|
+
* TODO: Return `'error'` for `score === null && !scoreDisplayMode`.
|
|
195
|
+
*
|
|
173
196
|
* @param {number|null} score
|
|
174
197
|
* @param {string=} scoreDisplayMode
|
|
175
198
|
* @return {string}
|
|
@@ -390,43 +413,21 @@ class Util {
|
|
|
390
413
|
return hostname.split('.').slice(-splitTld.length).join('.');
|
|
391
414
|
}
|
|
392
415
|
|
|
393
|
-
/**
|
|
394
|
-
* @param {LH.Result['configSettings']} settings
|
|
395
|
-
* @return {!Array<{name: string, description: string}>}
|
|
396
|
-
*/
|
|
397
|
-
static getEnvironmentDisplayValues(settings) {
|
|
398
|
-
const emulationDesc = Util.getEmulationDescriptions(settings);
|
|
399
|
-
|
|
400
|
-
return [
|
|
401
|
-
{
|
|
402
|
-
name: Util.i18n.strings.runtimeSettingsDevice,
|
|
403
|
-
description: emulationDesc.deviceEmulation,
|
|
404
|
-
},
|
|
405
|
-
{
|
|
406
|
-
name: Util.i18n.strings.runtimeSettingsNetworkThrottling,
|
|
407
|
-
description: emulationDesc.networkThrottling,
|
|
408
|
-
},
|
|
409
|
-
{
|
|
410
|
-
name: Util.i18n.strings.runtimeSettingsCPUThrottling,
|
|
411
|
-
description: emulationDesc.cpuThrottling,
|
|
412
|
-
},
|
|
413
|
-
];
|
|
414
|
-
}
|
|
415
416
|
|
|
416
417
|
/**
|
|
417
418
|
* @param {LH.Result['configSettings']} settings
|
|
418
|
-
* @return {{deviceEmulation: string, networkThrottling: string, cpuThrottling: string}}
|
|
419
|
+
* @return {!{deviceEmulation: string, networkThrottling: string, cpuThrottling: string, summary: string}}
|
|
419
420
|
*/
|
|
420
421
|
static getEmulationDescriptions(settings) {
|
|
421
422
|
let cpuThrottling;
|
|
422
423
|
let networkThrottling;
|
|
424
|
+
let summary;
|
|
423
425
|
|
|
424
426
|
const throttling = settings.throttling;
|
|
425
427
|
|
|
426
428
|
switch (settings.throttlingMethod) {
|
|
427
429
|
case 'provided':
|
|
428
|
-
cpuThrottling = Util.i18n.strings.throttlingProvided;
|
|
429
|
-
networkThrottling = Util.i18n.strings.throttlingProvided;
|
|
430
|
+
summary = networkThrottling = cpuThrottling = Util.i18n.strings.throttlingProvided;
|
|
430
431
|
break;
|
|
431
432
|
case 'devtools': {
|
|
432
433
|
const {cpuSlowdownMultiplier, requestLatencyMs} = throttling;
|
|
@@ -434,6 +435,13 @@ class Util {
|
|
|
434
435
|
networkThrottling = `${Util.i18n.formatNumber(requestLatencyMs)}${NBSP}ms HTTP RTT, ` +
|
|
435
436
|
`${Util.i18n.formatNumber(throttling.downloadThroughputKbps)}${NBSP}Kbps down, ` +
|
|
436
437
|
`${Util.i18n.formatNumber(throttling.uploadThroughputKbps)}${NBSP}Kbps up (DevTools)`;
|
|
438
|
+
|
|
439
|
+
const isSlow4G = () => {
|
|
440
|
+
return requestLatencyMs === 150 * 3.75 &&
|
|
441
|
+
throttling.downloadThroughputKbps === 1.6 * 1024 * 0.9 &&
|
|
442
|
+
throttling.uploadThroughputKbps === 750 * 0.9;
|
|
443
|
+
};
|
|
444
|
+
summary = isSlow4G() ? Util.i18n.strings.runtimeSlow4g : Util.i18n.strings.runtimeCustom;
|
|
437
445
|
break;
|
|
438
446
|
}
|
|
439
447
|
case 'simulate': {
|
|
@@ -441,11 +449,15 @@ class Util {
|
|
|
441
449
|
cpuThrottling = `${Util.i18n.formatNumber(cpuSlowdownMultiplier)}x slowdown (Simulated)`;
|
|
442
450
|
networkThrottling = `${Util.i18n.formatNumber(rttMs)}${NBSP}ms TCP RTT, ` +
|
|
443
451
|
`${Util.i18n.formatNumber(throughputKbps)}${NBSP}Kbps throughput (Simulated)`;
|
|
452
|
+
|
|
453
|
+
const isSlow4G = () => {
|
|
454
|
+
return rttMs === 150 && throughputKbps === 1.6 * 1024;
|
|
455
|
+
};
|
|
456
|
+
summary = isSlow4G() ? Util.i18n.strings.runtimeSlow4g : Util.i18n.strings.runtimeCustom;
|
|
444
457
|
break;
|
|
445
458
|
}
|
|
446
459
|
default:
|
|
447
|
-
cpuThrottling = Util.i18n.strings.runtimeUnknown;
|
|
448
|
-
networkThrottling = Util.i18n.strings.runtimeUnknown;
|
|
460
|
+
summary = cpuThrottling = networkThrottling = Util.i18n.strings.runtimeUnknown;
|
|
449
461
|
}
|
|
450
462
|
|
|
451
463
|
// TODO(paulirish): revise Runtime Settings strings: https://github.com/GoogleChrome/lighthouse/pull/11796
|
|
@@ -458,6 +470,7 @@ class Util {
|
|
|
458
470
|
deviceEmulation,
|
|
459
471
|
cpuThrottling,
|
|
460
472
|
networkThrottling,
|
|
473
|
+
summary,
|
|
461
474
|
};
|
|
462
475
|
}
|
|
463
476
|
|
|
@@ -527,10 +540,9 @@ class Util {
|
|
|
527
540
|
let totalWeight = 0;
|
|
528
541
|
for (const auditRef of category.auditRefs) {
|
|
529
542
|
const auditPassed = Util.showAsPassed(auditRef.result);
|
|
530
|
-
const notDisplayed = !auditRef.group && category.id === 'performance';
|
|
531
543
|
|
|
532
544
|
// Don't count the audit if it's manual, N/A, or isn't displayed.
|
|
533
|
-
if (
|
|
545
|
+
if (auditRef.group === 'hidden' ||
|
|
534
546
|
auditRef.result.scoreDisplayMode === 'manual' ||
|
|
535
547
|
auditRef.result.scoreDisplayMode === 'notApplicable') {
|
|
536
548
|
continue;
|
|
@@ -566,14 +578,10 @@ Util.getUniqueSuffix = (() => {
|
|
|
566
578
|
};
|
|
567
579
|
})();
|
|
568
580
|
|
|
569
|
-
/** @type {I18n<typeof Util['UIStrings']>} */
|
|
570
|
-
// @ts-expect-error: Is set in report renderer.
|
|
571
|
-
Util.i18n = null;
|
|
572
|
-
|
|
573
581
|
/**
|
|
574
582
|
* Report-renderer-specific strings.
|
|
575
583
|
*/
|
|
576
|
-
|
|
584
|
+
const UIStrings = {
|
|
577
585
|
/** Disclaimer shown to users below the metric values (First Contentful Paint, Time to Interactive, etc) to warn them that the numbers they see will likely change slightly the next time they run Lighthouse. */
|
|
578
586
|
varianceDisclaimer: 'Values are estimated and may vary. The [performance score is calculated](https://web.dev/performance-scoring/) directly from these metrics.',
|
|
579
587
|
/** Text link pointing to an interactive calculator that explains Lighthouse scoring. The link text should be fairly short. */
|
|
@@ -640,22 +648,12 @@ Util.UIStrings = {
|
|
|
640
648
|
/** Option in a dropdown menu that toggles the themeing of the report between Light(default) and Dark themes. */
|
|
641
649
|
dropdownDarkTheme: 'Toggle Dark Theme',
|
|
642
650
|
|
|
643
|
-
/** Title of the Runtime settings table in a Lighthouse report. Runtime settings are the environment configurations that a specific report used at auditing time. */
|
|
644
|
-
runtimeSettingsTitle: 'Runtime Settings',
|
|
645
|
-
/** Label for a row in a table that shows the URL that was audited during a Lighthouse run. */
|
|
646
|
-
runtimeSettingsUrl: 'URL',
|
|
647
|
-
/** Label for a row in a table that shows the time at which a Lighthouse run was conducted; formatted as a timestamp, e.g. Jan 1, 1970 12:00 AM UTC. */
|
|
648
|
-
runtimeSettingsFetchTime: 'Fetch Time',
|
|
649
651
|
/** Label for a row in a table that describes the kind of device that was emulated for the Lighthouse run. Example values for row elements: 'No Emulation', 'Emulated Desktop', etc. */
|
|
650
652
|
runtimeSettingsDevice: 'Device',
|
|
651
653
|
/** Label for a row in a table that describes the network throttling conditions that were used during a Lighthouse run, if any. */
|
|
652
654
|
runtimeSettingsNetworkThrottling: 'Network throttling',
|
|
653
655
|
/** Label for a row in a table that describes the CPU throttling conditions that were used during a Lighthouse run, if any.*/
|
|
654
656
|
runtimeSettingsCPUThrottling: 'CPU throttling',
|
|
655
|
-
/** Label for a row in a table that shows in what tool Lighthouse is being run (e.g. The lighthouse CLI, Chrome DevTools, Lightrider, WebPageTest, etc). */
|
|
656
|
-
runtimeSettingsChannel: 'Channel',
|
|
657
|
-
/** Label for a row in a table that shows the User Agent that was detected on the Host machine that ran Lighthouse. */
|
|
658
|
-
runtimeSettingsUA: 'User agent (host)',
|
|
659
657
|
/** Label for a row in a table that shows the User Agent that was used to send out all network requests during the Lighthouse run. */
|
|
660
658
|
runtimeSettingsUANetwork: 'User agent (network)',
|
|
661
659
|
/** Label for a row in a table that shows the estimated CPU power of the machine running Lighthouse. Example row values: 532, 1492, 783. */
|
|
@@ -674,10 +672,31 @@ Util.UIStrings = {
|
|
|
674
672
|
runtimeDesktopEmulation: 'Emulated Desktop',
|
|
675
673
|
/** Descriptive explanation for a runtime setting that is set to an unknown value. */
|
|
676
674
|
runtimeUnknown: 'Unknown',
|
|
675
|
+
/** Descriptive label that this analysis run was from a single pageload of a browser (not a summary of hundreds of loads) */
|
|
676
|
+
runtimeSingleLoad: 'Single page load',
|
|
677
|
+
/** Descriptive label that this analysis only considers the initial load of the page, and no interaction beyond when the page had "fully loaded" */
|
|
678
|
+
runtimeAnalysisWindow: 'Initial page load',
|
|
679
|
+
/** Descriptive explanation that this analysis run was from a single pageload of a browser, whereas field data often summarizes hundreds+ of page loads */
|
|
680
|
+
runtimeSingleLoadTooltip: 'This data is taken from a single page load, as opposed to field data summarizing many sessions.', // eslint-disable-line max-len
|
|
677
681
|
|
|
678
682
|
/** Descriptive explanation for environment throttling that was provided by the runtime environment instead of provided by Lighthouse throttling. */
|
|
679
683
|
throttlingProvided: 'Provided by environment',
|
|
684
|
+
/** Label for an interactive control that will reveal or hide a group of content. This control toggles between the text 'Show' and 'Hide'. */
|
|
685
|
+
show: 'Show',
|
|
686
|
+
/** Label for an interactive control that will reveal or hide a group of content. This control toggles between the text 'Show' and 'Hide'. */
|
|
687
|
+
hide: 'Hide',
|
|
688
|
+
/** Label for an interactive control that will reveal or hide a group of content. This control toggles between the text 'Expand view' and 'Collapse view'. */
|
|
689
|
+
expandView: 'Expand view',
|
|
690
|
+
/** Label for an interactive control that will reveal or hide a group of content. This control toggles between the text 'Expand view' and 'Collapse view'. */
|
|
691
|
+
collapseView: 'Collapse view',
|
|
692
|
+
/** Label indicating that Lighthouse throttled the page to emulate a slow 4G network connection. */
|
|
693
|
+
runtimeSlow4g: 'Slow 4G throttling',
|
|
694
|
+
/** Label indicating that Lighthouse throttled the page using custom throttling settings. */
|
|
695
|
+
runtimeCustom: 'Custom throttling',
|
|
680
696
|
};
|
|
697
|
+
Util.UIStrings = UIStrings;
|
|
681
698
|
|
|
682
|
-
|
|
683
|
-
|
|
699
|
+
module.exports = {
|
|
700
|
+
Util,
|
|
701
|
+
UIStrings,
|
|
702
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0-dev.20211118",
|
|
4
4
|
"description": "Automated auditing, performance metrics, and best practices for the web.",
|
|
5
5
|
"main": "./lighthouse-core/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
"smokehouse": "./lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js"
|
|
10
10
|
},
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": ">=
|
|
12
|
+
"node": ">=14.15"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
+
"prepack": "yarn build-report --standalone --flow --esm",
|
|
15
16
|
"build-all": "npm-run-posix-or-windows build-all:task",
|
|
16
17
|
"build-all:task": "yarn build-report && yarn build-cdt-lib && yarn build-devtools && (yarn build-extension & yarn build-lr & yarn build-viewer & yarn build-treemap & yarn build-smokehouse-bundle & wait) && yarn build-pack",
|
|
17
18
|
"build-all:task:windows": "yarn build-report && yarn build-cdt-lib && yarn build-extension && yarn build-devtools && yarn build-lr && yarn build-viewer && yarn build-treemap && yarn build-smokehouse-bundle",
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
"build-smokehouse-bundle": "node ./build/build-smokehouse-bundle.js",
|
|
24
25
|
"build-lr": "yarn reset-link && node ./build/build-lightrider-bundles.js",
|
|
25
26
|
"build-pack": "bash build/build-pack.sh",
|
|
26
|
-
"build-report": "node build/build-report-components.js && yarn eslint --fix report/renderer/components.js && node build/build-report.js",
|
|
27
|
+
"build-report": "node build/build-report-components.js && yarn eslint --fix report/renderer/components.js && bash lighthouse-core/scripts/copy-util-commonjs.sh && node build/build-report.js",
|
|
27
28
|
"build-sample-reports": "yarn build-report && node build/build-sample-reports.js",
|
|
28
29
|
"build-treemap": "node ./build/build-treemap.js",
|
|
29
30
|
"build-viewer": "node ./build/build-viewer.js",
|
|
@@ -38,8 +39,8 @@
|
|
|
38
39
|
"test": "yarn diff:sample-json && yarn lint --quiet && yarn unit && yarn type-check",
|
|
39
40
|
"test-bundle": "yarn smoke --runner bundle -j=1 --retries=2 --invert-match forms",
|
|
40
41
|
"test-clients": "yarn jest \"$PWD/clients/\" && yarn jest --testMatch=\"**/clients/test/**/*-test-pptr.js\"",
|
|
41
|
-
"test-viewer": "yarn unit-viewer && yarn jest --testMatch=\"**/
|
|
42
|
-
"test-treemap": "yarn unit-treemap && yarn jest --testMatch=\"**/
|
|
42
|
+
"test-viewer": "yarn unit-viewer && yarn jest --testMatch=\"**/viewer/**/*-test-pptr.js\"",
|
|
43
|
+
"test-treemap": "yarn unit-treemap && yarn jest --testMatch=\"**/treemap/**/*-test-pptr.js\"",
|
|
43
44
|
"test-lantern": "bash lighthouse-core/scripts/test-lantern.sh",
|
|
44
45
|
"test-legacy-javascript": "bash lighthouse-core/scripts/test-legacy-javascript.sh",
|
|
45
46
|
"test-docs": "yarn --cwd docs/recipes/ test",
|
|
@@ -47,11 +48,11 @@
|
|
|
47
48
|
"unit-core": "yarn jest \"lighthouse-core\"",
|
|
48
49
|
"unit-cli": "yarn jest \"lighthouse-cli/\"",
|
|
49
50
|
"unit-report": "yarn jest \"report/\"",
|
|
50
|
-
"unit-treemap": "yarn jest \"
|
|
51
|
-
"unit-viewer": "yarn jest \"
|
|
51
|
+
"unit-treemap": "yarn jest \"treemap/.*-test.js\"",
|
|
52
|
+
"unit-viewer": "yarn jest \"viewer/.*-test.js\"",
|
|
52
53
|
"unit-flow": "yarn jest \"flow-report/.*-test.[tj]s[x]?\"",
|
|
53
54
|
"unit": "yarn jest",
|
|
54
|
-
"unit:ci": "NODE_OPTIONS=--max-old-space-size=8192 npm run jest --
|
|
55
|
+
"unit:ci": "NODE_OPTIONS=--max-old-space-size=8192 npm run jest --ci .",
|
|
55
56
|
"core-unit": "yarn unit-core",
|
|
56
57
|
"cli-unit": "yarn unit-cli",
|
|
57
58
|
"viewer-unit": "yarn unit-viewer",
|
|
@@ -94,9 +95,16 @@
|
|
|
94
95
|
},
|
|
95
96
|
"devDependencies": {
|
|
96
97
|
"@build-tracker/cli": "^1.0.0-beta.15",
|
|
98
|
+
"@firebase/app-types": "0.3.1",
|
|
99
|
+
"@firebase/auth-types": "0.3.2",
|
|
100
|
+
"@firebase/util": "0.2.1",
|
|
101
|
+
"@rollup/plugin-alias": "^3.1.2",
|
|
97
102
|
"@rollup/plugin-commonjs": "^20.0.0",
|
|
103
|
+
"@rollup/plugin-dynamic-import-vars": "^1.1.1",
|
|
104
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
98
105
|
"@rollup/plugin-node-resolve": "^13.0.4",
|
|
99
106
|
"@rollup/plugin-typescript": "^8.2.5",
|
|
107
|
+
"@stadtlandnetz/rollup-plugin-postprocess": "^1.1.0",
|
|
100
108
|
"@testing-library/preact": "^2.0.1",
|
|
101
109
|
"@testing-library/preact-hooks": "^1.1.0",
|
|
102
110
|
"@types/archiver": "^2.1.2",
|
|
@@ -105,7 +113,7 @@
|
|
|
105
113
|
"@types/configstore": "^4.0.0",
|
|
106
114
|
"@types/cpy": "^5.1.0",
|
|
107
115
|
"@types/eslint": "^4.16.6",
|
|
108
|
-
"@types/
|
|
116
|
+
"@types/estree": "^0.0.50",
|
|
109
117
|
"@types/gh-pages": "^2.0.0",
|
|
110
118
|
"@types/google.analytics": "0.0.39",
|
|
111
119
|
"@types/jest": "^24.0.9",
|
|
@@ -127,11 +135,10 @@
|
|
|
127
135
|
"@types/yargs-parser": "^15.0.0",
|
|
128
136
|
"@typescript-eslint/eslint-plugin": "^4.30.0",
|
|
129
137
|
"@typescript-eslint/parser": "^4.30.0",
|
|
130
|
-
"
|
|
138
|
+
"acorn": "^8.5.0",
|
|
131
139
|
"angular": "^1.7.4",
|
|
132
140
|
"archiver": "^3.0.0",
|
|
133
141
|
"browserify": "^17.0.0",
|
|
134
|
-
"browserify-banner": "^1.0.15",
|
|
135
142
|
"c8": "^7.4.0",
|
|
136
143
|
"chalk": "^2.4.1",
|
|
137
144
|
"chrome-devtools-frontend": "1.0.922924",
|
|
@@ -139,14 +146,13 @@
|
|
|
139
146
|
"cpy": "^7.0.1",
|
|
140
147
|
"cross-env": "^7.0.2",
|
|
141
148
|
"csv-validator": "^0.0.3",
|
|
142
|
-
"devtools-protocol": "0.0.
|
|
149
|
+
"devtools-protocol": "0.0.939404",
|
|
143
150
|
"es-main": "^1.0.2",
|
|
144
151
|
"eslint": "^7.23.0",
|
|
145
152
|
"eslint-config-google": "^0.9.1",
|
|
146
153
|
"eslint-plugin-import": "^2.24.2",
|
|
147
154
|
"eslint-plugin-local-rules": "0.1.0",
|
|
148
155
|
"event-target-shim": "^6.0.2",
|
|
149
|
-
"exorcist": "^1.0.1",
|
|
150
156
|
"firebase": "^9.0.2",
|
|
151
157
|
"gh-pages": "^2.0.1",
|
|
152
158
|
"glob": "^7.1.3",
|
|
@@ -156,16 +162,17 @@
|
|
|
156
162
|
"jsdom": "^12.2.0",
|
|
157
163
|
"jsonld": "^5.2.0",
|
|
158
164
|
"jsonlint-mod": "^1.7.6",
|
|
159
|
-
"lighthouse-plugin-publisher-ads": "^1.4
|
|
165
|
+
"lighthouse-plugin-publisher-ads": "^1.5.4",
|
|
166
|
+
"magic-string": "^0.25.7",
|
|
160
167
|
"mime-types": "^2.1.30",
|
|
161
168
|
"node-fetch": "^2.6.1",
|
|
162
169
|
"npm-run-posix-or-windows": "^2.0.2",
|
|
163
|
-
"package-json-versionify": "^1.0.4",
|
|
164
170
|
"pako": "^2.0.3",
|
|
165
171
|
"preact": "^10.5.14",
|
|
166
172
|
"pretty-json-stringify": "^0.0.2",
|
|
167
173
|
"puppeteer": "^10.2.0",
|
|
168
|
-
"
|
|
174
|
+
"resolve": "^1.20.0",
|
|
175
|
+
"rollup": "^2.52.7",
|
|
169
176
|
"rollup-plugin-node-resolve": "^5.2.0",
|
|
170
177
|
"rollup-plugin-polyfill-node": "^0.7.0",
|
|
171
178
|
"rollup-plugin-replace": "^2.2.0",
|
|
@@ -181,7 +188,7 @@
|
|
|
181
188
|
},
|
|
182
189
|
"dependencies": {
|
|
183
190
|
"axe-core": "4.2.3",
|
|
184
|
-
"chrome-launcher": "^0.
|
|
191
|
+
"chrome-launcher": "^0.15.0",
|
|
185
192
|
"configstore": "^5.0.1",
|
|
186
193
|
"csp_evaluator": "1.1.0",
|
|
187
194
|
"cssstyle": "1.2.1",
|
|
@@ -211,6 +218,9 @@
|
|
|
211
218
|
"yargs": "^16.1.1",
|
|
212
219
|
"yargs-parser": "^20.2.4"
|
|
213
220
|
},
|
|
221
|
+
"resolutions": {
|
|
222
|
+
"puppeteer/**/devtools-protocol": "0.0.939404"
|
|
223
|
+
},
|
|
214
224
|
"repository": "GoogleChrome/lighthouse",
|
|
215
225
|
"keywords": [
|
|
216
226
|
"google",
|
package/readme.md
CHANGED
|
@@ -52,7 +52,7 @@ The Chrome extension was available prior to Lighthouse being available in Chrome
|
|
|
52
52
|
|
|
53
53
|
The Node CLI provides the most flexibility in how Lighthouse runs can be configured and reported. Users who want more advanced usage, or want to run Lighthouse in an automated fashion should use the Node CLI.
|
|
54
54
|
|
|
55
|
-
_Lighthouse requires Node
|
|
55
|
+
_Lighthouse requires Node 14 LTS (14.x) or later._
|
|
56
56
|
|
|
57
57
|
**Installation**:
|
|
58
58
|
|
|
@@ -451,9 +451,9 @@ machine. Report results are never processed or beaconed to a remote server.
|
|
|
451
451
|
|
|
452
452
|
### How do I get localized Lighthouse results via the CLI?
|
|
453
453
|
|
|
454
|
-
Starting in Lighthouse 8.0, Lighthouse relies entirely on native `Intl` support and no longer uses an `Intl` polyfill. If you're using Node
|
|
454
|
+
Starting in Lighthouse 8.0, Lighthouse relies entirely on native `Intl` support and no longer uses an `Intl` polyfill. If you're using Node 14 or later, there should be no issue because Node is now [built with `full-icu` by default](https://nodejs.medium.com/node-js-12-to-lts-and-node-js-13-is-here-e28d6a4a2bd#9514).
|
|
455
455
|
|
|
456
|
-
However, if you're using
|
|
456
|
+
However, if you're using a `small-icu` Node build, you may see Lighthouse log messages about your locale not being available. To remedy this, you can upgrade to Node 14+ or manually install ICU data by using the [`full-icu`](https://www.npmjs.com/package/full-icu) module and the [`--icu-data-dir` node flag](https://nodejs.org/api/intl.html#intl_providing_icu_data_at_runtime) at launch.
|
|
457
457
|
|
|
458
458
|
### How do I author custom audits to extend Lighthouse?
|
|
459
459
|
|
package/report/.eslintrc.cjs
CHANGED
package/report/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Example standalone HTML report, delivered by the CLI: [`dbwtest-3.0.3.html`](htt
|
|
|
9
9
|
### Report Renderer components
|
|
10
10
|
|
|
11
11
|
1. [`report/generator/report-generator.js`](https://github.com/GoogleChrome/lighthouse/blob/master/report/generator/report-generator.js) is the entry point for generating the HTML from Node. It compiles together the HTML string with everything required within it.
|
|
12
|
-
- It runs natively in Node.js but can run in the browser after a compile step is applied during our bundling pipeline. That compile step uses `
|
|
12
|
+
- It runs natively in Node.js but can run in the browser after a compile step is applied during our bundling pipeline. That compile step uses `inline-fs`, which takes any `fs.readFileSync()` calls and replaces them with the stringified file content.
|
|
13
13
|
1. [`report/renderer`](https://github.com/GoogleChrome/lighthouse/tree/master/report/renderer) are all client-side JS files. They transform an LHR object into a report DOM tree. They are all executed within the browser.
|
|
14
14
|
1. [`report/assets/standalone-template.html`](https://github.com/GoogleChrome/lighthouse/blob/master/lighthouse-core/report/html/report-template.html) is where the client-side build of the DOM report is typically kicked off ([with these four lines](https://github.com/GoogleChrome/lighthouse/blob/eda3a3e2e271249f261655f9504fd542d6acf0f8/lighthouse-core/report/html/report-template.html#L29-L33)) However, see _Current Uses.._ below for more possibilities.
|
|
15
15
|
|
|
@@ -21,12 +21,11 @@ limitations under the License.
|
|
|
21
21
|
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
|
22
22
|
<link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAEhklEQVR4AWJxL/BhIAesev1U5tcflpncgNrKIsqNIwzC9feMpDUzs70kOczMzMzJJcxwCTMzncPMnOwtzBwzMzPb0vRfeZPp0VhPS5I39V5fdiXV1/VD+9QC7OVn9BsyH1XIoEI1PfmJvLFowVV564+34DFUHudbmfDh4kVXh//7XwE+WjS/YfXZe3yr4j2rqj1AIhSB7hZ8ZtPZu/zw8cK523U4wE1/rvPfWrz4zs0m9ZdC9yUJAlASdBAgocRegfF/f3/h/PuaFsxMdwjAR0vm1+06eMMfIrhLqTWqdH4EumU2SPfMhigJAlRQbZrgrRsl9U+Y2DYDFCz3ILC9kiAiqSrMwbWT0nceEnR+9Kggc2zjOJCASDENkg0a5HfZZgDP81CM3CrQs2Z1+o7DJ6ePr8sK0AOCHv5Jjdt3evyYSaZ351VIStIxPRAUtrBYbxC6w+BZ0ivVSBKkIhJhemSyZpfB00EiPO2VjzYkxhcqXQqCWCShGplvi3y0QxqbuBurMjyJeWnkHZuAEgIQGsUBqwrfjZ+IlBgKyRJzVVYF8O6qFWdh86YzQzMrZigYmxAyfvHgLZQ/LC1CbeniW2Hkqr/PH16SgvGuf2/uzNMBwJA/njxizGPtSyAf7EziJCMGRDRdhoAC4PL1A/SrKQMAAQkEfpJAcRQdrBJ7gNwjSpJsdwK+CANBkqa1LgQB4IicV9nYUct7gaxuDJUErQIiEAiMxLVOFlKzIktPpT0ggpdpC/8YAHnxbgkUY4tAAFSR7AAXNyAAWHJrA/kHGjzg5nleuwFO7Nd/IoDw4Pm58+4jNLmYG0wRA5bErc2Mr3Y+dXTDW1VvwqbJkzMCHQ4S1GTCBOIgUHJrGdEwqzR+jAp/o2qAZelUDoQnruEEdDclJI6576AlNVfc+22XN/+Y1vnJD0Yind6UpEEvn/Hqq15EYjCW7jZCJEpnNvDgkyelDjs106kuux2AAXCSobULOWP8mLhYlpoDMK4qAFXJGk+grtH8YXVz5KJblqaG1+VUdTc0I290bmUQAriGITRbdQnom0aoFj8kx1+wMD2ifncAXUQE4SkDqN1hE0jEophs1SUwZAOhUAiMCLwRtamtTZtbbmZErSAUHbSysaoEmnrsakiMiUAURi283gN6wans9oX8rOCrj7/JP35DFD+iQ7Au/K2KE1jzx6ujjUnXFH9KjEq6ZlhsTBICrNLJf47Pv/pkHzvup1w4dmUbEei0+bcXRqJuh5kVARQ8byyYxOwNGr7A87xh1tp8sGT+uMInrwi++Xj7TQz2d27NvwEkrOflAFQGIDA5khASBCGdO2/Z/MnLPwYfv5TFhjW7QhVKAB6afwe2LpFlFsCnlQEosgQgDsdOG1/LKeNqJS4JCSPJ/i+TakwEARor7gER1Iva5JmPOJK0RUqmoPnnlzFCtmIAhAAQEIQRgDaiYPIauNXcnDlRIrWNFY3hm7PG9YRqr7IV7HrCgAC17befjEvRq2nGhAHtBqDpOuI/I1diUUAMYIxEdyejBJqLnNoszGZtfiX/CztGv2mq+sdaAAAAAElFTkSuQmCC">
|
|
23
23
|
<title>Lighthouse Report</title>
|
|
24
|
+
<style>body {margin: 0}</style>
|
|
24
25
|
</head>
|
|
25
|
-
<body
|
|
26
|
+
<body>
|
|
26
27
|
<noscript>Lighthouse report requires JavaScript. Please enable.</noscript>
|
|
27
28
|
|
|
28
|
-
<main><!-- report populated here --></main>
|
|
29
|
-
|
|
30
29
|
<div id="lh-log"></div>
|
|
31
30
|
|
|
32
31
|
<script>window.__LIGHTHOUSE_JSON__ = %%LIGHTHOUSE_JSON%%;</script>
|