@sentry/browser 11.0.0-alpha.2 → 11.0.0-beta.0

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 (454) hide show
  1. package/build/npm/cjs/dev/client.js +5 -5
  2. package/build/npm/cjs/dev/client.js.map +1 -1
  3. package/build/npm/cjs/dev/diagnose-sdk.js +3 -3
  4. package/build/npm/cjs/dev/diagnose-sdk.js.map +1 -1
  5. package/build/npm/cjs/dev/eventbuilder.js +25 -25
  6. package/build/npm/cjs/dev/eventbuilder.js.map +1 -1
  7. package/build/npm/cjs/dev/helpers.js +11 -11
  8. package/build/npm/cjs/dev/helpers.js.map +1 -1
  9. package/build/npm/cjs/dev/index.js +85 -84
  10. package/build/npm/cjs/dev/index.js.map +1 -1
  11. package/build/npm/cjs/dev/integrations/{bfcache.js → bfcacheMetrics.js} +41 -39
  12. package/build/npm/cjs/dev/integrations/bfcacheMetrics.js.map +1 -0
  13. package/build/npm/cjs/dev/integrations/breadcrumbs.js +27 -27
  14. package/build/npm/cjs/dev/integrations/breadcrumbs.js.map +1 -1
  15. package/build/npm/cjs/dev/integrations/browserapierrors.js +16 -16
  16. package/build/npm/cjs/dev/integrations/browserapierrors.js.map +1 -1
  17. package/build/npm/cjs/dev/integrations/browsersession.js +9 -9
  18. package/build/npm/cjs/dev/integrations/browsersession.js.map +1 -1
  19. package/build/npm/cjs/dev/integrations/contextlines.js +5 -5
  20. package/build/npm/cjs/dev/integrations/contextlines.js.map +1 -1
  21. package/build/npm/cjs/dev/integrations/culturecontext.js +3 -3
  22. package/build/npm/cjs/dev/integrations/culturecontext.js.map +1 -1
  23. package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js +2 -2
  24. package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js.map +1 -1
  25. package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js +5 -5
  26. package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  27. package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js +7 -7
  28. package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js.map +1 -1
  29. package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js +5 -5
  30. package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js.map +1 -1
  31. package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js +7 -7
  32. package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js.map +1 -1
  33. package/build/npm/cjs/dev/integrations/fetchStreamPerformance.js +16 -10
  34. package/build/npm/cjs/dev/integrations/fetchStreamPerformance.js.map +1 -1
  35. package/build/npm/cjs/dev/integrations/globalhandlers.js +15 -15
  36. package/build/npm/cjs/dev/integrations/globalhandlers.js.map +1 -1
  37. package/build/npm/cjs/dev/integrations/graphqlClient.js +28 -15
  38. package/build/npm/cjs/dev/integrations/graphqlClient.js.map +1 -1
  39. package/build/npm/cjs/dev/integrations/httpclient.js +20 -23
  40. package/build/npm/cjs/dev/integrations/httpclient.js.map +1 -1
  41. package/build/npm/cjs/dev/integrations/httpcontext.js +6 -7
  42. package/build/npm/cjs/dev/integrations/httpcontext.js.map +1 -1
  43. package/build/npm/cjs/dev/integrations/linkederrors.js +3 -3
  44. package/build/npm/cjs/dev/integrations/linkederrors.js.map +1 -1
  45. package/build/npm/cjs/dev/integrations/reportingobserver.js +6 -6
  46. package/build/npm/cjs/dev/integrations/reportingobserver.js.map +1 -1
  47. package/build/npm/cjs/dev/integrations/spotlight.js +6 -6
  48. package/build/npm/cjs/dev/integrations/spotlight.js.map +1 -1
  49. package/build/npm/cjs/dev/integrations/view-hierarchy.js +2 -2
  50. package/build/npm/cjs/dev/integrations/view-hierarchy.js.map +1 -1
  51. package/build/npm/cjs/dev/integrations/webVitals.js +3 -3
  52. package/build/npm/cjs/dev/integrations/webVitals.js.map +1 -1
  53. package/build/npm/cjs/dev/integrations/webWorker.js +18 -18
  54. package/build/npm/cjs/dev/integrations/webWorker.js.map +1 -1
  55. package/build/npm/cjs/dev/profiling/UIProfiler.js +33 -33
  56. package/build/npm/cjs/dev/profiling/UIProfiler.js.map +1 -1
  57. package/build/npm/cjs/dev/profiling/index.js +7 -7
  58. package/build/npm/cjs/dev/profiling/index.js.map +1 -1
  59. package/build/npm/cjs/dev/profiling/integration.js +8 -8
  60. package/build/npm/cjs/dev/profiling/integration.js.map +1 -1
  61. package/build/npm/cjs/dev/profiling/utils.js +16 -16
  62. package/build/npm/cjs/dev/profiling/utils.js.map +1 -1
  63. package/build/npm/cjs/dev/report-dialog.js +7 -7
  64. package/build/npm/cjs/dev/report-dialog.js.map +1 -1
  65. package/build/npm/cjs/dev/sdk.js +9 -9
  66. package/build/npm/cjs/dev/sdk.js.map +1 -1
  67. package/build/npm/cjs/dev/stack-parsers.js +10 -10
  68. package/build/npm/cjs/dev/stack-parsers.js.map +1 -1
  69. package/build/npm/cjs/dev/tracing/backgroundtab.js +7 -7
  70. package/build/npm/cjs/dev/tracing/backgroundtab.js.map +1 -1
  71. package/build/npm/cjs/dev/tracing/browserTracingIntegration.js +48 -48
  72. package/build/npm/cjs/dev/tracing/browserTracingIntegration.js.map +1 -1
  73. package/build/npm/cjs/dev/tracing/linkedTraces.js +10 -11
  74. package/build/npm/cjs/dev/tracing/linkedTraces.js.map +1 -1
  75. package/build/npm/cjs/dev/tracing/reportPageLoaded.js +2 -2
  76. package/build/npm/cjs/dev/tracing/reportPageLoaded.js.map +1 -1
  77. package/build/npm/cjs/dev/tracing/request.js +37 -29
  78. package/build/npm/cjs/dev/tracing/request.js.map +1 -1
  79. package/build/npm/cjs/dev/tracing/setActiveSpan.js +5 -5
  80. package/build/npm/cjs/dev/tracing/setActiveSpan.js.map +1 -1
  81. package/build/npm/cjs/dev/transports/fetch.js +3 -3
  82. package/build/npm/cjs/dev/transports/fetch.js.map +1 -1
  83. package/build/npm/cjs/dev/transports/offline.js +5 -5
  84. package/build/npm/cjs/dev/transports/offline.js.map +1 -1
  85. package/build/npm/cjs/dev/userfeedback.js +3 -3
  86. package/build/npm/cjs/dev/userfeedback.js.map +1 -1
  87. package/build/npm/cjs/dev/utils/detectBrowserExtension.js +2 -2
  88. package/build/npm/cjs/dev/utils/detectBrowserExtension.js.map +1 -1
  89. package/build/npm/cjs/dev/utils/lazyLoadIntegration.js +3 -3
  90. package/build/npm/cjs/dev/utils/lazyLoadIntegration.js.map +1 -1
  91. package/build/npm/cjs/prod/client.js +5 -5
  92. package/build/npm/cjs/prod/client.js.map +1 -1
  93. package/build/npm/cjs/prod/diagnose-sdk.js +3 -3
  94. package/build/npm/cjs/prod/diagnose-sdk.js.map +1 -1
  95. package/build/npm/cjs/prod/eventbuilder.js +25 -25
  96. package/build/npm/cjs/prod/eventbuilder.js.map +1 -1
  97. package/build/npm/cjs/prod/helpers.js +11 -11
  98. package/build/npm/cjs/prod/helpers.js.map +1 -1
  99. package/build/npm/cjs/prod/index.js +85 -84
  100. package/build/npm/cjs/prod/index.js.map +1 -1
  101. package/build/npm/cjs/prod/integrations/{bfcache.js → bfcacheMetrics.js} +41 -39
  102. package/build/npm/cjs/prod/integrations/bfcacheMetrics.js.map +1 -0
  103. package/build/npm/cjs/prod/integrations/breadcrumbs.js +27 -27
  104. package/build/npm/cjs/prod/integrations/breadcrumbs.js.map +1 -1
  105. package/build/npm/cjs/prod/integrations/browserapierrors.js +16 -16
  106. package/build/npm/cjs/prod/integrations/browserapierrors.js.map +1 -1
  107. package/build/npm/cjs/prod/integrations/browsersession.js +9 -9
  108. package/build/npm/cjs/prod/integrations/browsersession.js.map +1 -1
  109. package/build/npm/cjs/prod/integrations/contextlines.js +5 -5
  110. package/build/npm/cjs/prod/integrations/contextlines.js.map +1 -1
  111. package/build/npm/cjs/prod/integrations/culturecontext.js +3 -3
  112. package/build/npm/cjs/prod/integrations/culturecontext.js.map +1 -1
  113. package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js +2 -2
  114. package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js.map +1 -1
  115. package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js +5 -5
  116. package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  117. package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js +7 -7
  118. package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js.map +1 -1
  119. package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js +5 -5
  120. package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js.map +1 -1
  121. package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js +7 -7
  122. package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js.map +1 -1
  123. package/build/npm/cjs/prod/integrations/fetchStreamPerformance.js +16 -10
  124. package/build/npm/cjs/prod/integrations/fetchStreamPerformance.js.map +1 -1
  125. package/build/npm/cjs/prod/integrations/globalhandlers.js +15 -15
  126. package/build/npm/cjs/prod/integrations/globalhandlers.js.map +1 -1
  127. package/build/npm/cjs/prod/integrations/graphqlClient.js +28 -15
  128. package/build/npm/cjs/prod/integrations/graphqlClient.js.map +1 -1
  129. package/build/npm/cjs/prod/integrations/httpclient.js +20 -23
  130. package/build/npm/cjs/prod/integrations/httpclient.js.map +1 -1
  131. package/build/npm/cjs/prod/integrations/httpcontext.js +6 -7
  132. package/build/npm/cjs/prod/integrations/httpcontext.js.map +1 -1
  133. package/build/npm/cjs/prod/integrations/linkederrors.js +3 -3
  134. package/build/npm/cjs/prod/integrations/linkederrors.js.map +1 -1
  135. package/build/npm/cjs/prod/integrations/reportingobserver.js +6 -6
  136. package/build/npm/cjs/prod/integrations/reportingobserver.js.map +1 -1
  137. package/build/npm/cjs/prod/integrations/spotlight.js +6 -6
  138. package/build/npm/cjs/prod/integrations/spotlight.js.map +1 -1
  139. package/build/npm/cjs/prod/integrations/view-hierarchy.js +2 -2
  140. package/build/npm/cjs/prod/integrations/view-hierarchy.js.map +1 -1
  141. package/build/npm/cjs/prod/integrations/webVitals.js +3 -3
  142. package/build/npm/cjs/prod/integrations/webVitals.js.map +1 -1
  143. package/build/npm/cjs/prod/integrations/webWorker.js +18 -18
  144. package/build/npm/cjs/prod/integrations/webWorker.js.map +1 -1
  145. package/build/npm/cjs/prod/profiling/UIProfiler.js +33 -33
  146. package/build/npm/cjs/prod/profiling/UIProfiler.js.map +1 -1
  147. package/build/npm/cjs/prod/profiling/index.js +7 -7
  148. package/build/npm/cjs/prod/profiling/index.js.map +1 -1
  149. package/build/npm/cjs/prod/profiling/integration.js +8 -8
  150. package/build/npm/cjs/prod/profiling/integration.js.map +1 -1
  151. package/build/npm/cjs/prod/profiling/utils.js +16 -16
  152. package/build/npm/cjs/prod/profiling/utils.js.map +1 -1
  153. package/build/npm/cjs/prod/report-dialog.js +7 -7
  154. package/build/npm/cjs/prod/report-dialog.js.map +1 -1
  155. package/build/npm/cjs/prod/sdk.js +9 -9
  156. package/build/npm/cjs/prod/sdk.js.map +1 -1
  157. package/build/npm/cjs/prod/stack-parsers.js +10 -10
  158. package/build/npm/cjs/prod/stack-parsers.js.map +1 -1
  159. package/build/npm/cjs/prod/tracing/backgroundtab.js +7 -7
  160. package/build/npm/cjs/prod/tracing/backgroundtab.js.map +1 -1
  161. package/build/npm/cjs/prod/tracing/browserTracingIntegration.js +48 -48
  162. package/build/npm/cjs/prod/tracing/browserTracingIntegration.js.map +1 -1
  163. package/build/npm/cjs/prod/tracing/linkedTraces.js +10 -11
  164. package/build/npm/cjs/prod/tracing/linkedTraces.js.map +1 -1
  165. package/build/npm/cjs/prod/tracing/reportPageLoaded.js +2 -2
  166. package/build/npm/cjs/prod/tracing/reportPageLoaded.js.map +1 -1
  167. package/build/npm/cjs/prod/tracing/request.js +37 -29
  168. package/build/npm/cjs/prod/tracing/request.js.map +1 -1
  169. package/build/npm/cjs/prod/tracing/setActiveSpan.js +5 -5
  170. package/build/npm/cjs/prod/tracing/setActiveSpan.js.map +1 -1
  171. package/build/npm/cjs/prod/transports/fetch.js +3 -3
  172. package/build/npm/cjs/prod/transports/fetch.js.map +1 -1
  173. package/build/npm/cjs/prod/transports/offline.js +5 -5
  174. package/build/npm/cjs/prod/transports/offline.js.map +1 -1
  175. package/build/npm/cjs/prod/userfeedback.js +3 -3
  176. package/build/npm/cjs/prod/userfeedback.js.map +1 -1
  177. package/build/npm/cjs/prod/utils/detectBrowserExtension.js +2 -2
  178. package/build/npm/cjs/prod/utils/detectBrowserExtension.js.map +1 -1
  179. package/build/npm/cjs/prod/utils/lazyLoadIntegration.js +3 -3
  180. package/build/npm/cjs/prod/utils/lazyLoadIntegration.js.map +1 -1
  181. package/build/npm/esm/dev/client.js +1 -1
  182. package/build/npm/esm/dev/client.js.map +1 -1
  183. package/build/npm/esm/dev/diagnose-sdk.js +1 -1
  184. package/build/npm/esm/dev/diagnose-sdk.js.map +1 -1
  185. package/build/npm/esm/dev/eventbuilder.js +1 -1
  186. package/build/npm/esm/dev/eventbuilder.js.map +1 -1
  187. package/build/npm/esm/dev/helpers.js +1 -1
  188. package/build/npm/esm/dev/helpers.js.map +1 -1
  189. package/build/npm/esm/dev/index.js +3 -2
  190. package/build/npm/esm/dev/index.js.map +1 -1
  191. package/build/npm/esm/dev/integrations/{bfcache.js → bfcacheMetrics.js} +37 -35
  192. package/build/npm/esm/dev/integrations/bfcacheMetrics.js.map +1 -0
  193. package/build/npm/esm/dev/integrations/breadcrumbs.js +1 -1
  194. package/build/npm/esm/dev/integrations/breadcrumbs.js.map +1 -1
  195. package/build/npm/esm/dev/integrations/browserapierrors.js +1 -1
  196. package/build/npm/esm/dev/integrations/browserapierrors.js.map +1 -1
  197. package/build/npm/esm/dev/integrations/browsersession.js +1 -1
  198. package/build/npm/esm/dev/integrations/browsersession.js.map +1 -1
  199. package/build/npm/esm/dev/integrations/contextlines.js +1 -1
  200. package/build/npm/esm/dev/integrations/contextlines.js.map +1 -1
  201. package/build/npm/esm/dev/integrations/culturecontext.js +1 -1
  202. package/build/npm/esm/dev/integrations/culturecontext.js.map +1 -1
  203. package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js +1 -1
  204. package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js.map +1 -1
  205. package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js +1 -1
  206. package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  207. package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js +1 -1
  208. package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js.map +1 -1
  209. package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js +1 -1
  210. package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js.map +1 -1
  211. package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js +1 -1
  212. package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js.map +1 -1
  213. package/build/npm/esm/dev/integrations/fetchStreamPerformance.js +11 -5
  214. package/build/npm/esm/dev/integrations/fetchStreamPerformance.js.map +1 -1
  215. package/build/npm/esm/dev/integrations/globalhandlers.js +1 -1
  216. package/build/npm/esm/dev/integrations/globalhandlers.js.map +1 -1
  217. package/build/npm/esm/dev/integrations/graphqlClient.js +21 -8
  218. package/build/npm/esm/dev/integrations/graphqlClient.js.map +1 -1
  219. package/build/npm/esm/dev/integrations/httpclient.js +1 -4
  220. package/build/npm/esm/dev/integrations/httpclient.js.map +1 -1
  221. package/build/npm/esm/dev/integrations/httpcontext.js +1 -2
  222. package/build/npm/esm/dev/integrations/httpcontext.js.map +1 -1
  223. package/build/npm/esm/dev/integrations/linkederrors.js +1 -1
  224. package/build/npm/esm/dev/integrations/linkederrors.js.map +1 -1
  225. package/build/npm/esm/dev/integrations/reportingobserver.js +1 -1
  226. package/build/npm/esm/dev/integrations/reportingobserver.js.map +1 -1
  227. package/build/npm/esm/dev/integrations/spotlight.js +1 -1
  228. package/build/npm/esm/dev/integrations/spotlight.js.map +1 -1
  229. package/build/npm/esm/dev/integrations/view-hierarchy.js +1 -1
  230. package/build/npm/esm/dev/integrations/view-hierarchy.js.map +1 -1
  231. package/build/npm/esm/dev/integrations/webVitals.js +1 -1
  232. package/build/npm/esm/dev/integrations/webVitals.js.map +1 -1
  233. package/build/npm/esm/dev/integrations/webWorker.js +1 -1
  234. package/build/npm/esm/dev/integrations/webWorker.js.map +1 -1
  235. package/build/npm/esm/dev/package.json +1 -1
  236. package/build/npm/esm/dev/profiling/UIProfiler.js +1 -1
  237. package/build/npm/esm/dev/profiling/UIProfiler.js.map +1 -1
  238. package/build/npm/esm/dev/profiling/index.js +1 -1
  239. package/build/npm/esm/dev/profiling/index.js.map +1 -1
  240. package/build/npm/esm/dev/profiling/integration.js +1 -1
  241. package/build/npm/esm/dev/profiling/integration.js.map +1 -1
  242. package/build/npm/esm/dev/profiling/utils.js +1 -1
  243. package/build/npm/esm/dev/profiling/utils.js.map +1 -1
  244. package/build/npm/esm/dev/report-dialog.js +1 -1
  245. package/build/npm/esm/dev/report-dialog.js.map +1 -1
  246. package/build/npm/esm/dev/sdk.js +1 -1
  247. package/build/npm/esm/dev/sdk.js.map +1 -1
  248. package/build/npm/esm/dev/stack-parsers.js +1 -1
  249. package/build/npm/esm/dev/stack-parsers.js.map +1 -1
  250. package/build/npm/esm/dev/tracing/backgroundtab.js +1 -1
  251. package/build/npm/esm/dev/tracing/backgroundtab.js.map +1 -1
  252. package/build/npm/esm/dev/tracing/browserTracingIntegration.js +7 -7
  253. package/build/npm/esm/dev/tracing/browserTracingIntegration.js.map +1 -1
  254. package/build/npm/esm/dev/tracing/linkedTraces.js +1 -2
  255. package/build/npm/esm/dev/tracing/linkedTraces.js.map +1 -1
  256. package/build/npm/esm/dev/tracing/reportPageLoaded.js +1 -1
  257. package/build/npm/esm/dev/tracing/reportPageLoaded.js.map +1 -1
  258. package/build/npm/esm/dev/tracing/request.js +16 -8
  259. package/build/npm/esm/dev/tracing/request.js.map +1 -1
  260. package/build/npm/esm/dev/tracing/setActiveSpan.js +1 -1
  261. package/build/npm/esm/dev/tracing/setActiveSpan.js.map +1 -1
  262. package/build/npm/esm/dev/transports/fetch.js +1 -1
  263. package/build/npm/esm/dev/transports/fetch.js.map +1 -1
  264. package/build/npm/esm/dev/transports/offline.js +1 -1
  265. package/build/npm/esm/dev/transports/offline.js.map +1 -1
  266. package/build/npm/esm/dev/userfeedback.js +1 -1
  267. package/build/npm/esm/dev/userfeedback.js.map +1 -1
  268. package/build/npm/esm/dev/utils/detectBrowserExtension.js +1 -1
  269. package/build/npm/esm/dev/utils/detectBrowserExtension.js.map +1 -1
  270. package/build/npm/esm/dev/utils/lazyLoadIntegration.js +1 -1
  271. package/build/npm/esm/dev/utils/lazyLoadIntegration.js.map +1 -1
  272. package/build/npm/esm/prod/client.js +1 -1
  273. package/build/npm/esm/prod/client.js.map +1 -1
  274. package/build/npm/esm/prod/diagnose-sdk.js +1 -1
  275. package/build/npm/esm/prod/diagnose-sdk.js.map +1 -1
  276. package/build/npm/esm/prod/eventbuilder.js +1 -1
  277. package/build/npm/esm/prod/eventbuilder.js.map +1 -1
  278. package/build/npm/esm/prod/helpers.js +1 -1
  279. package/build/npm/esm/prod/helpers.js.map +1 -1
  280. package/build/npm/esm/prod/index.js +3 -2
  281. package/build/npm/esm/prod/index.js.map +1 -1
  282. package/build/npm/esm/prod/integrations/{bfcache.js → bfcacheMetrics.js} +37 -35
  283. package/build/npm/esm/prod/integrations/bfcacheMetrics.js.map +1 -0
  284. package/build/npm/esm/prod/integrations/breadcrumbs.js +1 -1
  285. package/build/npm/esm/prod/integrations/breadcrumbs.js.map +1 -1
  286. package/build/npm/esm/prod/integrations/browserapierrors.js +1 -1
  287. package/build/npm/esm/prod/integrations/browserapierrors.js.map +1 -1
  288. package/build/npm/esm/prod/integrations/browsersession.js +1 -1
  289. package/build/npm/esm/prod/integrations/browsersession.js.map +1 -1
  290. package/build/npm/esm/prod/integrations/contextlines.js +1 -1
  291. package/build/npm/esm/prod/integrations/contextlines.js.map +1 -1
  292. package/build/npm/esm/prod/integrations/culturecontext.js +1 -1
  293. package/build/npm/esm/prod/integrations/culturecontext.js.map +1 -1
  294. package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js +1 -1
  295. package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js.map +1 -1
  296. package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js +1 -1
  297. package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  298. package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js +1 -1
  299. package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js.map +1 -1
  300. package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js +1 -1
  301. package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js.map +1 -1
  302. package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js +1 -1
  303. package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js.map +1 -1
  304. package/build/npm/esm/prod/integrations/fetchStreamPerformance.js +11 -5
  305. package/build/npm/esm/prod/integrations/fetchStreamPerformance.js.map +1 -1
  306. package/build/npm/esm/prod/integrations/globalhandlers.js +1 -1
  307. package/build/npm/esm/prod/integrations/globalhandlers.js.map +1 -1
  308. package/build/npm/esm/prod/integrations/graphqlClient.js +21 -8
  309. package/build/npm/esm/prod/integrations/graphqlClient.js.map +1 -1
  310. package/build/npm/esm/prod/integrations/httpclient.js +1 -4
  311. package/build/npm/esm/prod/integrations/httpclient.js.map +1 -1
  312. package/build/npm/esm/prod/integrations/httpcontext.js +1 -2
  313. package/build/npm/esm/prod/integrations/httpcontext.js.map +1 -1
  314. package/build/npm/esm/prod/integrations/linkederrors.js +1 -1
  315. package/build/npm/esm/prod/integrations/linkederrors.js.map +1 -1
  316. package/build/npm/esm/prod/integrations/reportingobserver.js +1 -1
  317. package/build/npm/esm/prod/integrations/reportingobserver.js.map +1 -1
  318. package/build/npm/esm/prod/integrations/spotlight.js +1 -1
  319. package/build/npm/esm/prod/integrations/spotlight.js.map +1 -1
  320. package/build/npm/esm/prod/integrations/view-hierarchy.js +1 -1
  321. package/build/npm/esm/prod/integrations/view-hierarchy.js.map +1 -1
  322. package/build/npm/esm/prod/integrations/webVitals.js +1 -1
  323. package/build/npm/esm/prod/integrations/webVitals.js.map +1 -1
  324. package/build/npm/esm/prod/integrations/webWorker.js +1 -1
  325. package/build/npm/esm/prod/integrations/webWorker.js.map +1 -1
  326. package/build/npm/esm/prod/package.json +1 -1
  327. package/build/npm/esm/prod/profiling/UIProfiler.js +1 -1
  328. package/build/npm/esm/prod/profiling/UIProfiler.js.map +1 -1
  329. package/build/npm/esm/prod/profiling/index.js +1 -1
  330. package/build/npm/esm/prod/profiling/index.js.map +1 -1
  331. package/build/npm/esm/prod/profiling/integration.js +1 -1
  332. package/build/npm/esm/prod/profiling/integration.js.map +1 -1
  333. package/build/npm/esm/prod/profiling/utils.js +1 -1
  334. package/build/npm/esm/prod/profiling/utils.js.map +1 -1
  335. package/build/npm/esm/prod/report-dialog.js +1 -1
  336. package/build/npm/esm/prod/report-dialog.js.map +1 -1
  337. package/build/npm/esm/prod/sdk.js +1 -1
  338. package/build/npm/esm/prod/sdk.js.map +1 -1
  339. package/build/npm/esm/prod/stack-parsers.js +1 -1
  340. package/build/npm/esm/prod/stack-parsers.js.map +1 -1
  341. package/build/npm/esm/prod/tracing/backgroundtab.js +1 -1
  342. package/build/npm/esm/prod/tracing/backgroundtab.js.map +1 -1
  343. package/build/npm/esm/prod/tracing/browserTracingIntegration.js +7 -7
  344. package/build/npm/esm/prod/tracing/browserTracingIntegration.js.map +1 -1
  345. package/build/npm/esm/prod/tracing/linkedTraces.js +1 -2
  346. package/build/npm/esm/prod/tracing/linkedTraces.js.map +1 -1
  347. package/build/npm/esm/prod/tracing/reportPageLoaded.js +1 -1
  348. package/build/npm/esm/prod/tracing/reportPageLoaded.js.map +1 -1
  349. package/build/npm/esm/prod/tracing/request.js +16 -8
  350. package/build/npm/esm/prod/tracing/request.js.map +1 -1
  351. package/build/npm/esm/prod/tracing/setActiveSpan.js +1 -1
  352. package/build/npm/esm/prod/tracing/setActiveSpan.js.map +1 -1
  353. package/build/npm/esm/prod/transports/fetch.js +1 -1
  354. package/build/npm/esm/prod/transports/fetch.js.map +1 -1
  355. package/build/npm/esm/prod/transports/offline.js +1 -1
  356. package/build/npm/esm/prod/transports/offline.js.map +1 -1
  357. package/build/npm/esm/prod/userfeedback.js +1 -1
  358. package/build/npm/esm/prod/userfeedback.js.map +1 -1
  359. package/build/npm/esm/prod/utils/detectBrowserExtension.js +1 -1
  360. package/build/npm/esm/prod/utils/detectBrowserExtension.js.map +1 -1
  361. package/build/npm/esm/prod/utils/lazyLoadIntegration.js +1 -1
  362. package/build/npm/esm/prod/utils/lazyLoadIntegration.js.map +1 -1
  363. package/build/npm/types/client.d.ts +3 -2
  364. package/build/npm/types/client.d.ts.map +1 -1
  365. package/build/npm/types/eventbuilder.d.ts +1 -1
  366. package/build/npm/types/eventbuilder.d.ts.map +1 -1
  367. package/build/npm/types/exports.d.ts +3 -3
  368. package/build/npm/types/exports.d.ts.map +1 -1
  369. package/build/npm/types/helpers.d.ts +2 -2
  370. package/build/npm/types/helpers.d.ts.map +1 -1
  371. package/build/npm/types/index.bundle.logs.metrics.d.ts +1 -1
  372. package/build/npm/types/index.bundle.logs.metrics.d.ts.map +1 -1
  373. package/build/npm/types/index.bundle.replay.logs.metrics.d.ts +1 -1
  374. package/build/npm/types/index.bundle.replay.logs.metrics.d.ts.map +1 -1
  375. package/build/npm/types/index.bundle.tracing.d.ts +2 -2
  376. package/build/npm/types/index.bundle.tracing.d.ts.map +1 -1
  377. package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts +3 -3
  378. package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts.map +1 -1
  379. package/build/npm/types/index.bundle.tracing.replay.d.ts +2 -2
  380. package/build/npm/types/index.bundle.tracing.replay.d.ts.map +1 -1
  381. package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts +2 -2
  382. package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts.map +1 -1
  383. package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +2 -2
  384. package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts.map +1 -1
  385. package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts +3 -3
  386. package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts.map +1 -1
  387. package/build/npm/types/index.d.ts +4 -4
  388. package/build/npm/types/index.d.ts.map +1 -1
  389. package/build/npm/types/integrations/{bfcache.d.ts → bfcacheMetrics.d.ts} +3 -3
  390. package/build/npm/types/integrations/bfcacheMetrics.d.ts.map +1 -0
  391. package/build/npm/types/integrations/breadcrumbs.d.ts.map +1 -1
  392. package/build/npm/types/integrations/contextlines.d.ts +1 -1
  393. package/build/npm/types/integrations/contextlines.d.ts.map +1 -1
  394. package/build/npm/types/integrations/fetchStreamPerformance.d.ts.map +1 -1
  395. package/build/npm/types/integrations/globalhandlers.d.ts +1 -1
  396. package/build/npm/types/integrations/globalhandlers.d.ts.map +1 -1
  397. package/build/npm/types/integrations/graphqlClient.d.ts.map +1 -1
  398. package/build/npm/types/integrations/httpclient.d.ts.map +1 -1
  399. package/build/npm/types/integrations/view-hierarchy.d.ts +1 -1
  400. package/build/npm/types/integrations/view-hierarchy.d.ts.map +1 -1
  401. package/build/npm/types/integrations/webWorker.d.ts +1 -1
  402. package/build/npm/types/integrations/webWorker.d.ts.map +1 -1
  403. package/build/npm/types/integrations-bundle/index.captureconsole.d.ts +1 -1
  404. package/build/npm/types/integrations-bundle/index.captureconsole.d.ts.map +1 -1
  405. package/build/npm/types/integrations-bundle/index.dedupe.d.ts +1 -1
  406. package/build/npm/types/integrations-bundle/index.dedupe.d.ts.map +1 -1
  407. package/build/npm/types/integrations-bundle/index.extraerrordata.d.ts +1 -1
  408. package/build/npm/types/integrations-bundle/index.extraerrordata.d.ts.map +1 -1
  409. package/build/npm/types/integrations-bundle/index.feedback.d.ts +1 -1
  410. package/build/npm/types/integrations-bundle/index.feedback.d.ts.map +1 -1
  411. package/build/npm/types/integrations-bundle/index.modulemetadata.d.ts +1 -1
  412. package/build/npm/types/integrations-bundle/index.modulemetadata.d.ts.map +1 -1
  413. package/build/npm/types/integrations-bundle/index.rewriteframes.d.ts +1 -1
  414. package/build/npm/types/integrations-bundle/index.rewriteframes.d.ts.map +1 -1
  415. package/build/npm/types/pluggable-exports-bundle/index.multiplexedtransport.d.ts +1 -1
  416. package/build/npm/types/pluggable-exports-bundle/index.multiplexedtransport.d.ts.map +1 -1
  417. package/build/npm/types/profiling/UIProfiler.d.ts +1 -1
  418. package/build/npm/types/profiling/UIProfiler.d.ts.map +1 -1
  419. package/build/npm/types/profiling/index.d.ts +1 -1
  420. package/build/npm/types/profiling/index.d.ts.map +1 -1
  421. package/build/npm/types/profiling/utils.d.ts +1 -1
  422. package/build/npm/types/profiling/utils.d.ts.map +1 -1
  423. package/build/npm/types/report-dialog.d.ts +1 -1
  424. package/build/npm/types/report-dialog.d.ts.map +1 -1
  425. package/build/npm/types/sdk.d.ts +1 -1
  426. package/build/npm/types/sdk.d.ts.map +1 -1
  427. package/build/npm/types/stack-parsers.d.ts +1 -1
  428. package/build/npm/types/stack-parsers.d.ts.map +1 -1
  429. package/build/npm/types/tracing/browserTracingIntegration.d.ts +1 -1
  430. package/build/npm/types/tracing/browserTracingIntegration.d.ts.map +1 -1
  431. package/build/npm/types/tracing/linkedTraces.d.ts +2 -2
  432. package/build/npm/types/tracing/linkedTraces.d.ts.map +1 -1
  433. package/build/npm/types/tracing/reportPageLoaded.d.ts +1 -1
  434. package/build/npm/types/tracing/reportPageLoaded.d.ts.map +1 -1
  435. package/build/npm/types/tracing/request.d.ts +1 -1
  436. package/build/npm/types/tracing/request.d.ts.map +1 -1
  437. package/build/npm/types/tracing/setActiveSpan.d.ts +1 -1
  438. package/build/npm/types/tracing/setActiveSpan.d.ts.map +1 -1
  439. package/build/npm/types/transports/fetch.d.ts +1 -1
  440. package/build/npm/types/transports/fetch.d.ts.map +1 -1
  441. package/build/npm/types/transports/offline.d.ts +1 -1
  442. package/build/npm/types/transports/offline.d.ts.map +1 -1
  443. package/build/npm/types/transports/types.d.ts +1 -1
  444. package/build/npm/types/transports/types.d.ts.map +1 -1
  445. package/build/npm/types/userfeedback.d.ts +1 -1
  446. package/build/npm/types/userfeedback.d.ts.map +1 -1
  447. package/build/npm/types/utils/lazyLoadIntegration.d.ts +1 -1
  448. package/build/npm/types/utils/lazyLoadIntegration.d.ts.map +1 -1
  449. package/package.json +7 -7
  450. package/build/npm/cjs/dev/integrations/bfcache.js.map +0 -1
  451. package/build/npm/cjs/prod/integrations/bfcache.js.map +0 -1
  452. package/build/npm/esm/dev/integrations/bfcache.js.map +0 -1
  453. package/build/npm/esm/prod/integrations/bfcache.js.map +0 -1
  454. package/build/npm/types/integrations/bfcache.d.ts.map +0 -1
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const browser = require('@sentry/core/browser');
3
+ const core = require('@sentry/core');
4
4
  const debugBuild = require('../debug-build.js');
5
5
  const helpers = require('../helpers.js');
6
6
 
7
- const isMainThread = "window" in browser.GLOBAL_OBJ && browser.GLOBAL_OBJ.window === browser.GLOBAL_OBJ && typeof importScripts === "undefined";
7
+ const isMainThread = "window" in core.GLOBAL_OBJ && core.GLOBAL_OBJ.window === core.GLOBAL_OBJ && typeof importScripts === "undefined";
8
8
  const PROFILER_THREAD_ID_STRING = String(0);
9
9
  const PROFILER_THREAD_NAME = isMainThread ? "main" : "worker";
10
10
  function createProfileChunkPayload(jsSelfProfile, client, profilerId) {
@@ -17,12 +17,12 @@ function createProfileChunkPayload(jsSelfProfile, client, profilerId) {
17
17
  const options = client.getOptions();
18
18
  const sdk = client.getSdkMetadata?.()?.sdk;
19
19
  return {
20
- chunk_id: browser.uuid4(),
20
+ chunk_id: core.uuid4(),
21
21
  client_sdk: {
22
22
  name: sdk?.name ?? "sentry.javascript.browser",
23
23
  version: sdk?.version ?? "0.0.0"
24
24
  },
25
- profiler_id: profilerId || browser.uuid4(),
25
+ profiler_id: profilerId || core.uuid4(),
26
26
  platform: "javascript",
27
27
  version: "2",
28
28
  release: options.release ?? "",
@@ -95,7 +95,7 @@ function convertToContinuousProfile(input) {
95
95
  }
96
96
  stacks[i] = list;
97
97
  }
98
- const perfOrigin = browser.browserPerformanceTimeOrigin();
98
+ const perfOrigin = core.browserPerformanceTimeOrigin();
99
99
  const origin = typeof performance.timeOrigin === "number" ? performance.timeOrigin : perfOrigin || 0;
100
100
  const adjustForOriginChange = origin - (perfOrigin || origin);
101
101
  const samples = [];
@@ -119,17 +119,17 @@ function convertToContinuousProfile(input) {
119
119
  };
120
120
  }
121
121
  function applyDebugMetadata(resource_paths) {
122
- const client = browser.getClient();
122
+ const client = core.getClient();
123
123
  const options = client?.getOptions();
124
124
  const stackParser = options?.stackParser;
125
125
  if (!stackParser) {
126
126
  return [];
127
127
  }
128
- return browser.getDebugImagesForResources(stackParser, resource_paths);
128
+ return core.getDebugImagesForResources(stackParser, resource_paths);
129
129
  }
130
130
  function isValidSampleRate(rate) {
131
131
  if (typeof rate !== "number" && typeof rate !== "boolean" || typeof rate === "number" && isNaN(rate)) {
132
- debugBuild.DEBUG_BUILD && browser.debug.warn(
132
+ debugBuild.DEBUG_BUILD && core.debug.warn(
133
133
  `[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(
134
134
  rate
135
135
  )} of type ${JSON.stringify(typeof rate)}.`
@@ -140,7 +140,7 @@ function isValidSampleRate(rate) {
140
140
  return true;
141
141
  }
142
142
  if (rate < 0 || rate > 1) {
143
- debugBuild.DEBUG_BUILD && browser.debug.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${rate}.`);
143
+ debugBuild.DEBUG_BUILD && core.debug.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${rate}.`);
144
144
  return false;
145
145
  }
146
146
  return true;
@@ -154,7 +154,7 @@ function startJSSelfProfile() {
154
154
  const JSProfilerConstructor = helpers.WINDOW.Profiler;
155
155
  if (!isJSProfilerSupported(JSProfilerConstructor)) {
156
156
  if (debugBuild.DEBUG_BUILD) {
157
- browser.debug.log("[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.");
157
+ core.debug.log("[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.");
158
158
  }
159
159
  return;
160
160
  }
@@ -164,10 +164,10 @@ function startJSSelfProfile() {
164
164
  return new JSProfilerConstructor({ sampleInterval: samplingIntervalMS, maxBufferSize: maxSamples });
165
165
  } catch {
166
166
  if (debugBuild.DEBUG_BUILD) {
167
- browser.debug.log(
167
+ core.debug.log(
168
168
  "[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header."
169
169
  );
170
- browser.debug.log("[Profiling] Disabling profiling for current user session.");
170
+ core.debug.log("[Profiling] Disabling profiling for current user session.");
171
171
  }
172
172
  PROFILING_CONSTRUCTOR_FAILED = true;
173
173
  }
@@ -176,23 +176,23 @@ function startJSSelfProfile() {
176
176
  function shouldProfileSession(options) {
177
177
  if (PROFILING_CONSTRUCTOR_FAILED) {
178
178
  if (debugBuild.DEBUG_BUILD) {
179
- browser.debug.log(
179
+ core.debug.log(
180
180
  "[Profiling] Profiling has been disabled for the duration of the current user session as the JS Profiler could not be started."
181
181
  );
182
182
  }
183
183
  return false;
184
184
  }
185
185
  if (options.profileLifecycle !== "trace" && options.profileLifecycle !== "manual") {
186
- debugBuild.DEBUG_BUILD && browser.debug.warn("[Profiling] Session not sampled. Invalid `profileLifecycle` option.");
186
+ debugBuild.DEBUG_BUILD && core.debug.warn("[Profiling] Session not sampled. Invalid `profileLifecycle` option.");
187
187
  return false;
188
188
  }
189
189
  const profileSessionSampleRate = options.profileSessionSampleRate;
190
190
  if (!isValidSampleRate(profileSessionSampleRate)) {
191
- debugBuild.DEBUG_BUILD && browser.debug.warn("[Profiling] Discarding profile because of invalid profileSessionSampleRate.");
191
+ debugBuild.DEBUG_BUILD && core.debug.warn("[Profiling] Discarding profile because of invalid profileSessionSampleRate.");
192
192
  return false;
193
193
  }
194
194
  if (!profileSessionSampleRate) {
195
- debugBuild.DEBUG_BUILD && browser.debug.log("[Profiling] Discarding profile because profileSessionSampleRate is not defined or set to 0");
195
+ debugBuild.DEBUG_BUILD && core.debug.log("[Profiling] Discarding profile because profileSessionSampleRate is not defined or set to 0");
196
196
  return false;
197
197
  }
198
198
  return Math.random() <= profileSessionSampleRate;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../src/profiling/utils.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type { Client, ContinuousThreadCpuProfile, DebugImage, ProfileChunk, Span } from '@sentry/core/browser';\nimport {\n browserPerformanceTimeOrigin,\n debug,\n getClient,\n getDebugImagesForResources,\n GLOBAL_OBJ,\n uuid4,\n} from '@sentry/core/browser';\nimport type { BrowserOptions } from '../client';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { WINDOW } from '../helpers';\nimport type { JSSelfProfile, JSSelfProfiler, JSSelfProfilerConstructor } from './jsSelfProfiling';\n\n// Checking if we are in Main or Worker thread: `self` (not `window`) is the `globalThis` in Web Workers and `importScripts` are only available in Web Workers\nconst isMainThread = 'window' in GLOBAL_OBJ && GLOBAL_OBJ.window === GLOBAL_OBJ && typeof importScripts === 'undefined';\n\n// Setting ID to 0 as we cannot get an ID from Web Workers\nexport const PROFILER_THREAD_ID_STRING = String(0);\nexport const PROFILER_THREAD_NAME = isMainThread ? 'main' : 'worker';\n\n/**\n * Create a profile chunk envelope item\n */\nexport function createProfileChunkPayload(\n jsSelfProfile: JSSelfProfile,\n client: Client,\n profilerId?: string,\n): ProfileChunk {\n // only == to catch null and undefined\n if (jsSelfProfile == null) {\n throw new TypeError(\n `Cannot construct profiling event envelope without a valid profile. Got ${jsSelfProfile} instead.`,\n );\n }\n\n const continuousProfile = convertToContinuousProfile(jsSelfProfile);\n\n const options = client.getOptions();\n const sdk = client.getSdkMetadata?.()?.sdk;\n\n return {\n chunk_id: uuid4(),\n client_sdk: {\n name: sdk?.name ?? 'sentry.javascript.browser',\n version: sdk?.version ?? '0.0.0',\n },\n profiler_id: profilerId || uuid4(),\n platform: 'javascript',\n version: '2',\n release: options.release ?? '',\n environment: options.environment ?? 'production',\n debug_meta: {\n // function name obfuscation\n images: applyDebugMetadata(jsSelfProfile.resources),\n },\n profile: continuousProfile,\n };\n}\n\n/**\n * Validate a profile chunk against the Sample Format V2 requirements.\n * https://develop.sentry.dev/sdk/telemetry/profiles/sample-format-v2/\n * - Presence of samples, stacks, frames\n * - Required metadata fields\n */\nexport function validateProfileChunk(chunk: ProfileChunk): { valid: true } | { reason: string } {\n try {\n // Required metadata\n if (!chunk || typeof chunk !== 'object') {\n return { reason: 'chunk is not an object' };\n }\n\n // profiler_id and chunk_id must be 32 lowercase hex chars\n const isHex32 = (val: unknown): boolean => typeof val === 'string' && /^[a-f0-9]{32}$/.test(val);\n if (!isHex32(chunk.profiler_id)) {\n return { reason: 'missing or invalid profiler_id' };\n }\n if (!isHex32(chunk.chunk_id)) {\n return { reason: 'missing or invalid chunk_id' };\n }\n\n if (!chunk.client_sdk) {\n return { reason: 'missing client_sdk metadata' };\n }\n\n // Profile data must have frames, stacks, samples\n const profile = chunk.profile as { frames?: unknown[]; stacks?: unknown[]; samples?: unknown[] } | undefined;\n if (!profile) {\n return { reason: 'missing profile data' };\n }\n\n if (!Array.isArray(profile.frames) || !profile.frames.length) {\n return { reason: 'profile has no frames' };\n }\n if (!Array.isArray(profile.stacks) || !profile.stacks.length) {\n return { reason: 'profile has no stacks' };\n }\n if (!Array.isArray(profile.samples) || !profile.samples.length) {\n return { reason: 'profile has no samples' };\n }\n\n return { valid: true };\n } catch (e) {\n return { reason: `unknown validation error: ${e}` };\n }\n}\n\n/**\n * Convert from JSSelfProfile format to ContinuousThreadCpuProfile format.\n */\nfunction convertToContinuousProfile(input: {\n frames: { name: string; resourceId?: number; line?: number; column?: number }[];\n stacks: { frameId: number; parentId?: number }[];\n samples: { timestamp: number; stackId?: number }[];\n resources: string[];\n}): ContinuousThreadCpuProfile {\n // Frames map 1:1 by index; fill only when present to avoid sparse writes\n const frames: ContinuousThreadCpuProfile['frames'] = [];\n for (let i = 0; i < input.frames.length; i++) {\n const frame = input.frames[i];\n if (!frame) {\n continue;\n }\n frames[i] = {\n function: frame.name,\n abs_path: typeof frame.resourceId === 'number' ? input.resources[frame.resourceId] : undefined,\n lineno: frame.line,\n colno: frame.column,\n };\n }\n\n // Build stacks by following parent links, top->down order (root last)\n const stacks: ContinuousThreadCpuProfile['stacks'] = [];\n for (let i = 0; i < input.stacks.length; i++) {\n const stackHead = input.stacks[i];\n if (!stackHead) {\n continue;\n }\n const list: number[] = [];\n let current: { frameId: number; parentId?: number } | undefined = stackHead;\n while (current) {\n list.push(current.frameId);\n current = current.parentId === undefined ? undefined : input.stacks[current.parentId];\n }\n stacks[i] = list;\n }\n\n // Align timestamps to SDK time origin to match span/event timelines\n const perfOrigin = browserPerformanceTimeOrigin();\n const origin = typeof performance.timeOrigin === 'number' ? performance.timeOrigin : perfOrigin || 0;\n const adjustForOriginChange = origin - (perfOrigin || origin);\n\n const samples: ContinuousThreadCpuProfile['samples'] = [];\n for (let i = 0; i < input.samples.length; i++) {\n const sample = input.samples[i];\n if (!sample) {\n continue;\n }\n // Convert ms to seconds epoch-based timestamp\n const timestampSeconds = (origin + (sample.timestamp - adjustForOriginChange)) / 1000;\n samples[i] = {\n stack_id: sample.stackId ?? 0,\n thread_id: PROFILER_THREAD_ID_STRING,\n timestamp: timestampSeconds,\n };\n }\n\n return {\n frames,\n stacks,\n samples,\n thread_metadata: { [PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME } },\n };\n}\n\n/**\n * Applies debug meta data to an event from a list of paths to resources (sourcemaps)\n */\nexport function applyDebugMetadata(resource_paths: ReadonlyArray<string>): DebugImage[] {\n const client = getClient();\n const options = client?.getOptions();\n const stackParser = options?.stackParser;\n\n if (!stackParser) {\n return [];\n }\n\n return getDebugImagesForResources(stackParser, resource_paths);\n}\n\n/**\n * Checks the given sample rate to make sure it is valid type and value (a boolean, or a number between 0 and 1).\n */\nexport function isValidSampleRate(rate: unknown): boolean {\n // we need to check NaN explicitly because it's of type 'number' and therefore wouldn't get caught by this typecheck\n if ((typeof rate !== 'number' && typeof rate !== 'boolean') || (typeof rate === 'number' && isNaN(rate))) {\n DEBUG_BUILD &&\n debug.warn(\n `[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(\n rate,\n )} of type ${JSON.stringify(typeof rate)}.`,\n );\n return false;\n }\n\n // Boolean sample rates are always valid\n if (rate === true || rate === false) {\n return true;\n }\n\n // in case sampleRate is a boolean, it will get automatically cast to 1 if it's true and 0 if it's false\n if (rate < 0 || rate > 1) {\n DEBUG_BUILD && debug.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${rate}.`);\n return false;\n }\n return true;\n}\n\n// Keep a flag value to avoid re-initializing the profiler constructor. If it fails\n// once, it will always fail and this allows us to early return.\nlet PROFILING_CONSTRUCTOR_FAILED: boolean = false;\nexport const MAX_PROFILE_DURATION_MS = 30_000;\n\n/**\n * Check if profiler constructor is available.\n * @param maybeProfiler\n */\nfunction isJSProfilerSupported(maybeProfiler: unknown): maybeProfiler is typeof JSSelfProfilerConstructor {\n return typeof maybeProfiler === 'function';\n}\n\n/**\n * Starts the profiler and returns the profiler instance.\n */\nexport function startJSSelfProfile(): JSSelfProfiler | undefined {\n // Feature support check first\n const JSProfilerConstructor = WINDOW.Profiler;\n\n if (!isJSProfilerSupported(JSProfilerConstructor)) {\n if (DEBUG_BUILD) {\n debug.log('[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.');\n }\n return;\n }\n\n // From initial testing, it seems that the minimum value for sampleInterval is 10ms.\n const samplingIntervalMS = 10;\n // Start the profiler\n const maxSamples = Math.floor(MAX_PROFILE_DURATION_MS / samplingIntervalMS);\n\n // Attempt to initialize the profiler constructor, if it fails, we disable profiling for the current user session.\n // This is likely due to a missing 'Document-Policy': 'js-profiling' header. We do not want to throw an error if this happens\n // as we risk breaking the user's application, so just disable profiling and log an error.\n try {\n return new JSProfilerConstructor({ sampleInterval: samplingIntervalMS, maxBufferSize: maxSamples });\n } catch {\n if (DEBUG_BUILD) {\n debug.log(\n \"[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header.\",\n );\n debug.log('[Profiling] Disabling profiling for current user session.');\n }\n PROFILING_CONSTRUCTOR_FAILED = true;\n }\n\n return;\n}\n\n/**\n * Determine if a profile should be created for the current session.\n */\nexport function shouldProfileSession(options: BrowserOptions): boolean {\n // If constructor failed once, it will always fail, so we can early return.\n if (PROFILING_CONSTRUCTOR_FAILED) {\n if (DEBUG_BUILD) {\n debug.log(\n '[Profiling] Profiling has been disabled for the duration of the current user session as the JS Profiler could not be started.',\n );\n }\n return false;\n }\n\n if (options.profileLifecycle !== 'trace' && options.profileLifecycle !== 'manual') {\n DEBUG_BUILD && debug.warn('[Profiling] Session not sampled. Invalid `profileLifecycle` option.');\n return false;\n }\n\n // Session sampling: profileSessionSampleRate gates whether profiling is enabled for this session\n const profileSessionSampleRate = options.profileSessionSampleRate;\n\n if (!isValidSampleRate(profileSessionSampleRate)) {\n DEBUG_BUILD && debug.warn('[Profiling] Discarding profile because of invalid profileSessionSampleRate.');\n return false;\n }\n\n if (!profileSessionSampleRate) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Discarding profile because profileSessionSampleRate is not defined or set to 0');\n return false;\n }\n\n return Math.random() <= profileSessionSampleRate;\n}\n\nexport function setThreadAttributes(span: Span): void {\n span.setAttribute('thread.id', PROFILER_THREAD_ID_STRING);\n span.setAttribute('thread.name', PROFILER_THREAD_NAME);\n}\n"],"names":["GLOBAL_OBJ","uuid4","browserPerformanceTimeOrigin","getClient","getDebugImagesForResources","DEBUG_BUILD","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AK,YAAA,CAAa,eAAe,oBAAoB,CAAA;AACvD;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../src/profiling/utils.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type { Client, ContinuousThreadCpuProfile, DebugImage, ProfileChunk, Span } from '@sentry/core';\nimport {\n browserPerformanceTimeOrigin,\n debug,\n getClient,\n getDebugImagesForResources,\n GLOBAL_OBJ,\n uuid4,\n} from '@sentry/core';\nimport type { BrowserOptions } from '../client';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { WINDOW } from '../helpers';\nimport type { JSSelfProfile, JSSelfProfiler, JSSelfProfilerConstructor } from './jsSelfProfiling';\n\n// Checking if we are in Main or Worker thread: `self` (not `window`) is the `globalThis` in Web Workers and `importScripts` are only available in Web Workers\nconst isMainThread = 'window' in GLOBAL_OBJ && GLOBAL_OBJ.window === GLOBAL_OBJ && typeof importScripts === 'undefined';\n\n// Setting ID to 0 as we cannot get an ID from Web Workers\nexport const PROFILER_THREAD_ID_STRING = String(0);\nexport const PROFILER_THREAD_NAME = isMainThread ? 'main' : 'worker';\n\n/**\n * Create a profile chunk envelope item\n */\nexport function createProfileChunkPayload(\n jsSelfProfile: JSSelfProfile,\n client: Client,\n profilerId?: string,\n): ProfileChunk {\n // only == to catch null and undefined\n if (jsSelfProfile == null) {\n throw new TypeError(\n `Cannot construct profiling event envelope without a valid profile. Got ${jsSelfProfile} instead.`,\n );\n }\n\n const continuousProfile = convertToContinuousProfile(jsSelfProfile);\n\n const options = client.getOptions();\n const sdk = client.getSdkMetadata?.()?.sdk;\n\n return {\n chunk_id: uuid4(),\n client_sdk: {\n name: sdk?.name ?? 'sentry.javascript.browser',\n version: sdk?.version ?? '0.0.0',\n },\n profiler_id: profilerId || uuid4(),\n platform: 'javascript',\n version: '2',\n release: options.release ?? '',\n environment: options.environment ?? 'production',\n debug_meta: {\n // function name obfuscation\n images: applyDebugMetadata(jsSelfProfile.resources),\n },\n profile: continuousProfile,\n };\n}\n\n/**\n * Validate a profile chunk against the Sample Format V2 requirements.\n * https://develop.sentry.dev/sdk/telemetry/profiles/sample-format-v2/\n * - Presence of samples, stacks, frames\n * - Required metadata fields\n */\nexport function validateProfileChunk(chunk: ProfileChunk): { valid: true } | { reason: string } {\n try {\n // Required metadata\n if (!chunk || typeof chunk !== 'object') {\n return { reason: 'chunk is not an object' };\n }\n\n // profiler_id and chunk_id must be 32 lowercase hex chars\n const isHex32 = (val: unknown): boolean => typeof val === 'string' && /^[a-f0-9]{32}$/.test(val);\n if (!isHex32(chunk.profiler_id)) {\n return { reason: 'missing or invalid profiler_id' };\n }\n if (!isHex32(chunk.chunk_id)) {\n return { reason: 'missing or invalid chunk_id' };\n }\n\n if (!chunk.client_sdk) {\n return { reason: 'missing client_sdk metadata' };\n }\n\n // Profile data must have frames, stacks, samples\n const profile = chunk.profile as { frames?: unknown[]; stacks?: unknown[]; samples?: unknown[] } | undefined;\n if (!profile) {\n return { reason: 'missing profile data' };\n }\n\n if (!Array.isArray(profile.frames) || !profile.frames.length) {\n return { reason: 'profile has no frames' };\n }\n if (!Array.isArray(profile.stacks) || !profile.stacks.length) {\n return { reason: 'profile has no stacks' };\n }\n if (!Array.isArray(profile.samples) || !profile.samples.length) {\n return { reason: 'profile has no samples' };\n }\n\n return { valid: true };\n } catch (e) {\n return { reason: `unknown validation error: ${e}` };\n }\n}\n\n/**\n * Convert from JSSelfProfile format to ContinuousThreadCpuProfile format.\n */\nfunction convertToContinuousProfile(input: {\n frames: { name: string; resourceId?: number; line?: number; column?: number }[];\n stacks: { frameId: number; parentId?: number }[];\n samples: { timestamp: number; stackId?: number }[];\n resources: string[];\n}): ContinuousThreadCpuProfile {\n // Frames map 1:1 by index; fill only when present to avoid sparse writes\n const frames: ContinuousThreadCpuProfile['frames'] = [];\n for (let i = 0; i < input.frames.length; i++) {\n const frame = input.frames[i];\n if (!frame) {\n continue;\n }\n frames[i] = {\n function: frame.name,\n abs_path: typeof frame.resourceId === 'number' ? input.resources[frame.resourceId] : undefined,\n lineno: frame.line,\n colno: frame.column,\n };\n }\n\n // Build stacks by following parent links, top->down order (root last)\n const stacks: ContinuousThreadCpuProfile['stacks'] = [];\n for (let i = 0; i < input.stacks.length; i++) {\n const stackHead = input.stacks[i];\n if (!stackHead) {\n continue;\n }\n const list: number[] = [];\n let current: { frameId: number; parentId?: number } | undefined = stackHead;\n while (current) {\n list.push(current.frameId);\n current = current.parentId === undefined ? undefined : input.stacks[current.parentId];\n }\n stacks[i] = list;\n }\n\n // Align timestamps to SDK time origin to match span/event timelines\n const perfOrigin = browserPerformanceTimeOrigin();\n const origin = typeof performance.timeOrigin === 'number' ? performance.timeOrigin : perfOrigin || 0;\n const adjustForOriginChange = origin - (perfOrigin || origin);\n\n const samples: ContinuousThreadCpuProfile['samples'] = [];\n for (let i = 0; i < input.samples.length; i++) {\n const sample = input.samples[i];\n if (!sample) {\n continue;\n }\n // Convert ms to seconds epoch-based timestamp\n const timestampSeconds = (origin + (sample.timestamp - adjustForOriginChange)) / 1000;\n samples[i] = {\n stack_id: sample.stackId ?? 0,\n thread_id: PROFILER_THREAD_ID_STRING,\n timestamp: timestampSeconds,\n };\n }\n\n return {\n frames,\n stacks,\n samples,\n thread_metadata: { [PROFILER_THREAD_ID_STRING]: { name: PROFILER_THREAD_NAME } },\n };\n}\n\n/**\n * Applies debug meta data to an event from a list of paths to resources (sourcemaps)\n */\nexport function applyDebugMetadata(resource_paths: ReadonlyArray<string>): DebugImage[] {\n const client = getClient();\n const options = client?.getOptions();\n const stackParser = options?.stackParser;\n\n if (!stackParser) {\n return [];\n }\n\n return getDebugImagesForResources(stackParser, resource_paths);\n}\n\n/**\n * Checks the given sample rate to make sure it is valid type and value (a boolean, or a number between 0 and 1).\n */\nexport function isValidSampleRate(rate: unknown): boolean {\n // we need to check NaN explicitly because it's of type 'number' and therefore wouldn't get caught by this typecheck\n if ((typeof rate !== 'number' && typeof rate !== 'boolean') || (typeof rate === 'number' && isNaN(rate))) {\n DEBUG_BUILD &&\n debug.warn(\n `[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(\n rate,\n )} of type ${JSON.stringify(typeof rate)}.`,\n );\n return false;\n }\n\n // Boolean sample rates are always valid\n if (rate === true || rate === false) {\n return true;\n }\n\n // in case sampleRate is a boolean, it will get automatically cast to 1 if it's true and 0 if it's false\n if (rate < 0 || rate > 1) {\n DEBUG_BUILD && debug.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${rate}.`);\n return false;\n }\n return true;\n}\n\n// Keep a flag value to avoid re-initializing the profiler constructor. If it fails\n// once, it will always fail and this allows us to early return.\nlet PROFILING_CONSTRUCTOR_FAILED: boolean = false;\nexport const MAX_PROFILE_DURATION_MS = 30_000;\n\n/**\n * Check if profiler constructor is available.\n * @param maybeProfiler\n */\nfunction isJSProfilerSupported(maybeProfiler: unknown): maybeProfiler is typeof JSSelfProfilerConstructor {\n return typeof maybeProfiler === 'function';\n}\n\n/**\n * Starts the profiler and returns the profiler instance.\n */\nexport function startJSSelfProfile(): JSSelfProfiler | undefined {\n // Feature support check first\n const JSProfilerConstructor = WINDOW.Profiler;\n\n if (!isJSProfilerSupported(JSProfilerConstructor)) {\n if (DEBUG_BUILD) {\n debug.log('[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.');\n }\n return;\n }\n\n // From initial testing, it seems that the minimum value for sampleInterval is 10ms.\n const samplingIntervalMS = 10;\n // Start the profiler\n const maxSamples = Math.floor(MAX_PROFILE_DURATION_MS / samplingIntervalMS);\n\n // Attempt to initialize the profiler constructor, if it fails, we disable profiling for the current user session.\n // This is likely due to a missing 'Document-Policy': 'js-profiling' header. We do not want to throw an error if this happens\n // as we risk breaking the user's application, so just disable profiling and log an error.\n try {\n return new JSProfilerConstructor({ sampleInterval: samplingIntervalMS, maxBufferSize: maxSamples });\n } catch {\n if (DEBUG_BUILD) {\n debug.log(\n \"[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header.\",\n );\n debug.log('[Profiling] Disabling profiling for current user session.');\n }\n PROFILING_CONSTRUCTOR_FAILED = true;\n }\n\n return;\n}\n\n/**\n * Determine if a profile should be created for the current session.\n */\nexport function shouldProfileSession(options: BrowserOptions): boolean {\n // If constructor failed once, it will always fail, so we can early return.\n if (PROFILING_CONSTRUCTOR_FAILED) {\n if (DEBUG_BUILD) {\n debug.log(\n '[Profiling] Profiling has been disabled for the duration of the current user session as the JS Profiler could not be started.',\n );\n }\n return false;\n }\n\n if (options.profileLifecycle !== 'trace' && options.profileLifecycle !== 'manual') {\n DEBUG_BUILD && debug.warn('[Profiling] Session not sampled. Invalid `profileLifecycle` option.');\n return false;\n }\n\n // Session sampling: profileSessionSampleRate gates whether profiling is enabled for this session\n const profileSessionSampleRate = options.profileSessionSampleRate;\n\n if (!isValidSampleRate(profileSessionSampleRate)) {\n DEBUG_BUILD && debug.warn('[Profiling] Discarding profile because of invalid profileSessionSampleRate.');\n return false;\n }\n\n if (!profileSessionSampleRate) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Discarding profile because profileSessionSampleRate is not defined or set to 0');\n return false;\n }\n\n return Math.random() <= profileSessionSampleRate;\n}\n\nexport function setThreadAttributes(span: Span): void {\n span.setAttribute('thread.id', PROFILER_THREAD_ID_STRING);\n span.setAttribute('thread.name', PROFILER_THREAD_NAME);\n}\n"],"names":["GLOBAL_OBJ","uuid4","browserPerformanceTimeOrigin","getClient","getDebugImagesForResources","DEBUG_BUILD","debug","WINDOW"],"mappings":";;;;;;AAgBA,MAAM,eAAe,QAAA,IAAYA,eAAA,IAAcA,gBAAW,MAAA,KAAWA,eAAA,IAAc,OAAO,aAAA,KAAkB,WAAA;AAGrG,MAAM,yBAAA,GAA4B,OAAO,CAAC;AAC1C,MAAM,oBAAA,GAAuB,eAAe,MAAA,GAAS;AAKrD,SAAS,yBAAA,CACd,aAAA,EACA,MAAA,EACA,UAAA,EACc;AAEd,EAAA,IAAI,iB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,4BAAA,GAA+B,IAAA;AAAA,EACjC;AAEA,EAAA;AACF;AAKO,SAAS,qBAAqB,OAAA,EAAkC;AAErE,EAAA,IAAI,4BAAA,EAA8B;AAChC,IAAA,IAAID,sBAAA,EAAa;AACf,MAAAC,UAAA,CAAM,GAAA;AAAA,QACJ;AAAA,OACF;AAAA,IACF;AACA,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,IAAI,OAAA,CAAQ,gBAAA,KAAqB,OAAA,IAAW,OAAA,CAAQ,qBAAqB,QAAA,EAAU;AACjF,IAAAD,sBAAA,IAAeC,UAAA,CAAM,KAAK,qEAAqE,CAAA;AAC/F,IAAA,OAAO,KAAA;AAAA,EACT;AAGA,EAAA,MAAM,2BAA2B,OAAA,CAAQ,wBAAA;AAEzC,EAAA,IAAI,CAAC,iBAAA,CAAkB,wBAAwB,CAAA,EAAG;AAChD,IAAAD,sBAAA,IAAeC,UAAA,CAAM,KAAK,6EAA6E,CAAA;AACvG,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,IAAI,CAAC,wBAAA,EAA0B;AAC7B,IAAAD,sBAAA,IACEC,UAAA,CAAM,IAAI,4FAA4F,CAAA;AACxG,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,OAAO,IAAA,CAAK,QAAO,IAAK,wBAAA;AAC1B;AAEO,SAAS,oBAAoB,IAAA,EAAkB;AACpD,EAAA,IAAA,CAAK,YAAA,CAAa,aAAa,yBAAyB,CAAA;AACxD,EAAA,IAAA,CAAK,YAAA,CAAa,eAAe,oBAAoB,CAAA;AACvD;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const browser = require('@sentry/core/browser');
3
+ const core = require('@sentry/core');
4
4
  const debugBuild = require('./debug-build.js');
5
5
  const helpers = require('./helpers.js');
6
6
 
@@ -8,14 +8,14 @@ function showReportDialog(options = {}) {
8
8
  const optionalDocument = helpers.WINDOW.document;
9
9
  const injectionPoint = optionalDocument?.head || optionalDocument?.body;
10
10
  if (!injectionPoint) {
11
- debugBuild.DEBUG_BUILD && browser.debug.error("[showReportDialog] Global document not defined");
11
+ debugBuild.DEBUG_BUILD && core.debug.error("[showReportDialog] Global document not defined");
12
12
  return;
13
13
  }
14
- const scope = browser.getCurrentScope();
15
- const client = browser.getClient();
14
+ const scope = core.getCurrentScope();
15
+ const client = core.getClient();
16
16
  const dsn = client?.getDsn();
17
17
  if (!dsn) {
18
- debugBuild.DEBUG_BUILD && browser.debug.error("[showReportDialog] DSN not configured");
18
+ debugBuild.DEBUG_BUILD && core.debug.error("[showReportDialog] DSN not configured");
19
19
  return;
20
20
  }
21
21
  const mergedOptions = {
@@ -24,12 +24,12 @@ function showReportDialog(options = {}) {
24
24
  ...scope.getUser(),
25
25
  ...options.user
26
26
  },
27
- eventId: options.eventId || browser.lastEventId()
27
+ eventId: options.eventId || core.lastEventId()
28
28
  };
29
29
  const script = helpers.WINDOW.document.createElement("script");
30
30
  script.async = true;
31
31
  script.crossOrigin = "anonymous";
32
- script.src = browser.getReportDialogEndpoint(dsn, mergedOptions);
32
+ script.src = core.getReportDialogEndpoint(dsn, mergedOptions);
33
33
  const { onLoad, onClose } = mergedOptions;
34
34
  if (onLoad) {
35
35
  script.onload = onLoad;
@@ -1 +1 @@
1
- {"version":3,"file":"report-dialog.js","sources":["../../../../src/report-dialog.ts"],"sourcesContent":["import type { ReportDialogOptions } from '@sentry/core/browser';\nimport { debug, getClient, getCurrentScope, getReportDialogEndpoint, lastEventId } from '@sentry/core/browser';\nimport { DEBUG_BUILD } from './debug-build';\nimport { WINDOW } from './helpers';\n\n/**\n * Present the user with a report dialog.\n *\n * @param options Everything is optional, we try to fetch all info need from the current scope.\n */\nexport function showReportDialog(options: ReportDialogOptions = {}): void {\n const optionalDocument = WINDOW.document as Document | undefined;\n const injectionPoint = optionalDocument?.head || optionalDocument?.body;\n\n // doesn't work without a document (React Native)\n if (!injectionPoint) {\n DEBUG_BUILD && debug.error('[showReportDialog] Global document not defined');\n return;\n }\n\n const scope = getCurrentScope();\n const client = getClient();\n const dsn = client?.getDsn();\n\n if (!dsn) {\n DEBUG_BUILD && debug.error('[showReportDialog] DSN not configured');\n return;\n }\n\n const mergedOptions = {\n ...options,\n user: {\n ...scope.getUser(),\n ...options.user,\n },\n eventId: options.eventId || lastEventId(),\n };\n\n const script = WINDOW.document.createElement('script');\n script.async = true;\n script.crossOrigin = 'anonymous';\n script.src = getReportDialogEndpoint(dsn, mergedOptions);\n\n const { onLoad, onClose } = mergedOptions;\n\n if (onLoad) {\n script.onload = onLoad;\n }\n\n if (onClose) {\n const reportDialogClosedMessageHandler = (event: MessageEvent): void => {\n if (event.data === '__sentry_reportdialog_closed__') {\n try {\n onClose();\n } finally {\n WINDOW.removeEventListener('message', reportDialogClosedMessageHandler);\n }\n }\n };\n WINDOW.addEventListener('message', reportDialogClosedMessageHandler);\n }\n\n injectionPoint.appendChild(script);\n}\n"],"names":["WINDOW","DEBUG_BUILD","debug","getCurrentScope","getClient","lastEventId","getReportDialogEndpoint"],"mappings":";;;;;;AAUO,SAAS,gBAAA,CAAiB,OAAA,GAA+B,EAAC,EAAS;AACxE,EAAA,MAAM,mBAAmBA,cAAA,CAAO,QAAA;AAChC,EAAA,MAAM,cAAA,GAAiB,gBAAA,EAAkB,IAAA,IAAQ,gBAAA,EAAkB,IAAA;AAGnE,EAAA,IAAI,CAAC,cAAA,EAAgB;AACnB,IAAAC,sBAAA,IAAeC,aAAA,CAAM,MAAM,gDAAgD,CAAA;AAC3E,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,QAAQC,uBAAA,EAAgB;AAC9B,EAAA,MAAM,SAASC,iBAAA,EAAU;AACzB,EAAA,MAAM,GAAA,GAAM,QAAQ,MAAA,EAAO;AAE3B,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAAH,sBAAA,IAAeC,aAAA,CAAM,MAAM,uCAAuC,CAAA;AAClE,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,aAAA,GAAgB;AAAA,IACpB,GAAG,OAAA;AAAA,IACH,IAAA,EAAM;AAAA,MACJ,GAAG,MAAM,OAAA,EAAQ;AAAA,MACjB,GAAG,OAAA,CAAQ;AAAA,KACb;AAAA,IACA,OAAA,EAAS,OAAA,CAAQ,OAAA,IAAWG,mBAAA;AAAY,GAC1C;AAEA,EAAA,MAAM,MAAA,GAASL,cAAA,CAAO,QAAA,CAAS,aAAA,CAAc,QAAQ,CAAA;AACrD,EAAA,MAAA,CAAO,KAAA,GAAQ,IAAA;AACf,EAAA,MAAA,CAAO,WAAA,GAAc,WAAA;AACrB,EAAA,MAAA,CAAO,GAAA,GAAMM,+BAAA,CAAwB,GAAA,EAAK,aAAa,CAAA;AAEvD,EAAA,MAAM,EAAE,MAAA,EAAQ,OAAA,EAAQ,GAAI,aAAA;AAE5B,EAAA,IAAI,MAAA,EAAQ;AACV,IAAA,MAAA,CAAO,MAAA,GAAS,MAAA;AAAA,EAClB;AAEA,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,MAAM,gCAAA,GAAmC,CAAC,KAAA,KAA8B;AACtE,MAAA,IAAI,KAAA,CAAM,SAAS,gCAAA,EAAkC;AACnD,QAAA,IAAI;AACF,UAAA,OAAA,EAAQ;AAAA,QACV,CAAA,SAAE;AACA,UAAAN,cAAA,CAAO,mBAAA,CAAoB,WAAW,gCAAgC,CAAA;AAAA,QACxE;AAAA,MACF;AAAA,IACF,CAAA;AACA,IAAAA,cAAA,CAAO,gBAAA,CAAiB,WAAW,gCAAgC,CAAA;AAAA,EACrE;AAEA,EAAA,cAAA,CAAe,YAAY,MAAM,CAAA;AACnC;;;;"}
1
+ {"version":3,"file":"report-dialog.js","sources":["../../../../src/report-dialog.ts"],"sourcesContent":["import type { ReportDialogOptions } from '@sentry/core';\nimport { debug, getClient, getCurrentScope, getReportDialogEndpoint, lastEventId } from '@sentry/core';\nimport { DEBUG_BUILD } from './debug-build';\nimport { WINDOW } from './helpers';\n\n/**\n * Present the user with a report dialog.\n *\n * @param options Everything is optional, we try to fetch all info need from the current scope.\n */\nexport function showReportDialog(options: ReportDialogOptions = {}): void {\n const optionalDocument = WINDOW.document as Document | undefined;\n const injectionPoint = optionalDocument?.head || optionalDocument?.body;\n\n // doesn't work without a document (React Native)\n if (!injectionPoint) {\n DEBUG_BUILD && debug.error('[showReportDialog] Global document not defined');\n return;\n }\n\n const scope = getCurrentScope();\n const client = getClient();\n const dsn = client?.getDsn();\n\n if (!dsn) {\n DEBUG_BUILD && debug.error('[showReportDialog] DSN not configured');\n return;\n }\n\n const mergedOptions = {\n ...options,\n user: {\n ...scope.getUser(),\n ...options.user,\n },\n eventId: options.eventId || lastEventId(),\n };\n\n const script = WINDOW.document.createElement('script');\n script.async = true;\n script.crossOrigin = 'anonymous';\n script.src = getReportDialogEndpoint(dsn, mergedOptions);\n\n const { onLoad, onClose } = mergedOptions;\n\n if (onLoad) {\n script.onload = onLoad;\n }\n\n if (onClose) {\n const reportDialogClosedMessageHandler = (event: MessageEvent): void => {\n if (event.data === '__sentry_reportdialog_closed__') {\n try {\n onClose();\n } finally {\n WINDOW.removeEventListener('message', reportDialogClosedMessageHandler);\n }\n }\n };\n WINDOW.addEventListener('message', reportDialogClosedMessageHandler);\n }\n\n injectionPoint.appendChild(script);\n}\n"],"names":["WINDOW","DEBUG_BUILD","debug","getCurrentScope","getClient","lastEventId","getReportDialogEndpoint"],"mappings":";;;;;;AAUO,SAAS,gBAAA,CAAiB,OAAA,GAA+B,EAAC,EAAS;AACxE,EAAA,MAAM,mBAAmBA,cAAA,CAAO,QAAA;AAChC,EAAA,MAAM,cAAA,GAAiB,gBAAA,EAAkB,IAAA,IAAQ,gBAAA,EAAkB,IAAA;AAGnE,EAAA,IAAI,CAAC,cAAA,EAAgB;AACnB,IAAAC,sBAAA,IAAeC,UAAA,CAAM,MAAM,gDAAgD,CAAA;AAC3E,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,QAAQC,oBAA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,CAAA;AACnC;;;;"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const browser = require('@sentry/core/browser');
3
+ const core = require('@sentry/core');
4
4
  const client = require('./client.js');
5
5
  const breadcrumbs = require('./integrations/breadcrumbs.js');
6
6
  const browserapierrors = require('./integrations/browserapierrors.js');
@@ -17,14 +17,14 @@ const detectBrowserExtension = require('./utils/detectBrowserExtension.js');
17
17
 
18
18
  function getDefaultIntegrations(_options) {
19
19
  return [
20
- browser.eventFiltersIntegration(),
21
- browser.functionToStringIntegration(),
22
- browser.conversationIdIntegration(),
20
+ core.eventFiltersIntegration(),
21
+ core.functionToStringIntegration(),
22
+ core.conversationIdIntegration(),
23
23
  browserapierrors.browserApiErrorsIntegration(),
24
24
  breadcrumbs.breadcrumbsIntegration(),
25
25
  globalhandlers.globalHandlersIntegration(),
26
26
  linkederrors.linkedErrorsIntegration(),
27
- browser.dedupeIntegration(),
27
+ core.dedupeIntegration(),
28
28
  httpcontext.httpContextIntegration(),
29
29
  culturecontext.cultureContextIntegration(),
30
30
  browsersession.browserSessionIntegration()
@@ -42,19 +42,19 @@ function init(options = {}) {
42
42
  defaultIntegrations.push(spotlight.spotlightBrowserIntegration(args));
43
43
  }
44
44
  /*! rollup-include-development-only-end */
45
- const integrations = browser.getIntegrationsToSetup({
45
+ const integrations = core.getIntegrationsToSetup({
46
46
  integrations: options.integrations,
47
47
  defaultIntegrations
48
48
  });
49
49
  const clientOptions = {
50
50
  ...options,
51
51
  enabled: shouldDisableBecauseIsBrowserExtenstion ? false : options.enabled,
52
- stackParser: browser.stackParserFromStackParserOptions(options.stackParser || stackParsers.defaultStackParser),
52
+ stackParser: core.stackParserFromStackParserOptions(options.stackParser || stackParsers.defaultStackParser),
53
53
  integrations,
54
54
  transport: options.transport || fetch.makeFetchTransport
55
55
  };
56
- browser.setNormalizeStringifier(normalizeStringifyValue.normalizeStringifyValue);
57
- return browser.initAndBind(client.BrowserClient, clientOptions);
56
+ core.setNormalizeStringifier(normalizeStringifyValue.normalizeStringifyValue);
57
+ return core.initAndBind(client.BrowserClient, clientOptions);
58
58
  }
59
59
  function forceLoad() {
60
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../../../src/sdk.ts"],"sourcesContent":["import type { Client, Integration, Options } from '@sentry/core/browser';\nimport {\n conversationIdIntegration,\n dedupeIntegration,\n eventFiltersIntegration,\n functionToStringIntegration,\n getIntegrationsToSetup,\n initAndBind,\n setNormalizeStringifier,\n stackParserFromStackParserOptions,\n} from '@sentry/core/browser';\nimport type { BrowserClientOptions, BrowserOptions } from './client';\nimport { BrowserClient } from './client';\nimport { breadcrumbsIntegration } from './integrations/breadcrumbs';\nimport { browserApiErrorsIntegration } from './integrations/browserapierrors';\nimport { browserSessionIntegration } from './integrations/browsersession';\nimport { cultureContextIntegration } from './integrations/culturecontext';\nimport { globalHandlersIntegration } from './integrations/globalhandlers';\nimport { httpContextIntegration } from './integrations/httpcontext';\nimport { linkedErrorsIntegration } from './integrations/linkederrors';\nimport { spotlightBrowserIntegration } from './integrations/spotlight';\nimport { defaultStackParser } from './stack-parsers';\nimport { makeFetchTransport } from './transports/fetch';\nimport { normalizeStringifyValue } from './normalizeStringifyValue';\nimport { checkAndWarnIfIsEmbeddedBrowserExtension } from './utils/detectBrowserExtension';\n\n/** Get the default integrations for the browser SDK. */\nexport function getDefaultIntegrations(_options: Options): Integration[] {\n /**\n * Note: Please make sure this stays in sync with Angular SDK, which re-exports\n * `getDefaultIntegrations` but with an adjusted set of integrations.\n */\n return [\n eventFiltersIntegration(),\n functionToStringIntegration(),\n conversationIdIntegration(),\n browserApiErrorsIntegration(),\n breadcrumbsIntegration(),\n globalHandlersIntegration(),\n linkedErrorsIntegration(),\n dedupeIntegration(),\n httpContextIntegration(),\n cultureContextIntegration(),\n browserSessionIntegration(),\n ];\n}\n\n/**\n * The Sentry Browser SDK Client.\n *\n * To use this SDK, call the {@link init} function as early as possible when\n * loading the web page. To set context information or send manual events, use\n * the provided methods.\n *\n * @example\n *\n * ```\n *\n * import { init } from '@sentry/browser';\n *\n * init({\n * dsn: '__DSN__',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n *\n * import { addBreadcrumb } from '@sentry/browser';\n * addBreadcrumb({\n * message: 'My Breadcrumb',\n * // ...\n * });\n * ```\n *\n * @example\n *\n * ```\n *\n * import * as Sentry from '@sentry/browser';\n * Sentry.captureMessage('Hello, world!');\n * Sentry.captureException(new Error('Good bye'));\n * Sentry.captureEvent({\n * message: 'Manual',\n * stacktrace: [\n * // ...\n * ],\n * });\n * ```\n *\n * @see {@link BrowserOptions} for documentation on configuration options.\n */\nexport function init(options: BrowserOptions = {}): Client | undefined {\n const shouldDisableBecauseIsBrowserExtenstion =\n !options.skipBrowserExtensionCheck && checkAndWarnIfIsEmbeddedBrowserExtension();\n\n let defaultIntegrations =\n options.defaultIntegrations == null ? getDefaultIntegrations(options) : options.defaultIntegrations;\n\n /*! rollup-include-development-only */\n if (options.spotlight) {\n if (!defaultIntegrations) {\n defaultIntegrations = [];\n }\n const args = typeof options.spotlight === 'string' ? { sidecarUrl: options.spotlight } : undefined;\n defaultIntegrations.push(spotlightBrowserIntegration(args));\n }\n /*! rollup-include-development-only-end */\n\n const integrations = getIntegrationsToSetup({\n integrations: options.integrations,\n defaultIntegrations,\n });\n\n const clientOptions: BrowserClientOptions = {\n ...options,\n enabled: shouldDisableBecauseIsBrowserExtenstion ? false : options.enabled,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations,\n transport: options.transport || makeFetchTransport,\n };\n\n setNormalizeStringifier(normalizeStringifyValue);\n\n return initAndBind(BrowserClient, clientOptions);\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function forceLoad(): void {\n // Noop\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function onLoad(callback: () => void): void {\n callback();\n}\n"],"names":["eventFiltersIntegration","functionToStringIntegration","conversationIdIntegration","browserApiErrorsIntegration","breadcrumbsIntegration","globalHandlersIntegration","linkedErrorsIntegration","dedupeIntegration","httpContextIntegration","cultureContextIntegration","browserSessionIntegration","checkAndWarnIfIsEmbeddedBrowserExtension","spotlightBrowserIntegration","getIntegrationsToSetup","stackParserFromStackParserOptions","defaultStackParser","makeFetchTransport","setNormalizeStringifier","normalizeStringifyValue","initAndBind","BrowserClient"],"mappings":";;;;;;;;;;;;;;;;;AA2BO,SAAS,uBAAuB,QAAA,EAAkC;AAKvE,EAAA,OAAO;AAAA,IACLA,+BAAA,EAAwB;AAAA,IACxBC,mCAAA,EAA4B;AAAA,IAC5BC,iCAAA,EAA0B;AAAA,IAC1BC,4CAAA,EAA4B;AAAA,IAC5BC,kCAAA,EAAuB;AAAA,IACvBC,wCAAA,EAA0B;AAAA,IAC1BC,oCAAA,EAAwB;AAAA,IACxBC,yBAAA,EAAkB;AAAA,IAClBC,kCAAA,EAAuB;AAAA,IACvBC,wCAAA,EAA0B;AAAA,IAC1BC,wCAAA;AAA0B,GAC5B;AACF;AAgDO,SAAS,IAAA,CAAK,OAAA,GAA0B,EAAC,EAAuB;AACrE,EAAA,MAAM,uCAAA,GACJ,CAAC,OAAA,CAAQ,yBAAA,IAA6BC,+DAAA,EAAyC;AAEjF,EAAA,IAAI,sBACF,OAAA,CAAQ,mBAAA,IAAuB,OAAO,sBAAA,CAA8B,IAAI,OAAA,CAAQ,mBAAA;AAAA;AAGlF,EAAA,IAAI,QAAQ,SAAA,EAAW;AACrB,IAAA,IAAI,CAAC,mBAAA,EAAqB;AACxB,MAAA,mBAAA,GAAsB,EAAC;AAAA,IACzB;AACA,IAAA,MAAM,IAAA,GAAO,OAAO,OAAA,CAAQ,SAAA,KAAc,WAAW,EAAE,UAAA,EAAY,OAAA,CAAQ,SAAA,EAAU,GAAI,MAAA;AACzF,IAAA,mBAAA,CAAoB,IAAA,CAAKC,qCAAA,CAA4B,IAAI,CAAC,CAAA;AAAA,EAC5D;AAAA;AAGA,EAAA,MAAM,eAAeC,8BAAA,CAAuB;AAAA,IAC1C,cAAc,OAAA,CAAQ,YAAA;AAAA,IACtB;AAAA,GACD,CAAA;AAED,EAAA,MAAM,aAAA,GAAsC;AAAA,IAC1C,GAAG,OAAA;AAAA,IACH,OAAA,EAAS,uCAAA,GAA0C,KAAA,GAAQ,OAAA,CAAQ,OAAA;AAAA,IACnE,WAAA,EAAaC,yCAAA,CAAkC,OAAA,CAAQ,WAAA,IAAeC,+BAAkB,CAAA;AAAA,IACxF,YAAA;AAAA,IACA,SAAA,EAAW,QAAQ,SAAA,IAAaC;AAAA,GAClC;AAEA,EAAAC,+BAAA,CAAwBC,+CAAuB,CAAA;AAE/C,EAAA,OAAOC,mBAAA,CAAYC,sBAAe,aAAa,CAAA;AACjD;AAMO,SAAS,SAAA,GAAkB;AAElC;AAMO,SAAS,OAAO,QAAA,EAA4B;AACjD,EAAA,QAAA,EAAS;AACX;;;;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../../../src/sdk.ts"],"sourcesContent":["import type { Client, Integration, Options } from '@sentry/core';\nimport {\n conversationIdIntegration,\n dedupeIntegration,\n eventFiltersIntegration,\n functionToStringIntegration,\n getIntegrationsToSetup,\n initAndBind,\n setNormalizeStringifier,\n stackParserFromStackParserOptions,\n} from '@sentry/core';\nimport type { BrowserClientOptions, BrowserOptions } from './client';\nimport { BrowserClient } from './client';\nimport { breadcrumbsIntegration } from './integrations/breadcrumbs';\nimport { browserApiErrorsIntegration } from './integrations/browserapierrors';\nimport { browserSessionIntegration } from './integrations/browsersession';\nimport { cultureContextIntegration } from './integrations/culturecontext';\nimport { globalHandlersIntegration } from './integrations/globalhandlers';\nimport { httpContextIntegration } from './integrations/httpcontext';\nimport { linkedErrorsIntegration } from './integrations/linkederrors';\nimport { spotlightBrowserIntegration } from './integrations/spotlight';\nimport { defaultStackParser } from './stack-parsers';\nimport { makeFetchTransport } from './transports/fetch';\nimport { normalizeStringifyValue } from './normalizeStringifyValue';\nimport { checkAndWarnIfIsEmbeddedBrowserExtension } from './utils/detectBrowserExtension';\n\n/** Get the default integrations for the browser SDK. */\nexport function getDefaultIntegrations(_options: Options): Integration[] {\n /**\n * Note: Please make sure this stays in sync with Angular SDK, which re-exports\n * `getDefaultIntegrations` but with an adjusted set of integrations.\n */\n return [\n eventFiltersIntegration(),\n functionToStringIntegration(),\n conversationIdIntegration(),\n browserApiErrorsIntegration(),\n breadcrumbsIntegration(),\n globalHandlersIntegration(),\n linkedErrorsIntegration(),\n dedupeIntegration(),\n httpContextIntegration(),\n cultureContextIntegration(),\n browserSessionIntegration(),\n ];\n}\n\n/**\n * The Sentry Browser SDK Client.\n *\n * To use this SDK, call the {@link init} function as early as possible when\n * loading the web page. To set context information or send manual events, use\n * the provided methods.\n *\n * @example\n *\n * ```\n *\n * import { init } from '@sentry/browser';\n *\n * init({\n * dsn: '__DSN__',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n *\n * import { addBreadcrumb } from '@sentry/browser';\n * addBreadcrumb({\n * message: 'My Breadcrumb',\n * // ...\n * });\n * ```\n *\n * @example\n *\n * ```\n *\n * import * as Sentry from '@sentry/browser';\n * Sentry.captureMessage('Hello, world!');\n * Sentry.captureException(new Error('Good bye'));\n * Sentry.captureEvent({\n * message: 'Manual',\n * stacktrace: [\n * // ...\n * ],\n * });\n * ```\n *\n * @see {@link BrowserOptions} for documentation on configuration options.\n */\nexport function init(options: BrowserOptions = {}): Client | undefined {\n const shouldDisableBecauseIsBrowserExtenstion =\n !options.skipBrowserExtensionCheck && checkAndWarnIfIsEmbeddedBrowserExtension();\n\n let defaultIntegrations =\n options.defaultIntegrations == null ? getDefaultIntegrations(options) : options.defaultIntegrations;\n\n /*! rollup-include-development-only */\n if (options.spotlight) {\n if (!defaultIntegrations) {\n defaultIntegrations = [];\n }\n const args = typeof options.spotlight === 'string' ? { sidecarUrl: options.spotlight } : undefined;\n defaultIntegrations.push(spotlightBrowserIntegration(args));\n }\n /*! rollup-include-development-only-end */\n\n const integrations = getIntegrationsToSetup({\n integrations: options.integrations,\n defaultIntegrations,\n });\n\n const clientOptions: BrowserClientOptions = {\n ...options,\n enabled: shouldDisableBecauseIsBrowserExtenstion ? false : options.enabled,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations,\n transport: options.transport || makeFetchTransport,\n };\n\n setNormalizeStringifier(normalizeStringifyValue);\n\n return initAndBind(BrowserClient, clientOptions);\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function forceLoad(): void {\n // Noop\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function onLoad(callback: () => void): void {\n callback();\n}\n"],"names":["eventFiltersIntegration","functionToStringIntegration","conversationIdIntegration","browserApiErrorsIntegration","breadcrumbsIntegration","globalHandlersIntegration","linkedErrorsIntegration","dedupeIntegration","httpContextIntegration","cultureContextIntegration","browserSessionIntegration","checkAndWarnIfIsEmbeddedBrowserExtension","spotlightBrowserIntegration","getIntegrationsToSetup","stackParserFromStackParserOptions","defaultStackParser","makeFetchTransport","setNormalizeStringifier","normalizeStringifyValue","initAndBind","BrowserClient"],"mappings":";;;;;;;;;;;;;;;;;AA2BO,SAAS,uBAAuB,QAAA,EAAkC;AAKvE,EAAA,OAAO;AAAA,IACLA,4BAAA,EAAwB;AAAA,IACxBC,gCAAA,EAA4B;AAAA,IAC5BC,8BAAA,EAA0B;AAAA,IAC1BC,4CAAA,EAA4B;AAAA,IAC5BC,kCAAA,EAAuB;AAAA,IACvBC,wCAAA,EAA0B;AAAA,IAC1BC,oCAAA,EAAwB;AAAA,IACxBC,sBAAA,EAAkB;AAAA,IAClBC,kCAAA,EAAuB;AAAA,IACvBC,wCAAA,EAA0B;AAAA,IAC1BC,wCAAA;AAA0B,GAC5B;AACF;AAgDO,SAAS,IAAA,CAAK,OAAA,GAA0B,EAAC,EAAuB;AACrE,EAAA,MAAM,uCAAA,GACJ,CAAC,OAAA,CAAQ,yBAAA,IAA6BC,+DAAA,EAAyC;AAEjF,EAAA,IAAI,sBACF,OAAA,CAAQ,mBAAA,IAAuB,OAAO,sBAAA,CAA8B,IAAI,OAAA,CAAQ,mBAAA;AAAA;AAGlF,EAAA,IAAI,QAAQ,SAAA,EAAW;AACrB,IAAA,IAAI,CAAC,mBAAA,EAAqB;AACxB,MAAA,mBAAA,GAAsB,EAAC;AAAA,IACzB;AACA,IAAA,MAAM,IAAA,GAAO,OAAO,OAAA,CAAQ,SAAA,KAAc,WAAW,EAAE,UAAA,EAAY,OAAA,CAAQ,SAAA,EAAU,GAAI,MAAA;AACzF,IAAA,mBAAA,CAAoB,IAAA,CAAKC,qCAAA,CAA4B,IAAI,CAAC,CAAA;AAAA,EAC5D;AAAA;AAGA,EAAA,MAAM,eAAeC,2BAAA,CAAuB;AAAA,IAC1C,cAAc,OAAA,CAAQ,YAAA;AAAA,IACtB;AAAA,GACD,CAAA;AAED,EAAA,MAAM,aAAA,GAAsC;AAAA,IAC1C,GAAG,OAAA;AAAA,IACH,OAAA,EAAS,uCAAA,GAA0C,KAAA,GAAQ,OAAA,CAAQ,OAAA;AAAA,IACnE,WAAA,EAAaC,sCAAA,CAAkC,OAAA,CAAQ,WAAA,IAAeC,+BAAkB,CAAA;AAAA,IACxF,YAAA;AAAA,IACA,SAAA,EAAW,QAAQ,SAAA,IAAaC;AAAA,GAClC;AAEA,EAAAC,4BAAA,CAAwBC,+CAAuB,CAAA;AAE/C,EAAA,OAAOC,gBAAA,CAAYC,sBAAe,aAAa,CAAA;AACjD;AAMO,SAAS,SAAA,GAAkB;AAElC;AAMO,SAAS,OAAO,QAAA,EAA4B;AACjD,EAAA,QAAA,EAAS;AACX;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const browser = require('@sentry/core/browser');
3
+ const core = require('@sentry/core');
4
4
 
5
5
  const OPERA10_PRIORITY = 10;
6
6
  const OPERA11_PRIORITY = 20;
@@ -10,7 +10,7 @@ const GECKO_PRIORITY = 50;
10
10
  function createFrame(filename, func, lineno, colno) {
11
11
  const frame = {
12
12
  filename,
13
- function: func === "<anonymous>" ? browser.UNKNOWN_FUNCTION : func,
13
+ function: func === "<anonymous>" ? core.UNKNOWN_FUNCTION : func,
14
14
  in_app: true
15
15
  // All browser frames are considered in_app
16
16
  };
@@ -37,7 +37,7 @@ const chromeStackParserFn = (line) => {
37
37
  const noFnParts = chromeRegexNoFnName.exec(line);
38
38
  if (noFnParts) {
39
39
  const [, filename, line2, col] = noFnParts;
40
- return createFrame(filename, browser.UNKNOWN_FUNCTION, +line2, +col);
40
+ return createFrame(filename, core.UNKNOWN_FUNCTION, +line2, +col);
41
41
  }
42
42
  const parts = chromeRegex.exec(line);
43
43
  if (parts) {
@@ -50,7 +50,7 @@ const chromeStackParserFn = (line) => {
50
50
  parts[4] = subMatch[3];
51
51
  }
52
52
  }
53
- const [func, filename] = extractSafariExtensionDetails(parts[1] || browser.UNKNOWN_FUNCTION, parts[2]);
53
+ const [func, filename] = extractSafariExtensionDetails(parts[1] || core.UNKNOWN_FUNCTION, parts[2]);
54
54
  return createFrame(filename, func, parts[3] ? +parts[3] : void 0, parts[4] ? +parts[4] : void 0);
55
55
  }
56
56
  return;
@@ -72,7 +72,7 @@ const gecko = (line) => {
72
72
  }
73
73
  }
74
74
  let filename = parts[3];
75
- let func = parts[1] || browser.UNKNOWN_FUNCTION;
75
+ let func = parts[1] || core.UNKNOWN_FUNCTION;
76
76
  [func, filename] = extractSafariExtensionDetails(func, filename);
77
77
  return createFrame(filename, func, parts[4] ? +parts[4] : void 0, parts[5] ? +parts[5] : void 0);
78
78
  }
@@ -82,28 +82,28 @@ const geckoStackLineParser = [GECKO_PRIORITY, gecko];
82
82
  const winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
83
83
  const winjs = (line) => {
84
84
  const parts = winjsRegex.exec(line);
85
- return parts ? createFrame(parts[2], parts[1] || browser.UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : void 0) : void 0;
85
+ return parts ? createFrame(parts[2], parts[1] || core.UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : void 0) : void 0;
86
86
  };
87
87
  const winjsStackLineParser = [WINJS_PRIORITY, winjs];
88
88
  const opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
89
89
  const opera10 = (line) => {
90
90
  const parts = opera10Regex.exec(line);
91
- return parts ? createFrame(parts[2], parts[3] || browser.UNKNOWN_FUNCTION, +parts[1]) : void 0;
91
+ return parts ? createFrame(parts[2], parts[3] || core.UNKNOWN_FUNCTION, +parts[1]) : void 0;
92
92
  };
93
93
  const opera10StackLineParser = [OPERA10_PRIORITY, opera10];
94
94
  const opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i;
95
95
  const opera11 = (line) => {
96
96
  const parts = opera11Regex.exec(line);
97
- return parts ? createFrame(parts[5], parts[3] || parts[4] || browser.UNKNOWN_FUNCTION, +parts[1], +parts[2]) : void 0;
97
+ return parts ? createFrame(parts[5], parts[3] || parts[4] || core.UNKNOWN_FUNCTION, +parts[1], +parts[2]) : void 0;
98
98
  };
99
99
  const opera11StackLineParser = [OPERA11_PRIORITY, opera11];
100
100
  const defaultStackLineParsers = [chromeStackLineParser, geckoStackLineParser];
101
- const defaultStackParser = browser.createStackParser(...defaultStackLineParsers);
101
+ const defaultStackParser = core.createStackParser(...defaultStackLineParsers);
102
102
  const extractSafariExtensionDetails = (func, filename) => {
103
103
  const isSafariExtension = func.indexOf("safari-extension") !== -1;
104
104
  const isSafariWebExtension = func.indexOf("safari-web-extension") !== -1;
105
105
  return isSafariExtension || isSafariWebExtension ? [
106
- func.indexOf("@") !== -1 ? func.split("@")[0] : browser.UNKNOWN_FUNCTION,
106
+ func.indexOf("@") !== -1 ? func.split("@")[0] : core.UNKNOWN_FUNCTION,
107
107
  isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}`
108
108
  ] : [func, filename];
109
109
  };
@@ -1 +1 @@
1
- {"version":3,"file":"stack-parsers.js","sources":["../../../../src/stack-parsers.ts"],"sourcesContent":["// This was originally forked from https://github.com/csnover/TraceKit, and was largely\n// re - written as part of raven - js.\n//\n// This code was later copied to the JavaScript mono - repo and further modified and\n// refactored over the years.\n\n// Copyright (c) 2013 Onur Can Cakmak onur.cakmak@gmail.com and all TraceKit contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of this\n// software and associated documentation files(the 'Software'), to deal in the Software\n// without restriction, including without limitation the rights to use, copy, modify,\n// merge, publish, distribute, sublicense, and / or sell copies of the Software, and to\n// permit persons to whom the Software is furnished to do so, subject to the following\n// conditions:\n//\n// The above copyright notice and this permission notice shall be included in all copies\n// or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE\n// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nimport type { StackFrame, StackLineParser, StackLineParserFn } from '@sentry/core/browser';\nimport { createStackParser, UNKNOWN_FUNCTION } from '@sentry/core/browser';\n\nconst OPERA10_PRIORITY = 10;\nconst OPERA11_PRIORITY = 20;\nconst CHROME_PRIORITY = 30;\nconst WINJS_PRIORITY = 40;\nconst GECKO_PRIORITY = 50;\n\nfunction createFrame(filename: string, func: string, lineno?: number, colno?: number): StackFrame {\n const frame: StackFrame = {\n filename,\n function: func === '<anonymous>' ? UNKNOWN_FUNCTION : func,\n in_app: true, // All browser frames are considered in_app\n };\n\n if (lineno !== undefined) {\n frame.lineno = lineno;\n }\n\n if (colno !== undefined) {\n frame.colno = colno;\n }\n\n return frame;\n}\n\n// This regex matches frames that have no function name (ie. are at the top level of a module).\n// For example \"at http://localhost:5000//script.js:1:126\"\n// Frames _with_ function names usually look as follows: \"at commitLayoutEffects (react-dom.development.js:23426:1)\"\nconst chromeRegexNoFnName = /^\\s*at (\\S+?)(?::(\\d+))(?::(\\d+))\\s*$/i;\n\n// This regex matches all the frames that have a function name.\nconst chromeRegex =\n /^\\s*at (?:(.+?\\)(?: \\[.+\\])?|.*?) ?\\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\\/)?.*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i;\n\nconst chromeEvalRegex = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/;\n\n// Matches stack frames with data URIs instead of filename so we can still get the function name\n// Example: \"at dynamicFn (data:application/javascript,export function dynamicFn() {...\"\nconst chromeDataUriRegex = /at (.+?) ?\\(data:(.+?),/;\n\n// Chromium based browsers: Chrome, Brave, new Opera, new Edge\n// We cannot call this variable `chrome` because it can conflict with global `chrome` variable in certain environments\n// See: https://github.com/getsentry/sentry-javascript/issues/6880\nconst chromeStackParserFn: StackLineParserFn = line => {\n const dataUriMatch = line.match(chromeDataUriRegex);\n if (dataUriMatch) {\n return {\n filename: `<data:${dataUriMatch[2]}>`,\n function: dataUriMatch[1],\n };\n }\n\n // If the stack line has no function name, we need to parse it differently\n const noFnParts = chromeRegexNoFnName.exec(line) as null | [string, string, string, string];\n\n if (noFnParts) {\n const [, filename, line, col] = noFnParts;\n return createFrame(filename, UNKNOWN_FUNCTION, +line, +col);\n }\n\n const parts = chromeRegex.exec(line) as null | [string, string, string, string, string];\n\n if (parts) {\n const isEval = parts[2]?.indexOf('eval') === 0; // start of line\n\n if (isEval) {\n const subMatch = chromeEvalRegex.exec(parts[2]) as null | [string, string, string, string];\n\n if (subMatch) {\n // throw out eval line/column and use top-most line/column number\n parts[2] = subMatch[1]; // url\n parts[3] = subMatch[2]; // line\n parts[4] = subMatch[3]; // column\n }\n }\n\n // Kamil: One more hack won't hurt us right? Understanding and adding more rules on top of these regexps right now\n // would be way too time consuming. (TODO: Rewrite whole RegExp to be more readable)\n const [func, filename] = extractSafariExtensionDetails(parts[1] || UNKNOWN_FUNCTION, parts[2]);\n\n return createFrame(filename, func, parts[3] ? +parts[3] : undefined, parts[4] ? +parts[4] : undefined);\n }\n\n return;\n};\n\nexport const chromeStackLineParser: StackLineParser = [CHROME_PRIORITY, chromeStackParserFn];\n\n// gecko regex: `(?:bundle|\\d+\\.js)`: `bundle` is for react native, `\\d+\\.js` also but specifically for ram bundles because it\n// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js\n// We need this specific case for now because we want no other regex to match.\nconst geckoREgex =\n /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)?((?:[-a-z]+)?:\\/.*?|\\[native code\\]|[^@]*(?:bundle|\\d+\\.js)|\\/[\\w\\-. /=]+)(?::(\\d+))?(?::(\\d+))?\\s*$/i;\nconst geckoEvalRegex = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;\n\nconst gecko: StackLineParserFn = line => {\n const parts = geckoREgex.exec(line) as null | [string, string, string, string, string, string];\n\n if (parts) {\n const isEval = parts[3] && parts[3].indexOf(' > eval') > -1;\n if (isEval) {\n const subMatch = geckoEvalRegex.exec(parts[3]) as null | [string, string, string];\n\n if (subMatch) {\n // throw out eval line/column and use top-most line number\n parts[1] = parts[1] || 'eval';\n parts[3] = subMatch[1];\n parts[4] = subMatch[2];\n parts[5] = ''; // no column when eval\n }\n }\n\n let filename = parts[3];\n let func = parts[1] || UNKNOWN_FUNCTION;\n [func, filename] = extractSafariExtensionDetails(func, filename);\n\n return createFrame(filename, func, parts[4] ? +parts[4] : undefined, parts[5] ? +parts[5] : undefined);\n }\n\n return;\n};\n\nexport const geckoStackLineParser: StackLineParser = [GECKO_PRIORITY, gecko];\n\nconst winjsRegex = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:[-a-z]+):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\n\nconst winjs: StackLineParserFn = line => {\n const parts = winjsRegex.exec(line) as null | [string, string, string, string, string];\n\n return parts\n ? createFrame(parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined)\n : undefined;\n};\n\nexport const winjsStackLineParser: StackLineParser = [WINJS_PRIORITY, winjs];\n\nconst opera10Regex = / line (\\d+).*script (?:in )?(\\S+)(?:: in function (\\S+))?$/i;\n\nconst opera10: StackLineParserFn = line => {\n const parts = opera10Regex.exec(line) as null | [string, string, string, string];\n return parts ? createFrame(parts[2], parts[3] || UNKNOWN_FUNCTION, +parts[1]) : undefined;\n};\n\nexport const opera10StackLineParser: StackLineParser = [OPERA10_PRIORITY, opera10];\n\nconst opera11Regex =\n / line (\\d+), column (\\d+)\\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\\(.*\\))? in (.*):\\s*$/i;\n\nconst opera11: StackLineParserFn = line => {\n const parts = opera11Regex.exec(line) as null | [string, string, string, string, string, string];\n return parts ? createFrame(parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined;\n};\n\nexport const opera11StackLineParser: StackLineParser = [OPERA11_PRIORITY, opera11];\n\nexport const defaultStackLineParsers = [chromeStackLineParser, geckoStackLineParser];\n\nexport const defaultStackParser = createStackParser(...defaultStackLineParsers);\n\n/**\n * Safari web extensions, starting version unknown, can produce \"frames-only\" stacktraces.\n * What it means, is that instead of format like:\n *\n * Error: wat\n * at function@url:row:col\n * at function@url:row:col\n * at function@url:row:col\n *\n * it produces something like:\n *\n * function@url:row:col\n * function@url:row:col\n * function@url:row:col\n *\n * Because of that, it won't be captured by `chrome` RegExp and will fall into `Gecko` branch.\n * This function is extracted so that we can use it in both places without duplicating the logic.\n * Unfortunately \"just\" changing RegExp is too complicated now and making it pass all tests\n * and fix this case seems like an impossible, or at least way too time-consuming task.\n */\nconst extractSafariExtensionDetails = (func: string, filename: string): [string, string] => {\n const isSafariExtension = func.indexOf('safari-extension') !== -1;\n const isSafariWebExtension = func.indexOf('safari-web-extension') !== -1;\n\n return isSafariExtension || isSafariWebExtension\n ? [\n func.indexOf('@') !== -1 ? (func.split('@')[0] as string) : UNKNOWN_FUNCTION,\n isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}`,\n ]\n : [func, filename];\n};\n"],"names":["UNKNOWN_FUNCTION","line","createStackParser"],"mappings":";;;;AA4BA,MAAM,gBAAA,GAAmB,EAAA;AACzB,MAAM,gBAAA,GAAmB,EAAA;AACzB,MAAM,eAAA,GAAkB,EAAA;AACxB,MAAM,cAAA,GAAiB,EAAA;AACvB,MAAM,cAAA,GAAiB,EAAA;AAEvB,SAAS,WAAA,CAAY,QAAA,EAAkB,IAAA,EAAc,MAAA,EAAiB,KAAA,EAA4B;AAChG,EAAA,MAAM,KAAA,GAAoB;AAAA,IACxB,QAAA;AAAA,IACA,QAAA,EAAU,IAAA,KAAS,aAAA,GAAgBA,wBAAA,GAAmB,IAAA;AAAA,IACtD,MAAA,EAAQ;AAAA;AAAA,GACV;AAEA,EAAA,IAAI,WAAW,MAAA,EAAW;AACxB,IAAA,KAAA,CAAM,MAAA,GAAS,MAAA;AAAA,EACjB;AAEA,EAAA,IAAI,UAAU,MAAA,EAAW;AACvB,IAAA,KAAA,CAAM,KAAA,GAAQ,KAAA;AAAA,EAChB;AAEA,EAAA,OAAO,KAAA;AACT;AAKA,MAAM,mBAAA,GAAsB,wCAAA;AAG5B,MAAM,WAAA,GACJ,4IAAA;AAEF,MAAM,eAAA,GAAkB,+BAAA;AAIxB,MAAM,kBAAA,GAAqB,yBAAA;AAK3B,MAAM,sBAAyC,CAAA,IAAA,KAAQ;A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AAA,CAAM,CAAC,GAAG,KAAA,CAAM,CAAC,KAAK,KAAA,CAAM,CAAC,KAAKA,wBAAA,EAAkB,CAAC,MAAM,CAAC,CAAA,EAAG,CAAC,KAAA,CAAM,CAAC,CAAC,CAAA,GAAI,MAAA;AACzG,CAAA;AAEO,MAAM,sBAAA,GAA0C,CAAC,gBAAA,EAAkB,OAAO;AAE1E,MAAM,uBAAA,GAA0B,CAAC,qBAAA,EAAuB,oBAAoB;AAE5E,MAAM,kBAAA,GAAqBE,yBAAA,CAAkB,GAAG,uBAAuB;AAsB9E,MAAM,6BAAA,GAAgC,CAAC,IAAA,EAAc,QAAA,KAAuC;AAC1F,EAAA,MAAM,iBAAA,GAAoB,IAAA,CAAK,OAAA,CAAQ,kBAAkB,CAAA,KAAM,EAAA;AAC/D,EAAA,MAAM,oBAAA,GAAuB,IAAA,CAAK,OAAA,CAAQ,sBAAsB,CAAA,KAAM,EAAA;AAEtE,EAAA,OAAO,qBAAqB,oBAAA,GACxB;AAAA,IACE,IAAA,CAAK,OAAA,CAAQ,GAAG,CAAA,KAAM,EAAA,GAAM,KAAK,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,GAAeF,wBAAA;AAAA,IAC5D,iBAAA,GAAoB,CAAA,iBAAA,EAAoB,QAAQ,CAAA,CAAA,GAAK,wBAAwB,QAAQ,CAAA;AAAA,GACvF,GACA,CAAC,IAAA,EAAM,QAAQ,CAAA;AACrB,CAAA;;;;;;;;;;"}
1
+ {"version":3,"file":"stack-parsers.js","sources":["../../../../src/stack-parsers.ts"],"sourcesContent":["// This was originally forked from https://github.com/csnover/TraceKit, and was largely\n// re - written as part of raven - js.\n//\n// This code was later copied to the JavaScript mono - repo and further modified and\n// refactored over the years.\n\n// Copyright (c) 2013 Onur Can Cakmak onur.cakmak@gmail.com and all TraceKit contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of this\n// software and associated documentation files(the 'Software'), to deal in the Software\n// without restriction, including without limitation the rights to use, copy, modify,\n// merge, publish, distribute, sublicense, and / or sell copies of the Software, and to\n// permit persons to whom the Software is furnished to do so, subject to the following\n// conditions:\n//\n// The above copyright notice and this permission notice shall be included in all copies\n// or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE\n// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nimport type { StackFrame, StackLineParser, StackLineParserFn } from '@sentry/core';\nimport { createStackParser, UNKNOWN_FUNCTION } from '@sentry/core';\n\nconst OPERA10_PRIORITY = 10;\nconst OPERA11_PRIORITY = 20;\nconst CHROME_PRIORITY = 30;\nconst WINJS_PRIORITY = 40;\nconst GECKO_PRIORITY = 50;\n\nfunction createFrame(filename: string, func: string, lineno?: number, colno?: number): StackFrame {\n const frame: StackFrame = {\n filename,\n function: func === '<anonymous>' ? UNKNOWN_FUNCTION : func,\n in_app: true, // All browser frames are considered in_app\n };\n\n if (lineno !== undefined) {\n frame.lineno = lineno;\n }\n\n if (colno !== undefined) {\n frame.colno = colno;\n }\n\n return frame;\n}\n\n// This regex matches frames that have no function name (ie. are at the top level of a module).\n// For example \"at http://localhost:5000//script.js:1:126\"\n// Frames _with_ function names usually look as follows: \"at commitLayoutEffects (react-dom.development.js:23426:1)\"\nconst chromeRegexNoFnName = /^\\s*at (\\S+?)(?::(\\d+))(?::(\\d+))\\s*$/i;\n\n// This regex matches all the frames that have a function name.\nconst chromeRegex =\n /^\\s*at (?:(.+?\\)(?: \\[.+\\])?|.*?) ?\\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\\/)?.*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i;\n\nconst chromeEvalRegex = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/;\n\n// Matches stack frames with data URIs instead of filename so we can still get the function name\n// Example: \"at dynamicFn (data:application/javascript,export function dynamicFn() {...\"\nconst chromeDataUriRegex = /at (.+?) ?\\(data:(.+?),/;\n\n// Chromium based browsers: Chrome, Brave, new Opera, new Edge\n// We cannot call this variable `chrome` because it can conflict with global `chrome` variable in certain environments\n// See: https://github.com/getsentry/sentry-javascript/issues/6880\nconst chromeStackParserFn: StackLineParserFn = line => {\n const dataUriMatch = line.match(chromeDataUriRegex);\n if (dataUriMatch) {\n return {\n filename: `<data:${dataUriMatch[2]}>`,\n function: dataUriMatch[1],\n };\n }\n\n // If the stack line has no function name, we need to parse it differently\n const noFnParts = chromeRegexNoFnName.exec(line) as null | [string, string, string, string];\n\n if (noFnParts) {\n const [, filename, line, col] = noFnParts;\n return createFrame(filename, UNKNOWN_FUNCTION, +line, +col);\n }\n\n const parts = chromeRegex.exec(line) as null | [string, string, string, string, string];\n\n if (parts) {\n const isEval = parts[2]?.indexOf('eval') === 0; // start of line\n\n if (isEval) {\n const subMatch = chromeEvalRegex.exec(parts[2]) as null | [string, string, string, string];\n\n if (subMatch) {\n // throw out eval line/column and use top-most line/column number\n parts[2] = subMatch[1]; // url\n parts[3] = subMatch[2]; // line\n parts[4] = subMatch[3]; // column\n }\n }\n\n // Kamil: One more hack won't hurt us right? Understanding and adding more rules on top of these regexps right now\n // would be way too time consuming. (TODO: Rewrite whole RegExp to be more readable)\n const [func, filename] = extractSafariExtensionDetails(parts[1] || UNKNOWN_FUNCTION, parts[2]);\n\n return createFrame(filename, func, parts[3] ? +parts[3] : undefined, parts[4] ? +parts[4] : undefined);\n }\n\n return;\n};\n\nexport const chromeStackLineParser: StackLineParser = [CHROME_PRIORITY, chromeStackParserFn];\n\n// gecko regex: `(?:bundle|\\d+\\.js)`: `bundle` is for react native, `\\d+\\.js` also but specifically for ram bundles because it\n// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js\n// We need this specific case for now because we want no other regex to match.\nconst geckoREgex =\n /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)?((?:[-a-z]+)?:\\/.*?|\\[native code\\]|[^@]*(?:bundle|\\d+\\.js)|\\/[\\w\\-. /=]+)(?::(\\d+))?(?::(\\d+))?\\s*$/i;\nconst geckoEvalRegex = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;\n\nconst gecko: StackLineParserFn = line => {\n const parts = geckoREgex.exec(line) as null | [string, string, string, string, string, string];\n\n if (parts) {\n const isEval = parts[3] && parts[3].indexOf(' > eval') > -1;\n if (isEval) {\n const subMatch = geckoEvalRegex.exec(parts[3]) as null | [string, string, string];\n\n if (subMatch) {\n // throw out eval line/column and use top-most line number\n parts[1] = parts[1] || 'eval';\n parts[3] = subMatch[1];\n parts[4] = subMatch[2];\n parts[5] = ''; // no column when eval\n }\n }\n\n let filename = parts[3];\n let func = parts[1] || UNKNOWN_FUNCTION;\n [func, filename] = extractSafariExtensionDetails(func, filename);\n\n return createFrame(filename, func, parts[4] ? +parts[4] : undefined, parts[5] ? +parts[5] : undefined);\n }\n\n return;\n};\n\nexport const geckoStackLineParser: StackLineParser = [GECKO_PRIORITY, gecko];\n\nconst winjsRegex = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:[-a-z]+):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\n\nconst winjs: StackLineParserFn = line => {\n const parts = winjsRegex.exec(line) as null | [string, string, string, string, string];\n\n return parts\n ? createFrame(parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined)\n : undefined;\n};\n\nexport const winjsStackLineParser: StackLineParser = [WINJS_PRIORITY, winjs];\n\nconst opera10Regex = / line (\\d+).*script (?:in )?(\\S+)(?:: in function (\\S+))?$/i;\n\nconst opera10: StackLineParserFn = line => {\n const parts = opera10Regex.exec(line) as null | [string, string, string, string];\n return parts ? createFrame(parts[2], parts[3] || UNKNOWN_FUNCTION, +parts[1]) : undefined;\n};\n\nexport const opera10StackLineParser: StackLineParser = [OPERA10_PRIORITY, opera10];\n\nconst opera11Regex =\n / line (\\d+), column (\\d+)\\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\\(.*\\))? in (.*):\\s*$/i;\n\nconst opera11: StackLineParserFn = line => {\n const parts = opera11Regex.exec(line) as null | [string, string, string, string, string, string];\n return parts ? createFrame(parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined;\n};\n\nexport const opera11StackLineParser: StackLineParser = [OPERA11_PRIORITY, opera11];\n\nexport const defaultStackLineParsers = [chromeStackLineParser, geckoStackLineParser];\n\nexport const defaultStackParser = createStackParser(...defaultStackLineParsers);\n\n/**\n * Safari web extensions, starting version unknown, can produce \"frames-only\" stacktraces.\n * What it means, is that instead of format like:\n *\n * Error: wat\n * at function@url:row:col\n * at function@url:row:col\n * at function@url:row:col\n *\n * it produces something like:\n *\n * function@url:row:col\n * function@url:row:col\n * function@url:row:col\n *\n * Because of that, it won't be captured by `chrome` RegExp and will fall into `Gecko` branch.\n * This function is extracted so that we can use it in both places without duplicating the logic.\n * Unfortunately \"just\" changing RegExp is too complicated now and making it pass all tests\n * and fix this case seems like an impossible, or at least way too time-consuming task.\n */\nconst extractSafariExtensionDetails = (func: string, filename: string): [string, string] => {\n const isSafariExtension = func.indexOf('safari-extension') !== -1;\n const isSafariWebExtension = func.indexOf('safari-web-extension') !== -1;\n\n return isSafariExtension || isSafariWebExtension\n ? [\n func.indexOf('@') !== -1 ? (func.split('@')[0] as string) : UNKNOWN_FUNCTION,\n isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}`,\n ]\n : [func, filename];\n};\n"],"names":["UNKNOWN_FUNCTION","line","createStackParser"],"mappings":";;;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AK,OAAA,CAAQ,kBAAkB,CAAA,KAAM,EAAA;AAC/D,EAAA,MAAM,oBAAA,GAAuB,IAAA,CAAK,OAAA,CAAQ,sBAAsB,CAAA,KAAM,EAAA;AAEtE,EAAA,OAAO,qBAAqB,oBAAA,GACxB;AAAA,IACE,IAAA,CAAK,OAAA,CAAQ,GAAG,CAAA,KAAM,EAAA,GAAM,KAAK,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,GAAeF,qBAAA;AAAA,IAC5D,iBAAA,GAAoB,CAAA,iBAAA,EAAoB,QAAQ,CAAA,CAAA,GAAK,wBAAwB,QAAQ,CAAA;AAAA,GACvF,GACA,CAAC,IAAA,EAAM,QAAQ,CAAA;AACrB,CAAA;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const browser = require('@sentry/core/browser');
3
+ const core = require('@sentry/core');
4
4
  const debugBuild = require('../debug-build.js');
5
5
  const helpers = require('../helpers.js');
6
6
  const attributes = require('@sentry/conventions/attributes');
@@ -8,29 +8,29 @@ const attributes = require('@sentry/conventions/attributes');
8
8
  function registerBackgroundTabDetection() {
9
9
  if (helpers.WINDOW.document) {
10
10
  helpers.WINDOW.document.addEventListener("visibilitychange", () => {
11
- const activeSpan = browser.getActiveSpan();
11
+ const activeSpan = core.getActiveSpan();
12
12
  if (!activeSpan) {
13
13
  return;
14
14
  }
15
- const rootSpan = browser.getRootSpan(activeSpan);
15
+ const rootSpan = core.getRootSpan(activeSpan);
16
16
  if (helpers.WINDOW.document.hidden && rootSpan) {
17
17
  const cancelledStatus = "cancelled";
18
18
  const {
19
19
  attributes: { [attributes.SENTRY_OP]: op },
20
20
  status
21
- } = browser.spanToJSON(rootSpan);
21
+ } = core.spanToJSON(rootSpan);
22
22
  if (debugBuild.DEBUG_BUILD) {
23
- browser.debug.log(`[Tracing] Transaction: ${cancelledStatus} -> since tab moved to the background, op: ${op}`);
23
+ core.debug.log(`[Tracing] Transaction: ${cancelledStatus} -> since tab moved to the background, op: ${op}`);
24
24
  }
25
25
  if (status === "ok") {
26
- rootSpan.setStatus({ code: browser.SPAN_STATUS_ERROR, message: cancelledStatus });
26
+ rootSpan.setStatus({ code: core.SPAN_STATUS_ERROR, message: cancelledStatus });
27
27
  }
28
28
  rootSpan.setAttribute("sentry.cancellation_reason", "document.hidden");
29
29
  rootSpan.end();
30
30
  }
31
31
  });
32
32
  } else {
33
- debugBuild.DEBUG_BUILD && browser.debug.warn("[Tracing] Could not set up background tab detection due to lack of global document");
33
+ debugBuild.DEBUG_BUILD && core.debug.warn("[Tracing] Could not set up background tab detection due to lack of global document");
34
34
  }
35
35
  }
36
36
 
@@ -1 +1 @@
1
- {"version":3,"file":"backgroundtab.js","sources":["../../../../../src/tracing/backgroundtab.ts"],"sourcesContent":["import { debug, getActiveSpan, getRootSpan, SPAN_STATUS_ERROR, spanToJSON } from '@sentry/core/browser';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { WINDOW } from '../helpers';\nimport { SENTRY_OP } from '@sentry/conventions/attributes';\n\n/**\n * Add a listener that cancels and finishes a transaction when the global\n * document is hidden.\n */\nexport function registerBackgroundTabDetection(): void {\n if (WINDOW.document) {\n WINDOW.document.addEventListener('visibilitychange', () => {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n return;\n }\n\n const rootSpan = getRootSpan(activeSpan);\n\n if (WINDOW.document.hidden && rootSpan) {\n const cancelledStatus = 'cancelled';\n\n const {\n attributes: { [SENTRY_OP]: op },\n status,\n } = spanToJSON(rootSpan);\n\n if (DEBUG_BUILD) {\n debug.log(`[Tracing] Transaction: ${cancelledStatus} -> since tab moved to the background, op: ${op}`);\n }\n\n // We should not set status if it is already set, this prevent important statuses like\n // error or data loss from being overwritten on transaction.\n if (status === 'ok') {\n rootSpan.setStatus({ code: SPAN_STATUS_ERROR, message: cancelledStatus });\n }\n\n rootSpan.setAttribute('sentry.cancellation_reason', 'document.hidden');\n rootSpan.end();\n }\n });\n } else {\n DEBUG_BUILD && debug.warn('[Tracing] Could not set up background tab detection due to lack of global document');\n }\n}\n"],"names":["WINDOW","getActiveSpan","getRootSpan","SENTRY_OP","spanToJSON","DEBUG_BUILD","debug","SPAN_STATUS_ERROR"],"mappings":";;;;;;;AASO,SAAS,8BAAA,GAAuC;AACrD,EAAA,IAAIA,eAAO,QAAA,EAAU;AACnB,IAAAA,cAAA,CAAO,QAAA,CAAS,gBAAA,CAAiB,kBAAA,EAAoB,MAAM;AACzD,MAAA,MAAM,aAAaC,qBAAA,EAAc;AACjC,MAAA,IAAI,CAAC,UAAA,EAAY;AACf,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,QAAA,GAAWC,oBAAY,UAAU,CAAA;AAEvC,MAAA,IAAIF,cAAA,CAAO,QAAA,CAAS,MAAA,IAAU,QAAA,EAAU;AACtC,QAAA,MAAM,eAAA,GAAkB,WAAA;AAExB,QAAA,MAAM;AAAA,UACJ,UAAA,EAAY,EAAE,CAACG,oBAAS,GAAG,EAAA,EAAG;AAAA,UAC9B;AAAA,SACF,GAAIC,mBAAW,QAAQ,CAAA;AAEvB,QAAA,IAAIC,sBAAA,EAAa;AACf,UAAAC,aAAA,CAAM,GAAA,CAAI,CAAA,uBAAA,EAA0B,eAAe,CAAA,2CAAA,EAA8C,EAAE,CAAA,CAAE,CAAA;AAAA,QACvG;AAIA,QAAA,IAAI,WAAW,IAAA,EAAM;AACnB,UAAA,QAAA,CAAS,UAAU,EAAE,IAAA,EAAMC,yBAAA,EAAmB,OAAA,EAAS,iBAAiB,CAAA;AAAA,QAC1E;AAEA,QAAA,QAAA,CAAS,YAAA,CAAa,8BAA8B,iBAAiB,CAAA;AACrE,QAAA,QAAA,CAAS,GAAA,EAAI;AAAA,MACf;AAAA,IACF,CAAC,CAAA;AAAA,EACH,CAAA,MAAO;AACL,IAAAF,sBAAA,IAAeC,aAAA,CAAM,KAAK,oFAAoF,CAAA;AAAA,EAChH;AACF;;;;"}
1
+ {"version":3,"file":"backgroundtab.js","sources":["../../../../../src/tracing/backgroundtab.ts"],"sourcesContent":["import { debug, getActiveSpan, getRootSpan, SPAN_STATUS_ERROR, spanToJSON } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { WINDOW } from '../helpers';\nimport { SENTRY_OP } from '@sentry/conventions/attributes';\n\n/**\n * Add a listener that cancels and finishes a transaction when the global\n * document is hidden.\n */\nexport function registerBackgroundTabDetection(): void {\n if (WINDOW.document) {\n WINDOW.document.addEventListener('visibilitychange', () => {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n return;\n }\n\n const rootSpan = getRootSpan(activeSpan);\n\n if (WINDOW.document.hidden && rootSpan) {\n const cancelledStatus = 'cancelled';\n\n const {\n attributes: { [SENTRY_OP]: op },\n status,\n } = spanToJSON(rootSpan);\n\n if (DEBUG_BUILD) {\n debug.log(`[Tracing] Transaction: ${cancelledStatus} -> since tab moved to the background, op: ${op}`);\n }\n\n // We should not set status if it is already set, this prevent important statuses like\n // error or data loss from being overwritten on transaction.\n if (status === 'ok') {\n rootSpan.setStatus({ code: SPAN_STATUS_ERROR, message: cancelledStatus });\n }\n\n rootSpan.setAttribute('sentry.cancellation_reason', 'document.hidden');\n rootSpan.end();\n }\n });\n } else {\n DEBUG_BUILD && debug.warn('[Tracing] Could not set up background tab detection due to lack of global document');\n }\n}\n"],"names":["WINDOW","getActiveSpan","getRootSpan","SENTRY_OP","spanToJSON","DEBUG_BUILD","debug","SPAN_STATUS_ERROR"],"mappings":";;;;;;;AASO,SAAS,8BAAA,GAAuC;AACrD,EAAA,IAAIA,eAAO,QAAA,EAAU;AACnB,IAAAA,cAAA,CAAO,QAAA,CAAS,gBAAA,CAAiB,kBAAA,EAAoB,MAAM;AACzD,MAAA,MAAM,aAAaC,kBAAA,EAAc;AACjC,MAAA,IAAI,CAAC,UAAA,EAAY;AACf,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,QAAA,GAAWC,iBAAY,UAAU,CAAA;AAEvC,MAAA,IAAIF,cAAA,CAAO,QAAA,CAAS,MAAA,IAAU,QAAA,EAAU;AACtC,QAAA,MAAM,eAAA,GAAkB,WAAA;AAExB,QAAA,MAAM;AAAA,UACJ,UAAA,EAAY,EAAE,CAACG,oBAAS,GAAG,EAAA,EAAG;AAAA,UAC9B;AAAA,SACF,GAAIC,gBAAW,QAAQ,CAAA;AAEvB,QAAA,IAAIC,sBAAA,EAAa;AACf,UAAAC,UAAA,CAAM,GAAA,CAAI,CAAA,uBAAA,EAA0B,eAAe,CAAA,2CAAA,EAA8C,EAAE,CAAA,CAAE,CAAA;AAAA,QACvG;AAIA,QAAA,IAAI,WAAW,IAAA,EAAM;AACnB,UAAA,QAAA,CAAS,UAAU,EAAE,IAAA,EAAMC,sBAAA,EAAmB,OAAA,EAAS,iBAAiB,CAAA;AAAA,QAC1E;AAEA,QAAA,QAAA,CAAS,YAAA,CAAa,8BAA8B,iBAAiB,CAAA;AACrE,QAAA,QAAA,CAAS,GAAA,EAAI;AAAA,MACf;AAAA,IACF,CAAC,CAAA;AAAA,EACH,CAAA,MAAO;AACL,IAAAF,sBAAA,IAAeC,UAAA,CAAM,KAAK,oFAAoF,CAAA;AAAA,EAChH;AACF;;;;"}