lighthouse 9.3.1-dev.20220213 → 9.4.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/dist/report/bundle.esm.js +22 -18
- package/dist/report/flow.js +4 -4
- package/dist/report/standalone.js +5 -5
- package/flow-report/src/topbar.tsx +1 -1
- package/flow-report/src/wrappers/report.tsx +2 -1
- package/flow-report/test/topbar-test.tsx +1 -1
- package/lighthouse-cli/bin.js +1 -4
- package/lighthouse-cli/test/smokehouse/core-tests.js +2 -3
- package/lighthouse-core/audits/autocomplete.js +34 -37
- package/lighthouse-core/audits/byte-efficiency/uses-long-cache-ttl.js +1 -0
- package/lighthouse-core/config/default-config.js +2 -2
- package/lighthouse-core/fraggle-rock/config/default-config.js +3 -3
- package/lighthouse-core/gather/driver/wait-for-condition.js +11 -4
- package/lighthouse-core/gather/gatherers/full-page-screenshot.js +35 -9
- package/lighthouse-core/gather/gatherers/inputs.js +113 -0
- package/lighthouse-core/lib/sentry.js +39 -24
- package/lighthouse-core/runner.js +1 -1
- package/package.json +2 -3
- package/report/renderer/dom.js +1 -3
- package/report/renderer/report-ui-features.js +16 -14
- package/report/renderer/topbar-features.js +5 -1
- package/report/test-assets/faux-psi.js +2 -1
- package/report/types/report-renderer.d.ts +14 -2
- package/shared/localization/locales/en-US.json +1 -1
- package/shared/localization/locales/en-XL.json +1 -1
- package/types/artifacts.d.ts +14 -14
- package/types/parse-cache-control/index.d.ts +1 -0
- package/changelog.md +0 -5803
- package/lighthouse-core/gather/gatherers/form-elements.js +0 -113
- package/lighthouse-core/scripts/package.json +0 -4
|
@@ -70,12 +70,13 @@ export class ReportUIFeatures {
|
|
|
70
70
|
this._setupThirdPartyFilter();
|
|
71
71
|
this._setupElementScreenshotOverlay(this._dom.rootEl);
|
|
72
72
|
|
|
73
|
-
let turnOffTheLights = false;
|
|
74
73
|
// Do not query the system preferences for DevTools - DevTools should only apply dark theme
|
|
75
74
|
// if dark is selected in the settings panel.
|
|
76
|
-
|
|
75
|
+
// TODO: set `disableDarkMode` in devtools and delete this special case.
|
|
76
|
+
const disableDarkMode = this._dom.isDevTools() ||
|
|
77
|
+
this._opts.disableDarkMode || this._opts.disableAutoDarkModeAndFireworks;
|
|
77
78
|
if (!disableDarkMode && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
78
|
-
|
|
79
|
+
toggleDarkTheme(this._dom, true);
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
// Fireworks!
|
|
@@ -85,13 +86,12 @@ export class ReportUIFeatures {
|
|
|
85
86
|
const cat = lhr.categories[id];
|
|
86
87
|
return cat && cat.score === 1;
|
|
87
88
|
});
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
const disableFireworks =
|
|
90
|
+
this._opts.disableFireworks || this._opts.disableAutoDarkModeAndFireworks;
|
|
91
|
+
if (scoresAll100 && !disableFireworks) {
|
|
90
92
|
this._enableFireworks();
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (turnOffTheLights) {
|
|
94
|
-
toggleDarkTheme(this._dom, true);
|
|
93
|
+
// If dark mode is allowed, force it on because it looks so much better.
|
|
94
|
+
if (!disableDarkMode) toggleDarkTheme(this._dom, true);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
// Show the metric descriptions by default when there is an error.
|
|
@@ -345,13 +345,15 @@ export class ReportUIFeatures {
|
|
|
345
345
|
}
|
|
346
346
|
|
|
347
347
|
/**
|
|
348
|
-
* DevTools uses its own file manager to download files, so it redefines this function.
|
|
349
|
-
* Wrapper is necessary so DevTools can still override this function.
|
|
350
|
-
*
|
|
351
348
|
* @param {Blob|File} blob
|
|
352
349
|
*/
|
|
353
350
|
_saveFile(blob) {
|
|
354
|
-
const
|
|
355
|
-
this.
|
|
351
|
+
const ext = blob.type.match('json') ? '.json' : '.html';
|
|
352
|
+
const filename = getLhrFilenamePrefix(this.json) + ext;
|
|
353
|
+
if (this._opts.onSaveFileOverride) {
|
|
354
|
+
this._opts.onSaveFileOverride(blob, filename);
|
|
355
|
+
} else {
|
|
356
|
+
this._dom.saveFile(blob, filename);
|
|
357
|
+
}
|
|
356
358
|
}
|
|
357
359
|
}
|
|
@@ -199,7 +199,11 @@ export class TopbarFeatures {
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
_print() {
|
|
202
|
-
|
|
202
|
+
if (this._reportUIFeatures._opts.onPrintOverride) {
|
|
203
|
+
this._reportUIFeatures._opts.onPrintOverride(this._dom.rootEl);
|
|
204
|
+
} else {
|
|
205
|
+
self.print();
|
|
206
|
+
}
|
|
203
207
|
}
|
|
204
208
|
|
|
205
209
|
/**
|
|
@@ -46,7 +46,8 @@ async function renderLHReport() {
|
|
|
46
46
|
|
|
47
47
|
const reportRootEl = lighthouseRenderer.renderReport(lhr, {
|
|
48
48
|
omitTopbar: true,
|
|
49
|
-
|
|
49
|
+
disableFireworks: true,
|
|
50
|
+
disableDarkMode: true,
|
|
50
51
|
});
|
|
51
52
|
// TODO: display warnings if appropriate.
|
|
52
53
|
for (const el of reportRootEl.querySelectorAll('.lh-warnings--toplevel')) {
|
|
@@ -12,8 +12,16 @@ declare module Renderer {
|
|
|
12
12
|
|
|
13
13
|
interface Options {
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* Disables automatically applying dark mode based on `prefers-color-scheme: dark`. Dark mode can still
|
|
16
|
+
* be manually applied by assigning the class `lh-dark` to the report element.
|
|
17
|
+
*/
|
|
18
|
+
disableDarkMode?: boolean;
|
|
19
|
+
/** Disables the fireworks animation that plays when all core categories have a 100 score. */
|
|
20
|
+
disableFireworks?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Disable dark mode and fireworks.
|
|
23
|
+
* @deprecated Use `disableDarkMode` and `disableFireworks` instead.
|
|
24
|
+
*/
|
|
17
25
|
disableAutoDarkModeAndFireworks?: boolean;
|
|
18
26
|
|
|
19
27
|
/** Disable the topbar UI component */
|
|
@@ -27,6 +35,10 @@ declare module Renderer {
|
|
|
27
35
|
onPageAnchorRendered?: (link: HTMLAnchorElement) => void;
|
|
28
36
|
/** If defined, `Save as HTML` option is shown in dropdown menu. */
|
|
29
37
|
getStandaloneReportHTML?: () => string;
|
|
38
|
+
/** If defined, renderer will call this instead of `self.print()` */
|
|
39
|
+
onPrintOverride?: (rootEl: HTMLElement) => Promise<void>;
|
|
40
|
+
/** If defined, renderer will call this instead of using a `<a download>.click()>` to trigger a JSON/HTML download. Blob will be either json or html. */
|
|
41
|
+
onSaveFileOverride?: (blob: Blob, suggestedFilename: string) => Promise<void>;
|
|
30
42
|
/**
|
|
31
43
|
* If defined, adds a `View Trace` button to the report, and calls this callback when clicked.
|
|
32
44
|
* The callback should do something to present the user with a visualization of the trace
|
|
@@ -1668,7 +1668,7 @@
|
|
|
1668
1668
|
"message": "Best practices"
|
|
1669
1669
|
},
|
|
1670
1670
|
"lighthouse-core/config/default-config.js | a11yCategoryDescription": {
|
|
1671
|
-
"message": "These checks highlight opportunities to [improve the accessibility of your web app](https://
|
|
1671
|
+
"message": "These checks highlight opportunities to [improve the accessibility of your web app](https://web.dev/lighthouse-accessibility/). Only a subset of accessibility issues can be automatically detected so manual testing is also encouraged."
|
|
1672
1672
|
},
|
|
1673
1673
|
"lighthouse-core/config/default-config.js | a11yCategoryManualDescription": {
|
|
1674
1674
|
"message": "These items address areas which an automated testing tool cannot cover. Learn more in our guide on [conducting an accessibility review](https://developers.google.com/web/fundamentals/accessibility/how-to-review)."
|
|
@@ -1668,7 +1668,7 @@
|
|
|
1668
1668
|
"message": "B̂éŝt́ p̂ŕâćt̂íĉéŝ"
|
|
1669
1669
|
},
|
|
1670
1670
|
"lighthouse-core/config/default-config.js | a11yCategoryDescription": {
|
|
1671
|
-
"message": "T̂h́êśê ćĥéĉḱŝ h́îǵĥĺîǵĥt́ ôṕp̂ór̂t́ûńît́îéŝ t́ô [ím̂ṕr̂óv̂é t̂h́ê áĉćêśŝíb̂íl̂ít̂ý ôf́ ŷóûŕ ŵéb̂ áp̂ṕ](https://
|
|
1671
|
+
"message": "T̂h́êśê ćĥéĉḱŝ h́îǵĥĺîǵĥt́ ôṕp̂ór̂t́ûńît́îéŝ t́ô [ím̂ṕr̂óv̂é t̂h́ê áĉćêśŝíb̂íl̂ít̂ý ôf́ ŷóûŕ ŵéb̂ áp̂ṕ](https://web.dev/lighthouse-accessibility/). Ôńl̂ý â śûb́ŝét̂ óf̂ áĉćêśŝíb̂íl̂ít̂ý îśŝúêś ĉán̂ b́ê áût́ôḿât́îćâĺl̂ý d̂ét̂éĉt́êd́ ŝó m̂án̂úâĺ t̂éŝt́îńĝ íŝ ál̂śô én̂ćôúr̂áĝéd̂."
|
|
1672
1672
|
},
|
|
1673
1673
|
"lighthouse-core/config/default-config.js | a11yCategoryManualDescription": {
|
|
1674
1674
|
"message": "T̂h́êśê ít̂ém̂ś âd́d̂ŕêśŝ ár̂éâś ŵh́îćĥ án̂ áût́ôḿât́êd́ t̂éŝt́îńĝ t́ôól̂ ćâńn̂ót̂ ćôv́êŕ. L̂éâŕn̂ ḿôŕê ín̂ óûŕ ĝúîd́ê ón̂ [ćôńd̂úĉt́îńĝ án̂ áĉćêśŝíb̂íl̂ít̂ý r̂év̂íêẃ](https://developers.google.com/web/fundamentals/accessibility/how-to-review)."
|
package/types/artifacts.d.ts
CHANGED
|
@@ -139,8 +139,8 @@ export interface GathererArtifacts extends PublicGathererArtifacts,LegacyBaseArt
|
|
|
139
139
|
Fonts: Artifacts.Font[];
|
|
140
140
|
/** Information on poorly sized font usage and the text affected by it. */
|
|
141
141
|
FontSize: Artifacts.FontSize;
|
|
142
|
-
/** All the
|
|
143
|
-
|
|
142
|
+
/** All the input elements, including associated form and label elements. */
|
|
143
|
+
Inputs: {inputs: Artifacts.InputElement[]; forms: Artifacts.FormElement[]; labels: Artifacts.LabelElement[]};
|
|
144
144
|
/** Screenshot of the entire page (rather than just the above the fold content). */
|
|
145
145
|
FullPageScreenshot: Artifacts.FullPageScreenshot | null;
|
|
146
146
|
/** Information about event listeners registered on the global object. */
|
|
@@ -787,22 +787,22 @@ declare module Artifacts {
|
|
|
787
787
|
observedSpeedIndexTs: number;
|
|
788
788
|
}
|
|
789
789
|
|
|
790
|
-
interface
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
autocomplete: string;
|
|
796
|
-
};
|
|
797
|
-
node: NodeDetails | null;
|
|
798
|
-
inputs: Array<FormInput>;
|
|
799
|
-
labels: Array<FormLabel>;
|
|
790
|
+
interface FormElement {
|
|
791
|
+
id: string;
|
|
792
|
+
name: string;
|
|
793
|
+
autocomplete: string;
|
|
794
|
+
node: NodeDetails;
|
|
800
795
|
}
|
|
801
796
|
|
|
802
797
|
/** Attributes collected for every input element in the inputs array from the forms interface. */
|
|
803
|
-
interface
|
|
798
|
+
interface InputElement {
|
|
799
|
+
/** If set, the parent form is the index into the associated FormElement array. Otherwise, the input element has no parent form. */
|
|
800
|
+
parentFormIndex?: number;
|
|
801
|
+
/** Array of indices into associated LabelElement array. */
|
|
802
|
+
labelIndices: number[];
|
|
804
803
|
id: string;
|
|
805
804
|
name: string;
|
|
805
|
+
type: string;
|
|
806
806
|
placeholder?: string;
|
|
807
807
|
autocomplete: {
|
|
808
808
|
property: string;
|
|
@@ -813,7 +813,7 @@ declare module Artifacts {
|
|
|
813
813
|
}
|
|
814
814
|
|
|
815
815
|
/** Attributes collected for every label element in the labels array from the forms interface */
|
|
816
|
-
interface
|
|
816
|
+
interface LabelElement {
|
|
817
817
|
for: string;
|
|
818
818
|
node: NodeDetails;
|
|
819
819
|
}
|