@paulirish/trace_engine 0.0.67-beta.1 → 0.0.67

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 (776) hide show
  1. package/.tmp/tsbuildinfo/analyze-inspector-issues.d.mts +13 -0
  2. package/.tmp/tsbuildinfo/analyze-inspector-issues.d.mts.map +1 -0
  3. package/.tmp/tsbuildinfo/analyze-trace.d.mts +17 -0
  4. package/.tmp/tsbuildinfo/analyze-trace.d.mts.map +1 -0
  5. package/.tmp/tsbuildinfo/test/test-trace-engine.d.mts +2 -0
  6. package/.tmp/tsbuildinfo/test/test-trace-engine.d.mts.map +1 -0
  7. package/.tmp/tsbuildinfo/third_party/third-party-web/third-party-web.d.ts +3 -0
  8. package/.tmp/tsbuildinfo/third_party/third-party-web/third-party-web.d.ts.map +1 -0
  9. package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +1 -0
  10. package/README.md +22 -62
  11. package/analyze-inspector-issues.mjs +60 -0
  12. package/analyze-trace.mjs +144 -6
  13. package/core/common/ParsedURL.d.ts +8 -0
  14. package/core/common/ParsedURL.js +512 -0
  15. package/core/common/ParsedURL.js.map +1 -0
  16. package/core/common/common.d.ts +8 -33
  17. package/core/common/common.js +2 -0
  18. package/core/host/host.d.ts +1 -13
  19. package/core/host/host.js +1 -0
  20. package/core/i18n/i18n.d.ts +20 -8
  21. package/core/i18n/i18n.js +15 -0
  22. package/core/platform/ArrayUtilities.js +224 -0
  23. package/core/platform/ArrayUtilities.js.map +1 -0
  24. package/core/platform/Brand.js +5 -0
  25. package/core/platform/Brand.js.map +1 -0
  26. package/core/platform/Constructor.js +5 -0
  27. package/core/platform/Constructor.js.map +1 -0
  28. package/core/platform/DateUtilities.js +14 -0
  29. package/core/platform/DateUtilities.js.map +1 -0
  30. package/core/platform/DevToolsPath.js +28 -0
  31. package/core/platform/DevToolsPath.js.map +1 -0
  32. package/core/platform/HostRuntime.js +8 -0
  33. package/core/platform/HostRuntime.js.map +1 -0
  34. package/core/platform/KeyboardUtilities.js +34 -0
  35. package/core/platform/KeyboardUtilities.js.map +1 -0
  36. package/core/platform/MapUtilities.js +80 -0
  37. package/core/platform/MapUtilities.js.map +1 -0
  38. package/core/platform/MimeType.js +157 -0
  39. package/core/platform/MimeType.js.map +1 -0
  40. package/core/platform/NumberUtilities.js +73 -0
  41. package/core/platform/NumberUtilities.js.map +1 -0
  42. package/core/platform/Size.js +36 -0
  43. package/core/platform/Size.js.map +1 -0
  44. package/core/platform/StringUtilities.d.ts +21 -0
  45. package/core/platform/StringUtilities.js +731 -0
  46. package/core/platform/StringUtilities.js.map +1 -0
  47. package/core/platform/Timing.js +10 -0
  48. package/core/platform/Timing.js.map +1 -0
  49. package/core/platform/TypedArrayUtilities.js +158 -0
  50. package/core/platform/TypedArrayUtilities.js.map +1 -0
  51. package/core/platform/TypescriptUtilities.js +17 -0
  52. package/core/platform/TypescriptUtilities.js.map +1 -0
  53. package/core/platform/UIString.d.ts +5 -2
  54. package/core/platform/UIString.js +5 -0
  55. package/core/platform/UIString.js.map +1 -0
  56. package/core/platform/UserVisibleError.d.ts +1 -12
  57. package/core/platform/UserVisibleError.js +23 -0
  58. package/core/platform/UserVisibleError.js.map +1 -0
  59. package/core/platform/api/HostRuntime.d.ts +1 -0
  60. package/core/platform/api/HostRuntime.js +5 -0
  61. package/core/platform/api/HostRuntime.js.map +1 -0
  62. package/core/platform/api/api-tsconfig.json +58 -0
  63. package/core/platform/api/api-tsconfig.ref.json +26 -0
  64. package/core/platform/api/api.js +6 -0
  65. package/core/platform/api/api.js.map +1 -0
  66. package/core/platform/bundle-tsconfig.json +59 -0
  67. package/core/platform/bundle-tsconfig.ref.json +27 -0
  68. package/core/platform/foundation_unittests-tsconfig.json +73 -0
  69. package/core/platform/foundation_unittests-tsconfig.ref.json +40 -0
  70. package/core/platform/foundation_unittests_node_typecheck-tsconfig.json +69 -0
  71. package/core/platform/platform-tsconfig.json +81 -0
  72. package/core/platform/platform-tsconfig.ref.json +49 -0
  73. package/core/platform/platform.js +28 -0
  74. package/core/platform/platform.js.map +1 -0
  75. package/core/platform/platform_node_typecheck-tsconfig.json +78 -0
  76. package/core/platform/platform_node_typecheck.stamp +0 -0
  77. package/core/root/root.d.ts +1 -4
  78. package/core/root/root.js +1 -0
  79. package/core/sdk/sdk.d.ts +27 -97
  80. package/core/sdk/sdk.js +1 -0
  81. package/generated/protocol.d.ts +93 -30
  82. package/generated/protocol.js +3304 -0
  83. package/locales/af.json +173 -176
  84. package/locales/am.json +352 -355
  85. package/locales/ar.json +353 -356
  86. package/locales/as.json +351 -354
  87. package/locales/az.json +342 -345
  88. package/locales/be.json +352 -355
  89. package/locales/bg.json +352 -355
  90. package/locales/bn.json +352 -355
  91. package/locales/bs.json +254 -257
  92. package/locales/ca.json +284 -287
  93. package/locales/cs.json +337 -340
  94. package/locales/cy.json +147 -150
  95. package/locales/da.json +234 -237
  96. package/locales/de.json +253 -256
  97. package/locales/el.json +337 -340
  98. package/locales/en-GB.json +135 -138
  99. package/locales/en-US.json +300 -300
  100. package/locales/en-XL.json +1055 -0
  101. package/locales/es-419.json +283 -286
  102. package/locales/es.json +283 -286
  103. package/locales/et.json +239 -242
  104. package/locales/eu.json +134 -137
  105. package/locales/fa.json +352 -355
  106. package/locales/fi.json +284 -287
  107. package/locales/fil.json +131 -134
  108. package/locales/fr-CA.json +311 -314
  109. package/locales/fr.json +310 -313
  110. package/locales/gl.json +265 -268
  111. package/locales/gu.json +353 -356
  112. package/locales/he.json +353 -356
  113. package/locales/hi.json +337 -340
  114. package/locales/hr.json +258 -261
  115. package/locales/hu.json +343 -346
  116. package/locales/hy.json +352 -355
  117. package/locales/id.json +131 -134
  118. package/locales/is.json +305 -308
  119. package/locales/it.json +222 -225
  120. package/locales/ja.json +352 -355
  121. package/locales/ka.json +353 -356
  122. package/locales/kk.json +353 -356
  123. package/locales/km.json +352 -355
  124. package/locales/kn.json +353 -356
  125. package/locales/ko.json +352 -355
  126. package/locales/ky.json +351 -354
  127. package/locales/lo.json +353 -356
  128. package/locales/lt.json +324 -327
  129. package/locales/lv.json +318 -321
  130. package/locales/mk.json +353 -356
  131. package/locales/ml.json +352 -355
  132. package/locales/mn.json +352 -355
  133. package/locales/mr.json +352 -355
  134. package/locales/ms.json +131 -134
  135. package/locales/my.json +351 -354
  136. package/locales/ne.json +337 -340
  137. package/locales/nl.json +184 -187
  138. package/locales/no.json +240 -243
  139. package/locales/or.json +352 -355
  140. package/locales/pa.json +352 -355
  141. package/locales/pl.json +308 -311
  142. package/locales/pt-PT.json +275 -278
  143. package/locales/pt.json +271 -274
  144. package/locales/ro.json +310 -313
  145. package/locales/ru.json +352 -355
  146. package/locales/si.json +353 -356
  147. package/locales/sk.json +334 -337
  148. package/locales/sl.json +275 -278
  149. package/locales/sq.json +317 -320
  150. package/locales/sr-Latn.json +257 -260
  151. package/locales/sr.json +353 -356
  152. package/locales/sv.json +298 -301
  153. package/locales/sw.json +131 -134
  154. package/locales/ta.json +353 -356
  155. package/locales/te.json +351 -354
  156. package/locales/th.json +353 -356
  157. package/locales/tr.json +328 -331
  158. package/locales/uk.json +352 -355
  159. package/locales/ur.json +353 -356
  160. package/locales/uz.json +235 -238
  161. package/locales/vi.json +353 -356
  162. package/locales/zh-HK.json +353 -356
  163. package/locales/zh-TW.json +352 -355
  164. package/locales/zh.json +352 -355
  165. package/locales/zu.json +130 -133
  166. package/models/cpu_profile/CPUProfileDataModel.js +517 -0
  167. package/models/cpu_profile/CPUProfileDataModel.js.map +1 -0
  168. package/models/cpu_profile/ProfileTreeModel.js +90 -0
  169. package/models/cpu_profile/ProfileTreeModel.js.map +1 -0
  170. package/models/cpu_profile/bundle-tsconfig.json +59 -0
  171. package/models/cpu_profile/bundle-tsconfig.ref.json +27 -0
  172. package/models/cpu_profile/cpu_profile-tsconfig.json +63 -0
  173. package/models/cpu_profile/cpu_profile-tsconfig.ref.json +31 -0
  174. package/models/cpu_profile/cpu_profile.js +7 -0
  175. package/models/cpu_profile/cpu_profile.js.map +1 -0
  176. package/models/cpu_profile/cpu_profile_node_typecheck-tsconfig.json +60 -0
  177. package/models/cpu_profile/cpu_profile_node_typecheck.stamp +0 -0
  178. package/models/cpu_profile/foundation_unittests-tsconfig.json +63 -0
  179. package/models/cpu_profile/foundation_unittests-tsconfig.ref.json +30 -0
  180. package/models/cpu_profile/foundation_unittests_node_typecheck-tsconfig.json +59 -0
  181. package/models/crux-manager/crux-manager.d.ts +3 -1
  182. package/models/crux-manager/crux-manager.js +1 -0
  183. package/models/trace/EntityMapper.js +133 -0
  184. package/models/trace/EntityMapper.js.map +1 -0
  185. package/models/trace/EventsSerializer.d.ts +1 -0
  186. package/models/trace/EventsSerializer.js +118 -0
  187. package/models/trace/EventsSerializer.js.map +1 -0
  188. package/models/trace/LanternComputationData.js +368 -0
  189. package/models/trace/LanternComputationData.js.map +1 -0
  190. package/models/trace/ModelImpl.js +181 -0
  191. package/models/trace/ModelImpl.js.map +1 -0
  192. package/models/trace/Name.js +115 -0
  193. package/models/trace/Name.js.map +1 -0
  194. package/models/trace/Processor.js +616 -0
  195. package/models/trace/Processor.js.map +1 -0
  196. package/models/trace/Styles.d.ts +2 -2
  197. package/models/trace/Styles.js +836 -0
  198. package/models/trace/Styles.js.map +1 -0
  199. package/models/trace/bundle-tsconfig.json +77 -0
  200. package/models/trace/bundle-tsconfig.ref.json +45 -0
  201. package/models/trace/extras/FilmStrip.js +45 -0
  202. package/models/trace/extras/FilmStrip.js.map +1 -0
  203. package/models/trace/extras/Initiators.js +47 -0
  204. package/models/trace/extras/Initiators.js.map +1 -0
  205. package/models/trace/extras/MainThreadActivity.js +77 -0
  206. package/models/trace/extras/MainThreadActivity.js.map +1 -0
  207. package/models/trace/extras/ScriptDuplication.js +163 -0
  208. package/models/trace/extras/ScriptDuplication.js.map +1 -0
  209. package/models/trace/extras/StackTraceForEvent.d.ts +1 -1
  210. package/models/trace/extras/StackTraceForEvent.js +192 -0
  211. package/models/trace/extras/StackTraceForEvent.js.map +1 -0
  212. package/models/trace/extras/ThirdParties.js +119 -0
  213. package/models/trace/extras/ThirdParties.js.map +1 -0
  214. package/models/trace/extras/TraceFilter.js +51 -0
  215. package/models/trace/extras/TraceFilter.js.map +1 -0
  216. package/models/trace/extras/TraceTree.js +652 -0
  217. package/models/trace/extras/TraceTree.js.map +1 -0
  218. package/models/trace/extras/bundle-tsconfig.json +59 -0
  219. package/models/trace/extras/bundle-tsconfig.ref.json +27 -0
  220. package/models/trace/extras/extras-tsconfig.json +81 -0
  221. package/models/trace/extras/extras-tsconfig.ref.json +49 -0
  222. package/models/trace/extras/extras.js +12 -0
  223. package/models/trace/extras/extras.js.map +1 -0
  224. package/models/trace/extras/extras_node_typecheck-tsconfig.json +78 -0
  225. package/models/trace/extras/extras_node_typecheck.stamp +0 -0
  226. package/models/trace/extras/foundation_unittests-tsconfig.json +91 -0
  227. package/models/trace/extras/foundation_unittests-tsconfig.ref.json +58 -0
  228. package/models/trace/extras/foundation_unittests_node_typecheck-tsconfig.json +87 -0
  229. package/models/trace/foundation_unittests-tsconfig.json +70 -0
  230. package/models/trace/foundation_unittests-tsconfig.ref.json +37 -0
  231. package/models/trace/foundation_unittests_node_typecheck-tsconfig.json +66 -0
  232. package/models/trace/handlers/AnimationFramesHandler.d.ts +1 -1
  233. package/models/trace/handlers/AnimationFramesHandler.js +110 -0
  234. package/models/trace/handlers/AnimationFramesHandler.js.map +1 -0
  235. package/models/trace/handlers/AnimationHandler.js +27 -0
  236. package/models/trace/handlers/AnimationHandler.js.map +1 -0
  237. package/models/trace/handlers/AsyncJSCallsHandler.d.ts +2 -2
  238. package/models/trace/handlers/AsyncJSCallsHandler.js +188 -0
  239. package/models/trace/handlers/AsyncJSCallsHandler.js.map +1 -0
  240. package/models/trace/handlers/DOMStatsHandler.js +22 -0
  241. package/models/trace/handlers/DOMStatsHandler.js.map +1 -0
  242. package/models/trace/handlers/ExtensionTraceDataHandler.js +264 -0
  243. package/models/trace/handlers/ExtensionTraceDataHandler.js.map +1 -0
  244. package/models/trace/handlers/FlowsHandler.js +149 -0
  245. package/models/trace/handlers/FlowsHandler.js.map +1 -0
  246. package/models/trace/handlers/FramesHandler.js +491 -0
  247. package/models/trace/handlers/FramesHandler.js.map +1 -0
  248. package/models/trace/handlers/GPUHandler.js +36 -0
  249. package/models/trace/handlers/GPUHandler.js.map +1 -0
  250. package/models/trace/handlers/ImagePaintingHandler.d.ts +2 -2
  251. package/models/trace/handlers/ImagePaintingHandler.js +148 -0
  252. package/models/trace/handlers/ImagePaintingHandler.js.map +1 -0
  253. package/models/trace/handlers/InitiatorsHandler.d.ts +2 -2
  254. package/models/trace/handlers/InitiatorsHandler.js +181 -0
  255. package/models/trace/handlers/InitiatorsHandler.js.map +1 -0
  256. package/models/trace/handlers/InvalidationsHandler.js +125 -0
  257. package/models/trace/handlers/InvalidationsHandler.js.map +1 -0
  258. package/models/trace/handlers/LargestImagePaintHandler.js +86 -0
  259. package/models/trace/handlers/LargestImagePaintHandler.js.map +1 -0
  260. package/models/trace/handlers/LargestTextPaintHandler.js +28 -0
  261. package/models/trace/handlers/LargestTextPaintHandler.js.map +1 -0
  262. package/models/trace/handlers/LayerTreeHandler.d.ts +1 -1
  263. package/models/trace/handlers/LayerTreeHandler.js +104 -0
  264. package/models/trace/handlers/LayerTreeHandler.js.map +1 -0
  265. package/models/trace/handlers/LayoutShiftsHandler.js +453 -0
  266. package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -0
  267. package/models/trace/handlers/MemoryHandler.js +22 -0
  268. package/models/trace/handlers/MemoryHandler.js.map +1 -0
  269. package/models/trace/handlers/MetaHandler.js +442 -0
  270. package/models/trace/handlers/MetaHandler.js.map +1 -0
  271. package/models/trace/handlers/ModelHandlers.js +33 -0
  272. package/models/trace/handlers/ModelHandlers.js.map +1 -0
  273. package/models/trace/handlers/NetworkRequestsHandler.d.ts +1 -1
  274. package/models/trace/handlers/NetworkRequestsHandler.js +578 -0
  275. package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -0
  276. package/models/trace/handlers/PageFramesHandler.js +43 -0
  277. package/models/trace/handlers/PageFramesHandler.js.map +1 -0
  278. package/models/trace/handlers/PageLoadMetricsHandler.d.ts +1 -1
  279. package/models/trace/handlers/PageLoadMetricsHandler.js +463 -0
  280. package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -0
  281. package/models/trace/handlers/RendererHandler.js +346 -0
  282. package/models/trace/handlers/RendererHandler.js.map +1 -0
  283. package/models/trace/handlers/SamplesHandler.js +261 -0
  284. package/models/trace/handlers/SamplesHandler.js.map +1 -0
  285. package/models/trace/handlers/ScreenshotsHandler.js +56 -0
  286. package/models/trace/handlers/ScreenshotsHandler.js.map +1 -0
  287. package/models/trace/handlers/ScriptsHandler.d.ts +1 -1
  288. package/models/trace/handlers/ScriptsHandler.js +277 -0
  289. package/models/trace/handlers/ScriptsHandler.js.map +1 -0
  290. package/models/trace/handlers/SelectorStatsHandler.js +72 -0
  291. package/models/trace/handlers/SelectorStatsHandler.js.map +1 -0
  292. package/models/trace/handlers/Threads.js +108 -0
  293. package/models/trace/handlers/Threads.js.map +1 -0
  294. package/models/trace/handlers/UserInteractionsHandler.js +319 -0
  295. package/models/trace/handlers/UserInteractionsHandler.js.map +1 -0
  296. package/models/trace/handlers/UserTimingsHandler.js +194 -0
  297. package/models/trace/handlers/UserTimingsHandler.js.map +1 -0
  298. package/models/trace/handlers/WarningsHandler.d.ts +1 -1
  299. package/models/trace/handlers/WarningsHandler.js +135 -0
  300. package/models/trace/handlers/WarningsHandler.js.map +1 -0
  301. package/models/trace/handlers/WorkersHandler.js +34 -0
  302. package/models/trace/handlers/WorkersHandler.js.map +1 -0
  303. package/models/trace/handlers/bundle-tsconfig.json +59 -0
  304. package/models/trace/handlers/bundle-tsconfig.ref.json +27 -0
  305. package/models/trace/handlers/foundation_unittests-tsconfig.json +102 -0
  306. package/models/trace/handlers/foundation_unittests-tsconfig.ref.json +69 -0
  307. package/models/trace/handlers/foundation_unittests_node_typecheck-tsconfig.json +98 -0
  308. package/models/trace/handlers/handlers-tsconfig.json +112 -0
  309. package/models/trace/handlers/handlers-tsconfig.ref.json +80 -0
  310. package/models/trace/handlers/handlers.js +8 -0
  311. package/models/trace/handlers/handlers.js.map +1 -0
  312. package/models/trace/handlers/handlers_node_typecheck-tsconfig.json +109 -0
  313. package/models/trace/handlers/handlers_node_typecheck.stamp +0 -0
  314. package/models/trace/handlers/helpers.js +167 -0
  315. package/models/trace/handlers/helpers.js.map +1 -0
  316. package/models/trace/handlers/types.js +2 -0
  317. package/models/trace/handlers/types.js.map +1 -0
  318. package/models/trace/helpers/Extensions.js +42 -0
  319. package/models/trace/helpers/Extensions.js.map +1 -0
  320. package/models/trace/helpers/Network.js +103 -0
  321. package/models/trace/helpers/Network.js.map +1 -0
  322. package/models/trace/helpers/SamplesIntegrator.d.ts +3 -1
  323. package/models/trace/helpers/SamplesIntegrator.js +527 -0
  324. package/models/trace/helpers/SamplesIntegrator.js.map +1 -0
  325. package/models/trace/helpers/SyntheticEvents.js +96 -0
  326. package/models/trace/helpers/SyntheticEvents.js.map +1 -0
  327. package/models/trace/helpers/Timing.js +200 -0
  328. package/models/trace/helpers/Timing.js.map +1 -0
  329. package/models/trace/helpers/Trace.d.ts +2 -0
  330. package/models/trace/helpers/Trace.js +844 -0
  331. package/models/trace/helpers/Trace.js.map +1 -0
  332. package/models/trace/helpers/TreeHelpers.js +255 -0
  333. package/models/trace/helpers/TreeHelpers.js.map +1 -0
  334. package/models/trace/helpers/bundle-tsconfig.json +59 -0
  335. package/models/trace/helpers/bundle-tsconfig.ref.json +27 -0
  336. package/models/trace/helpers/foundation_unittests-tsconfig.json +73 -0
  337. package/models/trace/helpers/foundation_unittests-tsconfig.ref.json +40 -0
  338. package/models/trace/helpers/foundation_unittests_node_typecheck-tsconfig.json +69 -0
  339. package/models/trace/helpers/helpers-tsconfig.json +77 -0
  340. package/models/trace/helpers/helpers-tsconfig.ref.json +45 -0
  341. package/models/trace/helpers/helpers.js +11 -0
  342. package/models/trace/helpers/helpers.js.map +1 -0
  343. package/models/trace/helpers/helpers_node_typecheck-tsconfig.json +74 -0
  344. package/models/trace/helpers/helpers_node_typecheck.stamp +0 -0
  345. package/models/trace/insights/CLSCulprits.d.ts +14 -14
  346. package/models/trace/insights/CLSCulprits.js +519 -0
  347. package/models/trace/insights/CLSCulprits.js.map +1 -0
  348. package/models/trace/insights/Cache.d.ts +6 -6
  349. package/models/trace/insights/Cache.js +210 -0
  350. package/models/trace/insights/Cache.js.map +1 -0
  351. package/models/trace/insights/CharacterSet.d.ts +8 -8
  352. package/models/trace/insights/CharacterSet.js +132 -0
  353. package/models/trace/insights/CharacterSet.js.map +1 -0
  354. package/models/trace/insights/Common.js +367 -0
  355. package/models/trace/insights/Common.js.map +1 -0
  356. package/models/trace/insights/DOMSize.d.ts +13 -13
  357. package/models/trace/insights/DOMSize.js +182 -0
  358. package/models/trace/insights/DOMSize.js.map +1 -0
  359. package/models/trace/insights/DocumentLatency.d.ts +11 -11
  360. package/models/trace/insights/DocumentLatency.js +259 -0
  361. package/models/trace/insights/DocumentLatency.js.map +1 -0
  362. package/models/trace/insights/DuplicatedJavaScript.d.ts +6 -6
  363. package/models/trace/insights/DuplicatedJavaScript.js +110 -0
  364. package/models/trace/insights/DuplicatedJavaScript.js.map +1 -0
  365. package/models/trace/insights/FontDisplay.d.ts +5 -5
  366. package/models/trace/insights/FontDisplay.js +93 -0
  367. package/models/trace/insights/FontDisplay.js.map +1 -0
  368. package/models/trace/insights/ForcedReflow.d.ts +7 -7
  369. package/models/trace/insights/ForcedReflow.js +162 -0
  370. package/models/trace/insights/ForcedReflow.js.map +1 -0
  371. package/models/trace/insights/INPBreakdown.d.ts +8 -8
  372. package/models/trace/insights/INPBreakdown.js +130 -0
  373. package/models/trace/insights/INPBreakdown.js.map +1 -0
  374. package/models/trace/insights/ImageDelivery.d.ts +13 -12
  375. package/models/trace/insights/ImageDelivery.js +264 -0
  376. package/models/trace/insights/ImageDelivery.js.map +1 -0
  377. package/models/trace/insights/LCPBreakdown.d.ts +11 -11
  378. package/models/trace/insights/LCPBreakdown.js +200 -0
  379. package/models/trace/insights/LCPBreakdown.js.map +1 -0
  380. package/models/trace/insights/LCPDiscovery.d.ts +10 -10
  381. package/models/trace/insights/LCPDiscovery.js +190 -0
  382. package/models/trace/insights/LCPDiscovery.js.map +1 -0
  383. package/models/trace/insights/LegacyJavaScript.d.ts +5 -5
  384. package/models/trace/insights/LegacyJavaScript.js +99 -0
  385. package/models/trace/insights/LegacyJavaScript.js.map +1 -0
  386. package/models/trace/insights/Models.js +23 -0
  387. package/models/trace/insights/Models.js.map +1 -0
  388. package/models/trace/insights/ModernHTTP.d.ts +5 -5
  389. package/models/trace/insights/ModernHTTP.js +205 -0
  390. package/models/trace/insights/ModernHTTP.js.map +1 -0
  391. package/models/trace/insights/NetworkDependencyTree.d.ts +19 -19
  392. package/models/trace/insights/NetworkDependencyTree.js +551 -0
  393. package/models/trace/insights/NetworkDependencyTree.js.map +1 -0
  394. package/models/trace/insights/RenderBlocking.d.ts +5 -5
  395. package/models/trace/insights/RenderBlocking.js +211 -0
  396. package/models/trace/insights/RenderBlocking.js.map +1 -0
  397. package/models/trace/insights/SlowCSSSelector.d.ts +10 -10
  398. package/models/trace/insights/SlowCSSSelector.js +140 -0
  399. package/models/trace/insights/SlowCSSSelector.js.map +1 -0
  400. package/models/trace/insights/Statistics.js +93 -0
  401. package/models/trace/insights/Statistics.js.map +1 -0
  402. package/models/trace/insights/ThirdParties.d.ts +6 -6
  403. package/models/trace/insights/ThirdParties.js +110 -0
  404. package/models/trace/insights/ThirdParties.js.map +1 -0
  405. package/models/trace/insights/Viewport.d.ts +3 -3
  406. package/models/trace/insights/Viewport.js +105 -0
  407. package/models/trace/insights/Viewport.js.map +1 -0
  408. package/models/trace/insights/bundle-tsconfig.json +59 -0
  409. package/models/trace/insights/bundle-tsconfig.ref.json +27 -0
  410. package/models/trace/insights/foundation_unittests-tsconfig.json +98 -0
  411. package/models/trace/insights/foundation_unittests-tsconfig.ref.json +65 -0
  412. package/models/trace/insights/foundation_unittests_node_typecheck-tsconfig.json +94 -0
  413. package/models/trace/insights/insights-tsconfig.json +114 -0
  414. package/models/trace/insights/insights-tsconfig.ref.json +82 -0
  415. package/models/trace/insights/insights.js +10 -0
  416. package/models/trace/insights/insights.js.map +1 -0
  417. package/models/trace/insights/insights_node_typecheck-tsconfig.json +111 -0
  418. package/models/trace/insights/insights_node_typecheck.stamp +0 -0
  419. package/models/trace/insights/types.d.ts +3 -3
  420. package/models/trace/insights/types.js +41 -0
  421. package/models/trace/insights/types.js.map +1 -0
  422. package/models/trace/lantern/bundle-tsconfig.json +71 -0
  423. package/models/trace/lantern/bundle-tsconfig.ref.json +39 -0
  424. package/models/trace/lantern/core/LanternError.js +7 -0
  425. package/models/trace/lantern/core/LanternError.js.map +1 -0
  426. package/models/trace/lantern/core/NetworkAnalyzer.d.ts +1 -0
  427. package/models/trace/lantern/core/NetworkAnalyzer.js +496 -0
  428. package/models/trace/lantern/core/NetworkAnalyzer.js.map +1 -0
  429. package/models/trace/lantern/core/bundle-tsconfig.json +59 -0
  430. package/models/trace/lantern/core/bundle-tsconfig.ref.json +27 -0
  431. package/models/trace/lantern/core/core-tsconfig.json +60 -0
  432. package/models/trace/lantern/core/core-tsconfig.ref.json +28 -0
  433. package/models/trace/lantern/core/core.js +6 -0
  434. package/models/trace/lantern/core/core.js.map +1 -0
  435. package/models/trace/lantern/core/core_node_typecheck-tsconfig.json +57 -0
  436. package/models/trace/lantern/core/core_node_typecheck.stamp +0 -0
  437. package/models/trace/lantern/core/foundation_unittests-tsconfig.json +69 -0
  438. package/models/trace/lantern/core/foundation_unittests-tsconfig.ref.json +36 -0
  439. package/models/trace/lantern/core/foundation_unittests_node_typecheck-tsconfig.json +65 -0
  440. package/models/trace/lantern/graph/BaseNode.d.ts +2 -2
  441. package/models/trace/lantern/graph/BaseNode.js +277 -0
  442. package/models/trace/lantern/graph/BaseNode.js.map +1 -0
  443. package/models/trace/lantern/graph/CPUNode.d.ts +4 -2
  444. package/models/trace/lantern/graph/CPUNode.js +80 -0
  445. package/models/trace/lantern/graph/CPUNode.js.map +1 -0
  446. package/models/trace/lantern/graph/NetworkNode.js +95 -0
  447. package/models/trace/lantern/graph/NetworkNode.js.map +1 -0
  448. package/models/trace/lantern/graph/PageDependencyGraph.js +574 -0
  449. package/models/trace/lantern/graph/PageDependencyGraph.js.map +1 -0
  450. package/models/trace/lantern/graph/bundle-tsconfig.json +59 -0
  451. package/models/trace/lantern/graph/bundle-tsconfig.ref.json +27 -0
  452. package/models/trace/lantern/graph/foundation_unittests-tsconfig.json +61 -0
  453. package/models/trace/lantern/graph/foundation_unittests-tsconfig.ref.json +28 -0
  454. package/models/trace/lantern/graph/foundation_unittests_node_typecheck-tsconfig.json +57 -0
  455. package/models/trace/lantern/graph/graph-tsconfig.json +65 -0
  456. package/models/trace/lantern/graph/graph-tsconfig.ref.json +33 -0
  457. package/models/trace/lantern/graph/graph.js +8 -0
  458. package/models/trace/lantern/graph/graph.js.map +1 -0
  459. package/models/trace/lantern/graph/graph_node_typecheck-tsconfig.json +62 -0
  460. package/models/trace/lantern/graph/graph_node_typecheck.stamp +0 -0
  461. package/models/trace/lantern/lantern.js +10 -0
  462. package/models/trace/lantern/lantern.js.map +1 -0
  463. package/models/trace/lantern/metrics/FirstContentfulPaint.js +137 -0
  464. package/models/trace/lantern/metrics/FirstContentfulPaint.js.map +1 -0
  465. package/models/trace/lantern/metrics/Interactive.js +68 -0
  466. package/models/trace/lantern/metrics/Interactive.js.map +1 -0
  467. package/models/trace/lantern/metrics/LargestContentfulPaint.js +75 -0
  468. package/models/trace/lantern/metrics/LargestContentfulPaint.js.map +1 -0
  469. package/models/trace/lantern/metrics/MaxPotentialFID.js +49 -0
  470. package/models/trace/lantern/metrics/MaxPotentialFID.js.map +1 -0
  471. package/models/trace/lantern/metrics/Metric.js +69 -0
  472. package/models/trace/lantern/metrics/Metric.js.map +1 -0
  473. package/models/trace/lantern/metrics/SpeedIndex.js +102 -0
  474. package/models/trace/lantern/metrics/SpeedIndex.js.map +1 -0
  475. package/models/trace/lantern/metrics/TBTUtils.js +65 -0
  476. package/models/trace/lantern/metrics/TBTUtils.js.map +1 -0
  477. package/models/trace/lantern/metrics/TotalBlockingTime.js +79 -0
  478. package/models/trace/lantern/metrics/TotalBlockingTime.js.map +1 -0
  479. package/models/trace/lantern/metrics/bundle-tsconfig.json +59 -0
  480. package/models/trace/lantern/metrics/bundle-tsconfig.ref.json +27 -0
  481. package/models/trace/lantern/metrics/foundation_unittests-tsconfig.json +76 -0
  482. package/models/trace/lantern/metrics/foundation_unittests-tsconfig.ref.json +43 -0
  483. package/models/trace/lantern/metrics/foundation_unittests_node_typecheck-tsconfig.json +72 -0
  484. package/models/trace/lantern/metrics/metrics-tsconfig.json +75 -0
  485. package/models/trace/lantern/metrics/metrics-tsconfig.ref.json +43 -0
  486. package/models/trace/lantern/metrics/metrics.js +12 -0
  487. package/models/trace/lantern/metrics/metrics.js.map +1 -0
  488. package/models/trace/lantern/metrics/metrics_node_typecheck-tsconfig.json +72 -0
  489. package/models/trace/lantern/metrics/metrics_node_typecheck.stamp +0 -0
  490. package/models/trace/lantern/simulation/ConnectionPool.js +116 -0
  491. package/models/trace/lantern/simulation/ConnectionPool.js.map +1 -0
  492. package/models/trace/lantern/simulation/Constants.js +45 -0
  493. package/models/trace/lantern/simulation/Constants.js.map +1 -0
  494. package/models/trace/lantern/simulation/DNSCache.js +48 -0
  495. package/models/trace/lantern/simulation/DNSCache.js.map +1 -0
  496. package/models/trace/lantern/simulation/SimulationTimingMap.js +135 -0
  497. package/models/trace/lantern/simulation/SimulationTimingMap.js.map +1 -0
  498. package/models/trace/lantern/simulation/Simulator.js +457 -0
  499. package/models/trace/lantern/simulation/Simulator.js.map +1 -0
  500. package/models/trace/lantern/simulation/TCPConnection.d.ts +4 -4
  501. package/models/trace/lantern/simulation/TCPConnection.js +155 -0
  502. package/models/trace/lantern/simulation/TCPConnection.js.map +1 -0
  503. package/models/trace/lantern/simulation/bundle-tsconfig.json +59 -0
  504. package/models/trace/lantern/simulation/bundle-tsconfig.ref.json +27 -0
  505. package/models/trace/lantern/simulation/foundation_unittests-tsconfig.json +75 -0
  506. package/models/trace/lantern/simulation/foundation_unittests-tsconfig.ref.json +42 -0
  507. package/models/trace/lantern/simulation/foundation_unittests_node_typecheck-tsconfig.json +71 -0
  508. package/models/trace/lantern/simulation/simulation-tsconfig.json +70 -0
  509. package/models/trace/lantern/simulation/simulation-tsconfig.ref.json +38 -0
  510. package/models/trace/lantern/simulation/simulation.js +10 -0
  511. package/models/trace/lantern/simulation/simulation.js.map +1 -0
  512. package/models/trace/lantern/simulation/simulation_node_typecheck-tsconfig.json +67 -0
  513. package/models/trace/lantern/simulation/simulation_node_typecheck.stamp +0 -0
  514. package/models/trace/lantern/testing/bundle-tsconfig.json +60 -0
  515. package/models/trace/lantern/testing/bundle-tsconfig.ref.json +27 -0
  516. package/models/trace/lantern/testing/testing-tsconfig.json +63 -0
  517. package/models/trace/lantern/testing/testing-tsconfig.ref.json +30 -0
  518. package/models/trace/lantern/types/Lantern.d.ts +34 -19
  519. package/models/trace/lantern/types/Lantern.js +25 -0
  520. package/models/trace/lantern/types/Lantern.js.map +1 -0
  521. package/models/trace/lantern/types/bundle-tsconfig.json +59 -0
  522. package/models/trace/lantern/types/bundle-tsconfig.ref.json +27 -0
  523. package/models/trace/lantern/types/types-tsconfig.json +59 -0
  524. package/models/trace/lantern/types/types-tsconfig.ref.json +27 -0
  525. package/models/trace/lantern/types/types.js +5 -0
  526. package/models/trace/lantern/types/types.js.map +1 -0
  527. package/models/trace/lantern/types/types_node_typecheck-tsconfig.json +56 -0
  528. package/models/trace/lantern/types/types_node_typecheck.stamp +0 -0
  529. package/models/trace/trace-tsconfig.json +89 -0
  530. package/models/trace/trace-tsconfig.ref.json +57 -0
  531. package/models/trace/trace.js +16 -544
  532. package/models/trace/trace.js.map +1 -0
  533. package/models/trace/trace_node_typecheck-tsconfig.json +86 -0
  534. package/models/trace/trace_node_typecheck.stamp +0 -0
  535. package/models/trace/types/Configuration.d.ts +2 -2
  536. package/models/trace/types/Configuration.js +19 -0
  537. package/models/trace/types/Configuration.js.map +1 -0
  538. package/models/trace/types/Extensions.d.ts +1 -1
  539. package/models/trace/types/Extensions.js +38 -0
  540. package/models/trace/types/Extensions.js.map +1 -0
  541. package/models/trace/types/File.d.ts +9 -3
  542. package/models/trace/types/File.js +92 -0
  543. package/models/trace/types/File.js.map +1 -0
  544. package/models/trace/types/Overlays.d.ts +4 -3
  545. package/models/trace/types/Overlays.js +5 -0
  546. package/models/trace/types/Overlays.js.map +1 -0
  547. package/models/trace/types/Timing.js +16 -0
  548. package/models/trace/types/Timing.js.map +1 -0
  549. package/models/trace/types/TraceEvents.d.ts +205 -140
  550. package/models/trace/types/TraceEvents.js +983 -0
  551. package/models/trace/types/TraceEvents.js.map +1 -0
  552. package/models/trace/types/bundle-tsconfig.json +59 -0
  553. package/models/trace/types/bundle-tsconfig.ref.json +27 -0
  554. package/models/trace/types/foundation_unittests-tsconfig.json +67 -0
  555. package/models/trace/types/foundation_unittests-tsconfig.ref.json +34 -0
  556. package/models/trace/types/foundation_unittests_node_typecheck-tsconfig.json +63 -0
  557. package/models/trace/types/types-tsconfig.json +76 -0
  558. package/models/trace/types/types-tsconfig.ref.json +44 -0
  559. package/models/trace/types/types.js +10 -0
  560. package/models/trace/types/types.js.map +1 -0
  561. package/models/trace/types/types_node_typecheck-tsconfig.json +73 -0
  562. package/models/trace/types/types_node_typecheck.stamp +0 -0
  563. package/package.json +8 -37
  564. package/test/invalid-animation-events.json.gz +0 -0
  565. package/test/test-trace-engine.mjs +191 -0
  566. package/third_party/legacy-javascript/bundle-tsconfig.json +59 -0
  567. package/third_party/legacy-javascript/bundle-tsconfig.ref.json +27 -0
  568. package/third_party/legacy-javascript/legacy-javascript-tsconfig.ref.json +15 -0
  569. package/third_party/legacy-javascript/legacy-javascript.js +3 -0
  570. package/third_party/legacy-javascript/legacy-javascript.js.map +1 -0
  571. package/third_party/legacy-javascript/lib/legacy-javascript.js +1119 -0
  572. package/third_party/marked/marked.d.ts +1 -0
  573. package/third_party/marked/marked.js +1 -0
  574. package/third_party/third-party-web/third-party-web.d.ts +1 -2
  575. package/third_party/third-party-web/third-party-web.js +1 -0
  576. package/tsconfig.json +29 -0
  577. package/core/common/Base64.d.ts +0 -12
  578. package/core/common/CharacterIdMap.d.ts +0 -5
  579. package/core/common/Color.d.ts +0 -357
  580. package/core/common/ColorConverter.d.ts +0 -26
  581. package/core/common/ColorUtils.d.ts +0 -45
  582. package/core/common/Console.d.ts +0 -54
  583. package/core/common/Debouncer.d.ts +0 -8
  584. package/core/common/EventTarget.d.ts +0 -22
  585. package/core/common/Gzip.d.ts +0 -23
  586. package/core/common/JavaScriptMetaData.d.ts +0 -20
  587. package/core/common/Lazy.d.ts +0 -4
  588. package/core/common/MapWithDefault.d.ts +0 -9
  589. package/core/common/Mutex.d.ts +0 -13
  590. package/core/common/Object.d.ts +0 -20
  591. package/core/common/Progress.d.ts +0 -47
  592. package/core/common/ResolverBase.d.ts +0 -29
  593. package/core/common/ResourceType.d.ts +0 -52
  594. package/core/common/ReturnToPanel.d.ts +0 -10
  595. package/core/common/Revealer.d.ts +0 -66
  596. package/core/common/Runnable.d.ts +0 -14
  597. package/core/common/SegmentedRange.d.ts +0 -14
  598. package/core/common/SettingRegistration.d.ts +0 -136
  599. package/core/common/Settings.d.ts +0 -226
  600. package/core/common/SimpleHistoryManager.d.ts +0 -20
  601. package/core/common/Srcset.d.ts +0 -16
  602. package/core/common/StringOutputStream.d.ts +0 -10
  603. package/core/common/TextDictionary.d.ts +0 -11
  604. package/core/common/Throttler.d.ts +0 -12
  605. package/core/common/Trie.d.ts +0 -24
  606. package/core/common/VersionController.d.ts +0 -85
  607. package/core/host/AidaClient.d.ts +0 -73
  608. package/core/host/AidaClientTypes.d.ts +0 -355
  609. package/core/host/AidaGcaTranslation.d.ts +0 -10
  610. package/core/host/DispatchHttpRequestClient.d.ts +0 -14
  611. package/core/host/GcaClient.d.ts +0 -14
  612. package/core/host/GcaTypes.d.ts +0 -411
  613. package/core/host/GdpClient.d.ts +0 -84
  614. package/core/host/InspectorFrontendHost.d.ts +0 -29
  615. package/core/host/InspectorFrontendHostAPI.d.ts +0 -425
  616. package/core/host/InspectorFrontendHostStub.d.ts +0 -151
  617. package/core/host/Platform.d.ts +0 -11
  618. package/core/host/ResourceLoader.d.ts +0 -15
  619. package/core/host/UserMetrics.d.ts +0 -116
  620. package/core/host/UserMetricsEnums.d.ts +0 -883
  621. package/core/i18n/ByteUtilities.d.ts +0 -11
  622. package/core/i18n/DevToolsLocale.d.ts +0 -41
  623. package/core/i18n/NumberFormatter.d.ts +0 -11
  624. package/core/i18n/i18nImpl.d.ts +0 -64
  625. package/core/i18n/i18nTypes.d.ts +0 -5
  626. package/core/i18n/locales.d.ts +0 -15
  627. package/core/i18n/time-utilities.d.ts +0 -16
  628. package/core/platform/browser/HostRuntime.d.ts +0 -2
  629. package/core/platform/browser/browser.d.ts +0 -2
  630. package/core/platform/node/HostRuntime.d.ts +0 -2
  631. package/core/platform/node/node.d.ts +0 -2
  632. package/core/protocol_client/CDPConnection.d.ts +0 -77
  633. package/core/protocol_client/ConnectionTransport.d.ts +0 -9
  634. package/core/protocol_client/DevToolsCDPConnection.d.ts +0 -16
  635. package/core/protocol_client/InspectorBackend.d.ts +0 -223
  636. package/core/protocol_client/protocol_client.d.ts +0 -5
  637. package/core/root/DevToolsContext.d.ts +0 -34
  638. package/core/root/ExperimentNames.d.ts +0 -8
  639. package/core/root/Runtime.d.ts +0 -351
  640. package/core/sdk/AccessibilityModel.d.ts +0 -76
  641. package/core/sdk/AnimationModel.d.ts +0 -161
  642. package/core/sdk/AutofillModel.d.ts +0 -23
  643. package/core/sdk/CPUProfilerModel.d.ts +0 -46
  644. package/core/sdk/CPUThrottlingManager.d.ts +0 -47
  645. package/core/sdk/CSSContainerQuery.d.ts +0 -42
  646. package/core/sdk/CSSFontFace.d.ts +0 -10
  647. package/core/sdk/CSSLayer.d.ts +0 -9
  648. package/core/sdk/CSSLocation.d.ts +0 -14
  649. package/core/sdk/CSSMatchedStyles.d.ts +0 -138
  650. package/core/sdk/CSSMedia.d.ts +0 -36
  651. package/core/sdk/CSSMetadata.d.ts +0 -87
  652. package/core/sdk/CSSModel.d.ts +0 -180
  653. package/core/sdk/CSSNavigation.d.ts +0 -10
  654. package/core/sdk/CSSProperty.d.ts +0 -53
  655. package/core/sdk/CSSPropertyParser.d.ts +0 -131
  656. package/core/sdk/CSSPropertyParserMatchers.d.ts +0 -442
  657. package/core/sdk/CSSQuery.d.ts +0 -22
  658. package/core/sdk/CSSRule.d.ts +0 -132
  659. package/core/sdk/CSSScope.d.ts +0 -9
  660. package/core/sdk/CSSStartingStyle.d.ts +0 -9
  661. package/core/sdk/CSSStyleDeclaration.d.ts +0 -38
  662. package/core/sdk/CSSStyleSheetHeader.d.ts +0 -53
  663. package/core/sdk/CSSSupports.d.ts +0 -10
  664. package/core/sdk/CategorizedBreakpoint.d.ts +0 -42
  665. package/core/sdk/ChildTargetManager.d.ts +0 -40
  666. package/core/sdk/CompilerSourceMappingContentProvider.d.ts +0 -12
  667. package/core/sdk/Connections.d.ts +0 -36
  668. package/core/sdk/ConsoleModel.d.ts +0 -127
  669. package/core/sdk/ConsoleModelTypes.d.ts +0 -6
  670. package/core/sdk/Cookie.d.ts +0 -68
  671. package/core/sdk/CookieModel.d.ts +0 -31
  672. package/core/sdk/CookieParser.d.ts +0 -14
  673. package/core/sdk/CrashReportContextModel.d.ts +0 -8
  674. package/core/sdk/DOMDebuggerModel.d.ts +0 -127
  675. package/core/sdk/DOMModel.d.ts +0 -436
  676. package/core/sdk/DOMStorageModel.d.ts +0 -79
  677. package/core/sdk/DebuggerModel.d.ts +0 -272
  678. package/core/sdk/EmulationModel.d.ts +0 -95
  679. package/core/sdk/EnhancedTracesParser.d.ts +0 -105
  680. package/core/sdk/EventBreakpointsModel.d.ts +0 -66
  681. package/core/sdk/FrameAssociated.d.ts +0 -6
  682. package/core/sdk/FrameManager.d.ts +0 -68
  683. package/core/sdk/HeapProfilerModel.d.ts +0 -75
  684. package/core/sdk/HttpReasonPhraseStrings.d.ts +0 -5
  685. package/core/sdk/IOModel.d.ts +0 -10
  686. package/core/sdk/IsolateManager.d.ts +0 -53
  687. package/core/sdk/IssuesModel.d.ts +0 -28
  688. package/core/sdk/LayerTreeBase.d.ts +0 -70
  689. package/core/sdk/LogModel.d.ts +0 -20
  690. package/core/sdk/NetworkManager.d.ts +0 -418
  691. package/core/sdk/NetworkRequest.d.ts +0 -469
  692. package/core/sdk/NetworkRequestAccess.d.ts +0 -91
  693. package/core/sdk/OverlayColorGenerator.d.ts +0 -14
  694. package/core/sdk/OverlayModel.d.ts +0 -186
  695. package/core/sdk/OverlayPersistentHighlighter.d.ts +0 -116
  696. package/core/sdk/PageFunctions.d.ts +0 -22
  697. package/core/sdk/PageLoad.d.ts +0 -14
  698. package/core/sdk/PageResourceLoader.d.ts +0 -111
  699. package/core/sdk/PaintProfiler.d.ts +0 -43
  700. package/core/sdk/PerformanceMetricsModel.d.ts +0 -12
  701. package/core/sdk/PreloadingModel.d.ts +0 -146
  702. package/core/sdk/RehydratingConnection.d.ts +0 -73
  703. package/core/sdk/RehydratingObject.d.ts +0 -59
  704. package/core/sdk/RemoteObject.d.ts +0 -210
  705. package/core/sdk/Resource.d.ts +0 -36
  706. package/core/sdk/ResourceTreeModel.d.ts +0 -278
  707. package/core/sdk/RuntimeModel.d.ts +0 -163
  708. package/core/sdk/SDKModel.d.ts +0 -30
  709. package/core/sdk/SDKSettings.d.ts +0 -53
  710. package/core/sdk/ScopeTreeCache.d.ts +0 -21
  711. package/core/sdk/ScreenCaptureModel.d.ts +0 -69
  712. package/core/sdk/Script.d.ts +0 -134
  713. package/core/sdk/SecurityOrigin.d.ts +0 -108
  714. package/core/sdk/SecurityOriginManager.d.ts +0 -23
  715. package/core/sdk/ServerSentEvents.d.ts +0 -18
  716. package/core/sdk/ServerSentEventsProtocol.d.ts +0 -18
  717. package/core/sdk/ServerTiming.d.ts +0 -24
  718. package/core/sdk/ServiceWorkerCacheModel.d.ts +0 -71
  719. package/core/sdk/ServiceWorkerManager.d.ts +0 -125
  720. package/core/sdk/SourceMap.d.ts +0 -197
  721. package/core/sdk/SourceMapCache.d.ts +0 -12
  722. package/core/sdk/SourceMapFunctionRanges.d.ts +0 -26
  723. package/core/sdk/SourceMapManager.d.ts +0 -46
  724. package/core/sdk/SourceMapRangeMappings.d.ts +0 -15
  725. package/core/sdk/SourceMapScopeChainEntry.d.ts +0 -23
  726. package/core/sdk/SourceMapScopesInfo.d.ts +0 -109
  727. package/core/sdk/StorageBucketsModel.d.ts +0 -48
  728. package/core/sdk/StorageKeyManager.d.ts +0 -38
  729. package/core/sdk/Target.d.ts +0 -79
  730. package/core/sdk/TargetManager.d.ts +0 -92
  731. package/core/sdk/TraceObject.d.ts +0 -43
  732. package/core/sdk/WebAuthnModel.d.ts +0 -29
  733. package/core/text_utils/CodeMirrorUtils.d.ts +0 -3
  734. package/core/text_utils/ContentData.d.ts +0 -94
  735. package/core/text_utils/ContentProvider.d.ts +0 -42
  736. package/core/text_utils/StaticContentProvider.d.ts +0 -13
  737. package/core/text_utils/StreamingContentData.d.ts +0 -49
  738. package/core/text_utils/Text.d.ts +0 -19
  739. package/core/text_utils/TextCursor.d.ts +0 -9
  740. package/core/text_utils/TextRange.d.ts +0 -81
  741. package/core/text_utils/TextUtils.d.ts +0 -97
  742. package/core/text_utils/WasmDisassembly.d.ts +0 -29
  743. package/core/text_utils/text_utils.d.ts +0 -11
  744. package/entrypoints/formatter_actions/formatter_actions.d.ts +0 -48
  745. package/generated/InspectorBackendCommands.d.ts +0 -14
  746. package/generated/SupportedCSSProperties.d.ts +0 -18
  747. package/generated/protocol-mapping.d.ts +0 -5930
  748. package/generated/protocol-proxy-api.d.ts +0 -5396
  749. package/index.d.ts +0 -2
  750. package/index.js +0 -6
  751. package/models/crux-manager/CrUXManager.d.ts +0 -107
  752. package/models/emulation/DeviceModeModel.d.ts +0 -156
  753. package/models/emulation/EmulatedDevices.d.ts +0 -148
  754. package/models/emulation/emulation.d.ts +0 -3
  755. package/models/formatter/FormatterWorkerPool.d.ts +0 -58
  756. package/models/formatter/ScriptFormatter.d.ts +0 -11
  757. package/models/formatter/formatter.d.ts +0 -3
  758. package/third_party/codemirror.next/codemirror.next.d.ts +0 -9196
  759. package/third_party/i18n/i18n-impl.d.ts +0 -25
  760. package/third_party/i18n/i18n.d.ts +0 -3
  761. package/third_party/i18n/localized-string-set.d.ts +0 -49
  762. package/third_party/intl-messageformat/intl-messageformat.d.ts +0 -1
  763. package/third_party/source-map-scopes-codec/package/src/builder/builder.d.ts +0 -67
  764. package/third_party/source-map-scopes-codec/package/src/builder/safe_builder.d.ts +0 -38
  765. package/third_party/source-map-scopes-codec/package/src/codec.d.ts +0 -48
  766. package/third_party/source-map-scopes-codec/package/src/decode/decode.d.ts +0 -31
  767. package/third_party/source-map-scopes-codec/package/src/encode/encode.d.ts +0 -8
  768. package/third_party/source-map-scopes-codec/package/src/encode/encoder.d.ts +0 -6
  769. package/third_party/source-map-scopes-codec/package/src/mod.d.ts +0 -5
  770. package/third_party/source-map-scopes-codec/package/src/scopes.d.ts +0 -168
  771. package/third_party/source-map-scopes-codec/package/src/util.d.ts +0 -5
  772. package/third_party/source-map-scopes-codec/package/src/vlq.d.ts +0 -14
  773. package/third_party/source-map-scopes-codec/source-map-scopes-codec.d.ts +0 -1
  774. package/third_party/third-party-web/lib/nostats-subset.d.ts +0 -2
  775. package/third_party/third-party-web/package/lib/index.d.ts +0 -34
  776. package/third_party/third-party-web/package/lib/subsets/nostats.d.ts +0 -1
@@ -0,0 +1,130 @@
1
+ // Copyright 2024 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ import * as i18n from '../../../core/i18n/i18n.js';
5
+ import * as Handlers from '../handlers/handlers.js';
6
+ import * as Helpers from '../helpers/helpers.js';
7
+ import { InsightCategory, InsightKeys, } from './types.js';
8
+ export const UIStrings = {
9
+ /**
10
+ * @description Text to tell the user about the longest user interaction.
11
+ */
12
+ description: 'Start investigating [how to improve INP](https://developer.chrome.com/docs/performance/insights/inp-breakdown) by looking at the longest subpart',
13
+ /**
14
+ * @description Title for the performance insight "INP breakdown", which shows a breakdown of INP by subparts / sections.
15
+ */
16
+ title: 'INP breakdown',
17
+ /**
18
+ * @description Label used for the subpart/component/stage/section of a larger duration.
19
+ */
20
+ subpart: 'Subpart',
21
+ /**
22
+ * @description Label used for a time duration.
23
+ */
24
+ duration: 'Duration',
25
+ // TODO: these are repeated in InteractionBreakdown. Add a place for common strings?
26
+ /**
27
+ * @description Text shown next to the interaction event's input delay time in the detail view.
28
+ */
29
+ inputDelay: 'Input delay',
30
+ /**
31
+ * @description Text shown next to the interaction event's thread processing duration in the detail view.
32
+ */
33
+ processingDuration: 'Processing duration',
34
+ /**
35
+ * @description Text shown next to the interaction event's presentation delay time in the detail view.
36
+ */
37
+ presentationDelay: 'Presentation delay',
38
+ /**
39
+ * @description Text status indicating that no user interactions were detected.
40
+ */
41
+ noInteractions: 'No interactions detected',
42
+ };
43
+ const str_ = i18n.i18n.registerUIStrings('models/trace/insights/INPBreakdown.ts', UIStrings);
44
+ export const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
45
+ export function isINPBreakdownInsight(insight) {
46
+ return insight.insightKey === InsightKeys.INP_BREAKDOWN;
47
+ }
48
+ function finalize(partialModel) {
49
+ let state = 'pass';
50
+ if (partialModel.longestInteractionEvent) {
51
+ const classification = Handlers.ModelHandlers.UserInteractions.scoreClassificationForInteractionToNextPaint(partialModel.longestInteractionEvent.dur);
52
+ if (classification === Handlers.ModelHandlers.PageLoadMetrics.ScoreClassification.GOOD) {
53
+ state = 'informative';
54
+ }
55
+ else {
56
+ state = 'fail';
57
+ }
58
+ }
59
+ return {
60
+ insightKey: InsightKeys.INP_BREAKDOWN,
61
+ strings: UIStrings,
62
+ title: i18nString(UIStrings.title),
63
+ description: i18nString(UIStrings.description),
64
+ docs: 'https://developer.chrome.com/docs/performance/insights/inp-breakdown',
65
+ category: InsightCategory.INP,
66
+ state,
67
+ ...partialModel,
68
+ };
69
+ }
70
+ export function generateInsight(data, context) {
71
+ const interactionEvents = data.UserInteractions.interactionEventsWithNoNesting.filter(event => {
72
+ return Helpers.Timing.eventIsInBounds(event, context.bounds);
73
+ });
74
+ if (!interactionEvents.length) {
75
+ // A valid result, when there is no user interaction.
76
+ return finalize({});
77
+ }
78
+ const longestByInteractionId = new Map();
79
+ for (const event of interactionEvents) {
80
+ const key = event.interactionId;
81
+ const longest = longestByInteractionId.get(key);
82
+ if (!longest || event.dur > longest.dur) {
83
+ longestByInteractionId.set(key, event);
84
+ }
85
+ }
86
+ const normalizedInteractionEvents = [...longestByInteractionId.values()];
87
+ normalizedInteractionEvents.sort((a, b) => b.dur - a.dur);
88
+ // INP is the "nearest-rank"/inverted_cdf 98th percentile, except Chrome only
89
+ // keeps the 10 worst events around, so it can never be more than the 10th from
90
+ // last array element. To keep things simpler, sort desc and pick from front.
91
+ // See https://source.chromium.org/chromium/chromium/src/+/main:components/page_load_metrics/browser/responsiveness_metrics_normalization.cc;l=45-59;drc=cb0f9c8b559d9c7c3cb4ca94fc1118cc015d38ad
92
+ const highPercentileIndex = Math.min(9, Math.floor(normalizedInteractionEvents.length / 50));
93
+ return finalize({
94
+ relatedEvents: [normalizedInteractionEvents[0]],
95
+ longestInteractionEvent: normalizedInteractionEvents[0],
96
+ highPercentileInteractionEvent: normalizedInteractionEvents[highPercentileIndex],
97
+ });
98
+ }
99
+ /**
100
+ * If `subpart` is -1, then all subparts are included. Otherwise it's just that index.
101
+ **/
102
+ export function createOverlaysForSubpart(event, subpartIndex = -1) {
103
+ const p1 = Helpers.Timing.traceWindowFromMicroSeconds(event.ts, (event.ts + event.inputDelay));
104
+ const p2 = Helpers.Timing.traceWindowFromMicroSeconds(p1.max, (p1.max + event.mainThreadHandling));
105
+ const p3 = Helpers.Timing.traceWindowFromMicroSeconds(p2.max, (p2.max + event.presentationDelay));
106
+ let sections = [
107
+ { bounds: p1, label: i18nString(UIStrings.inputDelay), showDuration: true },
108
+ { bounds: p2, label: i18nString(UIStrings.processingDuration), showDuration: true },
109
+ { bounds: p3, label: i18nString(UIStrings.presentationDelay), showDuration: true },
110
+ ];
111
+ if (subpartIndex !== -1) {
112
+ sections = [sections[subpartIndex]];
113
+ }
114
+ return [
115
+ {
116
+ type: 'TIMESPAN_BREAKDOWN',
117
+ sections,
118
+ renderLocation: 'BELOW_EVENT',
119
+ entry: event,
120
+ },
121
+ ];
122
+ }
123
+ export function createOverlays(model) {
124
+ const event = model.longestInteractionEvent;
125
+ if (!event) {
126
+ return [];
127
+ }
128
+ return createOverlaysForSubpart(event);
129
+ }
130
+ //# sourceMappingURL=INPBreakdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"INPBreakdown.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/INPBreakdown.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AACnD,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EACL,eAAe,EACf,WAAW,GAIZ,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;;OAEG;IACH,WAAW,EACP,kJAAkJ;IACtJ;;OAEG;IACH,KAAK,EAAE,eAAe;IACtB;;OAEG;IACH,OAAO,EAAE,SAAS;IAClB;;OAEG;IACH,QAAQ,EAAE,UAAU;IAEpB,oFAAoF;IACpF;;OAEG;IACH,UAAU,EAAE,aAAa;IACzB;;OAEG;IACH,kBAAkB,EAAE,qBAAqB;IACzC;;OAEG;IAC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AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAA+B;IAC5D,MAAM,KAAK,GAAG,KAAK,CAAC,uBAAuB,CAAC;IAC5C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,wBAAwB,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as i18n from '../../../core/i18n/i18n.js';\nimport * as Handlers from '../handlers/handlers.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport type * as Types from '../types/types.js';\n\nimport {\n InsightCategory,\n InsightKeys,\n type InsightModel,\n type InsightSetContext,\n type PartialInsightModel,\n} from './types.js';\n\nexport const UIStrings = {\n /**\n * @description Text to tell the user about the longest user interaction.\n */\n description:\n 'Start investigating [how to improve INP](https://developer.chrome.com/docs/performance/insights/inp-breakdown) by looking at the longest subpart',\n /**\n * @description Title for the performance insight \"INP breakdown\", which shows a breakdown of INP by subparts / sections.\n */\n title: 'INP breakdown',\n /**\n * @description Label used for the subpart/component/stage/section of a larger duration.\n */\n subpart: 'Subpart',\n /**\n * @description Label used for a time duration.\n */\n duration: 'Duration',\n\n // TODO: these are repeated in InteractionBreakdown. Add a place for common strings?\n /**\n * @description Text shown next to the interaction event's input delay time in the detail view.\n */\n inputDelay: 'Input delay',\n /**\n * @description Text shown next to the interaction event's thread processing duration in the detail view.\n */\n processingDuration: 'Processing duration',\n /**\n * @description Text shown next to the interaction event's presentation delay time in the detail view.\n */\n presentationDelay: 'Presentation delay',\n /**\n * @description Text status indicating that no user interactions were detected.\n */\n noInteractions: 'No interactions detected',\n} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/INPBreakdown.ts', UIStrings);\nexport const i18nString: i18n.LocalizeString = i18n.i18n.getLocalizedString.bind(undefined, str_);\n\nexport type INPBreakdownInsightModel = InsightModel<typeof UIStrings, {\n longestInteractionEvent?: Types.Events.SyntheticInteractionPair,\n highPercentileInteractionEvent?: Types.Events.SyntheticInteractionPair,\n}>;\n\nexport function isINPBreakdownInsight(insight: InsightModel): insight is INPBreakdownInsightModel {\n return insight.insightKey === InsightKeys.INP_BREAKDOWN;\n}\n\nfunction finalize(partialModel: PartialInsightModel<INPBreakdownInsightModel>): INPBreakdownInsightModel {\n let state: INPBreakdownInsightModel['state'] = 'pass';\n if (partialModel.longestInteractionEvent) {\n const classification = Handlers.ModelHandlers.UserInteractions.scoreClassificationForInteractionToNextPaint(\n partialModel.longestInteractionEvent.dur);\n if (classification === Handlers.ModelHandlers.PageLoadMetrics.ScoreClassification.GOOD) {\n state = 'informative';\n } else {\n state = 'fail';\n }\n }\n\n return {\n insightKey: InsightKeys.INP_BREAKDOWN,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n docs: 'https://developer.chrome.com/docs/performance/insights/inp-breakdown',\n category: InsightCategory.INP,\n state,\n ...partialModel,\n };\n}\n\nexport function generateInsight(\n data: Handlers.Types.HandlerData, context: InsightSetContext): INPBreakdownInsightModel {\n const interactionEvents = data.UserInteractions.interactionEventsWithNoNesting.filter(event => {\n return Helpers.Timing.eventIsInBounds(event, context.bounds);\n });\n\n if (!interactionEvents.length) {\n // A valid result, when there is no user interaction.\n return finalize({});\n }\n\n const longestByInteractionId = new Map<number, Types.Events.SyntheticInteractionPair>();\n for (const event of interactionEvents) {\n const key = event.interactionId;\n const longest = longestByInteractionId.get(key);\n if (!longest || event.dur > longest.dur) {\n longestByInteractionId.set(key, event);\n }\n }\n const normalizedInteractionEvents = [...longestByInteractionId.values()];\n normalizedInteractionEvents.sort((a, b) => b.dur - a.dur);\n\n // INP is the \"nearest-rank\"/inverted_cdf 98th percentile, except Chrome only\n // keeps the 10 worst events around, so it can never be more than the 10th from\n // last array element. To keep things simpler, sort desc and pick from front.\n // See https://source.chromium.org/chromium/chromium/src/+/main:components/page_load_metrics/browser/responsiveness_metrics_normalization.cc;l=45-59;drc=cb0f9c8b559d9c7c3cb4ca94fc1118cc015d38ad\n const highPercentileIndex = Math.min(9, Math.floor(normalizedInteractionEvents.length / 50));\n\n return finalize({\n relatedEvents: [normalizedInteractionEvents[0]],\n longestInteractionEvent: normalizedInteractionEvents[0],\n highPercentileInteractionEvent: normalizedInteractionEvents[highPercentileIndex],\n });\n}\n\n/**\n * If `subpart` is -1, then all subparts are included. Otherwise it's just that index.\n **/\nexport function createOverlaysForSubpart(\n event: Types.Events.SyntheticInteractionPair, subpartIndex = -1): Types.Overlays.Overlay[] {\n const p1 = Helpers.Timing.traceWindowFromMicroSeconds(\n event.ts,\n (event.ts + event.inputDelay) as Types.Timing.Micro,\n );\n const p2 = Helpers.Timing.traceWindowFromMicroSeconds(\n p1.max,\n (p1.max + event.mainThreadHandling) as Types.Timing.Micro,\n );\n const p3 = Helpers.Timing.traceWindowFromMicroSeconds(\n p2.max,\n (p2.max + event.presentationDelay) as Types.Timing.Micro,\n );\n let sections = [\n {bounds: p1, label: i18nString(UIStrings.inputDelay), showDuration: true},\n {bounds: p2, label: i18nString(UIStrings.processingDuration), showDuration: true},\n {bounds: p3, label: i18nString(UIStrings.presentationDelay), showDuration: true},\n ];\n if (subpartIndex !== -1) {\n sections = [sections[subpartIndex]];\n }\n\n return [\n {\n type: 'TIMESPAN_BREAKDOWN',\n sections,\n renderLocation: 'BELOW_EVENT',\n entry: event,\n },\n ];\n}\n\nexport function createOverlays(model: INPBreakdownInsightModel): Types.Overlays.Overlay[] {\n const event = model.longestInteractionEvent;\n if (!event) {\n return [];\n }\n\n return createOverlaysForSubpart(event);\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import * as i18n from '../../../core/i18n/i18n.js';
2
+ import type * as Platform from '../../../core/platform/platform.js';
2
3
  import type * as Handlers from '../handlers/handlers.js';
3
4
  import type * as Types from '../types/types.js';
4
5
  import { type InsightModel, type InsightSetContext } from './types.js';
@@ -6,48 +7,48 @@ export declare const UIStrings: {
6
7
  /**
7
8
  * @description Title of an insight that recommends ways to reduce the size of images downloaded and used on the page.
8
9
  */
9
- readonly title: "Improve image delivery";
10
+ readonly title: 'Improve image delivery';
10
11
  /**
11
12
  * @description Description of an insight that recommends ways to reduce the size of images downloaded and used on the page.
12
13
  */
13
- readonly description: "Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).";
14
+ readonly description: 'Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).';
14
15
  /**
15
16
  * @description Message displayed in a chip explaining that an image file size is large for the # of pixels it has and recommends possible adjustments to improve the image size.
16
17
  */
17
- readonly useCompression: "Increasing the image compression factor could improve this image’s download size";
18
+ readonly useCompression: 'Increasing the image compression factor could improve this image’s download size';
18
19
  /**
19
20
  * @description Message displayed in a chip explaining that an image file size is large for the # of pixels it has and recommends possible adjustments to improve the image size.
20
21
  */
21
- readonly useModernFormat: "Using a modern image format (WebP, AVIF) or increasing the image compression could improve this image’s download size";
22
+ readonly useModernFormat: 'Using a modern image format (WebP, AVIF) or increasing the image compression could improve this image’s download size';
22
23
  /**
23
24
  * @description Message displayed in a chip advising the user to use video formats instead of GIFs because videos generally have smaller file sizes.
24
25
  */
25
- readonly useVideoFormat: "Using video formats instead of GIFs can improve the download size of animated content";
26
+ readonly useVideoFormat: 'Using video formats instead of GIFs can improve the download size of animated content';
26
27
  /**
27
28
  * @description Message displayed in a chip explaining that an image was displayed on the page with dimensions much smaller than the image file dimensions.
28
29
  * @example {1000x500} PH1
29
30
  * @example {100x50} PH2
30
31
  */
31
- readonly useResponsiveSize: "This image file is larger than it needs to be ({PH1}) for its displayed dimensions ({PH2}). Use responsive images to reduce the image download size.";
32
+ readonly useResponsiveSize: 'This image file is larger than it needs to be ({PH1}) for its displayed dimensions ({PH2}). Use responsive images to reduce the image download size.';
32
33
  /**
33
34
  * @description Column header for a table column containing network requests for images which can improve their file size (e.g. use a different format, increase compression, etc).
34
35
  */
35
- readonly optimizeFile: "Optimize file size";
36
+ readonly optimizeFile: 'Optimize file size';
36
37
  /**
37
38
  * @description Table row value representing the remaining items not shown in the table due to size constraints. This row will always represent at least 2 items.
38
39
  * @example {5} PH1
39
40
  */
40
- readonly others: "{PH1} others";
41
+ readonly others: '{PH1} others';
41
42
  /**
42
43
  * @description Text status indicating that no potential optimizations were found for any image file.
43
44
  */
44
- readonly noOptimizableImages: "No optimizable images";
45
+ readonly noOptimizableImages: 'No optimizable images';
45
46
  /**
46
47
  * @description Text describing the estimated number of bytes that an image file optimization can save. This text is appended to another block of text describing the image optimization in more detail. "Est" means "Estimated".
47
48
  * @example {Use the correct image dimensions to reduce the image file size.} PH1
48
49
  * @example {50 MB} PH2
49
50
  */
50
- readonly estimatedSavings: "{PH1} (Est {PH2})";
51
+ readonly estimatedSavings: '{PH1} (Est {PH2})';
51
52
  };
52
53
  export declare const i18nString: i18n.LocalizeString;
53
54
  export declare enum ImageOptimizationType {
@@ -89,8 +90,8 @@ export type ImageDeliveryInsightModel = InsightModel<typeof UIStrings, {
89
90
  wastedBytes: number;
90
91
  }>;
91
92
  export declare function isImageDeliveryInsight(model: InsightModel): model is ImageDeliveryInsightModel;
92
- export declare function getOptimizationMessage(optimization: ImageOptimization): {i18nId: string, values: Record<string, string|number>, formattedDefault: string};
93
- export declare function getOptimizationMessageWithBytes(optimization: ImageOptimization): {i18nId: string, values: Record<string, string|number>, formattedDefault: string};
93
+ export declare function getOptimizationMessage(optimization: ImageOptimization): Platform.UIString.LocalizedString;
94
+ export declare function getOptimizationMessageWithBytes(optimization: ImageOptimization): Platform.UIString.LocalizedString;
94
95
  export declare function generateInsight(data: Handlers.Types.HandlerData, context: InsightSetContext): ImageDeliveryInsightModel;
95
96
  export declare function createOverlayForRequest(request: Types.Events.SyntheticNetworkRequest): Types.Overlays.EntryOutline;
96
97
  export declare function createOverlays(model: ImageDeliveryInsightModel): Types.Overlays.Overlay[];
@@ -0,0 +1,264 @@
1
+ // Copyright 2024 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ import * as i18n from '../../../core/i18n/i18n.js';
5
+ import * as Helpers from '../helpers/helpers.js';
6
+ import { metricSavingsForWastedBytes } from './Common.js';
7
+ import { InsightCategory, InsightKeys, } from './types.js';
8
+ export const UIStrings = {
9
+ /**
10
+ * @description Title of an insight that recommends ways to reduce the size of images downloaded and used on the page.
11
+ */
12
+ title: 'Improve image delivery',
13
+ /**
14
+ * @description Description of an insight that recommends ways to reduce the size of images downloaded and used on the page.
15
+ */
16
+ description: 'Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).',
17
+ /**
18
+ * @description Message displayed in a chip explaining that an image file size is large for the # of pixels it has and recommends possible adjustments to improve the image size.
19
+ */
20
+ useCompression: 'Increasing the image compression factor could improve this image’s download size',
21
+ /**
22
+ * @description Message displayed in a chip explaining that an image file size is large for the # of pixels it has and recommends possible adjustments to improve the image size.
23
+ */
24
+ useModernFormat: 'Using a modern image format (WebP, AVIF) or increasing the image compression could improve this image’s download size',
25
+ /**
26
+ * @description Message displayed in a chip advising the user to use video formats instead of GIFs because videos generally have smaller file sizes.
27
+ */
28
+ useVideoFormat: 'Using video formats instead of GIFs can improve the download size of animated content',
29
+ /**
30
+ * @description Message displayed in a chip explaining that an image was displayed on the page with dimensions much smaller than the image file dimensions.
31
+ * @example {1000x500} PH1
32
+ * @example {100x50} PH2
33
+ */
34
+ useResponsiveSize: 'This image file is larger than it needs to be ({PH1}) for its displayed dimensions ({PH2}). Use responsive images to reduce the image download size.',
35
+ /**
36
+ * @description Column header for a table column containing network requests for images which can improve their file size (e.g. use a different format, increase compression, etc).
37
+ */
38
+ optimizeFile: 'Optimize file size',
39
+ /**
40
+ * @description Table row value representing the remaining items not shown in the table due to size constraints. This row will always represent at least 2 items.
41
+ * @example {5} PH1
42
+ */
43
+ others: '{PH1} others',
44
+ /**
45
+ * @description Text status indicating that no potential optimizations were found for any image file.
46
+ */
47
+ noOptimizableImages: 'No optimizable images',
48
+ /**
49
+ * @description Text describing the estimated number of bytes that an image file optimization can save. This text is appended to another block of text describing the image optimization in more detail. "Est" means "Estimated".
50
+ * @example {Use the correct image dimensions to reduce the image file size.} PH1
51
+ * @example {50 MB} PH2
52
+ */
53
+ estimatedSavings: '{PH1} (Est {PH2})',
54
+ };
55
+ const str_ = i18n.i18n.registerUIStrings('models/trace/insights/ImageDelivery.ts', UIStrings);
56
+ export const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
57
+ /**
58
+ * Even JPEGs with lots of detail can usually be compressed down to <1 byte per pixel
59
+ * Using 4:2:2 subsampling already gets an uncompressed bitmap to 2 bytes per pixel.
60
+ * The compression ratio for JPEG is usually somewhere around 10:1 depending on content, so
61
+ * 8:1 is a reasonable expectation for web content which is 1.5MB for a 6MP image.
62
+ *
63
+ * WebP usually gives ~20% additional savings on top of that, so we will assume 10:1 for WebP.
64
+ * This is quite pessimistic as their study shows a photographic compression ratio of ~29:1.
65
+ * https://developers.google.com/speed/webp/docs/webp_lossless_alpha_study#results
66
+ *
67
+ * AVIF usually gives ~20% additional savings on top of WebP, so we will use 12:1 for AVIF.
68
+ * This is quite pessimistic as Netflix study shows a photographic compression ratio of ~40:1
69
+ * (0.4 *bits* per pixel at SSIM 0.97).
70
+ * https://netflixtechblog.com/avif-for-next-generation-image-coding-b1d75675fe4
71
+ */
72
+ const TARGET_BYTES_PER_PIXEL_AVIF = 2 * 1 / 12;
73
+ /**
74
+ * If GIFs are above this size, we'll flag them
75
+ * See https://github.com/GoogleChrome/lighthouse/pull/4885#discussion_r178406623 and https://github.com/GoogleChrome/lighthouse/issues/4696#issuecomment-370979920
76
+ */
77
+ const GIF_SIZE_THRESHOLD = 100 * 1024;
78
+ const BYTE_SAVINGS_THRESHOLD = 4096;
79
+ // Ignore up to 12KB of waste for responsive images if an effort was made with breakpoints.
80
+ const BYTE_SAVINGS_THRESHOLD_RESPONSIVE_BREAKPOINTS = 12288;
81
+ export var ImageOptimizationType;
82
+ (function (ImageOptimizationType) {
83
+ ImageOptimizationType["ADJUST_COMPRESSION"] = "ADJUST_COMPRESSION";
84
+ ImageOptimizationType["MODERN_FORMAT_OR_COMPRESSION"] = "MODERN_FORMAT_OR_COMPRESSION";
85
+ ImageOptimizationType["VIDEO_FORMAT"] = "VIDEO_FORMAT";
86
+ ImageOptimizationType["RESPONSIVE_SIZE"] = "RESPONSIVE_SIZE";
87
+ })(ImageOptimizationType || (ImageOptimizationType = {}));
88
+ export function isImageDeliveryInsight(model) {
89
+ return model.insightKey === 'ImageDelivery';
90
+ }
91
+ export function getOptimizationMessage(optimization) {
92
+ switch (optimization.type) {
93
+ case ImageOptimizationType.ADJUST_COMPRESSION:
94
+ return i18nString(UIStrings.useCompression);
95
+ case ImageOptimizationType.MODERN_FORMAT_OR_COMPRESSION:
96
+ return i18nString(UIStrings.useModernFormat);
97
+ case ImageOptimizationType.VIDEO_FORMAT:
98
+ return i18nString(UIStrings.useVideoFormat);
99
+ case ImageOptimizationType.RESPONSIVE_SIZE:
100
+ return i18nString(UIStrings.useResponsiveSize, {
101
+ PH1: `${optimization.fileDimensions.width}x${optimization.fileDimensions.height}`,
102
+ PH2: `${optimization.displayDimensions.width}x${optimization.displayDimensions.height}`,
103
+ });
104
+ }
105
+ }
106
+ export function getOptimizationMessageWithBytes(optimization) {
107
+ const byteSavingsText = i18n.ByteUtilities.bytesToString(optimization.byteSavings);
108
+ const optimizationMessage = getOptimizationMessage(optimization);
109
+ return i18nString(UIStrings.estimatedSavings, { PH1: optimizationMessage, PH2: byteSavingsText });
110
+ }
111
+ function finalize(partialModel) {
112
+ return {
113
+ insightKey: InsightKeys.IMAGE_DELIVERY,
114
+ strings: UIStrings,
115
+ title: i18nString(UIStrings.title),
116
+ description: i18nString(UIStrings.description),
117
+ docs: 'https://developer.chrome.com/docs/performance/insights/image-delivery',
118
+ category: InsightCategory.LCP,
119
+ state: partialModel.optimizableImages.length > 0 ? 'fail' : 'pass',
120
+ ...partialModel,
121
+ relatedEvents: new Map(partialModel.optimizableImages.map(image => [image.request, image.optimizations.map(getOptimizationMessageWithBytes)])),
122
+ };
123
+ }
124
+ /**
125
+ * Calculate rough savings percentage based on 1000 real gifs transcoded to video
126
+ * https://github.com/GoogleChrome/lighthouse/issues/4696#issuecomment-380296510
127
+ */
128
+ function estimateGIFPercentSavings(request) {
129
+ return Math.round((29.1 * Math.log10(request.args.data.decodedBodyLength) - 100.7)) / 100;
130
+ }
131
+ function getDisplayedSize(data, paintImage) {
132
+ // Note: for traces made prior to metadata.hostDPR (which means no data in
133
+ // paintEventToCorrectedDisplaySize), the displayed size unexpectedly ignores any
134
+ // emulated DPR and so the results may be very misleading.
135
+ return data.ImagePainting.paintEventToCorrectedDisplaySize.get(paintImage) ?? {
136
+ width: paintImage.args.data.width,
137
+ height: paintImage.args.data.height,
138
+ };
139
+ }
140
+ function getPixelCounts(data, paintImage) {
141
+ const { width, height } = getDisplayedSize(data, paintImage);
142
+ return {
143
+ filePixels: paintImage.args.data.srcWidth * paintImage.args.data.srcHeight,
144
+ displayedPixels: width * height,
145
+ };
146
+ }
147
+ export function generateInsight(data, context) {
148
+ const isWithinContext = (event) => Helpers.Timing.eventIsInBounds(event, context.bounds);
149
+ const contextRequests = data.NetworkRequests.byTime.filter(isWithinContext);
150
+ const optimizableImages = [];
151
+ for (const request of contextRequests) {
152
+ if (request.args.data.resourceType !== 'Image') {
153
+ continue;
154
+ }
155
+ if (request.args.data.mimeType === 'image/svg+xml') {
156
+ continue;
157
+ }
158
+ // If the request was redirected, the image paints will have the pre-redirect URL.
159
+ const url = request.args.data.redirects[0]?.url ?? request.args.data.url;
160
+ const imagePaints = data.ImagePainting.paintImageEventForUrl.get(url)?.filter(isWithinContext);
161
+ // This will filter out things like preloaded image requests where an image file is downloaded
162
+ // but never rendered on the page.
163
+ if (!imagePaints?.length) {
164
+ continue;
165
+ }
166
+ const largestImagePaint = imagePaints.reduce((prev, curr) => {
167
+ const prevPixels = getPixelCounts(data, prev).displayedPixels;
168
+ const currPixels = getPixelCounts(data, curr).displayedPixels;
169
+ return prevPixels > currPixels ? prev : curr;
170
+ });
171
+ const { filePixels: imageFilePixels, displayedPixels: largestImageDisplayPixels, } = getPixelCounts(data, largestImagePaint);
172
+ // Decoded body length is almost always the right one to be using because of the below:
173
+ // `encodedDataLength = decodedBodyLength + headers`.
174
+ // HOWEVER, there are some cases where an image is compressed again over the network and transfer size
175
+ // is smaller (see https://github.com/GoogleChrome/lighthouse/pull/4968).
176
+ // Use the min of the two numbers to be safe.
177
+ const imageBytes = Math.min(request.args.data.decodedBodyLength, request.args.data.encodedDataLength);
178
+ const bytesPerPixel = imageBytes / imageFilePixels;
179
+ let optimizations = [];
180
+ if (request.args.data.mimeType === 'image/gif') {
181
+ if (imageBytes > GIF_SIZE_THRESHOLD) {
182
+ const percentSavings = estimateGIFPercentSavings(request);
183
+ const byteSavings = Math.round(imageBytes * percentSavings);
184
+ optimizations.push({ type: ImageOptimizationType.VIDEO_FORMAT, byteSavings });
185
+ }
186
+ }
187
+ else if (bytesPerPixel > TARGET_BYTES_PER_PIXEL_AVIF) {
188
+ const idealAvifImageSize = Math.round(TARGET_BYTES_PER_PIXEL_AVIF * imageFilePixels);
189
+ const byteSavings = imageBytes - idealAvifImageSize;
190
+ if (request.args.data.mimeType !== 'image/webp' && request.args.data.mimeType !== 'image/avif') {
191
+ optimizations.push({ type: ImageOptimizationType.MODERN_FORMAT_OR_COMPRESSION, byteSavings });
192
+ }
193
+ else {
194
+ optimizations.push({ type: ImageOptimizationType.ADJUST_COMPRESSION, byteSavings });
195
+ }
196
+ }
197
+ // At this point (before looking at image size), the # of optimizations should only ever be 1 or 0
198
+ // Math.max handles both cases correctly, and is defensive against future patches that would add
199
+ // more than 1 format-specific optimization by this point.
200
+ const imageByteSavingsFromFormat = Math.max(0, ...optimizations.map(o => o.byteSavings));
201
+ let imageByteSavings = imageByteSavingsFromFormat;
202
+ const wastedPixelRatio = 1 - (largestImageDisplayPixels / imageFilePixels);
203
+ // Ignore CSS images because it's difficult to determine what is a spritesheet,
204
+ // and the reward-to-effort ratio for responsive CSS images is quite low https://css-tricks.com/responsive-images-css/.
205
+ if (wastedPixelRatio > 0 && !largestImagePaint.args.data.isCSS) {
206
+ const byteSavings = Math.round(wastedPixelRatio * imageBytes);
207
+ const hadBreakpoints = largestImagePaint.args.data.isPicture || largestImagePaint.args.data.srcsetAttribute;
208
+ if (!hadBreakpoints || byteSavings > BYTE_SAVINGS_THRESHOLD_RESPONSIVE_BREAKPOINTS) {
209
+ // This will compound the byte savings from any potential format changes with the image size
210
+ // optimization added here.
211
+ imageByteSavings += Math.round(wastedPixelRatio * (imageBytes - imageByteSavingsFromFormat));
212
+ const { width, height } = getDisplayedSize(data, largestImagePaint);
213
+ optimizations.push({
214
+ type: ImageOptimizationType.RESPONSIVE_SIZE,
215
+ byteSavings,
216
+ fileDimensions: {
217
+ width: Math.round(largestImagePaint.args.data.srcWidth),
218
+ height: Math.round(largestImagePaint.args.data.srcHeight),
219
+ },
220
+ displayDimensions: {
221
+ width: Math.round(width),
222
+ height: Math.round(height),
223
+ },
224
+ });
225
+ }
226
+ }
227
+ optimizations = optimizations.filter(optimization => optimization.byteSavings > BYTE_SAVINGS_THRESHOLD);
228
+ if (optimizations.length > 0) {
229
+ optimizableImages.push({
230
+ request,
231
+ largestImagePaint,
232
+ optimizations,
233
+ byteSavings: imageByteSavings,
234
+ });
235
+ }
236
+ }
237
+ const wastedBytesByRequestId = new Map();
238
+ for (const image of optimizableImages) {
239
+ wastedBytesByRequestId.set(image.request.args.data.requestId, image.byteSavings);
240
+ }
241
+ // Sort by savings, then by size of image.
242
+ optimizableImages.sort((a, b) => {
243
+ if (b.byteSavings !== a.byteSavings) {
244
+ return b.byteSavings - a.byteSavings;
245
+ }
246
+ return b.request.args.data.decodedBodyLength - a.request.args.data.decodedBodyLength;
247
+ });
248
+ return finalize({
249
+ optimizableImages,
250
+ metricSavings: metricSavingsForWastedBytes(wastedBytesByRequestId, context),
251
+ wastedBytes: optimizableImages.reduce((total, img) => total + img.byteSavings, 0),
252
+ });
253
+ }
254
+ export function createOverlayForRequest(request) {
255
+ return {
256
+ type: 'ENTRY_OUTLINE',
257
+ entry: request,
258
+ outlineReason: 'ERROR',
259
+ };
260
+ }
261
+ export function createOverlays(model) {
262
+ return model.optimizableImages.map(image => createOverlayForRequest(image.request));
263
+ }
264
+ //# sourceMappingURL=ImageDelivery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageDelivery.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/ImageDelivery.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AAGnD,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EAAC,2BAA2B,EAAC,MAAM,aAAa,CAAC;AACxD,OAAO,EACL,eAAe,EACf,WAAW,GAIZ,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;;OAEG;IACH,KAAK,EAAE,wBAAwB;IAC/B;;OAEG;IACH,WAAW,EACP,gNAAgN;IACpN;;OAEG;IACH,cAAc,EAAE,kFAAkF;IAClG;;OAEG;IACH,eAAe,EACX,uHAAuH;IAC3H;;OAEG;IACH,cAAc,EAAE,uFAAuF;IACvG;;;;OAIG;IACH,iBAAiB,EACb,sJAAsJ;IAC1J;;OAEG;IACH,YAAY,EAAE,oBAAoB;IAClC;;;OAGG;IACH,MAAM,EAAE,cAAc;IACtB;;OAEG;IACH,mBAAmB,EAAE,uBAAuB;IAC5C;;;;OAIG;IACH,gBAAgB,EAAE,mBAAmB;CAC7B,CAAC;AAEX,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,wCAAwC,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;KACvB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAgC;IAC7D,OAAO,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AACtF,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as i18n from '../../../core/i18n/i18n.js';\nimport type * as Platform from '../../../core/platform/platform.js';\nimport type * as Handlers from '../handlers/handlers.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport type * as Types from '../types/types.js';\n\nimport {metricSavingsForWastedBytes} from './Common.js';\nimport {\n InsightCategory,\n InsightKeys,\n type InsightModel,\n type InsightSetContext,\n type PartialInsightModel,\n} from './types.js';\n\nexport const UIStrings = {\n /**\n * @description Title of an insight that recommends ways to reduce the size of images downloaded and used on the page.\n */\n title: 'Improve image delivery',\n /**\n * @description Description of an insight that recommends ways to reduce the size of images downloaded and used on the page.\n */\n description:\n 'Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).',\n /**\n * @description Message displayed in a chip explaining that an image file size is large for the # of pixels it has and recommends possible adjustments to improve the image size.\n */\n useCompression: 'Increasing the image compression factor could improve this image’s download size',\n /**\n * @description Message displayed in a chip explaining that an image file size is large for the # of pixels it has and recommends possible adjustments to improve the image size.\n */\n useModernFormat:\n 'Using a modern image format (WebP, AVIF) or increasing the image compression could improve this image’s download size',\n /**\n * @description Message displayed in a chip advising the user to use video formats instead of GIFs because videos generally have smaller file sizes.\n */\n useVideoFormat: 'Using video formats instead of GIFs can improve the download size of animated content',\n /**\n * @description Message displayed in a chip explaining that an image was displayed on the page with dimensions much smaller than the image file dimensions.\n * @example {1000x500} PH1\n * @example {100x50} PH2\n */\n useResponsiveSize:\n 'This image file is larger than it needs to be ({PH1}) for its displayed dimensions ({PH2}). Use responsive images to reduce the image download size.',\n /**\n * @description Column header for a table column containing network requests for images which can improve their file size (e.g. use a different format, increase compression, etc).\n */\n optimizeFile: 'Optimize file size',\n /**\n * @description Table row value representing the remaining items not shown in the table due to size constraints. This row will always represent at least 2 items.\n * @example {5} PH1\n */\n others: '{PH1} others',\n /**\n * @description Text status indicating that no potential optimizations were found for any image file.\n */\n noOptimizableImages: 'No optimizable images',\n /**\n * @description Text describing the estimated number of bytes that an image file optimization can save. This text is appended to another block of text describing the image optimization in more detail. \"Est\" means \"Estimated\".\n * @example {Use the correct image dimensions to reduce the image file size.} PH1\n * @example {50 MB} PH2\n */\n estimatedSavings: '{PH1} (Est {PH2})',\n} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/ImageDelivery.ts', UIStrings);\nexport const i18nString: i18n.LocalizeString = i18n.i18n.getLocalizedString.bind(undefined, str_);\n\n/**\n * Even JPEGs with lots of detail can usually be compressed down to <1 byte per pixel\n * Using 4:2:2 subsampling already gets an uncompressed bitmap to 2 bytes per pixel.\n * The compression ratio for JPEG is usually somewhere around 10:1 depending on content, so\n * 8:1 is a reasonable expectation for web content which is 1.5MB for a 6MP image.\n *\n * WebP usually gives ~20% additional savings on top of that, so we will assume 10:1 for WebP.\n * This is quite pessimistic as their study shows a photographic compression ratio of ~29:1.\n * https://developers.google.com/speed/webp/docs/webp_lossless_alpha_study#results\n *\n * AVIF usually gives ~20% additional savings on top of WebP, so we will use 12:1 for AVIF.\n * This is quite pessimistic as Netflix study shows a photographic compression ratio of ~40:1\n * (0.4 *bits* per pixel at SSIM 0.97).\n * https://netflixtechblog.com/avif-for-next-generation-image-coding-b1d75675fe4\n */\nconst TARGET_BYTES_PER_PIXEL_AVIF = 2 * 1 / 12;\n\n/**\n * If GIFs are above this size, we'll flag them\n * See https://github.com/GoogleChrome/lighthouse/pull/4885#discussion_r178406623 and https://github.com/GoogleChrome/lighthouse/issues/4696#issuecomment-370979920\n */\nconst GIF_SIZE_THRESHOLD = 100 * 1024;\n\nconst BYTE_SAVINGS_THRESHOLD = 4096;\n\n// Ignore up to 12KB of waste for responsive images if an effort was made with breakpoints.\nconst BYTE_SAVINGS_THRESHOLD_RESPONSIVE_BREAKPOINTS = 12288;\n\nexport enum ImageOptimizationType {\n ADJUST_COMPRESSION = 'ADJUST_COMPRESSION',\n MODERN_FORMAT_OR_COMPRESSION = 'MODERN_FORMAT_OR_COMPRESSION',\n VIDEO_FORMAT = 'VIDEO_FORMAT',\n RESPONSIVE_SIZE = 'RESPONSIVE_SIZE',\n}\n\nexport type ImageOptimization = {\n type: Exclude<ImageOptimizationType, ImageOptimizationType.RESPONSIVE_SIZE>,\n byteSavings: number,\n}|{\n type: ImageOptimizationType.RESPONSIVE_SIZE,\n byteSavings: number,\n fileDimensions: {width: number, height: number},\n displayDimensions: {width: number, height: number},\n};\n\nexport interface OptimizableImage {\n request: Types.Events.SyntheticNetworkRequest;\n optimizations: ImageOptimization[];\n byteSavings: number;\n /**\n * If the an image resource has multiple `PaintImage`s, we compare its intrinsic size to the largest of the displayed sizes.\n *\n * It is theoretically possible for `PaintImage` events with the same URL to have different intrinsic sizes.\n * However, this should be rare because it requires serving different images from the same URL.\n */\n largestImagePaint: Types.Events.PaintImage;\n}\n\nexport type ImageDeliveryInsightModel = InsightModel<typeof UIStrings, {\n /** Sorted by potential byte savings, then by size of image. */\n optimizableImages: OptimizableImage[],\n wastedBytes: number,\n}>;\n\nexport function isImageDeliveryInsight(model: InsightModel): model is ImageDeliveryInsightModel {\n return model.insightKey === 'ImageDelivery';\n}\n\nexport function getOptimizationMessage(optimization: ImageOptimization): Platform.UIString.LocalizedString {\n switch (optimization.type) {\n case ImageOptimizationType.ADJUST_COMPRESSION:\n return i18nString(UIStrings.useCompression);\n case ImageOptimizationType.MODERN_FORMAT_OR_COMPRESSION:\n return i18nString(UIStrings.useModernFormat);\n case ImageOptimizationType.VIDEO_FORMAT:\n return i18nString(UIStrings.useVideoFormat);\n case ImageOptimizationType.RESPONSIVE_SIZE:\n return i18nString(UIStrings.useResponsiveSize, {\n PH1: `${optimization.fileDimensions.width}x${optimization.fileDimensions.height}`,\n PH2: `${optimization.displayDimensions.width}x${optimization.displayDimensions.height}`,\n });\n }\n}\n\nexport function getOptimizationMessageWithBytes(optimization: ImageOptimization): Platform.UIString.LocalizedString {\n const byteSavingsText = i18n.ByteUtilities.bytesToString(optimization.byteSavings);\n const optimizationMessage = getOptimizationMessage(optimization);\n return i18nString(UIStrings.estimatedSavings, {PH1: optimizationMessage, PH2: byteSavingsText});\n}\n\nfunction finalize(partialModel: PartialInsightModel<ImageDeliveryInsightModel>): ImageDeliveryInsightModel {\n return {\n insightKey: InsightKeys.IMAGE_DELIVERY,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n docs: 'https://developer.chrome.com/docs/performance/insights/image-delivery',\n category: InsightCategory.LCP,\n state: partialModel.optimizableImages.length > 0 ? 'fail' : 'pass',\n ...partialModel,\n relatedEvents: new Map(partialModel.optimizableImages.map(\n image => [image.request, image.optimizations.map(getOptimizationMessageWithBytes)])),\n };\n}\n\n/**\n * Calculate rough savings percentage based on 1000 real gifs transcoded to video\n * https://github.com/GoogleChrome/lighthouse/issues/4696#issuecomment-380296510\n */\nfunction estimateGIFPercentSavings(request: Types.Events.SyntheticNetworkRequest): number {\n return Math.round((29.1 * Math.log10(request.args.data.decodedBodyLength) - 100.7)) / 100;\n}\n\nfunction getDisplayedSize(\n data: Handlers.Types.HandlerData, paintImage: Types.Events.PaintImage): {width: number, height: number} {\n // Note: for traces made prior to metadata.hostDPR (which means no data in\n // paintEventToCorrectedDisplaySize), the displayed size unexpectedly ignores any\n // emulated DPR and so the results may be very misleading.\n return data.ImagePainting.paintEventToCorrectedDisplaySize.get(paintImage) ?? {\n width: paintImage.args.data.width,\n height: paintImage.args.data.height,\n };\n}\n\nfunction getPixelCounts(data: Handlers.Types.HandlerData, paintImage: Types.Events.PaintImage):\n {displayedPixels: number, filePixels: number} {\n const {width, height} = getDisplayedSize(data, paintImage);\n return {\n filePixels: paintImage.args.data.srcWidth * paintImage.args.data.srcHeight,\n displayedPixels: width * height,\n };\n}\n\nexport function generateInsight(\n data: Handlers.Types.HandlerData, context: InsightSetContext): ImageDeliveryInsightModel {\n const isWithinContext = (event: Types.Events.Event): boolean => Helpers.Timing.eventIsInBounds(event, context.bounds);\n\n const contextRequests = data.NetworkRequests.byTime.filter(isWithinContext);\n\n const optimizableImages: OptimizableImage[] = [];\n for (const request of contextRequests) {\n if (request.args.data.resourceType !== 'Image') {\n continue;\n }\n\n if (request.args.data.mimeType === 'image/svg+xml') {\n continue;\n }\n\n // If the request was redirected, the image paints will have the pre-redirect URL.\n const url = request.args.data.redirects[0]?.url ?? request.args.data.url;\n const imagePaints = data.ImagePainting.paintImageEventForUrl.get(url)?.filter(isWithinContext);\n\n // This will filter out things like preloaded image requests where an image file is downloaded\n // but never rendered on the page.\n if (!imagePaints?.length) {\n continue;\n }\n\n const largestImagePaint = imagePaints.reduce((prev, curr) => {\n const prevPixels = getPixelCounts(data, prev).displayedPixels;\n const currPixels = getPixelCounts(data, curr).displayedPixels;\n return prevPixels > currPixels ? prev : curr;\n });\n\n const {\n filePixels: imageFilePixels,\n displayedPixels: largestImageDisplayPixels,\n } = getPixelCounts(data, largestImagePaint);\n\n // Decoded body length is almost always the right one to be using because of the below:\n // `encodedDataLength = decodedBodyLength + headers`.\n // HOWEVER, there are some cases where an image is compressed again over the network and transfer size\n // is smaller (see https://github.com/GoogleChrome/lighthouse/pull/4968).\n // Use the min of the two numbers to be safe.\n const imageBytes = Math.min(request.args.data.decodedBodyLength, request.args.data.encodedDataLength);\n\n const bytesPerPixel = imageBytes / imageFilePixels;\n\n let optimizations: ImageOptimization[] = [];\n if (request.args.data.mimeType === 'image/gif') {\n if (imageBytes > GIF_SIZE_THRESHOLD) {\n const percentSavings = estimateGIFPercentSavings(request);\n const byteSavings = Math.round(imageBytes * percentSavings);\n optimizations.push({type: ImageOptimizationType.VIDEO_FORMAT, byteSavings});\n }\n } else if (bytesPerPixel > TARGET_BYTES_PER_PIXEL_AVIF) {\n const idealAvifImageSize = Math.round(TARGET_BYTES_PER_PIXEL_AVIF * imageFilePixels);\n const byteSavings = imageBytes - idealAvifImageSize;\n if (request.args.data.mimeType !== 'image/webp' && request.args.data.mimeType !== 'image/avif') {\n optimizations.push({type: ImageOptimizationType.MODERN_FORMAT_OR_COMPRESSION, byteSavings});\n } else {\n optimizations.push({type: ImageOptimizationType.ADJUST_COMPRESSION, byteSavings});\n }\n }\n\n // At this point (before looking at image size), the # of optimizations should only ever be 1 or 0\n // Math.max handles both cases correctly, and is defensive against future patches that would add\n // more than 1 format-specific optimization by this point.\n const imageByteSavingsFromFormat = Math.max(0, ...optimizations.map(o => o.byteSavings));\n let imageByteSavings = imageByteSavingsFromFormat;\n\n const wastedPixelRatio = 1 - (largestImageDisplayPixels / imageFilePixels);\n\n // Ignore CSS images because it's difficult to determine what is a spritesheet,\n // and the reward-to-effort ratio for responsive CSS images is quite low https://css-tricks.com/responsive-images-css/.\n if (wastedPixelRatio > 0 && !largestImagePaint.args.data.isCSS) {\n const byteSavings = Math.round(wastedPixelRatio * imageBytes);\n\n const hadBreakpoints = largestImagePaint.args.data.isPicture || largestImagePaint.args.data.srcsetAttribute;\n if (!hadBreakpoints || byteSavings > BYTE_SAVINGS_THRESHOLD_RESPONSIVE_BREAKPOINTS) {\n // This will compound the byte savings from any potential format changes with the image size\n // optimization added here.\n imageByteSavings += Math.round(wastedPixelRatio * (imageBytes - imageByteSavingsFromFormat));\n\n const {width, height} = getDisplayedSize(data, largestImagePaint);\n\n optimizations.push({\n type: ImageOptimizationType.RESPONSIVE_SIZE,\n byteSavings,\n fileDimensions: {\n width: Math.round(largestImagePaint.args.data.srcWidth),\n height: Math.round(largestImagePaint.args.data.srcHeight),\n },\n displayDimensions: {\n width: Math.round(width),\n height: Math.round(height),\n },\n });\n }\n }\n\n optimizations = optimizations.filter(optimization => optimization.byteSavings > BYTE_SAVINGS_THRESHOLD);\n\n if (optimizations.length > 0) {\n optimizableImages.push({\n request,\n largestImagePaint,\n optimizations,\n byteSavings: imageByteSavings,\n });\n }\n }\n\n const wastedBytesByRequestId = new Map<string, number>();\n for (const image of optimizableImages) {\n wastedBytesByRequestId.set(image.request.args.data.requestId, image.byteSavings);\n }\n\n // Sort by savings, then by size of image.\n optimizableImages.sort((a, b) => {\n if (b.byteSavings !== a.byteSavings) {\n return b.byteSavings - a.byteSavings;\n }\n\n return b.request.args.data.decodedBodyLength - a.request.args.data.decodedBodyLength;\n });\n\n return finalize({\n optimizableImages,\n metricSavings: metricSavingsForWastedBytes(wastedBytesByRequestId, context),\n wastedBytes: optimizableImages.reduce((total, img) => total + img.byteSavings, 0),\n });\n}\n\nexport function createOverlayForRequest(request: Types.Events.SyntheticNetworkRequest): Types.Overlays.EntryOutline {\n return {\n type: 'ENTRY_OUTLINE',\n entry: request,\n outlineReason: 'ERROR',\n };\n}\n\nexport function createOverlays(model: ImageDeliveryInsightModel): Types.Overlays.Overlay[] {\n return model.optimizableImages.map(image => createOverlayForRequest(image.request));\n}\n"]}
@@ -7,49 +7,49 @@ export declare const UIStrings: {
7
7
  /**
8
8
  * @description Title of an insight that provides details about the LCP metric, broken down by parts.
9
9
  */
10
- readonly title: "LCP breakdown";
10
+ readonly title: 'LCP breakdown';
11
11
  /**
12
12
  * @description Description of a DevTools insight that presents a breakdown for the LCP metric by subparts.
13
13
  * This is displayed after a user expands the section to see more. No character length limits.
14
14
  */
15
- readonly description: "Each [subpart has specific improvement strategies](https://developer.chrome.com/docs/performance/insights/lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.";
15
+ readonly description: 'Each [subpart has specific improvement strategies](https://developer.chrome.com/docs/performance/insights/lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.';
16
16
  /**
17
17
  * @description Time to first byte title for the Largest Contentful Paint's subparts timespan breakdown.
18
18
  */
19
- readonly timeToFirstByte: "Time to first byte";
19
+ readonly timeToFirstByte: 'Time to first byte';
20
20
  /**
21
21
  * @description Resource load delay title for the Largest Contentful Paint subparts timespan breakdown.
22
22
  */
23
- readonly resourceLoadDelay: "Resource load delay";
23
+ readonly resourceLoadDelay: 'Resource load delay';
24
24
  /**
25
25
  * @description Resource load duration title for the Largest Contentful Paint subparts timespan breakdown.
26
26
  */
27
- readonly resourceLoadDuration: "Resource load duration";
27
+ readonly resourceLoadDuration: 'Resource load duration';
28
28
  /**
29
29
  * @description Element render delay title for the Largest Contentful Paint subparts timespan breakdown.
30
30
  */
31
- readonly elementRenderDelay: "Element render delay";
31
+ readonly elementRenderDelay: 'Element render delay';
32
32
  /**
33
33
  * @description Label used for the subpart (section) of a larger duration.
34
34
  */
35
- readonly subpart: "Subpart";
35
+ readonly subpart: 'Subpart';
36
36
  /**
37
37
  * @description Label used for the duration a single subpart (section) takes up of a larger duration.
38
38
  */
39
- readonly duration: "Duration";
39
+ readonly duration: 'Duration';
40
40
  /**
41
41
  * @description Label used for the duration a single subpart (section) takes up of a larger duration. The value will be the 75th percentile of aggregate data. "Field" means that the data was collected from real users in the field as opposed to the developers local environment. "Field" is synonymous with "Real user data".
42
42
  */
43
- readonly fieldDuration: "Field p75";
43
+ readonly fieldDuration: 'Field p75';
44
44
  /**
45
45
  * @description Text status indicating that the Largest Contentful Paint (LCP) metric timing was not found. "LCP" is an acronym and should not be translated.
46
46
  */
47
- readonly noLcp: "No LCP detected";
47
+ readonly noLcp: 'No LCP detected';
48
48
  };
49
49
  export declare const i18nString: i18n.LocalizeString;
50
50
  /** A TraceWindow plus its UIString. **/
51
51
  export type Subpart = Types.Timing.TraceWindowMicro & {
52
- label: {i18nId: string, values: Record<string, string|number>, formattedDefault: string};
52
+ label: Common.UIString.LocalizedString;
53
53
  };
54
54
  interface LCPSubparts {
55
55
  /**