lighthouse 12.4.0 → 12.5.0

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 (164) hide show
  1. package/core/audits/audit.js +3 -1
  2. package/core/audits/bootup-time.js +1 -1
  3. package/core/audits/byte-efficiency/duplicated-javascript.js +1 -1
  4. package/core/audits/byte-efficiency/efficient-animated-content.js +1 -1
  5. package/core/audits/byte-efficiency/legacy-javascript.d.ts +0 -65
  6. package/core/audits/byte-efficiency/legacy-javascript.js +11 -363
  7. package/core/audits/byte-efficiency/modern-image-formats.js +1 -1
  8. package/core/audits/byte-efficiency/offscreen-images.js +4 -3
  9. package/core/audits/byte-efficiency/render-blocking-resources.js +6 -3
  10. package/core/audits/byte-efficiency/unminified-css.js +2 -1
  11. package/core/audits/byte-efficiency/unminified-javascript.js +2 -1
  12. package/core/audits/byte-efficiency/unused-css-rules.js +1 -1
  13. package/core/audits/byte-efficiency/unused-javascript.js +2 -2
  14. package/core/audits/byte-efficiency/uses-long-cache-ttl.js +1 -1
  15. package/core/audits/byte-efficiency/uses-optimized-images.js +1 -1
  16. package/core/audits/byte-efficiency/uses-responsive-images.js +1 -1
  17. package/core/audits/byte-efficiency/uses-text-compression.js +2 -1
  18. package/core/audits/critical-request-chains.js +5 -3
  19. package/core/audits/dobetterweb/dom-size.js +1 -1
  20. package/core/audits/dobetterweb/uses-http2.js +1 -1
  21. package/core/audits/insights/cls-culprits-insight.js +1 -1
  22. package/core/audits/insights/document-latency-insight.js +1 -1
  23. package/core/audits/insights/dom-size-insight.js +1 -1
  24. package/core/audits/insights/{long-critical-network-tree-insight.d.ts → duplicated-javascript-insight.d.ts} +3 -3
  25. package/core/audits/insights/duplicated-javascript-insight.js +54 -0
  26. package/core/audits/insights/font-display-insight.js +8 -7
  27. package/core/audits/insights/forced-reflow-insight.d.ts +10 -0
  28. package/core/audits/insights/forced-reflow-insight.js +64 -12
  29. package/core/audits/insights/image-delivery-insight.js +9 -10
  30. package/core/audits/insights/insight-audit.js +9 -4
  31. package/core/audits/insights/interaction-to-next-paint-insight.js +1 -1
  32. package/core/audits/insights/lcp-discovery-insight.js +1 -1
  33. package/core/audits/insights/lcp-phases-insight.js +1 -1
  34. package/core/audits/insights/network-dependency-tree-insight.d.ts +11 -0
  35. package/core/audits/insights/{long-critical-network-tree-insight.js → network-dependency-tree-insight.js} +7 -7
  36. package/core/audits/insights/render-blocking-insight.js +1 -1
  37. package/core/audits/insights/slow-css-selector-insight.js +1 -1
  38. package/core/audits/insights/third-parties-insight.js +1 -1
  39. package/core/audits/insights/use-cache-insight.d.ts +11 -0
  40. package/core/audits/insights/use-cache-insight.js +61 -0
  41. package/core/audits/insights/viewport-insight.js +1 -1
  42. package/core/audits/largest-contentful-paint-element.js +7 -3
  43. package/core/audits/layout-shifts.js +5 -2
  44. package/core/audits/lcp-lazy-loaded.js +1 -1
  45. package/core/audits/long-tasks.js +6 -4
  46. package/core/audits/mainthread-work-breakdown.js +1 -1
  47. package/core/audits/metrics/first-contentful-paint.js +4 -2
  48. package/core/audits/metrics/interactive.js +6 -3
  49. package/core/audits/metrics/largest-contentful-paint.js +7 -3
  50. package/core/audits/metrics/max-potential-fid.js +6 -3
  51. package/core/audits/metrics/speed-index.js +6 -3
  52. package/core/audits/metrics/total-blocking-time.js +6 -3
  53. package/core/audits/metrics.js +4 -3
  54. package/core/audits/predictive-perf.js +4 -3
  55. package/core/audits/prioritize-lcp-image.js +5 -3
  56. package/core/audits/redirects.js +4 -2
  57. package/core/audits/script-treemap-data.js +8 -4
  58. package/core/audits/third-party-facades.js +1 -1
  59. package/core/audits/third-party-summary.js +1 -1
  60. package/core/audits/uses-rel-preconnect.js +7 -5
  61. package/core/audits/uses-rel-preload.js +5 -3
  62. package/core/computed/computed-artifact.d.ts +5 -1
  63. package/core/computed/computed-artifact.js +23 -2
  64. package/core/computed/critical-request-chains.d.ts +5 -1
  65. package/core/computed/critical-request-chains.js +4 -4
  66. package/core/computed/js-bundles.d.ts +1 -1
  67. package/core/computed/metrics/first-contentful-paint-all-frames.js +1 -1
  68. package/core/computed/metrics/first-contentful-paint.js +1 -1
  69. package/core/computed/metrics/interactive.js +1 -1
  70. package/core/computed/metrics/lantern-first-contentful-paint.js +1 -1
  71. package/core/computed/metrics/lantern-interactive.js +1 -1
  72. package/core/computed/metrics/lantern-largest-contentful-paint.js +1 -1
  73. package/core/computed/metrics/lantern-max-potential-fid.js +1 -1
  74. package/core/computed/metrics/lantern-metric.js +1 -1
  75. package/core/computed/metrics/lantern-speed-index.js +1 -1
  76. package/core/computed/metrics/lantern-total-blocking-time.js +1 -1
  77. package/core/computed/metrics/largest-contentful-paint-all-frames.js +1 -1
  78. package/core/computed/metrics/largest-contentful-paint.js +1 -1
  79. package/core/computed/metrics/lcp-breakdown.js +1 -1
  80. package/core/computed/metrics/max-potential-fid.js +1 -1
  81. package/core/computed/metrics/metric.js +2 -0
  82. package/core/computed/metrics/speed-index.js +1 -1
  83. package/core/computed/metrics/time-to-first-byte.js +1 -1
  84. package/core/computed/metrics/timing-summary.d.ts +5 -2
  85. package/core/computed/metrics/timing-summary.js +8 -4
  86. package/core/computed/metrics/total-blocking-time.js +1 -1
  87. package/core/computed/module-duplication.d.ts +1 -1
  88. package/core/computed/navigation-insights.d.ts +11 -3
  89. package/core/computed/navigation-insights.js +7 -4
  90. package/core/computed/page-dependency-graph.d.ts +7 -3
  91. package/core/computed/page-dependency-graph.js +6 -5
  92. package/core/computed/tbt-impact-tasks.js +1 -1
  93. package/core/computed/trace-engine-result.d.ts +36 -2
  94. package/core/computed/trace-engine-result.js +119 -25
  95. package/core/computed/unused-javascript-summary.d.ts +2 -2
  96. package/core/computed/unused-javascript-summary.js +1 -1
  97. package/core/config/default-config.js +19 -15
  98. package/core/config/experimental-config.js +19 -0
  99. package/core/gather/gatherers/source-maps.d.ts +1 -0
  100. package/core/gather/gatherers/source-maps.js +3 -0
  101. package/core/gather/gatherers/trace-elements.d.ts +4 -4
  102. package/core/gather/gatherers/trace-elements.js +8 -4
  103. package/core/gather/gatherers/trace.js +5 -0
  104. package/core/lib/bf-cache-strings.d.ts +0 -122
  105. package/core/lib/bf-cache-strings.js +1 -2
  106. package/core/lib/deprecation-description.js +2 -1
  107. package/core/lib/legacy-javascript/legacy-javascript.d.ts +29 -0
  108. package/core/lib/legacy-javascript/legacy-javascript.js +351 -0
  109. package/core/lib/legacy-javascript/polyfill-graph-data.json +93 -0
  110. package/core/lib/legacy-javascript/polyfill-module-data.json +623 -0
  111. package/core/lib/trace-engine.d.ts +6 -1
  112. package/core/lib/trace-engine.js +1 -2
  113. package/package.json +10 -8
  114. package/shared/localization/locales/ar-XB.json +783 -513
  115. package/shared/localization/locales/ar.json +783 -513
  116. package/shared/localization/locales/bg.json +933 -663
  117. package/shared/localization/locales/ca.json +925 -655
  118. package/shared/localization/locales/cs.json +926 -656
  119. package/shared/localization/locales/da.json +926 -656
  120. package/shared/localization/locales/de.json +803 -533
  121. package/shared/localization/locales/el.json +928 -658
  122. package/shared/localization/locales/en-GB.json +929 -659
  123. package/shared/localization/locales/en-US.json +593 -551
  124. package/shared/localization/locales/en-XA.json +28 -508
  125. package/shared/localization/locales/en-XL.json +593 -551
  126. package/shared/localization/locales/es-419.json +928 -658
  127. package/shared/localization/locales/es.json +787 -517
  128. package/shared/localization/locales/fi.json +925 -655
  129. package/shared/localization/locales/fil.json +929 -659
  130. package/shared/localization/locales/fr.json +927 -657
  131. package/shared/localization/locales/he.json +795 -528
  132. package/shared/localization/locales/hi.json +798 -528
  133. package/shared/localization/locales/hr.json +929 -659
  134. package/shared/localization/locales/hu.json +926 -656
  135. package/shared/localization/locales/id.json +926 -656
  136. package/shared/localization/locales/it.json +930 -660
  137. package/shared/localization/locales/ja.json +927 -657
  138. package/shared/localization/locales/ko.json +936 -666
  139. package/shared/localization/locales/lt.json +933 -663
  140. package/shared/localization/locales/lv.json +809 -539
  141. package/shared/localization/locales/nl.json +925 -655
  142. package/shared/localization/locales/no.json +928 -658
  143. package/shared/localization/locales/pl.json +927 -657
  144. package/shared/localization/locales/pt-PT.json +841 -571
  145. package/shared/localization/locales/pt.json +841 -571
  146. package/shared/localization/locales/ro.json +925 -655
  147. package/shared/localization/locales/ru.json +935 -668
  148. package/shared/localization/locales/sk.json +925 -655
  149. package/shared/localization/locales/sl.json +927 -657
  150. package/shared/localization/locales/sr-Latn.json +925 -655
  151. package/shared/localization/locales/sr.json +925 -655
  152. package/shared/localization/locales/sv.json +936 -666
  153. package/shared/localization/locales/ta.json +935 -668
  154. package/shared/localization/locales/te.json +785 -515
  155. package/shared/localization/locales/th.json +813 -543
  156. package/shared/localization/locales/tr.json +927 -657
  157. package/shared/localization/locales/uk.json +795 -525
  158. package/shared/localization/locales/vi.json +929 -659
  159. package/shared/localization/locales/zh-HK.json +926 -656
  160. package/shared/localization/locales/zh-TW.json +784 -514
  161. package/shared/localization/locales/zh.json +926 -656
  162. package/tsconfig.json +2 -1
  163. package/types/artifacts.d.ts +2 -1
  164. package/core/audits/byte-efficiency/polyfill-graph-data.json +0 -53
@@ -4,11 +4,14 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
+ import log from 'lighthouse-logger';
8
+
7
9
  import * as i18n from '../lib/i18n/i18n.js';
8
10
  import * as TraceEngine from '../lib/trace-engine.js';
9
11
  import {makeComputedArtifact} from './computed-artifact.js';
10
12
  import {CumulativeLayoutShift} from './metrics/cumulative-layout-shift.js';
11
13
  import {ProcessedTrace} from './processed-trace.js';
14
+ import SDK from '../lib/cdt/SDK.js';
12
15
  import * as LH from '../../types/lh.js';
13
16
 
14
17
  /**
@@ -17,15 +20,46 @@ import * as LH from '../../types/lh.js';
17
20
  class TraceEngineResult {
18
21
  /**
19
22
  * @param {LH.TraceEvent[]} traceEvents
23
+ * @param {LH.Audit.Context['settings']} settings
24
+ * @param {LH.Artifacts['SourceMaps']} SourceMaps
20
25
  * @return {Promise<LH.Artifacts.TraceEngineResult>}
21
26
  */
22
- static async runTraceEngine(traceEvents) {
27
+ static async runTraceEngine(traceEvents, settings, SourceMaps) {
23
28
  const processor = new TraceEngine.TraceProcessor(TraceEngine.TraceHandlers);
24
29
 
30
+ const lanternSettings = {};
31
+ if (settings.throttlingMethod) lanternSettings.throttlingMethod = settings.throttlingMethod;
32
+ if (settings.throttling) lanternSettings.throttling = settings.throttling;
33
+ if (settings.precomputedLanternData) {
34
+ lanternSettings.precomputedLanternData = settings.precomputedLanternData;
35
+ }
36
+
25
37
  // eslint-disable-next-line max-len
26
38
  await processor.parse(/** @type {import('@paulirish/trace_engine').Types.Events.Event[]} */ (
27
39
  traceEvents
28
- ), {});
40
+ ), {
41
+ logger: {
42
+ start(id) {
43
+ const logId = `lh:computed:TraceEngineResult:${id}`;
44
+ log.time({msg: `Trace Engine ${id}`, id: logId});
45
+ },
46
+ end(id) {
47
+ const logId = `lh:computed:TraceEngineResult:${id}`;
48
+ log.timeEnd({msg: `Trace Engine ${id}`, id: logId});
49
+ },
50
+ },
51
+ lanternSettings,
52
+ async resolveSourceMap(params) {
53
+ const sourceMap = SourceMaps.find(sm => sm.scriptId === params.scriptId);
54
+ if (!sourceMap) {
55
+ return null;
56
+ }
57
+
58
+ const compiledUrl = sourceMap.scriptUrl || 'compiled.js';
59
+ const mapUrl = sourceMap.sourceMapUrl || 'compiled.js.map';
60
+ return new SDK.SourceMap(compiledUrl, mapUrl, sourceMap.map);
61
+ },
62
+ });
29
63
  if (!processor.parsedTrace) throw new Error('No data');
30
64
  if (!processor.insights) throw new Error('No insights');
31
65
  this.localizeInsights(processor.insights);
@@ -33,9 +67,57 @@ class TraceEngineResult {
33
67
  }
34
68
 
35
69
  /**
36
- * @param {import('@paulirish/trace_engine/models/trace/insights/types.js').TraceInsightSets} insightSets
70
+ * Adapts the given DevTools function that returns a localized string to one
71
+ * that returns a LH.IcuMessage.
72
+ *
73
+ * @template {any[]} Args
74
+ * @template {import('../lib/trace-engine.js').DevToolsIcuMessage} Ret
75
+ * @param {ReturnType<i18n.createIcuMessageFn>} str_
76
+ * @param {(...args: Args) => Ret} fn
77
+ * @return {(...args: Args) => LH.IcuMessage}
37
78
  */
38
- static localizeInsights(insightSets) {
79
+ static localizeFunction(str_, fn) {
80
+ return (...args) => this.localize(str_, fn(...args));
81
+ }
82
+
83
+ /**
84
+ * Converts the input parameters given to `i18nString` usages in DevTools to a
85
+ * LH.IcuMessage.
86
+ *
87
+ * @param {ReturnType<i18n.createIcuMessageFn>} str_
88
+ * @param {import('../lib/trace-engine.js').DevToolsIcuMessage} traceEngineI18nObject
89
+ * @return {LH.IcuMessage}
90
+ */
91
+ static localize(str_, traceEngineI18nObject) {
92
+ /** @type {Record<string, string|number>|undefined} */
93
+ let values;
94
+ if (traceEngineI18nObject.values) {
95
+ values = {};
96
+ for (const [key, value] of Object.entries(traceEngineI18nObject.values)) {
97
+ if (value && typeof value === 'object' && '__i18nBytes' in value) {
98
+ values[key] = value.__i18nBytes;
99
+ // TODO: use an actual byte formatter. Right now, this shows the exact number of bytes.
100
+ } else if (value && typeof value === 'object' && 'i18nId' in value) {
101
+ // TODO: add support for str_ values to be IcuMessage. For now, we translate it here.
102
+ // This means that locale swapping won't work for this portion of the IcuMessage.
103
+ // @ts-expect-error
104
+ values[key] = str_(value.i18nId, value.values).formattedDefault;
105
+ } else {
106
+ values[key] = value;
107
+ }
108
+ }
109
+ }
110
+
111
+ return str_(traceEngineI18nObject.i18nId, values);
112
+ }
113
+
114
+ /**
115
+ * Recursively finds all DevToolsIcuMessage objects and replaces them with LH.IcuMessage.
116
+ *
117
+ * @param {ReturnType<i18n.createIcuMessageFn>} str_
118
+ * @param {object} object
119
+ */
120
+ static localizeObject(str_, object) {
39
121
  /**
40
122
  * Execute `cb(traceEngineI18nObject)` on every i18n object, recursively. The cb return
41
123
  * value replaces traceEngineI18nObject.
@@ -79,6 +161,33 @@ class TraceEngineResult {
79
161
  }
80
162
  }
81
163
 
164
+ // Pass `{i18nId: string, values?: {}}` through Lighthouse's i18n pipeline.
165
+ // This is equivalent to if we directly did `str_(UIStrings.whatever, ...)`
166
+ recursiveReplaceLocalizableStrings(object, (traceEngineI18nObject) => {
167
+ let values = traceEngineI18nObject.values;
168
+ if (values) {
169
+ values = structuredClone(values);
170
+ for (const [key, value] of Object.entries(values)) {
171
+ if (value && typeof value === 'object' && '__i18nBytes' in value) {
172
+ // @ts-expect-error
173
+ values[key] = value.__i18nBytes;
174
+ // TODO: use an actual byte formatter. Right now, this shows the exact number of bytes.
175
+ } else if (value && typeof value === 'object' && 'i18nId' in value) {
176
+ // TODO: add support for str_ values to be IcuMessage.
177
+ // @ts-expect-error
178
+ values[key] = str_(value.i18nId, value.values).formattedDefault;
179
+ }
180
+ }
181
+ }
182
+
183
+ return str_(traceEngineI18nObject.i18nId, values);
184
+ }, new Set());
185
+ }
186
+
187
+ /**
188
+ * @param {import('@paulirish/trace_engine/models/trace/insights/types.js').TraceInsightSets} insightSets
189
+ */
190
+ static localizeInsights(insightSets) {
82
191
  for (const insightSet of insightSets.values()) {
83
192
  for (const [name, model] of Object.entries(insightSet.model)) {
84
193
  if (model instanceof Error) {
@@ -96,30 +205,13 @@ class TraceEngineResult {
96
205
 
97
206
  const key = `node_modules/@paulirish/trace_engine/models/trace/insights/${name}.js`;
98
207
  const str_ = i18n.createIcuMessageFn(key, traceEngineUIStrings);
99
-
100
- // Pass `{i18nId: string, values?: {}}` through Lighthouse's i18n pipeline.
101
- // This is equivalent to if we directly did `str_(UIStrings.whatever, ...)`
102
- recursiveReplaceLocalizableStrings(model, (traceEngineI18nObject) => {
103
- let values = traceEngineI18nObject.values;
104
- if (values) {
105
- values = structuredClone(values);
106
- for (const [key, value] of Object.entries(values)) {
107
- if (value && typeof value === 'object' && '__i18nBytes' in value) {
108
- // @ts-expect-error
109
- values[key] = value.__i18nBytes;
110
- // TODO: use an actual byte formatter. Right now, this shows the exact number of bytes.
111
- }
112
- }
113
- }
114
-
115
- return str_(traceEngineI18nObject.i18nId, values);
116
- }, new Set());
208
+ this.localizeObject(str_, model);
117
209
  }
118
210
  }
119
211
  }
120
212
 
121
213
  /**
122
- * @param {{trace: LH.Trace}} data
214
+ * @param {{trace: LH.Trace, settings: LH.Audit.Context['settings'], SourceMaps: LH.Artifacts['SourceMaps']}} data
123
215
  * @param {LH.Artifacts.ComputedContext} context
124
216
  * @return {Promise<LH.Artifacts.TraceEngineResult>}
125
217
  */
@@ -149,10 +241,12 @@ class TraceEngineResult {
149
241
  }
150
242
  }
151
243
 
152
- const result = await TraceEngineResult.runTraceEngine(traceEvents);
244
+ const result =
245
+ await TraceEngineResult.runTraceEngine(traceEvents, data.settings, data.SourceMaps);
153
246
  return result;
154
247
  }
155
248
  }
156
249
 
157
- const TraceEngineResultComputed = makeComputedArtifact(TraceEngineResult, ['trace']);
250
+ const TraceEngineResultComputed =
251
+ makeComputedArtifact(TraceEngineResult, ['trace', 'settings', 'SourceMaps']);
158
252
  export {TraceEngineResultComputed as TraceEngineResult};
@@ -7,7 +7,7 @@ export type WasteData = {
7
7
  export type ComputeInput = {
8
8
  scriptId: string;
9
9
  scriptCoverage: Omit<LH.Crdp.Profiler.ScriptCoverage, "url">;
10
- bundle?: LH.Artifacts.Bundle | undefined;
10
+ bundle: LH.Artifacts.Bundle | null;
11
11
  };
12
12
  export type Summary = {
13
13
  scriptId: string;
@@ -32,7 +32,7 @@ declare const UnusedJavascriptSummaryComputed: typeof UnusedJavascriptSummary &
32
32
  * @typedef ComputeInput
33
33
  * @property {string} scriptId
34
34
  * @property {Omit<LH.Crdp.Profiler.ScriptCoverage, 'url'>} scriptCoverage
35
- * @property {LH.Artifacts.Bundle=} bundle
35
+ * @property {LH.Artifacts.Bundle|null} bundle
36
36
  */
37
37
  /**
38
38
  * @typedef Summary
@@ -16,7 +16,7 @@ import {makeComputedArtifact} from './computed-artifact.js';
16
16
  * @typedef ComputeInput
17
17
  * @property {string} scriptId
18
18
  * @property {Omit<LH.Crdp.Profiler.ScriptCoverage, 'url'>} scriptCoverage
19
- * @property {LH.Artifacts.Bundle=} bundle
19
+ * @property {LH.Artifacts.Bundle|null} bundle
20
20
  */
21
21
 
22
22
  /**
@@ -312,16 +312,18 @@ const defaultConfig = {
312
312
  'insights/cls-culprits-insight',
313
313
  'insights/document-latency-insight',
314
314
  'insights/dom-size-insight',
315
+ 'insights/duplicated-javascript-insight',
315
316
  'insights/font-display-insight',
316
317
  'insights/forced-reflow-insight',
317
318
  'insights/image-delivery-insight',
318
319
  'insights/interaction-to-next-paint-insight',
319
320
  'insights/lcp-discovery-insight',
320
321
  'insights/lcp-phases-insight',
321
- 'insights/long-critical-network-tree-insight',
322
+ 'insights/network-dependency-tree-insight',
322
323
  'insights/render-blocking-insight',
323
324
  'insights/slow-css-selector-insight',
324
325
  'insights/third-parties-insight',
326
+ 'insights/use-cache-insight',
325
327
  'insights/viewport-insight',
326
328
  ],
327
329
  groups: {
@@ -407,20 +409,22 @@ const defaultConfig = {
407
409
  {id: 'interaction-to-next-paint', weight: 0, group: 'metrics', acronym: 'INP'},
408
410
 
409
411
  // Insight audits.
410
- {id: 'cls-culprits-insight', weight: 0, group: 'insights'},
411
- {id: 'document-latency-insight', weight: 0, group: 'insights'},
412
- {id: 'dom-size-insight', weight: 0, group: 'insights'},
413
- {id: 'font-display-insight', weight: 0, group: 'insights'},
414
- {id: 'forced-reflow-insight', weight: 0, group: 'insights'},
415
- {id: 'image-delivery-insight', weight: 0, group: 'insights'},
416
- {id: 'interaction-to-next-paint-insight', weight: 0, group: 'insights'},
417
- {id: 'lcp-discovery-insight', weight: 0, group: 'insights'},
418
- {id: 'lcp-phases-insight', weight: 0, group: 'insights'},
419
- {id: 'long-critical-network-tree-insight', weight: 0, group: 'insights'},
420
- {id: 'render-blocking-insight', weight: 0, group: 'insights'},
421
- {id: 'slow-css-selector-insight', weight: 0, group: 'insights'},
422
- {id: 'third-parties-insight', weight: 0, group: 'insights'},
423
- {id: 'viewport-insight', weight: 0, group: 'insights'},
412
+ {id: 'cls-culprits-insight', weight: 0, group: 'hidden'},
413
+ {id: 'document-latency-insight', weight: 0, group: 'hidden'},
414
+ {id: 'dom-size-insight', weight: 0, group: 'hidden'},
415
+ {id: 'duplicated-javascript-insight', weight: 0, group: 'hidden'},
416
+ {id: 'font-display-insight', weight: 0, group: 'hidden'},
417
+ {id: 'forced-reflow-insight', weight: 0, group: 'hidden'},
418
+ {id: 'image-delivery-insight', weight: 0, group: 'hidden'},
419
+ {id: 'interaction-to-next-paint-insight', weight: 0, group: 'hidden'},
420
+ {id: 'lcp-discovery-insight', weight: 0, group: 'hidden'},
421
+ {id: 'lcp-phases-insight', weight: 0, group: 'hidden'},
422
+ {id: 'network-dependency-tree-insight', weight: 0, group: 'hidden'},
423
+ {id: 'render-blocking-insight', weight: 0, group: 'hidden'},
424
+ {id: 'slow-css-selector-insight', weight: 0, group: 'hidden'},
425
+ {id: 'third-parties-insight', weight: 0, group: 'hidden'},
426
+ {id: 'use-cache-insight', weight: 0, group: 'hidden'},
427
+ {id: 'viewport-insight', weight: 0, group: 'hidden'},
424
428
 
425
429
  // These are our "invisible" metrics. Not displayed, but still in the LHR.
426
430
  {id: 'interactive', weight: 0, group: 'hidden', acronym: 'TTI'},
@@ -24,6 +24,25 @@ const config = {
24
24
  'performance': {
25
25
  auditRefs: [
26
26
  {id: 'uses-rel-preload', weight: 0, group: 'diagnostics'},
27
+
28
+ // TODO: Remove this when insights aren't hidden by default
29
+ // Insight audits.
30
+ {id: 'cls-culprits-insight', weight: 0, group: 'insights'},
31
+ {id: 'document-latency-insight', weight: 0, group: 'insights'},
32
+ {id: 'dom-size-insight', weight: 0, group: 'insights'},
33
+ {id: 'duplicated-javascript-insight', weight: 0, group: 'insights'},
34
+ {id: 'font-display-insight', weight: 0, group: 'insights'},
35
+ {id: 'forced-reflow-insight', weight: 0, group: 'insights'},
36
+ {id: 'image-delivery-insight', weight: 0, group: 'insights'},
37
+ {id: 'interaction-to-next-paint-insight', weight: 0, group: 'insights'},
38
+ {id: 'lcp-discovery-insight', weight: 0, group: 'insights'},
39
+ {id: 'lcp-phases-insight', weight: 0, group: 'insights'},
40
+ {id: 'network-dependency-tree-insight', weight: 0, group: 'insights'},
41
+ {id: 'render-blocking-insight', weight: 0, group: 'insights'},
42
+ {id: 'slow-css-selector-insight', weight: 0, group: 'insights'},
43
+ {id: 'third-parties-insight', weight: 0, group: 'insights'},
44
+ {id: 'use-cache-insight', weight: 0, group: 'insights'},
45
+ {id: 'viewport-insight', weight: 0, group: 'insights'},
27
46
  ],
28
47
  },
29
48
  // @ts-ignore: `title` is required in CategoryJson. setting to the same value as the default
@@ -3,6 +3,7 @@ export default SourceMaps;
3
3
  * @fileoverview Gets JavaScript source maps.
4
4
  */
5
5
  declare class SourceMaps extends BaseGatherer {
6
+ static symbol: symbol;
6
7
  /** @type {LH.Gatherer.GathererMeta<'Scripts'>} */
7
8
  meta: LH.Gatherer.GathererMeta<"Scripts">;
8
9
  /**
@@ -12,8 +12,11 @@ import Scripts from './scripts.js';
12
12
  * @fileoverview Gets JavaScript source maps.
13
13
  */
14
14
  class SourceMaps extends BaseGatherer {
15
+ static symbol = Symbol('SourceMaps');
16
+
15
17
  /** @type {LH.Gatherer.GathererMeta<'Scripts'>} */
16
18
  meta = {
19
+ symbol: SourceMaps.symbol,
17
20
  supportedModes: ['timespan', 'navigation'],
18
21
  dependencies: {Scripts: Scripts.symbol},
19
22
  };
@@ -56,8 +56,8 @@ declare class TraceElements extends BaseGatherer {
56
56
  nodeId: number;
57
57
  type: string;
58
58
  } | undefined>;
59
- /** @type {LH.Gatherer.GathererMeta<'Trace'>} */
60
- meta: LH.Gatherer.GathererMeta<"Trace">;
59
+ /** @type {LH.Gatherer.GathererMeta<'Trace'|'SourceMaps'>} */
60
+ meta: LH.Gatherer.GathererMeta<"Trace" | "SourceMaps">;
61
61
  /** @type {Map<string, string>} */
62
62
  animationIdToName: Map<string, string>;
63
63
  /** @param {LH.Crdp.Animation.AnimationStartedEvent} args */
@@ -82,10 +82,10 @@ declare class TraceElements extends BaseGatherer {
82
82
  */
83
83
  getNodeDetails(session: LH.Gatherer.ProtocolSession, backendNodeId: number): Promise<import("devtools-protocol").Protocol.Runtime.CallFunctionOnResponse | null>;
84
84
  /**
85
- * @param {LH.Gatherer.Context<'Trace'|'RootCauses'>} context
85
+ * @param {LH.Gatherer.Context<'Trace'|'RootCauses'|'SourceMaps'>} context
86
86
  * @return {Promise<LH.Artifacts.TraceElement[]>}
87
87
  */
88
- getArtifact(context: LH.Gatherer.Context<"Trace" | "RootCauses">): Promise<LH.Artifacts.TraceElement[]>;
88
+ getArtifact(context: LH.Gatherer.Context<"Trace" | "RootCauses" | "SourceMaps">): Promise<LH.Artifacts.TraceElement[]>;
89
89
  }
90
90
  import BaseGatherer from '../base-gatherer.js';
91
91
  //# sourceMappingURL=trace-elements.d.ts.map
@@ -24,6 +24,7 @@ import {Responsiveness} from '../../computed/metrics/responsiveness.js';
24
24
  import {CumulativeLayoutShift} from '../../computed/metrics/cumulative-layout-shift.js';
25
25
  import {ExecutionContext} from '../driver/execution-context.js';
26
26
  import {TraceEngineResult} from '../../computed/trace-engine-result.js';
27
+ import SourceMaps from './source-maps.js';
27
28
 
28
29
  /** @typedef {{nodeId: number, animations?: {name?: string, failureReasonsMask?: number, unsupportedProperties?: string[]}[], type?: string}} TraceElementData */
29
30
 
@@ -45,10 +46,10 @@ function getNodeDetailsData() {
45
46
  /* c8 ignore stop */
46
47
 
47
48
  class TraceElements extends BaseGatherer {
48
- /** @type {LH.Gatherer.GathererMeta<'Trace'>} */
49
+ /** @type {LH.Gatherer.GathererMeta<'Trace'|'SourceMaps'>} */
49
50
  meta = {
50
51
  supportedModes: ['timespan', 'navigation'],
51
- dependencies: {Trace: Trace.symbol},
52
+ dependencies: {Trace: Trace.symbol, SourceMaps: SourceMaps.symbol},
52
53
  };
53
54
 
54
55
  /** @type {Map<string, string>} */
@@ -379,14 +380,17 @@ class TraceElements extends BaseGatherer {
379
380
  }
380
381
 
381
382
  /**
382
- * @param {LH.Gatherer.Context<'Trace'|'RootCauses'>} context
383
+ * @param {LH.Gatherer.Context<'Trace'|'RootCauses'|'SourceMaps'>} context
383
384
  * @return {Promise<LH.Artifacts.TraceElement[]>}
384
385
  */
385
386
  async getArtifact(context) {
386
387
  const session = context.driver.defaultSession;
387
388
 
388
389
  const trace = context.dependencies.Trace;
389
- const traceEngineResult = await TraceEngineResult.request({trace}, context);
390
+ const SourceMaps = context.dependencies.SourceMaps;
391
+ const settings = context.settings;
392
+ const traceEngineResult =
393
+ await TraceEngineResult.request({trace, settings, SourceMaps}, context);
390
394
  const rootCauses = context.dependencies.RootCauses;
391
395
 
392
396
  const processedTrace = await ProcessedTrace.request(trace, context);
@@ -59,6 +59,11 @@ class Trace extends BaseGatherer {
59
59
  // For CLS root causes.
60
60
  'disabled-by-default-devtools.timeline.invalidationTracking',
61
61
 
62
+ // Enhanced traces.
63
+ 'disabled-by-default-devtools.target-rundown',
64
+ 'disabled-by-default-devtools.v8-source-rundown-sources',
65
+ 'disabled-by-default-devtools.v8-source-rundown',
66
+
62
67
  // Not used by Lighthouse (yet) but included for users that want JS samples when looking at
63
68
  // a trace collected by Lighthouse (e.g. "View Trace" workflow in DevTools)
64
69
  // TODO: Re-enable after investigating b/325659693
@@ -2,126 +2,4 @@
2
2
  export const NotRestoredReasonDescription: Record<string, {
3
3
  name: LH.IcuMessage | string;
4
4
  } | undefined>;
5
- export namespace UIStrings {
6
- let notMainFrame: string;
7
- let backForwardCacheDisabled: string;
8
- let relatedActiveContentsExist: string;
9
- let HTTPStatusNotOK: string;
10
- let schemeNotHTTPOrHTTPS: string;
11
- let loading: string;
12
- let wasGrantedMediaAccess: string;
13
- let HTTPMethodNotGET: string;
14
- let subframeIsNavigating: string;
15
- let timeout: string;
16
- let cacheLimit: string;
17
- let JavaScriptExecution: string;
18
- let rendererProcessKilled: string;
19
- let rendererProcessCrashed: string;
20
- let grantedMediaStreamAccess: string;
21
- let cacheFlushed: string;
22
- let serviceWorkerVersionActivation: string;
23
- let sessionRestored: string;
24
- let serviceWorkerPostMessage: string;
25
- let enteredBackForwardCacheBeforeServiceWorkerHostAdded: string;
26
- let serviceWorkerClaim: string;
27
- let haveInnerContents: string;
28
- let timeoutPuttingInCache: string;
29
- let backForwardCacheDisabledByLowMemory: string;
30
- let backForwardCacheDisabledByCommandLine: string;
31
- let networkRequestDatapipeDrainedAsBytesConsumer: string;
32
- let networkRequestRedirected: string;
33
- let networkRequestTimeout: string;
34
- let networkExceedsBufferLimit: string;
35
- let navigationCancelledWhileRestoring: string;
36
- let backForwardCacheDisabledForPrerender: string;
37
- let userAgentOverrideDiffers: string;
38
- let foregroundCacheLimit: string;
39
- let backForwardCacheDisabledForDelegate: string;
40
- let unloadHandlerExistsInMainFrame: string;
41
- let unloadHandlerExistsInSubFrame: string;
42
- let serviceWorkerUnregistration: string;
43
- let noResponseHead: string;
44
- let cacheControlNoStore: string;
45
- let ineligibleAPI: string;
46
- let internalError: string;
47
- let webSocket: string;
48
- let webTransport: string;
49
- let webRTC: string;
50
- let mainResourceHasCacheControlNoStore: string;
51
- let mainResourceHasCacheControlNoCache: string;
52
- let subresourceHasCacheControlNoStore: string;
53
- let subresourceHasCacheControlNoCache: string;
54
- let containsPlugins: string;
55
- let documentLoaded: string;
56
- let dedicatedWorkerOrWorklet: string;
57
- let outstandingNetworkRequestOthers: string;
58
- let outstandingIndexedDBTransaction: string;
59
- let requestedNotificationsPermission: string;
60
- let requestedMIDIPermission: string;
61
- let requestedAudioCapturePermission: string;
62
- let requestedVideoCapturePermission: string;
63
- let requestedBackForwardCacheBlockedSensors: string;
64
- let requestedBackgroundWorkPermission: string;
65
- let broadcastChannel: string;
66
- let indexedDBConnection: string;
67
- let webXR: string;
68
- let sharedWorker: string;
69
- let webLocks: string;
70
- let webHID: string;
71
- let webShare: string;
72
- let requestedStorageAccessGrant: string;
73
- let webNfc: string;
74
- let outstandingNetworkRequestFetch: string;
75
- let outstandingNetworkRequestXHR: string;
76
- let appBanner: string;
77
- let printing: string;
78
- let webDatabase: string;
79
- let pictureInPicture: string;
80
- let speechRecognizer: string;
81
- let idleManager: string;
82
- let paymentManager: string;
83
- let speechSynthesis: string;
84
- let keyboardLock: string;
85
- let webOTPService: string;
86
- let outstandingNetworkRequestDirectSocket: string;
87
- let injectedJavascript: string;
88
- let injectedStyleSheet: string;
89
- let contentDiscarded: string;
90
- let contentSecurityHandler: string;
91
- let contentWebAuthenticationAPI: string;
92
- let contentFileChooser: string;
93
- let contentSerial: string;
94
- let contentFileSystemAccess: string;
95
- let contentMediaDevicesDispatcherHost: string;
96
- let contentWebBluetooth: string;
97
- let contentWebUSB: string;
98
- let contentMediaSession: string;
99
- let contentMediaSessionService: string;
100
- let contentMediaPlay: string;
101
- let contentScreenReader: string;
102
- let embedderPopupBlockerTabHelper: string;
103
- let embedderSafeBrowsingTriggeredPopupBlocker: string;
104
- let embedderSafeBrowsingThreatDetails: string;
105
- let embedderAppBannerManager: string;
106
- let embedderDomDistillerViewerSource: string;
107
- let embedderDomDistillerSelfDeletingRequestDelegate: string;
108
- let embedderOomInterventionTabHelper: string;
109
- let embedderOfflinePage: string;
110
- let embedderChromePasswordManagerClientBindCredentialManager: string;
111
- let embedderPermissionRequestManager: string;
112
- let embedderModalDialog: string;
113
- let embedderExtensions: string;
114
- let embedderExtensionMessaging: string;
115
- let embedderExtensionMessagingForOpenPort: string;
116
- let embedderExtensionSentMessageToCachedFrame: string;
117
- let errorDocument: string;
118
- let fencedFramesEmbedder: string;
119
- let keepaliveRequest: string;
120
- let jsNetworkRequestReceivedCacheControlNoStoreResource: string;
121
- let indexedDBEvent: string;
122
- let cookieDisabled: string;
123
- let webRTCSticky: string;
124
- let webTransportSticky: string;
125
- let webSocketSticky: string;
126
- }
127
5
  //# sourceMappingURL=bf-cache-strings.d.ts.map
@@ -544,7 +544,7 @@ const UIStrings = {
544
544
 
545
545
  };
546
546
 
547
- const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
547
+ const str_ = i18n.createIcuMessageFn('node_modules/@paulirish/trace_engine/panels/application/components/BackForwardCacheStrings.js', UIStrings);
548
548
 
549
549
 
550
550
  /** @type {Record<string, {name: LH.IcuMessage|string} | undefined>} */
@@ -707,5 +707,4 @@ const NotRestoredReasonDescription = {
707
707
 
708
708
  export {
709
709
  NotRestoredReasonDescription,
710
- UIStrings,
711
710
  };
@@ -25,7 +25,8 @@ const UIStrings = {
25
25
  };
26
26
 
27
27
  const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
28
- const deprecationsStr_ = i18n.createIcuMessageFn(import.meta.url, DeprecationUIStrings);
28
+ const deprecationsStr_ = i18n.createIcuMessageFn(
29
+ 'node_modules/@paulirish/trace_engine/generated/Deprecation.js', DeprecationUIStrings);
29
30
 
30
31
  /**
31
32
  * @param {LH.Crdp.Audits.DeprecationIssueDetails} issueDetails
@@ -0,0 +1,29 @@
1
+ export type Pattern = {
2
+ name: string;
3
+ expression: string;
4
+ estimateBytes?: (content: string) => number;
5
+ };
6
+ export type PatternMatchResult = {
7
+ name: string;
8
+ line: number;
9
+ column: number;
10
+ };
11
+ export type Result = {
12
+ matches: PatternMatchResult[];
13
+ estimatedByteSavings: number;
14
+ };
15
+ /**
16
+ * @param {string} content
17
+ * @param {import('../cdt/generated/SourceMap.js')|null} map
18
+ * @return {Result}
19
+ */
20
+ export function detectLegacyJavaScript(content: string, map: import("../cdt/generated/SourceMap.js") | null): Result;
21
+ /**
22
+ * @return {Pattern[]}
23
+ */
24
+ export function getTransformPatterns(): Pattern[];
25
+ export function getCoreJsPolyfillData(): {
26
+ name: string;
27
+ coreJs3Module: string;
28
+ }[];
29
+ //# sourceMappingURL=legacy-javascript.d.ts.map