@paulirish/trace_engine 0.0.64 → 0.0.66

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 (434) hide show
  1. package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +1 -1
  2. package/core/platform/ArrayUtilities.d.ts +5 -0
  3. package/core/platform/ArrayUtilities.js +14 -0
  4. package/core/platform/ArrayUtilities.js.map +1 -1
  5. package/core/platform/HostRuntime.d.ts +1 -0
  6. package/core/platform/HostRuntime.js +1 -1
  7. package/core/platform/HostRuntime.js.map +1 -1
  8. package/core/platform/KeyboardUtilities.js +12 -0
  9. package/core/platform/KeyboardUtilities.js.map +1 -1
  10. package/core/platform/MimeType.js +13 -0
  11. package/core/platform/MimeType.js.map +1 -1
  12. package/core/platform/Size.d.ts +12 -0
  13. package/core/platform/Size.js +36 -0
  14. package/core/platform/Size.js.map +1 -0
  15. package/core/platform/StringUtilities.d.ts +50 -0
  16. package/core/platform/StringUtilities.js +145 -4
  17. package/core/platform/StringUtilities.js.map +1 -1
  18. package/core/platform/TypescriptUtilities.d.ts +0 -6
  19. package/core/platform/TypescriptUtilities.js +0 -8
  20. package/core/platform/TypescriptUtilities.js.map +1 -1
  21. package/core/platform/api/HostRuntime.d.ts +30 -3
  22. package/core/platform/api/HostRuntime.js.map +1 -1
  23. package/core/platform/api/api-tsconfig.json +26 -11
  24. package/core/platform/api/api-tsconfig.ref.json +26 -0
  25. package/core/platform/browser/HostRuntime.js +103 -2
  26. package/core/platform/browser/HostRuntime.js.map +1 -1
  27. package/core/platform/browser/browser-tsconfig.json +22 -11
  28. package/core/platform/browser/browser-tsconfig.ref.json +27 -0
  29. package/core/platform/browser/bundle-tsconfig.json +59 -1
  30. package/core/platform/browser/bundle-tsconfig.ref.json +27 -0
  31. package/core/platform/bundle-tsconfig.json +59 -1
  32. package/core/platform/bundle-tsconfig.ref.json +27 -0
  33. package/core/platform/foundation_unittests-tsconfig.json +73 -0
  34. package/core/platform/foundation_unittests-tsconfig.ref.json +40 -0
  35. package/core/platform/foundation_unittests_node_typecheck-tsconfig.json +70 -0
  36. package/core/platform/node/HostRuntime.js +58 -4
  37. package/core/platform/node/HostRuntime.js.map +1 -1
  38. package/core/platform/node/bundle-tsconfig.json +59 -1
  39. package/core/platform/node/bundle-tsconfig.ref.json +27 -0
  40. package/core/platform/node/node-tsconfig.json +16 -9
  41. package/core/platform/node/node-tsconfig.ref.json +27 -0
  42. package/core/platform/platform-tsconfig.json +25 -13
  43. package/core/platform/platform-tsconfig.ref.json +49 -0
  44. package/core/platform/platform.d.ts +2 -1
  45. package/core/platform/platform.js +2 -1
  46. package/core/platform/platform.js.map +1 -1
  47. package/core/platform/platform_node_typecheck-tsconfig.json +18 -14
  48. package/core/platform/platform_node_typecheck.stamp +0 -0
  49. package/generated/protocol.d.ts +941 -718
  50. package/generated/protocol.js +3300 -1
  51. package/locales/af.json +191 -134
  52. package/locales/am.json +191 -134
  53. package/locales/ar.json +194 -137
  54. package/locales/as.json +193 -136
  55. package/locales/az.json +191 -134
  56. package/locales/be.json +189 -132
  57. package/locales/bg.json +190 -133
  58. package/locales/bn.json +191 -134
  59. package/locales/bs.json +189 -132
  60. package/locales/ca.json +193 -136
  61. package/locales/cs.json +185 -128
  62. package/locales/cy.json +191 -134
  63. package/locales/da.json +189 -132
  64. package/locales/de.json +189 -132
  65. package/locales/el.json +188 -131
  66. package/locales/en-GB.json +193 -136
  67. package/locales/en-US.json +165 -141
  68. package/locales/en-XL.json +165 -141
  69. package/locales/es-419.json +187 -130
  70. package/locales/es.json +186 -129
  71. package/locales/et.json +161 -104
  72. package/locales/eu.json +188 -131
  73. package/locales/fa.json +191 -134
  74. package/locales/fi.json +188 -131
  75. package/locales/fil.json +191 -134
  76. package/locales/fr-CA.json +191 -134
  77. package/locales/fr.json +187 -130
  78. package/locales/gl.json +190 -133
  79. package/locales/gu.json +192 -135
  80. package/locales/he.json +193 -136
  81. package/locales/hi.json +193 -136
  82. package/locales/hr.json +190 -133
  83. package/locales/hu.json +148 -91
  84. package/locales/hy.json +184 -127
  85. package/locales/id.json +190 -133
  86. package/locales/is.json +186 -129
  87. package/locales/it.json +190 -133
  88. package/locales/ja.json +187 -130
  89. package/locales/ka.json +193 -136
  90. package/locales/kk.json +98 -41
  91. package/locales/km.json +191 -134
  92. package/locales/kn.json +194 -137
  93. package/locales/ko.json +79 -22
  94. package/locales/ky.json +192 -135
  95. package/locales/lo.json +191 -134
  96. package/locales/lt.json +189 -132
  97. package/locales/lv.json +126 -69
  98. package/locales/mk.json +191 -134
  99. package/locales/ml.json +187 -130
  100. package/locales/mn.json +187 -130
  101. package/locales/mr.json +189 -132
  102. package/locales/ms.json +190 -133
  103. package/locales/my.json +192 -135
  104. package/locales/ne.json +189 -132
  105. package/locales/nl.json +186 -129
  106. package/locales/no.json +188 -131
  107. package/locales/or.json +189 -132
  108. package/locales/pa.json +190 -133
  109. package/locales/pl.json +190 -133
  110. package/locales/pt-PT.json +189 -132
  111. package/locales/pt.json +191 -134
  112. package/locales/ro.json +186 -129
  113. package/locales/ru.json +110 -53
  114. package/locales/si.json +191 -134
  115. package/locales/sk.json +190 -133
  116. package/locales/sl.json +186 -129
  117. package/locales/sq.json +187 -130
  118. package/locales/sr-Latn.json +187 -130
  119. package/locales/sr.json +187 -130
  120. package/locales/sv.json +189 -132
  121. package/locales/sw.json +195 -138
  122. package/locales/ta.json +190 -133
  123. package/locales/te.json +193 -136
  124. package/locales/th.json +148 -91
  125. package/locales/tr.json +188 -131
  126. package/locales/uk.json +186 -129
  127. package/locales/ur.json +188 -131
  128. package/locales/uz.json +185 -128
  129. package/locales/vi.json +196 -139
  130. package/locales/zh-HK.json +187 -130
  131. package/locales/zh-TW.json +190 -133
  132. package/locales/zh.json +189 -132
  133. package/locales/zu.json +193 -136
  134. package/models/cpu_profile/bundle-tsconfig.json +59 -1
  135. package/models/cpu_profile/bundle-tsconfig.ref.json +27 -0
  136. package/models/cpu_profile/cpu_profile-tsconfig.json +24 -16
  137. package/models/cpu_profile/cpu_profile-tsconfig.ref.json +31 -0
  138. package/models/cpu_profile/cpu_profile_node_typecheck-tsconfig.json +60 -0
  139. package/models/cpu_profile/cpu_profile_node_typecheck.stamp +0 -0
  140. package/models/{trace/devtools_entrypoint-bundle-typescript-tsconfig.json → cpu_profile/foundation_unittests-tsconfig.json} +27 -30
  141. package/models/cpu_profile/foundation_unittests-tsconfig.ref.json +30 -0
  142. package/models/cpu_profile/foundation_unittests_node_typecheck-tsconfig.json +60 -0
  143. package/models/trace/EntityMapper.js +1 -1
  144. package/models/trace/EntityMapper.js.map +1 -1
  145. package/models/trace/LanternComputationData.js +7 -0
  146. package/models/trace/LanternComputationData.js.map +1 -1
  147. package/models/trace/ModelImpl.d.ts +1 -5
  148. package/models/trace/ModelImpl.js +11 -0
  149. package/models/trace/ModelImpl.js.map +1 -1
  150. package/models/trace/Name.js +5 -5
  151. package/models/trace/Name.js.map +1 -1
  152. package/models/trace/Processor.d.ts +2 -6
  153. package/models/trace/Processor.js +77 -15
  154. package/models/trace/Processor.js.map +1 -1
  155. package/models/trace/Styles.js +128 -116
  156. package/models/trace/Styles.js.map +1 -1
  157. package/models/trace/bundle-tsconfig.json +77 -1
  158. package/models/trace/bundle-tsconfig.ref.json +45 -0
  159. package/models/trace/extras/StackTraceForEvent.d.ts +1 -1
  160. package/models/trace/extras/StackTraceForEvent.js.map +1 -1
  161. package/models/trace/extras/ThirdParties.js +7 -7
  162. package/models/trace/extras/ThirdParties.js.map +1 -1
  163. package/models/trace/extras/TraceTree.js +23 -3
  164. package/models/trace/extras/TraceTree.js.map +1 -1
  165. package/models/trace/extras/bundle-tsconfig.json +59 -1
  166. package/models/trace/extras/bundle-tsconfig.ref.json +27 -0
  167. package/models/trace/extras/extras-tsconfig.json +28 -20
  168. package/models/trace/extras/extras-tsconfig.ref.json +49 -0
  169. package/models/trace/extras/extras_node_typecheck-tsconfig.json +78 -0
  170. package/models/trace/extras/extras_node_typecheck.stamp +0 -0
  171. package/models/trace/extras/foundation_unittests-tsconfig.json +91 -0
  172. package/models/trace/extras/foundation_unittests-tsconfig.ref.json +58 -0
  173. package/models/trace/extras/foundation_unittests_node_typecheck-tsconfig.json +88 -0
  174. package/models/trace/foundation_unittests-tsconfig.json +70 -0
  175. package/models/trace/foundation_unittests-tsconfig.ref.json +37 -0
  176. package/models/trace/foundation_unittests_node_typecheck-tsconfig.json +67 -0
  177. package/models/trace/handlers/AsyncJSCallsHandler.js.map +1 -1
  178. package/models/trace/handlers/ExtensionTraceDataHandler.js +1 -1
  179. package/models/trace/handlers/ExtensionTraceDataHandler.js.map +1 -1
  180. package/models/trace/handlers/FlowsHandler.js.map +1 -1
  181. package/models/trace/handlers/FramesHandler.d.ts +1 -2
  182. package/models/trace/handlers/FramesHandler.js +23 -18
  183. package/models/trace/handlers/FramesHandler.js.map +1 -1
  184. package/models/trace/handlers/LayerTreeHandler.js +3 -3
  185. package/models/trace/handlers/LayerTreeHandler.js.map +1 -1
  186. package/models/trace/handlers/LayoutShiftsHandler.d.ts +2 -2
  187. package/models/trace/handlers/LayoutShiftsHandler.js +17 -18
  188. package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -1
  189. package/models/trace/handlers/MetaHandler.d.ts +2 -3
  190. package/models/trace/handlers/MetaHandler.js +38 -7
  191. package/models/trace/handlers/MetaHandler.js.map +1 -1
  192. package/models/trace/handlers/ModelHandlers.d.ts +0 -1
  193. package/models/trace/handlers/ModelHandlers.js +0 -1
  194. package/models/trace/handlers/ModelHandlers.js.map +1 -1
  195. package/models/trace/handlers/NetworkRequestsHandler.js +13 -11
  196. package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
  197. package/models/trace/handlers/PageLoadMetricsHandler.d.ts +2 -0
  198. package/models/trace/handlers/PageLoadMetricsHandler.js +43 -4
  199. package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -1
  200. package/models/trace/handlers/RendererHandler.js +19 -20
  201. package/models/trace/handlers/RendererHandler.js.map +1 -1
  202. package/models/trace/handlers/SamplesHandler.js.map +1 -1
  203. package/models/trace/handlers/ScreenshotsHandler.js +1 -43
  204. package/models/trace/handlers/ScreenshotsHandler.js.map +1 -1
  205. package/models/trace/handlers/Threads.d.ts +1 -3
  206. package/models/trace/handlers/Threads.js +4 -8
  207. package/models/trace/handlers/Threads.js.map +1 -1
  208. package/models/trace/handlers/UserInteractionsHandler.js.map +1 -1
  209. package/models/trace/handlers/UserTimingsHandler.d.ts +1 -1
  210. package/models/trace/handlers/UserTimingsHandler.js +16 -6
  211. package/models/trace/handlers/UserTimingsHandler.js.map +1 -1
  212. package/models/trace/handlers/WarningsHandler.js.map +1 -1
  213. package/models/trace/handlers/bundle-tsconfig.json +59 -1
  214. package/models/trace/handlers/bundle-tsconfig.ref.json +27 -0
  215. package/models/trace/handlers/foundation_unittests-tsconfig.json +102 -0
  216. package/models/trace/handlers/foundation_unittests-tsconfig.ref.json +69 -0
  217. package/models/trace/handlers/foundation_unittests_node_typecheck-tsconfig.json +99 -0
  218. package/models/trace/handlers/handlers-tsconfig.json +30 -23
  219. package/models/trace/handlers/handlers-tsconfig.ref.json +80 -0
  220. package/models/trace/handlers/handlers_node_typecheck-tsconfig.json +109 -0
  221. package/models/trace/handlers/handlers_node_typecheck.stamp +0 -0
  222. package/models/trace/helpers/Network.d.ts +3 -1
  223. package/models/trace/helpers/Network.js.map +1 -1
  224. package/models/trace/helpers/SamplesIntegrator.js +22 -6
  225. package/models/trace/helpers/SamplesIntegrator.js.map +1 -1
  226. package/models/trace/helpers/SyntheticEvents.d.ts +7 -0
  227. package/models/trace/helpers/SyntheticEvents.js +20 -1
  228. package/models/trace/helpers/SyntheticEvents.js.map +1 -1
  229. package/models/trace/helpers/Timing.js +14 -1
  230. package/models/trace/helpers/Timing.js.map +1 -1
  231. package/models/trace/helpers/Trace.js.map +1 -1
  232. package/models/trace/helpers/bundle-tsconfig.json +59 -1
  233. package/models/trace/helpers/bundle-tsconfig.ref.json +27 -0
  234. package/models/trace/helpers/foundation_unittests-tsconfig.json +73 -0
  235. package/models/trace/helpers/foundation_unittests-tsconfig.ref.json +40 -0
  236. package/models/trace/helpers/foundation_unittests_node_typecheck-tsconfig.json +70 -0
  237. package/models/trace/helpers/helpers-tsconfig.json +27 -22
  238. package/models/trace/helpers/helpers-tsconfig.ref.json +45 -0
  239. package/models/trace/helpers/helpers_node_typecheck-tsconfig.json +74 -0
  240. package/models/trace/helpers/helpers_node_typecheck.stamp +0 -0
  241. package/models/trace/insights/CLSCulprits.d.ts +18 -15
  242. package/models/trace/insights/CLSCulprits.js +7 -6
  243. package/models/trace/insights/CLSCulprits.js.map +1 -1
  244. package/models/trace/insights/Cache.d.ts +8 -7
  245. package/models/trace/insights/Cache.js.map +1 -1
  246. package/models/trace/insights/CharacterSet.d.ts +10 -9
  247. package/models/trace/insights/CharacterSet.js +4 -4
  248. package/models/trace/insights/CharacterSet.js.map +1 -1
  249. package/models/trace/insights/Common.d.ts +2 -1
  250. package/models/trace/insights/Common.js +32 -3
  251. package/models/trace/insights/Common.js.map +1 -1
  252. package/models/trace/insights/DOMSize.d.ts +15 -14
  253. package/models/trace/insights/DOMSize.js +2 -2
  254. package/models/trace/insights/DOMSize.js.map +1 -1
  255. package/models/trace/insights/DocumentLatency.d.ts +13 -12
  256. package/models/trace/insights/DocumentLatency.js +4 -4
  257. package/models/trace/insights/DocumentLatency.js.map +1 -1
  258. package/models/trace/insights/DuplicatedJavaScript.d.ts +16 -7
  259. package/models/trace/insights/DuplicatedJavaScript.js +11 -3
  260. package/models/trace/insights/DuplicatedJavaScript.js.map +1 -1
  261. package/models/trace/insights/FontDisplay.d.ts +19 -9
  262. package/models/trace/insights/FontDisplay.js +13 -3
  263. package/models/trace/insights/FontDisplay.js.map +1 -1
  264. package/models/trace/insights/ForcedReflow.d.ts +13 -13
  265. package/models/trace/insights/ForcedReflow.js +4 -4
  266. package/models/trace/insights/ForcedReflow.js.map +1 -1
  267. package/models/trace/insights/INPBreakdown.d.ts +12 -12
  268. package/models/trace/insights/INPBreakdown.js +1 -1
  269. package/models/trace/insights/INPBreakdown.js.map +1 -1
  270. package/models/trace/insights/ImageDelivery.d.ts +13 -12
  271. package/models/trace/insights/ImageDelivery.js +5 -5
  272. package/models/trace/insights/ImageDelivery.js.map +1 -1
  273. package/models/trace/insights/LCPBreakdown.d.ts +13 -12
  274. package/models/trace/insights/LCPBreakdown.js +3 -3
  275. package/models/trace/insights/LCPBreakdown.js.map +1 -1
  276. package/models/trace/insights/LCPDiscovery.d.ts +14 -13
  277. package/models/trace/insights/LCPDiscovery.js +7 -7
  278. package/models/trace/insights/LCPDiscovery.js.map +1 -1
  279. package/models/trace/insights/LegacyJavaScript.d.ts +16 -7
  280. package/models/trace/insights/LegacyJavaScript.js +11 -3
  281. package/models/trace/insights/LegacyJavaScript.js.map +1 -1
  282. package/models/trace/insights/ModernHTTP.d.ts +10 -10
  283. package/models/trace/insights/ModernHTTP.js +9 -5
  284. package/models/trace/insights/ModernHTTP.js.map +1 -1
  285. package/models/trace/insights/NetworkDependencyTree.d.ts +33 -28
  286. package/models/trace/insights/NetworkDependencyTree.js +17 -13
  287. package/models/trace/insights/NetworkDependencyTree.js.map +1 -1
  288. package/models/trace/insights/RenderBlocking.d.ts +8 -7
  289. package/models/trace/insights/RenderBlocking.js +3 -5
  290. package/models/trace/insights/RenderBlocking.js.map +1 -1
  291. package/models/trace/insights/SlowCSSSelector.d.ts +17 -16
  292. package/models/trace/insights/SlowCSSSelector.js +23 -20
  293. package/models/trace/insights/SlowCSSSelector.js.map +1 -1
  294. package/models/trace/insights/ThirdParties.d.ts +22 -13
  295. package/models/trace/insights/ThirdParties.js +19 -8
  296. package/models/trace/insights/ThirdParties.js.map +1 -1
  297. package/models/trace/insights/Viewport.d.ts +8 -6
  298. package/models/trace/insights/Viewport.js +4 -2
  299. package/models/trace/insights/Viewport.js.map +1 -1
  300. package/models/trace/insights/bundle-tsconfig.json +59 -1
  301. package/models/trace/insights/bundle-tsconfig.ref.json +27 -0
  302. package/models/trace/insights/foundation_unittests-tsconfig.json +98 -0
  303. package/models/trace/insights/foundation_unittests-tsconfig.ref.json +65 -0
  304. package/models/trace/insights/foundation_unittests_node_typecheck-tsconfig.json +95 -0
  305. package/models/trace/insights/insights-tsconfig.json +34 -23
  306. package/models/trace/insights/insights-tsconfig.ref.json +82 -0
  307. package/models/trace/insights/insights_node_typecheck-tsconfig.json +111 -0
  308. package/models/trace/insights/insights_node_typecheck.stamp +0 -0
  309. package/models/trace/insights/types.d.ts +9 -6
  310. package/models/trace/insights/types.js.map +1 -1
  311. package/models/trace/lantern/bundle-tsconfig.json +71 -1
  312. package/models/trace/lantern/bundle-tsconfig.ref.json +39 -0
  313. package/models/trace/lantern/core/NetworkAnalyzer.d.ts +5 -4
  314. package/models/trace/lantern/core/NetworkAnalyzer.js +21 -22
  315. package/models/trace/lantern/core/NetworkAnalyzer.js.map +1 -1
  316. package/models/trace/lantern/core/bundle-tsconfig.json +59 -1
  317. package/models/trace/lantern/core/bundle-tsconfig.ref.json +27 -0
  318. package/models/trace/lantern/core/core-tsconfig.json +23 -12
  319. package/models/trace/lantern/core/core-tsconfig.ref.json +28 -0
  320. package/models/trace/lantern/core/core_node_typecheck-tsconfig.json +57 -0
  321. package/models/trace/lantern/core/core_node_typecheck.stamp +0 -0
  322. package/models/trace/lantern/core/{devtools_entrypoint-bundle-typescript-tsconfig.json → foundation_unittests-tsconfig.json} +34 -13
  323. package/models/trace/lantern/core/foundation_unittests-tsconfig.ref.json +36 -0
  324. package/models/trace/lantern/core/foundation_unittests_node_typecheck-tsconfig.json +66 -0
  325. package/models/trace/lantern/graph/BaseNode.d.ts +2 -2
  326. package/models/trace/lantern/graph/BaseNode.js.map +1 -1
  327. package/models/trace/lantern/graph/CPUNode.d.ts +4 -2
  328. package/models/trace/lantern/graph/CPUNode.js +23 -7
  329. package/models/trace/lantern/graph/CPUNode.js.map +1 -1
  330. package/models/trace/lantern/graph/NetworkNode.js +12 -0
  331. package/models/trace/lantern/graph/NetworkNode.js.map +1 -1
  332. package/models/trace/lantern/graph/PageDependencyGraph.js +26 -4
  333. package/models/trace/lantern/graph/PageDependencyGraph.js.map +1 -1
  334. package/models/trace/lantern/graph/bundle-tsconfig.json +59 -1
  335. package/models/trace/lantern/graph/bundle-tsconfig.ref.json +27 -0
  336. package/models/trace/lantern/graph/{devtools_entrypoint-bundle-typescript-tsconfig.json → foundation_unittests-tsconfig.json} +26 -13
  337. package/models/trace/lantern/graph/foundation_unittests-tsconfig.ref.json +28 -0
  338. package/models/trace/lantern/graph/foundation_unittests_node_typecheck-tsconfig.json +58 -0
  339. package/models/trace/lantern/graph/graph-tsconfig.json +24 -13
  340. package/models/trace/lantern/graph/graph-tsconfig.ref.json +33 -0
  341. package/models/trace/lantern/graph/graph_node_typecheck-tsconfig.json +62 -0
  342. package/models/trace/lantern/graph/graph_node_typecheck.stamp +0 -0
  343. package/models/trace/lantern/metrics/TotalBlockingTime.js +1 -1
  344. package/models/trace/lantern/metrics/TotalBlockingTime.js.map +1 -1
  345. package/models/trace/lantern/metrics/bundle-tsconfig.json +59 -1
  346. package/models/trace/lantern/metrics/bundle-tsconfig.ref.json +27 -0
  347. package/models/trace/lantern/metrics/foundation_unittests-tsconfig.json +76 -0
  348. package/models/trace/lantern/metrics/foundation_unittests-tsconfig.ref.json +43 -0
  349. package/models/trace/lantern/metrics/foundation_unittests_node_typecheck-tsconfig.json +73 -0
  350. package/models/trace/lantern/metrics/metrics-tsconfig.json +26 -15
  351. package/models/trace/lantern/metrics/metrics-tsconfig.ref.json +43 -0
  352. package/models/trace/lantern/metrics/metrics_node_typecheck-tsconfig.json +72 -0
  353. package/models/trace/lantern/metrics/metrics_node_typecheck.stamp +0 -0
  354. package/models/trace/lantern/simulation/ConnectionPool.js +4 -4
  355. package/models/trace/lantern/simulation/ConnectionPool.js.map +1 -1
  356. package/models/trace/lantern/simulation/Constants.d.ts +29 -28
  357. package/models/trace/lantern/simulation/Constants.js +3 -1
  358. package/models/trace/lantern/simulation/Constants.js.map +1 -1
  359. package/models/trace/lantern/simulation/DNSCache.js.map +1 -1
  360. package/models/trace/lantern/simulation/Simulator.js +6 -2
  361. package/models/trace/lantern/simulation/Simulator.js.map +1 -1
  362. package/models/trace/lantern/simulation/TCPConnection.d.ts +4 -4
  363. package/models/trace/lantern/simulation/TCPConnection.js +12 -12
  364. package/models/trace/lantern/simulation/TCPConnection.js.map +1 -1
  365. package/models/trace/lantern/simulation/bundle-tsconfig.json +59 -1
  366. package/models/trace/lantern/simulation/bundle-tsconfig.ref.json +27 -0
  367. package/models/trace/lantern/simulation/foundation_unittests-tsconfig.json +75 -0
  368. package/models/trace/lantern/simulation/foundation_unittests-tsconfig.ref.json +42 -0
  369. package/models/trace/lantern/simulation/foundation_unittests_node_typecheck-tsconfig.json +72 -0
  370. package/models/trace/lantern/simulation/simulation-tsconfig.json +25 -14
  371. package/models/trace/lantern/simulation/simulation-tsconfig.ref.json +38 -0
  372. package/models/trace/lantern/simulation/simulation_node_typecheck-tsconfig.json +67 -0
  373. package/models/trace/lantern/simulation/simulation_node_typecheck.stamp +0 -0
  374. package/models/trace/lantern/{metrics/devtools_entrypoint-bundle-typescript-tsconfig.json → testing/bundle-tsconfig.json} +25 -13
  375. package/models/trace/lantern/testing/bundle-tsconfig.ref.json +27 -0
  376. package/models/trace/lantern/{simulation/devtools_entrypoint-bundle-typescript-tsconfig.json → testing/testing-tsconfig.json} +28 -13
  377. package/models/trace/lantern/testing/testing-tsconfig.ref.json +30 -0
  378. package/models/trace/lantern/types/Lantern.d.ts +27 -19
  379. package/models/trace/lantern/types/Lantern.js.map +1 -1
  380. package/models/trace/lantern/types/bundle-tsconfig.json +59 -1
  381. package/models/trace/lantern/types/bundle-tsconfig.ref.json +27 -0
  382. package/models/trace/lantern/types/types-tsconfig.json +23 -12
  383. package/models/trace/lantern/types/types-tsconfig.ref.json +27 -0
  384. package/models/trace/lantern/types/{devtools_entrypoint-bundle-typescript-tsconfig.json → types_node_typecheck-tsconfig.json} +25 -17
  385. package/models/trace/lantern/types/types_node_typecheck.stamp +0 -0
  386. package/models/trace/trace-tsconfig.json +31 -32
  387. package/models/trace/trace-tsconfig.ref.json +57 -0
  388. package/models/trace/trace_node_typecheck-tsconfig.json +86 -0
  389. package/models/trace/trace_node_typecheck.stamp +0 -0
  390. package/models/trace/types/Configuration.d.ts +11 -0
  391. package/models/trace/types/Configuration.js +1 -0
  392. package/models/trace/types/Configuration.js.map +1 -1
  393. package/models/trace/types/Extensions.d.ts +1 -1
  394. package/models/trace/types/File.d.ts +7 -1
  395. package/models/trace/types/File.js.map +1 -1
  396. package/models/trace/types/Overlays.d.ts +13 -3
  397. package/models/trace/types/Overlays.js.map +1 -1
  398. package/models/trace/types/TraceEvents.d.ts +39 -9
  399. package/models/trace/types/TraceEvents.js +103 -3
  400. package/models/trace/types/TraceEvents.js.map +1 -1
  401. package/models/trace/types/bundle-tsconfig.json +59 -1
  402. package/models/trace/types/bundle-tsconfig.ref.json +27 -0
  403. package/{core/platform/api/api_node_typecheck-tsconfig.json → models/trace/types/foundation_unittests-tsconfig.json} +32 -13
  404. package/models/trace/types/foundation_unittests-tsconfig.ref.json +34 -0
  405. package/models/trace/types/foundation_unittests_node_typecheck-tsconfig.json +64 -0
  406. package/models/trace/types/types-tsconfig.json +27 -19
  407. package/models/trace/types/types-tsconfig.ref.json +44 -0
  408. package/models/trace/types/types_node_typecheck-tsconfig.json +73 -0
  409. package/models/trace/types/types_node_typecheck.stamp +0 -0
  410. package/package.json +2 -3
  411. package/test/test-trace-engine.mjs +1 -1
  412. package/{models/cpu_profile/devtools_entrypoint-bundle-typescript-tsconfig.json → third_party/legacy-javascript/bundle-tsconfig.json} +24 -13
  413. package/third_party/legacy-javascript/bundle-tsconfig.ref.json +27 -0
  414. package/third_party/legacy-javascript/legacy-javascript-tsconfig.ref.json +15 -0
  415. package/third_party/legacy-javascript/legacy-javascript.d.ts +2 -1
  416. package/third_party/legacy-javascript/legacy-javascript.js +3 -1
  417. package/third_party/legacy-javascript/legacy-javascript.js.map +1 -0
  418. package/third_party/legacy-javascript/lib/legacy-javascript.d.ts +18 -0
  419. package/third_party/legacy-javascript/lib/legacy-javascript.js +1119 -0
  420. package/core/platform/api/bundle-tsconfig.json +0 -1
  421. package/core/platform/api/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  422. package/core/platform/browser/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  423. package/core/platform/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  424. package/core/platform/node/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  425. package/models/trace/extras/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  426. package/models/trace/handlers/AuctionWorkletsHandler.d.ts +0 -8
  427. package/models/trace/handlers/AuctionWorkletsHandler.js +0 -163
  428. package/models/trace/handlers/AuctionWorkletsHandler.js.map +0 -1
  429. package/models/trace/handlers/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  430. package/models/trace/helpers/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  431. package/models/trace/insights/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  432. package/models/trace/lantern/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  433. package/models/trace/lantern/lantern-tsconfig.json +0 -59
  434. package/models/trace/types/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
@@ -1 +1,59 @@
1
- {"compilerOptions":{"composite":true,"outDir":".","baseUrl":".","rootDir":"../../../../../../../../front_end/models/trace/lantern/core"},"files":["../../../../../../../../front_end/models/trace/lantern/core/core.ts"],"references":[{"path":"./core-tsconfig.json"}]}
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": false,
4
+ "allowSyntheticDefaultImports": true,
5
+ "checkJs": false,
6
+ "composite": false,
7
+ "declaration": false,
8
+ "disableSourceOfProjectReferenceRedirect": true,
9
+ "experimentalDecorators": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "incremental": false,
12
+ "inlineSources": true,
13
+ "lib": [
14
+ "dom",
15
+ "dom.iterable",
16
+ "ES2023",
17
+ "ES2024.Promise",
18
+ "ESNext.Iterator",
19
+ "ESNext.Collection",
20
+ "ESNext.Array"
21
+ ],
22
+ "module": "esnext",
23
+ "moduleResolution": "bundler",
24
+ "noEmitOnError": true,
25
+ "noFallthroughCasesInSwitch": true,
26
+ "noImplicitOverride": true,
27
+ "noImplicitReturns": true,
28
+ "outDir": ".",
29
+ "preserveConstEnums": true,
30
+ "rootDir": "../../../../../../../../front_end/models/trace/lantern/core",
31
+ "rootDirs": [
32
+ "../../../../../../../../",
33
+ "../../../../../"
34
+ ],
35
+ "skipLibCheck": true,
36
+ "sourceMap": true,
37
+ "strict": true,
38
+ "target": "ES2023",
39
+ "typeRoots": [
40
+
41
+ ],
42
+ "types": [
43
+
44
+ ],
45
+ "useUnknownInCatchVariables": false
46
+ },
47
+ "files": [
48
+ "../../../../../../../../front_end/models/trace/lantern/core/core.ts",
49
+ "../../../../../../../../front_end/legacy/legacy-defs.d.ts",
50
+ "../../../../../../../../front_end/global_typings/global_defs.d.ts",
51
+ "../../../../../../../../node_modules/@types/filesystem/index.d.ts",
52
+ "../../../../../../../../node_modules/@types/filewriter/index.d.ts"
53
+ ],
54
+ "references": [
55
+ {
56
+ "path": "core-tsconfig.ref.json"
57
+ }
58
+ ]
59
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "declaration": true,
5
+ "declarationDir": ".",
6
+ "emitDeclarationOnly": true,
7
+ "outDir": ".",
8
+ "rootDir": "../../../../../../../../front_end/models/trace/lantern/core",
9
+ "rootDirs": [
10
+ "../../../../../../../../",
11
+ "../../../../../"
12
+ ],
13
+ "skipLibCheck": true
14
+ },
15
+ "files": [
16
+ "../../../../../../../../front_end/models/trace/lantern/core/core.ts",
17
+ "../../../../../../../../front_end/legacy/legacy-defs.d.ts",
18
+ "../../../../../../../../front_end/global_typings/global_defs.d.ts",
19
+ "../../../../../../../../node_modules/@types/filesystem/index.d.ts",
20
+ "../../../../../../../../node_modules/@types/filewriter/index.d.ts"
21
+ ],
22
+ "references": [
23
+ {
24
+ "path": "core-tsconfig.ref.json"
25
+ }
26
+ ]
27
+ }
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "allowJs": true,
4
- "checkJs": true,
5
- "composite": true,
6
- "declaration": true,
3
+ "allowJs": false,
4
+ "allowSyntheticDefaultImports": true,
5
+ "checkJs": false,
6
+ "composite": false,
7
+ "declaration": false,
8
+ "disableSourceOfProjectReferenceRedirect": true,
7
9
  "experimentalDecorators": true,
8
10
  "forceConsistentCasingInFileNames": true,
11
+ "incremental": false,
9
12
  "inlineSources": true,
10
13
  "lib": [
11
14
  "dom",
@@ -17,21 +20,28 @@
17
20
  "ESNext.Array"
18
21
  ],
19
22
  "module": "esnext",
23
+ "moduleResolution": "bundler",
20
24
  "noEmitOnError": true,
21
25
  "noFallthroughCasesInSwitch": true,
22
26
  "noImplicitOverride": true,
23
27
  "noImplicitReturns": true,
24
- "noUnusedLocals": false,
25
- "noUnusedParameters": false,
26
28
  "outDir": ".",
29
+ "preserveConstEnums": true,
27
30
  "rootDir": "../../../../../../../../front_end/models/trace/lantern/core",
31
+ "rootDirs": [
32
+ "../../../../../../../../",
33
+ "../../../../../"
34
+ ],
28
35
  "skipLibCheck": true,
29
36
  "sourceMap": true,
30
37
  "strict": true,
31
- "target": "ES2023",
32
- "tsBuildInfoFile": "core-tsconfig.json.tsbuildinfo",
33
- "typeRoots": [],
34
- "types": [],
38
+ "target": "es2023",
39
+ "typeRoots": [
40
+
41
+ ],
42
+ "types": [
43
+
44
+ ],
35
45
  "useUnknownInCatchVariables": false
36
46
  },
37
47
  "files": [
@@ -39,11 +49,12 @@
39
49
  "../../../../../../../../front_end/models/trace/lantern/core/NetworkAnalyzer.ts",
40
50
  "../../../../../../../../front_end/legacy/legacy-defs.d.ts",
41
51
  "../../../../../../../../front_end/global_typings/global_defs.d.ts",
42
- "../../../../../../../../node_modules/@types/filesystem/index.d.ts"
52
+ "../../../../../../../../node_modules/@types/filesystem/index.d.ts",
53
+ "../../../../../../../../node_modules/@types/filewriter/index.d.ts"
43
54
  ],
44
55
  "references": [
45
56
  {
46
- "path": "../types/bundle-tsconfig.json"
57
+ "path": "../types/bundle-tsconfig.ref.json"
47
58
  }
48
59
  ]
49
60
  }
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "declaration": true,
5
+ "declarationDir": ".",
6
+ "emitDeclarationOnly": true,
7
+ "outDir": ".",
8
+ "rootDir": "../../../../../../../../front_end/models/trace/lantern/core",
9
+ "rootDirs": [
10
+ "../../../../../../../../",
11
+ "../../../../../"
12
+ ],
13
+ "skipLibCheck": true
14
+ },
15
+ "files": [
16
+ "../../../../../../../../front_end/models/trace/lantern/core/LanternError.ts",
17
+ "../../../../../../../../front_end/models/trace/lantern/core/NetworkAnalyzer.ts",
18
+ "../../../../../../../../front_end/legacy/legacy-defs.d.ts",
19
+ "../../../../../../../../front_end/global_typings/global_defs.d.ts",
20
+ "../../../../../../../../node_modules/@types/filesystem/index.d.ts",
21
+ "../../../../../../../../node_modules/@types/filewriter/index.d.ts"
22
+ ],
23
+ "references": [
24
+ {
25
+ "path": "../types/bundle-tsconfig.ref.json"
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": false,
4
+ "allowSyntheticDefaultImports": true,
5
+ "checkJs": false,
6
+ "composite": false,
7
+ "declaration": false,
8
+ "disableSourceOfProjectReferenceRedirect": true,
9
+ "experimentalDecorators": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "incremental": false,
12
+ "inlineSources": true,
13
+ "lib": [
14
+ "ES2023",
15
+ "ES2024.Promise",
16
+ "ESNext.Iterator",
17
+ "ESNext.Collection",
18
+ "ESNext.Array"
19
+ ],
20
+ "module": "esnext",
21
+ "moduleResolution": "bundler",
22
+ "noEmit": true,
23
+ "noEmitOnError": true,
24
+ "noFallthroughCasesInSwitch": true,
25
+ "noImplicitOverride": true,
26
+ "noImplicitReturns": true,
27
+ "outDir": ".",
28
+ "preserveConstEnums": true,
29
+ "rootDir": "../../../../../../../../front_end/models/trace/lantern/core",
30
+ "rootDirs": [
31
+ "../../../../../../../../",
32
+ "../../../../../"
33
+ ],
34
+ "skipLibCheck": true,
35
+ "sourceMap": true,
36
+ "strict": true,
37
+ "target": "es2023",
38
+ "typeRoots": [
39
+ "../../../../../../../../node_modules/@types",
40
+ "../../../../../../../../node_modules"
41
+ ],
42
+ "types": [
43
+ "node",
44
+ "undici-types"
45
+ ],
46
+ "useUnknownInCatchVariables": false
47
+ },
48
+ "files": [
49
+ "../../../../../../../../front_end/models/trace/lantern/core/LanternError.ts",
50
+ "../../../../../../../../front_end/models/trace/lantern/core/NetworkAnalyzer.ts"
51
+ ],
52
+ "references": [
53
+ {
54
+ "path": "../types/bundle-tsconfig.ref.json"
55
+ }
56
+ ]
57
+ }
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "allowJs": true,
4
- "checkJs": true,
5
- "composite": true,
6
- "declaration": true,
3
+ "allowJs": false,
4
+ "allowSyntheticDefaultImports": true,
5
+ "checkJs": false,
6
+ "composite": false,
7
+ "declaration": false,
8
+ "disableSourceOfProjectReferenceRedirect": true,
7
9
  "experimentalDecorators": true,
8
10
  "forceConsistentCasingInFileNames": true,
11
+ "incremental": false,
9
12
  "inlineSources": true,
10
13
  "lib": [
11
14
  "dom",
@@ -17,32 +20,50 @@
17
20
  "ESNext.Array"
18
21
  ],
19
22
  "module": "esnext",
23
+ "moduleResolution": "bundler",
20
24
  "noEmitOnError": true,
21
25
  "noFallthroughCasesInSwitch": true,
22
26
  "noImplicitOverride": true,
23
27
  "noImplicitReturns": true,
24
- "noUnusedLocals": false,
25
- "noUnusedParameters": false,
26
28
  "outDir": ".",
29
+ "preserveConstEnums": true,
27
30
  "rootDir": "../../../../../../../../front_end/models/trace/lantern/core",
31
+ "rootDirs": [
32
+ "../../../../../../../../",
33
+ "../../../../../"
34
+ ],
28
35
  "skipLibCheck": true,
29
36
  "sourceMap": true,
30
37
  "strict": true,
31
- "target": "ES2023",
32
- "tsBuildInfoFile": "devtools_entrypoint-bundle-typescript-tsconfig.json.tsbuildinfo",
33
- "typeRoots": [],
34
- "types": [],
38
+ "target": "es2023",
39
+ "typeRoots": [
40
+ "../../../../../../../../node_modules/@types",
41
+ "../../../../../../../../node_modules"
42
+ ],
43
+ "types": [
44
+ "mocha"
45
+ ],
35
46
  "useUnknownInCatchVariables": false
36
47
  },
37
48
  "files": [
38
- "../../../../../../../../front_end/models/trace/lantern/core/core.ts",
49
+ "../../../../../../../../front_end/models/trace/lantern/core/NetworkAnalyzer.test.ts",
39
50
  "../../../../../../../../front_end/legacy/legacy-defs.d.ts",
40
51
  "../../../../../../../../front_end/global_typings/global_defs.d.ts",
41
- "../../../../../../../../node_modules/@types/filesystem/index.d.ts"
52
+ "../../../../../../../../node_modules/@types/filesystem/index.d.ts",
53
+ "../../../../../../../../node_modules/@types/filewriter/index.d.ts"
42
54
  ],
43
55
  "references": [
44
56
  {
45
- "path": "./core-tsconfig.json"
57
+ "path": "../bundle-tsconfig.ref.json"
58
+ },
59
+ {
60
+ "path": "../../bundle-tsconfig.ref.json"
61
+ },
62
+ {
63
+ "path": "../../../../testing/testing-tsconfig.ref.json"
64
+ },
65
+ {
66
+ "path": "../testing/bundle-tsconfig.ref.json"
46
67
  }
47
68
  ]
48
69
  }
@@ -0,0 +1,36 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "declaration": true,
5
+ "declarationDir": ".",
6
+ "emitDeclarationOnly": true,
7
+ "outDir": ".",
8
+ "rootDir": "../../../../../../../../front_end/models/trace/lantern/core",
9
+ "rootDirs": [
10
+ "../../../../../../../../",
11
+ "../../../../../"
12
+ ],
13
+ "skipLibCheck": true
14
+ },
15
+ "files": [
16
+ "../../../../../../../../front_end/models/trace/lantern/core/NetworkAnalyzer.test.ts",
17
+ "../../../../../../../../front_end/legacy/legacy-defs.d.ts",
18
+ "../../../../../../../../front_end/global_typings/global_defs.d.ts",
19
+ "../../../../../../../../node_modules/@types/filesystem/index.d.ts",
20
+ "../../../../../../../../node_modules/@types/filewriter/index.d.ts"
21
+ ],
22
+ "references": [
23
+ {
24
+ "path": "../bundle-tsconfig.ref.json"
25
+ },
26
+ {
27
+ "path": "../../bundle-tsconfig.ref.json"
28
+ },
29
+ {
30
+ "path": "../../../../testing/testing-tsconfig.ref.json"
31
+ },
32
+ {
33
+ "path": "../testing/bundle-tsconfig.ref.json"
34
+ }
35
+ ]
36
+ }
@@ -0,0 +1,66 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": false,
4
+ "allowSyntheticDefaultImports": true,
5
+ "checkJs": false,
6
+ "composite": false,
7
+ "declaration": false,
8
+ "disableSourceOfProjectReferenceRedirect": true,
9
+ "experimentalDecorators": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "incremental": false,
12
+ "inlineSources": true,
13
+ "lib": [
14
+ "ES2023",
15
+ "ES2024.Promise",
16
+ "ESNext.Iterator",
17
+ "ESNext.Collection",
18
+ "ESNext.Array"
19
+ ],
20
+ "module": "esnext",
21
+ "moduleResolution": "bundler",
22
+ "noEmit": true,
23
+ "noEmitOnError": true,
24
+ "noFallthroughCasesInSwitch": true,
25
+ "noImplicitOverride": true,
26
+ "noImplicitReturns": true,
27
+ "outDir": ".",
28
+ "preserveConstEnums": true,
29
+ "rootDir": "../../../../../../../../front_end/models/trace/lantern/core",
30
+ "rootDirs": [
31
+ "../../../../../../../../",
32
+ "../../../../../"
33
+ ],
34
+ "skipLibCheck": true,
35
+ "sourceMap": true,
36
+ "strict": true,
37
+ "target": "es2023",
38
+ "typeRoots": [
39
+ "../../../../../../../../node_modules/@types",
40
+ "../../../../../../../../node_modules"
41
+ ],
42
+ "types": [
43
+ "mocha",
44
+ "node",
45
+ "undici-types"
46
+ ],
47
+ "useUnknownInCatchVariables": false
48
+ },
49
+ "files": [
50
+ "../../../../../../../../front_end/models/trace/lantern/core/NetworkAnalyzer.test.ts"
51
+ ],
52
+ "references": [
53
+ {
54
+ "path": "../bundle-tsconfig.ref.json"
55
+ },
56
+ {
57
+ "path": "../../bundle-tsconfig.ref.json"
58
+ },
59
+ {
60
+ "path": "../../../../testing/testing-tsconfig.ref.json"
61
+ },
62
+ {
63
+ "path": "../testing/bundle-tsconfig.ref.json"
64
+ }
65
+ ]
66
+ }
@@ -20,8 +20,8 @@ export type Node<T = Lantern.AnyNetworkObject> = CPUNode<T> | NetworkNode<T>;
20
20
  */
21
21
  declare class BaseNode<T = Lantern.AnyNetworkObject> {
22
22
  static types: {
23
- readonly NETWORK: "network";
24
- readonly CPU: "cpu";
23
+ readonly NETWORK: 'network';
24
+ readonly CPU: 'cpu';
25
25
  };
26
26
  _id: string;
27
27
  _isMainDocument: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"BaseNode.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/graph/BaseNode.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAYxC;;;;;;;;;;;GAWG;AAEH,MAAM,QAAQ;IACZ,MAAM,CAAC,KAAK,GAAG;QACb,OAAO,EAAE,SAAS;QAClB,GAAG,EAAE,KAAK;KACF,CAAC;IAEX,GAAG,CAAS;IACZ,eAAe,CAAU;IACzB,UAAU,CAAS;IACnB,YAAY,CAAS;IAErB,YAAY,EAAU;QACpB,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;IACzB,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,GAAG,C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be\n// found in the LICENSE file.\n\nimport * as Core from '../core/core.js';\nimport type * as Lantern from '../types/types.js';\n\nimport type {CPUNode} from './CPUNode.js';\nimport type {NetworkNode} from './NetworkNode.js';\n\n/**\n * A union of all types derived from BaseNode, allowing type check discrimination\n * based on `node.type`. If a new node type is created, it should be added here.\n */\nexport type Node<T = Lantern.AnyNetworkObject> = CPUNode<T>|NetworkNode<T>;\n\n/**\n * @file This class encapsulates logic for handling resources and tasks used to model the\n * execution dependency graph of the page. A node has a unique identifier and can depend on other\n * nodes/be depended on. The construction of the graph maintains some important invariants that are\n * inherent to the model:\n *\n * 1. The graph is a DAG, there are no cycles.\n * 2. There is always a root node upon which all other nodes eventually depend.\n *\n * This allows particular optimizations in this class so that we do no need to check for cycles as\n * these methods are called and we can always start traversal at the root node.\n */\n\nclass BaseNode<T = Lantern.AnyNetworkObject> {\n static types = {\n NETWORK: 'network',\n CPU: 'cpu',\n } as const;\n\n _id: string;\n _isMainDocument: boolean;\n dependents: Node[];\n dependencies: Node[];\n\n constructor(id: string) {\n this._id = id;\n this._isMainDocument = false;\n this.dependents = [];\n this.dependencies = [];\n }\n\n get id(): string {\n return this._id;\n }\n\n get type(): 'network'|'cpu' {\n throw new Core.LanternError('Unimplemented');\n }\n\n /**\n * In microseconds\n */\n get startTime(): number {\n throw new Core.LanternError('Unimplemented');\n }\n\n /**\n * In microseconds\n */\n get endTime(): number {\n throw new Core.LanternError('Unimplemented');\n }\n\n setIsMainDocument(value: boolean): void {\n this._isMainDocument = value;\n }\n\n isMainDocument(): boolean {\n return this._isMainDocument;\n }\n\n getDependents(): Node[] {\n return this.dependents.slice();\n }\n\n getNumberOfDependents(): number {\n return this.dependents.length;\n }\n\n getDependencies(): Node[] {\n return this.dependencies.slice();\n }\n\n getNumberOfDependencies(): number {\n return this.dependencies.length;\n }\n\n getRootNode(): Node<T> {\n let rootNode = this as BaseNode as Node;\n while (rootNode.dependencies.length) {\n rootNode = rootNode.dependencies[0];\n }\n\n return rootNode;\n }\n\n addDependent(node: Node): void {\n node.addDependency(this as BaseNode as Node);\n }\n\n addDependency(node: Node): void {\n // @ts-expect-error - in checkJs, ts doesn't know that CPUNode and NetworkNode *are* BaseNodes.\n if (node === this) {\n throw new Core.LanternError('Cannot add dependency on itself');\n }\n\n if (this.dependencies.includes(node)) {\n return;\n }\n\n node.dependents.push(this as BaseNode as Node);\n this.dependencies.push(node);\n }\n\n removeDependent(node: Node): void {\n node.removeDependency(this as BaseNode as Node);\n }\n\n removeDependency(node: Node): void {\n if (!this.dependencies.includes(node)) {\n return;\n }\n\n const thisIndex = node.dependents.indexOf(this as BaseNode as Node);\n node.dependents.splice(thisIndex, 1);\n this.dependencies.splice(this.dependencies.indexOf(node), 1);\n }\n\n // Unused in devtools, but used in LH.\n removeAllDependencies(): void {\n for (const node of this.dependencies.slice()) {\n this.removeDependency(node);\n }\n }\n\n /**\n * Computes whether the given node is anywhere in the dependency graph of this node.\n * While this method can prevent cycles, it walks the graph and should be used sparingly.\n * Nodes are always considered dependent on themselves for the purposes of cycle detection.\n */\n isDependentOn(node: BaseNode<T>): boolean {\n let isDependentOnNode = false;\n this.traverse(\n currentNode => {\n if (isDependentOnNode) {\n return;\n }\n isDependentOnNode = currentNode === node;\n },\n currentNode => {\n // If we've already found the dependency, don't traverse further.\n if (isDependentOnNode) {\n return [];\n }\n // Otherwise, traverse the dependencies.\n return currentNode.getDependencies();\n });\n\n return isDependentOnNode;\n }\n\n /**\n * Clones the node's information without adding any dependencies/dependents.\n */\n cloneWithoutRelationships(): Node<T> {\n const node = new BaseNode(this.id) as Node<T>;\n node.setIsMainDocument(this._isMainDocument);\n return node;\n }\n\n /**\n * Clones the entire graph connected to this node filtered by the optional predicate. If a node is\n * included by the predicate, all nodes along the paths between the node and the root will be included. If the\n * node this was called on is not included in the resulting filtered graph, the method will throw.\n *\n * This does not clone NetworkNode's `record` or `rawRecord` fields. It may be reasonable to clone the former,\n * to assist in graph construction, but the latter should never be cloned as one constraint of Lantern is that\n * the underlying data records are accessible for plain object reference equality checks.\n */\n cloneWithRelationships(predicate?: (arg0: Node) => boolean): Node {\n const rootNode = this.getRootNode();\n\n const idsToIncludedClones = new Map<string, Node>();\n\n // Walk down dependents.\n rootNode.traverse(node => {\n if (idsToIncludedClones.has(node.id)) {\n return;\n }\n\n if (predicate === undefined) {\n // No condition for entry, so clone every node.\n idsToIncludedClones.set(node.id, node.cloneWithoutRelationships());\n return;\n }\n\n if (predicate(node)) {\n // Node included, so walk back up dependencies, cloning nodes from here back to the root.\n node.traverse(\n node => idsToIncludedClones.set(node.id, node.cloneWithoutRelationships()),\n // Dependencies already cloned have already cloned ancestors, so no need to visit again.\n node => node.dependencies.filter(parent => !idsToIncludedClones.has(parent.id)),\n );\n }\n });\n\n // Copy dependencies between nodes.\n rootNode.traverse(originalNode => {\n const clonedNode = idsToIncludedClones.get(originalNode.id);\n if (!clonedNode) {\n return;\n }\n\n for (const dependency of originalNode.dependencies) {\n const clonedDependency = idsToIncludedClones.get(dependency.id);\n if (!clonedDependency) {\n throw new Core.LanternError('Dependency somehow not cloned');\n }\n clonedNode.addDependency(clonedDependency);\n }\n });\n\n const clonedThisNode = idsToIncludedClones.get(this.id);\n if (!clonedThisNode) {\n throw new Core.LanternError('Cloned graph missing node');\n }\n return clonedThisNode;\n }\n\n /**\n * Traverses all connected nodes in BFS order, calling `callback` exactly once\n * on each. `traversalPath` is the shortest (though not necessarily unique)\n * path from `node` to the root of the iteration.\n *\n * The `getNextNodes` function takes a visited node and returns which nodes to\n * visit next. It defaults to returning the node's dependents.\n */\n traverse(\n callback: (node: Node<T>, traversalPath: Array<Node<T>>) => void,\n getNextNodes?: (arg0: Node<T>) => Array<Node<T>>): void {\n for (const {node, traversalPath} of this.traverseGenerator(getNextNodes)) {\n callback(node, traversalPath);\n }\n }\n\n /**\n * @see BaseNode.traverse\n */\n // clang-format off\n *traverseGenerator(getNextNodes?: (arg0: Node) => Node[]):\n Generator<{node: Node, traversalPath: Node[]}, void, unknown> {\n // clang-format on\n if (!getNextNodes) {\n getNextNodes = node => node.getDependents();\n }\n\n // @ts-expect-error - only traverses graphs of Node, so force tsc to treat `this` as one\n const queue: Node[][] = [[this]];\n const visited = new Set([this.id]);\n\n while (queue.length) {\n // @ts-expect-error - queue has length so it's guaranteed to have an item\n const traversalPath: Node[] = queue.shift();\n const node = traversalPath[0];\n yield {node, traversalPath};\n\n for (const nextNode of getNextNodes(node)) {\n if (visited.has(nextNode.id)) {\n continue;\n }\n visited.add(nextNode.id);\n\n queue.push([nextNode, ...traversalPath]);\n }\n }\n }\n\n /**\n * If the given node has a cycle, returns a path representing that cycle.\n * Else returns null.\n *\n * Does a DFS on in its dependent graph.\n */\n static findCycle(node: Node, direction: 'dependents'|'dependencies'|'both' = 'both'): BaseNode[]|null {\n // Checking 'both' is the default entrypoint to recursively check both directions\n if (direction === 'both') {\n return BaseNode.findCycle(node, 'dependents') || BaseNode.findCycle(node, 'dependencies');\n }\n\n const visited = new Set();\n const currentPath: BaseNode[] = [];\n const toVisit = [node];\n const depthAdded = new Map([[node, 0]]);\n\n // Keep going while we have nodes to visit in the stack\n while (toVisit.length) {\n // Get the last node in the stack (DFS uses stack, not queue)\n // @ts-expect-error - toVisit has length so it's guaranteed to have an item\n const currentNode: BaseNode = toVisit.pop();\n\n // We've hit a cycle if the node we're visiting is in our current dependency path\n if (currentPath.includes(currentNode)) {\n return currentPath;\n }\n // If we've already visited the node, no need to revisit it\n if (visited.has(currentNode)) {\n continue;\n }\n\n // Since we're visiting this node, clear out any nodes in our path that we had to backtrack\n // @ts-expect-error\n while (currentPath.length > depthAdded.get(currentNode)) {\n currentPath.pop();\n }\n\n // Update our data structures to reflect that we're adding this node to our path\n visited.add(currentNode);\n currentPath.push(currentNode);\n\n // Add all of its dependents to our toVisit stack\n const nodesToExplore = direction === 'dependents' ? currentNode.dependents : currentNode.dependencies;\n for (const nextNode of nodesToExplore) {\n if (toVisit.includes(nextNode)) {\n continue;\n }\n toVisit.push(nextNode);\n depthAdded.set(nextNode, currentPath.length);\n }\n }\n\n return null;\n }\n\n canDependOn(node: Node): boolean {\n return node.startTime <= this.startTime;\n }\n}\n\nexport {BaseNode};\n"]}
1
+ {"version":3,"file":"BaseNode.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/graph/BaseNode.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAYxC;;;;;;;;;;;GAWG;AAEH,MAAM,QAAQ;IACZ,MAAM,CAAC,KAAK,GAAG;QACb,OAAO,EAAE,SAAS;QAClB,GAAG,EAAE,KAAK;KACF,CAAC;IAEX,GAAG,CAAS;IACZ,eAAe,CAAU;IACzB,UAAU,CAAS;IACnB,YAAY,CAAS;IAErB,YAAY,EAAU;QACpB,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;IACzB,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED,IAAI,IAAI;QACN,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IAC/C,CAAC;IAED,iBAAiB,CAAC,KAAc;QAC9B,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IAC/B,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,UAA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AAgF;YAChF,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACzB,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAE9B,iDAAiD;YACjD,MAAM,cAAc,GAAG,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC;YACtG,KAAK,MAAM,QAAQ,IAAI,cAAc,EAAE,CAAC;gBACtC,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;oBAC/B,SAAS;gBACX,CAAC;gBACD,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACvB,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,WAAW,CAAC,IAAU;QACpB,OAAO,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC;IAC1C,CAAC;CACF;AAED,OAAO,EAAC,QAAQ,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 Lantern from '../types/types.js';\n\nimport type {CPUNode} from './CPUNode.js';\nimport type {NetworkNode} from './NetworkNode.js';\n\n/**\n * A union of all types derived from BaseNode, allowing type check discrimination\n * based on `node.type`. If a new node type is created, it should be added here.\n */\nexport type Node<T = Lantern.AnyNetworkObject> = CPUNode<T>|NetworkNode<T>;\n\n/**\n * @file This class encapsulates logic for handling resources and tasks used to model the\n * execution dependency graph of the page. A node has a unique identifier and can depend on other\n * nodes/be depended on. The construction of the graph maintains some important invariants that are\n * inherent to the model:\n *\n * 1. The graph is a DAG, there are no cycles.\n * 2. There is always a root node upon which all other nodes eventually depend.\n *\n * This allows particular optimizations in this class so that we do no need to check for cycles as\n * these methods are called and we can always start traversal at the root node.\n */\n\nclass BaseNode<T = Lantern.AnyNetworkObject> {\n static types = {\n NETWORK: 'network',\n CPU: 'cpu',\n } as const;\n\n _id: string;\n _isMainDocument: boolean;\n dependents: Node[];\n dependencies: Node[];\n\n constructor(id: string) {\n this._id = id;\n this._isMainDocument = false;\n this.dependents = [];\n this.dependencies = [];\n }\n\n get id(): string {\n return this._id;\n }\n\n get type(): 'network'|'cpu' {\n throw new Core.LanternError('Unimplemented');\n }\n\n /**\n * In microseconds\n */\n get startTime(): number {\n throw new Core.LanternError('Unimplemented');\n }\n\n /**\n * In microseconds\n */\n get endTime(): number {\n throw new Core.LanternError('Unimplemented');\n }\n\n setIsMainDocument(value: boolean): void {\n this._isMainDocument = value;\n }\n\n isMainDocument(): boolean {\n return this._isMainDocument;\n }\n\n getDependents(): Node[] {\n return this.dependents.slice();\n }\n\n getNumberOfDependents(): number {\n return this.dependents.length;\n }\n\n getDependencies(): Node[] {\n return this.dependencies.slice();\n }\n\n getNumberOfDependencies(): number {\n return this.dependencies.length;\n }\n\n getRootNode(): Node<T> {\n let rootNode = this as BaseNode as Node;\n while (rootNode.dependencies.length) {\n rootNode = rootNode.dependencies[0];\n }\n\n return rootNode;\n }\n\n addDependent(node: Node): void {\n node.addDependency(this as BaseNode as Node);\n }\n\n addDependency(node: Node): void {\n // @ts-expect-error - in checkJs, ts doesn't know that CPUNode and NetworkNode *are* BaseNodes.\n if (node === this) {\n throw new Core.LanternError('Cannot add dependency on itself');\n }\n\n if (this.dependencies.includes(node)) {\n return;\n }\n\n node.dependents.push(this as BaseNode as Node);\n this.dependencies.push(node);\n }\n\n removeDependent(node: Node): void {\n node.removeDependency(this as BaseNode as Node);\n }\n\n removeDependency(node: Node): void {\n if (!this.dependencies.includes(node)) {\n return;\n }\n\n const thisIndex = node.dependents.indexOf(this as BaseNode as Node);\n node.dependents.splice(thisIndex, 1);\n this.dependencies.splice(this.dependencies.indexOf(node), 1);\n }\n\n // Unused in devtools, but used in LH.\n removeAllDependencies(): void {\n for (const node of this.dependencies.slice()) {\n this.removeDependency(node);\n }\n }\n\n /**\n * Computes whether the given node is anywhere in the dependency graph of this node.\n * While this method can prevent cycles, it walks the graph and should be used sparingly.\n * Nodes are always considered dependent on themselves for the purposes of cycle detection.\n */\n isDependentOn(node: BaseNode<T>): boolean {\n let isDependentOnNode = false;\n this.traverse(\n currentNode => {\n if (isDependentOnNode) {\n return;\n }\n isDependentOnNode = currentNode === node;\n },\n currentNode => {\n // If we've already found the dependency, don't traverse further.\n if (isDependentOnNode) {\n return [];\n }\n // Otherwise, traverse the dependencies.\n return currentNode.getDependencies();\n });\n\n return isDependentOnNode;\n }\n\n /**\n * Clones the node's information without adding any dependencies/dependents.\n */\n cloneWithoutRelationships(): Node<T> {\n const node = new BaseNode(this.id) as Node<T>;\n node.setIsMainDocument(this._isMainDocument);\n return node;\n }\n\n /**\n * Clones the entire graph connected to this node filtered by the optional predicate. If a node is\n * included by the predicate, all nodes along the paths between the node and the root will be included. If the\n * node this was called on is not included in the resulting filtered graph, the method will throw.\n *\n * This does not clone NetworkNode's `record` or `rawRecord` fields. It may be reasonable to clone the former,\n * to assist in graph construction, but the latter should never be cloned as one constraint of Lantern is that\n * the underlying data records are accessible for plain object reference equality checks.\n */\n cloneWithRelationships(predicate?: (arg0: Node) => boolean): Node {\n const rootNode = this.getRootNode();\n\n const idsToIncludedClones = new Map<string, Node>();\n\n // Walk down dependents.\n rootNode.traverse(node => {\n if (idsToIncludedClones.has(node.id)) {\n return;\n }\n\n if (predicate === undefined) {\n // No condition for entry, so clone every node.\n idsToIncludedClones.set(node.id, node.cloneWithoutRelationships());\n return;\n }\n\n if (predicate(node)) {\n // Node included, so walk back up dependencies, cloning nodes from here back to the root.\n node.traverse(\n node => idsToIncludedClones.set(node.id, node.cloneWithoutRelationships()),\n // Dependencies already cloned have already cloned ancestors, so no need to visit again.\n node => node.dependencies.filter(parent => !idsToIncludedClones.has(parent.id)),\n );\n }\n });\n\n // Copy dependencies between nodes.\n rootNode.traverse(originalNode => {\n const clonedNode = idsToIncludedClones.get(originalNode.id);\n if (!clonedNode) {\n return;\n }\n\n for (const dependency of originalNode.dependencies) {\n const clonedDependency = idsToIncludedClones.get(dependency.id);\n if (!clonedDependency) {\n throw new Core.LanternError('Dependency somehow not cloned');\n }\n clonedNode.addDependency(clonedDependency);\n }\n });\n\n const clonedThisNode = idsToIncludedClones.get(this.id);\n if (!clonedThisNode) {\n throw new Core.LanternError('Cloned graph missing node');\n }\n return clonedThisNode;\n }\n\n /**\n * Traverses all connected nodes in BFS order, calling `callback` exactly once\n * on each. `traversalPath` is the shortest (though not necessarily unique)\n * path from `node` to the root of the iteration.\n *\n * The `getNextNodes` function takes a visited node and returns which nodes to\n * visit next. It defaults to returning the node's dependents.\n */\n traverse(\n callback: (node: Node<T>, traversalPath: Array<Node<T>>) => void,\n getNextNodes?: (arg0: Node<T>) => Array<Node<T>>): void {\n for (const {node, traversalPath} of this.traverseGenerator(getNextNodes)) {\n callback(node, traversalPath);\n }\n }\n\n /**\n * @see BaseNode.traverse\n */\n // clang-format off\n *traverseGenerator(getNextNodes?: (arg0: Node) => Node[]):\n Generator<{node: Node, traversalPath: Node[]}, void, unknown> {\n // clang-format on\n if (!getNextNodes) {\n getNextNodes = node => node.getDependents();\n }\n\n // @ts-expect-error - only traverses graphs of Node, so force tsc to treat `this` as one\n const queue: Node[][] = [[this]];\n const visited = new Set([this.id]);\n\n while (queue.length) {\n // @ts-expect-error - queue has length so it's guaranteed to have an item\n const traversalPath: Node[] = queue.shift();\n const node = traversalPath[0];\n yield {node, traversalPath};\n\n for (const nextNode of getNextNodes(node)) {\n if (visited.has(nextNode.id)) {\n continue;\n }\n visited.add(nextNode.id);\n\n queue.push([nextNode, ...traversalPath]);\n }\n }\n }\n\n /**\n * If the given node has a cycle, returns a path representing that cycle.\n * Else returns null.\n *\n * Does a DFS on in its dependent graph.\n */\n static findCycle(node: Node, direction: 'dependents'|'dependencies'|'both' = 'both'): BaseNode[]|null {\n // Checking 'both' is the default entrypoint to recursively check both directions\n if (direction === 'both') {\n return BaseNode.findCycle(node, 'dependents') || BaseNode.findCycle(node, 'dependencies');\n }\n\n const visited = new Set();\n const currentPath: BaseNode[] = [];\n const toVisit = [node];\n const depthAdded = new Map([[node, 0]]);\n\n // Keep going while we have nodes to visit in the stack\n while (toVisit.length) {\n // Get the last node in the stack (DFS uses stack, not queue)\n // @ts-expect-error - toVisit has length so it's guaranteed to have an item\n const currentNode: BaseNode = toVisit.pop();\n\n // We've hit a cycle if the node we're visiting is in our current dependency path\n if (currentPath.includes(currentNode)) {\n return currentPath;\n }\n // If we've already visited the node, no need to revisit it\n if (visited.has(currentNode)) {\n continue;\n }\n\n // Since we're visiting this node, clear out any nodes in our path that we had to backtrack\n // @ts-expect-error\n while (currentPath.length > depthAdded.get(currentNode)) {\n currentPath.pop();\n }\n\n // Update our data structures to reflect that we're adding this node to our path\n visited.add(currentNode);\n currentPath.push(currentNode);\n\n // Add all of its dependents to our toVisit stack\n const nodesToExplore = direction === 'dependents' ? currentNode.dependents : currentNode.dependencies;\n for (const nextNode of nodesToExplore) {\n if (toVisit.includes(nextNode)) {\n continue;\n }\n toVisit.push(nextNode);\n depthAdded.set(nextNode, currentPath.length);\n }\n }\n\n return null;\n }\n\n canDependOn(node: Node): boolean {\n return node.startTime <= this.startTime;\n }\n}\n\nexport {BaseNode};\n"]}
@@ -1,22 +1,24 @@
1
1
  import type * as Lantern from '../types/types.js';
2
2
  import { BaseNode } from './BaseNode.js';
3
3
  declare class CPUNode<T = Lantern.AnyNetworkObject> extends BaseNode<T> {
4
+ #private;
4
5
  _event: Lantern.TraceEvent;
5
6
  _childEvents: Lantern.TraceEvent[];
6
7
  correctedEndTs: number | undefined;
7
- constructor(parentEvent: Lantern.TraceEvent, childEvents?: Lantern.TraceEvent[], correctedEndTs?: number);
8
+ constructor(parentEvent: Lantern.TraceEvent, childEvents?: Lantern.TraceEvent[], correctedEndTs?: number, scriptUrlById?: ReadonlyMap<number, string>);
8
9
  get type(): 'cpu';
9
10
  get startTime(): number;
10
11
  get endTime(): number;
11
12
  get duration(): number;
12
13
  get event(): Lantern.TraceEvent;
13
14
  get childEvents(): Lantern.TraceEvent[];
15
+ getScriptUrlById(scriptId: number): string | undefined;
14
16
  /**
15
17
  * Returns true if this node contains a Layout task.
16
18
  */
17
19
  didPerformLayout(): boolean;
18
20
  /**
19
- * Returns the script URLs that had their EvaluateScript events occur in this task.
21
+ * Returns the script URLs that had their EvaluateScript or v8.evaluateModule events occur in this task.
20
22
  */
21
23
  getEvaluateScriptURLs(): Set<string>;
22
24
  cloneWithoutRelationships(): CPUNode;
@@ -6,12 +6,16 @@ class CPUNode extends BaseNode {
6
6
  _event;
7
7
  _childEvents;
8
8
  correctedEndTs;
9
- constructor(parentEvent, childEvents = [], correctedEndTs) {
9
+ // TODO(crbug.com/568836981): Remove once v8.evaluateModule includes `url` in
10
+ // all supported Chrome versions.
11
+ #scriptUrlById;
12
+ constructor(parentEvent, childEvents = [], correctedEndTs, scriptUrlById) {
10
13
  const nodeId = `${parentEvent.tid}.${parentEvent.ts}`;
11
14
  super(nodeId);
12
15
  this._event = parentEvent;
13
16
  this._childEvents = childEvents;
14
17
  this.correctedEndTs = correctedEndTs;
18
+ this.#scriptUrlById = scriptUrlById;
15
19
  }
16
20
  get type() {
17
21
  return BaseNode.types.CPU;
@@ -34,6 +38,11 @@ class CPUNode extends BaseNode {
34
38
  get childEvents() {
35
39
  return this._childEvents;
36
40
  }
41
+ // TODO(crbug.com/568836981): Remove once v8.evaluateModule includes `url` in
42
+ // all supported Chrome versions.
43
+ getScriptUrlById(scriptId) {
44
+ return this.#scriptUrlById?.get(scriptId);
45
+ }
37
46
  /**
38
47
  * Returns true if this node contains a Layout task.
39
48
  */
@@ -41,23 +50,30 @@ class CPUNode extends BaseNode {
41
50
  return this._childEvents.some(evt => evt.name === 'Layout');
42
51
  }
43
52
  /**
44
- * Returns the script URLs that had their EvaluateScript events occur in this task.
53
+ * Returns the script URLs that had their EvaluateScript or v8.evaluateModule events occur in this task.
45
54
  */
46
55
  getEvaluateScriptURLs() {
47
56
  const urls = new Set();
48
57
  for (const event of this._childEvents) {
49
- if (event.name !== 'EvaluateScript') {
58
+ if (event.name === 'EvaluateScript' || event.name === 'v8.evaluateModule') {
59
+ if (event.args.data?.url) {
60
+ urls.add(event.args.data.url);
61
+ }
50
62
  continue;
51
63
  }
52
- if (!event.args.data?.url) {
53
- continue;
64
+ // TODO(crbug.com/568836981): Remove this workaround once v8.evaluateModule
65
+ // includes `args.data.url` in all supported Chrome versions.
66
+ if (event.name === 'ModuleEvaluated' && event.args.data?.scriptId !== undefined) {
67
+ const url = this.#scriptUrlById?.get(event.args.data.scriptId);
68
+ if (url) {
69
+ urls.add(url);
70
+ }
54
71
  }
55
- urls.add(event.args.data.url);
56
72
  }
57
73
  return urls;
58
74
  }
59
75
  cloneWithoutRelationships() {
60
- return new CPUNode(this._event, this._childEvents, this.correctedEndTs);
76
+ return new CPUNode(this._event, this._childEvents, this.correctedEndTs, this.#scriptUrlById);
61
77
  }
62
78
  }
63
79
  export { CPUNode };