lighthouse 12.0.0 → 12.1.0-dev.20240619
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/run.js +5 -38
- package/cli/test/smokehouse/lighthouse-runners/bundle.js +1 -1
- package/cli/test/smokehouse/smokehouse.js +11 -1
- package/core/audits/accessibility/aria-allowed-role.js +7 -9
- package/core/audits/byte-efficiency/byte-efficiency-audit.d.ts +2 -2
- package/core/audits/byte-efficiency/byte-efficiency-audit.js +3 -3
- package/core/audits/byte-efficiency/offscreen-images.js +1 -1
- package/core/audits/byte-efficiency/render-blocking-resources.d.ts +3 -3
- package/core/audits/byte-efficiency/render-blocking-resources.js +10 -10
- package/core/audits/dobetterweb/uses-http2.d.ts +2 -2
- package/core/audits/dobetterweb/uses-http2.js +5 -5
- package/core/audits/long-tasks.d.ts +7 -6
- package/core/audits/long-tasks.js +5 -4
- package/core/audits/metrics/first-meaningful-paint.d.ts +1 -17
- package/core/audits/metrics/first-meaningful-paint.js +5 -47
- package/core/audits/metrics/interactive.d.ts +1 -1
- package/core/audits/metrics/interactive.js +1 -1
- package/core/audits/predictive-perf.js +0 -6
- package/core/audits/prioritize-lcp-image.d.ts +1 -1
- package/core/audits/prioritize-lcp-image.js +2 -2
- package/core/audits/redirects.js +2 -3
- package/core/audits/third-party-facades.js +1 -1
- package/core/audits/third-party-summary.js +1 -1
- package/core/audits/uses-rel-preconnect.js +2 -2
- package/core/audits/uses-rel-preload.js +9 -9
- package/core/computed/critical-request-chains.js +3 -3
- package/core/computed/document-urls.js +3 -2
- package/core/computed/load-simulator.d.ts +4 -4
- package/core/computed/load-simulator.js +3 -54
- package/core/computed/main-resource.js +3 -2
- package/core/computed/metrics/interactive.d.ts +6 -0
- package/core/computed/metrics/interactive.js +2 -2
- package/core/computed/metrics/lantern-first-contentful-paint.d.ts +4 -4
- package/core/computed/metrics/lantern-first-contentful-paint.js +3 -3
- package/core/computed/metrics/lantern-interactive.d.ts +4 -4
- package/core/computed/metrics/lantern-interactive.js +6 -6
- package/core/computed/metrics/lantern-largest-contentful-paint.d.ts +4 -4
- package/core/computed/metrics/lantern-largest-contentful-paint.js +3 -3
- package/core/computed/metrics/lantern-max-potential-fid.d.ts +4 -4
- package/core/computed/metrics/lantern-max-potential-fid.js +3 -3
- package/core/computed/metrics/lantern-metric.d.ts +21 -2
- package/core/computed/metrics/lantern-metric.js +39 -4
- package/core/computed/metrics/lantern-speed-index.d.ts +4 -4
- package/core/computed/metrics/lantern-speed-index.js +4 -4
- package/core/computed/metrics/lantern-total-blocking-time.d.ts +4 -4
- package/core/computed/metrics/lantern-total-blocking-time.js +3 -3
- package/core/computed/metrics/timing-summary.js +0 -6
- package/core/computed/metrics/total-blocking-time.js +3 -1
- package/core/computed/navigation-insights.d.ts +2 -20
- package/core/computed/network-analysis.d.ts +0 -5
- package/core/computed/network-analysis.js +2 -42
- package/core/computed/page-dependency-graph.d.ts +5 -3
- package/core/computed/page-dependency-graph.js +17 -7
- package/core/computed/processed-navigation.d.ts +1 -1
- package/core/computed/tbt-impact-tasks.js +4 -2
- package/core/computed/trace-engine-result.d.ts +0 -11
- package/core/computed/trace-engine-result.js +5 -19
- package/core/config/constants.d.ts +28 -53
- package/core/config/constants.js +2 -43
- package/core/gather/driver/navigation.js +1 -1
- package/core/gather/driver/network-monitor.d.ts +2 -1
- package/core/gather/driver/network-monitor.js +4 -4
- package/core/gather/driver/target-manager.d.ts +1 -1
- package/core/gather/driver.d.ts +0 -12
- package/core/gather/driver.js +1 -26
- package/core/gather/gatherers/inspector-issues.js +1 -0
- package/core/gather/gatherers/root-causes.js +0 -1
- package/core/gather/session.d.ts +5 -3
- package/core/gather/session.js +22 -1
- package/core/lib/asset-saver.d.ts +13 -9
- package/core/lib/asset-saver.js +77 -30
- package/core/lib/bf-cache-strings.js +2 -2
- package/core/lib/lantern/{base-node.d.ts → BaseNode.d.ts} +7 -9
- package/core/lib/lantern/{base-node.js → BaseNode.js} +6 -6
- package/core/lib/lantern/BaseNode.test.js +385 -0
- package/core/lib/lantern/CpuNode.d.ts +43 -0
- package/core/lib/lantern/{cpu-node.js → CpuNode.js} +8 -9
- package/core/lib/lantern/{lantern-error.d.ts → LanternError.d.ts} +1 -1
- package/core/lib/lantern/{metric.d.ts → Metric.d.ts} +23 -25
- package/core/lib/lantern/{metric.js → Metric.js} +14 -16
- package/core/lib/lantern/{network-node.d.ts → NetworkNode.d.ts} +6 -7
- package/core/lib/lantern/{network-node.js → NetworkNode.js} +7 -9
- package/core/lib/lantern/PageDependencyGraph.d.ts +82 -0
- package/core/lib/lantern/{page-dependency-graph.js → PageDependencyGraph.js} +185 -50
- package/core/lib/lantern/PageDependencyGraph.test.js +654 -0
- package/core/{computed/metrics/tbt-utils.d.ts → lib/lantern/TBTUtils.d.ts} +1 -1
- package/core/lib/lantern/TBTUtils.test.d.ts +2 -0
- package/core/lib/lantern/TBTUtils.test.js +130 -0
- package/core/lib/lantern/TraceEngineComputationData.d.ts +25 -0
- package/core/lib/lantern/TraceEngineComputationData.js +466 -0
- package/core/lib/lantern/lantern.d.ts +19 -7
- package/core/lib/lantern/lantern.js +21 -1
- package/core/lib/lantern/metrics/{first-contentful-paint.d.ts → FirstContentfulPaint.d.ts} +11 -11
- package/core/lib/lantern/metrics/{first-contentful-paint.js → FirstContentfulPaint.js} +11 -13
- package/core/lib/lantern/metrics/FirstContentfulPaint.test.js +54 -0
- package/core/lib/lantern/metrics/Interactive.d.ts +20 -0
- package/core/lib/lantern/metrics/{interactive.js → Interactive.js} +23 -26
- package/core/lib/lantern/metrics/Interactive.test.js +56 -0
- package/core/lib/lantern/metrics/LargestContentfulPaint.d.ts +19 -0
- package/core/lib/lantern/metrics/{largest-contentful-paint.js → LargestContentfulPaint.js} +16 -19
- package/core/lib/lantern/metrics/LargestContentfulPaint.test.js +42 -0
- package/core/lib/lantern/metrics/MaxPotentialFID.d.ts +24 -0
- package/core/lib/lantern/metrics/{max-potential-fid.js → MaxPotentialFID.js} +12 -13
- package/core/lib/lantern/metrics/MetricTestUtils.d.ts +19 -0
- package/core/lib/lantern/metrics/MetricTestUtils.js +48 -0
- package/core/lib/lantern/metrics/{speed-index.d.ts → SpeedIndex.d.ts} +7 -13
- package/core/lib/lantern/metrics/{speed-index.js → SpeedIndex.js} +14 -16
- package/core/lib/lantern/metrics/SpeedIndex.test.js +83 -0
- package/core/lib/lantern/metrics/TotalBlockingTime.d.ts +25 -0
- package/core/lib/lantern/metrics/{total-blocking-time.js → TotalBlockingTime.js} +13 -16
- package/core/lib/lantern/metrics/__snapshots__/FirstContentfulPaint.test.js.snap +11 -0
- package/core/lib/lantern/metrics/__snapshots__/Interactive.test.js.snap +17 -0
- package/core/lib/lantern/metrics/metrics.d.ts +9 -0
- package/core/lib/lantern/metrics/metrics.js +16 -0
- package/core/lib/lantern/{simulator/connection-pool.d.ts → simulation/ConnectionPool.d.ts} +15 -15
- package/core/lib/lantern/{simulator/connection-pool.js → simulation/ConnectionPool.js} +25 -25
- package/core/lib/lantern/simulation/ConnectionPool.test.js +195 -0
- package/core/lib/lantern/simulation/Constants.d.ts +52 -0
- package/core/lib/lantern/simulation/Constants.js +48 -0
- package/core/lib/lantern/{simulator/dns-cache.d.ts → simulation/DNSCache.d.ts} +3 -3
- package/core/lib/lantern/{simulator/dns-cache.js → simulation/DNSCache.js} +2 -2
- package/core/lib/lantern/simulation/DNSCache.test.js +72 -0
- package/core/lib/lantern/{simulator/network-analyzer.d.ts → simulation/NetworkAnalyzer.d.ts} +34 -21
- package/core/lib/lantern/{simulator/network-analyzer.js → simulation/NetworkAnalyzer.js} +106 -57
- package/core/lib/lantern/simulation/NetworkAnalyzer.test.js +475 -0
- package/core/lib/lantern/{simulator/simulator-timing-map.d.ts → simulation/SimulationTimingMap.d.ts} +7 -7
- package/core/lib/lantern/{simulator/simulator-timing-map.js → simulation/SimulationTimingMap.js} +5 -6
- package/core/lib/lantern/{simulator/simulator.d.ts → simulation/Simulator.d.ts} +21 -19
- package/core/lib/lantern/{simulator/simulator.js → simulation/Simulator.js} +100 -45
- package/core/lib/lantern/simulation/Simulator.test.js +434 -0
- package/core/lib/lantern/simulation/TCPConnection.test.d.ts +2 -0
- package/core/lib/lantern/simulation/TCPConnection.test.js +374 -0
- package/core/lib/lantern/{simulator/tcp-connection.d.ts → simulation/TcpConnection.d.ts} +2 -2
- package/core/lib/lantern/{simulator/tcp-connection.js → simulation/TcpConnection.js} +1 -1
- package/core/lib/lantern/simulation/simulation.d.ts +21 -0
- package/core/lib/lantern/simulation/simulation.js +28 -0
- package/core/lib/lantern/types/lantern.d.ts +145 -20
- package/core/lib/lantern-trace-saver.d.ts +4 -4
- package/core/lib/lantern-trace-saver.js +4 -4
- package/core/lib/navigation-error.js +3 -3
- package/core/lib/network-recorder.js +2 -2
- package/core/lib/network-request.d.ts +29 -3
- package/core/lib/network-request.js +20 -13
- package/core/lib/tracehouse/trace-processor.d.ts +0 -2
- package/core/lib/tracehouse/trace-processor.js +1 -31
- package/core/lib/traces/metric-trace-events.js +0 -5
- package/dist/report/bundle.esm.js +1 -1
- package/dist/report/flow.js +1 -1
- package/dist/report/standalone.js +1 -1
- package/package.json +14 -13
- package/report/renderer/performance-category-renderer.js +1 -1
- package/shared/localization/locales/ar-XB.json +43 -4
- package/shared/localization/locales/ar.json +43 -4
- package/shared/localization/locales/bg.json +43 -4
- package/shared/localization/locales/ca.json +44 -5
- package/shared/localization/locales/cs.json +43 -4
- package/shared/localization/locales/da.json +43 -4
- package/shared/localization/locales/de.json +43 -4
- package/shared/localization/locales/el.json +43 -4
- package/shared/localization/locales/en-GB.json +42 -3
- package/shared/localization/locales/en-US.json +4 -4
- package/shared/localization/locales/en-XA.json +43 -4
- package/shared/localization/locales/en-XL.json +4 -4
- package/shared/localization/locales/es-419.json +43 -4
- package/shared/localization/locales/es.json +42 -3
- package/shared/localization/locales/fi.json +43 -4
- package/shared/localization/locales/fil.json +42 -3
- package/shared/localization/locales/fr.json +42 -3
- package/shared/localization/locales/he.json +48 -9
- package/shared/localization/locales/hi.json +43 -4
- package/shared/localization/locales/hr.json +43 -4
- package/shared/localization/locales/hu.json +42 -3
- package/shared/localization/locales/id.json +42 -3
- package/shared/localization/locales/it.json +43 -4
- package/shared/localization/locales/ja.json +42 -3
- package/shared/localization/locales/ko.json +43 -4
- package/shared/localization/locales/lt.json +42 -3
- package/shared/localization/locales/lv.json +43 -4
- package/shared/localization/locales/nl.json +44 -5
- package/shared/localization/locales/no.json +42 -3
- package/shared/localization/locales/pl.json +43 -4
- package/shared/localization/locales/pt-PT.json +43 -4
- package/shared/localization/locales/pt.json +43 -4
- package/shared/localization/locales/ro.json +43 -4
- package/shared/localization/locales/ru.json +43 -4
- package/shared/localization/locales/sk.json +43 -4
- package/shared/localization/locales/sl.json +42 -3
- package/shared/localization/locales/sr-Latn.json +43 -4
- package/shared/localization/locales/sr.json +43 -4
- package/shared/localization/locales/sv.json +42 -3
- package/shared/localization/locales/ta.json +42 -3
- package/shared/localization/locales/te.json +43 -4
- package/shared/localization/locales/th.json +44 -5
- package/shared/localization/locales/tr.json +43 -4
- package/shared/localization/locales/uk.json +43 -4
- package/shared/localization/locales/vi.json +43 -4
- package/shared/localization/locales/zh-HK.json +43 -4
- package/shared/localization/locales/zh-TW.json +43 -4
- package/shared/localization/locales/zh.json +43 -4
- package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +1 -0
- package/tsconfig-all.json +1 -0
- package/tsconfig.json +11 -7
- package/types/artifacts.d.ts +23 -25
- package/types/gatherer.d.ts +2 -3
- package/types/lhr/lhr.d.ts +2 -0
- package/core/computed/metrics/first-meaningful-paint.d.ts +0 -21
- package/core/computed/metrics/first-meaningful-paint.js +0 -44
- package/core/computed/metrics/lantern-first-meaningful-paint.d.ts +0 -25
- package/core/computed/metrics/lantern-first-meaningful-paint.js +0 -43
- package/core/lib/lantern/cpu-node.d.ts +0 -44
- package/core/lib/lantern/metrics/first-meaningful-paint.d.ts +0 -6
- package/core/lib/lantern/metrics/first-meaningful-paint.js +0 -64
- package/core/lib/lantern/metrics/interactive.d.ts +0 -26
- package/core/lib/lantern/metrics/largest-contentful-paint.d.ts +0 -19
- package/core/lib/lantern/metrics/max-potential-fid.d.ts +0 -30
- package/core/lib/lantern/metrics/total-blocking-time.d.ts +0 -31
- package/core/lib/lantern/page-dependency-graph.d.ts +0 -58
- /package/core/lib/lantern/{lantern-error.js → LanternError.js} +0 -0
- /package/core/{computed/metrics/tbt-utils.js → lib/lantern/TBTUtils.js} +0 -0
|
@@ -9,7 +9,6 @@ import {ProcessedNavigation} from '../processed-navigation.js';
|
|
|
9
9
|
import {Speedline} from '../speedline.js';
|
|
10
10
|
import {FirstContentfulPaint} from './first-contentful-paint.js';
|
|
11
11
|
import {FirstContentfulPaintAllFrames} from './first-contentful-paint-all-frames.js';
|
|
12
|
-
import {FirstMeaningfulPaint} from './first-meaningful-paint.js';
|
|
13
12
|
import {LargestContentfulPaint} from './largest-contentful-paint.js';
|
|
14
13
|
import {LargestContentfulPaintAllFrames} from './largest-contentful-paint-all-frames.js';
|
|
15
14
|
import {Interactive} from './interactive.js';
|
|
@@ -51,7 +50,6 @@ class TimingSummary {
|
|
|
51
50
|
const speedline = await Speedline.request(trace, context);
|
|
52
51
|
const firstContentfulPaint = await requestOrUndefined(FirstContentfulPaint, metricComputationData);
|
|
53
52
|
const firstContentfulPaintAllFrames = await requestOrUndefined(FirstContentfulPaintAllFrames, metricComputationData);
|
|
54
|
-
const firstMeaningfulPaint = await requestOrUndefined(FirstMeaningfulPaint, metricComputationData);
|
|
55
53
|
const largestContentfulPaint = await requestOrUndefined(LargestContentfulPaint, metricComputationData);
|
|
56
54
|
const largestContentfulPaintAllFrames = await requestOrUndefined(LargestContentfulPaintAllFrames, metricComputationData);
|
|
57
55
|
const interactive = await requestOrUndefined(Interactive, metricComputationData);
|
|
@@ -74,8 +72,6 @@ class TimingSummary {
|
|
|
74
72
|
firstContentfulPaintTs: firstContentfulPaint?.timestamp,
|
|
75
73
|
firstContentfulPaintAllFrames: firstContentfulPaintAllFrames?.timing,
|
|
76
74
|
firstContentfulPaintAllFramesTs: firstContentfulPaintAllFrames?.timestamp,
|
|
77
|
-
firstMeaningfulPaint: firstMeaningfulPaint?.timing,
|
|
78
|
-
firstMeaningfulPaintTs: firstMeaningfulPaint?.timestamp,
|
|
79
75
|
largestContentfulPaint: largestContentfulPaint?.timing,
|
|
80
76
|
largestContentfulPaintTs: largestContentfulPaint?.timestamp,
|
|
81
77
|
largestContentfulPaintAllFrames: largestContentfulPaintAllFrames?.timing,
|
|
@@ -107,8 +103,6 @@ class TimingSummary {
|
|
|
107
103
|
observedFirstContentfulPaintTs: processedNavigation?.timestamps.firstContentfulPaint,
|
|
108
104
|
observedFirstContentfulPaintAllFrames: processedNavigation?.timings.firstContentfulPaintAllFrames,
|
|
109
105
|
observedFirstContentfulPaintAllFramesTs: processedNavigation?.timestamps.firstContentfulPaintAllFrames,
|
|
110
|
-
observedFirstMeaningfulPaint: processedNavigation?.timings.firstMeaningfulPaint,
|
|
111
|
-
observedFirstMeaningfulPaintTs: processedNavigation?.timestamps.firstMeaningfulPaint,
|
|
112
106
|
observedLargestContentfulPaint: processedNavigation?.timings.largestContentfulPaint,
|
|
113
107
|
observedLargestContentfulPaintTs: processedNavigation?.timestamps.largestContentfulPaint,
|
|
114
108
|
observedLargestContentfulPaintAllFrames: processedNavigation?.timings.largestContentfulPaintAllFrames,
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import * as Lantern from '../../lib/lantern/lantern.js';
|
|
7
8
|
import {makeComputedArtifact} from '../computed-artifact.js';
|
|
8
9
|
import ComputedMetric from './metric.js';
|
|
9
10
|
import {TraceProcessor} from '../../lib/tracehouse/trace-processor.js';
|
|
10
11
|
import {LanternTotalBlockingTime} from './lantern-total-blocking-time.js';
|
|
11
12
|
import {Interactive} from './interactive.js';
|
|
12
|
-
|
|
13
|
+
|
|
14
|
+
const {calculateSumOfBlockingTime} = Lantern.TBTUtils;
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* @fileoverview This audit determines Total Blocking Time.
|
|
@@ -2,16 +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
|
-
}>>;
|
|
5
|
+
}>) => Promise<import("@paulirish/trace_engine/models/trace/insights/types.js").NavigationInsightData<typeof import("@paulirish/trace_engine/models/trace/handlers/ModelHandlers.js")>>;
|
|
15
6
|
};
|
|
16
7
|
/**
|
|
17
8
|
* @fileoverview Gets insights from the shared trace engine for the navigation audited by Lighthouse.
|
|
@@ -22,15 +13,6 @@ declare class NavigationInsights {
|
|
|
22
13
|
* @param {LH.Trace} trace
|
|
23
14
|
* @param {LH.Artifacts.ComputedContext} context
|
|
24
15
|
*/
|
|
25
|
-
static compute_(trace: LH.Trace, context: LH.Artifacts.ComputedContext): Promise<import("@paulirish/trace_engine/models/trace/insights/types.js").NavigationInsightData<
|
|
26
|
-
AuctionWorklets: typeof import("@paulirish/trace_engine/models/trace/handlers/AuctionWorkletsHandler.js");
|
|
27
|
-
Initiators: typeof import("@paulirish/trace_engine/models/trace/handlers/InitiatorsHandler.js");
|
|
28
|
-
LayoutShifts: typeof import("@paulirish/trace_engine/models/trace/handlers/LayoutShiftsHandler.js");
|
|
29
|
-
NetworkRequests: typeof import("@paulirish/trace_engine/models/trace/handlers/NetworkRequestsHandler.js");
|
|
30
|
-
Renderer: typeof import("@paulirish/trace_engine/models/trace/handlers/RendererHandler.js");
|
|
31
|
-
Samples: typeof import("@paulirish/trace_engine/models/trace/handlers/SamplesHandler.js");
|
|
32
|
-
Screenshots: typeof import("@paulirish/trace_engine/models/trace/handlers/ScreenshotsHandler.js");
|
|
33
|
-
PageLoadMetrics: typeof import("@paulirish/trace_engine/models/trace/handlers/PageLoadMetricsHandler.js");
|
|
34
|
-
}>>;
|
|
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")>>;
|
|
35
17
|
}
|
|
36
18
|
//# sourceMappingURL=navigation-insights.d.ts.map
|
|
@@ -5,11 +5,6 @@ declare const NetworkAnalysisComputed: typeof NetworkAnalysis & {
|
|
|
5
5
|
}>) => Promise<import("../index.js").Artifacts.NetworkAnalysis>;
|
|
6
6
|
};
|
|
7
7
|
declare class NetworkAnalysis {
|
|
8
|
-
/**
|
|
9
|
-
* @param {Array<LH.Artifacts.NetworkRequest>} records
|
|
10
|
-
* @return {LH.Util.StrictOmit<LH.Artifacts.NetworkAnalysis, 'throughput'>}
|
|
11
|
-
*/
|
|
12
|
-
static computeRTTAndServerResponseTime(records: Array<LH.Artifacts.NetworkRequest>): LH.Util.StrictOmit<LH.Artifacts.NetworkAnalysis, 'throughput'>;
|
|
13
8
|
/**
|
|
14
9
|
* @param {LH.DevtoolsLog} devtoolsLog
|
|
15
10
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -4,49 +4,11 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import * as Lantern from '../lib/lantern/lantern.js';
|
|
7
8
|
import {makeComputedArtifact} from './computed-artifact.js';
|
|
8
|
-
import {NetworkAnalyzer} from '../lib/lantern/simulator/network-analyzer.js';
|
|
9
9
|
import {NetworkRecords} from './network-records.js';
|
|
10
10
|
|
|
11
11
|
class NetworkAnalysis {
|
|
12
|
-
/**
|
|
13
|
-
* @param {Array<LH.Artifacts.NetworkRequest>} records
|
|
14
|
-
* @return {LH.Util.StrictOmit<LH.Artifacts.NetworkAnalysis, 'throughput'>}
|
|
15
|
-
*/
|
|
16
|
-
static computeRTTAndServerResponseTime(records) {
|
|
17
|
-
// First pass compute the estimated observed RTT to each origin's servers.
|
|
18
|
-
/** @type {Map<string, number>} */
|
|
19
|
-
const rttByOrigin = new Map();
|
|
20
|
-
for (const [origin, summary] of NetworkAnalyzer.estimateRTTByOrigin(records).entries()) {
|
|
21
|
-
rttByOrigin.set(origin, summary.min);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// We'll use the minimum RTT as the assumed connection latency since we care about how much addt'l
|
|
25
|
-
// latency each origin introduces as Lantern will be simulating with its own connection latency.
|
|
26
|
-
const minimumRtt = Math.min(...Array.from(rttByOrigin.values()));
|
|
27
|
-
// We'll use the observed RTT information to help estimate the server response time
|
|
28
|
-
const responseTimeSummaries = NetworkAnalyzer.estimateServerResponseTimeByOrigin(records, {
|
|
29
|
-
rttByOrigin,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
/** @type {Map<string, number>} */
|
|
33
|
-
const additionalRttByOrigin = new Map();
|
|
34
|
-
/** @type {Map<string, number>} */
|
|
35
|
-
const serverResponseTimeByOrigin = new Map();
|
|
36
|
-
for (const [origin, summary] of responseTimeSummaries.entries()) {
|
|
37
|
-
// Not all origins have usable timing data, we'll default to using no additional latency.
|
|
38
|
-
const rttForOrigin = rttByOrigin.get(origin) || minimumRtt;
|
|
39
|
-
additionalRttByOrigin.set(origin, rttForOrigin - minimumRtt);
|
|
40
|
-
serverResponseTimeByOrigin.set(origin, summary.median);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
rtt: minimumRtt,
|
|
45
|
-
additionalRttByOrigin,
|
|
46
|
-
serverResponseTimeByOrigin,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
12
|
/**
|
|
51
13
|
* @param {LH.DevtoolsLog} devtoolsLog
|
|
52
14
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -54,9 +16,7 @@ class NetworkAnalysis {
|
|
|
54
16
|
*/
|
|
55
17
|
static async compute_(devtoolsLog, context) {
|
|
56
18
|
const records = await NetworkRecords.request(devtoolsLog, context);
|
|
57
|
-
|
|
58
|
-
const rttAndServerResponseTime = NetworkAnalysis.computeRTTAndServerResponseTime(records);
|
|
59
|
-
return {throughput, ...rttAndServerResponseTime};
|
|
19
|
+
return Lantern.Simulation.NetworkAnalyzer.analyze(records);
|
|
60
20
|
}
|
|
61
21
|
}
|
|
62
22
|
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
export { PageDependencyGraphComputed as PageDependencyGraph };
|
|
2
|
-
export type Node = import('../lib/lantern/
|
|
2
|
+
export type Node = import('../lib/lantern/BaseNode.js').Node<LH.Artifacts.NetworkRequest>;
|
|
3
3
|
declare const PageDependencyGraphComputed: typeof PageDependencyGraph & {
|
|
4
4
|
request: (dependencies: {
|
|
5
5
|
trace: LH.Trace;
|
|
6
6
|
devtoolsLog: import("../index.js").DevtoolsLog;
|
|
7
7
|
URL: LH.Artifacts['URL'];
|
|
8
|
+
fromTrace?: boolean | undefined;
|
|
8
9
|
}, context: import("../../types/utility-types.js").default.ImmutableObject<{
|
|
9
10
|
computedCache: Map<string, import("../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
10
11
|
}>) => Promise<Node>;
|
|
11
12
|
};
|
|
12
13
|
import { NetworkRequest } from '../lib/network-request.js';
|
|
13
|
-
/** @typedef {import('../lib/lantern/
|
|
14
|
+
/** @typedef {import('../lib/lantern/BaseNode.js').Node<LH.Artifacts.NetworkRequest>} Node */
|
|
14
15
|
declare class PageDependencyGraph {
|
|
15
16
|
/**
|
|
16
|
-
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, URL: LH.Artifacts['URL']}} data
|
|
17
|
+
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, URL: LH.Artifacts['URL'], fromTrace?: boolean}} data
|
|
17
18
|
* @param {LH.Artifacts.ComputedContext} context
|
|
18
19
|
* @return {Promise<Node>}
|
|
19
20
|
*/
|
|
@@ -21,6 +22,7 @@ declare class PageDependencyGraph {
|
|
|
21
22
|
trace: LH.Trace;
|
|
22
23
|
devtoolsLog: import("../index.js").DevtoolsLog;
|
|
23
24
|
URL: LH.Artifacts['URL'];
|
|
25
|
+
fromTrace?: boolean | undefined;
|
|
24
26
|
}, context: LH.Artifacts.ComputedContext): Promise<Node>;
|
|
25
27
|
}
|
|
26
28
|
//# sourceMappingURL=page-dependency-graph.d.ts.map
|
|
@@ -4,33 +4,43 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import * as Lantern from '../lib/lantern/lantern.js';
|
|
7
8
|
import {makeComputedArtifact} from './computed-artifact.js';
|
|
8
|
-
import {PageDependencyGraph as LanternPageDependencyGraph} from '../lib/lantern/page-dependency-graph.js';
|
|
9
9
|
import {NetworkRequest} from '../lib/network-request.js';
|
|
10
10
|
import {ProcessedTrace} from './processed-trace.js';
|
|
11
11
|
import {NetworkRecords} from './network-records.js';
|
|
12
|
+
import {TraceEngineResult} from './trace-engine-result.js';
|
|
12
13
|
|
|
13
|
-
/** @typedef {import('../lib/lantern/
|
|
14
|
+
/** @typedef {import('../lib/lantern/BaseNode.js').Node<LH.Artifacts.NetworkRequest>} Node */
|
|
14
15
|
|
|
15
16
|
class PageDependencyGraph {
|
|
16
17
|
/**
|
|
17
|
-
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, URL: LH.Artifacts['URL']}} data
|
|
18
|
+
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, URL: LH.Artifacts['URL'], fromTrace?: boolean}} data
|
|
18
19
|
* @param {LH.Artifacts.ComputedContext} context
|
|
19
20
|
* @return {Promise<Node>}
|
|
20
21
|
*/
|
|
21
22
|
static async compute_(data, context) {
|
|
22
23
|
const {trace, devtoolsLog, URL} = data;
|
|
23
|
-
const [
|
|
24
|
+
const [{mainThreadEvents}, networkRecords] = await Promise.all([
|
|
24
25
|
ProcessedTrace.request(trace, context),
|
|
25
26
|
NetworkRecords.request(devtoolsLog, context),
|
|
26
27
|
]);
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
if (data.fromTrace) {
|
|
30
|
+
const traceEngineResult = await TraceEngineResult.request({trace}, context);
|
|
31
|
+
const traceEngineData = traceEngineResult.data;
|
|
32
|
+
const requests =
|
|
33
|
+
Lantern.TraceEngineComputationData.createNetworkRequests(trace, traceEngineData);
|
|
34
|
+
const graph =
|
|
35
|
+
Lantern.TraceEngineComputationData.createGraph(requests, trace, traceEngineData, URL);
|
|
36
|
+
return graph;
|
|
37
|
+
}
|
|
38
|
+
|
|
29
39
|
const lanternRequests = networkRecords.map(NetworkRequest.asLanternNetworkRequest);
|
|
30
|
-
return
|
|
40
|
+
return Lantern.PageDependencyGraph.createGraph(mainThreadEvents, lanternRequests, URL);
|
|
31
41
|
}
|
|
32
42
|
}
|
|
33
43
|
|
|
34
44
|
const PageDependencyGraphComputed =
|
|
35
|
-
makeComputedArtifact(PageDependencyGraph, ['devtoolsLog', 'trace', 'URL']);
|
|
45
|
+
makeComputedArtifact(PageDependencyGraph, ['devtoolsLog', 'trace', 'URL', 'fromTrace']);
|
|
36
46
|
export {PageDependencyGraphComputed as PageDependencyGraph};
|
|
@@ -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,15 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import * as Lantern from '../lib/lantern/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
|
-
|
|
14
|
+
|
|
15
|
+
const {calculateTbtImpactForEvent} = Lantern.TBTUtils;
|
|
14
16
|
|
|
15
17
|
class TBTImpactTasks {
|
|
16
18
|
/**
|
|
@@ -132,7 +134,7 @@ class TBTImpactTasks {
|
|
|
132
134
|
/** @type {Map<LH.Artifacts.TaskNode, {start: number, end: number, duration: number}>} */
|
|
133
135
|
const topLevelTaskToEvent = new Map();
|
|
134
136
|
|
|
135
|
-
/** @type {Map<
|
|
137
|
+
/** @type {Map<Lantern.TraceEvent, LH.Artifacts.TaskNode>} */
|
|
136
138
|
const traceEventToTask = new Map();
|
|
137
139
|
for (const task of tasks) {
|
|
138
140
|
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,16 +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
|
-
}
|
|
20
9
|
/**
|
|
21
10
|
* @fileoverview Processes trace with the shared trace engine.
|
|
22
11
|
*/
|
|
@@ -10,19 +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
|
-
};
|
|
25
|
-
|
|
26
13
|
/**
|
|
27
14
|
* @fileoverview Processes trace with the shared trace engine.
|
|
28
15
|
*/
|
|
@@ -32,15 +19,14 @@ class TraceEngineResult {
|
|
|
32
19
|
* @return {Promise<LH.Artifacts.TraceEngineResult>}
|
|
33
20
|
*/
|
|
34
21
|
static async runTraceEngine(traceEvents) {
|
|
35
|
-
const
|
|
22
|
+
const processor = TraceEngine.TraceProcessor.createWithAllHandlers();
|
|
36
23
|
// eslint-disable-next-line max-len
|
|
37
|
-
await
|
|
24
|
+
await processor.parse(/** @type {import('@paulirish/trace_engine').Types.TraceEvents.TraceEventData[]} */ (
|
|
38
25
|
traceEvents
|
|
39
26
|
));
|
|
40
|
-
|
|
41
|
-
if (!
|
|
42
|
-
|
|
43
|
-
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};
|
|
44
30
|
}
|
|
45
31
|
|
|
46
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.Simulation.Constants.throttling;
|
|
51
10
|
|
|
52
11
|
/**
|
|
53
12
|
* @type {Required<LH.SharedFlagsSettings['screenEmulation']>}
|
|
@@ -123,7 +123,7 @@ async function gotoURL(driver, requestor, options) {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
const waitConditions = await Promise.race([
|
|
126
|
-
|
|
126
|
+
session.onCrashPromise(),
|
|
127
127
|
Promise.all(waitConditionPromises),
|
|
128
128
|
]);
|
|
129
129
|
const timedOut = waitConditions.some(condition => condition.timedOut);
|
|
@@ -8,9 +8,10 @@ export class NetworkMonitor extends NetworkMonitor_base {
|
|
|
8
8
|
/**
|
|
9
9
|
* Finds all time periods where the number of inflight requests is less than or equal to the
|
|
10
10
|
* number of allowed concurrent requests.
|
|
11
|
+
* The time periods returned are in ms.
|
|
11
12
|
* @param {Array<LH.Artifacts.NetworkRequest>} requests
|
|
12
13
|
* @param {number} allowedConcurrentRequests
|
|
13
|
-
* @param {number=} endTime
|
|
14
|
+
* @param {number=} endTime In ms
|
|
14
15
|
* @return {Array<{start: number, end: number}>}
|
|
15
16
|
*/
|
|
16
17
|
static findNetworkQuietPeriods(requests: Array<LH.Artifacts.NetworkRequest>, allowedConcurrentRequests: number, endTime?: number | undefined): Array<{
|
|
@@ -202,9 +202,10 @@ class NetworkMonitor extends NetworkMonitorEventEmitter {
|
|
|
202
202
|
/**
|
|
203
203
|
* Finds all time periods where the number of inflight requests is less than or equal to the
|
|
204
204
|
* number of allowed concurrent requests.
|
|
205
|
+
* The time periods returned are in ms.
|
|
205
206
|
* @param {Array<LH.Artifacts.NetworkRequest>} requests
|
|
206
207
|
* @param {number} allowedConcurrentRequests
|
|
207
|
-
* @param {number=} endTime
|
|
208
|
+
* @param {number=} endTime In ms
|
|
208
209
|
* @return {Array<{start: number, end: number}>}
|
|
209
210
|
*/
|
|
210
211
|
static findNetworkQuietPeriods(requests, allowedConcurrentRequests, endTime = Infinity) {
|
|
@@ -215,10 +216,9 @@ class NetworkMonitor extends NetworkMonitorEventEmitter {
|
|
|
215
216
|
if (UrlUtils.isNonNetworkProtocol(request.protocol)) return;
|
|
216
217
|
if (request.protocol === 'ws' || request.protocol === 'wss') return;
|
|
217
218
|
|
|
218
|
-
|
|
219
|
-
timeBoundaries.push({time: request.networkRequestTime * 1000, isStart: true});
|
|
219
|
+
timeBoundaries.push({time: request.networkRequestTime, isStart: true});
|
|
220
220
|
if (request.finished) {
|
|
221
|
-
timeBoundaries.push({time: request.networkEndTime
|
|
221
|
+
timeBoundaries.push({time: request.networkEndTime, isStart: false});
|
|
222
222
|
}
|
|
223
223
|
});
|
|
224
224
|
|
|
@@ -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
|
*/
|
package/core/gather/driver.d.ts
CHANGED
|
@@ -14,10 +14,6 @@ export class Driver implements LH.Gatherer.Driver {
|
|
|
14
14
|
/** @type {Fetcher|undefined} */
|
|
15
15
|
_fetcher: Fetcher | undefined;
|
|
16
16
|
defaultSession: import("../../types/gatherer.js").default.ProtocolSession;
|
|
17
|
-
fatalRejection: {
|
|
18
|
-
promise: Promise<never>;
|
|
19
|
-
rej: (_: Error) => void;
|
|
20
|
-
};
|
|
21
17
|
/** @return {LH.Gatherer.Driver['executionContext']} */
|
|
22
18
|
get executionContext(): ExecutionContext;
|
|
23
19
|
get fetcher(): any;
|
|
@@ -27,14 +23,6 @@ export class Driver implements LH.Gatherer.Driver {
|
|
|
27
23
|
url(): Promise<string>;
|
|
28
24
|
/** @return {Promise<void>} */
|
|
29
25
|
connect(): Promise<void>;
|
|
30
|
-
/**
|
|
31
|
-
* If the target crashes, we can't continue gathering.
|
|
32
|
-
*
|
|
33
|
-
* FWIW, if the target unexpectedly detaches (eg the user closed the tab), pptr will
|
|
34
|
-
* catch that and reject into our this._cdpSession.send, which we'll alrady handle appropriately
|
|
35
|
-
* @return {void}
|
|
36
|
-
*/
|
|
37
|
-
listenForCrashes(): void;
|
|
38
26
|
/** @return {Promise<void>} */
|
|
39
27
|
disconnect(): Promise<void>;
|
|
40
28
|
}
|
package/core/gather/driver.js
CHANGED
|
@@ -8,7 +8,6 @@ import log from 'lighthouse-logger';
|
|
|
8
8
|
|
|
9
9
|
import {ExecutionContext} from './driver/execution-context.js';
|
|
10
10
|
import {TargetManager} from './driver/target-manager.js';
|
|
11
|
-
import {LighthouseError} from '../lib/lh-error.js';
|
|
12
11
|
import {Fetcher} from './fetcher.js';
|
|
13
12
|
import {NetworkMonitor} from './driver/network-monitor.js';
|
|
14
13
|
|
|
@@ -29,6 +28,7 @@ const throwingSession = {
|
|
|
29
28
|
sendCommand: throwNotConnectedFn,
|
|
30
29
|
sendCommandAndIgnore: throwNotConnectedFn,
|
|
31
30
|
dispose: throwNotConnectedFn,
|
|
31
|
+
onCrashPromise: throwNotConnectedFn,
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
/** @implements {LH.Gatherer.Driver} */
|
|
@@ -48,12 +48,6 @@ class Driver {
|
|
|
48
48
|
this._fetcher = undefined;
|
|
49
49
|
|
|
50
50
|
this.defaultSession = throwingSession;
|
|
51
|
-
|
|
52
|
-
// Poor man's Promise.withResolvers()
|
|
53
|
-
/** @param {Error} _ */
|
|
54
|
-
let rej = _ => {};
|
|
55
|
-
const promise = /** @type {Promise<never>} */ (new Promise((_, theRej) => rej = theRej));
|
|
56
|
-
this.fatalRejection = {promise, rej};
|
|
57
51
|
}
|
|
58
52
|
|
|
59
53
|
/** @return {LH.Gatherer.Driver['executionContext']} */
|
|
@@ -93,30 +87,11 @@ class Driver {
|
|
|
93
87
|
this._networkMonitor = new NetworkMonitor(this._targetManager);
|
|
94
88
|
await this._networkMonitor.enable();
|
|
95
89
|
this.defaultSession = this._targetManager.rootSession();
|
|
96
|
-
this.listenForCrashes();
|
|
97
90
|
this._executionContext = new ExecutionContext(this.defaultSession);
|
|
98
91
|
this._fetcher = new Fetcher(this.defaultSession);
|
|
99
92
|
log.timeEnd(status);
|
|
100
93
|
}
|
|
101
94
|
|
|
102
|
-
/**
|
|
103
|
-
* If the target crashes, we can't continue gathering.
|
|
104
|
-
*
|
|
105
|
-
* FWIW, if the target unexpectedly detaches (eg the user closed the tab), pptr will
|
|
106
|
-
* catch that and reject into our this._cdpSession.send, which we'll alrady handle appropriately
|
|
107
|
-
* @return {void}
|
|
108
|
-
*/
|
|
109
|
-
listenForCrashes() {
|
|
110
|
-
this.defaultSession.on('Inspector.targetCrashed', async _ => {
|
|
111
|
-
log.error('Driver', 'Inspector.targetCrashed');
|
|
112
|
-
// Manually detach so no more CDP traffic is attempted.
|
|
113
|
-
// Don't await, else our rejection will be a 'Target closed' protocol error on cross-talk CDP calls.
|
|
114
|
-
void this.defaultSession.dispose();
|
|
115
|
-
this.fatalRejection.rej(new LighthouseError(LighthouseError.errors.TARGET_CRASHED));
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
95
|
/** @return {Promise<void>} */
|
|
121
96
|
async disconnect() {
|
|
122
97
|
if (this.defaultSession === throwingSession) return;
|