@paulirish/trace_engine 0.0.59 → 0.0.61

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 (452) hide show
  1. package/.tmp/tsbuildinfo/analyze-trace.d.mts +2 -3
  2. package/.tmp/tsbuildinfo/analyze-trace.d.mts.map +1 -1
  3. package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +1 -1
  4. package/LICENSE +1 -1
  5. package/README.md +28 -1
  6. package/analyze-trace.mjs +5 -3
  7. package/core/platform/ArrayUtilities.d.ts +1 -0
  8. package/core/platform/ArrayUtilities.js +2 -2
  9. package/core/platform/ArrayUtilities.js.map +1 -1
  10. package/core/platform/Brand.js +1 -1
  11. package/core/platform/Brand.js.map +1 -1
  12. package/core/platform/Constructor.js +1 -1
  13. package/core/platform/Constructor.js.map +1 -1
  14. package/core/platform/DOMUtilities.js +1 -1
  15. package/core/platform/DOMUtilities.js.map +1 -1
  16. package/core/platform/DateUtilities.js +1 -1
  17. package/core/platform/DateUtilities.js.map +1 -1
  18. package/core/platform/DevToolsPath.js +1 -1
  19. package/core/platform/DevToolsPath.js.map +1 -1
  20. package/core/platform/KeyboardUtilities.js +1 -1
  21. package/core/platform/KeyboardUtilities.js.map +1 -1
  22. package/core/platform/MapUtilities.js +1 -1
  23. package/core/platform/MapUtilities.js.map +1 -1
  24. package/core/platform/MimeType.js +1 -1
  25. package/core/platform/MimeType.js.map +1 -1
  26. package/core/platform/NumberUtilities.js +1 -1
  27. package/core/platform/NumberUtilities.js.map +1 -1
  28. package/core/platform/StringUtilities.d.ts +2 -1
  29. package/core/platform/StringUtilities.js +34 -32
  30. package/core/platform/StringUtilities.js.map +1 -1
  31. package/core/platform/Timing.js +1 -1
  32. package/core/platform/Timing.js.map +1 -1
  33. package/core/platform/TypedArrayUtilities.js +1 -1
  34. package/core/platform/TypedArrayUtilities.js.map +1 -1
  35. package/core/platform/TypescriptUtilities.js +1 -1
  36. package/core/platform/TypescriptUtilities.js.map +1 -1
  37. package/core/platform/UIString.js +1 -1
  38. package/core/platform/UIString.js.map +1 -1
  39. package/core/platform/UserVisibleError.js +1 -1
  40. package/core/platform/UserVisibleError.js.map +1 -1
  41. package/core/platform/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
  42. package/core/platform/platform-tsconfig.json +6 -2
  43. package/core/platform/platform.js +3 -29
  44. package/core/platform/platform.js.map +1 -1
  45. package/generated/protocol.d.ts +188 -15
  46. package/generated/protocol.js +1 -1
  47. package/locales/af.json +3 -3
  48. package/locales/am.json +4 -4
  49. package/locales/ar.json +14 -14
  50. package/locales/as.json +3 -3
  51. package/locales/az.json +4 -4
  52. package/locales/be.json +3 -3
  53. package/locales/bg.json +3 -3
  54. package/locales/bn.json +4 -4
  55. package/locales/bs.json +4 -4
  56. package/locales/ca.json +3 -3
  57. package/locales/cs.json +3 -3
  58. package/locales/cy.json +4 -4
  59. package/locales/da.json +3 -3
  60. package/locales/de.json +3 -3
  61. package/locales/el.json +3 -3
  62. package/locales/en-GB.json +3 -3
  63. package/locales/en-US.json +26 -26
  64. package/locales/en-XL.json +26 -26
  65. package/locales/es-419.json +3 -3
  66. package/locales/es.json +3 -3
  67. package/locales/et.json +3 -3
  68. package/locales/eu.json +4 -4
  69. package/locales/fa.json +5 -5
  70. package/locales/fi.json +3 -3
  71. package/locales/fil.json +3 -3
  72. package/locales/fr-CA.json +4 -4
  73. package/locales/fr.json +3 -3
  74. package/locales/gl.json +3 -3
  75. package/locales/gu.json +3 -3
  76. package/locales/he.json +26 -26
  77. package/locales/hi.json +3 -3
  78. package/locales/hr.json +7 -7
  79. package/locales/hu.json +3 -3
  80. package/locales/hy.json +3 -3
  81. package/locales/id.json +3 -3
  82. package/locales/is.json +3 -3
  83. package/locales/it.json +3 -3
  84. package/locales/ja.json +3 -3
  85. package/locales/ka.json +4 -4
  86. package/locales/kk.json +3 -3
  87. package/locales/km.json +4 -4
  88. package/locales/kn.json +5 -5
  89. package/locales/ko.json +4 -4
  90. package/locales/ky.json +3 -3
  91. package/locales/lo.json +4 -4
  92. package/locales/lt.json +3 -3
  93. package/locales/lv.json +4 -4
  94. package/locales/mk.json +3 -3
  95. package/locales/ml.json +5 -5
  96. package/locales/mn.json +3 -3
  97. package/locales/mr.json +3 -3
  98. package/locales/ms.json +3 -3
  99. package/locales/my.json +6 -6
  100. package/locales/ne.json +25 -25
  101. package/locales/nl.json +3 -3
  102. package/locales/no.json +3 -3
  103. package/locales/or.json +3 -3
  104. package/locales/pa.json +3 -3
  105. package/locales/pl.json +3 -3
  106. package/locales/pt-PT.json +3 -3
  107. package/locales/pt.json +3 -3
  108. package/locales/ro.json +4 -4
  109. package/locales/ru.json +3 -3
  110. package/locales/si.json +4 -4
  111. package/locales/sk.json +3 -3
  112. package/locales/sl.json +3 -3
  113. package/locales/sq.json +4 -4
  114. package/locales/sr-Latn.json +3 -3
  115. package/locales/sr.json +3 -3
  116. package/locales/sv.json +3 -3
  117. package/locales/sw.json +3 -3
  118. package/locales/ta.json +3 -3
  119. package/locales/te.json +4 -4
  120. package/locales/th.json +3 -3
  121. package/locales/tr.json +3 -3
  122. package/locales/uk.json +3 -3
  123. package/locales/ur.json +4 -4
  124. package/locales/uz.json +3 -3
  125. package/locales/vi.json +3 -3
  126. package/locales/zh-HK.json +3 -3
  127. package/locales/zh-TW.json +4 -4
  128. package/locales/zh.json +3 -3
  129. package/locales/zu.json +3 -3
  130. package/models/cpu_profile/CPUProfileDataModel.d.ts +1 -0
  131. package/models/cpu_profile/CPUProfileDataModel.js +1 -1
  132. package/models/cpu_profile/CPUProfileDataModel.js.map +1 -1
  133. package/models/cpu_profile/ProfileTreeModel.d.ts +1 -1
  134. package/models/cpu_profile/ProfileTreeModel.js +1 -1
  135. package/models/cpu_profile/ProfileTreeModel.js.map +1 -1
  136. package/models/cpu_profile/cpu_profile-tsconfig.json +6 -2
  137. package/models/cpu_profile/cpu_profile.js +1 -1
  138. package/models/cpu_profile/cpu_profile.js.map +1 -1
  139. package/models/cpu_profile/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
  140. package/models/trace/EntityMapper.d.ts +33 -0
  141. package/models/trace/EntityMapper.js +123 -0
  142. package/models/trace/EntityMapper.js.map +1 -0
  143. package/models/trace/EventsSerializer.d.ts +11 -0
  144. package/models/trace/EventsSerializer.js +82 -0
  145. package/models/trace/EventsSerializer.js.map +1 -0
  146. package/models/trace/LanternComputationData.d.ts +3 -3
  147. package/models/trace/LanternComputationData.js +11 -10
  148. package/models/trace/LanternComputationData.js.map +1 -1
  149. package/models/trace/ModelImpl.d.ts +7 -14
  150. package/models/trace/ModelImpl.js +25 -52
  151. package/models/trace/ModelImpl.js.map +1 -1
  152. package/models/trace/Name.d.ts +12 -0
  153. package/models/trace/Name.js +115 -0
  154. package/models/trace/Name.js.map +1 -0
  155. package/models/trace/Processor.d.ts +1 -1
  156. package/models/trace/Processor.js +42 -61
  157. package/models/trace/Processor.js.map +1 -1
  158. package/models/trace/Styles.d.ts +50 -0
  159. package/models/trace/Styles.js +816 -0
  160. package/models/trace/Styles.js.map +1 -0
  161. package/models/trace/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
  162. package/models/trace/extras/FilmStrip.d.ts +1 -1
  163. package/models/trace/extras/FilmStrip.js +7 -7
  164. package/models/trace/extras/FilmStrip.js.map +1 -1
  165. package/models/trace/extras/MainThreadActivity.js +1 -1
  166. package/models/trace/extras/MainThreadActivity.js.map +1 -1
  167. package/models/trace/extras/ScriptDuplication.js +1 -1
  168. package/models/trace/extras/ScriptDuplication.js.map +1 -1
  169. package/models/trace/extras/StackTraceForEvent.d.ts +2 -2
  170. package/models/trace/extras/StackTraceForEvent.js +21 -21
  171. package/models/trace/extras/StackTraceForEvent.js.map +1 -1
  172. package/models/trace/extras/ThirdParties.d.ts +2 -2
  173. package/models/trace/extras/ThirdParties.js +17 -17
  174. package/models/trace/extras/ThirdParties.js.map +1 -1
  175. package/models/trace/extras/TraceFilter.d.ts +1 -1
  176. package/models/trace/extras/TraceFilter.js +1 -1
  177. package/models/trace/extras/TraceFilter.js.map +1 -1
  178. package/models/trace/extras/TraceTree.d.ts +1 -0
  179. package/models/trace/extras/TraceTree.js +2 -2
  180. package/models/trace/extras/TraceTree.js.map +1 -1
  181. package/models/trace/extras/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
  182. package/models/trace/extras/extras-tsconfig.json +6 -2
  183. package/models/trace/extras/extras.d.ts +0 -3978
  184. package/models/trace/extras/extras.js +0 -3978
  185. package/models/trace/extras/extras.js.map +1 -1
  186. package/models/trace/handlers/AnimationFramesHandler.js +11 -11
  187. package/models/trace/handlers/AnimationFramesHandler.js.map +1 -1
  188. package/models/trace/handlers/AnimationHandler.js +5 -5
  189. package/models/trace/handlers/AnimationHandler.js.map +1 -1
  190. package/models/trace/handlers/AsyncJSCallsHandler.d.ts +3 -3
  191. package/models/trace/handlers/AsyncJSCallsHandler.js +9 -9
  192. package/models/trace/handlers/AsyncJSCallsHandler.js.map +1 -1
  193. package/models/trace/handlers/AuctionWorkletsHandler.js +12 -12
  194. package/models/trace/handlers/AuctionWorkletsHandler.js.map +1 -1
  195. package/models/trace/handlers/DOMStatsHandler.js +3 -3
  196. package/models/trace/handlers/DOMStatsHandler.js.map +1 -1
  197. package/models/trace/handlers/ExtensionTraceDataHandler.d.ts +15 -2
  198. package/models/trace/handlers/ExtensionTraceDataHandler.js +53 -41
  199. package/models/trace/handlers/ExtensionTraceDataHandler.js.map +1 -1
  200. package/models/trace/handlers/FlowsHandler.js +11 -11
  201. package/models/trace/handlers/FlowsHandler.js.map +1 -1
  202. package/models/trace/handlers/FramesHandler.d.ts +7 -0
  203. package/models/trace/handlers/FramesHandler.js +12 -10
  204. package/models/trace/handlers/FramesHandler.js.map +1 -1
  205. package/models/trace/handlers/GPUHandler.js +3 -3
  206. package/models/trace/handlers/GPUHandler.js.map +1 -1
  207. package/models/trace/handlers/ImagePaintingHandler.js +13 -13
  208. package/models/trace/handlers/ImagePaintingHandler.js.map +1 -1
  209. package/models/trace/handlers/InitiatorsHandler.js +32 -41
  210. package/models/trace/handlers/InitiatorsHandler.js.map +1 -1
  211. package/models/trace/handlers/InvalidationsHandler.js +63 -44
  212. package/models/trace/handlers/InvalidationsHandler.js.map +1 -1
  213. package/models/trace/handlers/LargestImagePaintHandler.js +5 -4
  214. package/models/trace/handlers/LargestImagePaintHandler.js.map +1 -1
  215. package/models/trace/handlers/LargestTextPaintHandler.js +3 -3
  216. package/models/trace/handlers/LargestTextPaintHandler.js.map +1 -1
  217. package/models/trace/handlers/LayerTreeHandler.js +11 -11
  218. package/models/trace/handlers/LayerTreeHandler.js.map +1 -1
  219. package/models/trace/handlers/LayoutShiftsHandler.d.ts +17 -4
  220. package/models/trace/handlers/LayoutShiftsHandler.js +41 -38
  221. package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -1
  222. package/models/trace/handlers/MemoryHandler.js +3 -3
  223. package/models/trace/handlers/MemoryHandler.js.map +1 -1
  224. package/models/trace/handlers/MetaHandler.d.ts +16 -0
  225. package/models/trace/handlers/MetaHandler.js +29 -28
  226. package/models/trace/handlers/MetaHandler.js.map +1 -1
  227. package/models/trace/handlers/ModelHandlers.js +1 -1
  228. package/models/trace/handlers/ModelHandlers.js.map +1 -1
  229. package/models/trace/handlers/NetworkRequestsHandler.d.ts +10 -0
  230. package/models/trace/handlers/NetworkRequestsHandler.js +44 -25
  231. package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
  232. package/models/trace/handlers/PageFramesHandler.js +3 -3
  233. package/models/trace/handlers/PageFramesHandler.js.map +1 -1
  234. package/models/trace/handlers/PageLoadMetricsHandler.js +5 -5
  235. package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -1
  236. package/models/trace/handlers/RendererHandler.d.ts +1 -1
  237. package/models/trace/handlers/RendererHandler.js +22 -22
  238. package/models/trace/handlers/RendererHandler.js.map +1 -1
  239. package/models/trace/handlers/SamplesHandler.d.ts +2 -2
  240. package/models/trace/handlers/SamplesHandler.js +7 -9
  241. package/models/trace/handlers/SamplesHandler.js.map +1 -1
  242. package/models/trace/handlers/ScreenshotsHandler.js +9 -10
  243. package/models/trace/handlers/ScreenshotsHandler.js.map +1 -1
  244. package/models/trace/handlers/ScriptsHandler.js +9 -8
  245. package/models/trace/handlers/ScriptsHandler.js.map +1 -1
  246. package/models/trace/handlers/SelectorStatsHandler.d.ts +2 -2
  247. package/models/trace/handlers/SelectorStatsHandler.js +13 -13
  248. package/models/trace/handlers/SelectorStatsHandler.js.map +1 -1
  249. package/models/trace/handlers/Threads.d.ts +2 -2
  250. package/models/trace/handlers/Threads.js +9 -9
  251. package/models/trace/handlers/Threads.js.map +1 -1
  252. package/models/trace/handlers/UserInteractionsHandler.d.ts +10 -3
  253. package/models/trace/handlers/UserInteractionsHandler.js +104 -84
  254. package/models/trace/handlers/UserInteractionsHandler.js.map +1 -1
  255. package/models/trace/handlers/UserTimingsHandler.d.ts +1 -1
  256. package/models/trace/handlers/UserTimingsHandler.js +16 -17
  257. package/models/trace/handlers/UserTimingsHandler.js.map +1 -1
  258. package/models/trace/handlers/WarningsHandler.js +14 -14
  259. package/models/trace/handlers/WarningsHandler.js.map +1 -1
  260. package/models/trace/handlers/WorkersHandler.js +7 -7
  261. package/models/trace/handlers/WorkersHandler.js.map +1 -1
  262. package/models/trace/handlers/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
  263. package/models/trace/handlers/handlers-tsconfig.json +6 -2
  264. package/models/trace/handlers/handlers.js +1 -1
  265. package/models/trace/handlers/handlers.js.map +1 -1
  266. package/models/trace/handlers/helpers.d.ts +3 -2
  267. package/models/trace/handlers/helpers.js +10 -10
  268. package/models/trace/handlers/helpers.js.map +1 -1
  269. package/models/trace/handlers/types.d.ts +25 -2
  270. package/models/trace/handlers/types.js.map +1 -1
  271. package/models/trace/helpers/Extensions.js +8 -8
  272. package/models/trace/helpers/Extensions.js.map +1 -1
  273. package/models/trace/helpers/Network.js.map +1 -1
  274. package/models/trace/helpers/SamplesIntegrator.js +11 -9
  275. package/models/trace/helpers/SamplesIntegrator.js.map +1 -1
  276. package/models/trace/helpers/SyntheticEvents.js +1 -1
  277. package/models/trace/helpers/SyntheticEvents.js.map +1 -1
  278. package/models/trace/helpers/Timing.d.ts +4 -0
  279. package/models/trace/helpers/Timing.js +6 -4
  280. package/models/trace/helpers/Timing.js.map +1 -1
  281. package/models/trace/helpers/Trace.d.ts +19 -20
  282. package/models/trace/helpers/Trace.js +148 -60
  283. package/models/trace/helpers/Trace.js.map +1 -1
  284. package/models/trace/helpers/TreeHelpers.js +1 -1
  285. package/models/trace/helpers/TreeHelpers.js.map +1 -1
  286. package/models/trace/helpers/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
  287. package/models/trace/helpers/helpers-tsconfig.json +6 -2
  288. package/models/trace/helpers/helpers.js +1 -1
  289. package/models/trace/helpers/helpers.js.map +1 -1
  290. package/models/trace/insights/CLSCulprits.d.ts +3 -3
  291. package/models/trace/insights/CLSCulprits.js +16 -15
  292. package/models/trace/insights/CLSCulprits.js.map +1 -1
  293. package/models/trace/insights/Cache.d.ts +3 -2
  294. package/models/trace/insights/Cache.js +10 -6
  295. package/models/trace/insights/Cache.js.map +1 -1
  296. package/models/trace/insights/Common.d.ts +8 -1
  297. package/models/trace/insights/Common.js +16 -1
  298. package/models/trace/insights/Common.js.map +1 -1
  299. package/models/trace/insights/DOMSize.d.ts +4 -3
  300. package/models/trace/insights/DOMSize.js +12 -8
  301. package/models/trace/insights/DOMSize.js.map +1 -1
  302. package/models/trace/insights/DocumentLatency.d.ts +3 -3
  303. package/models/trace/insights/DocumentLatency.js +20 -18
  304. package/models/trace/insights/DocumentLatency.js.map +1 -1
  305. package/models/trace/insights/DuplicatedJavaScript.d.ts +3 -3
  306. package/models/trace/insights/DuplicatedJavaScript.js +7 -6
  307. package/models/trace/insights/DuplicatedJavaScript.js.map +1 -1
  308. package/models/trace/insights/FontDisplay.d.ts +3 -2
  309. package/models/trace/insights/FontDisplay.js +9 -5
  310. package/models/trace/insights/FontDisplay.js.map +1 -1
  311. package/models/trace/insights/ForcedReflow.d.ts +3 -2
  312. package/models/trace/insights/ForcedReflow.js +8 -4
  313. package/models/trace/insights/ForcedReflow.js.map +1 -1
  314. package/models/trace/insights/INPBreakdown.d.ts +4 -4
  315. package/models/trace/insights/INPBreakdown.js +18 -6
  316. package/models/trace/insights/INPBreakdown.js.map +1 -1
  317. package/models/trace/insights/ImageDelivery.d.ts +3 -3
  318. package/models/trace/insights/ImageDelivery.js +15 -14
  319. package/models/trace/insights/ImageDelivery.js.map +1 -1
  320. package/models/trace/insights/LCPBreakdown.d.ts +4 -3
  321. package/models/trace/insights/LCPBreakdown.js +19 -8
  322. package/models/trace/insights/LCPBreakdown.js.map +1 -1
  323. package/models/trace/insights/LCPDiscovery.d.ts +3 -3
  324. package/models/trace/insights/LCPDiscovery.js +8 -7
  325. package/models/trace/insights/LCPDiscovery.js.map +1 -1
  326. package/models/trace/insights/LegacyJavaScript.d.ts +2 -2
  327. package/models/trace/insights/LegacyJavaScript.js +7 -5
  328. package/models/trace/insights/LegacyJavaScript.js.map +1 -1
  329. package/models/trace/insights/Models.js +1 -1
  330. package/models/trace/insights/Models.js.map +1 -1
  331. package/models/trace/insights/ModernHTTP.d.ts +3 -3
  332. package/models/trace/insights/ModernHTTP.js +8 -7
  333. package/models/trace/insights/ModernHTTP.js.map +1 -1
  334. package/models/trace/insights/NetworkDependencyTree.d.ts +7 -4
  335. package/models/trace/insights/NetworkDependencyTree.js +21 -17
  336. package/models/trace/insights/NetworkDependencyTree.js.map +1 -1
  337. package/models/trace/insights/RenderBlocking.d.ts +2 -2
  338. package/models/trace/insights/RenderBlocking.js +13 -12
  339. package/models/trace/insights/RenderBlocking.js.map +1 -1
  340. package/models/trace/insights/SlowCSSSelector.d.ts +4 -3
  341. package/models/trace/insights/SlowCSSSelector.js +11 -7
  342. package/models/trace/insights/SlowCSSSelector.js.map +1 -1
  343. package/models/trace/insights/Statistics.js +1 -1
  344. package/models/trace/insights/Statistics.js.map +1 -1
  345. package/models/trace/insights/ThirdParties.d.ts +2 -1
  346. package/models/trace/insights/ThirdParties.js +10 -6
  347. package/models/trace/insights/ThirdParties.js.map +1 -1
  348. package/models/trace/insights/Viewport.d.ts +3 -2
  349. package/models/trace/insights/Viewport.js +10 -6
  350. package/models/trace/insights/Viewport.js.map +1 -1
  351. package/models/trace/insights/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
  352. package/models/trace/insights/insights-tsconfig.json +6 -2
  353. package/models/trace/insights/insights.d.ts +2 -0
  354. package/models/trace/insights/insights.js +3 -1
  355. package/models/trace/insights/insights.js.map +1 -1
  356. package/models/trace/insights/types.d.ts +6 -2
  357. package/models/trace/insights/types.js +2 -1
  358. package/models/trace/insights/types.js.map +1 -1
  359. package/models/trace/lantern/core/LanternError.js +1 -1
  360. package/models/trace/lantern/core/LanternError.js.map +1 -1
  361. package/models/trace/lantern/core/NetworkAnalyzer.js +1 -1
  362. package/models/trace/lantern/core/NetworkAnalyzer.js.map +1 -1
  363. package/models/trace/lantern/core/core-tsconfig.json +6 -2
  364. package/models/trace/lantern/core/core.js +1 -1
  365. package/models/trace/lantern/core/core.js.map +1 -1
  366. package/models/trace/lantern/core/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
  367. package/models/trace/lantern/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
  368. package/models/trace/lantern/graph/BaseNode.js +1 -1
  369. package/models/trace/lantern/graph/BaseNode.js.map +1 -1
  370. package/models/trace/lantern/graph/CPUNode.js +1 -1
  371. package/models/trace/lantern/graph/CPUNode.js.map +1 -1
  372. package/models/trace/lantern/graph/NetworkNode.js +1 -1
  373. package/models/trace/lantern/graph/NetworkNode.js.map +1 -1
  374. package/models/trace/lantern/graph/PageDependencyGraph.js +1 -1
  375. package/models/trace/lantern/graph/PageDependencyGraph.js.map +1 -1
  376. package/models/trace/lantern/graph/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
  377. package/models/trace/lantern/graph/graph-tsconfig.json +6 -2
  378. package/models/trace/lantern/graph/graph.js +1 -1
  379. package/models/trace/lantern/graph/graph.js.map +1 -1
  380. package/models/trace/lantern/lantern-tsconfig.json +6 -2
  381. package/models/trace/lantern/lantern.js +1 -1
  382. package/models/trace/lantern/lantern.js.map +1 -1
  383. package/models/trace/lantern/metrics/FirstContentfulPaint.js +1 -1
  384. package/models/trace/lantern/metrics/FirstContentfulPaint.js.map +1 -1
  385. package/models/trace/lantern/metrics/Interactive.js +1 -1
  386. package/models/trace/lantern/metrics/Interactive.js.map +1 -1
  387. package/models/trace/lantern/metrics/LargestContentfulPaint.js +1 -1
  388. package/models/trace/lantern/metrics/LargestContentfulPaint.js.map +1 -1
  389. package/models/trace/lantern/metrics/MaxPotentialFID.js +1 -1
  390. package/models/trace/lantern/metrics/MaxPotentialFID.js.map +1 -1
  391. package/models/trace/lantern/metrics/Metric.js +1 -1
  392. package/models/trace/lantern/metrics/Metric.js.map +1 -1
  393. package/models/trace/lantern/metrics/SpeedIndex.js +1 -1
  394. package/models/trace/lantern/metrics/SpeedIndex.js.map +1 -1
  395. package/models/trace/lantern/metrics/TBTUtils.js +1 -1
  396. package/models/trace/lantern/metrics/TBTUtils.js.map +1 -1
  397. package/models/trace/lantern/metrics/TotalBlockingTime.js +1 -1
  398. package/models/trace/lantern/metrics/TotalBlockingTime.js.map +1 -1
  399. package/models/trace/lantern/metrics/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
  400. package/models/trace/lantern/metrics/metrics-tsconfig.json +6 -2
  401. package/models/trace/lantern/metrics/metrics.js +1 -1
  402. package/models/trace/lantern/metrics/metrics.js.map +1 -1
  403. package/models/trace/lantern/simulation/ConnectionPool.js +1 -1
  404. package/models/trace/lantern/simulation/ConnectionPool.js.map +1 -1
  405. package/models/trace/lantern/simulation/Constants.js +1 -1
  406. package/models/trace/lantern/simulation/Constants.js.map +1 -1
  407. package/models/trace/lantern/simulation/DNSCache.js +1 -1
  408. package/models/trace/lantern/simulation/DNSCache.js.map +1 -1
  409. package/models/trace/lantern/simulation/SimulationTimingMap.js +1 -1
  410. package/models/trace/lantern/simulation/SimulationTimingMap.js.map +1 -1
  411. package/models/trace/lantern/simulation/Simulator.js +1 -1
  412. package/models/trace/lantern/simulation/Simulator.js.map +1 -1
  413. package/models/trace/lantern/simulation/TCPConnection.js +1 -1
  414. package/models/trace/lantern/simulation/TCPConnection.js.map +1 -1
  415. package/models/trace/lantern/simulation/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
  416. package/models/trace/lantern/simulation/simulation-tsconfig.json +6 -2
  417. package/models/trace/lantern/simulation/simulation.js +1 -1
  418. package/models/trace/lantern/simulation/simulation.js.map +1 -1
  419. package/models/trace/lantern/types/Lantern.js +1 -1
  420. package/models/trace/lantern/types/Lantern.js.map +1 -1
  421. package/models/trace/lantern/types/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
  422. package/models/trace/lantern/types/types-tsconfig.json +6 -2
  423. package/models/trace/lantern/types/types.js +1 -1
  424. package/models/trace/lantern/types/types.js.map +1 -1
  425. package/models/trace/trace-tsconfig.json +10 -2
  426. package/models/trace/trace.d.ts +5 -1
  427. package/models/trace/trace.js +6 -2
  428. package/models/trace/trace.js.map +1 -1
  429. package/models/trace/types/Configuration.d.ts +11 -0
  430. package/models/trace/types/Configuration.js +1 -1
  431. package/models/trace/types/Configuration.js.map +1 -1
  432. package/models/trace/types/Extensions.d.ts +25 -13
  433. package/models/trace/types/Extensions.js +6 -3
  434. package/models/trace/types/Extensions.js.map +1 -1
  435. package/models/trace/types/File.d.ts +12 -0
  436. package/models/trace/types/File.js +1 -1
  437. package/models/trace/types/File.js.map +1 -1
  438. package/models/trace/types/Overlays.d.ts +1 -2
  439. package/models/trace/types/Overlays.js +1 -1
  440. package/models/trace/types/Overlays.js.map +1 -1
  441. package/models/trace/types/Timing.d.ts +1 -0
  442. package/models/trace/types/Timing.js +1 -1
  443. package/models/trace/types/Timing.js.map +1 -1
  444. package/models/trace/types/TraceEvents.d.ts +75 -56
  445. package/models/trace/types/TraceEvents.js +42 -29
  446. package/models/trace/types/TraceEvents.js.map +1 -1
  447. package/models/trace/types/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
  448. package/models/trace/types/types-tsconfig.json +6 -2
  449. package/models/trace/types/types.js +1 -1
  450. package/models/trace/types/types.js.map +1 -1
  451. package/package.json +1 -1
  452. package/test/test-trace-engine.mjs +4 -4
@@ -9,7 +9,7 @@ export declare const UIStrings: {
9
9
  /**
10
10
  * @description Text to describe how to improve the performance of CSS selectors.
11
11
  */
12
- readonly description: "If Recalculate Style costs remain high, selector optimization can reduce them. [Optimize the selectors](https://developer.chrome.com/docs/devtools/performance/selector-stats) with both high elapsed time and high slow-path %. Simpler selectors, fewer selectors, a smaller DOM, and a shallower DOM will all reduce matching costs.";
12
+ readonly description: "If Recalculate Style costs remain high, selector optimization can reduce them. [Optimize the selectors](https://developer.chrome.com/docs/performance/insights/slow-css-selector) with both high elapsed time and high slow-path %. Simpler selectors, fewer selectors, a smaller DOM, and a shallower DOM will all reduce matching costs.";
13
13
  /**
14
14
  * @description Column name for count of elements that the engine attempted to match against a style rule
15
15
  */
@@ -37,7 +37,7 @@ export declare const UIStrings: {
37
37
  /**
38
38
  * @description top CSS selector when ranked by elapsed time in ms
39
39
  */
40
- readonly topSelectorElapsedTime: "Top selector elaspsed time";
40
+ readonly topSelectorElapsedTime: "Top selector elapsed time";
41
41
  /**
42
42
  * @description top CSS selector when ranked by match attempt
43
43
  */
@@ -51,5 +51,6 @@ export type SlowCSSSelectorInsightModel = InsightModel<typeof UIStrings, {
51
51
  topSelectorElapsedMs: Types.Events.SelectorTiming | null;
52
52
  topSelectorMatchAttempts: Types.Events.SelectorTiming | null;
53
53
  }>;
54
- export declare function generateInsight(parsedTrace: Handlers.Types.ParsedTrace, context: InsightSetContext): SlowCSSSelectorInsightModel;
54
+ export declare function isSlowCSSSelectorInsight(model: InsightModel): model is SlowCSSSelectorInsightModel;
55
+ export declare function generateInsight(data: Handlers.Types.HandlerData, context: InsightSetContext): SlowCSSSelectorInsightModel;
55
56
  export declare function createOverlays(_: SlowCSSSelectorInsightModel): Types.Overlays.Overlay[];
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Chromium Authors. All rights reserved.
1
+ // Copyright 2024 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
  // import * as i18n from '../../../core/i18n/i18n.js';
@@ -14,7 +14,7 @@ export const UIStrings = {
14
14
  /**
15
15
  * @description Text to describe how to improve the performance of CSS selectors.
16
16
  */
17
- description: 'If Recalculate Style costs remain high, selector optimization can reduce them. [Optimize the selectors](https://developer.chrome.com/docs/devtools/performance/selector-stats) with both high elapsed time and high slow-path %. Simpler selectors, fewer selectors, a smaller DOM, and a shallower DOM will all reduce matching costs.',
17
+ description: 'If Recalculate Style costs remain high, selector optimization can reduce them. [Optimize the selectors](https://developer.chrome.com/docs/performance/insights/slow-css-selector) with both high elapsed time and high slow-path %. Simpler selectors, fewer selectors, a smaller DOM, and a shallower DOM will all reduce matching costs.',
18
18
  /**
19
19
  * @description Column name for count of elements that the engine attempted to match against a style rule
20
20
  */
@@ -42,7 +42,7 @@ export const UIStrings = {
42
42
  /**
43
43
  * @description top CSS selector when ranked by elapsed time in ms
44
44
  */
45
- topSelectorElapsedTime: 'Top selector elaspsed time',
45
+ topSelectorElapsedTime: 'Top selector elapsed time',
46
46
  /**
47
47
  * @description top CSS selector when ranked by match attempt
48
48
  */
@@ -53,7 +53,7 @@ export const i18nString = (i18nId, values) => ({i18nId, values}); // i18n.i18n.g
53
53
  const slowCSSSelectorThreshold = 500; // 500us threshold for slow selectors
54
54
  function aggregateSelectorStats(data, context) {
55
55
  const selectorMap = new Map();
56
- for (const [event, value] of data.dataForUpdateLayoutEvent) {
56
+ for (const [event, value] of data.dataForRecalcStyleEvent) {
57
57
  if (event.args.beginData?.frame !== context.frameId) {
58
58
  continue;
59
59
  }
@@ -82,13 +82,17 @@ function finalize(partialModel) {
82
82
  strings: UIStrings,
83
83
  title: i18nString(UIStrings.title),
84
84
  description: i18nString(UIStrings.description),
85
+ docs: 'https://developer.chrome.com/docs/performance/insights/slow-css-selector',
85
86
  category: InsightCategory.ALL,
86
87
  state: partialModel.topSelectorElapsedMs && partialModel.topSelectorMatchAttempts ? 'informative' : 'pass',
87
88
  ...partialModel,
88
89
  };
89
90
  }
90
- export function generateInsight(parsedTrace, context) {
91
- const selectorStatsData = parsedTrace.SelectorStats;
91
+ export function isSlowCSSSelectorInsight(model) {
92
+ return model.insightKey === InsightKeys.SLOW_CSS_SELECTOR;
93
+ }
94
+ export function generateInsight(data, context) {
95
+ const selectorStatsData = data.SelectorStats;
92
96
  if (!selectorStatsData) {
93
97
  throw new Error('no selector stats data');
94
98
  }
@@ -118,7 +122,7 @@ export function generateInsight(parsedTrace, context) {
118
122
  });
119
123
  }
120
124
  return finalize({
121
- // TODO: should we identify UpdateLayout events as linked to this insight?
125
+ // TODO: should we identify RecalcStyle events as linked to this insight?
122
126
  relatedEvents: [],
123
127
  totalElapsedMs: Types.Timing.Milli(totalElapsedUs / 1000.0),
124
128
  totalMatchAttempts,
@@ -1 +1 @@
1
- {"version":3,"file":"SlowCSSSelector.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/SlowCSSSelector.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AAGnD,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAsB,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AAChF,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EACL,eAAe,EACf,WAAW,GAIZ,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;;OAEG;IACH,KAAK,EAAE,oBAAoB;IAE3B;;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CAAC,GAAG,CAAC,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3F,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;QACd,0EAA0E;QAC1E,aAAa,EAAE,EAAE;QACjB,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,GAAG,MAAM,CAAC;QAC3D,kBAAkB;QAClB,eAAe;QACf,oBAAoB;QACpB,wBAAwB;KACzB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,CAA8B;IAC3D,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\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 Handlers from '../handlers/handlers.js';\nimport type {SelectorStatsData} from '../handlers/SelectorStatsHandler.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport {type SelectorTiming, SelectorTimingsKey} from '../types/TraceEvents.js';\nimport * 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 Title of an insight that provides details about slow CSS selectors.\n */\n title: 'CSS Selector costs',\n\n /**\n * @description Text to describe how to improve the performance of CSS selectors.\n */\n description:\n 'If Recalculate Style costs remain high, selector optimization can reduce them. [Optimize the selectors](https://developer.chrome.com/docs/devtools/performance/selector-stats) with both high elapsed time and high slow-path %. Simpler selectors, fewer selectors, a smaller DOM, and a shallower DOM will all reduce matching costs.',\n /**\n * @description Column name for count of elements that the engine attempted to match against a style rule\n */\n matchAttempts: 'Match attempts',\n /**\n * @description Column name for count of elements that matched a style rule\n */\n matchCount: 'Match count',\n /**\n * @description Column name for elapsed time spent computing a style rule\n */\n elapsed: 'Elapsed time',\n /**\n * @description Column name for the selectors that took the longest amount of time/effort.\n */\n topSelectors: 'Top selectors',\n /**\n * @description Column name for a total sum.\n */\n total: 'Total',\n /**\n * @description Text status indicating that no CSS selector data was found.\n */\n enableSelectorData:\n 'No CSS selector data was found. CSS selector stats need to be enabled in the performance panel settings.',\n /**\n * @description top CSS selector when ranked by elapsed time in ms\n */\n topSelectorElapsedTime: 'Top selector elaspsed time',\n /**\n * @description top CSS selector when ranked by match attempt\n */\n topSelectorMatchAttempt: 'Top selector match attempt',\n} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/SlowCSSSelector.ts', UIStrings);\nexport const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);\nconst slowCSSSelectorThreshold = 500; // 500us threshold for slow selectors\n\nexport type SlowCSSSelectorInsightModel = InsightModel<typeof UIStrings, {\n totalElapsedMs: Types.Timing.Milli,\n totalMatchAttempts: number,\n totalMatchCount: number,\n topSelectorElapsedMs: Types.Events.SelectorTiming | null,\n topSelectorMatchAttempts: Types.Events.SelectorTiming | null,\n}>;\n\nfunction aggregateSelectorStats(data: SelectorStatsData, context: InsightSetContext): SelectorTiming[] {\n const selectorMap = new Map<String, SelectorTiming>();\n\n for (const [event, value] of data.dataForUpdateLayoutEvent) {\n if (event.args.beginData?.frame !== context.frameId) {\n continue;\n }\n if (!Helpers.Timing.eventIsInBounds(event, context.bounds)) {\n continue;\n }\n for (const timing of value.timings) {\n const key = timing[SelectorTimingsKey.Selector] + '_' + timing[SelectorTimingsKey.StyleSheetId];\n const findTiming = selectorMap.get(key);\n if (findTiming !== undefined) {\n findTiming[SelectorTimingsKey.Elapsed] += timing[SelectorTimingsKey.Elapsed];\n findTiming[SelectorTimingsKey.FastRejectCount] += timing[SelectorTimingsKey.FastRejectCount];\n findTiming[SelectorTimingsKey.MatchAttempts] += timing[SelectorTimingsKey.MatchAttempts];\n findTiming[SelectorTimingsKey.MatchCount] += timing[SelectorTimingsKey.MatchCount];\n } else {\n selectorMap.set(key, {...timing});\n }\n }\n }\n\n return [...selectorMap.values()];\n}\n\nfunction finalize(partialModel: PartialInsightModel<SlowCSSSelectorInsightModel>): SlowCSSSelectorInsightModel {\n return {\n insightKey: InsightKeys.SLOW_CSS_SELECTOR,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n category: InsightCategory.ALL,\n state: partialModel.topSelectorElapsedMs && partialModel.topSelectorMatchAttempts ? 'informative' : 'pass',\n ...partialModel,\n };\n}\n\nexport function generateInsight(\n parsedTrace: Handlers.Types.ParsedTrace, context: InsightSetContext): SlowCSSSelectorInsightModel {\n const selectorStatsData = parsedTrace.SelectorStats;\n\n if (!selectorStatsData) {\n throw new Error('no selector stats data');\n }\n\n const selectorTimings = aggregateSelectorStats(selectorStatsData, context);\n\n let totalElapsedUs = 0;\n let totalMatchAttempts = 0;\n let totalMatchCount = 0;\n\n selectorTimings.map(timing => {\n totalElapsedUs += timing[SelectorTimingsKey.Elapsed];\n totalMatchAttempts += timing[SelectorTimingsKey.MatchAttempts];\n totalMatchCount += timing[SelectorTimingsKey.MatchCount];\n });\n\n let topSelectorElapsedMs: SelectorTiming|null = null;\n let topSelectorMatchAttempts: SelectorTiming|null = null;\n\n if (selectorTimings.length > 0) {\n // find the selector with most elapsed time\n topSelectorElapsedMs = selectorTimings.reduce((a, b) => {\n return a[SelectorTimingsKey.Elapsed] > b[SelectorTimingsKey.Elapsed] ? a : b;\n });\n\n // check if the slowest selector is slow enough to trigger insights info\n if (topSelectorElapsedMs && topSelectorElapsedMs[SelectorTimingsKey.Elapsed] < slowCSSSelectorThreshold) {\n topSelectorElapsedMs = null;\n }\n\n // find the selector with most match attempts\n topSelectorMatchAttempts = selectorTimings.reduce((a, b) => {\n return a[SelectorTimingsKey.MatchAttempts] > b[SelectorTimingsKey.MatchAttempts] ? a : b;\n });\n }\n\n return finalize({\n // TODO: should we identify UpdateLayout events as linked to this insight?\n relatedEvents: [],\n totalElapsedMs: Types.Timing.Milli(totalElapsedUs / 1000.0),\n totalMatchAttempts,\n totalMatchCount,\n topSelectorElapsedMs,\n topSelectorMatchAttempts,\n });\n}\n\nexport function createOverlays(_: SlowCSSSelectorInsightModel): Types.Overlays.Overlay[] {\n return [];\n}\n"]}
1
+ {"version":3,"file":"SlowCSSSelector.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/SlowCSSSelector.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AAGnD,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAsB,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AAChF,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EACL,eAAe,EACf,WAAW,GAIZ,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;;OAEG;IACH,KAAK,EAAE,oBAAoB;IAE3B;;OAEG;IACH,WAAW,EACP,4UAA4U;IAChV;;OAEG;IACH,aAAa,EAAE,gBAAgB;IAC/B;;OAEG;IACH,UAAU,EAAE,aAAa;IACzB;;OAEG;IACH,OAAO,EAAE,cAAc;IACvB;;OAEG;IACH,YAAY,EAAE,eAAe;IAC7B;;OAEG;IACH,KAAK,EAAE,OAAO;IACd;;OAEG;IACH,kBAAkB,EACd,0GAA0G;IAC9G;;OAEG;IACH,sBAAsB,EAAE,2BAA2B;IACnD;;OAEG;IACH,uBAAuB,EAAE,4BAA4B;CAC7C,CAAC;AAEX,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,0CAA0C,EAAE,SAAS,CAAC,CAAC;AAChG,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC7E,MAAM,wBAAwB,GAAG,GAAG,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 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 Handlers from '../handlers/handlers.js';\nimport type {SelectorStatsData} from '../handlers/SelectorStatsHandler.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport {type SelectorTiming, SelectorTimingsKey} from '../types/TraceEvents.js';\nimport * 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 Title of an insight that provides details about slow CSS selectors.\n */\n title: 'CSS Selector costs',\n\n /**\n * @description Text to describe how to improve the performance of CSS selectors.\n */\n description:\n 'If Recalculate Style costs remain high, selector optimization can reduce them. [Optimize the selectors](https://developer.chrome.com/docs/performance/insights/slow-css-selector) with both high elapsed time and high slow-path %. Simpler selectors, fewer selectors, a smaller DOM, and a shallower DOM will all reduce matching costs.',\n /**\n * @description Column name for count of elements that the engine attempted to match against a style rule\n */\n matchAttempts: 'Match attempts',\n /**\n * @description Column name for count of elements that matched a style rule\n */\n matchCount: 'Match count',\n /**\n * @description Column name for elapsed time spent computing a style rule\n */\n elapsed: 'Elapsed time',\n /**\n * @description Column name for the selectors that took the longest amount of time/effort.\n */\n topSelectors: 'Top selectors',\n /**\n * @description Column name for a total sum.\n */\n total: 'Total',\n /**\n * @description Text status indicating that no CSS selector data was found.\n */\n enableSelectorData:\n 'No CSS selector data was found. CSS selector stats need to be enabled in the performance panel settings.',\n /**\n * @description top CSS selector when ranked by elapsed time in ms\n */\n topSelectorElapsedTime: 'Top selector elapsed time',\n /**\n * @description top CSS selector when ranked by match attempt\n */\n topSelectorMatchAttempt: 'Top selector match attempt',\n} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/SlowCSSSelector.ts', UIStrings);\nexport const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);\nconst slowCSSSelectorThreshold = 500; // 500us threshold for slow selectors\n\nexport type SlowCSSSelectorInsightModel = InsightModel<typeof UIStrings, {\n totalElapsedMs: Types.Timing.Milli,\n totalMatchAttempts: number,\n totalMatchCount: number,\n topSelectorElapsedMs: Types.Events.SelectorTiming | null,\n topSelectorMatchAttempts: Types.Events.SelectorTiming | null,\n}>;\n\nfunction aggregateSelectorStats(data: SelectorStatsData, context: InsightSetContext): SelectorTiming[] {\n const selectorMap = new Map<String, SelectorTiming>();\n\n for (const [event, value] of data.dataForRecalcStyleEvent) {\n if (event.args.beginData?.frame !== context.frameId) {\n continue;\n }\n if (!Helpers.Timing.eventIsInBounds(event, context.bounds)) {\n continue;\n }\n for (const timing of value.timings) {\n const key = timing[SelectorTimingsKey.Selector] + '_' + timing[SelectorTimingsKey.StyleSheetId];\n const findTiming = selectorMap.get(key);\n if (findTiming !== undefined) {\n findTiming[SelectorTimingsKey.Elapsed] += timing[SelectorTimingsKey.Elapsed];\n findTiming[SelectorTimingsKey.FastRejectCount] += timing[SelectorTimingsKey.FastRejectCount];\n findTiming[SelectorTimingsKey.MatchAttempts] += timing[SelectorTimingsKey.MatchAttempts];\n findTiming[SelectorTimingsKey.MatchCount] += timing[SelectorTimingsKey.MatchCount];\n } else {\n selectorMap.set(key, {...timing});\n }\n }\n }\n\n return [...selectorMap.values()];\n}\n\nfunction finalize(partialModel: PartialInsightModel<SlowCSSSelectorInsightModel>): SlowCSSSelectorInsightModel {\n return {\n insightKey: InsightKeys.SLOW_CSS_SELECTOR,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n docs: 'https://developer.chrome.com/docs/performance/insights/slow-css-selector',\n category: InsightCategory.ALL,\n state: partialModel.topSelectorElapsedMs && partialModel.topSelectorMatchAttempts ? 'informative' : 'pass',\n ...partialModel,\n };\n}\n\nexport function isSlowCSSSelectorInsight(model: InsightModel): model is SlowCSSSelectorInsightModel {\n return model.insightKey === InsightKeys.SLOW_CSS_SELECTOR;\n}\n\nexport function generateInsight(\n data: Handlers.Types.HandlerData, context: InsightSetContext): SlowCSSSelectorInsightModel {\n const selectorStatsData = data.SelectorStats;\n\n if (!selectorStatsData) {\n throw new Error('no selector stats data');\n }\n\n const selectorTimings = aggregateSelectorStats(selectorStatsData, context);\n\n let totalElapsedUs = 0;\n let totalMatchAttempts = 0;\n let totalMatchCount = 0;\n\n selectorTimings.map(timing => {\n totalElapsedUs += timing[SelectorTimingsKey.Elapsed];\n totalMatchAttempts += timing[SelectorTimingsKey.MatchAttempts];\n totalMatchCount += timing[SelectorTimingsKey.MatchCount];\n });\n\n let topSelectorElapsedMs: SelectorTiming|null = null;\n let topSelectorMatchAttempts: SelectorTiming|null = null;\n\n if (selectorTimings.length > 0) {\n // find the selector with most elapsed time\n topSelectorElapsedMs = selectorTimings.reduce((a, b) => {\n return a[SelectorTimingsKey.Elapsed] > b[SelectorTimingsKey.Elapsed] ? a : b;\n });\n\n // check if the slowest selector is slow enough to trigger insights info\n if (topSelectorElapsedMs && topSelectorElapsedMs[SelectorTimingsKey.Elapsed] < slowCSSSelectorThreshold) {\n topSelectorElapsedMs = null;\n }\n\n // find the selector with most match attempts\n topSelectorMatchAttempts = selectorTimings.reduce((a, b) => {\n return a[SelectorTimingsKey.MatchAttempts] > b[SelectorTimingsKey.MatchAttempts] ? a : b;\n });\n }\n\n return finalize({\n // TODO: should we identify RecalcStyle events as linked to this insight?\n relatedEvents: [],\n totalElapsedMs: Types.Timing.Milli(totalElapsedUs / 1000.0),\n totalMatchAttempts,\n totalMatchCount,\n topSelectorElapsedMs,\n topSelectorMatchAttempts,\n });\n}\n\nexport function createOverlays(_: SlowCSSSelectorInsightModel): Types.Overlays.Overlay[] {\n return [];\n}\n"]}
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Chromium Authors. All rights reserved.
1
+ // Copyright 2024 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
  // Lifted from Lighthouse: https://github.com/GoogleChrome/lighthouse/blob/36cac182a6c637b1671c57326d7c0241633d0076/shared/statistics.js
@@ -1 +1 @@
1
- {"version":3,"file":"Statistics.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/Statistics.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,wIAAwI;AAExI;;;;GAIG;AAEH,6EAA6E;AAC7E,MAAM,iBAAiB,GAAG,uDAAuD,CAAC;AAClF,MAAM,iBAAiB,GAAG,qDAAqD,CAAC;AAChF,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAC9B,MAAM,iBAAiB,GAAG,wDAAwD,CAAC;AAEnF;;;;GAIG;AACH,SAAS,GAAG,CAAC,CAAS;IACpB,qBAAqB;IACrB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAEhB,MAAM,EAAE,GAAG,WAAW,CAAC;IACvB,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC;IACxB,MAAM,EAAE,GAAG,WAAW,CAAC;IACvB,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC;IACxB,MAAM,EAAE,GAAG,WAAW,CAAC;IACvB,MAAM,CAAC,GAAG,SAAS,CAAC;IACpB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,OAAO,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC;AA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QACjB,8BAA8B;QAC9B,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC;IAC5E,CAAC;SAAM,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,gCAAgC;QAChC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,uBAAuB,CAAC,CAAC,CAAC;IAC5F,CAAC;SAAM,CAAC;QACN,8BAA8B;QAC9B,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,uBAAuB,CAAC,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,CAAS;IAC3F,MAAM,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACpC,OAAO,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;AAC/B,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n// Lifted from Lighthouse: https://github.com/GoogleChrome/lighthouse/blob/36cac182a6c637b1671c57326d7c0241633d0076/shared/statistics.js\n\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// The exact double values for the max and min scores possible in each range.\nconst MIN_PASSING_SCORE = 0.90000000000000002220446049250313080847263336181640625;\nconst MAX_AVERAGE_SCORE = 0.899999999999999911182158029987476766109466552734375;\nconst MIN_AVERAGE_SCORE = 0.5;\nconst MAX_FAILING_SCORE = 0.499999999999999944488848768742172978818416595458984375;\n\n/**\n * Approximates the Gauss error function, the probability that a random variable\n * from the standard normal distribution lies within [-x, x]. Moved from\n * traceviewer.b.math.erf, based on Abramowitz and Stegun, formula 7.1.26.\n */\nfunction erf(x: number): number {\n // erf(-x) = -erf(x);\n const sign = Math.sign(x);\n x = Math.abs(x);\n\n const a1 = 0.254829592;\n const a2 = -0.284496736;\n const a3 = 1.421413741;\n const a4 = -1.453152027;\n const a5 = 1.061405429;\n const p = 0.3275911;\n const t = 1 / (1 + p * x);\n const y = t * (a1 + t * (a2 + t * (a3 + t * (a4 + t * a5))));\n return sign * (1 - y * Math.exp(-x * x));\n}\n\n/**\n * Returns the score (1 - percentile) of `value` in a log-normal distribution\n * specified by the `median` value, at which the score will be 0.5, and a 10th\n * percentile value, at which the score will be 0.9. The score represents the\n * amount of the distribution greater than `value`. All values should be in the\n * same units (e.g. milliseconds). See\n * https://www.desmos.com/calculator/o98tbeyt1t\n * for an interactive view of the relationship between these parameters and the\n * typical parameterization (location and shape) of the log-normal distribution.\n */\nexport function getLogNormalScore({median, p10}: {median: number, p10: number}, value: number): number {\n // Required for the log-normal distribution.\n if (median <= 0) {\n throw new Error('median must be greater than zero');\n }\n if (p10 <= 0) {\n throw new Error('p10 must be greater than zero');\n }\n // Not strictly required, but if p10 > median, it flips around and becomes the p90 point.\n if (p10 >= median) {\n throw new Error('p10 must be less than the median');\n }\n\n // Non-positive values aren't in the distribution, so always 1.\n if (value <= 0) {\n return 1;\n }\n\n // Closest double to `erfc-1(1/5)`.\n const INVERSE_ERFC_ONE_FIFTH = 0.9061938024368232;\n\n // Shape (σ) is `|log(p10/median) / (sqrt(2)*erfc^-1(1/5))|` and\n // standardizedX is `1/2 erfc(log(value/median) / (sqrt(2)*σ))`, so simplify a bit.\n const xRatio = Math.max(Number.MIN_VALUE, value / median); // value and median are > 0, so is ratio.\n const xLogRatio = Math.log(xRatio);\n const p10Ratio = Math.max(Number.MIN_VALUE, p10 / median); // p10 and median are > 0, so is ratio.\n const p10LogRatio = -Math.log(p10Ratio); // negate to keep σ positive.\n const standardizedX = xLogRatio * INVERSE_ERFC_ONE_FIFTH / p10LogRatio;\n const complementaryPercentile = (1 - erf(standardizedX)) / 2;\n\n // Clamp to avoid floating-point out-of-bounds issues and keep score in expected range.\n let score;\n if (value <= p10) {\n // Passing. Clamp to [0.9, 1].\n score = Math.max(MIN_PASSING_SCORE, Math.min(1, complementaryPercentile));\n } else if (value <= median) {\n // Average. Clamp to [0.5, 0.9).\n score = Math.max(MIN_AVERAGE_SCORE, Math.min(MAX_AVERAGE_SCORE, complementaryPercentile));\n } else {\n // Failing. Clamp to [0, 0.5).\n score = Math.max(0, Math.min(MAX_FAILING_SCORE, complementaryPercentile));\n }\n return score;\n}\n\n/**\n * Interpolates the y value at a point x on the line defined by (x0, y0) and (x1, y1)\n */\nexport function linearInterpolation(x0: number, y0: number, x1: number, y1: number, x: number): number {\n const slope = (y1 - y0) / (x1 - x0);\n return y0 + (x - x0) * slope;\n}\n"]}
1
+ {"version":3,"file":"Statistics.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/Statistics.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,wIAAwI;AAExI;;;;GAIG;AAEH,6EAA6E;AAC7E,MAAM,iBAAiB,GAAG,uDAAuD,CAAC;AAClF,MAAM,iBAAiB,GAAG,qDAAqD,CAAC;AAChF,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAC9B,MAAM,iBAAiB,GAAG,wDAAwD,CAAC;AAEnF;;;;GAIG;AACH,SAAS,GAAG,CAAC,CAAS;IACpB,qBAAqB;IACrB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAEhB,MAAM,EAAE,GAAG,WAAW,CAAC;IACvB,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC;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,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACpC,OAAO,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;AAC/B,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\n// Lifted from Lighthouse: https://github.com/GoogleChrome/lighthouse/blob/36cac182a6c637b1671c57326d7c0241633d0076/shared/statistics.js\n\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// The exact double values for the max and min scores possible in each range.\nconst MIN_PASSING_SCORE = 0.90000000000000002220446049250313080847263336181640625;\nconst MAX_AVERAGE_SCORE = 0.899999999999999911182158029987476766109466552734375;\nconst MIN_AVERAGE_SCORE = 0.5;\nconst MAX_FAILING_SCORE = 0.499999999999999944488848768742172978818416595458984375;\n\n/**\n * Approximates the Gauss error function, the probability that a random variable\n * from the standard normal distribution lies within [-x, x]. Moved from\n * traceviewer.b.math.erf, based on Abramowitz and Stegun, formula 7.1.26.\n */\nfunction erf(x: number): number {\n // erf(-x) = -erf(x);\n const sign = Math.sign(x);\n x = Math.abs(x);\n\n const a1 = 0.254829592;\n const a2 = -0.284496736;\n const a3 = 1.421413741;\n const a4 = -1.453152027;\n const a5 = 1.061405429;\n const p = 0.3275911;\n const t = 1 / (1 + p * x);\n const y = t * (a1 + t * (a2 + t * (a3 + t * (a4 + t * a5))));\n return sign * (1 - y * Math.exp(-x * x));\n}\n\n/**\n * Returns the score (1 - percentile) of `value` in a log-normal distribution\n * specified by the `median` value, at which the score will be 0.5, and a 10th\n * percentile value, at which the score will be 0.9. The score represents the\n * amount of the distribution greater than `value`. All values should be in the\n * same units (e.g. milliseconds). See\n * https://www.desmos.com/calculator/o98tbeyt1t\n * for an interactive view of the relationship between these parameters and the\n * typical parameterization (location and shape) of the log-normal distribution.\n */\nexport function getLogNormalScore({median, p10}: {median: number, p10: number}, value: number): number {\n // Required for the log-normal distribution.\n if (median <= 0) {\n throw new Error('median must be greater than zero');\n }\n if (p10 <= 0) {\n throw new Error('p10 must be greater than zero');\n }\n // Not strictly required, but if p10 > median, it flips around and becomes the p90 point.\n if (p10 >= median) {\n throw new Error('p10 must be less than the median');\n }\n\n // Non-positive values aren't in the distribution, so always 1.\n if (value <= 0) {\n return 1;\n }\n\n // Closest double to `erfc-1(1/5)`.\n const INVERSE_ERFC_ONE_FIFTH = 0.9061938024368232;\n\n // Shape (σ) is `|log(p10/median) / (sqrt(2)*erfc^-1(1/5))|` and\n // standardizedX is `1/2 erfc(log(value/median) / (sqrt(2)*σ))`, so simplify a bit.\n const xRatio = Math.max(Number.MIN_VALUE, value / median); // value and median are > 0, so is ratio.\n const xLogRatio = Math.log(xRatio);\n const p10Ratio = Math.max(Number.MIN_VALUE, p10 / median); // p10 and median are > 0, so is ratio.\n const p10LogRatio = -Math.log(p10Ratio); // negate to keep σ positive.\n const standardizedX = xLogRatio * INVERSE_ERFC_ONE_FIFTH / p10LogRatio;\n const complementaryPercentile = (1 - erf(standardizedX)) / 2;\n\n // Clamp to avoid floating-point out-of-bounds issues and keep score in expected range.\n let score;\n if (value <= p10) {\n // Passing. Clamp to [0.9, 1].\n score = Math.max(MIN_PASSING_SCORE, Math.min(1, complementaryPercentile));\n } else if (value <= median) {\n // Average. Clamp to [0.5, 0.9).\n score = Math.max(MIN_AVERAGE_SCORE, Math.min(MAX_AVERAGE_SCORE, complementaryPercentile));\n } else {\n // Failing. Clamp to [0, 0.5).\n score = Math.max(0, Math.min(MAX_FAILING_SCORE, complementaryPercentile));\n }\n return score;\n}\n\n/**\n * Interpolates the y value at a point x on the line defined by (x0, y0) and (x1, y1)\n */\nexport function linearInterpolation(x0: number, y0: number, x1: number, y1: number, x: number): number {\n const slope = (y1 - y0) / (x1 - x0);\n return y0 + (x - x0) * slope;\n}\n"]}
@@ -27,6 +27,7 @@ export type ThirdPartiesInsightModel = InsightModel<typeof UIStrings, {
27
27
  entitySummaries: Extras.ThirdParties.EntitySummary[];
28
28
  firstPartyEntity?: Extras.ThirdParties.Entity;
29
29
  }>;
30
- export declare function generateInsight(parsedTrace: Handlers.Types.ParsedTrace, context: InsightSetContext): ThirdPartiesInsightModel;
30
+ export declare function isThirdPartyInsight(model: InsightModel): model is ThirdPartiesInsightModel;
31
+ export declare function generateInsight(data: Handlers.Types.HandlerData, context: InsightSetContext): ThirdPartiesInsightModel;
31
32
  export declare function createOverlaysForSummary(summary: Extras.ThirdParties.EntitySummary): Types.Overlays.Overlay[];
32
33
  export declare function createOverlays(model: ThirdPartiesInsightModel): Types.Overlays.Overlay[];
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Chromium Authors. All rights reserved.
1
+ // Copyright 2024 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
  // import * as i18n from '../../../core/i18n/i18n.js';
@@ -14,7 +14,7 @@ export const UIStrings = {
14
14
  * This is displayed after a user expands the section to see more. No character length limits.
15
15
  */
16
16
  description: '3rd party code can significantly impact load performance. ' +
17
- '[Reduce and defer loading of 3rd party code](https://web.dev/articles/optimizing-content-efficiency-loading-third-party-javascript/) to prioritize your page\'s content.',
17
+ '[Reduce and defer loading of 3rd party code](https://developer.chrome.com/docs/performance/insights/third-parties) to prioritize your page\'s content.',
18
18
  /** Label for a table column that displays the name of a third-party provider. */
19
19
  columnThirdParty: '3rd party',
20
20
  /** Label for a column in a data table; entries will be the download size of a web resource in kilobytes. */
@@ -43,6 +43,7 @@ function finalize(partialModel) {
43
43
  strings: UIStrings,
44
44
  title: i18nString(UIStrings.title),
45
45
  description: i18nString(UIStrings.description),
46
+ docs: 'https://developer.chrome.com/docs/performance/insights/third-parties',
46
47
  category: InsightCategory.ALL,
47
48
  state: partialModel.entitySummaries.find(summary => summary.entity !== partialModel.firstPartyEntity) ?
48
49
  'informative' :
@@ -50,11 +51,14 @@ function finalize(partialModel) {
50
51
  ...partialModel,
51
52
  };
52
53
  }
53
- export function generateInsight(parsedTrace, context) {
54
- const entitySummaries = Extras.ThirdParties.summarizeByThirdParty(parsedTrace, context.bounds);
55
- const firstPartyUrl = context.navigation?.args.data?.documentLoaderURL ?? parsedTrace.Meta.mainFrameURL;
54
+ export function isThirdPartyInsight(model) {
55
+ return model.insightKey === InsightKeys.THIRD_PARTIES;
56
+ }
57
+ export function generateInsight(data, context) {
58
+ const entitySummaries = Extras.ThirdParties.summarizeByThirdParty(data, context.bounds);
59
+ const firstPartyUrl = context.navigation?.args.data?.documentLoaderURL ?? data.Meta.mainFrameURL;
56
60
  const firstPartyEntity = ThirdPartyWeb.ThirdPartyWeb.getEntity(firstPartyUrl) ||
57
- Handlers.Helpers.makeUpEntity(parsedTrace.Renderer.entityMappings.createdEntityCache, firstPartyUrl);
61
+ Handlers.Helpers.makeUpEntity(data.Renderer.entityMappings.createdEntityCache, firstPartyUrl);
58
62
  return finalize({
59
63
  relatedEvents: getRelatedEvents(entitySummaries, firstPartyEntity),
60
64
  firstPartyEntity,
@@ -1 +1 @@
1
- {"version":3,"file":"ThirdParties.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/ThirdParties.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AACnD,OAAO,KAAK,aAAa,MAAM,yDAAyD,CAAC;AACzF,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EACL,eAAe,EACf,WAAW,GAIZ,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,gJAAgJ;IAChJ,KAAK,EAAE,aAAa;IACpB;;;OAGG;IACH,WAAW,EAAE,4DAA4D;QACrE,0KAA0K;IAC9K,iFAAiF;IACjF,gBAAgB,EAAE,WAAW;IAC7B,4GAA4G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K,KAAK,CAAC,gBAAgB,EAAE,CAAC;YAC9C,SAAS;QACX,CAAC;QAED,MAAM,eAAe,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAC;QAC1D,QAAQ,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\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 ThirdPartyWeb from '../../../third_party/third-party-web/third-party-web.js';\nimport * as Extras from '../extras/extras.js';\nimport * as Handlers from '../handlers/handlers.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 /** Title of an insight that provides details about the code on a web page that the user doesn't control (referred to as \"third-party code\"). */\n title: '3rd parties',\n /**\n * @description Description of a DevTools insight that identifies the code on the page that the user doesn't control.\n * This is displayed after a user expands the section to see more. No character length limits.\n */\n description: '3rd party code can significantly impact load performance. ' +\n '[Reduce and defer loading of 3rd party code](https://web.dev/articles/optimizing-content-efficiency-loading-third-party-javascript/) to prioritize your page\\'s content.',\n /** Label for a table column that displays the name of a third-party provider. */\n columnThirdParty: '3rd party',\n /** Label for a column in a data table; entries will be the download size of a web resource in kilobytes. */\n columnTransferSize: 'Transfer size',\n /** Label for a table column that displays how much time each row spent running on the main thread, entries will be the number of milliseconds spent. */\n columnMainThreadTime: 'Main thread time',\n /**\n * @description Text block indicating that no third party content was detected on the page\n */\n noThirdParties: 'No third parties found',\n} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/ThirdParties.ts', UIStrings);\nexport const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);\n\nexport type ThirdPartiesInsightModel = InsightModel<typeof UIStrings, {\n /** The entity for this navigation's URL. Any other entity is from a third party. */\n entitySummaries: Extras.ThirdParties.EntitySummary[],\n firstPartyEntity?: Extras.ThirdParties.Entity,\n}>;\n\nfunction getRelatedEvents(\n summaries: Extras.ThirdParties.EntitySummary[],\n firstPartyEntity: Extras.ThirdParties.Entity|undefined): Types.Events.Event[] {\n const relatedEvents = [];\n for (const summary of summaries) {\n if (summary.entity !== firstPartyEntity) {\n relatedEvents.push(...summary.relatedEvents);\n }\n }\n\n return relatedEvents;\n}\n\nfunction finalize(partialModel: PartialInsightModel<ThirdPartiesInsightModel>): ThirdPartiesInsightModel {\n return {\n insightKey: InsightKeys.THIRD_PARTIES,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n category: InsightCategory.ALL,\n state: partialModel.entitySummaries.find(summary => summary.entity !== partialModel.firstPartyEntity) ?\n 'informative' :\n 'pass',\n ...partialModel,\n };\n}\n\nexport function generateInsight(\n parsedTrace: Handlers.Types.ParsedTrace, context: InsightSetContext): ThirdPartiesInsightModel {\n const entitySummaries =\n Extras.ThirdParties.summarizeByThirdParty(parsedTrace as Handlers.Types.ParsedTrace, context.bounds);\n\n const firstPartyUrl = context.navigation?.args.data?.documentLoaderURL ?? parsedTrace.Meta.mainFrameURL;\n const firstPartyEntity = ThirdPartyWeb.ThirdPartyWeb.getEntity(firstPartyUrl) ||\n Handlers.Helpers.makeUpEntity(parsedTrace.Renderer.entityMappings.createdEntityCache, firstPartyUrl);\n\n return finalize({\n relatedEvents: getRelatedEvents(entitySummaries, firstPartyEntity),\n firstPartyEntity,\n entitySummaries,\n });\n}\n\nexport function createOverlaysForSummary(summary: Extras.ThirdParties.EntitySummary): Types.Overlays.Overlay[] {\n const overlays = [];\n for (const event of summary.relatedEvents) {\n // The events found for a third party can be vast, as they gather every\n // single main thread task along with everything else on the page. If the\n // main thread is busy with large icicles, we can easily create tens of\n // thousands of overlays. Therefore, only create overlays for events of at least 1ms.\n if (event.dur === undefined || event.dur < 1_000) {\n continue;\n }\n\n const overlay: Types.Overlays.Overlay = {\n type: 'ENTRY_OUTLINE',\n entry: event,\n outlineReason: 'INFO',\n };\n overlays.push(overlay);\n }\n return overlays;\n}\n\nexport function createOverlays(model: ThirdPartiesInsightModel): Types.Overlays.Overlay[] {\n const overlays: Types.Overlays.Overlay[] = [];\n const summaries = model.entitySummaries ?? [];\n for (const summary of summaries) {\n if (summary.entity === model.firstPartyEntity) {\n continue;\n }\n\n const summaryOverlays = createOverlaysForSummary(summary);\n overlays.push(...summaryOverlays);\n }\n\n return overlays;\n}\n"]}
1
+ {"version":3,"file":"ThirdParties.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/ThirdParties.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AACnD,OAAO,KAAK,aAAa,MAAM,yDAAyD,CAAC;AACzF,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EACL,eAAe,EACf,WAAW,GAIZ,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,gJAAgJ;IAChJ,KAAK,EAAE,aAAa;IACpB;;;OAGG;IACH,WAAW,EAAE,4DAA4D;QACrE,wJAAwJ;IAC5J,iFAAiF;IACjF,gBAAgB,EAAE,WAAW;IAC7B,4GAA4G;IAC5G,kBAAkB,EAAE,eAAe;IACnC,wJAAwJ;IACxJ,oBAAoB,EAAE,kBAAkB;IACxC;;OAEG;IACH,cAAc,EAAE,wBAAwB;CAChC,CAAC;AAEX,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,uCAAuC,EAAE,SAAS,CAAC,CAAC;AAC7F,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC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,QAAQ,CAAC;AAClB,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 ThirdPartyWeb from '../../../third_party/third-party-web/third-party-web.js';\nimport * as Extras from '../extras/extras.js';\nimport * as Handlers from '../handlers/handlers.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 /** Title of an insight that provides details about the code on a web page that the user doesn't control (referred to as \"third-party code\"). */\n title: '3rd parties',\n /**\n * @description Description of a DevTools insight that identifies the code on the page that the user doesn't control.\n * This is displayed after a user expands the section to see more. No character length limits.\n */\n description: '3rd party code can significantly impact load performance. ' +\n '[Reduce and defer loading of 3rd party code](https://developer.chrome.com/docs/performance/insights/third-parties) to prioritize your page\\'s content.',\n /** Label for a table column that displays the name of a third-party provider. */\n columnThirdParty: '3rd party',\n /** Label for a column in a data table; entries will be the download size of a web resource in kilobytes. */\n columnTransferSize: 'Transfer size',\n /** Label for a table column that displays how much time each row spent running on the main thread, entries will be the number of milliseconds spent. */\n columnMainThreadTime: 'Main thread time',\n /**\n * @description Text block indicating that no third party content was detected on the page\n */\n noThirdParties: 'No third parties found',\n} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/ThirdParties.ts', UIStrings);\nexport const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);\n\nexport type ThirdPartiesInsightModel = InsightModel<typeof UIStrings, {\n /** The entity for this navigation's URL. Any other entity is from a third party. */\n entitySummaries: Extras.ThirdParties.EntitySummary[],\n firstPartyEntity?: Extras.ThirdParties.Entity,\n}>;\n\nfunction getRelatedEvents(\n summaries: Extras.ThirdParties.EntitySummary[],\n firstPartyEntity: Extras.ThirdParties.Entity|undefined): Types.Events.Event[] {\n const relatedEvents = [];\n for (const summary of summaries) {\n if (summary.entity !== firstPartyEntity) {\n relatedEvents.push(...summary.relatedEvents);\n }\n }\n\n return relatedEvents;\n}\n\nfunction finalize(partialModel: PartialInsightModel<ThirdPartiesInsightModel>): ThirdPartiesInsightModel {\n return {\n insightKey: InsightKeys.THIRD_PARTIES,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n docs: 'https://developer.chrome.com/docs/performance/insights/third-parties',\n category: InsightCategory.ALL,\n state: partialModel.entitySummaries.find(summary => summary.entity !== partialModel.firstPartyEntity) ?\n 'informative' :\n 'pass',\n ...partialModel,\n };\n}\n\nexport function isThirdPartyInsight(model: InsightModel): model is ThirdPartiesInsightModel {\n return model.insightKey === InsightKeys.THIRD_PARTIES;\n}\n\nexport function generateInsight(\n data: Handlers.Types.HandlerData, context: InsightSetContext): ThirdPartiesInsightModel {\n const entitySummaries = Extras.ThirdParties.summarizeByThirdParty(data as Handlers.Types.HandlerData, context.bounds);\n\n const firstPartyUrl = context.navigation?.args.data?.documentLoaderURL ?? data.Meta.mainFrameURL;\n const firstPartyEntity = ThirdPartyWeb.ThirdPartyWeb.getEntity(firstPartyUrl) ||\n Handlers.Helpers.makeUpEntity(data.Renderer.entityMappings.createdEntityCache, firstPartyUrl);\n\n return finalize({\n relatedEvents: getRelatedEvents(entitySummaries, firstPartyEntity),\n firstPartyEntity,\n entitySummaries,\n });\n}\n\nexport function createOverlaysForSummary(summary: Extras.ThirdParties.EntitySummary): Types.Overlays.Overlay[] {\n const overlays = [];\n for (const event of summary.relatedEvents) {\n // The events found for a third party can be vast, as they gather every\n // single main thread task along with everything else on the page. If the\n // main thread is busy with large icicles, we can easily create tens of\n // thousands of overlays. Therefore, only create overlays for events of at least 1ms.\n if (event.dur === undefined || event.dur < 1_000) {\n continue;\n }\n\n const overlay: Types.Overlays.Overlay = {\n type: 'ENTRY_OUTLINE',\n entry: event,\n outlineReason: 'INFO',\n };\n overlays.push(overlay);\n }\n return overlays;\n}\n\nexport function createOverlays(model: ThirdPartiesInsightModel): Types.Overlays.Overlay[] {\n const overlays: Types.Overlays.Overlay[] = [];\n const summaries = model.entitySummaries ?? [];\n for (const summary of summaries) {\n if (summary.entity === model.firstPartyEntity) {\n continue;\n }\n\n const summaryOverlays = createOverlaysForSummary(summary);\n overlays.push(...summaryOverlays);\n }\n\n return overlays;\n}\n"]}
@@ -8,7 +8,7 @@ export declare const UIStrings: {
8
8
  /**
9
9
  * @description Text to tell the user how a viewport meta element can improve performance. \xa0 is a non-breaking space
10
10
  */
11
- readonly description: "Tap interactions may be [delayed by up to 300 ms](https://developer.chrome.com/blog/300ms-tap-delay-gone-away/) if the viewport is not optimized for mobile.";
11
+ readonly description: "Tap interactions may be [delayed by up to 300 ms](https://developer.chrome.com/docs/performance/insights/viewport) if the viewport is not optimized for mobile.";
12
12
  /**
13
13
  * @description Text for a label describing the portion of an interaction event that was delayed due to a bad mobile viewport.
14
14
  */
@@ -20,5 +20,6 @@ export type ViewportInsightModel = InsightModel<typeof UIStrings, {
20
20
  viewportEvent?: Types.Events.ParseMetaViewport;
21
21
  longPointerInteractions?: Types.Events.SyntheticInteractionPair[];
22
22
  }>;
23
- export declare function generateInsight(parsedTrace: Handlers.Types.ParsedTrace, context: InsightSetContext): ViewportInsightModel;
23
+ export declare function isViewportInsight(model: InsightModel): model is ViewportInsightModel;
24
+ export declare function generateInsight(data: Handlers.Types.HandlerData, context: InsightSetContext): ViewportInsightModel;
24
25
  export declare function createOverlays(model: ViewportInsightModel): Types.Overlays.Overlay[];
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Chromium Authors. All rights reserved.
1
+ // Copyright 2024 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
  // import * as i18n from '../../../core/i18n/i18n.js';
@@ -13,7 +13,7 @@ export const UIStrings = {
13
13
  /**
14
14
  * @description Text to tell the user how a viewport meta element can improve performance. \xa0 is a non-breaking space
15
15
  */
16
- description: 'Tap interactions may be [delayed by up to 300\xA0ms](https://developer.chrome.com/blog/300ms-tap-delay-gone-away/) if the viewport is not optimized for mobile.',
16
+ description: 'Tap interactions may be [delayed by up to 300\xA0ms](https://developer.chrome.com/docs/performance/insights/viewport) if the viewport is not optimized for mobile.',
17
17
  /**
18
18
  * @description Text for a label describing the portion of an interaction event that was delayed due to a bad mobile viewport.
19
19
  */
@@ -27,19 +27,23 @@ function finalize(partialModel) {
27
27
  strings: UIStrings,
28
28
  title: i18nString(UIStrings.title),
29
29
  description: i18nString(UIStrings.description),
30
+ docs: 'https://developer.chrome.com/docs/performance/insights/viewport',
30
31
  category: InsightCategory.INP,
31
32
  state: partialModel.mobileOptimized === false ? 'fail' : 'pass',
32
33
  ...partialModel,
33
34
  };
34
35
  }
35
- export function generateInsight(parsedTrace, context) {
36
- const viewportEvent = parsedTrace.UserInteractions.parseMetaViewportEvents.find(event => {
36
+ export function isViewportInsight(model) {
37
+ return model.insightKey === InsightKeys.VIEWPORT;
38
+ }
39
+ export function generateInsight(data, context) {
40
+ const viewportEvent = data.UserInteractions.parseMetaViewportEvents.find(event => {
37
41
  if (event.args.data.frame !== context.frameId) {
38
42
  return false;
39
43
  }
40
44
  return Helpers.Timing.eventIsInBounds(event, context.bounds);
41
45
  });
42
- const compositorEvents = parsedTrace.UserInteractions.beginCommitCompositorFrameEvents.filter(event => {
46
+ const compositorEvents = data.UserInteractions.beginCommitCompositorFrameEvents.filter(event => {
43
47
  if (event.args.frame !== context.frameId) {
44
48
  return false;
45
49
  }
@@ -61,7 +65,7 @@ export function generateInsight(parsedTrace, context) {
61
65
  for (const event of compositorEvents) {
62
66
  if (!event.args.is_mobile_optimized) {
63
67
  // Grab all the pointer events with at least 50ms of input delay.
64
- const longPointerInteractions = [...parsedTrace.UserInteractions.interactionsOverThreshold.values()].filter(interaction => Handlers.ModelHandlers.UserInteractions.categoryOfInteraction(interaction) === 'POINTER' &&
68
+ const longPointerInteractions = [...data.UserInteractions.interactionsOverThreshold.values()].filter(interaction => Handlers.ModelHandlers.UserInteractions.categoryOfInteraction(interaction) === 'POINTER' &&
65
69
  interaction.inputDelay >= 50_000);
66
70
  // The actual impact varies between 0 and 300.
67
71
  // Using inputDelay as the closest thing we have for measuring this, though inputDelay may be high for other reasons.
@@ -1 +1 @@
1
- {"version":3,"file":"Viewport.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/Viewport.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AACnD,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EACL,eAAe,EACf,WAAW,EAGX,cAAc,GAEf,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,8GAA8G;IAC9G,KAAK,EAAE,8BAA8B;IACrC;;OAEG;IACH,WAAW,EACP,iKAAiK;IACrK;;OAEG;IACH,mBAAmB,EAAE,kBAAkB;CAC/B,CAAC;AAEX,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,mCAAmC,EAAE,SAAS,CAAC,CAAC;AACzF,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAQ7E,SAAS,QAAQ,CAAC,YAAuD;IACvE,OAAO;QACL,UAAU,EAAE,WAAW,CAAC,QAAQ;QAChC,OAAO,EAAE,SAAS;QAClB,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC;QAClC,WAAW,EAAE,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC;QAC9C,QAAQ,EAAE,eAAe,CAAC,GAAG;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3D,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,2BAA2B,CACrD,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,EAClC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,GAAG,KAAK,CAAC,CAC7C,CAAC;QACF,OAAO;YACL,IAAI,EAAE,oBAAoB;YAC1B,KAAK,EAAE,WAAW;YAClB,QAAQ,EAAE,CAAC,EAAC,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,mBAAmB,CAAC,EAAE,YAAY,EAAE,IAAI,EAAC,CAAC;YAC1F,cAAc,EAAE,aAAa;SAC9B,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\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 Platform from '../../../core/platform/platform.js';\nimport * as Handlers from '../handlers/handlers.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {\n InsightCategory,\n InsightKeys,\n type InsightModel,\n type InsightSetContext,\n InsightWarning,\n type PartialInsightModel,\n} from './types.js';\n\nexport const UIStrings = {\n /** Title of an insight that provides details about if the page's viewport is optimized for mobile viewing. */\n title: 'Optimize viewport for mobile',\n /**\n * @description Text to tell the user how a viewport meta element can improve performance. \\xa0 is a non-breaking space\n */\n description:\n 'Tap interactions may be [delayed by up to 300\\xA0ms](https://developer.chrome.com/blog/300ms-tap-delay-gone-away/) if the viewport is not optimized for mobile.',\n /**\n * @description Text for a label describing the portion of an interaction event that was delayed due to a bad mobile viewport.\n */\n mobileTapDelayLabel: 'Mobile tap delay',\n} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/Viewport.ts', UIStrings);\nexport const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);\n\nexport type ViewportInsightModel = InsightModel<typeof UIStrings, {\n mobileOptimized: boolean | null,\n viewportEvent?: Types.Events.ParseMetaViewport,\n longPointerInteractions?: Types.Events.SyntheticInteractionPair[],\n}>;\n\nfunction finalize(partialModel: PartialInsightModel<ViewportInsightModel>): ViewportInsightModel {\n return {\n insightKey: InsightKeys.VIEWPORT,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n category: InsightCategory.INP,\n state: partialModel.mobileOptimized === false ? 'fail' : 'pass',\n ...partialModel,\n };\n}\n\nexport function generateInsight(\n parsedTrace: Handlers.Types.ParsedTrace, context: InsightSetContext): ViewportInsightModel {\n const viewportEvent = parsedTrace.UserInteractions.parseMetaViewportEvents.find(event => {\n if (event.args.data.frame !== context.frameId) {\n return false;\n }\n\n return Helpers.Timing.eventIsInBounds(event, context.bounds);\n });\n\n const compositorEvents = parsedTrace.UserInteractions.beginCommitCompositorFrameEvents.filter(event => {\n if (event.args.frame !== context.frameId) {\n return false;\n }\n\n // Commit compositor frame events can be emitted before the viewport tag is parsed.\n // We shouldn't count these since the browser hasn't had time to make the viewport mobile optimized.\n if (viewportEvent && event.ts < viewportEvent.ts) {\n return false;\n }\n\n return Helpers.Timing.eventIsInBounds(event, context.bounds);\n });\n\n if (!compositorEvents.length) {\n // Trace doesn't have the data we need.\n return finalize({\n mobileOptimized: null,\n warnings: [InsightWarning.NO_LAYOUT],\n });\n }\n\n // Returns true only if all events are mobile optimized.\n for (const event of compositorEvents) {\n if (!event.args.is_mobile_optimized) {\n // Grab all the pointer events with at least 50ms of input delay.\n const longPointerInteractions = [...parsedTrace.UserInteractions.interactionsOverThreshold.values()].filter(\n interaction => Handlers.ModelHandlers.UserInteractions.categoryOfInteraction(interaction) === 'POINTER' &&\n interaction.inputDelay >= 50_000);\n\n // The actual impact varies between 0 and 300.\n // Using inputDelay as the closest thing we have for measuring this, though inputDelay may be high for other reasons.\n // b/371566378#comment8\n const inputDelay = Math.max(0, ...longPointerInteractions.map(interaction => interaction.inputDelay)) / 1000;\n const inpMetricSavings = Platform.NumberUtilities.clamp(inputDelay, 0, 300);\n\n return finalize({\n mobileOptimized: false,\n viewportEvent,\n longPointerInteractions,\n metricSavings: {INP: inpMetricSavings as Types.Timing.Milli},\n });\n }\n }\n\n return finalize({\n mobileOptimized: true,\n viewportEvent,\n });\n}\n\nexport function createOverlays(model: ViewportInsightModel): Types.Overlays.Overlay[] {\n if (!model.longPointerInteractions) {\n return [];\n }\n\n return model.longPointerInteractions.map(interaction => {\n const delay = Math.min(interaction.inputDelay, 300 * 1000);\n const bounds = Helpers.Timing.traceWindowFromMicroSeconds(\n Types.Timing.Micro(interaction.ts),\n Types.Timing.Micro(interaction.ts + delay),\n );\n return {\n type: 'TIMESPAN_BREAKDOWN',\n entry: interaction,\n sections: [{bounds, label: i18nString(UIStrings.mobileTapDelayLabel), showDuration: true}],\n renderLocation: 'ABOVE_EVENT',\n };\n });\n}\n"]}
1
+ {"version":3,"file":"Viewport.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/Viewport.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AACnD,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EACL,eAAe,EACf,WAAW,EAGX,cAAc,GAEf,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,8GAA8G;IAC9G,KAAK,EAAE,8BAA8B;IACrC;;OAEG;IACH,WAAW,EACP,oKAAoK;IACxK;;OAEG;IACH,mBAAmB,EAAE,kBAAkB;CAC/B,CAAC;AAEX,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,iBA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;YAE5E,OAAO,QAAQ,CAAC;gBACd,eAAe,EAAE,KAAK;gBACtB,aAAa;gBACb,uBAAuB;gBACvB,aAAa,EAAE,EAAC,GAAG,EAAE,gBAAsC,EAAC;aAC7D,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;QACd,eAAe,EAAE,IAAI;QACrB,aAAa;KACd,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAA2B;IACxD,IAAI,CAAC,KAAK,CAAC,uBAAuB,EAAE,CAAC;QACnC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,KAAK,CAAC,uBAAuB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;QACrD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,UAAU,EAAE,GAAG,GAAG,IAAI,CAAC,CAAC;QAC3D,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,2BAA2B,CACrD,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,EAClC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,GAAG,KAAK,CAAC,CAC7C,CAAC;QACF,OAAO;YACL,IAAI,EAAE,oBAAoB;YAC1B,KAAK,EAAE,WAAW;YAClB,QAAQ,EAAE,CAAC,EAAC,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,mBAAmB,CAAC,EAAE,YAAY,EAAE,IAAI,EAAC,CAAC;YAC1F,cAAc,EAAE,aAAa;SAC9B,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,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 Platform from '../../../core/platform/platform.js';\nimport * as Handlers from '../handlers/handlers.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {\n InsightCategory,\n InsightKeys,\n type InsightModel,\n type InsightSetContext,\n InsightWarning,\n type PartialInsightModel,\n} from './types.js';\n\nexport const UIStrings = {\n /** Title of an insight that provides details about if the page's viewport is optimized for mobile viewing. */\n title: 'Optimize viewport for mobile',\n /**\n * @description Text to tell the user how a viewport meta element can improve performance. \\xa0 is a non-breaking space\n */\n description:\n 'Tap interactions may be [delayed by up to 300\\xA0ms](https://developer.chrome.com/docs/performance/insights/viewport) if the viewport is not optimized for mobile.',\n /**\n * @description Text for a label describing the portion of an interaction event that was delayed due to a bad mobile viewport.\n */\n mobileTapDelayLabel: 'Mobile tap delay',\n} as const;\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/Viewport.ts', UIStrings);\nexport const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);\n\nexport type ViewportInsightModel = InsightModel<typeof UIStrings, {\n mobileOptimized: boolean | null,\n viewportEvent?: Types.Events.ParseMetaViewport,\n longPointerInteractions?: Types.Events.SyntheticInteractionPair[],\n}>;\n\nfunction finalize(partialModel: PartialInsightModel<ViewportInsightModel>): ViewportInsightModel {\n return {\n insightKey: InsightKeys.VIEWPORT,\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n docs: 'https://developer.chrome.com/docs/performance/insights/viewport',\n category: InsightCategory.INP,\n state: partialModel.mobileOptimized === false ? 'fail' : 'pass',\n ...partialModel,\n };\n}\n\nexport function isViewportInsight(model: InsightModel): model is ViewportInsightModel {\n return model.insightKey === InsightKeys.VIEWPORT;\n}\n\nexport function generateInsight(data: Handlers.Types.HandlerData, context: InsightSetContext): ViewportInsightModel {\n const viewportEvent = data.UserInteractions.parseMetaViewportEvents.find(event => {\n if (event.args.data.frame !== context.frameId) {\n return false;\n }\n\n return Helpers.Timing.eventIsInBounds(event, context.bounds);\n });\n\n const compositorEvents = data.UserInteractions.beginCommitCompositorFrameEvents.filter(event => {\n if (event.args.frame !== context.frameId) {\n return false;\n }\n\n // Commit compositor frame events can be emitted before the viewport tag is parsed.\n // We shouldn't count these since the browser hasn't had time to make the viewport mobile optimized.\n if (viewportEvent && event.ts < viewportEvent.ts) {\n return false;\n }\n\n return Helpers.Timing.eventIsInBounds(event, context.bounds);\n });\n\n if (!compositorEvents.length) {\n // Trace doesn't have the data we need.\n return finalize({\n mobileOptimized: null,\n warnings: [InsightWarning.NO_LAYOUT],\n });\n }\n\n // Returns true only if all events are mobile optimized.\n for (const event of compositorEvents) {\n if (!event.args.is_mobile_optimized) {\n // Grab all the pointer events with at least 50ms of input delay.\n const longPointerInteractions = [...data.UserInteractions.interactionsOverThreshold.values()].filter(\n interaction => Handlers.ModelHandlers.UserInteractions.categoryOfInteraction(interaction) === 'POINTER' &&\n interaction.inputDelay >= 50_000);\n\n // The actual impact varies between 0 and 300.\n // Using inputDelay as the closest thing we have for measuring this, though inputDelay may be high for other reasons.\n // b/371566378#comment8\n const inputDelay = Math.max(0, ...longPointerInteractions.map(interaction => interaction.inputDelay)) / 1000;\n const inpMetricSavings = Platform.NumberUtilities.clamp(inputDelay, 0, 300);\n\n return finalize({\n mobileOptimized: false,\n viewportEvent,\n longPointerInteractions,\n metricSavings: {INP: inpMetricSavings as Types.Timing.Milli},\n });\n }\n }\n\n return finalize({\n mobileOptimized: true,\n viewportEvent,\n });\n}\n\nexport function createOverlays(model: ViewportInsightModel): Types.Overlays.Overlay[] {\n if (!model.longPointerInteractions) {\n return [];\n }\n\n return model.longPointerInteractions.map(interaction => {\n const delay = Math.min(interaction.inputDelay, 300 * 1000);\n const bounds = Helpers.Timing.traceWindowFromMicroSeconds(\n Types.Timing.Micro(interaction.ts),\n Types.Timing.Micro(interaction.ts + delay),\n );\n return {\n type: 'TIMESPAN_BREAKDOWN',\n entry: interaction,\n sections: [{bounds, label: i18nString(UIStrings.mobileTapDelayLabel), showDuration: true}],\n renderLocation: 'ABOVE_EVENT',\n };\n });\n}\n"]}
@@ -8,7 +8,11 @@
8
8
  "forceConsistentCasingInFileNames": true,
9
9
  "inlineSources": true,
10
10
  "lib": [
11
- "esnext",
11
+ "ES2023",
12
+ "ES2024.Promise",
13
+ "ESNext.Iterator",
14
+ "ESNext.Collection",
15
+ "ESNext.Array",
12
16
  "dom",
13
17
  "dom.iterable"
14
18
  ],
@@ -24,7 +28,7 @@
24
28
  "skipLibCheck": true,
25
29
  "sourceMap": true,
26
30
  "strict": true,
27
- "target": "esnext",
31
+ "target": "ES2023",
28
32
  "tsBuildInfoFile": "devtools_entrypoint-bundle-typescript-tsconfig.json.tsbuildinfo",
29
33
  "typeRoots": [],
30
34
  "useUnknownInCatchVariables": false
@@ -8,7 +8,11 @@
8
8
  "forceConsistentCasingInFileNames": true,
9
9
  "inlineSources": true,
10
10
  "lib": [
11
- "esnext",
11
+ "ES2023",
12
+ "ES2024.Promise",
13
+ "ESNext.Iterator",
14
+ "ESNext.Collection",
15
+ "ESNext.Array",
12
16
  "dom",
13
17
  "dom.iterable"
14
18
  ],
@@ -24,7 +28,7 @@
24
28
  "skipLibCheck": true,
25
29
  "sourceMap": true,
26
30
  "strict": true,
27
- "target": "esnext",
31
+ "target": "ES2023",
28
32
  "tsBuildInfoFile": "insights-tsconfig.json.tsbuildinfo",
29
33
  "typeRoots": [],
30
34
  "useUnknownInCatchVariables": false
@@ -1,4 +1,6 @@
1
+ export * as Cache from './Cache.js';
1
2
  export * as Common from './Common.js';
2
3
  export * as Models from './Models.js';
4
+ export * as ModernHTTP from './ModernHTTP.js';
3
5
  export * as Statistics from './Statistics.js';
4
6
  export * as Types from './types.js';
@@ -1,8 +1,10 @@
1
- // Copyright 2024 The Chromium Authors. All rights reserved.
1
+ // Copyright 2024 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
+ export * as Cache from './Cache.js'; // TODO(crbug.com/444191656): Exported for tests.
4
5
  export * as Common from './Common.js';
5
6
  export * as Models from './Models.js';
7
+ export * as ModernHTTP from './ModernHTTP.js'; // TODO(crbug.com/444191656): Exported for tests.
6
8
  export * as Statistics from './Statistics.js';
7
9
  export * as Types from './types.js';
8
10
  //# sourceMappingURL=insights.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"insights.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/insights.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nexport * as Common from './Common.js';\nexport * as Models from './Models.js';\nexport * as Statistics from './Statistics.js';\nexport * as Types from './types.js';\n"]}
1
+ {"version":3,"file":"insights.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/insights.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC,CAAE,iDAAiD;AACvF,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC,CAAE,iDAAiD;AACjG,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,YAAY,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\nexport * as Cache from './Cache.js'; // TODO(crbug.com/444191656): Exported for tests.\nexport * as Common from './Common.js';\nexport * as Models from './Models.js';\nexport * as ModernHTTP from './ModernHTTP.js'; // TODO(crbug.com/444191656): Exported for tests.\nexport * as Statistics from './Statistics.js';\nexport * as Types from './types.js';\n"]}
@@ -7,11 +7,13 @@ import type * as Models from './Models.js';
7
7
  */
8
8
  export type InsightSetContext = InsightSetContextWithoutNavigation | InsightSetContextWithNavigation;
9
9
  export interface InsightSetContextWithoutNavigation {
10
+ options: Types.Configuration.ParseOptions;
10
11
  bounds: Types.Timing.TraceWindowMicro;
11
12
  frameId: string;
12
13
  navigation?: never;
13
14
  }
14
15
  export interface InsightSetContextWithNavigation {
16
+ options: Types.Configuration.ParseOptions;
15
17
  bounds: Types.Timing.TraceWindowMicro;
16
18
  frameId: string;
17
19
  navigation: Types.Events.NavigationStart;
@@ -56,6 +58,7 @@ export type InsightModel<UIStrings extends Record<string, string> = Record<strin
56
58
  strings: UIStrings;
57
59
  title: {i18nId: string, values: Record<string, string|number>, formattedDefault: string};
58
60
  description: {i18nId: string, values: Record<string, string|number>, formattedDefault: string};
61
+ docs: string;
59
62
  category: InsightCategory;
60
63
  state: 'pass' | 'fail' | 'informative';
61
64
  /** Used by RelatedInsightChips.ts */
@@ -79,7 +82,7 @@ export type InsightModel<UIStrings extends Record<string, string> = Record<strin
79
82
  /** This is lazily-generated because some insights may create many overlays. */
80
83
  createOverlays?: () => Types.Overlays.Overlay[];
81
84
  };
82
- export type PartialInsightModel<T> = Omit<T, 'strings' | 'title' | 'description' | 'category' | 'state' | 'insightKey' | 'navigationId' | 'frameId'>;
85
+ export type PartialInsightModel<T> = Omit<T, 'strings' | 'title' | 'description' | 'docs' | 'category' | 'state' | 'insightKey' | 'navigationId' | 'frameId'>;
83
86
  /**
84
87
  * Contains insights for a specific navigation. If a trace began after a navigation already started,
85
88
  * this could instead represent the duration from the beginning of the trace up to the first recorded
@@ -125,5 +128,6 @@ export declare enum InsightKeys {
125
128
  RENDER_BLOCKING = "RenderBlocking",
126
129
  SLOW_CSS_SELECTOR = "SlowCSSSelector",
127
130
  VIEWPORT = "Viewport",
128
- MODERN_HTTP = "ModernHTTP"
131
+ MODERN_HTTP = "ModernHTTP",
132
+ CACHE = "Cache"
129
133
  }
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Chromium Authors. All rights reserved.
1
+ // Copyright 2024 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
  export var InsightWarning;
@@ -35,5 +35,6 @@ export var InsightKeys;
35
35
  InsightKeys["SLOW_CSS_SELECTOR"] = "SlowCSSSelector";
36
36
  InsightKeys["VIEWPORT"] = "Viewport";
37
37
  InsightKeys["MODERN_HTTP"] = "ModernHTTP";
38
+ InsightKeys["CACHE"] = "Cache";
38
39
  })(InsightKeys || (InsightKeys = {}));
39
40
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/types.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAoC7B,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,iCAAe,CAAA;IACf,mCAAiB,CAAA;IACjB,uEAAuE;IACvE,6DAA2C,CAAA;IAC3C,yCAAuB,CAAA;AACzB,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB;AAYD,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,8BAAW,CAAA;AACb,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B;AAyED,MAAM,CAAN,IAAY,WAkBX;AAlBD,WAAY,WAAW;IACrB,6CAA8B,CAAA;IAC9B,6CAA8B,CAAA;IAC9B,2CAA4B,CAAA;IAC5B,6CAA8B,CAAA;IAC9B,mDAAoC,CAAA;IACpC,mCAAoB,CAAA;IACpB,4DAA6C,CAAA;IAC7C,2CAA4B,CAAA;IAC5B,6CAA8B,CAAA;IAC9B,+CAAgC,CAAA;IAChC,6CAA8B,CAAA;IAC9B,qDAAsC,CAAA;IACtC,gEAAiD,CAAA;IACjD,iDAAkC,CAAA;IAClC,oDAAqC,CAAA;IACrC,oCAAqB,CAAA;IACrB,yCAA0B,CAAA;AAC5B,CAAC,EAlBW,WAAW,KAAX,WAAW,QAkBtB","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as Common from '../../../core/common/common.js';\nimport type * as Lantern from '../lantern/lantern.js';\nimport type * as Types from '../types/types.js';\n\nimport type * as Models from './Models.js';\n\n/**\n * Context for the portion of the trace an insight should look at.\n */\nexport type InsightSetContext = InsightSetContextWithoutNavigation|InsightSetContextWithNavigation;\n\nexport interface InsightSetContextWithoutNavigation {\n bounds: Types.Timing.TraceWindowMicro;\n frameId: string;\n navigation?: never;\n}\n\nexport interface InsightSetContextWithNavigation {\n bounds: Types.Timing.TraceWindowMicro;\n frameId: string;\n navigation: Types.Events.NavigationStart;\n navigationId: string;\n lantern?: LanternContext;\n}\n\nexport interface LanternContext {\n requests: Array<Lantern.Types.NetworkRequest<Types.Events.SyntheticNetworkRequest>>;\n graph: Lantern.Graph.Node<Types.Events.SyntheticNetworkRequest>;\n simulator: Lantern.Simulation.Simulator<Types.Events.SyntheticNetworkRequest>;\n metrics: Record<string, Lantern.Metrics.MetricResult>;\n}\n\nexport type InsightModelsType = typeof Models;\n\nexport enum InsightWarning {\n NO_FP = 'NO_FP',\n NO_LCP = 'NO_LCP',\n // No network request could be identified as the primary HTML document.\n NO_DOCUMENT_REQUEST = 'NO_DOCUMENT_REQUEST',\n NO_LAYOUT = 'NO_LAYOUT',\n}\n\nexport interface MetricSavings {\n /* eslint-disable @typescript-eslint/naming-convention */\n FCP?: Types.Timing.Milli;\n LCP?: Types.Timing.Milli;\n TBT?: Types.Timing.Milli;\n CLS?: number;\n INP?: Types.Timing.Milli;\n /* eslint-enable @typescript-eslint/naming-convention */\n}\n\nexport enum InsightCategory {\n ALL = 'All',\n INP = 'INP',\n LCP = 'LCP',\n CLS = 'CLS',\n}\n\nexport type RelatedEventsMap = Map<Types.Events.Event, string[]>;\n\nexport type Checklist<Keys extends string> = Record<Keys, {label: Common.UIString.LocalizedString, value: boolean}>;\n\nexport type InsightModel<UIStrings extends Record<string, string> = Record<string, string>,\n ExtraDetail extends Record<string, unknown> = Record<string, unknown>> =\n ExtraDetail&{\n /** Used internally to identify the type of a model, not shown visibly to users **/\n insightKey: keyof InsightModelsType,\n /** Not used within DevTools - this is for external consumers (like Lighthouse). */\n strings: UIStrings,\n title: Common.UIString.LocalizedString,\n description: Common.UIString.LocalizedString,\n category: InsightCategory,\n state: 'pass' | 'fail' | 'informative',\n /** Used by RelatedInsightChips.ts */\n relatedEvents?: RelatedEventsMap | Types.Events.Event[],\n warnings?: InsightWarning[],\n metricSavings?: MetricSavings,\n /**\n * An estimate for the number of bytes that this insight deems to have been wasted.\n * Bytes are in terms of transfer size: for each component of savings related to an\n * individual request, the insight will estimate its impact on transfer size by using\n * the compression ratio of the resource.\n *\n * This field is only displayed for informational purposes.\n */\n wastedBytes?: number,\n frameId?: string,\n /**\n * If this insight is attached to a navigation, this stores its ID.\n */\n navigationId?: string,\n /** This is lazily-generated because some insights may create many overlays. */\n createOverlays?: () => Types.Overlays.Overlay[],\n };\n\nexport type PartialInsightModel<T> =\n Omit<T, 'strings'|'title'|'description'|'category'|'state'|'insightKey'|'navigationId'|'frameId'>;\n\n/**\n * Contains insights for a specific navigation. If a trace began after a navigation already started,\n * this could instead represent the duration from the beginning of the trace up to the first recorded\n * navigation (or the end of the trace).\n */\nexport interface InsightSet {\n /** If for a navigation, this is the navigationId. Else it is Trace.Types.Events.NO_NAVIGATION. */\n id: Types.Events.NavigationId;\n /** The URL to show in the accordion list. */\n url: URL;\n frameId: string;\n bounds: Types.Timing.TraceWindowMicro;\n model: InsightModels;\n navigation?: Types.Events.NavigationStart;\n}\n\n/**\n * Contains insights for a specific insight set.\n */\nexport type InsightModels = {\n [I in keyof InsightModelsType]: ReturnType<InsightModelsType[I]['generateInsight']>;\n};\n\n/**\n * Contains insights for the entire trace. Insights are mostly grouped by `navigationId`, with one exception:\n *\n * If the analyzed trace started after the navigation, and has meaningful work with that span, there is no\n * navigation to map it to. In this case `Types.Events.NO_NAVIGATION` is used for the key.\n */\nexport type TraceInsightSets = Map<Types.Events.NavigationId, InsightSet>;\n\nexport enum InsightKeys {\n LCP_BREAKDOWN = 'LCPBreakdown',\n INP_BREAKDOWN = 'INPBreakdown',\n CLS_CULPRITS = 'CLSCulprits',\n THIRD_PARTIES = 'ThirdParties',\n DOCUMENT_LATENCY = 'DocumentLatency',\n DOM_SIZE = 'DOMSize',\n DUPLICATE_JAVASCRIPT = 'DuplicatedJavaScript',\n FONT_DISPLAY = 'FontDisplay',\n FORCED_REFLOW = 'ForcedReflow',\n IMAGE_DELIVERY = 'ImageDelivery',\n LCP_DISCOVERY = 'LCPDiscovery',\n LEGACY_JAVASCRIPT = 'LegacyJavaScript',\n NETWORK_DEPENDENCY_TREE = 'NetworkDependencyTree',\n RENDER_BLOCKING = 'RenderBlocking',\n SLOW_CSS_SELECTOR = 'SlowCSSSelector',\n VIEWPORT = 'Viewport',\n MODERN_HTTP = 'ModernHTTP',\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/types.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAsC7B,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,iCAAe,CAAA;IACf,mCAAiB,CAAA;IACjB,uEAAuE;IACvE,6DAA2C,CAAA;IAC3C,yCAAuB,CAAA;AACzB,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB;AAYD,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,8BAAW,CAAA;AACb,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B;AA0ED,MAAM,CAAN,IAAY,WAmBX;AAnBD,WAAY,WAAW;IACrB,6CAA8B,CAAA;IAC9B,6CAA8B,CAAA;IAC9B,2CAA4B,CAAA;IAC5B,6CAA8B,CAAA;IAC9B,mDAAoC,CAAA;IACpC,mCAAoB,CAAA;IACpB,4DAA6C,CAAA;IAC7C,2CAA4B,CAAA;IAC5B,6CAA8B,CAAA;IAC9B,+CAAgC,CAAA;IAChC,6CAA8B,CAAA;IAC9B,qDAAsC,CAAA;IACtC,gEAAiD,CAAA;IACjD,iDAAkC,CAAA;IAClC,oDAAqC,CAAA;IACrC,oCAAqB,CAAA;IACrB,yCAA0B,CAAA;IAC1B,8BAAe,CAAA;AACjB,CAAC,EAnBW,WAAW,KAAX,WAAW,QAmBtB","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 type * as Common from '../../../core/common/common.js';\nimport type * as Lantern from '../lantern/lantern.js';\nimport type * as Types from '../types/types.js';\n\nimport type * as Models from './Models.js';\n\n/**\n * Context for the portion of the trace an insight should look at.\n */\nexport type InsightSetContext = InsightSetContextWithoutNavigation|InsightSetContextWithNavigation;\n\nexport interface InsightSetContextWithoutNavigation {\n options: Types.Configuration.ParseOptions;\n bounds: Types.Timing.TraceWindowMicro;\n frameId: string;\n navigation?: never;\n}\n\nexport interface InsightSetContextWithNavigation {\n options: Types.Configuration.ParseOptions;\n bounds: Types.Timing.TraceWindowMicro;\n frameId: string;\n navigation: Types.Events.NavigationStart;\n navigationId: string;\n lantern?: LanternContext;\n}\n\nexport interface LanternContext {\n requests: Array<Lantern.Types.NetworkRequest<Types.Events.SyntheticNetworkRequest>>;\n graph: Lantern.Graph.Node<Types.Events.SyntheticNetworkRequest>;\n simulator: Lantern.Simulation.Simulator<Types.Events.SyntheticNetworkRequest>;\n metrics: Record<string, Lantern.Metrics.MetricResult>;\n}\n\nexport type InsightModelsType = typeof Models;\n\nexport enum InsightWarning {\n NO_FP = 'NO_FP',\n NO_LCP = 'NO_LCP',\n // No network request could be identified as the primary HTML document.\n NO_DOCUMENT_REQUEST = 'NO_DOCUMENT_REQUEST',\n NO_LAYOUT = 'NO_LAYOUT',\n}\n\nexport interface MetricSavings {\n /* eslint-disable @typescript-eslint/naming-convention */\n FCP?: Types.Timing.Milli;\n LCP?: Types.Timing.Milli;\n TBT?: Types.Timing.Milli;\n CLS?: number;\n INP?: Types.Timing.Milli;\n /* eslint-enable @typescript-eslint/naming-convention */\n}\n\nexport enum InsightCategory {\n ALL = 'All',\n INP = 'INP',\n LCP = 'LCP',\n CLS = 'CLS',\n}\n\nexport type RelatedEventsMap = Map<Types.Events.Event, string[]>;\n\nexport type Checklist<Keys extends string> = Record<Keys, {label: Common.UIString.LocalizedString, value: boolean}>;\n\nexport type InsightModel<UIStrings extends Record<string, string> = Record<string, string>,\n ExtraDetail extends Record<string, unknown> = Record<string, unknown>> =\n ExtraDetail&{\n /** Used internally to identify the type of a model, not shown visibly to users **/\n insightKey: keyof InsightModelsType,\n /** Not used within DevTools - this is for external consumers (like Lighthouse). */\n strings: UIStrings,\n title: Common.UIString.LocalizedString,\n description: Common.UIString.LocalizedString,\n docs: string,\n category: InsightCategory,\n state: 'pass' | 'fail' | 'informative',\n /** Used by RelatedInsightChips.ts */\n relatedEvents?: RelatedEventsMap | Types.Events.Event[],\n warnings?: InsightWarning[],\n metricSavings?: MetricSavings,\n /**\n * An estimate for the number of bytes that this insight deems to have been wasted.\n * Bytes are in terms of transfer size: for each component of savings related to an\n * individual request, the insight will estimate its impact on transfer size by using\n * the compression ratio of the resource.\n *\n * This field is only displayed for informational purposes.\n */\n wastedBytes?: number,\n frameId?: string,\n /**\n * If this insight is attached to a navigation, this stores its ID.\n */\n navigationId?: string,\n /** This is lazily-generated because some insights may create many overlays. */\n createOverlays?: () => Types.Overlays.Overlay[],\n };\n\nexport type PartialInsightModel<T> =\n Omit<T, 'strings'|'title'|'description'|'docs'|'category'|'state'|'insightKey'|'navigationId'|'frameId'>;\n\n/**\n * Contains insights for a specific navigation. If a trace began after a navigation already started,\n * this could instead represent the duration from the beginning of the trace up to the first recorded\n * navigation (or the end of the trace).\n */\nexport interface InsightSet {\n /** If for a navigation, this is the navigationId. Else it is Trace.Types.Events.NO_NAVIGATION. */\n id: Types.Events.NavigationId;\n /** The URL to show in the accordion list. */\n url: URL;\n frameId: string;\n bounds: Types.Timing.TraceWindowMicro;\n model: InsightModels;\n navigation?: Types.Events.NavigationStart;\n}\n\n/**\n * Contains insights for a specific insight set.\n */\nexport type InsightModels = {\n [I in keyof InsightModelsType]: ReturnType<InsightModelsType[I]['generateInsight']>;\n};\n\n/**\n * Contains insights for the entire trace. Insights are mostly grouped by `navigationId`, with one exception:\n *\n * If the analyzed trace started after the navigation, and has meaningful work with that span, there is no\n * navigation to map it to. In this case `Types.Events.NO_NAVIGATION` is used for the key.\n */\nexport type TraceInsightSets = Map<Types.Events.NavigationId, InsightSet>;\n\nexport enum InsightKeys {\n LCP_BREAKDOWN = 'LCPBreakdown',\n INP_BREAKDOWN = 'INPBreakdown',\n CLS_CULPRITS = 'CLSCulprits',\n THIRD_PARTIES = 'ThirdParties',\n DOCUMENT_LATENCY = 'DocumentLatency',\n DOM_SIZE = 'DOMSize',\n DUPLICATE_JAVASCRIPT = 'DuplicatedJavaScript',\n FONT_DISPLAY = 'FontDisplay',\n FORCED_REFLOW = 'ForcedReflow',\n IMAGE_DELIVERY = 'ImageDelivery',\n LCP_DISCOVERY = 'LCPDiscovery',\n LEGACY_JAVASCRIPT = 'LegacyJavaScript',\n NETWORK_DEPENDENCY_TREE = 'NetworkDependencyTree',\n RENDER_BLOCKING = 'RenderBlocking',\n SLOW_CSS_SELECTOR = 'SlowCSSSelector',\n VIEWPORT = 'Viewport',\n MODERN_HTTP = 'ModernHTTP',\n CACHE = 'Cache',\n}\n"]}
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Chromium Authors. All rights reserved.
1
+ // Copyright 2024 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
  class LanternError extends Error {
@@ -1 +1 @@
1
- {"version":3,"file":"LanternError.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/core/LanternError.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,MAAM,YAAa,SAAQ,KAAK;CAAG;AAEnC,OAAO,EAAC,YAAY,EAAC,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nclass LanternError extends Error {}\n\nexport {LanternError};\n"]}
1
+ {"version":3,"file":"LanternError.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/core/LanternError.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,MAAM,YAAa,SAAQ,KAAK;CAAG;AAEnC,OAAO,EAAC,YAAY,EAAC,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\nclass LanternError extends Error {}\n\nexport {LanternError};\n"]}
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Chromium Authors. All rights reserved.
1
+ // Copyright 2024 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
  import { LanternError } from './LanternError.js';