lighthouse 11.1.0 → 11.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/CONTRIBUTING.md +3 -5
- package/cli/bin.js +4 -3
- package/cli/cli-flags.js +3 -3
- package/cli/commands/commands.js +3 -3
- package/cli/commands/list-audits.js +3 -3
- package/cli/commands/list-locales.js +3 -3
- package/cli/commands/list-trace-categories.js +3 -3
- package/cli/index.js +3 -3
- package/cli/printer.js +3 -3
- package/cli/run.js +3 -3
- package/cli/sentry-prompt.js +3 -3
- package/cli/test/smokehouse/__snapshots__/report-assert-test.js.snap +8 -0
- package/cli/test/smokehouse/config/exclusions.d.ts +3 -3
- package/cli/test/smokehouse/config/exclusions.js +3 -3
- package/cli/test/smokehouse/core-tests.js +3 -3
- package/cli/test/smokehouse/frontends/back-compat-util.d.ts +3 -3
- package/cli/test/smokehouse/frontends/back-compat-util.js +3 -3
- package/cli/test/smokehouse/frontends/lib.js +3 -3
- package/cli/test/smokehouse/frontends/node.js +3 -3
- package/cli/test/smokehouse/frontends/smokehouse-bin.js +3 -3
- package/cli/test/smokehouse/lib/child-process-error.d.ts +3 -3
- package/cli/test/smokehouse/lib/child-process-error.js +3 -3
- package/cli/test/smokehouse/lib/concurrent-mapper.d.ts +3 -3
- package/cli/test/smokehouse/lib/concurrent-mapper.js +3 -3
- package/cli/test/smokehouse/lib/local-console.d.ts +3 -3
- package/cli/test/smokehouse/lib/local-console.js +3 -3
- package/cli/test/smokehouse/lighthouse-runners/bundle.js +3 -3
- package/cli/test/smokehouse/lighthouse-runners/cli.js +3 -3
- package/cli/test/smokehouse/lighthouse-runners/devtools.js +3 -3
- package/cli/test/smokehouse/report-assert-test.js +3 -3
- package/cli/test/smokehouse/report-assert.js +3 -3
- package/cli/test/smokehouse/smokehouse.d.ts +0 -1
- package/cli/test/smokehouse/smokehouse.js +12 -6
- package/cli/test/smokehouse/version-check-test.js +3 -3
- package/cli/test/smokehouse/version-check.js +3 -3
- package/commitlint.config.js +3 -3
- package/core/audits/accessibility/accesskeys.js +3 -3
- package/core/audits/accessibility/aria-allowed-attr.js +3 -3
- package/core/audits/accessibility/aria-allowed-role.js +3 -3
- package/core/audits/accessibility/aria-command-name.js +3 -3
- package/core/audits/accessibility/aria-dialog-name.js +3 -3
- package/core/audits/accessibility/aria-hidden-body.js +3 -3
- package/core/audits/accessibility/aria-hidden-focus.js +3 -3
- package/core/audits/accessibility/aria-input-field-name.js +3 -3
- package/core/audits/accessibility/aria-meter-name.js +3 -3
- package/core/audits/accessibility/aria-progressbar-name.js +3 -3
- package/core/audits/accessibility/aria-required-attr.js +3 -3
- package/core/audits/accessibility/aria-required-children.js +3 -3
- package/core/audits/accessibility/aria-required-parent.js +3 -3
- package/core/audits/accessibility/aria-roles.js +3 -3
- package/core/audits/accessibility/aria-text.js +3 -3
- package/core/audits/accessibility/aria-toggle-field-name.js +3 -3
- package/core/audits/accessibility/aria-tooltip-name.js +3 -3
- package/core/audits/accessibility/aria-treeitem-name.js +3 -3
- package/core/audits/accessibility/aria-valid-attr-value.js +3 -3
- package/core/audits/accessibility/aria-valid-attr.js +3 -3
- package/core/audits/accessibility/axe-audit.js +3 -3
- package/core/audits/accessibility/button-name.js +3 -3
- package/core/audits/accessibility/bypass.js +3 -3
- package/core/audits/accessibility/color-contrast.js +3 -3
- package/core/audits/accessibility/definition-list.js +3 -3
- package/core/audits/accessibility/dlitem.js +3 -3
- package/core/audits/accessibility/document-title.js +3 -3
- package/core/audits/accessibility/duplicate-id-active.js +3 -3
- package/core/audits/accessibility/duplicate-id-aria.js +3 -3
- package/core/audits/accessibility/empty-heading.js +3 -3
- package/core/audits/accessibility/form-field-multiple-labels.js +3 -3
- package/core/audits/accessibility/frame-title.js +3 -3
- package/core/audits/accessibility/heading-order.js +3 -3
- package/core/audits/accessibility/html-has-lang.js +3 -3
- package/core/audits/accessibility/html-lang-valid.js +3 -3
- package/core/audits/accessibility/html-xml-lang-mismatch.js +3 -3
- package/core/audits/accessibility/identical-links-same-purpose.js +3 -3
- package/core/audits/accessibility/image-alt.js +3 -3
- package/core/audits/accessibility/image-redundant-alt.js +3 -3
- package/core/audits/accessibility/input-button-name.js +3 -3
- package/core/audits/accessibility/input-image-alt.js +3 -3
- package/core/audits/accessibility/label-content-name-mismatch.js +3 -3
- package/core/audits/accessibility/label.js +3 -3
- package/core/audits/accessibility/landmark-one-main.js +3 -3
- package/core/audits/accessibility/link-in-text-block.js +3 -3
- package/core/audits/accessibility/link-name.js +3 -3
- package/core/audits/accessibility/list.js +3 -3
- package/core/audits/accessibility/listitem.js +3 -3
- package/core/audits/accessibility/manual/custom-controls-labels.js +3 -3
- package/core/audits/accessibility/manual/custom-controls-roles.js +3 -3
- package/core/audits/accessibility/manual/focus-traps.js +3 -3
- package/core/audits/accessibility/manual/focusable-controls.js +3 -3
- package/core/audits/accessibility/manual/interactive-element-affordance.js +3 -3
- package/core/audits/accessibility/manual/logical-tab-order.js +3 -3
- package/core/audits/accessibility/manual/managed-focus.js +3 -3
- package/core/audits/accessibility/manual/offscreen-content-hidden.js +3 -3
- package/core/audits/accessibility/manual/use-landmarks.js +3 -3
- package/core/audits/accessibility/manual/visual-order-follows-dom.js +3 -3
- package/core/audits/accessibility/meta-refresh.js +3 -3
- package/core/audits/accessibility/meta-viewport.js +3 -3
- package/core/audits/accessibility/object-alt.js +3 -3
- package/core/audits/accessibility/select-name.js +3 -3
- package/core/audits/accessibility/skip-link.js +3 -3
- package/core/audits/accessibility/tabindex.js +3 -3
- package/core/audits/accessibility/table-duplicate-name.js +3 -3
- package/core/audits/accessibility/table-fake-caption.js +3 -3
- package/core/audits/accessibility/target-size.js +3 -3
- package/core/audits/accessibility/td-has-header.js +3 -3
- package/core/audits/accessibility/td-headers-attr.js +3 -3
- package/core/audits/accessibility/th-has-data-cells.js +3 -3
- package/core/audits/accessibility/valid-lang.js +3 -3
- package/core/audits/accessibility/video-caption.js +3 -3
- package/core/audits/audit.js +24 -14
- package/core/audits/autocomplete.js +3 -3
- package/core/audits/bf-cache.js +4 -3
- package/core/audits/bootup-time.js +7 -4
- package/core/audits/byte-efficiency/byte-efficiency-audit.js +4 -4
- package/core/audits/byte-efficiency/duplicated-javascript.js +4 -4
- package/core/audits/byte-efficiency/efficient-animated-content.js +4 -4
- package/core/audits/byte-efficiency/legacy-javascript.js +4 -4
- package/core/audits/byte-efficiency/modern-image-formats.js +4 -4
- package/core/audits/byte-efficiency/offscreen-images.js +4 -4
- package/core/audits/byte-efficiency/render-blocking-resources.js +5 -6
- package/core/audits/byte-efficiency/total-byte-weight.js +6 -4
- package/core/audits/byte-efficiency/unminified-css.js +4 -4
- package/core/audits/byte-efficiency/unminified-javascript.js +4 -4
- package/core/audits/byte-efficiency/unused-css-rules.js +4 -4
- package/core/audits/byte-efficiency/unused-javascript.js +4 -4
- package/core/audits/byte-efficiency/uses-long-cache-ttl.js +6 -11
- package/core/audits/byte-efficiency/uses-optimized-images.js +4 -4
- package/core/audits/byte-efficiency/uses-responsive-images-snapshot.js +4 -3
- package/core/audits/byte-efficiency/uses-responsive-images.js +4 -4
- package/core/audits/byte-efficiency/uses-text-compression.js +4 -4
- package/core/audits/content-width.js +3 -3
- package/core/audits/critical-request-chains.js +3 -3
- package/core/audits/csp-xss.js +4 -4
- package/core/audits/deprecations.js +3 -3
- package/core/audits/diagnostics.js +3 -3
- package/core/audits/dobetterweb/charset.js +3 -3
- package/core/audits/dobetterweb/doctype.js +3 -3
- package/core/audits/dobetterweb/dom-size.js +6 -4
- package/core/audits/dobetterweb/geolocation-on-start.js +3 -3
- package/core/audits/dobetterweb/inspector-issues.js +3 -3
- package/core/audits/dobetterweb/js-libraries.js +3 -3
- package/core/audits/dobetterweb/no-document-write.js +4 -3
- package/core/audits/dobetterweb/notification-on-start.js +3 -3
- package/core/audits/dobetterweb/paste-preventing-inputs.js +3 -3
- package/core/audits/dobetterweb/uses-http2.js +5 -6
- package/core/audits/dobetterweb/uses-passive-event-listeners.js +4 -3
- package/core/audits/errors-in-console.js +3 -3
- package/core/audits/final-screenshot.js +3 -3
- package/core/audits/font-display.js +4 -3
- package/core/audits/image-aspect-ratio.js +3 -3
- package/core/audits/image-size-responsive.js +3 -3
- package/core/audits/installable-manifest.js +5 -5
- package/core/audits/is-on-https.js +3 -3
- package/core/audits/largest-contentful-paint-element.js +6 -5
- package/core/audits/layout-shift-elements.js +10 -7
- package/core/audits/lcp-lazy-loaded.js +4 -3
- package/core/audits/long-tasks.js +11 -4
- package/core/audits/main-thread-tasks.js +3 -3
- package/core/audits/mainthread-work-breakdown.js +26 -5
- package/core/audits/manual/manual-audit.js +3 -3
- package/core/audits/manual/pwa-cross-browser.js +3 -3
- package/core/audits/manual/pwa-each-page-has-url.js +3 -3
- package/core/audits/manual/pwa-page-transitions.js +3 -3
- package/core/audits/maskable-icon.js +3 -3
- package/core/audits/metrics/cumulative-layout-shift.js +7 -4
- package/core/audits/metrics/first-contentful-paint.js +4 -3
- package/core/audits/metrics/first-meaningful-paint.js +3 -3
- package/core/audits/metrics/interaction-to-next-paint.js +3 -3
- package/core/audits/metrics/interactive.js +3 -3
- package/core/audits/metrics/largest-contentful-paint.js +4 -3
- package/core/audits/metrics/max-potential-fid.js +3 -3
- package/core/audits/metrics/speed-index.js +4 -3
- package/core/audits/metrics/total-blocking-time.js +4 -3
- package/core/audits/metrics.js +3 -3
- package/core/audits/multi-check-audit.js +3 -3
- package/core/audits/network-requests.js +3 -3
- package/core/audits/network-rtt.js +3 -3
- package/core/audits/network-server-latency.js +3 -3
- package/core/audits/no-unload-listeners.js +3 -3
- package/core/audits/non-composited-animations.js +3 -3
- package/core/audits/oopif-iframe-test-audit.js +3 -3
- package/core/audits/performance-budget.js +3 -3
- package/core/audits/predictive-perf.js +3 -3
- package/core/audits/preload-fonts.js +3 -3
- package/core/audits/prioritize-lcp-image.js +5 -6
- package/core/audits/redirects.js +5 -6
- package/core/audits/screenshot-thumbnails.js +3 -3
- package/core/audits/script-elements-test-audit.js +3 -3
- package/core/audits/script-treemap-data.js +3 -3
- package/core/audits/seo/canonical.js +3 -3
- package/core/audits/seo/crawlable-anchors.js +3 -3
- package/core/audits/seo/font-size.js +3 -3
- package/core/audits/seo/hreflang.js +3 -3
- package/core/audits/seo/http-status-code.js +3 -3
- package/core/audits/seo/is-crawlable.js +3 -3
- package/core/audits/seo/link-text.js +3 -3
- package/core/audits/seo/manual/structured-data.js +3 -3
- package/core/audits/seo/meta-description.js +3 -3
- package/core/audits/seo/plugins.js +3 -3
- package/core/audits/seo/robots-txt.js +3 -3
- package/core/audits/seo/tap-targets.js +3 -3
- package/core/audits/server-response-time.js +5 -3
- package/core/audits/splash-screen.js +3 -3
- package/core/audits/themed-omnibox.js +3 -3
- package/core/audits/third-party-facades.js +4 -3
- package/core/audits/third-party-summary.js +8 -4
- package/core/audits/timing-budget.js +3 -3
- package/core/audits/unsized-images.js +4 -4
- package/core/audits/user-timings.js +3 -3
- package/core/audits/uses-rel-preconnect.js +5 -6
- package/core/audits/uses-rel-preload.js +5 -6
- package/core/audits/valid-source-maps.js +2 -3
- package/core/audits/viewport.js +4 -3
- package/core/audits/violation-audit.js +3 -3
- package/core/audits/work-during-interaction.js +9 -5
- package/core/computed/computed-artifact.js +3 -3
- package/core/computed/critical-request-chains.js +3 -3
- package/core/computed/document-urls.js +3 -3
- package/core/computed/entity-classification.js +3 -3
- package/core/computed/image-records.js +3 -3
- package/core/computed/js-bundles.js +3 -3
- package/core/computed/lcp-image-record.js +3 -3
- package/core/computed/load-simulator.js +3 -3
- package/core/computed/main-resource.js +3 -3
- package/core/computed/main-thread-tasks.js +3 -3
- package/core/computed/manifest-values.js +3 -3
- package/core/computed/metrics/cumulative-layout-shift.js +3 -3
- package/core/computed/metrics/first-contentful-paint-all-frames.js +3 -3
- package/core/computed/metrics/first-contentful-paint.js +3 -3
- package/core/computed/metrics/first-meaningful-paint.js +3 -3
- package/core/computed/metrics/interactive.js +3 -3
- package/core/computed/metrics/lantern-first-contentful-paint.js +3 -3
- package/core/computed/metrics/lantern-first-meaningful-paint.js +3 -3
- package/core/computed/metrics/lantern-interactive.js +3 -3
- package/core/computed/metrics/lantern-largest-contentful-paint.js +3 -3
- package/core/computed/metrics/lantern-max-potential-fid.js +3 -3
- package/core/computed/metrics/lantern-metric.js +3 -3
- package/core/computed/metrics/lantern-speed-index.js +3 -3
- package/core/computed/metrics/lantern-total-blocking-time.js +3 -3
- package/core/computed/metrics/largest-contentful-paint-all-frames.js +3 -3
- package/core/computed/metrics/largest-contentful-paint.js +3 -3
- package/core/computed/metrics/lcp-breakdown.js +3 -3
- package/core/computed/metrics/max-potential-fid.js +3 -3
- package/core/computed/metrics/metric.js +3 -3
- package/core/computed/metrics/navigation-metric.js +3 -3
- package/core/computed/metrics/responsiveness.js +3 -3
- package/core/computed/metrics/speed-index.js +3 -3
- package/core/computed/metrics/tbt-utils.d.ts +3 -3
- package/core/computed/metrics/tbt-utils.js +3 -3
- package/core/computed/metrics/time-to-first-byte.js +3 -3
- package/core/computed/metrics/timing-summary.js +3 -3
- package/core/computed/metrics/total-blocking-time.js +3 -3
- package/core/computed/module-duplication.js +3 -3
- package/core/computed/network-analysis.js +3 -3
- package/core/computed/network-records.js +3 -3
- package/core/computed/page-dependency-graph.js +4 -3
- package/core/computed/processed-navigation.js +3 -3
- package/core/computed/processed-trace.js +3 -3
- package/core/computed/resource-summary.js +3 -3
- package/core/computed/screenshots.js +3 -3
- package/core/computed/speedline.js +3 -3
- package/core/computed/tbt-impact-tasks.js +3 -3
- package/core/computed/unused-css.js +3 -3
- package/core/computed/unused-javascript-summary.js +2 -3
- package/core/computed/user-timings.js +3 -3
- package/core/computed/viewport-meta.js +3 -3
- package/core/config/budget.js +3 -3
- package/core/config/config-helpers.js +3 -3
- package/core/config/config-plugin.js +3 -3
- package/core/config/config.js +3 -3
- package/core/config/constants.d.ts +3 -3
- package/core/config/constants.js +3 -3
- package/core/config/default-config.js +3 -3
- package/core/config/desktop-config.js +3 -3
- package/core/config/experimental-config.d.ts +3 -3
- package/core/config/experimental-config.js +3 -3
- package/core/config/filters.js +3 -3
- package/core/config/full-config.d.ts +3 -3
- package/core/config/full-config.js +3 -3
- package/core/config/lr-desktop-config.js +3 -3
- package/core/config/lr-mobile-config.d.ts +3 -3
- package/core/config/lr-mobile-config.js +3 -3
- package/core/config/metrics-to-audits.d.ts +3 -3
- package/core/config/metrics-to-audits.js +3 -3
- package/core/config/perf-config.d.ts +3 -3
- package/core/config/perf-config.js +3 -3
- package/core/config/validation.js +3 -3
- package/core/gather/base-artifacts.js +3 -3
- package/core/gather/base-gatherer.js +3 -3
- package/core/gather/driver/dom.js +3 -3
- package/core/gather/driver/environment.js +3 -3
- package/core/gather/driver/execution-context.js +3 -3
- package/core/gather/driver/navigation.js +3 -3
- package/core/gather/driver/network-monitor.js +3 -3
- package/core/gather/driver/network.js +3 -3
- package/core/gather/driver/prepare.js +3 -3
- package/core/gather/driver/service-workers.d.ts +3 -3
- package/core/gather/driver/service-workers.js +3 -3
- package/core/gather/driver/storage.js +3 -3
- package/core/gather/driver/target-manager.d.ts +5 -0
- package/core/gather/driver/target-manager.js +21 -11
- package/core/gather/driver/wait-for-condition.js +3 -3
- package/core/gather/driver.js +3 -3
- package/core/gather/fetcher.js +2 -3
- package/core/gather/gatherers/accessibility.js +3 -3
- package/core/gather/gatherers/anchor-elements.js +3 -3
- package/core/gather/gatherers/bf-cache-failures.js +3 -3
- package/core/gather/gatherers/cache-contents.js +3 -3
- package/core/gather/gatherers/console-messages.js +3 -3
- package/core/gather/gatherers/css-usage.js +3 -3
- package/core/gather/gatherers/devtools-log-compat.js +3 -3
- package/core/gather/gatherers/devtools-log.js +3 -3
- package/core/gather/gatherers/dobetterweb/doctype.js +3 -3
- package/core/gather/gatherers/dobetterweb/domstats.js +3 -3
- package/core/gather/gatherers/dobetterweb/optimized-images.js +5 -5
- package/core/gather/gatherers/dobetterweb/response-compression.js +4 -4
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +8 -3
- package/core/gather/gatherers/full-page-screenshot.js +2 -3
- package/core/gather/gatherers/global-listeners.js +3 -3
- package/core/gather/gatherers/iframe-elements.js +3 -3
- package/core/gather/gatherers/image-elements.js +3 -3
- package/core/gather/gatherers/inputs.js +3 -3
- package/core/gather/gatherers/inspector-issues.js +4 -3
- package/core/gather/gatherers/installability-errors.js +3 -3
- package/core/gather/gatherers/js-usage.js +3 -3
- package/core/gather/gatherers/link-elements.js +3 -3
- package/core/gather/gatherers/main-document-content.js +3 -3
- package/core/gather/gatherers/meta-elements.js +3 -3
- package/core/gather/gatherers/network-user-agent.js +3 -3
- package/core/gather/gatherers/script-elements.js +4 -4
- package/core/gather/gatherers/scripts.js +3 -3
- package/core/gather/gatherers/seo/embedded-content.js +3 -3
- package/core/gather/gatherers/seo/font-size.js +3 -3
- package/core/gather/gatherers/seo/robots-txt.js +3 -3
- package/core/gather/gatherers/seo/tap-targets.js +3 -3
- package/core/gather/gatherers/service-worker.js +3 -3
- package/core/gather/gatherers/source-maps.js +3 -3
- package/core/gather/gatherers/stacks.js +3 -3
- package/core/gather/gatherers/trace-compat.js +3 -3
- package/core/gather/gatherers/trace-elements.js +3 -3
- package/core/gather/gatherers/trace.js +3 -3
- package/core/gather/gatherers/viewport-dimensions.js +3 -3
- package/core/gather/gatherers/web-app-manifest.js +3 -3
- package/core/gather/navigation-runner.js +3 -3
- package/core/gather/runner-helpers.js +3 -3
- package/core/gather/session.js +5 -3
- package/core/gather/snapshot-runner.js +3 -3
- package/core/gather/timespan-runner.js +3 -3
- package/core/index.cjs +3 -3
- package/core/index.js +3 -3
- package/core/lib/arbitrary-equality-map.js +3 -3
- package/core/lib/asset-saver.d.ts +4 -4
- package/core/lib/asset-saver.js +17 -13
- package/core/lib/axe.js +3 -3
- package/core/lib/cdt/Common.js +3 -3
- package/core/lib/cdt/Platform.d.ts +3 -3
- package/core/lib/cdt/Platform.js +3 -3
- package/core/lib/cdt/SDK.js +3 -3
- package/core/lib/csp-evaluator.js +16 -16
- package/core/lib/dependency-graph/base-node.d.ts +3 -3
- package/core/lib/dependency-graph/base-node.js +3 -3
- package/core/lib/dependency-graph/cpu-node.js +3 -3
- package/core/lib/dependency-graph/network-node.js +3 -3
- package/core/lib/dependency-graph/simulator/connection-pool.js +3 -3
- package/core/lib/dependency-graph/simulator/dns-cache.js +3 -3
- package/core/lib/dependency-graph/simulator/network-analyzer.js +3 -3
- package/core/lib/dependency-graph/simulator/simulator-timing-map.js +3 -3
- package/core/lib/dependency-graph/simulator/simulator.js +3 -3
- package/core/lib/dependency-graph/simulator/tcp-connection.js +3 -3
- package/core/lib/deprecation-description.js +3 -3
- package/core/lib/emulation.js +3 -3
- package/core/lib/i18n/i18n.js +3 -3
- package/core/lib/icons.d.ts +3 -3
- package/core/lib/icons.js +3 -3
- package/core/lib/lantern-trace-saver.d.ts +3 -3
- package/core/lib/lantern-trace-saver.js +3 -3
- package/core/lib/lh-env.js +3 -3
- package/core/lib/lh-error.js +3 -3
- package/core/lib/lh-trace-processor.js +3 -3
- package/core/lib/lighthouse-compatibility.js +3 -3
- package/core/lib/manifest-parser.js +3 -3
- package/core/lib/median-run.js +3 -3
- package/core/lib/minification-estimator.js +3 -3
- package/core/lib/minify-devtoolslog.js +3 -3
- package/core/lib/navigation-error.js +3 -3
- package/core/lib/network-recorder.js +3 -3
- package/core/lib/network-request.js +3 -3
- package/core/lib/page-functions.js +3 -3
- package/core/lib/proto-preprocessor.js +3 -3
- package/core/lib/rect-helpers.d.ts +3 -3
- package/core/lib/rect-helpers.js +3 -3
- package/core/lib/script-helpers.d.ts +3 -3
- package/core/lib/script-helpers.js +3 -3
- package/core/lib/sentry.d.ts +2 -1
- package/core/lib/sentry.js +24 -18
- package/core/lib/stack-packs.js +3 -3
- package/core/lib/tappable-rects.js +3 -3
- package/core/lib/third-party-web.js +3 -3
- package/core/lib/timing-trace-saver.d.ts +3 -3
- package/core/lib/timing-trace-saver.js +3 -3
- package/core/lib/tracehouse/cpu-profile-model.js +3 -3
- package/core/lib/tracehouse/main-thread-tasks.js +3 -3
- package/core/lib/tracehouse/task-groups.d.ts +3 -3
- package/core/lib/tracehouse/task-groups.js +3 -3
- package/core/lib/tracehouse/task-summary.js +3 -3
- package/core/lib/tracehouse/trace-processor.js +3 -3
- package/core/lib/traces/metric-trace-events.js +3 -3
- package/core/lib/url-utils.js +3 -3
- package/core/runner.js +3 -3
- package/core/scoring.js +3 -3
- package/core/scripts/download-chrome.sh +2 -3
- package/core/user-flow.js +3 -3
- package/dist/report/bundle.esm.js +260 -175
- package/dist/report/flow.js +265 -181
- package/dist/report/standalone.js +261 -176
- package/flow-report/api.d.ts +3 -3
- package/flow-report/api.ts +3 -3
- package/flow-report/assets/standalone-flow-template.html +2 -13
- package/flow-report/assets/styles.css +3 -3
- package/flow-report/clients/standalone.d.ts +3 -3
- package/flow-report/clients/standalone.ts +3 -3
- package/flow-report/src/app.d.ts +3 -3
- package/flow-report/src/app.tsx +3 -3
- package/flow-report/src/common.d.ts +3 -3
- package/flow-report/src/common.tsx +3 -3
- package/flow-report/src/header.d.ts +3 -3
- package/flow-report/src/header.tsx +3 -3
- package/flow-report/src/help-dialog.d.ts +3 -3
- package/flow-report/src/help-dialog.tsx +3 -3
- package/flow-report/src/i18n/i18n.d.ts +3 -3
- package/flow-report/src/i18n/i18n.tsx +3 -3
- package/flow-report/src/i18n/localized-strings.d.ts +3 -3
- package/flow-report/src/i18n/localized-strings.js +3 -3
- package/flow-report/src/i18n/ui-strings.js +3 -3
- package/flow-report/src/icons.d.ts +3 -3
- package/flow-report/src/icons.tsx +3 -3
- package/flow-report/src/sidebar/flow.d.ts +3 -3
- package/flow-report/src/sidebar/flow.tsx +3 -3
- package/flow-report/src/sidebar/sidebar.d.ts +3 -3
- package/flow-report/src/sidebar/sidebar.tsx +3 -3
- package/flow-report/src/summary/category.d.ts +3 -3
- package/flow-report/src/summary/category.tsx +3 -3
- package/flow-report/src/summary/summary.d.ts +3 -3
- package/flow-report/src/summary/summary.tsx +3 -3
- package/flow-report/src/topbar.d.ts +3 -3
- package/flow-report/src/topbar.tsx +3 -3
- package/flow-report/src/util.d.ts +3 -3
- package/flow-report/src/util.ts +3 -3
- package/flow-report/src/wrappers/category-score.d.ts +3 -3
- package/flow-report/src/wrappers/category-score.tsx +3 -3
- package/flow-report/src/wrappers/markdown.d.ts +3 -3
- package/flow-report/src/wrappers/markdown.tsx +3 -3
- package/flow-report/src/wrappers/report.d.ts +3 -3
- package/flow-report/src/wrappers/report.tsx +3 -3
- package/flow-report/src/wrappers/styles.d.ts +3 -3
- package/flow-report/src/wrappers/styles.tsx +3 -3
- package/flow-report/types/flow-report.d.ts +3 -3
- package/package.json +11 -11
- package/readme.md +1 -1
- package/report/assets/standalone-template.html +2 -13
- package/report/assets/styles.css +231 -93
- package/report/assets/templates.html +24 -52
- package/report/clients/bundle.js +3 -3
- package/report/clients/standalone.js +3 -3
- package/report/generator/file-namer.js +3 -3
- package/report/generator/flow-report-assets.js +3 -3
- package/report/generator/report-assets.js +3 -3
- package/report/generator/report-generator.js +3 -3
- package/report/renderer/api.js +3 -3
- package/report/renderer/category-renderer.js +2 -13
- package/report/renderer/components.d.ts +2 -2
- package/report/renderer/components.js +35 -52
- package/report/renderer/crc-details-renderer.js +2 -13
- package/report/renderer/details-renderer.js +2 -13
- package/report/renderer/dom.d.ts +24 -4
- package/report/renderer/dom.js +32 -16
- package/report/renderer/drop-down-menu.d.ts +3 -3
- package/report/renderer/drop-down-menu.js +3 -3
- package/report/renderer/element-screenshot-renderer.js +3 -3
- package/report/renderer/explodey-gauge.d.ts +11 -0
- package/report/renderer/explodey-gauge.js +357 -0
- package/report/renderer/features-util.d.ts +3 -3
- package/report/renderer/features-util.js +3 -3
- package/report/renderer/i18n-formatter.js +3 -3
- package/report/renderer/logger.d.ts +2 -13
- package/report/renderer/logger.js +2 -13
- package/report/renderer/open-tab.js +2 -13
- package/report/renderer/performance-category-renderer.d.ts +16 -18
- package/report/renderer/performance-category-renderer.js +99 -115
- package/report/renderer/pwa-category-renderer.js +2 -13
- package/report/renderer/report-globals.js +3 -3
- package/report/renderer/report-renderer.js +2 -13
- package/report/renderer/report-ui-features.js +2 -13
- package/report/renderer/report-utils.js +3 -3
- package/report/renderer/snippet-renderer.js +3 -3
- package/report/renderer/swap-locale-feature.d.ts +3 -3
- package/report/renderer/swap-locale-feature.js +3 -3
- package/report/renderer/text-encoding.js +3 -3
- package/report/renderer/topbar-features.js +3 -3
- package/report/types/augment-dom.d.ts +3 -3
- package/report/types/buffer.d.ts +3 -3
- package/report/types/html-renderer.d.ts +3 -3
- package/report/types/report-renderer.d.ts +3 -3
- package/report/types/report-result.d.ts +3 -3
- package/shared/esm-utils.js +3 -3
- package/shared/localization/format.d.ts +21 -16
- package/shared/localization/format.js +76 -39
- package/shared/localization/i18n-module.js +2 -3
- package/shared/localization/locales/en-US.json +14 -14
- package/shared/localization/locales/en-XL.json +14 -14
- package/shared/localization/locales.js +3 -3
- package/shared/localization/swap-flow-locale.js +3 -3
- package/shared/localization/swap-locale.js +3 -3
- package/shared/root.js +3 -3
- package/{core/lib → shared}/statistics.js +3 -3
- package/shared/type-verifiers.d.ts +4 -4
- package/shared/type-verifiers.js +3 -3
- package/shared/types/shared.d.ts +3 -3
- package/shared/util.d.ts +22 -0
- package/shared/util.js +33 -13
- package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +4 -3
- package/third-party/chromium-synchronization/installability-errors-test.js +3 -3
- package/third-party/download-content-shell/README.md +1 -1
- package/types/artifacts.d.ts +4 -3
- package/types/audit.d.ts +8 -4
- package/types/config.d.ts +3 -3
- package/types/externs.d.ts +3 -3
- package/types/gatherer.d.ts +3 -3
- package/types/internal/cssstyle.d.ts +3 -3
- package/types/internal/enquirer.d.ts +3 -3
- package/types/internal/global.d.ts +3 -3
- package/types/internal/http-link-header.d.ts +3 -3
- package/types/internal/lookup-closest-locale.d.ts +3 -3
- package/types/internal/metaviewport-parser.d.ts +3 -3
- package/types/internal/node.d.ts +3 -3
- package/types/internal/parse-cache-control.d.ts +3 -3
- package/types/internal/pretty-json-stringify.d.ts +3 -3
- package/types/internal/query-selector.d.ts +3 -3
- package/types/internal/rollup-plugin-postprocess.d.ts +3 -3
- package/types/internal/rxjs.d.ts +6 -3
- package/types/internal/smokehouse.d.ts +3 -3
- package/types/internal/test.d.ts +3 -3
- package/types/lh.d.ts +3 -3
- package/types/lh.js +3 -3
- package/types/lhr/audit-details.d.ts +3 -3
- package/types/lhr/audit-result.d.ts +19 -3
- package/types/lhr/budget.d.ts +3 -3
- package/types/lhr/flow-result.d.ts +3 -3
- package/types/lhr/i18n.d.ts +3 -3
- package/types/lhr/lhr.d.ts +3 -3
- package/types/lhr/settings.d.ts +3 -3
- package/types/lhr/treemap.d.ts +3 -3
- package/types/protocol.d.ts +3 -3
- package/types/puppeteer.d.ts +3 -3
- package/types/user-flow.d.ts +3 -3
- package/types/utility-types.d.ts +3 -3
- package/AUTHORS +0 -9
- /package/{core/lib → shared}/statistics.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import fs from 'fs';
|
|
@@ -12,6 +12,19 @@ import {getModuleDirectory} from '../esm-utils.js';
|
|
|
12
12
|
import {isObjectOfUnknownValues, isObjectOrArrayOfUnknownValues} from '../type-verifiers.js';
|
|
13
13
|
import {locales} from './locales.js';
|
|
14
14
|
|
|
15
|
+
// From @formatjs/icu-messageformat-parser - copy here so we don't need to bundle all that.
|
|
16
|
+
const TYPE = /** @type {const} */ ({
|
|
17
|
+
literal: 0,
|
|
18
|
+
argument: 1,
|
|
19
|
+
number: 2,
|
|
20
|
+
date: 3,
|
|
21
|
+
time: 4,
|
|
22
|
+
select: 5,
|
|
23
|
+
plural: 6,
|
|
24
|
+
pound: 7,
|
|
25
|
+
tag: 8,
|
|
26
|
+
});
|
|
27
|
+
|
|
15
28
|
const moduleDir = getModuleDirectory(import.meta);
|
|
16
29
|
|
|
17
30
|
/** Contains available locales with messages. May be an empty object if bundled. */
|
|
@@ -30,11 +43,11 @@ const CANONICAL_LOCALES = fs.readdirSync(moduleDir + '/locales/')
|
|
|
30
43
|
.map(locale => locale.replace('.json', ''))
|
|
31
44
|
.sort();
|
|
32
45
|
|
|
33
|
-
/** @typedef {import('
|
|
34
|
-
/** @typedef {import('intl-messageformat-parser').ArgumentElement} ArgumentElement */
|
|
46
|
+
/** @typedef {import('@formatjs/icu-messageformat-parser').MessageFormatElement} MessageFormatElement */
|
|
35
47
|
|
|
36
48
|
const MESSAGE_I18N_ID_REGEX = / | [^\s]+$/;
|
|
37
49
|
|
|
50
|
+
/** @type {Partial<import('intl-messageformat').Formats>} */
|
|
38
51
|
const formats = {
|
|
39
52
|
number: {
|
|
40
53
|
bytes: {
|
|
@@ -57,40 +70,39 @@ const formats = {
|
|
|
57
70
|
};
|
|
58
71
|
|
|
59
72
|
/**
|
|
60
|
-
* Function to retrieve all
|
|
61
|
-
*
|
|
62
|
-
* differs from
|
|
73
|
+
* Function to retrieve all elements from an ICU message AST that are associated
|
|
74
|
+
* with a named input, like '{varName}' or '{varName, number, bytes}'. This
|
|
75
|
+
* differs from literal message types which are just arbitrary text.
|
|
63
76
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
77
|
+
* This function recursively inspects plural elements for nested elements,
|
|
78
|
+
* but since the output is a Map they are deduplicated.
|
|
79
|
+
* e.g. "=1{hello {icu}} =other{hello {icu}}" will produce one element in the output,
|
|
80
|
+
* with "icu" as its key.
|
|
66
81
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* the variable "icu" would appear twice if it wasn't de duplicated. And they cannot
|
|
70
|
-
* be stored in a set because they are not equal since their locations are different,
|
|
71
|
-
* thus they are stored via a Map keyed on the "id" which is the ICU varName.
|
|
82
|
+
* TODO: don't do that deduplication because messages within a plural message could be number
|
|
83
|
+
* messages with different styles.
|
|
72
84
|
*
|
|
73
|
-
* @param {Array<
|
|
74
|
-
* @param {Map<string,
|
|
75
|
-
* @return {Map<string,
|
|
85
|
+
* @param {Array<MessageFormatElement>} icuElements
|
|
86
|
+
* @param {Map<string, MessageFormatElement>} [customElements]
|
|
87
|
+
* @return {Map<string, MessageFormatElement>}
|
|
76
88
|
*/
|
|
77
|
-
function collectAllCustomElementsFromICU(icuElements,
|
|
89
|
+
function collectAllCustomElementsFromICU(icuElements, customElements = new Map()) {
|
|
78
90
|
for (const el of icuElements) {
|
|
79
|
-
|
|
80
|
-
if (el.type !== 'argumentElement') continue;
|
|
91
|
+
if (el.type === TYPE.literal || el.type === TYPE.pound) continue;
|
|
81
92
|
|
|
82
|
-
|
|
93
|
+
customElements.set(el.value, el);
|
|
83
94
|
|
|
84
95
|
// Plurals need to be inspected recursively
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
96
|
+
if (el.type === TYPE.plural) {
|
|
97
|
+
// Look at all options of the plural (=1{} =other{}...)
|
|
98
|
+
for (const option of Object.values(el.options)) {
|
|
99
|
+
// Run collections on each option's elements
|
|
100
|
+
collectAllCustomElementsFromICU(option.value, customElements);
|
|
101
|
+
}
|
|
90
102
|
}
|
|
91
103
|
}
|
|
92
104
|
|
|
93
|
-
return
|
|
105
|
+
return customElements;
|
|
94
106
|
}
|
|
95
107
|
|
|
96
108
|
/**
|
|
@@ -103,15 +115,14 @@ function collectAllCustomElementsFromICU(icuElements, seenElementsById = new Map
|
|
|
103
115
|
* @return {Record<string, string | number>}
|
|
104
116
|
*/
|
|
105
117
|
function _preformatValues(messageFormatter, values = {}, lhlMessage) {
|
|
106
|
-
const
|
|
107
|
-
const argumentElements = [...elementMap.values()];
|
|
118
|
+
const customElements = collectAllCustomElementsFromICU(messageFormatter.getAst());
|
|
108
119
|
|
|
109
120
|
/** @type {Record<string, string | number>} */
|
|
110
121
|
const formattedValues = {};
|
|
111
122
|
|
|
112
|
-
for (const
|
|
123
|
+
for (const [id, element] of customElements) {
|
|
113
124
|
// Throw an error if a message's value isn't provided
|
|
114
|
-
if (
|
|
125
|
+
if (!(id in values)) {
|
|
115
126
|
throw new Error(`ICU Message "${lhlMessage}" contains a value reference ("${id}") ` +
|
|
116
127
|
`that wasn't provided`);
|
|
117
128
|
}
|
|
@@ -119,7 +130,7 @@ function _preformatValues(messageFormatter, values = {}, lhlMessage) {
|
|
|
119
130
|
const value = values[id];
|
|
120
131
|
|
|
121
132
|
// Direct `{id}` replacement and non-numeric values need no formatting.
|
|
122
|
-
if (
|
|
133
|
+
if (element.type !== TYPE.number) {
|
|
123
134
|
formattedValues[id] = value;
|
|
124
135
|
continue;
|
|
125
136
|
}
|
|
@@ -130,13 +141,13 @@ function _preformatValues(messageFormatter, values = {}, lhlMessage) {
|
|
|
130
141
|
}
|
|
131
142
|
|
|
132
143
|
// Format values for known styles.
|
|
133
|
-
if (
|
|
144
|
+
if (element.style === 'milliseconds') {
|
|
134
145
|
// Round all milliseconds to the nearest 10.
|
|
135
146
|
formattedValues[id] = Math.round(value / 10) * 10;
|
|
136
|
-
} else if (
|
|
147
|
+
} else if (element.style === 'seconds' && id === 'timeInMs') {
|
|
137
148
|
// Convert all seconds to the correct unit (currently only for `timeInMs`).
|
|
138
149
|
formattedValues[id] = Math.round(value / 100) / 10;
|
|
139
|
-
} else if (
|
|
150
|
+
} else if (element.style === 'bytes') {
|
|
140
151
|
// Replace all the bytes with KB.
|
|
141
152
|
formattedValues[id] = value / 1024;
|
|
142
153
|
} else {
|
|
@@ -162,6 +173,19 @@ function _preformatValues(messageFormatter, values = {}, lhlMessage) {
|
|
|
162
173
|
return formattedValues;
|
|
163
174
|
}
|
|
164
175
|
|
|
176
|
+
/**
|
|
177
|
+
* Our strings were made when \ was the escape character, but now it is '. To avoid churn,
|
|
178
|
+
* let's convert to the new style in memory.
|
|
179
|
+
* @param {string} message
|
|
180
|
+
* @return {string}
|
|
181
|
+
*/
|
|
182
|
+
function escapeIcuMessage(message) {
|
|
183
|
+
return message
|
|
184
|
+
.replace(/'/g, `''`)
|
|
185
|
+
.replace(/\\{/g, `'{`)
|
|
186
|
+
.replace(/\\}/g, `'}`);
|
|
187
|
+
}
|
|
188
|
+
|
|
165
189
|
/**
|
|
166
190
|
* Format string `message` by localizing `values` and inserting them. `message`
|
|
167
191
|
* is assumed to already be in the given locale.
|
|
@@ -172,19 +196,31 @@ function _preformatValues(messageFormatter, values = {}, lhlMessage) {
|
|
|
172
196
|
* @return {string}
|
|
173
197
|
*/
|
|
174
198
|
function formatMessage(message, values, locale) {
|
|
199
|
+
message = escapeIcuMessage(message);
|
|
200
|
+
|
|
175
201
|
// Parsing and formatting can be slow. Don't attempt if the string can't
|
|
176
202
|
// contain ICU placeholders, in which case formatting is already complete.
|
|
177
|
-
if (!message.includes('{') && values === undefined) return message;
|
|
178
203
|
|
|
179
204
|
// When using accented english, force the use of a different locale for number formatting.
|
|
180
205
|
const localeForMessageFormat = (locale === 'en-XA' || locale === 'en-XL') ? 'de-DE' : locale;
|
|
181
206
|
|
|
182
|
-
|
|
207
|
+
// This package is not correctly bundled.
|
|
208
|
+
/** @type {typeof IntlMessageFormat} */
|
|
209
|
+
// @ts-expect-error bundler woes
|
|
210
|
+
const IntlMessageFormatCtor = IntlMessageFormat.IntlMessageFormat || IntlMessageFormat;
|
|
211
|
+
const formatter = new IntlMessageFormatCtor(message, localeForMessageFormat, formats, {
|
|
212
|
+
ignoreTag: true,
|
|
213
|
+
});
|
|
183
214
|
|
|
184
215
|
// Preformat values for the message format like KB and milliseconds.
|
|
185
216
|
const valuesForMessageFormat = _preformatValues(formatter, values, message);
|
|
186
217
|
|
|
187
|
-
|
|
218
|
+
const formattedResult = formatter.format(valuesForMessageFormat);
|
|
219
|
+
// We only format to strings.
|
|
220
|
+
if (typeof formattedResult !== 'string') {
|
|
221
|
+
throw new Error('unexpected formatted result');
|
|
222
|
+
}
|
|
223
|
+
return formattedResult;
|
|
188
224
|
}
|
|
189
225
|
|
|
190
226
|
/**
|
|
@@ -459,4 +495,5 @@ export {
|
|
|
459
495
|
getIcuMessageIdParts,
|
|
460
496
|
getAvailableLocales,
|
|
461
497
|
getCanonicalLocales,
|
|
498
|
+
escapeIcuMessage,
|
|
462
499
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright 2021 Google
|
|
3
|
-
*
|
|
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.
|
|
2
|
+
* @license Copyright 2021 Google LLC
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
4
|
*/
|
|
6
5
|
|
|
7
6
|
import * as format from './format.js';
|
|
@@ -774,7 +774,7 @@
|
|
|
774
774
|
"message": "Syntax"
|
|
775
775
|
},
|
|
776
776
|
"core/audits/csp-xss.js | metaTagMessage": {
|
|
777
|
-
"message": "The page contains a CSP defined in a
|
|
777
|
+
"message": "The page contains a CSP defined in a `<meta>` tag. Consider moving the CSP to an HTTP header or defining another strict CSP in an HTTP header."
|
|
778
778
|
},
|
|
779
779
|
"core/audits/csp-xss.js | noCsp": {
|
|
780
780
|
"message": "No CSP found in enforcement mode"
|
|
@@ -1026,7 +1026,7 @@
|
|
|
1026
1026
|
"message": "Page is loaded in an incognito window"
|
|
1027
1027
|
},
|
|
1028
1028
|
"core/audits/installable-manifest.js | manifest-display-not-supported": {
|
|
1029
|
-
"message": "Manifest
|
|
1029
|
+
"message": "Manifest `display` property must be one of `standalone`, `fullscreen`, or `minimal-ui`"
|
|
1030
1030
|
},
|
|
1031
1031
|
"core/audits/installable-manifest.js | manifest-display-override-not-supported": {
|
|
1032
1032
|
"message": "Manifest contains 'display_override' field, and the first supported display mode must be one of 'standalone', 'fullscreen', or 'minimal-ui'"
|
|
@@ -1038,7 +1038,7 @@
|
|
|
1038
1038
|
"message": "Manifest URL changed while the manifest was being fetched."
|
|
1039
1039
|
},
|
|
1040
1040
|
"core/audits/installable-manifest.js | manifest-missing-name-or-short-name": {
|
|
1041
|
-
"message": "Manifest does not contain a
|
|
1041
|
+
"message": "Manifest does not contain a `name` or `short_name` field"
|
|
1042
1042
|
},
|
|
1043
1043
|
"core/audits/installable-manifest.js | manifest-missing-suitable-icon": {
|
|
1044
1044
|
"message": "Manifest does not contain a suitable icon - PNG, SVG or WebP format of at least {value0} px is required, the sizes attribute must be set, and the purpose attribute, if set, must include \"any\"."
|
|
@@ -2211,25 +2211,25 @@
|
|
|
2211
2211
|
"message": "Pages that use WebXR are not currently eligible for back/forward cache."
|
|
2212
2212
|
},
|
|
2213
2213
|
"core/lib/csp-evaluator.js | allowlistFallback": {
|
|
2214
|
-
"message": "Consider adding https: and http: URL schemes (ignored by browsers supporting 'strict-dynamic') to be backward compatible with older browsers."
|
|
2214
|
+
"message": "Consider adding https: and http: URL schemes (ignored by browsers supporting `'strict-dynamic'`) to be backward compatible with older browsers."
|
|
2215
2215
|
},
|
|
2216
2216
|
"core/lib/csp-evaluator.js | deprecatedDisownOpener": {
|
|
2217
|
-
"message": "disown-opener is deprecated since CSP3. Please, use the Cross-Origin-Opener-Policy header instead."
|
|
2217
|
+
"message": "`disown-opener` is deprecated since CSP3. Please, use the Cross-Origin-Opener-Policy header instead."
|
|
2218
2218
|
},
|
|
2219
2219
|
"core/lib/csp-evaluator.js | deprecatedReferrer": {
|
|
2220
|
-
"message": "referrer is deprecated since CSP2. Please, use the Referrer-Policy header instead."
|
|
2220
|
+
"message": "`referrer` is deprecated since CSP2. Please, use the Referrer-Policy header instead."
|
|
2221
2221
|
},
|
|
2222
2222
|
"core/lib/csp-evaluator.js | deprecatedReflectedXSS": {
|
|
2223
|
-
"message": "reflected-xss is deprecated since CSP2. Please, use the X-XSS-Protection header instead."
|
|
2223
|
+
"message": "`reflected-xss` is deprecated since CSP2. Please, use the X-XSS-Protection header instead."
|
|
2224
2224
|
},
|
|
2225
2225
|
"core/lib/csp-evaluator.js | missingBaseUri": {
|
|
2226
|
-
"message": "Missing base-uri allows injected
|
|
2226
|
+
"message": "Missing `base-uri` allows injected `<base>` tags to set the base URL for all relative URLs (e.g. scripts) to an attacker controlled domain. Consider setting `base-uri` to `'none'` or `'self'`."
|
|
2227
2227
|
},
|
|
2228
2228
|
"core/lib/csp-evaluator.js | missingObjectSrc": {
|
|
2229
|
-
"message": "Missing object-src allows the injection of plugins that execute unsafe scripts. Consider setting object-src to 'none' if you can."
|
|
2229
|
+
"message": "Missing `object-src` allows the injection of plugins that execute unsafe scripts. Consider setting `object-src` to `'none'` if you can."
|
|
2230
2230
|
},
|
|
2231
2231
|
"core/lib/csp-evaluator.js | missingScriptSrc": {
|
|
2232
|
-
"message": "script-src directive is missing. This can allow the execution of unsafe scripts."
|
|
2232
|
+
"message": "`script-src` directive is missing. This can allow the execution of unsafe scripts."
|
|
2233
2233
|
},
|
|
2234
2234
|
"core/lib/csp-evaluator.js | missingSemicolon": {
|
|
2235
2235
|
"message": "Did you forget the semicolon? {keyword} seems to be a directive, not a keyword."
|
|
@@ -2250,10 +2250,10 @@
|
|
|
2250
2250
|
"message": "No CSP configures a reporting destination. This makes it difficult to maintain the CSP over time and monitor for any breakages."
|
|
2251
2251
|
},
|
|
2252
2252
|
"core/lib/csp-evaluator.js | reportToOnly": {
|
|
2253
|
-
"message": "The reporting destination is only configured via the report-to directive. This directive is only supported in Chromium-based browsers so it is recommended to also use a report-uri directive."
|
|
2253
|
+
"message": "The reporting destination is only configured via the report-to directive. This directive is only supported in Chromium-based browsers so it is recommended to also use a `report-uri` directive."
|
|
2254
2254
|
},
|
|
2255
2255
|
"core/lib/csp-evaluator.js | strictDynamic": {
|
|
2256
|
-
"message": "Host allowlists can frequently be bypassed. Consider using CSP nonces or hashes instead, along with 'strict-dynamic' if necessary."
|
|
2256
|
+
"message": "Host allowlists can frequently be bypassed. Consider using CSP nonces or hashes instead, along with `'strict-dynamic'` if necessary."
|
|
2257
2257
|
},
|
|
2258
2258
|
"core/lib/csp-evaluator.js | unknownDirective": {
|
|
2259
2259
|
"message": "Unknown CSP directive."
|
|
@@ -2262,10 +2262,10 @@
|
|
|
2262
2262
|
"message": "{keyword} seems to be an invalid keyword."
|
|
2263
2263
|
},
|
|
2264
2264
|
"core/lib/csp-evaluator.js | unsafeInline": {
|
|
2265
|
-
"message": "'unsafe-inline' allows the execution of unsafe in-page scripts and event handlers. Consider using CSP nonces or hashes to allow scripts individually."
|
|
2265
|
+
"message": "`'unsafe-inline'` allows the execution of unsafe in-page scripts and event handlers. Consider using CSP nonces or hashes to allow scripts individually."
|
|
2266
2266
|
},
|
|
2267
2267
|
"core/lib/csp-evaluator.js | unsafeInlineFallback": {
|
|
2268
|
-
"message": "Consider adding 'unsafe-inline' (ignored by browsers supporting nonces/hashes) to be backward compatible with older browsers."
|
|
2268
|
+
"message": "Consider adding `'unsafe-inline'` (ignored by browsers supporting nonces/hashes) to be backward compatible with older browsers."
|
|
2269
2269
|
},
|
|
2270
2270
|
"core/lib/deprecation-description.js | feature": {
|
|
2271
2271
|
"message": "Check the feature status page for more details."
|
|
@@ -774,7 +774,7 @@
|
|
|
774
774
|
"message": "Ŝýn̂t́âx́"
|
|
775
775
|
},
|
|
776
776
|
"core/audits/csp-xss.js | metaTagMessage": {
|
|
777
|
-
"message": "T̂h́ê ṕâǵê ćôńt̂áîńŝ á ĈŚP̂ d́êf́îńêd́ îń â
|
|
777
|
+
"message": "T̂h́ê ṕâǵê ćôńt̂áîńŝ á ĈŚP̂ d́êf́îńêd́ îń â `<meta>` t́âǵ. Ĉón̂śîd́êŕ m̂óv̂ín̂ǵ t̂h́ê ĆŜṔ t̂ó âń ĤT́T̂Ṕ ĥéâd́êŕ ôŕ d̂éf̂ín̂ín̂ǵ âńôt́ĥér̂ śt̂ŕîćt̂ ĆŜṔ îń âń ĤT́T̂Ṕ ĥéâd́êŕ."
|
|
778
778
|
},
|
|
779
779
|
"core/audits/csp-xss.js | noCsp": {
|
|
780
780
|
"message": "N̂ó ĈŚP̂ f́ôún̂d́ îń êńf̂ór̂ćêḿêńt̂ ḿôd́ê"
|
|
@@ -1026,7 +1026,7 @@
|
|
|
1026
1026
|
"message": "P̂áĝé îś l̂óâd́êd́ îń âń îńĉóĝńît́ô ẃîńd̂óŵ"
|
|
1027
1027
|
},
|
|
1028
1028
|
"core/audits/installable-manifest.js | manifest-display-not-supported": {
|
|
1029
|
-
"message": "M̂án̂íf̂éŝt́
|
|
1029
|
+
"message": "M̂án̂íf̂éŝt́ `display` p̂ŕôṕêŕt̂ý m̂úŝt́ b̂é ôńê óf̂ `standalone`, `fullscreen`, ór̂ `minimal-ui`"
|
|
1030
1030
|
},
|
|
1031
1031
|
"core/audits/installable-manifest.js | manifest-display-override-not-supported": {
|
|
1032
1032
|
"message": "M̂án̂íf̂éŝt́ ĉón̂t́âín̂ś 'd̂íŝṕl̂áŷ_óv̂ér̂ŕîd́ê' f́îél̂d́, âńd̂ t́ĥé f̂ír̂śt̂ śûṕp̂ór̂t́êd́ d̂íŝṕl̂áŷ ḿôd́ê ḿûśt̂ b́ê ón̂é ôf́ 'ŝt́âńd̂ál̂ón̂é', 'f̂úl̂ĺŝćr̂éêń', ôŕ 'm̂ín̂ím̂ál̂-úî'"
|
|
@@ -1038,7 +1038,7 @@
|
|
|
1038
1038
|
"message": "M̂án̂íf̂éŝt́ ÛŔL̂ ćĥán̂ǵêd́ ŵh́îĺê t́ĥé m̂án̂íf̂éŝt́ ŵáŝ b́êín̂ǵ f̂ét̂ćĥéd̂."
|
|
1039
1039
|
},
|
|
1040
1040
|
"core/audits/installable-manifest.js | manifest-missing-name-or-short-name": {
|
|
1041
|
-
"message": "M̂án̂íf̂éŝt́ d̂óêś n̂ót̂ ćôńt̂áîń â
|
|
1041
|
+
"message": "M̂án̂íf̂éŝt́ d̂óêś n̂ót̂ ćôńt̂áîń â `name` ór̂ `short_name` f́îél̂d́"
|
|
1042
1042
|
},
|
|
1043
1043
|
"core/audits/installable-manifest.js | manifest-missing-suitable-icon": {
|
|
1044
1044
|
"message": "M̂án̂íf̂éŝt́ d̂óêś n̂ót̂ ćôńt̂áîń â śûít̂áb̂ĺê íĉón̂ - ṔN̂Ǵ, ŜV́Ĝ ór̂ Ẃêb́P̂ f́ôŕm̂át̂ óf̂ át̂ ĺêáŝt́ {value0} p̂x́ îś r̂éq̂úîŕêd́, t̂h́ê śîźêś ât́t̂ŕîb́ût́ê ḿûśt̂ b́ê śêt́, âńd̂ t́ĥé p̂úr̂ṕôśê át̂t́r̂íb̂út̂é, îf́ ŝét̂, ḿûśt̂ ín̂ćl̂úd̂é \"âńŷ\"."
|
|
@@ -2211,25 +2211,25 @@
|
|
|
2211
2211
|
"message": "P̂áĝéŝ t́ĥát̂ úŝé Ŵéb̂X́R̂ ár̂é n̂ót̂ ćûŕr̂én̂t́l̂ý êĺîǵîb́l̂é f̂ór̂ b́âćk̂/f́ôŕŵár̂d́ ĉáĉh́ê."
|
|
2212
2212
|
},
|
|
2213
2213
|
"core/lib/csp-evaluator.js | allowlistFallback": {
|
|
2214
|
-
"message": "Ĉón̂śîd́êŕ âd́d̂ín̂ǵ ĥt́t̂ṕŝ: án̂d́ ĥt́t̂ṕ: ÛŔL̂ śĉh́êḿêś (îǵn̂ór̂éd̂ b́ŷ b́r̂óŵśêŕŝ śûṕp̂ór̂t́îńĝ '
|
|
2214
|
+
"message": "Ĉón̂śîd́êŕ âd́d̂ín̂ǵ ĥt́t̂ṕŝ: án̂d́ ĥt́t̂ṕ: ÛŔL̂ śĉh́êḿêś (îǵn̂ór̂éd̂ b́ŷ b́r̂óŵśêŕŝ śûṕp̂ór̂t́îńĝ `'strict-dynamic'`) t́ô b́ê b́âćk̂ẃâŕd̂ ćôḿp̂át̂íb̂ĺê ẃît́ĥ ól̂d́êŕ b̂ŕôẃŝér̂ś."
|
|
2215
2215
|
},
|
|
2216
2216
|
"core/lib/csp-evaluator.js | deprecatedDisownOpener": {
|
|
2217
|
-
"message": "
|
|
2217
|
+
"message": "`disown-opener` îś d̂ép̂ŕêćât́êd́ ŝín̂ćê ĆŜṔ3. P̂ĺêáŝé, ûśê t́ĥé Ĉŕôśŝ-Ór̂íĝín̂-Óp̂én̂ér̂-Ṕôĺîćŷ h́êád̂ér̂ ín̂śt̂éâd́."
|
|
2218
2218
|
},
|
|
2219
2219
|
"core/lib/csp-evaluator.js | deprecatedReferrer": {
|
|
2220
|
-
"message": "
|
|
2220
|
+
"message": "`referrer` îś d̂ép̂ŕêćât́êd́ ŝín̂ćê ĆŜṔ2. P̂ĺêáŝé, ûśê t́ĥé R̂éf̂ér̂ŕêŕ-P̂ól̂íĉý ĥéâd́êŕ îńŝt́êád̂."
|
|
2221
2221
|
},
|
|
2222
2222
|
"core/lib/csp-evaluator.js | deprecatedReflectedXSS": {
|
|
2223
|
-
"message": "
|
|
2223
|
+
"message": "`reflected-xss` îś d̂ép̂ŕêćât́êd́ ŝín̂ćê ĆŜṔ2. P̂ĺêáŝé, ûśê t́ĥé X̂-X́ŜŚ-P̂ŕôt́êćt̂íôń ĥéâd́êŕ îńŝt́êád̂."
|
|
2224
2224
|
},
|
|
2225
2225
|
"core/lib/csp-evaluator.js | missingBaseUri": {
|
|
2226
|
-
"message": "M̂íŝśîńĝ
|
|
2226
|
+
"message": "M̂íŝśîńĝ `base-uri` ál̂ĺôẃŝ ín̂j́êćt̂éd̂ `<base>` t́âǵŝ t́ô śêt́ t̂h́ê b́âśê ÚR̂Ĺ f̂ór̂ ál̂ĺ r̂él̂át̂ív̂é ÛŔL̂ś (ê.ǵ. ŝćr̂íp̂t́ŝ) t́ô án̂ át̂t́âćk̂ér̂ ćôńt̂ŕôĺl̂éd̂ d́ôḿâín̂. Ćôńŝíd̂ér̂ śêt́t̂ín̂ǵ `base-uri` t̂ó `'none'` ôŕ `'self'`."
|
|
2227
2227
|
},
|
|
2228
2228
|
"core/lib/csp-evaluator.js | missingObjectSrc": {
|
|
2229
|
-
"message": "M̂íŝśîńĝ
|
|
2229
|
+
"message": "M̂íŝśîńĝ `object-src` ál̂ĺôẃŝ t́ĥé îńĵéĉt́îón̂ óf̂ ṕl̂úĝín̂ś t̂h́ât́ êx́êćût́ê ún̂śâf́ê śĉŕîṕt̂ś. Ĉón̂śîd́êŕ ŝét̂t́îńĝ `object-src` t́ô `'none'` íf̂ ýôú ĉán̂."
|
|
2230
2230
|
},
|
|
2231
2231
|
"core/lib/csp-evaluator.js | missingScriptSrc": {
|
|
2232
|
-
"message": "
|
|
2232
|
+
"message": "`script-src` d̂ír̂éĉt́îv́ê íŝ ḿîśŝín̂ǵ. T̂h́îś ĉán̂ ál̂ĺôẃ t̂h́ê éx̂éĉút̂íôń ôf́ ûńŝáf̂é ŝćr̂íp̂t́ŝ."
|
|
2233
2233
|
},
|
|
2234
2234
|
"core/lib/csp-evaluator.js | missingSemicolon": {
|
|
2235
2235
|
"message": "D̂íd̂ ýôú f̂ór̂ǵêt́ t̂h́ê śêḿîćôĺôń? {keyword} ŝéêḿŝ t́ô b́ê á d̂ír̂éĉt́îv́ê, ńôt́ â ḱêýŵór̂d́."
|
|
@@ -2250,10 +2250,10 @@
|
|
|
2250
2250
|
"message": "N̂ó ĈŚP̂ ćôńf̂íĝúr̂éŝ á r̂ép̂ór̂t́îńĝ d́êśt̂ín̂át̂íôń. T̂h́îś m̂ák̂éŝ ít̂ d́îf́f̂íĉúl̂t́ t̂ó m̂áîńt̂áîń t̂h́ê ĆŜṔ ôv́êŕ t̂ím̂é âńd̂ ḿôńît́ôŕ f̂ór̂ án̂ý b̂ŕêák̂áĝéŝ."
|
|
2251
2251
|
},
|
|
2252
2252
|
"core/lib/csp-evaluator.js | reportToOnly": {
|
|
2253
|
-
"message": "T̂h́ê ŕêṕôŕt̂ín̂ǵ d̂éŝt́îńât́îón̂ íŝ ón̂ĺŷ ćôńf̂íĝúr̂éd̂ v́îá t̂h́ê ŕêṕôŕt̂-t́ô d́îŕêćt̂ív̂é. T̂h́îś d̂ír̂éĉt́îv́ê íŝ ón̂ĺŷ śûṕp̂ór̂t́êd́ îń Ĉh́r̂óm̂íûḿ-b̂áŝéd̂ b́r̂óŵśêŕŝ śô ít̂ íŝ ŕêćôḿm̂én̂d́êd́ t̂ó âĺŝó ûśê á r̂é
|
|
2253
|
+
"message": "T̂h́ê ŕêṕôŕt̂ín̂ǵ d̂éŝt́îńât́îón̂ íŝ ón̂ĺŷ ćôńf̂íĝúr̂éd̂ v́îá t̂h́ê ŕêṕôŕt̂-t́ô d́îŕêćt̂ív̂é. T̂h́îś d̂ír̂éĉt́îv́ê íŝ ón̂ĺŷ śûṕp̂ór̂t́êd́ îń Ĉh́r̂óm̂íûḿ-b̂áŝéd̂ b́r̂óŵśêŕŝ śô ít̂ íŝ ŕêćôḿm̂én̂d́êd́ t̂ó âĺŝó ûśê á `report-uri` d̂ír̂éĉt́îv́ê."
|
|
2254
2254
|
},
|
|
2255
2255
|
"core/lib/csp-evaluator.js | strictDynamic": {
|
|
2256
|
-
"message": "Ĥóŝt́ âĺl̂óŵĺîśt̂ś ĉán̂ f́r̂éq̂úêńt̂ĺŷ b́ê b́ŷṕâśŝéd̂. Ćôńŝíd̂ér̂ úŝín̂ǵ ĈŚP̂ ńôńĉéŝ ór̂ h́âśĥéŝ ín̂śt̂éâd́, âĺôńĝ ẃît́ĥ '
|
|
2256
|
+
"message": "Ĥóŝt́ âĺl̂óŵĺîśt̂ś ĉán̂ f́r̂éq̂úêńt̂ĺŷ b́ê b́ŷṕâśŝéd̂. Ćôńŝíd̂ér̂ úŝín̂ǵ ĈŚP̂ ńôńĉéŝ ór̂ h́âśĥéŝ ín̂śt̂éâd́, âĺôńĝ ẃît́ĥ `'strict-dynamic'` íf̂ ńêćêśŝár̂ý."
|
|
2257
2257
|
},
|
|
2258
2258
|
"core/lib/csp-evaluator.js | unknownDirective": {
|
|
2259
2259
|
"message": "Ûńk̂ńôẃn̂ ĆŜṔ d̂ír̂éĉt́îv́ê."
|
|
@@ -2262,10 +2262,10 @@
|
|
|
2262
2262
|
"message": "{keyword} ŝéêḿŝ t́ô b́ê án̂ ín̂v́âĺîd́ k̂éŷẃôŕd̂."
|
|
2263
2263
|
},
|
|
2264
2264
|
"core/lib/csp-evaluator.js | unsafeInline": {
|
|
2265
|
-
"message": "'
|
|
2265
|
+
"message": "`'unsafe-inline'` âĺl̂óŵś t̂h́ê éx̂éĉút̂íôń ôf́ ûńŝáf̂é îń-p̂áĝé ŝćr̂íp̂t́ŝ án̂d́ êv́êńt̂ h́âńd̂ĺêŕŝ. Ćôńŝíd̂ér̂ úŝín̂ǵ ĈŚP̂ ńôńĉéŝ ór̂ h́âśĥéŝ t́ô ál̂ĺôẃ ŝćr̂íp̂t́ŝ ín̂d́îv́îd́ûál̂ĺŷ."
|
|
2266
2266
|
},
|
|
2267
2267
|
"core/lib/csp-evaluator.js | unsafeInlineFallback": {
|
|
2268
|
-
"message": "Ĉón̂śîd́êŕ âd́d̂ín̂ǵ '
|
|
2268
|
+
"message": "Ĉón̂śîd́êŕ âd́d̂ín̂ǵ `'unsafe-inline'` (îǵn̂ór̂éd̂ b́ŷ b́r̂óŵśêŕŝ śûṕp̂ór̂t́îńĝ ńôńĉéŝ/h́âśĥéŝ) t́ô b́ê b́âćk̂ẃâŕd̂ ćôḿp̂át̂íb̂ĺê ẃît́ĥ ól̂d́êŕ b̂ŕôẃŝér̂ś."
|
|
2269
2269
|
},
|
|
2270
2270
|
"core/lib/deprecation-description.js | feature": {
|
|
2271
2271
|
"message": "Ĉh́êćk̂ t́ĥé f̂éât́ûŕê śt̂át̂úŝ ṕâǵê f́ôŕ m̂ór̂é d̂ét̂áîĺŝ."
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2018 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {swapLocale} from './swap-locale.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import _set from 'lodash/set.js';
|
package/shared/root.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import fs from 'fs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
// The exact double values for the max and min scores possible in each range.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
7
|
* @fileoverview A collection of general type verification functions for dealing
|
|
@@ -19,5 +19,5 @@ export function isObjectOfUnknownValues(val: unknown): val is Record<string, unk
|
|
|
19
19
|
* @param {unknown} val
|
|
20
20
|
* @return {val is Record<string, unknown>|Array<unknown>}
|
|
21
21
|
*/
|
|
22
|
-
export function isObjectOrArrayOfUnknownValues(val: unknown): val is
|
|
22
|
+
export function isObjectOrArrayOfUnknownValues(val: unknown): val is Record<string, unknown> | unknown[];
|
|
23
23
|
//# sourceMappingURL=type-verifiers.d.ts.map
|
package/shared/type-verifiers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/**
|
package/shared/types/shared.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {IcuMessage as IcuMessage_} from '../../types/lhr/i18n';
|
package/shared/util.d.ts
CHANGED
|
@@ -130,5 +130,27 @@ export class Util {
|
|
|
130
130
|
lineNumber: number;
|
|
131
131
|
truncated?: boolean | undefined;
|
|
132
132
|
}[];
|
|
133
|
+
/**
|
|
134
|
+
* Computes a score between 0 and 1 based on the measured `value`. Score is determined by
|
|
135
|
+
* considering a log-normal distribution governed by two control points (the 10th
|
|
136
|
+
* percentile value and the median value) and represents the percentage of sites that are
|
|
137
|
+
* greater than `value`.
|
|
138
|
+
*
|
|
139
|
+
* Score characteristics:
|
|
140
|
+
* - within [0, 1]
|
|
141
|
+
* - rounded to two digits
|
|
142
|
+
* - value must meet or beat a controlPoint value to meet or exceed its percentile score:
|
|
143
|
+
* - value > median will give a score < 0.5; value ≤ median will give a score ≥ 0.5.
|
|
144
|
+
* - value > p10 will give a score < 0.9; value ≤ p10 will give a score ≥ 0.9.
|
|
145
|
+
* - values < p10 will get a slight boost so a score of 1 is achievable by a
|
|
146
|
+
* `value` other than those close to 0. Scores of > ~0.99524 end up rounded to 1.
|
|
147
|
+
* @param {{median: number, p10: number}} controlPoints
|
|
148
|
+
* @param {number} value
|
|
149
|
+
* @return {number}
|
|
150
|
+
*/
|
|
151
|
+
static computeLogNormalScore(controlPoints: {
|
|
152
|
+
median: number;
|
|
153
|
+
p10: number;
|
|
154
|
+
}, value: number): number;
|
|
133
155
|
}
|
|
134
156
|
//# sourceMappingURL=util.d.ts.map
|
package/shared/util.js
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright 2017
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
5
|
*/
|
|
17
6
|
|
|
7
|
+
import * as statistics from './statistics.js';
|
|
8
|
+
|
|
18
9
|
/** @typedef {import('../types/lhr/audit-details').default.SnippetValue} SnippetValue */
|
|
19
10
|
|
|
20
11
|
const ELLIPSIS = '\u2026';
|
|
@@ -373,6 +364,35 @@ class Util {
|
|
|
373
364
|
|
|
374
365
|
return lines.filter(line => lineNumbersToKeep.has(line.lineNumber));
|
|
375
366
|
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Computes a score between 0 and 1 based on the measured `value`. Score is determined by
|
|
370
|
+
* considering a log-normal distribution governed by two control points (the 10th
|
|
371
|
+
* percentile value and the median value) and represents the percentage of sites that are
|
|
372
|
+
* greater than `value`.
|
|
373
|
+
*
|
|
374
|
+
* Score characteristics:
|
|
375
|
+
* - within [0, 1]
|
|
376
|
+
* - rounded to two digits
|
|
377
|
+
* - value must meet or beat a controlPoint value to meet or exceed its percentile score:
|
|
378
|
+
* - value > median will give a score < 0.5; value ≤ median will give a score ≥ 0.5.
|
|
379
|
+
* - value > p10 will give a score < 0.9; value ≤ p10 will give a score ≥ 0.9.
|
|
380
|
+
* - values < p10 will get a slight boost so a score of 1 is achievable by a
|
|
381
|
+
* `value` other than those close to 0. Scores of > ~0.99524 end up rounded to 1.
|
|
382
|
+
* @param {{median: number, p10: number}} controlPoints
|
|
383
|
+
* @param {number} value
|
|
384
|
+
* @return {number}
|
|
385
|
+
*/
|
|
386
|
+
static computeLogNormalScore(controlPoints, value) {
|
|
387
|
+
let percentile = statistics.getLogNormalScore(controlPoints, value);
|
|
388
|
+
// Add a boost to scores of 90+, linearly ramping from 0 at 0.9 to half a
|
|
389
|
+
// point (0.005) at 1. Expands scores in (0.9, 1] to (0.9, 1.005], so more top
|
|
390
|
+
// scores will be a perfect 1 after the two-digit `Math.floor()` rounding below.
|
|
391
|
+
if (percentile > 0.9) { // getLogNormalScore ensures `percentile` can't exceed 1.
|
|
392
|
+
percentile += 0.05 * (percentile - 0.9);
|
|
393
|
+
}
|
|
394
|
+
return Math.floor(percentile * 100) / 100;
|
|
395
|
+
}
|
|
376
396
|
}
|
|
377
397
|
|
|
378
398
|
export {
|