@paulirish/trace_engine 0.0.67-beta.2 → 0.0.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (759) hide show
  1. package/.tmp/tsbuildinfo/analyze-inspector-issues.d.mts +13 -0
  2. package/.tmp/tsbuildinfo/analyze-inspector-issues.d.mts.map +1 -0
  3. package/.tmp/tsbuildinfo/analyze-trace.d.mts +17 -0
  4. package/.tmp/tsbuildinfo/analyze-trace.d.mts.map +1 -0
  5. package/.tmp/tsbuildinfo/test/test-trace-engine.d.mts +2 -0
  6. package/.tmp/tsbuildinfo/test/test-trace-engine.d.mts.map +1 -0
  7. package/.tmp/tsbuildinfo/third_party/third-party-web/third-party-web.d.ts +3 -0
  8. package/.tmp/tsbuildinfo/third_party/third-party-web/third-party-web.d.ts.map +1 -0
  9. package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +1 -0
  10. package/README.md +22 -62
  11. package/analyze-inspector-issues.mjs +60 -0
  12. package/analyze-trace.mjs +144 -6
  13. package/core/common/ParsedURL.js +512 -0
  14. package/core/common/ParsedURL.js.map +1 -0
  15. package/core/common/common.d.ts +8 -33
  16. package/core/common/common.js +2 -0
  17. package/core/host/host.d.ts +1 -13
  18. package/core/host/host.js +1 -0
  19. package/core/i18n/i18n.d.ts +20 -8
  20. package/core/i18n/i18n.js +15 -0
  21. package/core/platform/ArrayUtilities.js +224 -0
  22. package/core/platform/ArrayUtilities.js.map +1 -0
  23. package/core/platform/Brand.js +5 -0
  24. package/core/platform/Brand.js.map +1 -0
  25. package/core/platform/Constructor.js +5 -0
  26. package/core/platform/Constructor.js.map +1 -0
  27. package/core/platform/DateUtilities.js +14 -0
  28. package/core/platform/DateUtilities.js.map +1 -0
  29. package/core/platform/DevToolsPath.js +28 -0
  30. package/core/platform/DevToolsPath.js.map +1 -0
  31. package/core/platform/HostRuntime.js +8 -0
  32. package/core/platform/HostRuntime.js.map +1 -0
  33. package/core/platform/KeyboardUtilities.js +34 -0
  34. package/core/platform/KeyboardUtilities.js.map +1 -0
  35. package/core/platform/MapUtilities.js +80 -0
  36. package/core/platform/MapUtilities.js.map +1 -0
  37. package/core/platform/MimeType.js +157 -0
  38. package/core/platform/MimeType.js.map +1 -0
  39. package/core/platform/NumberUtilities.js +73 -0
  40. package/core/platform/NumberUtilities.js.map +1 -0
  41. package/core/platform/Size.js +36 -0
  42. package/core/platform/Size.js.map +1 -0
  43. package/core/platform/StringUtilities.js +731 -0
  44. package/core/platform/StringUtilities.js.map +1 -0
  45. package/core/platform/Timing.js +10 -0
  46. package/core/platform/Timing.js.map +1 -0
  47. package/core/platform/TypedArrayUtilities.js +158 -0
  48. package/core/platform/TypedArrayUtilities.js.map +1 -0
  49. package/core/platform/TypescriptUtilities.js +17 -0
  50. package/core/platform/TypescriptUtilities.js.map +1 -0
  51. package/core/platform/UIString.d.ts +5 -2
  52. package/core/platform/UIString.js +5 -0
  53. package/core/platform/UIString.js.map +1 -0
  54. package/core/platform/UserVisibleError.d.ts +1 -12
  55. package/core/platform/UserVisibleError.js +23 -0
  56. package/core/platform/UserVisibleError.js.map +1 -0
  57. package/core/platform/api/HostRuntime.d.ts +1 -0
  58. package/core/platform/api/HostRuntime.js +5 -0
  59. package/core/platform/api/HostRuntime.js.map +1 -0
  60. package/core/platform/api/api-tsconfig.json +58 -0
  61. package/core/platform/api/api-tsconfig.ref.json +26 -0
  62. package/core/platform/api/api.js +6 -0
  63. package/core/platform/api/api.js.map +1 -0
  64. package/core/platform/bundle-tsconfig.json +59 -0
  65. package/core/platform/bundle-tsconfig.ref.json +27 -0
  66. package/core/platform/foundation_unittests-tsconfig.json +73 -0
  67. package/core/platform/foundation_unittests-tsconfig.ref.json +40 -0
  68. package/core/platform/foundation_unittests_node_typecheck-tsconfig.json +69 -0
  69. package/core/platform/platform-tsconfig.json +81 -0
  70. package/core/platform/platform-tsconfig.ref.json +49 -0
  71. package/core/platform/platform.js +28 -0
  72. package/core/platform/platform.js.map +1 -0
  73. package/core/platform/platform_node_typecheck-tsconfig.json +78 -0
  74. package/core/platform/platform_node_typecheck.stamp +0 -0
  75. package/core/root/root.d.ts +1 -4
  76. package/core/root/root.js +1 -0
  77. package/core/sdk/sdk.d.ts +27 -97
  78. package/core/sdk/sdk.js +1 -0
  79. package/generated/protocol.js +3304 -0
  80. package/locales/af.json +86 -92
  81. package/locales/am.json +350 -356
  82. package/locales/ar.json +351 -357
  83. package/locales/as.json +349 -355
  84. package/locales/az.json +340 -346
  85. package/locales/be.json +350 -356
  86. package/locales/bg.json +350 -356
  87. package/locales/bn.json +350 -356
  88. package/locales/bs.json +243 -249
  89. package/locales/ca.json +279 -285
  90. package/locales/cs.json +335 -341
  91. package/locales/cy.json +114 -120
  92. package/locales/da.json +199 -205
  93. package/locales/de.json +219 -225
  94. package/locales/el.json +335 -341
  95. package/locales/en-GB.json +8 -14
  96. package/locales/en-US.json +249 -252
  97. package/locales/en-XL.json +1055 -0
  98. package/locales/es-419.json +275 -281
  99. package/locales/es.json +276 -282
  100. package/locales/et.json +231 -237
  101. package/locales/eu.json +119 -125
  102. package/locales/fa.json +350 -356
  103. package/locales/fi.json +280 -286
  104. package/locales/fil.json +1 -7
  105. package/locales/fr-CA.json +307 -313
  106. package/locales/fr.json +304 -310
  107. package/locales/gl.json +259 -265
  108. package/locales/gu.json +351 -357
  109. package/locales/he.json +351 -357
  110. package/locales/hi.json +335 -341
  111. package/locales/hr.json +234 -240
  112. package/locales/hu.json +341 -347
  113. package/locales/hy.json +350 -356
  114. package/locales/id.json +2 -8
  115. package/locales/is.json +302 -308
  116. package/locales/it.json +136 -142
  117. package/locales/ja.json +350 -356
  118. package/locales/ka.json +351 -357
  119. package/locales/kk.json +351 -357
  120. package/locales/km.json +350 -356
  121. package/locales/kn.json +351 -357
  122. package/locales/ko.json +350 -356
  123. package/locales/ky.json +349 -355
  124. package/locales/lo.json +351 -357
  125. package/locales/lt.json +319 -325
  126. package/locales/lv.json +316 -322
  127. package/locales/mk.json +351 -357
  128. package/locales/ml.json +350 -356
  129. package/locales/mn.json +350 -356
  130. package/locales/mr.json +350 -356
  131. package/locales/ms.json +2 -8
  132. package/locales/my.json +349 -355
  133. package/locales/ne.json +335 -341
  134. package/locales/nl.json +61 -67
  135. package/locales/no.json +169 -175
  136. package/locales/or.json +350 -356
  137. package/locales/pa.json +350 -356
  138. package/locales/pl.json +306 -312
  139. package/locales/pt-PT.json +271 -277
  140. package/locales/pt.json +265 -271
  141. package/locales/ro.json +305 -311
  142. package/locales/ru.json +350 -356
  143. package/locales/si.json +351 -357
  144. package/locales/sk.json +332 -338
  145. package/locales/sl.json +214 -220
  146. package/locales/sq.json +315 -321
  147. package/locales/sr-Latn.json +252 -258
  148. package/locales/sr.json +351 -357
  149. package/locales/sv.json +275 -281
  150. package/locales/sw.json +2 -8
  151. package/locales/ta.json +351 -357
  152. package/locales/te.json +349 -355
  153. package/locales/th.json +351 -357
  154. package/locales/tr.json +325 -331
  155. package/locales/uk.json +350 -356
  156. package/locales/ur.json +351 -357
  157. package/locales/uz.json +159 -165
  158. package/locales/vi.json +351 -357
  159. package/locales/zh-HK.json +351 -357
  160. package/locales/zh-TW.json +350 -356
  161. package/locales/zh.json +350 -356
  162. package/locales/zu.json +2 -8
  163. package/models/cpu_profile/CPUProfileDataModel.js +517 -0
  164. package/models/cpu_profile/CPUProfileDataModel.js.map +1 -0
  165. package/models/cpu_profile/ProfileTreeModel.js +90 -0
  166. package/models/cpu_profile/ProfileTreeModel.js.map +1 -0
  167. package/models/cpu_profile/bundle-tsconfig.json +59 -0
  168. package/models/cpu_profile/bundle-tsconfig.ref.json +27 -0
  169. package/models/cpu_profile/cpu_profile-tsconfig.json +63 -0
  170. package/models/cpu_profile/cpu_profile-tsconfig.ref.json +31 -0
  171. package/models/cpu_profile/cpu_profile.js +7 -0
  172. package/models/cpu_profile/cpu_profile.js.map +1 -0
  173. package/models/cpu_profile/cpu_profile_node_typecheck-tsconfig.json +60 -0
  174. package/models/cpu_profile/cpu_profile_node_typecheck.stamp +0 -0
  175. package/models/cpu_profile/foundation_unittests-tsconfig.json +63 -0
  176. package/models/cpu_profile/foundation_unittests-tsconfig.ref.json +30 -0
  177. package/models/cpu_profile/foundation_unittests_node_typecheck-tsconfig.json +59 -0
  178. package/models/crux-manager/crux-manager.d.ts +3 -1
  179. package/models/crux-manager/crux-manager.js +1 -0
  180. package/models/trace/EntityMapper.js +133 -0
  181. package/models/trace/EntityMapper.js.map +1 -0
  182. package/models/trace/EventsSerializer.d.ts +1 -0
  183. package/models/trace/EventsSerializer.js +118 -0
  184. package/models/trace/EventsSerializer.js.map +1 -0
  185. package/models/trace/LanternComputationData.js +368 -0
  186. package/models/trace/LanternComputationData.js.map +1 -0
  187. package/models/trace/ModelImpl.js +181 -0
  188. package/models/trace/ModelImpl.js.map +1 -0
  189. package/models/trace/Name.js +115 -0
  190. package/models/trace/Name.js.map +1 -0
  191. package/models/trace/Processor.js +616 -0
  192. package/models/trace/Processor.js.map +1 -0
  193. package/models/trace/Styles.d.ts +2 -2
  194. package/models/trace/Styles.js +836 -0
  195. package/models/trace/Styles.js.map +1 -0
  196. package/models/trace/bundle-tsconfig.json +77 -0
  197. package/models/trace/bundle-tsconfig.ref.json +45 -0
  198. package/models/trace/extras/FilmStrip.js +45 -0
  199. package/models/trace/extras/FilmStrip.js.map +1 -0
  200. package/models/trace/extras/Initiators.js +47 -0
  201. package/models/trace/extras/Initiators.js.map +1 -0
  202. package/models/trace/extras/MainThreadActivity.js +77 -0
  203. package/models/trace/extras/MainThreadActivity.js.map +1 -0
  204. package/models/trace/extras/ScriptDuplication.js +163 -0
  205. package/models/trace/extras/ScriptDuplication.js.map +1 -0
  206. package/models/trace/extras/StackTraceForEvent.js +192 -0
  207. package/models/trace/extras/StackTraceForEvent.js.map +1 -0
  208. package/models/trace/extras/ThirdParties.js +119 -0
  209. package/models/trace/extras/ThirdParties.js.map +1 -0
  210. package/models/trace/extras/TraceFilter.js +51 -0
  211. package/models/trace/extras/TraceFilter.js.map +1 -0
  212. package/models/trace/extras/TraceTree.js +652 -0
  213. package/models/trace/extras/TraceTree.js.map +1 -0
  214. package/models/trace/extras/bundle-tsconfig.json +59 -0
  215. package/models/trace/extras/bundle-tsconfig.ref.json +27 -0
  216. package/models/trace/extras/extras-tsconfig.json +81 -0
  217. package/models/trace/extras/extras-tsconfig.ref.json +49 -0
  218. package/models/trace/extras/extras.js +12 -0
  219. package/models/trace/extras/extras.js.map +1 -0
  220. package/models/trace/extras/extras_node_typecheck-tsconfig.json +78 -0
  221. package/models/trace/extras/extras_node_typecheck.stamp +0 -0
  222. package/models/trace/extras/foundation_unittests-tsconfig.json +91 -0
  223. package/models/trace/extras/foundation_unittests-tsconfig.ref.json +58 -0
  224. package/models/trace/extras/foundation_unittests_node_typecheck-tsconfig.json +87 -0
  225. package/models/trace/foundation_unittests-tsconfig.json +70 -0
  226. package/models/trace/foundation_unittests-tsconfig.ref.json +37 -0
  227. package/models/trace/foundation_unittests_node_typecheck-tsconfig.json +66 -0
  228. package/models/trace/handlers/AnimationFramesHandler.js +110 -0
  229. package/models/trace/handlers/AnimationFramesHandler.js.map +1 -0
  230. package/models/trace/handlers/AnimationHandler.js +27 -0
  231. package/models/trace/handlers/AnimationHandler.js.map +1 -0
  232. package/models/trace/handlers/AsyncJSCallsHandler.js +188 -0
  233. package/models/trace/handlers/AsyncJSCallsHandler.js.map +1 -0
  234. package/models/trace/handlers/DOMStatsHandler.js +22 -0
  235. package/models/trace/handlers/DOMStatsHandler.js.map +1 -0
  236. package/models/trace/handlers/ExtensionTraceDataHandler.js +264 -0
  237. package/models/trace/handlers/ExtensionTraceDataHandler.js.map +1 -0
  238. package/models/trace/handlers/FlowsHandler.js +149 -0
  239. package/models/trace/handlers/FlowsHandler.js.map +1 -0
  240. package/models/trace/handlers/FramesHandler.js +491 -0
  241. package/models/trace/handlers/FramesHandler.js.map +1 -0
  242. package/models/trace/handlers/GPUHandler.js +36 -0
  243. package/models/trace/handlers/GPUHandler.js.map +1 -0
  244. package/models/trace/handlers/ImagePaintingHandler.js +148 -0
  245. package/models/trace/handlers/ImagePaintingHandler.js.map +1 -0
  246. package/models/trace/handlers/InitiatorsHandler.js +181 -0
  247. package/models/trace/handlers/InitiatorsHandler.js.map +1 -0
  248. package/models/trace/handlers/InvalidationsHandler.js +125 -0
  249. package/models/trace/handlers/InvalidationsHandler.js.map +1 -0
  250. package/models/trace/handlers/LargestImagePaintHandler.js +86 -0
  251. package/models/trace/handlers/LargestImagePaintHandler.js.map +1 -0
  252. package/models/trace/handlers/LargestTextPaintHandler.js +28 -0
  253. package/models/trace/handlers/LargestTextPaintHandler.js.map +1 -0
  254. package/models/trace/handlers/LayerTreeHandler.js +104 -0
  255. package/models/trace/handlers/LayerTreeHandler.js.map +1 -0
  256. package/models/trace/handlers/LayoutShiftsHandler.js +453 -0
  257. package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -0
  258. package/models/trace/handlers/MemoryHandler.js +22 -0
  259. package/models/trace/handlers/MemoryHandler.js.map +1 -0
  260. package/models/trace/handlers/MetaHandler.js +442 -0
  261. package/models/trace/handlers/MetaHandler.js.map +1 -0
  262. package/models/trace/handlers/ModelHandlers.js +33 -0
  263. package/models/trace/handlers/ModelHandlers.js.map +1 -0
  264. package/models/trace/handlers/NetworkRequestsHandler.js +578 -0
  265. package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -0
  266. package/models/trace/handlers/PageFramesHandler.js +43 -0
  267. package/models/trace/handlers/PageFramesHandler.js.map +1 -0
  268. package/models/trace/handlers/PageLoadMetricsHandler.js +463 -0
  269. package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -0
  270. package/models/trace/handlers/RendererHandler.js +346 -0
  271. package/models/trace/handlers/RendererHandler.js.map +1 -0
  272. package/models/trace/handlers/SamplesHandler.js +261 -0
  273. package/models/trace/handlers/SamplesHandler.js.map +1 -0
  274. package/models/trace/handlers/ScreenshotsHandler.js +56 -0
  275. package/models/trace/handlers/ScreenshotsHandler.js.map +1 -0
  276. package/models/trace/handlers/ScriptsHandler.js +277 -0
  277. package/models/trace/handlers/ScriptsHandler.js.map +1 -0
  278. package/models/trace/handlers/SelectorStatsHandler.js +72 -0
  279. package/models/trace/handlers/SelectorStatsHandler.js.map +1 -0
  280. package/models/trace/handlers/Threads.js +108 -0
  281. package/models/trace/handlers/Threads.js.map +1 -0
  282. package/models/trace/handlers/UserInteractionsHandler.js +319 -0
  283. package/models/trace/handlers/UserInteractionsHandler.js.map +1 -0
  284. package/models/trace/handlers/UserTimingsHandler.js +194 -0
  285. package/models/trace/handlers/UserTimingsHandler.js.map +1 -0
  286. package/models/trace/handlers/WarningsHandler.js +135 -0
  287. package/models/trace/handlers/WarningsHandler.js.map +1 -0
  288. package/models/trace/handlers/WorkersHandler.js +34 -0
  289. package/models/trace/handlers/WorkersHandler.js.map +1 -0
  290. package/models/trace/handlers/bundle-tsconfig.json +59 -0
  291. package/models/trace/handlers/bundle-tsconfig.ref.json +27 -0
  292. package/models/trace/handlers/foundation_unittests-tsconfig.json +102 -0
  293. package/models/trace/handlers/foundation_unittests-tsconfig.ref.json +69 -0
  294. package/models/trace/handlers/foundation_unittests_node_typecheck-tsconfig.json +98 -0
  295. package/models/trace/handlers/handlers-tsconfig.json +112 -0
  296. package/models/trace/handlers/handlers-tsconfig.ref.json +80 -0
  297. package/models/trace/handlers/handlers.js +8 -0
  298. package/models/trace/handlers/handlers.js.map +1 -0
  299. package/models/trace/handlers/handlers_node_typecheck-tsconfig.json +109 -0
  300. package/models/trace/handlers/handlers_node_typecheck.stamp +0 -0
  301. package/models/trace/handlers/helpers.js +167 -0
  302. package/models/trace/handlers/helpers.js.map +1 -0
  303. package/models/trace/handlers/types.js +2 -0
  304. package/models/trace/handlers/types.js.map +1 -0
  305. package/models/trace/helpers/Extensions.js +42 -0
  306. package/models/trace/helpers/Extensions.js.map +1 -0
  307. package/models/trace/helpers/Network.js +103 -0
  308. package/models/trace/helpers/Network.js.map +1 -0
  309. package/models/trace/helpers/SamplesIntegrator.js +527 -0
  310. package/models/trace/helpers/SamplesIntegrator.js.map +1 -0
  311. package/models/trace/helpers/SyntheticEvents.js +96 -0
  312. package/models/trace/helpers/SyntheticEvents.js.map +1 -0
  313. package/models/trace/helpers/Timing.js +200 -0
  314. package/models/trace/helpers/Timing.js.map +1 -0
  315. package/models/trace/helpers/Trace.js +844 -0
  316. package/models/trace/helpers/Trace.js.map +1 -0
  317. package/models/trace/helpers/TreeHelpers.js +255 -0
  318. package/models/trace/helpers/TreeHelpers.js.map +1 -0
  319. package/models/trace/helpers/bundle-tsconfig.json +59 -0
  320. package/models/trace/helpers/bundle-tsconfig.ref.json +27 -0
  321. package/models/trace/helpers/foundation_unittests-tsconfig.json +73 -0
  322. package/models/trace/helpers/foundation_unittests-tsconfig.ref.json +40 -0
  323. package/models/trace/helpers/foundation_unittests_node_typecheck-tsconfig.json +69 -0
  324. package/models/trace/helpers/helpers-tsconfig.json +77 -0
  325. package/models/trace/helpers/helpers-tsconfig.ref.json +45 -0
  326. package/models/trace/helpers/helpers.js +11 -0
  327. package/models/trace/helpers/helpers.js.map +1 -0
  328. package/models/trace/helpers/helpers_node_typecheck-tsconfig.json +74 -0
  329. package/models/trace/helpers/helpers_node_typecheck.stamp +0 -0
  330. package/models/trace/insights/CLSCulprits.d.ts +14 -14
  331. package/models/trace/insights/CLSCulprits.js +519 -0
  332. package/models/trace/insights/CLSCulprits.js.map +1 -0
  333. package/models/trace/insights/Cache.d.ts +6 -6
  334. package/models/trace/insights/Cache.js +210 -0
  335. package/models/trace/insights/Cache.js.map +1 -0
  336. package/models/trace/insights/CharacterSet.d.ts +8 -8
  337. package/models/trace/insights/CharacterSet.js +132 -0
  338. package/models/trace/insights/CharacterSet.js.map +1 -0
  339. package/models/trace/insights/Common.js +367 -0
  340. package/models/trace/insights/Common.js.map +1 -0
  341. package/models/trace/insights/DOMSize.d.ts +13 -13
  342. package/models/trace/insights/DOMSize.js +182 -0
  343. package/models/trace/insights/DOMSize.js.map +1 -0
  344. package/models/trace/insights/DocumentLatency.d.ts +11 -11
  345. package/models/trace/insights/DocumentLatency.js +259 -0
  346. package/models/trace/insights/DocumentLatency.js.map +1 -0
  347. package/models/trace/insights/DuplicatedJavaScript.d.ts +5 -5
  348. package/models/trace/insights/DuplicatedJavaScript.js +110 -0
  349. package/models/trace/insights/DuplicatedJavaScript.js.map +1 -0
  350. package/models/trace/insights/FontDisplay.d.ts +5 -5
  351. package/models/trace/insights/FontDisplay.js +93 -0
  352. package/models/trace/insights/FontDisplay.js.map +1 -0
  353. package/models/trace/insights/ForcedReflow.d.ts +7 -7
  354. package/models/trace/insights/ForcedReflow.js +162 -0
  355. package/models/trace/insights/ForcedReflow.js.map +1 -0
  356. package/models/trace/insights/INPBreakdown.d.ts +8 -8
  357. package/models/trace/insights/INPBreakdown.js +130 -0
  358. package/models/trace/insights/INPBreakdown.js.map +1 -0
  359. package/models/trace/insights/ImageDelivery.d.ts +12 -12
  360. package/models/trace/insights/ImageDelivery.js +264 -0
  361. package/models/trace/insights/ImageDelivery.js.map +1 -0
  362. package/models/trace/insights/LCPBreakdown.d.ts +11 -11
  363. package/models/trace/insights/LCPBreakdown.js +200 -0
  364. package/models/trace/insights/LCPBreakdown.js.map +1 -0
  365. package/models/trace/insights/LCPDiscovery.d.ts +10 -10
  366. package/models/trace/insights/LCPDiscovery.js +190 -0
  367. package/models/trace/insights/LCPDiscovery.js.map +1 -0
  368. package/models/trace/insights/LegacyJavaScript.d.ts +5 -5
  369. package/models/trace/insights/LegacyJavaScript.js +99 -0
  370. package/models/trace/insights/LegacyJavaScript.js.map +1 -0
  371. package/models/trace/insights/Models.js +23 -0
  372. package/models/trace/insights/Models.js.map +1 -0
  373. package/models/trace/insights/ModernHTTP.d.ts +5 -5
  374. package/models/trace/insights/ModernHTTP.js +205 -0
  375. package/models/trace/insights/ModernHTTP.js.map +1 -0
  376. package/models/trace/insights/NetworkDependencyTree.d.ts +19 -19
  377. package/models/trace/insights/NetworkDependencyTree.js +551 -0
  378. package/models/trace/insights/NetworkDependencyTree.js.map +1 -0
  379. package/models/trace/insights/RenderBlocking.d.ts +5 -5
  380. package/models/trace/insights/RenderBlocking.js +211 -0
  381. package/models/trace/insights/RenderBlocking.js.map +1 -0
  382. package/models/trace/insights/SlowCSSSelector.d.ts +10 -10
  383. package/models/trace/insights/SlowCSSSelector.js +140 -0
  384. package/models/trace/insights/SlowCSSSelector.js.map +1 -0
  385. package/models/trace/insights/Statistics.js +93 -0
  386. package/models/trace/insights/Statistics.js.map +1 -0
  387. package/models/trace/insights/ThirdParties.d.ts +6 -6
  388. package/models/trace/insights/ThirdParties.js +110 -0
  389. package/models/trace/insights/ThirdParties.js.map +1 -0
  390. package/models/trace/insights/Viewport.d.ts +3 -3
  391. package/models/trace/insights/Viewport.js +105 -0
  392. package/models/trace/insights/Viewport.js.map +1 -0
  393. package/models/trace/insights/bundle-tsconfig.json +59 -0
  394. package/models/trace/insights/bundle-tsconfig.ref.json +27 -0
  395. package/models/trace/insights/foundation_unittests-tsconfig.json +98 -0
  396. package/models/trace/insights/foundation_unittests-tsconfig.ref.json +65 -0
  397. package/models/trace/insights/foundation_unittests_node_typecheck-tsconfig.json +94 -0
  398. package/models/trace/insights/insights-tsconfig.json +114 -0
  399. package/models/trace/insights/insights-tsconfig.ref.json +82 -0
  400. package/models/trace/insights/insights.js +10 -0
  401. package/models/trace/insights/insights.js.map +1 -0
  402. package/models/trace/insights/insights_node_typecheck-tsconfig.json +111 -0
  403. package/models/trace/insights/insights_node_typecheck.stamp +0 -0
  404. package/models/trace/insights/types.d.ts +3 -3
  405. package/models/trace/insights/types.js +41 -0
  406. package/models/trace/insights/types.js.map +1 -0
  407. package/models/trace/lantern/bundle-tsconfig.json +71 -0
  408. package/models/trace/lantern/bundle-tsconfig.ref.json +39 -0
  409. package/models/trace/lantern/core/LanternError.js +7 -0
  410. package/models/trace/lantern/core/LanternError.js.map +1 -0
  411. package/models/trace/lantern/core/NetworkAnalyzer.js +496 -0
  412. package/models/trace/lantern/core/NetworkAnalyzer.js.map +1 -0
  413. package/models/trace/lantern/core/bundle-tsconfig.json +59 -0
  414. package/models/trace/lantern/core/bundle-tsconfig.ref.json +27 -0
  415. package/models/trace/lantern/core/core-tsconfig.json +60 -0
  416. package/models/trace/lantern/core/core-tsconfig.ref.json +28 -0
  417. package/models/trace/lantern/core/core.js +6 -0
  418. package/models/trace/lantern/core/core.js.map +1 -0
  419. package/models/trace/lantern/core/core_node_typecheck-tsconfig.json +57 -0
  420. package/models/trace/lantern/core/core_node_typecheck.stamp +0 -0
  421. package/models/trace/lantern/core/foundation_unittests-tsconfig.json +69 -0
  422. package/models/trace/lantern/core/foundation_unittests-tsconfig.ref.json +36 -0
  423. package/models/trace/lantern/core/foundation_unittests_node_typecheck-tsconfig.json +65 -0
  424. package/models/trace/lantern/graph/BaseNode.d.ts +2 -2
  425. package/models/trace/lantern/graph/BaseNode.js +277 -0
  426. package/models/trace/lantern/graph/BaseNode.js.map +1 -0
  427. package/models/trace/lantern/graph/CPUNode.js +80 -0
  428. package/models/trace/lantern/graph/CPUNode.js.map +1 -0
  429. package/models/trace/lantern/graph/NetworkNode.js +95 -0
  430. package/models/trace/lantern/graph/NetworkNode.js.map +1 -0
  431. package/models/trace/lantern/graph/PageDependencyGraph.js +574 -0
  432. package/models/trace/lantern/graph/PageDependencyGraph.js.map +1 -0
  433. package/models/trace/lantern/graph/bundle-tsconfig.json +59 -0
  434. package/models/trace/lantern/graph/bundle-tsconfig.ref.json +27 -0
  435. package/models/trace/lantern/graph/foundation_unittests-tsconfig.json +61 -0
  436. package/models/trace/lantern/graph/foundation_unittests-tsconfig.ref.json +28 -0
  437. package/models/trace/lantern/graph/foundation_unittests_node_typecheck-tsconfig.json +57 -0
  438. package/models/trace/lantern/graph/graph-tsconfig.json +65 -0
  439. package/models/trace/lantern/graph/graph-tsconfig.ref.json +33 -0
  440. package/models/trace/lantern/graph/graph.js +8 -0
  441. package/models/trace/lantern/graph/graph.js.map +1 -0
  442. package/models/trace/lantern/graph/graph_node_typecheck-tsconfig.json +62 -0
  443. package/models/trace/lantern/graph/graph_node_typecheck.stamp +0 -0
  444. package/models/trace/lantern/lantern.js +10 -0
  445. package/models/trace/lantern/lantern.js.map +1 -0
  446. package/models/trace/lantern/metrics/FirstContentfulPaint.js +137 -0
  447. package/models/trace/lantern/metrics/FirstContentfulPaint.js.map +1 -0
  448. package/models/trace/lantern/metrics/Interactive.js +68 -0
  449. package/models/trace/lantern/metrics/Interactive.js.map +1 -0
  450. package/models/trace/lantern/metrics/LargestContentfulPaint.js +75 -0
  451. package/models/trace/lantern/metrics/LargestContentfulPaint.js.map +1 -0
  452. package/models/trace/lantern/metrics/MaxPotentialFID.js +49 -0
  453. package/models/trace/lantern/metrics/MaxPotentialFID.js.map +1 -0
  454. package/models/trace/lantern/metrics/Metric.js +69 -0
  455. package/models/trace/lantern/metrics/Metric.js.map +1 -0
  456. package/models/trace/lantern/metrics/SpeedIndex.js +102 -0
  457. package/models/trace/lantern/metrics/SpeedIndex.js.map +1 -0
  458. package/models/trace/lantern/metrics/TBTUtils.js +65 -0
  459. package/models/trace/lantern/metrics/TBTUtils.js.map +1 -0
  460. package/models/trace/lantern/metrics/TotalBlockingTime.js +79 -0
  461. package/models/trace/lantern/metrics/TotalBlockingTime.js.map +1 -0
  462. package/models/trace/lantern/metrics/bundle-tsconfig.json +59 -0
  463. package/models/trace/lantern/metrics/bundle-tsconfig.ref.json +27 -0
  464. package/models/trace/lantern/metrics/foundation_unittests-tsconfig.json +76 -0
  465. package/models/trace/lantern/metrics/foundation_unittests-tsconfig.ref.json +43 -0
  466. package/models/trace/lantern/metrics/foundation_unittests_node_typecheck-tsconfig.json +72 -0
  467. package/models/trace/lantern/metrics/metrics-tsconfig.json +75 -0
  468. package/models/trace/lantern/metrics/metrics-tsconfig.ref.json +43 -0
  469. package/models/trace/lantern/metrics/metrics.js +12 -0
  470. package/models/trace/lantern/metrics/metrics.js.map +1 -0
  471. package/models/trace/lantern/metrics/metrics_node_typecheck-tsconfig.json +72 -0
  472. package/models/trace/lantern/metrics/metrics_node_typecheck.stamp +0 -0
  473. package/models/trace/lantern/simulation/ConnectionPool.js +116 -0
  474. package/models/trace/lantern/simulation/ConnectionPool.js.map +1 -0
  475. package/models/trace/lantern/simulation/Constants.js +45 -0
  476. package/models/trace/lantern/simulation/Constants.js.map +1 -0
  477. package/models/trace/lantern/simulation/DNSCache.js +48 -0
  478. package/models/trace/lantern/simulation/DNSCache.js.map +1 -0
  479. package/models/trace/lantern/simulation/SimulationTimingMap.js +135 -0
  480. package/models/trace/lantern/simulation/SimulationTimingMap.js.map +1 -0
  481. package/models/trace/lantern/simulation/Simulator.js +457 -0
  482. package/models/trace/lantern/simulation/Simulator.js.map +1 -0
  483. package/models/trace/lantern/simulation/TCPConnection.js +155 -0
  484. package/models/trace/lantern/simulation/TCPConnection.js.map +1 -0
  485. package/models/trace/lantern/simulation/bundle-tsconfig.json +59 -0
  486. package/models/trace/lantern/simulation/bundle-tsconfig.ref.json +27 -0
  487. package/models/trace/lantern/simulation/foundation_unittests-tsconfig.json +75 -0
  488. package/models/trace/lantern/simulation/foundation_unittests-tsconfig.ref.json +42 -0
  489. package/models/trace/lantern/simulation/foundation_unittests_node_typecheck-tsconfig.json +71 -0
  490. package/models/trace/lantern/simulation/simulation-tsconfig.json +70 -0
  491. package/models/trace/lantern/simulation/simulation-tsconfig.ref.json +38 -0
  492. package/models/trace/lantern/simulation/simulation.js +10 -0
  493. package/models/trace/lantern/simulation/simulation.js.map +1 -0
  494. package/models/trace/lantern/simulation/simulation_node_typecheck-tsconfig.json +67 -0
  495. package/models/trace/lantern/simulation/simulation_node_typecheck.stamp +0 -0
  496. package/models/trace/lantern/testing/bundle-tsconfig.json +60 -0
  497. package/models/trace/lantern/testing/bundle-tsconfig.ref.json +27 -0
  498. package/models/trace/lantern/testing/testing-tsconfig.json +63 -0
  499. package/models/trace/lantern/testing/testing-tsconfig.ref.json +30 -0
  500. package/models/trace/lantern/types/Lantern.d.ts +19 -19
  501. package/models/trace/lantern/types/Lantern.js +25 -0
  502. package/models/trace/lantern/types/Lantern.js.map +1 -0
  503. package/models/trace/lantern/types/bundle-tsconfig.json +59 -0
  504. package/models/trace/lantern/types/bundle-tsconfig.ref.json +27 -0
  505. package/models/trace/lantern/types/types-tsconfig.json +59 -0
  506. package/models/trace/lantern/types/types-tsconfig.ref.json +27 -0
  507. package/models/trace/lantern/types/types.js +5 -0
  508. package/models/trace/lantern/types/types.js.map +1 -0
  509. package/models/trace/lantern/types/types_node_typecheck-tsconfig.json +56 -0
  510. package/models/trace/lantern/types/types_node_typecheck.stamp +0 -0
  511. package/models/trace/trace-tsconfig.json +89 -0
  512. package/models/trace/trace-tsconfig.ref.json +57 -0
  513. package/models/trace/trace.js +16 -544
  514. package/models/trace/trace.js.map +1 -0
  515. package/models/trace/trace_node_typecheck-tsconfig.json +86 -0
  516. package/models/trace/trace_node_typecheck.stamp +0 -0
  517. package/models/trace/types/Configuration.d.ts +2 -2
  518. package/models/trace/types/Configuration.js +19 -0
  519. package/models/trace/types/Configuration.js.map +1 -0
  520. package/models/trace/types/Extensions.d.ts +1 -1
  521. package/models/trace/types/Extensions.js +38 -0
  522. package/models/trace/types/Extensions.js.map +1 -0
  523. package/models/trace/types/File.d.ts +9 -3
  524. package/models/trace/types/File.js +92 -0
  525. package/models/trace/types/File.js.map +1 -0
  526. package/models/trace/types/Overlays.js +5 -0
  527. package/models/trace/types/Overlays.js.map +1 -0
  528. package/models/trace/types/Timing.js +16 -0
  529. package/models/trace/types/Timing.js.map +1 -0
  530. package/models/trace/types/TraceEvents.d.ts +21 -16
  531. package/models/trace/types/TraceEvents.js +983 -0
  532. package/models/trace/types/TraceEvents.js.map +1 -0
  533. package/models/trace/types/bundle-tsconfig.json +59 -0
  534. package/models/trace/types/bundle-tsconfig.ref.json +27 -0
  535. package/models/trace/types/foundation_unittests-tsconfig.json +67 -0
  536. package/models/trace/types/foundation_unittests-tsconfig.ref.json +34 -0
  537. package/models/trace/types/foundation_unittests_node_typecheck-tsconfig.json +63 -0
  538. package/models/trace/types/types-tsconfig.json +76 -0
  539. package/models/trace/types/types-tsconfig.ref.json +44 -0
  540. package/models/trace/types/types.js +10 -0
  541. package/models/trace/types/types.js.map +1 -0
  542. package/models/trace/types/types_node_typecheck-tsconfig.json +73 -0
  543. package/models/trace/types/types_node_typecheck.stamp +0 -0
  544. package/package.json +8 -40
  545. package/test/invalid-animation-events.json.gz +0 -0
  546. package/test/test-trace-engine.mjs +191 -0
  547. package/third_party/legacy-javascript/bundle-tsconfig.json +59 -0
  548. package/third_party/legacy-javascript/bundle-tsconfig.ref.json +27 -0
  549. package/third_party/legacy-javascript/legacy-javascript-tsconfig.ref.json +15 -0
  550. package/third_party/legacy-javascript/legacy-javascript.js +3 -0
  551. package/third_party/legacy-javascript/legacy-javascript.js.map +1 -0
  552. package/third_party/legacy-javascript/lib/legacy-javascript.js +1119 -0
  553. package/third_party/marked/marked.d.ts +1 -2
  554. package/third_party/marked/marked.js +1 -0
  555. package/third_party/third-party-web/third-party-web.d.ts +1 -2
  556. package/third_party/third-party-web/third-party-web.js +1 -0
  557. package/tsconfig.json +29 -0
  558. package/core/common/Base64.d.ts +0 -12
  559. package/core/common/CharacterIdMap.d.ts +0 -5
  560. package/core/common/Color.d.ts +0 -357
  561. package/core/common/ColorConverter.d.ts +0 -26
  562. package/core/common/ColorUtils.d.ts +0 -45
  563. package/core/common/Console.d.ts +0 -54
  564. package/core/common/Debouncer.d.ts +0 -8
  565. package/core/common/EventTarget.d.ts +0 -22
  566. package/core/common/Gzip.d.ts +0 -23
  567. package/core/common/JavaScriptMetaData.d.ts +0 -20
  568. package/core/common/Lazy.d.ts +0 -4
  569. package/core/common/MapWithDefault.d.ts +0 -9
  570. package/core/common/Mutex.d.ts +0 -13
  571. package/core/common/Object.d.ts +0 -20
  572. package/core/common/Progress.d.ts +0 -47
  573. package/core/common/ResolverBase.d.ts +0 -29
  574. package/core/common/ResourceType.d.ts +0 -52
  575. package/core/common/ReturnToPanel.d.ts +0 -10
  576. package/core/common/Revealer.d.ts +0 -66
  577. package/core/common/Runnable.d.ts +0 -14
  578. package/core/common/SegmentedRange.d.ts +0 -14
  579. package/core/common/SettingRegistration.d.ts +0 -136
  580. package/core/common/Settings.d.ts +0 -228
  581. package/core/common/SimpleHistoryManager.d.ts +0 -20
  582. package/core/common/Srcset.d.ts +0 -16
  583. package/core/common/StringOutputStream.d.ts +0 -10
  584. package/core/common/TextDictionary.d.ts +0 -11
  585. package/core/common/Throttler.d.ts +0 -12
  586. package/core/common/Trie.d.ts +0 -24
  587. package/core/common/VersionController.d.ts +0 -85
  588. package/core/host/AidaClient.d.ts +0 -73
  589. package/core/host/AidaClientTypes.d.ts +0 -355
  590. package/core/host/AidaGcaTranslation.d.ts +0 -10
  591. package/core/host/DispatchHttpRequestClient.d.ts +0 -14
  592. package/core/host/GcaClient.d.ts +0 -14
  593. package/core/host/GcaTypes.d.ts +0 -411
  594. package/core/host/GdpClient.d.ts +0 -84
  595. package/core/host/InspectorFrontendHost.d.ts +0 -29
  596. package/core/host/InspectorFrontendHostAPI.d.ts +0 -425
  597. package/core/host/InspectorFrontendHostStub.d.ts +0 -151
  598. package/core/host/Platform.d.ts +0 -16
  599. package/core/host/ResourceLoader.d.ts +0 -15
  600. package/core/host/UserMetrics.d.ts +0 -116
  601. package/core/host/UserMetricsEnums.d.ts +0 -888
  602. package/core/i18n/ByteUtilities.d.ts +0 -11
  603. package/core/i18n/DevToolsLocale.d.ts +0 -41
  604. package/core/i18n/NumberFormatter.d.ts +0 -11
  605. package/core/i18n/i18nImpl.d.ts +0 -64
  606. package/core/i18n/i18nTypes.d.ts +0 -5
  607. package/core/i18n/locales.d.ts +0 -15
  608. package/core/i18n/time-utilities.d.ts +0 -16
  609. package/core/platform/browser/HostRuntime.d.ts +0 -2
  610. package/core/platform/browser/browser.d.ts +0 -2
  611. package/core/platform/node/HostRuntime.d.ts +0 -2
  612. package/core/platform/node/node.d.ts +0 -2
  613. package/core/protocol_client/CDPConnection.d.ts +0 -77
  614. package/core/protocol_client/ConnectionTransport.d.ts +0 -9
  615. package/core/protocol_client/DevToolsCDPConnection.d.ts +0 -16
  616. package/core/protocol_client/InspectorBackend.d.ts +0 -223
  617. package/core/protocol_client/protocol_client.d.ts +0 -5
  618. package/core/root/DevToolsContext.d.ts +0 -34
  619. package/core/root/ExperimentNames.d.ts +0 -9
  620. package/core/root/Runtime.d.ts +0 -353
  621. package/core/sdk/AccessibilityModel.d.ts +0 -76
  622. package/core/sdk/AnimationModel.d.ts +0 -161
  623. package/core/sdk/AutofillModel.d.ts +0 -23
  624. package/core/sdk/CPUProfilerModel.d.ts +0 -46
  625. package/core/sdk/CPUThrottlingManager.d.ts +0 -47
  626. package/core/sdk/CSSContainerQuery.d.ts +0 -42
  627. package/core/sdk/CSSFontFace.d.ts +0 -10
  628. package/core/sdk/CSSLayer.d.ts +0 -9
  629. package/core/sdk/CSSLocation.d.ts +0 -14
  630. package/core/sdk/CSSMatchedStyles.d.ts +0 -138
  631. package/core/sdk/CSSMedia.d.ts +0 -36
  632. package/core/sdk/CSSMetadata.d.ts +0 -87
  633. package/core/sdk/CSSModel.d.ts +0 -185
  634. package/core/sdk/CSSNavigation.d.ts +0 -10
  635. package/core/sdk/CSSProperty.d.ts +0 -53
  636. package/core/sdk/CSSPropertyParser.d.ts +0 -126
  637. package/core/sdk/CSSPropertyParserMatchers.d.ts +0 -442
  638. package/core/sdk/CSSQuery.d.ts +0 -22
  639. package/core/sdk/CSSRule.d.ts +0 -132
  640. package/core/sdk/CSSScope.d.ts +0 -9
  641. package/core/sdk/CSSStartingStyle.d.ts +0 -9
  642. package/core/sdk/CSSStyleDeclaration.d.ts +0 -38
  643. package/core/sdk/CSSStyleSheetHeader.d.ts +0 -53
  644. package/core/sdk/CSSSupports.d.ts +0 -10
  645. package/core/sdk/CategorizedBreakpoint.d.ts +0 -42
  646. package/core/sdk/ChildTargetManager.d.ts +0 -40
  647. package/core/sdk/CompilerSourceMappingContentProvider.d.ts +0 -12
  648. package/core/sdk/Connections.d.ts +0 -36
  649. package/core/sdk/ConsoleModel.d.ts +0 -127
  650. package/core/sdk/ConsoleModelTypes.d.ts +0 -6
  651. package/core/sdk/Cookie.d.ts +0 -68
  652. package/core/sdk/CookieModel.d.ts +0 -31
  653. package/core/sdk/CookieParser.d.ts +0 -14
  654. package/core/sdk/CrashReportContextModel.d.ts +0 -8
  655. package/core/sdk/DOMDebuggerModel.d.ts +0 -127
  656. package/core/sdk/DOMModel.d.ts +0 -440
  657. package/core/sdk/DOMStorageModel.d.ts +0 -79
  658. package/core/sdk/DebuggerModel.d.ts +0 -305
  659. package/core/sdk/EmulationModel.d.ts +0 -95
  660. package/core/sdk/EnhancedTracesParser.d.ts +0 -105
  661. package/core/sdk/EventBreakpointsModel.d.ts +0 -66
  662. package/core/sdk/FrameAssociated.d.ts +0 -6
  663. package/core/sdk/FrameManager.d.ts +0 -68
  664. package/core/sdk/HeapProfilerModel.d.ts +0 -75
  665. package/core/sdk/HttpReasonPhraseStrings.d.ts +0 -5
  666. package/core/sdk/IOModel.d.ts +0 -10
  667. package/core/sdk/IsolateManager.d.ts +0 -53
  668. package/core/sdk/IssuesModel.d.ts +0 -28
  669. package/core/sdk/LayerTreeBase.d.ts +0 -70
  670. package/core/sdk/LogModel.d.ts +0 -20
  671. package/core/sdk/NetworkManager.d.ts +0 -418
  672. package/core/sdk/NetworkRequest.d.ts +0 -497
  673. package/core/sdk/NetworkRequestAccess.d.ts +0 -91
  674. package/core/sdk/OverlayColorGenerator.d.ts +0 -14
  675. package/core/sdk/OverlayModel.d.ts +0 -186
  676. package/core/sdk/OverlayPersistentHighlighter.d.ts +0 -116
  677. package/core/sdk/PageFunctions.d.ts +0 -22
  678. package/core/sdk/PageLoad.d.ts +0 -14
  679. package/core/sdk/PageResourceLoader.d.ts +0 -111
  680. package/core/sdk/PaintProfiler.d.ts +0 -43
  681. package/core/sdk/PerformanceMetricsModel.d.ts +0 -12
  682. package/core/sdk/PreloadingModel.d.ts +0 -146
  683. package/core/sdk/RehydratingConnection.d.ts +0 -73
  684. package/core/sdk/RehydratingObject.d.ts +0 -59
  685. package/core/sdk/RemoteObject.d.ts +0 -210
  686. package/core/sdk/Resource.d.ts +0 -36
  687. package/core/sdk/ResourceTreeModel.d.ts +0 -280
  688. package/core/sdk/RuntimeModel.d.ts +0 -164
  689. package/core/sdk/SDKModel.d.ts +0 -30
  690. package/core/sdk/SDKSettings.d.ts +0 -54
  691. package/core/sdk/ScopeTreeCache.d.ts +0 -21
  692. package/core/sdk/ScreenCaptureModel.d.ts +0 -69
  693. package/core/sdk/Script.d.ts +0 -134
  694. package/core/sdk/SecurityOrigin.d.ts +0 -108
  695. package/core/sdk/SecurityOriginManager.d.ts +0 -23
  696. package/core/sdk/ServerSentEvents.d.ts +0 -18
  697. package/core/sdk/ServerSentEventsProtocol.d.ts +0 -18
  698. package/core/sdk/ServerTiming.d.ts +0 -24
  699. package/core/sdk/ServiceWorkerCacheModel.d.ts +0 -71
  700. package/core/sdk/ServiceWorkerManager.d.ts +0 -125
  701. package/core/sdk/SourceMap.d.ts +0 -211
  702. package/core/sdk/SourceMapCache.d.ts +0 -12
  703. package/core/sdk/SourceMapFunctionRanges.d.ts +0 -23
  704. package/core/sdk/SourceMapManager.d.ts +0 -46
  705. package/core/sdk/SourceMapRangeMappings.d.ts +0 -15
  706. package/core/sdk/SourceMapScopeChainEntry.d.ts +0 -23
  707. package/core/sdk/SourceMapScopesInfo.d.ts +0 -184
  708. package/core/sdk/StorageBucketsModel.d.ts +0 -48
  709. package/core/sdk/StorageKeyManager.d.ts +0 -38
  710. package/core/sdk/Target.d.ts +0 -79
  711. package/core/sdk/TargetManager.d.ts +0 -92
  712. package/core/sdk/TraceObject.d.ts +0 -43
  713. package/core/sdk/WebAuthnModel.d.ts +0 -29
  714. package/core/text_utils/CodeMirrorUtils.d.ts +0 -3
  715. package/core/text_utils/ContentData.d.ts +0 -94
  716. package/core/text_utils/ContentProvider.d.ts +0 -42
  717. package/core/text_utils/Markdown.d.ts +0 -13
  718. package/core/text_utils/StaticContentProvider.d.ts +0 -13
  719. package/core/text_utils/StreamingContentData.d.ts +0 -49
  720. package/core/text_utils/Text.d.ts +0 -19
  721. package/core/text_utils/TextCursor.d.ts +0 -9
  722. package/core/text_utils/TextRange.d.ts +0 -81
  723. package/core/text_utils/TextUtils.d.ts +0 -97
  724. package/core/text_utils/WasmDisassembly.d.ts +0 -29
  725. package/core/text_utils/text_utils.d.ts +0 -12
  726. package/entrypoints/formatter_actions/formatter_actions.d.ts +0 -65
  727. package/generated/InspectorBackendCommands.d.ts +0 -14
  728. package/generated/SupportedCSSProperties.d.ts +0 -18
  729. package/generated/protocol-mapping.d.ts +0 -5985
  730. package/generated/protocol-proxy-api.d.ts +0 -5447
  731. package/index.d.ts +0 -2
  732. package/index.js +0 -6
  733. package/models/crux-manager/CrUXManager.d.ts +0 -107
  734. package/models/emulation/DeviceModeModel.d.ts +0 -157
  735. package/models/emulation/EmulatedDevices.d.ts +0 -148
  736. package/models/emulation/emulation.d.ts +0 -3
  737. package/models/formatter/FormatterWorkerPool.d.ts +0 -58
  738. package/models/formatter/ScriptFormatter.d.ts +0 -11
  739. package/models/formatter/formatter.d.ts +0 -3
  740. package/third_party/codemirror.next/codemirror.next.d.ts +0 -9196
  741. package/third_party/i18n/i18n-impl.d.ts +0 -25
  742. package/third_party/i18n/i18n.d.ts +0 -3
  743. package/third_party/i18n/localized-string-set.d.ts +0 -49
  744. package/third_party/intl-messageformat/intl-messageformat.d.ts +0 -1
  745. package/third_party/marked/package/lib/marked.esm.d.ts +0 -760
  746. package/third_party/source-map-scopes-codec/package/src/builder/builder.d.ts +0 -70
  747. package/third_party/source-map-scopes-codec/package/src/builder/safe_builder.d.ts +0 -40
  748. package/third_party/source-map-scopes-codec/package/src/codec.d.ts +0 -49
  749. package/third_party/source-map-scopes-codec/package/src/decode/decode.d.ts +0 -33
  750. package/third_party/source-map-scopes-codec/package/src/encode/encode.d.ts +0 -8
  751. package/third_party/source-map-scopes-codec/package/src/encode/encoder.d.ts +0 -9
  752. package/third_party/source-map-scopes-codec/package/src/mod.d.ts +0 -5
  753. package/third_party/source-map-scopes-codec/package/src/scopes.d.ts +0 -169
  754. package/third_party/source-map-scopes-codec/package/src/util.d.ts +0 -5
  755. package/third_party/source-map-scopes-codec/package/src/vlq.d.ts +0 -14
  756. package/third_party/source-map-scopes-codec/source-map-scopes-codec.d.ts +0 -1
  757. package/third_party/third-party-web/lib/nostats-subset.d.ts +0 -2
  758. package/third_party/third-party-web/package/lib/index.d.ts +0 -34
  759. package/third_party/third-party-web/package/lib/subsets/nostats.d.ts +0 -1
@@ -0,0 +1,137 @@
1
+ // Copyright 2024 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ import * as Graph from '../graph/graph.js';
5
+ import { Metric } from './Metric.js';
6
+ class FirstContentfulPaint extends Metric {
7
+ static get coefficients() {
8
+ return {
9
+ intercept: 0,
10
+ optimistic: 0.5,
11
+ pessimistic: 0.5,
12
+ };
13
+ }
14
+ /**
15
+ * Computes the set of URLs that *appeared* to be render-blocking based on our filter,
16
+ * *but definitely were not* render-blocking based on the timing of their EvaluateScript task.
17
+ * It also computes the set of corresponding CPU node ids that were needed for the paint at the
18
+ * given timestamp.
19
+ */
20
+ static getRenderBlockingNodeData(graph, { cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking }) {
21
+ /** A map of blocking script URLs to the earliest EvaluateScript task node that executed them. */
22
+ const scriptUrlToNodeMap = new Map();
23
+ const cpuNodes = [];
24
+ graph.traverse(node => {
25
+ if (node.type === Graph.BaseNode.types.CPU) {
26
+ // A task is *possibly* render-blocking if it *started* before cutoffTimestamp.
27
+ // We use startTime here because the paint event can be *inside* the task that was render-blocking.
28
+ if (node.startTime <= cutoffTimestamp) {
29
+ cpuNodes.push(node);
30
+ }
31
+ // Build our script URL map to find the earliest EvaluateScript task node.
32
+ const scriptUrls = node.getEvaluateScriptURLs();
33
+ for (const url of scriptUrls) {
34
+ // Use the earliest CPU node we find.
35
+ const existing = scriptUrlToNodeMap.get(url) || node;
36
+ scriptUrlToNodeMap.set(url, node.startTime < existing.startTime ? node : existing);
37
+ }
38
+ }
39
+ });
40
+ cpuNodes.sort((a, b) => a.startTime - b.startTime);
41
+ // A script is *possibly* render-blocking if it finished loading before cutoffTimestamp.
42
+ const possiblyRenderBlockingScriptUrls = Metric.getScriptUrls(graph, node => {
43
+ // The optimistic LCP treatNodeAsRenderBlocking fn wants to exclude some images in the graph,
44
+ // but here it only receives scripts to evaluate. It's a no-op in this case, but it will
45
+ // matter below in the getFirstPaintBasedGraph clone operation.
46
+ return node.endTime <= cutoffTimestamp && treatNodeAsRenderBlocking(node);
47
+ });
48
+ // A script is *definitely not* render-blocking if its EvaluateScript task started after cutoffTimestamp.
49
+ const definitelyNotRenderBlockingScriptUrls = new Set();
50
+ const renderBlockingCpuNodeIds = new Set();
51
+ for (const url of possiblyRenderBlockingScriptUrls) {
52
+ // Lookup the CPU node that had the earliest EvaluateScript for this URL.
53
+ const cpuNodeForUrl = scriptUrlToNodeMap.get(url);
54
+ // If we can't find it at all, we can't conclude anything, so just skip it.
55
+ if (!cpuNodeForUrl) {
56
+ continue;
57
+ }
58
+ // If we found it and it was in our `cpuNodes` set that means it finished before cutoffTimestamp, so it really is render-blocking.
59
+ if (cpuNodes.includes(cpuNodeForUrl)) {
60
+ renderBlockingCpuNodeIds.add(cpuNodeForUrl.id);
61
+ continue;
62
+ }
63
+ // We couldn't find the evaluate script in the set of CPU nodes that ran before our paint, so
64
+ // it must not have been necessary for the paint.
65
+ definitelyNotRenderBlockingScriptUrls.add(url);
66
+ }
67
+ // The first layout, first paint, and first ParseHTML are almost always necessary for first paint,
68
+ // so we always include those CPU nodes.
69
+ const firstLayout = cpuNodes.find(node => node.didPerformLayout());
70
+ if (firstLayout) {
71
+ renderBlockingCpuNodeIds.add(firstLayout.id);
72
+ }
73
+ const firstPaint = cpuNodes.find(node => node.childEvents.some(e => e.name === 'Paint'));
74
+ if (firstPaint) {
75
+ renderBlockingCpuNodeIds.add(firstPaint.id);
76
+ }
77
+ const firstParse = cpuNodes.find(node => node.childEvents.some(e => e.name === 'ParseHTML'));
78
+ if (firstParse) {
79
+ renderBlockingCpuNodeIds.add(firstParse.id);
80
+ }
81
+ // If a CPU filter was passed in, we also want to include those extra nodes.
82
+ if (additionalCpuNodesToTreatAsRenderBlocking) {
83
+ cpuNodes.filter(additionalCpuNodesToTreatAsRenderBlocking).forEach(node => renderBlockingCpuNodeIds.add(node.id));
84
+ }
85
+ return {
86
+ definitelyNotRenderBlockingScriptUrls,
87
+ renderBlockingCpuNodeIds,
88
+ };
89
+ }
90
+ /**
91
+ * Computes the graph required for the first paint of interest.
92
+ */
93
+ static getFirstPaintBasedGraph(dependencyGraph, { cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking }) {
94
+ const rbData = this.getRenderBlockingNodeData(dependencyGraph, {
95
+ cutoffTimestamp,
96
+ treatNodeAsRenderBlocking,
97
+ additionalCpuNodesToTreatAsRenderBlocking,
98
+ });
99
+ const { definitelyNotRenderBlockingScriptUrls, renderBlockingCpuNodeIds } = rbData;
100
+ return dependencyGraph.cloneWithRelationships(node => {
101
+ if (node.type === Graph.BaseNode.types.NETWORK) {
102
+ // Exclude all nodes that ended after cutoffTimestamp (except for the main document which we always consider necessary)
103
+ // endTime is negative if request does not finish, make sure startTime isn't after cutoffTimestamp in this case.
104
+ const endedAfterPaint = node.endTime > cutoffTimestamp || node.startTime > cutoffTimestamp;
105
+ if (endedAfterPaint && !node.isMainDocument()) {
106
+ return false;
107
+ }
108
+ const url = node.request.url;
109
+ // If the URL definitely wasn't render-blocking then we filter it out.
110
+ if (definitelyNotRenderBlockingScriptUrls.has(url)) {
111
+ return false;
112
+ }
113
+ // Lastly, build up the FCP graph of all nodes we consider render-blocking
114
+ return treatNodeAsRenderBlocking(node);
115
+ }
116
+ // If it's a CPU node, just check if it was blocking.
117
+ return renderBlockingCpuNodeIds.has(node.id);
118
+ });
119
+ }
120
+ static getOptimisticGraph(dependencyGraph, processedNavigation) {
121
+ return this.getFirstPaintBasedGraph(dependencyGraph, {
122
+ cutoffTimestamp: processedNavigation.timestamps.firstContentfulPaint,
123
+ // In the optimistic graph we exclude resources that appeared to be render-blocking but were
124
+ // initiated by a script. While they typically have a very high importance and tend to have a
125
+ // significant impact on the page's content, these resources don't technically block rendering.
126
+ treatNodeAsRenderBlocking: node => node.hasRenderBlockingPriority() && node.initiatorType !== 'script',
127
+ });
128
+ }
129
+ static getPessimisticGraph(dependencyGraph, processedNavigation) {
130
+ return this.getFirstPaintBasedGraph(dependencyGraph, {
131
+ cutoffTimestamp: processedNavigation.timestamps.firstContentfulPaint,
132
+ treatNodeAsRenderBlocking: node => node.hasRenderBlockingPriority(),
133
+ });
134
+ }
135
+ }
136
+ export { FirstContentfulPaint };
137
+ //# sourceMappingURL=FirstContentfulPaint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FirstContentfulPaint.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/metrics/FirstContentfulPaint.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAC,MAAM,EAA0B,MAAM,aAAa,CAAC;AAoB5D,MAAM,oBAAqB,SAAQ,MAAM;IACvC,MAAM,KAAc,YAAY;QAC9B,OAAO;YACL,SAAS,EAAE,CAAC;YACZ,UAAU,EAAE,GAAG;YACf,WAAW,EAAE,GAAG;SACjB,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,yBAAyB,CAC5B,KAAiB,EACjB,EAAC,eAAe,EAAE,yBAAyB,EAAE,yCAAyC,EACvD;QAEjC,iGAAiG;QACjG,MAAM,kBAAkB,GAAG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0E;gBAC1E,OAAO,yBAAyB,CAAC,IAAI,CAAC,CAAC;YACzC,CAAC;YACD,qDAAqD;YACrD,OAAO,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAU,kBAAkB,CAC9B,eAA8B,EAAE,mBAAyD;QAC3F,OAAO,IAAI,CAAC,uBAAuB,CAAC,eAAe,EAAE;YACnD,eAAe,EAAE,mBAAmB,CAAC,UAAU,CAAC,oBAAoB;YACpE,4FAA4F;YAC5F,6FAA6F;YAC7F,+FAA+F;YAC/F,yBAAyB,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,yBAAyB,EAAE,IAAI,IAAI,CAAC,aAAa,KAAK,QAAQ;SACvG,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAU,mBAAmB,CAC/B,eAA8B,EAAE,mBAAyD;QAC3F,OAAO,IAAI,CAAC,uBAAuB,CAAC,eAAe,EAAE;YACnD,eAAe,EAAE,mBAAmB,CAAC,UAAU,CAAC,oBAAoB;YACpE,yBAAyB,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,yBAAyB,EAAE;SACpE,CAAC,CAAC;IACL,CAAC;CACF;AAED,OAAO,EAAC,oBAAoB,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\nimport * as Graph from '../graph/graph.js';\nimport type * as Types from '../types/types.js';\n\nimport {Metric, type MetricCoefficients} from './Metric.js';\n\ninterface FirstPaintBasedGraphOpts<T> {\n /**\n * The timestamp used to filter out tasks that occurred after our paint of interest.\n * Typically this is First Contentful Paint or First Meaningful Paint.\n */\n cutoffTimestamp: number;\n /**\n * The function that determines which resources should be considered *possibly*\n * render-blocking.\n */\n treatNodeAsRenderBlocking: (node: Graph.NetworkNode<T>) => boolean;\n /**\n * The function that determines which CPU nodes should also be included in our\n * blocking node IDs set, beyond what getRenderBlockingNodeData() already includes.\n */\n additionalCpuNodesToTreatAsRenderBlocking?: (node: Graph.CPUNode) => boolean;\n}\n\nclass FirstContentfulPaint extends Metric {\n static override get coefficients(): MetricCoefficients {\n return {\n intercept: 0,\n optimistic: 0.5,\n pessimistic: 0.5,\n };\n }\n\n /**\n * Computes the set of URLs that *appeared* to be render-blocking based on our filter,\n * *but definitely were not* render-blocking based on the timing of their EvaluateScript task.\n * It also computes the set of corresponding CPU node ids that were needed for the paint at the\n * given timestamp.\n */\n static getRenderBlockingNodeData<T = unknown>(\n graph: Graph.Node,\n {cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking}:\n FirstPaintBasedGraphOpts<T>,\n ): {definitelyNotRenderBlockingScriptUrls: Set<string>, renderBlockingCpuNodeIds: Set<string>} {\n /** A map of blocking script URLs to the earliest EvaluateScript task node that executed them. */\n const scriptUrlToNodeMap = new Map<string, Graph.CPUNode>();\n\n const cpuNodes: Graph.CPUNode[] = [];\n graph.traverse(node => {\n if (node.type === Graph.BaseNode.types.CPU) {\n // A task is *possibly* render-blocking if it *started* before cutoffTimestamp.\n // We use startTime here because the paint event can be *inside* the task that was render-blocking.\n if (node.startTime <= cutoffTimestamp) {\n cpuNodes.push(node);\n }\n\n // Build our script URL map to find the earliest EvaluateScript task node.\n const scriptUrls = node.getEvaluateScriptURLs();\n for (const url of scriptUrls) {\n // Use the earliest CPU node we find.\n const existing = scriptUrlToNodeMap.get(url) || node;\n scriptUrlToNodeMap.set(url, node.startTime < existing.startTime ? node : existing);\n }\n }\n });\n\n cpuNodes.sort((a, b) => a.startTime - b.startTime);\n\n // A script is *possibly* render-blocking if it finished loading before cutoffTimestamp.\n const possiblyRenderBlockingScriptUrls = Metric.getScriptUrls(graph, node => {\n // The optimistic LCP treatNodeAsRenderBlocking fn wants to exclude some images in the graph,\n // but here it only receives scripts to evaluate. It's a no-op in this case, but it will\n // matter below in the getFirstPaintBasedGraph clone operation.\n return node.endTime <= cutoffTimestamp && treatNodeAsRenderBlocking(node);\n });\n\n // A script is *definitely not* render-blocking if its EvaluateScript task started after cutoffTimestamp.\n const definitelyNotRenderBlockingScriptUrls = new Set<string>();\n const renderBlockingCpuNodeIds = new Set<string>();\n for (const url of possiblyRenderBlockingScriptUrls) {\n // Lookup the CPU node that had the earliest EvaluateScript for this URL.\n const cpuNodeForUrl = scriptUrlToNodeMap.get(url);\n\n // If we can't find it at all, we can't conclude anything, so just skip it.\n if (!cpuNodeForUrl) {\n continue;\n }\n\n // If we found it and it was in our `cpuNodes` set that means it finished before cutoffTimestamp, so it really is render-blocking.\n if (cpuNodes.includes(cpuNodeForUrl)) {\n renderBlockingCpuNodeIds.add(cpuNodeForUrl.id);\n continue;\n }\n\n // We couldn't find the evaluate script in the set of CPU nodes that ran before our paint, so\n // it must not have been necessary for the paint.\n definitelyNotRenderBlockingScriptUrls.add(url);\n }\n\n // The first layout, first paint, and first ParseHTML are almost always necessary for first paint,\n // so we always include those CPU nodes.\n const firstLayout = cpuNodes.find(node => node.didPerformLayout());\n if (firstLayout) {\n renderBlockingCpuNodeIds.add(firstLayout.id);\n }\n const firstPaint = cpuNodes.find(node => node.childEvents.some(e => e.name === 'Paint'));\n if (firstPaint) {\n renderBlockingCpuNodeIds.add(firstPaint.id);\n }\n const firstParse = cpuNodes.find(node => node.childEvents.some(e => e.name === 'ParseHTML'));\n if (firstParse) {\n renderBlockingCpuNodeIds.add(firstParse.id);\n }\n\n // If a CPU filter was passed in, we also want to include those extra nodes.\n if (additionalCpuNodesToTreatAsRenderBlocking) {\n cpuNodes.filter(additionalCpuNodesToTreatAsRenderBlocking).forEach(node => renderBlockingCpuNodeIds.add(node.id));\n }\n\n return {\n definitelyNotRenderBlockingScriptUrls,\n renderBlockingCpuNodeIds,\n };\n }\n\n /**\n * Computes the graph required for the first paint of interest.\n */\n static getFirstPaintBasedGraph<T>(\n dependencyGraph: Graph.Node,\n {cutoffTimestamp, treatNodeAsRenderBlocking, additionalCpuNodesToTreatAsRenderBlocking}:\n FirstPaintBasedGraphOpts<T>,\n ): Graph.Node<T> {\n const rbData = this.getRenderBlockingNodeData(dependencyGraph, {\n cutoffTimestamp,\n treatNodeAsRenderBlocking,\n additionalCpuNodesToTreatAsRenderBlocking,\n });\n const {definitelyNotRenderBlockingScriptUrls, renderBlockingCpuNodeIds} = rbData;\n\n return dependencyGraph.cloneWithRelationships(node => {\n if (node.type === Graph.BaseNode.types.NETWORK) {\n // Exclude all nodes that ended after cutoffTimestamp (except for the main document which we always consider necessary)\n // endTime is negative if request does not finish, make sure startTime isn't after cutoffTimestamp in this case.\n const endedAfterPaint = node.endTime > cutoffTimestamp || node.startTime > cutoffTimestamp;\n if (endedAfterPaint && !node.isMainDocument()) {\n return false;\n }\n\n const url = node.request.url;\n // If the URL definitely wasn't render-blocking then we filter it out.\n if (definitelyNotRenderBlockingScriptUrls.has(url)) {\n return false;\n }\n\n // Lastly, build up the FCP graph of all nodes we consider render-blocking\n return treatNodeAsRenderBlocking(node);\n }\n // If it's a CPU node, just check if it was blocking.\n return renderBlockingCpuNodeIds.has(node.id);\n });\n }\n\n static override getOptimisticGraph<T>(\n dependencyGraph: Graph.Node<T>, processedNavigation: Types.Simulation.ProcessedNavigation): Graph.Node<T> {\n return this.getFirstPaintBasedGraph(dependencyGraph, {\n cutoffTimestamp: processedNavigation.timestamps.firstContentfulPaint,\n // In the optimistic graph we exclude resources that appeared to be render-blocking but were\n // initiated by a script. While they typically have a very high importance and tend to have a\n // significant impact on the page's content, these resources don't technically block rendering.\n treatNodeAsRenderBlocking: node => node.hasRenderBlockingPriority() && node.initiatorType !== 'script',\n });\n }\n\n static override getPessimisticGraph<T>(\n dependencyGraph: Graph.Node<T>, processedNavigation: Types.Simulation.ProcessedNavigation): Graph.Node<T> {\n return this.getFirstPaintBasedGraph(dependencyGraph, {\n cutoffTimestamp: processedNavigation.timestamps.firstContentfulPaint,\n treatNodeAsRenderBlocking: node => node.hasRenderBlockingPriority(),\n });\n }\n}\n\nexport {FirstContentfulPaint};\n"]}
@@ -0,0 +1,68 @@
1
+ // Copyright 2024 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ import * as Core from '../core/core.js';
5
+ import * as Graph from '../graph/graph.js';
6
+ import { Metric, } from './Metric.js';
7
+ // Any CPU task of 20 ms or more will end up being a critical long task on mobile
8
+ const CRITICAL_LONG_TASK_THRESHOLD = 20;
9
+ class Interactive extends Metric {
10
+ static get coefficients() {
11
+ return {
12
+ intercept: 0,
13
+ optimistic: 0.45,
14
+ pessimistic: 0.55,
15
+ };
16
+ }
17
+ static getOptimisticGraph(dependencyGraph) {
18
+ // Adjust the critical long task threshold for microseconds
19
+ const minimumCpuTaskDuration = CRITICAL_LONG_TASK_THRESHOLD * 1000;
20
+ return dependencyGraph.cloneWithRelationships(node => {
21
+ // Include everything that might be a long task
22
+ if (node.type === Graph.BaseNode.types.CPU) {
23
+ return node.duration > minimumCpuTaskDuration;
24
+ }
25
+ // Include all scripts and high priority requests, exclude all images
26
+ const isImage = node.request.resourceType === 'Image';
27
+ const isScript = node.request.resourceType === 'Script';
28
+ return (!isImage && (isScript || node.request.priority === 'High' || node.request.priority === 'VeryHigh'));
29
+ });
30
+ }
31
+ static getPessimisticGraph(dependencyGraph) {
32
+ return dependencyGraph;
33
+ }
34
+ static getEstimateFromSimulation(simulationResult, extras) {
35
+ if (!extras.lcpResult) {
36
+ throw new Core.LanternError('missing lcpResult');
37
+ }
38
+ const lastTaskAt = Interactive.getLastLongTaskEndTime(simulationResult.nodeTimings);
39
+ const minimumTime = extras.optimistic ? extras.lcpResult.optimisticEstimate.timeInMs :
40
+ extras.lcpResult.pessimisticEstimate.timeInMs;
41
+ return {
42
+ timeInMs: Math.max(minimumTime, lastTaskAt),
43
+ nodeTimings: simulationResult.nodeTimings,
44
+ };
45
+ }
46
+ static compute(data, extras) {
47
+ const lcpResult = extras?.lcpResult;
48
+ if (!lcpResult) {
49
+ throw new Core.LanternError('LCP is required to calculate the Interactive metric');
50
+ }
51
+ const metricResult = super.compute(data, extras);
52
+ metricResult.timing = Math.max(metricResult.timing, lcpResult.timing);
53
+ return metricResult;
54
+ }
55
+ static getLastLongTaskEndTime(nodeTimings, duration = 50) {
56
+ return Array.from(nodeTimings.entries())
57
+ .filter(([node, timing]) => {
58
+ if (node.type !== Graph.BaseNode.types.CPU) {
59
+ return false;
60
+ }
61
+ return timing.duration > duration;
62
+ })
63
+ .map(([_, timing]) => timing.endTime)
64
+ .reduce((max, x) => Math.max(max || 0, x || 0), 0);
65
+ }
66
+ }
67
+ export { Interactive };
68
+ //# sourceMappingURL=Interactive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Interactive.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/metrics/Interactive.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAEL,MAAM,GAIP,MAAM,aAAa,CAAC;AAErB,iFAAiF;AACjF,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAExC,MAAM,WAAY,SAAQ,MAAM;IAC9B,MAAM,KAAc,YAAY;QAC9B,OAAO;YACL,SAAS,EAAE,CAAC;YACZ,UAAU,EAAE,IAAI;YAChB,WAAW,EAAE,IAAI;SAClB,CAAC;IACJ,CAAC;IAED,MAAM,CAAU,kBAAkB,CAAI,eAA8B;QAClE,2DAA2D;QAC3D,MAAM,sBAAsB,GAAG,4BAA4B,GAAG,IAAI,CAAC;QAEnE,OAAO,eAAe,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE;YACnD,+CAA+C;YAC/C,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;gBAC3C,OAAO,IAAI,CAAC,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AAqD,CAAC,CAAC;QACrF,CAAC;QAED,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACjD,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QACtE,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,MAAM,CAAC,sBAAsB,CAAC,WAA6C,EAAE,QAAQ,GAAG,EAAE;QACxF,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;aACnC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE;YACzB,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;gBAC3C,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACpC,CAAC,CAAC;aACD,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;aACpC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC;CACF;AAED,OAAO,EAAC,WAAW,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\nimport * as Core from '../core/core.js';\nimport * as Graph from '../graph/graph.js';\nimport type * as Simulation from '../simulation/simulation.js';\n\nimport {\n type Extras,\n Metric,\n type MetricCoefficients,\n type MetricComputationDataInput,\n type MetricResult,\n} from './Metric.js';\n\n// Any CPU task of 20 ms or more will end up being a critical long task on mobile\nconst CRITICAL_LONG_TASK_THRESHOLD = 20;\n\nclass Interactive extends Metric {\n static override get coefficients(): MetricCoefficients {\n return {\n intercept: 0,\n optimistic: 0.45,\n pessimistic: 0.55,\n };\n }\n\n static override getOptimisticGraph<T>(dependencyGraph: Graph.Node<T>): Graph.Node<T> {\n // Adjust the critical long task threshold for microseconds\n const minimumCpuTaskDuration = CRITICAL_LONG_TASK_THRESHOLD * 1000;\n\n return dependencyGraph.cloneWithRelationships(node => {\n // Include everything that might be a long task\n if (node.type === Graph.BaseNode.types.CPU) {\n return node.duration > minimumCpuTaskDuration;\n }\n\n // Include all scripts and high priority requests, exclude all images\n const isImage = node.request.resourceType === 'Image';\n const isScript = node.request.resourceType === 'Script';\n return (!isImage && (isScript || node.request.priority === 'High' || node.request.priority === 'VeryHigh'));\n });\n }\n\n static override getPessimisticGraph<T>(dependencyGraph: Graph.Node<T>): Graph.Node<T> {\n return dependencyGraph;\n }\n\n static override getEstimateFromSimulation(simulationResult: Simulation.Result, extras: Extras): Simulation.Result {\n if (!extras.lcpResult) {\n throw new Core.LanternError('missing lcpResult');\n }\n\n const lastTaskAt = Interactive.getLastLongTaskEndTime(simulationResult.nodeTimings);\n const minimumTime = extras.optimistic ? extras.lcpResult.optimisticEstimate.timeInMs :\n extras.lcpResult.pessimisticEstimate.timeInMs;\n return {\n timeInMs: Math.max(minimumTime, lastTaskAt),\n nodeTimings: simulationResult.nodeTimings,\n };\n }\n\n static override compute(data: MetricComputationDataInput, extras?: Omit<Extras, 'optimistic'>): MetricResult {\n const lcpResult = extras?.lcpResult;\n if (!lcpResult) {\n throw new Core.LanternError('LCP is required to calculate the Interactive metric');\n }\n\n const metricResult = super.compute(data, extras);\n metricResult.timing = Math.max(metricResult.timing, lcpResult.timing);\n return metricResult;\n }\n\n static getLastLongTaskEndTime(nodeTimings: Simulation.Result['nodeTimings'], duration = 50): number {\n return Array.from(nodeTimings.entries())\n .filter(([node, timing]) => {\n if (node.type !== Graph.BaseNode.types.CPU) {\n return false;\n }\n return timing.duration > duration;\n })\n .map(([_, timing]) => timing.endTime)\n .reduce((max, x) => Math.max(max || 0, x || 0), 0);\n }\n}\n\nexport {Interactive};\n"]}
@@ -0,0 +1,75 @@
1
+ // Copyright 2024 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ import * as Core from '../core/core.js';
5
+ import { FirstContentfulPaint } from './FirstContentfulPaint.js';
6
+ import { Metric, } from './Metric.js';
7
+ class LargestContentfulPaint extends Metric {
8
+ static get coefficients() {
9
+ return {
10
+ intercept: 0,
11
+ optimistic: 0.5,
12
+ pessimistic: 0.5,
13
+ };
14
+ }
15
+ /**
16
+ * Low priority image nodes are usually offscreen and very unlikely to be the
17
+ * resource that is required for LCP. Our LCP graphs include everything except for these images.
18
+ */
19
+ static isNotLowPriorityImageNode(node) {
20
+ if (node.type !== 'network') {
21
+ return true;
22
+ }
23
+ const isImage = node.request.resourceType === 'Image';
24
+ const isLowPriority = node.request.priority === 'Low' || node.request.priority === 'VeryLow';
25
+ return !isImage || !isLowPriority;
26
+ }
27
+ static getOptimisticGraph(dependencyGraph, processedNavigation) {
28
+ const { firstContentfulPaint: fcp, largestContentfulPaint: lcp } = processedNavigation.timestamps;
29
+ if (!lcp) {
30
+ throw new Core.LanternError('NO_LCP');
31
+ }
32
+ if (fcp === lcp && processedNavigation.largestContentfulPaintEvt?.args?.data?.type === 'text') {
33
+ return FirstContentfulPaint.getOptimisticGraph(dependencyGraph, processedNavigation);
34
+ }
35
+ return FirstContentfulPaint.getFirstPaintBasedGraph(dependencyGraph, {
36
+ cutoffTimestamp: lcp,
37
+ treatNodeAsRenderBlocking: LargestContentfulPaint.isNotLowPriorityImageNode,
38
+ });
39
+ }
40
+ static getPessimisticGraph(dependencyGraph, processedNavigation) {
41
+ const { firstContentfulPaint: fcp, largestContentfulPaint: lcp } = processedNavigation.timestamps;
42
+ if (!lcp) {
43
+ throw new Core.LanternError('NO_LCP');
44
+ }
45
+ if (fcp === lcp && processedNavigation.largestContentfulPaintEvt?.args?.data?.type === 'text') {
46
+ return FirstContentfulPaint.getPessimisticGraph(dependencyGraph, processedNavigation);
47
+ }
48
+ return FirstContentfulPaint.getFirstPaintBasedGraph(dependencyGraph, {
49
+ cutoffTimestamp: lcp,
50
+ treatNodeAsRenderBlocking: _ => true,
51
+ // For pessimistic LCP we'll include *all* layout nodes
52
+ additionalCpuNodesToTreatAsRenderBlocking: node => node.didPerformLayout(),
53
+ });
54
+ }
55
+ static getEstimateFromSimulation(simulationResult) {
56
+ const nodeTimesNotOffscreenImages = Array.from(simulationResult.nodeTimings.entries())
57
+ .filter(entry => LargestContentfulPaint.isNotLowPriorityImageNode(entry[0]))
58
+ .map(entry => entry[1].endTime);
59
+ return {
60
+ timeInMs: Math.max(...nodeTimesNotOffscreenImages),
61
+ nodeTimings: simulationResult.nodeTimings,
62
+ };
63
+ }
64
+ static compute(data, extras) {
65
+ const fcpResult = extras?.fcpResult;
66
+ if (!fcpResult) {
67
+ throw new Core.LanternError('FCP is required to calculate the LCP metric');
68
+ }
69
+ const metricResult = super.compute(data, extras);
70
+ metricResult.timing = Math.max(metricResult.timing, fcpResult.timing);
71
+ return metricResult;
72
+ }
73
+ }
74
+ export { LargestContentfulPaint };
75
+ //# sourceMappingURL=LargestContentfulPaint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LargestContentfulPaint.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAKxC,OAAO,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAEL,MAAM,GAIP,MAAM,aAAa,CAAC;AAErB,MAAM,sBAAuB,SAAQ,MAAM;IACzC,MAAM,KAAc,YAAY;QAC9B,OAAO;YACL,SAAS,EAAE,CAAC;YACZ,UAAU,E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,CAAC;QAED,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACjD,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QACtE,OAAO,YAAY,CAAC;IACtB,CAAC;CACF;AAED,OAAO,EAAC,sBAAsB,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\nimport * as Core from '../core/core.js';\nimport type * as Graph from '../graph/graph.js';\nimport type * as Simulation from '../simulation/simulation.js';\nimport type * as Types from '../types/types.js';\n\nimport {FirstContentfulPaint} from './FirstContentfulPaint.js';\nimport {\n type Extras,\n Metric,\n type MetricCoefficients,\n type MetricComputationDataInput,\n type MetricResult,\n} from './Metric.js';\n\nclass LargestContentfulPaint extends Metric {\n static override get coefficients(): MetricCoefficients {\n return {\n intercept: 0,\n optimistic: 0.5,\n pessimistic: 0.5,\n };\n }\n\n /**\n * Low priority image nodes are usually offscreen and very unlikely to be the\n * resource that is required for LCP. Our LCP graphs include everything except for these images.\n */\n static isNotLowPriorityImageNode(node: Graph.Node): boolean {\n if (node.type !== 'network') {\n return true;\n }\n const isImage = node.request.resourceType === 'Image';\n const isLowPriority = node.request.priority === 'Low' || node.request.priority === 'VeryLow';\n return !isImage || !isLowPriority;\n }\n\n static override getOptimisticGraph(\n dependencyGraph: Graph.Node, processedNavigation: Types.Simulation.ProcessedNavigation): Graph.Node {\n const {firstContentfulPaint: fcp, largestContentfulPaint: lcp} = processedNavigation.timestamps;\n if (!lcp) {\n throw new Core.LanternError('NO_LCP');\n }\n if (fcp === lcp && processedNavigation.largestContentfulPaintEvt?.args?.data?.type === 'text') {\n return FirstContentfulPaint.getOptimisticGraph(dependencyGraph, processedNavigation);\n }\n\n return FirstContentfulPaint.getFirstPaintBasedGraph(dependencyGraph, {\n cutoffTimestamp: lcp,\n treatNodeAsRenderBlocking: LargestContentfulPaint.isNotLowPriorityImageNode,\n });\n }\n\n static override getPessimisticGraph(\n dependencyGraph: Graph.Node, processedNavigation: Types.Simulation.ProcessedNavigation): Graph.Node {\n const {firstContentfulPaint: fcp, largestContentfulPaint: lcp} = processedNavigation.timestamps;\n if (!lcp) {\n throw new Core.LanternError('NO_LCP');\n }\n if (fcp === lcp && processedNavigation.largestContentfulPaintEvt?.args?.data?.type === 'text') {\n return FirstContentfulPaint.getPessimisticGraph(dependencyGraph, processedNavigation);\n }\n\n return FirstContentfulPaint.getFirstPaintBasedGraph(dependencyGraph, {\n cutoffTimestamp: lcp,\n treatNodeAsRenderBlocking: _ => true,\n // For pessimistic LCP we'll include *all* layout nodes\n additionalCpuNodesToTreatAsRenderBlocking: node => node.didPerformLayout(),\n });\n }\n\n static override getEstimateFromSimulation(simulationResult: Simulation.Result): Simulation.Result {\n const nodeTimesNotOffscreenImages = Array.from(simulationResult.nodeTimings.entries())\n .filter(entry => LargestContentfulPaint.isNotLowPriorityImageNode(entry[0]))\n .map(entry => entry[1].endTime);\n\n return {\n timeInMs: Math.max(...nodeTimesNotOffscreenImages),\n nodeTimings: simulationResult.nodeTimings,\n };\n }\n\n static override compute(data: MetricComputationDataInput, extras?: Omit<Extras, 'optimistic'>): MetricResult {\n const fcpResult = extras?.fcpResult;\n if (!fcpResult) {\n throw new Core.LanternError('FCP is required to calculate the LCP metric');\n }\n\n const metricResult = super.compute(data, extras);\n metricResult.timing = Math.max(metricResult.timing, fcpResult.timing);\n return metricResult;\n }\n}\n\nexport {LargestContentfulPaint};\n"]}
@@ -0,0 +1,49 @@
1
+ // Copyright 2024 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ import * as Core from '../core/core.js';
5
+ import * as Graph from '../graph/graph.js';
6
+ import { Metric, } from './Metric.js';
7
+ class MaxPotentialFID extends Metric {
8
+ static get coefficients() {
9
+ return {
10
+ intercept: 0,
11
+ optimistic: 0.5,
12
+ pessimistic: 0.5,
13
+ };
14
+ }
15
+ static getOptimisticGraph(dependencyGraph) {
16
+ return dependencyGraph;
17
+ }
18
+ static getPessimisticGraph(dependencyGraph) {
19
+ return dependencyGraph;
20
+ }
21
+ static getEstimateFromSimulation(simulation, extras) {
22
+ if (!extras.fcpResult) {
23
+ throw new Core.LanternError('missing fcpResult');
24
+ }
25
+ // Intentionally use the opposite FCP estimate, a more pessimistic FCP means that more tasks
26
+ // are excluded from the FID computation, so a higher FCP means lower FID for same work.
27
+ const fcpTimeInMs = extras.optimistic ? extras.fcpResult.pessimisticEstimate.timeInMs :
28
+ extras.fcpResult.optimisticEstimate.timeInMs;
29
+ const timings = MaxPotentialFID.getTimingsAfterFCP(simulation.nodeTimings, fcpTimeInMs);
30
+ return {
31
+ timeInMs: Math.max(...timings.map(timing => timing.duration), 16),
32
+ nodeTimings: simulation.nodeTimings,
33
+ };
34
+ }
35
+ static compute(data, extras) {
36
+ const fcpResult = extras?.fcpResult;
37
+ if (!fcpResult) {
38
+ throw new Core.LanternError('FCP is required to calculate the Max Potential FID metric');
39
+ }
40
+ return super.compute(data, extras);
41
+ }
42
+ static getTimingsAfterFCP(nodeTimings, fcpTimeInMs) {
43
+ return Array.from(nodeTimings.entries())
44
+ .filter(([node, timing]) => node.type === Graph.BaseNode.types.CPU && timing.endTime > fcpTimeInMs)
45
+ .map(([_, timing]) => timing);
46
+ }
47
+ }
48
+ export { MaxPotentialFID };
49
+ //# sourceMappingURL=MaxPotentialFID.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MaxPotentialFID.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/metrics/MaxPotentialFID.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAEL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,CAAC;QAED,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,kBAAkB,CAAC,WAA6C,EAAE,WAAmB;QAE1F,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;aACnC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,MAAM,CAAC,OAAO,GAAG,WAAW,CAAC;aAClG,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CACF;AAED,OAAO,EAAC,eAAe,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\nimport * as Core from '../core/core.js';\nimport * as Graph from '../graph/graph.js';\nimport type * as Simulation from '../simulation/simulation.js';\n\nimport {\n type Extras,\n Metric,\n type MetricCoefficients,\n type MetricComputationDataInput,\n type MetricResult,\n} from './Metric.js';\n\nclass MaxPotentialFID extends Metric {\n static override get coefficients(): MetricCoefficients {\n return {\n intercept: 0,\n optimistic: 0.5,\n pessimistic: 0.5,\n };\n }\n\n static override getOptimisticGraph(dependencyGraph: Graph.Node): Graph.Node {\n return dependencyGraph;\n }\n\n static override getPessimisticGraph(dependencyGraph: Graph.Node): Graph.Node {\n return dependencyGraph;\n }\n\n static override getEstimateFromSimulation(simulation: Simulation.Result, extras: Extras): Simulation.Result {\n if (!extras.fcpResult) {\n throw new Core.LanternError('missing fcpResult');\n }\n\n // Intentionally use the opposite FCP estimate, a more pessimistic FCP means that more tasks\n // are excluded from the FID computation, so a higher FCP means lower FID for same work.\n const fcpTimeInMs = extras.optimistic ? extras.fcpResult.pessimisticEstimate.timeInMs :\n extras.fcpResult.optimisticEstimate.timeInMs;\n\n const timings = MaxPotentialFID.getTimingsAfterFCP(\n simulation.nodeTimings,\n fcpTimeInMs,\n );\n\n return {\n timeInMs: Math.max(...timings.map(timing => timing.duration), 16),\n nodeTimings: simulation.nodeTimings,\n };\n }\n\n static override compute(data: MetricComputationDataInput, extras?: Omit<Extras, 'optimistic'>): MetricResult {\n const fcpResult = extras?.fcpResult;\n if (!fcpResult) {\n throw new Core.LanternError('FCP is required to calculate the Max Potential FID metric');\n }\n\n return super.compute(data, extras);\n }\n\n static getTimingsAfterFCP(nodeTimings: Simulation.Result['nodeTimings'], fcpTimeInMs: number):\n Array<{duration: number}> {\n return Array.from(nodeTimings.entries())\n .filter(([node, timing]) => node.type === Graph.BaseNode.types.CPU && timing.endTime > fcpTimeInMs)\n .map(([_, timing]) => timing);\n }\n}\n\nexport {MaxPotentialFID};\n"]}
@@ -0,0 +1,69 @@
1
+ // Copyright 2024 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ import * as Core from '../core/core.js';
5
+ import * as Graph from '../graph/graph.js';
6
+ class Metric {
7
+ static getScriptUrls(dependencyGraph, treatNodeAsRenderBlocking) {
8
+ const scriptUrls = new Set();
9
+ dependencyGraph.traverse(node => {
10
+ if (node.type !== Graph.BaseNode.types.NETWORK) {
11
+ return;
12
+ }
13
+ if (node.request.resourceType !== 'Script') {
14
+ return;
15
+ }
16
+ if (treatNodeAsRenderBlocking?.(node)) {
17
+ scriptUrls.add(node.request.url);
18
+ }
19
+ });
20
+ return scriptUrls;
21
+ }
22
+ static get coefficients() {
23
+ throw new Core.LanternError('coefficients unimplemented!');
24
+ }
25
+ /**
26
+ * Returns the coefficients, scaled by the throttling settings if needed by the metric.
27
+ * Some lantern metrics (speed-index) use components in their estimate that are not
28
+ * from the simulator. In this case, we need to adjust the coefficients as the target throttling
29
+ * settings change.
30
+ */
31
+ static getScaledCoefficients(_rttMs) {
32
+ return this.coefficients;
33
+ }
34
+ static getOptimisticGraph(_dependencyGraph, _processedNavigation) {
35
+ throw new Core.LanternError('Optimistic graph unimplemented!');
36
+ }
37
+ static getPessimisticGraph(_dependencyGraph, _processedNavigation) {
38
+ throw new Core.LanternError('Pessmistic graph unimplemented!');
39
+ }
40
+ static getEstimateFromSimulation(simulationResult, _extras) {
41
+ return simulationResult;
42
+ }
43
+ static compute(data, extras) {
44
+ const { simulator, graph, processedNavigation } = data;
45
+ const metricName = this.name.replace('Lantern', '');
46
+ const optimisticGraph = this.getOptimisticGraph(graph, processedNavigation);
47
+ const pessimisticGraph = this.getPessimisticGraph(graph, processedNavigation);
48
+ let simulateOptions = { label: `optimistic${metricName}` };
49
+ const optimisticSimulation = simulator.simulate(optimisticGraph, simulateOptions);
50
+ simulateOptions = { label: `pessimistic${metricName}` };
51
+ const pessimisticSimulation = simulator.simulate(pessimisticGraph, simulateOptions);
52
+ const optimisticEstimate = this.getEstimateFromSimulation(optimisticSimulation, { ...extras, optimistic: true });
53
+ const pessimisticEstimate = this.getEstimateFromSimulation(pessimisticSimulation, { ...extras, optimistic: false });
54
+ const coefficients = this.getScaledCoefficients(simulator.rtt);
55
+ // Estimates under 1s don't really follow the normal curve fit, minimize the impact of the intercept
56
+ const interceptMultiplier = coefficients.intercept > 0 ? Math.min(1, optimisticEstimate.timeInMs / 1000) : 1;
57
+ const timing = coefficients.intercept * interceptMultiplier +
58
+ coefficients.optimistic * optimisticEstimate.timeInMs + coefficients.pessimistic * pessimisticEstimate.timeInMs;
59
+ return {
60
+ timing,
61
+ optimisticEstimate,
62
+ pessimisticEstimate,
63
+ optimisticGraph,
64
+ pessimisticGraph,
65
+ };
66
+ }
67
+ }
68
+ export { Metric };
69
+ //# sourceMappingURL=Metric.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Metric.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/metrics/Metric.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;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AAG,YAAY,CAAC,SAAS,GAAG,mBAAmB;YACvD,YAAY,CAAC,UAAU,GAAG,kBAAkB,CAAC,QAAQ,GAAG,YAAY,CAAC,WAAW,GAAG,mBAAmB,CAAC,QAAQ,CAAC;QAEpH,OAAO;YACL,MAAM;YACN,kBAAkB;YAClB,mBAAmB;YACnB,eAAe;YACf,gBAAgB;SACjB,CAAC;IACJ,CAAC;CACF;AAED,OAAO,EAAC,MAAM,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\nimport * as Core from '../core/core.js';\nimport * as Graph from '../graph/graph.js';\nimport type * as Simulation from '../simulation/simulation.js';\nimport type * as Types from '../types/types.js';\n\nexport interface MetricComputationDataInput {\n simulator: Simulation.Simulator;\n graph: Graph.Node<unknown>;\n processedNavigation: Types.Simulation.ProcessedNavigation;\n}\n\nexport interface MetricCoefficients {\n intercept: number;\n optimistic: number;\n pessimistic: number;\n}\n\nexport interface MetricResult<T = Types.AnyNetworkObject> {\n timing: number;\n timestamp?: never;\n optimisticEstimate: Simulation.Result<T>;\n pessimisticEstimate: Simulation.Result<T>;\n optimisticGraph: Graph.Node<T>;\n pessimisticGraph: Graph.Node;\n}\n\nexport interface Extras {\n optimistic: boolean;\n fcpResult?: MetricResult;\n lcpResult?: MetricResult;\n interactiveResult?: MetricResult;\n observedSpeedIndex?: number;\n}\n\nclass Metric {\n static getScriptUrls(dependencyGraph: Graph.Node, treatNodeAsRenderBlocking?: (node: Graph.NetworkNode) => boolean):\n Set<string> {\n const scriptUrls = new Set<string>();\n\n dependencyGraph.traverse(node => {\n if (node.type !== Graph.BaseNode.types.NETWORK) {\n return;\n }\n if (node.request.resourceType !== 'Script') {\n return;\n }\n if (treatNodeAsRenderBlocking?.(node)) {\n scriptUrls.add(node.request.url);\n }\n });\n\n return scriptUrls;\n }\n\n static get coefficients(): MetricCoefficients {\n throw new Core.LanternError('coefficients unimplemented!');\n }\n\n /**\n * Returns the coefficients, scaled by the throttling settings if needed by the metric.\n * Some lantern metrics (speed-index) use components in their estimate that are not\n * from the simulator. In this case, we need to adjust the coefficients as the target throttling\n * settings change.\n */\n static getScaledCoefficients(_rttMs: number): MetricCoefficients {\n return this.coefficients;\n }\n\n static getOptimisticGraph(_dependencyGraph: Graph.Node, _processedNavigation: Types.Simulation.ProcessedNavigation):\n Graph.Node {\n throw new Core.LanternError('Optimistic graph unimplemented!');\n }\n\n static getPessimisticGraph(_dependencyGraph: Graph.Node, _processedNavigation: Types.Simulation.ProcessedNavigation):\n Graph.Node {\n throw new Core.LanternError('Pessmistic graph unimplemented!');\n }\n\n static getEstimateFromSimulation(simulationResult: Simulation.Result, _extras: Extras): Simulation.Result {\n return simulationResult;\n }\n\n static compute(data: MetricComputationDataInput, extras?: Omit<Extras, 'optimistic'>): MetricResult {\n const {simulator, graph, processedNavigation} = data;\n\n const metricName = this.name.replace('Lantern', '');\n const optimisticGraph = this.getOptimisticGraph(graph, processedNavigation);\n const pessimisticGraph = this.getPessimisticGraph(graph, processedNavigation);\n\n let simulateOptions = {label: `optimistic${metricName}`};\n const optimisticSimulation = simulator.simulate(optimisticGraph, simulateOptions);\n\n simulateOptions = {label: `pessimistic${metricName}`};\n const pessimisticSimulation = simulator.simulate(pessimisticGraph, simulateOptions);\n\n const optimisticEstimate = this.getEstimateFromSimulation(\n optimisticSimulation,\n {...extras, optimistic: true},\n );\n\n const pessimisticEstimate = this.getEstimateFromSimulation(\n pessimisticSimulation,\n {...extras, optimistic: false},\n );\n\n const coefficients = this.getScaledCoefficients(simulator.rtt);\n // Estimates under 1s don't really follow the normal curve fit, minimize the impact of the intercept\n const interceptMultiplier = coefficients.intercept > 0 ? Math.min(1, optimisticEstimate.timeInMs / 1000) : 1;\n const timing = coefficients.intercept * interceptMultiplier +\n coefficients.optimistic * optimisticEstimate.timeInMs + coefficients.pessimistic * pessimisticEstimate.timeInMs;\n\n return {\n timing,\n optimisticEstimate,\n pessimisticEstimate,\n optimisticGraph,\n pessimisticGraph,\n };\n }\n}\n\nexport {Metric};\n"]}
@@ -0,0 +1,102 @@
1
+ // Copyright 2024 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ import * as Core from '../core/core.js';
5
+ import * as Graph from '../graph/graph.js';
6
+ import { Metric, } from './Metric.js';
7
+ const mobileSlow4GRtt = 150;
8
+ class SpeedIndex extends Metric {
9
+ static get coefficients() {
10
+ return {
11
+ // Note that the optimistic estimate is based on the real observed speed index rather than a
12
+ // real lantern graph (and the final estimate will be Math.max(FCP, Speed Index)).
13
+ intercept: 0,
14
+ optimistic: 1.4,
15
+ pessimistic: 0.4,
16
+ };
17
+ }
18
+ static getScaledCoefficients(rttMs) {
19
+ // We want to scale our default coefficients based on the speed of the connection.
20
+ // We will linearly interpolate coefficients for the passed-in rttMs based on two pre-determined points:
21
+ // 1. Baseline point of 30 ms RTT where Speed Index should be a ~50/50 blend of optimistic/pessimistic.
22
+ // 30 ms was based on a typical home WiFi connection's actual RTT.
23
+ // Coefficients here follow from the fact that the optimistic estimate should be very close
24
+ // to reality at this connection speed and the pessimistic estimate compensates for minor
25
+ // connection speed differences.
26
+ // 2. Default throttled point of 150 ms RTT where the default coefficients have been determined to be most accurate.
27
+ // Coefficients here were determined through thorough analysis and linear regression on the
28
+ // lantern test data set. See core/scripts/test-lantern.sh for more detail.
29
+ // While the coefficients haven't been analyzed at the interpolated points, it's our current best effort.
30
+ const defaultCoefficients = this.coefficients;
31
+ const defaultRttExcess = mobileSlow4GRtt - 30;
32
+ const multiplier = Math.max((rttMs - 30) / defaultRttExcess, 0);
33
+ return {
34
+ intercept: defaultCoefficients.intercept * multiplier,
35
+ optimistic: 0.5 + (defaultCoefficients.optimistic - 0.5) * multiplier,
36
+ pessimistic: 0.5 + (defaultCoefficients.pessimistic - 0.5) * multiplier,
37
+ };
38
+ }
39
+ static getOptimisticGraph(dependencyGraph) {
40
+ return dependencyGraph;
41
+ }
42
+ static getPessimisticGraph(dependencyGraph) {
43
+ return dependencyGraph;
44
+ }
45
+ static getEstimateFromSimulation(simulationResult, extras) {
46
+ if (!extras.fcpResult) {
47
+ throw new Core.LanternError('missing fcpResult');
48
+ }
49
+ if (extras.observedSpeedIndex === undefined) {
50
+ throw new Core.LanternError('missing observedSpeedIndex');
51
+ }
52
+ const fcpTimeInMs = extras.fcpResult.pessimisticEstimate.timeInMs;
53
+ const estimate = extras.optimistic ?
54
+ extras.observedSpeedIndex :
55
+ SpeedIndex.computeLayoutBasedSpeedIndex(simulationResult.nodeTimings, fcpTimeInMs);
56
+ return {
57
+ timeInMs: estimate,
58
+ nodeTimings: simulationResult.nodeTimings,
59
+ };
60
+ }
61
+ static compute(data, extras) {
62
+ const fcpResult = extras?.fcpResult;
63
+ if (!fcpResult) {
64
+ throw new Core.LanternError('FCP is required to calculate the SpeedIndex metric');
65
+ }
66
+ const metricResult = super.compute(data, extras);
67
+ metricResult.timing = Math.max(metricResult.timing, fcpResult.timing);
68
+ return metricResult;
69
+ }
70
+ /**
71
+ * Approximate speed index using layout events from the simulated node timings.
72
+ * The layout-based speed index is the weighted average of the endTime of CPU nodes that contained
73
+ * a 'Layout' task. log(duration) is used as the weight to stand for "significance" to the page.
74
+ *
75
+ * If no layout events can be found or the endTime of a CPU task is too early, FCP is used instead.
76
+ *
77
+ * This approach was determined after evaluating the accuracy/complexity tradeoff of many
78
+ * different methods. Read more in the evaluation doc.
79
+ *
80
+ * @see https://docs.google.com/document/d/1qJWXwxoyVLVadezIp_Tgdk867G3tDNkkVRvUJSH3K1E/edit#
81
+ */
82
+ static computeLayoutBasedSpeedIndex(nodeTimings, fcpTimeInMs) {
83
+ const layoutWeights = [];
84
+ for (const [node, timing] of nodeTimings.entries()) {
85
+ if (node.type !== Graph.BaseNode.types.CPU) {
86
+ continue;
87
+ }
88
+ if (node.childEvents.some(x => x.name === 'Layout')) {
89
+ const timingWeight = Math.max(Math.log2(timing.endTime - timing.startTime), 0);
90
+ layoutWeights.push({ time: timing.endTime, weight: timingWeight });
91
+ }
92
+ }
93
+ const totalWeightedTime = layoutWeights.map(evt => evt.weight * Math.max(evt.time, fcpTimeInMs)).reduce((a, b) => a + b, 0);
94
+ const totalWeight = layoutWeights.map(evt => evt.weight).reduce((a, b) => a + b, 0);
95
+ if (!totalWeight) {
96
+ return fcpTimeInMs;
97
+ }
98
+ return totalWeightedTime / totalWeight;
99
+ }
100
+ }
101
+ export { SpeedIndex };
102
+ //# sourceMappingURL=SpeedIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpeedIndex.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/metrics/SpeedIndex.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAEL,MAAM,GAIP,MAAM,aAAa,CAAC;AAErB,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,MAAM,UAAW,SAAQ,MAAM;IAC7B,MAAM,KAAc,YAAY;QAC9B,OAAO;YACL,4FAA4F;YAC5F,kFAAkF;YAClF,SAAS,EAAE,CAAC;YACZ,UAAU,EAAE,GAAG;YACf,WAAW,EAAE,GAAG;SACjB,CAAC;IACJ,CAAC;IAED,MAAM,CAAU,qBAAqB,CAAC,KAAa;QACjD,kFAAkF;QAClF,wGAAwG;QACxG,yGAAyG;QACzG,uEAAuE;QACvE,gGAAgG;QAChG,8FAA8F;QAC9F,qCAAqC;QACrC,sHAAsH;QACtH,gGAAgG;QAChG,gFAAgF;QAChF,yGAAyG;QACzG,MAAM,mBAAmB,GAAG,IAAI,CAAC,YAAY,CAAC;QAC9C,MAAM,gBAAgB,GAAG,eAAe,GAAG,EAAE,CAAC;QAC9C,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CA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AAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACtG,MAAM,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAEpF,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO,WAAW,CAAC;QACrB,CAAC;QACD,OAAO,iBAAiB,GAAG,WAAW,CAAC;IACzC,CAAC;CACF;AAED,OAAO,EAAC,UAAU,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\nimport * as Core from '../core/core.js';\nimport * as Graph from '../graph/graph.js';\nimport type * as Simulation from '../simulation/simulation.js';\n\nimport {\n type Extras,\n Metric,\n type MetricCoefficients,\n type MetricComputationDataInput,\n type MetricResult,\n} from './Metric.js';\n\nconst mobileSlow4GRtt = 150;\n\nclass SpeedIndex extends Metric {\n static override get coefficients(): MetricCoefficients {\n return {\n // Note that the optimistic estimate is based on the real observed speed index rather than a\n // real lantern graph (and the final estimate will be Math.max(FCP, Speed Index)).\n intercept: 0,\n optimistic: 1.4,\n pessimistic: 0.4,\n };\n }\n\n static override getScaledCoefficients(rttMs: number): MetricCoefficients {\n // We want to scale our default coefficients based on the speed of the connection.\n // We will linearly interpolate coefficients for the passed-in rttMs based on two pre-determined points:\n // 1. Baseline point of 30 ms RTT where Speed Index should be a ~50/50 blend of optimistic/pessimistic.\n // 30 ms was based on a typical home WiFi connection's actual RTT.\n // Coefficients here follow from the fact that the optimistic estimate should be very close\n // to reality at this connection speed and the pessimistic estimate compensates for minor\n // connection speed differences.\n // 2. Default throttled point of 150 ms RTT where the default coefficients have been determined to be most accurate.\n // Coefficients here were determined through thorough analysis and linear regression on the\n // lantern test data set. See core/scripts/test-lantern.sh for more detail.\n // While the coefficients haven't been analyzed at the interpolated points, it's our current best effort.\n const defaultCoefficients = this.coefficients;\n const defaultRttExcess = mobileSlow4GRtt - 30;\n const multiplier = Math.max((rttMs - 30) / defaultRttExcess, 0);\n\n return {\n intercept: defaultCoefficients.intercept * multiplier,\n optimistic: 0.5 + (defaultCoefficients.optimistic - 0.5) * multiplier,\n pessimistic: 0.5 + (defaultCoefficients.pessimistic - 0.5) * multiplier,\n };\n }\n\n static override getOptimisticGraph(dependencyGraph: Graph.Node): Graph.Node {\n return dependencyGraph;\n }\n\n static override getPessimisticGraph(dependencyGraph: Graph.Node): Graph.Node {\n return dependencyGraph;\n }\n\n static override getEstimateFromSimulation(simulationResult: Simulation.Result, extras: Extras): Simulation.Result {\n if (!extras.fcpResult) {\n throw new Core.LanternError('missing fcpResult');\n }\n if (extras.observedSpeedIndex === undefined) {\n throw new Core.LanternError('missing observedSpeedIndex');\n }\n\n const fcpTimeInMs = extras.fcpResult.pessimisticEstimate.timeInMs;\n const estimate = extras.optimistic ?\n extras.observedSpeedIndex :\n SpeedIndex.computeLayoutBasedSpeedIndex(simulationResult.nodeTimings, fcpTimeInMs);\n return {\n timeInMs: estimate,\n nodeTimings: simulationResult.nodeTimings,\n };\n }\n\n static override compute(data: MetricComputationDataInput, extras?: Omit<Extras, 'optimistic'>): MetricResult {\n const fcpResult = extras?.fcpResult;\n if (!fcpResult) {\n throw new Core.LanternError('FCP is required to calculate the SpeedIndex metric');\n }\n\n const metricResult = super.compute(data, extras);\n metricResult.timing = Math.max(metricResult.timing, fcpResult.timing);\n return metricResult;\n }\n\n /**\n * Approximate speed index using layout events from the simulated node timings.\n * The layout-based speed index is the weighted average of the endTime of CPU nodes that contained\n * a 'Layout' task. log(duration) is used as the weight to stand for \"significance\" to the page.\n *\n * If no layout events can be found or the endTime of a CPU task is too early, FCP is used instead.\n *\n * This approach was determined after evaluating the accuracy/complexity tradeoff of many\n * different methods. Read more in the evaluation doc.\n *\n * @see https://docs.google.com/document/d/1qJWXwxoyVLVadezIp_Tgdk867G3tDNkkVRvUJSH3K1E/edit#\n */\n static computeLayoutBasedSpeedIndex(nodeTimings: Simulation.Result['nodeTimings'], fcpTimeInMs: number): number {\n const layoutWeights: Array<{time: number, weight: number}> = [];\n for (const [node, timing] of nodeTimings.entries()) {\n if (node.type !== Graph.BaseNode.types.CPU) {\n continue;\n }\n\n if (node.childEvents.some(x => x.name === 'Layout')) {\n const timingWeight = Math.max(Math.log2(timing.endTime - timing.startTime), 0);\n layoutWeights.push({time: timing.endTime, weight: timingWeight});\n }\n }\n\n const totalWeightedTime =\n layoutWeights.map(evt => evt.weight * Math.max(evt.time, fcpTimeInMs)).reduce((a, b) => a + b, 0);\n const totalWeight = layoutWeights.map(evt => evt.weight).reduce((a, b) => a + b, 0);\n\n if (!totalWeight) {\n return fcpTimeInMs;\n }\n return totalWeightedTime / totalWeight;\n }\n}\n\nexport {SpeedIndex};\n"]}