lighthouse 9.3.1 → 9.4.0-dev.20220219
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/changelog.md +45 -0
- package/dist/report/bundle.esm.js +38 -24
- package/dist/report/flow.js +5 -5
- package/dist/report/standalone.js +9 -9
- 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/run.js +1 -1
- package/lighthouse-cli/test/smokehouse/core-tests.js +4 -5
- package/lighthouse-cli/test/smokehouse/readme.md +4 -0
- package/lighthouse-cli/test/smokehouse/report-assert.js +36 -0
- package/lighthouse-core/audits/autocomplete.js +34 -37
- package/lighthouse-core/audits/byte-efficiency/uses-long-cache-ttl.js +1 -0
- package/lighthouse-core/audits/seo/hreflang.js +2 -17
- package/lighthouse-core/config/default-config.js +2 -2
- package/lighthouse-core/fraggle-rock/config/default-config.js +3 -3
- package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +50 -31
- package/lighthouse-core/fraggle-rock/gather/snapshot-runner.js +4 -5
- package/lighthouse-core/fraggle-rock/gather/timespan-runner.js +4 -5
- package/lighthouse-core/fraggle-rock/user-flow.js +8 -6
- package/lighthouse-core/gather/driver/navigation.js +29 -10
- package/lighthouse-core/gather/driver/network-monitor.js +8 -6
- package/lighthouse-core/gather/driver/prepare.js +13 -7
- package/lighthouse-core/gather/driver/wait-for-condition.js +11 -4
- package/lighthouse-core/gather/gather-runner.js +1 -1
- package/lighthouse-core/gather/gatherers/full-page-screenshot.js +35 -9
- package/lighthouse-core/gather/gatherers/inputs.js +113 -0
- package/lighthouse-core/index.js +3 -3
- package/lighthouse-core/lib/page-functions.js +11 -1
- package/lighthouse-core/lib/sentry.js +39 -24
- package/lighthouse-core/runner.js +79 -52
- package/lighthouse-core/util-commonjs.js +4 -0
- package/package.json +2 -3
- package/readme.md +1 -1
- package/report/assets/templates.html +2 -5
- package/report/renderer/components.js +3 -3
- package/report/renderer/dom.js +1 -3
- package/report/renderer/report-ui-features.js +25 -17
- package/report/renderer/topbar-features.js +5 -1
- package/report/renderer/util.js +4 -0
- package/report/test/renderer/__snapshots__/report-renderer-axe-test.js.snap +107 -0
- package/report/test/renderer/report-renderer-axe-test.js +38 -17
- package/report/test-assets/faux-psi.js +2 -1
- package/report/types/report-renderer.d.ts +21 -2
- package/shared/localization/locales/en-US.json +7 -1
- package/shared/localization/locales/en-XL.json +7 -1
- package/third-party/axe/LICENSE +362 -0
- package/third-party/axe/README.md +6 -0
- package/third-party/axe/valid-langs.js +110 -0
- package/third-party/snyk/snapshot.json +1 -0
- package/tsconfig.json +1 -0
- package/types/artifacts.d.ts +14 -14
- package/types/global-lh.d.ts +1 -0
- package/types/parse-cache-control/index.d.ts +1 -0
- package/types/smokehouse.d.ts +3 -0
- package/lighthouse-core/gather/gatherers/form-elements.js +0 -113
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
|
}
|
package/types/global-lh.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ import Treemap_ from './lhr/treemap';
|
|
|
26
26
|
declare global {
|
|
27
27
|
module LH {
|
|
28
28
|
export type ArbitraryEqualityMap = ArbitraryEqualityMap_;
|
|
29
|
+
export type NavigationRequestor = string | (() => Promise<void> | void);
|
|
29
30
|
|
|
30
31
|
// artifacts.d.ts
|
|
31
32
|
export import Artifacts = Artifacts_.Artifacts;
|
package/types/smokehouse.d.ts
CHANGED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright 2020 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
-
*/
|
|
6
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
/* global getNodeDetails */
|
|
9
|
-
|
|
10
|
-
const FRGatherer = require('../../fraggle-rock/gather/base-gatherer.js');
|
|
11
|
-
const pageFunctions = require('../../lib/page-functions.js');
|
|
12
|
-
|
|
13
|
-
/* eslint-env browser, node */
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @return {LH.Artifacts['FormElements']}
|
|
17
|
-
*/
|
|
18
|
-
/* c8 ignore start */
|
|
19
|
-
function collectFormElements() {
|
|
20
|
-
// @ts-expect-error - put into scope via stringification
|
|
21
|
-
const formChildren = getElementsInDocument('textarea, input, label, select'); // eslint-disable-line no-undef
|
|
22
|
-
/** @type {Map<HTMLFormElement|string, LH.Artifacts.Form>} */
|
|
23
|
-
const forms = new Map();
|
|
24
|
-
/** @type {LH.Artifacts.Form} */
|
|
25
|
-
const formlessObj = {
|
|
26
|
-
node: null,
|
|
27
|
-
inputs: [],
|
|
28
|
-
labels: [],
|
|
29
|
-
};
|
|
30
|
-
for (const child of formChildren) {
|
|
31
|
-
const isButton = child instanceof HTMLInputElement &&
|
|
32
|
-
(child.type === 'submit' || child.type === 'button');
|
|
33
|
-
if (isButton) continue;
|
|
34
|
-
|
|
35
|
-
const parentFormElement = child.form;
|
|
36
|
-
const hasForm = !!parentFormElement;
|
|
37
|
-
if (hasForm && !forms.has(parentFormElement)) {
|
|
38
|
-
const newFormObj = {
|
|
39
|
-
attributes: {
|
|
40
|
-
id: parentFormElement.id,
|
|
41
|
-
name: parentFormElement.name,
|
|
42
|
-
autocomplete: parentFormElement.autocomplete,
|
|
43
|
-
},
|
|
44
|
-
// @ts-expect-error - getNodeDetails put into scope via stringification
|
|
45
|
-
node: getNodeDetails(parentFormElement),
|
|
46
|
-
inputs: [],
|
|
47
|
-
labels: [],
|
|
48
|
-
};
|
|
49
|
-
forms.set(parentFormElement, newFormObj);
|
|
50
|
-
}
|
|
51
|
-
const formObj = forms.get(parentFormElement) || formlessObj;
|
|
52
|
-
if (child instanceof HTMLInputElement || child instanceof HTMLTextAreaElement ||
|
|
53
|
-
child instanceof HTMLSelectElement) {
|
|
54
|
-
formObj.inputs.push({
|
|
55
|
-
id: child.id,
|
|
56
|
-
name: child.name,
|
|
57
|
-
placeholder: child instanceof HTMLSelectElement ? undefined : child.placeholder,
|
|
58
|
-
autocomplete: {
|
|
59
|
-
property: child.autocomplete,
|
|
60
|
-
// Requires `--enable-features=AutofillShowTypePredictions`.
|
|
61
|
-
attribute: child.getAttribute('autocomplete'),
|
|
62
|
-
prediction: child.getAttribute('autofill-prediction'),
|
|
63
|
-
},
|
|
64
|
-
// @ts-expect-error - getNodeDetails put into scope via stringification
|
|
65
|
-
node: getNodeDetails(child),
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
if (child instanceof HTMLLabelElement) {
|
|
69
|
-
formObj.labels.push({
|
|
70
|
-
for: child.htmlFor,
|
|
71
|
-
// @ts-expect-error - getNodeDetails put into scope via stringification
|
|
72
|
-
node: getNodeDetails(child),
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (formlessObj.inputs.length > 0 || formlessObj.labels.length > 0) {
|
|
78
|
-
forms.set('formless', {
|
|
79
|
-
node: formlessObj.node,
|
|
80
|
-
inputs: formlessObj.inputs,
|
|
81
|
-
labels: formlessObj.labels,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
return [...forms.values()];
|
|
85
|
-
}
|
|
86
|
-
/* c8 ignore stop */
|
|
87
|
-
|
|
88
|
-
class FormElements extends FRGatherer {
|
|
89
|
-
/** @type {LH.Gatherer.GathererMeta} */
|
|
90
|
-
meta = {
|
|
91
|
-
supportedModes: ['snapshot', 'navigation'],
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* @param {LH.Gatherer.FRTransitionalContext} passContext
|
|
96
|
-
* @return {Promise<LH.Artifacts['FormElements']>}
|
|
97
|
-
*/
|
|
98
|
-
async getArtifact(passContext) {
|
|
99
|
-
const driver = passContext.driver;
|
|
100
|
-
|
|
101
|
-
const formElements = await driver.executionContext.evaluate(collectFormElements, {
|
|
102
|
-
args: [],
|
|
103
|
-
useIsolation: true,
|
|
104
|
-
deps: [
|
|
105
|
-
pageFunctions.getElementsInDocumentString,
|
|
106
|
-
pageFunctions.getNodeDetailsString,
|
|
107
|
-
],
|
|
108
|
-
});
|
|
109
|
-
return formElements;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
module.exports = FormElements;
|