@sentry/browser-utils 11.0.0-alpha.0 → 11.0.0-alpha.1

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 (288) hide show
  1. package/build/cjs/index.js +29 -28
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/instrumentation/dom.js.map +1 -0
  4. package/build/cjs/instrumentation/history.js.map +1 -0
  5. package/build/cjs/instrumentation/location.js.map +1 -0
  6. package/build/cjs/{metrics/instrument.js → instrumentation/performanceObserver.js} +44 -32
  7. package/build/cjs/instrumentation/performanceObserver.js.map +1 -0
  8. package/build/cjs/instrumentation/xhr.js.map +1 -0
  9. package/build/cjs/{metrics → performance}/elementTiming.js +2 -2
  10. package/build/cjs/performance/elementTiming.js.map +1 -0
  11. package/build/cjs/{metrics/browserMetrics.js → performance/entries.js} +22 -175
  12. package/build/cjs/performance/entries.js.map +1 -0
  13. package/build/cjs/performance/resourceTiming.js.map +1 -0
  14. package/build/cjs/{metrics → performance}/userTiming.js +4 -3
  15. package/build/cjs/performance/userTiming.js.map +1 -0
  16. package/build/cjs/{metrics → performance}/utils.js +1 -27
  17. package/build/cjs/performance/utils.js.map +1 -0
  18. package/build/cjs/{metrics → web-vitals}/inp.js +4 -4
  19. package/build/cjs/web-vitals/inp.js.map +1 -0
  20. package/build/cjs/web-vitals/lcp.js.map +1 -0
  21. package/build/cjs/web-vitals/reportEvents.js +31 -0
  22. package/build/cjs/web-vitals/reportEvents.js.map +1 -0
  23. package/build/cjs/{metrics/webVitalSpans.js → web-vitals/spans.js} +11 -10
  24. package/build/cjs/web-vitals/spans.js.map +1 -0
  25. package/build/cjs/web-vitals/tracking.js +164 -0
  26. package/build/cjs/web-vitals/tracking.js.map +1 -0
  27. package/build/cjs/web-vitals/utils.js +99 -0
  28. package/build/cjs/web-vitals/utils.js.map +1 -0
  29. package/build/esm/index.js +14 -13
  30. package/build/esm/index.js.map +1 -1
  31. package/build/esm/instrumentation/dom.js.map +1 -0
  32. package/build/esm/instrumentation/history.js.map +1 -0
  33. package/build/esm/instrumentation/location.js.map +1 -0
  34. package/build/esm/{metrics/instrument.js → instrumentation/performanceObserver.js} +42 -30
  35. package/build/esm/instrumentation/performanceObserver.js.map +1 -0
  36. package/build/esm/instrumentation/xhr.js.map +1 -0
  37. package/build/esm/package.json +1 -1
  38. package/build/esm/{metrics → performance}/elementTiming.js +1 -1
  39. package/build/esm/performance/elementTiming.js.map +1 -0
  40. package/build/esm/{metrics/browserMetrics.js → performance/entries.js} +15 -166
  41. package/build/esm/performance/entries.js.map +1 -0
  42. package/build/esm/performance/resourceTiming.js.map +1 -0
  43. package/build/esm/{metrics → performance}/userTiming.js +4 -3
  44. package/build/esm/performance/userTiming.js.map +1 -0
  45. package/build/esm/{metrics → performance}/utils.js +3 -28
  46. package/build/esm/performance/utils.js.map +1 -0
  47. package/build/esm/{metrics → web-vitals}/inp.js +1 -1
  48. package/build/esm/web-vitals/inp.js.map +1 -0
  49. package/build/esm/web-vitals/lcp.js.map +1 -0
  50. package/build/esm/web-vitals/reportEvents.js +29 -0
  51. package/build/esm/web-vitals/reportEvents.js.map +1 -0
  52. package/build/esm/{metrics/webVitalSpans.js → web-vitals/spans.js} +7 -6
  53. package/build/esm/web-vitals/spans.js.map +1 -0
  54. package/build/esm/web-vitals/tracking.js +161 -0
  55. package/build/esm/web-vitals/tracking.js.map +1 -0
  56. package/build/esm/web-vitals/utils.js +91 -0
  57. package/build/esm/web-vitals/utils.js.map +1 -0
  58. package/build/types/index.d.ts +13 -12
  59. package/build/types/index.d.ts.map +1 -1
  60. package/build/types/instrumentation/dom.d.ts.map +1 -0
  61. package/build/types/instrumentation/history.d.ts.map +1 -0
  62. package/build/types/instrumentation/location.d.ts.map +1 -0
  63. package/build/types/{metrics/instrument.d.ts → instrumentation/performanceObserver.d.ts} +3 -3
  64. package/build/types/instrumentation/performanceObserver.d.ts.map +1 -0
  65. package/build/types/instrumentation/xhr.d.ts.map +1 -0
  66. package/build/types/performance/elementTiming.d.ts.map +1 -0
  67. package/build/types/{metrics/browserMetrics.d.ts → performance/entries.d.ts} +3 -46
  68. package/build/types/performance/entries.d.ts.map +1 -0
  69. package/build/types/performance/resourceTiming.d.ts.map +1 -0
  70. package/build/types/performance/userTiming.d.ts.map +1 -0
  71. package/build/types/{metrics → performance}/utils.d.ts +1 -17
  72. package/build/types/performance/utils.d.ts.map +1 -0
  73. package/build/types/web-vitals/inp.d.ts.map +1 -0
  74. package/build/types/web-vitals/lcp.d.ts.map +1 -0
  75. package/build/types/web-vitals/reportEvents.d.ts +18 -0
  76. package/build/types/web-vitals/reportEvents.d.ts.map +1 -0
  77. package/build/types/{metrics/webVitalSpans.d.ts → web-vitals/spans.d.ts} +3 -3
  78. package/build/types/web-vitals/spans.d.ts.map +1 -0
  79. package/build/types/web-vitals/tracking.d.ts +46 -0
  80. package/build/types/web-vitals/tracking.d.ts.map +1 -0
  81. package/build/types/{metrics/web-vitals/lib/globalListeners.d.ts → web-vitals/utils.d.ts} +16 -1
  82. package/build/types/web-vitals/utils.d.ts.map +1 -0
  83. package/package.json +4 -3
  84. package/build/cjs/instrument/dom.js.map +0 -1
  85. package/build/cjs/instrument/history.js.map +0 -1
  86. package/build/cjs/instrument/location.js.map +0 -1
  87. package/build/cjs/instrument/xhr.js.map +0 -1
  88. package/build/cjs/metrics/browserMetrics.js.map +0 -1
  89. package/build/cjs/metrics/elementTiming.js.map +0 -1
  90. package/build/cjs/metrics/inp.js.map +0 -1
  91. package/build/cjs/metrics/instrument.js.map +0 -1
  92. package/build/cjs/metrics/lcp.js.map +0 -1
  93. package/build/cjs/metrics/resourceTiming.js.map +0 -1
  94. package/build/cjs/metrics/userTiming.js.map +0 -1
  95. package/build/cjs/metrics/utils.js.map +0 -1
  96. package/build/cjs/metrics/web-vitals/getCLS.js +0 -46
  97. package/build/cjs/metrics/web-vitals/getCLS.js.map +0 -1
  98. package/build/cjs/metrics/web-vitals/getINP.js +0 -60
  99. package/build/cjs/metrics/web-vitals/getINP.js.map +0 -1
  100. package/build/cjs/metrics/web-vitals/getLCP.js +0 -62
  101. package/build/cjs/metrics/web-vitals/getLCP.js.map +0 -1
  102. package/build/cjs/metrics/web-vitals/lib/InteractionManager.js +0 -87
  103. package/build/cjs/metrics/web-vitals/lib/InteractionManager.js.map +0 -1
  104. package/build/cjs/metrics/web-vitals/lib/LCPEntryManager.js +0 -11
  105. package/build/cjs/metrics/web-vitals/lib/LCPEntryManager.js.map +0 -1
  106. package/build/cjs/metrics/web-vitals/lib/LayoutShiftManager.js +0 -27
  107. package/build/cjs/metrics/web-vitals/lib/LayoutShiftManager.js.map +0 -1
  108. package/build/cjs/metrics/web-vitals/lib/bindReporter.js +0 -31
  109. package/build/cjs/metrics/web-vitals/lib/bindReporter.js.map +0 -1
  110. package/build/cjs/metrics/web-vitals/lib/generateUniqueID.js +0 -8
  111. package/build/cjs/metrics/web-vitals/lib/generateUniqueID.js.map +0 -1
  112. package/build/cjs/metrics/web-vitals/lib/getActivationStart.js +0 -11
  113. package/build/cjs/metrics/web-vitals/lib/getActivationStart.js.map +0 -1
  114. package/build/cjs/metrics/web-vitals/lib/getNavigationEntry.js +0 -17
  115. package/build/cjs/metrics/web-vitals/lib/getNavigationEntry.js.map +0 -1
  116. package/build/cjs/metrics/web-vitals/lib/getVisibilityWatcher.js +0 -44
  117. package/build/cjs/metrics/web-vitals/lib/getVisibilityWatcher.js.map +0 -1
  118. package/build/cjs/metrics/web-vitals/lib/globalListeners.js +0 -18
  119. package/build/cjs/metrics/web-vitals/lib/globalListeners.js.map +0 -1
  120. package/build/cjs/metrics/web-vitals/lib/initMetric.js +0 -34
  121. package/build/cjs/metrics/web-vitals/lib/initMetric.js.map +0 -1
  122. package/build/cjs/metrics/web-vitals/lib/initUnique.js +0 -16
  123. package/build/cjs/metrics/web-vitals/lib/initUnique.js.map +0 -1
  124. package/build/cjs/metrics/web-vitals/lib/observe.js +0 -20
  125. package/build/cjs/metrics/web-vitals/lib/observe.js.map +0 -1
  126. package/build/cjs/metrics/web-vitals/lib/onHidden.js +0 -16
  127. package/build/cjs/metrics/web-vitals/lib/onHidden.js.map +0 -1
  128. package/build/cjs/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js +0 -32
  129. package/build/cjs/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js.map +0 -1
  130. package/build/cjs/metrics/web-vitals/lib/runOnce.js +0 -14
  131. package/build/cjs/metrics/web-vitals/lib/runOnce.js.map +0 -1
  132. package/build/cjs/metrics/web-vitals/lib/whenActivated.js +0 -14
  133. package/build/cjs/metrics/web-vitals/lib/whenActivated.js.map +0 -1
  134. package/build/cjs/metrics/web-vitals/lib/whenIdleOrHidden.js +0 -22
  135. package/build/cjs/metrics/web-vitals/lib/whenIdleOrHidden.js.map +0 -1
  136. package/build/cjs/metrics/web-vitals/onFCP.js +0 -37
  137. package/build/cjs/metrics/web-vitals/onFCP.js.map +0 -1
  138. package/build/cjs/metrics/web-vitals/onTTFB.js +0 -35
  139. package/build/cjs/metrics/web-vitals/onTTFB.js.map +0 -1
  140. package/build/cjs/metrics/webVitalSpans.js.map +0 -1
  141. package/build/esm/instrument/dom.js.map +0 -1
  142. package/build/esm/instrument/history.js.map +0 -1
  143. package/build/esm/instrument/location.js.map +0 -1
  144. package/build/esm/instrument/xhr.js.map +0 -1
  145. package/build/esm/metrics/browserMetrics.js.map +0 -1
  146. package/build/esm/metrics/elementTiming.js.map +0 -1
  147. package/build/esm/metrics/inp.js.map +0 -1
  148. package/build/esm/metrics/instrument.js.map +0 -1
  149. package/build/esm/metrics/lcp.js.map +0 -1
  150. package/build/esm/metrics/resourceTiming.js.map +0 -1
  151. package/build/esm/metrics/userTiming.js.map +0 -1
  152. package/build/esm/metrics/utils.js.map +0 -1
  153. package/build/esm/metrics/web-vitals/getCLS.js +0 -43
  154. package/build/esm/metrics/web-vitals/getCLS.js.map +0 -1
  155. package/build/esm/metrics/web-vitals/getINP.js +0 -57
  156. package/build/esm/metrics/web-vitals/getINP.js.map +0 -1
  157. package/build/esm/metrics/web-vitals/getLCP.js +0 -59
  158. package/build/esm/metrics/web-vitals/getLCP.js.map +0 -1
  159. package/build/esm/metrics/web-vitals/lib/InteractionManager.js +0 -85
  160. package/build/esm/metrics/web-vitals/lib/InteractionManager.js.map +0 -1
  161. package/build/esm/metrics/web-vitals/lib/LCPEntryManager.js +0 -9
  162. package/build/esm/metrics/web-vitals/lib/LCPEntryManager.js.map +0 -1
  163. package/build/esm/metrics/web-vitals/lib/LayoutShiftManager.js +0 -25
  164. package/build/esm/metrics/web-vitals/lib/LayoutShiftManager.js.map +0 -1
  165. package/build/esm/metrics/web-vitals/lib/bindReporter.js +0 -29
  166. package/build/esm/metrics/web-vitals/lib/bindReporter.js.map +0 -1
  167. package/build/esm/metrics/web-vitals/lib/generateUniqueID.js +0 -6
  168. package/build/esm/metrics/web-vitals/lib/generateUniqueID.js.map +0 -1
  169. package/build/esm/metrics/web-vitals/lib/getActivationStart.js +0 -9
  170. package/build/esm/metrics/web-vitals/lib/getActivationStart.js.map +0 -1
  171. package/build/esm/metrics/web-vitals/lib/getNavigationEntry.js +0 -15
  172. package/build/esm/metrics/web-vitals/lib/getNavigationEntry.js.map +0 -1
  173. package/build/esm/metrics/web-vitals/lib/getVisibilityWatcher.js +0 -42
  174. package/build/esm/metrics/web-vitals/lib/getVisibilityWatcher.js.map +0 -1
  175. package/build/esm/metrics/web-vitals/lib/globalListeners.js +0 -15
  176. package/build/esm/metrics/web-vitals/lib/globalListeners.js.map +0 -1
  177. package/build/esm/metrics/web-vitals/lib/initMetric.js +0 -32
  178. package/build/esm/metrics/web-vitals/lib/initMetric.js.map +0 -1
  179. package/build/esm/metrics/web-vitals/lib/initUnique.js +0 -14
  180. package/build/esm/metrics/web-vitals/lib/initUnique.js.map +0 -1
  181. package/build/esm/metrics/web-vitals/lib/observe.js +0 -18
  182. package/build/esm/metrics/web-vitals/lib/observe.js.map +0 -1
  183. package/build/esm/metrics/web-vitals/lib/onHidden.js +0 -14
  184. package/build/esm/metrics/web-vitals/lib/onHidden.js.map +0 -1
  185. package/build/esm/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js +0 -29
  186. package/build/esm/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js.map +0 -1
  187. package/build/esm/metrics/web-vitals/lib/runOnce.js +0 -12
  188. package/build/esm/metrics/web-vitals/lib/runOnce.js.map +0 -1
  189. package/build/esm/metrics/web-vitals/lib/whenActivated.js +0 -12
  190. package/build/esm/metrics/web-vitals/lib/whenActivated.js.map +0 -1
  191. package/build/esm/metrics/web-vitals/lib/whenIdleOrHidden.js +0 -20
  192. package/build/esm/metrics/web-vitals/lib/whenIdleOrHidden.js.map +0 -1
  193. package/build/esm/metrics/web-vitals/onFCP.js +0 -34
  194. package/build/esm/metrics/web-vitals/onFCP.js.map +0 -1
  195. package/build/esm/metrics/web-vitals/onTTFB.js +0 -32
  196. package/build/esm/metrics/web-vitals/onTTFB.js.map +0 -1
  197. package/build/esm/metrics/webVitalSpans.js.map +0 -1
  198. package/build/types/instrument/dom.d.ts.map +0 -1
  199. package/build/types/instrument/history.d.ts.map +0 -1
  200. package/build/types/instrument/location.d.ts.map +0 -1
  201. package/build/types/instrument/xhr.d.ts.map +0 -1
  202. package/build/types/metrics/browserMetrics.d.ts.map +0 -1
  203. package/build/types/metrics/elementTiming.d.ts.map +0 -1
  204. package/build/types/metrics/inp.d.ts.map +0 -1
  205. package/build/types/metrics/instrument.d.ts.map +0 -1
  206. package/build/types/metrics/lcp.d.ts.map +0 -1
  207. package/build/types/metrics/resourceTiming.d.ts.map +0 -1
  208. package/build/types/metrics/userTiming.d.ts.map +0 -1
  209. package/build/types/metrics/utils.d.ts.map +0 -1
  210. package/build/types/metrics/web-vitals/getCLS.d.ts +0 -26
  211. package/build/types/metrics/web-vitals/getCLS.d.ts.map +0 -1
  212. package/build/types/metrics/web-vitals/getINP.d.ts +0 -34
  213. package/build/types/metrics/web-vitals/getINP.d.ts.map +0 -1
  214. package/build/types/metrics/web-vitals/getLCP.d.ts +0 -16
  215. package/build/types/metrics/web-vitals/getLCP.d.ts.map +0 -1
  216. package/build/types/metrics/web-vitals/lib/InteractionManager.d.ts +0 -37
  217. package/build/types/metrics/web-vitals/lib/InteractionManager.d.ts.map +0 -1
  218. package/build/types/metrics/web-vitals/lib/LCPEntryManager.d.ts +0 -5
  219. package/build/types/metrics/web-vitals/lib/LCPEntryManager.d.ts.map +0 -1
  220. package/build/types/metrics/web-vitals/lib/LayoutShiftManager.d.ts +0 -7
  221. package/build/types/metrics/web-vitals/lib/LayoutShiftManager.d.ts.map +0 -1
  222. package/build/types/metrics/web-vitals/lib/bindReporter.d.ts +0 -7
  223. package/build/types/metrics/web-vitals/lib/bindReporter.d.ts.map +0 -1
  224. package/build/types/metrics/web-vitals/lib/generateUniqueID.d.ts +0 -7
  225. package/build/types/metrics/web-vitals/lib/generateUniqueID.d.ts.map +0 -1
  226. package/build/types/metrics/web-vitals/lib/getActivationStart.d.ts +0 -2
  227. package/build/types/metrics/web-vitals/lib/getActivationStart.d.ts.map +0 -1
  228. package/build/types/metrics/web-vitals/lib/getNavigationEntry.d.ts +0 -2
  229. package/build/types/metrics/web-vitals/lib/getNavigationEntry.d.ts.map +0 -1
  230. package/build/types/metrics/web-vitals/lib/getVisibilityWatcher.d.ts +0 -5
  231. package/build/types/metrics/web-vitals/lib/getVisibilityWatcher.d.ts.map +0 -1
  232. package/build/types/metrics/web-vitals/lib/globalListeners.d.ts.map +0 -1
  233. package/build/types/metrics/web-vitals/lib/initMetric.d.ts +0 -21
  234. package/build/types/metrics/web-vitals/lib/initMetric.d.ts.map +0 -1
  235. package/build/types/metrics/web-vitals/lib/initUnique.d.ts +0 -7
  236. package/build/types/metrics/web-vitals/lib/initUnique.d.ts.map +0 -1
  237. package/build/types/metrics/web-vitals/lib/observe.d.ts +0 -23
  238. package/build/types/metrics/web-vitals/lib/observe.d.ts.map +0 -1
  239. package/build/types/metrics/web-vitals/lib/onHidden.d.ts +0 -15
  240. package/build/types/metrics/web-vitals/lib/onHidden.d.ts.map +0 -1
  241. package/build/types/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts +0 -15
  242. package/build/types/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts.map +0 -1
  243. package/build/types/metrics/web-vitals/lib/runOnce.d.ts +0 -2
  244. package/build/types/metrics/web-vitals/lib/runOnce.d.ts.map +0 -1
  245. package/build/types/metrics/web-vitals/lib/whenActivated.d.ts +0 -2
  246. package/build/types/metrics/web-vitals/lib/whenActivated.d.ts.map +0 -1
  247. package/build/types/metrics/web-vitals/lib/whenIdleOrHidden.d.ts +0 -6
  248. package/build/types/metrics/web-vitals/lib/whenIdleOrHidden.d.ts.map +0 -1
  249. package/build/types/metrics/web-vitals/onFCP.d.ts +0 -11
  250. package/build/types/metrics/web-vitals/onFCP.d.ts.map +0 -1
  251. package/build/types/metrics/web-vitals/onTTFB.d.ts +0 -20
  252. package/build/types/metrics/web-vitals/onTTFB.d.ts.map +0 -1
  253. package/build/types/metrics/web-vitals/types/base.d.ts +0 -103
  254. package/build/types/metrics/web-vitals/types/base.d.ts.map +0 -1
  255. package/build/types/metrics/web-vitals/types/cls.d.ts +0 -58
  256. package/build/types/metrics/web-vitals/types/cls.d.ts.map +0 -1
  257. package/build/types/metrics/web-vitals/types/fcp.d.ts +0 -47
  258. package/build/types/metrics/web-vitals/types/fcp.d.ts.map +0 -1
  259. package/build/types/metrics/web-vitals/types/inp.d.ts +0 -150
  260. package/build/types/metrics/web-vitals/types/inp.d.ts.map +0 -1
  261. package/build/types/metrics/web-vitals/types/lcp.d.ts +0 -74
  262. package/build/types/metrics/web-vitals/types/lcp.d.ts.map +0 -1
  263. package/build/types/metrics/web-vitals/types/ttfb.d.ts +0 -60
  264. package/build/types/metrics/web-vitals/types/ttfb.d.ts.map +0 -1
  265. package/build/types/metrics/web-vitals/types.d.ts +0 -78
  266. package/build/types/metrics/web-vitals/types.d.ts.map +0 -1
  267. package/build/types/metrics/webVitalSpans.d.ts.map +0 -1
  268. /package/build/cjs/{instrument → instrumentation}/dom.js +0 -0
  269. /package/build/cjs/{instrument → instrumentation}/history.js +0 -0
  270. /package/build/cjs/{instrument → instrumentation}/location.js +0 -0
  271. /package/build/cjs/{instrument → instrumentation}/xhr.js +0 -0
  272. /package/build/cjs/{metrics → performance}/resourceTiming.js +0 -0
  273. /package/build/cjs/{metrics → web-vitals}/lcp.js +0 -0
  274. /package/build/esm/{instrument → instrumentation}/dom.js +0 -0
  275. /package/build/esm/{instrument → instrumentation}/history.js +0 -0
  276. /package/build/esm/{instrument → instrumentation}/location.js +0 -0
  277. /package/build/esm/{instrument → instrumentation}/xhr.js +0 -0
  278. /package/build/esm/{metrics → performance}/resourceTiming.js +0 -0
  279. /package/build/esm/{metrics → web-vitals}/lcp.js +0 -0
  280. /package/build/types/{instrument → instrumentation}/dom.d.ts +0 -0
  281. /package/build/types/{instrument → instrumentation}/history.d.ts +0 -0
  282. /package/build/types/{instrument → instrumentation}/location.d.ts +0 -0
  283. /package/build/types/{instrument → instrumentation}/xhr.d.ts +0 -0
  284. /package/build/types/{metrics → performance}/elementTiming.d.ts +0 -0
  285. /package/build/types/{metrics → performance}/resourceTiming.d.ts +0 -0
  286. /package/build/types/{metrics → performance}/userTiming.d.ts +0 -0
  287. /package/build/types/{metrics → web-vitals}/inp.d.ts +0 -0
  288. /package/build/types/{metrics → web-vitals}/lcp.d.ts +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"userTiming.js","sources":["../../../src/metrics/userTiming.ts"],"sourcesContent":["import { SENTRY_ORIGIN } from '@sentry/conventions/attributes';\nimport type { IntegrationFn, Span, SpanAttributes, SpanAttributeValue } from '@sentry/core';\nimport {\n browserPerformanceTimeOrigin,\n defineIntegration,\n isPrimitive,\n spanToJSON,\n stringMatchesSomePattern,\n} from '@sentry/core';\nimport { getBrowserPerformanceAPI, msToSec, startAndEndSpan } from './utils';\nimport { getNavigationEntry } from './web-vitals/lib/getNavigationEntry';\n\ninterface UserTimingOptions {\n /**\n * User Timing entries with names matching any of these strings or regular expressions will not be emitted.\n *\n * Default: []\n */\n ignore?: Array<string | RegExp>;\n}\n\nconst INTEGRATION_NAME = 'UserTiming';\n\nconst _userTimingIntegration = ((options: UserTimingOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n const performance = getBrowserPerformanceAPI();\n const timeOrigin = browserPerformanceTimeOrigin();\n if (!performance?.getEntries || !timeOrigin) {\n return;\n }\n const timeOriginInSeconds = msToSec(timeOrigin);\n let performanceCursor = 0;\n\n client.on('beforeIdleSpanEnd', idleSpan => {\n const { op: parentOp, start_timestamp: parentStartTimestamp } = spanToJSON(idleSpan);\n if (parentOp !== 'pageload' && parentOp !== 'navigation') {\n return;\n }\n\n const requestTime = msToSec(getNavigationEntry(false)?.requestStart ?? 0);\n const performanceEntries = performance.getEntries();\n\n for (const entry of performanceEntries.slice(performanceCursor)) {\n if (entry.entryType !== 'mark' && entry.entryType !== 'measure') {\n continue;\n }\n\n const startTime = msToSec(entry.startTime);\n const absoluteStartTime = timeOriginInSeconds + startTime;\n\n if (parentOp === 'navigation' && parentStartTimestamp && absoluteStartTime < parentStartTimestamp) {\n continue;\n }\n\n _addUserTimingSpan(\n idleSpan,\n entry,\n startTime,\n msToSec(Math.max(0, entry.duration)),\n timeOriginInSeconds,\n requestTime,\n options.ignore ?? [],\n );\n }\n\n performanceCursor = performanceEntries.length;\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Captures spans created with the browser's User Timing APIs, `performance.mark` and `performance.measure`.\n *\n * The integration must be explicitly added to `Sentry.init`. Entries are attached to the active pageload or\n * navigation span when it ends.\n *\n * @example\n * ```ts\n * Sentry.init({\n * integrations: [\n * Sentry.browserTracingIntegration(),\n * Sentry.userTimingIntegration({\n * ignore: ['third-party-mark', /framework-measure/],\n * }),\n * ],\n * });\n * ```\n */\nexport const userTimingIntegration = defineIntegration(_userTimingIntegration);\n\n/**\n * Creates a span for a browser User Timing entry.\n * Exported only for tests.\n */\nexport function _addUserTimingSpan(\n parentSpan: Span,\n entry: PerformanceEntry,\n startTime: number,\n duration: number,\n timeOrigin: number,\n requestTime: number,\n ignore: Array<string | RegExp>,\n): void {\n if (isReact19MeasureEntry(entry) || stringMatchesSomePattern(entry.name, ignore)) {\n return;\n }\n\n // Measures can reference arbitrary timestamps, including timestamps before the page request started.\n const spanStartTimestamp = timeOrigin + Math.max(startTime, requestTime);\n const originalStartTimestamp = timeOrigin + startTime;\n const spanEndTimestamp = originalStartTimestamp + duration;\n\n const attributes: SpanAttributes = {\n [SENTRY_ORIGIN]: `auto.browser.user_timing.${entry.entryType}`,\n };\n\n if (spanStartTimestamp !== originalStartTimestamp) {\n attributes['sentry.browser.measure_happened_before_request'] = true;\n attributes['sentry.browser.measure_start_time'] = spanStartTimestamp;\n }\n\n addDetailToSpanAttributes(attributes, entry as PerformanceMeasure);\n\n // Third-party measurements can contain timestamps which would produce invalid spans.\n if (spanStartTimestamp <= spanEndTimestamp) {\n startAndEndSpan(parentSpan, spanStartTimestamp, spanEndTimestamp, {\n name: entry.name,\n op: entry.entryType,\n attributes,\n });\n }\n}\n\n/**\n * React 19.2+ creates performance.measure entries for component renders.\n * We can identify them by the `detail.devtools.track` property being set to 'Components ⚛'.\n * See https://react.dev/reference/dev-tools/react-performance-tracks.\n */\nfunction isReact19MeasureEntry(entry: PerformanceEntry): boolean | void {\n if (entry.entryType !== 'measure') {\n return;\n }\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return (entry as PerformanceMeasure).detail.devtools.track === 'Components ⚛';\n } catch {\n return;\n }\n}\n\nfunction addDetailToSpanAttributes(attributes: SpanAttributes, entry: PerformanceMeasure): void {\n try {\n // Accessing detail can throw in some browsers due to security restrictions.\n const detail = entry.detail;\n if (!detail) {\n return;\n }\n\n if (typeof detail === 'object') {\n for (const [key, value] of Object.entries(detail)) {\n if (value && isPrimitive(value)) {\n attributes[`sentry.browser.measure.detail.${key}`] = value as SpanAttributeValue;\n } else if (value !== undefined) {\n try {\n attributes[`sentry.browser.measure.detail.${key}`] = JSON.stringify(value);\n } catch {\n // User-provided detail values are not guaranteed to be serializable.\n }\n }\n }\n return;\n }\n\n if (isPrimitive(detail)) {\n attributes['sentry.browser.measure.detail'] = detail as SpanAttributeValue;\n return;\n }\n\n try {\n attributes['sentry.browser.measure.detail'] = JSON.stringify(detail);\n } catch {\n // User-provided detail values are not guaranteed to be serializable.\n }\n } catch {\n // Accessing detail can throw in some browsers due to security restrictions.\n }\n}\n"],"names":["getBrowserPerformanceAPI","browserPerformanceTimeOrigin","msToSec","spanToJSON","getNavigationEntry","defineIntegration","stringMatchesSomePattern","attributes","SENTRY_ORIGIN","startAndEndSpan","isPrimitive"],"mappings":"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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/metrics/utils.ts"],"sourcesContent":["import type { Client, SentrySpan, Span, SpanTimeInput, StartSpanOptions } from '@sentry/core';\nimport { spanToJSON, startInactiveSpan, withActiveSpan } from '@sentry/core';\nimport { WINDOW } from '../types';\nimport { onHidden } from './web-vitals/lib/onHidden';\n\nexport type WebVitalReportEvent = 'pagehide' | 'navigation';\n\n/**\n * Checks if a given value is a valid measurement value.\n */\nexport function isMeasurementValue(value: unknown): value is number {\n return typeof value === 'number' && isFinite(value);\n}\n\n/**\n * Helper function to start child on transactions. This function will make sure that the transaction will\n * use the start timestamp of the created child span if it is earlier than the transactions actual\n * start timestamp.\n */\nexport function startAndEndSpan(\n parentSpan: Span,\n startTimeInSeconds: number,\n endTime: SpanTimeInput,\n { ...ctx }: StartSpanOptions,\n): Span | undefined {\n const parentStartTime = spanToJSON(parentSpan).start_timestamp;\n if (parentStartTime && parentStartTime > startTimeInSeconds) {\n // We can only do this for SentrySpans...\n if (typeof (parentSpan as Partial<SentrySpan>).updateStartTime === 'function') {\n (parentSpan as SentrySpan).updateStartTime(startTimeInSeconds);\n }\n }\n\n // The return value only exists for tests\n return withActiveSpan(parentSpan, () => {\n const span = startInactiveSpan({\n startTime: startTimeInSeconds,\n ...ctx,\n });\n\n if (span) {\n span.end(endTime);\n }\n\n return span;\n });\n}\n\n/** Get the browser performance API. */\nexport function getBrowserPerformanceAPI(): Performance | undefined {\n // @ts-expect-error we want to make sure all of these are available, even if TS is sure they are\n return WINDOW.addEventListener && WINDOW.performance;\n}\n\n/**\n * Converts from milliseconds to seconds\n * @param time time in ms\n */\nexport function msToSec(time: number): number {\n return time / 1000;\n}\n\n/**\n * Converts ALPN protocol ids to name and version.\n *\n * (https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids)\n * @param nextHopProtocol PerformanceResourceTiming.nextHopProtocol\n */\nexport function extractNetworkProtocol(nextHopProtocol: string): { name: string; version: string } {\n let name = 'unknown';\n let version = 'unknown';\n let _name = '';\n for (const char of nextHopProtocol) {\n // http/1.1 etc.\n if (char === '/') {\n [name, version] = nextHopProtocol.split('/') as [string, string];\n break;\n }\n // h2, h3 etc.\n if (!isNaN(Number(char))) {\n name = _name === 'h' ? 'http' : _name;\n version = nextHopProtocol.split(_name)[1] as string;\n break;\n }\n _name += char;\n }\n if (_name === nextHopProtocol) {\n // webrtc, ftp, etc.\n name = _name;\n }\n return { name, version };\n}\n\n/**\n * Generic support check for web vitals\n */\nexport function supportsWebVital(entryType: 'layout-shift' | 'largest-contentful-paint'): boolean {\n try {\n return PerformanceObserver.supportedEntryTypes.includes(entryType);\n } catch {\n return false;\n }\n}\n\n/**\n * Listens for events on which we want to collect a previously accumulated web vital value.\n * Currently, this includes:\n *\n * - pagehide (i.e. user minimizes browser window, hides tab, etc)\n * - soft navigation (we only care about the vital of the initially loaded route)\n *\n * As a \"side-effect\", this function will also collect the span id of the pageload span.\n *\n * @param collectorCallback the callback to be called when the first of these events is triggered. Parameters:\n * - event: the event that triggered the reporting of the web vital value.\n * - pageloadSpanId: the span id of the pageload span. This is used to link the web vital span to the pageload span.\n * - pageloadSpan: the pageload span instance. This is used for full access to the pageload span for span streaming.\n */\nexport function listenForWebVitalReportEvents(\n client: Client,\n collectorCallback: (event: WebVitalReportEvent, pageloadSpanId: string, pageloadSpan?: Span) => void,\n) {\n let pageloadSpan: Span | undefined;\n\n let collected = false;\n function _runCollectorCallbackOnce(event: WebVitalReportEvent) {\n if (!collected && pageloadSpan) {\n collectorCallback(event, pageloadSpan.spanContext().spanId, pageloadSpan);\n }\n collected = true;\n }\n\n // eslint-disable-next-line typescript/no-deprecated\n onHidden(() => {\n _runCollectorCallbackOnce('pagehide');\n });\n\n const unsubscribeStartNavigation = client.on('beforeStartNavigationSpan', (_, options) => {\n // we only want to collect LCP if we actually navigate. Redirects should be ignored.\n if (!options?.isRedirect) {\n _runCollectorCallbackOnce('navigation');\n unsubscribeStartNavigation();\n unsubscribeAfterStartPageLoadSpan();\n }\n });\n\n const unsubscribeAfterStartPageLoadSpan = client.on('afterStartPageLoadSpan', span => {\n pageloadSpan = span;\n unsubscribeAfterStartPageLoadSpan();\n });\n}\n"],"names":["spanToJSON","withActiveSpan","startInactiveSpan","WINDOW","onHidden"],"mappings":";;;;;;AAUO,SAAS,mBAAmB,KAAA,EAAiC;AAClE,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,QAAA,CAAS,KAAK,CAAA;AACpD;AAOO,SAAS,gBACd,UAAA,EACA,kBAAA,EACA,SACA,EAAE,GAAG,KAAI,EACS;AAClB,EAAA,MAAM,eAAA,GAAkBA,eAAA,CAAW,UAAU,CAAA,CAAE,eAAA;AAC/C,EAAA,IAAI,eAAA,IAAmB,kBAAkB,kBAAA,EAAoB;AAE3D,IAAA,IAAI,OAAQ,UAAA,CAAmC,eAAA,KAAoB,UAAA,EAAY;AAC7E,MAAC,UAAA,CAA0B,gBAAgB,kBAAkB,CAAA;AAAA,IAC/D;AAAA,EACF;AAGA,EAAA,OAAOC,mBAAA,CAAe,YAAY,MAAM;AACtC,IAAA,MAAM,OAAOC,sBAAA,CAAkB;AAAA,MAC7B,SAAA,EAAW,kBAAA;AAAA,MACX,GAAG;AAAA,KACJ,CAAA;AAED,IAAA,IAAI,IAAA,EAAM;AACR,MAAA,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,IAClB;AAEA,IAAA,OAAO,IAAA;AAAA,EACT,CAAC,CAAA;AACH;AAGO,SAAS,wBAAA,GAAoD;AAElE,EAAA,OAAOC,YAAA,CAAO,oBAAoBA,YAAA,CAAO,WAAA;AAC3C;AAMO,SAAS,QAAQ,IAAA,EAAsB;AAC5C,EAAA,OAAO,IAAA,GAAO,GAAA;AAChB;AAQO,SAAS,uBAAuB,eAAA,EAA4D;AACjG,EAAA,IAAI,IAAA,GAAO,SAAA;AACX,EAAA,IAAI,OAAA,GAAU,SAAA;AACd,EAAA,IAAI,KAAA,GAAQ,EAAA;AACZ,EAAA,KAAA,MAAW,QAAQ,eAAA,EAAiB;AAElC,IAAA,IAAI,SAAS,GAAA,EAAK;AAChB,MAAA,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,eAAA,CAAgB,MAAM,GAAG,CAAA;AAC3C,MAAA;AAAA,IACF;AAEA,IAAA,IAAI,CAAC,KAAA,CAAM,MAAA,CAAO,IAAI,CAAC,CAAA,EAAG;AACxB,MAAA,IAAA,GAAO,KAAA,KAAU,MAAM,MAAA,GAAS,KAAA;AAChC,MAAA,OAAA,GAAU,eAAA,CAAgB,KAAA,CAAM,KAAK,CAAA,CAAE,CAAC,CAAA;AACxC,MAAA;AAAA,IACF;AACA,IAAA,KAAA,IAAS,IAAA;AAAA,EACX;AACA,EAAA,IAAI,UAAU,eAAA,EAAiB;AAE7B,IAAA,IAAA,GAAO,KAAA;AAAA,EACT;AACA,EAAA,OAAO,EAAE,MAAM,OAAA,EAAQ;AACzB;AAKO,SAAS,iBAAiB,SAAA,EAAiE;AAChG,EAAA,IAAI;AACF,IAAA,OAAO,mBAAA,CAAoB,mBAAA,CAAoB,QAAA,CAAS,SAAS,CAAA;AAAA,EACnE,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;AAgBO,SAAS,6BAAA,CACd,QACA,iBAAA,EACA;AACA,EAAA,IAAI,YAAA;AAEJ,EAAA,IAAI,SAAA,GAAY,KAAA;AAChB,EAAA,SAAS,0BAA0B,KAAA,EAA4B;AAC7D,IAAA,IAAI,CAAC,aAAa,YAAA,EAAc;AAC9B,MAAA,iBAAA,CAAkB,KAAA,EAAO,YAAA,CAAa,WAAA,EAAY,CAAE,QAAQ,YAAY,CAAA;AAAA,IAC1E;AACA,IAAA,SAAA,GAAY,IAAA;AAAA,EACd;AAGA,EAAAC,iBAAA,CAAS,MAAM;AACb,IAAA,yBAAA,CAA0B,UAAU,CAAA;AAAA,EACtC,CAAC,CAAA;AAED,EAAA,MAAM,6BAA6B,MAAA,CAAO,EAAA,CAAG,2BAAA,EAA6B,CAAC,GAAG,OAAA,KAAY;AAExF,IAAA,IAAI,CAAC,SAAS,UAAA,EAAY;AACxB,MAAA,yBAAA,CAA0B,YAAY,CAAA;AACtC,MAAA,0BAAA,EAA2B;AAC3B,MAAA,iCAAA,EAAkC;AAAA,IACpC;AAAA,EACF,CAAC,CAAA;AAED,EAAA,MAAM,iCAAA,GAAoC,MAAA,CAAO,EAAA,CAAG,wBAAA,EAA0B,CAAA,IAAA,KAAQ;AACpF,IAAA,YAAA,GAAe,IAAA;AACf,IAAA,iCAAA,EAAkC;AAAA,EACpC,CAAC,CAAA;AACH;;;;;;;;;;"}
@@ -1,46 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const types = require('../../types.js');
4
- const bindReporter = require('./lib/bindReporter.js');
5
- const getVisibilityWatcher = require('./lib/getVisibilityWatcher.js');
6
- const initMetric = require('./lib/initMetric.js');
7
- const initUnique = require('./lib/initUnique.js');
8
- const LayoutShiftManager = require('./lib/LayoutShiftManager.js');
9
- const observe = require('./lib/observe.js');
10
- const runOnce = require('./lib/runOnce.js');
11
- const onFCP = require('./onFCP.js');
12
-
13
- const CLSThresholds = [0.1, 0.25];
14
- const onCLS = (onReport, opts = {}) => {
15
- onFCP.onFCP(
16
- runOnce.runOnce(() => {
17
- const metric = initMetric.initMetric("CLS", 0);
18
- let report;
19
- const visibilityWatcher = getVisibilityWatcher.getVisibilityWatcher();
20
- const layoutShiftManager = initUnique.initUnique(opts, LayoutShiftManager.LayoutShiftManager);
21
- const handleEntries = (entries) => {
22
- for (const entry of entries) {
23
- layoutShiftManager._processEntry(entry);
24
- }
25
- if (layoutShiftManager._sessionValue > metric.value) {
26
- metric.value = layoutShiftManager._sessionValue;
27
- metric.entries = layoutShiftManager._sessionEntries;
28
- report();
29
- }
30
- };
31
- const po = observe.observe("layout-shift", handleEntries);
32
- if (po) {
33
- report = bindReporter.bindReporter(onReport, metric, CLSThresholds, opts.reportAllChanges);
34
- visibilityWatcher.onHidden(() => {
35
- handleEntries(po.takeRecords());
36
- report(true);
37
- });
38
- types.WINDOW?.setTimeout?.(report);
39
- }
40
- })
41
- );
42
- };
43
-
44
- exports.CLSThresholds = CLSThresholds;
45
- exports.onCLS = onCLS;
46
- //# sourceMappingURL=getCLS.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getCLS.js","sources":["../../../../src/metrics/web-vitals/getCLS.ts"],"sourcesContent":["/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WINDOW } from '../../types';\nimport { bindReporter } from './lib/bindReporter';\nimport { getVisibilityWatcher } from './lib/getVisibilityWatcher';\nimport { initMetric } from './lib/initMetric';\nimport { initUnique } from './lib/initUnique';\nimport { LayoutShiftManager } from './lib/LayoutShiftManager';\nimport { observe } from './lib/observe';\nimport { runOnce } from './lib/runOnce';\nimport { onFCP } from './onFCP';\nimport type { CLSMetric, MetricRatingThresholds, ReportOpts } from './types';\n\n/** Thresholds for CLS. See https://web.dev/articles/cls#what_is_a_good_cls_score */\nexport const CLSThresholds: MetricRatingThresholds = [0.1, 0.25];\n\n/**\n * Calculates the [CLS](https://web.dev/articles/cls) value for the current page and\n * calls the `callback` function once the value is ready to be reported, along\n * with all `layout-shift` performance entries that were used in the metric\n * value calculation. The reported value is a `double` (corresponding to a\n * [layout shift score](https://web.dev/articles/cls#layout_shift_score)).\n *\n * If the `reportAllChanges` configuration option is set to `true`, the\n * `callback` function will be called as soon as the value is initially\n * determined as well as any time the value changes throughout the page\n * lifespan.\n *\n * _**Important:** CLS should be continually monitored for changes throughout\n * the entire lifespan of a page—including if the user returns to the page after\n * it's been hidden/backgrounded. However, since browsers often [will not fire\n * additional callbacks once the user has backgrounded a\n * page](https://developer.chrome.com/blog/page-lifecycle-api/#advice-hidden),\n * `callback` is always called when the page's visibility state changes to\n * hidden. As a result, the `callback` function might be called multiple times\n * during the same page load._\n */\nexport const onCLS = (onReport: (metric: CLSMetric) => void, opts: ReportOpts = {}) => {\n // Start monitoring FCP so we can only report CLS if FCP is also reported.\n // Note: this is done to match the current behavior of CrUX.\n onFCP(\n runOnce(() => {\n const metric = initMetric('CLS', 0);\n let report: ReturnType<typeof bindReporter>;\n const visibilityWatcher = getVisibilityWatcher();\n\n const layoutShiftManager = initUnique(opts, LayoutShiftManager);\n\n const handleEntries = (entries: LayoutShift[]) => {\n for (const entry of entries) {\n layoutShiftManager._processEntry(entry);\n }\n\n // If the current session value is larger than the current CLS value,\n // update CLS and the entries contributing to it.\n if (layoutShiftManager._sessionValue > metric.value) {\n metric.value = layoutShiftManager._sessionValue;\n metric.entries = layoutShiftManager._sessionEntries;\n report();\n }\n };\n\n const po = observe('layout-shift', handleEntries);\n if (po) {\n report = bindReporter(onReport, metric, CLSThresholds, opts.reportAllChanges);\n\n visibilityWatcher.onHidden(() => {\n handleEntries(po.takeRecords() as CLSMetric['entries']);\n report(true);\n });\n\n // Queue a task to report (if nothing else triggers a report first).\n // This allows CLS to be reported as soon as FCP fires when\n // `reportAllChanges` is true.\n WINDOW?.setTimeout?.(report);\n }\n }),\n );\n};\n"],"names":["onFCP","runOnce","initMetric","getVisibilityWatcher","initUnique","LayoutShiftManager","observe","bindReporter","WINDOW"],"mappings":";;;;;;;;;;;;AA4BO,MAAM,aAAA,GAAwC,CAAC,GAAA,EAAK,IAAI;AAuBxD,MAAM,KAAA,GAAQ,CAAC,QAAA,EAAuC,IAAA,GAAmB,EAAC,KAAM;AAGrF,EAAAA,WAAA;AAAA,IACEC,gBAAQ,MAAM;AACZ,MAAA,MAAM,MAAA,GAASC,qBAAA,CAAW,KAAA,EAAO,CAAC,CAAA;AAClC,MAAA,IAAI,MAAA;AACJ,MAAA,MAAM,oBAAoBC,yCAAA,EAAqB;AAE/C,MAAA,MAAM,kBAAA,GAAqBC,qBAAA,CAAW,IAAA,EAAMC,qCAAkB,CAAA;AAE9D,MAAA,MAAM,aAAA,GAAgB,CAAC,OAAA,KAA2B;AAChD,QAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC3B,UAAA,kBAAA,CAAmB,cAAc,KAAK,CAAA;AAAA,QACxC;AAIA,QAAA,IAAI,kBAAA,CAAmB,aAAA,GAAgB,MAAA,CAAO,KAAA,EAAO;AACnD,UAAA,MAAA,CAAO,QAAQ,kBAAA,CAAmB,aAAA;AAClC,UAAA,MAAA,CAAO,UAAU,kBAAA,CAAmB,eAAA;AACpC,UAAA,MAAA,EAAO;AAAA,QACT;AAAA,MACF,CAAA;AAEA,MAAA,MAAM,EAAA,GAAKC,eAAA,CAAQ,cAAA,EAAgB,aAAa,CAAA;AAChD,MAAA,IAAI,EAAA,EAAI;AACN,QAAA,MAAA,GAASC,yBAAA,CAAa,QAAA,EAAU,MAAA,EAAQ,aAAA,EAAe,KAAK,gBAAgB,CAAA;AAE5E,QAAA,iBAAA,CAAkB,SAAS,MAAM;AAC/B,UAAA,aAAA,CAAc,EAAA,CAAG,aAAqC,CAAA;AACtD,UAAA,MAAA,CAAO,IAAI,CAAA;AAAA,QACb,CAAC,CAAA;AAKD,QAAAC,YAAA,EAAQ,aAAa,MAAM,CAAA;AAAA,MAC7B;AAAA,IACF,CAAC;AAAA,GACH;AACF;;;;;"}
@@ -1,60 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const bindReporter = require('./lib/bindReporter.js');
4
- const getVisibilityWatcher = require('./lib/getVisibilityWatcher.js');
5
- const initMetric = require('./lib/initMetric.js');
6
- const initUnique = require('./lib/initUnique.js');
7
- const InteractionManager = require('./lib/InteractionManager.js');
8
- const observe = require('./lib/observe.js');
9
- const interactionCountPolyfill = require('./lib/polyfills/interactionCountPolyfill.js');
10
- const whenActivated = require('./lib/whenActivated.js');
11
- const whenIdleOrHidden = require('./lib/whenIdleOrHidden.js');
12
-
13
- const INPThresholds = [200, 500];
14
- const DEFAULT_DURATION_THRESHOLD = 40;
15
- const onINP = (onReport, opts = {}) => {
16
- if (!(globalThis.PerformanceEventTiming && "interactionId" in PerformanceEventTiming.prototype)) {
17
- return;
18
- }
19
- const visibilityWatcher = getVisibilityWatcher.getVisibilityWatcher();
20
- whenActivated.whenActivated(() => {
21
- interactionCountPolyfill.initInteractionCountPolyfill();
22
- const metric = initMetric.initMetric("INP");
23
- let report;
24
- const interactionManager = initUnique.initUnique(opts, InteractionManager.InteractionManager);
25
- const handleEntries = (entries) => {
26
- whenIdleOrHidden.whenIdleOrHidden(() => {
27
- for (const entry of entries) {
28
- interactionManager._processEntry(entry);
29
- }
30
- const inp = interactionManager._estimateP98LongestInteraction();
31
- if (inp && inp._latency !== metric.value) {
32
- metric.value = inp._latency;
33
- metric.entries = inp.entries;
34
- report();
35
- }
36
- });
37
- };
38
- const po = observe.observe("event", handleEntries, {
39
- // Event Timing entries have their durations rounded to the nearest 8ms,
40
- // so a duration of 40ms would be any event that spans 2.5 or more frames
41
- // at 60Hz. This threshold is chosen to strike a balance between usefulness
42
- // and performance. Running this callback for any interaction that spans
43
- // just one or two frames is likely not worth the insight that could be
44
- // gained.
45
- durationThreshold: opts.durationThreshold ?? DEFAULT_DURATION_THRESHOLD
46
- });
47
- report = bindReporter.bindReporter(onReport, metric, INPThresholds, opts.reportAllChanges);
48
- if (po) {
49
- po.observe({ type: "first-input", buffered: true });
50
- visibilityWatcher.onHidden(() => {
51
- handleEntries(po.takeRecords());
52
- report(true);
53
- });
54
- }
55
- });
56
- };
57
-
58
- exports.INPThresholds = INPThresholds;
59
- exports.onINP = onINP;
60
- //# sourceMappingURL=getINP.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getINP.js","sources":["../../../../src/metrics/web-vitals/getINP.ts"],"sourcesContent":["/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { bindReporter } from './lib/bindReporter';\nimport { getVisibilityWatcher } from './lib/getVisibilityWatcher';\nimport { initMetric } from './lib/initMetric';\nimport { initUnique } from './lib/initUnique';\nimport { InteractionManager } from './lib/InteractionManager';\nimport { observe } from './lib/observe';\nimport { initInteractionCountPolyfill } from './lib/polyfills/interactionCountPolyfill';\nimport { whenActivated } from './lib/whenActivated';\nimport { whenIdleOrHidden } from './lib/whenIdleOrHidden';\nimport type { INPMetric, INPReportOpts, MetricRatingThresholds } from './types';\n\n/** Thresholds for INP. See https://web.dev/articles/inp#what_is_a_good_inp_score */\nexport const INPThresholds: MetricRatingThresholds = [200, 500];\n\n// The default `durationThreshold` used across this library for observing\n// `event` entries via PerformanceObserver.\nconst DEFAULT_DURATION_THRESHOLD = 40;\n\n/**\n * Calculates the [INP](https://web.dev/articles/inp) value for the current\n * page and calls the `callback` function once the value is ready, along with\n * the `event` performance entries reported for that interaction. The reported\n * value is a `DOMHighResTimeStamp`.\n *\n * A custom `durationThreshold` configuration option can optionally be passed\n * to control what `event-timing` entries are considered for INP reporting. The\n * default threshold is `40`, which means INP scores of less than 40 will not\n * be reported. To avoid reporting no interactions in these cases, the library\n * will fall back to the input delay of the first interaction. Note that this\n * will not affect your 75th percentile INP value unless that value is also\n * less than 40 (well below the recommended\n * [good](https://web.dev/articles/inp#what_is_a_good_inp_score) threshold).\n *\n * If the `reportAllChanges` configuration option is set to `true`, the\n * `callback` function will be called as soon as the value is initially\n * determined as well as any time the value changes throughout the page\n * lifespan.\n *\n * _**Important:** INP should be continually monitored for changes throughout\n * the entire lifespan of a page—including if the user returns to the page after\n * it's been hidden/backgrounded. However, since browsers often [will not fire\n * additional callbacks once the user has backgrounded a\n * page](https://developer.chrome.com/blog/page-lifecycle-api/#advice-hidden),\n * `callback` is always called when the page's visibility state changes to\n * hidden. As a result, the `callback` function might be called multiple times\n * during the same page load._\n */\nexport const onINP = (onReport: (metric: INPMetric) => void, opts: INPReportOpts = {}) => {\n // Return if the browser doesn't support all APIs needed to measure INP.\n if (!(globalThis.PerformanceEventTiming && 'interactionId' in PerformanceEventTiming.prototype)) {\n return;\n }\n\n const visibilityWatcher = getVisibilityWatcher();\n\n whenActivated(() => {\n // TODO(philipwalton): remove once the polyfill is no longer needed.\n initInteractionCountPolyfill();\n\n const metric = initMetric('INP');\n // eslint-disable-next-line prefer-const\n let report: ReturnType<typeof bindReporter>;\n\n const interactionManager = initUnique(opts, InteractionManager);\n\n const handleEntries = (entries: INPMetric['entries']) => {\n // Queue the `handleEntries()` callback in the next idle task.\n // This is needed to increase the chances that all event entries that\n // occurred between the user interaction and the next paint\n // have been dispatched. Note: there is currently an experiment\n // running in Chrome (EventTimingKeypressAndCompositionInteractionId)\n // 123+ that if rolled out fully may make this no longer necessary.\n whenIdleOrHidden(() => {\n for (const entry of entries) {\n interactionManager._processEntry(entry);\n }\n\n const inp = interactionManager._estimateP98LongestInteraction();\n\n if (inp && inp._latency !== metric.value) {\n metric.value = inp._latency;\n metric.entries = inp.entries;\n report();\n }\n });\n };\n\n const po = observe('event', handleEntries, {\n // Event Timing entries have their durations rounded to the nearest 8ms,\n // so a duration of 40ms would be any event that spans 2.5 or more frames\n // at 60Hz. This threshold is chosen to strike a balance between usefulness\n // and performance. Running this callback for any interaction that spans\n // just one or two frames is likely not worth the insight that could be\n // gained.\n durationThreshold: opts.durationThreshold ?? DEFAULT_DURATION_THRESHOLD,\n });\n\n report = bindReporter(onReport, metric, INPThresholds, opts.reportAllChanges);\n\n if (po) {\n // Also observe entries of type `first-input`. This is useful in cases\n // where the first interaction is less than the `durationThreshold`.\n po.observe({ type: 'first-input', buffered: true });\n\n visibilityWatcher.onHidden(() => {\n handleEntries(po.takeRecords() as INPMetric['entries']);\n report(true);\n });\n }\n });\n};\n"],"names":["getVisibilityWatcher","whenActivated","initInteractionCountPolyfill","initMetric","initUnique","InteractionManager","whenIdleOrHidden","observe","bindReporter"],"mappings":";;;;;;;;;;;;AA4BO,MAAM,aAAA,GAAwC,CAAC,GAAA,EAAK,GAAG;AAI9D,MAAM,0BAAA,GAA6B,EAAA;AA+B5B,MAAM,KAAA,GAAQ,CAAC,QAAA,EAAuC,IAAA,GAAsB,EAAC,KAAM;AAExF,EAAA,IAAI,EAAE,UAAA,CAAW,sBAAA,IAA0B,eAAA,IAAmB,uBAAuB,SAAA,CAAA,EAAY;AAC/F,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,oBAAoBA,yCAAA,EAAqB;AAE/C,EAAAC,2BAAA,CAAc,MAAM;AAElB,IAAAC,qDAAA,EAA6B;AAE7B,IAAA,MAAM,MAAA,GAASC,sBAAW,KAAK,CAAA;AAE/B,IAAA,IAAI,MAAA;AAEJ,IAAA,MAAM,kBAAA,GAAqBC,qBAAA,CAAW,IAAA,EAAMC,qCAAkB,CAAA;AAE9D,IAAA,MAAM,aAAA,GAAgB,CAAC,OAAA,KAAkC;AAOvD,MAAAC,iCAAA,CAAiB,MAAM;AACrB,QAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC3B,UAAA,kBAAA,CAAmB,cAAc,KAAK,CAAA;AAAA,QACxC;AAEA,QAAA,MAAM,GAAA,GAAM,mBAAmB,8BAAA,EAA+B;AAE9D,QAAA,IAAI,GAAA,IAAO,GAAA,CAAI,QAAA,KAAa,MAAA,CAAO,KAAA,EAAO;AACxC,UAAA,MAAA,CAAO,QAAQ,GAAA,CAAI,QAAA;AACnB,UAAA,MAAA,CAAO,UAAU,GAAA,CAAI,OAAA;AACrB,UAAA,MAAA,EAAO;AAAA,QACT;AAAA,MACF,CAAC,CAAA;AAAA,IACH,CAAA;AAEA,IAAA,MAAM,EAAA,GAAKC,eAAA,CAAQ,OAAA,EAAS,aAAA,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOzC,iBAAA,EAAmB,KAAK,iBAAA,IAAqB;AAAA,KAC9C,CAAA;AAED,IAAA,MAAA,GAASC,yBAAA,CAAa,QAAA,EAAU,MAAA,EAAQ,aAAA,EAAe,KAAK,gBAAgB,CAAA;AAE5E,IAAA,IAAI,EAAA,EAAI;AAGN,MAAA,EAAA,CAAG,QAAQ,EAAE,IAAA,EAAM,aAAA,EAAe,QAAA,EAAU,MAAM,CAAA;AAElD,MAAA,iBAAA,CAAkB,SAAS,MAAM;AAC/B,QAAA,aAAA,CAAc,EAAA,CAAG,aAAqC,CAAA;AACtD,QAAA,MAAA,CAAO,IAAI,CAAA;AAAA,MACb,CAAC,CAAA;AAAA,IACH;AAAA,EACF,CAAC,CAAA;AACH;;;;;"}
@@ -1,62 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const bindReporter = require('./lib/bindReporter.js');
4
- const getActivationStart = require('./lib/getActivationStart.js');
5
- const getVisibilityWatcher = require('./lib/getVisibilityWatcher.js');
6
- const globalListeners = require('./lib/globalListeners.js');
7
- const initMetric = require('./lib/initMetric.js');
8
- const initUnique = require('./lib/initUnique.js');
9
- const LCPEntryManager = require('./lib/LCPEntryManager.js');
10
- const observe = require('./lib/observe.js');
11
- const runOnce = require('./lib/runOnce.js');
12
- const whenActivated = require('./lib/whenActivated.js');
13
- const whenIdleOrHidden = require('./lib/whenIdleOrHidden.js');
14
-
15
- const LCPThresholds = [2500, 4e3];
16
- const onLCP = (onReport, opts = {}) => {
17
- whenActivated.whenActivated(() => {
18
- const visibilityWatcher = getVisibilityWatcher.getVisibilityWatcher();
19
- const metric = initMetric.initMetric("LCP");
20
- let report;
21
- const lcpEntryManager = initUnique.initUnique(opts, LCPEntryManager.LCPEntryManager);
22
- const handleEntries = (entries) => {
23
- if (!opts.reportAllChanges) {
24
- entries = entries.slice(-1);
25
- }
26
- for (const entry of entries) {
27
- lcpEntryManager._processEntry(entry);
28
- if (entry.startTime < visibilityWatcher.firstHiddenTime) {
29
- metric.value = Math.max(entry.startTime - getActivationStart.getActivationStart(), 0);
30
- metric.entries = [entry];
31
- report();
32
- }
33
- }
34
- };
35
- const po = observe.observe("largest-contentful-paint", handleEntries);
36
- if (po) {
37
- report = bindReporter.bindReporter(onReport, metric, LCPThresholds, opts.reportAllChanges);
38
- const stopListening = runOnce.runOnce(() => {
39
- handleEntries(po.takeRecords());
40
- po.disconnect();
41
- report(true);
42
- });
43
- const stopListeningWrapper = (event) => {
44
- if (event.isTrusted) {
45
- whenIdleOrHidden.whenIdleOrHidden(stopListening);
46
- globalListeners.removePageListener(event.type, stopListeningWrapper, {
47
- capture: true
48
- });
49
- }
50
- };
51
- for (const type of ["keydown", "click", "visibilitychange"]) {
52
- globalListeners.addPageListener(type, stopListeningWrapper, {
53
- capture: true
54
- });
55
- }
56
- }
57
- });
58
- };
59
-
60
- exports.LCPThresholds = LCPThresholds;
61
- exports.onLCP = onLCP;
62
- //# sourceMappingURL=getLCP.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getLCP.js","sources":["../../../../src/metrics/web-vitals/getLCP.ts"],"sourcesContent":["/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { bindReporter } from './lib/bindReporter';\nimport { getActivationStart } from './lib/getActivationStart';\nimport { getVisibilityWatcher } from './lib/getVisibilityWatcher';\nimport { addPageListener, removePageListener } from './lib/globalListeners';\nimport { initMetric } from './lib/initMetric';\nimport { initUnique } from './lib/initUnique';\nimport { LCPEntryManager } from './lib/LCPEntryManager';\nimport { observe } from './lib/observe';\nimport { runOnce } from './lib/runOnce';\nimport { whenActivated } from './lib/whenActivated';\nimport { whenIdleOrHidden } from './lib/whenIdleOrHidden';\nimport type { LCPMetric, MetricRatingThresholds, ReportOpts } from './types';\n\n/** Thresholds for LCP. See https://web.dev/articles/lcp#what_is_a_good_lcp_score */\nexport const LCPThresholds: MetricRatingThresholds = [2500, 4000];\n\n/**\n * Calculates the [LCP](https://web.dev/articles/lcp) value for the current page and\n * calls the `callback` function once the value is ready (along with the\n * relevant `largest-contentful-paint` performance entry used to determine the\n * value). The reported value is a `DOMHighResTimeStamp`.\n *\n * If the `reportAllChanges` configuration option is set to `true`, the\n * `callback` function will be called any time a new `largest-contentful-paint`\n * performance entry is dispatched, or once the final value of the metric has\n * been determined.\n */\nexport const onLCP = (onReport: (metric: LCPMetric) => void, opts: ReportOpts = {}) => {\n whenActivated(() => {\n const visibilityWatcher = getVisibilityWatcher();\n const metric = initMetric('LCP');\n let report: ReturnType<typeof bindReporter>;\n\n const lcpEntryManager = initUnique(opts, LCPEntryManager);\n\n const handleEntries = (entries: LCPMetric['entries']) => {\n // If reportAllChanges is set then call this function for each entry,\n // otherwise only consider the last one.\n if (!opts.reportAllChanges) {\n // eslint-disable-next-line no-param-reassign\n entries = entries.slice(-1);\n }\n\n for (const entry of entries) {\n lcpEntryManager._processEntry(entry);\n\n // Only report if the page wasn't hidden prior to LCP.\n if (entry.startTime < visibilityWatcher.firstHiddenTime) {\n // The startTime attribute returns the value of the renderTime if it is\n // not 0, and the value of the loadTime otherwise. The activationStart\n // reference is used because LCP should be relative to page activation\n // rather than navigation start if the page was prerendered. But in cases\n // where `activationStart` occurs after the LCP, this time should be\n // clamped at 0.\n metric.value = Math.max(entry.startTime - getActivationStart(), 0);\n metric.entries = [entry];\n report();\n }\n }\n };\n\n const po = observe('largest-contentful-paint', handleEntries);\n\n if (po) {\n report = bindReporter(onReport, metric, LCPThresholds, opts.reportAllChanges);\n\n // Ensure this logic only runs once, since it can be triggered from\n // any of three different event listeners below.\n const stopListening = runOnce(() => {\n handleEntries(po.takeRecords() as LCPMetric['entries']);\n po.disconnect();\n report(true);\n });\n\n // Need a separate wrapper to ensure the `runOnce` function above is\n // common for all three functions\n const stopListeningWrapper = (event: Event) => {\n if (event.isTrusted) {\n // Wrap the listener in an idle callback so it's run in a separate\n // task to reduce potential INP impact.\n // https://github.com/GoogleChrome/web-vitals/issues/383\n whenIdleOrHidden(stopListening);\n removePageListener(event.type, stopListeningWrapper, {\n capture: true,\n });\n }\n };\n\n // Stop listening after input or visibilitychange.\n // Note: while scrolling is an input that stops LCP observation, it's\n // unreliable since it can be programmatically generated.\n // See: https://github.com/GoogleChrome/web-vitals/issues/75\n for (const type of ['keydown', 'click', 'visibilitychange']) {\n addPageListener(type, stopListeningWrapper, {\n capture: true,\n });\n }\n }\n });\n};\n"],"names":["whenActivated","getVisibilityWatcher","initMetric","initUnique","LCPEntryManager","getActivationStart","observe","bindReporter","runOnce","whenIdleOrHidden","removePageListener","addPageListener"],"mappings":";;;;;;;;;;;;;;AA8BO,MAAM,aAAA,GAAwC,CAAC,IAAA,EAAM,GAAI;AAazD,MAAM,KAAA,GAAQ,CAAC,QAAA,EAAuC,IAAA,GAAmB,EAAC,KAAM;AACrF,EAAAA,2BAAA,CAAc,MAAM;AAClB,IAAA,MAAM,oBAAoBC,yCAAA,EAAqB;AAC/C,IAAA,MAAM,MAAA,GAASC,sBAAW,KAAK,CAAA;AAC/B,IAAA,IAAI,MAAA;AAEJ,IAAA,MAAM,eAAA,GAAkBC,qBAAA,CAAW,IAAA,EAAMC,+BAAe,CAAA;AAExD,IAAA,MAAM,aAAA,GAAgB,CAAC,OAAA,KAAkC;AAGvD,MAAA,IAAI,CAAC,KAAK,gBAAA,EAAkB;AAE1B,QAAA,OAAA,GAAU,OAAA,CAAQ,MAAM,EAAE,CAAA;AAAA,MAC5B;AAEA,MAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC3B,QAAA,eAAA,CAAgB,cAAc,KAAK,CAAA;AAGnC,QAAA,IAAI,KAAA,CAAM,SAAA,GAAY,iBAAA,CAAkB,eAAA,EAAiB;AAOvD,UAAA,MAAA,CAAO,QAAQ,IAAA,CAAK,GAAA,CAAI,MAAM,SAAA,GAAYC,qCAAA,IAAsB,CAAC,CAAA;AACjE,UAAA,MAAA,CAAO,OAAA,GAAU,CAAC,KAAK,CAAA;AACvB,UAAA,MAAA,EAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF,CAAA;AAEA,IAAA,MAAM,EAAA,GAAKC,eAAA,CAAQ,0BAAA,EAA4B,aAAa,CAAA;AAE5D,IAAA,IAAI,EAAA,EAAI;AACN,MAAA,MAAA,GAASC,yBAAA,CAAa,QAAA,EAAU,MAAA,EAAQ,aAAA,EAAe,KAAK,gBAAgB,CAAA;AAI5E,MAAA,MAAM,aAAA,GAAgBC,gBAAQ,MAAM;AAClC,QAAA,aAAA,CAAc,EAAA,CAAG,aAAqC,CAAA;AACtD,QAAA,EAAA,CAAG,UAAA,EAAW;AACd,QAAA,MAAA,CAAO,IAAI,CAAA;AAAA,MACb,CAAC,CAAA;AAID,MAAA,MAAM,oBAAA,GAAuB,CAAC,KAAA,KAAiB;AAC7C,QAAA,IAAI,MAAM,SAAA,EAAW;AAInB,UAAAC,iCAAA,CAAiB,aAAa,CAAA;AAC9B,UAAAC,kCAAA,CAAmB,KAAA,CAAM,MAAM,oBAAA,EAAsB;AAAA,YACnD,OAAA,EAAS;AAAA,WACV,CAAA;AAAA,QACH;AAAA,MACF,CAAA;AAMA,MAAA,KAAA,MAAW,IAAA,IAAQ,CAAC,SAAA,EAAW,OAAA,EAAS,kBAAkB,CAAA,EAAG;AAC3D,QAAAC,+BAAA,CAAgB,MAAM,oBAAA,EAAsB;AAAA,UAC1C,OAAA,EAAS;AAAA,SACV,CAAA;AAAA,MACH;AAAA,IACF;AAAA,EACF,CAAC,CAAA;AACH;;;;;"}
@@ -1,87 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const interactionCountPolyfill = require('./polyfills/interactionCountPolyfill.js');
4
-
5
- const MAX_INTERACTIONS_TO_CONSIDER = 10;
6
- let prevInteractionCount = 0;
7
- const getInteractionCountForNavigation = () => {
8
- return interactionCountPolyfill.getInteractionCount() - prevInteractionCount;
9
- };
10
- class InteractionManager {
11
- constructor() {
12
- /**
13
- * A list of longest interactions on the page (by latency) sorted so the
14
- * longest one is first. The list is at most MAX_INTERACTIONS_TO_CONSIDER
15
- * long.
16
- */
17
- // oxlint-disable-next-line sdk/no-class-field-initializers
18
- this._longestInteractionList = [];
19
- /**
20
- * A mapping of longest interactions by their interaction ID.
21
- * This is used for faster lookup.
22
- */
23
- // oxlint-disable-next-line sdk/no-class-field-initializers
24
- this._longestInteractionMap = /* @__PURE__ */ new Map();
25
- }
26
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility, jsdoc/require-jsdoc
27
- _resetInteractions() {
28
- prevInteractionCount = interactionCountPolyfill.getInteractionCount();
29
- this._longestInteractionList.length = 0;
30
- this._longestInteractionMap.clear();
31
- }
32
- /**
33
- * Returns the estimated p98 longest interaction based on the stored
34
- * interaction candidates and the interaction count for the current page.
35
- */
36
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
37
- _estimateP98LongestInteraction() {
38
- const candidateInteractionIndex = Math.min(
39
- this._longestInteractionList.length - 1,
40
- Math.floor(getInteractionCountForNavigation() / 50)
41
- );
42
- return this._longestInteractionList[candidateInteractionIndex];
43
- }
44
- /**
45
- * Takes a performance entry and adds it to the list of worst interactions
46
- * if its duration is long enough to make it among the worst. If the
47
- * entry is part of an existing interaction, it is merged and the latency
48
- * and entries list is updated as needed.
49
- */
50
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
51
- _processEntry(entry) {
52
- this._onBeforeProcessingEntry?.(entry);
53
- if (!(entry.interactionId || entry.entryType === "first-input")) return;
54
- const minLongestInteraction = this._longestInteractionList.at(-1);
55
- let interaction = this._longestInteractionMap.get(entry.interactionId);
56
- if (interaction || this._longestInteractionList.length < MAX_INTERACTIONS_TO_CONSIDER || // If the above conditions are false, `minLongestInteraction` will be set.
57
- entry.duration > minLongestInteraction._latency) {
58
- if (interaction) {
59
- if (entry.duration > interaction._latency) {
60
- interaction.entries = [entry];
61
- interaction._latency = entry.duration;
62
- } else if (entry.duration === interaction._latency && entry.startTime === interaction.entries[0].startTime) {
63
- interaction.entries.push(entry);
64
- }
65
- } else {
66
- interaction = {
67
- id: entry.interactionId,
68
- entries: [entry],
69
- _latency: entry.duration
70
- };
71
- this._longestInteractionMap.set(interaction.id, interaction);
72
- this._longestInteractionList.push(interaction);
73
- }
74
- this._longestInteractionList.sort((a, b) => b._latency - a._latency);
75
- if (this._longestInteractionList.length > MAX_INTERACTIONS_TO_CONSIDER) {
76
- const removedInteractions = this._longestInteractionList.splice(MAX_INTERACTIONS_TO_CONSIDER);
77
- for (const interaction2 of removedInteractions) {
78
- this._longestInteractionMap.delete(interaction2.id);
79
- }
80
- }
81
- this._onAfterProcessingINPCandidate?.(interaction);
82
- }
83
- }
84
- }
85
-
86
- exports.InteractionManager = InteractionManager;
87
- //# sourceMappingURL=InteractionManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InteractionManager.js","sources":["../../../../../src/metrics/web-vitals/lib/InteractionManager.ts"],"sourcesContent":["/*\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getInteractionCount } from './polyfills/interactionCountPolyfill.js';\n\nexport interface Interaction {\n _latency: number;\n // While the `id` and `entries` properties are also internal and could be\n // mangled by prefixing with an underscore, since they correspond to public\n // symbols there is no need to mangle them as the library will compress\n // better if we reuse the existing names.\n id: number;\n entries: PerformanceEventTiming[];\n}\n\n// To prevent unnecessary memory usage on pages with lots of interactions,\n// store at most 10 of the longest interactions to consider as INP candidates.\nconst MAX_INTERACTIONS_TO_CONSIDER = 10;\n\n// Used to store the interaction count after a bfcache restore, since p98\n// interaction latencies should only consider the current navigation.\nlet prevInteractionCount = 0;\n\n/**\n * Returns the interaction count since the last bfcache restore (or for the\n * full page lifecycle if there were no bfcache restores).\n */\nconst getInteractionCountForNavigation = () => {\n return getInteractionCount() - prevInteractionCount;\n};\n\n/**\n *\n */\nexport class InteractionManager {\n /**\n * A list of longest interactions on the page (by latency) sorted so the\n * longest one is first. The list is at most MAX_INTERACTIONS_TO_CONSIDER\n * long.\n */\n // oxlint-disable-next-line sdk/no-class-field-initializers\n _longestInteractionList: Interaction[] = [];\n\n /**\n * A mapping of longest interactions by their interaction ID.\n * This is used for faster lookup.\n */\n // oxlint-disable-next-line sdk/no-class-field-initializers\n _longestInteractionMap: Map<number, Interaction> = new Map();\n\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n _onBeforeProcessingEntry?: (entry: PerformanceEventTiming) => void;\n\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n _onAfterProcessingINPCandidate?: (interaction: Interaction) => void;\n\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility, jsdoc/require-jsdoc\n _resetInteractions() {\n prevInteractionCount = getInteractionCount();\n this._longestInteractionList.length = 0;\n this._longestInteractionMap.clear();\n }\n\n /**\n * Returns the estimated p98 longest interaction based on the stored\n * interaction candidates and the interaction count for the current page.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n _estimateP98LongestInteraction() {\n const candidateInteractionIndex = Math.min(\n this._longestInteractionList.length - 1,\n Math.floor(getInteractionCountForNavigation() / 50),\n );\n\n return this._longestInteractionList[candidateInteractionIndex];\n }\n\n /**\n * Takes a performance entry and adds it to the list of worst interactions\n * if its duration is long enough to make it among the worst. If the\n * entry is part of an existing interaction, it is merged and the latency\n * and entries list is updated as needed.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n _processEntry(entry: PerformanceEventTiming) {\n this._onBeforeProcessingEntry?.(entry);\n\n // Skip further processing for entries that cannot be INP candidates.\n if (!(entry.interactionId || entry.entryType === 'first-input')) return;\n\n // The least-long of the 10 longest interactions.\n const minLongestInteraction = this._longestInteractionList.at(-1);\n\n let interaction = this._longestInteractionMap.get(entry.interactionId);\n\n // Only process the entry if it's possibly one of the ten longest,\n // or if it's part of an existing interaction.\n if (\n interaction ||\n this._longestInteractionList.length < MAX_INTERACTIONS_TO_CONSIDER ||\n // If the above conditions are false, `minLongestInteraction` will be set.\n entry.duration > minLongestInteraction!._latency\n ) {\n // If the interaction already exists, update it. Otherwise create one.\n if (interaction) {\n // If the new entry has a longer duration, replace the old entries,\n // otherwise add to the array.\n if (entry.duration > interaction._latency) {\n interaction.entries = [entry];\n interaction._latency = entry.duration;\n } else if (entry.duration === interaction._latency && entry.startTime === interaction.entries[0]!.startTime) {\n interaction.entries.push(entry);\n }\n } else {\n interaction = {\n id: entry.interactionId,\n entries: [entry],\n _latency: entry.duration,\n };\n this._longestInteractionMap.set(interaction.id, interaction);\n this._longestInteractionList.push(interaction);\n }\n\n // Sort the entries by latency (descending) and keep only the top ten.\n this._longestInteractionList.sort((a, b) => b._latency - a._latency);\n if (this._longestInteractionList.length > MAX_INTERACTIONS_TO_CONSIDER) {\n const removedInteractions = this._longestInteractionList.splice(MAX_INTERACTIONS_TO_CONSIDER);\n\n for (const interaction of removedInteractions) {\n this._longestInteractionMap.delete(interaction.id);\n }\n }\n\n // Call any post-processing on the interaction\n this._onAfterProcessingINPCandidate?.(interaction);\n }\n }\n}\n"],"names":["getInteractionCount","interaction"],"mappings":"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"}
@@ -1,11 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- class LCPEntryManager {
4
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility, jsdoc/require-jsdoc
5
- _processEntry(entry) {
6
- this._onBeforeProcessingEntry?.(entry);
7
- }
8
- }
9
-
10
- exports.LCPEntryManager = LCPEntryManager;
11
- //# sourceMappingURL=LCPEntryManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LCPEntryManager.js","sources":["../../../../../src/metrics/web-vitals/lib/LCPEntryManager.ts"],"sourcesContent":["/*\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport class LCPEntryManager {\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n _onBeforeProcessingEntry?: (entry: LargestContentfulPaint) => void;\n\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility, jsdoc/require-jsdoc\n _processEntry(entry: LargestContentfulPaint) {\n this._onBeforeProcessingEntry?.(entry);\n }\n}\n"],"names":[],"mappings":";;AAiBO,MAAM,eAAA,CAAgB;AAAA;AAAA,EAK3B,cAAc,KAAA,EAA+B;AAC3C,IAAA,IAAA,CAAK,2BAA2B,KAAK,CAAA;AAAA,EACvC;AACF;;;;"}
@@ -1,27 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- class LayoutShiftManager {
4
- constructor() {
5
- // oxlint-disable-next-line sdk/no-class-field-initializers
6
- this._sessionValue = 0;
7
- // oxlint-disable-next-line sdk/no-class-field-initializers
8
- this._sessionEntries = [];
9
- }
10
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
11
- _processEntry(entry) {
12
- if (entry.hadRecentInput) return;
13
- const firstSessionEntry = this._sessionEntries[0];
14
- const lastSessionEntry = this._sessionEntries[this._sessionEntries.length - 1];
15
- if (this._sessionValue && firstSessionEntry && lastSessionEntry && entry.startTime - lastSessionEntry.startTime < 1e3 && entry.startTime - firstSessionEntry.startTime < 5e3) {
16
- this._sessionValue += entry.value;
17
- this._sessionEntries.push(entry);
18
- } else {
19
- this._sessionValue = entry.value;
20
- this._sessionEntries = [entry];
21
- }
22
- this._onAfterProcessingUnexpectedShift?.(entry);
23
- }
24
- }
25
-
26
- exports.LayoutShiftManager = LayoutShiftManager;
27
- //# sourceMappingURL=LayoutShiftManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LayoutShiftManager.js","sources":["../../../../../src/metrics/web-vitals/lib/LayoutShiftManager.ts"],"sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\n/*\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport class LayoutShiftManager {\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n _onAfterProcessingUnexpectedShift?: (entry: LayoutShift) => void;\n\n // oxlint-disable-next-line sdk/no-class-field-initializers\n _sessionValue = 0;\n // oxlint-disable-next-line sdk/no-class-field-initializers\n _sessionEntries: LayoutShift[] = [];\n\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n _processEntry(entry: LayoutShift) {\n // Only count layout shifts without recent user input.\n if (entry.hadRecentInput) return;\n\n const firstSessionEntry = this._sessionEntries[0];\n // This previously used `this._sessionEntries.at(-1)` but that is ES2022. We support ES2021 and earlier.\n const lastSessionEntry = this._sessionEntries[this._sessionEntries.length - 1];\n\n // If the entry occurred less than 1 second after the previous entry\n // and less than 5 seconds after the first entry in the session,\n // include the entry in the current session. Otherwise, start a new\n // session.\n if (\n this._sessionValue &&\n firstSessionEntry &&\n lastSessionEntry &&\n entry.startTime - lastSessionEntry.startTime < 1000 &&\n entry.startTime - firstSessionEntry.startTime < 5000\n ) {\n this._sessionValue += entry.value;\n this._sessionEntries.push(entry);\n } else {\n this._sessionValue = entry.value;\n this._sessionEntries = [entry];\n }\n\n this._onAfterProcessingUnexpectedShift?.(entry);\n }\n}\n"],"names":[],"mappings":";;AAiBO,MAAM,kBAAA,CAAmB;AAAA,EAAzB,WAAA,GAAA;AAKL;AAAA,IAAA,IAAA,CAAA,aAAA,GAAgB,CAAA;AAEhB;AAAA,IAAA,IAAA,CAAA,eAAA,GAAiC,EAAC;AAAA,EAAA;AAAA;AAAA,EAGlC,cAAc,KAAA,EAAoB;AAEhC,IAAA,IAAI,MAAM,cAAA,EAAgB;AAE1B,IAAA,MAAM,iBAAA,GAAoB,IAAA,CAAK,eAAA,CAAgB,CAAC,CAAA;AAEhD,IAAA,MAAM,mBAAmB,IAAA,CAAK,eAAA,CAAgB,IAAA,CAAK,eAAA,CAAgB,SAAS,CAAC,CAAA;AAM7E,IAAA,IACE,IAAA,CAAK,aAAA,IACL,iBAAA,IACA,gBAAA,IACA,KAAA,CAAM,SAAA,GAAY,gBAAA,CAAiB,SAAA,GAAY,GAAA,IAC/C,KAAA,CAAM,SAAA,GAAY,iBAAA,CAAkB,YAAY,GAAA,EAChD;AACA,MAAA,IAAA,CAAK,iBAAiB,KAAA,CAAM,KAAA;AAC5B,MAAA,IAAA,CAAK,eAAA,CAAgB,KAAK,KAAK,CAAA;AAAA,IACjC,CAAA,MAAO;AACL,MAAA,IAAA,CAAK,gBAAgB,KAAA,CAAM,KAAA;AAC3B,MAAA,IAAA,CAAK,eAAA,GAAkB,CAAC,KAAK,CAAA;AAAA,IAC/B;AAEA,IAAA,IAAA,CAAK,oCAAoC,KAAK,CAAA;AAAA,EAChD;AACF;;;;"}
@@ -1,31 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const getRating = (value, thresholds) => {
4
- if (value > thresholds[1]) {
5
- return "poor";
6
- }
7
- if (value > thresholds[0]) {
8
- return "needs-improvement";
9
- }
10
- return "good";
11
- };
12
- const bindReporter = (callback, metric, thresholds, reportAllChanges) => {
13
- let prevValue;
14
- let delta;
15
- return (forceReport) => {
16
- if (metric.value >= 0) {
17
- if (forceReport || reportAllChanges) {
18
- delta = metric.value - (prevValue ?? 0);
19
- if (delta || prevValue === void 0) {
20
- prevValue = metric.value;
21
- metric.delta = delta;
22
- metric.rating = getRating(metric.value, thresholds);
23
- callback(metric);
24
- }
25
- }
26
- }
27
- };
28
- };
29
-
30
- exports.bindReporter = bindReporter;
31
- //# sourceMappingURL=bindReporter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bindReporter.js","sources":["../../../../../src/metrics/web-vitals/lib/bindReporter.ts"],"sourcesContent":["/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { MetricRatingThresholds, MetricType } from '../types';\n\nconst getRating = (value: number, thresholds: MetricRatingThresholds): MetricType['rating'] => {\n if (value > thresholds[1]) {\n return 'poor';\n }\n if (value > thresholds[0]) {\n return 'needs-improvement';\n }\n return 'good';\n};\n\nexport const bindReporter = <MetricName extends MetricType['name']>(\n callback: (metric: Extract<MetricType, { name: MetricName }>) => void,\n metric: Extract<MetricType, { name: MetricName }>,\n thresholds: MetricRatingThresholds,\n reportAllChanges?: boolean,\n) => {\n let prevValue: number;\n let delta: number;\n return (forceReport?: boolean) => {\n if (metric.value >= 0) {\n if (forceReport || reportAllChanges) {\n delta = metric.value - (prevValue ?? 0);\n\n // Report the metric if there's a non-zero delta or if no previous\n // value exists (which can happen in the case of the document becoming\n // hidden when the metric value is 0).\n // See: https://github.com/GoogleChrome/web-vitals/issues/14\n if (delta || prevValue === undefined) {\n prevValue = metric.value;\n metric.delta = delta;\n metric.rating = getRating(metric.value, thresholds);\n callback(metric);\n }\n }\n }\n };\n};\n"],"names":[],"mappings":";;AAkBA,MAAM,SAAA,GAAY,CAAC,KAAA,EAAe,UAAA,KAA6D;AAC7F,EAAA,IAAI,KAAA,GAAQ,UAAA,CAAW,CAAC,CAAA,EAAG;AACzB,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,IAAI,KAAA,GAAQ,UAAA,CAAW,CAAC,CAAA,EAAG;AACzB,IAAA,OAAO,mBAAA;AAAA,EACT;AACA,EAAA,OAAO,MAAA;AACT,CAAA;AAEO,MAAM,YAAA,GAAe,CAC1B,QAAA,EACA,MAAA,EACA,YACA,gBAAA,KACG;AACH,EAAA,IAAI,SAAA;AACJ,EAAA,IAAI,KAAA;AACJ,EAAA,OAAO,CAAC,WAAA,KAA0B;AAChC,IAAA,IAAI,MAAA,CAAO,SAAS,CAAA,EAAG;AACrB,MAAA,IAAI,eAAe,gBAAA,EAAkB;AACnC,QAAA,KAAA,GAAQ,MAAA,CAAO,SAAS,SAAA,IAAa,CAAA,CAAA;AAMrC,QAAA,IAAI,KAAA,IAAS,cAAc,MAAA,EAAW;AACpC,UAAA,SAAA,GAAY,MAAA,CAAO,KAAA;AACnB,UAAA,MAAA,CAAO,KAAA,GAAQ,KAAA;AACf,UAAA,MAAA,CAAO,MAAA,GAAS,SAAA,CAAU,MAAA,CAAO,KAAA,EAAO,UAAU,CAAA;AAClD,UAAA,QAAA,CAAS,MAAM,CAAA;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAA;AACF;;;;"}
@@ -1,8 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const generateUniqueID = () => {
4
- return `v5-${Date.now()}-${Math.floor(Math.random() * (9e12 - 1)) + 1e12}`;
5
- };
6
-
7
- exports.generateUniqueID = generateUniqueID;
8
- //# sourceMappingURL=generateUniqueID.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generateUniqueID.js","sources":["../../../../../src/metrics/web-vitals/lib/generateUniqueID.ts"],"sourcesContent":["/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Performantly generate a unique, 30-char string by combining a version\n * number, the current timestamp with a 13-digit number integer.\n * @return {string}\n */\nexport const generateUniqueID = () => {\n return `v5-${Date.now()}-${Math.floor(Math.random() * (9e12 - 1)) + 1e12}`;\n};\n"],"names":[],"mappings":";;AAqBO,MAAM,mBAAmB,MAAM;AACpC,EAAA,OAAO,CAAA,GAAA,EAAM,IAAA,CAAK,GAAA,EAAK,CAAA,CAAA,EAAI,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,MAAA,EAAO,IAAK,IAAA,GAAO,CAAA,CAAE,IAAI,IAAI,CAAA,CAAA;AAC1E;;;;"}
@@ -1,11 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const getNavigationEntry = require('./getNavigationEntry.js');
4
-
5
- const getActivationStart = () => {
6
- const navEntry = getNavigationEntry.getNavigationEntry();
7
- return navEntry?.activationStart ?? 0;
8
- };
9
-
10
- exports.getActivationStart = getActivationStart;
11
- //# sourceMappingURL=getActivationStart.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getActivationStart.js","sources":["../../../../../src/metrics/web-vitals/lib/getActivationStart.ts"],"sourcesContent":["/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getNavigationEntry } from './getNavigationEntry';\n\nexport const getActivationStart = (): number => {\n const navEntry = getNavigationEntry();\n return navEntry?.activationStart ?? 0;\n};\n"],"names":["getNavigationEntry"],"mappings":";;;;AAkBO,MAAM,qBAAqB,MAAc;AAC9C,EAAA,MAAM,WAAWA,qCAAA,EAAmB;AACpC,EAAA,OAAO,UAAU,eAAA,IAAmB,CAAA;AACtC;;;;"}
@@ -1,17 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const types = require('../../../types.js');
4
-
5
- const getNavigationEntry = (checkResponseStart = true) => {
6
- const navigationEntry = types.WINDOW.performance?.getEntriesByType?.("navigation")[0];
7
- if (
8
- // sentry-specific change:
9
- // We don't want to check for responseStart for our own use of `getNavigationEntry`
10
- !checkResponseStart || navigationEntry && navigationEntry.responseStart > 0 && navigationEntry.responseStart < performance.now()
11
- ) {
12
- return navigationEntry;
13
- }
14
- };
15
-
16
- exports.getNavigationEntry = getNavigationEntry;
17
- //# sourceMappingURL=getNavigationEntry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getNavigationEntry.js","sources":["../../../../../src/metrics/web-vitals/lib/getNavigationEntry.ts"],"sourcesContent":["/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WINDOW } from '../../../types';\n\n// sentry-specific change:\n// add optional param to not check for responseStart (see comment below)\nexport const getNavigationEntry = (checkResponseStart = true): PerformanceNavigationTiming | void => {\n const navigationEntry = WINDOW.performance?.getEntriesByType?.('navigation')[0];\n // Check to ensure the `responseStart` property is present and valid.\n // In some cases a zero value is reported by the browser (for\n // privacy/security reasons), and in other cases (bugs) the value is\n // negative or is larger than the current page time. Ignore these cases:\n // - https://github.com/GoogleChrome/web-vitals/issues/137\n // - https://github.com/GoogleChrome/web-vitals/issues/162\n // - https://github.com/GoogleChrome/web-vitals/issues/275\n if (\n // sentry-specific change:\n // We don't want to check for responseStart for our own use of `getNavigationEntry`\n !checkResponseStart ||\n (navigationEntry && navigationEntry.responseStart > 0 && navigationEntry.responseStart < performance.now())\n ) {\n return navigationEntry;\n }\n};\n"],"names":["WINDOW"],"mappings":";;;;AAoBO,MAAM,kBAAA,GAAqB,CAAC,kBAAA,GAAqB,IAAA,KAA6C;AACnG,EAAA,MAAM,kBAAkBA,YAAA,CAAO,WAAA,EAAa,gBAAA,GAAmB,YAAY,EAAE,CAAC,CAAA;AAQ9E,EAAA;AAAA;AAAA;AAAA,IAGE,CAAC,sBACA,eAAA,IAAmB,eAAA,CAAgB,gBAAgB,CAAA,IAAK,eAAA,CAAgB,aAAA,GAAgB,WAAA,CAAY,GAAA;AAAI,IACzG;AACA,IAAA,OAAO,eAAA;AAAA,EACT;AACF;;;;"}
@@ -1,44 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const types = require('../../../types.js');
4
- const getActivationStart = require('./getActivationStart.js');
5
- const globalListeners = require('./globalListeners.js');
6
-
7
- let firstHiddenTime = -1;
8
- const onHiddenFunctions = /* @__PURE__ */ new Set();
9
- const initHiddenTime = () => {
10
- return types.WINDOW.document?.visibilityState === "hidden" && !types.WINDOW.document?.prerendering ? 0 : Infinity;
11
- };
12
- const onVisibilityUpdate = (event) => {
13
- if (types.WINDOW.document?.visibilityState === "hidden" && firstHiddenTime > -1) {
14
- if (event.type === "visibilitychange") {
15
- for (const onHiddenFunction of onHiddenFunctions) {
16
- onHiddenFunction();
17
- }
18
- }
19
- if (!isFinite(firstHiddenTime)) {
20
- firstHiddenTime = event.type === "visibilitychange" ? event.timeStamp : 0;
21
- globalListeners.removePageListener("prerenderingchange", onVisibilityUpdate, true);
22
- }
23
- }
24
- };
25
- const getVisibilityWatcher = () => {
26
- if (types.WINDOW.document && firstHiddenTime < 0) {
27
- const activationStart = getActivationStart.getActivationStart();
28
- const firstVisibilityStateHiddenTime = !types.WINDOW.document.prerendering ? globalThis.performance.getEntriesByType("visibility-state").filter((e) => e.name === "hidden" && e.startTime > activationStart)[0]?.startTime : void 0;
29
- firstHiddenTime = firstVisibilityStateHiddenTime ?? initHiddenTime();
30
- globalListeners.addPageListener("visibilitychange", onVisibilityUpdate, true);
31
- globalListeners.addPageListener("prerenderingchange", onVisibilityUpdate, true);
32
- }
33
- return {
34
- get firstHiddenTime() {
35
- return firstHiddenTime;
36
- },
37
- onHidden(cb) {
38
- onHiddenFunctions.add(cb);
39
- }
40
- };
41
- };
42
-
43
- exports.getVisibilityWatcher = getVisibilityWatcher;
44
- //# sourceMappingURL=getVisibilityWatcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getVisibilityWatcher.js","sources":["../../../../../src/metrics/web-vitals/lib/getVisibilityWatcher.ts"],"sourcesContent":["/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WINDOW } from '../../../types';\nimport { getActivationStart } from './getActivationStart';\nimport { addPageListener, removePageListener } from './globalListeners';\n\nlet firstHiddenTime = -1;\nconst onHiddenFunctions: Set<() => void> = new Set();\n\nconst initHiddenTime = () => {\n // If the document is hidden when this code runs, assume it was always\n // hidden and the page was loaded in the background, with the one exception\n // that visibility state is always 'hidden' during prerendering, so we have\n // to ignore that case until prerendering finishes (see: `prerenderingchange`\n // event logic below).\n return WINDOW.document?.visibilityState === 'hidden' && !WINDOW.document?.prerendering ? 0 : Infinity;\n};\n\nconst onVisibilityUpdate = (event: Event) => {\n // Handle changes to hidden state\n if (WINDOW.document?.visibilityState === 'hidden' && firstHiddenTime > -1) {\n // Call onHidden callbacks when the page becomes hidden\n if (event.type === 'visibilitychange') {\n for (const onHiddenFunction of onHiddenFunctions) {\n onHiddenFunction();\n }\n }\n\n // If the document is 'hidden' and no previous hidden timestamp has been\n // set (so is infinity), update it based on the current event data.\n if (!isFinite(firstHiddenTime)) {\n // If the event is a 'visibilitychange' event, it means the page was\n // visible prior to this change, so the event timestamp is the first\n // hidden time.\n // However, if the event is not a 'visibilitychange' event, then it must\n // be a 'prerenderingchange' event, and the fact that the document is\n // still 'hidden' from the above check means the tab was activated\n // in a background state and so has always been hidden.\n firstHiddenTime = event.type === 'visibilitychange' ? event.timeStamp : 0;\n\n // We no longer need the `prerenderingchange` event listener now we've\n // set an initial init time so remove that\n // (we'll keep the visibilitychange one for onHiddenFunction above)\n removePageListener('prerenderingchange', onVisibilityUpdate, true);\n }\n }\n};\n\nexport const getVisibilityWatcher = () => {\n if (WINDOW.document && firstHiddenTime < 0) {\n // Check if we have a previous hidden `visibility-state` performance entry.\n const activationStart = getActivationStart();\n const firstVisibilityStateHiddenTime = !WINDOW.document.prerendering\n ? globalThis.performance\n .getEntriesByType('visibility-state')\n .filter(e => e.name === 'hidden' && e.startTime > activationStart)[0]?.startTime\n : undefined;\n\n // Prefer that, but if it's not available and the document is hidden when\n // this code runs, assume it was hidden since navigation start. This isn't\n // a perfect heuristic, but it's the best we can do until the\n // `visibility-state` performance entry becomes available in all browsers.\n firstHiddenTime = firstVisibilityStateHiddenTime ?? initHiddenTime();\n // Listen for visibility changes so we can handle things like bfcache\n // restores and/or prerender without having to examine individual\n // timestamps in detail and also for onHidden function calls.\n addPageListener('visibilitychange', onVisibilityUpdate, true);\n\n // IMPORTANT: when a page is prerendering, its `visibilityState` is\n // 'hidden', so in order to account for cases where this module checks for\n // visibility during prerendering, an additional check after prerendering\n // completes is also required.\n addPageListener('prerenderingchange', onVisibilityUpdate, true);\n }\n\n return {\n get firstHiddenTime() {\n return firstHiddenTime;\n },\n onHidden(cb: () => void) {\n onHiddenFunctions.add(cb);\n },\n };\n};\n"],"names":["WINDOW","removePageListener","getActivationStart","addPageListener"],"mappings":";;;;;;AAoBA,IAAI,eAAA,GAAkB,EAAA;AACtB,MAAM,iBAAA,uBAAyC,GAAA,EAAI;AAEnD,MAAM,iBAAiB,MAAM;AAM3B,EAAA,OAAOA,YAAA,CAAO,UAAU,eAAA,KAAoB,QAAA,IAAY,CAACA,YAAA,CAAO,QAAA,EAAU,eAAe,CAAA,GAAI,QAAA;AAC/F,CAAA;AAEA,MAAM,kBAAA,GAAqB,CAAC,KAAA,KAAiB;AAE3C,EAAA,IAAIA,YAAA,CAAO,QAAA,EAAU,eAAA,KAAoB,QAAA,IAAY,kBAAkB,EAAA,EAAI;AAEzE,IAAA,IAAI,KAAA,CAAM,SAAS,kBAAA,EAAoB;AACrC,MAAA,KAAA,MAAW,oBAAoB,iBAAA,EAAmB;AAChD,QAAA,gBAAA,EAAiB;AAAA,MACnB;AAAA,IACF;AAIA,IAAA,IAAI,CAAC,QAAA,CAAS,eAAe,CAAA,EAAG;AAQ9B,MAAA,eAAA,GAAkB,KAAA,CAAM,IAAA,KAAS,kBAAA,GAAqB,KAAA,CAAM,SAAA,GAAY,CAAA;AAKxE,MAAAC,kCAAA,CAAmB,oBAAA,EAAsB,oBAAoB,IAAI,CAAA;AAAA,IACnE;AAAA,EACF;AACF,CAAA;AAEO,MAAM,uBAAuB,MAAM;AACxC,EAAA,IAAID,YAAA,CAAO,QAAA,IAAY,eAAA,GAAkB,CAAA,EAAG;AAE1C,IAAA,MAAM,kBAAkBE,qCAAA,EAAmB;AAC3C,IAAA,MAAM,8BAAA,GAAiC,CAACF,YAAA,CAAO,QAAA,CAAS,eACpD,UAAA,CAAW,WAAA,CACR,iBAAiB,kBAAkB,CAAA,CACnC,OAAO,CAAA,CAAA,KAAK,CAAA,CAAE,SAAS,QAAA,IAAY,CAAA,CAAE,YAAY,eAAe,CAAA,CAAE,CAAC,CAAA,EAAG,SAAA,GACzE,MAAA;AAMJ,IAAA,eAAA,GAAkB,kCAAkC,cAAA,EAAe;AAInE,IAAAG,+BAAA,CAAgB,kBAAA,EAAoB,oBAAoB,IAAI,CAAA;AAM5D,IAAAA,+BAAA,CAAgB,oBAAA,EAAsB,oBAAoB,IAAI,CAAA;AAAA,EAChE;AAEA,EAAA,OAAO;AAAA,IACL,IAAI,eAAA,GAAkB;AACpB,MAAA,OAAO,eAAA;AAAA,IACT,CAAA;AAAA,IACA,SAAS,EAAA,EAAgB;AACvB,MAAA,iBAAA,CAAkB,IAAI,EAAE,CAAA;AAAA,IAC1B;AAAA,GACF;AACF;;;;"}
@@ -1,18 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const types = require('../../../types.js');
4
-
5
- function addPageListener(type, listener, options) {
6
- if (types.WINDOW.document) {
7
- types.WINDOW.addEventListener(type, listener, options);
8
- }
9
- }
10
- function removePageListener(type, listener, options) {
11
- if (types.WINDOW.document) {
12
- types.WINDOW.removeEventListener(type, listener, options);
13
- }
14
- }
15
-
16
- exports.addPageListener = addPageListener;
17
- exports.removePageListener = removePageListener;
18
- //# sourceMappingURL=globalListeners.js.map