lighthouse 12.0.0-dev.20240609 → 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/metrics/lantern-metric.js +2 -2
- package/core/computed/metrics/lantern-speed-index.js +1 -1
- package/core/computed/metrics/total-blocking-time.js +1 -1
- package/core/computed/navigation-insights.d.ts +2 -22
- package/core/computed/page-dependency-graph.js +5 -2
- package/core/computed/processed-navigation.d.ts +1 -1
- package/core/computed/tbt-impact-tasks.js +3 -2
- package/core/computed/trace-engine-result.d.ts +0 -12
- package/core/computed/trace-engine-result.js +5 -20
- package/core/config/constants.d.ts +28 -53
- package/core/config/constants.js +2 -43
- package/core/gather/driver/target-manager.d.ts +1 -1
- package/core/gather/gatherers/root-causes.js +0 -1
- package/core/gather/session.d.ts +3 -3
- 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 +48 -11
- package/core/lib/lantern/lantern.js +40 -43
- package/core/lib/lantern/metric.d.ts +10 -12
- package/core/lib/lantern/metric.js +7 -7
- 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 +8 -8
- package/core/lib/lantern/metrics/total-blocking-time.d.ts +3 -8
- package/core/lib/lantern/metrics/total-blocking-time.js +6 -6
- package/core/lib/lantern/page-dependency-graph.d.ts +17 -49
- package/core/lib/lantern/page-dependency-graph.js +45 -354
- 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 +25 -0
- package/core/lib/lantern/trace-engine-computation-data.js +468 -0
- package/core/lib/lantern/types/lantern.d.ts +77 -5
- package/core/lib/lantern-trace-saver.js +1 -1
- package/package.json +8 -8
- package/types/artifacts.d.ts +4 -11
- /package/core/{computed/metrics → lib/lantern}/tbt-utils.d.ts +0 -0
- /package/core/{computed/metrics → lib/lantern}/tbt-utils.js +0 -0
|
@@ -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') {
|
|
@@ -10,7 +10,7 @@ import {LoadSimulator} from '../load-simulator.js';
|
|
|
10
10
|
import {ProcessedNavigation} from '../processed-navigation.js';
|
|
11
11
|
import {PageDependencyGraph} from '../page-dependency-graph.js';
|
|
12
12
|
import {TraceEngineResult} from '../trace-engine-result.js';
|
|
13
|
-
import {createProcessedNavigation} from '../../lib/lantern/
|
|
13
|
+
import {createProcessedNavigation} from '../../lib/lantern/trace-engine-computation-data.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
@@ -39,7 +39,7 @@ async function getComputationDataParamsFromTrace(data, context) {
|
|
|
39
39
|
|
|
40
40
|
const graph = await PageDependencyGraph.request({...data, fromTrace: true}, context);
|
|
41
41
|
const traceEngineResult = await TraceEngineResult.request(data, context);
|
|
42
|
-
const processedNavigation = createProcessedNavigation(traceEngineResult);
|
|
42
|
+
const processedNavigation = createProcessedNavigation(traceEngineResult.data);
|
|
43
43
|
const simulator = data.simulator || (await LoadSimulator.request(data, context));
|
|
44
44
|
|
|
45
45
|
return {simulator, graph, processedNavigation};
|
|
@@ -34,7 +34,7 @@ class LanternSpeedIndex extends SpeedIndex {
|
|
|
34
34
|
const speedline = await Speedline.request(data.trace, context);
|
|
35
35
|
const fcpResult = await LanternFirstContentfulPaint.request(data, context);
|
|
36
36
|
return this.computeMetricWithGraphs(data, context, {
|
|
37
|
-
speedline,
|
|
37
|
+
observedSpeedIndex: speedline.speedIndex,
|
|
38
38
|
fcpResult,
|
|
39
39
|
});
|
|
40
40
|
}
|
|
@@ -9,7 +9,7 @@ import ComputedMetric from './metric.js';
|
|
|
9
9
|
import {TraceProcessor} from '../../lib/tracehouse/trace-processor.js';
|
|
10
10
|
import {LanternTotalBlockingTime} from './lantern-total-blocking-time.js';
|
|
11
11
|
import {Interactive} from './interactive.js';
|
|
12
|
-
import {calculateSumOfBlockingTime} from '
|
|
12
|
+
import {calculateSumOfBlockingTime} from '../../lib/lantern/tbt-utils.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @fileoverview This audit determines Total Blocking Time.
|
|
@@ -2,17 +2,7 @@ export { NavigationInsightsComputed as NavigationInsights };
|
|
|
2
2
|
declare const NavigationInsightsComputed: typeof NavigationInsights & {
|
|
3
3
|
request: (dependencies: import("../index.js").Trace, context: import("../../types/utility-types.js").default.ImmutableObject<{
|
|
4
4
|
computedCache: Map<string, import("../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
5
|
-
}>) => Promise<import("@paulirish/trace_engine/models/trace/insights/types.js").NavigationInsightData<
|
|
6
|
-
AuctionWorklets: typeof import("@paulirish/trace_engine/models/trace/handlers/AuctionWorkletsHandler.js");
|
|
7
|
-
Initiators: typeof import("@paulirish/trace_engine/models/trace/handlers/InitiatorsHandler.js");
|
|
8
|
-
LayoutShifts: typeof import("@paulirish/trace_engine/models/trace/handlers/LayoutShiftsHandler.js");
|
|
9
|
-
NetworkRequests: typeof import("@paulirish/trace_engine/models/trace/handlers/NetworkRequestsHandler.js");
|
|
10
|
-
Renderer: typeof import("@paulirish/trace_engine/models/trace/handlers/RendererHandler.js");
|
|
11
|
-
Samples: typeof import("@paulirish/trace_engine/models/trace/handlers/SamplesHandler.js");
|
|
12
|
-
Screenshots: typeof import("@paulirish/trace_engine/models/trace/handlers/ScreenshotsHandler.js");
|
|
13
|
-
PageLoadMetrics: typeof import("@paulirish/trace_engine/models/trace/handlers/PageLoadMetricsHandler.js");
|
|
14
|
-
Workers: typeof import("@paulirish/trace_engine/models/trace/handlers/WorkersHandler.js");
|
|
15
|
-
}>>;
|
|
5
|
+
}>) => Promise<import("@paulirish/trace_engine/models/trace/insights/types.js").NavigationInsightData<typeof import("@paulirish/trace_engine/models/trace/handlers/ModelHandlers.js")>>;
|
|
16
6
|
};
|
|
17
7
|
/**
|
|
18
8
|
* @fileoverview Gets insights from the shared trace engine for the navigation audited by Lighthouse.
|
|
@@ -23,16 +13,6 @@ declare class NavigationInsights {
|
|
|
23
13
|
* @param {LH.Trace} trace
|
|
24
14
|
* @param {LH.Artifacts.ComputedContext} context
|
|
25
15
|
*/
|
|
26
|
-
static compute_(trace: LH.Trace, context: LH.Artifacts.ComputedContext): Promise<import("@paulirish/trace_engine/models/trace/insights/types.js").NavigationInsightData<
|
|
27
|
-
AuctionWorklets: typeof import("@paulirish/trace_engine/models/trace/handlers/AuctionWorkletsHandler.js");
|
|
28
|
-
Initiators: typeof import("@paulirish/trace_engine/models/trace/handlers/InitiatorsHandler.js");
|
|
29
|
-
LayoutShifts: typeof import("@paulirish/trace_engine/models/trace/handlers/LayoutShiftsHandler.js");
|
|
30
|
-
NetworkRequests: typeof import("@paulirish/trace_engine/models/trace/handlers/NetworkRequestsHandler.js");
|
|
31
|
-
Renderer: typeof import("@paulirish/trace_engine/models/trace/handlers/RendererHandler.js");
|
|
32
|
-
Samples: typeof import("@paulirish/trace_engine/models/trace/handlers/SamplesHandler.js");
|
|
33
|
-
Screenshots: typeof import("@paulirish/trace_engine/models/trace/handlers/ScreenshotsHandler.js");
|
|
34
|
-
PageLoadMetrics: typeof import("@paulirish/trace_engine/models/trace/handlers/PageLoadMetricsHandler.js");
|
|
35
|
-
Workers: typeof import("@paulirish/trace_engine/models/trace/handlers/WorkersHandler.js");
|
|
36
|
-
}>>;
|
|
16
|
+
static compute_(trace: LH.Trace, context: LH.Artifacts.ComputedContext): Promise<import("@paulirish/trace_engine/models/trace/insights/types.js").NavigationInsightData<typeof import("@paulirish/trace_engine/models/trace/handlers/ModelHandlers.js")>>;
|
|
37
17
|
}
|
|
38
18
|
//# sourceMappingURL=navigation-insights.d.ts.map
|
|
@@ -10,6 +10,7 @@ import {NetworkRequest} from '../lib/network-request.js';
|
|
|
10
10
|
import {ProcessedTrace} from './processed-trace.js';
|
|
11
11
|
import {NetworkRecords} from './network-records.js';
|
|
12
12
|
import {TraceEngineResult} from './trace-engine-result.js';
|
|
13
|
+
import * as TraceEngineComputationData from '../lib/lantern/trace-engine-computation-data.js';
|
|
13
14
|
|
|
14
15
|
/** @typedef {import('../lib/lantern/base-node.js').Node<LH.Artifacts.NetworkRequest>} Node */
|
|
15
16
|
|
|
@@ -28,8 +29,10 @@ class PageDependencyGraph {
|
|
|
28
29
|
|
|
29
30
|
if (data.fromTrace) {
|
|
30
31
|
const traceEngineResult = await TraceEngineResult.request({trace}, context);
|
|
31
|
-
const
|
|
32
|
-
|
|
32
|
+
const traceEngineData = traceEngineResult.data;
|
|
33
|
+
const requests = TraceEngineComputationData.createNetworkRequests(trace, traceEngineData);
|
|
34
|
+
const graph =
|
|
35
|
+
TraceEngineComputationData.createGraph(requests, trace, traceEngineData, URL);
|
|
33
36
|
return graph;
|
|
34
37
|
}
|
|
35
38
|
|
|
@@ -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,13 +4,14 @@
|
|
|
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';
|
|
10
11
|
import {Interactive} from './metrics/interactive.js';
|
|
11
12
|
import {TotalBlockingTime} from './metrics/total-blocking-time.js';
|
|
12
13
|
import {ProcessedTrace} from './processed-trace.js';
|
|
13
|
-
import {calculateTbtImpactForEvent} from '
|
|
14
|
+
import {calculateTbtImpactForEvent} from '../lib/lantern/tbt-utils.js';
|
|
14
15
|
|
|
15
16
|
class TBTImpactTasks {
|
|
16
17
|
/**
|
|
@@ -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,5 +1,4 @@
|
|
|
1
1
|
export { TraceEngineResultComputed as TraceEngineResult };
|
|
2
|
-
export type EnabledHandlers = typeof ENABLED_HANDLERS;
|
|
3
2
|
declare const TraceEngineResultComputed: typeof TraceEngineResult & {
|
|
4
3
|
request: (dependencies: {
|
|
5
4
|
trace: LH.Trace;
|
|
@@ -7,17 +6,6 @@ declare const TraceEngineResultComputed: typeof TraceEngineResult & {
|
|
|
7
6
|
computedCache: Map<string, import("../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
8
7
|
}>) => Promise<LH.Artifacts.TraceEngineResult>;
|
|
9
8
|
};
|
|
10
|
-
declare namespace ENABLED_HANDLERS {
|
|
11
|
-
const AuctionWorklets: typeof import("@paulirish/trace_engine/models/trace/handlers/AuctionWorkletsHandler.js");
|
|
12
|
-
const Initiators: typeof import("@paulirish/trace_engine/models/trace/handlers/InitiatorsHandler.js");
|
|
13
|
-
const LayoutShifts: typeof import("@paulirish/trace_engine/models/trace/handlers/LayoutShiftsHandler.js");
|
|
14
|
-
const NetworkRequests: typeof import("@paulirish/trace_engine/models/trace/handlers/NetworkRequestsHandler.js");
|
|
15
|
-
const Renderer: typeof import("@paulirish/trace_engine/models/trace/handlers/RendererHandler.js");
|
|
16
|
-
const Samples: typeof import("@paulirish/trace_engine/models/trace/handlers/SamplesHandler.js");
|
|
17
|
-
const Screenshots: typeof import("@paulirish/trace_engine/models/trace/handlers/ScreenshotsHandler.js");
|
|
18
|
-
const PageLoadMetrics: typeof import("@paulirish/trace_engine/models/trace/handlers/PageLoadMetricsHandler.js");
|
|
19
|
-
const Workers: typeof import("@paulirish/trace_engine/models/trace/handlers/WorkersHandler.js");
|
|
20
|
-
}
|
|
21
9
|
/**
|
|
22
10
|
* @fileoverview Processes trace with the shared trace engine.
|
|
23
11
|
*/
|
|
@@ -10,20 +10,6 @@ import {CumulativeLayoutShift} from './metrics/cumulative-layout-shift.js';
|
|
|
10
10
|
import {ProcessedTrace} from './processed-trace.js';
|
|
11
11
|
import * as LH from '../../types/lh.js';
|
|
12
12
|
|
|
13
|
-
/** @typedef {typeof ENABLED_HANDLERS} EnabledHandlers */
|
|
14
|
-
|
|
15
|
-
const ENABLED_HANDLERS = {
|
|
16
|
-
AuctionWorklets: TraceEngine.TraceHandlers.AuctionWorklets,
|
|
17
|
-
Initiators: TraceEngine.TraceHandlers.Initiators,
|
|
18
|
-
LayoutShifts: TraceEngine.TraceHandlers.LayoutShifts,
|
|
19
|
-
NetworkRequests: TraceEngine.TraceHandlers.NetworkRequests,
|
|
20
|
-
Renderer: TraceEngine.TraceHandlers.Renderer,
|
|
21
|
-
Samples: TraceEngine.TraceHandlers.Samples,
|
|
22
|
-
Screenshots: TraceEngine.TraceHandlers.Screenshots,
|
|
23
|
-
PageLoadMetrics: TraceEngine.TraceHandlers.PageLoadMetrics,
|
|
24
|
-
Workers: TraceEngine.TraceHandlers.Workers,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
13
|
/**
|
|
28
14
|
* @fileoverview Processes trace with the shared trace engine.
|
|
29
15
|
*/
|
|
@@ -33,15 +19,14 @@ class TraceEngineResult {
|
|
|
33
19
|
* @return {Promise<LH.Artifacts.TraceEngineResult>}
|
|
34
20
|
*/
|
|
35
21
|
static async runTraceEngine(traceEvents) {
|
|
36
|
-
const
|
|
22
|
+
const processor = TraceEngine.TraceProcessor.createWithAllHandlers();
|
|
37
23
|
// eslint-disable-next-line max-len
|
|
38
|
-
await
|
|
24
|
+
await processor.parse(/** @type {import('@paulirish/trace_engine').Types.TraceEvents.TraceEventData[]} */ (
|
|
39
25
|
traceEvents
|
|
40
26
|
));
|
|
41
|
-
|
|
42
|
-
if (!
|
|
43
|
-
|
|
44
|
-
return {data: engine.traceParsedData, insights: engine.insights};
|
|
27
|
+
if (!processor.traceParsedData) throw new Error('No data');
|
|
28
|
+
if (!processor.insights) throw new Error('No insights');
|
|
29
|
+
return {data: processor.traceParsedData, insights: processor.insights};
|
|
45
30
|
}
|
|
46
31
|
|
|
47
32
|
/**
|
|
@@ -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']>}
|
|
@@ -66,7 +66,7 @@ export class TargetManager extends TargetManager_base {
|
|
|
66
66
|
* @param {LH.Protocol.TargetType} targetType
|
|
67
67
|
* @param {string} sessionId
|
|
68
68
|
*/
|
|
69
|
-
_getProtocolEventListener(targetType: LH.Protocol.TargetType, sessionId: string): <EventName extends keyof import("
|
|
69
|
+
_getProtocolEventListener(targetType: LH.Protocol.TargetType, sessionId: string): <EventName extends keyof import("devtools-protocol/types/protocol-mapping.js").ProtocolMapping.Events>(method: EventName, params: import("../../../types/protocol.js").default.RawEventMessageRecord[EventName]["params"]) => void;
|
|
70
70
|
/**
|
|
71
71
|
* @return {Promise<void>}
|
|
72
72
|
*/
|
|
@@ -114,7 +114,6 @@ class RootCauses extends BaseGatherer {
|
|
|
114
114
|
const rootCausesEngine = new TraceEngine.RootCauses(protocolInterface);
|
|
115
115
|
const layoutShiftEvents = traceParsedData.LayoutShifts.clusters.flatMap(c => c.events);
|
|
116
116
|
for (const event of layoutShiftEvents) {
|
|
117
|
-
// @ts-expect-error The data we do get in the trace processor is still enough here
|
|
118
117
|
const r = await rootCausesEngine.layoutShifts.rootCausesForEvent(traceParsedData, event);
|
|
119
118
|
if (!r) continue;
|
|
120
119
|
|
package/core/gather/session.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export class ProtocolSession extends ProtocolSession_base implements LH.Gatherer
|
|
|
17
17
|
* @param {E} method
|
|
18
18
|
* @param {LH.CrdpEvents[E]} params
|
|
19
19
|
*/
|
|
20
|
-
_handleProtocolEvent<E extends keyof import("
|
|
20
|
+
_handleProtocolEvent<E extends keyof import("devtools-protocol/types/protocol-mapping.js").ProtocolMapping.Events>(method: E, ...params: import("devtools-protocol/types/protocol-mapping.js").ProtocolMapping.Events[E]): void;
|
|
21
21
|
_targetCrashedPromise: Promise<never>;
|
|
22
22
|
id(): string;
|
|
23
23
|
/** @param {LH.Crdp.Target.TargetInfo} targetInfo */
|
|
@@ -40,7 +40,7 @@ export class ProtocolSession extends ProtocolSession_base implements LH.Gatherer
|
|
|
40
40
|
* @param {LH.CrdpCommands[C]['paramsType']} params
|
|
41
41
|
* @return {Promise<LH.CrdpCommands[C]['returnType']>}
|
|
42
42
|
*/
|
|
43
|
-
sendCommand<C extends keyof import("
|
|
43
|
+
sendCommand<C extends keyof import("devtools-protocol/types/protocol-mapping.js").ProtocolMapping.Commands>(method: C, ...params: import("devtools-protocol/types/protocol-mapping.js").ProtocolMapping.Commands[C]["paramsType"]): Promise<import("devtools-protocol/types/protocol-mapping.js").ProtocolMapping.Commands[C]["returnType"]>;
|
|
44
44
|
/**
|
|
45
45
|
* Send and if there's an error response, do not reject.
|
|
46
46
|
* @template {keyof LH.CrdpCommands} C
|
|
@@ -48,7 +48,7 @@ export class ProtocolSession extends ProtocolSession_base implements LH.Gatherer
|
|
|
48
48
|
* @param {LH.CrdpCommands[C]['paramsType']} params
|
|
49
49
|
* @return {Promise<void>}
|
|
50
50
|
*/
|
|
51
|
-
sendCommandAndIgnore<C_1 extends keyof import("
|
|
51
|
+
sendCommandAndIgnore<C_1 extends keyof import("devtools-protocol/types/protocol-mapping.js").ProtocolMapping.Commands>(method: C_1, ...params: import("devtools-protocol/types/protocol-mapping.js").ProtocolMapping.Commands[C_1]["paramsType"]): Promise<void>;
|
|
52
52
|
/**
|
|
53
53
|
* Disposes of a session so that it can no longer talk to Chrome.
|
|
54
54
|
* @return {Promise<void>}
|
|
@@ -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,13 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export const NetworkRequestTypes: LH.Util.SelfMap<LH.Crdp.Network.ResourceType>;
|
|
7
|
-
/**
|
|
8
|
-
* @param {LH.Artifacts.TraceEngineResult} traceEngineResult
|
|
9
|
-
* @return {Lantern.Simulation.ProcessedNavigation}
|
|
10
|
-
*/
|
|
11
|
-
export function createProcessedNavigation(traceEngineResult: LH.Artifacts.TraceEngineResult): Lantern.Simulation.ProcessedNavigation;
|
|
1
|
+
/** @type {Lantern.Util.SelfMap<Lantern.ResourceType>} */
|
|
2
|
+
export const NetworkRequestTypes: Lantern.Util.SelfMap<Lantern.ResourceType>;
|
|
3
|
+
export namespace constants {
|
|
4
|
+
export { throttling };
|
|
5
|
+
}
|
|
12
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 {};
|
|
13
50
|
//# sourceMappingURL=lantern.d.ts.map
|