lighthouse 12.8.2 → 13.0.0-dev.20251010

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.
Files changed (270) hide show
  1. package/cli/cli-flags.js +1 -1
  2. package/cli/test/smokehouse/config/exclusions.js +0 -2
  3. package/cli/test/smokehouse/version-check.d.ts +1 -1
  4. package/core/audits/accessibility/accesskeys.js +3 -3
  5. package/core/audits/accessibility/aria-allowed-attr.js +3 -3
  6. package/core/audits/accessibility/aria-allowed-role.js +2 -1
  7. package/core/audits/accessibility/aria-command-name.js +1 -1
  8. package/core/audits/accessibility/aria-conditional-attr.js +1 -1
  9. package/core/audits/accessibility/aria-deprecated-role.js +1 -1
  10. package/core/audits/accessibility/aria-dialog-name.js +1 -1
  11. package/core/audits/accessibility/aria-hidden-body.js +3 -3
  12. package/core/audits/accessibility/aria-hidden-focus.js +3 -3
  13. package/core/audits/accessibility/aria-input-field-name.js +3 -3
  14. package/core/audits/accessibility/aria-meter-name.js +1 -1
  15. package/core/audits/accessibility/aria-progressbar-name.js +1 -1
  16. package/core/audits/accessibility/aria-prohibited-attr.js +1 -1
  17. package/core/audits/accessibility/aria-required-attr.js +3 -3
  18. package/core/audits/accessibility/aria-required-children.js +3 -3
  19. package/core/audits/accessibility/aria-required-parent.js +3 -3
  20. package/core/audits/accessibility/aria-roles.js +3 -3
  21. package/core/audits/accessibility/aria-text.js +3 -3
  22. package/core/audits/accessibility/aria-toggle-field-name.js +3 -3
  23. package/core/audits/accessibility/aria-tooltip-name.js +1 -1
  24. package/core/audits/accessibility/aria-treeitem-name.js +1 -1
  25. package/core/audits/accessibility/aria-valid-attr-value.js +3 -3
  26. package/core/audits/accessibility/aria-valid-attr.js +3 -3
  27. package/core/audits/accessibility/button-name.js +3 -3
  28. package/core/audits/accessibility/bypass.js +3 -3
  29. package/core/audits/accessibility/color-contrast.js +3 -3
  30. package/core/audits/accessibility/definition-list.js +3 -3
  31. package/core/audits/accessibility/dlitem.js +3 -3
  32. package/core/audits/accessibility/document-title.js +3 -3
  33. package/core/audits/accessibility/duplicate-id-aria.js +3 -3
  34. package/core/audits/accessibility/empty-heading.js +3 -3
  35. package/core/audits/accessibility/form-field-multiple-labels.js +3 -3
  36. package/core/audits/accessibility/frame-title.js +3 -3
  37. package/core/audits/accessibility/heading-order.js +3 -3
  38. package/core/audits/accessibility/html-has-lang.js +3 -3
  39. package/core/audits/accessibility/html-lang-valid.js +3 -3
  40. package/core/audits/accessibility/html-xml-lang-mismatch.js +3 -3
  41. package/core/audits/accessibility/identical-links-same-purpose.js +3 -3
  42. package/core/audits/accessibility/image-alt.js +3 -3
  43. package/core/audits/accessibility/image-redundant-alt.js +4 -3
  44. package/core/audits/accessibility/input-button-name.js +3 -3
  45. package/core/audits/accessibility/input-image-alt.js +3 -3
  46. package/core/audits/accessibility/label-content-name-mismatch.js +3 -3
  47. package/core/audits/accessibility/label.js +3 -3
  48. package/core/audits/accessibility/landmark-one-main.js +3 -4
  49. package/core/audits/accessibility/link-in-text-block.js +3 -3
  50. package/core/audits/accessibility/link-name.js +3 -3
  51. package/core/audits/accessibility/list.js +3 -3
  52. package/core/audits/accessibility/listitem.js +3 -3
  53. package/core/audits/accessibility/meta-refresh.js +3 -3
  54. package/core/audits/accessibility/meta-viewport.js +3 -3
  55. package/core/audits/accessibility/object-alt.js +3 -3
  56. package/core/audits/accessibility/select-name.js +3 -3
  57. package/core/audits/accessibility/skip-link.js +3 -3
  58. package/core/audits/accessibility/tabindex.js +3 -3
  59. package/core/audits/accessibility/table-duplicate-name.js +4 -3
  60. package/core/audits/accessibility/table-fake-caption.js +3 -3
  61. package/core/audits/accessibility/target-size.js +3 -3
  62. package/core/audits/accessibility/td-has-header.js +3 -3
  63. package/core/audits/accessibility/td-headers-attr.js +3 -3
  64. package/core/audits/accessibility/th-has-data-cells.js +3 -3
  65. package/core/audits/accessibility/valid-lang.js +3 -3
  66. package/core/audits/accessibility/video-caption.js +3 -3
  67. package/core/audits/audit.d.ts +0 -4
  68. package/core/audits/audit.js +2 -13
  69. package/core/audits/insights/cls-culprits-insight.js +1 -1
  70. package/core/audits/insights/dom-size-insight.js +11 -7
  71. package/core/audits/insights/font-display-insight.js +3 -1
  72. package/core/audits/insights/image-delivery-insight.js +4 -1
  73. package/core/audits/insights/insight-audit.d.ts +6 -4
  74. package/core/audits/insights/insight-audit.js +27 -8
  75. package/core/audits/insights/third-parties-insight.js +1 -1
  76. package/core/audits/layout-shifts.js +1 -1
  77. package/core/audits/predictive-perf.js +2 -2
  78. package/core/audits/seo/crawlable-anchors.js +2 -3
  79. package/core/audits/seo/manual/structured-data.js +1 -1
  80. package/core/audits/server-response-time.d.ts +0 -5
  81. package/core/audits/server-response-time.js +12 -26
  82. package/core/computed/metrics/cumulative-layout-shift.js +2 -2
  83. package/core/computed/metrics/lantern-metric.js +3 -3
  84. package/core/computed/metrics/lcp-breakdown.d.ts +10 -5
  85. package/core/computed/metrics/lcp-breakdown.js +50 -22
  86. package/core/computed/metrics/time-to-first-byte.js +33 -10
  87. package/core/computed/metrics/timing-summary.js +3 -2
  88. package/core/computed/page-dependency-graph.js +1 -1
  89. package/core/computed/trace-engine-result.js +2 -2
  90. package/core/config/default-config.js +110 -152
  91. package/core/config/experimental-config.js +1 -32
  92. package/core/config/filters.js +6 -9
  93. package/core/config/lr-desktop-config.js +0 -1
  94. package/core/config/lr-mobile-config.js +0 -1
  95. package/core/gather/driver/target-manager.d.ts +1 -1
  96. package/core/gather/driver.d.ts +1 -1
  97. package/core/gather/gatherers/anchor-elements.js +8 -24
  98. package/core/gather/gatherers/image-elements.js +32 -6
  99. package/core/gather/gatherers/inspector-issues.js +1 -28
  100. package/core/gather/gatherers/trace-elements.d.ts +2 -11
  101. package/core/gather/gatherers/trace-elements.js +9 -39
  102. package/core/gather/navigation-runner.js +0 -3
  103. package/core/gather/session.d.ts +1 -1
  104. package/core/lib/asset-saver.d.ts +2 -2
  105. package/core/lib/asset-saver.js +33 -43
  106. package/core/lib/bf-cache-strings.js +10 -9
  107. package/core/lib/deprecations-strings.js +5 -5
  108. package/core/lib/emulation.d.ts +10 -0
  109. package/core/lib/emulation.js +21 -6
  110. package/core/lib/legacy-javascript/legacy-javascript.js +4 -11
  111. package/core/lib/network-request.d.ts +0 -7
  112. package/core/lib/network-request.js +0 -16
  113. package/core/lib/proto-preprocessor.js +10 -25
  114. package/core/runner.js +1 -8
  115. package/core/scoring.js +1 -1
  116. package/dist/report/bundle.esm.js +10 -49
  117. package/dist/report/flow.js +12 -51
  118. package/dist/report/standalone.js +11 -50
  119. package/flow-report/src/i18n/i18n.d.ts +4 -6
  120. package/package.json +16 -19
  121. package/readme.md +2 -2
  122. package/report/assets/styles.css +0 -39
  123. package/report/renderer/api.js +0 -1
  124. package/report/renderer/category-renderer.js +6 -0
  125. package/report/renderer/components.js +1 -1
  126. package/report/renderer/details-renderer.d.ts +1 -2
  127. package/report/renderer/details-renderer.js +0 -1
  128. package/report/renderer/dom.d.ts +0 -13
  129. package/report/renderer/dom.js +0 -38
  130. package/report/renderer/performance-category-renderer.d.ts +0 -26
  131. package/report/renderer/performance-category-renderer.js +10 -142
  132. package/report/renderer/report-ui-features.d.ts +0 -1
  133. package/report/renderer/report-ui-features.js +2 -13
  134. package/report/renderer/report-utils.d.ts +2 -3
  135. package/report/renderer/report-utils.js +4 -6
  136. package/report/types/report-renderer.d.ts +0 -6
  137. package/shared/localization/locales/ar-XB.json +107 -455
  138. package/shared/localization/locales/ar.json +107 -455
  139. package/shared/localization/locales/bg.json +96 -444
  140. package/shared/localization/locales/ca.json +96 -444
  141. package/shared/localization/locales/cs.json +96 -444
  142. package/shared/localization/locales/da.json +96 -444
  143. package/shared/localization/locales/de.json +96 -444
  144. package/shared/localization/locales/el.json +96 -444
  145. package/shared/localization/locales/en-GB.json +96 -444
  146. package/shared/localization/locales/en-US.json +116 -467
  147. package/shared/localization/locales/en-XA.json +93 -441
  148. package/shared/localization/locales/en-XL.json +116 -467
  149. package/shared/localization/locales/es-419.json +96 -444
  150. package/shared/localization/locales/es.json +96 -444
  151. package/shared/localization/locales/fi.json +96 -444
  152. package/shared/localization/locales/fil.json +96 -444
  153. package/shared/localization/locales/fr.json +96 -444
  154. package/shared/localization/locales/he.json +118 -466
  155. package/shared/localization/locales/hi.json +96 -444
  156. package/shared/localization/locales/hr.json +100 -448
  157. package/shared/localization/locales/hu.json +96 -444
  158. package/shared/localization/locales/id.json +96 -444
  159. package/shared/localization/locales/it.json +96 -444
  160. package/shared/localization/locales/ja.json +96 -444
  161. package/shared/localization/locales/ko.json +97 -445
  162. package/shared/localization/locales/lt.json +96 -444
  163. package/shared/localization/locales/lv.json +97 -445
  164. package/shared/localization/locales/nl.json +96 -444
  165. package/shared/localization/locales/no.json +96 -444
  166. package/shared/localization/locales/pl.json +96 -444
  167. package/shared/localization/locales/pt-PT.json +96 -444
  168. package/shared/localization/locales/pt.json +97 -445
  169. package/shared/localization/locales/ro.json +97 -445
  170. package/shared/localization/locales/ru.json +96 -444
  171. package/shared/localization/locales/sk.json +96 -444
  172. package/shared/localization/locales/sl.json +96 -444
  173. package/shared/localization/locales/sr-Latn.json +96 -444
  174. package/shared/localization/locales/sr.json +96 -444
  175. package/shared/localization/locales/sv.json +96 -444
  176. package/shared/localization/locales/ta.json +96 -444
  177. package/shared/localization/locales/te.json +97 -445
  178. package/shared/localization/locales/th.json +96 -444
  179. package/shared/localization/locales/tr.json +96 -444
  180. package/shared/localization/locales/uk.json +96 -444
  181. package/shared/localization/locales/vi.json +96 -444
  182. package/shared/localization/locales/zh-HK.json +96 -444
  183. package/shared/localization/locales/zh-TW.json +97 -445
  184. package/shared/localization/locales/zh.json +96 -444
  185. package/shared/localization/locales.d.ts +2 -0
  186. package/shared/localization/locales.js +130 -139
  187. package/shared/tsconfig.json +2 -0
  188. package/tsconfig-base.json +2 -2
  189. package/tsconfig.json +1 -4
  190. package/types/artifacts.d.ts +6 -81
  191. package/types/audit.d.ts +1 -1
  192. package/types/lhr/settings.d.ts +1 -1
  193. package/core/audits/byte-efficiency/duplicated-javascript.d.ts +0 -45
  194. package/core/audits/byte-efficiency/duplicated-javascript.js +0 -223
  195. package/core/audits/byte-efficiency/efficient-animated-content.d.ts +0 -22
  196. package/core/audits/byte-efficiency/efficient-animated-content.js +0 -93
  197. package/core/audits/byte-efficiency/legacy-javascript.d.ts +0 -28
  198. package/core/audits/byte-efficiency/legacy-javascript.js +0 -144
  199. package/core/audits/byte-efficiency/modern-image-formats.d.ts +0 -38
  200. package/core/audits/byte-efficiency/modern-image-formats.js +0 -187
  201. package/core/audits/byte-efficiency/offscreen-images.d.ts +0 -63
  202. package/core/audits/byte-efficiency/offscreen-images.js +0 -240
  203. package/core/audits/byte-efficiency/render-blocking-resources.d.ts +0 -53
  204. package/core/audits/byte-efficiency/render-blocking-resources.js +0 -312
  205. package/core/audits/byte-efficiency/uses-long-cache-ttl.d.ts +0 -59
  206. package/core/audits/byte-efficiency/uses-long-cache-ttl.js +0 -293
  207. package/core/audits/byte-efficiency/uses-optimized-images.d.ts +0 -33
  208. package/core/audits/byte-efficiency/uses-optimized-images.js +0 -146
  209. package/core/audits/byte-efficiency/uses-responsive-images-snapshot.d.ts +0 -16
  210. package/core/audits/byte-efficiency/uses-responsive-images-snapshot.js +0 -106
  211. package/core/audits/byte-efficiency/uses-responsive-images.d.ts +0 -44
  212. package/core/audits/byte-efficiency/uses-responsive-images.js +0 -202
  213. package/core/audits/byte-efficiency/uses-text-compression.d.ts +0 -14
  214. package/core/audits/byte-efficiency/uses-text-compression.js +0 -108
  215. package/core/audits/critical-request-chains.d.ts +0 -44
  216. package/core/audits/critical-request-chains.js +0 -221
  217. package/core/audits/dobetterweb/dom-size.d.ts +0 -32
  218. package/core/audits/dobetterweb/dom-size.js +0 -182
  219. package/core/audits/dobetterweb/no-document-write.d.ts +0 -16
  220. package/core/audits/dobetterweb/no-document-write.js +0 -86
  221. package/core/audits/dobetterweb/uses-http2.d.ts +0 -72
  222. package/core/audits/dobetterweb/uses-http2.js +0 -276
  223. package/core/audits/dobetterweb/uses-passive-event-listeners.d.ts +0 -16
  224. package/core/audits/dobetterweb/uses-passive-event-listeners.js +0 -69
  225. package/core/audits/font-display.d.ts +0 -32
  226. package/core/audits/font-display.js +0 -195
  227. package/core/audits/largest-contentful-paint-element.d.ts +0 -34
  228. package/core/audits/largest-contentful-paint-element.js +0 -181
  229. package/core/audits/lcp-lazy-loaded.d.ts +0 -22
  230. package/core/audits/lcp-lazy-loaded.js +0 -115
  231. package/core/audits/metrics/first-meaningful-paint.d.ts +0 -12
  232. package/core/audits/metrics/first-meaningful-paint.js +0 -47
  233. package/core/audits/preload-fonts.d.ts +0 -25
  234. package/core/audits/preload-fonts.js +0 -97
  235. package/core/audits/prioritize-lcp-image.d.ts +0 -74
  236. package/core/audits/prioritize-lcp-image.js +0 -297
  237. package/core/audits/seo/font-size.d.ts +0 -24
  238. package/core/audits/seo/font-size.js +0 -344
  239. package/core/audits/third-party-facades.d.ts +0 -41
  240. package/core/audits/third-party-facades.js +0 -234
  241. package/core/audits/third-party-summary.d.ts +0 -78
  242. package/core/audits/third-party-summary.js +0 -236
  243. package/core/audits/uses-rel-preconnect.d.ts +0 -37
  244. package/core/audits/uses-rel-preconnect.js +0 -286
  245. package/core/audits/uses-rel-preload.d.ts +0 -57
  246. package/core/audits/uses-rel-preload.js +0 -263
  247. package/core/audits/viewport.d.ts +0 -17
  248. package/core/audits/viewport.js +0 -87
  249. package/core/audits/work-during-interaction.d.ts +0 -81
  250. package/core/audits/work-during-interaction.js +0 -287
  251. package/core/computed/critical-request-chains.d.ts +0 -42
  252. package/core/computed/critical-request-chains.js +0 -143
  253. package/core/computed/viewport-meta.d.ts +0 -37
  254. package/core/computed/viewport-meta.js +0 -71
  255. package/core/gather/gatherers/cache-contents.d.ts +0 -11
  256. package/core/gather/gatherers/cache-contents.js +0 -56
  257. package/core/gather/gatherers/devtools-log-compat.d.ts +0 -13
  258. package/core/gather/gatherers/devtools-log-compat.js +0 -35
  259. package/core/gather/gatherers/dobetterweb/domstats.d.ts +0 -10
  260. package/core/gather/gatherers/dobetterweb/domstats.js +0 -102
  261. package/core/gather/gatherers/dobetterweb/optimized-images.d.ts +0 -48
  262. package/core/gather/gatherers/dobetterweb/optimized-images.js +0 -169
  263. package/core/gather/gatherers/dobetterweb/response-compression.d.ts +0 -23
  264. package/core/gather/gatherers/dobetterweb/response-compression.js +0 -136
  265. package/core/gather/gatherers/seo/font-size.d.ts +0 -131
  266. package/core/gather/gatherers/seo/font-size.js +0 -347
  267. package/core/gather/gatherers/trace-compat.d.ts +0 -13
  268. package/core/gather/gatherers/trace-compat.js +0 -35
  269. package/types/internal/metaviewport-parser.d.ts +0 -13
  270. 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. All rights reserved.
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://goo.gle/chrome-insecure-origins for more details.",
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://goo.gle/chrome-insecure-origins for more details.",
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://goo.gle/chrome-insecure-origins for more details.",
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://goo.gle/chrome-insecure-origins for more details.",
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
  */
@@ -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
@@ -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} userAgent
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(userAgent, formFactor) {
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(userAgent, settings.formFactor),
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 fs from 'fs';
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 = JSON.parse(polyfillModuleDataJson);
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 = JSON.parse(graphJson);
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
- // Clean up the configSettings
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
- // The settings that are in both proto and LHR
32
- const {
33
- formFactor,
34
- locale,
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 (esMain(import.meta)) {
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
- // If trace/devtoolsLog required, check that DEFAULT_PASS trace/devtoolsLog exists.
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 it's weight to 0. It will not count during the arithmeticMean() but
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];