@sentry/browser-utils 10.70.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 (350) hide show
  1. package/build/cjs/htmlTreeAsString.js.map +1 -1
  2. package/build/cjs/index.js +30 -28
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/instrumentation/dom.js.map +1 -0
  5. package/build/cjs/instrumentation/history.js.map +1 -0
  6. package/build/cjs/instrumentation/location.js.map +1 -0
  7. package/build/cjs/{metrics/instrument.js → instrumentation/performanceObserver.js} +44 -32
  8. package/build/cjs/instrumentation/performanceObserver.js.map +1 -0
  9. package/build/cjs/instrumentation/xhr.js.map +1 -0
  10. package/build/cjs/{metrics → performance}/elementTiming.js +2 -2
  11. package/build/cjs/performance/elementTiming.js.map +1 -0
  12. package/build/cjs/{metrics/browserMetrics.js → performance/entries.js} +43 -262
  13. package/build/cjs/performance/entries.js.map +1 -0
  14. package/build/cjs/performance/resourceTiming.js.map +1 -0
  15. package/build/cjs/performance/userTiming.js +119 -0
  16. package/build/cjs/performance/userTiming.js.map +1 -0
  17. package/build/cjs/performance/utils.js +68 -0
  18. package/build/cjs/performance/utils.js.map +1 -0
  19. package/build/cjs/{metrics → web-vitals}/inp.js +4 -61
  20. package/build/cjs/web-vitals/inp.js.map +1 -0
  21. package/build/cjs/web-vitals/lcp.js +10 -0
  22. package/build/cjs/web-vitals/lcp.js.map +1 -0
  23. package/build/cjs/web-vitals/reportEvents.js +31 -0
  24. package/build/cjs/web-vitals/reportEvents.js.map +1 -0
  25. package/build/cjs/{metrics/webVitalSpans.js → web-vitals/spans.js} +36 -19
  26. package/build/cjs/web-vitals/spans.js.map +1 -0
  27. package/build/cjs/web-vitals/tracking.js +164 -0
  28. package/build/cjs/web-vitals/tracking.js.map +1 -0
  29. package/build/cjs/web-vitals/utils.js +99 -0
  30. package/build/cjs/web-vitals/utils.js.map +1 -0
  31. package/build/esm/htmlTreeAsString.js.map +1 -1
  32. package/build/esm/index.js +14 -12
  33. package/build/esm/index.js.map +1 -1
  34. package/build/esm/instrumentation/dom.js.map +1 -0
  35. package/build/esm/instrumentation/history.js.map +1 -0
  36. package/build/esm/instrumentation/location.js.map +1 -0
  37. package/build/esm/{metrics/instrument.js → instrumentation/performanceObserver.js} +42 -30
  38. package/build/esm/instrumentation/performanceObserver.js.map +1 -0
  39. package/build/esm/instrumentation/xhr.js.map +1 -0
  40. package/build/esm/package.json +1 -1
  41. package/build/esm/{metrics → performance}/elementTiming.js +1 -1
  42. package/build/esm/performance/elementTiming.js.map +1 -0
  43. package/build/esm/{metrics/browserMetrics.js → performance/entries.js} +36 -252
  44. package/build/esm/performance/entries.js.map +1 -0
  45. package/build/esm/performance/resourceTiming.js.map +1 -0
  46. package/build/esm/performance/userTiming.js +116 -0
  47. package/build/esm/performance/userTiming.js.map +1 -0
  48. package/build/esm/performance/utils.js +61 -0
  49. package/build/esm/performance/utils.js.map +1 -0
  50. package/build/esm/{metrics → web-vitals}/inp.js +3 -57
  51. package/build/esm/web-vitals/inp.js.map +1 -0
  52. package/build/esm/web-vitals/lcp.js +7 -0
  53. package/build/esm/web-vitals/lcp.js.map +1 -0
  54. package/build/esm/web-vitals/reportEvents.js +29 -0
  55. package/build/esm/web-vitals/reportEvents.js.map +1 -0
  56. package/build/esm/{metrics/webVitalSpans.js → web-vitals/spans.js} +32 -15
  57. package/build/esm/web-vitals/spans.js.map +1 -0
  58. package/build/esm/web-vitals/tracking.js +161 -0
  59. package/build/esm/web-vitals/tracking.js.map +1 -0
  60. package/build/esm/web-vitals/utils.js +91 -0
  61. package/build/esm/web-vitals/utils.js.map +1 -0
  62. package/build/types/index.d.ts +13 -11
  63. package/build/types/index.d.ts.map +1 -1
  64. package/build/types/instrumentation/dom.d.ts.map +1 -0
  65. package/build/types/instrumentation/history.d.ts.map +1 -0
  66. package/build/types/instrumentation/location.d.ts.map +1 -0
  67. package/build/types/{metrics/instrument.d.ts → instrumentation/performanceObserver.d.ts} +3 -3
  68. package/build/types/instrumentation/performanceObserver.d.ts.map +1 -0
  69. package/build/types/instrumentation/xhr.d.ts.map +1 -0
  70. package/build/types/performance/elementTiming.d.ts.map +1 -0
  71. package/build/types/performance/entries.d.ts +49 -0
  72. package/build/types/performance/entries.d.ts.map +1 -0
  73. package/build/types/performance/resourceTiming.d.ts.map +1 -0
  74. package/build/types/performance/userTiming.d.ts +37 -0
  75. package/build/types/performance/userTiming.d.ts.map +1 -0
  76. package/build/types/performance/utils.d.ts +33 -0
  77. package/build/types/performance/utils.d.ts.map +1 -0
  78. package/build/types/types.d.ts +1 -1
  79. package/build/types/{metrics → web-vitals}/inp.d.ts +0 -13
  80. package/build/types/web-vitals/inp.d.ts.map +1 -0
  81. package/build/types/web-vitals/lcp.d.ts +6 -0
  82. package/build/types/web-vitals/lcp.d.ts.map +1 -0
  83. package/build/types/web-vitals/reportEvents.d.ts +18 -0
  84. package/build/types/web-vitals/reportEvents.d.ts.map +1 -0
  85. package/build/types/{metrics/webVitalSpans.d.ts → web-vitals/spans.d.ts} +18 -12
  86. package/build/types/web-vitals/spans.d.ts.map +1 -0
  87. package/build/types/web-vitals/tracking.d.ts +46 -0
  88. package/build/types/web-vitals/tracking.d.ts.map +1 -0
  89. package/build/types/{metrics/web-vitals/lib/globalListeners.d.ts → web-vitals/utils.d.ts} +16 -1
  90. package/build/types/web-vitals/utils.d.ts.map +1 -0
  91. package/package.json +8 -16
  92. package/build/cjs/instrument/dom.js.map +0 -1
  93. package/build/cjs/instrument/history.js.map +0 -1
  94. package/build/cjs/instrument/location.js.map +0 -1
  95. package/build/cjs/instrument/xhr.js.map +0 -1
  96. package/build/cjs/metrics/browserMetrics.js.map +0 -1
  97. package/build/cjs/metrics/cls.js +0 -64
  98. package/build/cjs/metrics/cls.js.map +0 -1
  99. package/build/cjs/metrics/elementTiming.js.map +0 -1
  100. package/build/cjs/metrics/inp.js.map +0 -1
  101. package/build/cjs/metrics/instrument.js.map +0 -1
  102. package/build/cjs/metrics/lcp.js +0 -77
  103. package/build/cjs/metrics/lcp.js.map +0 -1
  104. package/build/cjs/metrics/resourceTiming.js.map +0 -1
  105. package/build/cjs/metrics/utils.js +0 -137
  106. package/build/cjs/metrics/utils.js.map +0 -1
  107. package/build/cjs/metrics/web-vitals/getCLS.js +0 -46
  108. package/build/cjs/metrics/web-vitals/getCLS.js.map +0 -1
  109. package/build/cjs/metrics/web-vitals/getINP.js +0 -60
  110. package/build/cjs/metrics/web-vitals/getINP.js.map +0 -1
  111. package/build/cjs/metrics/web-vitals/getLCP.js +0 -62
  112. package/build/cjs/metrics/web-vitals/getLCP.js.map +0 -1
  113. package/build/cjs/metrics/web-vitals/lib/InteractionManager.js +0 -87
  114. package/build/cjs/metrics/web-vitals/lib/InteractionManager.js.map +0 -1
  115. package/build/cjs/metrics/web-vitals/lib/LCPEntryManager.js +0 -11
  116. package/build/cjs/metrics/web-vitals/lib/LCPEntryManager.js.map +0 -1
  117. package/build/cjs/metrics/web-vitals/lib/LayoutShiftManager.js +0 -27
  118. package/build/cjs/metrics/web-vitals/lib/LayoutShiftManager.js.map +0 -1
  119. package/build/cjs/metrics/web-vitals/lib/bindReporter.js +0 -31
  120. package/build/cjs/metrics/web-vitals/lib/bindReporter.js.map +0 -1
  121. package/build/cjs/metrics/web-vitals/lib/generateUniqueID.js +0 -8
  122. package/build/cjs/metrics/web-vitals/lib/generateUniqueID.js.map +0 -1
  123. package/build/cjs/metrics/web-vitals/lib/getActivationStart.js +0 -11
  124. package/build/cjs/metrics/web-vitals/lib/getActivationStart.js.map +0 -1
  125. package/build/cjs/metrics/web-vitals/lib/getNavigationEntry.js +0 -17
  126. package/build/cjs/metrics/web-vitals/lib/getNavigationEntry.js.map +0 -1
  127. package/build/cjs/metrics/web-vitals/lib/getVisibilityWatcher.js +0 -48
  128. package/build/cjs/metrics/web-vitals/lib/getVisibilityWatcher.js.map +0 -1
  129. package/build/cjs/metrics/web-vitals/lib/globalListeners.js +0 -18
  130. package/build/cjs/metrics/web-vitals/lib/globalListeners.js.map +0 -1
  131. package/build/cjs/metrics/web-vitals/lib/initMetric.js +0 -34
  132. package/build/cjs/metrics/web-vitals/lib/initMetric.js.map +0 -1
  133. package/build/cjs/metrics/web-vitals/lib/initUnique.js +0 -16
  134. package/build/cjs/metrics/web-vitals/lib/initUnique.js.map +0 -1
  135. package/build/cjs/metrics/web-vitals/lib/observe.js +0 -20
  136. package/build/cjs/metrics/web-vitals/lib/observe.js.map +0 -1
  137. package/build/cjs/metrics/web-vitals/lib/onHidden.js +0 -17
  138. package/build/cjs/metrics/web-vitals/lib/onHidden.js.map +0 -1
  139. package/build/cjs/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js +0 -32
  140. package/build/cjs/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js.map +0 -1
  141. package/build/cjs/metrics/web-vitals/lib/runOnce.js +0 -14
  142. package/build/cjs/metrics/web-vitals/lib/runOnce.js.map +0 -1
  143. package/build/cjs/metrics/web-vitals/lib/whenActivated.js +0 -14
  144. package/build/cjs/metrics/web-vitals/lib/whenActivated.js.map +0 -1
  145. package/build/cjs/metrics/web-vitals/lib/whenIdleOrHidden.js +0 -24
  146. package/build/cjs/metrics/web-vitals/lib/whenIdleOrHidden.js.map +0 -1
  147. package/build/cjs/metrics/web-vitals/onFCP.js +0 -37
  148. package/build/cjs/metrics/web-vitals/onFCP.js.map +0 -1
  149. package/build/cjs/metrics/web-vitals/onTTFB.js +0 -35
  150. package/build/cjs/metrics/web-vitals/onTTFB.js.map +0 -1
  151. package/build/cjs/metrics/webVitalSpans.js.map +0 -1
  152. package/build/esm/instrument/dom.js.map +0 -1
  153. package/build/esm/instrument/history.js.map +0 -1
  154. package/build/esm/instrument/location.js.map +0 -1
  155. package/build/esm/instrument/xhr.js.map +0 -1
  156. package/build/esm/metrics/browserMetrics.js.map +0 -1
  157. package/build/esm/metrics/cls.js +0 -61
  158. package/build/esm/metrics/cls.js.map +0 -1
  159. package/build/esm/metrics/elementTiming.js.map +0 -1
  160. package/build/esm/metrics/inp.js.map +0 -1
  161. package/build/esm/metrics/instrument.js.map +0 -1
  162. package/build/esm/metrics/lcp.js +0 -72
  163. package/build/esm/metrics/lcp.js.map +0 -1
  164. package/build/esm/metrics/resourceTiming.js.map +0 -1
  165. package/build/esm/metrics/utils.js +0 -128
  166. package/build/esm/metrics/utils.js.map +0 -1
  167. package/build/esm/metrics/web-vitals/getCLS.js +0 -43
  168. package/build/esm/metrics/web-vitals/getCLS.js.map +0 -1
  169. package/build/esm/metrics/web-vitals/getINP.js +0 -57
  170. package/build/esm/metrics/web-vitals/getINP.js.map +0 -1
  171. package/build/esm/metrics/web-vitals/getLCP.js +0 -59
  172. package/build/esm/metrics/web-vitals/getLCP.js.map +0 -1
  173. package/build/esm/metrics/web-vitals/lib/InteractionManager.js +0 -85
  174. package/build/esm/metrics/web-vitals/lib/InteractionManager.js.map +0 -1
  175. package/build/esm/metrics/web-vitals/lib/LCPEntryManager.js +0 -9
  176. package/build/esm/metrics/web-vitals/lib/LCPEntryManager.js.map +0 -1
  177. package/build/esm/metrics/web-vitals/lib/LayoutShiftManager.js +0 -25
  178. package/build/esm/metrics/web-vitals/lib/LayoutShiftManager.js.map +0 -1
  179. package/build/esm/metrics/web-vitals/lib/bindReporter.js +0 -29
  180. package/build/esm/metrics/web-vitals/lib/bindReporter.js.map +0 -1
  181. package/build/esm/metrics/web-vitals/lib/generateUniqueID.js +0 -6
  182. package/build/esm/metrics/web-vitals/lib/generateUniqueID.js.map +0 -1
  183. package/build/esm/metrics/web-vitals/lib/getActivationStart.js +0 -9
  184. package/build/esm/metrics/web-vitals/lib/getActivationStart.js.map +0 -1
  185. package/build/esm/metrics/web-vitals/lib/getNavigationEntry.js +0 -15
  186. package/build/esm/metrics/web-vitals/lib/getNavigationEntry.js.map +0 -1
  187. package/build/esm/metrics/web-vitals/lib/getVisibilityWatcher.js +0 -46
  188. package/build/esm/metrics/web-vitals/lib/getVisibilityWatcher.js.map +0 -1
  189. package/build/esm/metrics/web-vitals/lib/globalListeners.js +0 -15
  190. package/build/esm/metrics/web-vitals/lib/globalListeners.js.map +0 -1
  191. package/build/esm/metrics/web-vitals/lib/initMetric.js +0 -32
  192. package/build/esm/metrics/web-vitals/lib/initMetric.js.map +0 -1
  193. package/build/esm/metrics/web-vitals/lib/initUnique.js +0 -14
  194. package/build/esm/metrics/web-vitals/lib/initUnique.js.map +0 -1
  195. package/build/esm/metrics/web-vitals/lib/observe.js +0 -18
  196. package/build/esm/metrics/web-vitals/lib/observe.js.map +0 -1
  197. package/build/esm/metrics/web-vitals/lib/onHidden.js +0 -15
  198. package/build/esm/metrics/web-vitals/lib/onHidden.js.map +0 -1
  199. package/build/esm/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js +0 -29
  200. package/build/esm/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js.map +0 -1
  201. package/build/esm/metrics/web-vitals/lib/runOnce.js +0 -12
  202. package/build/esm/metrics/web-vitals/lib/runOnce.js.map +0 -1
  203. package/build/esm/metrics/web-vitals/lib/whenActivated.js +0 -12
  204. package/build/esm/metrics/web-vitals/lib/whenActivated.js.map +0 -1
  205. package/build/esm/metrics/web-vitals/lib/whenIdleOrHidden.js +0 -22
  206. package/build/esm/metrics/web-vitals/lib/whenIdleOrHidden.js.map +0 -1
  207. package/build/esm/metrics/web-vitals/onFCP.js +0 -34
  208. package/build/esm/metrics/web-vitals/onFCP.js.map +0 -1
  209. package/build/esm/metrics/web-vitals/onTTFB.js +0 -32
  210. package/build/esm/metrics/web-vitals/onTTFB.js.map +0 -1
  211. package/build/esm/metrics/webVitalSpans.js.map +0 -1
  212. package/build/types/instrument/dom.d.ts.map +0 -1
  213. package/build/types/instrument/history.d.ts.map +0 -1
  214. package/build/types/instrument/location.d.ts.map +0 -1
  215. package/build/types/instrument/xhr.d.ts.map +0 -1
  216. package/build/types/metrics/browserMetrics.d.ts +0 -116
  217. package/build/types/metrics/browserMetrics.d.ts.map +0 -1
  218. package/build/types/metrics/cls.d.ts +0 -17
  219. package/build/types/metrics/cls.d.ts.map +0 -1
  220. package/build/types/metrics/elementTiming.d.ts.map +0 -1
  221. package/build/types/metrics/inp.d.ts.map +0 -1
  222. package/build/types/metrics/instrument.d.ts.map +0 -1
  223. package/build/types/metrics/lcp.d.ts +0 -22
  224. package/build/types/metrics/lcp.d.ts.map +0 -1
  225. package/build/types/metrics/resourceTiming.d.ts.map +0 -1
  226. package/build/types/metrics/utils.d.ts +0 -73
  227. package/build/types/metrics/utils.d.ts.map +0 -1
  228. package/build/types/metrics/web-vitals/getCLS.d.ts +0 -26
  229. package/build/types/metrics/web-vitals/getCLS.d.ts.map +0 -1
  230. package/build/types/metrics/web-vitals/getINP.d.ts +0 -34
  231. package/build/types/metrics/web-vitals/getINP.d.ts.map +0 -1
  232. package/build/types/metrics/web-vitals/getLCP.d.ts +0 -16
  233. package/build/types/metrics/web-vitals/getLCP.d.ts.map +0 -1
  234. package/build/types/metrics/web-vitals/lib/InteractionManager.d.ts +0 -37
  235. package/build/types/metrics/web-vitals/lib/InteractionManager.d.ts.map +0 -1
  236. package/build/types/metrics/web-vitals/lib/LCPEntryManager.d.ts +0 -5
  237. package/build/types/metrics/web-vitals/lib/LCPEntryManager.d.ts.map +0 -1
  238. package/build/types/metrics/web-vitals/lib/LayoutShiftManager.d.ts +0 -7
  239. package/build/types/metrics/web-vitals/lib/LayoutShiftManager.d.ts.map +0 -1
  240. package/build/types/metrics/web-vitals/lib/bindReporter.d.ts +0 -7
  241. package/build/types/metrics/web-vitals/lib/bindReporter.d.ts.map +0 -1
  242. package/build/types/metrics/web-vitals/lib/generateUniqueID.d.ts +0 -7
  243. package/build/types/metrics/web-vitals/lib/generateUniqueID.d.ts.map +0 -1
  244. package/build/types/metrics/web-vitals/lib/getActivationStart.d.ts +0 -2
  245. package/build/types/metrics/web-vitals/lib/getActivationStart.d.ts.map +0 -1
  246. package/build/types/metrics/web-vitals/lib/getNavigationEntry.d.ts +0 -2
  247. package/build/types/metrics/web-vitals/lib/getNavigationEntry.d.ts.map +0 -1
  248. package/build/types/metrics/web-vitals/lib/getVisibilityWatcher.d.ts +0 -5
  249. package/build/types/metrics/web-vitals/lib/getVisibilityWatcher.d.ts.map +0 -1
  250. package/build/types/metrics/web-vitals/lib/globalListeners.d.ts.map +0 -1
  251. package/build/types/metrics/web-vitals/lib/initMetric.d.ts +0 -21
  252. package/build/types/metrics/web-vitals/lib/initMetric.d.ts.map +0 -1
  253. package/build/types/metrics/web-vitals/lib/initUnique.d.ts +0 -7
  254. package/build/types/metrics/web-vitals/lib/initUnique.d.ts.map +0 -1
  255. package/build/types/metrics/web-vitals/lib/observe.d.ts +0 -23
  256. package/build/types/metrics/web-vitals/lib/observe.d.ts.map +0 -1
  257. package/build/types/metrics/web-vitals/lib/onHidden.d.ts +0 -27
  258. package/build/types/metrics/web-vitals/lib/onHidden.d.ts.map +0 -1
  259. package/build/types/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts +0 -15
  260. package/build/types/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts.map +0 -1
  261. package/build/types/metrics/web-vitals/lib/runOnce.d.ts +0 -2
  262. package/build/types/metrics/web-vitals/lib/runOnce.d.ts.map +0 -1
  263. package/build/types/metrics/web-vitals/lib/whenActivated.d.ts +0 -2
  264. package/build/types/metrics/web-vitals/lib/whenActivated.d.ts.map +0 -1
  265. package/build/types/metrics/web-vitals/lib/whenIdleOrHidden.d.ts +0 -6
  266. package/build/types/metrics/web-vitals/lib/whenIdleOrHidden.d.ts.map +0 -1
  267. package/build/types/metrics/web-vitals/onFCP.d.ts +0 -11
  268. package/build/types/metrics/web-vitals/onFCP.d.ts.map +0 -1
  269. package/build/types/metrics/web-vitals/onTTFB.d.ts +0 -20
  270. package/build/types/metrics/web-vitals/onTTFB.d.ts.map +0 -1
  271. package/build/types/metrics/web-vitals/types/base.d.ts +0 -103
  272. package/build/types/metrics/web-vitals/types/base.d.ts.map +0 -1
  273. package/build/types/metrics/web-vitals/types/cls.d.ts +0 -58
  274. package/build/types/metrics/web-vitals/types/cls.d.ts.map +0 -1
  275. package/build/types/metrics/web-vitals/types/fcp.d.ts +0 -47
  276. package/build/types/metrics/web-vitals/types/fcp.d.ts.map +0 -1
  277. package/build/types/metrics/web-vitals/types/inp.d.ts +0 -150
  278. package/build/types/metrics/web-vitals/types/inp.d.ts.map +0 -1
  279. package/build/types/metrics/web-vitals/types/lcp.d.ts +0 -74
  280. package/build/types/metrics/web-vitals/types/lcp.d.ts.map +0 -1
  281. package/build/types/metrics/web-vitals/types/ttfb.d.ts +0 -60
  282. package/build/types/metrics/web-vitals/types/ttfb.d.ts.map +0 -1
  283. package/build/types/metrics/web-vitals/types.d.ts +0 -78
  284. package/build/types/metrics/web-vitals/types.d.ts.map +0 -1
  285. package/build/types/metrics/webVitalSpans.d.ts.map +0 -1
  286. package/build/types-ts3.8/debug-build.d.ts +0 -7
  287. package/build/types-ts3.8/getNativeImplementation.d.ts +0 -69
  288. package/build/types-ts3.8/htmlTreeAsString.d.ts +0 -11
  289. package/build/types-ts3.8/index.d.ts +0 -17
  290. package/build/types-ts3.8/instrument/dom.d.ts +0 -11
  291. package/build/types-ts3.8/instrument/history.d.ts +0 -15
  292. package/build/types-ts3.8/instrument/location.d.ts +0 -13
  293. package/build/types-ts3.8/instrument/xhr.d.ts +0 -14
  294. package/build/types-ts3.8/is.d.ts +0 -7
  295. package/build/types-ts3.8/metrics/browserMetrics.d.ts +0 -119
  296. package/build/types-ts3.8/metrics/cls.d.ts +0 -17
  297. package/build/types-ts3.8/metrics/elementTiming.d.ts +0 -21
  298. package/build/types-ts3.8/metrics/inp.d.ts +0 -35
  299. package/build/types-ts3.8/metrics/instrument.d.ts +0 -121
  300. package/build/types-ts3.8/metrics/lcp.d.ts +0 -22
  301. package/build/types-ts3.8/metrics/resourceTiming.d.ts +0 -13
  302. package/build/types-ts3.8/metrics/utils.d.ts +0 -73
  303. package/build/types-ts3.8/metrics/web-vitals/getCLS.d.ts +0 -26
  304. package/build/types-ts3.8/metrics/web-vitals/getINP.d.ts +0 -34
  305. package/build/types-ts3.8/metrics/web-vitals/getLCP.d.ts +0 -16
  306. package/build/types-ts3.8/metrics/web-vitals/lib/InteractionManager.d.ts +0 -37
  307. package/build/types-ts3.8/metrics/web-vitals/lib/LCPEntryManager.d.ts +0 -5
  308. package/build/types-ts3.8/metrics/web-vitals/lib/LayoutShiftManager.d.ts +0 -7
  309. package/build/types-ts3.8/metrics/web-vitals/lib/bindReporter.d.ts +0 -7
  310. package/build/types-ts3.8/metrics/web-vitals/lib/generateUniqueID.d.ts +0 -7
  311. package/build/types-ts3.8/metrics/web-vitals/lib/getActivationStart.d.ts +0 -2
  312. package/build/types-ts3.8/metrics/web-vitals/lib/getNavigationEntry.d.ts +0 -2
  313. package/build/types-ts3.8/metrics/web-vitals/lib/getVisibilityWatcher.d.ts +0 -5
  314. package/build/types-ts3.8/metrics/web-vitals/lib/globalListeners.d.ts +0 -11
  315. package/build/types-ts3.8/metrics/web-vitals/lib/initMetric.d.ts +0 -21
  316. package/build/types-ts3.8/metrics/web-vitals/lib/initUnique.d.ts +0 -7
  317. package/build/types-ts3.8/metrics/web-vitals/lib/observe.d.ts +0 -23
  318. package/build/types-ts3.8/metrics/web-vitals/lib/onHidden.d.ts +0 -27
  319. package/build/types-ts3.8/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts +0 -15
  320. package/build/types-ts3.8/metrics/web-vitals/lib/runOnce.d.ts +0 -2
  321. package/build/types-ts3.8/metrics/web-vitals/lib/whenActivated.d.ts +0 -2
  322. package/build/types-ts3.8/metrics/web-vitals/lib/whenIdleOrHidden.d.ts +0 -6
  323. package/build/types-ts3.8/metrics/web-vitals/onFCP.d.ts +0 -11
  324. package/build/types-ts3.8/metrics/web-vitals/onTTFB.d.ts +0 -20
  325. package/build/types-ts3.8/metrics/web-vitals/types/base.d.ts +0 -106
  326. package/build/types-ts3.8/metrics/web-vitals/types/cls.d.ts +0 -58
  327. package/build/types-ts3.8/metrics/web-vitals/types/fcp.d.ts +0 -47
  328. package/build/types-ts3.8/metrics/web-vitals/types/inp.d.ts +0 -150
  329. package/build/types-ts3.8/metrics/web-vitals/types/lcp.d.ts +0 -74
  330. package/build/types-ts3.8/metrics/web-vitals/types/ttfb.d.ts +0 -60
  331. package/build/types-ts3.8/metrics/web-vitals/types.d.ts +0 -78
  332. package/build/types-ts3.8/metrics/webVitalSpans.d.ts +0 -65
  333. package/build/types-ts3.8/networkUtils.d.ts +0 -28
  334. package/build/types-ts3.8/types.d.ts +0 -15
  335. /package/build/cjs/{instrument → instrumentation}/dom.js +0 -0
  336. /package/build/cjs/{instrument → instrumentation}/history.js +0 -0
  337. /package/build/cjs/{instrument → instrumentation}/location.js +0 -0
  338. /package/build/cjs/{instrument → instrumentation}/xhr.js +0 -0
  339. /package/build/cjs/{metrics → performance}/resourceTiming.js +0 -0
  340. /package/build/esm/{instrument → instrumentation}/dom.js +0 -0
  341. /package/build/esm/{instrument → instrumentation}/history.js +0 -0
  342. /package/build/esm/{instrument → instrumentation}/location.js +0 -0
  343. /package/build/esm/{instrument → instrumentation}/xhr.js +0 -0
  344. /package/build/esm/{metrics → performance}/resourceTiming.js +0 -0
  345. /package/build/types/{instrument → instrumentation}/dom.d.ts +0 -0
  346. /package/build/types/{instrument → instrumentation}/history.d.ts +0 -0
  347. /package/build/types/{instrument → instrumentation}/location.d.ts +0 -0
  348. /package/build/types/{instrument → instrumentation}/xhr.d.ts +0 -0
  349. /package/build/types/{metrics → performance}/elementTiming.d.ts +0 -0
  350. /package/build/types/{metrics → performance}/resourceTiming.d.ts +0 -0
@@ -1,57 +0,0 @@
1
- import { bindReporter } from './lib/bindReporter.js';
2
- import { getVisibilityWatcher } from './lib/getVisibilityWatcher.js';
3
- import { initMetric } from './lib/initMetric.js';
4
- import { initUnique } from './lib/initUnique.js';
5
- import { InteractionManager } from './lib/InteractionManager.js';
6
- import { observe } from './lib/observe.js';
7
- import { initInteractionCountPolyfill } from './lib/polyfills/interactionCountPolyfill.js';
8
- import { whenActivated } from './lib/whenActivated.js';
9
- import { whenIdleOrHidden } from './lib/whenIdleOrHidden.js';
10
-
11
- const INPThresholds = [200, 500];
12
- const DEFAULT_DURATION_THRESHOLD = 40;
13
- const onINP = (onReport, opts = {}) => {
14
- if (!(globalThis.PerformanceEventTiming && "interactionId" in PerformanceEventTiming.prototype)) {
15
- return;
16
- }
17
- const visibilityWatcher = getVisibilityWatcher();
18
- whenActivated(() => {
19
- initInteractionCountPolyfill();
20
- const metric = initMetric("INP");
21
- let report;
22
- const interactionManager = initUnique(opts, InteractionManager);
23
- const handleEntries = (entries) => {
24
- whenIdleOrHidden(() => {
25
- for (const entry of entries) {
26
- interactionManager._processEntry(entry);
27
- }
28
- const inp = interactionManager._estimateP98LongestInteraction();
29
- if (inp && inp._latency !== metric.value) {
30
- metric.value = inp._latency;
31
- metric.entries = inp.entries;
32
- report();
33
- }
34
- });
35
- };
36
- const po = observe("event", handleEntries, {
37
- // Event Timing entries have their durations rounded to the nearest 8ms,
38
- // so a duration of 40ms would be any event that spans 2.5 or more frames
39
- // at 60Hz. This threshold is chosen to strike a balance between usefulness
40
- // and performance. Running this callback for any interaction that spans
41
- // just one or two frames is likely not worth the insight that could be
42
- // gained.
43
- durationThreshold: opts.durationThreshold ?? DEFAULT_DURATION_THRESHOLD
44
- });
45
- report = bindReporter(onReport, metric, INPThresholds, opts.reportAllChanges);
46
- if (po) {
47
- po.observe({ type: "first-input", buffered: true });
48
- visibilityWatcher.onHidden(() => {
49
- handleEntries(po.takeRecords());
50
- report(true);
51
- });
52
- }
53
- });
54
- };
55
-
56
- export { INPThresholds, onINP };
57
- //# 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":[],"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,oBAAoB,oBAAA,EAAqB;AAE/C,EAAA,aAAA,CAAc,MAAM;AAElB,IAAA,4BAAA,EAA6B;AAE7B,IAAA,MAAM,MAAA,GAAS,WAAW,KAAK,CAAA;AAE/B,IAAA,IAAI,MAAA;AAEJ,IAAA,MAAM,kBAAA,GAAqB,UAAA,CAAW,IAAA,EAAM,kBAAkB,CAAA;AAE9D,IAAA,MAAM,aAAA,GAAgB,CAAC,OAAA,KAAkC;AAOvD,MAAA,gBAAA,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,GAAK,OAAA,CAAQ,OAAA,EAAS,aAAA,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOzC,iBAAA,EAAmB,KAAK,iBAAA,IAAqB;AAAA,KAC9C,CAAA;AAED,IAAA,MAAA,GAAS,YAAA,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,59 +0,0 @@
1
- import { bindReporter } from './lib/bindReporter.js';
2
- import { getActivationStart } from './lib/getActivationStart.js';
3
- import { getVisibilityWatcher } from './lib/getVisibilityWatcher.js';
4
- import { addPageListener, removePageListener } from './lib/globalListeners.js';
5
- import { initMetric } from './lib/initMetric.js';
6
- import { initUnique } from './lib/initUnique.js';
7
- import { LCPEntryManager } from './lib/LCPEntryManager.js';
8
- import { observe } from './lib/observe.js';
9
- import { runOnce } from './lib/runOnce.js';
10
- import { whenActivated } from './lib/whenActivated.js';
11
- import { whenIdleOrHidden } from './lib/whenIdleOrHidden.js';
12
-
13
- const LCPThresholds = [2500, 4e3];
14
- const onLCP = (onReport, opts = {}) => {
15
- whenActivated(() => {
16
- const visibilityWatcher = getVisibilityWatcher();
17
- const metric = initMetric("LCP");
18
- let report;
19
- const lcpEntryManager = initUnique(opts, LCPEntryManager);
20
- const handleEntries = (entries) => {
21
- if (!opts.reportAllChanges) {
22
- entries = entries.slice(-1);
23
- }
24
- for (const entry of entries) {
25
- lcpEntryManager._processEntry(entry);
26
- if (entry.startTime < visibilityWatcher.firstHiddenTime) {
27
- metric.value = Math.max(entry.startTime - getActivationStart(), 0);
28
- metric.entries = [entry];
29
- report();
30
- }
31
- }
32
- };
33
- const po = observe("largest-contentful-paint", handleEntries);
34
- if (po) {
35
- report = bindReporter(onReport, metric, LCPThresholds, opts.reportAllChanges);
36
- const stopListening = runOnce(() => {
37
- handleEntries(po.takeRecords());
38
- po.disconnect();
39
- report(true);
40
- });
41
- const stopListeningWrapper = (event) => {
42
- if (event.isTrusted) {
43
- whenIdleOrHidden(stopListening);
44
- removePageListener(event.type, stopListeningWrapper, {
45
- capture: true
46
- });
47
- }
48
- };
49
- for (const type of ["keydown", "click", "visibilitychange"]) {
50
- addPageListener(type, stopListeningWrapper, {
51
- capture: true
52
- });
53
- }
54
- }
55
- });
56
- };
57
-
58
- export { LCPThresholds, onLCP };
59
- //# 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":[],"mappings":";;;;;;;;;;;;AA8BO,MAAM,aAAA,GAAwC,CAAC,IAAA,EAAM,GAAI;AAazD,MAAM,KAAA,GAAQ,CAAC,QAAA,EAAuC,IAAA,GAAmB,EAAC,KAAM;AACrF,EAAA,aAAA,CAAc,MAAM;AAClB,IAAA,MAAM,oBAAoB,oBAAA,EAAqB;AAC/C,IAAA,MAAM,MAAA,GAAS,WAAW,KAAK,CAAA;AAC/B,IAAA,IAAI,MAAA;AAEJ,IAAA,MAAM,eAAA,GAAkB,UAAA,CAAW,IAAA,EAAM,eAAe,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,GAAY,kBAAA,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,GAAK,OAAA,CAAQ,0BAAA,EAA4B,aAAa,CAAA;AAE5D,IAAA,IAAI,EAAA,EAAI;AACN,MAAA,MAAA,GAAS,YAAA,CAAa,QAAA,EAAU,MAAA,EAAQ,aAAA,EAAe,KAAK,gBAAgB,CAAA;AAI5E,MAAA,MAAM,aAAA,GAAgB,QAAQ,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,UAAA,gBAAA,CAAiB,aAAa,CAAA;AAC9B,UAAA,kBAAA,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,QAAA,eAAA,CAAgB,MAAM,oBAAA,EAAsB;AAAA,UAC1C,OAAA,EAAS;AAAA,SACV,CAAA;AAAA,MACH;AAAA,IACF;AAAA,EACF,CAAC,CAAA;AACH;;;;"}
@@ -1,85 +0,0 @@
1
- import { getInteractionCount } from './polyfills/interactionCountPolyfill.js';
2
-
3
- const MAX_INTERACTIONS_TO_CONSIDER = 10;
4
- let prevInteractionCount = 0;
5
- const getInteractionCountForNavigation = () => {
6
- return getInteractionCount() - prevInteractionCount;
7
- };
8
- class InteractionManager {
9
- constructor() {
10
- /**
11
- * A list of longest interactions on the page (by latency) sorted so the
12
- * longest one is first. The list is at most MAX_INTERACTIONS_TO_CONSIDER
13
- * long.
14
- */
15
- // oxlint-disable-next-line sdk/no-class-field-initializers
16
- this._longestInteractionList = [];
17
- /**
18
- * A mapping of longest interactions by their interaction ID.
19
- * This is used for faster lookup.
20
- */
21
- // oxlint-disable-next-line sdk/no-class-field-initializers
22
- this._longestInteractionMap = /* @__PURE__ */ new Map();
23
- }
24
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility, jsdoc/require-jsdoc
25
- _resetInteractions() {
26
- prevInteractionCount = getInteractionCount();
27
- this._longestInteractionList.length = 0;
28
- this._longestInteractionMap.clear();
29
- }
30
- /**
31
- * Returns the estimated p98 longest interaction based on the stored
32
- * interaction candidates and the interaction count for the current page.
33
- */
34
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
35
- _estimateP98LongestInteraction() {
36
- const candidateInteractionIndex = Math.min(
37
- this._longestInteractionList.length - 1,
38
- Math.floor(getInteractionCountForNavigation() / 50)
39
- );
40
- return this._longestInteractionList[candidateInteractionIndex];
41
- }
42
- /**
43
- * Takes a performance entry and adds it to the list of worst interactions
44
- * if its duration is long enough to make it among the worst. If the
45
- * entry is part of an existing interaction, it is merged and the latency
46
- * and entries list is updated as needed.
47
- */
48
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
49
- _processEntry(entry) {
50
- this._onBeforeProcessingEntry?.(entry);
51
- if (!(entry.interactionId || entry.entryType === "first-input")) return;
52
- const minLongestInteraction = this._longestInteractionList.at(-1);
53
- let interaction = this._longestInteractionMap.get(entry.interactionId);
54
- if (interaction || this._longestInteractionList.length < MAX_INTERACTIONS_TO_CONSIDER || // If the above conditions are false, `minLongestInteraction` will be set.
55
- entry.duration > minLongestInteraction._latency) {
56
- if (interaction) {
57
- if (entry.duration > interaction._latency) {
58
- interaction.entries = [entry];
59
- interaction._latency = entry.duration;
60
- } else if (entry.duration === interaction._latency && entry.startTime === interaction.entries[0].startTime) {
61
- interaction.entries.push(entry);
62
- }
63
- } else {
64
- interaction = {
65
- id: entry.interactionId,
66
- entries: [entry],
67
- _latency: entry.duration
68
- };
69
- this._longestInteractionMap.set(interaction.id, interaction);
70
- this._longestInteractionList.push(interaction);
71
- }
72
- this._longestInteractionList.sort((a, b) => b._latency - a._latency);
73
- if (this._longestInteractionList.length > MAX_INTERACTIONS_TO_CONSIDER) {
74
- const removedInteractions = this._longestInteractionList.splice(MAX_INTERACTIONS_TO_CONSIDER);
75
- for (const interaction2 of removedInteractions) {
76
- this._longestInteractionMap.delete(interaction2.id);
77
- }
78
- }
79
- this._onAfterProcessingINPCandidate?.(interaction);
80
- }
81
- }
82
- }
83
-
84
- export { InteractionManager };
85
- //# 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":["interaction"],"mappings":";;AA8BA,MAAM,4BAAA,GAA+B,EAAA;AAIrC,IAAI,oBAAA,GAAuB,CAAA;AAM3B,MAAM,mCAAmC,MAAM;AAC7C,EAAA,OAAO,qBAAoB,GAAI,oBAAA;AACjC,CAAA;AAKO,MAAM,kBAAA,CAAmB;AAAA,EAAzB,WAAA,GAAA;AAOL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAA,uBAAA,GAAyC,EAAC;AAO1C;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAA,sBAAA,uBAAuD,GAAA,EAAI;AAAA,EAAA;AAAA;AAAA,EAS3D,kBAAA,GAAqB;AACnB,IAAA,oBAAA,GAAuB,mBAAA,EAAoB;AAC3C,IAAA,IAAA,CAAK,wBAAwB,MAAA,GAAS,CAAA;AACtC,IAAA,IAAA,CAAK,uBAAuB,KAAA,EAAM;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,8BAAA,GAAiC;AAC/B,IAAA,MAAM,4BAA4B,IAAA,CAAK,GAAA;AAAA,MACrC,IAAA,CAAK,wBAAwB,MAAA,GAAS,CAAA;AAAA,MACtC,IAAA,CAAK,KAAA,CAAM,gCAAA,EAAiC,GAAI,EAAE;AAAA,KACpD;AAEA,IAAA,OAAO,IAAA,CAAK,wBAAwB,yBAAyB,CAAA;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,cAAc,KAAA,EAA+B;AAC3C,IAAA,IAAA,CAAK,2BAA2B,KAAK,CAAA;AAGrC,IAAA,IAAI,EAAE,KAAA,CAAM,aAAA,IAAiB,KAAA,CAAM,cAAc,aAAA,CAAA,EAAgB;AAGjE,IAAA,MAAM,qBAAA,GAAwB,IAAA,CAAK,uBAAA,CAAwB,EAAA,CAAG,EAAE,CAAA;AAEhE,IAAA,IAAI,WAAA,GAAc,IAAA,CAAK,sBAAA,CAAuB,GAAA,CAAI,MAAM,aAAa,CAAA;AAIrE,IAAA,IACE,WAAA,IACA,IAAA,CAAK,uBAAA,CAAwB,MAAA,GAAS,4BAAA;AAAA,IAEtC,KAAA,CAAM,QAAA,GAAW,qBAAA,CAAuB,QAAA,EACxC;AAEA,MAAA,IAAI,WAAA,EAAa;AAGf,QAAA,IAAI,KAAA,CAAM,QAAA,GAAW,WAAA,CAAY,QAAA,EAAU;AACzC,UAAA,WAAA,CAAY,OAAA,GAAU,CAAC,KAAK,CAAA;AAC5B,UAAA,WAAA,CAAY,WAAW,KAAA,CAAM,QAAA;AAAA,QAC/B,CAAA,MAAA,IAAW,KAAA,CAAM,QAAA,KAAa,WAAA,CAAY,QAAA,IAAY,KAAA,CAAM,SAAA,KAAc,WAAA,CAAY,OAAA,CAAQ,CAAC,CAAA,CAAG,SAAA,EAAW;AAC3G,UAAA,WAAA,CAAY,OAAA,CAAQ,KAAK,KAAK,CAAA;AAAA,QAChC;AAAA,MACF,CAAA,MAAO;AACL,QAAA,WAAA,GAAc;AAAA,UACZ,IAAI,KAAA,CAAM,aAAA;AAAA,UACV,OAAA,EAAS,CAAC,KAAK,CAAA;AAAA,UACf,UAAU,KAAA,CAAM;AAAA,SAClB;AACA,QAAA,IAAA,CAAK,sBAAA,CAAuB,GAAA,CAAI,WAAA,CAAY,EAAA,EAAI,WAAW,CAAA;AAC3D,QAAA,IAAA,CAAK,uBAAA,CAAwB,KAAK,WAAW,CAAA;AAAA,MAC/C;AAGA,MAAA,IAAA,CAAK,uBAAA,CAAwB,KAAK,CAAC,CAAA,EAAG,MAAM,CAAA,CAAE,QAAA,GAAW,EAAE,QAAQ,CAAA;AACnE,MAAA,IAAI,IAAA,CAAK,uBAAA,CAAwB,MAAA,GAAS,4BAAA,EAA8B;AACtE,QAAA,MAAM,mBAAA,GAAsB,IAAA,CAAK,uBAAA,CAAwB,MAAA,CAAO,4BAA4B,CAAA;AAE5F,QAAA,KAAA,MAAWA,gBAAe,mBAAA,EAAqB;AAC7C,UAAA,IAAA,CAAK,sBAAA,CAAuB,MAAA,CAAOA,YAAAA,CAAY,EAAE,CAAA;AAAA,QACnD;AAAA,MACF;AAGA,MAAA,IAAA,CAAK,iCAAiC,WAAW,CAAA;AAAA,IACnD;AAAA,EACF;AACF;;;;"}
@@ -1,9 +0,0 @@
1
- class LCPEntryManager {
2
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility, jsdoc/require-jsdoc
3
- _processEntry(entry) {
4
- this._onBeforeProcessingEntry?.(entry);
5
- }
6
- }
7
-
8
- export { LCPEntryManager };
9
- //# 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,25 +0,0 @@
1
- class LayoutShiftManager {
2
- constructor() {
3
- // oxlint-disable-next-line sdk/no-class-field-initializers
4
- this._sessionValue = 0;
5
- // oxlint-disable-next-line sdk/no-class-field-initializers
6
- this._sessionEntries = [];
7
- }
8
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
9
- _processEntry(entry) {
10
- if (entry.hadRecentInput) return;
11
- const firstSessionEntry = this._sessionEntries[0];
12
- const lastSessionEntry = this._sessionEntries[this._sessionEntries.length - 1];
13
- if (this._sessionValue && firstSessionEntry && lastSessionEntry && entry.startTime - lastSessionEntry.startTime < 1e3 && entry.startTime - firstSessionEntry.startTime < 5e3) {
14
- this._sessionValue += entry.value;
15
- this._sessionEntries.push(entry);
16
- } else {
17
- this._sessionValue = entry.value;
18
- this._sessionEntries = [entry];
19
- }
20
- this._onAfterProcessingUnexpectedShift?.(entry);
21
- }
22
- }
23
-
24
- export { LayoutShiftManager };
25
- //# 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,29 +0,0 @@
1
- const getRating = (value, thresholds) => {
2
- if (value > thresholds[1]) {
3
- return "poor";
4
- }
5
- if (value > thresholds[0]) {
6
- return "needs-improvement";
7
- }
8
- return "good";
9
- };
10
- const bindReporter = (callback, metric, thresholds, reportAllChanges) => {
11
- let prevValue;
12
- let delta;
13
- return (forceReport) => {
14
- if (metric.value >= 0) {
15
- if (forceReport || reportAllChanges) {
16
- delta = metric.value - (prevValue ?? 0);
17
- if (delta || prevValue === void 0) {
18
- prevValue = metric.value;
19
- metric.delta = delta;
20
- metric.rating = getRating(metric.value, thresholds);
21
- callback(metric);
22
- }
23
- }
24
- }
25
- };
26
- };
27
-
28
- export { bindReporter };
29
- //# 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,6 +0,0 @@
1
- const generateUniqueID = () => {
2
- return `v5-${Date.now()}-${Math.floor(Math.random() * (9e12 - 1)) + 1e12}`;
3
- };
4
-
5
- export { generateUniqueID };
6
- //# 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,9 +0,0 @@
1
- import { getNavigationEntry } from './getNavigationEntry.js';
2
-
3
- const getActivationStart = () => {
4
- const navEntry = getNavigationEntry();
5
- return navEntry?.activationStart ?? 0;
6
- };
7
-
8
- export { getActivationStart };
9
- //# 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":[],"mappings":";;AAkBO,MAAM,qBAAqB,MAAc;AAC9C,EAAA,MAAM,WAAW,kBAAA,EAAmB;AACpC,EAAA,OAAO,UAAU,eAAA,IAAmB,CAAA;AACtC;;;;"}
@@ -1,15 +0,0 @@
1
- import { WINDOW } from '../../../types.js';
2
-
3
- const getNavigationEntry = (checkResponseStart = true) => {
4
- const navigationEntry = WINDOW.performance?.getEntriesByType?.("navigation")[0];
5
- if (
6
- // sentry-specific change:
7
- // We don't want to check for responseStart for our own use of `getNavigationEntry`
8
- !checkResponseStart || navigationEntry && navigationEntry.responseStart > 0 && navigationEntry.responseStart < performance.now()
9
- ) {
10
- return navigationEntry;
11
- }
12
- };
13
-
14
- export { getNavigationEntry };
15
- //# 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":[],"mappings":";;AAoBO,MAAM,kBAAA,GAAqB,CAAC,kBAAA,GAAqB,IAAA,KAA6C;AACnG,EAAA,MAAM,kBAAkB,MAAA,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,46 +0,0 @@
1
- import { WINDOW } from '../../../types.js';
2
- import { getActivationStart } from './getActivationStart.js';
3
- import { addPageListener, removePageListener } from './globalListeners.js';
4
-
5
- let firstHiddenTime = -1;
6
- const onHiddenFunctions = /* @__PURE__ */ new Set();
7
- const initHiddenTime = () => {
8
- return WINDOW.document?.visibilityState === "hidden" && !WINDOW.document?.prerendering ? 0 : Infinity;
9
- };
10
- const onVisibilityUpdate = (event) => {
11
- if (isPageHidden(event) && firstHiddenTime > -1) {
12
- if (event.type === "visibilitychange" || event.type === "pagehide") {
13
- for (const onHiddenFunction of onHiddenFunctions) {
14
- onHiddenFunction();
15
- }
16
- }
17
- if (!isFinite(firstHiddenTime)) {
18
- firstHiddenTime = event.type === "visibilitychange" ? event.timeStamp : 0;
19
- removePageListener("prerenderingchange", onVisibilityUpdate, true);
20
- }
21
- }
22
- };
23
- const getVisibilityWatcher = () => {
24
- if (WINDOW.document && firstHiddenTime < 0) {
25
- const activationStart = getActivationStart();
26
- const firstVisibilityStateHiddenTime = !WINDOW.document.prerendering ? globalThis.performance.getEntriesByType("visibility-state").filter((e) => e.name === "hidden" && e.startTime > activationStart)[0]?.startTime : void 0;
27
- firstHiddenTime = firstVisibilityStateHiddenTime ?? initHiddenTime();
28
- addPageListener("visibilitychange", onVisibilityUpdate, true);
29
- addPageListener("pagehide", onVisibilityUpdate, true);
30
- addPageListener("prerenderingchange", onVisibilityUpdate, true);
31
- }
32
- return {
33
- get firstHiddenTime() {
34
- return firstHiddenTime;
35
- },
36
- onHidden(cb) {
37
- onHiddenFunctions.add(cb);
38
- }
39
- };
40
- };
41
- function isPageHidden(event) {
42
- return event.type === "pagehide" || WINDOW.document?.visibilityState === "hidden";
43
- }
44
-
45
- export { getVisibilityWatcher };
46
- //# 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 (isPageHidden(event) && firstHiddenTime > -1) {\n // Sentry-specific change: Also call onHidden callbacks for pagehide events\n // to support older browsers (Safari <14.4) that don't properly fire visibilitychange\n if (event.type === 'visibilitychange' || event.type === 'pagehide') {\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' or 'pagehide' 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 and pagehide ones 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 // Sentry-specific change: Some browsers have buggy implementations of visibilitychange,\n // so we use pagehide in addition, just to be safe. This is also required for older\n // Safari versions (<14.4) that we still support.\n addPageListener('pagehide', 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\n/**\n * Check if the page is hidden, uses the `pagehide` event for older browsers support that we used to have in `onHidden` function.\n * Some browsers we still support (Safari <14.4) don't fully support `visibilitychange`\n * or have known bugs w.r.t the `visibilitychange` event.\n * // TODO (v11): If we decide to drop support for Safari 14.4, we can use the logic from web-vitals 4.2.4\n */\nfunction isPageHidden(event: Event) {\n return event.type === 'pagehide' || WINDOW.document?.visibilityState === 'hidden';\n}\n"],"names":[],"mappings":";;;;AAoBA,IAAI,eAAA,GAAkB,EAAA;AACtB,MAAM,iBAAA,uBAAyC,GAAA,EAAI;AAEnD,MAAM,iBAAiB,MAAM;AAM3B,EAAA,OAAO,MAAA,CAAO,UAAU,eAAA,KAAoB,QAAA,IAAY,CAAC,MAAA,CAAO,QAAA,EAAU,eAAe,CAAA,GAAI,QAAA;AAC/F,CAAA;AAEA,MAAM,kBAAA,GAAqB,CAAC,KAAA,KAAiB;AAE3C,EAAA,IAAI,YAAA,CAAa,KAAK,CAAA,IAAK,eAAA,GAAkB,EAAA,EAAI;AAG/C,IAAA,IAAI,KAAA,CAAM,IAAA,KAAS,kBAAA,IAAsB,KAAA,CAAM,SAAS,UAAA,EAAY;AAClE,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,MAAA,kBAAA,CAAmB,oBAAA,EAAsB,oBAAoB,IAAI,CAAA;AAAA,IACnE;AAAA,EACF;AACF,CAAA;AAEO,MAAM,uBAAuB,MAAM;AACxC,EAAA,IAAI,MAAA,CAAO,QAAA,IAAY,eAAA,GAAkB,CAAA,EAAG;AAE1C,IAAA,MAAM,kBAAkB,kBAAA,EAAmB;AAC3C,IAAA,MAAM,8BAAA,GAAiC,CAAC,MAAA,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,IAAA,eAAA,CAAgB,kBAAA,EAAoB,oBAAoB,IAAI,CAAA;AAK5D,IAAA,eAAA,CAAgB,UAAA,EAAY,oBAAoB,IAAI,CAAA;AAMpD,IAAA,eAAA,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;AAQA,SAAS,aAAa,KAAA,EAAc;AAClC,EAAA,OAAO,KAAA,CAAM,IAAA,KAAS,UAAA,IAAc,MAAA,CAAO,UAAU,eAAA,KAAoB,QAAA;AAC3E;;;;"}
@@ -1,15 +0,0 @@
1
- import { WINDOW } from '../../../types.js';
2
-
3
- function addPageListener(type, listener, options) {
4
- if (WINDOW.document) {
5
- WINDOW.addEventListener(type, listener, options);
6
- }
7
- }
8
- function removePageListener(type, listener, options) {
9
- if (WINDOW.document) {
10
- WINDOW.removeEventListener(type, listener, options);
11
- }
12
- }
13
-
14
- export { addPageListener, removePageListener };
15
- //# sourceMappingURL=globalListeners.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"globalListeners.js","sources":["../../../../../src/metrics/web-vitals/lib/globalListeners.ts"],"sourcesContent":["import { WINDOW } from '../../../types';\n\n/**\n * web-vitals 5.1.0 switched listeners to be added on the window rather than the document.\n * Instead of having to check for window/document every time we add a listener, we can use this function.\n */\nexport function addPageListener(type: string, listener: EventListener, options?: boolean | AddEventListenerOptions) {\n if (WINDOW.document) {\n WINDOW.addEventListener(type, listener, options);\n }\n}\n/**\n * web-vitals 5.1.0 switched listeners to be removed from the window rather than the document.\n * Instead of having to check for window/document every time we remove a listener, we can use this function.\n */\nexport function removePageListener(type: string, listener: EventListener, options?: boolean | AddEventListenerOptions) {\n if (WINDOW.document) {\n WINDOW.removeEventListener(type, listener, options);\n }\n}\n"],"names":[],"mappings":";;AAMO,SAAS,eAAA,CAAgB,IAAA,EAAc,QAAA,EAAyB,OAAA,EAA6C;AAClH,EAAA,IAAI,OAAO,QAAA,EAAU;AACnB,IAAA,MAAA,CAAO,gBAAA,CAAiB,IAAA,EAAM,QAAA,EAAU,OAAO,CAAA;AAAA,EACjD;AACF;AAKO,SAAS,kBAAA,CAAmB,IAAA,EAAc,QAAA,EAAyB,OAAA,EAA6C;AACrH,EAAA,IAAI,OAAO,QAAA,EAAU;AACnB,IAAA,MAAA,CAAO,mBAAA,CAAoB,IAAA,EAAM,QAAA,EAAU,OAAO,CAAA;AAAA,EACpD;AACF;;;;"}
@@ -1,32 +0,0 @@
1
- import { WINDOW } from '../../../types.js';
2
- import { generateUniqueID } from './generateUniqueID.js';
3
- import { getActivationStart } from './getActivationStart.js';
4
- import { getNavigationEntry } from './getNavigationEntry.js';
5
-
6
- const initMetric = (name, value = -1) => {
7
- const navEntry = getNavigationEntry();
8
- let navigationType = "navigate";
9
- if (navEntry) {
10
- if (WINDOW.document?.prerendering || getActivationStart() > 0) {
11
- navigationType = "prerender";
12
- } else if (WINDOW.document?.wasDiscarded) {
13
- navigationType = "restore";
14
- } else if (navEntry.type) {
15
- navigationType = navEntry.type.replace(/_/g, "-");
16
- }
17
- }
18
- const entries = [];
19
- return {
20
- name,
21
- value,
22
- rating: "good",
23
- // If needed, will be updated when reported. `const` to keep the type from widening to `string`.
24
- delta: 0,
25
- entries,
26
- id: generateUniqueID(),
27
- navigationType
28
- };
29
- };
30
-
31
- export { initMetric };
32
- //# sourceMappingURL=initMetric.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"initMetric.js","sources":["../../../../../src/metrics/web-vitals/lib/initMetric.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 type { MetricType } from '../types';\nimport { generateUniqueID } from './generateUniqueID';\nimport { getActivationStart } from './getActivationStart';\nimport { getNavigationEntry } from './getNavigationEntry';\n\nexport const initMetric = <MetricName extends MetricType['name']>(name: MetricName, value: number = -1) => {\n const navEntry = getNavigationEntry();\n let navigationType: MetricType['navigationType'] = 'navigate';\n\n if (navEntry) {\n if (WINDOW.document?.prerendering || getActivationStart() > 0) {\n navigationType = 'prerender';\n } else if (WINDOW.document?.wasDiscarded) {\n navigationType = 'restore';\n } else if (navEntry.type) {\n navigationType = navEntry.type.replace(/_/g, '-') as MetricType['navigationType'];\n }\n }\n\n // Use `entries` type specific for the metric.\n const entries: Extract<MetricType, { name: MetricName }>['entries'] = [];\n\n return {\n name,\n value,\n rating: 'good' as const, // If needed, will be updated when reported. `const` to keep the type from widening to `string`.\n delta: 0,\n entries,\n id: generateUniqueID(),\n navigationType,\n };\n};\n"],"names":[],"mappings":";;;;;AAsBO,MAAM,UAAA,GAAa,CAAwC,IAAA,EAAkB,KAAA,GAAgB,EAAA,KAAO;AACzG,EAAA,MAAM,WAAW,kBAAA,EAAmB;AACpC,EAAA,IAAI,cAAA,GAA+C,UAAA;AAEnD,EAAA,IAAI,QAAA,EAAU;AACZ,IAAA,IAAI,MAAA,CAAO,QAAA,EAAU,YAAA,IAAgB,kBAAA,KAAuB,CAAA,EAAG;AAC7D,MAAA,cAAA,GAAiB,WAAA;AAAA,IACnB,CAAA,MAAA,IAAW,MAAA,CAAO,QAAA,EAAU,YAAA,EAAc;AACxC,MAAA,cAAA,GAAiB,SAAA;AAAA,IACnB,CAAA,MAAA,IAAW,SAAS,IAAA,EAAM;AACxB,MAAA,cAAA,GAAiB,QAAA,CAAS,IAAA,CAAK,OAAA,CAAQ,IAAA,EAAM,GAAG,CAAA;AAAA,IAClD;AAAA,EACF;AAGA,EAAA,MAAM,UAAgE,EAAC;AAEvE,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,KAAA;AAAA,IACA,MAAA,EAAQ,MAAA;AAAA;AAAA,IACR,KAAA,EAAO,CAAA;AAAA,IACP,OAAA;AAAA,IACA,IAAI,gBAAA,EAAiB;AAAA,IACrB;AAAA,GACF;AACF;;;;"}
@@ -1,14 +0,0 @@
1
- const instanceMap = /* @__PURE__ */ new WeakMap();
2
- function initUnique(identityObj, ClassObj) {
3
- try {
4
- if (!instanceMap.get(identityObj)) {
5
- instanceMap.set(identityObj, new ClassObj());
6
- }
7
- return instanceMap.get(identityObj);
8
- } catch (_e) {
9
- return new ClassObj();
10
- }
11
- }
12
-
13
- export { initUnique };
14
- //# sourceMappingURL=initUnique.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"initUnique.js","sources":["../../../../../src/metrics/web-vitals/lib/initUnique.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\nconst instanceMap: WeakMap<object, unknown> = new WeakMap();\n\n/**\n * A function that accepts and identity object and a class object and returns\n * either a new instance of that class or an existing instance, if the\n * identity object was previously used.\n */\nexport function initUnique<T>(identityObj: object, ClassObj: new () => T): T {\n try {\n if (!instanceMap.get(identityObj)) {\n instanceMap.set(identityObj, new ClassObj());\n }\n return instanceMap.get(identityObj)! as T;\n } catch (_e) {\n // --- START Sentry-custom code (try/catch wrapping) ---\n // Fix for cases where identityObj is not a valid key for WeakMap (sometimes a problem in Safari)\n // Just return a new instance without caching it in instanceMap\n return new ClassObj();\n }\n // --- END Sentry-custom code ---\n}\n"],"names":[],"mappings":"AAgBA,MAAM,WAAA,uBAA4C,OAAA,EAAQ;AAOnD,SAAS,UAAA,CAAc,aAAqB,QAAA,EAA0B;AAC3E,EAAA,IAAI;AACF,IAAA,IAAI,CAAC,WAAA,CAAY,GAAA,CAAI,WAAW,CAAA,EAAG;AACjC,MAAA,WAAA,CAAY,GAAA,CAAI,WAAA,EAAa,IAAI,QAAA,EAAU,CAAA;AAAA,IAC7C;AACA,IAAA,OAAO,WAAA,CAAY,IAAI,WAAW,CAAA;AAAA,EACpC,SAAS,EAAA,EAAI;AAIX,IAAA,OAAO,IAAI,QAAA,EAAS;AAAA,EACtB;AAEF;;;;"}
@@ -1,18 +0,0 @@
1
- const observe = (type, callback, opts = {}) => {
2
- try {
3
- if (PerformanceObserver.supportedEntryTypes.includes(type)) {
4
- const po = new PerformanceObserver((list) => {
5
- Promise.resolve().then(() => {
6
- callback(list.getEntries());
7
- });
8
- });
9
- po.observe({ type, buffered: true, ...opts });
10
- return po;
11
- }
12
- } catch {
13
- }
14
- return;
15
- };
16
-
17
- export { observe };
18
- //# sourceMappingURL=observe.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"observe.js","sources":["../../../../../src/metrics/web-vitals/lib/observe.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\ninterface PerformanceEntryMap {\n event: PerformanceEventTiming[];\n 'first-input': PerformanceEventTiming[];\n 'layout-shift': LayoutShift[];\n 'largest-contentful-paint': LargestContentfulPaint[];\n 'long-animation-frame': PerformanceLongAnimationFrameTiming[];\n paint: PerformancePaintTiming[];\n navigation: PerformanceNavigationTiming[];\n resource: PerformanceResourceTiming[];\n // Sentry-specific change:\n // We add longtask as a supported entry type as we use this in\n // our `instrumentPerformanceObserver` function also observes 'longtask'\n // entries.\n longtask: PerformanceEntry[];\n // Sentry-specific change:\n // We add element as a supported entry type for ElementTiming API\n element: PerformanceEntry[];\n}\n\n/**\n * Takes a performance entry type and a callback function, and creates a\n * `PerformanceObserver` instance that will observe the specified entry type\n * with buffering enabled and call the callback _for each entry_.\n *\n * This function also feature-detects entry support and wraps the logic in a\n * try/catch to avoid errors in unsupporting browsers.\n */\nexport const observe = <K extends keyof PerformanceEntryMap>(\n type: K,\n callback: (entries: PerformanceEntryMap[K]) => void,\n opts: PerformanceObserverInit = {},\n): PerformanceObserver | undefined => {\n try {\n if (PerformanceObserver.supportedEntryTypes.includes(type)) {\n const po = new PerformanceObserver(list => {\n // Delay by a microtask to workaround a bug in Safari where the\n // callback is invoked immediately, rather than in a separate task.\n // See: https://github.com/GoogleChrome/web-vitals/issues/277\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n Promise.resolve().then(() => {\n callback(list.getEntries() as PerformanceEntryMap[K]);\n });\n });\n po.observe({ type, buffered: true, ...opts });\n return po;\n }\n } catch {\n // Do nothing.\n }\n return;\n};\n"],"names":[],"mappings":"AA2CO,MAAM,UAAU,CACrB,IAAA,EACA,QAAA,EACA,IAAA,GAAgC,EAAC,KACG;AACpC,EAAA,IAAI;AACF,IAAA,IAAI,mBAAA,CAAoB,mBAAA,CAAoB,QAAA,CAAS,IAAI,CAAA,EAAG;AAC1D,MAAA,MAAM,EAAA,GAAK,IAAI,mBAAA,CAAoB,CAAA,IAAA,KAAQ;AAKzC,QAAA,OAAA,CAAQ,OAAA,EAAQ,CAAE,IAAA,CAAK,MAAM;AAC3B,UAAA,QAAA,CAAS,IAAA,CAAK,YAAsC,CAAA;AAAA,QACtD,CAAC,CAAA;AAAA,MACH,CAAC,CAAA;AACD,MAAA,EAAA,CAAG,QAAQ,EAAE,IAAA,EAAM,UAAU,IAAA,EAAM,GAAG,MAAM,CAAA;AAC5C,MAAA,OAAO,EAAA;AAAA,IACT;AAAA,EACF,CAAA,CAAA,MAAQ;AAAA,EAER;AACA,EAAA;AACF;;;;"}
@@ -1,15 +0,0 @@
1
- import { WINDOW } from '../../../types.js';
2
- import { addPageListener } from './globalListeners.js';
3
-
4
- const onHidden = (cb) => {
5
- const onHiddenOrPageHide = (event) => {
6
- if (event.type === "pagehide" || WINDOW.document?.visibilityState === "hidden") {
7
- cb(event);
8
- }
9
- };
10
- addPageListener("visibilitychange", onHiddenOrPageHide, { capture: true, once: true });
11
- addPageListener("pagehide", onHiddenOrPageHide, { capture: true, once: true });
12
- };
13
-
14
- export { onHidden };
15
- //# sourceMappingURL=onHidden.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"onHidden.js","sources":["../../../../../src/metrics/web-vitals/lib/onHidden.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 { addPageListener } from './globalListeners';\n\nexport interface OnHiddenCallback {\n (event: Event): void;\n}\n\n/**\n * Sentry-specific change:\n *\n * This function's logic was NOT updated to web-vitals 4.2.4 or 5.x but we continue\n * to use the web-vitals 3.5.2 version due to having stricter browser support.\n *\n * PR with context that made the changes:\n * https://github.com/GoogleChrome/web-vitals/pull/442/files#r1530492402\n *\n * The PR removed listening to the `pagehide` event, in favour of only listening to\n * the `visibilitychange` event. This is \"more correct\" but some browsers we still\n * support (Safari <14.4) don't fully support `visibilitychange` or have known bugs\n * with respect to the `visibilitychange` event.\n *\n * TODO (v11): If we decide to drop support for Safari 14.4, we can use the logic\n * from web-vitals 4.2.4. In this case, we also need to update the integration tests\n * that currently trigger the `pagehide` event to simulate the page being hidden.\n *\n * @param {OnHiddenCallback} cb - Callback to be executed when the page is hidden or unloaded.\n *\n * @deprecated use `whenIdleOrHidden` or `addPageListener('visibilitychange')` instead\n */\nexport const onHidden = (cb: OnHiddenCallback) => {\n const onHiddenOrPageHide = (event: Event) => {\n if (event.type === 'pagehide' || WINDOW.document?.visibilityState === 'hidden') {\n cb(event);\n }\n };\n\n addPageListener('visibilitychange', onHiddenOrPageHide, { capture: true, once: true });\n // Some browsers have buggy implementations of visibilitychange,\n // so we use pagehide in addition, just to be safe.\n addPageListener('pagehide', onHiddenOrPageHide, { capture: true, once: true });\n};\n"],"names":[],"mappings":";;;AA6CO,MAAM,QAAA,GAAW,CAAC,EAAA,KAAyB;AAChD,EAAA,MAAM,kBAAA,GAAqB,CAAC,KAAA,KAAiB;AAC3C,IAAA,IAAI,MAAM,IAAA,KAAS,UAAA,IAAc,MAAA,CAAO,QAAA,EAAU,oBAAoB,QAAA,EAAU;AAC9E,MAAA,EAAA,CAAG,KAAK,CAAA;AAAA,IACV;AAAA,EACF,CAAA;AAEA,EAAA,eAAA,CAAgB,oBAAoB,kBAAA,EAAoB,EAAE,SAAS,IAAA,EAAM,IAAA,EAAM,MAAM,CAAA;AAGrF,EAAA,eAAA,CAAgB,YAAY,kBAAA,EAAoB,EAAE,SAAS,IAAA,EAAM,IAAA,EAAM,MAAM,CAAA;AAC/E;;;;"}