lighthouse 12.0.0-dev.20240611 → 12.0.0-dev.20240613
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 +2 -2
- package/core/audits/byte-efficiency/render-blocking-resources.d.ts +3 -3
- package/core/audits/byte-efficiency/render-blocking-resources.js +4 -4
- package/core/audits/dobetterweb/uses-http2.d.ts +2 -2
- package/core/audits/dobetterweb/uses-http2.js +2 -2
- package/core/audits/long-tasks.d.ts +1 -1
- package/core/audits/long-tasks.js +1 -1
- package/core/audits/prioritize-lcp-image.d.ts +1 -1
- package/core/computed/document-urls.js +3 -2
- package/core/computed/load-simulator.d.ts +4 -4
- package/core/computed/load-simulator.js +3 -3
- package/core/computed/main-resource.js +3 -2
- package/core/computed/metrics/lantern-first-contentful-paint.d.ts +4 -4
- package/core/computed/metrics/lantern-first-contentful-paint.js +3 -3
- package/core/computed/metrics/lantern-interactive.d.ts +4 -4
- package/core/computed/metrics/lantern-interactive.js +3 -3
- package/core/computed/metrics/lantern-largest-contentful-paint.d.ts +4 -4
- package/core/computed/metrics/lantern-largest-contentful-paint.js +3 -3
- package/core/computed/metrics/lantern-max-potential-fid.d.ts +4 -4
- package/core/computed/metrics/lantern-max-potential-fid.js +3 -3
- package/core/computed/metrics/lantern-metric.d.ts +4 -3
- package/core/computed/metrics/lantern-metric.js +4 -4
- package/core/computed/metrics/lantern-speed-index.d.ts +4 -4
- package/core/computed/metrics/lantern-speed-index.js +3 -3
- package/core/computed/metrics/lantern-total-blocking-time.d.ts +4 -4
- package/core/computed/metrics/lantern-total-blocking-time.js +3 -3
- package/core/computed/metrics/total-blocking-time.js +3 -1
- package/core/computed/network-analysis.js +2 -2
- package/core/computed/page-dependency-graph.d.ts +2 -2
- package/core/computed/page-dependency-graph.js +6 -6
- package/core/computed/tbt-impact-tasks.js +3 -2
- package/core/config/constants.js +1 -1
- package/core/lib/asset-saver.js +2 -2
- package/core/lib/lantern/{base-node.d.ts → BaseNode.d.ts} +7 -9
- package/core/lib/lantern/{base-node.js → BaseNode.js} +6 -6
- package/core/lib/lantern/BaseNode.test.js +385 -0
- package/core/lib/lantern/{cpu-node.d.ts → CpuNode.d.ts} +8 -9
- package/core/lib/lantern/{cpu-node.js → CpuNode.js} +4 -5
- package/core/lib/lantern/{lantern-error.d.ts → LanternError.d.ts} +1 -1
- package/core/lib/lantern/{metric.d.ts → Metric.d.ts} +17 -17
- package/core/lib/lantern/{metric.js → Metric.js} +10 -12
- package/core/lib/lantern/{network-node.d.ts → NetworkNode.d.ts} +4 -5
- package/core/lib/lantern/{network-node.js → NetworkNode.js} +4 -5
- package/core/lib/lantern/{page-dependency-graph.d.ts → PageDependencyGraph.d.ts} +5 -5
- package/core/lib/lantern/{page-dependency-graph.js → PageDependencyGraph.js} +11 -10
- package/core/lib/lantern/PageDependencyGraph.test.js +654 -0
- package/core/lib/lantern/{tbt-utils.d.ts → TBTUtils.d.ts} +1 -1
- package/core/lib/lantern/TBTUtils.test.d.ts +2 -0
- package/core/lib/lantern/TBTUtils.test.js +130 -0
- package/core/lib/lantern/{trace-engine-computation-data.d.ts → TraceEngineComputationData.d.ts} +3 -3
- package/core/lib/lantern/{trace-engine-computation-data.js → TraceEngineComputationData.js} +5 -7
- package/core/lib/lantern/lantern.d.ts +16 -46
- package/core/lib/lantern/lantern.js +16 -40
- package/core/lib/lantern/metrics/{first-contentful-paint.d.ts → FirstContentfulPaint.d.ts} +11 -11
- package/core/lib/lantern/metrics/{first-contentful-paint.js → FirstContentfulPaint.js} +8 -10
- package/core/lib/lantern/metrics/FirstContentfulPaint.test.js +54 -0
- package/core/lib/lantern/metrics/{interactive.d.ts → Interactive.d.ts} +4 -5
- package/core/lib/lantern/metrics/{interactive.js → Interactive.js} +10 -13
- package/core/lib/lantern/metrics/Interactive.test.js +56 -0
- package/core/lib/lantern/metrics/{largest-contentful-paint.d.ts → LargestContentfulPaint.d.ts} +5 -6
- package/core/lib/lantern/metrics/{largest-contentful-paint.js → LargestContentfulPaint.js} +9 -12
- package/core/lib/lantern/metrics/LargestContentfulPaint.test.js +42 -0
- package/core/lib/lantern/metrics/{max-potential-fid.d.ts → MaxPotentialFID.d.ts} +5 -6
- package/core/lib/lantern/metrics/{max-potential-fid.js → MaxPotentialFID.js} +8 -9
- package/core/lib/lantern/metrics/MetricTestUtils.d.ts +19 -0
- package/core/lib/lantern/metrics/MetricTestUtils.js +48 -0
- package/core/lib/lantern/metrics/{speed-index.d.ts → SpeedIndex.d.ts} +5 -6
- package/core/lib/lantern/metrics/{speed-index.js → SpeedIndex.js} +7 -9
- package/core/lib/lantern/metrics/SpeedIndex.test.js +83 -0
- package/core/lib/lantern/metrics/{total-blocking-time.d.ts → TotalBlockingTime.d.ts} +5 -6
- package/core/lib/lantern/metrics/{total-blocking-time.js → TotalBlockingTime.js} +9 -12
- package/core/lib/lantern/metrics/__snapshots__/first-contentful-paint-test.js.snap +11 -0
- package/core/lib/lantern/metrics/__snapshots__/interactive-test.js.snap +17 -0
- package/core/lib/lantern/metrics/metrics.d.ts +9 -0
- package/core/lib/lantern/metrics/metrics.js +16 -0
- package/core/lib/lantern/{simulator/connection-pool.d.ts → simulation/ConnectionPool.d.ts} +5 -5
- package/core/lib/lantern/{simulator/connection-pool.js → simulation/ConnectionPool.js} +3 -3
- package/core/lib/lantern/simulation/ConnectionPool.test.js +195 -0
- package/core/lib/lantern/simulation/Constants.d.ts +52 -0
- package/core/lib/lantern/simulation/Constants.js +48 -0
- package/core/lib/lantern/{simulator/dns-cache.d.ts → simulation/DNSCache.d.ts} +2 -2
- package/core/lib/lantern/{simulator/dns-cache.js → simulation/DNSCache.js} +1 -1
- package/core/lib/lantern/simulation/DNSCache.test.js +72 -0
- package/core/lib/lantern/{simulator/network-analyzer.d.ts → simulation/NetworkAnalyzer.d.ts} +2 -2
- package/core/lib/lantern/{simulator/network-analyzer.js → simulation/NetworkAnalyzer.js} +1 -1
- package/core/lib/lantern/simulation/NetworkAnalyzer.test.js +475 -0
- package/core/lib/lantern/{simulator/simulator-timing-map.d.ts → simulation/SimulationTimingMap.d.ts} +7 -7
- package/core/lib/lantern/{simulator/simulator-timing-map.js → simulation/SimulationTimingMap.js} +5 -6
- package/core/lib/lantern/{simulator/simulator.d.ts → simulation/Simulator.d.ts} +13 -15
- package/core/lib/lantern/{simulator/simulator.js → simulation/Simulator.js} +25 -26
- package/core/lib/lantern/simulation/Simulator.test.js +434 -0
- package/core/lib/lantern/simulation/TCPConnection.test.d.ts +2 -0
- package/core/lib/lantern/simulation/TCPConnection.test.js +374 -0
- package/core/lib/lantern/{simulator/tcp-connection.d.ts → simulation/TcpConnection.d.ts} +2 -2
- package/core/lib/lantern/{simulator/tcp-connection.js → simulation/TcpConnection.js} +1 -1
- package/core/lib/lantern/simulation/simulation.d.ts +21 -0
- package/core/lib/lantern/simulation/simulation.js +28 -0
- package/core/lib/lantern/types/lantern.d.ts +5 -5
- package/core/lib/lantern-trace-saver.d.ts +4 -4
- package/core/lib/lantern-trace-saver.js +2 -2
- package/core/lib/navigation-error.js +3 -3
- package/core/lib/network-recorder.js +2 -2
- package/core/lib/network-request.d.ts +1 -1
- package/core/lib/network-request.js +1 -1
- package/package.json +2 -2
- package/tsconfig.json +10 -8
- package/types/artifacts.d.ts +3 -4
- package/types/gatherer.d.ts +1 -1
- /package/core/lib/lantern/{lantern-error.js → LanternError.js} +0 -0
- /package/core/lib/lantern/{tbt-utils.js → TBTUtils.js} +0 -0
|
@@ -4,20 +4,18 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import * as Lantern from './
|
|
8
|
-
import {BaseNode} from './base-node.js';
|
|
9
|
-
import {RESOURCE_TYPES} from '../network-request.js';
|
|
7
|
+
import * as Lantern from './lantern.js';
|
|
10
8
|
|
|
11
|
-
/** @typedef {import('./
|
|
12
|
-
/** @typedef {import('./
|
|
13
|
-
/** @typedef {import('./
|
|
9
|
+
/** @typedef {import('./BaseNode.js').Node} Node */
|
|
10
|
+
/** @typedef {import('./NetworkNode.js').NetworkNode} NetworkNode */
|
|
11
|
+
/** @typedef {import('./simulation/Simulator.js').Simulator} Simulator */
|
|
14
12
|
|
|
15
13
|
/**
|
|
16
14
|
* @typedef Extras
|
|
17
15
|
* @property {boolean} optimistic
|
|
18
|
-
* @property {Lantern.
|
|
19
|
-
* @property {Lantern.
|
|
20
|
-
* @property {Lantern.
|
|
16
|
+
* @property {Lantern.Metrics.Result=} fcpResult
|
|
17
|
+
* @property {Lantern.Metrics.Result=} lcpResult
|
|
18
|
+
* @property {Lantern.Metrics.Result=} interactiveResult
|
|
21
19
|
* @property {number=} observedSpeedIndex
|
|
22
20
|
*/
|
|
23
21
|
|
|
@@ -32,8 +30,8 @@ class Metric {
|
|
|
32
30
|
const scriptUrls = new Set();
|
|
33
31
|
|
|
34
32
|
dependencyGraph.traverse(node => {
|
|
35
|
-
if (node.type !== BaseNode.TYPES.NETWORK) return;
|
|
36
|
-
if (node.request.resourceType !==
|
|
33
|
+
if (node.type !== Lantern.BaseNode.TYPES.NETWORK) return;
|
|
34
|
+
if (node.request.resourceType !== Lantern.NetworkRequestTypes.Script) return;
|
|
37
35
|
if (treatNodeAsRenderBlocking?.(node)) {
|
|
38
36
|
scriptUrls.add(node.request.url);
|
|
39
37
|
}
|
|
@@ -92,7 +90,7 @@ class Metric {
|
|
|
92
90
|
/**
|
|
93
91
|
* @param {Lantern.Simulation.MetricComputationDataInput} data
|
|
94
92
|
* @param {Omit<Extras, 'optimistic'>=} extras
|
|
95
|
-
* @return {Promise<Lantern.
|
|
93
|
+
* @return {Promise<Lantern.Metrics.Result>}
|
|
96
94
|
*/
|
|
97
95
|
static async compute(data, extras) {
|
|
98
96
|
const {simulator, graph, processedNavigation} = data;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @template [T=any]
|
|
3
|
-
* @extends {BaseNode<T>}
|
|
3
|
+
* @extends {Lantern.BaseNode<T>}
|
|
4
4
|
*/
|
|
5
|
-
export class NetworkNode<T = any> extends BaseNode<T> {
|
|
5
|
+
export class NetworkNode<T = any> extends Lantern.BaseNode<T> {
|
|
6
6
|
/**
|
|
7
7
|
* @param {Lantern.NetworkRequest<T>} networkRequest
|
|
8
8
|
*/
|
|
@@ -45,6 +45,5 @@ export class NetworkNode<T = any> extends BaseNode<T> {
|
|
|
45
45
|
*/
|
|
46
46
|
cloneWithoutRelationships(): NetworkNode<T>;
|
|
47
47
|
}
|
|
48
|
-
import
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=network-node.d.ts.map
|
|
48
|
+
import * as Lantern from './lantern.js';
|
|
49
|
+
//# sourceMappingURL=NetworkNode.d.ts.map
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import * as Lantern from './
|
|
7
|
+
import * as Lantern from './lantern.js';
|
|
8
8
|
import {NetworkRequestTypes} from './lantern.js';
|
|
9
|
-
import {BaseNode} from './base-node.js';
|
|
10
9
|
|
|
11
10
|
const NON_NETWORK_SCHEMES = [
|
|
12
11
|
'blob', // @see https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL
|
|
@@ -35,9 +34,9 @@ function isNonNetworkProtocol(protocol) {
|
|
|
35
34
|
|
|
36
35
|
/**
|
|
37
36
|
* @template [T=any]
|
|
38
|
-
* @extends {BaseNode<T>}
|
|
37
|
+
* @extends {Lantern.BaseNode<T>}
|
|
39
38
|
*/
|
|
40
|
-
class NetworkNode extends BaseNode {
|
|
39
|
+
class NetworkNode extends Lantern.BaseNode {
|
|
41
40
|
/**
|
|
42
41
|
* @param {Lantern.NetworkRequest<T>} networkRequest
|
|
43
42
|
*/
|
|
@@ -48,7 +47,7 @@ class NetworkNode extends BaseNode {
|
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
get type() {
|
|
51
|
-
return BaseNode.TYPES.NETWORK;
|
|
50
|
+
return Lantern.BaseNode.TYPES.NETWORK;
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type Node = import('./
|
|
1
|
+
export type Node = import('./BaseNode.js').Node;
|
|
2
2
|
export type NetworkNodeOutput = {
|
|
3
3
|
nodes: Array<NetworkNode>;
|
|
4
4
|
idToNodeMap: Map<string, NetworkNode>;
|
|
@@ -76,7 +76,7 @@ export class PageDependencyGraph {
|
|
|
76
76
|
*/
|
|
77
77
|
static printGraph(rootNode: Node, widthInCharacters?: number): void;
|
|
78
78
|
}
|
|
79
|
-
import { NetworkNode } from './
|
|
80
|
-
import * as Lantern from './
|
|
81
|
-
import { CPUNode } from './
|
|
82
|
-
//# sourceMappingURL=
|
|
79
|
+
import { NetworkNode } from './NetworkNode.js';
|
|
80
|
+
import * as Lantern from './lantern.js';
|
|
81
|
+
import { CPUNode } from './CpuNode.js';
|
|
82
|
+
//# sourceMappingURL=PageDependencyGraph.d.ts.map
|
|
@@ -4,11 +4,9 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import * as Lantern from './
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {CPUNode} from './cpu-node.js';
|
|
11
|
-
import {NetworkAnalyzer} from './simulator/network-analyzer.js';
|
|
7
|
+
import * as Lantern from './lantern.js';
|
|
8
|
+
import {NetworkNode} from './NetworkNode.js';
|
|
9
|
+
import {CPUNode} from './CpuNode.js';
|
|
12
10
|
|
|
13
11
|
// COMPAT: m71+ We added RunTask to `disabled-by-default-lighthouse`
|
|
14
12
|
const SCHEDULABLE_TASK_TITLE_LH = 'RunTask';
|
|
@@ -19,7 +17,7 @@ const SCHEDULABLE_TASK_TITLE_ALT2 = 'ThreadControllerImpl::DoWork';
|
|
|
19
17
|
// m65 and earlier
|
|
20
18
|
const SCHEDULABLE_TASK_TITLE_ALT3 = 'TaskQueueManager::ProcessTaskFromWorkQueue';
|
|
21
19
|
|
|
22
|
-
/** @typedef {import('./
|
|
20
|
+
/** @typedef {import('./BaseNode.js').Node} Node */
|
|
23
21
|
|
|
24
22
|
/**
|
|
25
23
|
* @typedef {Object} NetworkNodeOutput
|
|
@@ -104,7 +102,7 @@ class PageDependencyGraph {
|
|
|
104
102
|
// If the request was for the root document of an iframe, save an entry in our
|
|
105
103
|
// map so we can link up the task `args.data.frame` dependencies later in graph creation.
|
|
106
104
|
if (request.frameId &&
|
|
107
|
-
request.resourceType === NetworkRequestTypes.Document &&
|
|
105
|
+
request.resourceType === Lantern.NetworkRequestTypes.Document &&
|
|
108
106
|
request.documentURL === request.url) {
|
|
109
107
|
// If there's ever any ambiguity, permanently set the value to `false` to avoid loops in the graph.
|
|
110
108
|
const value = frameIdToNodeMap.has(request.frameId) ? null : node;
|
|
@@ -245,7 +243,9 @@ class PageDependencyGraph {
|
|
|
245
243
|
static linkCPUNodes(rootNode, networkNodeOutput, cpuNodes) {
|
|
246
244
|
/** @type {Set<Lantern.ResourceType|undefined>} */
|
|
247
245
|
const linkableResourceTypes = new Set([
|
|
248
|
-
NetworkRequestTypes.XHR,
|
|
246
|
+
Lantern.NetworkRequestTypes.XHR,
|
|
247
|
+
Lantern.NetworkRequestTypes.Fetch,
|
|
248
|
+
Lantern.NetworkRequestTypes.Script,
|
|
249
249
|
]);
|
|
250
250
|
|
|
251
251
|
/** @param {CPUNode} cpuNode @param {string} reqId */
|
|
@@ -553,12 +553,13 @@ class PageDependencyGraph {
|
|
|
553
553
|
if (!requestedUrl) throw new Error('requestedUrl is required to get the root request');
|
|
554
554
|
if (!mainDocumentUrl) throw new Error('mainDocumentUrl is required to get the main resource');
|
|
555
555
|
|
|
556
|
-
const rootRequest =
|
|
556
|
+
const rootRequest =
|
|
557
|
+
Lantern.Simulation.NetworkAnalyzer.findResourceForUrl(networkRequests, requestedUrl);
|
|
557
558
|
if (!rootRequest) throw new Error('rootRequest not found');
|
|
558
559
|
const rootNode = networkNodeOutput.idToNodeMap.get(rootRequest.requestId);
|
|
559
560
|
if (!rootNode) throw new Error('rootNode not found');
|
|
560
561
|
const mainDocumentRequest =
|
|
561
|
-
NetworkAnalyzer.findLastDocumentForUrl(networkRequests, mainDocumentUrl);
|
|
562
|
+
Lantern.Simulation.NetworkAnalyzer.findLastDocumentForUrl(networkRequests, mainDocumentUrl);
|
|
562
563
|
if (!mainDocumentRequest) throw new Error('mainDocumentRequest not found');
|
|
563
564
|
const mainDocumentNode = networkNodeOutput.idToNodeMap.get(mainDocumentRequest.requestId);
|
|
564
565
|
if (!mainDocumentNode) throw new Error('mainDocumentNode not found');
|