Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: update public gatherer list #15940

Merged
merged 9 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/lib/lh-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ const UIStrings = {
criTimeout: 'Timeout waiting for initial Debugger Protocol connection.',
/**
* @description Error message explaining that a resource that was required for testing was never collected. "artifactName" will be replaced with the name of the resource that wasn't collected.
* @example {WebAppManifest} artifactName
* @example {MainDocumentContent} artifactName
* */
missingRequiredArtifact: 'Required {artifactName} gatherer did not run.',
/**
* @description Error message explaining that there was an error while trying to collect a resource that was required for testing. "artifactName" will be replaced with the name of the resource that wasn't collected; "errorMessage" will be replaced with a string description of the error that occurred.
* @example {WebAppManifest} artifactName
* @example {Manifest invalid} errorMessage
* @example {MainDocumentContent} artifactName
* @example {Could not find main document} errorMessage
* */
erroredRequiredArtifact: 'Required {artifactName} gatherer encountered an error: {errorMessage}',

Expand Down
24 changes: 12 additions & 12 deletions docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,26 +209,26 @@ The primary objective of the audit function is to return a `score` from `0` to `

#### Available Artifacts

The following artifacts are available for use in the audits of Lighthouse plugins. For more detailed information on their usage and purpose, see the [type information](https://github.com/GoogleChrome/lighthouse/blob/623b789497f6c87f85d366b4038deae5dc701c90/types/artifacts.d.ts#L20-L70).
The following artifacts are available for use in the audits of Lighthouse plugins. For more detailed information on their usage and purpose, see the [type information](https://github.com/GoogleChrome/lighthouse/blob/main/types/artifacts.d.ts#L42-L99).

- `DevtoolsLog`
- `fetchTime`
- `settings`
- `Trace`
- `BenchmarkIndex`
- `ConsoleMessages`
- `settings`
- `Timing`
- `HostFormFactor`
- `HostUserAgent`
- `HostProduct`
- `GatherContext`
- `URL`
- `ConsoleMessages`
- `DevtoolsLog`
- `MainDocumentContent`
- `ImageElements`
- `LinkElements`
- `MetaElements`
- `NetworkUserAgent`
- `RuntimeExceptions`
- `ScriptElements`
- `Stacks`
- `Timing`
- `URL`
- `Scripts`
- `Trace`
- `ViewportDimensions`
- `WebAppManifest`

While Lighthouse has more artifacts with information about the page than are in this list, those artifacts are considered experimental and their structure or existence could change at any time. Only use artifacts not on the list above if you are comfortable living on the bleeding edge and can tolerate unannounced breaking changes.

Expand Down
55 changes: 10 additions & 45 deletions types/artifacts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,20 @@ interface ContextualBaseArtifacts {
interface PublicGathererArtifacts {
/** ConsoleMessages deprecation and intervention warnings, console API calls, and exceptions logged by Chrome during page load. */
ConsoleMessages: Artifacts.ConsoleMessage[];
/** All the iframe elements in the page. */
IFrameElements: Artifacts.IFrameElement[];
/** The contents of the main HTML document network resource. */
MainDocumentContent: string;
/** The primary log of devtools protocol activity. */
DevtoolsLog: DevtoolsLog;
/** Information on size and loading for all the images in the page. Natural size information for `picture` and CSS images is only available if the image was one of the largest 50 images. */
ImageElements: Artifacts.ImageElement[];
/** All the link elements on the page or equivalently declared in `Link` headers. @see https://html.spec.whatwg.org/multipage/links.html */
LinkElements: Artifacts.LinkElement[];
/** The contents of the main HTML document network resource. */
MainDocumentContent: string;
/** The values of the <meta> elements in the head. */
MetaElements: Array<{name?: string, content?: string, property?: string, httpEquiv?: string, charset?: string, node: Artifacts.NodeDetails}>;
/** Information on all scripts in the page. */
Scripts: Artifacts.Script[];
/** The primary trace taken over the entire run. */
Trace: Trace;
/** The dimensions and devicePixelRatio of the loaded viewport. */
ViewportDimensions: Artifacts.ViewportDimensions;
}
Expand All @@ -111,8 +113,6 @@ export interface GathererArtifacts extends PublicGathererArtifacts {
CacheContents: string[];
/** CSS coverage information for styles used by page's final state. */
CSSUsage: {rules: Crdp.CSS.RuleUsage[], stylesheets: Artifacts.CSSStyleSheetInfo[]};
/** The primary log of devtools protocol activity. */
DevtoolsLog: DevtoolsLog;
/** The log of devtools protocol activity if there was a page load error and Chrome navigated to a `chrome-error://` page. */
DevtoolsLogError: DevtoolsLog;
/** Information on the document's doctype(or null if not present), specifically the name, publicId, and systemId.
Expand All @@ -122,12 +122,12 @@ export interface GathererArtifacts extends PublicGathererArtifacts {
DOMStats: Artifacts.DOMStats;
/** Information on poorly sized font usage and the text affected by it. */
FontSize: Artifacts.FontSize;
/** All the iframe elements in the page. */
IFrameElements: Artifacts.IFrameElement[];
/** All the input elements, including associated form and label elements. */
Inputs: {inputs: Artifacts.InputElement[]; forms: Artifacts.FormElement[]; labels: Artifacts.LabelElement[]};
/** Screenshot of the entire page (rather than just the above the fold content). */
FullPageScreenshot: LHResult.FullPageScreenshot | null;
/** Information about event listeners registered on the global object. */
GlobalListeners: Array<Artifacts.GlobalListener>;
/** The issues surfaced in the devtools Issues panel */
InspectorIssues: Artifacts.InspectorIssues;
/** JS coverage information for code used during audit. Keyed by script id. */
Expand All @@ -149,10 +149,6 @@ export interface GathererArtifacts extends PublicGathererArtifacts {
SourceMaps: Array<Artifacts.SourceMap>;
/** Information on detected tech stacks (e.g. JS libraries) used by the page. */
Stacks: Artifacts.DetectedStack[];
/** Information about tap targets including their position and size. */
TapTargets: Artifacts.TapTarget[];
/** The primary trace taken over the entire run. */
Trace: Trace;
/** The trace if there was a page load error and Chrome navigated to a `chrome-error://` page. */
TraceError: Trace;
/** Elements associated with metrics (ie: Largest Contentful Paint element). */
Expand Down Expand Up @@ -188,6 +184,8 @@ declare module Artifacts {
finalDisplayedUrl: string;
}

type Rect = AuditDetails.Rect;

interface NodeDetails {
lhId: string,
devtoolsNodePath: string,
Expand Down Expand Up @@ -293,19 +291,6 @@ declare module Artifacts {
content?: string;
}

interface ScriptElement {
type: string | null
src: string | null
/** The `id` property of the script element; null if it had no `id` or if `source` is 'network'. */
id: string | null
async: boolean
defer: boolean
/** Details for node in DOM for the script element */
node: NodeDetails | null
/** Where the script was discovered, either in the head, the body, or network records. */
source: 'head'|'body'|'network'
}

/** @see https://sourcemaps.info/spec.html#h.qz3o9nc69um5 */
type RawSourceMap = {
/** File version and must be a positive integer. */
Expand Down Expand Up @@ -518,14 +503,6 @@ declare module Artifacts {
resourceSize: number;
}

type Rect = AuditDetails.Rect;

interface TapTarget {
node: NodeDetails;
href: string;
clientRects: Rect[];
}

interface TraceElement {
traceEventType: 'largest-contentful-paint'|'layout-shift'|'animation'|'responsiveness';
node: NodeDetails;
Expand Down Expand Up @@ -800,18 +777,6 @@ declare module Artifacts {
node: NodeDetails;
}

/** Information about an event listener registered on the global object. */
interface GlobalListener {
/** Event listener type, limited to those events currently of interest. */
type: 'pagehide'|'unload'|'visibilitychange';
/** The DevTools protocol script identifier. */
scriptId: string;
/** Line number in the script (0-based). */
lineNumber: number;
/** Column number in the script (0-based). */
columnNumber: number;
}

/** Describes a generic console message. */
interface BaseConsoleMessage {
/**
Expand Down
Loading