lighthouse 11.6.0 → 11.7.0
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/cli/test/smokehouse/core-tests.js +2 -2
- 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/metrics/interaction-to-next-paint.js +1 -3
- package/core/audits/prioritize-lcp-image.d.ts +1 -1
- package/core/audits/work-during-interaction.js +0 -8
- package/core/computed/document-urls.js +1 -1
- package/core/computed/load-simulator.d.ts +2 -2
- package/core/computed/load-simulator.js +3 -2
- package/core/computed/main-resource.js +1 -1
- package/core/computed/metrics/lantern-first-contentful-paint.d.ts +18 -6
- package/core/computed/metrics/lantern-first-contentful-paint.js +4 -4
- package/core/computed/metrics/lantern-first-meaningful-paint.d.ts +14 -2
- package/core/computed/metrics/lantern-first-meaningful-paint.js +1 -1
- package/core/computed/metrics/lantern-interactive.d.ts +8 -6
- package/core/computed/metrics/lantern-interactive.js +3 -3
- package/core/computed/metrics/lantern-largest-contentful-paint.d.ts +14 -2
- package/core/computed/metrics/lantern-largest-contentful-paint.js +1 -1
- package/core/computed/metrics/lantern-max-potential-fid.d.ts +8 -2
- package/core/computed/metrics/lantern-max-potential-fid.js +3 -3
- package/core/computed/metrics/lantern-metric.d.ts +4 -63
- package/core/computed/metrics/lantern-metric.js +6 -124
- package/core/computed/metrics/lantern-speed-index.d.ts +8 -2
- package/core/computed/metrics/lantern-speed-index.js +3 -3
- package/core/computed/metrics/lantern-total-blocking-time.d.ts +8 -2
- package/core/computed/metrics/lantern-total-blocking-time.js +3 -3
- package/core/computed/metrics/responsiveness.d.ts +5 -13
- package/core/computed/metrics/responsiveness.js +10 -14
- 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/config/config-helpers.js +1 -1
- package/core/gather/driver/execution-context.d.ts +2 -1
- package/core/gather/driver/execution-context.js +9 -9
- package/core/gather/driver/wait-for-condition.js +4 -2
- package/core/gather/gatherers/accessibility.js +2 -1
- package/core/gather/gatherers/css-usage.d.ts +1 -9
- package/core/gather/gatherers/css-usage.js +23 -25
- package/core/gather/gatherers/devtools-log.d.ts +4 -0
- package/core/gather/gatherers/devtools-log.js +7 -0
- package/core/gather/gatherers/full-page-screenshot.d.ts +4 -0
- package/core/gather/gatherers/full-page-screenshot.js +31 -35
- package/core/gather/gatherers/root-causes.js +1 -3
- package/core/gather/gatherers/trace-elements.js +1 -1
- package/core/gather/gatherers/trace.d.ts +1 -0
- package/core/gather/gatherers/trace.js +4 -0
- package/core/gather/navigation-runner.js +49 -62
- package/core/gather/session.js +5 -0
- package/core/gather/snapshot-runner.js +25 -25
- package/core/gather/timespan-runner.js +24 -25
- package/core/lib/asset-saver.js +1 -1
- package/core/lib/emulation.js +0 -3
- 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/lantern/metric.d.ts +71 -0
- package/core/lib/lantern/metric.js +143 -0
- package/core/lib/{dependency-graph → lantern}/network-node.d.ts +17 -10
- package/core/lib/lantern/network-node.js +114 -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 +14 -14
- package/core/lib/{dependency-graph → lantern}/simulator/connection-pool.js +7 -7
- package/core/lib/{dependency-graph → lantern}/simulator/dns-cache.d.ts +5 -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 +21 -17
- package/core/lib/{dependency-graph → lantern}/simulator/simulator.d.ts +18 -15
- package/core/lib/{dependency-graph → lantern}/simulator/simulator.js +18 -15
- package/core/lib/lantern/types/lantern.d.ts +129 -0
- package/core/lib/lantern/types/lantern.js +7 -0
- 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 +2 -2
- package/core/lib/network-request.d.ts +6 -0
- package/core/lib/network-request.js +12 -0
- package/package.json +4 -5
- package/shared/localization/locales/ar-XB.json +1 -1
- package/shared/localization/locales/ar.json +1 -1
- package/shared/localization/locales/bg.json +1 -1
- package/shared/localization/locales/ca.json +1 -1
- package/shared/localization/locales/cs.json +1 -1
- package/shared/localization/locales/da.json +2 -2
- package/shared/localization/locales/de.json +1 -1
- package/shared/localization/locales/el.json +1 -1
- package/shared/localization/locales/en-GB.json +1 -1
- package/shared/localization/locales/en-US.json +3 -0
- package/shared/localization/locales/en-XA.json +1 -1
- package/shared/localization/locales/en-XL.json +3 -0
- package/shared/localization/locales/es-419.json +1 -1
- package/shared/localization/locales/es.json +1 -1
- package/shared/localization/locales/fi.json +1 -1
- package/shared/localization/locales/fil.json +1 -1
- package/shared/localization/locales/he.json +1 -1
- package/shared/localization/locales/hi.json +1 -1
- package/shared/localization/locales/hr.json +1 -1
- package/shared/localization/locales/hu.json +1 -1
- package/shared/localization/locales/id.json +1 -1
- package/shared/localization/locales/it.json +1 -1
- package/shared/localization/locales/ko.json +1 -1
- package/shared/localization/locales/lt.json +1 -1
- package/shared/localization/locales/nl.json +1 -1
- package/shared/localization/locales/no.json +1 -1
- package/shared/localization/locales/pl.json +1 -1
- package/shared/localization/locales/pt-PT.json +1 -1
- package/shared/localization/locales/pt.json +1 -1
- package/shared/localization/locales/ro.json +1 -1
- package/shared/localization/locales/sk.json +1 -1
- package/shared/localization/locales/sl.json +1 -1
- package/shared/localization/locales/sr-Latn.json +1 -1
- package/shared/localization/locales/sr.json +1 -1
- package/shared/localization/locales/sv.json +1 -1
- package/shared/localization/locales/ta.json +1 -1
- package/shared/localization/locales/te.json +1 -1
- package/shared/localization/locales/th.json +4 -4
- package/shared/localization/locales/tr.json +1 -1
- package/shared/localization/locales/uk.json +1 -1
- package/shared/localization/locales/vi.json +1 -1
- package/shared/localization/locales/zh-HK.json +1 -1
- package/shared/localization/locales/zh-TW.json +1 -1
- package/shared/localization/locales/zh.json +1 -1
- package/third-party/chromium-synchronization/installability-errors-test.js +1 -1
- package/tsconfig.json +7 -5
- package/types/artifacts.d.ts +1 -1
- package/types/gatherer.d.ts +8 -35
- package/types/lhr/lhr.d.ts +1 -1
- 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
|
@@ -1,65 +1,6 @@
|
|
|
1
|
-
export type
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export type Extras = {
|
|
5
|
-
optimistic: boolean;
|
|
6
|
-
fcpResult?: LH.Artifacts.LanternMetric | undefined;
|
|
7
|
-
fmpResult?: LH.Artifacts.LanternMetric | undefined;
|
|
8
|
-
interactiveResult?: LH.Artifacts.LanternMetric | undefined;
|
|
9
|
-
speedline?: {
|
|
10
|
-
speedIndex: number;
|
|
11
|
-
} | undefined;
|
|
12
|
-
};
|
|
13
|
-
/** @typedef {import('../../lib/dependency-graph/base-node.js').Node} Node */
|
|
14
|
-
/** @typedef {import('../../lib/dependency-graph/network-node').NetworkNode} NetworkNode */
|
|
15
|
-
/** @typedef {import('../../lib/dependency-graph/simulator/simulator').Simulator} Simulator */
|
|
16
|
-
/**
|
|
17
|
-
* @typedef Extras
|
|
18
|
-
* @property {boolean} optimistic
|
|
19
|
-
* @property {LH.Artifacts.LanternMetric=} fcpResult
|
|
20
|
-
* @property {LH.Artifacts.LanternMetric=} fmpResult
|
|
21
|
-
* @property {LH.Artifacts.LanternMetric=} interactiveResult
|
|
22
|
-
* @property {{speedIndex: number}=} speedline
|
|
23
|
-
*/
|
|
24
|
-
export class LanternMetric {
|
|
25
|
-
/**
|
|
26
|
-
* @param {Node} dependencyGraph
|
|
27
|
-
* @param {function(NetworkNode):boolean=} treatNodeAsRenderBlocking
|
|
28
|
-
* @return {Set<string>}
|
|
29
|
-
*/
|
|
30
|
-
static getScriptUrls(dependencyGraph: Node, treatNodeAsRenderBlocking?: ((arg0: NetworkNode) => boolean) | undefined): Set<string>;
|
|
31
|
-
/**
|
|
32
|
-
* @return {LH.Gatherer.Simulation.MetricCoefficients}
|
|
33
|
-
*/
|
|
34
|
-
static get COEFFICIENTS(): import("../../../types/gatherer.js").default.Simulation.MetricCoefficients;
|
|
35
|
-
/**
|
|
36
|
-
* Returns the coefficients, scaled by the throttling settings if needed by the metric.
|
|
37
|
-
* Some lantern metrics (speed-index) use components in their estimate that are not
|
|
38
|
-
* from the simulator. In this case, we need to adjust the coefficients as the target throttling
|
|
39
|
-
* settings change.
|
|
40
|
-
*
|
|
41
|
-
* @param {number} rttMs
|
|
42
|
-
* @return {LH.Gatherer.Simulation.MetricCoefficients}
|
|
43
|
-
*/
|
|
44
|
-
static getScaledCoefficients(rttMs: number): LH.Gatherer.Simulation.MetricCoefficients;
|
|
45
|
-
/**
|
|
46
|
-
* @param {Node} dependencyGraph
|
|
47
|
-
* @param {LH.Artifacts.ProcessedNavigation} processedNavigation
|
|
48
|
-
* @return {Node}
|
|
49
|
-
*/
|
|
50
|
-
static getOptimisticGraph(dependencyGraph: Node, processedNavigation: LH.Artifacts.ProcessedNavigation): Node;
|
|
51
|
-
/**
|
|
52
|
-
* @param {Node} dependencyGraph
|
|
53
|
-
* @param {LH.Artifacts.ProcessedNavigation} processedNavigation
|
|
54
|
-
* @return {Node}
|
|
55
|
-
*/
|
|
56
|
-
static getPessimisticGraph(dependencyGraph: Node, processedNavigation: LH.Artifacts.ProcessedNavigation): Node;
|
|
57
|
-
/**
|
|
58
|
-
* @param {LH.Gatherer.Simulation.Result} simulationResult
|
|
59
|
-
* @param {Extras} extras
|
|
60
|
-
* @return {LH.Gatherer.Simulation.Result}
|
|
61
|
-
*/
|
|
62
|
-
static getEstimateFromSimulation(simulationResult: LH.Gatherer.Simulation.Result, extras: Extras): LH.Gatherer.Simulation.Result;
|
|
1
|
+
export type Extras = import('../../lib/lantern/metric.js').Extras;
|
|
2
|
+
/** @typedef {import('../../lib/lantern/metric.js').Extras} Extras */
|
|
3
|
+
export class LanternMetric extends Metric {
|
|
63
4
|
/**
|
|
64
5
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
65
6
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -74,5 +15,5 @@ export class LanternMetric {
|
|
|
74
15
|
*/
|
|
75
16
|
static compute_(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.LanternMetric>;
|
|
76
17
|
}
|
|
77
|
-
import {
|
|
18
|
+
import { Metric } from '../../lib/lantern/metric.js';
|
|
78
19
|
//# sourceMappingURL=lantern-metric.d.ts.map
|
|
@@ -4,93 +4,14 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {NetworkRequest} from '../../lib/network-request.js';
|
|
9
|
-
import {ProcessedNavigation} from '../processed-navigation.js';
|
|
10
|
-
import {PageDependencyGraph} from '../page-dependency-graph.js';
|
|
7
|
+
import {Metric} from '../../lib/lantern/metric.js';
|
|
11
8
|
import {LoadSimulator} from '../load-simulator.js';
|
|
9
|
+
import {PageDependencyGraph} from '../page-dependency-graph.js';
|
|
10
|
+
import {ProcessedNavigation} from '../processed-navigation.js';
|
|
12
11
|
|
|
13
|
-
/** @typedef {import('../../lib/
|
|
14
|
-
/** @typedef {import('../../lib/dependency-graph/network-node').NetworkNode} NetworkNode */
|
|
15
|
-
/** @typedef {import('../../lib/dependency-graph/simulator/simulator').Simulator} Simulator */
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @typedef Extras
|
|
19
|
-
* @property {boolean} optimistic
|
|
20
|
-
* @property {LH.Artifacts.LanternMetric=} fcpResult
|
|
21
|
-
* @property {LH.Artifacts.LanternMetric=} fmpResult
|
|
22
|
-
* @property {LH.Artifacts.LanternMetric=} interactiveResult
|
|
23
|
-
* @property {{speedIndex: number}=} speedline
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
class LanternMetric {
|
|
27
|
-
/**
|
|
28
|
-
* @param {Node} dependencyGraph
|
|
29
|
-
* @param {function(NetworkNode):boolean=} treatNodeAsRenderBlocking
|
|
30
|
-
* @return {Set<string>}
|
|
31
|
-
*/
|
|
32
|
-
static getScriptUrls(dependencyGraph, treatNodeAsRenderBlocking) {
|
|
33
|
-
/** @type {Set<string>} */
|
|
34
|
-
const scriptUrls = new Set();
|
|
35
|
-
|
|
36
|
-
dependencyGraph.traverse(node => {
|
|
37
|
-
if (node.type !== BaseNode.TYPES.NETWORK) return;
|
|
38
|
-
if (node.record.resourceType !== NetworkRequest.TYPES.Script) return;
|
|
39
|
-
if (treatNodeAsRenderBlocking?.(node)) {
|
|
40
|
-
scriptUrls.add(node.record.url);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
return scriptUrls;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @return {LH.Gatherer.Simulation.MetricCoefficients}
|
|
49
|
-
*/
|
|
50
|
-
static get COEFFICIENTS() {
|
|
51
|
-
throw new Error('COEFFICIENTS unimplemented!');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Returns the coefficients, scaled by the throttling settings if needed by the metric.
|
|
56
|
-
* Some lantern metrics (speed-index) use components in their estimate that are not
|
|
57
|
-
* from the simulator. In this case, we need to adjust the coefficients as the target throttling
|
|
58
|
-
* settings change.
|
|
59
|
-
*
|
|
60
|
-
* @param {number} rttMs
|
|
61
|
-
* @return {LH.Gatherer.Simulation.MetricCoefficients}
|
|
62
|
-
*/
|
|
63
|
-
static getScaledCoefficients(rttMs) { // eslint-disable-line no-unused-vars
|
|
64
|
-
return this.COEFFICIENTS;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @param {Node} dependencyGraph
|
|
69
|
-
* @param {LH.Artifacts.ProcessedNavigation} processedNavigation
|
|
70
|
-
* @return {Node}
|
|
71
|
-
*/
|
|
72
|
-
static getOptimisticGraph(dependencyGraph, processedNavigation) { // eslint-disable-line no-unused-vars
|
|
73
|
-
throw new Error('Optimistic graph unimplemented!');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @param {Node} dependencyGraph
|
|
78
|
-
* @param {LH.Artifacts.ProcessedNavigation} processedNavigation
|
|
79
|
-
* @return {Node}
|
|
80
|
-
*/
|
|
81
|
-
static getPessimisticGraph(dependencyGraph, processedNavigation) { // eslint-disable-line no-unused-vars
|
|
82
|
-
throw new Error('Pessmistic graph unimplemented!');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* @param {LH.Gatherer.Simulation.Result} simulationResult
|
|
87
|
-
* @param {Extras} extras
|
|
88
|
-
* @return {LH.Gatherer.Simulation.Result}
|
|
89
|
-
*/
|
|
90
|
-
static getEstimateFromSimulation(simulationResult, extras) { // eslint-disable-line no-unused-vars
|
|
91
|
-
return simulationResult;
|
|
92
|
-
}
|
|
12
|
+
/** @typedef {import('../../lib/lantern/metric.js').Extras} Extras */
|
|
93
13
|
|
|
14
|
+
class LanternMetric extends Metric {
|
|
94
15
|
/**
|
|
95
16
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
96
17
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -104,50 +25,11 @@ class LanternMetric {
|
|
|
104
25
|
throw new Error(`Lantern metrics can only be computed on navigations`);
|
|
105
26
|
}
|
|
106
27
|
|
|
107
|
-
const metricName = this.name.replace('Lantern', '');
|
|
108
28
|
const graph = await PageDependencyGraph.request(data, context);
|
|
109
29
|
const processedNavigation = await ProcessedNavigation.request(data.trace, context);
|
|
110
30
|
const simulator = data.simulator || (await LoadSimulator.request(data, context));
|
|
111
31
|
|
|
112
|
-
|
|
113
|
-
const pessimisticGraph = this.getPessimisticGraph(graph, processedNavigation);
|
|
114
|
-
|
|
115
|
-
/** @type {{flexibleOrdering?: boolean, label?: string}} */
|
|
116
|
-
let simulateOptions = {label: `optimistic${metricName}`};
|
|
117
|
-
const optimisticSimulation = simulator.simulate(optimisticGraph, simulateOptions);
|
|
118
|
-
|
|
119
|
-
simulateOptions = {label: `optimisticFlex${metricName}`, flexibleOrdering: true};
|
|
120
|
-
const optimisticFlexSimulation = simulator.simulate(optimisticGraph, simulateOptions);
|
|
121
|
-
|
|
122
|
-
simulateOptions = {label: `pessimistic${metricName}`};
|
|
123
|
-
const pessimisticSimulation = simulator.simulate(pessimisticGraph, simulateOptions);
|
|
124
|
-
|
|
125
|
-
const optimisticEstimate = this.getEstimateFromSimulation(
|
|
126
|
-
optimisticSimulation.timeInMs < optimisticFlexSimulation.timeInMs ?
|
|
127
|
-
optimisticSimulation : optimisticFlexSimulation, {...extras, optimistic: true}
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
const pessimisticEstimate = this.getEstimateFromSimulation(
|
|
131
|
-
pessimisticSimulation,
|
|
132
|
-
{...extras, optimistic: false}
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
const coefficients = this.getScaledCoefficients(simulator.rtt);
|
|
136
|
-
// Estimates under 1s don't really follow the normal curve fit, minimize the impact of the intercept
|
|
137
|
-
const interceptMultiplier = coefficients.intercept > 0 ?
|
|
138
|
-
Math.min(1, optimisticEstimate.timeInMs / 1000) : 1;
|
|
139
|
-
const timing =
|
|
140
|
-
coefficients.intercept * interceptMultiplier +
|
|
141
|
-
coefficients.optimistic * optimisticEstimate.timeInMs +
|
|
142
|
-
coefficients.pessimistic * pessimisticEstimate.timeInMs;
|
|
143
|
-
|
|
144
|
-
return {
|
|
145
|
-
timing,
|
|
146
|
-
optimisticEstimate,
|
|
147
|
-
pessimisticEstimate,
|
|
148
|
-
optimisticGraph,
|
|
149
|
-
pessimisticGraph,
|
|
150
|
-
};
|
|
32
|
+
return this.compute({simulator, graph, processedNavigation}, extras);
|
|
151
33
|
}
|
|
152
34
|
|
|
153
35
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { LanternSpeedIndexComputed as LanternSpeedIndex };
|
|
2
|
-
export type Node = import('../../lib/
|
|
2
|
+
export type Node = import('../../lib/lantern/base-node.js').Node<LH.Artifacts.NetworkRequest>;
|
|
3
3
|
declare const LanternSpeedIndexComputed: typeof LanternSpeedIndex & {
|
|
4
4
|
request: (dependencies: import("../../index.js").Artifacts.MetricComputationDataInput, context: import("../../../types/utility-types.js").default.ImmutableObject<{
|
|
5
5
|
computedCache: Map<string, import("../../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
6
6
|
}>) => Promise<import("../../index.js").Artifacts.LanternMetric>;
|
|
7
7
|
};
|
|
8
|
-
/** @typedef {import('../../lib/
|
|
8
|
+
/** @typedef {import('../../lib/lantern/base-node.js').Node<LH.Artifacts.NetworkRequest>} Node */
|
|
9
9
|
declare class LanternSpeedIndex extends LanternMetric {
|
|
10
10
|
/**
|
|
11
11
|
* @param {Node} dependencyGraph
|
|
@@ -17,6 +17,12 @@ declare class LanternSpeedIndex extends LanternMetric {
|
|
|
17
17
|
* @return {Node}
|
|
18
18
|
*/
|
|
19
19
|
static getPessimisticGraph(dependencyGraph: Node): Node;
|
|
20
|
+
/**
|
|
21
|
+
* @param {LH.Gatherer.Simulation.Result} simulationResult
|
|
22
|
+
* @param {import('../../lib/lantern/metric.js').Extras} extras
|
|
23
|
+
* @return {LH.Gatherer.Simulation.Result}
|
|
24
|
+
*/
|
|
25
|
+
static getEstimateFromSimulation(simulationResult: LH.Gatherer.Simulation.Result, extras: import('../../lib/lantern/metric.js').Extras): LH.Gatherer.Simulation.Result;
|
|
20
26
|
/**
|
|
21
27
|
* Approximate speed index using layout events from the simulated node timings.
|
|
22
28
|
* The layout-based speed index is the weighted average of the endTime of CPU nodes that contained
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
import {makeComputedArtifact} from '../computed-artifact.js';
|
|
8
8
|
import {LanternMetric} from './lantern-metric.js';
|
|
9
|
-
import {BaseNode} from '../../lib/
|
|
9
|
+
import {BaseNode} from '../../lib/lantern/base-node.js';
|
|
10
10
|
import {Speedline} from '../speedline.js';
|
|
11
11
|
import {LanternFirstContentfulPaint} from './lantern-first-contentful-paint.js';
|
|
12
12
|
import {throttling as defaultThrottling} from '../../config/constants.js';
|
|
13
13
|
|
|
14
|
-
/** @typedef {import('../../lib/
|
|
14
|
+
/** @typedef {import('../../lib/lantern/base-node.js').Node<LH.Artifacts.NetworkRequest>} Node */
|
|
15
15
|
|
|
16
16
|
class LanternSpeedIndex extends LanternMetric {
|
|
17
17
|
/**
|
|
@@ -73,7 +73,7 @@ class LanternSpeedIndex extends LanternMetric {
|
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* @param {LH.Gatherer.Simulation.Result} simulationResult
|
|
76
|
-
* @param {import('
|
|
76
|
+
* @param {import('../../lib/lantern/metric.js').Extras} extras
|
|
77
77
|
* @return {LH.Gatherer.Simulation.Result}
|
|
78
78
|
*/
|
|
79
79
|
static getEstimateFromSimulation(simulationResult, extras) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { LanternTotalBlockingTimeComputed as LanternTotalBlockingTime };
|
|
2
|
-
export type Node = import('../../lib/
|
|
2
|
+
export type Node = import('../../lib/lantern/base-node.js').Node<LH.Artifacts.NetworkRequest>;
|
|
3
3
|
declare const LanternTotalBlockingTimeComputed: typeof LanternTotalBlockingTime & {
|
|
4
4
|
request: (dependencies: import("../../index.js").Artifacts.MetricComputationDataInput, context: import("../../../types/utility-types.js").default.ImmutableObject<{
|
|
5
5
|
computedCache: Map<string, import("../../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
6
6
|
}>) => Promise<import("../../index.js").Artifacts.LanternMetric>;
|
|
7
7
|
};
|
|
8
|
-
/** @typedef {import('../../lib/
|
|
8
|
+
/** @typedef {import('../../lib/lantern/base-node.js').Node<LH.Artifacts.NetworkRequest>} Node */
|
|
9
9
|
declare class LanternTotalBlockingTime extends LanternMetric {
|
|
10
10
|
/**
|
|
11
11
|
* @param {Node} dependencyGraph
|
|
@@ -17,6 +17,12 @@ declare class LanternTotalBlockingTime extends LanternMetric {
|
|
|
17
17
|
* @return {Node}
|
|
18
18
|
*/
|
|
19
19
|
static getPessimisticGraph(dependencyGraph: Node): Node;
|
|
20
|
+
/**
|
|
21
|
+
* @param {LH.Gatherer.Simulation.Result} simulation
|
|
22
|
+
* @param {import('../../lib/lantern/metric.js').Extras} extras
|
|
23
|
+
* @return {LH.Gatherer.Simulation.Result}
|
|
24
|
+
*/
|
|
25
|
+
static getEstimateFromSimulation(simulation: LH.Gatherer.Simulation.Result, extras: import('../../lib/lantern/metric.js').Extras): LH.Gatherer.Simulation.Result;
|
|
20
26
|
/**
|
|
21
27
|
* @param {LH.Gatherer.Simulation.Result['nodeTimings']} nodeTimings
|
|
22
28
|
* @param {number} minDurationMs
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
import {makeComputedArtifact} from '../computed-artifact.js';
|
|
8
8
|
import {LanternMetric} from './lantern-metric.js';
|
|
9
|
-
import {BaseNode} from '../../lib/
|
|
9
|
+
import {BaseNode} from '../../lib/lantern/base-node.js';
|
|
10
10
|
import {LanternFirstContentfulPaint} from './lantern-first-contentful-paint.js';
|
|
11
11
|
import {LanternInteractive} from './lantern-interactive.js';
|
|
12
12
|
import {BLOCKING_TIME_THRESHOLD, calculateSumOfBlockingTime} from './tbt-utils.js';
|
|
13
13
|
|
|
14
|
-
/** @typedef {import('../../lib/
|
|
14
|
+
/** @typedef {import('../../lib/lantern/base-node.js').Node<LH.Artifacts.NetworkRequest>} Node */
|
|
15
15
|
|
|
16
16
|
class LanternTotalBlockingTime extends LanternMetric {
|
|
17
17
|
/**
|
|
@@ -43,7 +43,7 @@ class LanternTotalBlockingTime extends LanternMetric {
|
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* @param {LH.Gatherer.Simulation.Result} simulation
|
|
46
|
-
* @param {import('
|
|
46
|
+
* @param {import('../../lib/lantern/metric.js').Extras} extras
|
|
47
47
|
* @return {LH.Gatherer.Simulation.Result}
|
|
48
48
|
*/
|
|
49
49
|
static getEstimateFromSimulation(simulation, extras) {
|
|
@@ -38,21 +38,13 @@ export type EventTimingEvent = LH.Trace.AsyncEvent & {
|
|
|
38
38
|
data: EventTimingData;
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
|
-
/**
|
|
42
|
-
* A fallback EventTiming placeholder, used if updated EventTiming events are not available.
|
|
43
|
-
* TODO: Remove once 103.0.5052.0 is sufficiently released.
|
|
44
|
-
*/
|
|
45
|
-
export type FallbackTimingEvent = {
|
|
46
|
-
name: 'FallbackTiming';
|
|
47
|
-
duration: number;
|
|
48
|
-
};
|
|
49
41
|
declare const ResponsivenessComputed: typeof Responsiveness & {
|
|
50
42
|
request: (dependencies: {
|
|
51
43
|
trace: LH.Trace;
|
|
52
44
|
settings: LH.Audit.Context['settings'];
|
|
53
45
|
}, context: import("../../../types/utility-types.js").default.ImmutableObject<{
|
|
54
46
|
computedCache: Map<string, import("../../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
55
|
-
}>) => Promise<EventTimingEvent |
|
|
47
|
+
}>) => Promise<EventTimingEvent | null>;
|
|
56
48
|
};
|
|
57
49
|
declare class Responsiveness {
|
|
58
50
|
/**
|
|
@@ -70,18 +62,18 @@ declare class Responsiveness {
|
|
|
70
62
|
* one interaction had this duration by returning the first found.
|
|
71
63
|
* @param {ResponsivenessEvent} responsivenessEvent
|
|
72
64
|
* @param {LH.Trace} trace
|
|
73
|
-
* @return {EventTimingEvent
|
|
65
|
+
* @return {EventTimingEvent}
|
|
74
66
|
*/
|
|
75
|
-
static findInteractionEvent(responsivenessEvent: ResponsivenessEvent, { traceEvents }: LH.Trace): EventTimingEvent
|
|
67
|
+
static findInteractionEvent(responsivenessEvent: ResponsivenessEvent, { traceEvents }: LH.Trace): EventTimingEvent;
|
|
76
68
|
/**
|
|
77
69
|
* @param {{trace: LH.Trace, settings: LH.Audit.Context['settings']}} data
|
|
78
70
|
* @param {LH.Artifacts.ComputedContext} context
|
|
79
|
-
* @return {Promise<EventTimingEvent|
|
|
71
|
+
* @return {Promise<EventTimingEvent|null>}
|
|
80
72
|
*/
|
|
81
73
|
static compute_(data: {
|
|
82
74
|
trace: LH.Trace;
|
|
83
75
|
settings: LH.Audit.Context['settings'];
|
|
84
|
-
}, context: LH.Artifacts.ComputedContext): Promise<EventTimingEvent |
|
|
76
|
+
}, context: LH.Artifacts.ComputedContext): Promise<EventTimingEvent | null>;
|
|
85
77
|
}
|
|
86
78
|
import { ProcessedTrace } from '../processed-trace.js';
|
|
87
79
|
//# sourceMappingURL=responsiveness.d.ts.map
|
|
@@ -24,14 +24,10 @@
|
|
|
24
24
|
* @property {number} interactionId
|
|
25
25
|
*/
|
|
26
26
|
/** @typedef {LH.Trace.AsyncEvent & {name: 'EventTiming', args: {data: EventTimingData}}} EventTimingEvent */
|
|
27
|
-
/**
|
|
28
|
-
* A fallback EventTiming placeholder, used if updated EventTiming events are not available.
|
|
29
|
-
* TODO: Remove once 103.0.5052.0 is sufficiently released.
|
|
30
|
-
* @typedef {{name: 'FallbackTiming', duration: number}} FallbackTimingEvent
|
|
31
|
-
*/
|
|
32
27
|
|
|
33
28
|
import {ProcessedTrace} from '../processed-trace.js';
|
|
34
29
|
import {makeComputedArtifact} from '../computed-artifact.js';
|
|
30
|
+
import {LighthouseError} from '../../lib/lh-error.js';
|
|
35
31
|
|
|
36
32
|
const KEYBOARD_EVENTS = new Set(['keydown', 'keypress', 'keyup']);
|
|
37
33
|
const CLICK_TAP_DRAG_EVENTS = new Set([
|
|
@@ -79,7 +75,7 @@ class Responsiveness {
|
|
|
79
75
|
* one interaction had this duration by returning the first found.
|
|
80
76
|
* @param {ResponsivenessEvent} responsivenessEvent
|
|
81
77
|
* @param {LH.Trace} trace
|
|
82
|
-
* @return {EventTimingEvent
|
|
78
|
+
* @return {EventTimingEvent}
|
|
83
79
|
*/
|
|
84
80
|
static findInteractionEvent(responsivenessEvent, {traceEvents}) {
|
|
85
81
|
const candidates = traceEvents.filter(/** @return {evt is EventTimingEvent} */ evt => {
|
|
@@ -87,15 +83,15 @@ class Responsiveness {
|
|
|
87
83
|
return evt.name === 'EventTiming' && evt.ph !== 'e';
|
|
88
84
|
});
|
|
89
85
|
|
|
90
|
-
// If trace is from < m103, the timestamps cannot be trusted
|
|
91
|
-
// <m103 traces (bad) had a args.frame
|
|
86
|
+
// If trace is from < m103, the timestamps cannot be trusted
|
|
87
|
+
// <m103 traces (bad) had a args.frame (we used to provide a fallback trace event, but not
|
|
88
|
+
// any more)
|
|
92
89
|
// m103+ traces (good) have a args.data.frame (https://crrev.com/c/3632661)
|
|
93
|
-
// TODO(compat): remove FallbackTiming handling when we don't care about <m103
|
|
94
90
|
if (candidates.length && candidates.every(candidate => !candidate.args.data?.frame)) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
throw new LighthouseError(
|
|
92
|
+
LighthouseError.errors.UNSUPPORTED_OLD_CHROME,
|
|
93
|
+
{featureName: 'detailed EventTiming trace events'}
|
|
94
|
+
);
|
|
99
95
|
}
|
|
100
96
|
|
|
101
97
|
const {maxDuration, interactionType} = responsivenessEvent.args.data;
|
|
@@ -136,7 +132,7 @@ class Responsiveness {
|
|
|
136
132
|
/**
|
|
137
133
|
* @param {{trace: LH.Trace, settings: LH.Audit.Context['settings']}} data
|
|
138
134
|
* @param {LH.Artifacts.ComputedContext} context
|
|
139
|
-
* @return {Promise<EventTimingEvent|
|
|
135
|
+
* @return {Promise<EventTimingEvent|null>}
|
|
140
136
|
*/
|
|
141
137
|
static async compute_(data, context) {
|
|
142
138
|
const {settings, trace} = data;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {makeComputedArtifact} from './computed-artifact.js';
|
|
8
|
-
import {NetworkAnalyzer} from '../lib/
|
|
8
|
+
import {NetworkAnalyzer} from '../lib/lantern/simulator/network-analyzer.js';
|
|
9
9
|
import {NetworkRecords} from './network-records.js';
|
|
10
10
|
|
|
11
11
|
class NetworkAnalysis {
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
export { PageDependencyGraphComputed as PageDependencyGraph };
|
|
2
|
-
export type Node = import('../lib/
|
|
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
|
-
};
|
|
2
|
+
export type Node = import('../lib/lantern/base-node.js').Node<LH.Artifacts.NetworkRequest>;
|
|
10
3
|
declare const PageDependencyGraphComputed: typeof PageDependencyGraph & {
|
|
11
4
|
request: (dependencies: {
|
|
12
5
|
trace: LH.Trace;
|
|
@@ -14,54 +7,11 @@ declare const PageDependencyGraphComputed: typeof PageDependencyGraph & {
|
|
|
14
7
|
URL: LH.Artifacts['URL'];
|
|
15
8
|
}, context: import("../../types/utility-types.js").default.ImmutableObject<{
|
|
16
9
|
computedCache: Map<string, import("../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
17
|
-
}>) => Promise<
|
|
10
|
+
}>) => Promise<Node>;
|
|
18
11
|
};
|
|
19
|
-
import {
|
|
12
|
+
import { NetworkRequest } from '../lib/network-request.js';
|
|
13
|
+
/** @typedef {import('../lib/lantern/base-node.js').Node<LH.Artifacts.NetworkRequest>} Node */
|
|
20
14
|
declare class PageDependencyGraph {
|
|
21
|
-
/**
|
|
22
|
-
* @param {LH.Artifacts.NetworkRequest} record
|
|
23
|
-
* @return {Array<string>}
|
|
24
|
-
*/
|
|
25
|
-
static getNetworkInitiators(record: LH.Artifacts.NetworkRequest): Array<string>;
|
|
26
|
-
/**
|
|
27
|
-
* @param {Array<LH.Artifacts.NetworkRequest>} networkRecords
|
|
28
|
-
* @return {NetworkNodeOutput}
|
|
29
|
-
*/
|
|
30
|
-
static getNetworkNodeOutput(networkRecords: Array<LH.Artifacts.NetworkRequest>): NetworkNodeOutput;
|
|
31
|
-
/**
|
|
32
|
-
* @param {LH.Artifacts.ProcessedTrace} processedTrace
|
|
33
|
-
* @return {Array<CPUNode>}
|
|
34
|
-
*/
|
|
35
|
-
static getCPUNodes({ mainThreadEvents }: LH.Artifacts.ProcessedTrace): Array<CPUNode>;
|
|
36
|
-
/**
|
|
37
|
-
* @param {NetworkNode} rootNode
|
|
38
|
-
* @param {NetworkNodeOutput} networkNodeOutput
|
|
39
|
-
*/
|
|
40
|
-
static linkNetworkNodes(rootNode: NetworkNode, networkNodeOutput: NetworkNodeOutput): void;
|
|
41
|
-
/**
|
|
42
|
-
* @param {Node} rootNode
|
|
43
|
-
* @param {NetworkNodeOutput} networkNodeOutput
|
|
44
|
-
* @param {Array<CPUNode>} cpuNodes
|
|
45
|
-
*/
|
|
46
|
-
static linkCPUNodes(rootNode: Node, networkNodeOutput: NetworkNodeOutput, cpuNodes: Array<CPUNode>): void;
|
|
47
|
-
/**
|
|
48
|
-
* Removes the given node from the graph, but retains all paths between its dependencies and
|
|
49
|
-
* dependents.
|
|
50
|
-
* @param {Node} node
|
|
51
|
-
*/
|
|
52
|
-
static _pruneNode(node: Node): void;
|
|
53
|
-
/**
|
|
54
|
-
* @param {LH.Artifacts.ProcessedTrace} processedTrace
|
|
55
|
-
* @param {Array<LH.Artifacts.NetworkRequest>} networkRecords
|
|
56
|
-
* @param {URLArtifact} URL
|
|
57
|
-
* @return {Node}
|
|
58
|
-
*/
|
|
59
|
-
static createGraph(processedTrace: LH.Artifacts.ProcessedTrace, networkRecords: Array<LH.Artifacts.NetworkRequest>, URL: URLArtifact): Node;
|
|
60
|
-
/**
|
|
61
|
-
*
|
|
62
|
-
* @param {Node} rootNode
|
|
63
|
-
*/
|
|
64
|
-
static printGraph(rootNode: Node, widthInCharacters?: number): void;
|
|
65
15
|
/**
|
|
66
16
|
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, URL: LH.Artifacts['URL']}} data
|
|
67
17
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -73,7 +23,4 @@ declare class PageDependencyGraph {
|
|
|
73
23
|
URL: LH.Artifacts['URL'];
|
|
74
24
|
}, context: LH.Artifacts.ComputedContext): Promise<Node>;
|
|
75
25
|
}
|
|
76
|
-
import { NetworkRequest } from '../lib/network-request.js';
|
|
77
|
-
import { ProcessedTrace } from './processed-trace.js';
|
|
78
|
-
import { CPUNode } from '../lib/dependency-graph/cpu-node.js';
|
|
79
26
|
//# sourceMappingURL=page-dependency-graph.d.ts.map
|