lighthouse 12.0.0-dev.20240605 → 12.0.0-dev.20240606
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/metrics/interactive.d.ts +1 -1
- package/core/audits/metrics/interactive.js +1 -1
- package/core/computed/metrics/lantern-interactive.js +3 -3
- package/core/lib/lantern/metric.d.ts +2 -2
- package/core/lib/lantern/metric.js +1 -1
- package/core/lib/lantern/metrics/interactive.js +7 -7
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default InteractiveMetric;
|
|
2
2
|
/**
|
|
3
3
|
* @fileoverview This audit identifies the time the page is "consistently interactive".
|
|
4
|
-
* Looks for the first period of at least 5 seconds after
|
|
4
|
+
* Looks for the first period of at least 5 seconds after FCP where both CPU and network were quiet,
|
|
5
5
|
* and returns the timestamp of the beginning of the CPU quiet period.
|
|
6
6
|
* @see https://docs.google.com/document/d/1GGiI9-7KeY3TPqS3YT271upUVimo-XiL5mwWorDUD4c/edit#
|
|
7
7
|
*/
|
|
@@ -18,7 +18,7 @@ const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* @fileoverview This audit identifies the time the page is "consistently interactive".
|
|
21
|
-
* Looks for the first period of at least 5 seconds after
|
|
21
|
+
* Looks for the first period of at least 5 seconds after FCP where both CPU and network were quiet,
|
|
22
22
|
* and returns the timestamp of the beginning of the CPU quiet period.
|
|
23
23
|
* @see https://docs.google.com/document/d/1GGiI9-7KeY3TPqS3YT271upUVimo-XiL5mwWorDUD4c/edit#
|
|
24
24
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {makeComputedArtifact} from '../computed-artifact.js';
|
|
8
|
-
import {
|
|
8
|
+
import {LanternLargestContentfulPaint} from './lantern-largest-contentful-paint.js';
|
|
9
9
|
import {Interactive} from '../../lib/lantern/metrics/interactive.js';
|
|
10
10
|
import {getComputationDataParams, lanternErrorAdapter} from './lantern-metric.js';
|
|
11
11
|
|
|
@@ -29,8 +29,8 @@ class LanternInteractive extends Interactive {
|
|
|
29
29
|
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
30
30
|
*/
|
|
31
31
|
static async compute_(data, context) {
|
|
32
|
-
const
|
|
33
|
-
return this.computeMetricWithGraphs(data, context, {
|
|
32
|
+
const lcpResult = await LanternLargestContentfulPaint.request(data, context);
|
|
33
|
+
return this.computeMetricWithGraphs(data, context, {lcpResult});
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -4,7 +4,7 @@ export type Simulator = import('./simulator/simulator.js').Simulator;
|
|
|
4
4
|
export type Extras = {
|
|
5
5
|
optimistic: boolean;
|
|
6
6
|
fcpResult?: LH.Artifacts.LanternMetric | undefined;
|
|
7
|
-
|
|
7
|
+
lcpResult?: LH.Artifacts.LanternMetric | undefined;
|
|
8
8
|
interactiveResult?: LH.Artifacts.LanternMetric | undefined;
|
|
9
9
|
speedline?: {
|
|
10
10
|
speedIndex: number;
|
|
@@ -17,7 +17,7 @@ export type Extras = {
|
|
|
17
17
|
* @typedef Extras
|
|
18
18
|
* @property {boolean} optimistic
|
|
19
19
|
* @property {LH.Artifacts.LanternMetric=} fcpResult
|
|
20
|
-
* @property {LH.Artifacts.LanternMetric=}
|
|
20
|
+
* @property {LH.Artifacts.LanternMetric=} lcpResult
|
|
21
21
|
* @property {LH.Artifacts.LanternMetric=} interactiveResult
|
|
22
22
|
* @property {{speedIndex: number}=} speedline
|
|
23
23
|
*/
|
|
@@ -16,7 +16,7 @@ import {RESOURCE_TYPES} from '../../lib/network-request.js';
|
|
|
16
16
|
* @typedef Extras
|
|
17
17
|
* @property {boolean} optimistic
|
|
18
18
|
* @property {LH.Artifacts.LanternMetric=} fcpResult
|
|
19
|
-
* @property {LH.Artifacts.LanternMetric=}
|
|
19
|
+
* @property {LH.Artifacts.LanternMetric=} lcpResult
|
|
20
20
|
* @property {LH.Artifacts.LanternMetric=} interactiveResult
|
|
21
21
|
* @property {{speedIndex: number}=} speedline
|
|
22
22
|
*/
|
|
@@ -66,12 +66,12 @@ class Interactive extends Metric {
|
|
|
66
66
|
* @return {LH.Gatherer.Simulation.Result}
|
|
67
67
|
*/
|
|
68
68
|
static getEstimateFromSimulation(simulationResult, extras) {
|
|
69
|
-
if (!extras.
|
|
69
|
+
if (!extras.lcpResult) throw new Error('missing lcpResult');
|
|
70
70
|
|
|
71
71
|
const lastTaskAt = Interactive.getLastLongTaskEndTime(simulationResult.nodeTimings);
|
|
72
72
|
const minimumTime = extras.optimistic
|
|
73
|
-
? extras.
|
|
74
|
-
: extras.
|
|
73
|
+
? extras.lcpResult.optimisticEstimate.timeInMs
|
|
74
|
+
: extras.lcpResult.pessimisticEstimate.timeInMs;
|
|
75
75
|
return {
|
|
76
76
|
timeInMs: Math.max(minimumTime, lastTaskAt),
|
|
77
77
|
nodeTimings: simulationResult.nodeTimings,
|
|
@@ -84,13 +84,13 @@ class Interactive extends Metric {
|
|
|
84
84
|
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
85
85
|
*/
|
|
86
86
|
static async compute(data, extras) {
|
|
87
|
-
const
|
|
88
|
-
if (!
|
|
89
|
-
throw new Error('
|
|
87
|
+
const lcpResult = extras?.lcpResult;
|
|
88
|
+
if (!lcpResult) {
|
|
89
|
+
throw new Error('LCP is required to calculate the Interactive metric');
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
const metricResult = await super.compute(data, extras);
|
|
93
|
-
metricResult.timing = Math.max(metricResult.timing,
|
|
93
|
+
metricResult.timing = Math.max(metricResult.timing, lcpResult.timing);
|
|
94
94
|
return metricResult;
|
|
95
95
|
}
|
|
96
96
|
|
package/package.json
CHANGED