lighthouse 12.1.0-dev.20240630 → 12.1.0-dev.20240701
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/audits/byte-efficiency/byte-efficiency-audit.d.ts +5 -7
- package/core/audits/byte-efficiency/byte-efficiency-audit.js +3 -6
- package/core/audits/byte-efficiency/render-blocking-resources.d.ts +3 -7
- package/core/audits/byte-efficiency/render-blocking-resources.js +10 -16
- package/core/audits/dobetterweb/uses-http2.d.ts +4 -6
- package/core/audits/dobetterweb/uses-http2.js +2 -5
- package/core/audits/long-tasks.d.ts +6 -6
- package/core/audits/long-tasks.js +4 -4
- package/core/audits/prioritize-lcp-image.d.ts +1 -1
- package/core/audits/uses-rel-preload.d.ts +4 -3
- package/core/audits/uses-rel-preload.js +8 -6
- package/core/computed/critical-request-chains.d.ts +4 -3
- package/core/computed/critical-request-chains.js +5 -4
- package/core/computed/document-urls.js +1 -1
- package/core/computed/load-simulator.d.ts +3 -4
- package/core/computed/load-simulator.js +1 -1
- package/core/computed/main-resource.js +1 -1
- package/core/computed/metrics/lantern-first-contentful-paint.d.ts +2 -4
- package/core/computed/metrics/lantern-first-contentful-paint.js +1 -3
- package/core/computed/metrics/lantern-interactive.d.ts +2 -4
- package/core/computed/metrics/lantern-interactive.js +1 -3
- package/core/computed/metrics/lantern-largest-contentful-paint.d.ts +2 -4
- package/core/computed/metrics/lantern-largest-contentful-paint.js +1 -3
- package/core/computed/metrics/lantern-max-potential-fid.d.ts +2 -4
- package/core/computed/metrics/lantern-max-potential-fid.js +1 -3
- package/core/computed/metrics/lantern-metric.d.ts +8 -8
- package/core/computed/metrics/lantern-metric.js +1 -1
- package/core/computed/metrics/lantern-speed-index.d.ts +2 -4
- package/core/computed/metrics/lantern-speed-index.js +1 -3
- package/core/computed/metrics/lantern-total-blocking-time.d.ts +2 -4
- package/core/computed/metrics/lantern-total-blocking-time.js +1 -3
- package/core/computed/metrics/total-blocking-time.js +1 -1
- package/core/computed/network-analysis.js +1 -1
- package/core/computed/page-dependency-graph.d.ts +3 -6
- package/core/computed/page-dependency-graph.js +3 -4
- package/core/computed/tbt-impact-tasks.js +2 -2
- package/core/lib/asset-saver.js +1 -1
- package/core/lib/lantern/lantern.d.ts +2 -19
- package/core/lib/lantern/lantern.js +2 -45
- package/core/lib/lantern-trace-saver.d.ts +4 -6
- package/core/lib/lantern-trace-saver.js +2 -3
- package/core/lib/navigation-error.js +2 -2
- package/core/lib/network-recorder.js +1 -1
- package/core/lib/network-request.d.ts +4 -4
- package/core/lib/network-request.js +2 -2
- package/package.json +2 -2
- package/tsconfig.json +0 -11
- package/types/artifacts.d.ts +2 -2
- package/types/gatherer.d.ts +4 -5
- package/core/lib/lantern/BaseNode.d.ts +0 -163
- package/core/lib/lantern/BaseNode.js +0 -369
- package/core/lib/lantern/BaseNode.test.js +0 -385
- package/core/lib/lantern/CpuNode.d.ts +0 -43
- package/core/lib/lantern/CpuNode.js +0 -99
- package/core/lib/lantern/LanternError.d.ts +0 -8
- package/core/lib/lantern/LanternError.js +0 -9
- package/core/lib/lantern/Metric.d.ts +0 -69
- package/core/lib/lantern/Metric.js +0 -137
- package/core/lib/lantern/NetworkNode.d.ts +0 -49
- package/core/lib/lantern/NetworkNode.js +0 -136
- package/core/lib/lantern/PageDependencyGraph.d.ts +0 -82
- package/core/lib/lantern/PageDependencyGraph.js +0 -610
- package/core/lib/lantern/PageDependencyGraph.test.js +0 -654
- package/core/lib/lantern/TBTUtils.d.ts +0 -44
- package/core/lib/lantern/TBTUtils.js +0 -76
- package/core/lib/lantern/TBTUtils.test.d.ts +0 -2
- package/core/lib/lantern/TBTUtils.test.js +0 -130
- package/core/lib/lantern/TraceEngineComputationData.d.ts +0 -25
- package/core/lib/lantern/TraceEngineComputationData.js +0 -466
- package/core/lib/lantern/metrics/FirstContentfulPaint.d.ts +0 -79
- package/core/lib/lantern/metrics/FirstContentfulPaint.js +0 -198
- package/core/lib/lantern/metrics/FirstContentfulPaint.test.js +0 -54
- package/core/lib/lantern/metrics/Interactive.d.ts +0 -20
- package/core/lib/lantern/metrics/Interactive.js +0 -109
- package/core/lib/lantern/metrics/Interactive.test.js +0 -56
- package/core/lib/lantern/metrics/LargestContentfulPaint.d.ts +0 -19
- package/core/lib/lantern/metrics/LargestContentfulPaint.js +0 -105
- package/core/lib/lantern/metrics/LargestContentfulPaint.test.js +0 -42
- package/core/lib/lantern/metrics/MaxPotentialFID.d.ts +0 -24
- package/core/lib/lantern/metrics/MaxPotentialFID.js +0 -91
- package/core/lib/lantern/metrics/MetricTestUtils.d.ts +0 -19
- package/core/lib/lantern/metrics/MetricTestUtils.js +0 -48
- package/core/lib/lantern/metrics/SpeedIndex.d.ts +0 -32
- package/core/lib/lantern/metrics/SpeedIndex.js +0 -142
- package/core/lib/lantern/metrics/SpeedIndex.test.js +0 -83
- package/core/lib/lantern/metrics/TotalBlockingTime.d.ts +0 -25
- package/core/lib/lantern/metrics/TotalBlockingTime.js +0 -125
- package/core/lib/lantern/metrics/__snapshots__/FirstContentfulPaint.test.js.snap +0 -11
- package/core/lib/lantern/metrics/__snapshots__/Interactive.test.js.snap +0 -17
- package/core/lib/lantern/metrics/metrics.d.ts +0 -9
- package/core/lib/lantern/metrics/metrics.js +0 -16
- package/core/lib/lantern/simulation/ConnectionPool.d.ts +0 -48
- package/core/lib/lantern/simulation/ConnectionPool.js +0 -152
- package/core/lib/lantern/simulation/ConnectionPool.test.js +0 -195
- package/core/lib/lantern/simulation/Constants.d.ts +0 -52
- package/core/lib/lantern/simulation/Constants.js +0 -48
- package/core/lib/lantern/simulation/DNSCache.d.ts +0 -42
- package/core/lib/lantern/simulation/DNSCache.js +0 -74
- package/core/lib/lantern/simulation/DNSCache.test.js +0 -72
- package/core/lib/lantern/simulation/NetworkAnalyzer.d.ts +0 -209
- package/core/lib/lantern/simulation/NetworkAnalyzer.js +0 -597
- package/core/lib/lantern/simulation/NetworkAnalyzer.test.js +0 -475
- package/core/lib/lantern/simulation/SimulationTimingMap.d.ts +0 -153
- package/core/lib/lantern/simulation/SimulationTimingMap.js +0 -219
- package/core/lib/lantern/simulation/Simulator.d.ts +0 -157
- package/core/lib/lantern/simulation/Simulator.js +0 -593
- package/core/lib/lantern/simulation/Simulator.test.js +0 -434
- package/core/lib/lantern/simulation/TCPConnection.test.d.ts +0 -2
- package/core/lib/lantern/simulation/TCPConnection.test.js +0 -374
- package/core/lib/lantern/simulation/TcpConnection.d.ts +0 -89
- package/core/lib/lantern/simulation/TcpConnection.js +0 -230
- package/core/lib/lantern/simulation/simulation.d.ts +0 -21
- package/core/lib/lantern/simulation/simulation.js +0 -28
- package/core/lib/lantern/types/lantern.d.ts +0 -256
- package/core/lib/lantern/types/lantern.js +0 -7
|
@@ -9,13 +9,11 @@ import {makeComputedArtifact} from '../computed-artifact.js';
|
|
|
9
9
|
import {getComputationDataParams, lanternErrorAdapter} from './lantern-metric.js';
|
|
10
10
|
import {LanternFirstContentfulPaint} from './lantern-first-contentful-paint.js';
|
|
11
11
|
|
|
12
|
-
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
13
|
-
|
|
14
12
|
class LanternLargestContentfulPaint extends Lantern.Metrics.LargestContentfulPaint {
|
|
15
13
|
/**
|
|
16
14
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
17
15
|
* @param {LH.Artifacts.ComputedContext} context
|
|
18
|
-
* @param {Omit<Extras, 'optimistic'>=} extras
|
|
16
|
+
* @param {Omit<Lantern.Metrics.Extras, 'optimistic'>=} extras
|
|
19
17
|
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
20
18
|
*/
|
|
21
19
|
static async computeMetricWithGraphs(data, context, extras) {
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
export { LanternMaxPotentialFIDComputed as LanternMaxPotentialFID };
|
|
2
|
-
export type Extras = import('../../lib/lantern/Metric.js').Extras;
|
|
3
2
|
declare const LanternMaxPotentialFIDComputed: typeof LanternMaxPotentialFID & {
|
|
4
3
|
request: (dependencies: import("../../index.js").Artifacts.MetricComputationDataInput, context: import("../../../types/utility-types.js").default.ImmutableObject<{
|
|
5
4
|
computedCache: Map<string, import("../../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
6
5
|
}>) => Promise<import("../../index.js").Artifacts.LanternMetric>;
|
|
7
6
|
};
|
|
8
|
-
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
9
7
|
declare class LanternMaxPotentialFID extends Lantern.Metrics.MaxPotentialFID {
|
|
10
8
|
/**
|
|
11
9
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
12
10
|
* @param {LH.Artifacts.ComputedContext} context
|
|
13
|
-
* @param {Omit<Extras, 'optimistic'>=} extras
|
|
11
|
+
* @param {Omit<Lantern.Metrics.Extras, 'optimistic'>=} extras
|
|
14
12
|
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
15
13
|
*/
|
|
16
|
-
static computeMetricWithGraphs(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext, extras?: Omit<Extras, 'optimistic'> | undefined): Promise<LH.Artifacts.LanternMetric>;
|
|
14
|
+
static computeMetricWithGraphs(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext, extras?: Omit<Lantern.Metrics.Extras, 'optimistic'> | undefined): Promise<LH.Artifacts.LanternMetric>;
|
|
17
15
|
/**
|
|
18
16
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
19
17
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -9,13 +9,11 @@ import {makeComputedArtifact} from '../computed-artifact.js';
|
|
|
9
9
|
import {getComputationDataParams, lanternErrorAdapter} from './lantern-metric.js';
|
|
10
10
|
import {LanternFirstContentfulPaint} from './lantern-first-contentful-paint.js';
|
|
11
11
|
|
|
12
|
-
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
13
|
-
|
|
14
12
|
class LanternMaxPotentialFID extends Lantern.Metrics.MaxPotentialFID {
|
|
15
13
|
/**
|
|
16
14
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
17
15
|
* @param {LH.Artifacts.ComputedContext} context
|
|
18
|
-
* @param {Omit<Extras, 'optimistic'>=} extras
|
|
16
|
+
* @param {Omit<Lantern.Metrics.Extras, 'optimistic'>=} extras
|
|
19
17
|
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
20
18
|
*/
|
|
21
19
|
static async computeMetricWithGraphs(data, context, extras) {
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
* @param {LH.Artifacts.ComputedContext} context
|
|
4
4
|
*/
|
|
5
5
|
export function getComputationDataParamsFromTrace(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<{
|
|
6
|
-
simulator:
|
|
7
|
-
graph: import("
|
|
8
|
-
processedNavigation:
|
|
6
|
+
simulator: import("../../../types/gatherer.js").default.Simulation.Simulator;
|
|
7
|
+
graph: import("../../../types/gatherer.js").default.Simulation.GraphNode;
|
|
8
|
+
processedNavigation: Lantern.Types.Simulation.ProcessedNavigation;
|
|
9
9
|
}>;
|
|
10
10
|
/**
|
|
11
11
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
12
12
|
* @param {LH.Artifacts.ComputedContext} context
|
|
13
13
|
*/
|
|
14
14
|
export function getComputationDataParamsFromDevtoolsLog(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<{
|
|
15
|
-
simulator:
|
|
16
|
-
graph: import("
|
|
15
|
+
simulator: import("../../../types/gatherer.js").default.Simulation.Simulator;
|
|
16
|
+
graph: import("../../../types/gatherer.js").default.Simulation.GraphNode;
|
|
17
17
|
processedNavigation: import("../../index.js").Artifacts.ProcessedNavigation;
|
|
18
18
|
}>;
|
|
19
19
|
/**
|
|
@@ -21,9 +21,9 @@ export function getComputationDataParamsFromDevtoolsLog(data: LH.Artifacts.Metri
|
|
|
21
21
|
* @param {LH.Artifacts.ComputedContext} context
|
|
22
22
|
*/
|
|
23
23
|
export function getComputationDataParams(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<{
|
|
24
|
-
simulator:
|
|
25
|
-
graph: import("
|
|
26
|
-
processedNavigation:
|
|
24
|
+
simulator: import("../../../types/gatherer.js").default.Simulation.Simulator;
|
|
25
|
+
graph: import("../../../types/gatherer.js").default.Simulation.GraphNode;
|
|
26
|
+
processedNavigation: Lantern.Types.Simulation.ProcessedNavigation;
|
|
27
27
|
}>;
|
|
28
28
|
/**
|
|
29
29
|
* @param {unknown} err
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
export { LanternSpeedIndexComputed as LanternSpeedIndex };
|
|
2
|
-
export type Extras = import('../../lib/lantern/Metric.js').Extras;
|
|
3
2
|
declare const LanternSpeedIndexComputed: typeof LanternSpeedIndex & {
|
|
4
3
|
request: (dependencies: import("../../index.js").Artifacts.MetricComputationDataInput, context: import("../../../types/utility-types.js").default.ImmutableObject<{
|
|
5
4
|
computedCache: Map<string, import("../../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
6
5
|
}>) => Promise<import("../../index.js").Artifacts.LanternMetric>;
|
|
7
6
|
};
|
|
8
|
-
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
9
7
|
declare class LanternSpeedIndex extends Lantern.Metrics.SpeedIndex {
|
|
10
8
|
/**
|
|
11
9
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
12
10
|
* @param {LH.Artifacts.ComputedContext} context
|
|
13
|
-
* @param {Omit<Extras, 'optimistic'>=} extras
|
|
11
|
+
* @param {Omit<Lantern.Metrics.Extras, 'optimistic'>=} extras
|
|
14
12
|
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
15
13
|
*/
|
|
16
|
-
static computeMetricWithGraphs(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext, extras?: Omit<Extras, 'optimistic'> | undefined): Promise<LH.Artifacts.LanternMetric>;
|
|
14
|
+
static computeMetricWithGraphs(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext, extras?: Omit<Lantern.Metrics.Extras, 'optimistic'> | undefined): Promise<LH.Artifacts.LanternMetric>;
|
|
17
15
|
/**
|
|
18
16
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
19
17
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -10,13 +10,11 @@ import {getComputationDataParams, lanternErrorAdapter} from './lantern-metric.js
|
|
|
10
10
|
import {Speedline} from '../speedline.js';
|
|
11
11
|
import {LanternFirstContentfulPaint} from './lantern-first-contentful-paint.js';
|
|
12
12
|
|
|
13
|
-
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
14
|
-
|
|
15
13
|
class LanternSpeedIndex extends Lantern.Metrics.SpeedIndex {
|
|
16
14
|
/**
|
|
17
15
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
18
16
|
* @param {LH.Artifacts.ComputedContext} context
|
|
19
|
-
* @param {Omit<Extras, 'optimistic'>=} extras
|
|
17
|
+
* @param {Omit<Lantern.Metrics.Extras, 'optimistic'>=} extras
|
|
20
18
|
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
21
19
|
*/
|
|
22
20
|
static async computeMetricWithGraphs(data, context, extras) {
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
export { LanternTotalBlockingTimeComputed as LanternTotalBlockingTime };
|
|
2
|
-
export type Extras = import('../../lib/lantern/Metric.js').Extras;
|
|
3
2
|
declare const LanternTotalBlockingTimeComputed: typeof LanternTotalBlockingTime & {
|
|
4
3
|
request: (dependencies: import("../../index.js").Artifacts.MetricComputationDataInput, context: import("../../../types/utility-types.js").default.ImmutableObject<{
|
|
5
4
|
computedCache: Map<string, import("../../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
6
5
|
}>) => Promise<import("../../index.js").Artifacts.LanternMetric>;
|
|
7
6
|
};
|
|
8
|
-
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
9
7
|
declare class LanternTotalBlockingTime extends Lantern.Metrics.TotalBlockingTime {
|
|
10
8
|
/**
|
|
11
9
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
12
10
|
* @param {LH.Artifacts.ComputedContext} context
|
|
13
|
-
* @param {Omit<Extras, 'optimistic'>=} extras
|
|
11
|
+
* @param {Omit<Lantern.Metrics.Extras, 'optimistic'>=} extras
|
|
14
12
|
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
15
13
|
*/
|
|
16
|
-
static computeMetricWithGraphs(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext, extras?: Omit<Extras, 'optimistic'> | undefined): Promise<LH.Artifacts.LanternMetric>;
|
|
14
|
+
static computeMetricWithGraphs(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext, extras?: Omit<Lantern.Metrics.Extras, 'optimistic'> | undefined): Promise<LH.Artifacts.LanternMetric>;
|
|
17
15
|
/**
|
|
18
16
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
19
17
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -10,13 +10,11 @@ import {LanternFirstContentfulPaint} from './lantern-first-contentful-paint.js';
|
|
|
10
10
|
import {LanternInteractive} from './lantern-interactive.js';
|
|
11
11
|
import {getComputationDataParams} from './lantern-metric.js';
|
|
12
12
|
|
|
13
|
-
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
14
|
-
|
|
15
13
|
class LanternTotalBlockingTime extends Lantern.Metrics.TotalBlockingTime {
|
|
16
14
|
/**
|
|
17
15
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
18
16
|
* @param {LH.Artifacts.ComputedContext} context
|
|
19
|
-
* @param {Omit<Extras, 'optimistic'>=} extras
|
|
17
|
+
* @param {Omit<Lantern.Metrics.Extras, 'optimistic'>=} extras
|
|
20
18
|
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
21
19
|
*/
|
|
22
20
|
static async computeMetricWithGraphs(data, context, extras) {
|
|
@@ -11,7 +11,7 @@ import {TraceProcessor} from '../../lib/tracehouse/trace-processor.js';
|
|
|
11
11
|
import {LanternTotalBlockingTime} from './lantern-total-blocking-time.js';
|
|
12
12
|
import {Interactive} from './interactive.js';
|
|
13
13
|
|
|
14
|
-
const {calculateSumOfBlockingTime} = Lantern.TBTUtils;
|
|
14
|
+
const {calculateSumOfBlockingTime} = Lantern.Metrics.TBTUtils;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @fileoverview This audit determines Total Blocking Time.
|
|
@@ -16,7 +16,7 @@ class NetworkAnalysis {
|
|
|
16
16
|
*/
|
|
17
17
|
static async compute_(devtoolsLog, context) {
|
|
18
18
|
const records = await NetworkRecords.request(devtoolsLog, context);
|
|
19
|
-
return Lantern.
|
|
19
|
+
return Lantern.Core.NetworkAnalyzer.analyze(records);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { PageDependencyGraphComputed as PageDependencyGraph };
|
|
2
|
-
export type Node = import('../lib/lantern/BaseNode.js').Node<LH.Artifacts.NetworkRequest>;
|
|
3
2
|
declare const PageDependencyGraphComputed: typeof PageDependencyGraph & {
|
|
4
3
|
request: (dependencies: {
|
|
5
4
|
trace: LH.Trace;
|
|
@@ -8,21 +7,19 @@ declare const PageDependencyGraphComputed: typeof PageDependencyGraph & {
|
|
|
8
7
|
fromTrace?: boolean | undefined;
|
|
9
8
|
}, context: import("../../types/utility-types.js").default.ImmutableObject<{
|
|
10
9
|
computedCache: Map<string, import("../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
11
|
-
}>) => Promise<
|
|
10
|
+
}>) => Promise<import("../../types/gatherer.js").default.Simulation.GraphNode>;
|
|
12
11
|
};
|
|
13
|
-
import { NetworkRequest } from '../lib/network-request.js';
|
|
14
|
-
/** @typedef {import('../lib/lantern/BaseNode.js').Node<LH.Artifacts.NetworkRequest>} Node */
|
|
15
12
|
declare class PageDependencyGraph {
|
|
16
13
|
/**
|
|
17
14
|
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, URL: LH.Artifacts['URL'], fromTrace?: boolean}} data
|
|
18
15
|
* @param {LH.Artifacts.ComputedContext} context
|
|
19
|
-
* @return {Promise<
|
|
16
|
+
* @return {Promise<LH.Gatherer.Simulation.GraphNode>}
|
|
20
17
|
*/
|
|
21
18
|
static compute_(data: {
|
|
22
19
|
trace: LH.Trace;
|
|
23
20
|
devtoolsLog: import("../index.js").DevtoolsLog;
|
|
24
21
|
URL: LH.Artifacts['URL'];
|
|
25
22
|
fromTrace?: boolean | undefined;
|
|
26
|
-
}, context: LH.Artifacts.ComputedContext): Promise<
|
|
23
|
+
}, context: LH.Artifacts.ComputedContext): Promise<LH.Gatherer.Simulation.GraphNode>;
|
|
27
24
|
}
|
|
28
25
|
//# sourceMappingURL=page-dependency-graph.d.ts.map
|
|
@@ -11,13 +11,11 @@ import {ProcessedTrace} from './processed-trace.js';
|
|
|
11
11
|
import {NetworkRecords} from './network-records.js';
|
|
12
12
|
import {TraceEngineResult} from './trace-engine-result.js';
|
|
13
13
|
|
|
14
|
-
/** @typedef {import('../lib/lantern/BaseNode.js').Node<LH.Artifacts.NetworkRequest>} Node */
|
|
15
|
-
|
|
16
14
|
class PageDependencyGraph {
|
|
17
15
|
/**
|
|
18
16
|
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, URL: LH.Artifacts['URL'], fromTrace?: boolean}} data
|
|
19
17
|
* @param {LH.Artifacts.ComputedContext} context
|
|
20
|
-
* @return {Promise<
|
|
18
|
+
* @return {Promise<LH.Gatherer.Simulation.GraphNode>}
|
|
21
19
|
*/
|
|
22
20
|
static async compute_(data, context) {
|
|
23
21
|
const {trace, devtoolsLog, URL} = data;
|
|
@@ -33,11 +31,12 @@ class PageDependencyGraph {
|
|
|
33
31
|
Lantern.TraceEngineComputationData.createNetworkRequests(trace, traceEngineData);
|
|
34
32
|
const graph =
|
|
35
33
|
Lantern.TraceEngineComputationData.createGraph(requests, trace, traceEngineData, URL);
|
|
34
|
+
// @ts-expect-error for now, ignore that this is a SyntheticNetworkEvent instead of LH's NetworkEvent.
|
|
36
35
|
return graph;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
const lanternRequests = networkRecords.map(NetworkRequest.asLanternNetworkRequest);
|
|
40
|
-
return Lantern.PageDependencyGraph.createGraph(mainThreadEvents, lanternRequests, URL);
|
|
39
|
+
return Lantern.Graph.PageDependencyGraph.createGraph(mainThreadEvents, lanternRequests, URL);
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
|
|
@@ -12,7 +12,7 @@ import {Interactive} from './metrics/interactive.js';
|
|
|
12
12
|
import {TotalBlockingTime} from './metrics/total-blocking-time.js';
|
|
13
13
|
import {ProcessedTrace} from './processed-trace.js';
|
|
14
14
|
|
|
15
|
-
const {calculateTbtImpactForEvent} = Lantern.TBTUtils;
|
|
15
|
+
const {calculateTbtImpactForEvent} = Lantern.Metrics.TBTUtils;
|
|
16
16
|
|
|
17
17
|
class TBTImpactTasks {
|
|
18
18
|
/**
|
|
@@ -134,7 +134,7 @@ class TBTImpactTasks {
|
|
|
134
134
|
/** @type {Map<LH.Artifacts.TaskNode, {start: number, end: number, duration: number}>} */
|
|
135
135
|
const topLevelTaskToEvent = new Map();
|
|
136
136
|
|
|
137
|
-
/** @type {Map<Lantern.TraceEvent, LH.Artifacts.TaskNode>} */
|
|
137
|
+
/** @type {Map<Lantern.Types.TraceEvent, LH.Artifacts.TaskNode>} */
|
|
138
138
|
const traceEventToTask = new Map();
|
|
139
139
|
for (const task of tasks) {
|
|
140
140
|
traceEventToTask.set(task.event, task);
|
package/core/lib/asset-saver.js
CHANGED
|
@@ -449,7 +449,7 @@ function saveDevtoolsLog(devtoolsLog, devtoolLogFilename, options = {}) {
|
|
|
449
449
|
async function saveLanternDebugTraces(pathWithBasename) {
|
|
450
450
|
if (!process.env.LANTERN_DEBUG) return;
|
|
451
451
|
|
|
452
|
-
for (const [label, nodeTimings] of Lantern.Simulation.Simulator.
|
|
452
|
+
for (const [label, nodeTimings] of Lantern.Simulation.Simulator.allNodeTimings) {
|
|
453
453
|
if (lanternTraceSaver.simulationNamesToIgnore.includes(label)) continue;
|
|
454
454
|
|
|
455
455
|
const traceFilename = `${pathWithBasename}-${label}${traceSuffix}`;
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
3
|
-
export { LanternError as Error } from "./LanternError.js";
|
|
4
|
-
export { Metric } from "./Metric.js";
|
|
5
|
-
export { NetworkNode } from "./NetworkNode.js";
|
|
6
|
-
export { PageDependencyGraph } from "./PageDependencyGraph.js";
|
|
7
|
-
export * as Metrics from "./metrics/metrics.js";
|
|
8
|
-
export * as Simulation from "./simulation/simulation.js";
|
|
9
|
-
export * as TBTUtils from "./TBTUtils.js";
|
|
10
|
-
export * as TraceEngineComputationData from "./TraceEngineComputationData.js";
|
|
11
|
-
export type NetworkRequest<T = any> = Lantern.NetworkRequest<T>;
|
|
12
|
-
export type ResourcePriority = Lantern.ResourcePriority;
|
|
13
|
-
export type ResourceTiming = Lantern.ResourceTiming;
|
|
14
|
-
export type ResourceType = Lantern.ResourceType;
|
|
15
|
-
export type Trace = Lantern.Trace;
|
|
16
|
-
export type TraceEvent = Lantern.TraceEvent;
|
|
17
|
-
/** @type {Lantern.Util.SelfMap<Lantern.ResourceType>} */
|
|
18
|
-
export const NetworkRequestTypes: Lantern.Util.SelfMap<Lantern.ResourceType>;
|
|
19
|
-
import * as Lantern from './types/lantern.js';
|
|
1
|
+
export * from "@paulirish/trace_engine/models/trace/lantern/lantern.js";
|
|
2
|
+
export { LanternComputationData as TraceEngineComputationData } from "@paulirish/trace_engine";
|
|
20
3
|
//# sourceMappingURL=lantern.d.ts.map
|
|
@@ -4,48 +4,5 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/** @type {Lantern.Util.SelfMap<Lantern.ResourceType>} */
|
|
10
|
-
const NetworkRequestTypes = {
|
|
11
|
-
XHR: 'XHR',
|
|
12
|
-
Fetch: 'Fetch',
|
|
13
|
-
EventSource: 'EventSource',
|
|
14
|
-
Script: 'Script',
|
|
15
|
-
Stylesheet: 'Stylesheet',
|
|
16
|
-
Image: 'Image',
|
|
17
|
-
Media: 'Media',
|
|
18
|
-
Font: 'Font',
|
|
19
|
-
Document: 'Document',
|
|
20
|
-
TextTrack: 'TextTrack',
|
|
21
|
-
WebSocket: 'WebSocket',
|
|
22
|
-
Other: 'Other',
|
|
23
|
-
Manifest: 'Manifest',
|
|
24
|
-
SignedExchange: 'SignedExchange',
|
|
25
|
-
Ping: 'Ping',
|
|
26
|
-
Preflight: 'Preflight',
|
|
27
|
-
CSPViolationReport: 'CSPViolationReport',
|
|
28
|
-
Prefetch: 'Prefetch',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export {BaseNode} from './BaseNode.js';
|
|
32
|
-
export {CPUNode} from './CpuNode.js';
|
|
33
|
-
export {LanternError as Error} from './LanternError.js';
|
|
34
|
-
export {Metric} from './Metric.js';
|
|
35
|
-
export {NetworkNode} from './NetworkNode.js';
|
|
36
|
-
export {PageDependencyGraph} from './PageDependencyGraph.js';
|
|
37
|
-
export * as Metrics from './metrics/metrics.js';
|
|
38
|
-
export * as Simulation from './simulation/simulation.js';
|
|
39
|
-
export * as TBTUtils from './TBTUtils.js';
|
|
40
|
-
export * as TraceEngineComputationData from './TraceEngineComputationData.js';
|
|
41
|
-
|
|
42
|
-
/** @template [T=any] @typedef {Lantern.NetworkRequest<T>} NetworkRequest */
|
|
43
|
-
/** @typedef {Lantern.ResourcePriority} ResourcePriority */
|
|
44
|
-
/** @typedef {Lantern.ResourceTiming} ResourceTiming */
|
|
45
|
-
/** @typedef {Lantern.ResourceType} ResourceType */
|
|
46
|
-
/** @typedef {Lantern.Trace} Trace */
|
|
47
|
-
/** @typedef {Lantern.TraceEvent} TraceEvent */
|
|
48
|
-
|
|
49
|
-
export {
|
|
50
|
-
NetworkRequestTypes,
|
|
51
|
-
};
|
|
7
|
+
export * from '@paulirish/trace_engine/models/trace/lantern/lantern.js';
|
|
8
|
+
export {LanternComputationData as TraceEngineComputationData} from '@paulirish/trace_engine';
|
|
@@ -3,18 +3,16 @@ declare namespace _default {
|
|
|
3
3
|
export { convertNodeTimingsToTrace };
|
|
4
4
|
}
|
|
5
5
|
export default _default;
|
|
6
|
-
export type
|
|
7
|
-
export type CompleteNodeTiming = import('./lantern/simulation/Simulator.js').CompleteNodeTiming;
|
|
6
|
+
export type CompleteNodeTiming = import('./lantern/lantern.js').Simulation.CompleteNodeTiming;
|
|
8
7
|
/**
|
|
9
8
|
* @license
|
|
10
9
|
* Copyright 2018 Google LLC
|
|
11
10
|
* SPDX-License-Identifier: Apache-2.0
|
|
12
11
|
*/
|
|
13
|
-
/** @typedef {import('./lantern/
|
|
14
|
-
/** @typedef {import('./lantern/simulation/Simulator.js').CompleteNodeTiming} CompleteNodeTiming */
|
|
12
|
+
/** @typedef {import('./lantern/lantern.js').Simulation.CompleteNodeTiming} CompleteNodeTiming */
|
|
15
13
|
/**
|
|
16
|
-
* @param {Map<
|
|
14
|
+
* @param {Map<LH.Gatherer.Simulation.GraphNode, CompleteNodeTiming>} nodeTimings
|
|
17
15
|
* @return {LH.Trace}
|
|
18
16
|
*/
|
|
19
|
-
declare function convertNodeTimingsToTrace(nodeTimings: Map<
|
|
17
|
+
declare function convertNodeTimingsToTrace(nodeTimings: Map<LH.Gatherer.Simulation.GraphNode, CompleteNodeTiming>): LH.Trace;
|
|
20
18
|
//# sourceMappingURL=lantern-trace-saver.d.ts.map
|
|
@@ -4,11 +4,10 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
/** @typedef {import('./lantern/
|
|
8
|
-
/** @typedef {import('./lantern/simulation/Simulator.js').CompleteNodeTiming} CompleteNodeTiming */
|
|
7
|
+
/** @typedef {import('./lantern/lantern.js').Simulation.CompleteNodeTiming} CompleteNodeTiming */
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
|
-
* @param {Map<
|
|
10
|
+
* @param {Map<LH.Gatherer.Simulation.GraphNode, CompleteNodeTiming>} nodeTimings
|
|
12
11
|
* @return {LH.Trace}
|
|
13
12
|
*/
|
|
14
13
|
function convertNodeTimingsToTrace(nodeTimings) {
|
|
@@ -131,7 +131,7 @@ function getNonHtmlError(finalRecord) {
|
|
|
131
131
|
function getPageLoadError(navigationError, context) {
|
|
132
132
|
const {url, networkRecords} = context;
|
|
133
133
|
/** @type {LH.Artifacts.NetworkRequest|undefined} */
|
|
134
|
-
let mainRecord = Lantern.
|
|
134
|
+
let mainRecord = Lantern.Core.NetworkAnalyzer.findResourceForUrl(networkRecords, url);
|
|
135
135
|
|
|
136
136
|
// If the url doesn't give us a network request, it's possible we landed on a chrome-error:// page
|
|
137
137
|
// In this case, just get the first document request.
|
|
@@ -149,7 +149,7 @@ function getPageLoadError(navigationError, context) {
|
|
|
149
149
|
// MIME Type is only set on the final redirected document request. Use this for the HTML check instead of root.
|
|
150
150
|
let finalRecord;
|
|
151
151
|
if (mainRecord) {
|
|
152
|
-
finalRecord = Lantern.
|
|
152
|
+
finalRecord = Lantern.Core.NetworkAnalyzer.resolveRedirects(mainRecord);
|
|
153
153
|
} else {
|
|
154
154
|
// We have no network requests to process, use the navError
|
|
155
155
|
return navigationError;
|
|
@@ -253,7 +253,7 @@ class NetworkRecorder extends RequestEventEmitter {
|
|
|
253
253
|
return record.redirectSource;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
const initiatorURL = Lantern.PageDependencyGraph.getNetworkInitiators(record)[0];
|
|
256
|
+
const initiatorURL = Lantern.Graph.PageDependencyGraph.getNetworkInitiators(record)[0];
|
|
257
257
|
let candidates = recordsByURL.get(initiatorURL) || [];
|
|
258
258
|
// The (valid) initiator must come before the initiated request.
|
|
259
259
|
candidates = candidates.filter(c => {
|
|
@@ -49,14 +49,14 @@ export class NetworkRequest {
|
|
|
49
49
|
static get TYPES(): LH.Util.SelfMap<LH.Crdp.Network.ResourceType>;
|
|
50
50
|
/**
|
|
51
51
|
* @param {NetworkRequest} record
|
|
52
|
-
* @return {Lantern.NetworkRequest<NetworkRequest>}
|
|
52
|
+
* @return {Lantern.Types.NetworkRequest<NetworkRequest>}
|
|
53
53
|
*/
|
|
54
|
-
static asLanternNetworkRequest(record: NetworkRequest): Lantern.NetworkRequest<NetworkRequest>;
|
|
54
|
+
static asLanternNetworkRequest(record: NetworkRequest): Lantern.Types.NetworkRequest<NetworkRequest>;
|
|
55
55
|
/**
|
|
56
|
-
* @param {NetworkRequest} record
|
|
56
|
+
* @param {Pick<NetworkRequest, 'protocol'|'parsedURL'>} record
|
|
57
57
|
* @return {boolean}
|
|
58
58
|
*/
|
|
59
|
-
static isNonNetworkRequest(record: NetworkRequest): boolean;
|
|
59
|
+
static isNonNetworkRequest(record: Pick<NetworkRequest, 'protocol' | 'parsedURL'>): boolean;
|
|
60
60
|
/**
|
|
61
61
|
* Technically there's not alignment on URLs that create "secure connections" vs "secure contexts"
|
|
62
62
|
* https://github.com/GoogleChrome/lighthouse/pull/11766#discussion_r582340683
|
|
@@ -577,7 +577,7 @@ class NetworkRequest {
|
|
|
577
577
|
|
|
578
578
|
/**
|
|
579
579
|
* @param {NetworkRequest} record
|
|
580
|
-
* @return {Lantern.NetworkRequest<NetworkRequest>}
|
|
580
|
+
* @return {Lantern.Types.NetworkRequest<NetworkRequest>}
|
|
581
581
|
*/
|
|
582
582
|
static asLanternNetworkRequest(record) {
|
|
583
583
|
// In LR, network records are missing connection timing, but we've smuggled it in via headers.
|
|
@@ -616,7 +616,7 @@ class NetworkRequest {
|
|
|
616
616
|
}
|
|
617
617
|
|
|
618
618
|
/**
|
|
619
|
-
* @param {NetworkRequest} record
|
|
619
|
+
* @param {Pick<NetworkRequest, 'protocol'|'parsedURL'>} record
|
|
620
620
|
* @return {boolean}
|
|
621
621
|
*/
|
|
622
622
|
static isNonNetworkRequest(record) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "12.1.0-dev.
|
|
4
|
+
"version": "12.1.0-dev.20240701",
|
|
5
5
|
"description": "Automated auditing, performance metrics, and best practices for the web.",
|
|
6
6
|
"main": "./core/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
"webtreemap-cdt": "^3.2.1"
|
|
182
182
|
},
|
|
183
183
|
"dependencies": {
|
|
184
|
-
"@paulirish/trace_engine": "
|
|
184
|
+
"@paulirish/trace_engine": "0.0.28",
|
|
185
185
|
"@sentry/node": "^6.17.4",
|
|
186
186
|
"axe-core": "^4.9.1",
|
|
187
187
|
"chrome-launcher": "^1.1.2",
|
package/tsconfig.json
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"clients/**/*.js",
|
|
18
18
|
"build/**/*.js",
|
|
19
19
|
"./types/**/*.d.ts",
|
|
20
|
-
"./core/lib/lantern/types/**/*.d.ts",
|
|
21
20
|
"eslint-local-rules.cjs",
|
|
22
21
|
"third-party/axe/valid-langs.js",
|
|
23
22
|
"third-party/esbuild-plugins-polyfills/esbuild-polyfills.js",
|
|
@@ -67,15 +66,6 @@
|
|
|
67
66
|
"core/test/lib/emulation-test.js",
|
|
68
67
|
"core/test/lib/i18n/i18n-test.js",
|
|
69
68
|
"core/test/lib/icons-test.js",
|
|
70
|
-
// TODO(15841): remove when importing Lantern from npm
|
|
71
|
-
"core/lib/lantern/BaseNode.test.js",
|
|
72
|
-
"core/lib/lantern/metrics/*.test.js",
|
|
73
|
-
"core/lib/lantern/PageDependencyGraph.test.js",
|
|
74
|
-
"core/lib/lantern/simulation/ConnectionPool.test.js",
|
|
75
|
-
"core/lib/lantern/simulation/DNSCache.test.js",
|
|
76
|
-
"core/lib/lantern/simulation/NetworkAnalyzer.test.js",
|
|
77
|
-
"core/lib/lantern/simulation/Simulator.test.js",
|
|
78
|
-
// ------ done TODO
|
|
79
69
|
"core/test/lib/lh-element-test.js",
|
|
80
70
|
"core/test/lib/lighthouse-compatibility-test.js",
|
|
81
71
|
"core/test/lib/manifest-parser-test.js",
|
|
@@ -112,6 +102,5 @@
|
|
|
112
102
|
"core/test/computed/metrics/interactive-test.js",
|
|
113
103
|
"core/test/computed/tbt-impact-tasks-test.js",
|
|
114
104
|
"core/test/fixtures/config-plugins/lighthouse-plugin-simple/plugin-simple.js",
|
|
115
|
-
"core/lib/lantern/metrics/MetricTestUtils.js",
|
|
116
105
|
],
|
|
117
106
|
}
|
package/types/artifacts.d.ts
CHANGED
|
@@ -565,7 +565,7 @@ declare module Artifacts {
|
|
|
565
565
|
trace: Trace;
|
|
566
566
|
settings: Audit.Context['settings'];
|
|
567
567
|
gatherContext: Artifacts['GatherContext'];
|
|
568
|
-
simulator?:
|
|
568
|
+
simulator?: Gatherer.Simulation.Simulator;
|
|
569
569
|
URL: Artifacts['URL'];
|
|
570
570
|
}
|
|
571
571
|
|
|
@@ -591,7 +591,7 @@ declare module Artifacts {
|
|
|
591
591
|
throughput: number;
|
|
592
592
|
}
|
|
593
593
|
|
|
594
|
-
type LanternMetric = Lantern.Metrics.
|
|
594
|
+
type LanternMetric = Lantern.Metrics.MetricResult<Artifacts.NetworkRequest>;
|
|
595
595
|
|
|
596
596
|
type Speedline = speedline.Output<'speedIndex'>;
|
|
597
597
|
|
package/types/gatherer.d.ts
CHANGED
|
@@ -133,12 +133,11 @@ declare module Gatherer {
|
|
|
133
133
|
type AnyGathererInstance = GathererInstanceExpander<Gatherer.DependencyKey>
|
|
134
134
|
|
|
135
135
|
namespace Simulation {
|
|
136
|
-
type GraphNode = Lantern.
|
|
137
|
-
type GraphNetworkNode = Lantern.
|
|
138
|
-
type GraphCPUNode = Lantern.
|
|
136
|
+
type GraphNode = Lantern.Graph.Node<Artifacts.NetworkRequest>;
|
|
137
|
+
type GraphNetworkNode = Lantern.Graph.NetworkNode<Artifacts.NetworkRequest>;
|
|
138
|
+
type GraphCPUNode = Lantern.Graph.CPUNode<Artifacts.NetworkRequest>;
|
|
139
139
|
type Simulator = Lantern.Simulation.Simulator<Artifacts.NetworkRequest>;
|
|
140
|
-
type NodeTiming = Lantern.Simulation.NodeTiming;
|
|
141
|
-
type MetricCoefficients = Lantern.Simulation.MetricCoefficients;
|
|
140
|
+
type NodeTiming = Lantern.Types.Simulation.NodeTiming;
|
|
142
141
|
type Result = Lantern.Simulation.Result<Artifacts.NetworkRequest>;
|
|
143
142
|
}
|
|
144
143
|
}
|