lighthouse 12.0.0-dev.20240610 → 12.0.0-dev.20240611
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/long-tasks.d.ts +7 -6
- package/core/audits/long-tasks.js +5 -4
- package/core/computed/processed-navigation.d.ts +1 -1
- package/core/computed/tbt-impact-tasks.js +2 -1
- package/core/config/constants.d.ts +28 -53
- package/core/config/constants.js +2 -43
- package/core/lib/lantern/cpu-node.d.ts +10 -10
- package/core/lib/lantern/cpu-node.js +5 -5
- package/core/lib/lantern/lantern.d.ts +49 -7
- package/core/lib/lantern/lantern.js +45 -1
- package/core/lib/lantern/metric.d.ts +8 -8
- package/core/lib/lantern/metric.js +6 -6
- package/core/lib/lantern/metrics/interactive.d.ts +3 -8
- package/core/lib/lantern/metrics/interactive.js +5 -5
- package/core/lib/lantern/metrics/largest-contentful-paint.d.ts +4 -3
- package/core/lib/lantern/metrics/largest-contentful-paint.js +4 -4
- package/core/lib/lantern/metrics/max-potential-fid.d.ts +3 -8
- package/core/lib/lantern/metrics/max-potential-fid.js +5 -5
- package/core/lib/lantern/metrics/speed-index.d.ts +3 -8
- package/core/lib/lantern/metrics/speed-index.js +6 -6
- package/core/lib/lantern/metrics/total-blocking-time.d.ts +3 -8
- package/core/lib/lantern/metrics/total-blocking-time.js +5 -5
- package/core/lib/lantern/page-dependency-graph.d.ts +17 -6
- package/core/lib/lantern/page-dependency-graph.js +45 -12
- package/core/lib/lantern/simulator/network-analyzer.d.ts +6 -6
- package/core/lib/lantern/simulator/network-analyzer.js +2 -2
- package/core/lib/lantern/simulator/simulator.js +6 -6
- package/core/lib/lantern/trace-engine-computation-data.d.ts +5 -5
- package/core/lib/lantern/trace-engine-computation-data.js +13 -9
- package/core/lib/lantern/types/lantern.d.ts +77 -5
- package/core/lib/lantern-trace-saver.js +1 -1
- package/package.json +4 -4
- package/types/artifacts.d.ts +2 -8
|
@@ -25,11 +25,11 @@ declare class LongTasks extends Audit {
|
|
|
25
25
|
* most time will be attributed to 'other' (the category of the top-level
|
|
26
26
|
* RunTask). See pruning in `PageDependencyGraph.linkCPUNodes`.
|
|
27
27
|
* @param {LH.Artifacts.TaskNode} task
|
|
28
|
-
* @param {Map<
|
|
28
|
+
* @param {Map<Lantern.TraceEvent, LH.Gatherer.Simulation.NodeTiming>|undefined} taskTimingsByEvent
|
|
29
29
|
* @param {Map<TaskGroupIds, number>} [timeByTaskGroup]
|
|
30
30
|
* @return {{startTime: number, duration: number, timeByTaskGroup: Map<TaskGroupIds, number>}}
|
|
31
31
|
*/
|
|
32
|
-
static getTimingBreakdown(task: LH.Artifacts.TaskNode, taskTimingsByEvent: Map<
|
|
32
|
+
static getTimingBreakdown(task: LH.Artifacts.TaskNode, taskTimingsByEvent: Map<Lantern.TraceEvent, LH.Gatherer.Simulation.NodeTiming> | undefined, timeByTaskGroup?: Map<import("../lib/tracehouse/task-groups.js").TaskGroupIds, number> | undefined): {
|
|
33
33
|
startTime: number;
|
|
34
34
|
duration: number;
|
|
35
35
|
timeByTaskGroup: Map<TaskGroupIds, number>;
|
|
@@ -37,17 +37,17 @@ declare class LongTasks extends Audit {
|
|
|
37
37
|
/**
|
|
38
38
|
* @param {Array<LH.Artifacts.TaskNode>} longTasks
|
|
39
39
|
* @param {Set<string>} jsUrls
|
|
40
|
-
* @param {Map<
|
|
40
|
+
* @param {Map<Lantern.TraceEvent, LH.Gatherer.Simulation.NodeTiming>|undefined} taskTimingsByEvent
|
|
41
41
|
* @return {LH.Audit.Details.DebugData}
|
|
42
42
|
*/
|
|
43
|
-
static makeDebugData(longTasks: Array<LH.Artifacts.TaskNode>, jsUrls: Set<string>, taskTimingsByEvent: Map<
|
|
43
|
+
static makeDebugData(longTasks: Array<LH.Artifacts.TaskNode>, jsUrls: Set<string>, taskTimingsByEvent: Map<Lantern.TraceEvent, LH.Gatherer.Simulation.NodeTiming> | undefined): LH.Audit.Details.DebugData;
|
|
44
44
|
/**
|
|
45
45
|
* Get timing from task, overridden by taskTimingsByEvent if provided.
|
|
46
46
|
* @param {LH.Artifacts.TaskNode} task
|
|
47
|
-
* @param {Map<
|
|
47
|
+
* @param {Map<Lantern.TraceEvent, LH.Gatherer.Simulation.NodeTiming>|undefined} taskTimingsByEvent
|
|
48
48
|
* @return {Timing}
|
|
49
49
|
*/
|
|
50
|
-
static getTiming(task: LH.Artifacts.TaskNode, taskTimingsByEvent: Map<
|
|
50
|
+
static getTiming(task: LH.Artifacts.TaskNode, taskTimingsByEvent: Map<Lantern.TraceEvent, LH.Gatherer.Simulation.NodeTiming> | undefined): Timing;
|
|
51
51
|
/**
|
|
52
52
|
* @param {LH.Artifacts} artifacts
|
|
53
53
|
* @param {LH.Audit.Context} context
|
|
@@ -61,4 +61,5 @@ export namespace UIStrings {
|
|
|
61
61
|
const displayValue: string;
|
|
62
62
|
}
|
|
63
63
|
import { Audit } from './audit.js';
|
|
64
|
+
import * as Lantern from '../lib/lantern/types/lantern.js';
|
|
64
65
|
//# sourceMappingURL=long-tasks.d.ts.map
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import * as Lantern from '../lib/lantern/types/lantern.js';
|
|
7
8
|
import {Audit} from './audit.js';
|
|
8
9
|
import {NetworkRecords} from '../computed/network-records.js';
|
|
9
10
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
@@ -85,7 +86,7 @@ class LongTasks extends Audit {
|
|
|
85
86
|
* most time will be attributed to 'other' (the category of the top-level
|
|
86
87
|
* RunTask). See pruning in `PageDependencyGraph.linkCPUNodes`.
|
|
87
88
|
* @param {LH.Artifacts.TaskNode} task
|
|
88
|
-
* @param {Map<
|
|
89
|
+
* @param {Map<Lantern.TraceEvent, LH.Gatherer.Simulation.NodeTiming>|undefined} taskTimingsByEvent
|
|
89
90
|
* @param {Map<TaskGroupIds, number>} [timeByTaskGroup]
|
|
90
91
|
* @return {{startTime: number, duration: number, timeByTaskGroup: Map<TaskGroupIds, number>}}
|
|
91
92
|
*/
|
|
@@ -116,7 +117,7 @@ class LongTasks extends Audit {
|
|
|
116
117
|
/**
|
|
117
118
|
* @param {Array<LH.Artifacts.TaskNode>} longTasks
|
|
118
119
|
* @param {Set<string>} jsUrls
|
|
119
|
-
* @param {Map<
|
|
120
|
+
* @param {Map<Lantern.TraceEvent, LH.Gatherer.Simulation.NodeTiming>|undefined} taskTimingsByEvent
|
|
120
121
|
* @return {LH.Audit.Details.DebugData}
|
|
121
122
|
*/
|
|
122
123
|
static makeDebugData(longTasks, jsUrls, taskTimingsByEvent) {
|
|
@@ -154,7 +155,7 @@ class LongTasks extends Audit {
|
|
|
154
155
|
/**
|
|
155
156
|
* Get timing from task, overridden by taskTimingsByEvent if provided.
|
|
156
157
|
* @param {LH.Artifacts.TaskNode} task
|
|
157
|
-
* @param {Map<
|
|
158
|
+
* @param {Map<Lantern.TraceEvent, LH.Gatherer.Simulation.NodeTiming>|undefined} taskTimingsByEvent
|
|
158
159
|
* @return {Timing}
|
|
159
160
|
*/
|
|
160
161
|
static getTiming(task, taskTimingsByEvent) {
|
|
@@ -184,7 +185,7 @@ class LongTasks extends Audit {
|
|
|
184
185
|
const metricComputationData = Audit.makeMetricComputationDataInput(artifacts, context);
|
|
185
186
|
const tbtResult = await TotalBlockingTime.request(metricComputationData, context);
|
|
186
187
|
|
|
187
|
-
/** @type {Map<
|
|
188
|
+
/** @type {Map<Lantern.TraceEvent, LH.Gatherer.Simulation.NodeTiming>|undefined} */
|
|
188
189
|
let taskTimingsByEvent;
|
|
189
190
|
|
|
190
191
|
if (settings.throttlingMethod === 'simulate') {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ProcessedNavigationComputed as ProcessedNavigation };
|
|
2
2
|
declare const ProcessedNavigationComputed: typeof ProcessedNavigation & {
|
|
3
|
-
request: (dependencies: import("../index.js").
|
|
3
|
+
request: (dependencies: import("../index.js").Trace | import("../index.js").Artifacts.ProcessedTrace, context: import("../../types/utility-types.js").default.ImmutableObject<{
|
|
4
4
|
computedCache: Map<string, import("../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
5
5
|
}>) => Promise<import("../index.js").Artifacts.ProcessedNavigation>;
|
|
6
6
|
};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import * as Lantern from '../lib/lantern/types/lantern.js';
|
|
7
8
|
import {makeComputedArtifact} from './computed-artifact.js';
|
|
8
9
|
import {MainThreadTasks} from './main-thread-tasks.js';
|
|
9
10
|
import {FirstContentfulPaint} from './metrics/first-contentful-paint.js';
|
|
@@ -132,7 +133,7 @@ class TBTImpactTasks {
|
|
|
132
133
|
/** @type {Map<LH.Artifacts.TaskNode, {start: number, end: number, duration: number}>} */
|
|
133
134
|
const topLevelTaskToEvent = new Map();
|
|
134
135
|
|
|
135
|
-
/** @type {Map<
|
|
136
|
+
/** @type {Map<Lantern.TraceEvent, LH.Artifacts.TaskNode>} */
|
|
136
137
|
const traceEventToTask = new Map();
|
|
137
138
|
for (const task of tasks) {
|
|
138
139
|
traceEventToTask.set(task.event, task);
|
|
@@ -1,43 +1,31 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const throughputKbps_2: number;
|
|
30
|
-
export { throughputKbps_2 as throughputKbps };
|
|
31
|
-
const cpuSlowdownMultiplier_2: number;
|
|
32
|
-
export { cpuSlowdownMultiplier_2 as cpuSlowdownMultiplier };
|
|
33
|
-
const requestLatencyMs_2: number;
|
|
34
|
-
export { requestLatencyMs_2 as requestLatencyMs };
|
|
35
|
-
const downloadThroughputKbps_2: number;
|
|
36
|
-
export { downloadThroughputKbps_2 as downloadThroughputKbps };
|
|
37
|
-
const uploadThroughputKbps_2: number;
|
|
38
|
-
export { uploadThroughputKbps_2 as uploadThroughputKbps };
|
|
39
|
-
}
|
|
40
|
-
}
|
|
1
|
+
export const throttling: {
|
|
2
|
+
DEVTOOLS_RTT_ADJUSTMENT_FACTOR: number;
|
|
3
|
+
DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR: number;
|
|
4
|
+
mobileSlow4G: {
|
|
5
|
+
rttMs: number;
|
|
6
|
+
throughputKbps: number;
|
|
7
|
+
requestLatencyMs: number;
|
|
8
|
+
downloadThroughputKbps: number;
|
|
9
|
+
uploadThroughputKbps: number;
|
|
10
|
+
cpuSlowdownMultiplier: number;
|
|
11
|
+
};
|
|
12
|
+
mobileRegular3G: {
|
|
13
|
+
rttMs: number;
|
|
14
|
+
throughputKbps: number;
|
|
15
|
+
requestLatencyMs: number;
|
|
16
|
+
downloadThroughputKbps: number;
|
|
17
|
+
uploadThroughputKbps: number;
|
|
18
|
+
cpuSlowdownMultiplier: number;
|
|
19
|
+
};
|
|
20
|
+
desktopDense4G: {
|
|
21
|
+
rttMs: number;
|
|
22
|
+
throughputKbps: number;
|
|
23
|
+
cpuSlowdownMultiplier: number;
|
|
24
|
+
requestLatencyMs: number;
|
|
25
|
+
downloadThroughputKbps: number;
|
|
26
|
+
uploadThroughputKbps: number;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
41
29
|
export namespace screenEmulationMetrics {
|
|
42
30
|
export { MOTOGPOWER_EMULATION_METRICS as mobile };
|
|
43
31
|
export { DESKTOP_EMULATION_METRICS as desktop };
|
|
@@ -54,19 +42,6 @@ export namespace nonSimulatedSettingsOverrides {
|
|
|
54
42
|
const networkQuietThresholdMs: number;
|
|
55
43
|
const cpuQuietThresholdMs: number;
|
|
56
44
|
}
|
|
57
|
-
/**
|
|
58
|
-
* @license
|
|
59
|
-
* Copyright 2018 Google LLC
|
|
60
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
61
|
-
*/
|
|
62
|
-
/**
|
|
63
|
-
* Adjustments needed for DevTools network throttling to simulate
|
|
64
|
-
* more realistic network conditions.
|
|
65
|
-
* @see https://crbug.com/721112
|
|
66
|
-
* @see https://docs.google.com/document/d/10lfVdS1iDWCRKQXPfbxEn4Or99D64mvNlugP1AQuFlE/edit
|
|
67
|
-
*/
|
|
68
|
-
declare const DEVTOOLS_RTT_ADJUSTMENT_FACTOR: 3.75;
|
|
69
|
-
declare const DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR: 0.9;
|
|
70
45
|
/**
|
|
71
46
|
* @type {Required<LH.SharedFlagsSettings['screenEmulation']>}
|
|
72
47
|
*/
|
package/core/config/constants.js
CHANGED
|
@@ -4,50 +4,9 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
* Adjustments needed for DevTools network throttling to simulate
|
|
9
|
-
* more realistic network conditions.
|
|
10
|
-
* @see https://crbug.com/721112
|
|
11
|
-
* @see https://docs.google.com/document/d/10lfVdS1iDWCRKQXPfbxEn4Or99D64mvNlugP1AQuFlE/edit
|
|
12
|
-
*/
|
|
13
|
-
const DEVTOOLS_RTT_ADJUSTMENT_FACTOR = 3.75;
|
|
14
|
-
const DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR = 0.9;
|
|
7
|
+
import * as Lantern from '../lib/lantern/lantern.js';
|
|
15
8
|
|
|
16
|
-
const throttling =
|
|
17
|
-
DEVTOOLS_RTT_ADJUSTMENT_FACTOR,
|
|
18
|
-
DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR,
|
|
19
|
-
// These values align with WebPageTest's definition of "Fast 3G"
|
|
20
|
-
// But offer similar characteristics to roughly the 75th percentile of 4G connections.
|
|
21
|
-
mobileSlow4G: {
|
|
22
|
-
rttMs: 150,
|
|
23
|
-
throughputKbps: 1.6 * 1024,
|
|
24
|
-
requestLatencyMs: 150 * DEVTOOLS_RTT_ADJUSTMENT_FACTOR,
|
|
25
|
-
downloadThroughputKbps: 1.6 * 1024 * DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR,
|
|
26
|
-
uploadThroughputKbps: 750 * DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR,
|
|
27
|
-
cpuSlowdownMultiplier: 4,
|
|
28
|
-
},
|
|
29
|
-
// These values partially align with WebPageTest's definition of "Regular 3G".
|
|
30
|
-
// These values are meant to roughly align with Chrome UX report's 3G definition which are based
|
|
31
|
-
// on HTTP RTT of 300-1400ms and downlink throughput of <700kbps.
|
|
32
|
-
mobileRegular3G: {
|
|
33
|
-
rttMs: 300,
|
|
34
|
-
throughputKbps: 700,
|
|
35
|
-
requestLatencyMs: 300 * DEVTOOLS_RTT_ADJUSTMENT_FACTOR,
|
|
36
|
-
downloadThroughputKbps: 700 * DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR,
|
|
37
|
-
uploadThroughputKbps: 700 * DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR,
|
|
38
|
-
cpuSlowdownMultiplier: 4,
|
|
39
|
-
},
|
|
40
|
-
// Using a "broadband" connection type
|
|
41
|
-
// Corresponds to "Dense 4G 25th percentile" in https://docs.google.com/document/d/1Ft1Bnq9-t4jK5egLSOc28IL4TvR-Tt0se_1faTA4KTY/edit#heading=h.bb7nfy2x9e5v
|
|
42
|
-
desktopDense4G: {
|
|
43
|
-
rttMs: 40,
|
|
44
|
-
throughputKbps: 10 * 1024,
|
|
45
|
-
cpuSlowdownMultiplier: 1,
|
|
46
|
-
requestLatencyMs: 0, // 0 means unset
|
|
47
|
-
downloadThroughputKbps: 0,
|
|
48
|
-
uploadThroughputKbps: 0,
|
|
49
|
-
},
|
|
50
|
-
};
|
|
9
|
+
const throttling = Lantern.constants.throttling;
|
|
51
10
|
|
|
52
11
|
/**
|
|
53
12
|
* @type {Required<LH.SharedFlagsSettings['screenEmulation']>}
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export class CPUNode<T = any> extends BaseNode<T> {
|
|
6
6
|
/**
|
|
7
|
-
* @param {
|
|
8
|
-
* @param {
|
|
7
|
+
* @param {Lantern.TraceEvent} parentEvent
|
|
8
|
+
* @param {Lantern.TraceEvent[]=} childEvents
|
|
9
9
|
* @param {number=} correctedEndTs
|
|
10
10
|
*/
|
|
11
|
-
constructor(parentEvent:
|
|
12
|
-
_event:
|
|
13
|
-
_childEvents:
|
|
11
|
+
constructor(parentEvent: Lantern.TraceEvent, childEvents?: Lantern.TraceEvent[] | undefined, correctedEndTs?: number | undefined);
|
|
12
|
+
_event: Lantern.TraceEvent;
|
|
13
|
+
_childEvents: Lantern.TraceEvent[];
|
|
14
14
|
_correctedEndTs: number | undefined;
|
|
15
15
|
get type(): "cpu";
|
|
16
16
|
/**
|
|
@@ -18,13 +18,13 @@ export class CPUNode<T = any> extends BaseNode<T> {
|
|
|
18
18
|
*/
|
|
19
19
|
get duration(): number;
|
|
20
20
|
/**
|
|
21
|
-
* @return {
|
|
21
|
+
* @return {Lantern.TraceEvent}
|
|
22
22
|
*/
|
|
23
|
-
get event():
|
|
23
|
+
get event(): Lantern.TraceEvent;
|
|
24
24
|
/**
|
|
25
|
-
* @return {
|
|
25
|
+
* @return {Lantern.TraceEvent[]}
|
|
26
26
|
*/
|
|
27
|
-
get childEvents():
|
|
27
|
+
get childEvents(): Lantern.TraceEvent[];
|
|
28
28
|
/**
|
|
29
29
|
* Returns true if this node contains a Layout task.
|
|
30
30
|
* @return {boolean}
|
|
@@ -40,5 +40,5 @@ export class CPUNode<T = any> extends BaseNode<T> {
|
|
|
40
40
|
cloneWithoutRelationships(): CPUNode;
|
|
41
41
|
}
|
|
42
42
|
import { BaseNode } from './base-node.js';
|
|
43
|
-
import * as
|
|
43
|
+
import * as Lantern from './types/lantern.js';
|
|
44
44
|
//# sourceMappingURL=cpu-node.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import * as
|
|
7
|
+
import * as Lantern from './types/lantern.js';
|
|
8
8
|
import {BaseNode} from './base-node.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -13,8 +13,8 @@ import {BaseNode} from './base-node.js';
|
|
|
13
13
|
*/
|
|
14
14
|
class CPUNode extends BaseNode {
|
|
15
15
|
/**
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
16
|
+
* @param {Lantern.TraceEvent} parentEvent
|
|
17
|
+
* @param {Lantern.TraceEvent[]=} childEvents
|
|
18
18
|
* @param {number=} correctedEndTs
|
|
19
19
|
*/
|
|
20
20
|
constructor(parentEvent, childEvents = [], correctedEndTs) {
|
|
@@ -53,14 +53,14 @@ class CPUNode extends BaseNode {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
-
* @return {
|
|
56
|
+
* @return {Lantern.TraceEvent}
|
|
57
57
|
*/
|
|
58
58
|
get event() {
|
|
59
59
|
return this._event;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* @return {
|
|
63
|
+
* @return {Lantern.TraceEvent[]}
|
|
64
64
|
*/
|
|
65
65
|
get childEvents() {
|
|
66
66
|
return this._childEvents;
|
|
@@ -1,8 +1,50 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/** @type {Lantern.Util.SelfMap<Lantern.ResourceType>} */
|
|
2
|
+
export const NetworkRequestTypes: Lantern.Util.SelfMap<Lantern.ResourceType>;
|
|
3
|
+
export namespace constants {
|
|
4
|
+
export { throttling };
|
|
5
|
+
}
|
|
6
|
+
import * as Lantern from './types/lantern.js';
|
|
7
|
+
declare namespace throttling {
|
|
8
|
+
export { DEVTOOLS_RTT_ADJUSTMENT_FACTOR };
|
|
9
|
+
export { DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR };
|
|
10
|
+
export namespace mobileSlow4G {
|
|
11
|
+
const rttMs: number;
|
|
12
|
+
const throughputKbps: number;
|
|
13
|
+
const requestLatencyMs: number;
|
|
14
|
+
const downloadThroughputKbps: number;
|
|
15
|
+
const uploadThroughputKbps: number;
|
|
16
|
+
const cpuSlowdownMultiplier: number;
|
|
17
|
+
}
|
|
18
|
+
export namespace mobileRegular3G {
|
|
19
|
+
const rttMs_1: number;
|
|
20
|
+
export { rttMs_1 as rttMs };
|
|
21
|
+
const throughputKbps_1: number;
|
|
22
|
+
export { throughputKbps_1 as throughputKbps };
|
|
23
|
+
const requestLatencyMs_1: number;
|
|
24
|
+
export { requestLatencyMs_1 as requestLatencyMs };
|
|
25
|
+
const downloadThroughputKbps_1: number;
|
|
26
|
+
export { downloadThroughputKbps_1 as downloadThroughputKbps };
|
|
27
|
+
const uploadThroughputKbps_1: number;
|
|
28
|
+
export { uploadThroughputKbps_1 as uploadThroughputKbps };
|
|
29
|
+
const cpuSlowdownMultiplier_1: number;
|
|
30
|
+
export { cpuSlowdownMultiplier_1 as cpuSlowdownMultiplier };
|
|
31
|
+
}
|
|
32
|
+
export namespace desktopDense4G {
|
|
33
|
+
const rttMs_2: number;
|
|
34
|
+
export { rttMs_2 as rttMs };
|
|
35
|
+
const throughputKbps_2: number;
|
|
36
|
+
export { throughputKbps_2 as throughputKbps };
|
|
37
|
+
const cpuSlowdownMultiplier_2: number;
|
|
38
|
+
export { cpuSlowdownMultiplier_2 as cpuSlowdownMultiplier };
|
|
39
|
+
const requestLatencyMs_2: number;
|
|
40
|
+
export { requestLatencyMs_2 as requestLatencyMs };
|
|
41
|
+
const downloadThroughputKbps_2: number;
|
|
42
|
+
export { downloadThroughputKbps_2 as downloadThroughputKbps };
|
|
43
|
+
const uploadThroughputKbps_2: number;
|
|
44
|
+
export { uploadThroughputKbps_2 as uploadThroughputKbps };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
declare const DEVTOOLS_RTT_ADJUSTMENT_FACTOR: 3.75;
|
|
48
|
+
declare const DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR: 0.9;
|
|
49
|
+
export {};
|
|
8
50
|
//# sourceMappingURL=lantern.d.ts.map
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import * as Lantern from './types/lantern.js';
|
|
8
|
+
|
|
9
|
+
/** @type {Lantern.Util.SelfMap<Lantern.ResourceType>} */
|
|
8
10
|
const NetworkRequestTypes = {
|
|
9
11
|
XHR: 'XHR',
|
|
10
12
|
Fetch: 'Fetch',
|
|
@@ -26,6 +28,48 @@ const NetworkRequestTypes = {
|
|
|
26
28
|
Prefetch: 'Prefetch',
|
|
27
29
|
};
|
|
28
30
|
|
|
31
|
+
const DEVTOOLS_RTT_ADJUSTMENT_FACTOR = 3.75;
|
|
32
|
+
const DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR = 0.9;
|
|
33
|
+
|
|
34
|
+
const throttling = {
|
|
35
|
+
DEVTOOLS_RTT_ADJUSTMENT_FACTOR,
|
|
36
|
+
DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR,
|
|
37
|
+
// These values align with WebPageTest's definition of "Fast 3G"
|
|
38
|
+
// But offer similar characteristics to roughly the 75th percentile of 4G connections.
|
|
39
|
+
mobileSlow4G: {
|
|
40
|
+
rttMs: 150,
|
|
41
|
+
throughputKbps: 1.6 * 1024,
|
|
42
|
+
requestLatencyMs: 150 * DEVTOOLS_RTT_ADJUSTMENT_FACTOR,
|
|
43
|
+
downloadThroughputKbps: 1.6 * 1024 * DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR,
|
|
44
|
+
uploadThroughputKbps: 750 * DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR,
|
|
45
|
+
cpuSlowdownMultiplier: 4,
|
|
46
|
+
},
|
|
47
|
+
// These values partially align with WebPageTest's definition of "Regular 3G".
|
|
48
|
+
// These values are meant to roughly align with Chrome UX report's 3G definition which are based
|
|
49
|
+
// on HTTP RTT of 300-1400ms and downlink throughput of <700kbps.
|
|
50
|
+
mobileRegular3G: {
|
|
51
|
+
rttMs: 300,
|
|
52
|
+
throughputKbps: 700,
|
|
53
|
+
requestLatencyMs: 300 * DEVTOOLS_RTT_ADJUSTMENT_FACTOR,
|
|
54
|
+
downloadThroughputKbps: 700 * DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR,
|
|
55
|
+
uploadThroughputKbps: 700 * DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR,
|
|
56
|
+
cpuSlowdownMultiplier: 4,
|
|
57
|
+
},
|
|
58
|
+
// Using a "broadband" connection type
|
|
59
|
+
// Corresponds to "Dense 4G 25th percentile" in https://docs.google.com/document/d/1Ft1Bnq9-t4jK5egLSOc28IL4TvR-Tt0se_1faTA4KTY/edit#heading=h.bb7nfy2x9e5v
|
|
60
|
+
desktopDense4G: {
|
|
61
|
+
rttMs: 40,
|
|
62
|
+
throughputKbps: 10 * 1024,
|
|
63
|
+
cpuSlowdownMultiplier: 1,
|
|
64
|
+
requestLatencyMs: 0, // 0 means unset
|
|
65
|
+
downloadThroughputKbps: 0,
|
|
66
|
+
uploadThroughputKbps: 0,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const constants = {throttling};
|
|
71
|
+
|
|
29
72
|
export {
|
|
30
73
|
NetworkRequestTypes,
|
|
74
|
+
constants,
|
|
31
75
|
};
|
|
@@ -3,9 +3,9 @@ export type NetworkNode = import('./network-node.js').NetworkNode;
|
|
|
3
3
|
export type Simulator = import('./simulator/simulator.js').Simulator;
|
|
4
4
|
export type Extras = {
|
|
5
5
|
optimistic: boolean;
|
|
6
|
-
fcpResult?:
|
|
7
|
-
lcpResult?:
|
|
8
|
-
interactiveResult?:
|
|
6
|
+
fcpResult?: Lantern.Metric | undefined;
|
|
7
|
+
lcpResult?: Lantern.Metric | undefined;
|
|
8
|
+
interactiveResult?: Lantern.Metric | undefined;
|
|
9
9
|
observedSpeedIndex?: number | undefined;
|
|
10
10
|
};
|
|
11
11
|
/** @typedef {import('./base-node.js').Node} Node */
|
|
@@ -14,9 +14,9 @@ export type Extras = {
|
|
|
14
14
|
/**
|
|
15
15
|
* @typedef Extras
|
|
16
16
|
* @property {boolean} optimistic
|
|
17
|
-
* @property {
|
|
18
|
-
* @property {
|
|
19
|
-
* @property {
|
|
17
|
+
* @property {Lantern.Metric=} fcpResult
|
|
18
|
+
* @property {Lantern.Metric=} lcpResult
|
|
19
|
+
* @property {Lantern.Metric=} interactiveResult
|
|
20
20
|
* @property {number=} observedSpeedIndex
|
|
21
21
|
*/
|
|
22
22
|
export class Metric {
|
|
@@ -61,9 +61,9 @@ export class Metric {
|
|
|
61
61
|
/**
|
|
62
62
|
* @param {Lantern.Simulation.MetricComputationDataInput} data
|
|
63
63
|
* @param {Omit<Extras, 'optimistic'>=} extras
|
|
64
|
-
* @return {Promise<
|
|
64
|
+
* @return {Promise<Lantern.Metric>}
|
|
65
65
|
*/
|
|
66
|
-
static compute(data: Lantern.Simulation.MetricComputationDataInput, extras?: Omit<Extras, 'optimistic'> | undefined): Promise<
|
|
66
|
+
static compute(data: Lantern.Simulation.MetricComputationDataInput, extras?: Omit<Extras, 'optimistic'> | undefined): Promise<Lantern.Metric>;
|
|
67
67
|
}
|
|
68
68
|
import * as Lantern from './types/lantern.js';
|
|
69
69
|
//# sourceMappingURL=metric.d.ts.map
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as Lantern from './types/lantern.js';
|
|
8
|
-
import {BaseNode} from '
|
|
9
|
-
import {RESOURCE_TYPES} from '
|
|
8
|
+
import {BaseNode} from './base-node.js';
|
|
9
|
+
import {RESOURCE_TYPES} from '../network-request.js';
|
|
10
10
|
|
|
11
11
|
/** @typedef {import('./base-node.js').Node} Node */
|
|
12
12
|
/** @typedef {import('./network-node.js').NetworkNode} NetworkNode */
|
|
@@ -15,9 +15,9 @@ import {RESOURCE_TYPES} from '../../lib/network-request.js';
|
|
|
15
15
|
/**
|
|
16
16
|
* @typedef Extras
|
|
17
17
|
* @property {boolean} optimistic
|
|
18
|
-
* @property {
|
|
19
|
-
* @property {
|
|
20
|
-
* @property {
|
|
18
|
+
* @property {Lantern.Metric=} fcpResult
|
|
19
|
+
* @property {Lantern.Metric=} lcpResult
|
|
20
|
+
* @property {Lantern.Metric=} interactiveResult
|
|
21
21
|
* @property {number=} observedSpeedIndex
|
|
22
22
|
*/
|
|
23
23
|
|
|
@@ -92,7 +92,7 @@ class Metric {
|
|
|
92
92
|
/**
|
|
93
93
|
* @param {Lantern.Simulation.MetricComputationDataInput} data
|
|
94
94
|
* @param {Omit<Extras, 'optimistic'>=} extras
|
|
95
|
-
* @return {Promise<
|
|
95
|
+
* @return {Promise<Lantern.Metric>}
|
|
96
96
|
*/
|
|
97
97
|
static async compute(data, extras) {
|
|
98
98
|
const {simulator, graph, processedNavigation} = data;
|
|
@@ -11,16 +11,11 @@ export class Interactive extends Metric {
|
|
|
11
11
|
*/
|
|
12
12
|
static getPessimisticGraph(dependencyGraph: Node): Node;
|
|
13
13
|
/**
|
|
14
|
-
* @param {
|
|
15
|
-
* @param {import('../metric.js').Extras} extras
|
|
16
|
-
* @return {LH.Gatherer.Simulation.Result}
|
|
17
|
-
*/
|
|
18
|
-
static getEstimateFromSimulation(simulationResult: LH.Gatherer.Simulation.Result, extras: import('../metric.js').Extras): LH.Gatherer.Simulation.Result;
|
|
19
|
-
/**
|
|
20
|
-
* @param {LH.Gatherer.Simulation.Result['nodeTimings']} nodeTimings
|
|
14
|
+
* @param {Lantern.Simulation.Result['nodeTimings']} nodeTimings
|
|
21
15
|
* @return {number}
|
|
22
16
|
*/
|
|
23
|
-
static getLastLongTaskEndTime(nodeTimings:
|
|
17
|
+
static getLastLongTaskEndTime(nodeTimings: Lantern.Simulation.Result['nodeTimings'], duration?: number): number;
|
|
24
18
|
}
|
|
25
19
|
import { Metric } from '../metric.js';
|
|
20
|
+
import * as Lantern from '../types/lantern.js';
|
|
26
21
|
//# sourceMappingURL=interactive.d.ts.map
|
|
@@ -16,7 +16,7 @@ const CRITICAL_LONG_TASK_THRESHOLD = 20;
|
|
|
16
16
|
|
|
17
17
|
class Interactive extends Metric {
|
|
18
18
|
/**
|
|
19
|
-
* @return {
|
|
19
|
+
* @return {Lantern.Simulation.MetricCoefficients}
|
|
20
20
|
*/
|
|
21
21
|
static get COEFFICIENTS() {
|
|
22
22
|
return {
|
|
@@ -61,9 +61,9 @@ class Interactive extends Metric {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
* @param {
|
|
64
|
+
* @param {Lantern.Simulation.Result} simulationResult
|
|
65
65
|
* @param {import('../metric.js').Extras} extras
|
|
66
|
-
* @return {
|
|
66
|
+
* @return {Lantern.Simulation.Result}
|
|
67
67
|
*/
|
|
68
68
|
static getEstimateFromSimulation(simulationResult, extras) {
|
|
69
69
|
if (!extras.lcpResult) throw new Error('missing lcpResult');
|
|
@@ -81,7 +81,7 @@ class Interactive extends Metric {
|
|
|
81
81
|
/**
|
|
82
82
|
* @param {Lantern.Simulation.MetricComputationDataInput} data
|
|
83
83
|
* @param {Omit<import('../metric.js').Extras, 'optimistic'>=} extras
|
|
84
|
-
* @return {Promise<
|
|
84
|
+
* @return {Promise<Lantern.Metric>}
|
|
85
85
|
*/
|
|
86
86
|
static async compute(data, extras) {
|
|
87
87
|
const lcpResult = extras?.lcpResult;
|
|
@@ -95,7 +95,7 @@ class Interactive extends Metric {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
|
-
* @param {
|
|
98
|
+
* @param {Lantern.Simulation.Result['nodeTimings']} nodeTimings
|
|
99
99
|
* @return {number}
|
|
100
100
|
*/
|
|
101
101
|
static getLastLongTaskEndTime(nodeTimings, duration = 50) {
|
|
@@ -10,10 +10,11 @@ export class LargestContentfulPaint extends Metric {
|
|
|
10
10
|
*/
|
|
11
11
|
static isNotLowPriorityImageNode(node: Node): boolean;
|
|
12
12
|
/**
|
|
13
|
-
* @param {
|
|
14
|
-
* @return {
|
|
13
|
+
* @param {Lantern.Simulation.Result} simulationResult
|
|
14
|
+
* @return {Lantern.Simulation.Result}
|
|
15
15
|
*/
|
|
16
|
-
static getEstimateFromSimulation(simulationResult:
|
|
16
|
+
static getEstimateFromSimulation(simulationResult: Lantern.Simulation.Result): Lantern.Simulation.Result;
|
|
17
17
|
}
|
|
18
18
|
import { Metric } from '../metric.js';
|
|
19
|
+
import * as Lantern from '../types/lantern.js';
|
|
19
20
|
//# sourceMappingURL=largest-contentful-paint.d.ts.map
|
|
@@ -13,7 +13,7 @@ import {LanternError} from '../lantern-error.js';
|
|
|
13
13
|
|
|
14
14
|
class LargestContentfulPaint extends Metric {
|
|
15
15
|
/**
|
|
16
|
-
* @return {
|
|
16
|
+
* @return {Lantern.Simulation.MetricCoefficients}
|
|
17
17
|
*/
|
|
18
18
|
static get COEFFICIENTS() {
|
|
19
19
|
return {
|
|
@@ -74,8 +74,8 @@ class LargestContentfulPaint extends Metric {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
|
-
* @param {
|
|
78
|
-
* @return {
|
|
77
|
+
* @param {Lantern.Simulation.Result} simulationResult
|
|
78
|
+
* @return {Lantern.Simulation.Result}
|
|
79
79
|
*/
|
|
80
80
|
static getEstimateFromSimulation(simulationResult) {
|
|
81
81
|
const nodeTimesNotOffscreenImages = Array.from(simulationResult.nodeTimings.entries())
|
|
@@ -91,7 +91,7 @@ class LargestContentfulPaint extends Metric {
|
|
|
91
91
|
/**
|
|
92
92
|
* @param {Lantern.Simulation.MetricComputationDataInput} data
|
|
93
93
|
* @param {Omit<import('../metric.js').Extras, 'optimistic'>=} extras
|
|
94
|
-
* @return {Promise<
|
|
94
|
+
* @return {Promise<Lantern.Metric>}
|
|
95
95
|
*/
|
|
96
96
|
static async compute(data, extras) {
|
|
97
97
|
const fcpResult = extras?.fcpResult;
|