lighthouse 11.2.0-dev.20231022 → 11.2.0-dev.20231024
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/config/constants.js +1 -0
- package/core/gather/driver/prepare.js +9 -7
- package/core/gather/driver/storage.d.ts +2 -1
- package/core/gather/driver/storage.js +3 -12
- package/core/gather/navigation-runner.js +6 -1
- package/package.json +2 -2
- package/shared/localization/locales/en-US.json +6 -6
- package/shared/localization/locales/en-XL.json +6 -6
- package/types/lhr/settings.d.ts +10 -0
package/core/config/constants.js
CHANGED
|
@@ -89,21 +89,22 @@ async function dismissJavaScriptDialogs(session) {
|
|
|
89
89
|
* Reset the storage and warn if any stored data could be affecting the scores.
|
|
90
90
|
* @param {LH.Gatherer.ProtocolSession} session
|
|
91
91
|
* @param {string} url
|
|
92
|
+
* @param {LH.Config.Settings['clearStorageTypes']} clearStorageTypes
|
|
92
93
|
* @return {Promise<{warnings: Array<LH.IcuMessage>}>}
|
|
93
94
|
*/
|
|
94
|
-
async function resetStorageForUrl(session, url) {
|
|
95
|
+
async function resetStorageForUrl(session, url, clearStorageTypes) {
|
|
95
96
|
/** @type {Array<LH.IcuMessage>} */
|
|
96
97
|
const warnings = [];
|
|
97
98
|
|
|
98
|
-
const
|
|
99
|
-
if (importantStorageWarning) warnings.push(importantStorageWarning);
|
|
100
|
-
|
|
101
|
-
const clearDataWarnings = await storage.clearDataForOrigin(session, url);
|
|
99
|
+
const clearDataWarnings = await storage.clearDataForOrigin(session, url, clearStorageTypes);
|
|
102
100
|
warnings.push(...clearDataWarnings);
|
|
103
101
|
|
|
104
102
|
const clearCacheWarnings = await storage.clearBrowserCaches(session);
|
|
105
103
|
warnings.push(...clearCacheWarnings);
|
|
106
104
|
|
|
105
|
+
const importantStorageWarning = await storage.getImportantStorageWarning(session, url);
|
|
106
|
+
if (importantStorageWarning) warnings.push(importantStorageWarning);
|
|
107
|
+
|
|
107
108
|
return {warnings};
|
|
108
109
|
}
|
|
109
110
|
|
|
@@ -215,8 +216,9 @@ async function prepareTargetForNavigationMode(driver, settings, requestor) {
|
|
|
215
216
|
// Without prior knowledge of the destination, we cannot know which URL to clear storage for.
|
|
216
217
|
typeof requestor === 'string';
|
|
217
218
|
if (shouldResetStorage) {
|
|
218
|
-
const {warnings: storageWarnings} =
|
|
219
|
-
|
|
219
|
+
const {warnings: storageWarnings} = await resetStorageForUrl(driver.defaultSession,
|
|
220
|
+
requestor,
|
|
221
|
+
settings.clearStorageTypes);
|
|
220
222
|
warnings.push(...storageWarnings);
|
|
221
223
|
}
|
|
222
224
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param {LH.Gatherer.ProtocolSession} session
|
|
3
3
|
* @param {string} url
|
|
4
|
+
* @param {LH.Config.Settings['clearStorageTypes']} clearStorageTypes
|
|
4
5
|
* @return {Promise<LH.IcuMessage[]>}
|
|
5
6
|
*/
|
|
6
|
-
export function clearDataForOrigin(session: LH.Gatherer.ProtocolSession, url: string): Promise<LH.IcuMessage[]>;
|
|
7
|
+
export function clearDataForOrigin(session: LH.Gatherer.ProtocolSession, url: string, clearStorageTypes: LH.Config.Settings['clearStorageTypes']): Promise<LH.IcuMessage[]>;
|
|
7
8
|
/**
|
|
8
9
|
* Clear the network cache on disk and in memory.
|
|
9
10
|
* @param {LH.Gatherer.ProtocolSession} session
|
|
@@ -36,9 +36,10 @@ const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
|
36
36
|
/**
|
|
37
37
|
* @param {LH.Gatherer.ProtocolSession} session
|
|
38
38
|
* @param {string} url
|
|
39
|
+
* @param {LH.Config.Settings['clearStorageTypes']} clearStorageTypes
|
|
39
40
|
* @return {Promise<LH.IcuMessage[]>}
|
|
40
41
|
*/
|
|
41
|
-
async function clearDataForOrigin(session, url) {
|
|
42
|
+
async function clearDataForOrigin(session, url, clearStorageTypes) {
|
|
42
43
|
const status = {msg: 'Cleaning origin data', id: 'lh:storage:clearDataForOrigin'};
|
|
43
44
|
log.time(status);
|
|
44
45
|
|
|
@@ -46,17 +47,7 @@ async function clearDataForOrigin(session, url) {
|
|
|
46
47
|
|
|
47
48
|
const origin = new URL(url).origin;
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
// Cookies are not cleared, so the user isn't logged out.
|
|
51
|
-
// indexeddb, websql, and localstorage are not cleared to prevent loss of potentially important data.
|
|
52
|
-
// https://chromedevtools.github.io/debugger-protocol-viewer/tot/Storage/#type-StorageType
|
|
53
|
-
const typesToClear = [
|
|
54
|
-
// 'cookies',
|
|
55
|
-
'file_systems',
|
|
56
|
-
'shader_cache',
|
|
57
|
-
'service_workers',
|
|
58
|
-
'cache_storage',
|
|
59
|
-
].join(',');
|
|
50
|
+
const typesToClear = clearStorageTypes.join(',');
|
|
60
51
|
|
|
61
52
|
// `Storage.clearDataForOrigin` is one of our PROTOCOL_TIMEOUT culprits and this command is also
|
|
62
53
|
// run in the context of PAGE_HUNG to cleanup. We'll keep the timeout low and just warn if it fails.
|
|
@@ -247,7 +247,12 @@ async function _navigation(navigationContext) {
|
|
|
247
247
|
*/
|
|
248
248
|
async function _cleanup({requestedUrl, driver, resolvedConfig, lhBrowser, lhPage}) {
|
|
249
249
|
const didResetStorage = !resolvedConfig.settings.disableStorageReset && requestedUrl;
|
|
250
|
-
if (didResetStorage)
|
|
250
|
+
if (didResetStorage) {
|
|
251
|
+
await storage.clearDataForOrigin(driver.defaultSession,
|
|
252
|
+
requestedUrl,
|
|
253
|
+
resolvedConfig.settings.clearStorageTypes
|
|
254
|
+
);
|
|
255
|
+
}
|
|
251
256
|
|
|
252
257
|
await driver.disconnect();
|
|
253
258
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "11.2.0-dev.
|
|
4
|
+
"version": "11.2.0-dev.20231024",
|
|
5
5
|
"description": "Automated auditing, performance metrics, and best practices for the web.",
|
|
6
6
|
"main": "./core/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
"jpeg-js": "^0.4.4",
|
|
193
193
|
"js-library-detector": "^6.7.0",
|
|
194
194
|
"lighthouse-logger": "^2.0.1",
|
|
195
|
-
"lighthouse-stack-packs": "1.12.
|
|
195
|
+
"lighthouse-stack-packs": "1.12.1",
|
|
196
196
|
"lodash": "^4.17.21",
|
|
197
197
|
"lookup-closest-locale": "6.2.0",
|
|
198
198
|
"metaviewport-parser": "0.3.0",
|
|
@@ -3111,22 +3111,22 @@
|
|
|
3111
3111
|
"message": "Use [`Gzip compression`](https://support.nitropack.io/hc/en-us/articles/13229297479313-Enabling-GZIP-compression) in NitroPack to reduce the size of the files that are sent to the browser."
|
|
3112
3112
|
},
|
|
3113
3113
|
"node_modules/lighthouse-stack-packs/packs/nuxt.js | modern-image-formats": {
|
|
3114
|
-
"message": "Use the `nuxt/image` component and set `format=\"webp\"`. [Learn more](https://image.
|
|
3114
|
+
"message": "Use the `nuxt/image` component and set `format=\"webp\"`. [Learn more](https://image.nuxt.com/usage/nuxt-img#format)."
|
|
3115
3115
|
},
|
|
3116
3116
|
"node_modules/lighthouse-stack-packs/packs/nuxt.js | offscreen-images": {
|
|
3117
|
-
"message": "Use the `nuxt/image` component and set `loading=\"lazy\"` for offscreen images. [Learn more](https://image.
|
|
3117
|
+
"message": "Use the `nuxt/image` component and set `loading=\"lazy\"` for offscreen images. [Learn more](https://image.nuxt.com/usage/nuxt-img#loading)."
|
|
3118
3118
|
},
|
|
3119
3119
|
"node_modules/lighthouse-stack-packs/packs/nuxt.js | prioritize-lcp-image": {
|
|
3120
|
-
"message": "Use the `nuxt/image` component and specify `preload` for LCP image. [Learn more](https://image.
|
|
3120
|
+
"message": "Use the `nuxt/image` component and specify `preload` for LCP image. [Learn more](https://image.nuxt.com/usage/nuxt-img#preload)."
|
|
3121
3121
|
},
|
|
3122
3122
|
"node_modules/lighthouse-stack-packs/packs/nuxt.js | unsized-images": {
|
|
3123
|
-
"message": "Use the `nuxt/image` component and specify explicit `width` and `height`. [Learn more](https://image.
|
|
3123
|
+
"message": "Use the `nuxt/image` component and specify explicit `width` and `height`. [Learn more](https://image.nuxt.com/usage/nuxt-img#width-height)."
|
|
3124
3124
|
},
|
|
3125
3125
|
"node_modules/lighthouse-stack-packs/packs/nuxt.js | uses-optimized-images": {
|
|
3126
|
-
"message": "Use the `nuxt/image` component and set the appropriate `quality`. [Learn more](https://image.
|
|
3126
|
+
"message": "Use the `nuxt/image` component and set the appropriate `quality`. [Learn more](https://image.nuxt.com/usage/nuxt-img#quality)."
|
|
3127
3127
|
},
|
|
3128
3128
|
"node_modules/lighthouse-stack-packs/packs/nuxt.js | uses-responsive-images": {
|
|
3129
|
-
"message": "Use the `nuxt/image` component and set the appropriate `sizes`. [Learn more](https://image.
|
|
3129
|
+
"message": "Use the `nuxt/image` component and set the appropriate `sizes`. [Learn more](https://image.nuxt.com/usage/nuxt-img#sizes)."
|
|
3130
3130
|
},
|
|
3131
3131
|
"node_modules/lighthouse-stack-packs/packs/octobercms.js | efficient-animated-content": {
|
|
3132
3132
|
"message": "[Replace animated GIFs with video](https://web.dev/replace-gifs-with-videos/) for faster web page loads and consider using modern file formats such as [WebM](https://web.dev/replace-gifs-with-videos/#create-webm-videos) or [AV1](https://developers.google.com/web/updates/2018/09/chrome-70-media-updates#av1-decoder) to improve compression efficiency by greater than 30% over the current state-of-the-art video codec, VP9."
|
|
@@ -3111,22 +3111,22 @@
|
|
|
3111
3111
|
"message": "Ûśê [`Gzip compression`](https://support.nitropack.io/hc/en-us/articles/13229297479313-Enabling-GZIP-compression) ín̂ Ńît́r̂óP̂áĉḱ t̂ó r̂éd̂úĉé t̂h́ê śîźê óf̂ t́ĥé f̂íl̂éŝ t́ĥát̂ ár̂é ŝén̂t́ t̂ó t̂h́ê b́r̂óŵśêŕ."
|
|
3112
3112
|
},
|
|
3113
3113
|
"node_modules/lighthouse-stack-packs/packs/nuxt.js | modern-image-formats": {
|
|
3114
|
-
"message": "Ûśê t́ĥé `nuxt/image` ĉóm̂ṕôńêńt̂ án̂d́ ŝét̂ `format=\"webp\"`. [Ĺêár̂ń m̂ór̂é](https://image.
|
|
3114
|
+
"message": "Ûśê t́ĥé `nuxt/image` ĉóm̂ṕôńêńt̂ án̂d́ ŝét̂ `format=\"webp\"`. [Ĺêár̂ń m̂ór̂é](https://image.nuxt.com/usage/nuxt-img#format)."
|
|
3115
3115
|
},
|
|
3116
3116
|
"node_modules/lighthouse-stack-packs/packs/nuxt.js | offscreen-images": {
|
|
3117
|
-
"message": "Ûśê t́ĥé `nuxt/image` ĉóm̂ṕôńêńt̂ án̂d́ ŝét̂ `loading=\"lazy\"` f́ôŕ ôf́f̂śĉŕêén̂ ím̂áĝéŝ. [Ĺêár̂ń m̂ór̂é](https://image.
|
|
3117
|
+
"message": "Ûśê t́ĥé `nuxt/image` ĉóm̂ṕôńêńt̂ án̂d́ ŝét̂ `loading=\"lazy\"` f́ôŕ ôf́f̂śĉŕêén̂ ím̂áĝéŝ. [Ĺêár̂ń m̂ór̂é](https://image.nuxt.com/usage/nuxt-img#loading)."
|
|
3118
3118
|
},
|
|
3119
3119
|
"node_modules/lighthouse-stack-packs/packs/nuxt.js | prioritize-lcp-image": {
|
|
3120
|
-
"message": "Ûśê t́ĥé `nuxt/image` ĉóm̂ṕôńêńt̂ án̂d́ ŝṕêćîf́ŷ `preload` f́ôŕ L̂ĆP̂ ím̂áĝé. [L̂éâŕn̂ ḿôŕê](https://image.
|
|
3120
|
+
"message": "Ûśê t́ĥé `nuxt/image` ĉóm̂ṕôńêńt̂ án̂d́ ŝṕêćîf́ŷ `preload` f́ôŕ L̂ĆP̂ ím̂áĝé. [L̂éâŕn̂ ḿôŕê](https://image.nuxt.com/usage/nuxt-img#preload)."
|
|
3121
3121
|
},
|
|
3122
3122
|
"node_modules/lighthouse-stack-packs/packs/nuxt.js | unsized-images": {
|
|
3123
|
-
"message": "Ûśê t́ĥé `nuxt/image` ĉóm̂ṕôńêńt̂ án̂d́ ŝṕêćîf́ŷ éx̂ṕl̂íĉít̂ `width` án̂d́ `height`. [L̂éâŕn̂ ḿôŕê](https://image.
|
|
3123
|
+
"message": "Ûśê t́ĥé `nuxt/image` ĉóm̂ṕôńêńt̂ án̂d́ ŝṕêćîf́ŷ éx̂ṕl̂íĉít̂ `width` án̂d́ `height`. [L̂éâŕn̂ ḿôŕê](https://image.nuxt.com/usage/nuxt-img#width-height)."
|
|
3124
3124
|
},
|
|
3125
3125
|
"node_modules/lighthouse-stack-packs/packs/nuxt.js | uses-optimized-images": {
|
|
3126
|
-
"message": "Ûśê t́ĥé `nuxt/image` ĉóm̂ṕôńêńt̂ án̂d́ ŝét̂ t́ĥé âṕp̂ŕôṕr̂íât́ê `quality`. [Ĺêár̂ń m̂ór̂é](https://image.
|
|
3126
|
+
"message": "Ûśê t́ĥé `nuxt/image` ĉóm̂ṕôńêńt̂ án̂d́ ŝét̂ t́ĥé âṕp̂ŕôṕr̂íât́ê `quality`. [Ĺêár̂ń m̂ór̂é](https://image.nuxt.com/usage/nuxt-img#quality)."
|
|
3127
3127
|
},
|
|
3128
3128
|
"node_modules/lighthouse-stack-packs/packs/nuxt.js | uses-responsive-images": {
|
|
3129
|
-
"message": "Ûśê t́ĥé `nuxt/image` ĉóm̂ṕôńêńt̂ án̂d́ ŝét̂ t́ĥé âṕp̂ŕôṕr̂íât́ê `sizes`. [Ĺêár̂ń m̂ór̂é](https://image.
|
|
3129
|
+
"message": "Ûśê t́ĥé `nuxt/image` ĉóm̂ṕôńêńt̂ án̂d́ ŝét̂ t́ĥé âṕp̂ŕôṕr̂íât́ê `sizes`. [Ĺêár̂ń m̂ór̂é](https://image.nuxt.com/usage/nuxt-img#sizes)."
|
|
3130
3130
|
},
|
|
3131
3131
|
"node_modules/lighthouse-stack-packs/packs/octobercms.js | efficient-animated-content": {
|
|
3132
3132
|
"message": "[R̂ép̂ĺâćê án̂ím̂át̂éd̂ ǴÎF́ŝ ẃît́ĥ v́îd́êó](https://web.dev/replace-gifs-with-videos/) f̂ór̂ f́âśt̂ér̂ ẃêb́ p̂áĝé l̂óâd́ŝ án̂d́ ĉón̂śîd́êŕ ûśîńĝ ḿôd́êŕn̂ f́îĺê f́ôŕm̂át̂ś ŝúĉh́ âś [Ŵéb̂Ḿ](https://web.dev/replace-gifs-with-videos/#create-webm-videos) ôŕ [ÂV́1](https://developers.google.com/web/updates/2018/09/chrome-70-media-updates#av1-decoder) t̂ó îḿp̂ŕôv́ê ćôḿp̂ŕêśŝíôń êf́f̂íĉíêńĉý b̂ý ĝŕêát̂ér̂ t́ĥán̂ 30% óv̂ér̂ t́ĥé ĉúr̂ŕêńt̂ śt̂át̂é-ôf́-t̂h́ê-ár̂t́ v̂íd̂éô ćôd́êć, V̂Ṕ9."
|
package/types/lhr/settings.d.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import type {Protocol as Crdp} from 'devtools-protocol/types/protocol.js';
|
|
8
|
+
|
|
7
9
|
import Budget from './budget.js';
|
|
8
10
|
|
|
9
11
|
export type Locale = 'en-US'|'en'|'en-AU'|'en-GB'|'en-IE'|'en-SG'|'en-ZA'|'en-IN'|'ar-XB'|'ar'|'bg'|'ca'|'cs'|'da'|'de'|'el'|'en-XA'|'en-XL'|'es'|'es-419'|'es-AR'|'es-BO'|'es-BR'|'es-BZ'|'es-CL'|'es-CO'|'es-CR'|'es-CU'|'es-DO'|'es-EC'|'es-GT'|'es-HN'|'es-MX'|'es-NI'|'es-PA'|'es-PE'|'es-PR'|'es-PY'|'es-SV'|'es-US'|'es-UY'|'es-VE'|'fi'|'fil'|'fr'|'he'|'hi'|'hr'|'hu'|'gsw'|'id'|'in'|'it'|'iw'|'ja'|'ko'|'lt'|'lv'|'mo'|'nl'|'nb'|'no'|'pl'|'pt'|'pt-PT'|'ro'|'ru'|'sk'|'sl'|'sr'|'sr-Latn'|'sv'|'ta'|'te'|'th'|'tl'|'tr'|'uk'|'vi'|'zh'|'zh-HK'|'zh-TW';
|
|
@@ -69,6 +71,14 @@ export type ScreenEmulationSettings = {
|
|
|
69
71
|
gatherMode?: boolean | string;
|
|
70
72
|
/** Flag indicating that the browser storage should not be reset for the audit. */
|
|
71
73
|
disableStorageReset?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Flag indicating which kinds of browser storage should be reset for the audit.
|
|
76
|
+
* Cookies are not cleared by default, so the user isn't logged out.
|
|
77
|
+
* indexeddb, websql, and localstorage are not cleared by default to prevent
|
|
78
|
+
* loss of potentially important data.
|
|
79
|
+
* https://chromedevtools.github.io/debugger-protocol-viewer/tot/Storage/#type-StorageType
|
|
80
|
+
*/
|
|
81
|
+
clearStorageTypes?: Crdp.Storage.StorageType[];
|
|
72
82
|
/** Flag indicating that Lighthouse should pause after page load to wait for the user's permission to continue the audit. */
|
|
73
83
|
debugNavigation?: boolean;
|
|
74
84
|
/** If set to true, will skip the initial navigation to about:blank. */
|