lighthouse 8.6.0-dev.20211028 → 8.6.0-dev.20211101

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.
Files changed (102) hide show
  1. package/dist/report/flow.js +7 -7
  2. package/dist/report/standalone.js +7 -7
  3. package/flow-report/src/app.tsx +10 -11
  4. package/flow-report/src/common.tsx +11 -5
  5. package/flow-report/src/header.tsx +3 -3
  6. package/flow-report/src/sidebar/flow.tsx +3 -3
  7. package/flow-report/src/sidebar/sidebar.tsx +3 -3
  8. package/flow-report/src/summary/category.tsx +2 -2
  9. package/flow-report/src/util.ts +12 -12
  10. package/flow-report/src/wrappers/report.tsx +11 -6
  11. package/flow-report/test/common-test.tsx +25 -10
  12. package/flow-report/test/flow-report-pptr-test.ts +46 -0
  13. package/flow-report/test/header-test.tsx +6 -6
  14. package/flow-report/test/summary/category-test.tsx +5 -5
  15. package/flow-report/test/util-test.tsx +32 -11
  16. package/jest.config.js +1 -0
  17. package/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +4 -2
  18. package/lighthouse-cli/test/smokehouse/smokehouse.js +1 -1
  19. package/lighthouse-core/audits/errors-in-console.js +0 -2
  20. package/lighthouse-core/audits/image-aspect-ratio.js +1 -2
  21. package/lighthouse-core/audits/image-size-responsive.js +4 -5
  22. package/lighthouse-core/audits/unsized-images.js +1 -1
  23. package/lighthouse-core/computed/image-records.js +4 -3
  24. package/lighthouse-core/computed/metrics/lantern-total-blocking-time.js +3 -4
  25. package/lighthouse-core/computed/metrics/tbt-utils.js +57 -0
  26. package/lighthouse-core/computed/metrics/total-blocking-time.js +3 -53
  27. package/lighthouse-core/config/config-helpers.js +20 -10
  28. package/lighthouse-core/config/default-config.js +59 -56
  29. package/lighthouse-core/fraggle-rock/config/default-config.js +1 -4
  30. package/lighthouse-core/fraggle-rock/gather/base-gatherer.js +6 -1
  31. package/lighthouse-core/gather/driver/storage.js +0 -1
  32. package/lighthouse-core/gather/gatherers/dobetterweb/response-compression.js +1 -0
  33. package/lighthouse-core/gather/gatherers/image-elements.js +0 -3
  34. package/lighthouse-core/lib/asset-saver.js +4 -1
  35. package/lighthouse-core/lib/lh-env.js +2 -0
  36. package/lighthouse-core/lib/tappable-rects.js +8 -15
  37. package/lighthouse-core/runner.js +1 -1
  38. package/lighthouse-core/util-commonjs.js +1 -2
  39. package/package.json +10 -7
  40. package/report/clients/standalone.js +0 -2
  41. package/report/renderer/element-screenshot-renderer.js +2 -2
  42. package/report/renderer/performance-category-renderer.js +20 -5
  43. package/report/renderer/util.js +1 -2
  44. package/report/test/renderer/performance-category-renderer-test.js +34 -8
  45. package/report/test/renderer/report-renderer-test.js +1 -1
  46. package/report/test/renderer/report-ui-features-test.js +3 -0
  47. package/report/test/renderer/util-test.js +13 -31
  48. package/shared/localization/format.js +9 -4
  49. package/shared/localization/locales/ar-XB.json +0 -12
  50. package/shared/localization/locales/ar.json +0 -12
  51. package/shared/localization/locales/bg.json +0 -12
  52. package/shared/localization/locales/ca.json +0 -12
  53. package/shared/localization/locales/cs.json +0 -12
  54. package/shared/localization/locales/da.json +0 -12
  55. package/shared/localization/locales/de.json +0 -12
  56. package/shared/localization/locales/el.json +0 -12
  57. package/shared/localization/locales/en-GB.json +0 -12
  58. package/shared/localization/locales/en-US.json +1 -13
  59. package/shared/localization/locales/en-XA.json +0 -12
  60. package/shared/localization/locales/en-XL.json +1 -13
  61. package/shared/localization/locales/es-419.json +0 -12
  62. package/shared/localization/locales/es.json +0 -12
  63. package/shared/localization/locales/fi.json +0 -12
  64. package/shared/localization/locales/fil.json +0 -12
  65. package/shared/localization/locales/fr.json +0 -12
  66. package/shared/localization/locales/he.json +0 -12
  67. package/shared/localization/locales/hi.json +0 -12
  68. package/shared/localization/locales/hr.json +0 -12
  69. package/shared/localization/locales/hu.json +0 -12
  70. package/shared/localization/locales/id.json +0 -12
  71. package/shared/localization/locales/it.json +0 -12
  72. package/shared/localization/locales/ja.json +0 -12
  73. package/shared/localization/locales/ko.json +0 -12
  74. package/shared/localization/locales/lt.json +0 -12
  75. package/shared/localization/locales/lv.json +0 -12
  76. package/shared/localization/locales/nl.json +0 -12
  77. package/shared/localization/locales/no.json +0 -12
  78. package/shared/localization/locales/pl.json +0 -12
  79. package/shared/localization/locales/pt-PT.json +0 -12
  80. package/shared/localization/locales/pt.json +0 -12
  81. package/shared/localization/locales/ro.json +0 -12
  82. package/shared/localization/locales/ru.json +0 -12
  83. package/shared/localization/locales/sk.json +0 -12
  84. package/shared/localization/locales/sl.json +0 -12
  85. package/shared/localization/locales/sr-Latn.json +0 -12
  86. package/shared/localization/locales/sr.json +0 -12
  87. package/shared/localization/locales/sv.json +0 -12
  88. package/shared/localization/locales/ta.json +0 -12
  89. package/shared/localization/locales/te.json +0 -12
  90. package/shared/localization/locales/th.json +0 -12
  91. package/shared/localization/locales/tr.json +0 -12
  92. package/shared/localization/locales/uk.json +0 -12
  93. package/shared/localization/locales/vi.json +0 -12
  94. package/shared/localization/locales/zh-HK.json +0 -12
  95. package/shared/localization/locales/zh-TW.json +0 -12
  96. package/shared/localization/locales/zh.json +0 -12
  97. package/third-party/chromium-synchronization/installability-errors-test.js +2 -0
  98. package/types/artifacts.d.ts +5 -4
  99. package/types/lhr/flow.d.ts +3 -2
  100. package/types/rollup-plugin-postprocess.d.ts +10 -0
  101. package/lighthouse-core/audits/dobetterweb/appcache-manifest.js +0 -67
  102. package/lighthouse-core/gather/gatherers/dobetterweb/appcache.js +0 -34
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lighthouse",
3
- "version": "8.6.0-dev.20211028",
3
+ "version": "8.6.0-dev.20211101",
4
4
  "description": "Automated auditing, performance metrics, and best practices for the web.",
5
5
  "main": "./lighthouse-core/index.js",
6
6
  "bin": {
@@ -37,7 +37,7 @@
37
37
  "start": "yarn build-report --standalone && node ./lighthouse-cli/index.js",
38
38
  "jest": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js",
39
39
  "test": "yarn diff:sample-json && yarn lint --quiet && yarn unit && yarn type-check",
40
- "test-bundle": "yarn smoke --runner bundle -j=1 --retries=2 a11y dbw",
40
+ "test-bundle": "yarn smoke --runner bundle -j=1 --retries=2 --invert-match forms",
41
41
  "test-clients": "yarn jest \"$PWD/clients/\" && yarn jest --testMatch=\"**/clients/test/**/*-test-pptr.js\"",
42
42
  "test-viewer": "yarn unit-viewer && yarn jest --testMatch=\"**/viewer/**/*-test-pptr.js\"",
43
43
  "test-treemap": "yarn unit-treemap && yarn jest --testMatch=\"**/treemap/**/*-test-pptr.js\"",
@@ -95,9 +95,16 @@
95
95
  },
96
96
  "devDependencies": {
97
97
  "@build-tracker/cli": "^1.0.0-beta.15",
98
+ "@firebase/app-types": "0.3.1",
99
+ "@firebase/auth-types": "0.3.2",
100
+ "@firebase/util": "0.2.1",
101
+ "@rollup/plugin-alias": "^3.1.2",
98
102
  "@rollup/plugin-commonjs": "^20.0.0",
103
+ "@rollup/plugin-dynamic-import-vars": "^1.1.1",
104
+ "@rollup/plugin-json": "^4.1.0",
99
105
  "@rollup/plugin-node-resolve": "^13.0.4",
100
106
  "@rollup/plugin-typescript": "^8.2.5",
107
+ "@stadtlandnetz/rollup-plugin-postprocess": "^1.1.0",
101
108
  "@testing-library/preact": "^2.0.1",
102
109
  "@testing-library/preact-hooks": "^1.1.0",
103
110
  "@types/archiver": "^2.1.2",
@@ -107,7 +114,6 @@
107
114
  "@types/cpy": "^5.1.0",
108
115
  "@types/eslint": "^4.16.6",
109
116
  "@types/estree": "^0.0.50",
110
- "@types/exorcist": "^0.4.5",
111
117
  "@types/gh-pages": "^2.0.0",
112
118
  "@types/google.analytics": "0.0.39",
113
119
  "@types/jest": "^24.0.9",
@@ -133,7 +139,6 @@
133
139
  "angular": "^1.7.4",
134
140
  "archiver": "^3.0.0",
135
141
  "browserify": "^17.0.0",
136
- "browserify-banner": "^1.0.15",
137
142
  "c8": "^7.4.0",
138
143
  "chalk": "^2.4.1",
139
144
  "chrome-devtools-frontend": "1.0.922924",
@@ -148,7 +153,6 @@
148
153
  "eslint-plugin-import": "^2.24.2",
149
154
  "eslint-plugin-local-rules": "0.1.0",
150
155
  "event-target-shim": "^6.0.2",
151
- "exorcist": "^1.0.1",
152
156
  "firebase": "^9.0.2",
153
157
  "gh-pages": "^2.0.1",
154
158
  "glob": "^7.1.3",
@@ -163,13 +167,12 @@
163
167
  "mime-types": "^2.1.30",
164
168
  "node-fetch": "^2.6.1",
165
169
  "npm-run-posix-or-windows": "^2.0.2",
166
- "package-json-versionify": "^1.0.4",
167
170
  "pako": "^2.0.3",
168
171
  "preact": "^10.5.14",
169
172
  "pretty-json-stringify": "^0.0.2",
170
173
  "puppeteer": "^10.2.0",
171
174
  "resolve": "^1.20.0",
172
- "rollup": "^2.50.6",
175
+ "rollup": "^2.52.7",
173
176
  "rollup-plugin-node-resolve": "^5.2.0",
174
177
  "rollup-plugin-polyfill-node": "^0.7.0",
175
178
  "rollup-plugin-replace": "^2.2.0",
@@ -18,8 +18,6 @@ import {Logger} from '../renderer/logger.js';
18
18
  import {ReportRenderer} from '../renderer/report-renderer.js';
19
19
  import {ReportUIFeatures} from '../renderer/report-ui-features.js';
20
20
 
21
- // Used by standalone.html
22
- // eslint-disable-next-line no-unused-vars
23
21
  function __initLighthouseReport__() {
24
22
  const dom = new DOM(document);
25
23
  const renderer = new ReportRenderer(dom);
@@ -51,7 +51,7 @@ function clamp(value, min, max) {
51
51
  /**
52
52
  * @param {Rect} rect
53
53
  */
54
- function getRectCenterPoint(rect) {
54
+ function getElementRectCenterPoint(rect) {
55
55
  return {
56
56
  x: rect.left + rect.width / 2,
57
57
  y: rect.top + rect.height / 2,
@@ -68,7 +68,7 @@ export class ElementScreenshotRenderer {
68
68
  * @param {Size} screenshotSize
69
69
  */
70
70
  static getScreenshotPositions(elementRectSC, elementPreviewSizeSC, screenshotSize) {
71
- const elementRectCenter = getRectCenterPoint(elementRectSC);
71
+ const elementRectCenter = getElementRectCenterPoint(elementRectSC);
72
72
 
73
73
  // Try to center clipped region.
74
74
  const screenshotLeftVisibleEdge = clamp(
@@ -152,6 +152,21 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
152
152
  return url.href;
153
153
  }
154
154
 
155
+ /**
156
+ * For performance, audits with no group should be a diagnostic or opportunity.
157
+ * The audit details type will determine which of the two groups an audit is in.
158
+ *
159
+ * @param {LH.ReportResult.AuditRef} audit
160
+ * @return {'load-opportunity'|'diagnostic'|null}
161
+ */
162
+ _classifyPerformanceAudit(audit) {
163
+ if (audit.group) return null;
164
+ if (audit.result.details && audit.result.details.type === 'opportunity') {
165
+ return 'load-opportunity';
166
+ }
167
+ return 'diagnostic';
168
+ }
169
+
155
170
  /**
156
171
  * @param {LH.ReportResult.Category} category
157
172
  * @param {Object<string, LH.Result.ReportGroup>} groups
@@ -209,10 +224,10 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
209
224
 
210
225
  // Opportunities
211
226
  const opportunityAudits = category.auditRefs
212
- .filter(audit => audit.group === 'load-opportunities' && !Util.showAsPassed(audit.result))
227
+ .filter(audit => this._classifyPerformanceAudit(audit) === 'load-opportunity')
228
+ .filter(audit => !Util.showAsPassed(audit.result))
213
229
  .sort((auditA, auditB) => this._getWastedMs(auditB) - this._getWastedMs(auditA));
214
230
 
215
-
216
231
  const filterableMetrics = metricAudits.filter(a => !!a.relevantAudits);
217
232
  // TODO: only add if there are opportunities & diagnostics rendered.
218
233
  if (filterableMetrics.length) {
@@ -242,7 +257,8 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
242
257
 
243
258
  // Diagnostics
244
259
  const diagnosticAudits = category.auditRefs
245
- .filter(audit => audit.group === 'diagnostics' && !Util.showAsPassed(audit.result))
260
+ .filter(audit => this._classifyPerformanceAudit(audit) === 'diagnostic')
261
+ .filter(audit => !Util.showAsPassed(audit.result))
246
262
  .sort((a, b) => {
247
263
  const scoreA = a.result.scoreDisplayMode === 'informative' ? 100 : Number(a.result.score);
248
264
  const scoreB = b.result.scoreDisplayMode === 'informative' ? 100 : Number(b.result.score);
@@ -258,8 +274,7 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
258
274
 
259
275
  // Passed audits
260
276
  const passedAudits = category.auditRefs
261
- .filter(audit => (audit.group === 'load-opportunities' || audit.group === 'diagnostics') &&
262
- Util.showAsPassed(audit.result));
277
+ .filter(audit => this._classifyPerformanceAudit(audit) && Util.showAsPassed(audit.result));
263
278
 
264
279
  if (!passedAudits.length) return element;
265
280
 
@@ -516,10 +516,9 @@ export class Util {
516
516
  let totalWeight = 0;
517
517
  for (const auditRef of category.auditRefs) {
518
518
  const auditPassed = Util.showAsPassed(auditRef.result);
519
- const notDisplayed = !auditRef.group && category.id === 'performance';
520
519
 
521
520
  // Don't count the audit if it's manual, N/A, or isn't displayed.
522
- if (notDisplayed ||
521
+ if (auditRef.group === 'hidden' ||
523
522
  auditRef.result.scoreDisplayMode === 'manual' ||
524
523
  auditRef.result.scoreDisplayMode === 'notApplicable') {
525
524
  continue;
@@ -96,11 +96,23 @@ describe('PerfCategoryRenderer', () => {
96
96
  assert.strictEqual(new URL(calcLink.href).hostname, 'googlechrome.github.io');
97
97
  });
98
98
 
99
+ it('ignores hidden audits', () => {
100
+ const categoryDOM = renderer.render(category, sampleResults.categoryGroups);
101
+
102
+ const hiddenAudits = category.auditRefs.filter(audit => audit.group === 'hidden');
103
+ const auditElements = [...categoryDOM.querySelectorAll('.lh-audit')];
104
+ const matchingElements = auditElements
105
+ .filter(el => hiddenAudits.some(audit => audit.id === el.id));
106
+ expect(matchingElements).toHaveLength(0);
107
+ });
108
+
99
109
  it('renders the failing performance opportunities', () => {
100
110
  const categoryDOM = renderer.render(category, sampleResults.categoryGroups);
101
111
 
102
- const oppAudits = category.auditRefs.filter(audit => audit.group === 'load-opportunities' &&
103
- !Util.showAsPassed(audit.result));
112
+ const oppAudits = category.auditRefs.filter(audit =>
113
+ audit.result.details &&
114
+ audit.result.details.type === 'opportunity' &&
115
+ !Util.showAsPassed(audit.result));
104
116
  const oppElements = [...categoryDOM.querySelectorAll('.lh-audit--load-opportunity')];
105
117
  expect(oppElements.map(e => e.id).sort()).toEqual(oppAudits.map(a => a.id).sort());
106
118
  expect(oppElements.length).toBeGreaterThan(0);
@@ -120,10 +132,14 @@ describe('PerfCategoryRenderer', () => {
120
132
  it('renders performance opportunities with an errorMessage', () => {
121
133
  const auditWithError = {
122
134
  score: 0,
123
- group: 'load-opportunities',
124
135
  result: {
125
136
  score: null, scoreDisplayMode: 'error', errorMessage: 'Yikes!!', title: 'Bug #2',
126
137
  description: '',
138
+ details: {
139
+ overallSavingsMs: 0,
140
+ items: [],
141
+ type: 'opportunity',
142
+ },
127
143
  },
128
144
  };
129
145
 
@@ -137,10 +153,14 @@ describe('PerfCategoryRenderer', () => {
137
153
  it('renders performance opportunities\' explanation', () => {
138
154
  const auditWithExplanation = {
139
155
  score: 0,
140
- group: 'load-opportunities',
141
156
  result: {
142
157
  score: 0, scoreDisplayMode: 'numeric',
143
158
  numericValue: 100, explanation: 'Yikes!!', title: 'Bug #2', description: '',
159
+ details: {
160
+ overallSavingsMs: 0,
161
+ items: [],
162
+ type: 'opportunity',
163
+ },
144
164
  },
145
165
  };
146
166
 
@@ -159,7 +179,9 @@ describe('PerfCategoryRenderer', () => {
159
179
  '.lh-category > .lh-audit-group.lh-audit-group--diagnostics');
160
180
 
161
181
  const diagnosticAuditIds = category.auditRefs.filter(audit => {
162
- return audit.group === 'diagnostics' && !Util.showAsPassed(audit.result);
182
+ return !audit.group &&
183
+ !(audit.result.details && audit.result.details.type === 'opportunity') &&
184
+ !Util.showAsPassed(audit.result);
163
185
  }).map(audit => audit.id).sort();
164
186
  assert.ok(diagnosticAuditIds.length > 0);
165
187
 
@@ -173,8 +195,8 @@ describe('PerfCategoryRenderer', () => {
173
195
  const passedSection = categoryDOM.querySelector('.lh-category > .lh-clump--passed');
174
196
 
175
197
  const passedAudits = category.auditRefs.filter(audit =>
176
- audit.group && audit.group !== 'metrics' && audit.id !== 'performance-budget'
177
- && Util.showAsPassed(audit.result));
198
+ !audit.group &&
199
+ Util.showAsPassed(audit.result));
178
200
  const passedElements = passedSection.querySelectorAll('.lh-audit');
179
201
  assert.equal(passedElements.length, passedAudits.length);
180
202
  });
@@ -187,10 +209,14 @@ describe('PerfCategoryRenderer', () => {
187
209
  it('handles erroring opportunities', () => {
188
210
  const auditWithDebug = {
189
211
  score: 0,
190
- group: 'load-opportunities',
191
212
  result: {
192
213
  error: true, score: 0,
193
214
  numericValue: 100, explanation: 'Yikes!!', title: 'Bug #2',
215
+ details: {
216
+ overallSavingsMs: 0,
217
+ items: [],
218
+ type: 'opportunity',
219
+ },
194
220
  },
195
221
  };
196
222
  const wastedMs = renderer._getWastedMs(auditWithDebug);
@@ -90,7 +90,7 @@ describe('ReportRenderer', () => {
90
90
  const output = renderer.renderReport(sampleResultsCopy, container);
91
91
 
92
92
  function isPWAGauge(el) {
93
- return el.querySelector('.lh-gauge__label').textContent === 'Progressive Web App';
93
+ return el.querySelector('.lh-gauge__label').textContent === 'PWA';
94
94
  }
95
95
  function isPluginGauge(el) {
96
96
  return el.querySelector('.lh-gauge__label').textContent === 'Some Plugin';
@@ -515,6 +515,9 @@ describe('ReportUIFeatures', () => {
515
515
  expect(render(lhr).querySelector('.lh-button.lh-report-icon--treemap')).toBeTruthy();
516
516
 
517
517
  delete lhr.audits['script-treemap-data'];
518
+ const newAuditRefs = lhr.categories['performance'].auditRefs
519
+ .filter(a => a.id !== 'script-treemap-data');
520
+ lhr.categories['performance'].auditRefs = newAuditRefs;
518
521
  expect(render(lhr).querySelector('.lh-button.lh-report-icon--treemap')).toBeNull();
519
522
  });
520
523
  });
@@ -401,10 +401,10 @@ describe('util helpers', () => {
401
401
  const category = {
402
402
  id: 'performance',
403
403
  auditRefs: [
404
- {weight: 3, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'diagnostics'},
405
- {weight: 2, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'diagnostics'},
406
- {weight: 0, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'diagnostics'},
407
- {weight: 1, result: {score: 0, scoreDisplayMode: 'binary'}, group: 'diagnostics'},
404
+ {weight: 3, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'metrics'},
405
+ {weight: 2, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'metrics'},
406
+ {weight: 0, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'metrics'},
407
+ {weight: 1, result: {score: 0, scoreDisplayMode: 'binary'}, group: 'metrics'},
408
408
  ],
409
409
  };
410
410
  const fraction = Util.calculateCategoryFraction(category);
@@ -416,14 +416,14 @@ describe('util helpers', () => {
416
416
  });
417
417
  });
418
418
 
419
- it('ignores manual audits, N/A audits, and performance audits with no group', () => {
419
+ it('ignores manual audits, N/A audits, and hidden audits', () => {
420
420
  const category = {
421
421
  id: 'performance',
422
422
  auditRefs: [
423
- {weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'diagnostics'},
424
- {weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}},
425
- {weight: 1, result: {score: 0, scoreDisplayMode: 'manual'}, group: 'diagnostics'},
426
- {weight: 1, result: {score: 0, scoreDisplayMode: 'notApplicable'}, group: 'diagnostics'},
423
+ {weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'metrics'},
424
+ {weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'hidden'},
425
+ {weight: 1, result: {score: 0, scoreDisplayMode: 'manual'}, group: 'metrics'},
426
+ {weight: 1, result: {score: 0, scoreDisplayMode: 'notApplicable'}, group: 'metrics'},
427
427
  ],
428
428
  };
429
429
  const fraction = Util.calculateCategoryFraction(category);
@@ -435,32 +435,14 @@ describe('util helpers', () => {
435
435
  });
436
436
  });
437
437
 
438
- it('does not ignore audits with no group in non-performance category', () => {
439
- const category = {
440
- id: 'seo',
441
- auditRefs: [
442
- {weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'diagnostics'},
443
- {weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}},
444
- {weight: 1, result: {score: 0, scoreDisplayMode: 'manual'}, group: 'diagnostics'},
445
- ],
446
- };
447
- const fraction = Util.calculateCategoryFraction(category);
448
- expect(fraction).toEqual({
449
- numPassableAudits: 2,
450
- numPassed: 2,
451
- numInformative: 0,
452
- totalWeight: 2,
453
- });
454
- });
455
-
456
438
  it('tracks informative audits separately', () => {
457
439
  const category = {
458
440
  id: 'performance',
459
441
  auditRefs: [
460
- {weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'diagnostics'},
461
- {weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'diagnostics'},
462
- {weight: 0, result: {score: 1, scoreDisplayMode: 'informative'}, group: 'diagnostics'},
463
- {weight: 1, result: {score: 0, scoreDisplayMode: 'informative'}, group: 'diagnostics'},
442
+ {weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'metrics'},
443
+ {weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'metrics'},
444
+ {weight: 0, result: {score: 1, scoreDisplayMode: 'informative'}, group: 'metrics'},
445
+ {weight: 1, result: {score: 0, scoreDisplayMode: 'informative'}, group: 'metrics'},
464
446
  ],
465
447
  };
466
448
  const fraction = Util.calculateCategoryFraction(category);
@@ -7,11 +7,13 @@
7
7
 
8
8
  const fs = require('fs');
9
9
 
10
- const MessageFormat = require('intl-messageformat').default;
10
+ const MessageFormat = require('intl-messageformat');
11
11
  const {isObjectOfUnknownValues, isObjectOrArrayOfUnknownValues} = require('../type-verifiers.js');
12
12
 
13
13
  /** Contains available locales with messages. May be an empty object if bundled. */
14
- const LOCALE_MESSAGES = require('./locales.js');
14
+ /** @type {import('./locales')} */
15
+ // @ts-expect-error TODO(esmodules): remove when file is es modules.
16
+ const LOCALE_MESSAGES = require('./locales.js').default || require('./locales.js');
15
17
 
16
18
  const DEFAULT_LOCALE = 'en-US';
17
19
 
@@ -93,7 +95,7 @@ function collectAllCustomElementsFromICU(icuElements, seenElementsById = new Map
93
95
  * Returns a copy of the `values` object, with the values formatted based on how
94
96
  * they will be used in their icuMessage, e.g. KB or milliseconds. The original
95
97
  * object is unchanged.
96
- * @param {MessageFormat} messageFormatter
98
+ * @param {MessageFormat.IntlMessageFormat} messageFormatter
97
99
  * @param {Readonly<Record<string, string | number>>} values
98
100
  * @param {string} lhlMessage Used for clear error logging.
99
101
  * @return {Record<string, string | number>}
@@ -171,7 +173,10 @@ function formatMessage(message, values = {}, locale) {
171
173
  // When using accented english, force the use of a different locale for number formatting.
172
174
  const localeForMessageFormat = (locale === 'en-XA' || locale === 'en-XL') ? 'de-DE' : locale;
173
175
 
174
- const formatter = new MessageFormat(message, localeForMessageFormat, formats);
176
+ // This package is not correctly bundled by Rollup.
177
+ /** @type {typeof MessageFormat.IntlMessageFormat} */
178
+ const MessageFormatCtor = MessageFormat.IntlMessageFormat || MessageFormat;
179
+ const formatter = new MessageFormatCtor(message, localeForMessageFormat, formats);
175
180
 
176
181
  // Preformat values for the message format like KB and milliseconds.
177
182
  const valuesForMessageFormat = _preformatValues(formatter, values, message);
@@ -743,18 +743,6 @@
743
743
  "lighthouse-core/audits/deprecations.js | title": {
744
744
  "message": "‏‮Avoids‬‏ ‏‮deprecated‬‏ ‏‮APIs‬‏"
745
745
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "‏‮Application‬‏ ‏‮Cache‬‏ ‏‮is‬‏ ‏‮deprecated‬‏. [‏‮Learn‬‏ ‏‮more‬‏](https://web.dev/appcache-manifest/)."
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "‏‮Found‬‏ \"{AppCacheManifest}\""
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "‏‮Uses‬‏ ‏‮Application‬‏ ‏‮Cache‬‏"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "‏‮Avoids‬‏ ‏‮Application‬‏ ‏‮Cache‬‏"
757
- },
758
746
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
747
  "message": "‏‮A‬‏ ‏‮character‬‏ ‏‮encoding‬‏ ‏‮declaration‬‏ ‏‮is‬‏ ‏‮required‬‏. ‏‮It‬‏ ‏‮can‬‏ ‏‮be‬‏ ‏‮done‬‏ ‏‮with‬‏ ‏‮a‬‏ `<meta>` ‏‮tag‬‏ ‏‮in‬‏ ‏‮the‬‏ ‏‮first‬‏ 1024 ‏‮bytes‬‏ ‏‮of‬‏ ‏‮the‬‏ ‏‮HTML‬‏ ‏‮or‬‏ ‏‮in‬‏ ‏‮the‬‏ ‏‮Content‬‏-‏‮Type‬‏ ‏‮HTTP‬‏ ‏‮response‬‏ ‏‮header‬‏. [‏‮Learn‬‏ ‏‮more‬‏](https://web.dev/charset/)."
760
748
  },
@@ -743,18 +743,6 @@
743
743
  "lighthouse-core/audits/deprecations.js | title": {
744
744
  "message": "يتم تجنّب واجهات برمجة التطبيقات المتوقفة"
745
745
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "تم إيقاف ذاكرة التخزين المؤقت للتطبيق. [مزيد من المعلومات](https://web.dev/appcache-manifest/)"
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "تم العثور على \"{AppCacheManifest}\""
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "يتم استخدام ذاكرة التخزين المؤقت للتطبيق"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "يتم تجنُب ذاكرة التخزين المؤقت للتطبيق"
757
- },
758
746
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
747
  "message": "تعريف ترميز الأحرف مطلوب. ويمكن إجراء ذلك باستخدام علامة `<meta>` في أول 1024 وحدة بايت من عنوان HTML أو في عنوان الاستجابة Content-Type في HTTP. [مزيد من المعلومات](https://web.dev/charset/)"
760
748
  },
@@ -743,18 +743,6 @@
743
743
  "lighthouse-core/audits/deprecations.js | title": {
744
744
  "message": "Избягва оттеглени API"
745
745
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "Кешът на приложенията е оттеглен. [Научете повече](https://web.dev/appcache-manifest/)."
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "Намерихме {AppCacheManifest}"
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "Използва кеша на приложенията"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "Избягва кеша на приложенията"
757
- },
758
746
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
747
  "message": "Трябва да декларирате система за кодиране на знаците. За целта можете да използвате маркер `<meta>` в първите 1024 байта на HTML кода или в заглавката Content-Type за HTTP отговор. [Научете повече](https://web.dev/charset/)."
760
748
  },
@@ -743,18 +743,6 @@
743
743
  "lighthouse-core/audits/deprecations.js | title": {
744
744
  "message": "Evita les API obsoletes"
745
745
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "La memòria cau de l'aplicació està obsoleta. [Obtén més informació](https://web.dev/appcache-manifest/)."
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "S'ha trobat \"{AppCacheManifest}\""
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "Utilitza la memòria cau de l'aplicació"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "Evita la memòria cau de l'aplicació"
757
- },
758
746
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
747
  "message": "Cal una declaració de codificació de caràcters. Es pot fer amb una etiqueta `<meta>` als primers 1.024 bytes de l'HTML o a la capçalera de resposta HTTP de tipus contingut. [Obtén més informació](https://web.dev/charset/)."
760
748
  },
@@ -743,18 +743,6 @@
743
743
  "lighthouse-core/audits/deprecations.js | title": {
744
744
  "message": "Nepoužívá zastaralá rozhraní API"
745
745
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "Mezipaměť aplikace je zastaralá technologie. [Další informace](https://web.dev/appcache-manifest/)"
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "Nalezeno „{AppCacheManifest}“"
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "Používá mezipaměť aplikace"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "Nepoužívá mezipaměť aplikace"
757
- },
758
746
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
747
  "message": "Je požadována deklarace kódování znaků. Lze ho deklarovat pomocí značky `<meta>` v prvních 1024 bajtech kódu HTML nebo pomocí záhlaví Content-Type odpovědi HTTP. [Další informace](https://web.dev/charset/)"
760
748
  },
@@ -743,18 +743,6 @@
743
743
  "lighthouse-core/audits/deprecations.js | title": {
744
744
  "message": "Undgår udfasede API'er"
745
745
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "Application Cache er udfaset. [Få flere oplysninger](https://web.dev/appcache-manifest/)."
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "\"{AppCacheManifest}\" blev fundet"
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "Bruger Application Cache"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "Undgår Application Cache"
757
- },
758
746
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
747
  "message": "Der skal angives en erklæring om tegnkodning. Det kan gøres med et `<meta>`-tag i de første 1024 bytes i HTML-koden eller i HTTP-svarheaderen for Content-Type. [Få flere oplysninger](https://web.dev/charset/)."
760
748
  },
@@ -743,18 +743,6 @@
743
743
  "lighthouse-core/audits/deprecations.js | title": {
744
744
  "message": "Vermeidet veraltete APIs"
745
745
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "Application Cache ist veraltet. [Weitere Informationen.](https://web.dev/appcache-manifest/)"
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "\"{AppCacheManifest}\" gefunden"
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "Verwendet Application Cache"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "Vermeidet Application Cache"
757
- },
758
746
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
747
  "message": "Eine Zeichencodierungsdeklaration ist erforderlich. Sie kann mit einem `<meta>`-Tag in den ersten 1024 Byte des HTML-Codes oder im HTTP-Antwortheader „Content-Type“ angegeben werden. [Weitere Informationen](https://web.dev/charset/)"
760
748
  },
@@ -743,18 +743,6 @@
743
743
  "lighthouse-core/audits/deprecations.js | title": {
744
744
  "message": "Αποφυγή καταργημένων API"
745
745
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "Η κρυφή μνήμη εφαρμογής έχει καταργηθεί. [Μάθετε περισσότερα](https://web.dev/appcache-manifest/)."
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "Βρέθηκε \"{AppCacheManifest}\""
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "Χρησιμοποιεί προσωρινή μνήμη εφαρμογής"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "Αποφυγή προσωρινής μνήμης εφαρμογής"
757
- },
758
746
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
747
  "message": "Απαιτείται δήλωση κωδικοποίησης χαρακτήρων. Μπορεί να πραγματοποιηθεί με μια ετικέτα `<meta>` στα πρώτα 1024 byte του κώδικα HTML ή στην κεφαλίδα απόκρισης HTTP τύπου περιεχομένου. [Μάθετε περισσότερα](https://web.dev/charset/)."
760
748
  },
@@ -743,18 +743,6 @@
743
743
  "lighthouse-core/audits/deprecations.js | title": {
744
744
  "message": "Avoids deprecated APIs"
745
745
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "Application cache is deprecated. [Learn more](https://web.dev/appcache-manifest/)."
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "Found '{AppCacheManifest}'"
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "Uses application cache"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "Avoids application cache"
757
- },
758
746
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
747
  "message": "A character encoding declaration is required. It can be done with a `<meta>` tag in the first 1,024 bytes of the HTML or in the Content-Type HTTP response header. [Learn more](https://web.dev/charset/)."
760
748
  },
@@ -764,18 +764,6 @@
764
764
  "lighthouse-core/audits/deprecations.js | title": {
765
765
  "message": "Avoids deprecated APIs"
766
766
  },
767
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
768
- "message": "Application Cache is deprecated. [Learn more](https://web.dev/appcache-manifest/)."
769
- },
770
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
771
- "message": "Found \"{AppCacheManifest}\""
772
- },
773
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
774
- "message": "Uses Application Cache"
775
- },
776
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
777
- "message": "Avoids Application Cache"
778
- },
779
767
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
780
768
  "message": "A character encoding declaration is required. It can be done with a `<meta>` tag in the first 1024 bytes of the HTML or in the Content-Type HTTP response header. [Learn more](https://web.dev/charset/)."
781
769
  },
@@ -1788,7 +1776,7 @@
1788
1776
  "message": "These checks are required by the baseline [PWA Checklist](https://developers.google.com/web/progressive-web-apps/checklist) but are not automatically checked by Lighthouse. They do not affect your score but it's important that you verify them manually."
1789
1777
  },
1790
1778
  "lighthouse-core/config/default-config.js | pwaCategoryTitle": {
1791
- "message": "Progressive Web App"
1779
+ "message": "PWA"
1792
1780
  },
1793
1781
  "lighthouse-core/config/default-config.js | pwaInstallableGroupTitle": {
1794
1782
  "message": "Installable"
@@ -743,18 +743,6 @@
743
743
  "lighthouse-core/audits/deprecations.js | title": {
744
744
  "message": "[Åvöîðš ðéþŕéçåţéð ÅÞΚ one two three]"
745
745
  },
746
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | description": {
747
- "message": "[Åþþļîçåţîöñ Çåçĥé îš ðéþŕéçåţéð. ᐅ[ᐊĻéåŕñ möŕéᐅ](https://web.dev/appcache-manifest/)ᐊ. one two three four five six seven eight nine ten eleven]"
748
- },
749
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | displayValue": {
750
- "message": "[Föûñð \"ᐅ{AppCacheManifest}ᐊ\" one two three]"
751
- },
752
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | failureTitle": {
753
- "message": "[Ûšéš Åþþļîçåţîöñ Çåçĥé one two three]"
754
- },
755
- "lighthouse-core/audits/dobetterweb/appcache-manifest.js | title": {
756
- "message": "[Åvöîðš Åþþļîçåţîöñ Çåçĥé one two three]"
757
- },
758
746
  "lighthouse-core/audits/dobetterweb/charset.js | description": {
759
747
  "message": "[Å çĥåŕåçţéŕ éñçöðîñĝ ðéçļåŕåţîöñ îš ŕéqûîŕéð. Îţ çåñ бé ðöñé ŵîţĥ å ᐅ`<meta>`ᐊ ţåĝ îñ ţĥé ƒîŕšţ 1024 бýţéš öƒ ţĥé ĤŢMĻ öŕ îñ ţĥé Çöñţéñţ-Ţýþé ĤŢŢÞ ŕéšþöñšé ĥéåðéŕ. ᐅ[ᐊĻéåŕñ möŕéᐅ](https://web.dev/charset/)ᐊ. one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twentyone twentytwo twentythree twentyfour]"
760
748
  },