lighthouse 9.5.0-dev.20230122 → 9.5.0-dev.20230124
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/.codecov.yml +0 -5
- package/core/audits/audit.js +1 -1
- package/core/audits/bf-cache.js +1 -1
- package/core/audits/byte-efficiency/legacy-javascript.d.ts +1 -0
- package/core/audits/byte-efficiency/legacy-javascript.js +7 -3
- package/core/audits/dobetterweb/uses-http2.d.ts +5 -2
- package/core/audits/dobetterweb/uses-http2.js +12 -7
- package/core/audits/screenshot-thumbnails.d.ts +2 -1
- package/core/audits/screenshot-thumbnails.js +14 -9
- package/core/audits/third-party-facades.d.ts +3 -2
- package/core/audits/third-party-facades.js +12 -9
- package/core/audits/third-party-summary.d.ts +7 -6
- package/core/audits/third-party-summary.js +16 -14
- package/core/audits/valid-source-maps.d.ts +5 -3
- package/core/audits/valid-source-maps.js +11 -9
- package/core/computed/entity-classification.d.ts +29 -0
- package/core/computed/entity-classification.js +102 -0
- package/core/computed/processed-navigation.d.ts +12 -6
- package/core/computed/processed-navigation.js +19 -6
- package/core/computed/resource-summary.d.ts +4 -2
- package/core/computed/resource-summary.js +8 -5
- package/core/lib/url-utils.js +1 -1
- package/core/runner.d.ts +10 -0
- package/core/runner.js +48 -0
- package/core/util.cjs +43 -10
- package/core/util.d.cts +114 -2
- package/dist/report/bundle.esm.js +858 -883
- package/dist/report/flow.js +33 -23
- package/dist/report/standalone.js +27 -17
- package/flow-report/assets/standalone-flow-template.html +1 -1
- package/flow-report/src/common.tsx +1 -1
- package/flow-report/src/i18n/i18n.d.ts +103 -100
- package/flow-report/src/i18n/i18n.tsx +23 -18
- package/flow-report/src/sidebar/sidebar.tsx +3 -3
- package/flow-report/src/summary/category.tsx +7 -7
- package/flow-report/src/summary/summary.tsx +2 -2
- package/flow-report/src/topbar.tsx +4 -28
- package/package.json +5 -5
- package/readme.md +1 -1
- package/report/assets/standalone-template.html +1 -1
- package/report/assets/styles.css +3 -3
- package/report/assets/templates.html +4 -28
- package/report/renderer/category-renderer.js +19 -17
- package/report/renderer/components.js +119 -202
- package/report/renderer/crc-details-renderer.js +7 -6
- package/report/renderer/details-renderer.js +7 -6
- package/report/renderer/dom.js +1 -1
- package/report/renderer/element-screenshot-renderer.js +3 -3
- package/report/renderer/{i18n.d.ts → i18n-formatter.d.ts} +3 -9
- package/report/renderer/{i18n.js → i18n-formatter.js} +2 -11
- package/report/renderer/performance-category-renderer.js +17 -15
- package/report/renderer/pwa-category-renderer.js +5 -4
- package/report/renderer/report-globals.d.ts +21 -0
- package/report/renderer/report-globals.js +49 -0
- package/report/renderer/report-renderer.js +22 -24
- package/report/renderer/report-ui-features.js +9 -8
- package/report/renderer/report-utils.d.ts +116 -0
- package/report/renderer/{util.js → report-utils.js} +100 -415
- package/report/renderer/snippet-renderer.js +3 -2
- package/report/test/renderer/category-renderer-test.js +10 -5
- package/report/test/renderer/crc-details-renderer-test.js +8 -4
- package/report/test/renderer/details-renderer-test.js +8 -4
- package/report/test/renderer/dom-test.js +8 -4
- package/report/test/renderer/element-screenshot-renderer-test.js +9 -5
- package/report/test/renderer/{i18n-test.js → i18n-formatter-test.js} +15 -21
- package/report/test/renderer/performance-category-renderer-test.js +15 -10
- package/report/test/renderer/pwa-category-renderer-test.js +11 -6
- package/report/test/renderer/report-renderer-test.js +2 -2
- package/report/test/renderer/report-ui-features-test.js +3 -3
- package/report/test/renderer/{util-test.js → report-utils-test.js} +37 -235
- package/report/test/renderer/snippet-renderer-test.js +8 -4
- package/report/test-assets/lhr-3.0.0.json +2332 -0
- package/report/test-assets/lhr-4.3.0.json +4754 -0
- package/report/test-assets/lhr-5.0.0.json +5994 -0
- package/report/test-assets/lhr-6.0.0.json +7222 -0
- package/report/test-assets/lhr-8.5.0.json +8679 -0
- package/shared/localization/format.js +5 -2
- package/shared/localization/locales/ar-XB.json +50 -50
- package/shared/localization/locales/ar.json +50 -50
- package/shared/localization/locales/bg.json +50 -50
- package/shared/localization/locales/ca.json +50 -50
- package/shared/localization/locales/cs.json +50 -50
- package/shared/localization/locales/da.json +50 -50
- package/shared/localization/locales/de.json +50 -50
- package/shared/localization/locales/el.json +50 -50
- package/shared/localization/locales/en-GB.json +50 -50
- package/shared/localization/locales/en-US.json +55 -55
- package/shared/localization/locales/en-XA.json +50 -50
- package/shared/localization/locales/en-XL.json +55 -55
- package/shared/localization/locales/es-419.json +50 -50
- package/shared/localization/locales/es.json +50 -50
- package/shared/localization/locales/fi.json +50 -50
- package/shared/localization/locales/fil.json +50 -50
- package/shared/localization/locales/fr.json +50 -50
- package/shared/localization/locales/he.json +50 -50
- package/shared/localization/locales/hi.json +50 -50
- package/shared/localization/locales/hr.json +50 -50
- package/shared/localization/locales/hu.json +50 -50
- package/shared/localization/locales/id.json +50 -50
- package/shared/localization/locales/it.json +50 -50
- package/shared/localization/locales/ja.json +50 -50
- package/shared/localization/locales/ko.json +50 -50
- package/shared/localization/locales/lt.json +50 -50
- package/shared/localization/locales/lv.json +50 -50
- package/shared/localization/locales/nl.json +50 -50
- package/shared/localization/locales/no.json +50 -50
- package/shared/localization/locales/pl.json +50 -50
- package/shared/localization/locales/pt-PT.json +50 -50
- package/shared/localization/locales/pt.json +50 -50
- package/shared/localization/locales/ro.json +50 -50
- package/shared/localization/locales/ru.json +50 -50
- package/shared/localization/locales/sk.json +50 -50
- package/shared/localization/locales/sl.json +50 -50
- package/shared/localization/locales/sr-Latn.json +50 -50
- package/shared/localization/locales/sr.json +50 -50
- package/shared/localization/locales/sv.json +50 -50
- package/shared/localization/locales/ta.json +50 -50
- package/shared/localization/locales/te.json +50 -50
- package/shared/localization/locales/th.json +50 -50
- package/shared/localization/locales/tr.json +50 -50
- package/shared/localization/locales/uk.json +50 -50
- package/shared/localization/locales/vi.json +50 -50
- package/shared/localization/locales/zh-HK.json +50 -50
- package/shared/localization/locales/zh-TW.json +50 -50
- package/shared/localization/locales/zh.json +50 -50
- package/shared/test/util-test.js +214 -0
- package/shared/util.d.ts +122 -0
- package/shared/util.js +332 -0
- package/types/artifacts.d.ts +14 -0
- package/types/lhr/lhr.d.ts +33 -0
- package/report/renderer/util.d.ts +0 -230
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
/** @typedef {import('./details-renderer.js').DetailsRenderer} DetailsRenderer */
|
|
21
21
|
/** @typedef {'failed'|'warning'|'manual'|'passed'|'notApplicable'} TopLevelClumpId */
|
|
22
22
|
|
|
23
|
-
import {
|
|
23
|
+
import {ReportUtils} from './report-utils.js';
|
|
24
|
+
import {Globals} from './report-globals.js';
|
|
24
25
|
|
|
25
26
|
export class CategoryRenderer {
|
|
26
27
|
/**
|
|
@@ -39,10 +40,10 @@ export class CategoryRenderer {
|
|
|
39
40
|
*/
|
|
40
41
|
get _clumpTitles() {
|
|
41
42
|
return {
|
|
42
|
-
warning:
|
|
43
|
-
manual:
|
|
44
|
-
passed:
|
|
45
|
-
notApplicable:
|
|
43
|
+
warning: Globals.strings.warningAuditsGroupTitle,
|
|
44
|
+
manual: Globals.strings.manualAuditsGroupTitle,
|
|
45
|
+
passed: Globals.strings.passedAuditsGroupTitle,
|
|
46
|
+
notApplicable: Globals.strings.notApplicableAuditsGroupTitle,
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
49
|
|
|
@@ -62,7 +63,7 @@ export class CategoryRenderer {
|
|
|
62
63
|
* @return {!Element}
|
|
63
64
|
*/
|
|
64
65
|
populateAuditValues(audit, component) {
|
|
65
|
-
const strings =
|
|
66
|
+
const strings = Globals.strings;
|
|
66
67
|
const auditEl = this.dom.find('.lh-audit', component);
|
|
67
68
|
auditEl.id = audit.result.id;
|
|
68
69
|
const scoreDisplayMode = audit.result.scoreDisplayMode;
|
|
@@ -185,7 +186,7 @@ export class CategoryRenderer {
|
|
|
185
186
|
* @return {!Element}
|
|
186
187
|
*/
|
|
187
188
|
_setRatingClass(element, score, scoreDisplayMode) {
|
|
188
|
-
const rating =
|
|
189
|
+
const rating = ReportUtils.calculateRating(score, scoreDisplayMode);
|
|
189
190
|
element.classList.add(`lh-audit--${scoreDisplayMode.toLowerCase()}`);
|
|
190
191
|
if (scoreDisplayMode !== 'informative') {
|
|
191
192
|
element.classList.add(`lh-audit--${rating}`);
|
|
@@ -334,8 +335,8 @@ export class CategoryRenderer {
|
|
|
334
335
|
el.append(descriptionEl);
|
|
335
336
|
}
|
|
336
337
|
|
|
337
|
-
this.dom.find('.lh-clump-toggletext--show', el).textContent =
|
|
338
|
-
this.dom.find('.lh-clump-toggletext--hide', el).textContent =
|
|
338
|
+
this.dom.find('.lh-clump-toggletext--show', el).textContent = Globals.strings.show;
|
|
339
|
+
this.dom.find('.lh-clump-toggletext--hide', el).textContent = Globals.strings.hide;
|
|
339
340
|
|
|
340
341
|
clumpElement.classList.add(`lh-clump--${clumpId.toLowerCase()}`);
|
|
341
342
|
return el;
|
|
@@ -349,7 +350,7 @@ export class CategoryRenderer {
|
|
|
349
350
|
*/
|
|
350
351
|
renderCategoryScore(category, groupDefinitions, options) {
|
|
351
352
|
let categoryScore;
|
|
352
|
-
if (options &&
|
|
353
|
+
if (options && ReportUtils.shouldDisplayAsFraction(options.gatherMode)) {
|
|
353
354
|
categoryScore = this.renderCategoryFraction(category);
|
|
354
355
|
} else {
|
|
355
356
|
categoryScore = this.renderScoreGauge(category, groupDefinitions);
|
|
@@ -377,7 +378,7 @@ export class CategoryRenderer {
|
|
|
377
378
|
const tmpl = this.dom.createComponent('gauge');
|
|
378
379
|
const wrapper = this.dom.find('a.lh-gauge__wrapper', tmpl);
|
|
379
380
|
|
|
380
|
-
if (
|
|
381
|
+
if (ReportUtils.isPluginCategory(category.id)) {
|
|
381
382
|
wrapper.classList.add('lh-gauge__wrapper--plugin');
|
|
382
383
|
}
|
|
383
384
|
|
|
@@ -393,16 +394,16 @@ export class CategoryRenderer {
|
|
|
393
394
|
percentageEl.textContent = scoreOutOf100.toString();
|
|
394
395
|
if (category.score === null) {
|
|
395
396
|
percentageEl.textContent = '?';
|
|
396
|
-
percentageEl.title =
|
|
397
|
+
percentageEl.title = Globals.strings.errorLabel;
|
|
397
398
|
}
|
|
398
399
|
|
|
399
400
|
// Render a numerical score if the category has applicable audits, or no audits whatsoever.
|
|
400
401
|
if (category.auditRefs.length === 0 || this.hasApplicableAudits(category)) {
|
|
401
|
-
wrapper.classList.add(`lh-gauge__wrapper--${
|
|
402
|
+
wrapper.classList.add(`lh-gauge__wrapper--${ReportUtils.calculateRating(category.score)}`);
|
|
402
403
|
} else {
|
|
403
404
|
wrapper.classList.add(`lh-gauge__wrapper--not-applicable`);
|
|
404
405
|
percentageEl.textContent = '-';
|
|
405
|
-
percentageEl.title =
|
|
406
|
+
percentageEl.title = Globals.strings.notApplicableAuditsGroupTitle;
|
|
406
407
|
}
|
|
407
408
|
|
|
408
409
|
this.dom.find('.lh-gauge__label', tmpl).textContent = category.title;
|
|
@@ -417,7 +418,8 @@ export class CategoryRenderer {
|
|
|
417
418
|
const tmpl = this.dom.createComponent('fraction');
|
|
418
419
|
const wrapper = this.dom.find('a.lh-fraction__wrapper', tmpl);
|
|
419
420
|
|
|
420
|
-
const {numPassed, numPassableAudits, totalWeight} =
|
|
421
|
+
const {numPassed, numPassableAudits, totalWeight} =
|
|
422
|
+
ReportUtils.calculateCategoryFraction(category);
|
|
421
423
|
|
|
422
424
|
const fraction = numPassed / numPassableAudits;
|
|
423
425
|
const content = this.dom.find('.lh-fraction__content', tmpl);
|
|
@@ -425,7 +427,7 @@ export class CategoryRenderer {
|
|
|
425
427
|
text.textContent = `${numPassed}/${numPassableAudits}`;
|
|
426
428
|
content.append(text);
|
|
427
429
|
|
|
428
|
-
let rating =
|
|
430
|
+
let rating = ReportUtils.calculateRating(fraction);
|
|
429
431
|
|
|
430
432
|
// If none of the available audits can affect the score, a rating isn't useful.
|
|
431
433
|
// The flow report should display the fraction with neutral icon and coloring in this case.
|
|
@@ -490,7 +492,7 @@ export class CategoryRenderer {
|
|
|
490
492
|
return scoreDisplayMode;
|
|
491
493
|
}
|
|
492
494
|
|
|
493
|
-
if (
|
|
495
|
+
if (ReportUtils.showAsPassed(auditRef.result)) {
|
|
494
496
|
if (this._auditHasWarning(auditRef)) {
|
|
495
497
|
return 'warning';
|
|
496
498
|
} else {
|