lighthouse 12.8.2 → 13.0.0-dev.20251009
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/cli/cli-flags.js +1 -1
- package/cli/test/smokehouse/config/exclusions.js +0 -2
- package/cli/test/smokehouse/version-check.d.ts +1 -1
- package/core/audits/accessibility/accesskeys.js +3 -3
- package/core/audits/accessibility/aria-allowed-attr.js +3 -3
- package/core/audits/accessibility/aria-allowed-role.js +2 -1
- package/core/audits/accessibility/aria-command-name.js +1 -1
- package/core/audits/accessibility/aria-conditional-attr.js +1 -1
- package/core/audits/accessibility/aria-deprecated-role.js +1 -1
- package/core/audits/accessibility/aria-dialog-name.js +1 -1
- package/core/audits/accessibility/aria-hidden-body.js +3 -3
- package/core/audits/accessibility/aria-hidden-focus.js +3 -3
- package/core/audits/accessibility/aria-input-field-name.js +3 -3
- package/core/audits/accessibility/aria-meter-name.js +1 -1
- package/core/audits/accessibility/aria-progressbar-name.js +1 -1
- package/core/audits/accessibility/aria-prohibited-attr.js +1 -1
- package/core/audits/accessibility/aria-required-attr.js +3 -3
- package/core/audits/accessibility/aria-required-children.js +3 -3
- package/core/audits/accessibility/aria-required-parent.js +3 -3
- package/core/audits/accessibility/aria-roles.js +3 -3
- package/core/audits/accessibility/aria-text.js +3 -3
- package/core/audits/accessibility/aria-toggle-field-name.js +3 -3
- package/core/audits/accessibility/aria-tooltip-name.js +1 -1
- package/core/audits/accessibility/aria-treeitem-name.js +1 -1
- package/core/audits/accessibility/aria-valid-attr-value.js +3 -3
- package/core/audits/accessibility/aria-valid-attr.js +3 -3
- package/core/audits/accessibility/button-name.js +3 -3
- package/core/audits/accessibility/bypass.js +3 -3
- package/core/audits/accessibility/color-contrast.js +3 -3
- package/core/audits/accessibility/definition-list.js +3 -3
- package/core/audits/accessibility/dlitem.js +3 -3
- package/core/audits/accessibility/document-title.js +3 -3
- package/core/audits/accessibility/duplicate-id-aria.js +3 -3
- package/core/audits/accessibility/empty-heading.js +3 -3
- package/core/audits/accessibility/form-field-multiple-labels.js +3 -3
- package/core/audits/accessibility/frame-title.js +3 -3
- package/core/audits/accessibility/heading-order.js +3 -3
- package/core/audits/accessibility/html-has-lang.js +3 -3
- package/core/audits/accessibility/html-lang-valid.js +3 -3
- package/core/audits/accessibility/html-xml-lang-mismatch.js +3 -3
- package/core/audits/accessibility/identical-links-same-purpose.js +3 -3
- package/core/audits/accessibility/image-alt.js +3 -3
- package/core/audits/accessibility/image-redundant-alt.js +4 -3
- package/core/audits/accessibility/input-button-name.js +3 -3
- package/core/audits/accessibility/input-image-alt.js +3 -3
- package/core/audits/accessibility/label-content-name-mismatch.js +3 -3
- package/core/audits/accessibility/label.js +3 -3
- package/core/audits/accessibility/landmark-one-main.js +3 -4
- package/core/audits/accessibility/link-in-text-block.js +3 -3
- package/core/audits/accessibility/link-name.js +3 -3
- package/core/audits/accessibility/list.js +3 -3
- package/core/audits/accessibility/listitem.js +3 -3
- package/core/audits/accessibility/meta-refresh.js +3 -3
- package/core/audits/accessibility/meta-viewport.js +3 -3
- package/core/audits/accessibility/object-alt.js +3 -3
- package/core/audits/accessibility/select-name.js +3 -3
- package/core/audits/accessibility/skip-link.js +3 -3
- package/core/audits/accessibility/tabindex.js +3 -3
- package/core/audits/accessibility/table-duplicate-name.js +4 -3
- package/core/audits/accessibility/table-fake-caption.js +3 -3
- package/core/audits/accessibility/target-size.js +3 -3
- package/core/audits/accessibility/td-has-header.js +3 -3
- package/core/audits/accessibility/td-headers-attr.js +3 -3
- package/core/audits/accessibility/th-has-data-cells.js +3 -3
- package/core/audits/accessibility/valid-lang.js +3 -3
- package/core/audits/accessibility/video-caption.js +3 -3
- package/core/audits/audit.d.ts +0 -4
- package/core/audits/audit.js +2 -13
- package/core/audits/insights/cls-culprits-insight.js +1 -1
- package/core/audits/insights/dom-size-insight.js +11 -7
- package/core/audits/insights/font-display-insight.js +3 -1
- package/core/audits/insights/image-delivery-insight.js +4 -1
- package/core/audits/insights/insight-audit.d.ts +6 -4
- package/core/audits/insights/insight-audit.js +27 -8
- package/core/audits/insights/third-parties-insight.js +1 -1
- package/core/audits/layout-shifts.js +1 -1
- package/core/audits/predictive-perf.js +2 -2
- package/core/audits/seo/crawlable-anchors.js +2 -3
- package/core/audits/seo/manual/structured-data.js +1 -1
- package/core/audits/server-response-time.d.ts +0 -5
- package/core/audits/server-response-time.js +12 -26
- package/core/computed/metrics/cumulative-layout-shift.js +2 -2
- package/core/computed/metrics/lantern-metric.js +3 -3
- package/core/computed/metrics/lcp-breakdown.d.ts +10 -5
- package/core/computed/metrics/lcp-breakdown.js +50 -22
- package/core/computed/metrics/time-to-first-byte.js +33 -10
- package/core/computed/metrics/timing-summary.js +3 -2
- package/core/computed/page-dependency-graph.js +1 -1
- package/core/computed/trace-engine-result.js +2 -2
- package/core/config/default-config.js +110 -152
- package/core/config/experimental-config.js +1 -32
- package/core/config/filters.js +6 -9
- package/core/config/lr-desktop-config.js +0 -1
- package/core/config/lr-mobile-config.js +0 -1
- package/core/gather/driver/target-manager.d.ts +1 -1
- package/core/gather/driver.d.ts +1 -1
- package/core/gather/gatherers/anchor-elements.js +8 -24
- package/core/gather/gatherers/image-elements.js +32 -6
- package/core/gather/gatherers/inspector-issues.js +1 -28
- package/core/gather/gatherers/trace-elements.d.ts +2 -11
- package/core/gather/gatherers/trace-elements.js +9 -39
- package/core/gather/navigation-runner.js +0 -3
- package/core/gather/session.d.ts +1 -1
- package/core/lib/asset-saver.d.ts +2 -2
- package/core/lib/asset-saver.js +33 -43
- package/core/lib/bf-cache-strings.js +10 -9
- package/core/lib/deprecations-strings.js +5 -5
- package/core/lib/emulation.d.ts +10 -0
- package/core/lib/emulation.js +21 -6
- package/core/lib/legacy-javascript/legacy-javascript.js +4 -11
- package/core/lib/network-request.d.ts +0 -7
- package/core/lib/network-request.js +0 -16
- package/core/lib/proto-preprocessor.js +10 -25
- package/core/runner.js +1 -8
- package/core/scoring.js +1 -1
- package/dist/report/bundle.esm.js +10 -49
- package/dist/report/flow.js +12 -51
- package/dist/report/standalone.js +11 -50
- package/flow-report/src/i18n/i18n.d.ts +4 -6
- package/package.json +16 -19
- package/readme.md +2 -2
- package/report/assets/styles.css +0 -39
- package/report/renderer/api.js +0 -1
- package/report/renderer/category-renderer.js +6 -0
- package/report/renderer/components.js +1 -1
- package/report/renderer/details-renderer.d.ts +1 -2
- package/report/renderer/details-renderer.js +0 -1
- package/report/renderer/dom.d.ts +0 -13
- package/report/renderer/dom.js +0 -38
- package/report/renderer/performance-category-renderer.d.ts +0 -26
- package/report/renderer/performance-category-renderer.js +10 -142
- package/report/renderer/report-ui-features.d.ts +0 -1
- package/report/renderer/report-ui-features.js +2 -13
- package/report/renderer/report-utils.d.ts +2 -3
- package/report/renderer/report-utils.js +4 -6
- package/report/types/report-renderer.d.ts +0 -6
- package/shared/localization/locales/ar-XB.json +107 -455
- package/shared/localization/locales/ar.json +107 -455
- package/shared/localization/locales/bg.json +96 -444
- package/shared/localization/locales/ca.json +96 -444
- package/shared/localization/locales/cs.json +96 -444
- package/shared/localization/locales/da.json +96 -444
- package/shared/localization/locales/de.json +96 -444
- package/shared/localization/locales/el.json +96 -444
- package/shared/localization/locales/en-GB.json +96 -444
- package/shared/localization/locales/en-US.json +116 -467
- package/shared/localization/locales/en-XA.json +93 -441
- package/shared/localization/locales/en-XL.json +116 -467
- package/shared/localization/locales/es-419.json +96 -444
- package/shared/localization/locales/es.json +96 -444
- package/shared/localization/locales/fi.json +96 -444
- package/shared/localization/locales/fil.json +96 -444
- package/shared/localization/locales/fr.json +96 -444
- package/shared/localization/locales/he.json +118 -466
- package/shared/localization/locales/hi.json +96 -444
- package/shared/localization/locales/hr.json +100 -448
- package/shared/localization/locales/hu.json +96 -444
- package/shared/localization/locales/id.json +96 -444
- package/shared/localization/locales/it.json +96 -444
- package/shared/localization/locales/ja.json +96 -444
- package/shared/localization/locales/ko.json +97 -445
- package/shared/localization/locales/lt.json +96 -444
- package/shared/localization/locales/lv.json +97 -445
- package/shared/localization/locales/nl.json +96 -444
- package/shared/localization/locales/no.json +96 -444
- package/shared/localization/locales/pl.json +96 -444
- package/shared/localization/locales/pt-PT.json +96 -444
- package/shared/localization/locales/pt.json +97 -445
- package/shared/localization/locales/ro.json +97 -445
- package/shared/localization/locales/ru.json +96 -444
- package/shared/localization/locales/sk.json +96 -444
- package/shared/localization/locales/sl.json +96 -444
- package/shared/localization/locales/sr-Latn.json +96 -444
- package/shared/localization/locales/sr.json +96 -444
- package/shared/localization/locales/sv.json +96 -444
- package/shared/localization/locales/ta.json +96 -444
- package/shared/localization/locales/te.json +97 -445
- package/shared/localization/locales/th.json +96 -444
- package/shared/localization/locales/tr.json +96 -444
- package/shared/localization/locales/uk.json +96 -444
- package/shared/localization/locales/vi.json +96 -444
- package/shared/localization/locales/zh-HK.json +96 -444
- package/shared/localization/locales/zh-TW.json +97 -445
- package/shared/localization/locales/zh.json +96 -444
- package/shared/localization/locales.d.ts +2 -0
- package/shared/localization/locales.js +130 -139
- package/shared/tsconfig.json +2 -0
- package/tsconfig-base.json +2 -2
- package/tsconfig.json +1 -4
- package/types/artifacts.d.ts +6 -81
- package/types/audit.d.ts +1 -1
- package/types/lhr/settings.d.ts +1 -1
- package/core/audits/byte-efficiency/duplicated-javascript.d.ts +0 -45
- package/core/audits/byte-efficiency/duplicated-javascript.js +0 -223
- package/core/audits/byte-efficiency/efficient-animated-content.d.ts +0 -22
- package/core/audits/byte-efficiency/efficient-animated-content.js +0 -93
- package/core/audits/byte-efficiency/legacy-javascript.d.ts +0 -28
- package/core/audits/byte-efficiency/legacy-javascript.js +0 -144
- package/core/audits/byte-efficiency/modern-image-formats.d.ts +0 -38
- package/core/audits/byte-efficiency/modern-image-formats.js +0 -187
- package/core/audits/byte-efficiency/offscreen-images.d.ts +0 -63
- package/core/audits/byte-efficiency/offscreen-images.js +0 -240
- package/core/audits/byte-efficiency/render-blocking-resources.d.ts +0 -53
- package/core/audits/byte-efficiency/render-blocking-resources.js +0 -312
- package/core/audits/byte-efficiency/uses-long-cache-ttl.d.ts +0 -59
- package/core/audits/byte-efficiency/uses-long-cache-ttl.js +0 -293
- package/core/audits/byte-efficiency/uses-optimized-images.d.ts +0 -33
- package/core/audits/byte-efficiency/uses-optimized-images.js +0 -146
- package/core/audits/byte-efficiency/uses-responsive-images-snapshot.d.ts +0 -16
- package/core/audits/byte-efficiency/uses-responsive-images-snapshot.js +0 -106
- package/core/audits/byte-efficiency/uses-responsive-images.d.ts +0 -44
- package/core/audits/byte-efficiency/uses-responsive-images.js +0 -202
- package/core/audits/byte-efficiency/uses-text-compression.d.ts +0 -14
- package/core/audits/byte-efficiency/uses-text-compression.js +0 -108
- package/core/audits/critical-request-chains.d.ts +0 -44
- package/core/audits/critical-request-chains.js +0 -221
- package/core/audits/dobetterweb/dom-size.d.ts +0 -32
- package/core/audits/dobetterweb/dom-size.js +0 -182
- package/core/audits/dobetterweb/no-document-write.d.ts +0 -16
- package/core/audits/dobetterweb/no-document-write.js +0 -86
- package/core/audits/dobetterweb/uses-http2.d.ts +0 -72
- package/core/audits/dobetterweb/uses-http2.js +0 -276
- package/core/audits/dobetterweb/uses-passive-event-listeners.d.ts +0 -16
- package/core/audits/dobetterweb/uses-passive-event-listeners.js +0 -69
- package/core/audits/font-display.d.ts +0 -32
- package/core/audits/font-display.js +0 -195
- package/core/audits/largest-contentful-paint-element.d.ts +0 -34
- package/core/audits/largest-contentful-paint-element.js +0 -181
- package/core/audits/lcp-lazy-loaded.d.ts +0 -22
- package/core/audits/lcp-lazy-loaded.js +0 -115
- package/core/audits/metrics/first-meaningful-paint.d.ts +0 -12
- package/core/audits/metrics/first-meaningful-paint.js +0 -47
- package/core/audits/preload-fonts.d.ts +0 -25
- package/core/audits/preload-fonts.js +0 -97
- package/core/audits/prioritize-lcp-image.d.ts +0 -74
- package/core/audits/prioritize-lcp-image.js +0 -297
- package/core/audits/seo/font-size.d.ts +0 -24
- package/core/audits/seo/font-size.js +0 -344
- package/core/audits/third-party-facades.d.ts +0 -41
- package/core/audits/third-party-facades.js +0 -234
- package/core/audits/third-party-summary.d.ts +0 -78
- package/core/audits/third-party-summary.js +0 -236
- package/core/audits/uses-rel-preconnect.d.ts +0 -37
- package/core/audits/uses-rel-preconnect.js +0 -286
- package/core/audits/uses-rel-preload.d.ts +0 -57
- package/core/audits/uses-rel-preload.js +0 -263
- package/core/audits/viewport.d.ts +0 -17
- package/core/audits/viewport.js +0 -87
- package/core/audits/work-during-interaction.d.ts +0 -81
- package/core/audits/work-during-interaction.js +0 -287
- package/core/computed/critical-request-chains.d.ts +0 -42
- package/core/computed/critical-request-chains.js +0 -143
- package/core/computed/viewport-meta.d.ts +0 -37
- package/core/computed/viewport-meta.js +0 -71
- package/core/gather/gatherers/cache-contents.d.ts +0 -11
- package/core/gather/gatherers/cache-contents.js +0 -56
- package/core/gather/gatherers/devtools-log-compat.d.ts +0 -13
- package/core/gather/gatherers/devtools-log-compat.js +0 -35
- package/core/gather/gatherers/dobetterweb/domstats.d.ts +0 -10
- package/core/gather/gatherers/dobetterweb/domstats.js +0 -102
- package/core/gather/gatherers/dobetterweb/optimized-images.d.ts +0 -48
- package/core/gather/gatherers/dobetterweb/optimized-images.js +0 -169
- package/core/gather/gatherers/dobetterweb/response-compression.d.ts +0 -23
- package/core/gather/gatherers/dobetterweb/response-compression.js +0 -136
- package/core/gather/gatherers/seo/font-size.d.ts +0 -131
- package/core/gather/gatherers/seo/font-size.js +0 -347
- package/core/gather/gatherers/trace-compat.d.ts +0 -13
- package/core/gather/gatherers/trace-compat.js +0 -35
- package/types/internal/metaviewport-parser.d.ts +0 -13
- package/types/internal/parse-cache-control.d.ts +0 -20
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// auto-generated by build/build-cdt-strings.js
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
// Copyright 2025 The Chromium Authors
|
|
3
|
+
// Copyright 2025 The Chromium Authors
|
|
4
4
|
// Use of this source code is governed by a BSD-style license that can be
|
|
5
5
|
// found in the LICENSE file.
|
|
6
6
|
|
|
@@ -59,15 +59,15 @@ export const UIStrings = {
|
|
|
59
59
|
/**
|
|
60
60
|
* @description Warning displayed to developers when the Geolocation API is used from an insecure origin (one that isn't localhost or doesn't use HTTPS) to notify them that this use is no longer supported.
|
|
61
61
|
*/
|
|
62
|
-
GeolocationInsecureOrigin: "`getCurrentPosition()` and `watchPosition()` no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://
|
|
62
|
+
GeolocationInsecureOrigin: "`getCurrentPosition()` and `watchPosition()` no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://www.chromium.org/Home/chromium-security/deprecating-powerful-features-on-insecure-origins/ for more details.",
|
|
63
63
|
/**
|
|
64
64
|
* @description Warning displayed to developers when the Geolocation API is used from an insecure origin (one that isn't localhost or doesn't use HTTPS) to notify them that this use is deprecated.
|
|
65
65
|
*/
|
|
66
|
-
GeolocationInsecureOriginDeprecatedNotRemoved: "`getCurrentPosition()` and `watchPosition()` are deprecated on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://
|
|
66
|
+
GeolocationInsecureOriginDeprecatedNotRemoved: "`getCurrentPosition()` and `watchPosition()` are deprecated on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://www.chromium.org/Home/chromium-security/deprecating-powerful-features-on-insecure-origins/ for more details.",
|
|
67
67
|
/**
|
|
68
68
|
* @description This warning occurs when the `getUserMedia()` API is invoked on an insecure (e.g., HTTP) site. This is only permitted on secure sites (e.g., HTTPS).
|
|
69
69
|
*/
|
|
70
|
-
GetUserMediaInsecureOrigin: "`getUserMedia()` no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://
|
|
70
|
+
GetUserMediaInsecureOrigin: "`getUserMedia()` no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://www.chromium.org/Home/chromium-security/deprecating-powerful-features-on-insecure-origins/ for more details.",
|
|
71
71
|
/**
|
|
72
72
|
* @description A deprecation warning shown to developers in the DevTools Issues tab when code tries to use the deprecated hostCandidate field, guiding developers to use the equivalent information in the .address and .port fields instead.
|
|
73
73
|
*/
|
|
@@ -107,7 +107,7 @@ export const UIStrings = {
|
|
|
107
107
|
/**
|
|
108
108
|
* @description Warning displayed to developers when the Notification API is used from an insecure origin (one that isn't localhost or doesn't use HTTPS) to notify them that this use is no longer supported.
|
|
109
109
|
*/
|
|
110
|
-
NotificationInsecureOrigin: "The Notification API may no longer be used from insecure origins. You should consider switching your application to a secure origin, such as HTTPS. See https://
|
|
110
|
+
NotificationInsecureOrigin: "The Notification API may no longer be used from insecure origins. You should consider switching your application to a secure origin, such as HTTPS. See https://www.chromium.org/Home/chromium-security/deprecating-powerful-features-on-insecure-origins/ for more details.",
|
|
111
111
|
/**
|
|
112
112
|
* @description Warning displayed to developers when permission to use notifications has been requested by a cross-origin iframe, to notify them that this use is no longer supported.
|
|
113
113
|
*/
|
package/core/lib/emulation.d.ts
CHANGED
|
@@ -40,4 +40,14 @@ export function enableCPUThrottling(session: LH.Gatherer.ProtocolSession, thrott
|
|
|
40
40
|
* @return {Promise<void>}
|
|
41
41
|
*/
|
|
42
42
|
export function clearCPUThrottling(session: LH.Gatherer.ProtocolSession): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Tweak a useragent to have the milestone match the host's Chrome version.
|
|
45
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
46
|
+
* @param {string} userAgent
|
|
47
|
+
* @returns {Promise<{tweakedUA: string, fullVersion: string}>}
|
|
48
|
+
*/
|
|
49
|
+
export function matchHostUAVersion(session: LH.Gatherer.ProtocolSession, userAgent: string): Promise<{
|
|
50
|
+
tweakedUA: string;
|
|
51
|
+
fullVersion: string;
|
|
52
|
+
}>;
|
|
43
53
|
//# sourceMappingURL=emulation.d.ts.map
|
package/core/lib/emulation.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import {getBrowserVersion} from '../gather/driver/environment.js';
|
|
8
|
+
|
|
7
9
|
const NO_THROTTLING_METRICS = {
|
|
8
10
|
latency: 0,
|
|
9
11
|
downloadThroughput: 0,
|
|
@@ -16,13 +18,11 @@ const NO_CPU_THROTTLE_METRICS = {
|
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
|
-
* @param {string}
|
|
21
|
+
* @param {string} fullVersion
|
|
20
22
|
* @param {LH.Config.Settings['formFactor']} formFactor
|
|
21
23
|
* @return {LH.Crdp.Emulation.SetUserAgentOverrideRequest['userAgentMetadata']}
|
|
22
24
|
*/
|
|
23
|
-
function parseUseragentIntoMetadata(
|
|
24
|
-
const match = userAgent.match(/Chrome\/([\d.]+)/); // eg 'Chrome/(71.0.3577.0)'
|
|
25
|
-
const fullVersion = match?.[1] || '99.0.1234.0';
|
|
25
|
+
function parseUseragentIntoMetadata(fullVersion, formFactor) {
|
|
26
26
|
const [version] = fullVersion.split('.', 1);
|
|
27
27
|
const brands = [
|
|
28
28
|
{brand: 'Chromium', version},
|
|
@@ -54,6 +54,19 @@ function parseUseragentIntoMetadata(userAgent, formFactor) {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Tweak a useragent to have the milestone match the host's Chrome version.
|
|
59
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
60
|
+
* @param {string} userAgent
|
|
61
|
+
* @returns {Promise<{tweakedUA: string, fullVersion: string}>}
|
|
62
|
+
*/
|
|
63
|
+
async function matchHostUAVersion(session, userAgent) {
|
|
64
|
+
const {milestone} = await getBrowserVersion(session);
|
|
65
|
+
const tweakedUA = userAgent.replace(/(Chrome\/)[\d.]+/, `$1${milestone}.0.0.0`);
|
|
66
|
+
const fullVersion = `${milestone}.0.0.0`;
|
|
67
|
+
return {tweakedUA, fullVersion};
|
|
68
|
+
}
|
|
69
|
+
|
|
57
70
|
/**
|
|
58
71
|
* @param {LH.Gatherer.ProtocolSession} session
|
|
59
72
|
* @param {LH.Config.Settings} settings
|
|
@@ -62,9 +75,10 @@ function parseUseragentIntoMetadata(userAgent, formFactor) {
|
|
|
62
75
|
async function emulate(session, settings) {
|
|
63
76
|
if (settings.emulatedUserAgent !== false) {
|
|
64
77
|
const userAgent = /** @type {string} */ (settings.emulatedUserAgent);
|
|
78
|
+
const {tweakedUA, fullVersion} = await matchHostUAVersion(session, userAgent);
|
|
65
79
|
await session.sendCommand('Network.setUserAgentOverride', {
|
|
66
|
-
userAgent,
|
|
67
|
-
userAgentMetadata: parseUseragentIntoMetadata(
|
|
80
|
+
userAgent: tweakedUA,
|
|
81
|
+
userAgentMetadata: parseUseragentIntoMetadata(fullVersion, settings.formFactor),
|
|
68
82
|
});
|
|
69
83
|
}
|
|
70
84
|
// See devtools-entry for one usecase for disabling screenEmulation
|
|
@@ -157,4 +171,5 @@ export {
|
|
|
157
171
|
clearNetworkThrottling,
|
|
158
172
|
enableCPUThrottling,
|
|
159
173
|
clearCPUThrottling,
|
|
174
|
+
matchHostUAVersion,
|
|
160
175
|
};
|
|
@@ -15,21 +15,14 @@
|
|
|
15
15
|
/** @typedef {{name: string, line: number, column: number}} PatternMatchResult */
|
|
16
16
|
/** @typedef {{matches: PatternMatchResult[], estimatedByteSavings: number}} Result */
|
|
17
17
|
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
import {LH_ROOT} from '../../../shared/root.js';
|
|
21
|
-
|
|
22
|
-
const polyfillModuleDataJson = fs.readFileSync(
|
|
23
|
-
`${LH_ROOT}/core/lib/legacy-javascript/polyfill-module-data.json`, 'utf-8');
|
|
18
|
+
import polyfillModuleData_ from './polyfill-module-data.json' with { type: 'json' };
|
|
19
|
+
import graph_ from './polyfill-graph-data.json' with { type: 'json' };
|
|
24
20
|
|
|
25
21
|
/** @type {import('../../scripts/legacy-javascript/create-polyfill-module-data.js').PolyfillModuleData} */
|
|
26
|
-
const polyfillModuleData =
|
|
27
|
-
|
|
28
|
-
const graphJson = fs.readFileSync(
|
|
29
|
-
`${LH_ROOT}/core/lib/legacy-javascript/polyfill-graph-data.json`, 'utf-8');
|
|
22
|
+
const polyfillModuleData = polyfillModuleData_;
|
|
30
23
|
|
|
31
24
|
/** @type {import('../../scripts/legacy-javascript/create-polyfill-size-estimation.js').PolyfillSizeEstimator} */
|
|
32
|
-
const graph =
|
|
25
|
+
const graph = graph_;
|
|
33
26
|
|
|
34
27
|
/**
|
|
35
28
|
* Takes a list of patterns (consisting of a name identifier and a RegExp expression string)
|
|
@@ -241,13 +241,6 @@ export class NetworkRequest {
|
|
|
241
241
|
* LR loses protocol information.
|
|
242
242
|
*/
|
|
243
243
|
_updateProtocolForLightrider(): void;
|
|
244
|
-
/**
|
|
245
|
-
* TODO(compat): remove M116.
|
|
246
|
-
* `timing.receiveHeadersStart` was added recently, and will be in M116. Until then,
|
|
247
|
-
* set it to receiveHeadersEnd, which is close enough, to allow consumers of NetworkRequest
|
|
248
|
-
* to use the new field without accounting for this backcompat.
|
|
249
|
-
*/
|
|
250
|
-
_backfillReceiveHeaderStartTiming(): void;
|
|
251
244
|
/**
|
|
252
245
|
* LR gets additional, accurate timing information from its underlying fetch infrastructure. This
|
|
253
246
|
* is passed in via X-Headers similar to 'X-TotalFetchedSize'.
|
|
@@ -286,7 +286,6 @@ class NetworkRequest {
|
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
this._updateResponseHeadersEndTimeIfNecessary();
|
|
289
|
-
this._backfillReceiveHeaderStartTiming();
|
|
290
289
|
this._updateTransferSizeForLightrider();
|
|
291
290
|
this._updateTimingsForLightrider();
|
|
292
291
|
}
|
|
@@ -306,7 +305,6 @@ class NetworkRequest {
|
|
|
306
305
|
this.localizedFailDescription = data.errorText;
|
|
307
306
|
|
|
308
307
|
this._updateResponseHeadersEndTimeIfNecessary();
|
|
309
|
-
this._backfillReceiveHeaderStartTiming();
|
|
310
308
|
this._updateTransferSizeForLightrider();
|
|
311
309
|
this._updateTimingsForLightrider();
|
|
312
310
|
}
|
|
@@ -329,7 +327,6 @@ class NetworkRequest {
|
|
|
329
327
|
this.networkEndTime = data.timestamp * 1000;
|
|
330
328
|
|
|
331
329
|
this._updateResponseHeadersEndTimeIfNecessary();
|
|
332
|
-
this._backfillReceiveHeaderStartTiming();
|
|
333
330
|
}
|
|
334
331
|
|
|
335
332
|
/**
|
|
@@ -463,19 +460,6 @@ class NetworkRequest {
|
|
|
463
460
|
}
|
|
464
461
|
}
|
|
465
462
|
|
|
466
|
-
/**
|
|
467
|
-
* TODO(compat): remove M116.
|
|
468
|
-
* `timing.receiveHeadersStart` was added recently, and will be in M116. Until then,
|
|
469
|
-
* set it to receiveHeadersEnd, which is close enough, to allow consumers of NetworkRequest
|
|
470
|
-
* to use the new field without accounting for this backcompat.
|
|
471
|
-
*/
|
|
472
|
-
_backfillReceiveHeaderStartTiming() {
|
|
473
|
-
// Do nothing if a value is already present!
|
|
474
|
-
if (!this.timing || this.timing.receiveHeadersStart !== undefined) return;
|
|
475
|
-
|
|
476
|
-
this.timing.receiveHeadersStart = this.timing.receiveHeadersEnd;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
463
|
/**
|
|
480
464
|
* LR gets additional, accurate timing information from its underlying fetch infrastructure. This
|
|
481
465
|
* is passed in via X-Headers similar to 'X-TotalFetchedSize'.
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
import fs from 'fs';
|
|
8
8
|
|
|
9
|
-
import esMain from 'es-main';
|
|
10
|
-
|
|
11
9
|
/**
|
|
12
10
|
* @fileoverview Helper functions to transform an LHR into a proto-ready LHR.
|
|
13
11
|
*
|
|
@@ -24,29 +22,12 @@ function processForProto(lhr) {
|
|
|
24
22
|
/** @type {LH.Result} */
|
|
25
23
|
const reportJson = JSON.parse(JSON.stringify(lhr));
|
|
26
24
|
|
|
27
|
-
//
|
|
28
|
-
// Note: This is not strictly required for conversion if protobuf parsing is set to
|
|
29
|
-
// 'ignore unknown fields' in the language of conversion.
|
|
25
|
+
// Drop these fields as we've omitted them from the proto for simplicity
|
|
30
26
|
if (reportJson.configSettings) {
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
onlyCategories,
|
|
36
|
-
channel,
|
|
37
|
-
throttling,
|
|
38
|
-
screenEmulation,
|
|
39
|
-
throttlingMethod} = reportJson.configSettings;
|
|
40
|
-
|
|
41
|
-
// @ts-expect-error - intentionally only a subset of settings.
|
|
42
|
-
reportJson.configSettings = {
|
|
43
|
-
formFactor,
|
|
44
|
-
locale,
|
|
45
|
-
onlyCategories,
|
|
46
|
-
channel,
|
|
47
|
-
throttling,
|
|
48
|
-
screenEmulation,
|
|
49
|
-
throttlingMethod};
|
|
27
|
+
// @ts-expect-error Removing non-optional field.
|
|
28
|
+
delete reportJson.configSettings.auditMode;
|
|
29
|
+
// @ts-expect-error Removing non-optional field.
|
|
30
|
+
delete reportJson.configSettings.gatherMode;
|
|
50
31
|
}
|
|
51
32
|
|
|
52
33
|
// Remove runtimeError if it is NO_ERROR
|
|
@@ -126,7 +107,7 @@ function processForProto(lhr) {
|
|
|
126
107
|
}
|
|
127
108
|
|
|
128
109
|
// Test if called from the CLI or as a module.
|
|
129
|
-
if (
|
|
110
|
+
if (import.meta.main) {
|
|
130
111
|
// read in the argv for the input & output
|
|
131
112
|
const args = process.argv.slice(2);
|
|
132
113
|
let input;
|
|
@@ -143,6 +124,10 @@ if (esMain(import.meta)) {
|
|
|
143
124
|
const report = processForProto(JSON.parse(fs.readFileSync(input, 'utf-8')));
|
|
144
125
|
// write to output from argv
|
|
145
126
|
fs.writeFileSync(output, JSON.stringify(report), 'utf-8');
|
|
127
|
+
// eslint-disable-next-line no-console
|
|
128
|
+
console.log(`file written to ${output}`);
|
|
129
|
+
} else {
|
|
130
|
+
process.exit(1);
|
|
146
131
|
}
|
|
147
132
|
}
|
|
148
133
|
|
package/core/runner.js
CHANGED
|
@@ -369,14 +369,7 @@ vs: ${JSON.stringify(normalizedAuditSettings[k], null, 2)}`);
|
|
|
369
369
|
for (const artifactName of audit.meta.requiredArtifacts) {
|
|
370
370
|
const noArtifact = artifacts[artifactName] === undefined;
|
|
371
371
|
|
|
372
|
-
|
|
373
|
-
// NOTE: for now, not a pass-specific check of traces or devtoolsLogs.
|
|
374
|
-
const noRequiredTrace = artifactName === 'traces' &&
|
|
375
|
-
!artifacts.traces?.[Audit.DEFAULT_PASS];
|
|
376
|
-
const noRequiredDevtoolsLog = artifactName === 'devtoolsLogs' &&
|
|
377
|
-
!artifacts.devtoolsLogs?.[Audit.DEFAULT_PASS];
|
|
378
|
-
|
|
379
|
-
if (noArtifact || noRequiredTrace || noRequiredDevtoolsLog) {
|
|
372
|
+
if (noArtifact) {
|
|
380
373
|
log.warn('Runner',
|
|
381
374
|
`${artifactName} gatherer, required by audit ${audit.meta.id}, did not run.`);
|
|
382
375
|
throw new LighthouseError(
|
package/core/scoring.js
CHANGED
|
@@ -57,7 +57,7 @@ class ReportScoring {
|
|
|
57
57
|
const member = {...configMember};
|
|
58
58
|
|
|
59
59
|
// If a result was not applicable, meaning its checks did not run against anything on
|
|
60
|
-
// the page, force
|
|
60
|
+
// the page, force its weight to 0. It will not count during the arithmeticMean() but
|
|
61
61
|
// will still be included in the final report json and displayed in the report as
|
|
62
62
|
// "Not Applicable".
|
|
63
63
|
const result = resultsByAuditId[member.id];
|