lighthouse 11.6.0-dev.20240306 → 11.6.0-dev.20240307

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 (37) hide show
  1. package/core/computed/load-simulator.d.ts +0 -2
  2. package/core/computed/load-simulator.js +2 -3
  3. package/core/computed/metrics/lantern-first-contentful-paint.d.ts +12 -0
  4. package/core/computed/metrics/lantern-first-meaningful-paint.d.ts +12 -0
  5. package/core/computed/metrics/lantern-interactive.d.ts +6 -0
  6. package/core/computed/metrics/lantern-interactive.js +1 -1
  7. package/core/computed/metrics/lantern-largest-contentful-paint.d.ts +12 -0
  8. package/core/computed/metrics/lantern-max-potential-fid.d.ts +6 -0
  9. package/core/computed/metrics/lantern-max-potential-fid.js +1 -1
  10. package/core/computed/metrics/lantern-metric.d.ts +4 -64
  11. package/core/computed/metrics/lantern-metric.js +6 -124
  12. package/core/computed/metrics/lantern-speed-index.d.ts +6 -0
  13. package/core/computed/metrics/lantern-speed-index.js +1 -1
  14. package/core/computed/metrics/lantern-total-blocking-time.d.ts +6 -0
  15. package/core/computed/metrics/lantern-total-blocking-time.js +1 -1
  16. package/core/lib/lantern/metric.d.ts +71 -0
  17. package/core/lib/lantern/metric.js +143 -0
  18. package/core/lib/lantern/network-node.d.ts +5 -5
  19. package/core/lib/lantern/network-node.js +3 -4
  20. package/core/lib/lantern/page-dependency-graph.d.ts +7 -7
  21. package/core/lib/lantern/page-dependency-graph.js +4 -4
  22. package/core/lib/lantern/simulator/connection-pool.d.ts +14 -15
  23. package/core/lib/lantern/simulator/connection-pool.js +7 -9
  24. package/core/lib/lantern/simulator/dns-cache.d.ts +5 -11
  25. package/core/lib/lantern/simulator/dns-cache.js +3 -3
  26. package/core/lib/lantern/simulator/network-analyzer.d.ts +30 -30
  27. package/core/lib/lantern/simulator/network-analyzer.js +14 -15
  28. package/core/lib/lantern/simulator/simulator.d.ts +13 -16
  29. package/core/lib/lantern/simulator/simulator.js +10 -16
  30. package/core/lib/lantern/types/lantern.d.ts +129 -0
  31. package/core/lib/lantern/types/lantern.js +7 -0
  32. package/core/lib/network-request.d.ts +3 -4
  33. package/core/lib/network-request.js +2 -3
  34. package/package.json +1 -1
  35. package/tsconfig.json +1 -0
  36. package/types/gatherer.d.ts +1 -1
  37. package/types/internal/lantern.d.ts +0 -124
@@ -1,13 +1,12 @@
1
- export type NetworkRequest<T> = import('../../../types/internal/lantern.js').Lantern.NetworkRequest<T>;
2
1
  /**
3
2
  * @template [T=any]
4
3
  * @extends {BaseNode<T>}
5
4
  */
6
5
  export class NetworkNode<T = any> extends BaseNode<T> {
7
6
  /**
8
- * @param {NetworkRequest<T>} networkRequest
7
+ * @param {Lantern.NetworkRequest<T>} networkRequest
9
8
  */
10
- constructor(networkRequest: NetworkRequest<T>);
9
+ constructor(networkRequest: Lantern.NetworkRequest<T>);
11
10
  /** @private */
12
11
  private _request;
13
12
  get type(): "network";
@@ -16,9 +15,9 @@ export class NetworkNode<T = any> extends BaseNode<T> {
16
15
  */
17
16
  get record(): Readonly<T>;
18
17
  /**
19
- * @return {NetworkRequest<T>}
18
+ * @return {Lantern.NetworkRequest<T>}
20
19
  */
21
- get request(): import("../../../types/internal/lantern.js").Lantern.NetworkRequest<T>;
20
+ get request(): Lantern.NetworkRequest<T>;
22
21
  /**
23
22
  * @return {string}
24
23
  */
@@ -47,4 +46,5 @@ export class NetworkNode<T = any> extends BaseNode<T> {
47
46
  cloneWithoutRelationships(): NetworkNode<T>;
48
47
  }
49
48
  import { BaseNode } from './base-node.js';
49
+ import * as Lantern from './types/lantern.js';
50
50
  //# sourceMappingURL=network-node.d.ts.map
@@ -4,8 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- /** @template T @typedef {import('../../../types/internal/lantern.js').Lantern.NetworkRequest<T>} NetworkRequest */
8
-
7
+ import * as Lantern from './types/lantern.js';
9
8
  import {NetworkRequestTypes} from './lantern.js';
10
9
  import {BaseNode} from './base-node.js';
11
10
  // TODO(15841): bring impl of isNonNetworkRequest inside lantern and remove this.
@@ -17,7 +16,7 @@ import UrlUtils from '../url-utils.js';
17
16
  */
18
17
  class NetworkNode extends BaseNode {
19
18
  /**
20
- * @param {NetworkRequest<T>} networkRequest
19
+ * @param {Lantern.NetworkRequest<T>} networkRequest
21
20
  */
22
21
  constructor(networkRequest) {
23
22
  super(networkRequest.requestId);
@@ -51,7 +50,7 @@ class NetworkNode extends BaseNode {
51
50
  }
52
51
 
53
52
  /**
54
- * @return {NetworkRequest<T>}
53
+ * @return {Lantern.NetworkRequest<T>}
55
54
  */
56
55
  get request() {
57
56
  return this._request;
@@ -1,4 +1,3 @@
1
- export type NetworkRequest = import('../../../types/internal/lantern.js').Lantern.NetworkRequest;
2
1
  export type Node = import('./base-node.js').Node;
3
2
  export type URLArtifact = Omit<LH.Artifacts['URL'], 'finalDisplayedUrl'>;
4
3
  export type NetworkNodeOutput = {
@@ -9,15 +8,15 @@ export type NetworkNodeOutput = {
9
8
  };
10
9
  export class PageDependencyGraph {
11
10
  /**
12
- * @param {NetworkRequest} record
11
+ * @param {Lantern.NetworkRequest} record
13
12
  * @return {Array<string>}
14
13
  */
15
- static getNetworkInitiators(record: NetworkRequest): Array<string>;
14
+ static getNetworkInitiators(record: Lantern.NetworkRequest): Array<string>;
16
15
  /**
17
- * @param {Array<NetworkRequest>} networkRecords
16
+ * @param {Array<Lantern.NetworkRequest>} networkRecords
18
17
  * @return {NetworkNodeOutput}
19
18
  */
20
- static getNetworkNodeOutput(networkRecords: Array<NetworkRequest>): NetworkNodeOutput;
19
+ static getNetworkNodeOutput(networkRecords: Array<Lantern.NetworkRequest>): NetworkNodeOutput;
21
20
  /**
22
21
  * @param {LH.Artifacts.ProcessedTrace} processedTrace
23
22
  * @return {Array<CPUNode>}
@@ -42,11 +41,11 @@ export class PageDependencyGraph {
42
41
  static _pruneNode(node: Node): void;
43
42
  /**
44
43
  * @param {LH.Artifacts.ProcessedTrace} processedTrace
45
- * @param {Array<NetworkRequest>} networkRecords
44
+ * @param {Array<Lantern.NetworkRequest>} networkRecords
46
45
  * @param {URLArtifact} URL
47
46
  * @return {Node}
48
47
  */
49
- static createGraph(processedTrace: LH.Artifacts.ProcessedTrace, networkRecords: Array<NetworkRequest>, URL: URLArtifact): Node;
48
+ static createGraph(processedTrace: LH.Artifacts.ProcessedTrace, networkRecords: Array<Lantern.NetworkRequest>, URL: URLArtifact): Node;
50
49
  /**
51
50
  *
52
51
  * @param {Node} rootNode
@@ -54,5 +53,6 @@ export class PageDependencyGraph {
54
53
  static printGraph(rootNode: Node, widthInCharacters?: number): void;
55
54
  }
56
55
  import { NetworkNode } from './network-node.js';
56
+ import * as Lantern from './types/lantern.js';
57
57
  import { CPUNode } from './cpu-node.js';
58
58
  //# sourceMappingURL=page-dependency-graph.d.ts.map
@@ -4,13 +4,13 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
+ import * as Lantern from './types/lantern.js';
7
8
  import {NetworkRequestTypes} from './lantern.js';
8
9
  import {NetworkNode} from './network-node.js';
9
10
  import {CPUNode} from './cpu-node.js';
10
11
  import {TraceProcessor} from '../tracehouse/trace-processor.js';
11
12
  import {NetworkAnalyzer} from './simulator/network-analyzer.js';
12
13
 
13
- /** @typedef {import('../../../types/internal/lantern.js').Lantern.NetworkRequest} NetworkRequest */
14
14
  /** @typedef {import('./base-node.js').Node} Node */
15
15
  /** @typedef {Omit<LH.Artifacts['URL'], 'finalDisplayedUrl'>} URLArtifact */
16
16
 
@@ -31,7 +31,7 @@ const IGNORED_MIME_TYPES_REGEX = /^video/;
31
31
 
32
32
  class PageDependencyGraph {
33
33
  /**
34
- * @param {NetworkRequest} record
34
+ * @param {Lantern.NetworkRequest} record
35
35
  * @return {Array<string>}
36
36
  */
37
37
  static getNetworkInitiators(record) {
@@ -60,7 +60,7 @@ class PageDependencyGraph {
60
60
  }
61
61
 
62
62
  /**
63
- * @param {Array<NetworkRequest>} networkRecords
63
+ * @param {Array<Lantern.NetworkRequest>} networkRecords
64
64
  * @return {NetworkNodeOutput}
65
65
  */
66
66
  static getNetworkNodeOutput(networkRecords) {
@@ -394,7 +394,7 @@ class PageDependencyGraph {
394
394
 
395
395
  /**
396
396
  * @param {LH.Artifacts.ProcessedTrace} processedTrace
397
- * @param {Array<NetworkRequest>} networkRecords
397
+ * @param {Array<Lantern.NetworkRequest>} networkRecords
398
398
  * @param {URLArtifact} URL
399
399
  * @return {Node}
400
400
  */
@@ -1,15 +1,15 @@
1
1
  export class ConnectionPool {
2
2
  /**
3
- * @param {NetworkRequest[]} records
4
- * @param {Required<SimulationOptions>} options
3
+ * @param {Lantern.NetworkRequest[]} records
4
+ * @param {Required<Lantern.Simulation.Options>} options
5
5
  */
6
- constructor(records: NetworkRequest[], options: Required<SimulationOptions>);
7
- _options: Required<import("../../../../types/internal/lantern.js").Lantern.Simulation.Options>;
8
- _records: import("../../../../types/internal/lantern.js").Lantern.NetworkRequest<any>[];
6
+ constructor(records: Lantern.NetworkRequest[], options: Required<Lantern.Simulation.Options>);
7
+ _options: Required<Lantern.Simulation.Options>;
8
+ _records: Lantern.NetworkRequest<any>[];
9
9
  /** @type {Map<string, TcpConnection[]>} */
10
10
  _connectionsByOrigin: Map<string, TcpConnection[]>;
11
- /** @type {Map<NetworkRequest, TcpConnection>} */
12
- _connectionsByRecord: Map<NetworkRequest, TcpConnection>;
11
+ /** @type {Map<Lantern.NetworkRequest, TcpConnection>} */
12
+ _connectionsByRecord: Map<Lantern.NetworkRequest, TcpConnection>;
13
13
  _connectionsInUse: Set<any>;
14
14
  _connectionReusedByRequestId: Map<string, boolean>;
15
15
  /**
@@ -33,27 +33,26 @@ export class ConnectionPool {
33
33
  * If ignoreConnectionReused is true, acquire will consider all connections not in use as available.
34
34
  * Otherwise, only connections that have matching "warmth" are considered available.
35
35
  *
36
- * @param {NetworkRequest} record
36
+ * @param {Lantern.NetworkRequest} record
37
37
  * @param {{ignoreConnectionReused?: boolean}} options
38
38
  * @return {?TcpConnection}
39
39
  */
40
- acquire(record: NetworkRequest, options?: {
40
+ acquire(record: Lantern.NetworkRequest, options?: {
41
41
  ignoreConnectionReused?: boolean;
42
42
  }): TcpConnection | null;
43
43
  /**
44
44
  * Return the connection currently being used to fetch a record. If no connection
45
45
  * currently being used for this record, an error will be thrown.
46
46
  *
47
- * @param {NetworkRequest} record
47
+ * @param {Lantern.NetworkRequest} record
48
48
  * @return {TcpConnection}
49
49
  */
50
- acquireActiveConnectionFromRecord(record: NetworkRequest): TcpConnection;
50
+ acquireActiveConnectionFromRecord(record: Lantern.NetworkRequest): TcpConnection;
51
51
  /**
52
- * @param {NetworkRequest} record
52
+ * @param {Lantern.NetworkRequest} record
53
53
  */
54
- release(record: NetworkRequest): void;
54
+ release(record: Lantern.NetworkRequest): void;
55
55
  }
56
- export type NetworkRequest = import('../../../../types/internal/lantern.js').Lantern.NetworkRequest;
57
- export type SimulationOptions = import('../../../../types/internal/lantern.js').Lantern.Simulation.Options;
56
+ import * as Lantern from '../types/lantern.js';
58
57
  import { TcpConnection } from './tcp-connection.js';
59
58
  //# sourceMappingURL=connection-pool.d.ts.map
@@ -4,9 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- /** @typedef {import('../../../../types/internal/lantern.js').Lantern.NetworkRequest} NetworkRequest */
8
- /** @typedef {import('../../../../types/internal/lantern.js').Lantern.Simulation.Options} SimulationOptions */
9
-
7
+ import * as Lantern from '../types/lantern.js';
10
8
  import {NetworkAnalyzer} from './network-analyzer.js';
11
9
  import {TcpConnection} from './tcp-connection.js';
12
10
 
@@ -19,8 +17,8 @@ const CONNECTIONS_PER_ORIGIN = 6;
19
17
 
20
18
  export class ConnectionPool {
21
19
  /**
22
- * @param {NetworkRequest[]} records
23
- * @param {Required<SimulationOptions>} options
20
+ * @param {Lantern.NetworkRequest[]} records
21
+ * @param {Required<Lantern.Simulation.Options>} options
24
22
  */
25
23
  constructor(records, options) {
26
24
  this._options = options;
@@ -28,7 +26,7 @@ export class ConnectionPool {
28
26
  this._records = records;
29
27
  /** @type {Map<string, TcpConnection[]>} */
30
28
  this._connectionsByOrigin = new Map();
31
- /** @type {Map<NetworkRequest, TcpConnection>} */
29
+ /** @type {Map<Lantern.NetworkRequest, TcpConnection>} */
32
30
  this._connectionsByRecord = new Map();
33
31
  this._connectionsInUse = new Set();
34
32
  this._connectionReusedByRequestId = NetworkAnalyzer.estimateIfConnectionWasReused(records, {
@@ -126,7 +124,7 @@ export class ConnectionPool {
126
124
  * If ignoreConnectionReused is true, acquire will consider all connections not in use as available.
127
125
  * Otherwise, only connections that have matching "warmth" are considered available.
128
126
  *
129
- * @param {NetworkRequest} record
127
+ * @param {Lantern.NetworkRequest} record
130
128
  * @param {{ignoreConnectionReused?: boolean}} options
131
129
  * @return {?TcpConnection}
132
130
  */
@@ -152,7 +150,7 @@ export class ConnectionPool {
152
150
  * Return the connection currently being used to fetch a record. If no connection
153
151
  * currently being used for this record, an error will be thrown.
154
152
  *
155
- * @param {NetworkRequest} record
153
+ * @param {Lantern.NetworkRequest} record
156
154
  * @return {TcpConnection}
157
155
  */
158
156
  acquireActiveConnectionFromRecord(record) {
@@ -163,7 +161,7 @@ export class ConnectionPool {
163
161
  }
164
162
 
165
163
  /**
166
- * @param {NetworkRequest} record
164
+ * @param {Lantern.NetworkRequest} record
167
165
  */
168
166
  release(record) {
169
167
  const connection = this._connectionsByRecord.get(record);
@@ -1,4 +1,3 @@
1
- export type NetworkRequest = import('../../../../types/internal/lantern.js').Lantern.NetworkRequest;
2
1
  export class DNSCache {
3
2
  /**
4
3
  * @param {{rtt: number}} options
@@ -12,19 +11,19 @@ export class DNSCache {
12
11
  resolvedAt: number;
13
12
  }>;
14
13
  /**
15
- * @param {NetworkRequest} request
14
+ * @param {Lantern.NetworkRequest} request
16
15
  * @param {{requestedAt: number, shouldUpdateCache: boolean}=} options
17
16
  * @return {number}
18
17
  */
19
- getTimeUntilResolution(request: NetworkRequest, options?: {
18
+ getTimeUntilResolution(request: Lantern.NetworkRequest, options?: {
20
19
  requestedAt: number;
21
20
  shouldUpdateCache: boolean;
22
21
  } | undefined): number;
23
22
  /**
24
- * @param {NetworkRequest} request
23
+ * @param {Lantern.NetworkRequest} request
25
24
  * @param {number} resolvedAt
26
25
  */
27
- _updateCacheResolvedAtIfNeeded(request: NetworkRequest, resolvedAt: number): void;
26
+ _updateCacheResolvedAtIfNeeded(request: Lantern.NetworkRequest, resolvedAt: number): void;
28
27
  /**
29
28
  * Forcefully sets the DNS resolution time for a record.
30
29
  * Useful for testing and alternate execution simulations.
@@ -37,12 +36,7 @@ export class DNSCache {
37
36
  export namespace DNSCache {
38
37
  export { DNS_RESOLUTION_RTT_MULTIPLIER as RTT_MULTIPLIER };
39
38
  }
40
- /**
41
- * @license
42
- * Copyright 2018 Google LLC
43
- * SPDX-License-Identifier: Apache-2.0
44
- */
45
- /** @typedef {import('../../../../types/internal/lantern.js').Lantern.NetworkRequest} NetworkRequest */
39
+ import * as Lantern from '../types/lantern.js';
46
40
  declare const DNS_RESOLUTION_RTT_MULTIPLIER: 2;
47
41
  export {};
48
42
  //# sourceMappingURL=dns-cache.d.ts.map
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- /** @typedef {import('../../../../types/internal/lantern.js').Lantern.NetworkRequest} NetworkRequest */
7
+ import * as Lantern from '../types/lantern.js';
8
8
 
9
9
  // A DNS lookup will usually take ~1-2 roundtrips of connection latency plus the extra DNS routing time.
10
10
  // Example: https://www.webpagetest.org/result/180703_3A_e33ec79747c002ed4d7bcbfc81462203/1/details/#waterfall_view_step1
@@ -25,7 +25,7 @@ class DNSCache {
25
25
  }
26
26
 
27
27
  /**
28
- * @param {NetworkRequest} request
28
+ * @param {Lantern.NetworkRequest} request
29
29
  * @param {{requestedAt: number, shouldUpdateCache: boolean}=} options
30
30
  * @return {number}
31
31
  */
@@ -47,7 +47,7 @@ class DNSCache {
47
47
  }
48
48
 
49
49
  /**
50
- * @param {NetworkRequest} request
50
+ * @param {Lantern.NetworkRequest} request
51
51
  * @param {number} resolvedAt
52
52
  */
53
53
  _updateCacheResolvedAtIfNeeded(request, resolvedAt) {
@@ -1,4 +1,3 @@
1
- export type NetworkRequest = import('../../../../types/internal/lantern.js').Lantern.NetworkRequest;
2
1
  export type Summary = {
3
2
  min: number;
4
3
  max: number;
@@ -33,10 +32,10 @@ export class NetworkAnalyzer {
33
32
  */
34
33
  static get SUMMARY(): string;
35
34
  /**
36
- * @param {NetworkRequest[]} records
37
- * @return {Map<string, NetworkRequest[]>}
35
+ * @param {Lantern.NetworkRequest[]} records
36
+ * @return {Map<string, Lantern.NetworkRequest[]>}
38
37
  */
39
- static groupByOrigin(records: NetworkRequest[]): Map<string, NetworkRequest[]>;
38
+ static groupByOrigin(records: Lantern.NetworkRequest[]): Map<string, Lantern.NetworkRequest[]>;
40
39
  /**
41
40
  * @param {number[]} values
42
41
  * @return {Summary}
@@ -47,14 +46,14 @@ export class NetworkAnalyzer {
47
46
  * @return {Map<string, Summary>}
48
47
  */
49
48
  static summarize(values: Map<string, number[]>): Map<string, Summary>;
50
- /** @typedef {{record: NetworkRequest, timing: LH.Crdp.Network.ResourceTiming, connectionReused?: boolean}} RequestInfo */
49
+ /** @typedef {{record: Lantern.NetworkRequest, timing: LH.Crdp.Network.ResourceTiming, connectionReused?: boolean}} RequestInfo */
51
50
  /**
52
- * @param {NetworkRequest[]} records
51
+ * @param {Lantern.NetworkRequest[]} records
53
52
  * @param {(e: RequestInfo) => number | number[] | undefined} iteratee
54
53
  * @return {Map<string, number[]>}
55
54
  */
56
- static _estimateValueByOrigin(records: NetworkRequest[], iteratee: (e: {
57
- record: NetworkRequest;
55
+ static _estimateValueByOrigin(records: Lantern.NetworkRequest[], iteratee: (e: {
56
+ record: Lantern.NetworkRequest;
58
57
  timing: LH.Crdp.Network.ResourceTiming;
59
58
  connectionReused?: boolean | undefined;
60
59
  }) => number | number[] | undefined): Map<string, number[]>;
@@ -70,7 +69,7 @@ export class NetworkAnalyzer {
70
69
  * @return {number[]|number|undefined}
71
70
  */
72
71
  static _estimateRTTViaConnectionTiming(info: {
73
- record: NetworkRequest;
72
+ record: Lantern.NetworkRequest;
74
73
  timing: LH.Crdp.Network.ResourceTiming;
75
74
  connectionReused?: boolean | undefined;
76
75
  }): number[] | number | undefined;
@@ -83,7 +82,7 @@ export class NetworkAnalyzer {
83
82
  * @return {number|undefined}
84
83
  */
85
84
  static _estimateRTTViaDownloadTiming(info: {
86
- record: NetworkRequest;
85
+ record: Lantern.NetworkRequest;
87
86
  timing: LH.Crdp.Network.ResourceTiming;
88
87
  connectionReused?: boolean | undefined;
89
88
  }): number | undefined;
@@ -97,7 +96,7 @@ export class NetworkAnalyzer {
97
96
  * @return {number|undefined}
98
97
  */
99
98
  static _estimateRTTViaSendStartTiming(info: {
100
- record: NetworkRequest;
99
+ record: Lantern.NetworkRequest;
101
100
  timing: LH.Crdp.Network.ResourceTiming;
102
101
  connectionReused?: boolean | undefined;
103
102
  }): number | undefined;
@@ -111,32 +110,32 @@ export class NetworkAnalyzer {
111
110
  * @return {number|undefined}
112
111
  */
113
112
  static _estimateRTTViaHeadersEndTiming(info: {
114
- record: NetworkRequest;
113
+ record: Lantern.NetworkRequest;
115
114
  timing: LH.Crdp.Network.ResourceTiming;
116
115
  connectionReused?: boolean | undefined;
117
116
  }): number | undefined;
118
117
  /**
119
118
  * Given the RTT to each origin, estimates the observed server response times.
120
119
  *
121
- * @param {NetworkRequest[]} records
120
+ * @param {Lantern.NetworkRequest[]} records
122
121
  * @param {Map<string, number>} rttByOrigin
123
122
  * @return {Map<string, number[]>}
124
123
  */
125
- static _estimateResponseTimeByOrigin(records: NetworkRequest[], rttByOrigin: Map<string, number>): Map<string, number[]>;
124
+ static _estimateResponseTimeByOrigin(records: Lantern.NetworkRequest[], rttByOrigin: Map<string, number>): Map<string, number[]>;
126
125
  /**
127
- * @param {NetworkRequest[]} records
126
+ * @param {Lantern.NetworkRequest[]} records
128
127
  * @return {boolean}
129
128
  */
130
- static canTrustConnectionInformation(records: NetworkRequest[]): boolean;
129
+ static canTrustConnectionInformation(records: Lantern.NetworkRequest[]): boolean;
131
130
  /**
132
131
  * Returns a map of requestId -> connectionReused, estimating the information if the information
133
132
  * available in the records themselves appears untrustworthy.
134
133
  *
135
- * @param {NetworkRequest[]} records
134
+ * @param {Lantern.NetworkRequest[]} records
136
135
  * @param {{forceCoarseEstimates: boolean}} [options]
137
136
  * @return {Map<string, boolean>}
138
137
  */
139
- static estimateIfConnectionWasReused(records: NetworkRequest[], options?: {
138
+ static estimateIfConnectionWasReused(records: Lantern.NetworkRequest[], options?: {
140
139
  forceCoarseEstimates: boolean;
141
140
  } | undefined): Map<string, boolean>;
142
141
  /**
@@ -144,20 +143,20 @@ export class NetworkAnalyzer {
144
143
  * Attempts to use the most accurate information first and falls back to coarser estimates when it
145
144
  * is unavailable.
146
145
  *
147
- * @param {NetworkRequest[]} records
146
+ * @param {Lantern.NetworkRequest[]} records
148
147
  * @param {RTTEstimateOptions} [options]
149
148
  * @return {Map<string, Summary>}
150
149
  */
151
- static estimateRTTByOrigin(records: NetworkRequest[], options?: RTTEstimateOptions | undefined): Map<string, Summary>;
150
+ static estimateRTTByOrigin(records: Lantern.NetworkRequest[], options?: RTTEstimateOptions | undefined): Map<string, Summary>;
152
151
  /**
153
152
  * Estimates the server response time of each origin. RTT times can be passed in or will be
154
153
  * estimated automatically if not provided.
155
154
  *
156
- * @param {NetworkRequest[]} records
155
+ * @param {Lantern.NetworkRequest[]} records
157
156
  * @param {RTTEstimateOptions & {rttByOrigin?: Map<string, number>}} [options]
158
157
  * @return {Map<string, Summary>}
159
158
  */
160
- static estimateServerResponseTimeByOrigin(records: NetworkRequest[], options?: (RTTEstimateOptions & {
159
+ static estimateServerResponseTimeByOrigin(records: Lantern.NetworkRequest[], options?: (RTTEstimateOptions & {
161
160
  rttByOrigin?: Map<string, number> | undefined;
162
161
  }) | undefined): Map<string, Summary>;
163
162
  /**
@@ -165,32 +164,33 @@ export class NetworkAnalyzer {
165
164
  * Excludes data URI, failed or otherwise incomplete, and cached requests.
166
165
  * Returns Infinity if there were no analyzable network records.
167
166
  *
168
- * @param {Array<NetworkRequest>} networkRecords
167
+ * @param {Array<Lantern.NetworkRequest>} networkRecords
169
168
  * @return {number}
170
169
  */
171
- static estimateThroughput(networkRecords: Array<NetworkRequest>): number;
170
+ static estimateThroughput(networkRecords: Array<Lantern.NetworkRequest>): number;
172
171
  /**
173
- * @template {NetworkRequest} T
172
+ * @template {Lantern.NetworkRequest} T
174
173
  * @param {Array<T>} records
175
174
  * @param {string} resourceUrl
176
175
  * @return {T|undefined}
177
176
  */
178
- static findResourceForUrl<T extends import("../../../../types/internal/lantern.js").Lantern.NetworkRequest<any>>(records: T[], resourceUrl: string): T | undefined;
177
+ static findResourceForUrl<T extends Lantern.NetworkRequest<any>>(records: T[], resourceUrl: string): T | undefined;
179
178
  /**
180
- * @template {NetworkRequest} T
179
+ * @template {Lantern.NetworkRequest} T
181
180
  * @param {Array<T>} records
182
181
  * @param {string} resourceUrl
183
182
  * @return {T|undefined}
184
183
  */
185
- static findLastDocumentForUrl<T_1 extends import("../../../../types/internal/lantern.js").Lantern.NetworkRequest<any>>(records: T_1[], resourceUrl: string): T_1 | undefined;
184
+ static findLastDocumentForUrl<T_1 extends Lantern.NetworkRequest<any>>(records: T_1[], resourceUrl: string): T_1 | undefined;
186
185
  /**
187
186
  * Resolves redirect chain given a main document.
188
187
  * See: {@link NetworkAnalyzer.findLastDocumentForUrl}) for how to retrieve main document.
189
188
  *
190
- * @template {NetworkRequest} T
189
+ * @template {Lantern.NetworkRequest} T
191
190
  * @param {T} request
192
191
  * @return {T}
193
192
  */
194
- static resolveRedirects<T_2 extends import("../../../../types/internal/lantern.js").Lantern.NetworkRequest<any>>(request: T_2): T_2;
193
+ static resolveRedirects<T_2 extends Lantern.NetworkRequest<any>>(request: T_2): T_2;
195
194
  }
195
+ import * as Lantern from '../types/lantern.js';
196
196
  //# sourceMappingURL=network-analyzer.d.ts.map
@@ -4,8 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- /** @typedef {import('../../../../types/internal/lantern.js').Lantern.NetworkRequest} NetworkRequest */
8
-
7
+ import * as Lantern from '../types/lantern.js';
9
8
  import UrlUtils from '../../url-utils.js';
10
9
 
11
10
  const INITIAL_CWD = 14 * 1024;
@@ -33,8 +32,8 @@ class NetworkAnalyzer {
33
32
  }
34
33
 
35
34
  /**
36
- * @param {NetworkRequest[]} records
37
- * @return {Map<string, NetworkRequest[]>}
35
+ * @param {Lantern.NetworkRequest[]} records
36
+ * @return {Map<string, Lantern.NetworkRequest[]>}
38
37
  */
39
38
  static groupByOrigin(records) {
40
39
  const grouped = new Map();
@@ -89,10 +88,10 @@ class NetworkAnalyzer {
89
88
  return summaryByKey;
90
89
  }
91
90
 
92
- /** @typedef {{record: NetworkRequest, timing: LH.Crdp.Network.ResourceTiming, connectionReused?: boolean}} RequestInfo */
91
+ /** @typedef {{record: Lantern.NetworkRequest, timing: LH.Crdp.Network.ResourceTiming, connectionReused?: boolean}} RequestInfo */
93
92
 
94
93
  /**
95
- * @param {NetworkRequest[]} records
94
+ * @param {Lantern.NetworkRequest[]} records
96
95
  * @param {(e: RequestInfo) => number | number[] | undefined} iteratee
97
96
  * @return {Map<string, number[]>}
98
97
  */
@@ -251,7 +250,7 @@ class NetworkAnalyzer {
251
250
  /**
252
251
  * Given the RTT to each origin, estimates the observed server response times.
253
252
  *
254
- * @param {NetworkRequest[]} records
253
+ * @param {Lantern.NetworkRequest[]} records
255
254
  * @param {Map<string, number>} rttByOrigin
256
255
  * @return {Map<string, number[]>}
257
256
  */
@@ -272,7 +271,7 @@ class NetworkAnalyzer {
272
271
  }
273
272
 
274
273
  /**
275
- * @param {NetworkRequest[]} records
274
+ * @param {Lantern.NetworkRequest[]} records
276
275
  * @return {boolean}
277
276
  */
278
277
  static canTrustConnectionInformation(records) {
@@ -292,7 +291,7 @@ class NetworkAnalyzer {
292
291
  * Returns a map of requestId -> connectionReused, estimating the information if the information
293
292
  * available in the records themselves appears untrustworthy.
294
293
  *
295
- * @param {NetworkRequest[]} records
294
+ * @param {Lantern.NetworkRequest[]} records
296
295
  * @param {{forceCoarseEstimates: boolean}} [options]
297
296
  * @return {Map<string, boolean>}
298
297
  */
@@ -336,7 +335,7 @@ class NetworkAnalyzer {
336
335
  * Attempts to use the most accurate information first and falls back to coarser estimates when it
337
336
  * is unavailable.
338
337
  *
339
- * @param {NetworkRequest[]} records
338
+ * @param {Lantern.NetworkRequest[]} records
340
339
  * @param {RTTEstimateOptions} [options]
341
340
  * @return {Map<string, Summary>}
342
341
  */
@@ -417,7 +416,7 @@ class NetworkAnalyzer {
417
416
  * Estimates the server response time of each origin. RTT times can be passed in or will be
418
417
  * estimated automatically if not provided.
419
418
  *
420
- * @param {NetworkRequest[]} records
419
+ * @param {Lantern.NetworkRequest[]} records
421
420
  * @param {RTTEstimateOptions & {rttByOrigin?: Map<string, number>}} [options]
422
421
  * @return {Map<string, Summary>}
423
422
  */
@@ -443,7 +442,7 @@ class NetworkAnalyzer {
443
442
  * Excludes data URI, failed or otherwise incomplete, and cached requests.
444
443
  * Returns Infinity if there were no analyzable network records.
445
444
  *
446
- * @param {Array<NetworkRequest>} networkRecords
445
+ * @param {Array<Lantern.NetworkRequest>} networkRecords
447
446
  * @return {number}
448
447
  */
449
448
  static estimateThroughput(networkRecords) {
@@ -496,7 +495,7 @@ class NetworkAnalyzer {
496
495
  }
497
496
 
498
497
  /**
499
- * @template {NetworkRequest} T
498
+ * @template {Lantern.NetworkRequest} T
500
499
  * @param {Array<T>} records
501
500
  * @param {string} resourceUrl
502
501
  * @return {T|undefined}
@@ -510,7 +509,7 @@ class NetworkAnalyzer {
510
509
  }
511
510
 
512
511
  /**
513
- * @template {NetworkRequest} T
512
+ * @template {Lantern.NetworkRequest} T
514
513
  * @param {Array<T>} records
515
514
  * @param {string} resourceUrl
516
515
  * @return {T|undefined}
@@ -530,7 +529,7 @@ class NetworkAnalyzer {
530
529
  * Resolves redirect chain given a main document.
531
530
  * See: {@link NetworkAnalyzer.findLastDocumentForUrl}) for how to retrieve main document.
532
531
  *
533
- * @template {NetworkRequest} T
532
+ * @template {Lantern.NetworkRequest} T
534
533
  * @param {T} request
535
534
  * @return {T}
536
535
  */