lighthouse 10.4.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +1 -1
- package/cli/cli-flags.d.ts +1 -6
- package/cli/cli-flags.js +0 -5
- package/cli/run.js +3 -10
- package/cli/sentry-prompt.js +4 -2
- package/cli/test/smokehouse/core-tests.js +0 -2
- package/cli/test/smokehouse/frontends/smokehouse-bin.js +24 -14
- package/cli/test/smokehouse/lighthouse-runners/bundle.d.ts +1 -2
- package/cli/test/smokehouse/lighthouse-runners/bundle.js +12 -21
- package/cli/test/smokehouse/lighthouse-runners/cli.d.ts +1 -3
- package/cli/test/smokehouse/lighthouse-runners/cli.js +3 -7
- package/cli/test/smokehouse/lighthouse-runners/devtools.d.ts +1 -5
- package/cli/test/smokehouse/lighthouse-runners/devtools.js +1 -12
- package/cli/test/smokehouse/readme.md +0 -2
- package/cli/test/smokehouse/report-assert.d.ts +1 -3
- package/cli/test/smokehouse/report-assert.js +2 -19
- package/cli/test/smokehouse/smokehouse.js +3 -32
- package/core/audits/accessibility/aria-allowed-role.d.ts +10 -0
- package/core/audits/accessibility/aria-allowed-role.js +46 -0
- package/core/audits/accessibility/image-redundant-alt.d.ts +10 -0
- package/core/audits/accessibility/image-redundant-alt.js +45 -0
- package/core/audits/accessibility/label-content-name-mismatch.d.ts +10 -0
- package/core/audits/accessibility/label-content-name-mismatch.js +44 -0
- package/core/audits/accessibility/skip-link.d.ts +10 -0
- package/core/audits/accessibility/skip-link.js +43 -0
- package/core/audits/accessibility/table-duplicate-name.d.ts +10 -0
- package/core/audits/accessibility/table-duplicate-name.js +44 -0
- package/core/audits/accessibility/target-size.js +1 -1
- package/core/audits/byte-efficiency/duplicated-javascript.js +2 -2
- package/core/audits/byte-efficiency/render-blocking-resources.js +1 -0
- package/core/audits/dobetterweb/uses-http2.d.ts +18 -1
- package/core/audits/dobetterweb/uses-http2.js +62 -16
- package/core/audits/installable-manifest.d.ts +1 -5
- package/core/audits/installable-manifest.js +2 -7
- package/core/audits/largest-contentful-paint-element.d.ts +0 -6
- package/core/audits/largest-contentful-paint-element.js +13 -15
- package/core/audits/metrics/{experimental-interaction-to-next-paint.d.ts → interaction-to-next-paint.d.ts} +3 -3
- package/core/audits/metrics/{experimental-interaction-to-next-paint.js → interaction-to-next-paint.js} +3 -3
- package/core/audits/uses-rel-preconnect.js +23 -8
- package/core/audits/work-during-interaction.js +2 -2
- package/core/computed/processed-navigation.d.ts +1 -1
- package/core/config/config-helpers.d.ts +3 -3
- package/core/config/config-helpers.js +5 -12
- package/core/config/config.js +1 -7
- package/core/config/constants.d.ts +0 -2
- package/core/config/constants.js +2 -18
- package/core/config/default-config.js +59 -53
- package/core/config/filters.js +1 -1
- package/core/config/validation.d.ts +7 -12
- package/core/config/validation.js +16 -26
- package/core/gather/base-artifacts.d.ts +4 -4
- package/core/gather/base-artifacts.js +2 -6
- package/core/gather/base-gatherer.d.ts +12 -37
- package/core/gather/base-gatherer.js +7 -54
- package/core/gather/driver/dom.d.ts +4 -4
- package/core/gather/driver/dom.js +2 -2
- package/core/gather/driver/environment.d.ts +4 -4
- package/core/gather/driver/environment.js +2 -2
- package/core/gather/driver/execution-context.d.ts +12 -3
- package/core/gather/driver/execution-context.js +34 -3
- package/core/gather/driver/navigation.d.ts +2 -2
- package/core/gather/driver/navigation.js +2 -5
- package/core/gather/driver/network-monitor.d.ts +7 -6
- package/core/gather/driver/network-monitor.js +4 -4
- package/core/gather/driver/network.d.ts +2 -2
- package/core/gather/driver/network.js +1 -1
- package/core/gather/driver/prepare.d.ts +10 -10
- package/core/gather/driver/prepare.js +10 -10
- package/core/gather/driver/service-workers.d.ts +4 -4
- package/core/gather/driver/service-workers.js +2 -2
- package/core/gather/driver/storage.d.ts +6 -6
- package/core/gather/driver/storage.js +3 -3
- package/core/gather/driver/target-manager.d.ts +6 -5
- package/core/gather/driver/target-manager.js +3 -3
- package/core/gather/driver/wait-for-condition.d.ts +14 -14
- package/core/gather/driver/wait-for-condition.js +8 -8
- package/core/gather/driver.d.ts +9 -6
- package/core/gather/driver.js +14 -4
- package/core/gather/fetcher.d.ts +3 -3
- package/core/gather/fetcher.js +1 -1
- package/core/gather/gatherers/accessibility.d.ts +4 -4
- package/core/gather/gatherers/accessibility.js +8 -3
- package/core/gather/gatherers/anchor-elements.d.ts +4 -4
- package/core/gather/gatherers/anchor-elements.js +4 -4
- package/core/gather/gatherers/bf-cache-failures.d.ts +8 -14
- package/core/gather/gatherers/bf-cache-failures.js +5 -14
- package/core/gather/gatherers/cache-contents.d.ts +4 -4
- package/core/gather/gatherers/cache-contents.js +3 -3
- package/core/gather/gatherers/console-messages.d.ts +6 -6
- package/core/gather/gatherers/console-messages.js +4 -4
- package/core/gather/gatherers/css-usage.d.ts +14 -14
- package/core/gather/gatherers/css-usage.js +9 -9
- package/core/gather/gatherers/devtools-log-compat.d.ts +5 -5
- package/core/gather/gatherers/devtools-log-compat.js +4 -4
- package/core/gather/gatherers/devtools-log.d.ts +6 -6
- package/core/gather/gatherers/devtools-log.js +4 -4
- package/core/gather/gatherers/dobetterweb/doctype.d.ts +4 -4
- package/core/gather/gatherers/dobetterweb/doctype.js +3 -3
- package/core/gather/gatherers/dobetterweb/domstats.d.ts +4 -4
- package/core/gather/gatherers/dobetterweb/domstats.js +3 -3
- package/core/gather/gatherers/dobetterweb/optimized-images.d.ts +10 -22
- package/core/gather/gatherers/dobetterweb/optimized-images.js +10 -27
- package/core/gather/gatherers/dobetterweb/response-compression.d.ts +6 -12
- package/core/gather/gatherers/dobetterweb/response-compression.js +14 -21
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.d.ts +8 -14
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +5 -14
- package/core/gather/gatherers/full-page-screenshot.d.ts +10 -10
- package/core/gather/gatherers/full-page-screenshot.js +7 -10
- package/core/gather/gatherers/global-listeners.d.ts +4 -4
- package/core/gather/gatherers/global-listeners.js +3 -3
- package/core/gather/gatherers/iframe-elements.d.ts +4 -4
- package/core/gather/gatherers/iframe-elements.js +3 -3
- package/core/gather/gatherers/image-elements.d.ts +10 -10
- package/core/gather/gatherers/image-elements.js +6 -6
- package/core/gather/gatherers/inputs.d.ts +4 -4
- package/core/gather/gatherers/inputs.js +3 -3
- package/core/gather/gatherers/inspector-issues.d.ts +8 -19
- package/core/gather/gatherers/inspector-issues.js +9 -26
- package/core/gather/gatherers/installability-errors.d.ts +6 -6
- package/core/gather/gatherers/installability-errors.js +4 -4
- package/core/gather/gatherers/js-usage.d.ts +6 -6
- package/core/gather/gatherers/js-usage.js +4 -4
- package/core/gather/gatherers/link-elements.d.ts +8 -20
- package/core/gather/gatherers/link-elements.js +7 -24
- package/core/gather/gatherers/main-document-content.d.ts +4 -16
- package/core/gather/gatherers/main-document-content.js +5 -23
- package/core/gather/gatherers/meta-elements.d.ts +4 -4
- package/core/gather/gatherers/meta-elements.js +3 -3
- package/core/gather/gatherers/network-user-agent.d.ts +5 -5
- package/core/gather/gatherers/network-user-agent.js +4 -4
- package/core/gather/gatherers/script-elements.d.ts +6 -11
- package/core/gather/gatherers/script-elements.js +4 -13
- package/core/gather/gatherers/scripts.d.ts +7 -6
- package/core/gather/gatherers/scripts.js +7 -9
- package/core/gather/gatherers/seo/embedded-content.d.ts +4 -4
- package/core/gather/gatherers/seo/embedded-content.js +3 -3
- package/core/gather/gatherers/seo/font-size.d.ts +6 -6
- package/core/gather/gatherers/seo/font-size.js +5 -5
- package/core/gather/gatherers/seo/robots-txt.d.ts +4 -4
- package/core/gather/gatherers/seo/robots-txt.js +3 -3
- package/core/gather/gatherers/seo/tap-targets.d.ts +8 -8
- package/core/gather/gatherers/seo/tap-targets.js +5 -5
- package/core/gather/gatherers/service-worker.d.ts +4 -10
- package/core/gather/gatherers/service-worker.js +3 -15
- package/core/gather/gatherers/source-maps.d.ts +11 -23
- package/core/gather/gatherers/source-maps.js +22 -53
- package/core/gather/gatherers/stacks.d.ts +7 -7
- package/core/gather/gatherers/stacks.js +6 -6
- package/core/gather/gatherers/trace-compat.d.ts +5 -5
- package/core/gather/gatherers/trace-compat.js +4 -4
- package/core/gather/gatherers/trace-elements.d.ts +13 -25
- package/core/gather/gatherers/trace-elements.js +19 -32
- package/core/gather/gatherers/trace.d.ts +8 -8
- package/core/gather/gatherers/trace.js +5 -5
- package/core/gather/gatherers/viewport-dimensions.d.ts +4 -4
- package/core/gather/gatherers/viewport-dimensions.js +3 -3
- package/core/gather/gatherers/web-app-manifest.d.ts +8 -8
- package/core/gather/gatherers/web-app-manifest.js +5 -5
- package/core/gather/navigation-runner.d.ts +9 -9
- package/core/gather/navigation-runner.js +14 -8
- package/core/gather/runner-helpers.d.ts +3 -3
- package/core/gather/runner-helpers.js +12 -4
- package/core/gather/session.d.ts +2 -2
- package/core/gather/session.js +1 -1
- package/core/gather/snapshot-runner.d.ts +2 -2
- package/core/gather/snapshot-runner.js +1 -1
- package/core/gather/timespan-runner.d.ts +2 -2
- package/core/gather/timespan-runner.js +1 -1
- package/core/index.cjs +0 -7
- package/core/index.d.ts +0 -15
- package/core/index.js +2 -40
- package/core/lib/asset-saver.js +14 -4
- package/core/lib/axe.js +1 -1
- package/core/lib/dependency-graph/simulator/network-analyzer.d.ts +28 -12
- package/core/lib/dependency-graph/simulator/network-analyzer.js +128 -100
- package/core/lib/emulation.d.ts +14 -14
- package/core/lib/emulation.js +7 -7
- package/core/lib/navigation-error.js +5 -0
- package/core/lib/network-recorder.d.ts +2 -1
- package/core/lib/network-recorder.js +1 -0
- package/core/lib/network-request.js +12 -3
- package/core/lib/page-functions.d.ts +10 -2
- package/core/lib/page-functions.js +85 -8
- package/core/lib/sentry.js +9 -2
- package/core/lib/stack-packs.js +4 -0
- package/core/runner.d.ts +8 -30
- package/core/runner.js +8 -39
- package/core/user-flow.d.ts +4 -4
- package/core/user-flow.js +2 -2
- package/dist/report/bundle.esm.js +2221 -5832
- package/dist/report/flow.js +2631 -235
- package/dist/report/standalone.js +2586 -234
- package/flow-report/src/i18n/i18n.d.ts +2 -2
- package/package.json +17 -24
- package/readme.md +3 -1
- package/report/assets/templates.html +3 -1
- package/report/renderer/category-renderer.d.ts +3 -2
- package/report/renderer/category-renderer.js +8 -4
- package/report/renderer/components.js +11 -5
- package/report/renderer/pwa-category-renderer.js +1 -1
- package/report/renderer/report-ui-features.js +9 -6
- package/report/renderer/report-utils.d.ts +1 -1
- package/report/renderer/report-utils.js +2 -2
- package/report/renderer/topbar-features.js +3 -0
- package/shared/localization/locales/ar-XB.json +185 -44
- package/shared/localization/locales/ar.json +185 -44
- package/shared/localization/locales/bg.json +185 -44
- package/shared/localization/locales/ca.json +190 -49
- package/shared/localization/locales/cs.json +185 -44
- package/shared/localization/locales/da.json +185 -44
- package/shared/localization/locales/de.json +185 -44
- package/shared/localization/locales/el.json +185 -44
- package/shared/localization/locales/en-GB.json +185 -44
- package/shared/localization/locales/en-US.json +99 -45
- package/shared/localization/locales/en-XA.json +185 -44
- package/shared/localization/locales/en-XL.json +99 -45
- package/shared/localization/locales/es-419.json +185 -44
- package/shared/localization/locales/es.json +185 -44
- package/shared/localization/locales/fi.json +185 -44
- package/shared/localization/locales/fil.json +185 -44
- package/shared/localization/locales/fr.json +185 -44
- package/shared/localization/locales/he.json +186 -45
- package/shared/localization/locales/hi.json +185 -44
- package/shared/localization/locales/hr.json +185 -44
- package/shared/localization/locales/hu.json +185 -44
- package/shared/localization/locales/id.json +185 -44
- package/shared/localization/locales/it.json +185 -44
- package/shared/localization/locales/ja.json +185 -44
- package/shared/localization/locales/ko.json +185 -44
- package/shared/localization/locales/lt.json +185 -44
- package/shared/localization/locales/lv.json +185 -44
- package/shared/localization/locales/nl.json +185 -44
- package/shared/localization/locales/no.json +185 -44
- package/shared/localization/locales/pl.json +185 -44
- package/shared/localization/locales/pt-PT.json +185 -44
- package/shared/localization/locales/pt.json +190 -49
- package/shared/localization/locales/ro.json +185 -44
- package/shared/localization/locales/ru.json +185 -44
- package/shared/localization/locales/sk.json +185 -44
- package/shared/localization/locales/sl.json +185 -44
- package/shared/localization/locales/sr-Latn.json +185 -44
- package/shared/localization/locales/sr.json +185 -44
- package/shared/localization/locales/sv.json +185 -44
- package/shared/localization/locales/ta.json +185 -44
- package/shared/localization/locales/te.json +185 -44
- package/shared/localization/locales/th.json +185 -44
- package/shared/localization/locales/tr.json +185 -44
- package/shared/localization/locales/uk.json +185 -44
- package/shared/localization/locales/vi.json +185 -44
- package/shared/localization/locales/zh-HK.json +185 -44
- package/shared/localization/locales/zh-TW.json +185 -44
- package/shared/localization/locales/zh.json +185 -44
- package/third-party/esbuild-plugins-polyfills/LICENSE +3 -0
- package/third-party/esbuild-plugins-polyfills/README.md +7 -0
- package/third-party/esbuild-plugins-polyfills/esbuild-polyfills.d.ts +9 -0
- package/third-party/esbuild-plugins-polyfills/esbuild-polyfills.js +129 -0
- package/tsconfig.json +2 -1
- package/types/artifacts.d.ts +16 -45
- package/types/config.d.ts +10 -52
- package/types/externs.d.ts +0 -2
- package/types/gatherer.d.ts +24 -47
- package/types/internal/rxjs.d.ts +26 -0
- package/types/internal/smokehouse.d.ts +1 -3
- package/types/lh.d.ts +0 -2
- package/types/lhr/settings.d.ts +1 -1
- package/core/audits/metrics/first-contentful-paint-3g.d.ts +0 -15
- package/core/audits/metrics/first-contentful-paint-3g.js +0 -69
- package/core/audits/resource-summary.d.ts +0 -16
- package/core/audits/resource-summary.js +0 -104
- package/core/audits/service-worker.d.ts +0 -46
- package/core/audits/service-worker.js +0 -182
- package/core/gather/gatherers/gatherer.d.ts +0 -46
- package/core/gather/gatherers/gatherer.js +0 -58
- package/core/legacy/config/config.d.ts +0 -107
- package/core/legacy/config/config.js +0 -566
- package/core/legacy/config/legacy-default-config.d.ts +0 -4
- package/core/legacy/config/legacy-default-config.js +0 -87
- package/core/legacy/gather/connections/connection.d.ts +0 -77
- package/core/legacy/gather/connections/connection.js +0 -196
- package/core/legacy/gather/connections/cri.d.ts +0 -27
- package/core/legacy/gather/connections/cri.js +0 -162
- package/core/legacy/gather/connections/raw.d.ts +0 -20
- package/core/legacy/gather/connections/raw.js +0 -57
- package/core/legacy/gather/driver.d.ts +0 -216
- package/core/legacy/gather/driver.js +0 -480
- package/core/legacy/gather/gather-runner.d.ts +0 -166
- package/core/legacy/gather/gather-runner.js +0 -590
- package/types/internal/lighthouse-logger.d.ts +0 -34
package/types/artifacts.d.ts
CHANGED
|
@@ -24,23 +24,14 @@ import Protocol from './protocol.js';
|
|
|
24
24
|
import Util from './utility-types.js';
|
|
25
25
|
import Audit from './audit.js';
|
|
26
26
|
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
export type FRArtifacts = Util.StrictOmit<Artifacts,
|
|
30
|
-
| 'Fonts'
|
|
31
|
-
| 'Manifest'
|
|
32
|
-
| 'MixedContent'
|
|
33
|
-
| keyof FRBaseArtifacts
|
|
34
|
-
>;
|
|
27
|
+
export type Artifacts = BaseArtifacts & GathererArtifacts;
|
|
35
28
|
|
|
36
29
|
/**
|
|
37
30
|
* Artifacts always created by gathering. These artifacts are available to Lighthouse plugins.
|
|
38
31
|
* NOTE: any breaking changes here are considered breaking Lighthouse changes that must be done
|
|
39
32
|
* on a major version bump.
|
|
40
33
|
*/
|
|
41
|
-
export type BaseArtifacts = UniversalBaseArtifacts & ContextualBaseArtifacts
|
|
42
|
-
|
|
43
|
-
export type FRBaseArtifacts = UniversalBaseArtifacts & ContextualBaseArtifacts;
|
|
34
|
+
export type BaseArtifacts = UniversalBaseArtifacts & ContextualBaseArtifacts;
|
|
44
35
|
|
|
45
36
|
/**
|
|
46
37
|
* The set of base artifacts that are available in every mode of Lighthouse operation.
|
|
@@ -76,18 +67,6 @@ interface ContextualBaseArtifacts {
|
|
|
76
67
|
PageLoadError: LighthouseError | null;
|
|
77
68
|
}
|
|
78
69
|
|
|
79
|
-
/**
|
|
80
|
-
* The set of base artifacts that were replaced by standard gatherers in Fraggle Rock.
|
|
81
|
-
*/
|
|
82
|
-
interface LegacyBaseArtifacts {
|
|
83
|
-
/** The user agent string that Lighthouse used to load the page. Set to the empty string if unknown. */
|
|
84
|
-
NetworkUserAgent: string;
|
|
85
|
-
/** A set of page-load traces, keyed by passName. */
|
|
86
|
-
traces: {[passName: string]: Trace};
|
|
87
|
-
/** A set of DevTools debugger protocol records, keyed by passName. */
|
|
88
|
-
devtoolsLogs: {[passName: string]: DevtoolsLog};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
70
|
/**
|
|
92
71
|
* Artifacts provided by the default gatherers that are exposed to plugins with a hardended API.
|
|
93
72
|
* NOTE: any breaking changes here are considered breaking Lighthouse changes that must be done
|
|
@@ -116,7 +95,7 @@ interface PublicGathererArtifacts {
|
|
|
116
95
|
* Artifacts provided by the default gatherers. Augment this interface when adding additional
|
|
117
96
|
* gatherers. Changes to these artifacts are not considered a breaking Lighthouse change.
|
|
118
97
|
*/
|
|
119
|
-
export interface GathererArtifacts extends PublicGathererArtifacts
|
|
98
|
+
export interface GathererArtifacts extends PublicGathererArtifacts {
|
|
120
99
|
/** The results of running the aXe accessibility tests on the page. */
|
|
121
100
|
Accessibility: Artifacts.Accessibility;
|
|
122
101
|
/** Array of all anchors on the page. */
|
|
@@ -127,8 +106,10 @@ export interface GathererArtifacts extends PublicGathererArtifacts,LegacyBaseArt
|
|
|
127
106
|
CacheContents: string[];
|
|
128
107
|
/** CSS coverage information for styles used by page's final state. */
|
|
129
108
|
CSSUsage: {rules: Crdp.CSS.RuleUsage[], stylesheets: Artifacts.CSSStyleSheetInfo[]};
|
|
130
|
-
/** The primary log of devtools protocol activity.
|
|
109
|
+
/** The primary log of devtools protocol activity. */
|
|
131
110
|
DevtoolsLog: DevtoolsLog;
|
|
111
|
+
/** The log of devtools protocol activity if there was a page load error and Chrome navigated to a `chrome-error://` page. */
|
|
112
|
+
DevtoolsLogError: DevtoolsLog;
|
|
132
113
|
/** Information on the document's doctype(or null if not present), specifically the name, publicId, and systemId.
|
|
133
114
|
All properties default to an empty string if not present */
|
|
134
115
|
Doctype: Artifacts.Doctype | null;
|
|
@@ -136,8 +117,6 @@ export interface GathererArtifacts extends PublicGathererArtifacts,LegacyBaseArt
|
|
|
136
117
|
DOMStats: Artifacts.DOMStats;
|
|
137
118
|
/** Relevant attributes and child properties of all <object>s, <embed>s and <applet>s in the page. */
|
|
138
119
|
EmbeddedContent: Artifacts.EmbeddedContentInfo[];
|
|
139
|
-
/** Information for font faces used in the page. */
|
|
140
|
-
Fonts: Artifacts.Font[];
|
|
141
120
|
/** Information on poorly sized font usage and the text affected by it. */
|
|
142
121
|
FontSize: Artifacts.FontSize;
|
|
143
122
|
/** All the input elements, including associated form and label elements. */
|
|
@@ -153,10 +132,8 @@ export interface GathererArtifacts extends PublicGathererArtifacts,LegacyBaseArt
|
|
|
153
132
|
/** JS coverage information for code used during audit. Keyed by script id. */
|
|
154
133
|
// 'url' is excluded because it can be overridden by a magic sourceURL= comment, which makes keeping it a dangerous footgun!
|
|
155
134
|
JsUsage: Record<string, Omit<Crdp.Profiler.ScriptCoverage, 'url'>>;
|
|
156
|
-
/**
|
|
157
|
-
|
|
158
|
-
/** The URL loaded with interception */
|
|
159
|
-
MixedContent: {url: string};
|
|
135
|
+
/** The user agent string that Lighthouse used to load the page. Set to the empty string if unknown. */
|
|
136
|
+
NetworkUserAgent: string;
|
|
160
137
|
/** Size and compression opportunity information for all the images in the page. */
|
|
161
138
|
OptimizedImages: Array<Artifacts.OptimizedImage | Artifacts.OptimizedImageError>;
|
|
162
139
|
/** Size info of all network records sent without compression and their size after gzipping. */
|
|
@@ -175,12 +152,18 @@ export interface GathererArtifacts extends PublicGathererArtifacts,LegacyBaseArt
|
|
|
175
152
|
TagsBlockingFirstPaint: Artifacts.TagBlockingFirstPaint[];
|
|
176
153
|
/** Information about tap targets including their position and size. */
|
|
177
154
|
TapTargets: Artifacts.TapTarget[];
|
|
178
|
-
/** The primary
|
|
155
|
+
/** The primary trace taken over the entire run. */
|
|
179
156
|
Trace: Trace;
|
|
157
|
+
/** The trace if there was a page load error and Chrome navigated to a `chrome-error://` page. */
|
|
158
|
+
TraceError: Trace;
|
|
180
159
|
/** Elements associated with metrics (ie: Largest Contentful Paint element). */
|
|
181
160
|
TraceElements: Artifacts.TraceElement[];
|
|
182
161
|
/** Parsed version of the page's Web App Manifest, or null if none found. */
|
|
183
162
|
WebAppManifest: Artifacts.Manifest | null;
|
|
163
|
+
/** COMPAT: A set of traces, keyed by passName. */
|
|
164
|
+
traces: {[passName: string]: Trace};
|
|
165
|
+
/** COMPAT: A set of DevTools debugger protocol records, keyed by passName. */
|
|
166
|
+
devtoolsLogs: {[passName: string]: DevtoolsLog};
|
|
184
167
|
}
|
|
185
168
|
|
|
186
169
|
declare module Artifacts {
|
|
@@ -426,18 +409,6 @@ declare module Artifacts {
|
|
|
426
409
|
notRestoredReasonsTree: BFCacheNotRestoredReasonsTree;
|
|
427
410
|
}
|
|
428
411
|
|
|
429
|
-
interface Font {
|
|
430
|
-
display: string;
|
|
431
|
-
family: string;
|
|
432
|
-
featureSettings: string;
|
|
433
|
-
stretch: string;
|
|
434
|
-
style: string;
|
|
435
|
-
unicodeRange: string;
|
|
436
|
-
variant: string;
|
|
437
|
-
weight: string;
|
|
438
|
-
src?: string[];
|
|
439
|
-
}
|
|
440
|
-
|
|
441
412
|
interface FontSize {
|
|
442
413
|
totalTextLength: number;
|
|
443
414
|
failingTextLength: number;
|
|
@@ -728,7 +699,7 @@ declare module Artifacts {
|
|
|
728
699
|
mainFrameInfo: {startingPid: number, frameId: string};
|
|
729
700
|
/** The list of frames committed in the trace. */
|
|
730
701
|
frames: Array<{id: string, url: string}>;
|
|
731
|
-
/** The trace event marking the time at which the run should consider to have begun. Typically the same as the navigationStart but might differ due to SPA navigations, client-side redirects, etc. In the
|
|
702
|
+
/** The trace event marking the time at which the run should consider to have begun. Typically the same as the navigationStart but might differ due to SPA navigations, client-side redirects, etc. In the timespan case, this event is injected by Lighthouse itself. */
|
|
732
703
|
timeOriginEvt: TraceEvent;
|
|
733
704
|
/** All received trace events subsetted to important categories. */
|
|
734
705
|
_keyEvents: Array<TraceEvent>;
|
package/types/config.d.ts
CHANGED
|
@@ -20,30 +20,14 @@ interface ClassOf<T> {
|
|
|
20
20
|
interface Config {
|
|
21
21
|
extends?: 'lighthouse:default' | string;
|
|
22
22
|
settings?: SharedFlagsSettings;
|
|
23
|
+
artifacts?: Config.ArtifactJson[] | null;
|
|
23
24
|
audits?: Config.AuditJson[] | null;
|
|
24
25
|
categories?: Record<string, Config.CategoryJson> | null;
|
|
25
26
|
groups?: Record<string, Config.GroupJson> | null;
|
|
26
27
|
plugins?: Array<string>;
|
|
27
|
-
|
|
28
|
-
// Fraggle Rock Only
|
|
29
|
-
artifacts?: Config.ArtifactJson[] | null;
|
|
30
|
-
|
|
31
|
-
// Legacy Only
|
|
32
|
-
passes?: Config.PassJson[] | null;
|
|
33
28
|
}
|
|
34
29
|
|
|
35
30
|
declare module Config {
|
|
36
|
-
/**
|
|
37
|
-
* The normalized and fully resolved legacy config.
|
|
38
|
-
*/
|
|
39
|
-
interface LegacyResolvedConfig {
|
|
40
|
-
settings: Settings;
|
|
41
|
-
passes: Pass[] | null;
|
|
42
|
-
audits: AuditDefn[] | null;
|
|
43
|
-
categories: Record<string, Category> | null;
|
|
44
|
-
groups: Record<string, Group> | null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
31
|
/**
|
|
48
32
|
* The normalized and fully resolved config.
|
|
49
33
|
*/
|
|
@@ -78,17 +62,6 @@ declare module Config {
|
|
|
78
62
|
blankPage?: string;
|
|
79
63
|
}
|
|
80
64
|
|
|
81
|
-
interface PassJson extends SharedPassNavigationJson {
|
|
82
|
-
/** The identifier for the pass. Config extension will deduplicate passes with the same passName. */
|
|
83
|
-
passName: string;
|
|
84
|
-
/** Whether a trace and devtoolsLog should be recorded for the pass. */
|
|
85
|
-
recordTrace?: boolean;
|
|
86
|
-
/** Whether throttling settings should be used for the pass. */
|
|
87
|
-
useThrottling?: boolean;
|
|
88
|
-
/** The array of gatherers to run during the pass. */
|
|
89
|
-
gatherers?: GathererJson[];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
65
|
interface NavigationJson extends SharedPassNavigationJson {
|
|
93
66
|
/** The identifier for the navigation. Config extension will deduplicate navigations with the same id. */
|
|
94
67
|
id: string;
|
|
@@ -102,22 +75,17 @@ declare module Config {
|
|
|
102
75
|
|
|
103
76
|
interface ArtifactJson {
|
|
104
77
|
id: string;
|
|
105
|
-
gatherer:
|
|
78
|
+
gatherer: GathererJson;
|
|
106
79
|
}
|
|
107
80
|
|
|
108
81
|
type GathererJson = {
|
|
109
82
|
path: string;
|
|
110
|
-
options?: {};
|
|
111
83
|
} | {
|
|
112
84
|
implementation: ClassOf<Gatherer.GathererInstance>;
|
|
113
|
-
options?: {};
|
|
114
85
|
} | {
|
|
115
86
|
instance: Gatherer.GathererInstance;
|
|
116
|
-
options?: {};
|
|
117
87
|
} | Gatherer.GathererInstance | ClassOf<Gatherer.GathererInstance> | string;
|
|
118
88
|
|
|
119
|
-
type FRGathererJson = string | {instance: Gatherer.FRGathererInstance}
|
|
120
|
-
|
|
121
89
|
interface CategoryJson {
|
|
122
90
|
title: string | IcuMessage;
|
|
123
91
|
auditRefs: AuditRefJson[];
|
|
@@ -153,17 +121,13 @@ declare module Config {
|
|
|
153
121
|
|
|
154
122
|
type Settings = ConfigSettings;
|
|
155
123
|
|
|
156
|
-
interface Pass extends Required<PassJson> {
|
|
157
|
-
gatherers: GathererDefn[];
|
|
158
|
-
}
|
|
159
|
-
|
|
160
124
|
interface NavigationDefn extends Omit<Required<NavigationJson>, 'artifacts'> {
|
|
161
125
|
artifacts: AnyArtifactDefn[];
|
|
162
126
|
}
|
|
163
127
|
|
|
164
128
|
interface ArtifactDefn<TDependencies extends Gatherer.DependencyKey = Gatherer.DependencyKey> {
|
|
165
129
|
id: string;
|
|
166
|
-
gatherer:
|
|
130
|
+
gatherer: GathererDefn<TDependencies>;
|
|
167
131
|
dependencies?: TDependencies extends Gatherer.DefaultDependenciesKey ?
|
|
168
132
|
undefined :
|
|
169
133
|
Record<Exclude<TDependencies, Gatherer.DefaultDependenciesKey>, {id: string}>;
|
|
@@ -176,24 +140,18 @@ declare module Config {
|
|
|
176
140
|
ArtifactDefn<TDependencies>
|
|
177
141
|
type AnyArtifactDefn = ArtifactDefnExpander<Gatherer.DefaultDependenciesKey>|ArtifactDefnExpander<Gatherer.DependencyKey>
|
|
178
142
|
|
|
179
|
-
interface
|
|
180
|
-
implementation?: ClassOf<Gatherer.
|
|
181
|
-
instance: Gatherer.
|
|
143
|
+
interface GathererDefn<TDependencies extends Gatherer.DependencyKey = Gatherer.DependencyKey> {
|
|
144
|
+
implementation?: ClassOf<Gatherer.GathererInstance<TDependencies>>;
|
|
145
|
+
instance: Gatherer.GathererInstance<TDependencies>;
|
|
182
146
|
path?: string;
|
|
183
147
|
}
|
|
184
148
|
|
|
185
|
-
type
|
|
149
|
+
type GathererDefnExpander<TDependencies extends Gatherer.DependencyKey> =
|
|
186
150
|
// Lack of brackets intentional here to convert to the union of all individual dependencies.
|
|
187
151
|
TDependencies extends Gatherer.DefaultDependenciesKey ?
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
type
|
|
191
|
-
|
|
192
|
-
interface GathererDefn {
|
|
193
|
-
implementation?: ClassOf<Gatherer.GathererInstance>;
|
|
194
|
-
instance: Gatherer.GathererInstance;
|
|
195
|
-
path?: string;
|
|
196
|
-
}
|
|
152
|
+
GathererDefn<Gatherer.DefaultDependenciesKey> :
|
|
153
|
+
GathererDefn<TDependencies>
|
|
154
|
+
type AnyGathererDefn = GathererDefnExpander<Gatherer.DefaultDependenciesKey>|GathererDefnExpander<Gatherer.DependencyKey>
|
|
197
155
|
|
|
198
156
|
interface AuditDefn {
|
|
199
157
|
implementation: typeof Audit;
|
package/types/externs.d.ts
CHANGED
|
@@ -53,8 +53,6 @@ export interface CliFlags extends Flags {
|
|
|
53
53
|
verbose: boolean;
|
|
54
54
|
/** A flag to enable logLevel 'silent'. */
|
|
55
55
|
quiet: boolean;
|
|
56
|
-
/** Use the legacy navigation runner to gather CLI results. */
|
|
57
|
-
legacyNavigation: boolean;
|
|
58
56
|
/** Path to the file where precomputed lantern data should be read from. */
|
|
59
57
|
precomputedLanternDataPath?: string;
|
|
60
58
|
/** Path to the file where precomputed lantern data should be written to. */
|
package/types/gatherer.d.ts
CHANGED
|
@@ -10,14 +10,13 @@ import {ProtocolMapping as CrdpMappings} from 'devtools-protocol/types/protocol-
|
|
|
10
10
|
import {NetworkNode as _NetworkNode} from '../core/lib/dependency-graph/network-node.js';
|
|
11
11
|
import {CPUNode as _CPUNode} from '../core/lib/dependency-graph/cpu-node.js';
|
|
12
12
|
import {Simulator as _Simulator} from '../core/lib/dependency-graph/simulator/simulator.js';
|
|
13
|
-
import {Driver} from '../core/legacy/gather/driver.js';
|
|
14
13
|
import {ExecutionContext} from '../core/gather/driver/execution-context.js';
|
|
14
|
+
import {NetworkMonitor} from '../core/gather/driver/network-monitor.js';
|
|
15
15
|
import {Fetcher} from '../core/gather/fetcher.js';
|
|
16
16
|
import {ArbitraryEqualityMap} from '../core/lib/arbitrary-equality-map.js';
|
|
17
17
|
|
|
18
|
-
import {Artifacts, BaseArtifacts,
|
|
18
|
+
import {Artifacts, BaseArtifacts, GathererArtifacts, DevtoolsLog, Trace} from './artifacts.js';
|
|
19
19
|
import Config from './config.js';
|
|
20
|
-
import {IcuMessage} from './lhr/i18n.js';
|
|
21
20
|
import Result from './lhr/lhr.js';
|
|
22
21
|
import Protocol from './protocol.js';
|
|
23
22
|
import Puppeteer from './puppeteer.js';
|
|
@@ -27,7 +26,7 @@ type CrdpCommands = CrdpMappings.Commands;
|
|
|
27
26
|
|
|
28
27
|
declare module Gatherer {
|
|
29
28
|
/** The Lighthouse wrapper around a raw CDP session. */
|
|
30
|
-
interface
|
|
29
|
+
interface ProtocolSession {
|
|
31
30
|
setTargetInfo(targetInfo: Crdp.Target.TargetInfo): void;
|
|
32
31
|
hasNextProtocolTimeout(): boolean;
|
|
33
32
|
getNextProtocolTimeout(): number;
|
|
@@ -39,30 +38,29 @@ declare module Gatherer {
|
|
|
39
38
|
dispose(): Promise<void>;
|
|
40
39
|
}
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
defaultSession: FRProtocolSession;
|
|
41
|
+
interface Driver {
|
|
42
|
+
defaultSession: ProtocolSession;
|
|
45
43
|
executionContext: ExecutionContext;
|
|
46
44
|
fetcher: Fetcher;
|
|
47
45
|
url: () => Promise<string>;
|
|
48
46
|
targetManager: {
|
|
49
|
-
rootSession():
|
|
47
|
+
rootSession(): ProtocolSession;
|
|
50
48
|
mainFrameExecutionContexts(): Array<Crdp.Runtime.ExecutionContextDescription>;
|
|
51
49
|
on(event: 'protocolevent', callback: (payload: Protocol.RawEventMessage) => void): void
|
|
52
50
|
off(event: 'protocolevent', callback: (payload: Protocol.RawEventMessage) => void): void
|
|
53
51
|
};
|
|
52
|
+
networkMonitor: NetworkMonitor;
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
interface FRTransitionalContext<TDependencies extends DependencyKey = DefaultDependenciesKey> {
|
|
55
|
+
interface Context<TDependencies extends DependencyKey = DefaultDependenciesKey> {
|
|
58
56
|
/** The gather mode Lighthouse is currently in. */
|
|
59
57
|
gatherMode: GatherMode;
|
|
60
58
|
/** The connection to the page being analyzed. */
|
|
61
|
-
driver:
|
|
62
|
-
/** The Puppeteer page handle.
|
|
63
|
-
page
|
|
59
|
+
driver: Driver;
|
|
60
|
+
/** The Puppeteer page handle. */
|
|
61
|
+
page: Puppeteer.Page;
|
|
64
62
|
/** The set of base artifacts that are always collected. */
|
|
65
|
-
baseArtifacts:
|
|
63
|
+
baseArtifacts: BaseArtifacts;
|
|
66
64
|
/** The cached results of computed artifacts. */
|
|
67
65
|
computedCache: Map<string, ArbitraryEqualityMap>;
|
|
68
66
|
/** The set of available dependencies requested by the current gatherer. */
|
|
@@ -71,7 +69,7 @@ declare module Gatherer {
|
|
|
71
69
|
settings: Config.Settings;
|
|
72
70
|
}
|
|
73
71
|
|
|
74
|
-
interface
|
|
72
|
+
interface GatherResult {
|
|
75
73
|
artifacts: Artifacts;
|
|
76
74
|
runnerOptions: {
|
|
77
75
|
resolvedConfig: Config.ResolvedConfig;
|
|
@@ -79,19 +77,6 @@ declare module Gatherer {
|
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
interface PassContext {
|
|
83
|
-
gatherMode: 'navigation';
|
|
84
|
-
/** The url of the currently loaded page. If the main document redirects, this will be updated to keep track. */
|
|
85
|
-
url: string;
|
|
86
|
-
driver: Driver;
|
|
87
|
-
passConfig: Config.Pass
|
|
88
|
-
settings: Config.Settings;
|
|
89
|
-
computedCache: Map<string, ArbitraryEqualityMap>
|
|
90
|
-
/** Gatherers can push to this array to add top-level warnings to the LHR. */
|
|
91
|
-
LighthouseRunWarnings: Array<string | IcuMessage>;
|
|
92
|
-
baseArtifacts: BaseArtifacts;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
80
|
interface LoadData {
|
|
96
81
|
networkRecords: Array<Artifacts.NetworkRequest>;
|
|
97
82
|
devtoolsLog: DevtoolsLog;
|
|
@@ -129,31 +114,23 @@ declare module Gatherer {
|
|
|
129
114
|
GathererMetaNoDependencies :
|
|
130
115
|
GathererMetaWithDependencies<Exclude<TDependencies, DefaultDependenciesKey>>;
|
|
131
116
|
|
|
132
|
-
|
|
133
|
-
name: keyof GathererArtifacts;
|
|
134
|
-
beforePass(context: Gatherer.PassContext): PhaseResult;
|
|
135
|
-
pass(context: Gatherer.PassContext): PhaseResult;
|
|
136
|
-
afterPass(context: Gatherer.PassContext, loadData: Gatherer.LoadData): PhaseResult;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
type FRGatherPhase = keyof Omit<Gatherer.FRGathererInstance, 'name'|'meta'>
|
|
117
|
+
type GatherPhase = keyof Omit<Gatherer.GathererInstance, 'name'|'meta'>
|
|
140
118
|
|
|
141
|
-
interface
|
|
142
|
-
name: keyof GathererArtifacts; // temporary COMPAT measure until artifact config support is available
|
|
119
|
+
interface GathererInstance<TDependencies extends DependencyKey = DefaultDependenciesKey> {
|
|
143
120
|
meta: GathererMeta<TDependencies>;
|
|
144
|
-
startInstrumentation(context:
|
|
145
|
-
startSensitiveInstrumentation(context:
|
|
146
|
-
stopSensitiveInstrumentation(context:
|
|
147
|
-
stopInstrumentation(context:
|
|
148
|
-
getArtifact(context:
|
|
121
|
+
startInstrumentation(context: Context<DefaultDependenciesKey>): Promise<void>|void;
|
|
122
|
+
startSensitiveInstrumentation(context: Context<DefaultDependenciesKey>): Promise<void>|void;
|
|
123
|
+
stopSensitiveInstrumentation(context: Context<DefaultDependenciesKey>): Promise<void>|void;
|
|
124
|
+
stopInstrumentation(context: Context<DefaultDependenciesKey>): Promise<void>|void;
|
|
125
|
+
getArtifact(context: Context<TDependencies>): PhaseResult;
|
|
149
126
|
}
|
|
150
127
|
|
|
151
|
-
type
|
|
128
|
+
type GathererInstanceExpander<TDependencies extends Gatherer.DependencyKey> =
|
|
152
129
|
// Lack of brackets intentional here to convert to the union of all individual dependencies.
|
|
153
130
|
TDependencies extends Gatherer.DefaultDependenciesKey ?
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
type
|
|
131
|
+
GathererInstance<Gatherer.DefaultDependenciesKey> :
|
|
132
|
+
GathererInstance<Exclude<TDependencies, DefaultDependenciesKey>>
|
|
133
|
+
type AnyGathererInstance = GathererInstanceExpander<Gatherer.DependencyKey>
|
|
157
134
|
|
|
158
135
|
namespace Simulation {
|
|
159
136
|
type GraphNode = import('../core/lib/dependency-graph/base-node.js').Node;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright 2023 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
declare module 'rxjs' {
|
|
8
|
+
export * from 'rxjs/index.js';
|
|
9
|
+
|
|
10
|
+
// Puppeteer uses a later version of rxjs as a dev dep.
|
|
11
|
+
// We don't need it for normal execution, but these types are necessary
|
|
12
|
+
// when we reach into puppeteer internals in `lightrider-entry.js`
|
|
13
|
+
export const catchError: any;
|
|
14
|
+
export const defaultIfEmpty: any;
|
|
15
|
+
export const filter: any;
|
|
16
|
+
export const first: any;
|
|
17
|
+
export const ignoreElements: any;
|
|
18
|
+
export const map: any;
|
|
19
|
+
export const mergeMap: any;
|
|
20
|
+
export const raceWith: any;
|
|
21
|
+
export const retry: any;
|
|
22
|
+
export const tap: any;
|
|
23
|
+
export const throwIfEmpty: any;
|
|
24
|
+
export const firstValueFrom: any;
|
|
25
|
+
}
|
|
26
|
+
|
|
@@ -53,13 +53,11 @@ declare global {
|
|
|
53
53
|
{expectations: Smokehouse.ExpectedRunnerResult | Array<Smokehouse.ExpectedRunnerResult>}
|
|
54
54
|
|
|
55
55
|
export type LighthouseRunner =
|
|
56
|
-
{runnerName?: string} & ((url: string, config?: Config, runnerOptions?: {isDebug?: boolean
|
|
56
|
+
{runnerName?: string} & ((url: string, config?: Config, runnerOptions?: {isDebug?: boolean}) => Promise<{lhr: LHResult, artifacts: Artifacts, log: string}>);
|
|
57
57
|
|
|
58
58
|
export interface SmokehouseOptions {
|
|
59
59
|
/** If true, performs extra logging from the test runs. */
|
|
60
60
|
isDebug?: boolean;
|
|
61
|
-
/** If true, use the legacy navigation runner. */
|
|
62
|
-
useLegacyNavigation?: boolean;
|
|
63
61
|
/** Manually set the number of jobs to run at once. `1` runs all tests serially. */
|
|
64
62
|
jobs?: number;
|
|
65
63
|
/** The number of times to retry failing tests before accepting. Defaults to 0. */
|
package/types/lh.d.ts
CHANGED
|
@@ -35,8 +35,6 @@ export import Puppeteer = Puppeteer_;
|
|
|
35
35
|
// artifacts.d.ts
|
|
36
36
|
export import Artifacts = Artifacts_.Artifacts;
|
|
37
37
|
export import BaseArtifacts = Artifacts_.BaseArtifacts;
|
|
38
|
-
export import FRArtifacts = Artifacts_.FRArtifacts;
|
|
39
|
-
export import FRBaseArtifacts = Artifacts_.FRBaseArtifacts;
|
|
40
38
|
export import GathererArtifacts = Artifacts_.GathererArtifacts;
|
|
41
39
|
export import DevtoolsLog = Artifacts_.DevtoolsLog;
|
|
42
40
|
export import Trace = Artifacts_.Trace;
|
package/types/lhr/settings.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export type ScreenEmulationSettings = {
|
|
|
71
71
|
disableStorageReset?: boolean;
|
|
72
72
|
/** Flag indicating that Lighthouse should pause after page load to wait for the user's permission to continue the audit. */
|
|
73
73
|
debugNavigation?: boolean;
|
|
74
|
-
/** If set to true, will skip the initial navigation to about:blank.
|
|
74
|
+
/** If set to true, will skip the initial navigation to about:blank. */
|
|
75
75
|
skipAboutBlank?: boolean;
|
|
76
76
|
/** If set to true, gatherers should avoid any behavior that may be destructive to the page state. (e.g. extra navigations, resizing the viewport) */
|
|
77
77
|
usePassiveGathering?: boolean;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export default FirstContentfulPaint3G;
|
|
2
|
-
declare class FirstContentfulPaint3G extends Audit {
|
|
3
|
-
/**
|
|
4
|
-
* @return {LH.Audit.ScoreOptions}
|
|
5
|
-
*/
|
|
6
|
-
static get defaultOptions(): import("../../../types/audit.js").default.ScoreOptions;
|
|
7
|
-
/**
|
|
8
|
-
* @param {LH.Artifacts} artifacts
|
|
9
|
-
* @param {LH.Audit.Context} context
|
|
10
|
-
* @return {Promise<LH.Audit.Product>}
|
|
11
|
-
*/
|
|
12
|
-
static audit(artifacts: LH.Artifacts, context: LH.Audit.Context): Promise<LH.Audit.Product>;
|
|
13
|
-
}
|
|
14
|
-
import { Audit } from '../audit.js';
|
|
15
|
-
//# sourceMappingURL=first-contentful-paint-3g.d.ts.map
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright 2019 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import {Audit} from '../audit.js';
|
|
8
|
-
import {FirstContentfulPaint as ComputedFcp} from '../../computed/metrics/first-contentful-paint.js';
|
|
9
|
-
import * as constants from '../../config/constants.js';
|
|
10
|
-
|
|
11
|
-
const regular3G = constants.throttling.mobileRegular3G;
|
|
12
|
-
|
|
13
|
-
class FirstContentfulPaint3G extends Audit {
|
|
14
|
-
/**
|
|
15
|
-
* @return {LH.Audit.Meta}
|
|
16
|
-
*/
|
|
17
|
-
static get meta() {
|
|
18
|
-
return {
|
|
19
|
-
id: 'first-contentful-paint-3g',
|
|
20
|
-
title: 'First Contentful Paint (3G)',
|
|
21
|
-
description: 'First Contentful Paint 3G marks the time at which the first text or image is ' +
|
|
22
|
-
'painted while on a 3G network. ' +
|
|
23
|
-
'[Learn more about the First Contentful Paint (3G) metric](https://developers.google.com/web/tools/lighthouse/audits/first-contentful-paint).',
|
|
24
|
-
scoreDisplayMode: Audit.SCORING_MODES.NUMERIC,
|
|
25
|
-
supportedModes: ['navigation'],
|
|
26
|
-
requiredArtifacts: ['traces', 'devtoolsLogs', 'GatherContext', 'URL'],
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @return {LH.Audit.ScoreOptions}
|
|
32
|
-
*/
|
|
33
|
-
static get defaultOptions() {
|
|
34
|
-
return {
|
|
35
|
-
// 25th and 8th percentiles HTTPArchive on Slow 4G -> multiply by 1.5 for RTT differential -> median and p10.
|
|
36
|
-
// https://bigquery.cloud.google.com/table/httparchive:lighthouse.2021_05_01_mobile
|
|
37
|
-
// https://www.desmos.com/calculator/xi5oympawp
|
|
38
|
-
p10: 2700,
|
|
39
|
-
median: 4500,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @param {LH.Artifacts} artifacts
|
|
45
|
-
* @param {LH.Audit.Context} context
|
|
46
|
-
* @return {Promise<LH.Audit.Product>}
|
|
47
|
-
*/
|
|
48
|
-
static async audit(artifacts, context) {
|
|
49
|
-
const gatherContext = artifacts.GatherContext;
|
|
50
|
-
const trace = artifacts.traces[Audit.DEFAULT_PASS];
|
|
51
|
-
const devtoolsLog = artifacts.devtoolsLogs[Audit.DEFAULT_PASS];
|
|
52
|
-
/** @type {LH.Audit.Context['settings']} */
|
|
53
|
-
const settings = {...context.settings, throttlingMethod: 'simulate', throttling: regular3G};
|
|
54
|
-
const metricComputationData = {trace, devtoolsLog, gatherContext, settings, URL: artifacts.URL};
|
|
55
|
-
const metricResult = await ComputedFcp.request(metricComputationData, context);
|
|
56
|
-
|
|
57
|
-
return {
|
|
58
|
-
score: Audit.computeLogNormalScore(
|
|
59
|
-
{p10: context.options.p10, median: context.options.median},
|
|
60
|
-
metricResult.timing
|
|
61
|
-
),
|
|
62
|
-
numericValue: metricResult.timing,
|
|
63
|
-
numericUnit: 'millisecond',
|
|
64
|
-
displayValue: `${metricResult.timing}\xa0ms`,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export default FirstContentfulPaint3G;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export default ResourceSummary;
|
|
2
|
-
declare class ResourceSummary extends Audit {
|
|
3
|
-
/**
|
|
4
|
-
* @param {LH.Artifacts} artifacts
|
|
5
|
-
* @param {LH.Audit.Context} context
|
|
6
|
-
* @return {Promise<LH.Audit.Product>}
|
|
7
|
-
*/
|
|
8
|
-
static audit(artifacts: LH.Artifacts, context: LH.Audit.Context): Promise<LH.Audit.Product>;
|
|
9
|
-
}
|
|
10
|
-
export namespace UIStrings {
|
|
11
|
-
const title: string;
|
|
12
|
-
const description: string;
|
|
13
|
-
const displayValue: string;
|
|
14
|
-
}
|
|
15
|
-
import { Audit } from './audit.js';
|
|
16
|
-
//# sourceMappingURL=resource-summary.d.ts.map
|