lighthouse 12.8.2-dev.20251005 → 12.8.2-dev.20251006

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 (126) hide show
  1. package/cli/test/smokehouse/config/exclusions.js +0 -2
  2. package/core/audits/audit.js +0 -1
  3. package/core/audits/insights/cls-culprits-insight.js +1 -1
  4. package/core/audits/insights/dom-size-insight.js +6 -6
  5. package/core/audits/redirects.js +1 -0
  6. package/core/audits/server-response-time.d.ts +0 -5
  7. package/core/audits/server-response-time.js +12 -26
  8. package/core/computed/metrics/lcp-breakdown.js +1 -0
  9. package/core/config/default-config.js +20 -63
  10. package/core/config/experimental-config.js +1 -26
  11. package/core/config/filters.js +6 -9
  12. package/core/config/lr-desktop-config.js +0 -1
  13. package/core/config/lr-mobile-config.js +0 -1
  14. package/core/gather/gatherers/trace-elements.js +1 -0
  15. package/core/lib/proto-preprocessor.js +5 -22
  16. package/dist/report/bundle.esm.js +10 -49
  17. package/dist/report/flow.js +12 -51
  18. package/dist/report/standalone.js +11 -50
  19. package/flow-report/src/i18n/i18n.d.ts +4 -6
  20. package/package.json +3 -3
  21. package/report/assets/styles.css +0 -39
  22. package/report/renderer/api.js +0 -1
  23. package/report/renderer/category-renderer.js +6 -0
  24. package/report/renderer/components.js +1 -1
  25. package/report/renderer/dom.d.ts +0 -13
  26. package/report/renderer/dom.js +0 -38
  27. package/report/renderer/performance-category-renderer.d.ts +0 -26
  28. package/report/renderer/performance-category-renderer.js +10 -142
  29. package/report/renderer/report-ui-features.d.ts +0 -1
  30. package/report/renderer/report-ui-features.js +3 -13
  31. package/report/renderer/report-utils.d.ts +2 -3
  32. package/report/renderer/report-utils.js +4 -6
  33. package/report/types/report-renderer.d.ts +0 -6
  34. package/shared/localization/locales/ar-XB.json +0 -330
  35. package/shared/localization/locales/ar.json +0 -330
  36. package/shared/localization/locales/bg.json +0 -330
  37. package/shared/localization/locales/ca.json +0 -330
  38. package/shared/localization/locales/cs.json +0 -330
  39. package/shared/localization/locales/da.json +0 -330
  40. package/shared/localization/locales/de.json +0 -330
  41. package/shared/localization/locales/el.json +0 -330
  42. package/shared/localization/locales/en-GB.json +0 -330
  43. package/shared/localization/locales/en-US.json +26 -275
  44. package/shared/localization/locales/en-XA.json +0 -330
  45. package/shared/localization/locales/en-XL.json +26 -275
  46. package/shared/localization/locales/es-419.json +0 -330
  47. package/shared/localization/locales/es.json +0 -330
  48. package/shared/localization/locales/fi.json +0 -330
  49. package/shared/localization/locales/fil.json +0 -330
  50. package/shared/localization/locales/fr.json +0 -330
  51. package/shared/localization/locales/he.json +0 -330
  52. package/shared/localization/locales/hi.json +0 -330
  53. package/shared/localization/locales/hr.json +0 -330
  54. package/shared/localization/locales/hu.json +0 -330
  55. package/shared/localization/locales/id.json +0 -330
  56. package/shared/localization/locales/it.json +0 -330
  57. package/shared/localization/locales/ja.json +0 -330
  58. package/shared/localization/locales/ko.json +0 -330
  59. package/shared/localization/locales/lt.json +0 -330
  60. package/shared/localization/locales/lv.json +0 -330
  61. package/shared/localization/locales/nl.json +0 -330
  62. package/shared/localization/locales/no.json +0 -330
  63. package/shared/localization/locales/pl.json +0 -330
  64. package/shared/localization/locales/pt-PT.json +0 -330
  65. package/shared/localization/locales/pt.json +0 -330
  66. package/shared/localization/locales/ro.json +0 -330
  67. package/shared/localization/locales/ru.json +0 -330
  68. package/shared/localization/locales/sk.json +0 -330
  69. package/shared/localization/locales/sl.json +0 -330
  70. package/shared/localization/locales/sr-Latn.json +0 -330
  71. package/shared/localization/locales/sr.json +0 -330
  72. package/shared/localization/locales/sv.json +0 -330
  73. package/shared/localization/locales/ta.json +0 -330
  74. package/shared/localization/locales/te.json +0 -330
  75. package/shared/localization/locales/th.json +0 -330
  76. package/shared/localization/locales/tr.json +0 -330
  77. package/shared/localization/locales/uk.json +0 -330
  78. package/shared/localization/locales/vi.json +0 -330
  79. package/shared/localization/locales/zh-HK.json +0 -330
  80. package/shared/localization/locales/zh-TW.json +0 -330
  81. package/shared/localization/locales/zh.json +0 -330
  82. package/types/artifacts.d.ts +1 -0
  83. package/types/audit.d.ts +1 -1
  84. package/types/lhr/settings.d.ts +1 -1
  85. package/core/audits/byte-efficiency/duplicated-javascript.d.ts +0 -45
  86. package/core/audits/byte-efficiency/duplicated-javascript.js +0 -223
  87. package/core/audits/byte-efficiency/efficient-animated-content.d.ts +0 -22
  88. package/core/audits/byte-efficiency/efficient-animated-content.js +0 -93
  89. package/core/audits/byte-efficiency/legacy-javascript.d.ts +0 -28
  90. package/core/audits/byte-efficiency/legacy-javascript.js +0 -144
  91. package/core/audits/byte-efficiency/modern-image-formats.d.ts +0 -38
  92. package/core/audits/byte-efficiency/modern-image-formats.js +0 -187
  93. package/core/audits/byte-efficiency/render-blocking-resources.d.ts +0 -53
  94. package/core/audits/byte-efficiency/render-blocking-resources.js +0 -312
  95. package/core/audits/byte-efficiency/uses-long-cache-ttl.d.ts +0 -59
  96. package/core/audits/byte-efficiency/uses-long-cache-ttl.js +0 -293
  97. package/core/audits/byte-efficiency/uses-optimized-images.d.ts +0 -33
  98. package/core/audits/byte-efficiency/uses-optimized-images.js +0 -146
  99. package/core/audits/byte-efficiency/uses-responsive-images-snapshot.d.ts +0 -16
  100. package/core/audits/byte-efficiency/uses-responsive-images-snapshot.js +0 -106
  101. package/core/audits/byte-efficiency/uses-responsive-images.d.ts +0 -44
  102. package/core/audits/byte-efficiency/uses-responsive-images.js +0 -202
  103. package/core/audits/byte-efficiency/uses-text-compression.d.ts +0 -14
  104. package/core/audits/byte-efficiency/uses-text-compression.js +0 -108
  105. package/core/audits/critical-request-chains.d.ts +0 -44
  106. package/core/audits/critical-request-chains.js +0 -221
  107. package/core/audits/dobetterweb/dom-size.d.ts +0 -32
  108. package/core/audits/dobetterweb/dom-size.js +0 -182
  109. package/core/audits/dobetterweb/uses-http2.d.ts +0 -72
  110. package/core/audits/dobetterweb/uses-http2.js +0 -276
  111. package/core/audits/font-display.d.ts +0 -32
  112. package/core/audits/font-display.js +0 -195
  113. package/core/audits/largest-contentful-paint-element.d.ts +0 -34
  114. package/core/audits/largest-contentful-paint-element.js +0 -181
  115. package/core/audits/lcp-lazy-loaded.d.ts +0 -22
  116. package/core/audits/lcp-lazy-loaded.js +0 -115
  117. package/core/audits/prioritize-lcp-image.d.ts +0 -74
  118. package/core/audits/prioritize-lcp-image.js +0 -297
  119. package/core/audits/third-party-summary.d.ts +0 -78
  120. package/core/audits/third-party-summary.js +0 -236
  121. package/core/audits/uses-rel-preconnect.d.ts +0 -37
  122. package/core/audits/uses-rel-preconnect.js +0 -286
  123. package/core/audits/viewport.d.ts +0 -17
  124. package/core/audits/viewport.js +0 -87
  125. package/core/audits/work-during-interaction.d.ts +0 -81
  126. package/core/audits/work-during-interaction.js +0 -287
@@ -12,16 +12,7 @@ import {Globals} from './report-globals.js';
12
12
  import {Util} from '../../shared/util.js';
13
13
  import {createGauge, updateGauge} from './explodey-gauge.js';
14
14
 
15
- const LOCAL_STORAGE_INSIGHTS_KEY = '__lh__insights_audits_toggle_state_2';
16
-
17
- /**
18
- * @typedef {('DEFAULT'|'AUDITS'|'INSIGHTS')} InsightsExperimentState
19
- */
20
-
21
15
  export class PerformanceCategoryRenderer extends CategoryRenderer {
22
- /** @type InsightsExperimentState*/
23
- _memoryInsightToggleState = 'DEFAULT';
24
-
25
16
  /**
26
17
  * @param {LH.ReportResult.AuditRef} audit
27
18
  * @return {!Element}
@@ -143,84 +134,6 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
143
134
  return {overallImpact, overallLinearImpact};
144
135
  }
145
136
 
146
- /**
147
- * @param {InsightsExperimentState} newState
148
- **/
149
- _persistInsightToggleToStorage(newState) {
150
- try {
151
- window.localStorage.setItem(LOCAL_STORAGE_INSIGHTS_KEY, newState);
152
- } finally {
153
- this._memoryInsightToggleState = newState;
154
- }
155
- }
156
-
157
- /**
158
- * @returns {InsightsExperimentState}
159
- **/
160
- _getInsightToggleState() {
161
- let state = this._getRawInsightToggleState();
162
- if (state === 'DEFAULT') state = 'INSIGHTS';
163
- return state;
164
- }
165
-
166
- /**
167
- * @returns {InsightsExperimentState}
168
- **/
169
- _getRawInsightToggleState() {
170
- try {
171
- const fromStorage = window.localStorage.getItem(LOCAL_STORAGE_INSIGHTS_KEY);
172
- if (fromStorage === 'AUDITS' || fromStorage === 'INSIGHTS') {
173
- return fromStorage;
174
- }
175
- } catch {
176
- return this._memoryInsightToggleState;
177
- }
178
- return 'DEFAULT';
179
- }
180
-
181
- /**
182
- * @param {HTMLButtonElement} button
183
- **/
184
- _setInsightToggleButtonText(button) {
185
- const state = this._getInsightToggleState();
186
- button.innerText =
187
- state === 'AUDITS' ? Globals.strings.tryInsights : Globals.strings.goBackToAudits;
188
- }
189
-
190
- /**
191
- * @param {HTMLElement} element
192
- */
193
- _renderInsightsToggle(element) {
194
- // Insights / Audits toggle.
195
- const container = this.dom.createChildOf(element, 'div', 'lh-perf-insights-toggle');
196
- const textSpan = this.dom.createChildOf(container, 'span', 'lh-perf-toggle-text');
197
- const icon = this.dom.createElement('span', 'lh-perf-insights-icon insights-icon-url');
198
- textSpan.appendChild(icon);
199
- textSpan.appendChild(this.dom.convertMarkdownLinkSnippets(Globals.strings.insightsNotice));
200
-
201
- const buttonClasses = 'lh-button lh-button-insight-toggle';
202
- const button = this.dom.createChildOf(container, 'button', buttonClasses);
203
- this._setInsightToggleButtonText(button);
204
-
205
- button.addEventListener('click', event => {
206
- event.preventDefault();
207
- const swappableSection = this.dom.maybeFind('.lh-perf-audits--swappable');
208
- if (swappableSection) {
209
- this.dom.swapSectionIfPossible(swappableSection);
210
- }
211
- const currentState = this._getInsightToggleState();
212
- const newState = currentState === 'AUDITS' ? 'INSIGHTS' : 'AUDITS';
213
- this.dom.fireEventOn('lh-analytics', this.dom.document(), {
214
- name: 'toggle_insights',
215
- data: {newState},
216
- });
217
- this._persistInsightToggleToStorage(newState);
218
- this._setInsightToggleButtonText(button);
219
- });
220
-
221
- container.appendChild(button);
222
- }
223
-
224
137
  /**
225
138
  * @param {LH.ReportResult.Category} category
226
139
  * @param {Object<string, LH.Result.ReportGroup>} groups
@@ -288,44 +201,12 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
288
201
  filmstripEl && timelineEl.append(filmstripEl);
289
202
  }
290
203
 
291
- this._renderInsightsToggle(element);
292
-
293
- const legacyAuditsSection =
294
- this.renderFilterableSection(category, groups, ['diagnostics'], metricAudits);
295
- legacyAuditsSection?.classList.add('lh-perf-audits--swappable', 'lh-perf-audits--legacy');
296
-
297
- const experimentalInsightsSection =
204
+ const auditsSection =
298
205
  this.renderFilterableSection(category, groups, ['insights', 'diagnostics'], metricAudits);
299
- experimentalInsightsSection?.classList.add(
300
- 'lh-perf-audits--swappable', 'lh-perf-audits--experimental');
301
-
302
- if (legacyAuditsSection) {
303
- element.append(legacyAuditsSection);
304
-
305
- // Many tests expect just one of these sections to be in the DOM at a given time.
306
- // To prevent the hidden section from tripping up these tests, we will just remove the hidden
307
- // section from the DOM and store it in memory.
308
- if (experimentalInsightsSection) {
309
- this.dom.registerSwappableSections(legacyAuditsSection, experimentalInsightsSection);
310
- }
206
+ if (auditsSection) {
207
+ auditsSection.classList.add('lh-perf-audits');
208
+ element.append(auditsSection);
311
209
  }
312
- // Deal with the user loading the report and having toggled to Insights
313
- // which is now stored in local storage. Put in a rAF otherwise this code
314
- // runs before the DOM is created.
315
- if (this._getInsightToggleState() === 'INSIGHTS') {
316
- requestAnimationFrame(() => {
317
- const swappableSection = this.dom.maybeFind('.lh-perf-audits--swappable');
318
- if (swappableSection) {
319
- this.dom.swapSectionIfPossible(swappableSection);
320
- }
321
- });
322
- }
323
-
324
- // Log the initial state.
325
- this.dom.fireEventOn('lh-analytics', this.dom.document(), {
326
- name: 'initial_insights_state',
327
- data: {state: this._getRawInsightToggleState()},
328
- });
329
210
 
330
211
  const isNavigationMode = !options || options?.gatherMode === 'navigation';
331
212
  if (isNavigationMode && category.score !== null) {
@@ -349,31 +230,18 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
349
230
 
350
231
  const element = this.dom.createElement('div');
351
232
 
352
- /** @type {Set<string>} */
353
- const replacedAuditIds = new Set();
354
-
355
233
  /**
356
- * This exists to temporarily allow showing insights - which are in the hidden
357
- * group by default - when using the insights toggle.
358
- * See https://github.com/GoogleChrome/lighthouse/pull/16418 for motivation.
359
- *
360
234
  * @param {LH.ReportResult.AuditRef} auditRef
361
235
  */
362
236
  const getGroup = (auditRef) => {
363
- return auditRef.id.endsWith('-insight') ? 'insights' : auditRef.group ?? '';
237
+ return auditRef.group ?? '';
364
238
  };
365
239
 
366
240
  const allGroupAudits =
367
241
  category.auditRefs.filter(audit => groupNames.includes(getGroup(audit)));
368
- for (const auditRef of allGroupAudits) {
369
- auditRef.result.replacesAudits?.forEach(replacedAuditId => {
370
- replacedAuditIds.add(replacedAuditId);
371
- });
372
- }
373
242
 
374
243
  // Diagnostics
375
244
  const allFilterableAudits = allGroupAudits
376
- .filter(audit => !replacedAuditIds.has(audit.id))
377
245
  .map(auditRef => {
378
246
  const {overallImpact, overallLinearImpact} = this.overallImpact(auditRef, metricAudits);
379
247
  const guidanceLevel = auditRef.result.guidanceLevel || 1;
@@ -382,7 +250,7 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
382
250
  return {auditRef, auditEl, overallImpact, overallLinearImpact, guidanceLevel};
383
251
  });
384
252
 
385
- const filterableAudits = allFilterableAudits
253
+ const notPassedAudits = allFilterableAudits
386
254
  .filter(audit => !ReportUtils.showAsPassed(audit.auditRef.result));
387
255
 
388
256
  const passedAudits = allFilterableAudits
@@ -409,7 +277,7 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
409
277
  }
410
278
  }
411
279
 
412
- filterableAudits.sort((a, b) => {
280
+ notPassedAudits.sort((a, b) => {
413
281
  // Performance diagnostics should only have score display modes of "informative" and "metricSavings"
414
282
  // If the score display mode is "metricSavings", the `score` will be a coarse approximation of the overall impact.
415
283
  // Therefore, it makes sense to sort audits by score first to ensure visual clarity with the score icons.
@@ -441,7 +309,7 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
441
309
  return b.guidanceLevel - a.guidanceLevel;
442
310
  });
443
311
 
444
- for (const audit of filterableAudits) {
312
+ for (const audit of notPassedAudits) {
445
313
  if (!audit.auditRef.group) continue;
446
314
 
447
315
  const groupEls = groupElsMap[getGroup(audit.auditRef)];
@@ -454,7 +322,7 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
454
322
 
455
323
  /** @type {Set<string>} */
456
324
  const filterableMetricAcronyms = new Set();
457
- for (const audit of filterableAudits) {
325
+ for (const audit of notPassedAudits) {
458
326
  const metricSavings = audit.auditRef.result.metricSavings || {};
459
327
  for (const [key, value] of Object.entries(metricSavings)) {
460
328
  if (typeof value === 'number') filterableMetricAcronyms.add(key);
@@ -472,7 +340,7 @@ export class PerformanceCategoryRenderer extends CategoryRenderer {
472
340
  refreshFilteredAudits('All');
473
341
 
474
342
  for (const groupName of groupNames) {
475
- if (filterableAudits.some(audit => getGroup(audit.auditRef) === groupName)) {
343
+ if (notPassedAudits.some(audit => getGroup(audit.auditRef) === groupName)) {
476
344
  const groupEls = groupElsMap[groupName];
477
345
  if (!groupEls) continue;
478
346
  element.append(groupEls[0]);
@@ -10,7 +10,6 @@ export class ReportUIFeatures {
10
10
  _dom: DOM;
11
11
  _opts: import("../types/report-renderer.js").default.Options;
12
12
  _topbar: TopbarFeatures | null;
13
- _tablesHandledFor3p: WeakSet<object>;
14
13
  /**
15
14
  * Handle media query change events.
16
15
  * @param {MediaQueryList|MediaQueryListEvent} mql
@@ -40,7 +40,6 @@ export class ReportUIFeatures {
40
40
  this._opts = opts;
41
41
 
42
42
  this._topbar = opts.omitTopbar ? null : new TopbarFeatures(this, dom);
43
- this._tablesHandledFor3p = new WeakSet();
44
43
  this.onMediaQueryChange = this.onMediaQueryChange.bind(this);
45
44
  }
46
45
 
@@ -61,9 +60,6 @@ export class ReportUIFeatures {
61
60
  this._setupThirdPartyFilter();
62
61
  this._setupElementScreenshotOverlay(this._dom.rootEl);
63
62
 
64
- // TODO(v13): remove.
65
- this._dom._onSwap = () => this._setupThirdPartyFilter();
66
-
67
63
  // Do not query the system preferences for DevTools - DevTools should only apply dark theme
68
64
  // if dark is selected in the settings panel.
69
65
  // TODO: set `disableDarkMode` in devtools and delete this special case.
@@ -215,10 +211,13 @@ export class ReportUIFeatures {
215
211
  }
216
212
 
217
213
  _setupThirdPartyFilter() {
214
+ // Note: do not remove deleted audits from the below arrays.
215
+
218
216
  // Some audits should not display the third party filter option.
219
217
  const thirdPartyFilterAuditExclusions = [
220
218
  // These audits deal explicitly with third party resources.
221
219
  'uses-rel-preconnect',
220
+ 'third-party-facades',
222
221
  // Too much work to support.
223
222
  'network-dependency-tree-insight',
224
223
  ];
@@ -241,15 +240,6 @@ export class ReportUIFeatures {
241
240
  });
242
241
 
243
242
  tablesWithUrls.forEach((tableEl) => {
244
- // The "toggle insights/audits" button means that not all tables are on the DOM on init.
245
- // So we call this whole setup function multiple times for now, once every time we toggle.
246
- // TODO(v13): remove.
247
- if (this._tablesHandledFor3p.has(tableEl)) {
248
- return;
249
- }
250
-
251
- this._tablesHandledFor3p.add(tableEl);
252
-
253
243
  const rowEls = getTableRows(tableEl);
254
244
  const nonSubItemRows = rowEls.filter(rowEl => !rowEl.classList.contains('lh-sub-item-row'));
255
245
  const thirdPartyRowEls = this._getThirdPartyRows(nonSubItemRows,
@@ -136,8 +136,7 @@ export namespace UIStrings {
136
136
  let firstPartyChipLabel: string;
137
137
  let openInANewTabTooltip: string;
138
138
  let unattributable: string;
139
- let insightsNotice: string;
140
- let tryInsights: string;
141
- let goBackToAudits: string;
139
+ let unscoredLabel: string;
140
+ let unscoredTitle: string;
142
141
  }
143
142
  //# sourceMappingURL=report-utils.d.ts.map
@@ -483,12 +483,10 @@ const UIStrings = {
483
483
  /** Generic category name for all resources that could not be attributed to a 1st or 3rd party entity. */
484
484
  unattributable: 'Unattributable',
485
485
 
486
- /** Notice about upcoming planned changes to Lighthouse, to replace most performance audits with a new set of "insight" audits. */
487
- insightsNotice: 'Later this year, insights will replace performance audits. [Learn more and provide feedback here](https://github.com/GoogleChrome/lighthouse/discussions/16462).',
488
- /** Text for a button to try out "Performance insight audits", a new set of performance advice that will replace performance audits. */
489
- tryInsights: 'Try insights',
490
- /** Text for a button for going back to normal "Performance audits", instead of using the new set of performance insight audits that will replace performance audits. */
491
- goBackToAudits: 'Go back to audits',
486
+ /** Descriptive explanation used when an audit is not part of the calculated score. */
487
+ unscoredLabel: 'Unscored',
488
+ /** Descriptive explanation used when an audit is not part of the calculated score. */
489
+ unscoredTitle: 'This audit does not contribute to the overall category score.',
492
490
  };
493
491
 
494
492
  export {
@@ -5,7 +5,6 @@
5
5
  */
6
6
 
7
7
  import { Result as AuditResult } from "../../types/lhr/audit-result";
8
- import { ReportUIFeatures } from "../renderer/report-ui-features.js";
9
8
 
10
9
  declare module Renderer {
11
10
  function renderReport(lhr: AuditResult, options?: Options): HTMLElement;
@@ -47,11 +46,6 @@ declare module Renderer {
47
46
  * data, which can be gotten from the artifacts.
48
47
  */
49
48
  onViewTrace?: () => void;
50
- /**
51
- * Called when the performance audits/insights are swapped out.
52
- * TODO(v13): remove
53
- */
54
- _onSwapHook?: () => void;
55
49
  }
56
50
  }
57
51