lighthouse 12.8.2-dev.20251006 → 12.8.2-dev.20251008
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/insights/dom-size-insight.js +5 -1
- package/core/audits/insights/font-display-insight.js +3 -1
- package/core/audits/insights/insight-audit.d.ts +4 -2
- package/core/audits/insights/insight-audit.js +22 -3
- package/core/audits/predictive-perf.js +2 -2
- package/core/audits/redirects.js +0 -1
- package/core/audits/seo/crawlable-anchors.js +2 -3
- package/core/computed/metrics/lcp-breakdown.d.ts +10 -5
- package/core/computed/metrics/lcp-breakdown.js +50 -23
- package/core/computed/metrics/time-to-first-byte.js +33 -10
- package/core/computed/metrics/timing-summary.js +3 -2
- package/core/config/default-config.js +0 -12
- package/core/gather/gatherers/anchor-elements.js +8 -24
- package/core/gather/gatherers/inspector-issues.js +1 -28
- package/core/gather/gatherers/trace-elements.d.ts +0 -9
- package/core/gather/gatherers/trace-elements.js +0 -36
- package/core/lib/network-request.d.ts +0 -7
- package/core/lib/network-request.js +0 -16
- package/package.json +2 -4
- package/shared/localization/locales/ar-XB.json +20 -38
- package/shared/localization/locales/ar.json +20 -38
- package/shared/localization/locales/bg.json +9 -27
- package/shared/localization/locales/ca.json +9 -27
- package/shared/localization/locales/cs.json +9 -27
- package/shared/localization/locales/da.json +9 -27
- package/shared/localization/locales/de.json +9 -27
- package/shared/localization/locales/el.json +9 -27
- package/shared/localization/locales/en-GB.json +9 -27
- package/shared/localization/locales/en-US.json +18 -45
- package/shared/localization/locales/en-XA.json +0 -27
- package/shared/localization/locales/en-XL.json +18 -45
- package/shared/localization/locales/es-419.json +9 -27
- package/shared/localization/locales/es.json +9 -27
- package/shared/localization/locales/fi.json +9 -27
- package/shared/localization/locales/fil.json +9 -27
- package/shared/localization/locales/fr.json +9 -27
- package/shared/localization/locales/he.json +31 -49
- package/shared/localization/locales/hi.json +9 -27
- package/shared/localization/locales/hr.json +9 -27
- package/shared/localization/locales/hu.json +9 -27
- package/shared/localization/locales/id.json +9 -27
- package/shared/localization/locales/it.json +9 -27
- package/shared/localization/locales/ja.json +9 -27
- package/shared/localization/locales/ko.json +10 -28
- package/shared/localization/locales/lt.json +9 -27
- package/shared/localization/locales/lv.json +10 -28
- package/shared/localization/locales/nl.json +9 -27
- package/shared/localization/locales/no.json +9 -27
- package/shared/localization/locales/pl.json +9 -27
- package/shared/localization/locales/pt-PT.json +9 -27
- package/shared/localization/locales/pt.json +9 -27
- package/shared/localization/locales/ro.json +10 -28
- package/shared/localization/locales/ru.json +9 -27
- package/shared/localization/locales/sk.json +9 -27
- package/shared/localization/locales/sl.json +9 -27
- package/shared/localization/locales/sr-Latn.json +9 -27
- package/shared/localization/locales/sr.json +9 -27
- package/shared/localization/locales/sv.json +9 -27
- package/shared/localization/locales/ta.json +9 -27
- package/shared/localization/locales/te.json +10 -28
- package/shared/localization/locales/th.json +9 -27
- package/shared/localization/locales/tr.json +9 -27
- package/shared/localization/locales/uk.json +9 -27
- package/shared/localization/locales/vi.json +9 -27
- package/shared/localization/locales/zh-HK.json +9 -27
- package/shared/localization/locales/zh-TW.json +10 -28
- package/shared/localization/locales/zh.json +9 -27
- package/tsconfig.json +0 -3
- package/types/artifacts.d.ts +4 -43
- package/core/audits/byte-efficiency/offscreen-images.d.ts +0 -63
- package/core/audits/byte-efficiency/offscreen-images.js +0 -240
- package/core/audits/dobetterweb/no-document-write.d.ts +0 -16
- package/core/audits/dobetterweb/no-document-write.js +0 -86
- package/core/audits/dobetterweb/uses-passive-event-listeners.d.ts +0 -16
- package/core/audits/dobetterweb/uses-passive-event-listeners.js +0 -69
- package/core/audits/metrics/first-meaningful-paint.d.ts +0 -12
- package/core/audits/metrics/first-meaningful-paint.js +0 -47
- package/core/computed/critical-request-chains.d.ts +0 -42
- package/core/computed/critical-request-chains.js +0 -143
- package/core/computed/viewport-meta.d.ts +0 -37
- package/core/computed/viewport-meta.js +0 -71
- package/core/gather/gatherers/cache-contents.d.ts +0 -11
- package/core/gather/gatherers/cache-contents.js +0 -56
- package/core/gather/gatherers/dobetterweb/domstats.d.ts +0 -10
- package/core/gather/gatherers/dobetterweb/domstats.js +0 -102
- package/core/gather/gatherers/dobetterweb/optimized-images.d.ts +0 -48
- package/core/gather/gatherers/dobetterweb/optimized-images.js +0 -169
- package/core/gather/gatherers/dobetterweb/response-compression.d.ts +0 -23
- package/core/gather/gatherers/dobetterweb/response-compression.js +0 -136
- package/types/internal/metaviewport-parser.d.ts +0 -13
- package/types/internal/parse-cache-control.d.ts +0 -20
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @fileoverview Determines optimized gzip/br/deflate filesizes for all responses by
|
|
9
|
-
* checking the content-encoding header.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import {Buffer} from 'buffer';
|
|
14
|
-
import {gzip} from 'zlib';
|
|
15
|
-
|
|
16
|
-
import log from 'lighthouse-logger';
|
|
17
|
-
|
|
18
|
-
import BaseGatherer from '../../base-gatherer.js';
|
|
19
|
-
import UrlUtils from '../../../lib/url-utils.js';
|
|
20
|
-
import {NetworkRequest} from '../../../lib/network-request.js';
|
|
21
|
-
import DevtoolsLog from '../devtools-log.js';
|
|
22
|
-
import {fetchResponseBodyFromCache} from '../../driver/network.js';
|
|
23
|
-
import {NetworkRecords} from '../../../computed/network-records.js';
|
|
24
|
-
|
|
25
|
-
const CHROME_EXTENSION_PROTOCOL = 'chrome-extension:';
|
|
26
|
-
const binaryMimeTypes = ['image', 'audio', 'video'];
|
|
27
|
-
/** @type {LH.Crdp.Network.ResourceType[]} */
|
|
28
|
-
const textResourceTypes = [
|
|
29
|
-
NetworkRequest.TYPES.Document,
|
|
30
|
-
NetworkRequest.TYPES.Script,
|
|
31
|
-
NetworkRequest.TYPES.Stylesheet,
|
|
32
|
-
NetworkRequest.TYPES.XHR,
|
|
33
|
-
NetworkRequest.TYPES.Fetch,
|
|
34
|
-
NetworkRequest.TYPES.EventSource,
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
class ResponseCompression extends BaseGatherer {
|
|
38
|
-
/** @type {LH.Gatherer.GathererMeta<'DevtoolsLog'>} */
|
|
39
|
-
meta = {
|
|
40
|
-
supportedModes: ['timespan', 'navigation'],
|
|
41
|
-
dependencies: {DevtoolsLog: DevtoolsLog.symbol},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @param {LH.Artifacts.NetworkRequest[]} networkRecords
|
|
46
|
-
* @return {LH.Artifacts['ResponseCompression']}
|
|
47
|
-
*/
|
|
48
|
-
static filterUnoptimizedResponses(networkRecords) {
|
|
49
|
-
/** @type {LH.Artifacts['ResponseCompression']} */
|
|
50
|
-
const unoptimizedResponses = [];
|
|
51
|
-
|
|
52
|
-
networkRecords.forEach(record => {
|
|
53
|
-
if (record.sessionTargetType !== 'page') return;
|
|
54
|
-
|
|
55
|
-
const mimeType = record.mimeType;
|
|
56
|
-
const resourceType = record.resourceType || NetworkRequest.TYPES.Other;
|
|
57
|
-
const resourceSize = record.resourceSize;
|
|
58
|
-
|
|
59
|
-
const isBinaryResource = mimeType && binaryMimeTypes.some(type => mimeType.startsWith(type));
|
|
60
|
-
const isTextResource = !isBinaryResource && textResourceTypes.includes(resourceType);
|
|
61
|
-
const isChromeExtensionResource = record.url.startsWith(CHROME_EXTENSION_PROTOCOL);
|
|
62
|
-
|
|
63
|
-
if (!isTextResource || !resourceSize || !record.finished ||
|
|
64
|
-
isChromeExtensionResource || !record.transferSize || record.statusCode === 304) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (!NetworkRequest.isContentEncoded(record)) {
|
|
69
|
-
unoptimizedResponses.push({
|
|
70
|
-
requestId: record.requestId,
|
|
71
|
-
url: record.url,
|
|
72
|
-
mimeType: mimeType,
|
|
73
|
-
transferSize: record.transferSize,
|
|
74
|
-
resourceSize: resourceSize,
|
|
75
|
-
gzipSize: 0,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
return unoptimizedResponses;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* @param {LH.Gatherer.Context} context
|
|
85
|
-
* @param {LH.Artifacts.NetworkRequest[]} networkRecords
|
|
86
|
-
* @return {Promise<LH.Artifacts['ResponseCompression']>}
|
|
87
|
-
*/
|
|
88
|
-
async getCompressibleRecords(context, networkRecords) {
|
|
89
|
-
const session = context.driver.defaultSession;
|
|
90
|
-
const textRecords = ResponseCompression.filterUnoptimizedResponses(networkRecords);
|
|
91
|
-
|
|
92
|
-
return Promise.all(textRecords.map(record => {
|
|
93
|
-
return fetchResponseBodyFromCache(session, record.requestId).then(content => {
|
|
94
|
-
// if we don't have any content, gzipSize is already set to 0
|
|
95
|
-
if (!content) {
|
|
96
|
-
return record;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return new Promise((resolve, reject) => {
|
|
100
|
-
return gzip(content, (err, res) => {
|
|
101
|
-
if (err) {
|
|
102
|
-
return reject(err);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// get gzip size
|
|
106
|
-
record.gzipSize = Buffer.byteLength(res, 'utf8');
|
|
107
|
-
|
|
108
|
-
resolve(record);
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
}).catch(err => {
|
|
112
|
-
const isExpectedError = err?.message?.includes('No resource with given identifier found');
|
|
113
|
-
if (!isExpectedError) {
|
|
114
|
-
err.extra = {url: UrlUtils.elideDataURI(record.url)};
|
|
115
|
-
throw err;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
log.error('ResponseCompression', err.message);
|
|
119
|
-
record.gzipSize = undefined;
|
|
120
|
-
return record;
|
|
121
|
-
});
|
|
122
|
-
}));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* @param {LH.Gatherer.Context<'DevtoolsLog'>} context
|
|
127
|
-
* @return {Promise<LH.Artifacts['ResponseCompression']>}
|
|
128
|
-
*/
|
|
129
|
-
async getArtifact(context) {
|
|
130
|
-
const devtoolsLog = context.dependencies.DevtoolsLog;
|
|
131
|
-
const networkRecords = await NetworkRecords.request(devtoolsLog, context);
|
|
132
|
-
return this.getCompressibleRecords(context, networkRecords);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export default ResponseCompression;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2018 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
declare module 'metaviewport-parser' {
|
|
8
|
-
export function parseMetaViewPortContent(S: string): {
|
|
9
|
-
validProperties: {[p: string]: number | string},
|
|
10
|
-
unknownProperties: {[p: string]: number | string},
|
|
11
|
-
invalidValues: {[p: string]: number | string};
|
|
12
|
-
};
|
|
13
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2019 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
declare module 'parse-cache-control' {
|
|
8
|
-
// Follows the potential settings of cache-control, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
|
|
9
|
-
interface CacheHeaders {
|
|
10
|
-
'max-age'?: number;
|
|
11
|
-
'must-revalidate'?: boolean;
|
|
12
|
-
'no-cache'?: boolean;
|
|
13
|
-
'no-store'?: boolean;
|
|
14
|
-
'private'?: boolean;
|
|
15
|
-
'stale-while-revalidate'?: boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function ParseCacheControl(headers?: string): CacheHeaders | null;
|
|
19
|
-
export = ParseCacheControl;
|
|
20
|
-
}
|