lighthouse 9.5.0-dev.20230117 → 9.5.0-dev.20230119

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 (518) hide show
  1. package/cli/bin.d.ts +5 -0
  2. package/cli/cli-flags.d.ts +258 -0
  3. package/cli/commands/commands.d.ts +4 -0
  4. package/cli/commands/list-audits.d.ts +2 -0
  5. package/cli/commands/list-locales.d.ts +2 -0
  6. package/cli/commands/list-trace-categories.d.ts +2 -0
  7. package/cli/index.d.ts +3 -0
  8. package/cli/printer.d.ts +28 -0
  9. package/cli/run.d.ts +24 -0
  10. package/cli/sentry-prompt.d.ts +5 -0
  11. package/cli/test/smokehouse/config/exclusions.d.ts +12 -0
  12. package/cli/test/smokehouse/core-tests.d.ts +4 -0
  13. package/cli/test/smokehouse/frontends/back-compat-util.d.ts +16 -0
  14. package/cli/test/smokehouse/frontends/lib.d.ts +8 -0
  15. package/cli/test/smokehouse/frontends/node.d.ts +2 -0
  16. package/cli/test/smokehouse/frontends/smokehouse-bin.d.ts +3 -0
  17. package/cli/test/smokehouse/lib/child-process-error.d.ts +21 -0
  18. package/cli/test/smokehouse/lib/concurrent-mapper.d.ts +78 -0
  19. package/cli/test/smokehouse/lib/local-console.d.ts +33 -0
  20. package/cli/test/smokehouse/lighthouse-runners/bundle.d.ts +16 -0
  21. package/cli/test/smokehouse/lighthouse-runners/cli.d.ts +18 -0
  22. package/cli/test/smokehouse/lighthouse-runners/devtools.d.ts +23 -0
  23. package/cli/test/smokehouse/report-assert-test.d.ts +2 -0
  24. package/cli/test/smokehouse/report-assert.d.ts +50 -0
  25. package/cli/test/smokehouse/smokehouse.d.ts +35 -0
  26. package/cli/test/smokehouse/version-check-test.d.ts +2 -0
  27. package/cli/test/smokehouse/version-check.d.ts +15 -0
  28. package/core/audits/accessibility/accesskeys.d.ts +10 -0
  29. package/core/audits/accessibility/aria-allowed-attr.d.ts +10 -0
  30. package/core/audits/accessibility/aria-command-name.d.ts +10 -0
  31. package/core/audits/accessibility/aria-hidden-body.d.ts +10 -0
  32. package/core/audits/accessibility/aria-hidden-focus.d.ts +10 -0
  33. package/core/audits/accessibility/aria-input-field-name.d.ts +10 -0
  34. package/core/audits/accessibility/aria-meter-name.d.ts +10 -0
  35. package/core/audits/accessibility/aria-progressbar-name.d.ts +10 -0
  36. package/core/audits/accessibility/aria-required-attr.d.ts +10 -0
  37. package/core/audits/accessibility/aria-required-children.d.ts +10 -0
  38. package/core/audits/accessibility/aria-required-parent.d.ts +10 -0
  39. package/core/audits/accessibility/aria-roles.d.ts +10 -0
  40. package/core/audits/accessibility/aria-toggle-field-name.d.ts +10 -0
  41. package/core/audits/accessibility/aria-tooltip-name.d.ts +10 -0
  42. package/core/audits/accessibility/aria-treeitem-name.d.ts +10 -0
  43. package/core/audits/accessibility/aria-valid-attr-value.d.ts +10 -0
  44. package/core/audits/accessibility/aria-valid-attr.d.ts +10 -0
  45. package/core/audits/accessibility/axe-audit.d.ts +17 -0
  46. package/core/audits/accessibility/button-name.d.ts +10 -0
  47. package/core/audits/accessibility/bypass.d.ts +10 -0
  48. package/core/audits/accessibility/color-contrast.d.ts +10 -0
  49. package/core/audits/accessibility/definition-list.d.ts +10 -0
  50. package/core/audits/accessibility/dlitem.d.ts +10 -0
  51. package/core/audits/accessibility/document-title.d.ts +10 -0
  52. package/core/audits/accessibility/duplicate-id-active.d.ts +10 -0
  53. package/core/audits/accessibility/duplicate-id-aria.d.ts +10 -0
  54. package/core/audits/accessibility/form-field-multiple-labels.d.ts +10 -0
  55. package/core/audits/accessibility/frame-title.d.ts +10 -0
  56. package/core/audits/accessibility/heading-order.d.ts +10 -0
  57. package/core/audits/accessibility/html-has-lang.d.ts +10 -0
  58. package/core/audits/accessibility/html-lang-valid.d.ts +10 -0
  59. package/core/audits/accessibility/image-alt.d.ts +10 -0
  60. package/core/audits/accessibility/input-image-alt.d.ts +10 -0
  61. package/core/audits/accessibility/label.d.ts +10 -0
  62. package/core/audits/accessibility/link-name.d.ts +10 -0
  63. package/core/audits/accessibility/list.d.ts +10 -0
  64. package/core/audits/accessibility/listitem.d.ts +10 -0
  65. package/core/audits/accessibility/manual/custom-controls-labels.d.ts +8 -0
  66. package/core/audits/accessibility/manual/custom-controls-roles.d.ts +8 -0
  67. package/core/audits/accessibility/manual/focus-traps.d.ts +8 -0
  68. package/core/audits/accessibility/manual/focusable-controls.d.ts +8 -0
  69. package/core/audits/accessibility/manual/interactive-element-affordance.d.ts +8 -0
  70. package/core/audits/accessibility/manual/logical-tab-order.d.ts +8 -0
  71. package/core/audits/accessibility/manual/managed-focus.d.ts +8 -0
  72. package/core/audits/accessibility/manual/offscreen-content-hidden.d.ts +9 -0
  73. package/core/audits/accessibility/manual/use-landmarks.d.ts +8 -0
  74. package/core/audits/accessibility/manual/visual-order-follows-dom.d.ts +8 -0
  75. package/core/audits/accessibility/meta-refresh.d.ts +10 -0
  76. package/core/audits/accessibility/meta-viewport.d.ts +10 -0
  77. package/core/audits/accessibility/object-alt.d.ts +10 -0
  78. package/core/audits/accessibility/tabindex.d.ts +10 -0
  79. package/core/audits/accessibility/td-headers-attr.d.ts +10 -0
  80. package/core/audits/accessibility/th-has-data-cells.d.ts +10 -0
  81. package/core/audits/accessibility/valid-lang.d.ts +10 -0
  82. package/core/audits/accessibility/video-caption.d.ts +10 -0
  83. package/core/audits/audit.d.ts +150 -0
  84. package/core/audits/audit.js +1 -0
  85. package/core/audits/autocomplete.d.ts +36 -0
  86. package/core/audits/bf-cache.d.ts +21 -0
  87. package/core/audits/bootup-time.d.ts +26 -0
  88. package/core/audits/byte-efficiency/byte-efficiency-audit.d.ts +82 -0
  89. package/core/audits/byte-efficiency/duplicated-javascript.d.ts +52 -0
  90. package/core/audits/byte-efficiency/efficient-animated-content.d.ts +23 -0
  91. package/core/audits/byte-efficiency/legacy-javascript.d.ts +99 -0
  92. package/core/audits/byte-efficiency/modern-image-formats.d.ts +38 -0
  93. package/core/audits/byte-efficiency/offscreen-images.d.ts +75 -0
  94. package/core/audits/byte-efficiency/render-blocking-resources.d.ts +55 -0
  95. package/core/audits/byte-efficiency/render-blocking-resources.js +1 -3
  96. package/core/audits/byte-efficiency/total-byte-weight.d.ts +21 -0
  97. package/core/audits/byte-efficiency/unminified-css.d.ts +36 -0
  98. package/core/audits/byte-efficiency/unminified-javascript.d.ts +37 -0
  99. package/core/audits/byte-efficiency/unused-css-rules.d.ts +16 -0
  100. package/core/audits/byte-efficiency/unused-javascript.d.ts +27 -0
  101. package/core/audits/byte-efficiency/uses-long-cache-ttl.d.ts +61 -0
  102. package/core/audits/byte-efficiency/uses-optimized-images.d.ts +33 -0
  103. package/core/audits/byte-efficiency/uses-responsive-images-snapshot.d.ts +16 -0
  104. package/core/audits/byte-efficiency/uses-responsive-images.d.ts +45 -0
  105. package/core/audits/byte-efficiency/uses-text-compression.d.ts +14 -0
  106. package/core/audits/content-width.d.ts +17 -0
  107. package/core/audits/critical-request-chains.d.ts +44 -0
  108. package/core/audits/csp-xss.d.ts +51 -0
  109. package/core/audits/deprecations.d.ts +19 -0
  110. package/core/audits/diagnostics.d.ts +11 -0
  111. package/core/audits/dobetterweb/charset.d.ts +19 -0
  112. package/core/audits/dobetterweb/doctype.d.ts +21 -0
  113. package/core/audits/dobetterweb/dom-size.d.ts +26 -0
  114. package/core/audits/dobetterweb/geolocation-on-start.d.ts +16 -0
  115. package/core/audits/dobetterweb/inspector-issues.d.ts +45 -0
  116. package/core/audits/dobetterweb/js-libraries.d.ts +15 -0
  117. package/core/audits/dobetterweb/no-document-write.d.ts +16 -0
  118. package/core/audits/dobetterweb/notification-on-start.d.ts +16 -0
  119. package/core/audits/dobetterweb/password-inputs-can-be-pasted-into.d.ts +15 -0
  120. package/core/audits/dobetterweb/uses-http2.d.ts +69 -0
  121. package/core/audits/dobetterweb/uses-passive-event-listeners.d.ts +16 -0
  122. package/core/audits/errors-in-console.d.ts +31 -0
  123. package/core/audits/final-screenshot.d.ts +11 -0
  124. package/core/audits/font-display.d.ts +32 -0
  125. package/core/audits/image-aspect-ratio.d.ts +30 -0
  126. package/core/audits/image-size-responsive.d.ts +28 -0
  127. package/core/audits/installable-manifest.d.ts +118 -0
  128. package/core/audits/is-on-https.d.ts +23 -0
  129. package/core/audits/largest-contentful-paint-element.d.ts +14 -0
  130. package/core/audits/layout-shift-elements.d.ts +15 -0
  131. package/core/audits/lcp-lazy-loaded.d.ts +21 -0
  132. package/core/audits/long-tasks.d.ts +16 -0
  133. package/core/audits/main-thread-tasks.d.ts +11 -0
  134. package/core/audits/mainthread-work-breakdown.d.ts +28 -0
  135. package/core/audits/manual/manual-audit.d.ts +13 -0
  136. package/core/audits/manual/pwa-cross-browser.d.ts +12 -0
  137. package/core/audits/manual/pwa-each-page-has-url.d.ts +12 -0
  138. package/core/audits/manual/pwa-page-transitions.d.ts +12 -0
  139. package/core/audits/maskable-icon.d.ts +25 -0
  140. package/core/audits/metrics/cumulative-layout-shift.d.ts +21 -0
  141. package/core/audits/metrics/experimental-interaction-to-next-paint.d.ts +21 -0
  142. package/core/audits/metrics/first-contentful-paint-3g.d.ts +15 -0
  143. package/core/audits/metrics/first-contentful-paint.d.ts +25 -0
  144. package/core/audits/metrics/first-meaningful-paint.d.ts +28 -0
  145. package/core/audits/metrics/interactive.d.ts +31 -0
  146. package/core/audits/metrics/largest-contentful-paint.d.ts +25 -0
  147. package/core/audits/metrics/max-potential-fid.d.ts +23 -0
  148. package/core/audits/metrics/speed-index.d.ts +27 -0
  149. package/core/audits/metrics/total-blocking-time.d.ts +32 -0
  150. package/core/audits/metrics.d.ts +11 -0
  151. package/core/audits/multi-check-audit.d.ts +28 -0
  152. package/core/audits/network-requests.d.ts +11 -0
  153. package/core/audits/network-rtt.d.ts +15 -0
  154. package/core/audits/network-server-latency.d.ts +15 -0
  155. package/core/audits/no-unload-listeners.d.ts +16 -0
  156. package/core/audits/non-composited-animations.d.ts +21 -0
  157. package/core/audits/oopif-iframe-test-audit.d.ts +14 -0
  158. package/core/audits/performance-budget.d.ts +39 -0
  159. package/core/audits/predictive-perf.d.ts +11 -0
  160. package/core/audits/preload-fonts.d.ts +29 -0
  161. package/core/audits/preload-lcp-image.d.ts +67 -0
  162. package/core/audits/redirects.d.ts +33 -0
  163. package/core/audits/resource-summary.d.ts +16 -0
  164. package/core/audits/screenshot-thumbnails.d.ts +32 -0
  165. package/core/audits/script-elements-test-audit.d.ts +14 -0
  166. package/core/audits/script-treemap-data.d.ts +42 -0
  167. package/core/audits/seo/canonical.d.ts +51 -0
  168. package/core/audits/seo/crawlable-anchors.d.ts +16 -0
  169. package/core/audits/seo/font-size.d.ts +24 -0
  170. package/core/audits/seo/hreflang.d.ts +28 -0
  171. package/core/audits/seo/http-status-code.d.ts +16 -0
  172. package/core/audits/seo/is-crawlable.d.ts +38 -0
  173. package/core/audits/seo/link-text.d.ts +16 -0
  174. package/core/audits/seo/manual/structured-data.d.ts +12 -0
  175. package/core/audits/seo/meta-description.d.ts +16 -0
  176. package/core/audits/seo/plugins.d.ts +15 -0
  177. package/core/audits/seo/robots-txt.d.ts +18 -0
  178. package/core/audits/seo/tap-targets.d.ts +50 -0
  179. package/core/audits/server-response-time.d.ts +21 -0
  180. package/core/audits/service-worker.d.ts +46 -0
  181. package/core/audits/splash-screen.d.ts +37 -0
  182. package/core/audits/themed-omnibox.d.ts +42 -0
  183. package/core/audits/third-party-facades.d.ts +41 -0
  184. package/core/audits/third-party-summary.d.ts +58 -0
  185. package/core/audits/timing-budget.d.ts +43 -0
  186. package/core/audits/unsized-images.d.ts +39 -0
  187. package/core/audits/user-timings.d.ts +43 -0
  188. package/core/audits/uses-rel-preconnect.d.ts +37 -0
  189. package/core/audits/uses-rel-preconnect.js +1 -4
  190. package/core/audits/uses-rel-preload.d.ts +61 -0
  191. package/core/audits/valid-source-maps.d.ts +27 -0
  192. package/core/audits/viewport.d.ts +17 -0
  193. package/core/audits/violation-audit.d.ts +14 -0
  194. package/core/audits/work-during-interaction.d.ts +82 -0
  195. package/core/computed/computed-artifact.d.ts +15 -0
  196. package/core/computed/critical-request-chains.d.ts +40 -0
  197. package/core/computed/image-records.d.ts +24 -0
  198. package/core/computed/js-bundles.d.ts +13 -0
  199. package/core/computed/load-simulator.d.ts +28 -0
  200. package/core/computed/main-resource.d.ts +25 -0
  201. package/core/computed/main-thread-tasks.d.ts +15 -0
  202. package/core/computed/manifest-values.d.ts +24 -0
  203. package/core/computed/metrics/cumulative-layout-shift.d.ts +53 -0
  204. package/core/computed/metrics/first-contentful-paint-all-frames.d.ts +19 -0
  205. package/core/computed/metrics/first-contentful-paint.d.ts +15 -0
  206. package/core/computed/metrics/first-meaningful-paint.d.ts +15 -0
  207. package/core/computed/metrics/interactive.d.ts +61 -0
  208. package/core/computed/metrics/lantern-first-contentful-paint.d.ts +48 -0
  209. package/core/computed/metrics/lantern-first-meaningful-paint.d.ts +12 -0
  210. package/core/computed/metrics/lantern-interactive.d.ts +31 -0
  211. package/core/computed/metrics/lantern-largest-contentful-paint.d.ts +25 -0
  212. package/core/computed/metrics/lantern-max-potential-fid.d.ts +30 -0
  213. package/core/computed/metrics/lantern-metric.d.ts +78 -0
  214. package/core/computed/metrics/lantern-metric.js +1 -3
  215. package/core/computed/metrics/lantern-speed-index.d.ts +38 -0
  216. package/core/computed/metrics/lantern-total-blocking-time.d.ts +31 -0
  217. package/core/computed/metrics/largest-contentful-paint-all-frames.d.ts +20 -0
  218. package/core/computed/metrics/largest-contentful-paint.d.ts +15 -0
  219. package/core/computed/metrics/max-potential-fid.d.ts +15 -0
  220. package/core/computed/metrics/metric.d.ts +38 -0
  221. package/core/computed/metrics/metric.js +1 -1
  222. package/core/computed/metrics/navigation-metric.d.ts +16 -0
  223. package/core/computed/metrics/responsiveness.d.ts +87 -0
  224. package/core/computed/metrics/speed-index.d.ts +10 -0
  225. package/core/computed/metrics/tbt-utils.d.ts +18 -0
  226. package/core/computed/metrics/timing-summary.d.ts +46 -0
  227. package/core/computed/metrics/timing-summary.js +1 -1
  228. package/core/computed/metrics/total-blocking-time.d.ts +23 -0
  229. package/core/computed/module-duplication.d.ts +37 -0
  230. package/core/computed/network-analysis.d.ts +20 -0
  231. package/core/computed/network-records.d.ts +15 -0
  232. package/core/computed/network-records.js +1 -0
  233. package/core/computed/page-dependency-graph.d.ts +88 -0
  234. package/core/computed/processed-navigation.d.ts +15 -0
  235. package/core/computed/processed-navigation.js +5 -2
  236. package/core/computed/processed-trace.d.ts +14 -0
  237. package/core/computed/resource-summary.d.ts +44 -0
  238. package/core/computed/screenshots.d.ts +20 -0
  239. package/core/computed/speedline.d.ts +15 -0
  240. package/core/computed/unused-css.d.ts +62 -0
  241. package/core/computed/unused-javascript-summary.d.ts +71 -0
  242. package/core/computed/user-timings.d.ts +31 -0
  243. package/core/computed/viewport-meta.d.ts +35 -0
  244. package/core/config/budget.d.ts +74 -0
  245. package/core/config/config-helpers.d.ts +94 -0
  246. package/core/config/config-plugin.d.ts +46 -0
  247. package/core/config/config.d.ts +28 -0
  248. package/core/config/constants.d.ts +86 -0
  249. package/core/config/default-config.d.ts +5 -0
  250. package/core/config/default-config.js +5 -4
  251. package/core/config/desktop-config.d.ts +5 -0
  252. package/core/config/desktop-config.js +1 -0
  253. package/core/config/experimental-config.d.ts +13 -0
  254. package/core/config/filters.d.ts +83 -0
  255. package/core/config/full-config.d.ts +9 -0
  256. package/core/config/lr-desktop-config.d.ts +4 -0
  257. package/core/config/lr-mobile-config.d.ts +9 -0
  258. package/core/config/metrics-to-audits.d.ts +19 -0
  259. package/core/config/perf-config.d.ts +9 -0
  260. package/core/config/validation.d.ts +77 -0
  261. package/core/gather/base-artifacts.d.ts +16 -0
  262. package/core/gather/base-gatherer.d.ts +72 -0
  263. package/core/gather/base-gatherer.js +2 -0
  264. package/core/gather/driver/dom.d.ts +20 -0
  265. package/core/gather/driver/environment.d.ts +35 -0
  266. package/core/gather/driver/execution-context.d.ts +101 -0
  267. package/core/gather/driver/execution-context.js +1 -7
  268. package/core/gather/driver/navigation.d.ts +33 -0
  269. package/core/gather/driver/network-monitor.d.ts +82 -0
  270. package/core/gather/driver/network.d.ts +10 -0
  271. package/core/gather/driver/prepare.d.ts +46 -0
  272. package/core/gather/driver/service-workers.d.ts +16 -0
  273. package/core/gather/driver/storage.d.ts +24 -0
  274. package/core/gather/driver/target-manager.d.ts +61 -0
  275. package/core/gather/driver/wait-for-condition.d.ts +116 -0
  276. package/core/gather/driver/wait-for-condition.js +3 -2
  277. package/core/gather/driver.d.ts +30 -0
  278. package/core/gather/fetcher.d.ts +63 -0
  279. package/core/gather/fetcher.js +2 -0
  280. package/core/gather/gatherers/accessibility.d.ts +23 -0
  281. package/core/gather/gatherers/anchor-elements.d.ts +10 -0
  282. package/core/gather/gatherers/bf-cache-failures.d.ts +43 -0
  283. package/core/gather/gatherers/cache-contents.d.ts +11 -0
  284. package/core/gather/gatherers/console-messages.d.ts +39 -0
  285. package/core/gather/gatherers/css-usage.d.ts +39 -0
  286. package/core/gather/gatherers/devtools-log-compat.d.ts +13 -0
  287. package/core/gather/gatherers/devtools-log.d.ts +48 -0
  288. package/core/gather/gatherers/dobetterweb/doctype.d.ts +10 -0
  289. package/core/gather/gatherers/dobetterweb/domstats.d.ts +10 -0
  290. package/core/gather/gatherers/dobetterweb/optimized-images.d.ts +61 -0
  291. package/core/gather/gatherers/dobetterweb/password-inputs-with-prevented-paste.d.ts +10 -0
  292. package/core/gather/gatherers/dobetterweb/response-compression.d.ts +30 -0
  293. package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.d.ts +53 -0
  294. package/core/gather/gatherers/full-page-screenshot.d.ts +35 -0
  295. package/core/gather/gatherers/gatherer.d.ts +46 -0
  296. package/core/gather/gatherers/global-listeners.d.ts +27 -0
  297. package/core/gather/gatherers/iframe-elements.d.ts +11 -0
  298. package/core/gather/gatherers/image-elements.d.ts +35 -0
  299. package/core/gather/gatherers/inputs.d.ts +10 -0
  300. package/core/gather/gatherers/inspector-issues.d.ts +38 -0
  301. package/core/gather/gatherers/installability-errors.d.ts +17 -0
  302. package/core/gather/gatherers/js-usage.d.ts +22 -0
  303. package/core/gather/gatherers/link-elements.d.ts +39 -0
  304. package/core/gather/gatherers/main-document-content.d.ts +27 -0
  305. package/core/gather/gatherers/meta-elements.d.ts +10 -0
  306. package/core/gather/gatherers/network-user-agent.d.ts +18 -0
  307. package/core/gather/gatherers/script-elements.d.ts +26 -0
  308. package/core/gather/gatherers/scripts.d.ts +27 -0
  309. package/core/gather/gatherers/seo/embedded-content.d.ts +10 -0
  310. package/core/gather/gatherers/seo/font-size.d.ts +131 -0
  311. package/core/gather/gatherers/seo/robots-txt.d.ts +10 -0
  312. package/core/gather/gatherers/seo/tap-targets.d.ts +21 -0
  313. package/core/gather/gatherers/service-worker.d.ts +16 -0
  314. package/core/gather/gatherers/source-maps.d.ts +50 -0
  315. package/core/gather/gatherers/stacks.d.ts +38 -0
  316. package/core/gather/gatherers/trace-compat.d.ts +13 -0
  317. package/core/gather/gatherers/trace-elements.d.ts +83 -0
  318. package/core/gather/gatherers/trace-elements.js +4 -4
  319. package/core/gather/gatherers/trace.d.ts +23 -0
  320. package/core/gather/gatherers/viewport-dimensions.d.ts +10 -0
  321. package/core/gather/gatherers/web-app-manifest.d.ts +32 -0
  322. package/core/gather/navigation-runner.d.ts +92 -0
  323. package/core/gather/runner-helpers.d.ts +39 -0
  324. package/core/gather/session.d.ts +50 -0
  325. package/core/gather/snapshot-runner.d.ts +10 -0
  326. package/core/gather/timespan-runner.d.ts +12 -0
  327. package/core/index.d.cts +4 -0
  328. package/core/index.d.ts +88 -0
  329. package/core/index.js +2 -0
  330. package/core/legacy/config/config.d.ts +107 -0
  331. package/core/legacy/config/legacy-default-config.d.ts +4 -0
  332. package/core/legacy/gather/connections/connection.d.ts +75 -0
  333. package/core/legacy/gather/connections/connection.js +1 -0
  334. package/core/legacy/gather/connections/cri.d.ts +27 -0
  335. package/core/legacy/gather/connections/raw.d.ts +20 -0
  336. package/core/legacy/gather/driver.d.ts +214 -0
  337. package/core/legacy/gather/driver.js +1 -0
  338. package/core/legacy/gather/gather-runner.d.ts +166 -0
  339. package/core/lib/arbitrary-equality-map.d.ts +47 -0
  340. package/core/lib/asset-saver.d.ts +101 -0
  341. package/core/lib/axe.d.ts +2 -0
  342. package/core/lib/bf-cache-strings.d.ts +121 -0
  343. package/core/lib/cdt/Common.d.ts +3 -0
  344. package/core/lib/cdt/Platform.d.ts +26 -0
  345. package/core/lib/cdt/SDK.d.ts +2 -0
  346. package/core/lib/cdt/generated/ParsedURL.d.ts +28 -0
  347. package/core/lib/cdt/generated/SourceMap.d.ts +100 -0
  348. package/core/lib/csp-evaluator.d.ts +41 -0
  349. package/core/lib/dependency-graph/base-node.d.ts +161 -0
  350. package/core/lib/dependency-graph/cpu-node.d.ts +34 -0
  351. package/core/lib/dependency-graph/cpu-node.js +1 -0
  352. package/core/lib/dependency-graph/network-node.d.ts +43 -0
  353. package/core/lib/dependency-graph/network-node.js +1 -0
  354. package/core/lib/dependency-graph/simulator/connection-pool.d.ts +58 -0
  355. package/core/lib/dependency-graph/simulator/connection-pool.js +1 -0
  356. package/core/lib/dependency-graph/simulator/dns-cache.d.ts +42 -0
  357. package/core/lib/dependency-graph/simulator/dns-cache.js +2 -0
  358. package/core/lib/dependency-graph/simulator/network-analyzer.d.ts +166 -0
  359. package/core/lib/dependency-graph/simulator/simulator-timing-map.d.ts +153 -0
  360. package/core/lib/dependency-graph/simulator/simulator-timing-map.js +2 -2
  361. package/core/lib/dependency-graph/simulator/simulator.d.ts +154 -0
  362. package/core/lib/dependency-graph/simulator/simulator.js +3 -2
  363. package/core/lib/dependency-graph/simulator/tcp-connection.d.ts +89 -0
  364. package/core/lib/deprecations-strings.d.ts +66 -0
  365. package/core/lib/emulation.d.ts +43 -0
  366. package/core/lib/i18n/i18n.d.ts +81 -0
  367. package/core/lib/icons.d.ts +22 -0
  368. package/core/lib/lantern-trace-saver.d.ts +20 -0
  369. package/core/lib/lh-env.d.ts +2 -0
  370. package/core/lib/lh-error.d.ts +328 -0
  371. package/core/lib/lh-trace-processor.d.ts +5 -0
  372. package/core/lib/manifest-parser.d.ts +186 -0
  373. package/core/lib/median-run.d.ts +17 -0
  374. package/core/lib/minification-estimator.d.ts +9 -0
  375. package/core/lib/minify-devtoolslog.d.ts +6 -0
  376. package/core/lib/minify-trace.d.ts +6 -0
  377. package/core/lib/navigation-error.d.ts +39 -0
  378. package/core/lib/network-recorder.d.ts +115 -0
  379. package/core/lib/network-request.d.ts +245 -0
  380. package/core/lib/network-request.js +1 -0
  381. package/core/lib/page-functions.d.ts +149 -0
  382. package/core/lib/proto-preprocessor.d.ts +13 -0
  383. package/core/lib/rect-helpers.d.ts +100 -0
  384. package/core/lib/script-helpers.d.ts +17 -0
  385. package/core/lib/sentry.d.ts +32 -0
  386. package/core/lib/stack-packs.d.ts +16 -0
  387. package/core/lib/statistics.d.ts +28 -0
  388. package/core/lib/tappable-rects.d.ts +8 -0
  389. package/core/lib/third-party-web.d.ts +32 -0
  390. package/core/lib/timing-trace-saver.d.ts +21 -0
  391. package/core/lib/tracehouse/cpu-profile-model.d.ts +228 -0
  392. package/core/lib/tracehouse/main-thread-tasks.d.ts +162 -0
  393. package/core/lib/tracehouse/main-thread-tasks.js +1 -0
  394. package/core/lib/tracehouse/task-groups.d.ts +66 -0
  395. package/core/lib/tracehouse/task-summary.d.ts +18 -0
  396. package/core/lib/tracehouse/trace-processor.d.ts +275 -0
  397. package/core/lib/traces/metric-trace-events.d.ts +65 -0
  398. package/core/lib/url-utils.d.ts +100 -0
  399. package/core/runner.d.ts +109 -0
  400. package/core/scoring.d.ts +26 -0
  401. package/core/user-flow.d.ts +106 -0
  402. package/core/user-flow.js +1 -0
  403. package/core/util.d.cts +230 -0
  404. package/dist/report/bundle.esm.js +2 -0
  405. package/dist/report/flow.js +1 -1
  406. package/dist/report/standalone.js +1 -1
  407. package/eslint-local-rules.d.cts +6 -0
  408. package/esm-utils.d.ts +14 -0
  409. package/flow-report/api.d.ts +7 -0
  410. package/flow-report/clients/standalone.d.ts +7 -0
  411. package/flow-report/src/app.d.ts +11 -0
  412. package/flow-report/src/common.d.ts +20 -0
  413. package/flow-report/src/header.d.ts +10 -0
  414. package/flow-report/src/help-dialog.d.ts +10 -0
  415. package/flow-report/src/i18n/i18n.d.ts +209 -0
  416. package/flow-report/src/i18n/localized-strings.d.ts +9 -0
  417. package/flow-report/src/i18n/ui-strings.d.ts +48 -0
  418. package/flow-report/src/icons.d.ts +18 -0
  419. package/flow-report/src/sidebar/flow.d.ts +8 -0
  420. package/flow-report/src/sidebar/sidebar.d.ts +17 -0
  421. package/flow-report/src/summary/category.d.ts +19 -0
  422. package/flow-report/src/summary/summary.d.ts +18 -0
  423. package/flow-report/src/topbar.d.ts +15 -0
  424. package/flow-report/src/util.d.ts +30 -0
  425. package/flow-report/src/wrappers/category-score.d.ts +12 -0
  426. package/flow-report/src/wrappers/markdown.d.ts +10 -0
  427. package/flow-report/src/wrappers/report.d.ts +10 -0
  428. package/flow-report/src/wrappers/styles.d.ts +8 -0
  429. package/flow-report/test/app-test.d.ts +7 -0
  430. package/flow-report/test/common-test.d.ts +7 -0
  431. package/flow-report/test/flow-report-pptr-test.d.ts +7 -0
  432. package/flow-report/test/header-test.d.ts +7 -0
  433. package/flow-report/test/sample-flow.d.ts +7 -0
  434. package/flow-report/test/setup/env-setup.d.ts +11 -0
  435. package/flow-report/test/sidebar/flow-test.d.ts +7 -0
  436. package/flow-report/test/sidebar/sidebar-test.d.ts +7 -0
  437. package/flow-report/test/summary/category-test.d.ts +7 -0
  438. package/flow-report/test/summary/summary-test.d.ts +7 -0
  439. package/flow-report/test/topbar-test.d.ts +7 -0
  440. package/flow-report/test/util-test.d.ts +7 -0
  441. package/flow-report/test/wrappers/category-score-test.d.ts +7 -0
  442. package/flow-report/test/wrappers/markdown-test.d.ts +7 -0
  443. package/flow-report/tsconfig.json +1 -1
  444. package/package.json +5 -2
  445. package/report/clients/bundle.d.ts +6 -0
  446. package/report/clients/standalone.d.ts +2 -0
  447. package/report/generator/file-namer.d.ts +35 -0
  448. package/report/generator/flow-report-assets.d.ts +9 -0
  449. package/report/generator/report-assets.d.ts +8 -0
  450. package/report/generator/report-generator.d.ts +59 -0
  451. package/report/renderer/api.d.ts +31 -0
  452. package/report/renderer/category-renderer.d.ts +176 -0
  453. package/report/renderer/components.d.ts +10 -0
  454. package/report/renderer/crc-details-renderer.d.ts +73 -0
  455. package/report/renderer/details-renderer.d.ts +141 -0
  456. package/report/renderer/dom.d.ts +125 -0
  457. package/report/renderer/drop-down-menu.d.ts +70 -0
  458. package/report/renderer/element-screenshot-renderer.d.ts +79 -0
  459. package/report/renderer/features-util.d.ts +13 -0
  460. package/report/renderer/i18n.d.ts +106 -0
  461. package/report/renderer/logger.d.ts +47 -0
  462. package/report/renderer/open-tab.d.ts +19 -0
  463. package/report/renderer/performance-category-renderer.d.ts +56 -0
  464. package/report/renderer/performance-category-renderer.js +2 -0
  465. package/report/renderer/pwa-category-renderer.d.ts +55 -0
  466. package/report/renderer/report-renderer.d.ts +57 -0
  467. package/report/renderer/report-ui-features.d.ts +71 -0
  468. package/report/renderer/snippet-renderer.d.ts +85 -0
  469. package/report/renderer/swap-locale-feature.d.ts +31 -0
  470. package/report/renderer/text-encoding.d.ts +26 -0
  471. package/report/renderer/topbar-features.d.ts +82 -0
  472. package/report/renderer/util.d.ts +230 -0
  473. package/report/test/generator/report-generator-test.js +3 -3
  474. package/report/test/renderer/performance-category-renderer-test.js +8 -9
  475. package/report/test-assets/faux-psi.d.ts +34 -0
  476. package/report/types/augment-dom.d.ts +1 -1
  477. package/root.d.ts +3 -0
  478. package/shared/localization/format.d.ts +106 -0
  479. package/shared/localization/i18n-module.d.ts +4 -0
  480. package/shared/localization/locales.d.ts +7 -0
  481. package/shared/localization/swap-flow-locale.d.ts +6 -0
  482. package/shared/localization/swap-locale.d.ts +39 -0
  483. package/shared/type-verifiers.d.ts +23 -0
  484. package/third-party/axe/valid-langs.d.ts +9 -0
  485. package/types/artifacts.d.ts +40 -38
  486. package/types/audit.d.ts +6 -6
  487. package/types/config.d.ts +3 -3
  488. package/types/externs.d.ts +7 -3
  489. package/types/gatherer.d.ts +27 -21
  490. package/types/{cssstyle/index.d.ts → internal/cssstyle.d.ts} +0 -0
  491. package/types/{enquirer.d.ts → internal/enquirer.d.ts} +0 -0
  492. package/types/{es-main.d.ts → internal/es-main.d.ts} +0 -0
  493. package/types/internal/global.d.ts +15 -0
  494. package/types/{http-link-header/index.d.ts → internal/http-link-header.d.ts} +0 -0
  495. package/types/{jsonlint-mod.d.ts → internal/jsonlint-mod.d.ts} +0 -0
  496. package/types/{lighthouse-logger/index.d.ts → internal/lighthouse-logger.d.ts} +0 -0
  497. package/types/{lookup-closest-locale/index.d.ts → internal/lookup-closest-locale.d.ts} +3 -1
  498. package/types/{metaviewport-parser/index.d.ts → internal/metaviewport-parser.d.ts} +0 -0
  499. package/types/{node-fetch.d.ts → internal/node-fetch.d.ts} +0 -0
  500. package/types/{node.d.ts → internal/node.d.ts} +0 -0
  501. package/types/{parse-cache-control/index.d.ts → internal/parse-cache-control.d.ts} +0 -0
  502. package/types/{pretty-json-stringify/index.d.ts → internal/pretty-json-stringify.d.ts} +0 -0
  503. package/types/{query-selector.d.ts → internal/query-selector.d.ts} +1 -1
  504. package/types/{rollup-plugin-postprocess.d.ts → internal/rollup-plugin-postprocess.d.ts} +0 -0
  505. package/types/{smokehouse.d.ts → internal/smokehouse.d.ts} +3 -3
  506. package/types/{test.d.ts → internal/test.d.ts} +0 -0
  507. package/types/lh.d.ts +81 -0
  508. package/types/lh.js +13 -0
  509. package/types/lhr/audit-details.d.ts +2 -2
  510. package/types/lhr/audit-result.d.ts +2 -2
  511. package/types/lhr/flow-result.d.ts +1 -1
  512. package/types/lhr/lhr.d.ts +2 -2
  513. package/types/lhr/settings.d.ts +1 -1
  514. package/types/lhr/treemap.d.ts +2 -2
  515. package/types/protocol.d.ts +8 -3
  516. package/types/puppeteer.d.ts +11 -6
  517. package/types/user-flow.d.ts +14 -5
  518. package/types/global-lh.d.ts +0 -85
@@ -0,0 +1,100 @@
1
+ export default UrlUtils;
2
+ export type NetworkRequest = import('./network-request.js').NetworkRequest;
3
+ declare class UrlUtils {
4
+ /**
5
+ * @param {string} url
6
+ * @return {boolean}
7
+ */
8
+ static isValid(url: string): boolean;
9
+ /**
10
+ * @param {string} urlA
11
+ * @param {string} urlB
12
+ * @return {boolean}
13
+ */
14
+ static hostsMatch(urlA: string, urlB: string): boolean;
15
+ /**
16
+ * @param {string} urlA
17
+ * @param {string} urlB
18
+ * @return {boolean}
19
+ */
20
+ static originsMatch(urlA: string, urlB: string): boolean;
21
+ /**
22
+ * @param {string} url
23
+ * @return {?string}
24
+ */
25
+ static getOrigin(url: string): string | null;
26
+ /**
27
+ * Check if rootDomains matches
28
+ *
29
+ * @param {string|URL} urlA
30
+ * @param {string|URL} urlB
31
+ */
32
+ static rootDomainsMatch(urlA: string | URL, urlB: string | URL): boolean;
33
+ /**
34
+ * @param {string} url
35
+ * @param {{numPathParts: number, preserveQuery: boolean, preserveHost: boolean}=} options
36
+ * @return {string}
37
+ */
38
+ static getURLDisplayName(url: string, options?: {
39
+ numPathParts: number;
40
+ preserveQuery: boolean;
41
+ preserveHost: boolean;
42
+ } | undefined): string;
43
+ /**
44
+ * Limits data URIs to 100 characters, returns all other strings untouched.
45
+ * @param {string} url
46
+ * @return {string}
47
+ */
48
+ static elideDataURI(url: string): string;
49
+ /**
50
+ * Determine if url1 equals url2, ignoring URL fragments.
51
+ * @param {string} url1
52
+ * @param {string} url2
53
+ * @return {boolean}
54
+ */
55
+ static equalWithExcludedFragments(url1: string, url2: string): boolean;
56
+ /**
57
+ * Determine if the url has a protocol that we're able to test
58
+ * @param {string} url
59
+ * @return {boolean}
60
+ */
61
+ static isProtocolAllowed(url: string): boolean;
62
+ /**
63
+ * Is the host localhost-enough to satisfy the "secure context" definition
64
+ * https://github.com/GoogleChrome/lighthouse/pull/11766#discussion_r582340683
65
+ * @param {string} hostname Either a `new URL(url).hostname` or a `networkRequest.parsedUrl.host`
66
+ * @return {boolean}
67
+ */
68
+ static isLikeLocalhost(hostname: string): boolean;
69
+ /**
70
+ * @param {NetworkRequest['parsedURL']['scheme']} scheme
71
+ * @return {boolean}
72
+ */
73
+ static isSecureScheme(scheme: NetworkRequest['parsedURL']['scheme']): boolean;
74
+ /**
75
+ * Use `NetworkRequest.isNonNetworkRequest(req)` if working with a request.
76
+ * Note: the `protocol` field from CDP can be 'h2', 'http', (not 'https'!) or it'll be url's scheme.
77
+ * https://source.chromium.org/chromium/chromium/src/+/main:content/browser/devtools/protocol/network_handler.cc;l=598-611;drc=56d4a9a9deb30be73adcee8737c73bcb2a5ab64f
78
+ * However, a `new URL(href).protocol` has a colon suffix.
79
+ * https://url.spec.whatwg.org/#dom-url-protocol
80
+ * A URL's `scheme` is specced as the `protocol` sans-colon, but isn't exposed on a URL object.
81
+ * This method can take all 3 of these string types as a parameter.
82
+ * @param {NetworkRequest['protocol'] | URL['protocol']} protocol Either a networkRequest's `protocol` per CDP or a `new URL(href).protocol`
83
+ * @return {boolean}
84
+ */
85
+ static isNonNetworkProtocol(protocol: NetworkRequest['protocol'] | URL['protocol']): boolean;
86
+ /**
87
+ * @param {string} src
88
+ * @return {string|undefined}
89
+ */
90
+ static guessMimeType(src: string): string | undefined;
91
+ /**
92
+ * @param {string|undefined} url
93
+ * @return {string}
94
+ */
95
+ static normalizeUrl(url: string | undefined): string;
96
+ }
97
+ declare namespace UrlUtils {
98
+ const INVALID_URL_DEBUG_STRING: string;
99
+ }
100
+ //# sourceMappingURL=url-utils.d.ts.map
@@ -0,0 +1,109 @@
1
+ export type Connection = import('./legacy/gather/connections/connection.js').Connection;
2
+ export type ArbitraryEqualityMap = import('./lib/arbitrary-equality-map.js').ArbitraryEqualityMap;
3
+ export type Config = LH.Config.LegacyResolvedConfig;
4
+ /** @typedef {import('./legacy/gather/connections/connection.js').Connection} Connection */
5
+ /** @typedef {import('./lib/arbitrary-equality-map.js').ArbitraryEqualityMap} ArbitraryEqualityMap */
6
+ /** @typedef {LH.Config.LegacyResolvedConfig} Config */
7
+ export class Runner {
8
+ /**
9
+ * @template {LH.Config.LegacyResolvedConfig | LH.Config.ResolvedConfig} TConfig
10
+ * @param {LH.Artifacts} artifacts
11
+ * @param {{resolvedConfig: TConfig, driverMock?: Driver, computedCache: Map<string, ArbitraryEqualityMap>}} options
12
+ * @return {Promise<LH.RunnerResult|undefined>}
13
+ */
14
+ static audit<TConfig extends import("../types/config.js").default.ResolvedConfig | import("../types/config.js").default.LegacyResolvedConfig>(artifacts: LH.Artifacts, options: {
15
+ resolvedConfig: TConfig;
16
+ driverMock?: Driver | undefined;
17
+ computedCache: Map<string, ArbitraryEqualityMap>;
18
+ }): Promise<LH.RunnerResult | undefined>;
19
+ /**
20
+ * User can run -G solo, -A solo, or -GA together
21
+ * -G and -A will run partial lighthouse pipelines,
22
+ * and -GA will run everything plus save artifacts and lhr to disk.
23
+ *
24
+ * @template {LH.Config.LegacyResolvedConfig | LH.Config.ResolvedConfig} TConfig
25
+ * @param {(runnerData: {resolvedConfig: TConfig, driverMock?: Driver}) => Promise<LH.Artifacts>} gatherFn
26
+ * @param {{resolvedConfig: TConfig, driverMock?: Driver, computedCache: Map<string, ArbitraryEqualityMap>}} options
27
+ * @return {Promise<LH.Artifacts>}
28
+ */
29
+ static gather<TConfig_1 extends import("../types/config.js").default.ResolvedConfig | import("../types/config.js").default.LegacyResolvedConfig>(gatherFn: (runnerData: {
30
+ resolvedConfig: TConfig_1;
31
+ driverMock?: Driver | undefined;
32
+ }) => Promise<LH.Artifacts>, options: {
33
+ resolvedConfig: TConfig_1;
34
+ driverMock?: Driver | undefined;
35
+ computedCache: Map<string, ArbitraryEqualityMap>;
36
+ }): Promise<LH.Artifacts>;
37
+ /**
38
+ * @param {any} err
39
+ * @param {LH.Config.Settings} settings
40
+ */
41
+ static createRunnerError(err: any, settings: LH.Config.Settings): any;
42
+ /**
43
+ * This handles both the auditMode case where gatherer entries need to be merged in and
44
+ * the gather/audit case where timingEntriesFromRunner contains all entries from this run,
45
+ * including those also in timingEntriesFromArtifacts.
46
+ * @param {LH.Artifacts} artifacts
47
+ * @return {LH.Result.Timing}
48
+ */
49
+ static _getTiming(artifacts: LH.Artifacts): LH.Result.Timing;
50
+ /**
51
+ * Establish connection, load page and collect all required artifacts
52
+ * @param {string} requestedUrl
53
+ * @param {{resolvedConfig: Config, computedCache: Map<string, ArbitraryEqualityMap>, driverMock?: Driver}} runnerOpts
54
+ * @param {Connection} connection
55
+ * @return {Promise<LH.Artifacts>}
56
+ */
57
+ static _gatherArtifactsFromBrowser(requestedUrl: string, runnerOpts: {
58
+ resolvedConfig: Config;
59
+ computedCache: Map<string, ArbitraryEqualityMap>;
60
+ driverMock?: Driver;
61
+ }, connection: Connection): Promise<LH.Artifacts>;
62
+ /**
63
+ * Run all audits with specified settings and artifacts.
64
+ * @param {LH.Config.Settings} settings
65
+ * @param {Array<LH.Config.AuditDefn>} audits
66
+ * @param {LH.Artifacts} artifacts
67
+ * @param {Array<string | LH.IcuMessage>} runWarnings
68
+ * @param {Map<string, ArbitraryEqualityMap>} computedCache
69
+ * @return {Promise<Record<string, LH.RawIcu<LH.Audit.Result>>>}
70
+ */
71
+ static _runAudits(settings: LH.Config.Settings, audits: Array<LH.Config.AuditDefn>, artifacts: LH.Artifacts, runWarnings: Array<string | LH.IcuMessage>, computedCache: Map<string, ArbitraryEqualityMap>): Promise<Record<string, LH.RawIcu<LH.Audit.Result>>>;
72
+ /**
73
+ * Checks that the audit's required artifacts exist and runs the audit if so.
74
+ * Otherwise returns error audit result.
75
+ * @param {LH.Config.AuditDefn} auditDefn
76
+ * @param {LH.Artifacts} artifacts
77
+ * @param {Pick<LH.Audit.Context, 'settings'|'computedCache'>} sharedAuditContext
78
+ * @param {Array<string | LH.IcuMessage>} runWarnings
79
+ * @return {Promise<LH.RawIcu<LH.Audit.Result>>}
80
+ * @private
81
+ */
82
+ private static _runAudit;
83
+ /**
84
+ * Searches a pass's artifacts for any `lhrRuntimeError` error artifacts.
85
+ * Returns the first one found or `null` if none found.
86
+ * @param {LH.Artifacts} artifacts
87
+ * @return {LH.RawIcu<LH.Result['runtimeError']>|undefined}
88
+ */
89
+ static getArtifactRuntimeError(artifacts: LH.Artifacts): LH.RawIcu<LH.Result['runtimeError']> | undefined;
90
+ /**
91
+ * Returns list of audit names for external querying.
92
+ * @return {Array<string>}
93
+ */
94
+ static getAuditList(): Array<string>;
95
+ /**
96
+ * Returns list of gatherer names for external querying.
97
+ * @return {Array<string>}
98
+ */
99
+ static getGathererList(): Array<string>;
100
+ /**
101
+ * Get path to use for -G and -A modes. Defaults to $CWD/latest-run
102
+ * @param {LH.Config.Settings} settings
103
+ * @return {string}
104
+ */
105
+ static _getDataSavePath(settings: LH.Config.Settings): string;
106
+ }
107
+ import { Driver } from "./legacy/gather/driver.js";
108
+ import { Audit } from "./audits/audit.js";
109
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1,26 @@
1
+ export class ReportScoring {
2
+ /**
3
+ * Computes the weighted-average of the score of the list of items.
4
+ * @param {Array<{score: number|null, weight: number}>} items
5
+ * @return {number|null}
6
+ */
7
+ static arithmeticMean(items: Array<{
8
+ score: number | null;
9
+ weight: number;
10
+ }>): number | null;
11
+ /**
12
+ * Returns the report JSON object with computed scores.
13
+ * @param {Object<string, LH.Config.Category>} configCategories
14
+ * @param {Object<string, LH.RawIcu<LH.Audit.Result>>} resultsByAuditId
15
+ * @return {Object<string, LH.RawIcu<LH.Result.Category>>}
16
+ */
17
+ static scoreAllCategories(configCategories: {
18
+ [x: string]: LH.Config.Category;
19
+ }, resultsByAuditId: {
20
+ [x: string]: LH.RawIcu<LH.Audit.Result>;
21
+ }): {
22
+ [x: string]: LH.RawIcu<LH.Result.Category>;
23
+ };
24
+ }
25
+ import { Audit } from "./audits/audit.js";
26
+ //# sourceMappingURL=scoring.d.ts.map
@@ -0,0 +1,106 @@
1
+ export type GatherStepRunnerOptions = WeakMap<LH.UserFlow.GatherStep, LH.Gatherer.FRGatherResult['runnerOptions']>;
2
+ export class UserFlow {
3
+ /**
4
+ * @param {LH.Puppeteer.Page} page
5
+ * @param {LH.UserFlow.Options} [options]
6
+ */
7
+ constructor(page: LH.Puppeteer.Page, options?: LH.UserFlow.Options | undefined);
8
+ /** @type {LH.Puppeteer.Page} */
9
+ _page: LH.Puppeteer.Page;
10
+ /** @type {LH.UserFlow.Options|undefined} */
11
+ _options: LH.UserFlow.Options | undefined;
12
+ /** @type {LH.UserFlow.GatherStep[]} */
13
+ _gatherSteps: LH.UserFlow.GatherStep[];
14
+ /** @type {GatherStepRunnerOptions} */
15
+ _gatherStepRunnerOptions: GatherStepRunnerOptions;
16
+ /**
17
+ * @param {LH.UserFlow.StepFlags|undefined} flags
18
+ * @return {LH.UserFlow.StepFlags|undefined}
19
+ */
20
+ _getNextFlags(flags: LH.UserFlow.StepFlags | undefined): LH.UserFlow.StepFlags | undefined;
21
+ /**
22
+ * @param {LH.UserFlow.StepFlags|undefined} flags
23
+ * @return {LH.UserFlow.StepFlags}
24
+ */
25
+ _getNextNavigationFlags(flags: LH.UserFlow.StepFlags | undefined): LH.UserFlow.StepFlags;
26
+ /**
27
+ * @param {LH.Gatherer.FRGatherResult} gatherResult
28
+ * @param {LH.UserFlow.StepFlags} [flags]
29
+ */
30
+ _addGatherStep(gatherResult: LH.Gatherer.FRGatherResult, flags?: LH.UserFlow.StepFlags | undefined): void;
31
+ /**
32
+ * @param {LH.NavigationRequestor} requestor
33
+ * @param {LH.UserFlow.StepFlags} [flags]
34
+ */
35
+ navigate(requestor: LH.NavigationRequestor, flags?: LH.UserFlow.StepFlags | undefined): Promise<void>;
36
+ /**
37
+ * This is an alternative to `navigate()` that can be used to analyze a navigation triggered by user interaction.
38
+ * For more on user triggered navigations, see https://github.com/GoogleChrome/lighthouse/blob/main/docs/user-flows.md#triggering-a-navigation-via-user-interactions.
39
+ *
40
+ * @param {LH.UserFlow.StepFlags} [stepOptions]
41
+ */
42
+ startNavigation(stepOptions?: LH.UserFlow.StepFlags | undefined): Promise<void>;
43
+ currentNavigation: {
44
+ continueAndAwaitResult: () => Promise<void>;
45
+ } | undefined;
46
+ endNavigation(): Promise<void>;
47
+ /**
48
+ * @param {LH.UserFlow.StepFlags} [flags]
49
+ */
50
+ startTimespan(flags?: LH.UserFlow.StepFlags | undefined): Promise<void>;
51
+ currentTimespan: {
52
+ timespan: {
53
+ endTimespanGather(): Promise<LH.Gatherer.FRGatherResult>;
54
+ };
55
+ flags: LH.UserFlow.StepFlags | undefined;
56
+ } | undefined;
57
+ endTimespan(): Promise<void>;
58
+ /**
59
+ * @param {LH.UserFlow.StepFlags} [flags]
60
+ */
61
+ snapshot(flags?: LH.UserFlow.StepFlags | undefined): Promise<void>;
62
+ /**
63
+ * @returns {Promise<LH.FlowResult>}
64
+ */
65
+ createFlowResult(): Promise<LH.FlowResult>;
66
+ /**
67
+ * @return {Promise<string>}
68
+ */
69
+ generateReport(): Promise<string>;
70
+ /**
71
+ * @return {LH.UserFlow.FlowArtifacts}
72
+ */
73
+ createArtifactsJson(): LH.UserFlow.FlowArtifacts;
74
+ }
75
+ /**
76
+ * @param {Array<LH.UserFlow.GatherStep>} gatherSteps
77
+ * @param {{name?: string, config?: LH.Config, gatherStepRunnerOptions?: GatherStepRunnerOptions}} options
78
+ */
79
+ export function auditGatherSteps(gatherSteps: Array<LH.UserFlow.GatherStep>, options: {
80
+ name?: string;
81
+ config?: LH.Config;
82
+ gatherStepRunnerOptions?: GatherStepRunnerOptions;
83
+ }): Promise<{
84
+ steps: LH.FlowResult.Step[];
85
+ name: string;
86
+ }>;
87
+ /**
88
+ * @param {LH.UserFlow.StepFlags|undefined} flags
89
+ * @param {LH.Artifacts} artifacts
90
+ * @return {string}
91
+ */
92
+ export function getStepName(flags: LH.UserFlow.StepFlags | undefined, artifacts: LH.Artifacts): string;
93
+ /**
94
+ * @param {string|undefined} name
95
+ * @param {LH.UserFlow.GatherStep[]} gatherSteps
96
+ * @return {string}
97
+ */
98
+ export function getFlowName(name: string | undefined, gatherSteps: LH.UserFlow.GatherStep[]): string;
99
+ export namespace UIStrings {
100
+ const defaultFlowName: string;
101
+ const defaultNavigationName: string;
102
+ const defaultTimespanName: string;
103
+ const defaultSnapshotName: string;
104
+ }
105
+ import * as LH from "../types/lh.js";
106
+ //# sourceMappingURL=user-flow.d.ts.map
package/core/user-flow.js CHANGED
@@ -13,6 +13,7 @@ import {initializeConfig} from './config/config.js';
13
13
  import {getFormatted} from '../shared/localization/format.js';
14
14
  import {mergeConfigFragment, deepClone} from './config/config-helpers.js';
15
15
  import * as i18n from './lib/i18n/i18n.js';
16
+ import * as LH from '../types/lh.js';
16
17
 
17
18
  /** @typedef {WeakMap<LH.UserFlow.GatherStep, LH.Gatherer.FRGatherResult['runnerOptions']>} GatherStepRunnerOptions */
18
19
 
@@ -0,0 +1,230 @@
1
+ export type I18n<T> = any;
2
+ export class Util {
3
+ /** @type {I18n<typeof UIStrings>} */
4
+ static i18n: any;
5
+ static get PASS_THRESHOLD(): number;
6
+ static get MS_DISPLAY_VALUE(): string;
7
+ /**
8
+ * If LHR is older than 10.0 it will not have the `finalDisplayedUrl` property.
9
+ * Old LHRs should have the `finalUrl` property which will work fine for the report.
10
+ *
11
+ * @param {LH.Result} lhr
12
+ */
13
+ static getFinalDisplayedUrl(lhr: LH.Result): string;
14
+ /**
15
+ * If LHR is older than 10.0 it will not have the `mainDocumentUrl` property.
16
+ * Old LHRs should have the `finalUrl` property which is the same as `mainDocumentUrl`.
17
+ *
18
+ * @param {LH.Result} lhr
19
+ */
20
+ static getMainDocumentUrl(lhr: LH.Result): string | undefined;
21
+ /**
22
+ * Returns a new LHR that's reshaped for slightly better ergonomics within the report rendereer.
23
+ * Also, sets up the localized UI strings used within renderer and makes changes to old LHRs to be
24
+ * compatible with current renderer.
25
+ * The LHR passed in is not mutated.
26
+ * TODO(team): we all agree the LHR shape change is technical debt we should fix
27
+ * @param {LH.Result} result
28
+ * @return {LH.ReportResult}
29
+ */
30
+ static prepareReportResult(result: LH.Result): LH.ReportResult;
31
+ /**
32
+ * @param {LH.Result} lhr
33
+ * @return {LH.Result.FullPageScreenshot=}
34
+ */
35
+ static getFullPageScreenshot(lhr: LH.Result): LH.Result.FullPageScreenshot | undefined;
36
+ /**
37
+ * Used to determine if the "passed" for the purposes of showing up in the "failed" or "passed"
38
+ * sections of the report.
39
+ *
40
+ * @param {{score: (number|null), scoreDisplayMode: string}} audit
41
+ * @return {boolean}
42
+ */
43
+ static showAsPassed(audit: {
44
+ score: (number | null);
45
+ scoreDisplayMode: string;
46
+ }): boolean;
47
+ /**
48
+ * Convert a score to a rating label.
49
+ * TODO: Return `'error'` for `score === null && !scoreDisplayMode`.
50
+ *
51
+ * @param {number|null} score
52
+ * @param {string=} scoreDisplayMode
53
+ * @return {string}
54
+ */
55
+ static calculateRating(score: number | null, scoreDisplayMode?: string | undefined): string;
56
+ /**
57
+ * Split a string by markdown code spans (enclosed in `backticks`), splitting
58
+ * into segments that were enclosed in backticks (marked as `isCode === true`)
59
+ * and those that outside the backticks (`isCode === false`).
60
+ * @param {string} text
61
+ * @return {Array<{isCode: true, text: string}|{isCode: false, text: string}>}
62
+ */
63
+ static splitMarkdownCodeSpans(text: string): Array<{
64
+ isCode: true;
65
+ text: string;
66
+ } | {
67
+ isCode: false;
68
+ text: string;
69
+ }>;
70
+ /**
71
+ * Split a string on markdown links (e.g. [some link](https://...)) into
72
+ * segments of plain text that weren't part of a link (marked as
73
+ * `isLink === false`), and segments with text content and a URL that did make
74
+ * up a link (marked as `isLink === true`).
75
+ * @param {string} text
76
+ * @return {Array<{isLink: true, text: string, linkHref: string}|{isLink: false, text: string}>}
77
+ */
78
+ static splitMarkdownLink(text: string): Array<{
79
+ isLink: true;
80
+ text: string;
81
+ linkHref: string;
82
+ } | {
83
+ isLink: false;
84
+ text: string;
85
+ }>;
86
+ /**
87
+ * @param {URL} parsedUrl
88
+ * @param {{numPathParts?: number, preserveQuery?: boolean, preserveHost?: boolean}=} options
89
+ * @return {string}
90
+ */
91
+ static getURLDisplayName(parsedUrl: URL, options?: {
92
+ numPathParts?: number | undefined;
93
+ preserveQuery?: boolean | undefined;
94
+ preserveHost?: boolean | undefined;
95
+ } | undefined): string;
96
+ /**
97
+ * Split a URL into a file, hostname and origin for easy display.
98
+ * @param {string} url
99
+ * @return {{file: string, hostname: string, origin: string}}
100
+ */
101
+ static parseURL(url: string): {
102
+ file: string;
103
+ hostname: string;
104
+ origin: string;
105
+ };
106
+ /**
107
+ * @param {string|URL} value
108
+ * @return {!URL}
109
+ */
110
+ static createOrReturnURL(value: string | URL): URL;
111
+ /**
112
+ * Gets the tld of a domain
113
+ *
114
+ * @param {string} hostname
115
+ * @return {string} tld
116
+ */
117
+ static getTld(hostname: string): string;
118
+ /**
119
+ * Returns a primary domain for provided hostname (e.g. www.example.com -> example.com).
120
+ * @param {string|URL} url hostname or URL object
121
+ * @return {string}
122
+ */
123
+ static getRootDomain(url: string | URL): string;
124
+ /**
125
+ * @param {LH.Result['configSettings']} settings
126
+ * @return {!{deviceEmulation: string, screenEmulation?: string, networkThrottling: string, cpuThrottling: string, summary: string}}
127
+ */
128
+ static getEmulationDescriptions(settings: LH.Result['configSettings']): {
129
+ deviceEmulation: string;
130
+ screenEmulation?: string | undefined;
131
+ networkThrottling: string;
132
+ cpuThrottling: string;
133
+ summary: string;
134
+ };
135
+ /**
136
+ * Returns only lines that are near a message, or the first few lines if there are
137
+ * no line messages.
138
+ * @param {LH.Audit.Details.SnippetValue['lines']} lines
139
+ * @param {LH.Audit.Details.SnippetValue['lineMessages']} lineMessages
140
+ * @param {number} surroundingLineCount Number of lines to include before and after
141
+ * the message. If this is e.g. 2 this function might return 5 lines.
142
+ */
143
+ static filterRelevantLines(lines: LH.Audit.Details.SnippetValue['lines'], lineMessages: LH.Audit.Details.SnippetValue['lineMessages'], surroundingLineCount: number): {
144
+ content: string;
145
+ lineNumber: number;
146
+ truncated?: boolean | undefined;
147
+ }[];
148
+ /**
149
+ * @param {string} categoryId
150
+ */
151
+ static isPluginCategory(categoryId: string): boolean;
152
+ /**
153
+ * @param {LH.Result.GatherMode} gatherMode
154
+ */
155
+ static shouldDisplayAsFraction(gatherMode: LH.Result.GatherMode): boolean;
156
+ /**
157
+ * @param {LH.ReportResult.Category} category
158
+ */
159
+ static calculateCategoryFraction(category: LH.ReportResult.Category): {
160
+ numPassed: number;
161
+ numPassableAudits: number;
162
+ numInformative: number;
163
+ totalWeight: number;
164
+ };
165
+ }
166
+ export namespace Util {
167
+ export const reportJson: LH.ReportResult | null;
168
+ /**
169
+ * An always-increasing counter for making unique SVG ID suffixes.
170
+ */
171
+ export function getUniqueSuffix(): number;
172
+ export function resetUniqueSuffix(): void;
173
+ export { UIStrings };
174
+ }
175
+ export namespace UIStrings {
176
+ const varianceDisclaimer: string;
177
+ const calculatorLink: string;
178
+ const showRelevantAudits: string;
179
+ const opportunityResourceColumnLabel: string;
180
+ const opportunitySavingsColumnLabel: string;
181
+ const errorMissingAuditInfo: string;
182
+ const errorLabel: string;
183
+ const warningHeader: string;
184
+ const warningAuditsGroupTitle: string;
185
+ const passedAuditsGroupTitle: string;
186
+ const notApplicableAuditsGroupTitle: string;
187
+ const manualAuditsGroupTitle: string;
188
+ const toplevelWarningsMessage: string;
189
+ const crcInitialNavigation: string;
190
+ const crcLongestDurationLabel: string;
191
+ const snippetExpandButtonLabel: string;
192
+ const snippetCollapseButtonLabel: string;
193
+ const lsPerformanceCategoryDescription: string;
194
+ const labDataTitle: string;
195
+ const thirdPartyResourcesLabel: string;
196
+ const viewTreemapLabel: string;
197
+ const viewTraceLabel: string;
198
+ const viewOriginalTraceLabel: string;
199
+ const dropdownPrintSummary: string;
200
+ const dropdownPrintExpanded: string;
201
+ const dropdownCopyJSON: string;
202
+ const dropdownSaveHTML: string;
203
+ const dropdownSaveJSON: string;
204
+ const dropdownViewer: string;
205
+ const dropdownSaveGist: string;
206
+ const dropdownDarkTheme: string;
207
+ const runtimeSettingsDevice: string;
208
+ const runtimeSettingsNetworkThrottling: string;
209
+ const runtimeSettingsCPUThrottling: string;
210
+ const runtimeSettingsUANetwork: string;
211
+ const runtimeSettingsBenchmark: string;
212
+ const runtimeSettingsAxeVersion: string;
213
+ const runtimeSettingsScreenEmulation: string;
214
+ const footerIssue: string;
215
+ const runtimeNoEmulation: string;
216
+ const runtimeMobileEmulation: string;
217
+ const runtimeDesktopEmulation: string;
218
+ const runtimeUnknown: string;
219
+ const runtimeSingleLoad: string;
220
+ const runtimeAnalysisWindow: string;
221
+ const runtimeSingleLoadTooltip: string;
222
+ const throttlingProvided: string;
223
+ const show: string;
224
+ const hide: string;
225
+ const expandView: string;
226
+ const collapseView: string;
227
+ const runtimeSlow4g: string;
228
+ const runtimeCustom: string;
229
+ }
230
+ //# sourceMappingURL=util.d.cts.map
@@ -3840,8 +3840,10 @@ class PerformanceCategoryRenderer extends CategoryRenderer {
3840
3840
  _getScoringCalculatorHref(auditRefs) {
3841
3841
  // TODO: filter by !!acronym when dropping renderer support of v7 LHRs.
3842
3842
  const metrics = auditRefs.filter(audit => audit.group === 'metrics');
3843
+ const tti = auditRefs.find(audit => audit.id === 'interactive');
3843
3844
  const fci = auditRefs.find(audit => audit.id === 'first-cpu-idle');
3844
3845
  const fmp = auditRefs.find(audit => audit.id === 'first-meaningful-paint');
3846
+ if (tti) metrics.push(tti);
3845
3847
  if (fci) metrics.push(fci);
3846
3848
  if (fmp) metrics.push(fmp);
3847
3849
 
@@ -117,7 +117,7 @@ class Ca{constructor(e,a){this._document=e,this._lighthouseChannel="unknown",thi
117
117
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
118
118
  * See the License for the specific language governing permissions and
119
119
  * limitations under the License.
120
- */class La extends wa{_renderMetric(e){const a=this.dom.createComponent("metric"),n=this.dom.find(".lh-metric",a);n.id=e.result.id;const t=de.calculateRating(e.result.score,e.result.scoreDisplayMode);n.classList.add(`lh-metric--${t}`);this.dom.find(".lh-metric__title",a).textContent=e.result.title;const i=this.dom.find(".lh-metric__value",a);i.textContent=e.result.displayValue||"";const o=this.dom.find(".lh-metric__description",a);if(o.append(this.dom.convertMarkdownLinkSnippets(e.result.description)),"error"===e.result.scoreDisplayMode){o.textContent="",i.textContent="Error!";this.dom.createChildOf(o,"span").textContent=e.result.errorMessage||"Report error: no metric information"}else"notApplicable"===e.result.scoreDisplayMode&&(i.textContent="--");return n}_renderOpportunity(e,a){const n=this.dom.createComponent("opportunity"),t=this.populateAuditValues(e,n);if(t.id=e.result.id,!e.result.details||"error"===e.result.scoreDisplayMode)return t;const i=e.result.details;if("opportunity"!==i.type)return t;const o=this.dom.find("span.lh-audit__display-text, div.lh-audit__display-text",t),r=i.overallSavingsMs/a*100+"%";if(this.dom.find("div.lh-sparkline__bar",t).style.width=r,o.textContent=de.i18n.formatSeconds(i.overallSavingsMs,.01),e.result.displayValue){const a=e.result.displayValue;this.dom.find("div.lh-load-opportunity__sparkline",t).title=a,o.title=a}return t}_getWastedMs(e){if(e.result.details&&"opportunity"===e.result.details.type){const a=e.result.details;if("number"!=typeof a.overallSavingsMs)throw new Error("non-opportunity details passed to _getWastedMs");return a.overallSavingsMs}return Number.MIN_VALUE}_getScoringCalculatorHref(e){const a=e.filter((e=>"metrics"===e.group)),n=e.find((e=>"first-cpu-idle"===e.id)),t=e.find((e=>"first-meaningful-paint"===e.id));n&&a.push(n),t&&a.push(t);const i=[...a.map((e=>{let a;var n;return"number"==typeof e.result.numericValue?(a="cumulative-layout-shift"===e.id?(n=e.result.numericValue,Math.round(100*n)/100):Math.round(e.result.numericValue),a=a.toString()):a="null",[e.acronym||e.id,a]}))];de.reportJson&&(i.push(["device",de.reportJson.configSettings.formFactor]),i.push(["version",de.reportJson.lighthouseVersion]));const o=new URLSearchParams(i),r=new URL("https://googlechrome.github.io/lighthouse/scorecalc/");return r.hash=o.toString(),r.href}_classifyPerformanceAudit(e){return e.group?null:e.result.details&&"opportunity"===e.result.details.type?"load-opportunity":"diagnostic"}render(e,a,n){const t=de.i18n.strings,i=this.dom.createElement("div","lh-category");i.id=e.id,i.append(this.renderCategoryHeader(e,a,n));const o=e.auditRefs.filter((e=>"metrics"===e.group));if(o.length){const[n,r]=this.renderAuditGroup(a.metrics),s=this.dom.createElement("input","lh-metrics-toggle__input"),l=`lh-metrics-toggle${de.getUniqueSuffix()}`;s.setAttribute("aria-label","Toggle the display of metric descriptions"),s.type="checkbox",s.id=l,n.prepend(s);const p=this.dom.find(".lh-audit-group__header",n),u=this.dom.createChildOf(p,"label","lh-metrics-toggle__label");u.htmlFor=l;const c=this.dom.createChildOf(u,"span","lh-metrics-toggle__labeltext--show"),d=this.dom.createChildOf(u,"span","lh-metrics-toggle__labeltext--hide");c.textContent=de.i18n.strings.expandView,d.textContent=de.i18n.strings.collapseView;const m=this.dom.createElement("div","lh-metrics-container");if(n.insertBefore(m,r),o.forEach((e=>{m.append(this._renderMetric(e))})),i.querySelector(".lh-gauge__wrapper")){const a=this.dom.find(".lh-category-header__description",i),n=this.dom.createChildOf(a,"div","lh-metrics__disclaimer"),o=this.dom.convertMarkdownLinkSnippets(t.varianceDisclaimer);n.append(o);const r=this.dom.createChildOf(n,"a","lh-calclink");r.target="_blank",r.textContent=t.calculatorLink,this.dom.safelySetHref(r,this._getScoringCalculatorHref(e.auditRefs))}n.classList.add("lh-audit-group--metrics"),i.append(n)}const r=this.dom.createChildOf(i,"div","lh-filmstrip-container"),s=e.auditRefs.find((e=>"screenshot-thumbnails"===e.id))?.result;if(s?.details){r.id=s.id;const e=this.detailsRenderer.render(s.details);e&&r.append(e)}const l=e.auditRefs.filter((e=>"load-opportunity"===this._classifyPerformanceAudit(e))).filter((e=>!de.showAsPassed(e.result))).sort(((e,a)=>this._getWastedMs(a)-this._getWastedMs(e))),p=o.filter((e=>!!e.relevantAudits));if(p.length&&this.renderMetricAuditFilter(p,i),l.length){const e=2e3,n=l.map((e=>this._getWastedMs(e))),o=Math.max(...n),r=Math.max(1e3*Math.ceil(o/1e3),e),[s,p]=this.renderAuditGroup(a["load-opportunities"]),u=this.dom.createComponent("opportunityHeader");this.dom.find(".lh-load-opportunity__col--one",u).textContent=t.opportunityResourceColumnLabel,this.dom.find(".lh-load-opportunity__col--two",u).textContent=t.opportunitySavingsColumnLabel;const c=this.dom.find(".lh-load-opportunity__header",u);s.insertBefore(c,p),l.forEach((e=>s.insertBefore(this._renderOpportunity(e,r),p))),s.classList.add("lh-audit-group--load-opportunities"),i.append(s)}const u=e.auditRefs.filter((e=>"diagnostic"===this._classifyPerformanceAudit(e))).filter((e=>!de.showAsPassed(e.result))).sort(((e,a)=>("informative"===e.result.scoreDisplayMode?100:Number(e.result.score))-("informative"===a.result.scoreDisplayMode?100:Number(a.result.score))));if(u.length){const[e,n]=this.renderAuditGroup(a.diagnostics);u.forEach((a=>e.insertBefore(this.renderAudit(a),n))),e.classList.add("lh-audit-group--diagnostics"),i.append(e)}const c=e.auditRefs.filter((e=>this._classifyPerformanceAudit(e)&&de.showAsPassed(e.result)));if(!c.length)return i;const d={auditRefs:c,groupDefinitions:a},m=this.renderClump("passed",d);i.append(m);const h=[];if(["performance-budget","timing-budget"].forEach((a=>{const n=e.auditRefs.find((e=>e.id===a));if(n?.result.details){const e=this.detailsRenderer.render(n.result.details);e&&(e.id=a,e.classList.add("lh-details","lh-details--budget","lh-audit"),h.push(e))}})),h.length>0){const[e,n]=this.renderAuditGroup(a.budgets);h.forEach((a=>e.insertBefore(a,n))),e.classList.add("lh-audit-group--budgets"),i.append(e)}return i}renderMetricAuditFilter(e,a){const n=this.dom.createElement("div","lh-metricfilter");this.dom.createChildOf(n,"span","lh-metricfilter__text").textContent=de.i18n.strings.showRelevantAudits;const t=[{acronym:"All"},...e],i=de.getUniqueSuffix();for(const e of t){const t=`metric-${e.acronym}-${i}`,o=this.dom.createChildOf(n,"input","lh-metricfilter__radio");o.type="radio",o.name=`metricsfilter-${i}`,o.id=t;const r=this.dom.createChildOf(n,"label","lh-metricfilter__label");r.htmlFor=t,r.title=e.result?.title,r.textContent=e.acronym||e.id,"All"===e.acronym&&(o.checked=!0,r.classList.add("lh-metricfilter__label--active")),a.append(n),o.addEventListener("input",(n=>{for(const e of a.querySelectorAll("label.lh-metricfilter__label"))e.classList.toggle("lh-metricfilter__label--active",e.htmlFor===t);a.classList.toggle("lh-category--filtered","All"!==e.acronym);for(const n of a.querySelectorAll("div.lh-audit"))"All"!==e.acronym?(n.hidden=!0,e.relevantAudits&&e.relevantAudits.includes(n.id)&&(n.hidden=!1)):n.hidden=!1;const i=a.querySelectorAll("div.lh-audit-group, details.lh-audit-group");for(const e of i){e.hidden=!1;const a=Array.from(e.querySelectorAll("div.lh-audit")),n=!!a.length&&a.every((e=>e.hidden));e.hidden=n}}))}}}
120
+ */class La extends wa{_renderMetric(e){const a=this.dom.createComponent("metric"),n=this.dom.find(".lh-metric",a);n.id=e.result.id;const t=de.calculateRating(e.result.score,e.result.scoreDisplayMode);n.classList.add(`lh-metric--${t}`);this.dom.find(".lh-metric__title",a).textContent=e.result.title;const i=this.dom.find(".lh-metric__value",a);i.textContent=e.result.displayValue||"";const o=this.dom.find(".lh-metric__description",a);if(o.append(this.dom.convertMarkdownLinkSnippets(e.result.description)),"error"===e.result.scoreDisplayMode){o.textContent="",i.textContent="Error!";this.dom.createChildOf(o,"span").textContent=e.result.errorMessage||"Report error: no metric information"}else"notApplicable"===e.result.scoreDisplayMode&&(i.textContent="--");return n}_renderOpportunity(e,a){const n=this.dom.createComponent("opportunity"),t=this.populateAuditValues(e,n);if(t.id=e.result.id,!e.result.details||"error"===e.result.scoreDisplayMode)return t;const i=e.result.details;if("opportunity"!==i.type)return t;const o=this.dom.find("span.lh-audit__display-text, div.lh-audit__display-text",t),r=i.overallSavingsMs/a*100+"%";if(this.dom.find("div.lh-sparkline__bar",t).style.width=r,o.textContent=de.i18n.formatSeconds(i.overallSavingsMs,.01),e.result.displayValue){const a=e.result.displayValue;this.dom.find("div.lh-load-opportunity__sparkline",t).title=a,o.title=a}return t}_getWastedMs(e){if(e.result.details&&"opportunity"===e.result.details.type){const a=e.result.details;if("number"!=typeof a.overallSavingsMs)throw new Error("non-opportunity details passed to _getWastedMs");return a.overallSavingsMs}return Number.MIN_VALUE}_getScoringCalculatorHref(e){const a=e.filter((e=>"metrics"===e.group)),n=e.find((e=>"interactive"===e.id)),t=e.find((e=>"first-cpu-idle"===e.id)),i=e.find((e=>"first-meaningful-paint"===e.id));n&&a.push(n),t&&a.push(t),i&&a.push(i);const o=[...a.map((e=>{let a;var n;return"number"==typeof e.result.numericValue?(a="cumulative-layout-shift"===e.id?(n=e.result.numericValue,Math.round(100*n)/100):Math.round(e.result.numericValue),a=a.toString()):a="null",[e.acronym||e.id,a]}))];de.reportJson&&(o.push(["device",de.reportJson.configSettings.formFactor]),o.push(["version",de.reportJson.lighthouseVersion]));const r=new URLSearchParams(o),s=new URL("https://googlechrome.github.io/lighthouse/scorecalc/");return s.hash=r.toString(),s.href}_classifyPerformanceAudit(e){return e.group?null:e.result.details&&"opportunity"===e.result.details.type?"load-opportunity":"diagnostic"}render(e,a,n){const t=de.i18n.strings,i=this.dom.createElement("div","lh-category");i.id=e.id,i.append(this.renderCategoryHeader(e,a,n));const o=e.auditRefs.filter((e=>"metrics"===e.group));if(o.length){const[n,r]=this.renderAuditGroup(a.metrics),s=this.dom.createElement("input","lh-metrics-toggle__input"),l=`lh-metrics-toggle${de.getUniqueSuffix()}`;s.setAttribute("aria-label","Toggle the display of metric descriptions"),s.type="checkbox",s.id=l,n.prepend(s);const p=this.dom.find(".lh-audit-group__header",n),u=this.dom.createChildOf(p,"label","lh-metrics-toggle__label");u.htmlFor=l;const c=this.dom.createChildOf(u,"span","lh-metrics-toggle__labeltext--show"),d=this.dom.createChildOf(u,"span","lh-metrics-toggle__labeltext--hide");c.textContent=de.i18n.strings.expandView,d.textContent=de.i18n.strings.collapseView;const m=this.dom.createElement("div","lh-metrics-container");if(n.insertBefore(m,r),o.forEach((e=>{m.append(this._renderMetric(e))})),i.querySelector(".lh-gauge__wrapper")){const a=this.dom.find(".lh-category-header__description",i),n=this.dom.createChildOf(a,"div","lh-metrics__disclaimer"),o=this.dom.convertMarkdownLinkSnippets(t.varianceDisclaimer);n.append(o);const r=this.dom.createChildOf(n,"a","lh-calclink");r.target="_blank",r.textContent=t.calculatorLink,this.dom.safelySetHref(r,this._getScoringCalculatorHref(e.auditRefs))}n.classList.add("lh-audit-group--metrics"),i.append(n)}const r=this.dom.createChildOf(i,"div","lh-filmstrip-container"),s=e.auditRefs.find((e=>"screenshot-thumbnails"===e.id))?.result;if(s?.details){r.id=s.id;const e=this.detailsRenderer.render(s.details);e&&r.append(e)}const l=e.auditRefs.filter((e=>"load-opportunity"===this._classifyPerformanceAudit(e))).filter((e=>!de.showAsPassed(e.result))).sort(((e,a)=>this._getWastedMs(a)-this._getWastedMs(e))),p=o.filter((e=>!!e.relevantAudits));if(p.length&&this.renderMetricAuditFilter(p,i),l.length){const e=2e3,n=l.map((e=>this._getWastedMs(e))),o=Math.max(...n),r=Math.max(1e3*Math.ceil(o/1e3),e),[s,p]=this.renderAuditGroup(a["load-opportunities"]),u=this.dom.createComponent("opportunityHeader");this.dom.find(".lh-load-opportunity__col--one",u).textContent=t.opportunityResourceColumnLabel,this.dom.find(".lh-load-opportunity__col--two",u).textContent=t.opportunitySavingsColumnLabel;const c=this.dom.find(".lh-load-opportunity__header",u);s.insertBefore(c,p),l.forEach((e=>s.insertBefore(this._renderOpportunity(e,r),p))),s.classList.add("lh-audit-group--load-opportunities"),i.append(s)}const u=e.auditRefs.filter((e=>"diagnostic"===this._classifyPerformanceAudit(e))).filter((e=>!de.showAsPassed(e.result))).sort(((e,a)=>("informative"===e.result.scoreDisplayMode?100:Number(e.result.score))-("informative"===a.result.scoreDisplayMode?100:Number(a.result.score))));if(u.length){const[e,n]=this.renderAuditGroup(a.diagnostics);u.forEach((a=>e.insertBefore(this.renderAudit(a),n))),e.classList.add("lh-audit-group--diagnostics"),i.append(e)}const c=e.auditRefs.filter((e=>this._classifyPerformanceAudit(e)&&de.showAsPassed(e.result)));if(!c.length)return i;const d={auditRefs:c,groupDefinitions:a},m=this.renderClump("passed",d);i.append(m);const h=[];if(["performance-budget","timing-budget"].forEach((a=>{const n=e.auditRefs.find((e=>e.id===a));if(n?.result.details){const e=this.detailsRenderer.render(n.result.details);e&&(e.id=a,e.classList.add("lh-details","lh-details--budget","lh-audit"),h.push(e))}})),h.length>0){const[e,n]=this.renderAuditGroup(a.budgets);h.forEach((a=>e.insertBefore(a,n))),e.classList.add("lh-audit-group--budgets"),i.append(e)}return i}renderMetricAuditFilter(e,a){const n=this.dom.createElement("div","lh-metricfilter");this.dom.createChildOf(n,"span","lh-metricfilter__text").textContent=de.i18n.strings.showRelevantAudits;const t=[{acronym:"All"},...e],i=de.getUniqueSuffix();for(const e of t){const t=`metric-${e.acronym}-${i}`,o=this.dom.createChildOf(n,"input","lh-metricfilter__radio");o.type="radio",o.name=`metricsfilter-${i}`,o.id=t;const r=this.dom.createChildOf(n,"label","lh-metricfilter__label");r.htmlFor=t,r.title=e.result?.title,r.textContent=e.acronym||e.id,"All"===e.acronym&&(o.checked=!0,r.classList.add("lh-metricfilter__label--active")),a.append(n),o.addEventListener("input",(n=>{for(const e of a.querySelectorAll("label.lh-metricfilter__label"))e.classList.toggle("lh-metricfilter__label--active",e.htmlFor===t);a.classList.toggle("lh-category--filtered","All"!==e.acronym);for(const n of a.querySelectorAll("div.lh-audit"))"All"!==e.acronym?(n.hidden=!0,e.relevantAudits&&e.relevantAudits.includes(n.id)&&(n.hidden=!1)):n.hidden=!1;const i=a.querySelectorAll("div.lh-audit-group, details.lh-audit-group");for(const e of i){e.hidden=!1;const a=Array.from(e.querySelectorAll("div.lh-audit")),n=!!a.length&&a.every((e=>e.hidden));e.hidden=n}}))}}}
121
121
  /**
122
122
  * @license
123
123
  * Copyright 2018 The Lighthouse Authors. All Rights Reserved.