lighthouse 10.2.0-dev.20230516 → 10.2.0-dev.20230518
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/audits/seo/is-crawlable.d.ts +0 -1
- package/core/audits/server-response-time.js +4 -4
- package/core/lib/dependency-graph/simulator/network-analyzer.d.ts +6 -2
- package/core/lib/dependency-graph/simulator/network-analyzer.js +13 -7
- package/package.json +2 -2
- package/readme.md +1 -0
- package/types/audit.d.ts +3 -0
- package/types/lhr/audit-details.d.ts +0 -9
- package/types/lhr/audit-result.d.ts +8 -2
|
@@ -76,10 +76,6 @@ class ServerResponseTime extends Audit {
|
|
|
76
76
|
[{url: mainResource.url, responseTime}],
|
|
77
77
|
{overallSavingsMs}
|
|
78
78
|
);
|
|
79
|
-
details.metricSavings = {
|
|
80
|
-
FCP: overallSavingsMs,
|
|
81
|
-
LCP: overallSavingsMs,
|
|
82
|
-
};
|
|
83
79
|
|
|
84
80
|
return {
|
|
85
81
|
numericValue: responseTime,
|
|
@@ -87,6 +83,10 @@ class ServerResponseTime extends Audit {
|
|
|
87
83
|
score: Number(passed),
|
|
88
84
|
displayValue,
|
|
89
85
|
details,
|
|
86
|
+
metricSavings: {
|
|
87
|
+
FCP: overallSavingsMs,
|
|
88
|
+
LCP: overallSavingsMs,
|
|
89
|
+
},
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -58,13 +58,17 @@ export class NetworkAnalyzer {
|
|
|
58
58
|
connectionReused?: boolean | undefined;
|
|
59
59
|
}) => number | number[] | undefined): Map<string, number[]>;
|
|
60
60
|
/**
|
|
61
|
-
* Estimates the observed RTT to each origin based on how long the
|
|
61
|
+
* Estimates the observed RTT to each origin based on how long the connection setup.
|
|
62
|
+
* For h1 and h2, this could includes two estimates - one for the TCP handshake, another for
|
|
63
|
+
* SSL negotiation.
|
|
64
|
+
* For h3, we get only one estimate since QUIC establishes a secure connection in a
|
|
65
|
+
* single handshake.
|
|
62
66
|
* This is the most accurate and preferred method of measurement when the data is available.
|
|
63
67
|
*
|
|
64
68
|
* @param {LH.Artifacts.NetworkRequest[]} records
|
|
65
69
|
* @return {Map<string, number[]>}
|
|
66
70
|
*/
|
|
67
|
-
static
|
|
71
|
+
static _estimateRTTByOriginViaConnectionTiming(records: LH.Artifacts.NetworkRequest[]): Map<string, number[]>;
|
|
68
72
|
/**
|
|
69
73
|
* Estimates the observed RTT to each origin based on how long a download took on a fresh connection.
|
|
70
74
|
* NOTE: this will tend to overestimate the actual RTT quite significantly as the download can be
|
|
@@ -114,19 +114,25 @@ class NetworkAnalyzer {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
|
-
* Estimates the observed RTT to each origin based on how long the
|
|
117
|
+
* Estimates the observed RTT to each origin based on how long the connection setup.
|
|
118
|
+
* For h1 and h2, this could includes two estimates - one for the TCP handshake, another for
|
|
119
|
+
* SSL negotiation.
|
|
120
|
+
* For h3, we get only one estimate since QUIC establishes a secure connection in a
|
|
121
|
+
* single handshake.
|
|
118
122
|
* This is the most accurate and preferred method of measurement when the data is available.
|
|
119
123
|
*
|
|
120
124
|
* @param {LH.Artifacts.NetworkRequest[]} records
|
|
121
125
|
* @return {Map<string, number[]>}
|
|
122
126
|
*/
|
|
123
|
-
static
|
|
124
|
-
return NetworkAnalyzer._estimateValueByOrigin(records, ({timing, connectionReused}) => {
|
|
127
|
+
static _estimateRTTByOriginViaConnectionTiming(records) {
|
|
128
|
+
return NetworkAnalyzer._estimateValueByOrigin(records, ({timing, connectionReused, record}) => {
|
|
125
129
|
if (connectionReused) return;
|
|
126
130
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
131
|
+
if (timing.connectEnd > 0 && timing.connectStart > 0 && record.protocol.startsWith('h3')) {
|
|
132
|
+
// These values are equal to sslStart and sslEnd for h3.
|
|
133
|
+
return timing.connectEnd - timing.connectStart;
|
|
134
|
+
} else if (timing.sslStart > 0 && timing.sslEnd > 0) {
|
|
135
|
+
// SSL can also be more than 1 RT but assume False Start was used.
|
|
130
136
|
return [timing.connectEnd - timing.sslStart, timing.sslStart - timing.connectStart];
|
|
131
137
|
} else if (timing.connectStart > 0 && timing.connectEnd > 0) {
|
|
132
138
|
return timing.connectEnd - timing.connectStart;
|
|
@@ -318,7 +324,7 @@ class NetworkAnalyzer {
|
|
|
318
324
|
useHeadersEndEstimates = true,
|
|
319
325
|
} = options || {};
|
|
320
326
|
|
|
321
|
-
let estimatesByOrigin = NetworkAnalyzer.
|
|
327
|
+
let estimatesByOrigin = NetworkAnalyzer._estimateRTTByOriginViaConnectionTiming(records);
|
|
322
328
|
if (!estimatesByOrigin.size || forceCoarseEstimates) {
|
|
323
329
|
estimatesByOrigin = new Map();
|
|
324
330
|
const estimatesViaDownload = NetworkAnalyzer._estimateRTTByOriginViaDownloadTiming(records);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "10.2.0-dev.
|
|
4
|
+
"version": "10.2.0-dev.20230518",
|
|
5
5
|
"description": "Automated auditing, performance metrics, and best practices for the web.",
|
|
6
6
|
"main": "./core/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
},
|
|
188
188
|
"dependencies": {
|
|
189
189
|
"@sentry/node": "^6.17.4",
|
|
190
|
-
"axe-core": "4.7.
|
|
190
|
+
"axe-core": "4.7.1",
|
|
191
191
|
"chrome-launcher": "^0.15.2",
|
|
192
192
|
"configstore": "^5.0.1",
|
|
193
193
|
"csp_evaluator": "1.1.1",
|
package/readme.md
CHANGED
|
@@ -399,6 +399,7 @@ Other awesome open source projects that use Lighthouse.
|
|
|
399
399
|
* **[site-audit-seo](https://github.com/viasite/site-audit-seo)** - CLI tool for SEO site audit, crawl site, lighthouse each page. Output to console and tables in csv, xlsx, json, web or Google Drive.
|
|
400
400
|
* **[webpack-lighthouse-plugin](https://github.com/addyosmani/webpack-lighthouse-plugin)** - Run Lighthouse from a Webpack build.
|
|
401
401
|
* **[cypress-audit](https://github.com/mfrachet/cypress-audit)** - Run Lighthouse and Pa11y audits directly in your E2E test suites.
|
|
402
|
+
* **[laravel-lighthouse](https://github.com/adityadees/laravel-lighthouse)** - Google Lighthouse wrapper for laravel framework to run Google Lighthouse CLI with custom option and can automatically save result in your server directory.
|
|
402
403
|
|
|
403
404
|
## FAQ
|
|
404
405
|
|
package/types/audit.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ declare module Audit {
|
|
|
18
18
|
export type Result = AuditResult.Result;
|
|
19
19
|
export type ScoreDisplayMode = AuditResult.ScoreDisplayMode;
|
|
20
20
|
export type ScoreDisplayModes = AuditResult.ScoreDisplayModes;
|
|
21
|
+
export type MetricSavings = AuditResult.MetricSavings;
|
|
21
22
|
|
|
22
23
|
type Context = Util.Immutable<{
|
|
23
24
|
/** audit options */
|
|
@@ -81,6 +82,8 @@ declare module Audit {
|
|
|
81
82
|
details?: AuditDetails;
|
|
82
83
|
/** If an audit encounters unusual execution circumstances, strings can be put in this optional array to add top-level warnings to the LHR. */
|
|
83
84
|
runWarnings?: Array<IcuMessage>;
|
|
85
|
+
/** [EXPERIMENTAL] Estimates of how much this audit affects various performance metrics. Values will be in the unit of the respective metrics. */
|
|
86
|
+
metricSavings?: MetricSavings;
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
/** The Audit.Product type for audits that do not return a `numericValue`. */
|
|
@@ -15,8 +15,6 @@ interface BaseDetails {
|
|
|
15
15
|
overallSavingsBytes?: number;
|
|
16
16
|
/** Additional information, usually used for including debug or meta information in the LHR */
|
|
17
17
|
debugData?: Details.DebugData;
|
|
18
|
-
/** Estimates of how much this audit affects various performance metrics. Values will be in the unit of the respective metrics. */
|
|
19
|
-
metricSavings?: Details.MetricSavings;
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
type Details =
|
|
@@ -306,13 +304,6 @@ declare module Details {
|
|
|
306
304
|
granularity?: number,
|
|
307
305
|
}
|
|
308
306
|
|
|
309
|
-
interface MetricSavings {
|
|
310
|
-
LCP?: number;
|
|
311
|
-
FCP?: number;
|
|
312
|
-
CLS?: number;
|
|
313
|
-
TBT?: number;
|
|
314
|
-
INP?: number;
|
|
315
|
-
}
|
|
316
307
|
}
|
|
317
308
|
|
|
318
309
|
export default Details;
|
|
@@ -24,6 +24,14 @@ interface ScoreDisplayModes {
|
|
|
24
24
|
|
|
25
25
|
type ScoreDisplayMode = ScoreDisplayModes[keyof ScoreDisplayModes];
|
|
26
26
|
|
|
27
|
+
interface MetricSavings {
|
|
28
|
+
LCP?: number;
|
|
29
|
+
FCP?: number;
|
|
30
|
+
CLS?: number;
|
|
31
|
+
TBT?: number;
|
|
32
|
+
INP?: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
/** Audit result returned in Lighthouse report. All audits offer a description and score of 0-1. */
|
|
28
36
|
export interface Result {
|
|
29
37
|
displayValue?: string;
|
|
@@ -50,8 +58,6 @@ export interface Result {
|
|
|
50
58
|
id: string;
|
|
51
59
|
/** A more detailed description that describes why the audit is important and links to Lighthouse documentation on the audit; markdown links supported. */
|
|
52
60
|
description: string;
|
|
53
|
-
/** Estimates of how much this audit affects various performance metrics. Values will be in the unit of the respective metrics. */
|
|
54
|
-
metricSavings?: AuditDetails.MetricSavings;
|
|
55
61
|
/** A numeric value that has a meaning specific to the audit, e.g. the number of nodes in the DOM or the timestamp of a specific load event. More information can be found in the audit details, if present. */
|
|
56
62
|
numericValue?: number;
|
|
57
63
|
/** The unit of `numericValue`, used when the consumer wishes to convert numericValue to a display string. */
|