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
|
@@ -45,11 +45,7 @@ declare class UsesRelPreloadAudit extends Audit {
|
|
|
45
45
|
* @param {LH.Audit.Context} context
|
|
46
46
|
* @return {Promise<LH.Audit.Product>}
|
|
47
47
|
*/
|
|
48
|
-
static
|
|
49
|
-
/**
|
|
50
|
-
* @return {Promise<LH.Audit.Product>}
|
|
51
|
-
*/
|
|
52
|
-
static audit(): Promise<LH.Audit.Product>;
|
|
48
|
+
static audit(artifacts: LH.Artifacts, context: LH.Audit.Context): Promise<LH.Audit.Product>;
|
|
53
49
|
}
|
|
54
50
|
export namespace UIStrings {
|
|
55
51
|
const title: string;
|
|
@@ -143,9 +143,9 @@ class UsesRelPreloadAudit extends Audit {
|
|
|
143
143
|
return {wastedMs: 0, results: []};
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
// Preload changes the ordering of requests, simulate the original graph
|
|
146
|
+
// Preload changes the ordering of requests, simulate the original graph
|
|
147
147
|
// to have a reasonable baseline for comparison.
|
|
148
|
-
const simulationBeforeChanges = simulator.simulate(graph
|
|
148
|
+
const simulationBeforeChanges = simulator.simulate(graph);
|
|
149
149
|
const modifiedGraph = graph.cloneWithRelationships();
|
|
150
150
|
|
|
151
151
|
/** @type {Array<LH.Gatherer.Simulation.GraphNetworkNode>} */
|
|
@@ -174,8 +174,8 @@ class UsesRelPreloadAudit extends Audit {
|
|
|
174
174
|
node.addDependency(mainDocumentNode);
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
// Once we've modified the dependencies, simulate the new graph
|
|
178
|
-
const simulationAfterChanges = simulator.simulate(modifiedGraph
|
|
177
|
+
// Once we've modified the dependencies, simulate the new graph.
|
|
178
|
+
const simulationAfterChanges = simulator.simulate(modifiedGraph);
|
|
179
179
|
const originalNodesByRecord = Array.from(simulationBeforeChanges.nodeTimings.keys())
|
|
180
180
|
// @ts-expect-error we don't care if all nodes without a record collect on `undefined`
|
|
181
181
|
.reduce((map, node) => map.set(node.record, node), new Map());
|
|
@@ -209,7 +209,7 @@ class UsesRelPreloadAudit extends Audit {
|
|
|
209
209
|
* @param {LH.Audit.Context} context
|
|
210
210
|
* @return {Promise<LH.Audit.Product>}
|
|
211
211
|
*/
|
|
212
|
-
static async
|
|
212
|
+
static async audit(artifacts, context) {
|
|
213
213
|
const trace = artifacts.traces[UsesRelPreloadAudit.DEFAULT_PASS];
|
|
214
214
|
const devtoolsLog = artifacts.devtoolsLogs[UsesRelPreloadAudit.DEFAULT_PASS];
|
|
215
215
|
const URL = artifacts.URL;
|
|
@@ -253,16 +253,6 @@ class UsesRelPreloadAudit extends Audit {
|
|
|
253
253
|
warnings,
|
|
254
254
|
};
|
|
255
255
|
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* @return {Promise<LH.Audit.Product>}
|
|
259
|
-
*/
|
|
260
|
-
static async audit() {
|
|
261
|
-
// Preload advice is on hold until https://github.com/GoogleChrome/lighthouse/issues/11960
|
|
262
|
-
// is resolved.
|
|
263
|
-
return {score: 1, notApplicable: true,
|
|
264
|
-
details: Audit.makeOpportunityDetails([], [], {overallSavingsMs: 0})};
|
|
265
|
-
}
|
|
266
256
|
}
|
|
267
257
|
|
|
268
258
|
export default UsesRelPreloadAudit;
|
|
@@ -32,7 +32,7 @@ declare class WorkDuringInteraction extends Audit {
|
|
|
32
32
|
startTs: number;
|
|
33
33
|
endTs: number;
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
processingDuration: {
|
|
36
36
|
startTs: number;
|
|
37
37
|
endTs: number;
|
|
38
38
|
};
|
|
@@ -72,7 +72,7 @@ export namespace UIStrings {
|
|
|
72
72
|
const failureTitle: string;
|
|
73
73
|
const description: string;
|
|
74
74
|
const inputDelay: string;
|
|
75
|
-
const
|
|
75
|
+
const processingDuration: string;
|
|
76
76
|
const presentationDelay: string;
|
|
77
77
|
const displayValue: string;
|
|
78
78
|
const eventTarget: string;
|
|
@@ -30,7 +30,7 @@ const UIStrings = {
|
|
|
30
30
|
/** Label for a column in a data table; entries will be information on the time that the browser is delayed before responding to user input. Ideally fits within a ~40 character limit. */
|
|
31
31
|
inputDelay: 'Input delay',
|
|
32
32
|
/** Label for a column in a data table; entries will be information on the time taken by code processing user input that delays a response to the user. Ideally fits within a ~40 character limit. */
|
|
33
|
-
|
|
33
|
+
processingDuration: 'Processing duration',
|
|
34
34
|
/** Label for a column in a data table; entries will be information on the time that the browser is delayed before presenting a response to user input on screen. Ideally fits within a ~40 character limit. */
|
|
35
35
|
presentationDelay: 'Presentation delay',
|
|
36
36
|
/**
|
|
@@ -115,7 +115,7 @@ class WorkDuringInteraction extends Audit {
|
|
|
115
115
|
const endTs = startTs + interactionData.duration * 1000;
|
|
116
116
|
return {
|
|
117
117
|
inputDelay: {startTs, endTs: processingStartTs},
|
|
118
|
-
|
|
118
|
+
processingDuration: {startTs: processingStartTs, endTs: processingEndTs},
|
|
119
119
|
presentationDelay: {startTs: processingEndTs, endTs},
|
|
120
120
|
};
|
|
121
121
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { JSBundlesComputed as JSBundles };
|
|
2
2
|
declare const JSBundlesComputed: typeof JSBundles & {
|
|
3
|
-
request: (dependencies: Pick<import("../index.js").Artifacts, "
|
|
3
|
+
request: (dependencies: Pick<import("../index.js").Artifacts, "SourceMaps" | "Scripts">, context: import("../../types/utility-types.js").default.ImmutableObject<{
|
|
4
4
|
computedCache: Map<string, import("../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
5
5
|
}>) => Promise<import("../index.js").Artifacts.Bundle[]>;
|
|
6
6
|
};
|
|
@@ -163,10 +163,10 @@ class CumulativeLayoutShift {
|
|
|
163
163
|
await processor.parse(/** @type {import('@paulirish/trace_engine').Types.TraceEvents.TraceEventData[]} */ (
|
|
164
164
|
events
|
|
165
165
|
));
|
|
166
|
-
if (!processor.
|
|
166
|
+
if (!processor.traceParsedData) {
|
|
167
167
|
throw new Error('null trace engine result');
|
|
168
168
|
}
|
|
169
|
-
return processor.
|
|
169
|
+
return processor.traceParsedData.LayoutShifts.sessionMaxScore;
|
|
170
170
|
};
|
|
171
171
|
const cumulativeLayoutShift = await run(allFrameShiftEvents.map(e => e.event));
|
|
172
172
|
const cumulativeLayoutShiftMainFrame = await run(mainFrameShiftEvents.map(e => e.event));
|
|
@@ -1,94 +1,25 @@
|
|
|
1
1
|
export { LanternFirstContentfulPaintComputed as LanternFirstContentfulPaint };
|
|
2
|
-
export type
|
|
3
|
-
export type CPUNode = import('../../lib/lantern/cpu-node.js').CPUNode<LH.Artifacts.NetworkRequest>;
|
|
4
|
-
export type NetworkNode = import('../../lib/lantern/network-node.js').NetworkNode<LH.Artifacts.NetworkRequest>;
|
|
2
|
+
export type Extras = import('../../lib/lantern/metric.js').Extras;
|
|
5
3
|
declare const LanternFirstContentfulPaintComputed: typeof LanternFirstContentfulPaint & {
|
|
6
4
|
request: (dependencies: import("../../index.js").Artifacts.MetricComputationDataInput, context: import("../../../types/utility-types.js").default.ImmutableObject<{
|
|
7
5
|
computedCache: Map<string, import("../../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
8
6
|
}>) => Promise<import("../../index.js").Artifacts.LanternMetric>;
|
|
9
7
|
};
|
|
10
|
-
/** @typedef {import('../../lib/lantern/
|
|
11
|
-
|
|
12
|
-
/** @typedef {import('../../lib/lantern/network-node.js').NetworkNode<LH.Artifacts.NetworkRequest>} NetworkNode */
|
|
13
|
-
declare class LanternFirstContentfulPaint extends LanternMetric {
|
|
8
|
+
/** @typedef {import('../../lib/lantern/metric.js').Extras} Extras */
|
|
9
|
+
declare class LanternFirstContentfulPaint extends FirstContentfulPaint {
|
|
14
10
|
/**
|
|
15
|
-
* @
|
|
16
|
-
* @
|
|
17
|
-
*
|
|
18
|
-
* @
|
|
19
|
-
* which resources should be considered *possibly* render-blocking.
|
|
20
|
-
* @property {(function(CPUNode):boolean)=} additionalCpuNodesToTreatAsRenderBlocking The function that
|
|
21
|
-
* determines which CPU nodes should also be included in our blocking node IDs set,
|
|
22
|
-
* beyond what getRenderBlockingNodeData() already includes.
|
|
11
|
+
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
12
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
13
|
+
* @param {Omit<Extras, 'optimistic'>=} extras
|
|
14
|
+
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
23
15
|
*/
|
|
16
|
+
static computeMetricWithGraphs(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext, extras?: Omit<Extras, 'optimistic'> | undefined): Promise<LH.Artifacts.LanternMetric>;
|
|
24
17
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* given timestamp.
|
|
29
|
-
*
|
|
30
|
-
* @param {Node} graph
|
|
31
|
-
* @param {FirstPaintBasedGraphOpts} opts
|
|
32
|
-
* @return {{definitelyNotRenderBlockingScriptUrls: Set<string>, renderBlockingCpuNodeIds: Set<string>}}
|
|
18
|
+
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
19
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
20
|
+
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
33
21
|
*/
|
|
34
|
-
static
|
|
35
|
-
/**
|
|
36
|
-
* The timestamp used to filter out tasks that occured after
|
|
37
|
-
* our paint of interest. Typically this is First Contentful Paint or First Meaningful Paint.
|
|
38
|
-
*/
|
|
39
|
-
cutoffTimestamp: number;
|
|
40
|
-
/**
|
|
41
|
-
* The function that determines
|
|
42
|
-
* which resources should be considered *possibly* render-blocking.
|
|
43
|
-
*/
|
|
44
|
-
treatNodeAsRenderBlocking: (arg0: NetworkNode) => boolean;
|
|
45
|
-
/**
|
|
46
|
-
* The function that
|
|
47
|
-
* determines which CPU nodes should also be included in our blocking node IDs set,
|
|
48
|
-
* beyond what getRenderBlockingNodeData() already includes.
|
|
49
|
-
*/
|
|
50
|
-
additionalCpuNodesToTreatAsRenderBlocking?: ((arg0: CPUNode) => boolean) | undefined;
|
|
51
|
-
}): {
|
|
52
|
-
definitelyNotRenderBlockingScriptUrls: Set<string>;
|
|
53
|
-
renderBlockingCpuNodeIds: Set<string>;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* This function computes the graph required for the first paint of interest.
|
|
57
|
-
*
|
|
58
|
-
* @param {Node} dependencyGraph
|
|
59
|
-
* @param {FirstPaintBasedGraphOpts} opts
|
|
60
|
-
* @return {Node}
|
|
61
|
-
*/
|
|
62
|
-
static getFirstPaintBasedGraph(dependencyGraph: Node, { cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking }: {
|
|
63
|
-
/**
|
|
64
|
-
* The timestamp used to filter out tasks that occured after
|
|
65
|
-
* our paint of interest. Typically this is First Contentful Paint or First Meaningful Paint.
|
|
66
|
-
*/
|
|
67
|
-
cutoffTimestamp: number;
|
|
68
|
-
/**
|
|
69
|
-
* The function that determines
|
|
70
|
-
* which resources should be considered *possibly* render-blocking.
|
|
71
|
-
*/
|
|
72
|
-
treatNodeAsRenderBlocking: (arg0: NetworkNode) => boolean;
|
|
73
|
-
/**
|
|
74
|
-
* The function that
|
|
75
|
-
* determines which CPU nodes should also be included in our blocking node IDs set,
|
|
76
|
-
* beyond what getRenderBlockingNodeData() already includes.
|
|
77
|
-
*/
|
|
78
|
-
additionalCpuNodesToTreatAsRenderBlocking?: ((arg0: CPUNode) => boolean) | undefined;
|
|
79
|
-
}): Node;
|
|
80
|
-
/**
|
|
81
|
-
* @param {Node} dependencyGraph
|
|
82
|
-
* @param {LH.Artifacts.ProcessedNavigation} processedNavigation
|
|
83
|
-
* @return {Node}
|
|
84
|
-
*/
|
|
85
|
-
static getOptimisticGraph(dependencyGraph: Node, processedNavigation: LH.Artifacts.ProcessedNavigation): Node;
|
|
86
|
-
/**
|
|
87
|
-
* @param {Node} dependencyGraph
|
|
88
|
-
* @param {LH.Artifacts.ProcessedNavigation} processedNavigation
|
|
89
|
-
* @return {Node}
|
|
90
|
-
*/
|
|
91
|
-
static getPessimisticGraph(dependencyGraph: Node, processedNavigation: LH.Artifacts.ProcessedNavigation): Node;
|
|
22
|
+
static compute_(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.LanternMetric>;
|
|
92
23
|
}
|
|
93
|
-
import {
|
|
24
|
+
import { FirstContentfulPaint } from '../../lib/lantern/metrics/first-contentful-paint.js';
|
|
94
25
|
//# sourceMappingURL=lantern-first-contentful-paint.d.ts.map
|
|
@@ -5,192 +5,30 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {makeComputedArtifact} from '../computed-artifact.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import {getComputationDataParams, lanternErrorAdapter} from './lantern-metric.js';
|
|
9
|
+
import {FirstContentfulPaint} from '../../lib/lantern/metrics/first-contentful-paint.js';
|
|
10
10
|
|
|
11
|
-
/** @typedef {import('../../lib/lantern/
|
|
12
|
-
/** @typedef {import('../../lib/lantern/cpu-node.js').CPUNode<LH.Artifacts.NetworkRequest>} CPUNode */
|
|
13
|
-
/** @typedef {import('../../lib/lantern/network-node.js').NetworkNode<LH.Artifacts.NetworkRequest>} NetworkNode */
|
|
11
|
+
/** @typedef {import('../../lib/lantern/metric.js').Extras} Extras */
|
|
14
12
|
|
|
15
|
-
class LanternFirstContentfulPaint extends
|
|
13
|
+
class LanternFirstContentfulPaint extends FirstContentfulPaint {
|
|
16
14
|
/**
|
|
17
|
-
* @
|
|
15
|
+
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
16
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
17
|
+
* @param {Omit<Extras, 'optimistic'>=} extras
|
|
18
|
+
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
18
19
|
*/
|
|
19
|
-
static
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
optimistic: 0.5,
|
|
23
|
-
pessimistic: 0.5,
|
|
24
|
-
};
|
|
20
|
+
static async computeMetricWithGraphs(data, context, extras) {
|
|
21
|
+
return this.compute(await getComputationDataParams(data, context), extras)
|
|
22
|
+
.catch(lanternErrorAdapter);
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
/**
|
|
28
|
-
* @
|
|
29
|
-
* @
|
|
30
|
-
*
|
|
31
|
-
* @property {function(NetworkNode):boolean} treatNodeAsRenderBlocking The function that determines
|
|
32
|
-
* which resources should be considered *possibly* render-blocking.
|
|
33
|
-
* @property {(function(CPUNode):boolean)=} additionalCpuNodesToTreatAsRenderBlocking The function that
|
|
34
|
-
* determines which CPU nodes should also be included in our blocking node IDs set,
|
|
35
|
-
* beyond what getRenderBlockingNodeData() already includes.
|
|
26
|
+
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
27
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
28
|
+
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
36
29
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
* This function computes the set of URLs that *appeared* to be render-blocking based on our filter,
|
|
40
|
-
* *but definitely were not* render-blocking based on the timing of their EvaluateScript task.
|
|
41
|
-
* It also computes the set of corresponding CPU node ids that were needed for the paint at the
|
|
42
|
-
* given timestamp.
|
|
43
|
-
*
|
|
44
|
-
* @param {Node} graph
|
|
45
|
-
* @param {FirstPaintBasedGraphOpts} opts
|
|
46
|
-
* @return {{definitelyNotRenderBlockingScriptUrls: Set<string>, renderBlockingCpuNodeIds: Set<string>}}
|
|
47
|
-
*/
|
|
48
|
-
static getRenderBlockingNodeData(
|
|
49
|
-
graph,
|
|
50
|
-
{cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking}
|
|
51
|
-
) {
|
|
52
|
-
/** @type {Map<string, CPUNode>} A map of blocking script URLs to the earliest EvaluateScript task node that executed them. */
|
|
53
|
-
const scriptUrlToNodeMap = new Map();
|
|
54
|
-
|
|
55
|
-
/** @type {Array<CPUNode>} */
|
|
56
|
-
const cpuNodes = [];
|
|
57
|
-
graph.traverse(node => {
|
|
58
|
-
if (node.type === BaseNode.TYPES.CPU) {
|
|
59
|
-
// A task is *possibly* render blocking if it *started* before cutoffTimestamp.
|
|
60
|
-
// We use startTime here because the paint event can be *inside* the task that was render blocking.
|
|
61
|
-
if (node.startTime <= cutoffTimestamp) cpuNodes.push(node);
|
|
62
|
-
|
|
63
|
-
// Build our script URL map to find the earliest EvaluateScript task node.
|
|
64
|
-
const scriptUrls = node.getEvaluateScriptURLs();
|
|
65
|
-
for (const url of scriptUrls) {
|
|
66
|
-
// Use the earliest CPU node we find.
|
|
67
|
-
const existing = scriptUrlToNodeMap.get(url) || node;
|
|
68
|
-
scriptUrlToNodeMap.set(url, node.startTime < existing.startTime ? node : existing);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
cpuNodes.sort((a, b) => a.startTime - b.startTime);
|
|
74
|
-
|
|
75
|
-
// A script is *possibly* render blocking if it finished loading before cutoffTimestamp.
|
|
76
|
-
const possiblyRenderBlockingScriptUrls = LanternMetric.getScriptUrls(graph, node => {
|
|
77
|
-
// The optimistic LCP treatNodeAsRenderBlocking fn wants to exclude some images in the graph,
|
|
78
|
-
// but here it only receives scripts to evaluate. It's a no-op in this case, but it will
|
|
79
|
-
// matter below in the getFirstPaintBasedGraph clone operation.
|
|
80
|
-
return node.endTime <= cutoffTimestamp && treatNodeAsRenderBlocking(node);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
// A script is *definitely not* render blocking if its EvaluateScript task started after cutoffTimestamp.
|
|
84
|
-
/** @type {Set<string>} */
|
|
85
|
-
const definitelyNotRenderBlockingScriptUrls = new Set();
|
|
86
|
-
/** @type {Set<string>} */
|
|
87
|
-
const renderBlockingCpuNodeIds = new Set();
|
|
88
|
-
for (const url of possiblyRenderBlockingScriptUrls) {
|
|
89
|
-
// Lookup the CPU node that had the earliest EvaluateScript for this URL.
|
|
90
|
-
const cpuNodeForUrl = scriptUrlToNodeMap.get(url);
|
|
91
|
-
|
|
92
|
-
// If we can't find it at all, we can't conclude anything, so just skip it.
|
|
93
|
-
if (!cpuNodeForUrl) continue;
|
|
94
|
-
|
|
95
|
-
// If we found it and it was in our `cpuNodes` set that means it finished before cutoffTimestamp, so it really is render-blocking.
|
|
96
|
-
if (cpuNodes.includes(cpuNodeForUrl)) {
|
|
97
|
-
renderBlockingCpuNodeIds.add(cpuNodeForUrl.id);
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// We couldn't find the evaluate script in the set of CPU nodes that ran before our paint, so
|
|
102
|
-
// it must not have been necessary for the paint.
|
|
103
|
-
definitelyNotRenderBlockingScriptUrls.add(url);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// The first layout, first paint, and first ParseHTML are almost always necessary for first paint,
|
|
107
|
-
// so we always include those CPU nodes.
|
|
108
|
-
const firstLayout = cpuNodes.find(node => node.didPerformLayout());
|
|
109
|
-
if (firstLayout) renderBlockingCpuNodeIds.add(firstLayout.id);
|
|
110
|
-
const firstPaint = cpuNodes.find(node => node.childEvents.some(e => e.name === 'Paint'));
|
|
111
|
-
if (firstPaint) renderBlockingCpuNodeIds.add(firstPaint.id);
|
|
112
|
-
const firstParse = cpuNodes.find(node => node.childEvents.some(e => e.name === 'ParseHTML'));
|
|
113
|
-
if (firstParse) renderBlockingCpuNodeIds.add(firstParse.id);
|
|
114
|
-
|
|
115
|
-
// If a CPU filter was passed in, we also want to include those extra nodes.
|
|
116
|
-
if (additionalCpuNodesToTreatAsRenderBlocking) {
|
|
117
|
-
cpuNodes
|
|
118
|
-
.filter(additionalCpuNodesToTreatAsRenderBlocking)
|
|
119
|
-
.forEach(node => renderBlockingCpuNodeIds.add(node.id));
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return {
|
|
123
|
-
definitelyNotRenderBlockingScriptUrls,
|
|
124
|
-
renderBlockingCpuNodeIds,
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* This function computes the graph required for the first paint of interest.
|
|
130
|
-
*
|
|
131
|
-
* @param {Node} dependencyGraph
|
|
132
|
-
* @param {FirstPaintBasedGraphOpts} opts
|
|
133
|
-
* @return {Node}
|
|
134
|
-
*/
|
|
135
|
-
static getFirstPaintBasedGraph(
|
|
136
|
-
dependencyGraph,
|
|
137
|
-
{cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking}
|
|
138
|
-
) {
|
|
139
|
-
const rbData = this.getRenderBlockingNodeData(dependencyGraph, {
|
|
140
|
-
cutoffTimestamp,
|
|
141
|
-
treatNodeAsRenderBlocking,
|
|
142
|
-
additionalCpuNodesToTreatAsRenderBlocking,
|
|
143
|
-
});
|
|
144
|
-
const {definitelyNotRenderBlockingScriptUrls, renderBlockingCpuNodeIds} = rbData;
|
|
145
|
-
|
|
146
|
-
return dependencyGraph.cloneWithRelationships(node => {
|
|
147
|
-
if (node.type === BaseNode.TYPES.NETWORK) {
|
|
148
|
-
// Exclude all nodes that ended after cutoffTimestamp (except for the main document which we always consider necessary)
|
|
149
|
-
// endTime is negative if request does not finish, make sure startTime isn't after cutoffTimestamp in this case.
|
|
150
|
-
const endedAfterPaint = node.endTime > cutoffTimestamp || node.startTime > cutoffTimestamp;
|
|
151
|
-
if (endedAfterPaint && !node.isMainDocument()) return false;
|
|
152
|
-
|
|
153
|
-
const url = node.record.url;
|
|
154
|
-
// If the URL definitely wasn't render-blocking then we filter it out.
|
|
155
|
-
if (definitelyNotRenderBlockingScriptUrls.has(url)) {
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// Lastly, build up the FCP graph of all nodes we consider render blocking
|
|
160
|
-
return treatNodeAsRenderBlocking(node);
|
|
161
|
-
} else {
|
|
162
|
-
// If it's a CPU node, just check if it was blocking.
|
|
163
|
-
return renderBlockingCpuNodeIds.has(node.id);
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* @param {Node} dependencyGraph
|
|
170
|
-
* @param {LH.Artifacts.ProcessedNavigation} processedNavigation
|
|
171
|
-
* @return {Node}
|
|
172
|
-
*/
|
|
173
|
-
static getOptimisticGraph(dependencyGraph, processedNavigation) {
|
|
174
|
-
return this.getFirstPaintBasedGraph(dependencyGraph, {
|
|
175
|
-
cutoffTimestamp: processedNavigation.timestamps.firstContentfulPaint,
|
|
176
|
-
// In the optimistic graph we exclude resources that appeared to be render blocking but were
|
|
177
|
-
// initiated by a script. While they typically have a very high importance and tend to have a
|
|
178
|
-
// significant impact on the page's content, these resources don't technically block rendering.
|
|
179
|
-
treatNodeAsRenderBlocking: node =>
|
|
180
|
-
node.hasRenderBlockingPriority() && node.initiatorType !== 'script',
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* @param {Node} dependencyGraph
|
|
186
|
-
* @param {LH.Artifacts.ProcessedNavigation} processedNavigation
|
|
187
|
-
* @return {Node}
|
|
188
|
-
*/
|
|
189
|
-
static getPessimisticGraph(dependencyGraph, processedNavigation) {
|
|
190
|
-
return this.getFirstPaintBasedGraph(dependencyGraph, {
|
|
191
|
-
cutoffTimestamp: processedNavigation.timestamps.firstContentfulPaint,
|
|
192
|
-
treatNodeAsRenderBlocking: node => node.hasRenderBlockingPriority(),
|
|
193
|
-
});
|
|
30
|
+
static async compute_(data, context) {
|
|
31
|
+
return this.computeMetricWithGraphs(data, context);
|
|
194
32
|
}
|
|
195
33
|
}
|
|
196
34
|
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
export { LanternFirstMeaningfulPaintComputed as LanternFirstMeaningfulPaint };
|
|
2
|
-
export type
|
|
2
|
+
export type Extras = import('../../lib/lantern/metric.js').Extras;
|
|
3
3
|
declare const LanternFirstMeaningfulPaintComputed: typeof LanternFirstMeaningfulPaint & {
|
|
4
4
|
request: (dependencies: import("../../index.js").Artifacts.MetricComputationDataInput, context: import("../../../types/utility-types.js").default.ImmutableObject<{
|
|
5
5
|
computedCache: Map<string, import("../../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
6
6
|
}>) => Promise<import("../../index.js").Artifacts.LanternMetric>;
|
|
7
7
|
};
|
|
8
|
-
/** @typedef {import('../../lib/lantern/
|
|
9
|
-
declare class LanternFirstMeaningfulPaint extends
|
|
8
|
+
/** @typedef {import('../../lib/lantern/metric.js').Extras} Extras */
|
|
9
|
+
declare class LanternFirstMeaningfulPaint extends FirstMeaningfulPaint {
|
|
10
10
|
/**
|
|
11
|
-
* @param {
|
|
12
|
-
* @param {LH.Artifacts.
|
|
13
|
-
* @
|
|
11
|
+
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
12
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
13
|
+
* @param {Omit<Extras, 'optimistic'>=} extras
|
|
14
|
+
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
14
15
|
*/
|
|
15
|
-
static
|
|
16
|
+
static computeMetricWithGraphs(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext, extras?: Omit<Extras, 'optimistic'> | undefined): Promise<LH.Artifacts.LanternMetric>;
|
|
16
17
|
/**
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {LH.Artifacts.
|
|
19
|
-
* @return {
|
|
18
|
+
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
19
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
20
|
+
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
20
21
|
*/
|
|
21
|
-
static
|
|
22
|
+
static compute_(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.LanternMetric>;
|
|
22
23
|
}
|
|
23
|
-
import {
|
|
24
|
+
import { FirstMeaningfulPaint } from '../../lib/lantern/metrics/first-meaningful-paint.js';
|
|
24
25
|
//# sourceMappingURL=lantern-first-meaningful-paint.d.ts.map
|
|
@@ -5,60 +5,22 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {makeComputedArtifact} from '../computed-artifact.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import {getComputationDataParams, lanternErrorAdapter} from './lantern-metric.js';
|
|
9
|
+
import {FirstMeaningfulPaint} from '../../lib/lantern/metrics/first-meaningful-paint.js';
|
|
10
10
|
import {LanternFirstContentfulPaint} from './lantern-first-contentful-paint.js';
|
|
11
11
|
|
|
12
|
-
/** @typedef {import('../../lib/lantern/
|
|
12
|
+
/** @typedef {import('../../lib/lantern/metric.js').Extras} Extras */
|
|
13
13
|
|
|
14
|
-
class LanternFirstMeaningfulPaint extends
|
|
14
|
+
class LanternFirstMeaningfulPaint extends FirstMeaningfulPaint {
|
|
15
15
|
/**
|
|
16
|
-
* @
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
intercept: 0,
|
|
21
|
-
optimistic: 0.5,
|
|
22
|
-
pessimistic: 0.5,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @param {Node} dependencyGraph
|
|
28
|
-
* @param {LH.Artifacts.ProcessedNavigation} processedNavigation
|
|
29
|
-
* @return {Node}
|
|
30
|
-
*/
|
|
31
|
-
static getOptimisticGraph(dependencyGraph, processedNavigation) {
|
|
32
|
-
const fmp = processedNavigation.timestamps.firstMeaningfulPaint;
|
|
33
|
-
if (!fmp) {
|
|
34
|
-
throw new LighthouseError(LighthouseError.errors.NO_FMP);
|
|
35
|
-
}
|
|
36
|
-
return LanternFirstContentfulPaint.getFirstPaintBasedGraph(dependencyGraph, {
|
|
37
|
-
cutoffTimestamp: fmp,
|
|
38
|
-
// See LanternFirstContentfulPaint's getOptimisticGraph implementation for a longer description
|
|
39
|
-
// of why we exclude script initiated resources here.
|
|
40
|
-
treatNodeAsRenderBlocking: node =>
|
|
41
|
-
node.hasRenderBlockingPriority() && node.initiatorType !== 'script',
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @param {Node} dependencyGraph
|
|
47
|
-
* @param {LH.Artifacts.ProcessedNavigation} processedNavigation
|
|
48
|
-
* @return {Node}
|
|
16
|
+
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
17
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
18
|
+
* @param {Omit<Extras, 'optimistic'>=} extras
|
|
19
|
+
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
49
20
|
*/
|
|
50
|
-
static
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
throw new LighthouseError(LighthouseError.errors.NO_FMP);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return LanternFirstContentfulPaint.getFirstPaintBasedGraph(dependencyGraph, {
|
|
57
|
-
cutoffTimestamp: fmp,
|
|
58
|
-
treatNodeAsRenderBlocking: node => node.hasRenderBlockingPriority(),
|
|
59
|
-
// For pessimistic FMP we'll include *all* layout nodes
|
|
60
|
-
additionalCpuNodesToTreatAsRenderBlocking: node => node.didPerformLayout(),
|
|
61
|
-
});
|
|
21
|
+
static async computeMetricWithGraphs(data, context, extras) {
|
|
22
|
+
return this.compute(await getComputationDataParams(data, context), extras)
|
|
23
|
+
.catch(lanternErrorAdapter);
|
|
62
24
|
}
|
|
63
25
|
|
|
64
26
|
/**
|
|
@@ -1,33 +1,25 @@
|
|
|
1
1
|
export { LanternInteractiveComputed as LanternInteractive };
|
|
2
|
-
export type
|
|
2
|
+
export type Extras = import('../../lib/lantern/metric.js').Extras;
|
|
3
3
|
declare const LanternInteractiveComputed: typeof LanternInteractive & {
|
|
4
4
|
request: (dependencies: import("../../index.js").Artifacts.MetricComputationDataInput, context: import("../../../types/utility-types.js").default.ImmutableObject<{
|
|
5
5
|
computedCache: Map<string, import("../../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
6
6
|
}>) => Promise<import("../../index.js").Artifacts.LanternMetric>;
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
declare class LanternInteractive extends
|
|
8
|
+
/** @typedef {import('../../lib/lantern/metric.js').Extras} Extras */
|
|
9
|
+
declare class LanternInteractive extends Interactive {
|
|
10
10
|
/**
|
|
11
|
-
* @param {
|
|
12
|
-
* @
|
|
11
|
+
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
12
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
13
|
+
* @param {Omit<Extras, 'optimistic'>=} extras
|
|
14
|
+
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
13
15
|
*/
|
|
14
|
-
static
|
|
16
|
+
static computeMetricWithGraphs(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext, extras?: Omit<Extras, 'optimistic'> | undefined): Promise<LH.Artifacts.LanternMetric>;
|
|
15
17
|
/**
|
|
16
|
-
* @param {
|
|
17
|
-
* @
|
|
18
|
+
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
19
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
20
|
+
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
18
21
|
*/
|
|
19
|
-
static
|
|
20
|
-
/**
|
|
21
|
-
* @param {LH.Gatherer.Simulation.Result} simulationResult
|
|
22
|
-
* @param {import('../../lib/lantern/metric.js').Extras} extras
|
|
23
|
-
* @return {LH.Gatherer.Simulation.Result}
|
|
24
|
-
*/
|
|
25
|
-
static getEstimateFromSimulation(simulationResult: LH.Gatherer.Simulation.Result, extras: import('../../lib/lantern/metric.js').Extras): LH.Gatherer.Simulation.Result;
|
|
26
|
-
/**
|
|
27
|
-
* @param {LH.Gatherer.Simulation.Result['nodeTimings']} nodeTimings
|
|
28
|
-
* @return {number}
|
|
29
|
-
*/
|
|
30
|
-
static getLastLongTaskEndTime(nodeTimings: LH.Gatherer.Simulation.Result['nodeTimings'], duration?: number): number;
|
|
22
|
+
static compute_(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.LanternMetric>;
|
|
31
23
|
}
|
|
32
|
-
import {
|
|
24
|
+
import { Interactive } from '../../lib/lantern/metrics/interactive.js';
|
|
33
25
|
//# sourceMappingURL=lantern-interactive.d.ts.map
|