lighthouse 11.7.0 → 12.0.0-dev.20240422
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 +2 -2
- package/cli/bin.js +0 -7
- package/cli/cli-flags.d.ts +1 -5
- package/cli/cli-flags.js +4 -8
- package/cli/test/smokehouse/__snapshots__/report-assert-test.js.snap +14 -14
- package/cli/test/smokehouse/config/exclusions.js +3 -0
- package/cli/test/smokehouse/core-tests.js +6 -20
- package/cli/test/smokehouse/frontends/smokehouse-bin.js +2 -2
- package/core/audits/accessibility/accesskeys.js +1 -1
- package/core/audits/accessibility/aria-allowed-attr.js +1 -1
- package/core/audits/accessibility/aria-allowed-role.js +1 -1
- package/core/audits/accessibility/aria-command-name.js +1 -1
- package/core/audits/accessibility/aria-conditional-attr.d.ts +10 -0
- package/core/audits/accessibility/aria-conditional-attr.js +43 -0
- package/core/audits/accessibility/{duplicate-id-active.d.ts → aria-deprecated-role.d.ts} +3 -3
- package/core/audits/accessibility/aria-deprecated-role.js +43 -0
- package/core/audits/accessibility/aria-dialog-name.js +1 -1
- package/core/audits/accessibility/aria-hidden-body.js +1 -1
- package/core/audits/accessibility/aria-hidden-focus.js +1 -1
- package/core/audits/accessibility/aria-input-field-name.js +1 -1
- package/core/audits/accessibility/aria-meter-name.js +1 -1
- package/core/audits/accessibility/aria-progressbar-name.js +1 -1
- package/core/audits/accessibility/aria-prohibited-attr.d.ts +10 -0
- package/core/audits/accessibility/aria-prohibited-attr.js +44 -0
- package/core/audits/accessibility/aria-required-attr.js +1 -1
- package/core/audits/accessibility/aria-required-children.js +1 -1
- package/core/audits/accessibility/aria-required-parent.js +1 -1
- package/core/audits/accessibility/aria-roles.js +1 -1
- package/core/audits/accessibility/aria-text.js +1 -1
- package/core/audits/accessibility/aria-toggle-field-name.js +1 -1
- package/core/audits/accessibility/aria-tooltip-name.js +1 -1
- package/core/audits/accessibility/aria-treeitem-name.js +1 -1
- package/core/audits/accessibility/aria-valid-attr-value.js +1 -1
- package/core/audits/accessibility/aria-valid-attr.js +1 -1
- package/core/audits/accessibility/button-name.js +1 -1
- package/core/audits/accessibility/bypass.js +1 -1
- package/core/audits/accessibility/color-contrast.js +1 -1
- package/core/audits/accessibility/definition-list.js +1 -1
- package/core/audits/accessibility/dlitem.js +1 -1
- package/core/audits/accessibility/document-title.js +1 -1
- package/core/audits/accessibility/duplicate-id-aria.js +1 -1
- package/core/audits/accessibility/empty-heading.js +1 -1
- package/core/audits/accessibility/form-field-multiple-labels.js +1 -1
- package/core/audits/accessibility/frame-title.js +1 -1
- package/core/audits/accessibility/heading-order.js +1 -1
- package/core/audits/accessibility/html-has-lang.js +1 -1
- package/core/audits/accessibility/html-lang-valid.js +1 -1
- package/core/audits/accessibility/html-xml-lang-mismatch.js +1 -1
- package/core/audits/accessibility/identical-links-same-purpose.js +1 -1
- package/core/audits/accessibility/image-alt.js +1 -1
- package/core/audits/accessibility/image-redundant-alt.js +1 -1
- package/core/audits/accessibility/input-button-name.js +1 -1
- package/core/audits/accessibility/input-image-alt.js +1 -1
- package/core/audits/accessibility/label-content-name-mismatch.js +1 -1
- package/core/audits/accessibility/label.js +1 -1
- package/core/audits/accessibility/landmark-one-main.js +1 -1
- package/core/audits/accessibility/link-in-text-block.js +1 -1
- package/core/audits/accessibility/link-name.js +1 -1
- package/core/audits/accessibility/list.js +1 -1
- package/core/audits/accessibility/listitem.js +1 -1
- package/core/audits/accessibility/meta-refresh.js +1 -1
- package/core/audits/accessibility/meta-viewport.js +1 -1
- package/core/audits/accessibility/object-alt.js +1 -1
- package/core/audits/accessibility/select-name.js +1 -1
- package/core/audits/accessibility/skip-link.js +1 -1
- package/core/audits/accessibility/tabindex.js +1 -1
- package/core/audits/accessibility/table-duplicate-name.js +1 -1
- package/core/audits/accessibility/table-fake-caption.js +1 -1
- package/core/audits/accessibility/target-size.js +1 -2
- package/core/audits/accessibility/td-has-header.js +1 -1
- package/core/audits/accessibility/td-headers-attr.js +1 -1
- package/core/audits/accessibility/th-has-data-cells.js +1 -1
- package/core/audits/accessibility/valid-lang.js +1 -1
- package/core/audits/accessibility/video-caption.js +1 -1
- package/core/audits/byte-efficiency/byte-efficiency-audit.d.ts +0 -16
- package/core/audits/byte-efficiency/byte-efficiency-audit.js +1 -38
- package/core/audits/byte-efficiency/offscreen-images.d.ts +0 -11
- package/core/audits/byte-efficiency/offscreen-images.js +0 -15
- package/core/audits/byte-efficiency/render-blocking-resources.js +27 -26
- package/core/audits/byte-efficiency/unminified-css.js +2 -2
- package/core/audits/byte-efficiency/unused-css-rules.js +3 -1
- package/core/audits/dobetterweb/uses-http2.d.ts +0 -13
- package/core/audits/dobetterweb/uses-http2.js +4 -38
- package/core/audits/font-display.js +2 -2
- package/core/audits/layout-shifts.js +2 -2
- package/core/audits/preload-fonts.d.ts +1 -5
- package/core/audits/preload-fonts.js +1 -10
- package/core/audits/prioritize-lcp-image.js +2 -2
- package/core/audits/redirects-http.d.ts +19 -0
- package/core/audits/redirects-http.js +75 -0
- package/core/audits/resource-summary.d.ts +2 -0
- package/core/audits/resource-summary.js +5 -4
- package/core/audits/seo/is-crawlable.d.ts +2 -1
- package/core/audits/seo/link-text.js +12 -0
- package/core/audits/uses-rel-preload.d.ts +1 -5
- package/core/audits/uses-rel-preload.js +5 -15
- package/core/audits/work-during-interaction.d.ts +2 -2
- package/core/audits/work-during-interaction.js +2 -2
- package/core/computed/js-bundles.d.ts +1 -1
- package/core/computed/metrics/cumulative-layout-shift.js +2 -2
- package/core/computed/metrics/lantern-first-contentful-paint.d.ts +13 -82
- package/core/computed/metrics/lantern-first-contentful-paint.js +16 -178
- package/core/computed/metrics/lantern-first-meaningful-paint.d.ts +13 -12
- package/core/computed/metrics/lantern-first-meaningful-paint.js +11 -49
- package/core/computed/metrics/lantern-interactive.d.ts +13 -21
- package/core/computed/metrics/lantern-interactive.js +12 -84
- package/core/computed/metrics/lantern-largest-contentful-paint.d.ts +13 -25
- package/core/computed/metrics/lantern-largest-contentful-paint.js +13 -80
- package/core/computed/metrics/lantern-max-potential-fid.d.ts +13 -24
- package/core/computed/metrics/lantern-max-potential-fid.js +12 -64
- package/core/computed/metrics/lantern-metric.d.ts +14 -18
- package/core/computed/metrics/lantern-metric.js +34 -30
- package/core/computed/metrics/lantern-speed-index.d.ts +13 -32
- package/core/computed/metrics/lantern-speed-index.js +13 -116
- package/core/computed/metrics/lantern-total-blocking-time.d.ts +13 -25
- package/core/computed/metrics/lantern-total-blocking-time.js +10 -94
- package/core/computed/metrics/metric.js +1 -3
- package/core/computed/module-duplication.d.ts +1 -1
- package/core/computed/navigation-insights.d.ts +36 -0
- package/core/computed/navigation-insights.js +35 -0
- package/core/computed/page-dependency-graph.js +3 -7
- package/core/computed/resource-summary.d.ts +10 -12
- package/core/computed/resource-summary.js +12 -19
- package/core/computed/trace-engine-result.d.ts +16 -3
- package/core/computed/trace-engine-result.js +19 -14
- package/core/computed/unused-css.d.ts +3 -1
- package/core/computed/unused-css.js +6 -5
- package/core/config/config-helpers.js +0 -4
- package/core/config/constants.js +0 -1
- package/core/config/default-config.js +63 -142
- package/core/config/experimental-config.js +11 -0
- package/core/config/filters.js +0 -1
- package/core/gather/driver/navigation.js +4 -1
- package/core/gather/driver/prepare.js +1 -1
- package/core/gather/driver/target-manager.js +4 -3
- package/core/gather/driver/wait-for-condition.js +2 -3
- package/core/gather/driver.d.ts +12 -0
- package/core/gather/driver.js +27 -0
- package/core/gather/gatherers/accessibility.js +4 -6
- package/core/gather/gatherers/css-usage.d.ts +0 -21
- package/core/gather/gatherers/css-usage.js +9 -119
- package/core/gather/gatherers/root-causes.d.ts +2 -2
- package/core/gather/gatherers/root-causes.js +6 -5
- package/core/gather/gatherers/stylesheets.d.ts +26 -0
- package/core/gather/gatherers/stylesheets.js +138 -0
- package/core/gather/gatherers/trace-elements.d.ts +4 -13
- package/core/gather/gatherers/trace-elements.js +42 -31
- package/core/gather/navigation-runner.js +3 -1
- package/core/gather/session.d.ts +8 -0
- package/core/gather/session.js +14 -1
- package/core/lib/emulation.js +2 -2
- package/core/lib/i18n/i18n.d.ts +0 -1
- package/core/lib/i18n/i18n.js +0 -2
- package/core/lib/lantern/cpu-node.d.ts +7 -1
- package/core/lib/lantern/cpu-node.js +12 -2
- package/core/lib/lantern/lantern-error.d.ts +8 -0
- package/core/lib/lantern/lantern-error.js +9 -0
- package/core/lib/lantern/metric.js +2 -6
- package/core/lib/lantern/metrics/first-contentful-paint.d.ts +79 -0
- package/core/lib/lantern/metrics/first-contentful-paint.js +200 -0
- package/core/lib/lantern/metrics/first-meaningful-paint.d.ts +6 -0
- package/core/lib/lantern/metrics/first-meaningful-paint.js +64 -0
- package/core/lib/lantern/metrics/interactive.d.ts +26 -0
- package/core/lib/lantern/metrics/interactive.js +112 -0
- package/core/lib/lantern/metrics/largest-contentful-paint.d.ts +19 -0
- package/core/lib/lantern/metrics/largest-contentful-paint.js +108 -0
- package/core/lib/lantern/metrics/max-potential-fid.d.ts +30 -0
- package/core/lib/lantern/metrics/max-potential-fid.js +92 -0
- package/core/lib/lantern/metrics/speed-index.d.ts +38 -0
- package/core/lib/lantern/metrics/speed-index.js +144 -0
- package/core/lib/lantern/metrics/total-blocking-time.d.ts +31 -0
- package/core/lib/lantern/metrics/total-blocking-time.js +128 -0
- package/core/lib/lantern/network-node.js +28 -4
- package/core/lib/lantern/page-dependency-graph.d.ts +4 -4
- package/core/lib/lantern/page-dependency-graph.js +19 -7
- package/core/lib/lantern/simulator/connection-pool.d.ts +2 -12
- package/core/lib/lantern/simulator/connection-pool.js +3 -22
- package/core/lib/lantern/simulator/network-analyzer.js +1 -12
- package/core/lib/lantern/simulator/simulator.d.ts +2 -4
- package/core/lib/lantern/simulator/simulator.js +7 -14
- package/core/lib/lantern/types/lantern.d.ts +5 -3
- package/core/lib/lantern-trace-saver.js +0 -1
- package/core/lib/lh-error.d.ts +9 -0
- package/core/lib/lh-error.js +13 -3
- package/core/lib/lighthouse-compatibility.js +53 -10
- package/core/lib/navigation-error.js +3 -0
- package/core/lib/network-request.d.ts +1 -0
- package/core/lib/network-request.js +29 -1
- package/core/lib/proto-preprocessor.js +24 -8
- package/core/lib/tracehouse/trace-processor.js +15 -2
- package/core/runner.js +18 -25
- package/dist/report/bundle.esm.js +11 -112
- package/dist/report/flow.js +16 -117
- package/dist/report/standalone.js +12 -113
- package/flow-report/src/help-dialog.tsx +0 -1
- package/flow-report/src/i18n/i18n.d.ts +0 -4
- package/flow-report/src/i18n/ui-strings.d.ts +0 -1
- package/flow-report/src/i18n/ui-strings.js +0 -2
- package/flow-report/src/summary/category.tsx +10 -12
- package/package.json +7 -7
- package/readme.md +4 -4
- package/report/assets/styles.css +1 -60
- package/report/assets/templates.html +0 -95
- package/report/renderer/category-renderer.js +1 -1
- package/report/renderer/components.d.ts +2 -2
- package/report/renderer/components.js +2 -103
- package/report/renderer/dom.d.ts +1 -1
- package/report/renderer/dom.js +1 -1
- package/report/renderer/performance-category-renderer.d.ts +0 -7
- package/report/renderer/performance-category-renderer.js +1 -32
- package/report/renderer/report-renderer.js +3 -13
- package/report/renderer/report-ui-features.js +1 -1
- package/report/renderer/report-utils.d.ts +0 -1
- package/report/renderer/report-utils.js +13 -13
- package/shared/localization/locales/ar-XB.json +62 -329
- package/shared/localization/locales/ar.json +62 -329
- package/shared/localization/locales/bg.json +62 -329
- package/shared/localization/locales/ca.json +62 -329
- package/shared/localization/locales/cs.json +62 -329
- package/shared/localization/locales/da.json +62 -329
- package/shared/localization/locales/de.json +62 -329
- package/shared/localization/locales/el.json +62 -329
- package/shared/localization/locales/en-GB.json +62 -329
- package/shared/localization/locales/en-US.json +101 -332
- package/shared/localization/locales/en-XA.json +62 -329
- package/shared/localization/locales/en-XL.json +101 -332
- package/shared/localization/locales/es-419.json +62 -329
- package/shared/localization/locales/es.json +62 -329
- package/shared/localization/locales/fi.json +62 -329
- package/shared/localization/locales/fil.json +61 -328
- package/shared/localization/locales/fr.json +62 -329
- package/shared/localization/locales/he.json +62 -329
- package/shared/localization/locales/hi.json +62 -329
- package/shared/localization/locales/hr.json +63 -330
- package/shared/localization/locales/hu.json +62 -329
- package/shared/localization/locales/id.json +62 -329
- package/shared/localization/locales/it.json +62 -329
- package/shared/localization/locales/ja.json +62 -329
- package/shared/localization/locales/ko.json +62 -329
- package/shared/localization/locales/lt.json +62 -329
- package/shared/localization/locales/lv.json +62 -329
- package/shared/localization/locales/nl.json +62 -329
- package/shared/localization/locales/no.json +62 -329
- package/shared/localization/locales/pl.json +61 -328
- package/shared/localization/locales/pt-PT.json +62 -329
- package/shared/localization/locales/pt.json +64 -331
- package/shared/localization/locales/ro.json +62 -329
- package/shared/localization/locales/ru.json +62 -329
- package/shared/localization/locales/sk.json +62 -329
- package/shared/localization/locales/sl.json +62 -329
- package/shared/localization/locales/sr-Latn.json +62 -329
- package/shared/localization/locales/sr.json +62 -329
- package/shared/localization/locales/sv.json +62 -329
- package/shared/localization/locales/ta.json +61 -328
- package/shared/localization/locales/te.json +62 -329
- package/shared/localization/locales/th.json +62 -329
- package/shared/localization/locales/tr.json +62 -329
- package/shared/localization/locales/uk.json +62 -329
- package/shared/localization/locales/vi.json +61 -328
- package/shared/localization/locales/zh-HK.json +62 -329
- package/shared/localization/locales/zh-TW.json +61 -328
- package/shared/localization/locales/zh.json +62 -329
- package/tsconfig.json +1 -3
- package/types/artifacts.d.ts +21 -110
- package/types/audit.d.ts +0 -10
- package/types/config.d.ts +0 -1
- package/types/externs.d.ts +0 -2
- package/types/gatherer.d.ts +3 -0
- package/types/internal/smokehouse.d.ts +1 -1
- package/types/lh.d.ts +0 -2
- package/types/lhr/audit-details.d.ts +9 -4
- package/types/lhr/lhr.d.ts +0 -4
- package/types/lhr/settings.d.ts +0 -4
- package/core/audits/accessibility/duplicate-id-active.js +0 -42
- package/core/audits/content-width.d.ts +0 -17
- package/core/audits/content-width.js +0 -76
- package/core/audits/installable-manifest.d.ts +0 -111
- package/core/audits/installable-manifest.js +0 -248
- package/core/audits/layout-shift-elements.d.ts +0 -16
- package/core/audits/layout-shift-elements.js +0 -101
- package/core/audits/manual/pwa-cross-browser.d.ts +0 -12
- package/core/audits/manual/pwa-cross-browser.js +0 -40
- package/core/audits/manual/pwa-each-page-has-url.d.ts +0 -12
- package/core/audits/manual/pwa-each-page-has-url.js +0 -38
- package/core/audits/manual/pwa-page-transitions.d.ts +0 -12
- package/core/audits/manual/pwa-page-transitions.js +0 -38
- package/core/audits/maskable-icon.d.ts +0 -25
- package/core/audits/maskable-icon.js +0 -70
- package/core/audits/multi-check-audit.d.ts +0 -28
- package/core/audits/multi-check-audit.js +0 -82
- package/core/audits/no-unload-listeners.d.ts +0 -16
- package/core/audits/no-unload-listeners.js +0 -86
- package/core/audits/performance-budget.d.ts +0 -39
- package/core/audits/performance-budget.js +0 -154
- package/core/audits/script-elements-test-audit.d.ts +0 -14
- package/core/audits/script-elements-test-audit.js +0 -29
- package/core/audits/seo/plugins.d.ts +0 -15
- package/core/audits/seo/plugins.js +0 -150
- package/core/audits/seo/tap-targets.d.ts +0 -50
- package/core/audits/seo/tap-targets.js +0 -352
- package/core/audits/splash-screen.d.ts +0 -37
- package/core/audits/splash-screen.js +0 -98
- package/core/audits/themed-omnibox.d.ts +0 -42
- package/core/audits/themed-omnibox.js +0 -102
- package/core/audits/timing-budget.d.ts +0 -43
- package/core/audits/timing-budget.js +0 -175
- package/core/computed/manifest-values.d.ts +0 -24
- package/core/computed/manifest-values.js +0 -136
- package/core/config/budget.d.ts +0 -74
- package/core/config/budget.js +0 -340
- package/core/config/metrics-to-audits.d.ts +0 -19
- package/core/config/metrics-to-audits.js +0 -62
- package/core/gather/driver/service-workers.d.ts +0 -16
- package/core/gather/driver/service-workers.js +0 -52
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.d.ts +0 -47
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +0 -233
- package/core/gather/gatherers/global-listeners.d.ts +0 -27
- package/core/gather/gatherers/global-listeners.js +0 -108
- package/core/gather/gatherers/installability-errors.d.ts +0 -17
- package/core/gather/gatherers/installability-errors.js +0 -56
- package/core/gather/gatherers/script-elements.d.ts +0 -21
- package/core/gather/gatherers/script-elements.js +0 -100
- package/core/gather/gatherers/seo/embedded-content.d.ts +0 -10
- package/core/gather/gatherers/seo/embedded-content.js +0 -63
- package/core/gather/gatherers/seo/tap-targets.d.ts +0 -21
- package/core/gather/gatherers/seo/tap-targets.js +0 -389
- package/core/gather/gatherers/service-worker.d.ts +0 -10
- package/core/gather/gatherers/service-worker.js +0 -32
- package/core/gather/gatherers/web-app-manifest.d.ts +0 -32
- package/core/gather/gatherers/web-app-manifest.js +0 -106
- package/report/renderer/pwa-category-renderer.d.ts +0 -55
- package/report/renderer/pwa-category-renderer.js +0 -184
- package/third-party/chromium-synchronization/installability-errors-test.js +0 -79
- package/types/lhr/budget.d.ts +0 -60
|
@@ -8,6 +8,20 @@ import * as TraceEngine from '../lib/trace-engine.js';
|
|
|
8
8
|
import {makeComputedArtifact} from './computed-artifact.js';
|
|
9
9
|
import {CumulativeLayoutShift} from './metrics/cumulative-layout-shift.js';
|
|
10
10
|
import {ProcessedTrace} from './processed-trace.js';
|
|
11
|
+
import * as LH from '../../types/lh.js';
|
|
12
|
+
|
|
13
|
+
/** @typedef {typeof ENABLED_HANDLERS} EnabledHandlers */
|
|
14
|
+
|
|
15
|
+
const ENABLED_HANDLERS = {
|
|
16
|
+
AuctionWorklets: TraceEngine.TraceHandlers.AuctionWorklets,
|
|
17
|
+
Initiators: TraceEngine.TraceHandlers.Initiators,
|
|
18
|
+
LayoutShifts: TraceEngine.TraceHandlers.LayoutShifts,
|
|
19
|
+
NetworkRequests: TraceEngine.TraceHandlers.NetworkRequests,
|
|
20
|
+
Renderer: TraceEngine.TraceHandlers.Renderer,
|
|
21
|
+
Samples: TraceEngine.TraceHandlers.Samples,
|
|
22
|
+
Screenshots: TraceEngine.TraceHandlers.Screenshots,
|
|
23
|
+
PageLoadMetrics: TraceEngine.TraceHandlers.PageLoadMetrics,
|
|
24
|
+
};
|
|
11
25
|
|
|
12
26
|
/**
|
|
13
27
|
* @fileoverview Processes trace with the shared trace engine.
|
|
@@ -15,24 +29,18 @@ import {ProcessedTrace} from './processed-trace.js';
|
|
|
15
29
|
class TraceEngineResult {
|
|
16
30
|
/**
|
|
17
31
|
* @param {LH.TraceEvent[]} traceEvents
|
|
32
|
+
* @return {Promise<LH.Artifacts.TraceEngineResult>}
|
|
18
33
|
*/
|
|
19
34
|
static async runTraceEngine(traceEvents) {
|
|
20
|
-
const engine = new TraceEngine.TraceProcessor(
|
|
21
|
-
AuctionWorklets: TraceEngine.TraceHandlers.AuctionWorklets,
|
|
22
|
-
Initiators: TraceEngine.TraceHandlers.Initiators,
|
|
23
|
-
LayoutShifts: TraceEngine.TraceHandlers.LayoutShifts,
|
|
24
|
-
NetworkRequests: TraceEngine.TraceHandlers.NetworkRequests,
|
|
25
|
-
Renderer: TraceEngine.TraceHandlers.Renderer,
|
|
26
|
-
Samples: TraceEngine.TraceHandlers.Samples,
|
|
27
|
-
Screenshots: TraceEngine.TraceHandlers.Screenshots,
|
|
28
|
-
});
|
|
35
|
+
const engine = new TraceEngine.TraceProcessor(ENABLED_HANDLERS);
|
|
29
36
|
// eslint-disable-next-line max-len
|
|
30
37
|
await engine.parse(/** @type {import('@paulirish/trace_engine').Types.TraceEvents.TraceEventData[]} */ (
|
|
31
38
|
traceEvents
|
|
32
39
|
));
|
|
33
40
|
// TODO: use TraceEngine.TraceProcessor.createWithAllHandlers above.
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
if (!engine.traceParsedData) throw new Error('No data');
|
|
42
|
+
if (!engine.insights) throw new Error('No insights');
|
|
43
|
+
return {data: engine.traceParsedData, insights: engine.insights};
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
/**
|
|
@@ -67,9 +75,6 @@ class TraceEngineResult {
|
|
|
67
75
|
}
|
|
68
76
|
|
|
69
77
|
const result = await TraceEngineResult.runTraceEngine(traceEvents);
|
|
70
|
-
if (!result) {
|
|
71
|
-
throw new Error('null trace engine result');
|
|
72
|
-
}
|
|
73
78
|
return result;
|
|
74
79
|
}
|
|
75
80
|
}
|
|
@@ -5,6 +5,7 @@ export type StyleSheetInfo = LH.Artifacts.CSSStyleSheetInfo & {
|
|
|
5
5
|
};
|
|
6
6
|
declare const UnusedCSSComputed: typeof UnusedCSS & {
|
|
7
7
|
request: (dependencies: {
|
|
8
|
+
Stylesheets: LH.Artifacts['Stylesheets'];
|
|
8
9
|
CSSUsage: LH.Artifacts['CSSUsage'];
|
|
9
10
|
devtoolsLog: import("../index.js").DevtoolsLog;
|
|
10
11
|
}, context: import("../../types/utility-types.js").default.ImmutableObject<{
|
|
@@ -50,11 +51,12 @@ declare class UnusedCSS {
|
|
|
50
51
|
*/
|
|
51
52
|
static mapSheetToResult(stylesheetInfo: StyleSheetInfo): LH.Audit.ByteEfficiencyItem;
|
|
52
53
|
/**
|
|
53
|
-
* @param {{CSSUsage: LH.Artifacts['CSSUsage'], devtoolsLog: LH.DevtoolsLog}} data
|
|
54
|
+
* @param {{Stylesheets: LH.Artifacts['Stylesheets'], CSSUsage: LH.Artifacts['CSSUsage'], devtoolsLog: LH.DevtoolsLog}} data
|
|
54
55
|
* @param {LH.Artifacts.ComputedContext} context
|
|
55
56
|
* @return {Promise<LH.Audit.ByteEfficiencyItem[]>}
|
|
56
57
|
*/
|
|
57
58
|
static compute_(data: {
|
|
59
|
+
Stylesheets: LH.Artifacts['Stylesheets'];
|
|
58
60
|
CSSUsage: LH.Artifacts['CSSUsage'];
|
|
59
61
|
devtoolsLog: import("../index.js").DevtoolsLog;
|
|
60
62
|
}, context: LH.Artifacts.ComputedContext): Promise<LH.Audit.ByteEfficiencyItem[]>;
|
|
@@ -134,15 +134,15 @@ class UnusedCSS {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
/**
|
|
137
|
-
* @param {{CSSUsage: LH.Artifacts['CSSUsage'], devtoolsLog: LH.DevtoolsLog}} data
|
|
137
|
+
* @param {{Stylesheets: LH.Artifacts['Stylesheets'], CSSUsage: LH.Artifacts['CSSUsage'], devtoolsLog: LH.DevtoolsLog}} data
|
|
138
138
|
* @param {LH.Artifacts.ComputedContext} context
|
|
139
139
|
* @return {Promise<LH.Audit.ByteEfficiencyItem[]>}
|
|
140
140
|
*/
|
|
141
141
|
static async compute_(data, context) {
|
|
142
|
-
const {CSSUsage, devtoolsLog} = data;
|
|
142
|
+
const {CSSUsage, Stylesheets, devtoolsLog} = data;
|
|
143
143
|
const networkRecords = await NetworkRecords.request(devtoolsLog, context);
|
|
144
|
-
const indexedSheets = UnusedCSS.indexStylesheetsById(
|
|
145
|
-
UnusedCSS.indexUsedRules(CSSUsage
|
|
144
|
+
const indexedSheets = UnusedCSS.indexStylesheetsById(Stylesheets, networkRecords);
|
|
145
|
+
UnusedCSS.indexUsedRules(CSSUsage, indexedSheets);
|
|
146
146
|
|
|
147
147
|
const items = Object.keys(indexedSheets)
|
|
148
148
|
.map(sheetId => UnusedCSS.mapSheetToResult(indexedSheets[sheetId]));
|
|
@@ -150,5 +150,6 @@ class UnusedCSS {
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
const UnusedCSSComputed = makeComputedArtifact(UnusedCSS,
|
|
153
|
+
const UnusedCSSComputed = makeComputedArtifact(UnusedCSS,
|
|
154
|
+
['Stylesheets', 'CSSUsage', 'devtoolsLog']);
|
|
154
155
|
export {UnusedCSSComputed as UnusedCSS};
|
|
@@ -11,7 +11,6 @@ import url from 'url';
|
|
|
11
11
|
import isDeepEqual from 'lodash/isEqual.js';
|
|
12
12
|
|
|
13
13
|
import * as constants from './constants.js';
|
|
14
|
-
import {Budget} from './budget.js';
|
|
15
14
|
import ConfigPlugin from './config-plugin.js';
|
|
16
15
|
import {Runner} from '../runner.js';
|
|
17
16
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
@@ -347,9 +346,6 @@ function resolveSettings(settingsJson = {}, overrides = undefined) {
|
|
|
347
346
|
true
|
|
348
347
|
);
|
|
349
348
|
|
|
350
|
-
if (settingsWithFlags.budgets) {
|
|
351
|
-
settingsWithFlags.budgets = Budget.initializeBudget(settingsWithFlags.budgets);
|
|
352
|
-
}
|
|
353
349
|
// Locale is special and comes only from flags/settings/lookupLocale.
|
|
354
350
|
settingsWithFlags.locale = locale;
|
|
355
351
|
|
package/core/config/constants.js
CHANGED
|
@@ -118,7 +118,6 @@ const defaultSettings = {
|
|
|
118
118
|
|
|
119
119
|
// the following settings have no defaults but we still want ensure that `key in settings`
|
|
120
120
|
// in config will work in a typechecked way
|
|
121
|
-
budgets: null,
|
|
122
121
|
locale: 'en-US', // actual default determined by Config using lib/i18n
|
|
123
122
|
blockedUrlPatterns: null,
|
|
124
123
|
additionalTraceCategories: null,
|
|
@@ -9,21 +9,12 @@
|
|
|
9
9
|
import * as LH from '../../types/lh.js';
|
|
10
10
|
import * as constants from './constants.js';
|
|
11
11
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
12
|
-
import {metricsToAudits} from './metrics-to-audits.js';
|
|
13
12
|
|
|
14
13
|
const UIStrings = {
|
|
15
14
|
/** Title of the Performance category of audits. Equivalent to 'Web performance', this term is inclusive of all web page speed and loading optimization topics. Also used as a label of a score gauge; try to limit to 20 characters. */
|
|
16
15
|
performanceCategoryTitle: 'Performance',
|
|
17
|
-
/** Title of the Budgets section of the Performance Category. 'Budgets' refers to a budget (like a financial budget), but applied to the amount of resources on a page, rather than money. */
|
|
18
|
-
budgetsGroupTitle: 'Budgets',
|
|
19
|
-
/** Description of the Budgets section of the Performance category. Within this section the budget results are displayed. */
|
|
20
|
-
budgetsGroupDescription: 'Performance budgets set standards for the performance of your site.',
|
|
21
16
|
/** Title of the speed metrics section of the Performance category. Within this section are various speed metrics which quantify the pageload performance into values presented in seconds and milliseconds. */
|
|
22
17
|
metricGroupTitle: 'Metrics',
|
|
23
|
-
/** Title of the opportunity section of the Performance category. Within this section are audits with imperative titles that suggest actions the user can take to improve the loading performance of their web page. 'Suggestion'/'Optimization'/'Recommendation' are reasonable synonyms for 'opportunity' in this case. */
|
|
24
|
-
loadOpportunitiesGroupTitle: 'Opportunities',
|
|
25
|
-
/** Description of the opportunity section of the Performance category. 'Suggestions' could also be 'recommendations'. Within this section are audits with imperative titles that suggest actions the user can take to improve the loading performance of their web page. */
|
|
26
|
-
loadOpportunitiesGroupDescription: 'These suggestions can help your page load faster. They don\'t [directly affect](https://developer.chrome.com/docs/lighthouse/performance/performance-scoring/) the Performance score.',
|
|
27
18
|
/** Title of an opportunity sub-section of the Performance category. Within this section are audits with imperative titles that suggest actions the user can take to improve the time of the first initial render of the webpage. */
|
|
28
19
|
firstPaintImprovementsGroupTitle: 'First Paint Improvements',
|
|
29
20
|
/** Description of an opportunity sub-section of the Performance category. Within this section are audits with imperative titles that suggest actions the user can take to improve the time of the first initial render of the webpage. */
|
|
@@ -95,15 +86,6 @@ const UIStrings = {
|
|
|
95
86
|
seoCrawlingGroupTitle: 'Crawling and Indexing',
|
|
96
87
|
/** Description of the navigation section within the Search Engine Optimization (SEO) category. Within this section are audits with descriptive titles that highlight ways to make a website accessible to search engine crawlers. */
|
|
97
88
|
seoCrawlingGroupDescription: 'To appear in search results, crawlers need access to your app.',
|
|
98
|
-
/** Title of the Progressive Web Application (PWA) category of audits. This is displayed at the top of a list of audits focused on topics related to whether or not a site is a progressive web app, e.g. responds offline, uses a service worker, is on https, etc. Also used as a label of a score gauge. */
|
|
99
|
-
pwaCategoryTitle: 'PWA',
|
|
100
|
-
/** Description of the Progressive Web Application (PWA) category. This is displayed at the top of a list of audits focused on topics related to whether or not a site is a progressive web app, e.g. responds offline, uses a service worker, is on https, etc. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. */
|
|
101
|
-
pwaCategoryDescription: 'These checks validate the aspects of a Progressive Web App. ' +
|
|
102
|
-
'[Learn what makes a good Progressive Web App](https://web.dev/articles/pwa-checklist).',
|
|
103
|
-
/** Description of the Progressive Web Application (PWA) manual checks category, containing a list of additional validators must be run by hand in order to check all PWA best practices. This is displayed at the top of a list of manually run audits focused on topics related to whether or not a site is a progressive web app, e.g. responds offline, uses a service worker, is on https, etc.. No character length limits. */
|
|
104
|
-
pwaCategoryManualDescription: 'These checks are required by the baseline ' +
|
|
105
|
-
'[PWA Checklist](https://web.dev/articles/pwa-checklist) but are ' +
|
|
106
|
-
'not automatically checked by Lighthouse. They do not affect your score but it\'s important that you verify them manually.',
|
|
107
89
|
/** Title of the Best Practices category of audits. This is displayed at the top of a list of audits focused on topics related to following web development best practices and accepted guidelines. Also used as a label of a score gauge; try to limit to 20 characters. */
|
|
108
90
|
bestPracticesCategoryTitle: 'Best Practices',
|
|
109
91
|
/** Title of the Trust & Safety group of audits. This is displayed at the top of a list of audits focused on maintaining user trust and protecting security in web development. */
|
|
@@ -114,10 +96,6 @@ const UIStrings = {
|
|
|
114
96
|
bestPracticesBrowserCompatGroupTitle: 'Browser Compatibility',
|
|
115
97
|
/** Title of the General group of the Best Practices category. Within this section are the audits that don't belong to a specific group but are of general interest. */
|
|
116
98
|
bestPracticesGeneralGroupTitle: 'General',
|
|
117
|
-
/** Title of the Installable section of the web app category. Within this section are audits that check if Chrome supports installing the web site as an app on their device. */
|
|
118
|
-
pwaInstallableGroupTitle: 'Installable',
|
|
119
|
-
/** Title of the "PWA Optimized" section of the web app category. Within this section are audits that check if the developer has taken advantage of features to make their web page more enjoyable and engaging for the user. */
|
|
120
|
-
pwaOptimizedGroupTitle: 'PWA Optimized',
|
|
121
99
|
};
|
|
122
100
|
|
|
123
101
|
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
@@ -138,13 +116,10 @@ const defaultConfig = {
|
|
|
138
116
|
{id: 'CSSUsage', gatherer: 'css-usage'},
|
|
139
117
|
{id: 'Doctype', gatherer: 'dobetterweb/doctype'},
|
|
140
118
|
{id: 'DOMStats', gatherer: 'dobetterweb/domstats'},
|
|
141
|
-
{id: 'EmbeddedContent', gatherer: 'seo/embedded-content'},
|
|
142
119
|
{id: 'FontSize', gatherer: 'seo/font-size'},
|
|
143
120
|
{id: 'Inputs', gatherer: 'inputs'},
|
|
144
|
-
{id: 'GlobalListeners', gatherer: 'global-listeners'},
|
|
145
121
|
{id: 'IFrameElements', gatherer: 'iframe-elements'},
|
|
146
122
|
{id: 'ImageElements', gatherer: 'image-elements'},
|
|
147
|
-
{id: 'InstallabilityErrors', gatherer: 'installability-errors'},
|
|
148
123
|
{id: 'InspectorIssues', gatherer: 'inspector-issues'},
|
|
149
124
|
{id: 'JsUsage', gatherer: 'js-usage'},
|
|
150
125
|
{id: 'LinkElements', gatherer: 'link-elements'},
|
|
@@ -154,16 +129,12 @@ const defaultConfig = {
|
|
|
154
129
|
{id: 'OptimizedImages', gatherer: 'dobetterweb/optimized-images'},
|
|
155
130
|
{id: 'ResponseCompression', gatherer: 'dobetterweb/response-compression'},
|
|
156
131
|
{id: 'RobotsTxt', gatherer: 'seo/robots-txt'},
|
|
157
|
-
{id: 'ServiceWorker', gatherer: 'service-worker'},
|
|
158
|
-
{id: 'ScriptElements', gatherer: 'script-elements'},
|
|
159
132
|
{id: 'Scripts', gatherer: 'scripts'},
|
|
160
133
|
{id: 'SourceMaps', gatherer: 'source-maps'},
|
|
161
134
|
{id: 'Stacks', gatherer: 'stacks'},
|
|
162
|
-
{id: '
|
|
163
|
-
{id: 'TapTargets', gatherer: 'seo/tap-targets'},
|
|
135
|
+
{id: 'Stylesheets', gatherer: 'stylesheets'},
|
|
164
136
|
{id: 'TraceElements', gatherer: 'trace-elements'},
|
|
165
137
|
{id: 'ViewportDimensions', gatherer: 'viewport-dimensions'},
|
|
166
|
-
{id: 'WebAppManifest', gatherer: 'web-app-manifest'},
|
|
167
138
|
|
|
168
139
|
// Artifact copies are renamed for compatibility with legacy artifacts.
|
|
169
140
|
{id: 'devtoolsLogs', gatherer: 'devtools-log-compat'},
|
|
@@ -177,6 +148,7 @@ const defaultConfig = {
|
|
|
177
148
|
],
|
|
178
149
|
audits: [
|
|
179
150
|
'is-on-https',
|
|
151
|
+
'redirects-http',
|
|
180
152
|
'viewport',
|
|
181
153
|
'metrics/first-contentful-paint',
|
|
182
154
|
'metrics/largest-contentful-paint',
|
|
@@ -194,19 +166,12 @@ const defaultConfig = {
|
|
|
194
166
|
'user-timings',
|
|
195
167
|
'critical-request-chains',
|
|
196
168
|
'redirects',
|
|
197
|
-
'installable-manifest',
|
|
198
|
-
'splash-screen',
|
|
199
|
-
'themed-omnibox',
|
|
200
|
-
'maskable-icon',
|
|
201
|
-
'content-width',
|
|
202
169
|
'image-aspect-ratio',
|
|
203
170
|
'image-size-responsive',
|
|
204
|
-
'preload-fonts',
|
|
205
171
|
'deprecations',
|
|
206
172
|
'third-party-cookies',
|
|
207
173
|
'mainthread-work-breakdown',
|
|
208
174
|
'bootup-time',
|
|
209
|
-
'uses-rel-preload',
|
|
210
175
|
'uses-rel-preconnect',
|
|
211
176
|
'font-display',
|
|
212
177
|
'diagnostics',
|
|
@@ -215,36 +180,32 @@ const defaultConfig = {
|
|
|
215
180
|
'network-server-latency',
|
|
216
181
|
'main-thread-tasks',
|
|
217
182
|
'metrics',
|
|
218
|
-
'performance-budget',
|
|
219
|
-
'timing-budget',
|
|
220
183
|
'resource-summary',
|
|
221
184
|
'third-party-summary',
|
|
222
185
|
'third-party-facades',
|
|
223
186
|
'largest-contentful-paint-element',
|
|
224
187
|
'lcp-lazy-loaded',
|
|
225
|
-
'layout-shift-elements',
|
|
226
188
|
'layout-shifts',
|
|
227
189
|
'long-tasks',
|
|
228
|
-
'no-unload-listeners',
|
|
229
190
|
'non-composited-animations',
|
|
230
191
|
'unsized-images',
|
|
231
192
|
'valid-source-maps',
|
|
232
193
|
'prioritize-lcp-image',
|
|
233
194
|
'csp-xss',
|
|
234
195
|
'script-treemap-data',
|
|
235
|
-
'manual/pwa-cross-browser',
|
|
236
|
-
'manual/pwa-page-transitions',
|
|
237
|
-
'manual/pwa-each-page-has-url',
|
|
238
196
|
'accessibility/accesskeys',
|
|
239
197
|
'accessibility/aria-allowed-attr',
|
|
240
198
|
'accessibility/aria-allowed-role',
|
|
241
199
|
'accessibility/aria-command-name',
|
|
200
|
+
'accessibility/aria-conditional-attr',
|
|
201
|
+
'accessibility/aria-deprecated-role',
|
|
242
202
|
'accessibility/aria-dialog-name',
|
|
243
203
|
'accessibility/aria-hidden-body',
|
|
244
204
|
'accessibility/aria-hidden-focus',
|
|
245
205
|
'accessibility/aria-input-field-name',
|
|
246
206
|
'accessibility/aria-meter-name',
|
|
247
207
|
'accessibility/aria-progressbar-name',
|
|
208
|
+
'accessibility/aria-prohibited-attr',
|
|
248
209
|
'accessibility/aria-required-attr',
|
|
249
210
|
'accessibility/aria-required-children',
|
|
250
211
|
'accessibility/aria-required-parent',
|
|
@@ -261,7 +222,6 @@ const defaultConfig = {
|
|
|
261
222
|
'accessibility/definition-list',
|
|
262
223
|
'accessibility/dlitem',
|
|
263
224
|
'accessibility/document-title',
|
|
264
|
-
'accessibility/duplicate-id-active',
|
|
265
225
|
'accessibility/duplicate-id-aria',
|
|
266
226
|
'accessibility/empty-heading',
|
|
267
227
|
'accessibility/form-field-multiple-labels',
|
|
@@ -340,9 +300,7 @@ const defaultConfig = {
|
|
|
340
300
|
'seo/crawlable-anchors',
|
|
341
301
|
'seo/is-crawlable',
|
|
342
302
|
'seo/robots-txt',
|
|
343
|
-
'seo/tap-targets',
|
|
344
303
|
'seo/hreflang',
|
|
345
|
-
'seo/plugins',
|
|
346
304
|
'seo/canonical',
|
|
347
305
|
'seo/manual/structured-data',
|
|
348
306
|
'work-during-interaction',
|
|
@@ -352,24 +310,10 @@ const defaultConfig = {
|
|
|
352
310
|
'metrics': {
|
|
353
311
|
title: str_(UIStrings.metricGroupTitle),
|
|
354
312
|
},
|
|
355
|
-
'load-opportunities': {
|
|
356
|
-
title: str_(UIStrings.loadOpportunitiesGroupTitle),
|
|
357
|
-
description: str_(UIStrings.loadOpportunitiesGroupDescription),
|
|
358
|
-
},
|
|
359
|
-
'budgets': {
|
|
360
|
-
title: str_(UIStrings.budgetsGroupTitle),
|
|
361
|
-
description: str_(UIStrings.budgetsGroupDescription),
|
|
362
|
-
},
|
|
363
313
|
'diagnostics': {
|
|
364
314
|
title: str_(UIStrings.diagnosticsGroupTitle),
|
|
365
315
|
description: str_(UIStrings.diagnosticsGroupDescription),
|
|
366
316
|
},
|
|
367
|
-
'pwa-installable': {
|
|
368
|
-
title: str_(UIStrings.pwaInstallableGroupTitle),
|
|
369
|
-
},
|
|
370
|
-
'pwa-optimized': {
|
|
371
|
-
title: str_(UIStrings.pwaOptimizedGroupTitle),
|
|
372
|
-
},
|
|
373
317
|
'a11y-best-practices': {
|
|
374
318
|
title: str_(UIStrings.a11yBestPracticesGroupTitle),
|
|
375
319
|
description: str_(UIStrings.a11yBestPracticesGroupDescription),
|
|
@@ -434,64 +378,58 @@ const defaultConfig = {
|
|
|
434
378
|
title: str_(UIStrings.performanceCategoryTitle),
|
|
435
379
|
supportedModes: ['navigation', 'timespan', 'snapshot'],
|
|
436
380
|
auditRefs: [
|
|
437
|
-
{id: 'first-contentful-paint', weight: 10, group: 'metrics', acronym: 'FCP'
|
|
438
|
-
{id: 'largest-contentful-paint', weight: 25, group: 'metrics', acronym: 'LCP'
|
|
439
|
-
{id: 'total-blocking-time', weight: 30, group: 'metrics', acronym: 'TBT'
|
|
440
|
-
{id: 'cumulative-layout-shift', weight: 25, group: 'metrics', acronym: 'CLS'
|
|
381
|
+
{id: 'first-contentful-paint', weight: 10, group: 'metrics', acronym: 'FCP'},
|
|
382
|
+
{id: 'largest-contentful-paint', weight: 25, group: 'metrics', acronym: 'LCP'},
|
|
383
|
+
{id: 'total-blocking-time', weight: 30, group: 'metrics', acronym: 'TBT'},
|
|
384
|
+
{id: 'cumulative-layout-shift', weight: 25, group: 'metrics', acronym: 'CLS'},
|
|
441
385
|
{id: 'speed-index', weight: 10, group: 'metrics', acronym: 'SI'},
|
|
442
|
-
{id: 'interaction-to-next-paint', weight: 0, group: 'metrics', acronym: 'INP'
|
|
386
|
+
{id: 'interaction-to-next-paint', weight: 0, group: 'metrics', acronym: 'INP'},
|
|
443
387
|
|
|
444
388
|
// These are our "invisible" metrics. Not displayed, but still in the LHR.
|
|
445
389
|
{id: 'interactive', weight: 0, group: 'hidden', acronym: 'TTI'},
|
|
446
390
|
{id: 'max-potential-fid', weight: 0, group: 'hidden'},
|
|
447
391
|
{id: 'first-meaningful-paint', weight: 0, acronym: 'FMP', group: 'hidden'},
|
|
448
392
|
|
|
449
|
-
|
|
450
|
-
{id: '
|
|
451
|
-
{id: '
|
|
452
|
-
{id: '
|
|
453
|
-
{id: 'unminified-
|
|
454
|
-
{id: '
|
|
455
|
-
{id: 'unused-
|
|
456
|
-
{id: '
|
|
457
|
-
{id: '
|
|
458
|
-
{id: '
|
|
459
|
-
{id: 'uses-
|
|
460
|
-
{id: '
|
|
461
|
-
{id: '
|
|
462
|
-
{id: '
|
|
463
|
-
{id: '
|
|
464
|
-
{id: '
|
|
465
|
-
{id: '
|
|
466
|
-
{id: '
|
|
467
|
-
{id: '
|
|
468
|
-
{id: '
|
|
469
|
-
{id: '
|
|
470
|
-
{id: '
|
|
471
|
-
{id: '
|
|
472
|
-
{id: '
|
|
473
|
-
{id: '
|
|
474
|
-
{id: '
|
|
475
|
-
{id: '
|
|
476
|
-
{id: '
|
|
477
|
-
{id: '
|
|
478
|
-
{id: '
|
|
479
|
-
{id: '
|
|
480
|
-
{id: '
|
|
481
|
-
{id: '
|
|
482
|
-
{id: '
|
|
483
|
-
{id: '
|
|
484
|
-
{id: '
|
|
485
|
-
{id: '
|
|
486
|
-
{id: '
|
|
487
|
-
{id: '
|
|
488
|
-
{id: '
|
|
489
|
-
{id: 'work-during-interaction', weight: 0},
|
|
490
|
-
{id: 'bf-cache', weight: 0},
|
|
491
|
-
|
|
492
|
-
// Budget audits.
|
|
493
|
-
{id: 'performance-budget', weight: 0, group: 'budgets'},
|
|
494
|
-
{id: 'timing-budget', weight: 0, group: 'budgets'},
|
|
393
|
+
{id: 'render-blocking-resources', weight: 0, group: 'diagnostics'},
|
|
394
|
+
{id: 'uses-responsive-images', weight: 0, group: 'diagnostics'},
|
|
395
|
+
{id: 'offscreen-images', weight: 0, group: 'diagnostics'},
|
|
396
|
+
{id: 'unminified-css', weight: 0, group: 'diagnostics'},
|
|
397
|
+
{id: 'unminified-javascript', weight: 0, group: 'diagnostics'},
|
|
398
|
+
{id: 'unused-css-rules', weight: 0, group: 'diagnostics'},
|
|
399
|
+
{id: 'unused-javascript', weight: 0, group: 'diagnostics'},
|
|
400
|
+
{id: 'uses-optimized-images', weight: 0, group: 'diagnostics'},
|
|
401
|
+
{id: 'modern-image-formats', weight: 0, group: 'diagnostics'},
|
|
402
|
+
{id: 'uses-text-compression', weight: 0, group: 'diagnostics'},
|
|
403
|
+
{id: 'uses-rel-preconnect', weight: 0, group: 'diagnostics'},
|
|
404
|
+
{id: 'server-response-time', weight: 0, group: 'diagnostics'},
|
|
405
|
+
{id: 'redirects', weight: 0, group: 'diagnostics'},
|
|
406
|
+
{id: 'uses-http2', weight: 0, group: 'diagnostics'},
|
|
407
|
+
{id: 'efficient-animated-content', weight: 0, group: 'diagnostics'},
|
|
408
|
+
{id: 'duplicated-javascript', weight: 0, group: 'diagnostics'},
|
|
409
|
+
{id: 'legacy-javascript', weight: 0, group: 'diagnostics'},
|
|
410
|
+
{id: 'prioritize-lcp-image', weight: 0, group: 'diagnostics'},
|
|
411
|
+
{id: 'total-byte-weight', weight: 0, group: 'diagnostics'},
|
|
412
|
+
{id: 'uses-long-cache-ttl', weight: 0, group: 'diagnostics'},
|
|
413
|
+
{id: 'dom-size', weight: 0, group: 'diagnostics'},
|
|
414
|
+
{id: 'critical-request-chains', weight: 0, group: 'diagnostics'},
|
|
415
|
+
{id: 'user-timings', weight: 0, group: 'diagnostics'},
|
|
416
|
+
{id: 'bootup-time', weight: 0, group: 'diagnostics'},
|
|
417
|
+
{id: 'mainthread-work-breakdown', weight: 0, group: 'diagnostics'},
|
|
418
|
+
{id: 'font-display', weight: 0, group: 'diagnostics'},
|
|
419
|
+
{id: 'third-party-summary', weight: 0, group: 'diagnostics'},
|
|
420
|
+
{id: 'third-party-facades', weight: 0, group: 'diagnostics'},
|
|
421
|
+
{id: 'largest-contentful-paint-element', weight: 0, group: 'diagnostics'},
|
|
422
|
+
{id: 'lcp-lazy-loaded', weight: 0, group: 'diagnostics'},
|
|
423
|
+
{id: 'layout-shifts', weight: 0, group: 'diagnostics'},
|
|
424
|
+
{id: 'uses-passive-event-listeners', weight: 0, group: 'diagnostics'},
|
|
425
|
+
{id: 'no-document-write', weight: 0, group: 'diagnostics'},
|
|
426
|
+
{id: 'long-tasks', weight: 0, group: 'diagnostics'},
|
|
427
|
+
{id: 'non-composited-animations', weight: 0, group: 'diagnostics'},
|
|
428
|
+
{id: 'unsized-images', weight: 0, group: 'diagnostics'},
|
|
429
|
+
{id: 'viewport', weight: 0, group: 'diagnostics'},
|
|
430
|
+
{id: 'uses-responsive-images-snapshot', weight: 0, group: 'diagnostics'},
|
|
431
|
+
{id: 'work-during-interaction', weight: 0, group: 'diagnostics'},
|
|
432
|
+
{id: 'bf-cache', weight: 0, group: 'diagnostics'},
|
|
495
433
|
|
|
496
434
|
// Audits past this point contain useful data but are not displayed with other audits.
|
|
497
435
|
{id: 'network-requests', weight: 0, group: 'hidden'},
|
|
@@ -504,7 +442,6 @@ const defaultConfig = {
|
|
|
504
442
|
{id: 'final-screenshot', weight: 0, group: 'hidden'},
|
|
505
443
|
{id: 'script-treemap-data', weight: 0, group: 'hidden'},
|
|
506
444
|
{id: 'resource-summary', weight: 0, group: 'hidden'},
|
|
507
|
-
{id: 'layout-shift-elements', weight: 0, group: 'hidden'},
|
|
508
445
|
],
|
|
509
446
|
},
|
|
510
447
|
'accessibility': {
|
|
@@ -521,12 +458,15 @@ const defaultConfig = {
|
|
|
521
458
|
{id: 'aria-allowed-attr', weight: 10, group: 'a11y-aria'},
|
|
522
459
|
{id: 'aria-allowed-role', weight: 1, group: 'a11y-aria'},
|
|
523
460
|
{id: 'aria-command-name', weight: 7, group: 'a11y-aria'},
|
|
461
|
+
{id: 'aria-conditional-attr', weight: 7, group: 'a11y-aria'},
|
|
462
|
+
{id: 'aria-deprecated-role', weight: 1, group: 'a11y-aria'},
|
|
524
463
|
{id: 'aria-dialog-name', weight: 7, group: 'a11y-aria'},
|
|
525
464
|
{id: 'aria-hidden-body', weight: 10, group: 'a11y-aria'},
|
|
526
465
|
{id: 'aria-hidden-focus', weight: 7, group: 'a11y-aria'},
|
|
527
466
|
{id: 'aria-input-field-name', weight: 7, group: 'a11y-aria'},
|
|
528
467
|
{id: 'aria-meter-name', weight: 7, group: 'a11y-aria'},
|
|
529
468
|
{id: 'aria-progressbar-name', weight: 7, group: 'a11y-aria'},
|
|
469
|
+
{id: 'aria-prohibited-attr', weight: 7, group: 'a11y-aria'},
|
|
530
470
|
{id: 'aria-required-attr', weight: 10, group: 'a11y-aria'},
|
|
531
471
|
{id: 'aria-required-children', weight: 10, group: 'a11y-aria'},
|
|
532
472
|
{id: 'aria-required-parent', weight: 10, group: 'a11y-aria'},
|
|
@@ -543,7 +483,6 @@ const defaultConfig = {
|
|
|
543
483
|
{id: 'definition-list', weight: 7, group: 'a11y-tables-lists'},
|
|
544
484
|
{id: 'dlitem', weight: 7, group: 'a11y-tables-lists'},
|
|
545
485
|
{id: 'document-title', weight: 7, group: 'a11y-names-labels'},
|
|
546
|
-
{id: 'duplicate-id-active', weight: 7, group: 'a11y-navigation'},
|
|
547
486
|
{id: 'duplicate-id-aria', weight: 10, group: 'a11y-aria'},
|
|
548
487
|
{id: 'form-field-multiple-labels', weight: 3, group: 'a11y-names-labels'},
|
|
549
488
|
{id: 'frame-title', weight: 7, group: 'a11y-names-labels'},
|
|
@@ -567,6 +506,7 @@ const defaultConfig = {
|
|
|
567
506
|
{id: 'skip-link', weight: 3, group: 'a11y-names-labels'},
|
|
568
507
|
{id: 'tabindex', weight: 7, group: 'a11y-navigation'},
|
|
569
508
|
{id: 'table-duplicate-name', weight: 1, group: 'a11y-tables-lists'},
|
|
509
|
+
{id: 'target-size', weight: 7, group: 'a11y-best-practices'},
|
|
570
510
|
{id: 'td-headers-attr', weight: 7, group: 'a11y-tables-lists'},
|
|
571
511
|
{id: 'th-has-data-cells', weight: 7, group: 'a11y-tables-lists'},
|
|
572
512
|
{id: 'valid-lang', weight: 7, group: 'a11y-language'},
|
|
@@ -586,7 +526,6 @@ const defaultConfig = {
|
|
|
586
526
|
{id: 'empty-heading', weight: 0, group: 'hidden'},
|
|
587
527
|
{id: 'identical-links-same-purpose', weight: 0, group: 'hidden'},
|
|
588
528
|
{id: 'landmark-one-main', weight: 0, group: 'hidden'},
|
|
589
|
-
{id: 'target-size', weight: 0, group: 'hidden'},
|
|
590
529
|
{id: 'label-content-name-mismatch', weight: 0, group: 'hidden'},
|
|
591
530
|
{id: 'table-fake-caption', weight: 0, group: 'hidden'},
|
|
592
531
|
{id: 'td-has-header', weight: 0, group: 'hidden'},
|
|
@@ -598,6 +537,7 @@ const defaultConfig = {
|
|
|
598
537
|
auditRefs: [
|
|
599
538
|
// Trust & Safety
|
|
600
539
|
{id: 'is-on-https', weight: 5, group: 'best-practices-trust-safety'},
|
|
540
|
+
{id: 'redirects-http', weight: 1, group: 'best-practices-trust-safety'},
|
|
601
541
|
{id: 'geolocation-on-start', weight: 1, group: 'best-practices-trust-safety'},
|
|
602
542
|
{id: 'notification-on-start', weight: 1, group: 'best-practices-trust-safety'},
|
|
603
543
|
{id: 'csp-xss', weight: 0, group: 'best-practices-trust-safety'},
|
|
@@ -605,12 +545,12 @@ const defaultConfig = {
|
|
|
605
545
|
{id: 'paste-preventing-inputs', weight: 3, group: 'best-practices-ux'},
|
|
606
546
|
{id: 'image-aspect-ratio', weight: 1, group: 'best-practices-ux'},
|
|
607
547
|
{id: 'image-size-responsive', weight: 1, group: 'best-practices-ux'},
|
|
608
|
-
{id: '
|
|
548
|
+
{id: 'viewport', weight: 1, group: 'best-practices-ux'},
|
|
549
|
+
{id: 'font-size', weight: 1, group: 'best-practices-ux'},
|
|
609
550
|
// Browser Compatibility
|
|
610
551
|
{id: 'doctype', weight: 1, group: 'best-practices-browser-compat'},
|
|
611
552
|
{id: 'charset', weight: 1, group: 'best-practices-browser-compat'},
|
|
612
553
|
// General Group
|
|
613
|
-
{id: 'no-unload-listeners', weight: 1, group: 'best-practices-general'},
|
|
614
554
|
{id: 'js-libraries', weight: 0, group: 'best-practices-general'},
|
|
615
555
|
{id: 'deprecations', weight: 5, group: 'best-practices-general'},
|
|
616
556
|
{id: 'third-party-cookies', weight: 5, group: 'best-practices-general'},
|
|
@@ -625,44 +565,25 @@ const defaultConfig = {
|
|
|
625
565
|
manualDescription: str_(UIStrings.seoCategoryManualDescription),
|
|
626
566
|
supportedModes: ['navigation', 'snapshot'],
|
|
627
567
|
auditRefs: [
|
|
628
|
-
|
|
568
|
+
// Should be at least 31% of the score, such that this audit failing
|
|
569
|
+
// results in the SEO category failing.
|
|
570
|
+
// Solve for w:
|
|
571
|
+
// w / (w + T) >= 0.31
|
|
572
|
+
// where T is the sum of all the other weights.
|
|
573
|
+
{id: 'is-crawlable', weight: 93 / 23, group: 'seo-crawl'},
|
|
629
574
|
{id: 'document-title', weight: 1, group: 'seo-content'},
|
|
630
575
|
{id: 'meta-description', weight: 1, group: 'seo-content'},
|
|
631
576
|
{id: 'http-status-code', weight: 1, group: 'seo-crawl'},
|
|
632
577
|
{id: 'link-text', weight: 1, group: 'seo-content'},
|
|
633
578
|
{id: 'crawlable-anchors', weight: 1, group: 'seo-crawl'},
|
|
634
|
-
{id: 'is-crawlable', weight: 1, group: 'seo-crawl'},
|
|
635
579
|
{id: 'robots-txt', weight: 1, group: 'seo-crawl'},
|
|
636
580
|
{id: 'image-alt', weight: 1, group: 'seo-content'},
|
|
637
581
|
{id: 'hreflang', weight: 1, group: 'seo-content'},
|
|
638
582
|
{id: 'canonical', weight: 1, group: 'seo-content'},
|
|
639
|
-
{id: 'font-size', weight: 1, group: 'seo-mobile'},
|
|
640
|
-
{id: 'plugins', weight: 1, group: 'seo-content'},
|
|
641
|
-
{id: 'tap-targets', weight: 1, group: 'seo-mobile'},
|
|
642
583
|
// Manual audits
|
|
643
584
|
{id: 'structured-data', weight: 0},
|
|
644
585
|
],
|
|
645
586
|
},
|
|
646
|
-
'pwa': {
|
|
647
|
-
title: str_(UIStrings.pwaCategoryTitle),
|
|
648
|
-
description: str_(UIStrings.pwaCategoryDescription),
|
|
649
|
-
manualDescription: str_(UIStrings.pwaCategoryManualDescription),
|
|
650
|
-
supportedModes: ['navigation'],
|
|
651
|
-
auditRefs: [
|
|
652
|
-
// Installable
|
|
653
|
-
{id: 'installable-manifest', weight: 2, group: 'pwa-installable'},
|
|
654
|
-
// PWA Optimized
|
|
655
|
-
{id: 'splash-screen', weight: 1, group: 'pwa-optimized'},
|
|
656
|
-
{id: 'themed-omnibox', weight: 1, group: 'pwa-optimized'},
|
|
657
|
-
{id: 'content-width', weight: 1, group: 'pwa-optimized'},
|
|
658
|
-
{id: 'viewport', weight: 2, group: 'pwa-optimized'},
|
|
659
|
-
{id: 'maskable-icon', weight: 1, group: 'pwa-optimized'},
|
|
660
|
-
// Manual audits
|
|
661
|
-
{id: 'pwa-cross-browser', weight: 0},
|
|
662
|
-
{id: 'pwa-page-transitions', weight: 0},
|
|
663
|
-
{id: 'pwa-each-page-has-url', weight: 0},
|
|
664
|
-
],
|
|
665
|
-
},
|
|
666
587
|
},
|
|
667
588
|
};
|
|
668
589
|
|
|
@@ -14,13 +14,24 @@ const config = {
|
|
|
14
14
|
extends: 'lighthouse:default',
|
|
15
15
|
audits: [
|
|
16
16
|
'autocomplete',
|
|
17
|
+
// Preload advice is on hold until https://github.com/GoogleChrome/lighthouse/issues/11960
|
|
18
|
+
'preload-fonts',
|
|
19
|
+
'uses-rel-preload',
|
|
17
20
|
],
|
|
18
21
|
categories: {
|
|
22
|
+
// @ts-ignore: `title` is required in CategoryJson. setting to the same value as the default
|
|
23
|
+
// config is awkward - easier to omit the property here. Will defer to default config.
|
|
24
|
+
'performance': {
|
|
25
|
+
auditRefs: [
|
|
26
|
+
{id: 'uses-rel-preload', weight: 0, group: 'diagnostics'},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
19
29
|
// @ts-ignore: `title` is required in CategoryJson. setting to the same value as the default
|
|
20
30
|
// config is awkward - easier to omit the property here. Will defer to default config.
|
|
21
31
|
'best-practices': {
|
|
22
32
|
auditRefs: [
|
|
23
33
|
{id: 'autocomplete', weight: 0, group: 'best-practices-ux'},
|
|
34
|
+
{id: 'preload-fonts', weight: 0, group: 'best-practices-ux'},
|
|
24
35
|
],
|
|
25
36
|
},
|
|
26
37
|
},
|
package/core/config/filters.js
CHANGED
|
@@ -122,7 +122,10 @@ async function gotoURL(driver, requestor, options) {
|
|
|
122
122
|
throw new Error('Cannot wait for FCP without waiting for page load');
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
const waitConditions = await Promise.
|
|
125
|
+
const waitConditions = await Promise.race([
|
|
126
|
+
driver.fatalRejection.promise,
|
|
127
|
+
Promise.all(waitConditionPromises),
|
|
128
|
+
]);
|
|
126
129
|
const timedOut = waitConditions.some(condition => condition.timedOut);
|
|
127
130
|
const navigationUrls = await networkMonitor.getNavigationUrls();
|
|
128
131
|
|
|
@@ -45,7 +45,7 @@ async function enableAsyncStacks(session) {
|
|
|
45
45
|
await enable();
|
|
46
46
|
|
|
47
47
|
return async () => {
|
|
48
|
-
await session.
|
|
48
|
+
await session.sendCommandAndIgnore('Debugger.disable');
|
|
49
49
|
session.off('Debugger.paused', onDebuggerPaused);
|
|
50
50
|
session.off('Page.frameNavigated', onFrameNavigated);
|
|
51
51
|
};
|
|
@@ -180,7 +180,7 @@ class TargetManager extends ProtocolEventEmitter {
|
|
|
180
180
|
throw err;
|
|
181
181
|
} finally {
|
|
182
182
|
// Resume the target if it was paused, but if it's unnecessary, we don't care about the error.
|
|
183
|
-
await newSession.
|
|
183
|
+
await newSession.sendCommandAndIgnore('Runtime.runIfWaitingForDebugger');
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
|
|
@@ -266,8 +266,9 @@ class TargetManager extends ProtocolEventEmitter {
|
|
|
266
266
|
cdpSession.off('sessionattached', this._onSessionAttached);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
|
|
270
|
-
await this._rootCdpSession.send('
|
|
269
|
+
// Ignore failures on these in case the tab has crashed.
|
|
270
|
+
await this._rootCdpSession.send('Page.disable').catch(_ => {});
|
|
271
|
+
await this._rootCdpSession.send('Runtime.disable').catch(_ => {});
|
|
271
272
|
|
|
272
273
|
this._enabled = false;
|
|
273
274
|
this._targetIdToTargets = new Map();
|