lighthouse 10.1.1 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/cli-flags.d.ts +1 -1
- package/cli/test/smokehouse/lighthouse-runners/cli.d.ts +1 -1
- package/cli/test/smokehouse/report-assert.d.ts +1 -1
- package/core/audits/accessibility/accesskeys.d.ts +1 -1
- package/core/audits/accessibility/accesskeys.js +1 -1
- package/core/audits/accessibility/aria-allowed-attr.d.ts +1 -1
- package/core/audits/accessibility/aria-allowed-attr.js +1 -1
- package/core/audits/accessibility/aria-command-name.d.ts +1 -1
- package/core/audits/accessibility/aria-command-name.js +1 -1
- package/core/audits/accessibility/aria-hidden-body.d.ts +1 -1
- package/core/audits/accessibility/aria-hidden-body.js +1 -1
- package/core/audits/accessibility/aria-hidden-focus.d.ts +1 -1
- package/core/audits/accessibility/aria-hidden-focus.js +1 -1
- package/core/audits/accessibility/aria-input-field-name.d.ts +1 -1
- package/core/audits/accessibility/aria-input-field-name.js +1 -1
- package/core/audits/accessibility/aria-meter-name.d.ts +1 -1
- package/core/audits/accessibility/aria-meter-name.js +1 -1
- package/core/audits/accessibility/aria-progressbar-name.d.ts +1 -1
- package/core/audits/accessibility/aria-progressbar-name.js +1 -1
- package/core/audits/accessibility/aria-required-attr.d.ts +1 -1
- package/core/audits/accessibility/aria-required-attr.js +1 -1
- package/core/audits/accessibility/aria-required-children.d.ts +1 -1
- package/core/audits/accessibility/aria-required-children.js +1 -1
- package/core/audits/accessibility/aria-required-parent.d.ts +1 -1
- package/core/audits/accessibility/aria-required-parent.js +1 -1
- package/core/audits/accessibility/aria-roles.d.ts +1 -1
- package/core/audits/accessibility/aria-roles.js +1 -1
- package/core/audits/accessibility/aria-toggle-field-name.d.ts +1 -1
- package/core/audits/accessibility/aria-toggle-field-name.js +1 -1
- package/core/audits/accessibility/aria-tooltip-name.d.ts +1 -1
- package/core/audits/accessibility/aria-tooltip-name.js +1 -1
- package/core/audits/accessibility/aria-treeitem-name.d.ts +1 -1
- package/core/audits/accessibility/aria-treeitem-name.js +1 -1
- package/core/audits/accessibility/aria-valid-attr-value.d.ts +1 -1
- package/core/audits/accessibility/aria-valid-attr-value.js +1 -1
- package/core/audits/accessibility/aria-valid-attr.d.ts +1 -1
- package/core/audits/accessibility/aria-valid-attr.js +1 -1
- package/core/audits/accessibility/axe-audit.d.ts +1 -1
- package/core/audits/accessibility/button-name.d.ts +1 -1
- package/core/audits/accessibility/button-name.js +1 -1
- package/core/audits/accessibility/bypass.d.ts +1 -1
- package/core/audits/accessibility/bypass.js +1 -1
- package/core/audits/accessibility/color-contrast.d.ts +1 -1
- package/core/audits/accessibility/color-contrast.js +1 -1
- package/core/audits/accessibility/definition-list.d.ts +1 -1
- package/core/audits/accessibility/definition-list.js +1 -1
- package/core/audits/accessibility/dlitem.d.ts +1 -1
- package/core/audits/accessibility/dlitem.js +1 -1
- package/core/audits/accessibility/document-title.d.ts +1 -1
- package/core/audits/accessibility/document-title.js +1 -1
- package/core/audits/accessibility/duplicate-id-active.d.ts +1 -1
- package/core/audits/accessibility/duplicate-id-active.js +1 -1
- package/core/audits/accessibility/duplicate-id-aria.d.ts +1 -1
- package/core/audits/accessibility/duplicate-id-aria.js +1 -1
- package/core/audits/accessibility/form-field-multiple-labels.d.ts +1 -1
- package/core/audits/accessibility/form-field-multiple-labels.js +1 -1
- package/core/audits/accessibility/frame-title.d.ts +1 -1
- package/core/audits/accessibility/frame-title.js +1 -1
- package/core/audits/accessibility/heading-order.d.ts +1 -1
- package/core/audits/accessibility/heading-order.js +1 -1
- package/core/audits/accessibility/html-has-lang.d.ts +1 -1
- package/core/audits/accessibility/html-has-lang.js +1 -1
- package/core/audits/accessibility/html-lang-valid.d.ts +1 -1
- package/core/audits/accessibility/html-lang-valid.js +1 -1
- package/core/audits/accessibility/image-alt.d.ts +1 -1
- package/core/audits/accessibility/image-alt.js +1 -1
- package/core/audits/accessibility/input-image-alt.d.ts +1 -1
- package/core/audits/accessibility/input-image-alt.js +1 -1
- package/core/audits/accessibility/label.d.ts +1 -1
- package/core/audits/accessibility/label.js +1 -1
- package/core/audits/accessibility/link-name.d.ts +1 -1
- package/core/audits/accessibility/link-name.js +1 -1
- package/core/audits/accessibility/list.d.ts +1 -1
- package/core/audits/accessibility/list.js +1 -1
- package/core/audits/accessibility/listitem.d.ts +1 -1
- package/core/audits/accessibility/listitem.js +1 -1
- package/core/audits/accessibility/manual/custom-controls-labels.d.ts +1 -1
- package/core/audits/accessibility/manual/custom-controls-roles.d.ts +1 -1
- package/core/audits/accessibility/manual/focus-traps.d.ts +1 -1
- package/core/audits/accessibility/manual/focusable-controls.d.ts +1 -1
- package/core/audits/accessibility/manual/interactive-element-affordance.d.ts +1 -1
- package/core/audits/accessibility/manual/logical-tab-order.d.ts +1 -1
- package/core/audits/accessibility/manual/managed-focus.d.ts +1 -1
- package/core/audits/accessibility/manual/offscreen-content-hidden.d.ts +1 -1
- package/core/audits/accessibility/manual/use-landmarks.d.ts +1 -1
- package/core/audits/accessibility/manual/visual-order-follows-dom.d.ts +1 -1
- package/core/audits/accessibility/meta-refresh.d.ts +1 -1
- package/core/audits/accessibility/meta-refresh.js +1 -1
- package/core/audits/accessibility/meta-viewport.d.ts +1 -1
- package/core/audits/accessibility/meta-viewport.js +1 -1
- package/core/audits/accessibility/object-alt.d.ts +1 -1
- package/core/audits/accessibility/object-alt.js +1 -1
- package/core/audits/accessibility/tabindex.d.ts +1 -1
- package/core/audits/accessibility/tabindex.js +1 -1
- package/core/audits/accessibility/td-headers-attr.d.ts +1 -1
- package/core/audits/accessibility/td-headers-attr.js +1 -1
- package/core/audits/accessibility/th-has-data-cells.d.ts +1 -1
- package/core/audits/accessibility/th-has-data-cells.js +1 -1
- package/core/audits/accessibility/valid-lang.d.ts +1 -1
- package/core/audits/accessibility/valid-lang.js +1 -1
- package/core/audits/accessibility/video-caption.d.ts +1 -1
- package/core/audits/accessibility/video-caption.js +1 -1
- package/core/audits/audit.d.ts +1 -1
- package/core/audits/autocomplete.d.ts +1 -1
- package/core/audits/bf-cache.d.ts +1 -1
- package/core/audits/bootup-time.d.ts +1 -1
- package/core/audits/byte-efficiency/byte-efficiency-audit.d.ts +1 -1
- package/core/audits/byte-efficiency/duplicated-javascript.d.ts +1 -1
- package/core/audits/byte-efficiency/efficient-animated-content.d.ts +2 -2
- package/core/audits/byte-efficiency/legacy-javascript.d.ts +2 -2
- package/core/audits/byte-efficiency/modern-image-formats.d.ts +1 -1
- package/core/audits/byte-efficiency/offscreen-images.d.ts +2 -2
- package/core/audits/byte-efficiency/render-blocking-resources.d.ts +1 -1
- package/core/audits/byte-efficiency/total-byte-weight.d.ts +1 -1
- package/core/audits/byte-efficiency/unminified-css.d.ts +1 -1
- package/core/audits/byte-efficiency/unminified-javascript.d.ts +1 -1
- package/core/audits/byte-efficiency/unused-css-rules.d.ts +1 -1
- package/core/audits/byte-efficiency/unused-javascript.d.ts +1 -1
- package/core/audits/byte-efficiency/uses-long-cache-ttl.d.ts +3 -3
- package/core/audits/byte-efficiency/uses-optimized-images.d.ts +1 -1
- package/core/audits/byte-efficiency/uses-responsive-images-snapshot.d.ts +1 -1
- package/core/audits/byte-efficiency/uses-responsive-images.d.ts +2 -2
- package/core/audits/byte-efficiency/uses-text-compression.d.ts +1 -1
- package/core/audits/content-width.d.ts +1 -1
- package/core/audits/critical-request-chains.d.ts +1 -1
- package/core/audits/csp-xss.d.ts +1 -1
- package/core/audits/deprecations.d.ts +1 -1
- package/core/audits/diagnostics.d.ts +1 -1
- package/core/audits/dobetterweb/charset.d.ts +1 -1
- package/core/audits/dobetterweb/doctype.d.ts +1 -1
- package/core/audits/dobetterweb/dom-size.d.ts +1 -1
- package/core/audits/dobetterweb/geolocation-on-start.d.ts +1 -1
- package/core/audits/dobetterweb/inspector-issues.d.ts +1 -1
- package/core/audits/dobetterweb/js-libraries.d.ts +1 -1
- package/core/audits/dobetterweb/no-document-write.d.ts +1 -1
- package/core/audits/dobetterweb/notification-on-start.d.ts +1 -1
- package/core/audits/dobetterweb/paste-preventing-inputs.d.ts +1 -1
- package/core/audits/dobetterweb/uses-http2.d.ts +3 -3
- package/core/audits/dobetterweb/uses-passive-event-listeners.d.ts +1 -1
- package/core/audits/errors-in-console.d.ts +1 -1
- package/core/audits/final-screenshot.d.ts +1 -1
- package/core/audits/font-display.d.ts +1 -1
- package/core/audits/image-aspect-ratio.d.ts +1 -1
- package/core/audits/image-size-responsive.d.ts +1 -1
- package/core/audits/installable-manifest.d.ts +1 -1
- package/core/audits/is-on-https.d.ts +1 -1
- package/core/audits/largest-contentful-paint-element.d.ts +17 -3
- package/core/audits/largest-contentful-paint-element.js +77 -4
- package/core/audits/layout-shift-elements.d.ts +1 -1
- package/core/audits/lcp-lazy-loaded.d.ts +1 -1
- package/core/audits/long-tasks.d.ts +1 -1
- package/core/audits/main-thread-tasks.d.ts +1 -1
- package/core/audits/mainthread-work-breakdown.d.ts +1 -1
- package/core/audits/manual/manual-audit.d.ts +1 -1
- package/core/audits/manual/pwa-cross-browser.d.ts +1 -1
- package/core/audits/manual/pwa-each-page-has-url.d.ts +1 -1
- package/core/audits/manual/pwa-page-transitions.d.ts +1 -1
- package/core/audits/maskable-icon.d.ts +1 -1
- package/core/audits/metrics/cumulative-layout-shift.d.ts +1 -1
- package/core/audits/metrics/experimental-interaction-to-next-paint.d.ts +1 -1
- package/core/audits/metrics/first-contentful-paint-3g.d.ts +1 -1
- package/core/audits/metrics/first-contentful-paint.d.ts +1 -1
- package/core/audits/metrics/first-meaningful-paint.d.ts +1 -1
- package/core/audits/metrics/interactive.d.ts +1 -1
- package/core/audits/metrics/largest-contentful-paint.d.ts +1 -1
- package/core/audits/metrics/max-potential-fid.d.ts +1 -1
- package/core/audits/metrics/speed-index.d.ts +1 -1
- package/core/audits/metrics/total-blocking-time.d.ts +1 -1
- package/core/audits/metrics.d.ts +1 -1
- package/core/audits/multi-check-audit.d.ts +1 -1
- package/core/audits/network-requests.d.ts +1 -1
- package/core/audits/network-requests.js +1 -0
- package/core/audits/network-rtt.d.ts +1 -1
- package/core/audits/network-server-latency.d.ts +1 -1
- package/core/audits/no-unload-listeners.d.ts +1 -1
- package/core/audits/non-composited-animations.d.ts +1 -1
- package/core/audits/performance-budget.d.ts +2 -2
- package/core/audits/predictive-perf.d.ts +1 -1
- package/core/audits/predictive-perf.js +10 -3
- package/core/audits/preload-fonts.d.ts +1 -1
- package/core/audits/prioritize-lcp-image.d.ts +2 -13
- package/core/audits/prioritize-lcp-image.js +3 -55
- package/core/audits/redirects.d.ts +2 -2
- package/core/audits/resource-summary.d.ts +1 -1
- package/core/audits/screenshot-thumbnails.d.ts +2 -2
- package/core/audits/script-treemap-data.d.ts +1 -1
- package/core/audits/seo/canonical.d.ts +1 -1
- package/core/audits/seo/crawlable-anchors.d.ts +1 -1
- package/core/audits/seo/font-size.d.ts +1 -1
- package/core/audits/seo/hreflang.d.ts +1 -1
- package/core/audits/seo/http-status-code.d.ts +1 -1
- package/core/audits/seo/is-crawlable.d.ts +1 -1
- package/core/audits/seo/link-text.d.ts +1 -1
- package/core/audits/seo/manual/structured-data.d.ts +1 -1
- package/core/audits/seo/meta-description.d.ts +1 -1
- package/core/audits/seo/plugins.d.ts +1 -1
- package/core/audits/seo/robots-txt.d.ts +1 -1
- package/core/audits/seo/tap-targets.d.ts +1 -1
- package/core/audits/server-response-time.d.ts +1 -1
- package/core/audits/service-worker.d.ts +1 -1
- package/core/audits/splash-screen.d.ts +2 -2
- package/core/audits/themed-omnibox.d.ts +2 -2
- package/core/audits/third-party-facades.d.ts +2 -2
- package/core/audits/third-party-summary.d.ts +2 -2
- package/core/audits/timing-budget.d.ts +3 -3
- package/core/audits/unsized-images.d.ts +1 -1
- package/core/audits/user-timings.d.ts +1 -1
- package/core/audits/uses-rel-preconnect.d.ts +1 -1
- package/core/audits/uses-rel-preload.d.ts +2 -2
- package/core/audits/valid-source-maps.d.ts +2 -2
- package/core/audits/viewport.d.ts +1 -1
- package/core/audits/violation-audit.d.ts +1 -1
- package/core/audits/work-during-interaction.d.ts +2 -2
- package/core/computed/critical-request-chains.d.ts +1 -1
- package/core/computed/document-urls.d.ts +32 -0
- package/core/computed/document-urls.js +53 -0
- package/core/computed/entity-classification.js +0 -1
- package/core/computed/lcp-image-record.d.ts +26 -0
- package/core/computed/lcp-image-record.js +74 -0
- package/core/computed/load-simulator.d.ts +2 -2
- package/core/computed/metrics/cumulative-layout-shift.d.ts +1 -1
- package/core/computed/metrics/first-contentful-paint-all-frames.d.ts +1 -1
- package/core/computed/metrics/first-contentful-paint.d.ts +7 -1
- package/core/computed/metrics/first-meaningful-paint.d.ts +7 -1
- package/core/computed/metrics/interactive.d.ts +7 -1
- package/core/computed/metrics/lantern-first-contentful-paint.d.ts +1 -1
- package/core/computed/metrics/lantern-first-meaningful-paint.d.ts +1 -1
- package/core/computed/metrics/lantern-interactive.d.ts +1 -1
- package/core/computed/metrics/lantern-largest-contentful-paint.d.ts +1 -1
- package/core/computed/metrics/lantern-max-potential-fid.d.ts +1 -1
- package/core/computed/metrics/lantern-metric.d.ts +1 -1
- package/core/computed/metrics/lantern-speed-index.d.ts +1 -1
- package/core/computed/metrics/lantern-total-blocking-time.d.ts +1 -1
- package/core/computed/metrics/largest-contentful-paint-all-frames.d.ts +1 -1
- package/core/computed/metrics/largest-contentful-paint.d.ts +7 -1
- package/core/computed/metrics/lcp-breakdown.d.ts +23 -0
- package/core/computed/metrics/lcp-breakdown.js +58 -0
- package/core/computed/metrics/max-potential-fid.d.ts +7 -1
- package/core/computed/metrics/metric.d.ts +2 -2
- package/core/computed/metrics/metric.js +1 -1
- package/core/computed/metrics/navigation-metric.d.ts +3 -3
- package/core/computed/metrics/navigation-metric.js +1 -1
- package/core/computed/metrics/responsiveness.d.ts +1 -1
- package/core/computed/metrics/speed-index.d.ts +7 -1
- package/core/computed/metrics/time-to-first-byte.d.ts +16 -0
- package/core/computed/metrics/time-to-first-byte.js +60 -0
- package/core/computed/metrics/timing-summary.js +10 -0
- package/core/computed/metrics/total-blocking-time.d.ts +7 -1
- package/core/computed/network-records.d.ts +1 -1
- package/core/computed/page-dependency-graph.d.ts +4 -13
- package/core/computed/page-dependency-graph.js +2 -33
- package/core/computed/processed-navigation.d.ts +1 -1
- package/core/computed/resource-summary.d.ts +4 -4
- package/core/config/default-config.d.ts +1 -1
- package/core/config/desktop-config.d.ts +1 -1
- package/core/gather/base-gatherer.d.ts +1 -1
- package/core/gather/driver/execution-context.d.ts +1 -1
- package/core/gather/driver/network-monitor.d.ts +2 -2
- package/core/gather/driver/target-manager.d.ts +2 -1
- package/core/gather/driver/target-manager.js +5 -3
- package/core/gather/driver/wait-for-condition.js +12 -0
- package/core/gather/driver.d.ts +3 -3
- package/core/gather/fetcher.d.ts +1 -1
- package/core/gather/gatherers/accessibility.d.ts +1 -1
- package/core/gather/gatherers/anchor-elements.d.ts +1 -1
- package/core/gather/gatherers/bf-cache-failures.d.ts +1 -1
- package/core/gather/gatherers/cache-contents.d.ts +1 -1
- package/core/gather/gatherers/console-messages.d.ts +1 -1
- package/core/gather/gatherers/css-usage.d.ts +1 -1
- package/core/gather/gatherers/devtools-log-compat.d.ts +1 -1
- package/core/gather/gatherers/devtools-log.d.ts +1 -1
- package/core/gather/gatherers/dobetterweb/doctype.d.ts +1 -1
- package/core/gather/gatherers/dobetterweb/domstats.d.ts +1 -1
- package/core/gather/gatherers/dobetterweb/optimized-images.d.ts +2 -2
- package/core/gather/gatherers/dobetterweb/optimized-images.js +2 -2
- package/core/gather/gatherers/dobetterweb/response-compression.d.ts +2 -2
- package/core/gather/gatherers/dobetterweb/response-compression.js +1 -2
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.d.ts +1 -1
- package/core/gather/gatherers/full-page-screenshot.d.ts +1 -1
- package/core/gather/gatherers/global-listeners.d.ts +1 -1
- package/core/gather/gatherers/iframe-elements.d.ts +1 -1
- package/core/gather/gatherers/image-elements.d.ts +1 -1
- package/core/gather/gatherers/inputs.d.ts +1 -1
- package/core/gather/gatherers/inspector-issues.d.ts +1 -1
- package/core/gather/gatherers/installability-errors.d.ts +1 -1
- package/core/gather/gatherers/js-usage.d.ts +1 -1
- package/core/gather/gatherers/link-elements.d.ts +1 -1
- package/core/gather/gatherers/main-document-content.d.ts +1 -1
- package/core/gather/gatherers/meta-elements.d.ts +1 -1
- package/core/gather/gatherers/network-user-agent.d.ts +1 -1
- package/core/gather/gatherers/script-elements.d.ts +2 -2
- package/core/gather/gatherers/script-elements.js +1 -2
- package/core/gather/gatherers/scripts.d.ts +1 -3
- package/core/gather/gatherers/scripts.js +0 -3
- package/core/gather/gatherers/seo/embedded-content.d.ts +1 -1
- package/core/gather/gatherers/seo/font-size.d.ts +1 -1
- package/core/gather/gatherers/seo/robots-txt.d.ts +1 -1
- package/core/gather/gatherers/seo/tap-targets.d.ts +1 -1
- package/core/gather/gatherers/service-worker.d.ts +1 -1
- package/core/gather/gatherers/source-maps.d.ts +1 -1
- package/core/gather/gatherers/stacks.d.ts +1 -1
- package/core/gather/gatherers/trace-compat.d.ts +1 -1
- package/core/gather/gatherers/trace-elements.d.ts +2 -2
- package/core/gather/gatherers/trace.d.ts +1 -1
- package/core/gather/gatherers/viewport-dimensions.d.ts +1 -1
- package/core/gather/gatherers/web-app-manifest.d.ts +1 -1
- package/core/gather/navigation-runner.d.ts +3 -3
- package/core/gather/navigation-runner.js +1 -1
- package/core/gather/runner-helpers.js +18 -4
- package/core/index.cjs +28 -0
- package/core/index.d.ts +2 -2
- package/core/legacy/gather/connections/connection.d.ts +3 -1
- package/core/legacy/gather/connections/connection.js +15 -0
- package/core/legacy/gather/connections/cri.d.ts +2 -2
- package/core/legacy/gather/connections/raw.d.ts +1 -1
- package/core/legacy/gather/driver.d.ts +3 -3
- package/core/legacy/gather/gather-runner.js +1 -1
- package/core/lib/dependency-graph/cpu-node.d.ts +2 -2
- package/core/lib/dependency-graph/network-node.d.ts +3 -3
- package/core/lib/dependency-graph/simulator/connection-pool.d.ts +2 -2
- package/core/lib/dependency-graph/simulator/dns-cache.d.ts +1 -1
- package/core/lib/dependency-graph/simulator/simulator.d.ts +5 -5
- package/core/lib/lh-trace-processor.d.ts +1 -1
- package/core/lib/navigation-error.d.ts +2 -2
- package/core/lib/network-recorder.d.ts +17 -11
- package/core/lib/network-recorder.js +24 -31
- package/core/lib/network-request.d.ts +7 -8
- package/core/lib/network-request.js +8 -6
- package/core/lib/stack-packs.js +9 -1
- package/core/lib/tracehouse/main-thread-tasks.d.ts +1 -1
- package/core/lib/tracehouse/task-summary.d.ts +1 -1
- package/core/lib/url-utils.js +1 -0
- package/core/runner.d.ts +2 -2
- package/core/runner.js +8 -2
- package/core/scoring.d.ts +1 -1
- package/core/user-flow.d.ts +1 -1
- package/dist/report/bundle.esm.js +3 -1
- package/dist/report/flow.js +3 -3
- package/dist/report/standalone.js +5 -5
- package/package.json +9 -8
- package/report/README.md +1 -1
- package/report/assets/styles.css +0 -4
- package/report/renderer/components.js +1 -1
- package/report/renderer/performance-category-renderer.d.ts +1 -1
- package/report/renderer/pwa-category-renderer.d.ts +1 -1
- package/report/renderer/report-globals.d.ts +1 -1
- package/report/renderer/report-renderer.d.ts +1 -1
- package/report/renderer/report-ui-features.d.ts +1 -1
- package/report/renderer/topbar-features.d.ts +1 -1
- package/shared/localization/i18n-module.d.ts +2 -2
- package/shared/localization/locales/ar-XB.json +113 -53
- package/shared/localization/locales/ar.json +113 -53
- package/shared/localization/locales/bg.json +113 -53
- package/shared/localization/locales/ca.json +115 -55
- package/shared/localization/locales/cs.json +113 -53
- package/shared/localization/locales/da.json +114 -54
- package/shared/localization/locales/de.json +113 -53
- package/shared/localization/locales/el.json +113 -53
- package/shared/localization/locales/en-GB.json +107 -47
- package/shared/localization/locales/en-US.json +92 -44
- package/shared/localization/locales/en-XA.json +113 -53
- package/shared/localization/locales/en-XL.json +92 -44
- package/shared/localization/locales/es-419.json +113 -53
- package/shared/localization/locales/es.json +114 -54
- package/shared/localization/locales/fi.json +113 -53
- package/shared/localization/locales/fil.json +113 -53
- package/shared/localization/locales/fr.json +113 -53
- package/shared/localization/locales/he.json +114 -54
- package/shared/localization/locales/hi.json +116 -56
- package/shared/localization/locales/hr.json +113 -53
- package/shared/localization/locales/hu.json +113 -53
- package/shared/localization/locales/id.json +113 -53
- package/shared/localization/locales/it.json +114 -54
- package/shared/localization/locales/ja.json +116 -56
- package/shared/localization/locales/ko.json +113 -53
- package/shared/localization/locales/lt.json +113 -53
- package/shared/localization/locales/lv.json +113 -53
- package/shared/localization/locales/nl.json +117 -57
- package/shared/localization/locales/no.json +114 -54
- package/shared/localization/locales/pl.json +125 -65
- package/shared/localization/locales/pt-PT.json +117 -57
- package/shared/localization/locales/pt.json +113 -53
- package/shared/localization/locales/ro.json +113 -53
- package/shared/localization/locales/ru.json +113 -53
- package/shared/localization/locales/sk.json +112 -52
- package/shared/localization/locales/sl.json +113 -53
- package/shared/localization/locales/sr-Latn.json +113 -53
- package/shared/localization/locales/sr.json +113 -53
- package/shared/localization/locales/sv.json +113 -53
- package/shared/localization/locales/ta.json +113 -53
- package/shared/localization/locales/te.json +113 -53
- package/shared/localization/locales/th.json +113 -53
- package/shared/localization/locales/tr.json +113 -53
- package/shared/localization/locales/uk.json +115 -55
- package/shared/localization/locales/vi.json +113 -53
- package/shared/localization/locales/zh-HK.json +113 -53
- package/shared/localization/locales/zh-TW.json +113 -53
- package/shared/localization/locales/zh.json +113 -53
- package/shared/util.js +2 -0
- package/types/artifacts.d.ts +4 -0
- package/types/externs.d.ts +1 -1
- package/types/internal/test.d.ts +1 -1
- package/types/protocol.d.ts +3 -0
|
@@ -11,8 +11,7 @@ import {MainResource} from '../computed/main-resource.js';
|
|
|
11
11
|
import {LanternLargestContentfulPaint} from '../computed/metrics/lantern-largest-contentful-paint.js';
|
|
12
12
|
import {LoadSimulator} from '../computed/load-simulator.js';
|
|
13
13
|
import {ByteEfficiencyAudit} from './byte-efficiency/byte-efficiency-audit.js';
|
|
14
|
-
import {
|
|
15
|
-
import {NetworkRecords} from '../computed/network-records.js';
|
|
14
|
+
import {LCPImageRecord} from '../computed/lcp-image-record.js';
|
|
16
15
|
|
|
17
16
|
const UIStrings = {
|
|
18
17
|
/** Title of a lighthouse audit that tells a user to preload an image in order to improve their LCP time. */
|
|
@@ -140,55 +139,6 @@ class PrioritizeLcpImage extends Audit {
|
|
|
140
139
|
};
|
|
141
140
|
}
|
|
142
141
|
|
|
143
|
-
/**
|
|
144
|
-
* Match the LCP event with the paint event to get the request of the image actually painted.
|
|
145
|
-
* This could differ from the `ImageElement` associated with the nodeId if e.g. the LCP
|
|
146
|
-
* was a pseudo-element associated with a node containing a smaller background-image.
|
|
147
|
-
* @param {LH.Trace} trace
|
|
148
|
-
* @param {LH.Artifacts.ProcessedNavigation} processedNavigation
|
|
149
|
-
* @param {Array<NetworkRequest>} networkRecords
|
|
150
|
-
* @return {NetworkRequest|undefined}
|
|
151
|
-
*/
|
|
152
|
-
static getLcpRecord(trace, processedNavigation, networkRecords) {
|
|
153
|
-
// Use main-frame-only LCP to match the metric value.
|
|
154
|
-
const lcpEvent = processedNavigation.largestContentfulPaintEvt;
|
|
155
|
-
if (!lcpEvent) return;
|
|
156
|
-
|
|
157
|
-
const lcpImagePaintEvent = trace.traceEvents.filter(e => {
|
|
158
|
-
return e.name === 'LargestImagePaint::Candidate' &&
|
|
159
|
-
e.args.frame === lcpEvent.args.frame &&
|
|
160
|
-
e.args.data?.DOMNodeId === lcpEvent.args.data?.nodeId &&
|
|
161
|
-
e.args.data?.size === lcpEvent.args.data?.size;
|
|
162
|
-
// Get last candidate, in case there was more than one.
|
|
163
|
-
}).sort((a, b) => b.ts - a.ts)[0];
|
|
164
|
-
|
|
165
|
-
const lcpUrl = lcpImagePaintEvent?.args.data?.imageUrl;
|
|
166
|
-
if (!lcpUrl) return;
|
|
167
|
-
|
|
168
|
-
const candidates = networkRecords.filter(record => {
|
|
169
|
-
return record.url === lcpUrl &&
|
|
170
|
-
record.finished &&
|
|
171
|
-
// Same frame as LCP trace event.
|
|
172
|
-
record.frameId === lcpImagePaintEvent.args.frame &&
|
|
173
|
-
record.networkRequestTime < (processedNavigation.timestamps.largestContentfulPaint || 0);
|
|
174
|
-
}).map(record => {
|
|
175
|
-
// Follow any redirects to find the real image request.
|
|
176
|
-
while (record.redirectDestination) {
|
|
177
|
-
record = record.redirectDestination;
|
|
178
|
-
}
|
|
179
|
-
return record;
|
|
180
|
-
}).filter(record => {
|
|
181
|
-
// Don't select if also loaded by some other means (xhr, etc). `resourceType`
|
|
182
|
-
// isn't set on redirect _sources_, so have to check after following redirects.
|
|
183
|
-
return record.resourceType === 'Image';
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
// If there are still multiple candidates, at this point it appears the page
|
|
187
|
-
// simply made multiple requests for the image. The first loaded is the best
|
|
188
|
-
// guess of the request that made the image available for use.
|
|
189
|
-
return candidates.sort((a, b) => a.networkEndTime - b.networkEndTime)[0];
|
|
190
|
-
}
|
|
191
|
-
|
|
192
142
|
/**
|
|
193
143
|
* Computes the estimated effect of preloading the LCP image.
|
|
194
144
|
* @param {LH.Artifacts.TraceElement} lcpElement
|
|
@@ -297,17 +247,15 @@ class PrioritizeLcpImage extends Audit {
|
|
|
297
247
|
return {score: null, notApplicable: true};
|
|
298
248
|
}
|
|
299
249
|
|
|
300
|
-
const networkRecords = await NetworkRecords.request(devtoolsLog, context);
|
|
301
|
-
const processedNavigation = await ProcessedNavigation.request(trace, context);
|
|
302
250
|
const mainResource = await MainResource.request({devtoolsLog, URL}, context);
|
|
303
251
|
const lanternLCP = await LanternLargestContentfulPaint.request(metricData, context);
|
|
304
252
|
const simulator = await LoadSimulator.request({devtoolsLog, settings}, context);
|
|
305
253
|
|
|
306
|
-
const
|
|
254
|
+
const lcpImageRecord = await LCPImageRecord.request({trace, devtoolsLog}, context);
|
|
307
255
|
const graph = lanternLCP.pessimisticGraph;
|
|
308
256
|
// Note: if moving to LCPAllFrames, mainResource would need to be the LCP frame's main resource.
|
|
309
257
|
const {lcpNodeToPreload, initiatorPath} = PrioritizeLcpImage.getLCPNodeToPreload(mainResource,
|
|
310
|
-
graph,
|
|
258
|
+
graph, lcpImageRecord);
|
|
311
259
|
|
|
312
260
|
const {results, wastedMs} =
|
|
313
261
|
PrioritizeLcpImage.computeWasteWithGraph(lcpElement, lcpNodeToPreload, graph, simulator);
|
|
@@ -28,6 +28,6 @@ export namespace UIStrings {
|
|
|
28
28
|
const title: string;
|
|
29
29
|
const description: string;
|
|
30
30
|
}
|
|
31
|
-
import { Audit } from
|
|
32
|
-
import { ProcessedTrace } from
|
|
31
|
+
import { Audit } from './audit.js';
|
|
32
|
+
import { ProcessedTrace } from '../computed/processed-trace.js';
|
|
33
33
|
//# sourceMappingURL=redirects.d.ts.map
|
|
@@ -28,6 +28,6 @@ declare class ScreenshotThumbnails extends Audit {
|
|
|
28
28
|
*/
|
|
29
29
|
static audit(artifacts: LH.Artifacts, context: LH.Audit.Context): Promise<LH.Audit.Product>;
|
|
30
30
|
}
|
|
31
|
-
import { Speedline } from
|
|
32
|
-
import { Audit } from
|
|
31
|
+
import { Speedline } from '../computed/speedline.js';
|
|
32
|
+
import { Audit } from './audit.js';
|
|
33
33
|
//# sourceMappingURL=screenshot-thumbnails.d.ts.map
|
|
@@ -38,5 +38,5 @@ declare class ScriptTreemapDataAudit extends Audit {
|
|
|
38
38
|
*/
|
|
39
39
|
static audit(artifacts: LH.Artifacts, context: LH.Audit.Context): Promise<LH.Audit.Product>;
|
|
40
40
|
}
|
|
41
|
-
import { Audit } from
|
|
41
|
+
import { Audit } from './audit.js';
|
|
42
42
|
//# sourceMappingURL=script-treemap-data.d.ts.map
|
|
@@ -45,6 +45,6 @@ export namespace UIStrings {
|
|
|
45
45
|
const explanationViewportMetaNotOptimized: string;
|
|
46
46
|
const displayValue: string;
|
|
47
47
|
}
|
|
48
|
-
import { Audit } from
|
|
48
|
+
import { Audit } from '../audit.js';
|
|
49
49
|
declare const FINGER_SIZE_PX: 48;
|
|
50
50
|
//# sourceMappingURL=tap-targets.d.ts.map
|
|
@@ -32,6 +32,6 @@ export namespace UIStrings {
|
|
|
32
32
|
const failureTitle: string;
|
|
33
33
|
const description: string;
|
|
34
34
|
}
|
|
35
|
-
import MultiCheckAudit from
|
|
36
|
-
import { ManifestValues } from
|
|
35
|
+
import MultiCheckAudit from './multi-check-audit.js';
|
|
36
|
+
import { ManifestValues } from '../computed/manifest-values.js';
|
|
37
37
|
//# sourceMappingURL=splash-screen.d.ts.map
|
|
@@ -37,6 +37,6 @@ export namespace UIStrings {
|
|
|
37
37
|
const failureTitle: string;
|
|
38
38
|
const description: string;
|
|
39
39
|
}
|
|
40
|
-
import MultiCheckAudit from
|
|
41
|
-
import { ManifestValues } from
|
|
40
|
+
import MultiCheckAudit from './multi-check-audit.js';
|
|
41
|
+
import { ManifestValues } from '../computed/manifest-values.js';
|
|
42
42
|
//# sourceMappingURL=themed-omnibox.d.ts.map
|
|
@@ -37,6 +37,6 @@ export namespace UIStrings {
|
|
|
37
37
|
const categoryMarketing: string;
|
|
38
38
|
const categorySocial: string;
|
|
39
39
|
}
|
|
40
|
-
import { Audit } from
|
|
41
|
-
import { EntityClassification } from
|
|
40
|
+
import { Audit } from './audit.js';
|
|
41
|
+
import { EntityClassification } from '../computed/entity-classification.js';
|
|
42
42
|
//# sourceMappingURL=third-party-facades.d.ts.map
|
|
@@ -54,6 +54,6 @@ export namespace UIStrings {
|
|
|
54
54
|
const columnThirdParty: string;
|
|
55
55
|
const displayValue: string;
|
|
56
56
|
}
|
|
57
|
-
import { Audit } from
|
|
58
|
-
import { EntityClassification } from
|
|
57
|
+
import { Audit } from './audit.js';
|
|
58
|
+
import { EntityClassification } from '../computed/entity-classification.js';
|
|
59
59
|
//# sourceMappingURL=third-party-summary.d.ts.map
|
|
@@ -37,7 +37,7 @@ export namespace UIStrings {
|
|
|
37
37
|
const columnTimingMetric: string;
|
|
38
38
|
const columnMeasurement: string;
|
|
39
39
|
}
|
|
40
|
-
import { Budget } from
|
|
41
|
-
import { Audit } from
|
|
42
|
-
import { TimingSummary } from
|
|
40
|
+
import { Budget } from '../config/budget.js';
|
|
41
|
+
import { Audit } from './audit.js';
|
|
42
|
+
import { TimingSummary } from '../computed/metrics/timing-summary.js';
|
|
43
43
|
//# sourceMappingURL=timing-budget.d.ts.map
|
|
@@ -56,6 +56,6 @@ export namespace UIStrings {
|
|
|
56
56
|
const description: string;
|
|
57
57
|
const crossoriginWarning: string;
|
|
58
58
|
}
|
|
59
|
-
import { Audit } from
|
|
60
|
-
import { NetworkRequest } from
|
|
59
|
+
import { Audit } from './audit.js';
|
|
60
|
+
import { NetworkRequest } from '../lib/network-request.js';
|
|
61
61
|
//# sourceMappingURL=uses-rel-preload.d.ts.map
|
|
@@ -24,6 +24,6 @@ export namespace UIStrings {
|
|
|
24
24
|
const missingSourceMapErrorMessage: string;
|
|
25
25
|
const missingSourceMapItemsWarningMesssage: string;
|
|
26
26
|
}
|
|
27
|
-
import { Audit } from
|
|
28
|
-
import { EntityClassification } from
|
|
27
|
+
import { Audit } from './audit.js';
|
|
28
|
+
import { EntityClassification } from '../computed/entity-classification.js';
|
|
29
29
|
//# sourceMappingURL=valid-source-maps.d.ts.map
|
|
@@ -77,6 +77,6 @@ export namespace UIStrings {
|
|
|
77
77
|
const displayValue: string;
|
|
78
78
|
const eventTarget: string;
|
|
79
79
|
}
|
|
80
|
-
import { Audit } from
|
|
81
|
-
import { ProcessedTrace } from
|
|
80
|
+
import { Audit } from './audit.js';
|
|
81
|
+
import { ProcessedTrace } from '../computed/processed-trace.js';
|
|
82
82
|
//# sourceMappingURL=work-during-interaction.d.ts.map
|
|
@@ -36,5 +36,5 @@ declare class CriticalRequestChains {
|
|
|
36
36
|
trace: LH.Trace;
|
|
37
37
|
}, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.CriticalRequestNode>;
|
|
38
38
|
}
|
|
39
|
-
import { NetworkRequest } from
|
|
39
|
+
import { NetworkRequest } from '../lib/network-request.js';
|
|
40
40
|
//# sourceMappingURL=critical-request-chains.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export { DocumentUrlsComputed as DocumentUrls };
|
|
2
|
+
declare const DocumentUrlsComputed: typeof DocumentUrls & {
|
|
3
|
+
request: (dependencies: {
|
|
4
|
+
trace: LH.Trace;
|
|
5
|
+
devtoolsLog: import("../index.js").DevtoolsLog;
|
|
6
|
+
}, context: import("../../types/utility-types.js").default.ImmutableObject<{
|
|
7
|
+
computedCache: Map<string, import("../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
8
|
+
}>) => Promise<{
|
|
9
|
+
requestedUrl: string;
|
|
10
|
+
mainDocumentUrl: string;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @fileoverview Compute the navigation specific URLs `requestedUrl` and `mainDocumentUrl` in situations where
|
|
15
|
+
* the `URL` artifact is not present. This is not a drop-in replacement for `URL` but can be helpful in situations
|
|
16
|
+
* where getting the `URL` artifact is difficult.
|
|
17
|
+
*/
|
|
18
|
+
declare class DocumentUrls {
|
|
19
|
+
/**
|
|
20
|
+
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog}} data
|
|
21
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
22
|
+
* @return {Promise<{requestedUrl: string, mainDocumentUrl: string}>}
|
|
23
|
+
*/
|
|
24
|
+
static compute_(data: {
|
|
25
|
+
trace: LH.Trace;
|
|
26
|
+
devtoolsLog: import("../index.js").DevtoolsLog;
|
|
27
|
+
}, context: LH.Artifacts.ComputedContext): Promise<{
|
|
28
|
+
requestedUrl: string;
|
|
29
|
+
mainDocumentUrl: string;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=document-urls.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright 2023 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {NetworkAnalyzer} from '../lib/dependency-graph/simulator/network-analyzer.js';
|
|
8
|
+
import {makeComputedArtifact} from './computed-artifact.js';
|
|
9
|
+
import {NetworkRecords} from './network-records.js';
|
|
10
|
+
import {ProcessedTrace} from './processed-trace.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @fileoverview Compute the navigation specific URLs `requestedUrl` and `mainDocumentUrl` in situations where
|
|
14
|
+
* the `URL` artifact is not present. This is not a drop-in replacement for `URL` but can be helpful in situations
|
|
15
|
+
* where getting the `URL` artifact is difficult.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
class DocumentUrls {
|
|
19
|
+
/**
|
|
20
|
+
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog}} data
|
|
21
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
22
|
+
* @return {Promise<{requestedUrl: string, mainDocumentUrl: string}>}
|
|
23
|
+
*/
|
|
24
|
+
static async compute_(data, context) {
|
|
25
|
+
const processedTrace = await ProcessedTrace.request(data.trace, context);
|
|
26
|
+
const networkRecords = await NetworkRecords.request(data.devtoolsLog, context);
|
|
27
|
+
|
|
28
|
+
const mainFrameId = processedTrace.mainFrameInfo.frameId;
|
|
29
|
+
|
|
30
|
+
/** @type {string|undefined} */
|
|
31
|
+
let requestedUrl;
|
|
32
|
+
/** @type {string|undefined} */
|
|
33
|
+
let mainDocumentUrl;
|
|
34
|
+
for (const event of data.devtoolsLog) {
|
|
35
|
+
if (event.method === 'Page.frameNavigated' && event.params.frame.id === mainFrameId) {
|
|
36
|
+
const {url} = event.params.frame;
|
|
37
|
+
// Only set requestedUrl on the first main frame navigation.
|
|
38
|
+
if (!requestedUrl) requestedUrl = url;
|
|
39
|
+
mainDocumentUrl = url;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (!requestedUrl || !mainDocumentUrl) throw new Error('No main frame navigations found');
|
|
43
|
+
|
|
44
|
+
const initialRequest = NetworkAnalyzer.findResourceForUrl(networkRecords, requestedUrl);
|
|
45
|
+
if (initialRequest?.redirects?.length) requestedUrl = initialRequest.redirects[0].url;
|
|
46
|
+
|
|
47
|
+
return {requestedUrl, mainDocumentUrl};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const DocumentUrlsComputed = makeComputedArtifact(DocumentUrls, ['devtoolsLog', 'trace']);
|
|
52
|
+
export {DocumentUrlsComputed as DocumentUrls};
|
|
53
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { LCPImageRecordComputed as LCPImageRecord };
|
|
2
|
+
declare const LCPImageRecordComputed: typeof LCPImageRecord & {
|
|
3
|
+
request: (dependencies: {
|
|
4
|
+
trace: LH.Trace;
|
|
5
|
+
devtoolsLog: import("../index.js").DevtoolsLog;
|
|
6
|
+
}, context: import("../../types/utility-types.js").default.ImmutableObject<{
|
|
7
|
+
computedCache: Map<string, import("../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
8
|
+
}>) => Promise<import("../lib/network-request.js").NetworkRequest | undefined>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @fileoverview Match the LCP event with the paint event to get the request of the image actually painted.
|
|
12
|
+
* This could differ from the `ImageElement` associated with the nodeId if e.g. the LCP
|
|
13
|
+
* was a pseudo-element associated with a node containing a smaller background-image.
|
|
14
|
+
*/
|
|
15
|
+
declare class LCPImageRecord {
|
|
16
|
+
/**
|
|
17
|
+
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog}} data
|
|
18
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
19
|
+
* @return {Promise<LH.Artifacts.NetworkRequest|undefined>}
|
|
20
|
+
*/
|
|
21
|
+
static compute_(data: {
|
|
22
|
+
trace: LH.Trace;
|
|
23
|
+
devtoolsLog: import("../index.js").DevtoolsLog;
|
|
24
|
+
}, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.NetworkRequest | undefined>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=lcp-image-record.d.ts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright 2023 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {makeComputedArtifact} from './computed-artifact.js';
|
|
8
|
+
import {NetworkRecords} from './network-records.js';
|
|
9
|
+
import {ProcessedNavigation} from './processed-navigation.js';
|
|
10
|
+
import {LighthouseError} from '../lib/lh-error.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @fileoverview Match the LCP event with the paint event to get the request of the image actually painted.
|
|
14
|
+
* This could differ from the `ImageElement` associated with the nodeId if e.g. the LCP
|
|
15
|
+
* was a pseudo-element associated with a node containing a smaller background-image.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
class LCPImageRecord {
|
|
19
|
+
/**
|
|
20
|
+
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog}} data
|
|
21
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
22
|
+
* @return {Promise<LH.Artifacts.NetworkRequest|undefined>}
|
|
23
|
+
*/
|
|
24
|
+
static async compute_(data, context) {
|
|
25
|
+
const {trace, devtoolsLog} = data;
|
|
26
|
+
const networkRecords = await NetworkRecords.request(devtoolsLog, context);
|
|
27
|
+
const processedNavigation = await ProcessedNavigation.request(trace, context);
|
|
28
|
+
if (processedNavigation.timings.largestContentfulPaint === undefined) {
|
|
29
|
+
throw new LighthouseError(LighthouseError.errors.NO_LCP);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Use main-frame-only LCP to match the metric value.
|
|
33
|
+
const lcpEvent = processedNavigation.largestContentfulPaintEvt;
|
|
34
|
+
if (!lcpEvent) return;
|
|
35
|
+
|
|
36
|
+
const lcpImagePaintEvent = trace.traceEvents.filter(e => {
|
|
37
|
+
return e.name === 'LargestImagePaint::Candidate' &&
|
|
38
|
+
e.args.frame === lcpEvent.args.frame &&
|
|
39
|
+
e.args.data?.DOMNodeId === lcpEvent.args.data?.nodeId &&
|
|
40
|
+
e.args.data?.size === lcpEvent.args.data?.size;
|
|
41
|
+
// Get last candidate, in case there was more than one.
|
|
42
|
+
}).sort((a, b) => b.ts - a.ts)[0];
|
|
43
|
+
|
|
44
|
+
const lcpUrl = lcpImagePaintEvent?.args.data?.imageUrl;
|
|
45
|
+
if (!lcpUrl) return;
|
|
46
|
+
|
|
47
|
+
const candidates = networkRecords.filter(record => {
|
|
48
|
+
return record.url === lcpUrl &&
|
|
49
|
+
record.finished &&
|
|
50
|
+
// Same frame as LCP trace event.
|
|
51
|
+
record.frameId === lcpImagePaintEvent.args.frame &&
|
|
52
|
+
record.networkRequestTime < (processedNavigation.timestamps.largestContentfulPaint || 0);
|
|
53
|
+
}).map(record => {
|
|
54
|
+
// Follow any redirects to find the real image request.
|
|
55
|
+
while (record.redirectDestination) {
|
|
56
|
+
record = record.redirectDestination;
|
|
57
|
+
}
|
|
58
|
+
return record;
|
|
59
|
+
}).filter(record => {
|
|
60
|
+
// Don't select if also loaded by some other means (xhr, etc). `resourceType`
|
|
61
|
+
// isn't set on redirect _sources_, so have to check after following redirects.
|
|
62
|
+
return record.resourceType === 'Image';
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// If there are still multiple candidates, at this point it appears the page
|
|
66
|
+
// simply made multiple requests for the image. The first loaded is the best
|
|
67
|
+
// guess of the request that made the image available for use.
|
|
68
|
+
return candidates.sort((a, b) => a.networkEndTime - b.networkEndTime)[0];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const LCPImageRecordComputed = makeComputedArtifact(LCPImageRecord, ['devtoolsLog', 'trace']);
|
|
73
|
+
export {LCPImageRecordComputed as LCPImageRecord};
|
|
74
|
+
|
|
@@ -23,6 +23,6 @@ declare class LoadSimulator {
|
|
|
23
23
|
*/
|
|
24
24
|
static convertAnalysisToSaveableLanternData(networkAnalysis: LH.Artifacts.NetworkAnalysis): LH.PrecomputedLanternData;
|
|
25
25
|
}
|
|
26
|
-
import { Simulator } from
|
|
27
|
-
import { NetworkAnalysis } from
|
|
26
|
+
import { Simulator } from '../lib/dependency-graph/simulator/simulator.js';
|
|
27
|
+
import { NetworkAnalysis } from './network-analysis.js';
|
|
28
28
|
//# sourceMappingURL=load-simulator.d.ts.map
|
|
@@ -15,5 +15,5 @@ declare class FirstContentfulPaintAllFrames extends NavigationMetric {
|
|
|
15
15
|
*/
|
|
16
16
|
static computeObservedMetric(data: LH.Artifacts.NavigationMetricComputationData): Promise<LH.Artifacts.Metric>;
|
|
17
17
|
}
|
|
18
|
-
import { NavigationMetric } from
|
|
18
|
+
import { NavigationMetric } from './navigation-metric.js';
|
|
19
19
|
//# sourceMappingURL=first-contentful-paint-all-frames.d.ts.map
|
|
@@ -5,11 +5,17 @@ declare const FirstContentfulPaintComputed: typeof FirstContentfulPaint & {
|
|
|
5
5
|
}>) => Promise<import("../../index.js").Artifacts.Metric | import("../../index.js").Artifacts.LanternMetric>;
|
|
6
6
|
};
|
|
7
7
|
declare class FirstContentfulPaint extends NavigationMetric {
|
|
8
|
+
/**
|
|
9
|
+
* @param {LH.Artifacts.NavigationMetricComputationData} data
|
|
10
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
11
|
+
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
12
|
+
*/
|
|
13
|
+
static computeSimulatedMetric(data: LH.Artifacts.NavigationMetricComputationData, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.LanternMetric>;
|
|
8
14
|
/**
|
|
9
15
|
* @param {LH.Artifacts.NavigationMetricComputationData} data
|
|
10
16
|
* @return {Promise<LH.Artifacts.Metric>}
|
|
11
17
|
*/
|
|
12
18
|
static computeObservedMetric(data: LH.Artifacts.NavigationMetricComputationData): Promise<LH.Artifacts.Metric>;
|
|
13
19
|
}
|
|
14
|
-
import { NavigationMetric } from
|
|
20
|
+
import { NavigationMetric } from './navigation-metric.js';
|
|
15
21
|
//# sourceMappingURL=first-contentful-paint.d.ts.map
|