@atlaskit/react-ufo 3.6.6 → 3.6.7

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 (430) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/additional-payload/utils/cache-hit-ratio/index.js +5 -6
  3. package/dist/cjs/additional-payload/utils/lighthouse-metrics/cls/index.js +3 -4
  4. package/dist/cjs/additional-payload/utils/lighthouse-metrics/index.js +6 -6
  5. package/dist/cjs/additional-payload/utils/lighthouse-metrics/tbt/index.js +3 -4
  6. package/dist/cjs/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +0 -3
  7. package/dist/cjs/additional-payload/utils/lighthouse-metrics/utils/observer/index.js +10 -10
  8. package/dist/cjs/assets/index.js +14 -17
  9. package/dist/cjs/assets/utils.js +13 -10
  10. package/dist/cjs/bundle-eval-timing/index.js +8 -8
  11. package/dist/cjs/coinflip/index.js +2 -3
  12. package/dist/cjs/config/index.js +42 -30
  13. package/dist/cjs/create-experimental-interaction-metrics-payload/index.js +41 -29
  14. package/dist/cjs/create-payload/common/utils/index.js +20 -16
  15. package/dist/cjs/create-payload/index.js +120 -128
  16. package/dist/cjs/create-payload/utils/get-interaction-status.js +2 -3
  17. package/dist/cjs/create-payload/utils/get-page-visibility-up-to-ttai.js +2 -3
  18. package/dist/cjs/create-payload/utils/get-react-ufo-payload-version.js +3 -4
  19. package/dist/cjs/create-payload/utils/get-ssr-done-time-value.js +2 -3
  20. package/dist/cjs/create-payload/utils/get-vc-metrics.js +7 -8
  21. package/dist/cjs/create-post-interaction-log-payload/index.js +12 -13
  22. package/dist/cjs/custom-data/index.js +14 -6
  23. package/dist/cjs/custom-mark/index.js +3 -4
  24. package/dist/cjs/custom-spans/index.js +3 -4
  25. package/dist/cjs/custom-timings/index.js +6 -6
  26. package/dist/cjs/experience-trace-id-context/index.js +21 -16
  27. package/dist/cjs/experience-trace-id-context/utils/make-trace-http-request-headers/index.js +3 -4
  28. package/dist/cjs/feature-flags-accessed/common/utils/index.js +12 -12
  29. package/dist/cjs/feature-flags-accessed/index.js +4 -4
  30. package/dist/cjs/generate-id/index.js +2 -3
  31. package/dist/cjs/global-error-handler/index.js +16 -15
  32. package/dist/cjs/initial-page-load-extra-timing/index.js +6 -6
  33. package/dist/cjs/interaction-metrics/index.js +146 -110
  34. package/dist/cjs/interaction-metrics/post-interaction-log.js +0 -10
  35. package/dist/cjs/interaction-metrics-init/index.js +15 -16
  36. package/dist/cjs/interaction-metrics-init/schedule-idle-callback.js +2 -3
  37. package/dist/cjs/resource-timing/common/utils/config.js +10 -10
  38. package/dist/cjs/resource-timing/common/utils/resource-timing-buffer.js +14 -14
  39. package/dist/cjs/resource-timing/main.js +19 -20
  40. package/dist/cjs/resource-timing/utils.js +3 -4
  41. package/dist/cjs/round-number/index.js +3 -4
  42. package/dist/cjs/route-name/index.js +2 -3
  43. package/dist/cjs/segment/schedule-on-paint.js +2 -4
  44. package/dist/cjs/segment/segment.js +4 -5
  45. package/dist/cjs/set-interaction-error/index.js +3 -4
  46. package/dist/cjs/short-id/index.js +2 -3
  47. package/dist/cjs/ssr/index.js +21 -18
  48. package/dist/cjs/trace-interaction/index.js +4 -5
  49. package/dist/cjs/trace-pageload/index.js +6 -6
  50. package/dist/cjs/trace-press/index.js +2 -3
  51. package/dist/cjs/trace-redirect/index.js +2 -3
  52. package/dist/cjs/trace-transition/index.js +2 -3
  53. package/dist/cjs/trace-transition/utils/generate-span-id/index.js +3 -4
  54. package/dist/cjs/trace-transition/utils/set-interaction-active-trace/index.js +3 -4
  55. package/dist/cjs/vc/index.js +6 -17
  56. package/dist/cjs/vc/vc-observer/attachAbortListeners.js +3 -4
  57. package/dist/cjs/vc/vc-observer/getVCRevisionsData.js +22 -13
  58. package/dist/cjs/vc/vc-observer/getViewport.js +6 -6
  59. package/dist/cjs/vc/vc-observer/heatmap/heatmap.js +10 -20
  60. package/dist/cjs/vc/vc-observer/index.js +119 -145
  61. package/dist/cjs/vc/vc-observer/media-wrapper/vc-utils.js +3 -4
  62. package/dist/cjs/vc/vc-observer/observers/editor-lnv/index.js +0 -17
  63. package/dist/cjs/vc/vc-observer/observers/index.js +2 -29
  64. package/dist/cjs/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.js +2 -3
  65. package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/index.js +0 -16
  66. package/dist/cjs/vc/vc-observer/revisions/fy25_01.js +0 -2
  67. package/dist/cjs/vc/vc-observer/revisions/fy25_02.js +0 -2
  68. package/dist/cjs/vc/vc-observer/revisions/revisions.js +3 -4
  69. package/dist/cjs/vc/vc-observer-new/entries-timeline/index.js +0 -9
  70. package/dist/cjs/vc/vc-observer-new/get-element-name.js +2 -3
  71. package/dist/cjs/vc/vc-observer-new/get-unique-element-name.js +10 -11
  72. package/dist/cjs/vc/vc-observer-new/index.js +0 -9
  73. package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +0 -2
  74. package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +1 -6
  75. package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.js +12 -20
  76. package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.js +26 -26
  77. package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/heatmap.js +6 -18
  78. package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.js +13 -25
  79. package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/index.js +7 -8
  80. package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/calc-union-area.js +39 -48
  81. package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/index.js +7 -8
  82. package/dist/cjs/vc/vc-observer-new/metric-calculator/utils/get-viewport-height.js +2 -3
  83. package/dist/cjs/vc/vc-observer-new/metric-calculator/utils/get-viewport-width.js +2 -3
  84. package/dist/cjs/vc/vc-observer-new/metric-calculator/utils/is-viewport-entry-data.js +2 -3
  85. package/dist/cjs/vc/vc-observer-new/metric-calculator/utils/task-yield.js +7 -8
  86. package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +7 -15
  87. package/dist/cjs/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +7 -8
  88. package/dist/cjs/vc/vc-observer-new/viewport-observer/mutation-observer/index.js +14 -15
  89. package/dist/cjs/vc/vc-observer-new/viewport-observer/performance-observer/index.js +9 -9
  90. package/dist/cjs/vc/vc-observer-new/window-event-observer/index.js +1 -7
  91. package/dist/es2019/additional-payload/utils/cache-hit-ratio/index.js +4 -5
  92. package/dist/es2019/additional-payload/utils/lighthouse-metrics/cls/index.js +2 -3
  93. package/dist/es2019/additional-payload/utils/lighthouse-metrics/index.js +4 -5
  94. package/dist/es2019/additional-payload/utils/lighthouse-metrics/tbt/index.js +2 -3
  95. package/dist/es2019/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +0 -3
  96. package/dist/es2019/additional-payload/utils/lighthouse-metrics/utils/observer/index.js +8 -9
  97. package/dist/es2019/assets/index.js +14 -19
  98. package/dist/es2019/assets/utils.js +8 -10
  99. package/dist/es2019/bundle-eval-timing/index.js +6 -7
  100. package/dist/es2019/coinflip/index.js +2 -4
  101. package/dist/es2019/config/index.js +28 -29
  102. package/dist/es2019/create-experimental-interaction-metrics-payload/index.js +15 -18
  103. package/dist/es2019/create-payload/common/utils/index.js +14 -15
  104. package/dist/es2019/create-payload/index.js +75 -84
  105. package/dist/es2019/create-payload/utils/get-interaction-status.js +2 -4
  106. package/dist/es2019/create-payload/utils/get-page-visibility-up-to-ttai.js +2 -3
  107. package/dist/es2019/create-payload/utils/get-react-ufo-payload-version.js +2 -3
  108. package/dist/es2019/create-payload/utils/get-ssr-done-time-value.js +2 -3
  109. package/dist/es2019/create-payload/utils/get-vc-metrics.js +2 -3
  110. package/dist/es2019/create-post-interaction-log-payload/index.js +12 -13
  111. package/dist/es2019/custom-data/index.js +13 -5
  112. package/dist/es2019/custom-mark/index.js +2 -3
  113. package/dist/es2019/custom-spans/index.js +2 -3
  114. package/dist/es2019/custom-timings/index.js +4 -5
  115. package/dist/es2019/experience-trace-id-context/index.js +14 -15
  116. package/dist/es2019/experience-trace-id-context/utils/make-trace-http-request-headers/index.js +2 -3
  117. package/dist/es2019/feature-flags-accessed/common/utils/index.js +10 -11
  118. package/dist/es2019/feature-flags-accessed/index.js +2 -3
  119. package/dist/es2019/generate-id/index.js +2 -3
  120. package/dist/es2019/global-error-handler/index.js +13 -14
  121. package/dist/es2019/initial-page-load-extra-timing/index.js +4 -5
  122. package/dist/es2019/interaction-metrics/index.js +108 -109
  123. package/dist/es2019/interaction-metrics/post-interaction-log.js +0 -10
  124. package/dist/es2019/interaction-metrics-init/index.js +14 -15
  125. package/dist/es2019/interaction-metrics-init/schedule-idle-callback.js +2 -3
  126. package/dist/es2019/resource-timing/common/utils/config.js +8 -9
  127. package/dist/es2019/resource-timing/common/utils/resource-timing-buffer.js +12 -13
  128. package/dist/es2019/resource-timing/main.js +18 -19
  129. package/dist/es2019/resource-timing/utils.js +2 -3
  130. package/dist/es2019/round-number/index.js +2 -3
  131. package/dist/es2019/route-name/index.js +2 -3
  132. package/dist/es2019/segment/schedule-on-paint.js +2 -4
  133. package/dist/es2019/segment/segment.js +4 -5
  134. package/dist/es2019/set-interaction-error/index.js +2 -3
  135. package/dist/es2019/short-id/index.js +2 -3
  136. package/dist/es2019/ssr/index.js +16 -17
  137. package/dist/es2019/trace-interaction/index.js +4 -5
  138. package/dist/es2019/trace-pageload/index.js +4 -5
  139. package/dist/es2019/trace-press/index.js +2 -3
  140. package/dist/es2019/trace-redirect/index.js +2 -3
  141. package/dist/es2019/trace-transition/index.js +2 -3
  142. package/dist/es2019/trace-transition/utils/generate-span-id/index.js +2 -3
  143. package/dist/es2019/trace-transition/utils/set-interaction-active-trace/index.js +2 -3
  144. package/dist/es2019/vc/index.js +4 -16
  145. package/dist/es2019/vc/vc-observer/attachAbortListeners.js +2 -3
  146. package/dist/es2019/vc/vc-observer/getVCRevisionsData.js +4 -5
  147. package/dist/es2019/vc/vc-observer/getViewport.js +4 -5
  148. package/dist/es2019/vc/vc-observer/heatmap/heatmap.js +8 -20
  149. package/dist/es2019/vc/vc-observer/index.js +104 -134
  150. package/dist/es2019/vc/vc-observer/media-wrapper/vc-utils.js +2 -3
  151. package/dist/es2019/vc/vc-observer/observers/editor-lnv/index.js +0 -17
  152. package/dist/es2019/vc/vc-observer/observers/index.js +2 -29
  153. package/dist/es2019/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.js +2 -4
  154. package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/index.js +0 -16
  155. package/dist/es2019/vc/vc-observer/revisions/fy25_01.js +0 -2
  156. package/dist/es2019/vc/vc-observer/revisions/fy25_02.js +0 -2
  157. package/dist/es2019/vc/vc-observer/revisions/revisions.js +2 -3
  158. package/dist/es2019/vc/vc-observer-new/entries-timeline/index.js +0 -9
  159. package/dist/es2019/vc/vc-observer-new/get-element-name.js +2 -3
  160. package/dist/es2019/vc/vc-observer-new/get-unique-element-name.js +10 -11
  161. package/dist/es2019/vc/vc-observer-new/index.js +0 -9
  162. package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +0 -2
  163. package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +0 -3
  164. package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.js +4 -14
  165. package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.js +4 -5
  166. package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/heatmap.js +6 -18
  167. package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.js +8 -20
  168. package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/index.js +2 -3
  169. package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/calc-union-area.js +8 -9
  170. package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/index.js +2 -3
  171. package/dist/es2019/vc/vc-observer-new/metric-calculator/utils/get-viewport-height.js +2 -3
  172. package/dist/es2019/vc/vc-observer-new/metric-calculator/utils/get-viewport-width.js +2 -3
  173. package/dist/es2019/vc/vc-observer-new/metric-calculator/utils/is-viewport-entry-data.js +2 -3
  174. package/dist/es2019/vc/vc-observer-new/metric-calculator/utils/task-yield.js +2 -4
  175. package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +7 -15
  176. package/dist/es2019/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +8 -8
  177. package/dist/es2019/vc/vc-observer-new/viewport-observer/mutation-observer/index.js +15 -15
  178. package/dist/es2019/vc/vc-observer-new/viewport-observer/performance-observer/index.js +8 -9
  179. package/dist/es2019/vc/vc-observer-new/window-event-observer/index.js +1 -7
  180. package/dist/esm/additional-payload/utils/cache-hit-ratio/index.js +4 -5
  181. package/dist/esm/additional-payload/utils/lighthouse-metrics/cls/index.js +2 -3
  182. package/dist/esm/additional-payload/utils/lighthouse-metrics/index.js +4 -5
  183. package/dist/esm/additional-payload/utils/lighthouse-metrics/tbt/index.js +2 -3
  184. package/dist/esm/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +0 -3
  185. package/dist/esm/additional-payload/utils/lighthouse-metrics/utils/observer/index.js +8 -9
  186. package/dist/esm/assets/index.js +14 -17
  187. package/dist/esm/assets/utils.js +8 -10
  188. package/dist/esm/bundle-eval-timing/index.js +6 -7
  189. package/dist/esm/coinflip/index.js +2 -4
  190. package/dist/esm/config/index.js +28 -29
  191. package/dist/esm/create-experimental-interaction-metrics-payload/index.js +36 -28
  192. package/dist/esm/create-payload/common/utils/index.js +14 -15
  193. package/dist/esm/create-payload/index.js +119 -127
  194. package/dist/esm/create-payload/utils/get-interaction-status.js +2 -4
  195. package/dist/esm/create-payload/utils/get-page-visibility-up-to-ttai.js +2 -3
  196. package/dist/esm/create-payload/utils/get-react-ufo-payload-version.js +2 -3
  197. package/dist/esm/create-payload/utils/get-ssr-done-time-value.js +2 -3
  198. package/dist/esm/create-payload/utils/get-vc-metrics.js +7 -8
  199. package/dist/esm/create-post-interaction-log-payload/index.js +12 -13
  200. package/dist/esm/custom-data/index.js +13 -5
  201. package/dist/esm/custom-mark/index.js +2 -3
  202. package/dist/esm/custom-spans/index.js +2 -3
  203. package/dist/esm/custom-timings/index.js +4 -5
  204. package/dist/esm/experience-trace-id-context/index.js +14 -15
  205. package/dist/esm/experience-trace-id-context/utils/make-trace-http-request-headers/index.js +2 -3
  206. package/dist/esm/feature-flags-accessed/common/utils/index.js +10 -11
  207. package/dist/esm/feature-flags-accessed/index.js +2 -3
  208. package/dist/esm/generate-id/index.js +2 -3
  209. package/dist/esm/global-error-handler/index.js +13 -14
  210. package/dist/esm/initial-page-load-extra-timing/index.js +4 -5
  211. package/dist/esm/interaction-metrics/index.js +108 -109
  212. package/dist/esm/interaction-metrics/post-interaction-log.js +0 -10
  213. package/dist/esm/interaction-metrics-init/index.js +14 -15
  214. package/dist/esm/interaction-metrics-init/schedule-idle-callback.js +2 -3
  215. package/dist/esm/resource-timing/common/utils/config.js +8 -9
  216. package/dist/esm/resource-timing/common/utils/resource-timing-buffer.js +12 -13
  217. package/dist/esm/resource-timing/main.js +18 -19
  218. package/dist/esm/resource-timing/utils.js +2 -3
  219. package/dist/esm/round-number/index.js +2 -3
  220. package/dist/esm/route-name/index.js +2 -3
  221. package/dist/esm/segment/schedule-on-paint.js +2 -4
  222. package/dist/esm/segment/segment.js +4 -5
  223. package/dist/esm/set-interaction-error/index.js +2 -3
  224. package/dist/esm/short-id/index.js +2 -3
  225. package/dist/esm/ssr/index.js +16 -17
  226. package/dist/esm/trace-interaction/index.js +4 -5
  227. package/dist/esm/trace-pageload/index.js +4 -5
  228. package/dist/esm/trace-press/index.js +2 -3
  229. package/dist/esm/trace-redirect/index.js +2 -3
  230. package/dist/esm/trace-transition/index.js +2 -3
  231. package/dist/esm/trace-transition/utils/generate-span-id/index.js +2 -3
  232. package/dist/esm/trace-transition/utils/set-interaction-active-trace/index.js +2 -3
  233. package/dist/esm/vc/index.js +4 -16
  234. package/dist/esm/vc/vc-observer/attachAbortListeners.js +2 -3
  235. package/dist/esm/vc/vc-observer/getVCRevisionsData.js +21 -12
  236. package/dist/esm/vc/vc-observer/getViewport.js +4 -5
  237. package/dist/esm/vc/vc-observer/heatmap/heatmap.js +10 -20
  238. package/dist/esm/vc/vc-observer/index.js +119 -145
  239. package/dist/esm/vc/vc-observer/media-wrapper/vc-utils.js +2 -3
  240. package/dist/esm/vc/vc-observer/observers/editor-lnv/index.js +0 -17
  241. package/dist/esm/vc/vc-observer/observers/index.js +2 -29
  242. package/dist/esm/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.js +2 -4
  243. package/dist/esm/vc/vc-observer/observers/ssr-placeholders/index.js +0 -16
  244. package/dist/esm/vc/vc-observer/revisions/fy25_01.js +0 -2
  245. package/dist/esm/vc/vc-observer/revisions/fy25_02.js +0 -2
  246. package/dist/esm/vc/vc-observer/revisions/revisions.js +2 -3
  247. package/dist/esm/vc/vc-observer-new/entries-timeline/index.js +0 -9
  248. package/dist/esm/vc/vc-observer-new/get-element-name.js +2 -3
  249. package/dist/esm/vc/vc-observer-new/get-unique-element-name.js +10 -11
  250. package/dist/esm/vc/vc-observer-new/index.js +0 -9
  251. package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +0 -2
  252. package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +1 -6
  253. package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.js +9 -19
  254. package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.js +24 -25
  255. package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/heatmap.js +6 -18
  256. package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.js +13 -25
  257. package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/index.js +7 -8
  258. package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/calc-union-area.js +39 -48
  259. package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/index.js +7 -8
  260. package/dist/esm/vc/vc-observer-new/metric-calculator/utils/get-viewport-height.js +2 -3
  261. package/dist/esm/vc/vc-observer-new/metric-calculator/utils/get-viewport-width.js +2 -3
  262. package/dist/esm/vc/vc-observer-new/metric-calculator/utils/is-viewport-entry-data.js +2 -3
  263. package/dist/esm/vc/vc-observer-new/metric-calculator/utils/task-yield.js +7 -9
  264. package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +7 -15
  265. package/dist/esm/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +7 -8
  266. package/dist/esm/vc/vc-observer-new/viewport-observer/mutation-observer/index.js +14 -15
  267. package/dist/esm/vc/vc-observer-new/viewport-observer/performance-observer/index.js +7 -9
  268. package/dist/esm/vc/vc-observer-new/window-event-observer/index.js +1 -7
  269. package/dist/types/additional-payload/utils/cache-hit-ratio/index.d.ts +2 -2
  270. package/dist/types/additional-payload/utils/lighthouse-metrics/cls/index.d.ts +1 -1
  271. package/dist/types/additional-payload/utils/lighthouse-metrics/index.d.ts +3 -3
  272. package/dist/types/additional-payload/utils/lighthouse-metrics/tbt/index.d.ts +1 -1
  273. package/dist/types/additional-payload/utils/lighthouse-metrics/utils/observer/index.d.ts +2 -2
  274. package/dist/types/assets/index.d.ts +1 -3
  275. package/dist/types/assets/utils.d.ts +4 -4
  276. package/dist/types/bundle-eval-timing/index.d.ts +2 -2
  277. package/dist/types/coinflip/index.d.ts +1 -1
  278. package/dist/types/common/react-ufo-payload-schema.d.ts +1 -0
  279. package/dist/types/config/index.d.ts +16 -14
  280. package/dist/types/create-experimental-interaction-metrics-payload/index.d.ts +4 -5
  281. package/dist/types/create-payload/common/utils/index.d.ts +8 -7
  282. package/dist/types/create-payload/index.d.ts +1 -97
  283. package/dist/types/create-payload/utils/get-interaction-status.d.ts +1 -1
  284. package/dist/types/create-payload/utils/get-page-visibility-up-to-ttai.d.ts +1 -1
  285. package/dist/types/create-payload/utils/get-react-ufo-payload-version.d.ts +1 -1
  286. package/dist/types/create-payload/utils/get-ssr-done-time-value.d.ts +1 -1
  287. package/dist/types/create-payload/utils/get-vc-metrics.d.ts +2 -2
  288. package/dist/types/create-post-interaction-log-payload/index.d.ts +1 -1
  289. package/dist/types/custom-data/index.d.ts +1 -1
  290. package/dist/types/custom-mark/index.d.ts +1 -1
  291. package/dist/types/custom-spans/index.d.ts +1 -1
  292. package/dist/types/custom-timings/index.d.ts +2 -2
  293. package/dist/types/experience-trace-id-context/index.d.ts +7 -7
  294. package/dist/types/experience-trace-id-context/utils/make-trace-http-request-headers/index.d.ts +1 -1
  295. package/dist/types/feature-flags-accessed/common/utils/index.d.ts +2 -2
  296. package/dist/types/feature-flags-accessed/index.d.ts +1 -1
  297. package/dist/types/generate-id/index.d.ts +1 -1
  298. package/dist/types/global-error-handler/index.d.ts +3 -3
  299. package/dist/types/initial-page-load-extra-timing/index.d.ts +2 -2
  300. package/dist/types/interaction-context/index.d.ts +1 -1
  301. package/dist/types/interaction-metrics/index.d.ts +44 -44
  302. package/dist/types/interaction-metrics/post-interaction-log.d.ts +0 -1
  303. package/dist/types/interaction-metrics-init/index.d.ts +1 -1
  304. package/dist/types/interaction-metrics-init/schedule-idle-callback.d.ts +1 -1
  305. package/dist/types/resource-timing/common/utils/config.d.ts +2 -2
  306. package/dist/types/resource-timing/common/utils/resource-timing-buffer.d.ts +5 -5
  307. package/dist/types/resource-timing/main.d.ts +1 -1
  308. package/dist/types/resource-timing/utils.d.ts +1 -1
  309. package/dist/types/round-number/index.d.ts +1 -1
  310. package/dist/types/route-name/index.d.ts +3 -3
  311. package/dist/types/segment/schedule-on-paint.d.ts +1 -1
  312. package/dist/types/set-interaction-error/index.d.ts +1 -1
  313. package/dist/types/short-id/index.d.ts +1 -1
  314. package/dist/types/ssr/index.d.ts +5 -5
  315. package/dist/types/trace-interaction/index.d.ts +1 -1
  316. package/dist/types/trace-pageload/index.d.ts +2 -2
  317. package/dist/types/trace-press/index.d.ts +1 -1
  318. package/dist/types/trace-redirect/index.d.ts +1 -1
  319. package/dist/types/trace-transition/index.d.ts +1 -1
  320. package/dist/types/trace-transition/utils/generate-span-id/index.d.ts +1 -1
  321. package/dist/types/trace-transition/utils/set-interaction-active-trace/index.d.ts +1 -1
  322. package/dist/types/vc/index.d.ts +2 -2
  323. package/dist/types/vc/vc-observer/attachAbortListeners.d.ts +2 -2
  324. package/dist/types/vc/vc-observer/getVCRevisionsData.d.ts +5 -5
  325. package/dist/types/vc/vc-observer/getViewport.d.ts +2 -2
  326. package/dist/types/vc/vc-observer/heatmap/heatmap.d.ts +1 -1
  327. package/dist/types/vc/vc-observer/index.d.ts +4 -4
  328. package/dist/types/vc/vc-observer/media-wrapper/vc-utils.d.ts +1 -1
  329. package/dist/types/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.d.ts +4 -4
  330. package/dist/types/vc/vc-observer/revisions/revisions.d.ts +1 -1
  331. package/dist/types/vc/vc-observer-new/get-element-name.d.ts +1 -1
  332. package/dist/types/vc/vc-observer-new/get-unique-element-name.d.ts +1 -1
  333. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.d.ts +3 -2
  334. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.d.ts +2 -2
  335. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.d.ts +2 -2
  336. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/index.d.ts +1 -1
  337. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/calc-union-area.d.ts +1 -1
  338. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/index.d.ts +2 -2
  339. package/dist/types/vc/vc-observer-new/metric-calculator/utils/get-viewport-height.d.ts +1 -1
  340. package/dist/types/vc/vc-observer-new/metric-calculator/utils/get-viewport-width.d.ts +1 -1
  341. package/dist/types/vc/vc-observer-new/metric-calculator/utils/is-viewport-entry-data.d.ts +1 -1
  342. package/dist/types/vc/vc-observer-new/metric-calculator/utils/task-yield.d.ts +1 -1
  343. package/dist/types/vc/vc-observer-new/viewport-observer/index.d.ts +1 -1
  344. package/dist/types/vc/vc-observer-new/viewport-observer/intersection-observer/index.d.ts +1 -1
  345. package/dist/types/vc/vc-observer-new/viewport-observer/mutation-observer/index.d.ts +1 -1
  346. package/dist/types/vc/vc-observer-new/viewport-observer/performance-observer/index.d.ts +2 -2
  347. package/dist/types-ts4.5/additional-payload/utils/cache-hit-ratio/index.d.ts +2 -2
  348. package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/cls/index.d.ts +1 -1
  349. package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/index.d.ts +3 -3
  350. package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/tbt/index.d.ts +1 -1
  351. package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/utils/observer/index.d.ts +2 -2
  352. package/dist/types-ts4.5/assets/index.d.ts +1 -3
  353. package/dist/types-ts4.5/assets/utils.d.ts +4 -4
  354. package/dist/types-ts4.5/bundle-eval-timing/index.d.ts +2 -2
  355. package/dist/types-ts4.5/coinflip/index.d.ts +1 -1
  356. package/dist/types-ts4.5/common/react-ufo-payload-schema.d.ts +1 -0
  357. package/dist/types-ts4.5/config/index.d.ts +20 -14
  358. package/dist/types-ts4.5/create-experimental-interaction-metrics-payload/index.d.ts +4 -5
  359. package/dist/types-ts4.5/create-payload/common/utils/index.d.ts +8 -7
  360. package/dist/types-ts4.5/create-payload/index.d.ts +1 -97
  361. package/dist/types-ts4.5/create-payload/utils/get-interaction-status.d.ts +1 -1
  362. package/dist/types-ts4.5/create-payload/utils/get-page-visibility-up-to-ttai.d.ts +1 -1
  363. package/dist/types-ts4.5/create-payload/utils/get-react-ufo-payload-version.d.ts +1 -1
  364. package/dist/types-ts4.5/create-payload/utils/get-ssr-done-time-value.d.ts +1 -1
  365. package/dist/types-ts4.5/create-payload/utils/get-vc-metrics.d.ts +2 -2
  366. package/dist/types-ts4.5/create-post-interaction-log-payload/index.d.ts +1 -1
  367. package/dist/types-ts4.5/custom-data/index.d.ts +1 -1
  368. package/dist/types-ts4.5/custom-mark/index.d.ts +1 -1
  369. package/dist/types-ts4.5/custom-spans/index.d.ts +1 -1
  370. package/dist/types-ts4.5/custom-timings/index.d.ts +2 -2
  371. package/dist/types-ts4.5/experience-trace-id-context/index.d.ts +7 -7
  372. package/dist/types-ts4.5/experience-trace-id-context/utils/make-trace-http-request-headers/index.d.ts +1 -1
  373. package/dist/types-ts4.5/feature-flags-accessed/common/utils/index.d.ts +2 -2
  374. package/dist/types-ts4.5/feature-flags-accessed/index.d.ts +1 -1
  375. package/dist/types-ts4.5/generate-id/index.d.ts +1 -1
  376. package/dist/types-ts4.5/global-error-handler/index.d.ts +3 -3
  377. package/dist/types-ts4.5/initial-page-load-extra-timing/index.d.ts +2 -2
  378. package/dist/types-ts4.5/interaction-context/index.d.ts +1 -1
  379. package/dist/types-ts4.5/interaction-metrics/index.d.ts +44 -44
  380. package/dist/types-ts4.5/interaction-metrics/post-interaction-log.d.ts +0 -1
  381. package/dist/types-ts4.5/interaction-metrics-init/index.d.ts +1 -1
  382. package/dist/types-ts4.5/interaction-metrics-init/schedule-idle-callback.d.ts +1 -1
  383. package/dist/types-ts4.5/resource-timing/common/utils/config.d.ts +2 -2
  384. package/dist/types-ts4.5/resource-timing/common/utils/resource-timing-buffer.d.ts +5 -5
  385. package/dist/types-ts4.5/resource-timing/main.d.ts +1 -1
  386. package/dist/types-ts4.5/resource-timing/utils.d.ts +1 -1
  387. package/dist/types-ts4.5/round-number/index.d.ts +1 -1
  388. package/dist/types-ts4.5/route-name/index.d.ts +3 -3
  389. package/dist/types-ts4.5/segment/schedule-on-paint.d.ts +1 -1
  390. package/dist/types-ts4.5/set-interaction-error/index.d.ts +1 -1
  391. package/dist/types-ts4.5/short-id/index.d.ts +1 -1
  392. package/dist/types-ts4.5/ssr/index.d.ts +5 -5
  393. package/dist/types-ts4.5/trace-interaction/index.d.ts +1 -1
  394. package/dist/types-ts4.5/trace-pageload/index.d.ts +2 -2
  395. package/dist/types-ts4.5/trace-press/index.d.ts +1 -1
  396. package/dist/types-ts4.5/trace-redirect/index.d.ts +1 -1
  397. package/dist/types-ts4.5/trace-transition/index.d.ts +1 -1
  398. package/dist/types-ts4.5/trace-transition/utils/generate-span-id/index.d.ts +1 -1
  399. package/dist/types-ts4.5/trace-transition/utils/set-interaction-active-trace/index.d.ts +1 -1
  400. package/dist/types-ts4.5/vc/index.d.ts +2 -2
  401. package/dist/types-ts4.5/vc/vc-observer/attachAbortListeners.d.ts +2 -2
  402. package/dist/types-ts4.5/vc/vc-observer/getVCRevisionsData.d.ts +5 -5
  403. package/dist/types-ts4.5/vc/vc-observer/getViewport.d.ts +2 -2
  404. package/dist/types-ts4.5/vc/vc-observer/heatmap/heatmap.d.ts +1 -1
  405. package/dist/types-ts4.5/vc/vc-observer/index.d.ts +4 -4
  406. package/dist/types-ts4.5/vc/vc-observer/media-wrapper/vc-utils.d.ts +1 -1
  407. package/dist/types-ts4.5/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.d.ts +4 -4
  408. package/dist/types-ts4.5/vc/vc-observer/revisions/revisions.d.ts +1 -1
  409. package/dist/types-ts4.5/vc/vc-observer-new/get-element-name.d.ts +1 -1
  410. package/dist/types-ts4.5/vc/vc-observer-new/get-unique-element-name.d.ts +1 -1
  411. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.d.ts +3 -2
  412. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.d.ts +2 -2
  413. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.d.ts +2 -2
  414. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/index.d.ts +1 -1
  415. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/calc-union-area.d.ts +1 -1
  416. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/index.d.ts +2 -2
  417. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/utils/get-viewport-height.d.ts +1 -1
  418. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/utils/get-viewport-width.d.ts +1 -1
  419. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/utils/is-viewport-entry-data.d.ts +1 -1
  420. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/utils/task-yield.d.ts +1 -1
  421. package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/index.d.ts +1 -1
  422. package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/intersection-observer/index.d.ts +1 -1
  423. package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/mutation-observer/index.d.ts +1 -1
  424. package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/performance-observer/index.d.ts +2 -2
  425. package/package.json +4 -1
  426. package/dist/cjs/self-measurements/index.js +0 -261
  427. package/dist/es2019/self-measurements/index.js +0 -213
  428. package/dist/esm/self-measurements/index.js +0 -246
  429. package/dist/types/self-measurements/index.d.ts +0 -57
  430. package/dist/types-ts4.5/self-measurements/index.d.ts +0 -57
@@ -1,246 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
- import _regeneratorRuntime from "@babel/runtime/regenerator";
6
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
7
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
8
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
9
- import { fg } from '@atlaskit/platform-feature-flags';
10
- globalThis.__ufo_self_measurements = globalThis.__ufo_self_measurements || {
11
- __internalState: {
12
- functionStack: []
13
- },
14
- runtime: {
15
- total: 0,
16
- async: 0,
17
- error: 0,
18
- byFunction: {},
19
- custom: {}
20
- }
21
- };
22
- export function resetProfilerMeasurements() {
23
- globalThis.__ufo_self_measurements = {
24
- __internalState: {
25
- functionStack: []
26
- },
27
- runtime: {
28
- total: 0,
29
- async: 0,
30
- error: 0,
31
- byFunction: {},
32
- custom: {}
33
- }
34
- };
35
- }
36
- function trackFunctionTimingStart(fnName) {
37
- var _globalThis$__ufo_sel;
38
- if (!(globalThis !== null && globalThis !== void 0 && globalThis.__ufo_self_measurements)) {
39
- resetProfilerMeasurements();
40
- }
41
- globalThis === null || globalThis === void 0 || (_globalThis$__ufo_sel = globalThis.__ufo_self_measurements) === null || _globalThis$__ufo_sel === void 0 || (_globalThis$__ufo_sel = _globalThis$__ufo_sel.__internalState) === null || _globalThis$__ufo_sel === void 0 || (_globalThis$__ufo_sel = _globalThis$__ufo_sel.functionStack) === null || _globalThis$__ufo_sel === void 0 || _globalThis$__ufo_sel.push(fnName);
42
- }
43
- function trackFunctionTimingEnd() {
44
- var _globalThis$__ufo_sel2;
45
- if (!(globalThis !== null && globalThis !== void 0 && globalThis.__ufo_self_measurements)) {
46
- resetProfilerMeasurements();
47
- }
48
- globalThis === null || globalThis === void 0 || (_globalThis$__ufo_sel2 = globalThis.__ufo_self_measurements) === null || _globalThis$__ufo_sel2 === void 0 || (_globalThis$__ufo_sel2 = _globalThis$__ufo_sel2.__internalState) === null || _globalThis$__ufo_sel2 === void 0 || (_globalThis$__ufo_sel2 = _globalThis$__ufo_sel2.functionStack) === null || _globalThis$__ufo_sel2 === void 0 || _globalThis$__ufo_sel2.pop();
49
- }
50
- function shouldRecordProfilerMeasurement() {
51
- var _globalThis$__ufo_sel3;
52
- if (!(globalThis !== null && globalThis !== void 0 && globalThis.__ufo_self_measurements)) {
53
- resetProfilerMeasurements();
54
- }
55
- return (globalThis === null || globalThis === void 0 || (_globalThis$__ufo_sel3 = globalThis.__ufo_self_measurements) === null || _globalThis$__ufo_sel3 === void 0 || (_globalThis$__ufo_sel3 = _globalThis$__ufo_sel3.__internalState) === null || _globalThis$__ufo_sel3 === void 0 || (_globalThis$__ufo_sel3 = _globalThis$__ufo_sel3.functionStack) === null || _globalThis$__ufo_sel3 === void 0 ? void 0 : _globalThis$__ufo_sel3.length) === 0;
56
- }
57
- function recordProfilerMeasurement(functionName, duration, isAsync, isError) {
58
- var tags = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
59
- // discard measurements that are not significant
60
- if (duration <= 0) {
61
- return;
62
- }
63
- if (!(globalThis !== null && globalThis !== void 0 && globalThis.__ufo_self_measurements)) {
64
- resetProfilerMeasurements();
65
- }
66
- globalThis.__ufo_self_measurements.runtime.total += duration;
67
- if (isAsync) {
68
- globalThis.__ufo_self_measurements.runtime.async += duration;
69
- }
70
- if (isError) {
71
- globalThis.__ufo_self_measurements.runtime.error += duration;
72
- }
73
- if (functionName in globalThis.__ufo_self_measurements.runtime.byFunction) {
74
- globalThis.__ufo_self_measurements.runtime.byFunction[functionName] += duration;
75
- } else {
76
- globalThis.__ufo_self_measurements.runtime.byFunction[functionName] = duration;
77
- }
78
- var _iterator = _createForOfIteratorHelper(tags),
79
- _step;
80
- try {
81
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
82
- var tag = _step.value;
83
- if (tag in globalThis.__ufo_self_measurements.runtime.custom) {
84
- globalThis.__ufo_self_measurements.runtime.custom[tag] += duration;
85
- } else {
86
- globalThis.__ufo_self_measurements.runtime.custom[tag] = duration;
87
- }
88
- }
89
- } catch (err) {
90
- _iterator.e(err);
91
- } finally {
92
- _iterator.f();
93
- }
94
- }
95
- function isPromise(value) {
96
- return value && typeof value.then === 'function';
97
- }
98
- export function withProfiling(fn) {
99
- var tags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
100
- try {
101
- if (!fg('platform_ufo_self_timings')) {
102
- return fn; // this is a NOOP wrapper if feature gate is disabled
103
- }
104
- } catch (_unused) {
105
- return fn;
106
- }
107
- if (!(globalThis !== null && globalThis !== void 0 && globalThis.performance)) {
108
- return fn;
109
- }
110
- if (fn.constructor.name === 'AsyncFunction') {
111
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
112
- var _fn$name;
113
- var startTime,
114
- result,
115
- endTime,
116
- _endTime,
117
- _args = arguments;
118
- return _regeneratorRuntime.wrap(function _callee$(_context) {
119
- while (1) switch (_context.prev = _context.next) {
120
- case 0:
121
- startTime = performance.now();
122
- trackFunctionTimingStart((_fn$name = fn.name) !== null && _fn$name !== void 0 ? _fn$name : 'anonymous');
123
- _context.prev = 2;
124
- _context.next = 5;
125
- return fn.apply(void 0, _args);
126
- case 5:
127
- result = _context.sent;
128
- endTime = performance.now();
129
- trackFunctionTimingEnd();
130
- if (shouldRecordProfilerMeasurement()) {
131
- recordProfilerMeasurement(fn.name, endTime - startTime, true, false, tags);
132
- }
133
- return _context.abrupt("return", result);
134
- case 12:
135
- _context.prev = 12;
136
- _context.t0 = _context["catch"](2);
137
- _endTime = performance.now();
138
- trackFunctionTimingEnd();
139
- if (shouldRecordProfilerMeasurement()) {
140
- recordProfilerMeasurement(fn.name, _endTime - startTime, true, true, tags);
141
- }
142
- throw _context.t0;
143
- case 18:
144
- case "end":
145
- return _context.stop();
146
- }
147
- }, _callee, null, [[2, 12]]);
148
- }));
149
- }
150
- return function () {
151
- var _fn$name2;
152
- var startTime = performance.now();
153
- trackFunctionTimingStart((_fn$name2 = fn.name) !== null && _fn$name2 !== void 0 ? _fn$name2 : 'anonymous');
154
- try {
155
- var result = fn.apply(void 0, arguments);
156
- if (isPromise(result)) {
157
- result.then(function (value) {
158
- var endTime = performance.now();
159
- trackFunctionTimingEnd();
160
- if (shouldRecordProfilerMeasurement()) {
161
- recordProfilerMeasurement(fn.name, endTime - startTime, true, false, tags);
162
- }
163
- return value;
164
- }).catch(function (value) {
165
- var endTime = performance.now();
166
- trackFunctionTimingEnd();
167
- if (shouldRecordProfilerMeasurement()) {
168
- recordProfilerMeasurement(fn.name, endTime - startTime, true, true, tags);
169
- }
170
- return value;
171
- });
172
- } else {
173
- var endTime = performance.now();
174
- trackFunctionTimingEnd();
175
- if (shouldRecordProfilerMeasurement()) {
176
- recordProfilerMeasurement(fn.name, endTime - startTime, false, false, tags);
177
- }
178
- }
179
- return result;
180
- } catch (error) {
181
- var _endTime2 = performance.now();
182
- trackFunctionTimingEnd();
183
- if (shouldRecordProfilerMeasurement()) {
184
- recordProfilerMeasurement(fn.name, _endTime2 - startTime, false, true, tags);
185
- }
186
- throw error;
187
- }
188
- };
189
- }
190
- export function markProfilingStart(name) {
191
- if (!(globalThis !== null && globalThis !== void 0 && globalThis.performance)) {
192
- return {
193
- name: name,
194
- startTime: -1
195
- };
196
- }
197
- trackFunctionTimingStart(name);
198
- return {
199
- name: name,
200
- startTime: performance.now()
201
- };
202
- }
203
- export function markProfilingEnd(_ref2) {
204
- var name = _ref2.name,
205
- startTime = _ref2.startTime;
206
- var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
207
- isAsync = _ref3.isAsync,
208
- isError = _ref3.isError,
209
- tags = _ref3.tags;
210
- if (!(globalThis !== null && globalThis !== void 0 && globalThis.performance)) {
211
- return;
212
- }
213
- trackFunctionTimingEnd();
214
- if (!fg('platform_ufo_self_timings')) {
215
- return;
216
- }
217
- var endTime = performance.now();
218
- recordProfilerMeasurement(name, endTime - startTime, isAsync, isError, tags);
219
- }
220
- export function getProfilerData() {
221
- return _objectSpread({}, globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime);
222
- }
223
- export function getProfilerTotalRuntime() {
224
- if (typeof (globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime.total) === 'number') {
225
- return Math.round(globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime.total);
226
- }
227
- return null;
228
- }
229
- export function getProfilerAsyncRuntime() {
230
- if (typeof (globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime.async) === 'number') {
231
- return Math.round(globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime.async);
232
- }
233
- return null;
234
- }
235
- export function getProfilerRuntimeByFunction(functionName) {
236
- if (typeof (globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime.byFunction[functionName]) === 'number') {
237
- return Math.round(globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime.byFunction[functionName]);
238
- }
239
- return null;
240
- }
241
- export function getProfilerRuntimeByTag(tag) {
242
- if (typeof (globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime.custom[tag]) === 'number') {
243
- return Math.round(globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime.custom[tag]);
244
- }
245
- return null;
246
- }
@@ -1,57 +0,0 @@
1
- interface RuntimeSelfMeasurement {
2
- __internalState: {
3
- /**
4
- * Stack to maintain whether there is already an existing timing that has started
5
- * This is so we don't "double-count" the timing of functions, e.g.
6
- *
7
- * const foo = withProfiling(function foo() {
8
- * // do some work...
9
- * })
10
- * const bar = withProfiling(function bar() {
11
- * foo();
12
- * // do some more additional work...
13
- * });
14
- *
15
- * Here since bar invokes foo, and bar already has profiling, then we don't need to profile foo.
16
- * However, if foo is invoked somewhere else by a function that doesn't have profiling,
17
- * then we should profile foo's timings
18
- */
19
- functionStack: string[];
20
- };
21
- runtime: {
22
- total: number;
23
- async: number;
24
- error: number;
25
- byFunction: Record<string, number>;
26
- custom: Record<string, number>;
27
- };
28
- }
29
- declare global {
30
- var __ufo_self_measurements: RuntimeSelfMeasurement;
31
- }
32
- export declare function resetProfilerMeasurements(): void;
33
- type AsyncFunction<T, Args extends any[]> = (...args: Args) => Promise<T>;
34
- type SyncFunction<T, Args extends any[]> = (...args: Args) => T;
35
- export declare function withProfiling<ReturnType, Args extends any[]>(fn: AsyncFunction<ReturnType, Args>, tags?: string[]): (...args: Args) => Promise<ReturnType>;
36
- export declare function withProfiling<ReturnType, Args extends any[]>(fn: SyncFunction<ReturnType, Args>, tags?: string[]): (...args: Args) => ReturnType;
37
- export declare function markProfilingStart(name: string): {
38
- name: string;
39
- startTime: number;
40
- };
41
- export declare function markProfilingEnd({ name, startTime }: ReturnType<typeof markProfilingStart>, { isAsync, isError, tags }?: {
42
- isAsync?: boolean;
43
- isError?: boolean;
44
- tags?: string[];
45
- }): void;
46
- export declare function getProfilerData(): {
47
- total: number;
48
- async: number;
49
- error: number;
50
- byFunction: Record<string, number>;
51
- custom: Record<string, number>;
52
- };
53
- export declare function getProfilerTotalRuntime(): number | null;
54
- export declare function getProfilerAsyncRuntime(): number | null;
55
- export declare function getProfilerRuntimeByFunction(functionName: string): number | null;
56
- export declare function getProfilerRuntimeByTag(tag: string): number | null;
57
- export {};
@@ -1,57 +0,0 @@
1
- interface RuntimeSelfMeasurement {
2
- __internalState: {
3
- /**
4
- * Stack to maintain whether there is already an existing timing that has started
5
- * This is so we don't "double-count" the timing of functions, e.g.
6
- *
7
- * const foo = withProfiling(function foo() {
8
- * // do some work...
9
- * })
10
- * const bar = withProfiling(function bar() {
11
- * foo();
12
- * // do some more additional work...
13
- * });
14
- *
15
- * Here since bar invokes foo, and bar already has profiling, then we don't need to profile foo.
16
- * However, if foo is invoked somewhere else by a function that doesn't have profiling,
17
- * then we should profile foo's timings
18
- */
19
- functionStack: string[];
20
- };
21
- runtime: {
22
- total: number;
23
- async: number;
24
- error: number;
25
- byFunction: Record<string, number>;
26
- custom: Record<string, number>;
27
- };
28
- }
29
- declare global {
30
- var __ufo_self_measurements: RuntimeSelfMeasurement;
31
- }
32
- export declare function resetProfilerMeasurements(): void;
33
- type AsyncFunction<T, Args extends any[]> = (...args: Args) => Promise<T>;
34
- type SyncFunction<T, Args extends any[]> = (...args: Args) => T;
35
- export declare function withProfiling<ReturnType, Args extends any[]>(fn: AsyncFunction<ReturnType, Args>, tags?: string[]): (...args: Args) => Promise<ReturnType>;
36
- export declare function withProfiling<ReturnType, Args extends any[]>(fn: SyncFunction<ReturnType, Args>, tags?: string[]): (...args: Args) => ReturnType;
37
- export declare function markProfilingStart(name: string): {
38
- name: string;
39
- startTime: number;
40
- };
41
- export declare function markProfilingEnd({ name, startTime }: ReturnType<typeof markProfilingStart>, { isAsync, isError, tags }?: {
42
- isAsync?: boolean;
43
- isError?: boolean;
44
- tags?: string[];
45
- }): void;
46
- export declare function getProfilerData(): {
47
- total: number;
48
- async: number;
49
- error: number;
50
- byFunction: Record<string, number>;
51
- custom: Record<string, number>;
52
- };
53
- export declare function getProfilerTotalRuntime(): number | null;
54
- export declare function getProfilerAsyncRuntime(): number | null;
55
- export declare function getProfilerRuntimeByFunction(functionName: string): number | null;
56
- export declare function getProfilerRuntimeByTag(tag: string): number | null;
57
- export {};