lighthouse 12.5.0 → 12.5.1-dev.20250327

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.
Files changed (85) hide show
  1. package/cli/test/smokehouse/lib/concurrent-mapper.d.ts +3 -3
  2. package/core/audits/audit.d.ts +1 -1
  3. package/core/audits/bootup-time.d.ts +1 -1
  4. package/core/audits/byte-efficiency/total-byte-weight.d.ts +1 -1
  5. package/core/audits/byte-efficiency/uses-long-cache-ttl.d.ts +1 -1
  6. package/core/audits/byte-efficiency/uses-responsive-images.d.ts +1 -1
  7. package/core/audits/dobetterweb/dom-size.d.ts +1 -1
  8. package/core/audits/long-tasks.d.ts +1 -1
  9. package/core/audits/mainthread-work-breakdown.d.ts +1 -1
  10. package/core/audits/manual/manual-audit.d.ts +1 -1
  11. package/core/audits/metrics/cumulative-layout-shift.d.ts +1 -1
  12. package/core/audits/metrics/interaction-to-next-paint.d.ts +1 -1
  13. package/core/audits/metrics/max-potential-fid.d.ts +1 -1
  14. package/core/audits/user-timings.d.ts +1 -1
  15. package/core/computed/critical-request-chains.d.ts +1 -1
  16. package/core/computed/document-urls.d.ts +4 -1
  17. package/core/computed/entity-classification.d.ts +1 -1
  18. package/core/computed/image-records.d.ts +1 -1
  19. package/core/computed/js-bundles.d.ts +1 -1
  20. package/core/computed/lcp-image-record.d.ts +1 -1
  21. package/core/computed/load-simulator.d.ts +1 -1
  22. package/core/computed/main-resource.d.ts +1 -1
  23. package/core/computed/main-thread-tasks.d.ts +1 -1
  24. package/core/computed/metrics/cumulative-layout-shift.d.ts +10 -1
  25. package/core/computed/metrics/first-contentful-paint-all-frames.d.ts +1 -1
  26. package/core/computed/metrics/first-contentful-paint.d.ts +1 -1
  27. package/core/computed/metrics/interactive.d.ts +1 -1
  28. package/core/computed/metrics/lantern-first-contentful-paint.d.ts +1 -1
  29. package/core/computed/metrics/lantern-interactive.d.ts +1 -1
  30. package/core/computed/metrics/lantern-largest-contentful-paint.d.ts +1 -1
  31. package/core/computed/metrics/lantern-max-potential-fid.d.ts +1 -1
  32. package/core/computed/metrics/lantern-speed-index.d.ts +1 -1
  33. package/core/computed/metrics/lantern-total-blocking-time.d.ts +1 -1
  34. package/core/computed/metrics/largest-contentful-paint-all-frames.d.ts +1 -1
  35. package/core/computed/metrics/largest-contentful-paint.d.ts +1 -1
  36. package/core/computed/metrics/lcp-breakdown.d.ts +5 -1
  37. package/core/computed/metrics/max-potential-fid.d.ts +1 -1
  38. package/core/computed/metrics/responsiveness.d.ts +1 -1
  39. package/core/computed/metrics/speed-index.d.ts +1 -1
  40. package/core/computed/metrics/time-to-first-byte.d.ts +1 -1
  41. package/core/computed/metrics/timing-summary.d.ts +4 -1
  42. package/core/computed/metrics/total-blocking-time.d.ts +1 -1
  43. package/core/computed/module-duplication.d.ts +5 -1
  44. package/core/computed/navigation-insights.d.ts +1 -1
  45. package/core/computed/network-analysis.d.ts +1 -1
  46. package/core/computed/network-records.d.ts +1 -1
  47. package/core/computed/page-dependency-graph.d.ts +1 -1
  48. package/core/computed/processed-navigation.d.ts +1 -1
  49. package/core/computed/processed-trace.d.ts +1 -1
  50. package/core/computed/resource-summary.d.ts +1 -1
  51. package/core/computed/screenshots.d.ts +4 -1
  52. package/core/computed/speedline.d.ts +1 -1
  53. package/core/computed/tbt-impact-tasks.d.ts +1 -1
  54. package/core/computed/trace-engine-result.d.ts +1 -1
  55. package/core/computed/trace-engine-result.js +1 -1
  56. package/core/computed/unused-css.d.ts +1 -1
  57. package/core/computed/unused-javascript-summary.d.ts +1 -1
  58. package/core/computed/user-timings.d.ts +1 -1
  59. package/core/computed/viewport-meta.d.ts +1 -1
  60. package/core/gather/driver/network-monitor.d.ts +1 -1
  61. package/core/gather/driver/network.d.ts +1 -1
  62. package/core/gather/driver.d.ts +1 -1
  63. package/core/gather/gatherers/devtools-log.d.ts +1 -1
  64. package/core/gather/navigation-runner.d.ts +1 -1
  65. package/core/gather/snapshot-runner.d.ts +1 -1
  66. package/core/gather/timespan-runner.d.ts +1 -1
  67. package/core/index.d.ts +6 -6
  68. package/core/lib/asset-saver.d.ts +1 -1
  69. package/core/lib/cdt/generated/SourceMap.d.ts +6 -3
  70. package/core/lib/cdt/generated/SourceMap.js +3 -0
  71. package/core/lib/i18n/i18n.d.ts +1 -1
  72. package/core/lib/page-functions.d.ts +1 -1
  73. package/core/lib/tracehouse/cpu-profile-model.d.ts +1 -1
  74. package/core/lib/tracehouse/main-thread-tasks.d.ts +3 -3
  75. package/core/lib/tracehouse/trace-processor.d.ts +1 -1
  76. package/core/lib/traces/metric-trace-events.d.ts +2 -2
  77. package/core/scoring.d.ts +492 -3
  78. package/core/user-flow.d.ts +6 -6
  79. package/package.json +2 -2
  80. package/report/renderer/category-renderer.d.ts +2 -2
  81. package/report/renderer/details-renderer.d.ts +1 -1
  82. package/report/renderer/features-util.d.ts +1 -1
  83. package/report/renderer/performance-category-renderer.d.ts +2 -2
  84. package/shared/localization/format.d.ts +1 -1
  85. package/types/internal/node.d.ts +0 -16
@@ -20,7 +20,7 @@ export type Summary = {
20
20
  sourcesWastedBytes?: Record<string, number> | undefined;
21
21
  };
22
22
  declare const UnusedJavascriptSummaryComputed: typeof UnusedJavascriptSummary & {
23
- request: (dependencies: ComputeInput, context: LH.Artifacts.ComputedContext) => ReturnType<typeof UnusedJavascriptSummary.compute_>;
23
+ request: (dependencies: ComputeInput, context: LH.Artifacts.ComputedContext) => Promise<Summary>;
24
24
  };
25
25
  /**
26
26
  * @typedef WasteData
@@ -14,7 +14,7 @@ export type MeasureEvent = {
14
14
  duration: number;
15
15
  };
16
16
  declare const UserTimingsComputed: typeof UserTimings & {
17
- request: (dependencies: import("../index.js").Trace, context: LH.Artifacts.ComputedContext) => ReturnType<typeof UserTimings.compute_>;
17
+ request: (dependencies: import("../index.js").Trace, context: LH.Artifacts.ComputedContext) => Promise<(MarkEvent | MeasureEvent)[]>;
18
18
  };
19
19
  /** @typedef {{name: string, isMark: true, args: LH.TraceEvent['args'], startTime: number}} MarkEvent */
20
20
  /** @typedef {{name: string, isMark: false, args: LH.TraceEvent['args'], startTime: number, endTime: number, duration: number}} MeasureEvent */
@@ -25,7 +25,7 @@ declare const ViewportMetaComputed: typeof ViewportMeta & {
25
25
  httpEquiv?: string;
26
26
  charset?: string;
27
27
  node: import("../index.js").Artifacts.NodeDetails;
28
- }[], context: LH.Artifacts.ComputedContext) => ReturnType<typeof ViewportMeta.compute_>;
28
+ }[], context: LH.Artifacts.ComputedContext) => Promise<ViewportMetaResult>;
29
29
  };
30
30
  declare class ViewportMeta {
31
31
  /**
@@ -71,7 +71,7 @@ export class NetworkMonitor extends NetworkMonitor_base {
71
71
  * @param {(request: NetworkRequest) => boolean} [requestFilter]
72
72
  * @return {boolean}
73
73
  */
74
- _isIdlePeriod(allowedRequests: number, requestFilter?: ((request: NetworkRequest) => boolean) | undefined): boolean;
74
+ _isIdlePeriod(allowedRequests: number, requestFilter?: (request: NetworkRequest) => boolean): boolean;
75
75
  /**
76
76
  * Emits the appropriate network status event.
77
77
  */
@@ -6,5 +6,5 @@
6
6
  * @param {number} [timeout]
7
7
  * @return {Promise<string>}
8
8
  */
9
- export function fetchResponseBodyFromCache(session: LH.Gatherer.ProtocolSession, requestId: string, timeout?: number | undefined): Promise<string>;
9
+ export function fetchResponseBodyFromCache(session: LH.Gatherer.ProtocolSession, requestId: string, timeout?: number): Promise<string>;
10
10
  //# sourceMappingURL=network.d.ts.map
@@ -15,7 +15,7 @@ export class Driver implements LH.Gatherer.Driver {
15
15
  _fetcher: Fetcher | undefined;
16
16
  defaultSession: import("../../types/gatherer.js").default.ProtocolSession;
17
17
  /** @return {LH.Gatherer.Driver['executionContext']} */
18
- get executionContext(): ExecutionContext;
18
+ get executionContext(): LH.Gatherer.Driver["executionContext"];
19
19
  get fetcher(): any;
20
20
  get targetManager(): any;
21
21
  get networkMonitor(): any;
@@ -38,7 +38,7 @@ export class DevtoolsMessageLog {
38
38
  /**
39
39
  * @return {LH.DevtoolsLog}
40
40
  */
41
- get messages(): import("../../index.js").DevtoolsLog;
41
+ get messages(): LH.DevtoolsLog;
42
42
  reset(): void;
43
43
  beginRecording(): void;
44
44
  endRecording(): void;
@@ -16,7 +16,7 @@ export type PhaseState = Omit<Parameters<typeof collectPhaseArtifacts>[0], "phas
16
16
  export function navigationGather(page: LH.Puppeteer.Page | undefined, requestor: LH.NavigationRequestor | undefined, options?: {
17
17
  config?: LH.Config;
18
18
  flags?: LH.Flags;
19
- } | undefined): Promise<LH.Gatherer.GatherResult>;
19
+ }): Promise<LH.Gatherer.GatherResult>;
20
20
  /**
21
21
  * @param {{driver: Driver, resolvedConfig: LH.Config.ResolvedConfig, requestor: LH.NavigationRequestor}} args
22
22
  * @return {Promise<{baseArtifacts: LH.BaseArtifacts}>}
@@ -6,5 +6,5 @@
6
6
  export function snapshotGather(page: LH.Puppeteer.Page, options?: {
7
7
  config?: LH.Config;
8
8
  flags?: LH.Flags;
9
- } | undefined): Promise<LH.Gatherer.GatherResult>;
9
+ }): Promise<LH.Gatherer.GatherResult>;
10
10
  //# sourceMappingURL=snapshot-runner.d.ts.map
@@ -6,7 +6,7 @@
6
6
  export function startTimespanGather(page: LH.Puppeteer.Page, options?: {
7
7
  config?: LH.Config;
8
8
  flags?: LH.Flags;
9
- } | undefined): Promise<{
9
+ }): Promise<{
10
10
  endTimespanGather(): Promise<LH.Gatherer.GatherResult>;
11
11
  }>;
12
12
  export namespace UIStrings {
package/core/index.d.ts CHANGED
@@ -20,7 +20,7 @@ declare function lighthouse(url?: string | undefined, flags?: LH.Flags | undefin
20
20
  * @param {LH.Puppeteer.Page} page
21
21
  * @param {LH.UserFlow.Options} [options]
22
22
  */
23
- export function startFlow(page: LH.Puppeteer.Page, options?: LH.UserFlow.Options | undefined): Promise<UserFlow>;
23
+ export function startFlow(page: LH.Puppeteer.Page, options?: LH.UserFlow.Options): Promise<UserFlow>;
24
24
  /**
25
25
  * @param {LH.Puppeteer.Page|undefined} page
26
26
  * @param {LH.NavigationRequestor|undefined} requestor
@@ -30,7 +30,7 @@ export function startFlow(page: LH.Puppeteer.Page, options?: LH.UserFlow.Options
30
30
  export function navigation(page: LH.Puppeteer.Page | undefined, requestor: LH.NavigationRequestor | undefined, options?: {
31
31
  config?: LH.Config;
32
32
  flags?: LH.Flags;
33
- } | undefined): Promise<LH.RunnerResult | undefined>;
33
+ }): Promise<LH.RunnerResult | undefined>;
34
34
  /**
35
35
  * @param {LH.Puppeteer.Page} page
36
36
  * @param {{config?: LH.Config, flags?: LH.Flags}} [options]
@@ -39,7 +39,7 @@ export function navigation(page: LH.Puppeteer.Page | undefined, requestor: LH.Na
39
39
  export function startTimespan(page: LH.Puppeteer.Page, options?: {
40
40
  config?: LH.Config;
41
41
  flags?: LH.Flags;
42
- } | undefined): Promise<{
42
+ }): Promise<{
43
43
  endTimespan: () => Promise<LH.RunnerResult | undefined>;
44
44
  }>;
45
45
  /**
@@ -50,19 +50,19 @@ export function startTimespan(page: LH.Puppeteer.Page, options?: {
50
50
  export function snapshot(page: LH.Puppeteer.Page, options?: {
51
51
  config?: LH.Config;
52
52
  flags?: LH.Flags;
53
- } | undefined): Promise<LH.RunnerResult | undefined>;
53
+ }): Promise<LH.RunnerResult | undefined>;
54
54
  /**
55
55
  * @template {LH.Result|LH.FlowResult} R
56
56
  * @param {R} result
57
57
  * @param {[R] extends [LH.Result] ? LH.OutputMode : Exclude<LH.OutputMode, 'csv'>} [format]
58
58
  * @return {string}
59
59
  */
60
- export function generateReport<R extends LH.Result | LH.FlowResult>(result: R, format?: ([R] extends [LH.Result] ? LH.OutputMode : "json" | "html") | undefined): string;
60
+ export function generateReport<R extends LH.Result | LH.FlowResult>(result: R, format?: [R] extends [LH.Result] ? LH.OutputMode : Exclude<LH.OutputMode, "csv">): string;
61
61
  /**
62
62
  * @param {LH.UserFlow.FlowArtifacts} flowArtifacts
63
63
  * @param {LH.Config} [config]
64
64
  */
65
- export function auditFlowArtifacts(flowArtifacts: LH.UserFlow.FlowArtifacts, config?: LH.Config | undefined): Promise<{
65
+ export function auditFlowArtifacts(flowArtifacts: LH.UserFlow.FlowArtifacts, config?: LH.Config): Promise<{
66
66
  steps: LH.FlowResult.Step[];
67
67
  name: string;
68
68
  }>;
@@ -60,7 +60,7 @@ export function saveAssets(artifacts: LH.Artifacts, audits: LH.Result["audits"],
60
60
  * @param {LH.Result['audits']} [audits]
61
61
  * @return {Promise<Array<PreparedAssets>>}
62
62
  */
63
- export function prepareAssets(artifacts: LH.Artifacts, audits?: Record<string, import("../../types/lhr/audit-result.js").Result> | undefined): Promise<Array<PreparedAssets>>;
63
+ export function prepareAssets(artifacts: LH.Artifacts, audits?: LH.Result["audits"]): Promise<Array<PreparedAssets>>;
64
64
  /**
65
65
  * Save a trace as JSON by streaming to disk at traceFilename.
66
66
  * @param {LH.Trace} traceData
@@ -1,12 +1,15 @@
1
1
  export = SourceMap;
2
2
  declare class SourceMap {
3
3
  /**
4
+ * @param {string} compiledURL
5
+ * @param {string} sourceMappingURL
6
+ * @param {object} payload
4
7
  * Implements Source Map V3 model. See https://github.com/google/closure-compiler/wiki/Source-Maps
5
8
  * for format description.
6
9
  */
7
- constructor(compiledURL: any, sourceMappingURL: any, payload: any);
8
- compiledURL(): any;
9
- url(): any;
10
+ constructor(compiledURL: string, sourceMappingURL: string, payload: object);
11
+ compiledURL(): string;
12
+ url(): string;
10
13
  sourceURLs(): any[];
11
14
  embeddedContentByURL(sourceURL: any): any;
12
15
  hasScopeInfo(): boolean;
@@ -104,6 +104,9 @@ class SourceMap {
104
104
  #sourceInfoByURL = new Map();
105
105
  #scopesInfo = null;
106
106
  /**
107
+ * @param {string} compiledURL
108
+ * @param {string} sourceMappingURL
109
+ * @param {object} payload
107
110
  * Implements Source Map V3 model. See https://github.com/google/closure-compiler/wiki/Source-Maps
108
111
  * for format description.
109
112
  */
@@ -71,7 +71,7 @@ export function lookupLocale(locales?: (string | string[]) | undefined, possible
71
71
  * @param {string} filename
72
72
  * @param {Record<string, string>=} fileStrings
73
73
  */
74
- export function createIcuMessageFn(filename: string, fileStrings?: Record<string, string> | undefined): (message: string, values?: Record<string, string | number> | undefined) => LH.IcuMessage;
74
+ export function createIcuMessageFn(filename: string, fileStrings?: Record<string, string> | undefined): (message: string, values?: Record<string, string | number>) => LH.IcuMessage;
75
75
  /**
76
76
  * Returns true if the given value is a string or an LH.IcuMessage.
77
77
  * @param {unknown} value
@@ -43,7 +43,7 @@ export type ParseSelector<T extends string> = import("typed-query-selector/parse
43
43
  * @param {string|Error} [err] The error to convert
44
44
  * @return {{__failedInBrowser: boolean, name: string, message: string, stack: string|undefined}}
45
45
  */
46
- declare function wrapRuntimeEvalErrorInBrowser(err?: string | Error | undefined): {
46
+ declare function wrapRuntimeEvalErrorInBrowser(err?: string | Error): {
47
47
  __failedInBrowser: boolean;
48
48
  name: string;
49
49
  message: string;
@@ -223,6 +223,6 @@ export class CpuProfileModel {
223
223
  * @param {Array<LH.Artifacts.TaskNode>} [knownTaskNodes]
224
224
  * @return {Array<LH.TraceEvent>}
225
225
  */
226
- synthesizeTraceEvents(knownTaskNodes?: import("./main-thread-tasks.js").TaskNode[] | undefined): Array<LH.TraceEvent>;
226
+ synthesizeTraceEvents(knownTaskNodes?: Array<LH.Artifacts.TaskNode>): Array<LH.TraceEvent>;
227
227
  }
228
228
  //# sourceMappingURL=cpu-profile-model.d.ts.map
@@ -59,7 +59,7 @@ export class MainThreadTasks {
59
59
  * @param {LH.TraceEvent} [endEvent]
60
60
  * @return {TaskNode}
61
61
  */
62
- static _createNewTaskNode(event: LH.TraceEvent, endEvent?: LH.TraceEvent | undefined): TaskNode;
62
+ static _createNewTaskNode(event: LH.TraceEvent, endEvent?: LH.TraceEvent): TaskNode;
63
63
  /**
64
64
  *
65
65
  * @param {TaskNode} currentTask
@@ -132,7 +132,7 @@ export class MainThreadTasks {
132
132
  * @param {TaskNode} task
133
133
  * @param {TaskGroup} [parentGroup]
134
134
  */
135
- static _computeRecursiveTaskGroup(task: TaskNode, parentGroup?: import("./task-groups.js").TaskGroup | undefined): void;
135
+ static _computeRecursiveTaskGroup(task: TaskNode, parentGroup?: TaskGroup): void;
136
136
  /**
137
137
  * @param {LH.TraceEvent[]} mainThreadEvents
138
138
  * @param {Array<{id: string, url: string}>} frames
@@ -143,7 +143,7 @@ export class MainThreadTasks {
143
143
  static getMainThreadTasks(mainThreadEvents: LH.TraceEvent[], frames: Array<{
144
144
  id: string;
145
145
  url: string;
146
- }>, traceEndTs: number, traceStartTs?: number | undefined): TaskNode[];
146
+ }>, traceEndTs: number, traceStartTs?: number): TaskNode[];
147
147
  /**
148
148
  * Prints an artistic rendering of the task tree for easier debugability.
149
149
  *
@@ -220,7 +220,7 @@ export class TraceProcessor {
220
220
  */
221
221
  static processTrace(trace: LH.Trace, options?: {
222
222
  timeOriginDeterminationMethod?: TimeOriginDeterminationMethod;
223
- } | undefined): LH.Artifacts.ProcessedTrace;
223
+ }): LH.Artifacts.ProcessedTrace;
224
224
  /**
225
225
  * Finds key navigation trace events and computes timings of events in milliseconds since the time
226
226
  * origin in addition to the standard microsecond monotonic timestamps.
@@ -3,11 +3,11 @@ export class MetricTraceEvents {
3
3
  * Returns simplified representation of all metrics
4
4
  * @return {Array<{id: string, name: string, tsKey: keyof LH.Artifacts.TimingSummary}>} metrics to consider
5
5
  */
6
- static get metricsDefinitions(): {
6
+ static get metricsDefinitions(): Array<{
7
7
  id: string;
8
8
  name: string;
9
9
  tsKey: keyof LH.Artifacts.TimingSummary;
10
- }[];
10
+ }>;
11
11
  /**
12
12
  * @param {Array<LH.TraceEvent>} traceEvents
13
13
  * @param {LH.Result['audits']} auditResults