lighthouse 11.6.0-dev.20240303 → 11.6.0-dev.20240305
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/core/audits/byte-efficiency/byte-efficiency-audit.d.ts +2 -2
- package/core/audits/byte-efficiency/byte-efficiency-audit.js +7 -7
- package/core/audits/byte-efficiency/render-blocking-resources.d.ts +4 -3
- package/core/audits/byte-efficiency/render-blocking-resources.js +6 -6
- package/core/audits/dobetterweb/uses-http2.d.ts +3 -3
- package/core/audits/dobetterweb/uses-http2.js +4 -4
- package/core/audits/installable-manifest.d.ts +2 -0
- package/core/audits/installable-manifest.js +2 -0
- package/core/audits/prioritize-lcp-image.d.ts +1 -1
- package/core/computed/document-urls.js +1 -1
- package/core/computed/load-simulator.d.ts +4 -2
- package/core/computed/load-simulator.js +4 -2
- package/core/computed/main-resource.js +1 -1
- package/core/computed/metrics/lantern-first-contentful-paint.d.ts +6 -6
- package/core/computed/metrics/lantern-first-contentful-paint.js +4 -4
- package/core/computed/metrics/lantern-first-meaningful-paint.d.ts +2 -2
- package/core/computed/metrics/lantern-first-meaningful-paint.js +1 -1
- package/core/computed/metrics/lantern-interactive.d.ts +2 -6
- package/core/computed/metrics/lantern-interactive.js +2 -2
- package/core/computed/metrics/lantern-largest-contentful-paint.d.ts +2 -2
- package/core/computed/metrics/lantern-largest-contentful-paint.js +1 -1
- package/core/computed/metrics/lantern-max-potential-fid.d.ts +2 -2
- package/core/computed/metrics/lantern-max-potential-fid.js +2 -2
- package/core/computed/metrics/lantern-metric.d.ts +8 -7
- package/core/computed/metrics/lantern-metric.js +4 -4
- package/core/computed/metrics/lantern-speed-index.d.ts +2 -2
- package/core/computed/metrics/lantern-speed-index.js +2 -2
- package/core/computed/metrics/lantern-total-blocking-time.d.ts +2 -2
- package/core/computed/metrics/lantern-total-blocking-time.js +2 -2
- package/core/computed/network-analysis.js +1 -1
- package/core/computed/page-dependency-graph.d.ts +4 -57
- package/core/computed/page-dependency-graph.js +4 -451
- package/core/lib/asset-saver.js +1 -1
- package/core/lib/{dependency-graph → lantern}/base-node.d.ts +12 -8
- package/core/lib/{dependency-graph → lantern}/base-node.js +8 -3
- package/core/lib/{dependency-graph → lantern}/cpu-node.d.ts +5 -1
- package/core/lib/{dependency-graph → lantern}/cpu-node.js +4 -0
- package/core/lib/lantern/lantern.d.ts +8 -0
- package/core/lib/lantern/lantern.js +31 -0
- package/core/lib/{dependency-graph → lantern}/network-node.d.ts +17 -10
- package/core/lib/lantern/network-node.js +115 -0
- package/core/lib/lantern/page-dependency-graph.d.ts +58 -0
- package/core/lib/lantern/page-dependency-graph.js +463 -0
- package/core/lib/{dependency-graph → lantern}/simulator/connection-pool.d.ts +15 -14
- package/core/lib/{dependency-graph → lantern}/simulator/connection-pool.js +9 -7
- package/core/lib/{dependency-graph → lantern}/simulator/dns-cache.d.ts +11 -5
- package/core/lib/{dependency-graph → lantern}/simulator/dns-cache.js +3 -3
- package/core/lib/{dependency-graph → lantern}/simulator/network-analyzer.d.ts +36 -32
- package/core/lib/{dependency-graph → lantern}/simulator/network-analyzer.js +22 -17
- package/core/lib/{dependency-graph → lantern}/simulator/simulator.d.ts +21 -15
- package/core/lib/{dependency-graph → lantern}/simulator/simulator.js +24 -15
- package/core/lib/lantern-trace-saver.d.ts +4 -4
- package/core/lib/lantern-trace-saver.js +6 -4
- package/core/lib/navigation-error.js +1 -1
- package/core/lib/network-recorder.js +1 -1
- package/core/lib/network-request.d.ts +7 -0
- package/core/lib/network-request.js +13 -0
- package/package.json +1 -1
- package/shared/localization/locales/en-US.json +3 -0
- package/shared/localization/locales/en-XL.json +3 -0
- package/third-party/chromium-synchronization/installability-errors-test.js +1 -1
- package/tsconfig.json +6 -5
- package/types/artifacts.d.ts +1 -1
- package/types/gatherer.d.ts +8 -35
- package/types/internal/lantern.d.ts +124 -0
- package/core/lib/dependency-graph/network-node.js +0 -99
- /package/core/lib/{dependency-graph → lantern}/simulator/simulator-timing-map.d.ts +0 -0
- /package/core/lib/{dependency-graph → lantern}/simulator/simulator-timing-map.js +0 -0
- /package/core/lib/{dependency-graph → lantern}/simulator/tcp-connection.d.ts +0 -0
- /package/core/lib/{dependency-graph → lantern}/simulator/tcp-connection.js +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** @type {LH.Util.SelfMap<LH.Crdp.Network.ResourceType>} */
|
|
8
|
+
const NetworkRequestTypes = {
|
|
9
|
+
XHR: 'XHR',
|
|
10
|
+
Fetch: 'Fetch',
|
|
11
|
+
EventSource: 'EventSource',
|
|
12
|
+
Script: 'Script',
|
|
13
|
+
Stylesheet: 'Stylesheet',
|
|
14
|
+
Image: 'Image',
|
|
15
|
+
Media: 'Media',
|
|
16
|
+
Font: 'Font',
|
|
17
|
+
Document: 'Document',
|
|
18
|
+
TextTrack: 'TextTrack',
|
|
19
|
+
WebSocket: 'WebSocket',
|
|
20
|
+
Other: 'Other',
|
|
21
|
+
Manifest: 'Manifest',
|
|
22
|
+
SignedExchange: 'SignedExchange',
|
|
23
|
+
Ping: 'Ping',
|
|
24
|
+
Preflight: 'Preflight',
|
|
25
|
+
CSPViolationReport: 'CSPViolationReport',
|
|
26
|
+
Prefetch: 'Prefetch',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
NetworkRequestTypes,
|
|
31
|
+
};
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type NetworkRequest<T> = import('../../../types/internal/lantern.js').Lantern.NetworkRequest<T>;
|
|
2
|
+
/**
|
|
3
|
+
* @template [T=any]
|
|
4
|
+
* @extends {BaseNode<T>}
|
|
5
|
+
*/
|
|
6
|
+
export class NetworkNode<T = any> extends BaseNode<T> {
|
|
2
7
|
/**
|
|
3
|
-
* @param {
|
|
8
|
+
* @param {NetworkRequest<T>} networkRequest
|
|
4
9
|
*/
|
|
5
|
-
constructor(
|
|
10
|
+
constructor(networkRequest: NetworkRequest<T>);
|
|
6
11
|
/** @private */
|
|
7
|
-
private
|
|
12
|
+
private _request;
|
|
8
13
|
get type(): "network";
|
|
9
14
|
/**
|
|
10
|
-
* @return {
|
|
15
|
+
* @return {Readonly<T>}
|
|
11
16
|
*/
|
|
12
|
-
get record():
|
|
17
|
+
get record(): Readonly<T>;
|
|
18
|
+
/**
|
|
19
|
+
* @return {NetworkRequest<T>}
|
|
20
|
+
*/
|
|
21
|
+
get request(): import("../../../types/internal/lantern.js").Lantern.NetworkRequest<T>;
|
|
13
22
|
/**
|
|
14
23
|
* @return {string}
|
|
15
24
|
*/
|
|
@@ -33,11 +42,9 @@ export class NetworkNode extends BaseNode {
|
|
|
33
42
|
*/
|
|
34
43
|
hasRenderBlockingPriority(): boolean;
|
|
35
44
|
/**
|
|
36
|
-
* @return {NetworkNode}
|
|
45
|
+
* @return {NetworkNode<T>}
|
|
37
46
|
*/
|
|
38
|
-
cloneWithoutRelationships(): NetworkNode
|
|
47
|
+
cloneWithoutRelationships(): NetworkNode<T>;
|
|
39
48
|
}
|
|
40
49
|
import { BaseNode } from './base-node.js';
|
|
41
|
-
import { NetworkRequest } from '../network-request.js';
|
|
42
|
-
import * as LH from '../../../types/lh.js';
|
|
43
50
|
//# sourceMappingURL=network-node.d.ts.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** @template T @typedef {import('../../../types/internal/lantern.js').Lantern.NetworkRequest<T>} NetworkRequest */
|
|
8
|
+
|
|
9
|
+
import {NetworkRequestTypes} from './lantern.js';
|
|
10
|
+
import {BaseNode} from './base-node.js';
|
|
11
|
+
// TODO(15841): bring impl of isNonNetworkRequest inside lantern and remove this.
|
|
12
|
+
import UrlUtils from '../url-utils.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @template [T=any]
|
|
16
|
+
* @extends {BaseNode<T>}
|
|
17
|
+
*/
|
|
18
|
+
class NetworkNode extends BaseNode {
|
|
19
|
+
/**
|
|
20
|
+
* @param {NetworkRequest<T>} networkRequest
|
|
21
|
+
*/
|
|
22
|
+
constructor(networkRequest) {
|
|
23
|
+
super(networkRequest.requestId);
|
|
24
|
+
/** @private */
|
|
25
|
+
this._request = networkRequest;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get type() {
|
|
29
|
+
return BaseNode.TYPES.NETWORK;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @return {number}
|
|
34
|
+
*/
|
|
35
|
+
get startTime() {
|
|
36
|
+
return this._request.rendererStartTime * 1000;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @return {number}
|
|
41
|
+
*/
|
|
42
|
+
get endTime() {
|
|
43
|
+
return this._request.networkEndTime * 1000;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @return {Readonly<T>}
|
|
48
|
+
*/
|
|
49
|
+
get record() {
|
|
50
|
+
return /** @type {Required<T>} */ (this._request.record);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @return {NetworkRequest<T>}
|
|
55
|
+
*/
|
|
56
|
+
get request() {
|
|
57
|
+
return this._request;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @return {string}
|
|
62
|
+
*/
|
|
63
|
+
get initiatorType() {
|
|
64
|
+
return this._request.initiator && this._request.initiator.type;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @return {boolean}
|
|
69
|
+
*/
|
|
70
|
+
get fromDiskCache() {
|
|
71
|
+
return !!this._request.fromDiskCache;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @return {boolean}
|
|
76
|
+
*/
|
|
77
|
+
get isNonNetworkProtocol() {
|
|
78
|
+
// The 'protocol' field in devtools a string more like a `scheme`
|
|
79
|
+
return UrlUtils.isNonNetworkProtocol(this.request.protocol) ||
|
|
80
|
+
// But `protocol` can fail to be populated if the request fails, so fallback to scheme.
|
|
81
|
+
UrlUtils.isNonNetworkProtocol(this.request.parsedURL.scheme);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Returns whether this network record can be downloaded without a TCP connection.
|
|
86
|
+
* During simulation we treat data coming in over a network connection separately from on-device data.
|
|
87
|
+
* @return {boolean}
|
|
88
|
+
*/
|
|
89
|
+
get isConnectionless() {
|
|
90
|
+
return this.fromDiskCache || this.isNonNetworkProtocol;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @return {boolean}
|
|
95
|
+
*/
|
|
96
|
+
hasRenderBlockingPriority() {
|
|
97
|
+
const priority = this._request.priority;
|
|
98
|
+
const isScript = this._request.resourceType === NetworkRequestTypes.Script;
|
|
99
|
+
const isDocument = this._request.resourceType === NetworkRequestTypes.Document;
|
|
100
|
+
const isBlockingScript = priority === 'High' && isScript;
|
|
101
|
+
const isBlockingHtmlImport = priority === 'High' && isDocument;
|
|
102
|
+
return priority === 'VeryHigh' || isBlockingScript || isBlockingHtmlImport;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @return {NetworkNode<T>}
|
|
107
|
+
*/
|
|
108
|
+
cloneWithoutRelationships() {
|
|
109
|
+
const node = new NetworkNode(this._request);
|
|
110
|
+
node.setIsMainDocument(this._isMainDocument);
|
|
111
|
+
return node;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export {NetworkNode};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export type NetworkRequest = import('../../../types/internal/lantern.js').Lantern.NetworkRequest;
|
|
2
|
+
export type Node = import('./base-node.js').Node;
|
|
3
|
+
export type URLArtifact = Omit<LH.Artifacts['URL'], 'finalDisplayedUrl'>;
|
|
4
|
+
export type NetworkNodeOutput = {
|
|
5
|
+
nodes: Array<NetworkNode>;
|
|
6
|
+
idToNodeMap: Map<string, NetworkNode>;
|
|
7
|
+
urlToNodeMap: Map<string, Array<NetworkNode>>;
|
|
8
|
+
frameIdToNodeMap: Map<string, NetworkNode | null>;
|
|
9
|
+
};
|
|
10
|
+
export class PageDependencyGraph {
|
|
11
|
+
/**
|
|
12
|
+
* @param {NetworkRequest} record
|
|
13
|
+
* @return {Array<string>}
|
|
14
|
+
*/
|
|
15
|
+
static getNetworkInitiators(record: NetworkRequest): Array<string>;
|
|
16
|
+
/**
|
|
17
|
+
* @param {Array<NetworkRequest>} networkRecords
|
|
18
|
+
* @return {NetworkNodeOutput}
|
|
19
|
+
*/
|
|
20
|
+
static getNetworkNodeOutput(networkRecords: Array<NetworkRequest>): NetworkNodeOutput;
|
|
21
|
+
/**
|
|
22
|
+
* @param {LH.Artifacts.ProcessedTrace} processedTrace
|
|
23
|
+
* @return {Array<CPUNode>}
|
|
24
|
+
*/
|
|
25
|
+
static getCPUNodes({ mainThreadEvents }: LH.Artifacts.ProcessedTrace): Array<CPUNode>;
|
|
26
|
+
/**
|
|
27
|
+
* @param {NetworkNode} rootNode
|
|
28
|
+
* @param {NetworkNodeOutput} networkNodeOutput
|
|
29
|
+
*/
|
|
30
|
+
static linkNetworkNodes(rootNode: NetworkNode, networkNodeOutput: NetworkNodeOutput): void;
|
|
31
|
+
/**
|
|
32
|
+
* @param {Node} rootNode
|
|
33
|
+
* @param {NetworkNodeOutput} networkNodeOutput
|
|
34
|
+
* @param {Array<CPUNode>} cpuNodes
|
|
35
|
+
*/
|
|
36
|
+
static linkCPUNodes(rootNode: Node, networkNodeOutput: NetworkNodeOutput, cpuNodes: Array<CPUNode>): void;
|
|
37
|
+
/**
|
|
38
|
+
* Removes the given node from the graph, but retains all paths between its dependencies and
|
|
39
|
+
* dependents.
|
|
40
|
+
* @param {Node} node
|
|
41
|
+
*/
|
|
42
|
+
static _pruneNode(node: Node): void;
|
|
43
|
+
/**
|
|
44
|
+
* @param {LH.Artifacts.ProcessedTrace} processedTrace
|
|
45
|
+
* @param {Array<NetworkRequest>} networkRecords
|
|
46
|
+
* @param {URLArtifact} URL
|
|
47
|
+
* @return {Node}
|
|
48
|
+
*/
|
|
49
|
+
static createGraph(processedTrace: LH.Artifacts.ProcessedTrace, networkRecords: Array<NetworkRequest>, URL: URLArtifact): Node;
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* @param {Node} rootNode
|
|
53
|
+
*/
|
|
54
|
+
static printGraph(rootNode: Node, widthInCharacters?: number): void;
|
|
55
|
+
}
|
|
56
|
+
import { NetworkNode } from './network-node.js';
|
|
57
|
+
import { CPUNode } from './cpu-node.js';
|
|
58
|
+
//# sourceMappingURL=page-dependency-graph.d.ts.map
|