lighthouse 12.0.0 → 12.1.0
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
|
@@ -61,8 +61,8 @@ class UsesRelPreloadAudit extends Audit {
|
|
|
61
61
|
if (node.type !== 'network') return;
|
|
62
62
|
// Don't include the node itself or any CPU nodes in the initiatorPath
|
|
63
63
|
const path = traversalPath.slice(1).filter(initiator => initiator.type === 'network');
|
|
64
|
-
if (!UsesRelPreloadAudit.shouldPreloadRequest(node.
|
|
65
|
-
urls.add(node.
|
|
64
|
+
if (!UsesRelPreloadAudit.shouldPreloadRequest(node.rawRequest, mainResource, path)) return;
|
|
65
|
+
urls.add(node.rawRequest.url);
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
return urls;
|
|
@@ -77,7 +77,7 @@ class UsesRelPreloadAudit extends Audit {
|
|
|
77
77
|
static getURLsFailedToPreload(graph) {
|
|
78
78
|
/** @type {Array<LH.Artifacts.NetworkRequest>} */
|
|
79
79
|
const requests = [];
|
|
80
|
-
graph.traverse(node => node.type === 'network' && requests.push(node.
|
|
80
|
+
graph.traverse(node => node.type === 'network' && requests.push(node.rawRequest));
|
|
81
81
|
|
|
82
82
|
const preloadRequests = requests.filter(req => req.isLinkPreload);
|
|
83
83
|
const preloadURLsByFrame = new Map();
|
|
@@ -157,7 +157,7 @@ class UsesRelPreloadAudit extends Audit {
|
|
|
157
157
|
|
|
158
158
|
if (node.isMainDocument()) {
|
|
159
159
|
mainDocumentNode = node;
|
|
160
|
-
} else if (node.
|
|
160
|
+
} else if (node.rawRequest && urls.has(node.rawRequest.url)) {
|
|
161
161
|
nodesToPreload.push(node);
|
|
162
162
|
}
|
|
163
163
|
});
|
|
@@ -176,20 +176,20 @@ class UsesRelPreloadAudit extends Audit {
|
|
|
176
176
|
|
|
177
177
|
// Once we've modified the dependencies, simulate the new graph.
|
|
178
178
|
const simulationAfterChanges = simulator.simulate(modifiedGraph);
|
|
179
|
-
const
|
|
180
|
-
// @ts-expect-error we don't care if all nodes without a
|
|
181
|
-
.reduce((map, node) => map.set(node.
|
|
179
|
+
const originalNodesByRequest = Array.from(simulationBeforeChanges.nodeTimings.keys())
|
|
180
|
+
// @ts-expect-error we don't care if all nodes without a request collect on `undefined`
|
|
181
|
+
.reduce((map, node) => map.set(node.request, node), new Map());
|
|
182
182
|
|
|
183
183
|
const results = [];
|
|
184
184
|
for (const node of nodesToPreload) {
|
|
185
|
-
const originalNode =
|
|
185
|
+
const originalNode = originalNodesByRequest.get(node.request);
|
|
186
186
|
const timingAfter = simulationAfterChanges.nodeTimings.get(node);
|
|
187
187
|
const timingBefore = simulationBeforeChanges.nodeTimings.get(originalNode);
|
|
188
188
|
if (!timingBefore || !timingAfter) throw new Error('Missing preload node');
|
|
189
189
|
|
|
190
190
|
const wastedMs = Math.round(timingBefore.endTime - timingAfter.endTime);
|
|
191
191
|
if (wastedMs < THRESHOLD_IN_MS) continue;
|
|
192
|
-
results.push({url: node.
|
|
192
|
+
results.push({url: node.rawRequest.url, wastedMs});
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
if (!results.length) {
|
|
@@ -105,19 +105,19 @@ class CriticalRequestChains {
|
|
|
105
105
|
graph.traverse((node, traversalPath) => {
|
|
106
106
|
seenNodes.add(node);
|
|
107
107
|
if (node.type !== 'network') return;
|
|
108
|
-
if (!CriticalRequestChains.isCritical(node.
|
|
108
|
+
if (!CriticalRequestChains.isCritical(node.rawRequest, mainResource)) return;
|
|
109
109
|
|
|
110
110
|
const networkPath = traversalPath
|
|
111
111
|
.filter(/** @return {n is LH.Gatherer.Simulation.GraphNetworkNode} */
|
|
112
112
|
n => n.type === 'network')
|
|
113
113
|
.reverse()
|
|
114
|
-
.map(node => node.
|
|
114
|
+
.map(node => node.rawRequest);
|
|
115
115
|
|
|
116
116
|
// Ignore if some ancestor is not a critical request.
|
|
117
117
|
if (networkPath.some(r => !CriticalRequestChains.isCritical(r, mainResource))) return;
|
|
118
118
|
|
|
119
119
|
// Ignore non-network things (like data urls).
|
|
120
|
-
if (NetworkRequest.isNonNetworkRequest(node.
|
|
120
|
+
if (NetworkRequest.isNonNetworkRequest(node.rawRequest)) return;
|
|
121
121
|
|
|
122
122
|
addChain(networkPath);
|
|
123
123
|
}, getNextNodes);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import * as Lantern from '../lib/lantern/lantern.js';
|
|
8
8
|
import {makeComputedArtifact} from './computed-artifact.js';
|
|
9
9
|
import {NetworkRecords} from './network-records.js';
|
|
10
10
|
import {ProcessedTrace} from './processed-trace.js';
|
|
@@ -41,7 +41,8 @@ class DocumentUrls {
|
|
|
41
41
|
}
|
|
42
42
|
if (!requestedUrl || !mainDocumentUrl) throw new Error('No main frame navigations found');
|
|
43
43
|
|
|
44
|
-
const initialRequest =
|
|
44
|
+
const initialRequest =
|
|
45
|
+
Lantern.Simulation.NetworkAnalyzer.findResourceForUrl(networkRecords, requestedUrl);
|
|
45
46
|
if (initialRequest?.redirects?.length) requestedUrl = initialRequest.redirects[0].url;
|
|
46
47
|
|
|
47
48
|
return {requestedUrl, mainDocumentUrl};
|
|
@@ -5,24 +5,24 @@ declare const LoadSimulatorComputed: typeof LoadSimulator & {
|
|
|
5
5
|
settings: LH.Audit.Context['settings'];
|
|
6
6
|
}, context: import("../../types/utility-types.js").default.ImmutableObject<{
|
|
7
7
|
computedCache: Map<string, import("../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
8
|
-
}>) => Promise<Simulator<any>>;
|
|
8
|
+
}>) => Promise<Lantern.Simulation.Simulator<any>>;
|
|
9
9
|
};
|
|
10
10
|
declare class LoadSimulator {
|
|
11
11
|
/**
|
|
12
12
|
* @param {{devtoolsLog: LH.DevtoolsLog, settings: LH.Audit.Context['settings']}} data
|
|
13
13
|
* @param {LH.Artifacts.ComputedContext} context
|
|
14
|
-
* @return {Promise<Simulator>}
|
|
14
|
+
* @return {Promise<Lantern.Simulation.Simulator>}
|
|
15
15
|
*/
|
|
16
16
|
static compute_(data: {
|
|
17
17
|
devtoolsLog: import("../index.js").DevtoolsLog;
|
|
18
18
|
settings: LH.Audit.Context['settings'];
|
|
19
|
-
}, context: LH.Artifacts.ComputedContext): Promise<Simulator>;
|
|
19
|
+
}, context: LH.Artifacts.ComputedContext): Promise<Lantern.Simulation.Simulator>;
|
|
20
20
|
/**
|
|
21
21
|
* @param {LH.Artifacts.NetworkAnalysis} networkAnalysis
|
|
22
22
|
* @return {LH.PrecomputedLanternData}
|
|
23
23
|
*/
|
|
24
24
|
static convertAnalysisToSaveableLanternData(networkAnalysis: LH.Artifacts.NetworkAnalysis): LH.PrecomputedLanternData;
|
|
25
25
|
}
|
|
26
|
-
import
|
|
26
|
+
import * as Lantern from '../lib/lantern/lantern.js';
|
|
27
27
|
import { NetworkAnalysis } from './network-analysis.js';
|
|
28
28
|
//# sourceMappingURL=load-simulator.d.ts.map
|
|
@@ -4,70 +4,19 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import * as Lantern from '../lib/lantern/types/lantern.js';
|
|
8
7
|
import {makeComputedArtifact} from './computed-artifact.js';
|
|
9
|
-
import * as
|
|
10
|
-
import {Simulator} from '../lib/lantern/simulator/simulator.js';
|
|
8
|
+
import * as Lantern from '../lib/lantern/lantern.js';
|
|
11
9
|
import {NetworkAnalysis} from './network-analysis.js';
|
|
12
10
|
|
|
13
11
|
class LoadSimulator {
|
|
14
12
|
/**
|
|
15
13
|
* @param {{devtoolsLog: LH.DevtoolsLog, settings: LH.Audit.Context['settings']}} data
|
|
16
14
|
* @param {LH.Artifacts.ComputedContext} context
|
|
17
|
-
* @return {Promise<Simulator>}
|
|
15
|
+
* @return {Promise<Lantern.Simulation.Simulator>}
|
|
18
16
|
*/
|
|
19
17
|
static async compute_(data, context) {
|
|
20
|
-
const {throttlingMethod, throttling, precomputedLanternData} = data.settings;
|
|
21
18
|
const networkAnalysis = await NetworkAnalysis.request(data.devtoolsLog, context);
|
|
22
|
-
|
|
23
|
-
/** @type {Lantern.Simulation.Options} */
|
|
24
|
-
const options = {
|
|
25
|
-
additionalRttByOrigin: networkAnalysis.additionalRttByOrigin,
|
|
26
|
-
serverResponseTimeByOrigin: networkAnalysis.serverResponseTimeByOrigin,
|
|
27
|
-
observedThroughput: networkAnalysis.throughput,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// If we have precomputed lantern data, overwrite our observed estimates and use precomputed instead
|
|
31
|
-
// for increased stability.
|
|
32
|
-
if (precomputedLanternData) {
|
|
33
|
-
options.additionalRttByOrigin = new Map(Object.entries(
|
|
34
|
-
precomputedLanternData.additionalRttByOrigin));
|
|
35
|
-
options.serverResponseTimeByOrigin = new Map(Object.entries(
|
|
36
|
-
precomputedLanternData.serverResponseTimeByOrigin));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
switch (throttlingMethod) {
|
|
40
|
-
case 'provided':
|
|
41
|
-
options.rtt = networkAnalysis.rtt;
|
|
42
|
-
options.throughput = networkAnalysis.throughput;
|
|
43
|
-
options.cpuSlowdownMultiplier = 1;
|
|
44
|
-
options.layoutTaskMultiplier = 1;
|
|
45
|
-
break;
|
|
46
|
-
case 'devtools':
|
|
47
|
-
if (throttling) {
|
|
48
|
-
options.rtt =
|
|
49
|
-
throttling.requestLatencyMs / constants.throttling.DEVTOOLS_RTT_ADJUSTMENT_FACTOR;
|
|
50
|
-
options.throughput =
|
|
51
|
-
throttling.downloadThroughputKbps * 1024 /
|
|
52
|
-
constants.throttling.DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
options.cpuSlowdownMultiplier = 1;
|
|
56
|
-
options.layoutTaskMultiplier = 1;
|
|
57
|
-
break;
|
|
58
|
-
case 'simulate':
|
|
59
|
-
if (throttling) {
|
|
60
|
-
options.rtt = throttling.rttMs;
|
|
61
|
-
options.throughput = throttling.throughputKbps * 1024;
|
|
62
|
-
options.cpuSlowdownMultiplier = throttling.cpuSlowdownMultiplier;
|
|
63
|
-
}
|
|
64
|
-
break;
|
|
65
|
-
default:
|
|
66
|
-
// intentionally fallback to simulator defaults
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return new Simulator(options);
|
|
19
|
+
return Lantern.Simulation.Simulator.createSimulator({...data.settings, networkAnalysis});
|
|
71
20
|
}
|
|
72
21
|
|
|
73
22
|
/**
|
|
@@ -4,9 +4,9 @@
|
|
|
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 {NetworkRecords} from './network-records.js';
|
|
9
|
-
import {NetworkAnalyzer} from '../lib/lantern/simulator/network-analyzer.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @fileoverview This artifact identifies the main resource on the page. Current solution assumes
|
|
@@ -28,7 +28,8 @@ class MainResource {
|
|
|
28
28
|
// document request, we should return the last candidate here. Besides, the browser
|
|
29
29
|
// would have evicted the first request by the time `MainDocumentRequest` (a consumer
|
|
30
30
|
// of this computed artifact) attempts to fetch the contents, resulting in a protocol error.
|
|
31
|
-
const mainResource =
|
|
31
|
+
const mainResource =
|
|
32
|
+
Lantern.Simulation.NetworkAnalyzer.findLastDocumentForUrl(records, mainDocumentUrl);
|
|
32
33
|
if (!mainResource) {
|
|
33
34
|
throw new Error('Unable to identify the main resource');
|
|
34
35
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { LanternFirstContentfulPaintComputed as LanternFirstContentfulPaint };
|
|
2
|
-
export type Extras = import('../../lib/lantern/
|
|
2
|
+
export type Extras = import('../../lib/lantern/Metric.js').Extras;
|
|
3
3
|
declare const LanternFirstContentfulPaintComputed: typeof LanternFirstContentfulPaint & {
|
|
4
4
|
request: (dependencies: import("../../index.js").Artifacts.MetricComputationDataInput, context: import("../../../types/utility-types.js").default.ImmutableObject<{
|
|
5
5
|
computedCache: Map<string, import("../../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
6
6
|
}>) => Promise<import("../../index.js").Artifacts.LanternMetric>;
|
|
7
7
|
};
|
|
8
|
-
/** @typedef {import('../../lib/lantern/
|
|
9
|
-
declare class LanternFirstContentfulPaint extends FirstContentfulPaint {
|
|
8
|
+
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
9
|
+
declare class LanternFirstContentfulPaint extends Lantern.Metrics.FirstContentfulPaint {
|
|
10
10
|
/**
|
|
11
11
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
12
12
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -21,5 +21,5 @@ declare class LanternFirstContentfulPaint extends FirstContentfulPaint {
|
|
|
21
21
|
*/
|
|
22
22
|
static compute_(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.LanternMetric>;
|
|
23
23
|
}
|
|
24
|
-
import
|
|
24
|
+
import * as Lantern from '../../lib/lantern/lantern.js';
|
|
25
25
|
//# sourceMappingURL=lantern-first-contentful-paint.d.ts.map
|
|
@@ -4,13 +4,13 @@
|
|
|
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 {getComputationDataParams, lanternErrorAdapter} from './lantern-metric.js';
|
|
9
|
-
import {FirstContentfulPaint} from '../../lib/lantern/metrics/first-contentful-paint.js';
|
|
10
10
|
|
|
11
|
-
/** @typedef {import('../../lib/lantern/
|
|
11
|
+
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
12
12
|
|
|
13
|
-
class LanternFirstContentfulPaint extends FirstContentfulPaint {
|
|
13
|
+
class LanternFirstContentfulPaint extends Lantern.Metrics.FirstContentfulPaint {
|
|
14
14
|
/**
|
|
15
15
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
16
16
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { LanternInteractiveComputed as LanternInteractive };
|
|
2
|
-
export type Extras = import('../../lib/lantern/
|
|
2
|
+
export type Extras = import('../../lib/lantern/Metric.js').Extras;
|
|
3
3
|
declare const LanternInteractiveComputed: typeof LanternInteractive & {
|
|
4
4
|
request: (dependencies: import("../../index.js").Artifacts.MetricComputationDataInput, context: import("../../../types/utility-types.js").default.ImmutableObject<{
|
|
5
5
|
computedCache: Map<string, import("../../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
6
6
|
}>) => Promise<import("../../index.js").Artifacts.LanternMetric>;
|
|
7
7
|
};
|
|
8
|
-
/** @typedef {import('../../lib/lantern/
|
|
9
|
-
declare class LanternInteractive extends Interactive {
|
|
8
|
+
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
9
|
+
declare class LanternInteractive extends Lantern.Metrics.Interactive {
|
|
10
10
|
/**
|
|
11
11
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
12
12
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -21,5 +21,5 @@ declare class LanternInteractive extends Interactive {
|
|
|
21
21
|
*/
|
|
22
22
|
static compute_(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.LanternMetric>;
|
|
23
23
|
}
|
|
24
|
-
import
|
|
24
|
+
import * as Lantern from '../../lib/lantern/lantern.js';
|
|
25
25
|
//# sourceMappingURL=lantern-interactive.d.ts.map
|
|
@@ -4,14 +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
|
-
import {
|
|
9
|
-
import {Interactive} from '../../lib/lantern/metrics/interactive.js';
|
|
9
|
+
import {LanternLargestContentfulPaint} from './lantern-largest-contentful-paint.js';
|
|
10
10
|
import {getComputationDataParams, lanternErrorAdapter} from './lantern-metric.js';
|
|
11
11
|
|
|
12
|
-
/** @typedef {import('../../lib/lantern/
|
|
12
|
+
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
13
13
|
|
|
14
|
-
class LanternInteractive extends Interactive {
|
|
14
|
+
class LanternInteractive extends Lantern.Metrics.Interactive {
|
|
15
15
|
/**
|
|
16
16
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
17
17
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -29,8 +29,8 @@ class LanternInteractive extends Interactive {
|
|
|
29
29
|
* @return {Promise<LH.Artifacts.LanternMetric>}
|
|
30
30
|
*/
|
|
31
31
|
static async compute_(data, context) {
|
|
32
|
-
const
|
|
33
|
-
return this.computeMetricWithGraphs(data, context, {
|
|
32
|
+
const lcpResult = await LanternLargestContentfulPaint.request(data, context);
|
|
33
|
+
return this.computeMetricWithGraphs(data, context, {lcpResult});
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { LanternLargestContentfulPaintComputed as LanternLargestContentfulPaint };
|
|
2
|
-
export type Extras = import('../../lib/lantern/
|
|
2
|
+
export type Extras = import('../../lib/lantern/Metric.js').Extras;
|
|
3
3
|
declare const LanternLargestContentfulPaintComputed: typeof LanternLargestContentfulPaint & {
|
|
4
4
|
request: (dependencies: import("../../index.js").Artifacts.MetricComputationDataInput, context: import("../../../types/utility-types.js").default.ImmutableObject<{
|
|
5
5
|
computedCache: Map<string, import("../../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
6
6
|
}>) => Promise<import("../../index.js").Artifacts.LanternMetric>;
|
|
7
7
|
};
|
|
8
|
-
/** @typedef {import('../../lib/lantern/
|
|
9
|
-
declare class LanternLargestContentfulPaint extends LargestContentfulPaint {
|
|
8
|
+
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
9
|
+
declare class LanternLargestContentfulPaint extends Lantern.Metrics.LargestContentfulPaint {
|
|
10
10
|
/**
|
|
11
11
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
12
12
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -21,5 +21,5 @@ declare class LanternLargestContentfulPaint extends LargestContentfulPaint {
|
|
|
21
21
|
*/
|
|
22
22
|
static compute_(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.LanternMetric>;
|
|
23
23
|
}
|
|
24
|
-
import
|
|
24
|
+
import * as Lantern from '../../lib/lantern/lantern.js';
|
|
25
25
|
//# sourceMappingURL=lantern-largest-contentful-paint.d.ts.map
|
|
@@ -4,14 +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
|
-
import {LargestContentfulPaint} from '../../lib/lantern/metrics/largest-contentful-paint.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/
|
|
12
|
+
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
13
13
|
|
|
14
|
-
class LanternLargestContentfulPaint extends LargestContentfulPaint {
|
|
14
|
+
class LanternLargestContentfulPaint extends Lantern.Metrics.LargestContentfulPaint {
|
|
15
15
|
/**
|
|
16
16
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
17
17
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { LanternMaxPotentialFIDComputed as LanternMaxPotentialFID };
|
|
2
|
-
export type Extras = import('../../lib/lantern/
|
|
2
|
+
export type Extras = import('../../lib/lantern/Metric.js').Extras;
|
|
3
3
|
declare const LanternMaxPotentialFIDComputed: typeof LanternMaxPotentialFID & {
|
|
4
4
|
request: (dependencies: import("../../index.js").Artifacts.MetricComputationDataInput, context: import("../../../types/utility-types.js").default.ImmutableObject<{
|
|
5
5
|
computedCache: Map<string, import("../../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
6
6
|
}>) => Promise<import("../../index.js").Artifacts.LanternMetric>;
|
|
7
7
|
};
|
|
8
|
-
/** @typedef {import('../../lib/lantern/
|
|
9
|
-
declare class LanternMaxPotentialFID extends MaxPotentialFID {
|
|
8
|
+
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
9
|
+
declare class LanternMaxPotentialFID extends Lantern.Metrics.MaxPotentialFID {
|
|
10
10
|
/**
|
|
11
11
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
12
12
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -21,5 +21,5 @@ declare class LanternMaxPotentialFID extends MaxPotentialFID {
|
|
|
21
21
|
*/
|
|
22
22
|
static compute_(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.LanternMetric>;
|
|
23
23
|
}
|
|
24
|
-
import
|
|
24
|
+
import * as Lantern from '../../lib/lantern/lantern.js';
|
|
25
25
|
//# sourceMappingURL=lantern-max-potential-fid.d.ts.map
|
|
@@ -4,14 +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
|
-
import {MaxPotentialFID} from '../../lib/lantern/metrics/max-potential-fid.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/
|
|
12
|
+
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
13
13
|
|
|
14
|
-
class LanternMaxPotentialFID extends MaxPotentialFID {
|
|
14
|
+
class LanternMaxPotentialFID extends Lantern.Metrics.MaxPotentialFID {
|
|
15
15
|
/**
|
|
16
16
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
17
17
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -2,14 +2,33 @@
|
|
|
2
2
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
3
3
|
* @param {LH.Artifacts.ComputedContext} context
|
|
4
4
|
*/
|
|
5
|
-
export function
|
|
6
|
-
simulator:
|
|
5
|
+
export function getComputationDataParamsFromTrace(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<{
|
|
6
|
+
simulator: Lantern.Simulation.Simulator<any>;
|
|
7
|
+
graph: import("../page-dependency-graph.js").Node;
|
|
8
|
+
processedNavigation: import("../../lib/lantern/types/lantern.js").Simulation.ProcessedNavigation;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
12
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
13
|
+
*/
|
|
14
|
+
export function getComputationDataParamsFromDevtoolsLog(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<{
|
|
15
|
+
simulator: Lantern.Simulation.Simulator<any>;
|
|
7
16
|
graph: import("../page-dependency-graph.js").Node;
|
|
8
17
|
processedNavigation: import("../../index.js").Artifacts.ProcessedNavigation;
|
|
9
18
|
}>;
|
|
19
|
+
/**
|
|
20
|
+
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
21
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
22
|
+
*/
|
|
23
|
+
export function getComputationDataParams(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<{
|
|
24
|
+
simulator: Lantern.Simulation.Simulator<any>;
|
|
25
|
+
graph: import("../page-dependency-graph.js").Node;
|
|
26
|
+
processedNavigation: import("../../lib/lantern/types/lantern.js").Simulation.ProcessedNavigation;
|
|
27
|
+
}>;
|
|
10
28
|
/**
|
|
11
29
|
* @param {unknown} err
|
|
12
30
|
* @return {never}
|
|
13
31
|
*/
|
|
14
32
|
export function lanternErrorAdapter(err: unknown): never;
|
|
33
|
+
import * as Lantern from '../../lib/lantern/lantern.js';
|
|
15
34
|
//# sourceMappingURL=lantern-metric.d.ts.map
|
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import * as Lantern from '../../lib/lantern/lantern.js';
|
|
8
8
|
import {LighthouseError} from '../../lib/lh-error.js';
|
|
9
9
|
import {LoadSimulator} from '../load-simulator.js';
|
|
10
|
-
import {PageDependencyGraph} from '../page-dependency-graph.js';
|
|
11
10
|
import {ProcessedNavigation} from '../processed-navigation.js';
|
|
11
|
+
import {PageDependencyGraph} from '../page-dependency-graph.js';
|
|
12
|
+
import {TraceEngineResult} from '../trace-engine-result.js';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
15
16
|
* @param {LH.Artifacts.ComputedContext} context
|
|
16
17
|
*/
|
|
17
|
-
async function
|
|
18
|
+
async function getComputationDataParamsFromDevtoolsLog(data, context) {
|
|
18
19
|
if (data.gatherContext.gatherMode !== 'navigation') {
|
|
19
20
|
throw new Error(`Lantern metrics can only be computed on navigations`);
|
|
20
21
|
}
|
|
@@ -26,12 +27,30 @@ async function getComputationDataParams(data, context) {
|
|
|
26
27
|
return {simulator, graph, processedNavigation};
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
/**
|
|
31
|
+
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
32
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
33
|
+
*/
|
|
34
|
+
async function getComputationDataParamsFromTrace(data, context) {
|
|
35
|
+
if (data.gatherContext.gatherMode !== 'navigation') {
|
|
36
|
+
throw new Error(`Lantern metrics can only be computed on navigations`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const graph = await PageDependencyGraph.request({...data, fromTrace: true}, context);
|
|
40
|
+
const traceEngineResult = await TraceEngineResult.request(data, context);
|
|
41
|
+
const processedNavigation =
|
|
42
|
+
Lantern.TraceEngineComputationData.createProcessedNavigation(traceEngineResult.data);
|
|
43
|
+
const simulator = data.simulator || (await LoadSimulator.request(data, context));
|
|
44
|
+
|
|
45
|
+
return {simulator, graph, processedNavigation};
|
|
46
|
+
}
|
|
47
|
+
|
|
29
48
|
/**
|
|
30
49
|
* @param {unknown} err
|
|
31
50
|
* @return {never}
|
|
32
51
|
*/
|
|
33
52
|
function lanternErrorAdapter(err) {
|
|
34
|
-
if (!(err instanceof
|
|
53
|
+
if (!(err instanceof Lantern.Error)) {
|
|
35
54
|
throw err;
|
|
36
55
|
}
|
|
37
56
|
|
|
@@ -43,7 +62,23 @@ function lanternErrorAdapter(err) {
|
|
|
43
62
|
throw err;
|
|
44
63
|
}
|
|
45
64
|
|
|
65
|
+
/**
|
|
66
|
+
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
67
|
+
* @param {LH.Artifacts.ComputedContext} context
|
|
68
|
+
*/
|
|
69
|
+
function getComputationDataParams(data, context) {
|
|
70
|
+
// TODO(15841): remove devtools impl when ready to make breaking change.
|
|
71
|
+
if (process.env.INTERNAL_LANTERN_USE_TRACE !== undefined) {
|
|
72
|
+
return getComputationDataParamsFromTrace(data, context);
|
|
73
|
+
} else {
|
|
74
|
+
// This is the default behavior.
|
|
75
|
+
return getComputationDataParamsFromDevtoolsLog(data, context);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
46
79
|
export {
|
|
80
|
+
getComputationDataParamsFromTrace,
|
|
81
|
+
getComputationDataParamsFromDevtoolsLog,
|
|
47
82
|
getComputationDataParams,
|
|
48
83
|
lanternErrorAdapter,
|
|
49
84
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { LanternSpeedIndexComputed as LanternSpeedIndex };
|
|
2
|
-
export type Extras = import('../../lib/lantern/
|
|
2
|
+
export type Extras = import('../../lib/lantern/Metric.js').Extras;
|
|
3
3
|
declare const LanternSpeedIndexComputed: typeof LanternSpeedIndex & {
|
|
4
4
|
request: (dependencies: import("../../index.js").Artifacts.MetricComputationDataInput, context: import("../../../types/utility-types.js").default.ImmutableObject<{
|
|
5
5
|
computedCache: Map<string, import("../../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
6
6
|
}>) => Promise<import("../../index.js").Artifacts.LanternMetric>;
|
|
7
7
|
};
|
|
8
|
-
/** @typedef {import('../../lib/lantern/
|
|
9
|
-
declare class LanternSpeedIndex extends SpeedIndex {
|
|
8
|
+
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
9
|
+
declare class LanternSpeedIndex extends Lantern.Metrics.SpeedIndex {
|
|
10
10
|
/**
|
|
11
11
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
12
12
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -21,5 +21,5 @@ declare class LanternSpeedIndex extends SpeedIndex {
|
|
|
21
21
|
*/
|
|
22
22
|
static compute_(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.LanternMetric>;
|
|
23
23
|
}
|
|
24
|
-
import
|
|
24
|
+
import * as Lantern from '../../lib/lantern/lantern.js';
|
|
25
25
|
//# sourceMappingURL=lantern-speed-index.d.ts.map
|
|
@@ -4,15 +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 {getComputationDataParams, lanternErrorAdapter} from './lantern-metric.js';
|
|
9
10
|
import {Speedline} from '../speedline.js';
|
|
10
11
|
import {LanternFirstContentfulPaint} from './lantern-first-contentful-paint.js';
|
|
11
|
-
import {SpeedIndex} from '../../lib/lantern/metrics/speed-index.js';
|
|
12
12
|
|
|
13
|
-
/** @typedef {import('../../lib/lantern/
|
|
13
|
+
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
14
14
|
|
|
15
|
-
class LanternSpeedIndex extends SpeedIndex {
|
|
15
|
+
class LanternSpeedIndex extends Lantern.Metrics.SpeedIndex {
|
|
16
16
|
/**
|
|
17
17
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
18
18
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -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
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { LanternTotalBlockingTimeComputed as LanternTotalBlockingTime };
|
|
2
|
-
export type Extras = import('../../lib/lantern/
|
|
2
|
+
export type Extras = import('../../lib/lantern/Metric.js').Extras;
|
|
3
3
|
declare const LanternTotalBlockingTimeComputed: typeof LanternTotalBlockingTime & {
|
|
4
4
|
request: (dependencies: import("../../index.js").Artifacts.MetricComputationDataInput, context: import("../../../types/utility-types.js").default.ImmutableObject<{
|
|
5
5
|
computedCache: Map<string, import("../../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
6
6
|
}>) => Promise<import("../../index.js").Artifacts.LanternMetric>;
|
|
7
7
|
};
|
|
8
|
-
/** @typedef {import('../../lib/lantern/
|
|
9
|
-
declare class LanternTotalBlockingTime extends TotalBlockingTime {
|
|
8
|
+
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
9
|
+
declare class LanternTotalBlockingTime extends Lantern.Metrics.TotalBlockingTime {
|
|
10
10
|
/**
|
|
11
11
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
12
12
|
* @param {LH.Artifacts.ComputedContext} context
|
|
@@ -21,5 +21,5 @@ declare class LanternTotalBlockingTime extends TotalBlockingTime {
|
|
|
21
21
|
*/
|
|
22
22
|
static compute_(data: LH.Artifacts.MetricComputationDataInput, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.LanternMetric>;
|
|
23
23
|
}
|
|
24
|
-
import
|
|
24
|
+
import * as Lantern from '../../lib/lantern/lantern.js';
|
|
25
25
|
//# sourceMappingURL=lantern-total-blocking-time.d.ts.map
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import * as Lantern from '../../lib/lantern/lantern.js';
|
|
8
8
|
import {makeComputedArtifact} from '../computed-artifact.js';
|
|
9
9
|
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/
|
|
13
|
+
/** @typedef {import('../../lib/lantern/Metric.js').Extras} Extras */
|
|
14
14
|
|
|
15
|
-
class LanternTotalBlockingTime extends TotalBlockingTime {
|
|
15
|
+
class LanternTotalBlockingTime extends Lantern.Metrics.TotalBlockingTime {
|
|
16
16
|
/**
|
|
17
17
|
* @param {LH.Artifacts.MetricComputationDataInput} data
|
|
18
18
|
* @param {LH.Artifacts.ComputedContext} context
|