lighthouse 9.5.0-dev.20221019 → 9.5.0-dev.20221021

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 (81) hide show
  1. package/core/audits/accessibility/axe-audit.js +1 -1
  2. package/core/audits/autocomplete.js +3 -3
  3. package/core/audits/bootup-time.js +5 -5
  4. package/core/audits/byte-efficiency/duplicated-javascript.js +1 -1
  5. package/core/audits/byte-efficiency/legacy-javascript.js +1 -1
  6. package/core/audits/byte-efficiency/total-byte-weight.js +2 -2
  7. package/core/audits/byte-efficiency/uses-long-cache-ttl.js +3 -3
  8. package/core/audits/byte-efficiency/uses-responsive-images-snapshot.js +4 -4
  9. package/core/audits/csp-xss.js +3 -3
  10. package/core/audits/deprecations.js +2 -2
  11. package/core/audits/dobetterweb/dom-size.js +3 -3
  12. package/core/audits/dobetterweb/geolocation-on-start.js +1 -1
  13. package/core/audits/dobetterweb/inspector-issues.js +1 -1
  14. package/core/audits/dobetterweb/js-libraries.js +2 -2
  15. package/core/audits/dobetterweb/no-document-write.js +1 -1
  16. package/core/audits/dobetterweb/notification-on-start.js +1 -1
  17. package/core/audits/dobetterweb/password-inputs-can-be-pasted-into.js +1 -1
  18. package/core/audits/dobetterweb/uses-http2.js +2 -2
  19. package/core/audits/dobetterweb/uses-passive-event-listeners.js +1 -1
  20. package/core/audits/errors-in-console.js +4 -2
  21. package/core/audits/font-display.js +2 -2
  22. package/core/audits/image-aspect-ratio.js +4 -4
  23. package/core/audits/image-size-responsive.js +5 -5
  24. package/core/audits/installable-manifest.js +1 -1
  25. package/core/audits/is-on-https.js +2 -2
  26. package/core/audits/largest-contentful-paint-element.js +1 -1
  27. package/core/audits/layout-shift-elements.js +3 -3
  28. package/core/audits/lcp-lazy-loaded.js +1 -1
  29. package/core/audits/long-tasks.js +3 -3
  30. package/core/audits/main-thread-tasks.js +2 -2
  31. package/core/audits/mainthread-work-breakdown.js +4 -2
  32. package/core/audits/network-requests.js +11 -11
  33. package/core/audits/network-rtt.js +2 -2
  34. package/core/audits/network-server-latency.js +3 -3
  35. package/core/audits/no-unload-listeners.js +1 -1
  36. package/core/audits/non-composited-animations.js +2 -2
  37. package/core/audits/performance-budget.js +5 -5
  38. package/core/audits/preload-fonts.js +1 -1
  39. package/core/audits/resource-summary.js +3 -3
  40. package/core/audits/seo/crawlable-anchors.js +2 -2
  41. package/core/audits/seo/font-size.js +4 -4
  42. package/core/audits/seo/hreflang.js +3 -3
  43. package/core/audits/seo/is-crawlable.js +1 -1
  44. package/core/audits/seo/link-text.js +2 -2
  45. package/core/audits/seo/plugins.js +1 -1
  46. package/core/audits/seo/robots-txt.js +3 -3
  47. package/core/audits/seo/tap-targets.js +3 -3
  48. package/core/audits/themed-omnibox.js +6 -14
  49. package/core/audits/third-party-facades.js +3 -3
  50. package/core/audits/third-party-summary.js +3 -3
  51. package/core/audits/timing-budget.js +3 -3
  52. package/core/audits/unsized-images.js +2 -2
  53. package/core/audits/user-timings.js +6 -6
  54. package/core/audits/valid-source-maps.js +3 -3
  55. package/core/audits/work-during-interaction.js +6 -6
  56. package/core/lib/bfcache-strings.js +655 -0
  57. package/core/lib/deprecations-strings.js +3 -2
  58. package/core/lib/manifest-parser.js +0 -16
  59. package/core/user-flow.js +93 -23
  60. package/core/util.cjs +27 -0
  61. package/dist/report/bundle.esm.js +38 -73
  62. package/dist/report/flow.js +2 -2
  63. package/dist/report/standalone.js +2 -2
  64. package/flow-report/src/app.tsx +1 -1
  65. package/flow-report/src/header.tsx +1 -1
  66. package/flow-report/src/util.ts +1 -1
  67. package/flow-report/src/wrappers/report.tsx +1 -1
  68. package/flow-report/types/flow-report.d.ts +8 -1
  69. package/package.json +2 -3
  70. package/report/generator/report-generator.js +1 -1
  71. package/report/renderer/details-renderer.js +12 -73
  72. package/report/renderer/util.js +27 -0
  73. package/report/test/renderer/details-renderer-test.js +38 -38
  74. package/report/test/renderer/util-test.js +25 -0
  75. package/shared/localization/locales/en-US.json +352 -1
  76. package/shared/localization/locales/en-XL.json +352 -1
  77. package/shared/types/shared.d.ts +2 -2
  78. package/types/global-lh.d.ts +1 -1
  79. package/types/lhr/audit-details.d.ts +4 -34
  80. package/types/lhr/{flow.d.ts → flow-result.d.ts} +3 -7
  81. package/types/user-flow.d.ts +7 -2
@@ -123,6 +123,33 @@ class Util {
123
123
  }
124
124
  }
125
125
  }
126
+
127
+ // Circa 10.0, table items were refactored.
128
+ if (audit.details.type === 'table') {
129
+ for (const heading of audit.details.headings) {
130
+ /** @type {{itemType: LH.Audit.Details.ItemValueType|undefined, text: string|undefined}} */
131
+ // @ts-expect-error
132
+ const {itemType, text} = heading;
133
+ if (itemType !== undefined) {
134
+ heading.valueType = itemType;
135
+ // @ts-expect-error
136
+ delete heading.itemType;
137
+ }
138
+ if (text !== undefined) {
139
+ heading.label = text;
140
+ // @ts-expect-error
141
+ delete heading.text;
142
+ }
143
+
144
+ // @ts-expect-error
145
+ const subItemsItemType = heading.subItemsHeading?.itemType;
146
+ if (heading.subItemsHeading && subItemsItemType !== undefined) {
147
+ heading.subItemsHeading.valueType = subItemsItemType;
148
+ // @ts-expect-error
149
+ delete heading.subItemsHeading.itemType;
150
+ }
151
+ }
152
+ }
126
153
  }
127
154
  }
128
155
 
@@ -57,9 +57,9 @@ describe('DetailsRenderer', () => {
57
57
  const el = renderer.render({
58
58
  type: 'table',
59
59
  headings: [
60
- {text: 'First', key: 'a', itemType: 'text'},
61
- {text: 'Second', key: 'b', itemType: 'text'},
62
- {text: 'Preview', key: 'c', itemType: 'thumbnail'},
60
+ {text: 'First', key: 'a', valueType: 'text'},
61
+ {text: 'Second', key: 'b', valueType: 'text'},
62
+ {text: 'Preview', key: 'c', valueType: 'thumbnail'},
63
63
  ],
64
64
  items: [
65
65
  {
@@ -88,11 +88,11 @@ describe('DetailsRenderer', () => {
88
88
  const el = renderer.render({
89
89
  type: 'table',
90
90
  headings: [
91
- {text: '', key: 'bytes', itemType: 'bytes'},
92
- {text: '', key: 'numeric', itemType: 'numeric'},
93
- {text: '', key: 'ms', itemType: 'ms'},
91
+ {text: '', key: 'bytes', valueType: 'bytes'},
92
+ {text: '', key: 'numeric', valueType: 'numeric'},
93
+ {text: '', key: 'ms', valueType: 'ms'},
94
94
  // Verify that 0 is ignored.
95
- {text: '', key: 'ms', itemType: 'ms', granularity: 0},
95
+ {text: '', key: 'ms', valueType: 'ms', granularity: 0},
96
96
  ],
97
97
  items: [
98
98
  {
@@ -114,9 +114,9 @@ describe('DetailsRenderer', () => {
114
114
  const el = renderer.render({
115
115
  type: 'table',
116
116
  headings: [
117
- {text: '', key: 'bytes', itemType: 'bytes', granularity: 0.01},
118
- {text: '', key: 'numeric', itemType: 'numeric', granularity: 100},
119
- {text: '', key: 'ms', itemType: 'ms', granularity: 1},
117
+ {text: '', key: 'bytes', valueType: 'bytes', granularity: 0.01},
118
+ {text: '', key: 'numeric', valueType: 'numeric', granularity: 100},
119
+ {text: '', key: 'ms', valueType: 'ms', granularity: 1},
120
120
  ],
121
121
  items: [
122
122
  {
@@ -190,7 +190,7 @@ describe('DetailsRenderer', () => {
190
190
  it('renders lists', () => {
191
191
  const table = {
192
192
  type: 'table',
193
- headings: [{text: '', key: 'numeric', itemType: 'numeric'}],
193
+ headings: [{text: '', key: 'numeric', valueType: 'numeric'}],
194
194
  items: [{numeric: 1234.567}],
195
195
  };
196
196
 
@@ -264,7 +264,7 @@ describe('DetailsRenderer', () => {
264
264
  it('renders text values', () => {
265
265
  const details = {
266
266
  type: 'table',
267
- headings: [{key: 'content', itemType: 'text', text: 'Heading'}],
267
+ headings: [{key: 'content', valueType: 'text', label: 'Heading'}],
268
268
  items: [{content: 'My text content'}],
269
269
  };
270
270
 
@@ -277,7 +277,7 @@ describe('DetailsRenderer', () => {
277
277
  it('renders not much if items are empty', () => {
278
278
  const details = {
279
279
  type: 'table',
280
- headings: [{key: 'content', itemType: 'text', text: 'Heading'}],
280
+ headings: [{key: 'content', valueType: 'text', label: 'Heading'}],
281
281
  items: [],
282
282
  };
283
283
 
@@ -288,7 +288,7 @@ describe('DetailsRenderer', () => {
288
288
  it('renders an empty cell if item is missing a property', () => {
289
289
  const details = {
290
290
  type: 'table',
291
- headings: [{key: 'content', itemType: 'text', text: 'Heading'}],
291
+ headings: [{key: 'content', valueType: 'text', label: 'Heading'}],
292
292
  items: [
293
293
  {},
294
294
  {content: undefined},
@@ -316,7 +316,7 @@ describe('DetailsRenderer', () => {
316
316
  it('renders code values from a string', () => {
317
317
  const details = {
318
318
  type: 'table',
319
- headings: [{key: 'content', itemType: 'code', text: 'Heading'}],
319
+ headings: [{key: 'content', valueType: 'code', label: 'Heading'}],
320
320
  items: [{content: 'code snippet'}],
321
321
  };
322
322
 
@@ -334,7 +334,7 @@ describe('DetailsRenderer', () => {
334
334
 
335
335
  const details = {
336
336
  type: 'table',
337
- headings: [{key: 'content', itemType: 'code', text: 'Heading'}],
337
+ headings: [{key: 'content', valueType: 'code', label: 'Heading'}],
338
338
  items: [{content: code}],
339
339
  };
340
340
 
@@ -347,7 +347,7 @@ describe('DetailsRenderer', () => {
347
347
  it('renders thumbnail values', () => {
348
348
  const details = {
349
349
  type: 'table',
350
- headings: [{key: 'content', itemType: 'thumbnail', text: 'Heading'}],
350
+ headings: [{key: 'content', valueType: 'thumbnail', label: 'Heading'}],
351
351
  items: [{content: 'http://example.com/my-image.jpg'}],
352
352
  };
353
353
 
@@ -369,7 +369,7 @@ describe('DetailsRenderer', () => {
369
369
  };
370
370
  const details = {
371
371
  type: 'table',
372
- headings: [{key: 'content', itemType: 'link', text: 'Heading'}],
372
+ headings: [{key: 'content', valueType: 'link', label: 'Heading'}],
373
373
  items: [{content: link}],
374
374
  };
375
375
 
@@ -391,7 +391,7 @@ describe('DetailsRenderer', () => {
391
391
  };
392
392
  const details = {
393
393
  type: 'table',
394
- headings: [{key: 'content', itemType: 'link', text: 'Heading'}],
394
+ headings: [{key: 'content', valueType: 'link', label: 'Heading'}],
395
395
  items: [{content: link}],
396
396
  };
397
397
 
@@ -411,7 +411,7 @@ describe('DetailsRenderer', () => {
411
411
  };
412
412
  const details = {
413
413
  type: 'table',
414
- headings: [{key: 'content', itemType: 'link', text: 'Heading'}],
414
+ headings: [{key: 'content', valueType: 'link', label: 'Heading'}],
415
415
  items: [{content: link}],
416
416
  };
417
417
 
@@ -431,7 +431,7 @@ describe('DetailsRenderer', () => {
431
431
  };
432
432
  const details = {
433
433
  type: 'table',
434
- headings: [{key: 'content', itemType: 'node', text: 'Heading'}],
434
+ headings: [{key: 'content', valueType: 'node', label: 'Heading'}],
435
435
  items: [{content: node}],
436
436
  };
437
437
 
@@ -466,7 +466,7 @@ describe('DetailsRenderer', () => {
466
466
  };
467
467
  const details = {
468
468
  type: 'table',
469
- headings: [{key: 'content', itemType: 'node', text: 'Heading'}],
469
+ headings: [{key: 'content', valueType: 'node', label: 'Heading'}],
470
470
  items: [{content: node}],
471
471
  };
472
472
 
@@ -498,7 +498,7 @@ describe('DetailsRenderer', () => {
498
498
  };
499
499
  const details = {
500
500
  type: 'table',
501
- headings: [{key: 'content', itemType: 'node', text: 'Heading'}],
501
+ headings: [{key: 'content', valueType: 'node', label: 'Heading'}],
502
502
  items: [{content: node}],
503
503
  };
504
504
 
@@ -519,7 +519,7 @@ describe('DetailsRenderer', () => {
519
519
  };
520
520
  const details = {
521
521
  type: 'table',
522
- headings: [{key: 'content', itemType: 'source-location', text: 'Heading'}],
522
+ headings: [{key: 'content', valueType: 'source-location', label: 'Heading'}],
523
523
  items: [{content: sourceLocation}],
524
524
  };
525
525
 
@@ -549,7 +549,7 @@ describe('DetailsRenderer', () => {
549
549
  };
550
550
  const details = {
551
551
  type: 'table',
552
- headings: [{key: 'content', itemType: 'source-location', text: 'Heading'}],
552
+ headings: [{key: 'content', valueType: 'source-location', label: 'Heading'}],
553
553
  items: [{content: sourceLocation}],
554
554
  };
555
555
 
@@ -575,7 +575,7 @@ describe('DetailsRenderer', () => {
575
575
  };
576
576
  const details = {
577
577
  type: 'table',
578
- headings: [{key: 'content', itemType: 'source-location', text: 'Heading'}],
578
+ headings: [{key: 'content', valueType: 'source-location', label: 'Heading'}],
579
579
  items: [{content: sourceLocation}],
580
580
  };
581
581
 
@@ -600,7 +600,7 @@ describe('DetailsRenderer', () => {
600
600
  };
601
601
  const details = {
602
602
  type: 'table',
603
- headings: [{key: 'content', itemType: 'source-location', text: 'Heading'}],
603
+ headings: [{key: 'content', valueType: 'source-location', label: 'Heading'}],
604
604
  items: [{content: sourceLocation}],
605
605
  };
606
606
 
@@ -625,7 +625,7 @@ describe('DetailsRenderer', () => {
625
625
  };
626
626
  const details = {
627
627
  type: 'table',
628
- headings: [{key: 'content', itemType: 'source-location', text: 'Heading'}],
628
+ headings: [{key: 'content', valueType: 'source-location', label: 'Heading'}],
629
629
  items: [{content: sourceLocation}],
630
630
  };
631
631
 
@@ -646,7 +646,7 @@ describe('DetailsRenderer', () => {
646
646
 
647
647
  const details = {
648
648
  type: 'table',
649
- headings: [{key: 'content', itemType: 'url', text: 'Heading'}],
649
+ headings: [{key: 'content', valueType: 'url', label: 'Heading'}],
650
650
  items: [{content: urlText}],
651
651
  };
652
652
 
@@ -673,7 +673,7 @@ describe('DetailsRenderer', () => {
673
673
 
674
674
  const details = {
675
675
  type: 'table',
676
- headings: [{key: 'content', itemType: 'url', text: 'Heading'}],
676
+ headings: [{key: 'content', valueType: 'url', label: 'Heading'}],
677
677
  items: [{content: url}],
678
678
  overallSavingsMs: 100,
679
679
  };
@@ -693,7 +693,7 @@ describe('DetailsRenderer', () => {
693
693
 
694
694
  const details = {
695
695
  type: 'table',
696
- headings: [{key: 'content', itemType: 'url', text: 'Heading'}],
696
+ headings: [{key: 'content', valueType: 'url', label: 'Heading'}],
697
697
  items: [{content: urlText}],
698
698
  };
699
699
 
@@ -712,11 +712,11 @@ describe('DetailsRenderer', () => {
712
712
  console.error = consoleError;
713
713
  });
714
714
 
715
- it('renders an unknown heading itemType', () => {
715
+ it('renders an unknown heading valueType', () => {
716
716
  // Disallowed by type system, but test that we get an error message out just in case.
717
717
  const details = {
718
718
  type: 'table',
719
- headings: [{key: 'content', itemType: 'notRealValueType', text: 'Heading'}],
719
+ headings: [{key: 'content', valueType: 'notRealValueType', label: 'Heading'}],
720
720
  items: [{content: 'some string'}],
721
721
  };
722
722
 
@@ -737,7 +737,7 @@ describe('DetailsRenderer', () => {
737
737
 
738
738
  const details = {
739
739
  type: 'table',
740
- headings: [{key: 'content', itemType: 'url', text: 'Heading'}],
740
+ headings: [{key: 'content', valueType: 'url', label: 'Heading'}],
741
741
  items: [{content: item}],
742
742
  };
743
743
 
@@ -753,8 +753,8 @@ describe('DetailsRenderer', () => {
753
753
  it('uses the item\'s type over the heading type', () => {
754
754
  const details = {
755
755
  type: 'table',
756
- // itemType is overriden by code object
757
- headings: [{key: 'content', itemType: 'url', text: 'Heading'}],
756
+ // valueType is overriden by code object
757
+ headings: [{key: 'content', valueType: 'url', label: 'Heading'}],
758
758
  items: [
759
759
  {content: {type: 'code', value: 'https://codeobject.com'}},
760
760
  {content: 'https://example.com'},
@@ -790,7 +790,7 @@ describe('DetailsRenderer', () => {
790
790
  const details = {
791
791
  type: 'table',
792
792
  headings: [
793
- {key: 'url', itemType: 'url', subItemsHeading: {key: 'source', itemType: 'code'}},
793
+ {key: 'url', valueType: 'url', subItemsHeading: {key: 'source', valueType: 'code'}},
794
794
  ],
795
795
  items: [
796
796
  {
@@ -832,7 +832,7 @@ describe('DetailsRenderer', () => {
832
832
  it('renders, uses heading properties as fallback', () => {
833
833
  const details = {
834
834
  type: 'table',
835
- headings: [{key: 'url', itemType: 'url', subItemsHeading: {key: 'source'}}],
835
+ headings: [{key: 'url', valueType: 'url', subItemsHeading: {key: 'source'}}],
836
836
  items: [
837
837
  {
838
838
  url: 'https://www.example.com',
@@ -176,6 +176,31 @@ describe('util helpers', () => {
176
176
  assert.deepStrictEqual(clonedPreparedResult.categories, preparedResult.categories);
177
177
  assert.deepStrictEqual(clonedPreparedResult.categoryGroups, preparedResult.categoryGroups);
178
178
  });
179
+
180
+ it('converts old opportunity table column headings to consolidated table headings', () => {
181
+ const clonedSampleResult = JSON.parse(JSON.stringify(sampleResult));
182
+
183
+ const auditsWithTableDetails = Object.values(clonedSampleResult.audits)
184
+ .filter(audit => audit.details?.type === 'table');
185
+ assert.notEqual(auditsWithTableDetails.length, 0);
186
+ for (const audit of auditsWithTableDetails) {
187
+ for (const heading of audit.details.headings) {
188
+ heading.itemType = heading.valueType;
189
+ heading.text = heading.label;
190
+ delete heading.valueType;
191
+ delete heading.label;
192
+
193
+ if (heading.subItemsHeading) {
194
+ heading.subItemsHeading.itemType = heading.subItemsHeading.valueType;
195
+ // @ts-expect-error
196
+ delete heading.subItemsHeading.valueType;
197
+ }
198
+ }
199
+ }
200
+
201
+ const preparedResult = Util.prepareReportResult(clonedSampleResult);
202
+ assert.deepStrictEqual(sampleResult.audits, preparedResult.audits);
203
+ });
179
204
  });
180
205
 
181
206
  it('appends stack pack descriptions to auditRefs', () => {