lighthouse 11.3.0-dev.20231126 → 11.3.0-dev.20231127
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.
|
@@ -22,7 +22,7 @@ const UIStrings = {
|
|
|
22
22
|
'the web page. If the `role` values are misspelled, not existing ARIA `role` values, or ' +
|
|
23
23
|
'abstract roles, then the purpose of the element will not be communicated to users of ' +
|
|
24
24
|
'assistive technologies. ' +
|
|
25
|
-
'[Learn more about ARIA roles](https://dequeuniversity.com/rules/axe/4.8/aria-allowed-
|
|
25
|
+
'[Learn more about ARIA roles](https://dequeuniversity.com/rules/axe/4.8/aria-allowed-role).',
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
@@ -25,6 +25,25 @@ export type SummaryMaps = {
|
|
|
25
25
|
*/
|
|
26
26
|
urls: Map<LH.Artifacts.Entity, string[]>;
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* @typedef Summary
|
|
30
|
+
* @property {number} mainThreadTime
|
|
31
|
+
* @property {number} transferSize
|
|
32
|
+
* @property {number} blockingTime
|
|
33
|
+
* @property {number} tbtImpact
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* @typedef URLSummary
|
|
37
|
+
* @property {number} transferSize
|
|
38
|
+
* @property {number} blockingTime
|
|
39
|
+
* @property {number} tbtImpact
|
|
40
|
+
* @property {string | LH.IcuMessage} url
|
|
41
|
+
*/
|
|
42
|
+
/** @typedef SummaryMaps
|
|
43
|
+
* @property {Map<LH.Artifacts.Entity, Summary>} byEntity Map of impact summaries for each entity.
|
|
44
|
+
* @property {Map<string, Summary>} byURL Map of impact summaries for each URL.
|
|
45
|
+
* @property {Map<LH.Artifacts.Entity, string[]>} urls Map of URLs under each entity.
|
|
46
|
+
*/
|
|
28
47
|
declare class ThirdPartySummary extends Audit {
|
|
29
48
|
/**
|
|
30
49
|
*
|
|
@@ -38,10 +57,9 @@ declare class ThirdPartySummary extends Audit {
|
|
|
38
57
|
/**
|
|
39
58
|
* @param {LH.Artifacts.Entity} entity
|
|
40
59
|
* @param {SummaryMaps} summaries
|
|
41
|
-
* @param {Summary} stats
|
|
42
60
|
* @return {Array<URLSummary>}
|
|
43
61
|
*/
|
|
44
|
-
static makeSubItems(entity: LH.Artifacts.Entity, summaries: SummaryMaps
|
|
62
|
+
static makeSubItems(entity: LH.Artifacts.Entity, summaries: SummaryMaps): Array<URLSummary>;
|
|
45
63
|
/**
|
|
46
64
|
* @param {LH.Artifacts} artifacts
|
|
47
65
|
* @param {LH.Audit.Context} context
|
|
@@ -55,15 +55,6 @@ const PASS_THRESHOLD_IN_MS = 250;
|
|
|
55
55
|
* @property {Map<LH.Artifacts.Entity, string[]>} urls Map of URLs under each entity.
|
|
56
56
|
*/
|
|
57
57
|
|
|
58
|
-
/**
|
|
59
|
-
* Don't bother showing resources smaller than 4KiB since they're likely to be pixels, which isn't
|
|
60
|
-
* too actionable.
|
|
61
|
-
*/
|
|
62
|
-
const MIN_TRANSFER_SIZE_FOR_SUBITEMS = 4096;
|
|
63
|
-
|
|
64
|
-
/** Show at most 5 sub items in the resource breakdown. */
|
|
65
|
-
const MAX_SUBITEMS = 5;
|
|
66
|
-
|
|
67
58
|
class ThirdPartySummary extends Audit {
|
|
68
59
|
/**
|
|
69
60
|
* @return {LH.Audit.Meta}
|
|
@@ -146,51 +137,15 @@ class ThirdPartySummary extends Audit {
|
|
|
146
137
|
/**
|
|
147
138
|
* @param {LH.Artifacts.Entity} entity
|
|
148
139
|
* @param {SummaryMaps} summaries
|
|
149
|
-
* @param {Summary} stats
|
|
150
140
|
* @return {Array<URLSummary>}
|
|
151
141
|
*/
|
|
152
|
-
static makeSubItems(entity, summaries
|
|
142
|
+
static makeSubItems(entity, summaries) {
|
|
153
143
|
const entityURLs = summaries.urls.get(entity) || [];
|
|
154
|
-
|
|
144
|
+
const items = entityURLs
|
|
155
145
|
.map(url => /** @type {URLSummary} */ ({url, ...summaries.byURL.get(url)}))
|
|
156
|
-
// Filter out any cases where byURL was missing entries.
|
|
157
|
-
.filter((stat) => stat.transferSize > 0)
|
|
158
146
|
// Sort by blocking time first, then transfer size to break ties.
|
|
159
147
|
.sort((a, b) => (b.blockingTime - a.blockingTime) || (b.transferSize - a.transferSize));
|
|
160
148
|
|
|
161
|
-
const subitemSummary = {transferSize: 0, blockingTime: 0, tbtImpact: 0};
|
|
162
|
-
const minTransferSize = Math.max(MIN_TRANSFER_SIZE_FOR_SUBITEMS, stats.transferSize / 20);
|
|
163
|
-
const maxSubItems = Math.min(MAX_SUBITEMS, items.length);
|
|
164
|
-
let numSubItems = 0;
|
|
165
|
-
while (numSubItems < maxSubItems) {
|
|
166
|
-
const nextSubItem = items[numSubItems];
|
|
167
|
-
if (nextSubItem.blockingTime === 0 && nextSubItem.transferSize < minTransferSize) {
|
|
168
|
-
// Don't include the resource in the sub-item breakdown because it didn't have a big
|
|
169
|
-
// enough impact on its own.
|
|
170
|
-
break;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
numSubItems++;
|
|
174
|
-
subitemSummary.transferSize += nextSubItem.transferSize;
|
|
175
|
-
subitemSummary.blockingTime += nextSubItem.blockingTime;
|
|
176
|
-
subitemSummary.tbtImpact += nextSubItem.tbtImpact;
|
|
177
|
-
}
|
|
178
|
-
if (!subitemSummary.blockingTime && !subitemSummary.transferSize) {
|
|
179
|
-
// Don't bother breaking down if there are no large resources.
|
|
180
|
-
return [];
|
|
181
|
-
}
|
|
182
|
-
// Only show the top N entries for brevity. If there is more than one remaining entry
|
|
183
|
-
// we'll replace the tail entries with single remainder entry.
|
|
184
|
-
items = items.slice(0, numSubItems);
|
|
185
|
-
const remainder = {
|
|
186
|
-
url: str_(i18n.UIStrings.otherResourcesLabel),
|
|
187
|
-
transferSize: stats.transferSize - subitemSummary.transferSize,
|
|
188
|
-
blockingTime: stats.blockingTime - subitemSummary.blockingTime,
|
|
189
|
-
tbtImpact: stats.tbtImpact - subitemSummary.tbtImpact,
|
|
190
|
-
};
|
|
191
|
-
if (remainder.transferSize > minTransferSize) {
|
|
192
|
-
items.push(remainder);
|
|
193
|
-
}
|
|
194
149
|
return items;
|
|
195
150
|
}
|
|
196
151
|
|
|
@@ -231,7 +186,7 @@ class ThirdPartySummary extends Audit {
|
|
|
231
186
|
entity: entity.name,
|
|
232
187
|
subItems: {
|
|
233
188
|
type: /** @type {const} */ ('subitems'),
|
|
234
|
-
items: ThirdPartySummary.makeSubItems(entity, summaries
|
|
189
|
+
items: ThirdPartySummary.makeSubItems(entity, summaries),
|
|
235
190
|
},
|
|
236
191
|
};
|
|
237
192
|
})
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"message": "`[aria-*]` attributes match their roles"
|
|
19
19
|
},
|
|
20
20
|
"core/audits/accessibility/aria-allowed-role.js | description": {
|
|
21
|
-
"message": "ARIA `role`s enable assistive technologies to know the role of each element on the web page. If the `role` values are misspelled, not existing ARIA `role` values, or abstract roles, then the purpose of the element will not be communicated to users of assistive technologies. [Learn more about ARIA roles](https://dequeuniversity.com/rules/axe/4.8/aria-allowed-
|
|
21
|
+
"message": "ARIA `role`s enable assistive technologies to know the role of each element on the web page. If the `role` values are misspelled, not existing ARIA `role` values, or abstract roles, then the purpose of the element will not be communicated to users of assistive technologies. [Learn more about ARIA roles](https://dequeuniversity.com/rules/axe/4.8/aria-allowed-role)."
|
|
22
22
|
},
|
|
23
23
|
"core/audits/accessibility/aria-allowed-role.js | failureTitle": {
|
|
24
24
|
"message": "Values assigned to `role=\"\"` are not valid ARIA roles."
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"message": "`[aria-*]` ât́t̂ŕîb́ût́êś m̂át̂ćĥ t́ĥéîŕ r̂ól̂éŝ"
|
|
19
19
|
},
|
|
20
20
|
"core/audits/accessibility/aria-allowed-role.js | description": {
|
|
21
|
-
"message": "ÂŔÎÁ `role`ŝ én̂áb̂ĺê áŝśîśt̂ív̂é t̂éĉh́n̂ól̂óĝíêś t̂ó k̂ńôẃ t̂h́ê ŕôĺê óf̂ éâćĥ él̂ém̂én̂t́ ôń t̂h́ê ẃêb́ p̂áĝé. Îf́ t̂h́ê `role` v́âĺûéŝ ár̂é m̂íŝśp̂él̂ĺêd́, n̂ót̂ éx̂íŝt́îńĝ ÁR̂ÍÂ `role` v́âĺûéŝ, ór̂ áb̂śt̂ŕâćt̂ ŕôĺêś, t̂h́êń t̂h́ê ṕûŕp̂óŝé ôf́ t̂h́ê él̂ém̂én̂t́ ŵíl̂ĺ n̂ót̂ b́ê ćôḿm̂ún̂íĉát̂éd̂ t́ô úŝér̂ś ôf́ âśŝíŝt́îv́ê t́êćĥńôĺôǵîéŝ. [Ĺêár̂ń m̂ór̂é âb́ôút̂ ÁR̂ÍÂ ŕôĺêś](https://dequeuniversity.com/rules/axe/4.8/aria-allowed-
|
|
21
|
+
"message": "ÂŔÎÁ `role`ŝ én̂áb̂ĺê áŝśîśt̂ív̂é t̂éĉh́n̂ól̂óĝíêś t̂ó k̂ńôẃ t̂h́ê ŕôĺê óf̂ éâćĥ él̂ém̂én̂t́ ôń t̂h́ê ẃêb́ p̂áĝé. Îf́ t̂h́ê `role` v́âĺûéŝ ár̂é m̂íŝśp̂él̂ĺêd́, n̂ót̂ éx̂íŝt́îńĝ ÁR̂ÍÂ `role` v́âĺûéŝ, ór̂ áb̂śt̂ŕâćt̂ ŕôĺêś, t̂h́êń t̂h́ê ṕûŕp̂óŝé ôf́ t̂h́ê él̂ém̂én̂t́ ŵíl̂ĺ n̂ót̂ b́ê ćôḿm̂ún̂íĉát̂éd̂ t́ô úŝér̂ś ôf́ âśŝíŝt́îv́ê t́êćĥńôĺôǵîéŝ. [Ĺêár̂ń m̂ór̂é âb́ôút̂ ÁR̂ÍÂ ŕôĺêś](https://dequeuniversity.com/rules/axe/4.8/aria-allowed-role)."
|
|
22
22
|
},
|
|
23
23
|
"core/audits/accessibility/aria-allowed-role.js | failureTitle": {
|
|
24
24
|
"message": "V̂ál̂úêś âśŝíĝńêd́ t̂ó `role=\"\"` âŕê ńôt́ v̂ál̂íd̂ ÁR̂ÍÂ ŕôĺêś."
|