@sentry/react-native 8.4.0 → 8.6.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 (266) hide show
  1. package/RNSentry.podspec +1 -1
  2. package/android/build.gradle +2 -2
  3. package/android/expo-handler/build.gradle +20 -0
  4. package/android/expo-handler/src/main/java/io/sentry/react/expo/SentryExpoPackage.java +22 -0
  5. package/android/expo-handler/src/main/java/io/sentry/react/expo/SentryReactNativeHostHandler.java +48 -0
  6. package/android/expo-stubs/README.md +7 -0
  7. package/android/expo-stubs/build.gradle +23 -0
  8. package/android/expo-stubs/gradle/wrapper/gradle-wrapper.jar +0 -0
  9. package/android/expo-stubs/gradle/wrapper/gradle-wrapper.properties +7 -0
  10. package/android/expo-stubs/gradlew +251 -0
  11. package/android/expo-stubs/gradlew.bat +94 -0
  12. package/android/expo-stubs/settings.gradle +1 -0
  13. package/android/expo-stubs/src/main/java/expo/modules/core/interfaces/Package.java +11 -0
  14. package/android/expo-stubs/src/main/java/expo/modules/core/interfaces/ReactNativeHostHandler.java +7 -0
  15. package/android/libs/expo-stubs.jar +0 -0
  16. package/android/libs/replay-stubs.jar +0 -0
  17. package/android/replay-stubs/build.gradle +1 -1
  18. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +71 -15
  19. package/android/src/main/java/io/sentry/react/RNSentryStart.java +3 -0
  20. package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
  21. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +10 -0
  22. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +10 -0
  23. package/dist/js/NativeLogListener.js.map +1 -1
  24. package/dist/js/NativeRNSentry.d.ts +2 -0
  25. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  26. package/dist/js/NativeRNSentry.js.map +1 -1
  27. package/dist/js/RNSentryReplayMaskNativeComponent.d.ts.map +1 -1
  28. package/dist/js/RNSentryReplayUnmaskNativeComponent.d.ts.map +1 -1
  29. package/dist/js/breadcrumb.js.map +1 -1
  30. package/dist/js/client.js.map +1 -1
  31. package/dist/js/feedback/FeedbackButton.js.map +1 -1
  32. package/dist/js/feedback/FeedbackWidget.js +6 -6
  33. package/dist/js/feedback/FeedbackWidget.js.map +1 -1
  34. package/dist/js/feedback/FeedbackWidget.styles.d.ts.map +1 -1
  35. package/dist/js/feedback/FeedbackWidgetManager.d.ts +3 -1
  36. package/dist/js/feedback/FeedbackWidgetManager.d.ts.map +1 -1
  37. package/dist/js/feedback/FeedbackWidgetManager.js +15 -1
  38. package/dist/js/feedback/FeedbackWidgetManager.js.map +1 -1
  39. package/dist/js/feedback/FeedbackWidgetProvider.d.ts +3 -2
  40. package/dist/js/feedback/FeedbackWidgetProvider.d.ts.map +1 -1
  41. package/dist/js/feedback/FeedbackWidgetProvider.js +12 -4
  42. package/dist/js/feedback/FeedbackWidgetProvider.js.map +1 -1
  43. package/dist/js/feedback/ScreenshotButton.d.ts +1 -1
  44. package/dist/js/feedback/ScreenshotButton.js.map +1 -1
  45. package/dist/js/feedback/ShakeToReportBug.d.ts +27 -0
  46. package/dist/js/feedback/ShakeToReportBug.d.ts.map +1 -0
  47. package/dist/js/feedback/ShakeToReportBug.js +83 -0
  48. package/dist/js/feedback/ShakeToReportBug.js.map +1 -0
  49. package/dist/js/feedback/defaults.js.map +1 -1
  50. package/dist/js/feedback/integration.d.ts +13 -2
  51. package/dist/js/feedback/integration.d.ts.map +1 -1
  52. package/dist/js/feedback/integration.js +7 -1
  53. package/dist/js/feedback/integration.js.map +1 -1
  54. package/dist/js/feedback/lazy.js.map +1 -1
  55. package/dist/js/feedback/utils.d.ts.map +1 -1
  56. package/dist/js/feedback/utils.js.map +1 -1
  57. package/dist/js/index.d.ts +1 -1
  58. package/dist/js/index.d.ts.map +1 -1
  59. package/dist/js/index.js +1 -1
  60. package/dist/js/index.js.map +1 -1
  61. package/dist/js/integrations/appRegistry.d.ts.map +1 -1
  62. package/dist/js/integrations/appRegistry.js.map +1 -1
  63. package/dist/js/integrations/breadcrumbs.d.ts.map +1 -1
  64. package/dist/js/integrations/debugsymbolicator.js +6 -4
  65. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  66. package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -1
  67. package/dist/js/integrations/default.d.ts.map +1 -1
  68. package/dist/js/integrations/default.js +3 -2
  69. package/dist/js/integrations/default.js.map +1 -1
  70. package/dist/js/integrations/devicecontext.js +1 -1
  71. package/dist/js/integrations/devicecontext.js.map +1 -1
  72. package/dist/js/integrations/expoconstants.js.map +1 -1
  73. package/dist/js/integrations/expocontext.js.map +1 -1
  74. package/dist/js/integrations/exports.d.ts +1 -0
  75. package/dist/js/integrations/exports.d.ts.map +1 -1
  76. package/dist/js/integrations/exports.js +1 -0
  77. package/dist/js/integrations/exports.js.map +1 -1
  78. package/dist/js/integrations/expoupdateslistener.d.ts +38 -0
  79. package/dist/js/integrations/expoupdateslistener.d.ts.map +1 -0
  80. package/dist/js/integrations/expoupdateslistener.js +130 -0
  81. package/dist/js/integrations/expoupdateslistener.js.map +1 -0
  82. package/dist/js/integrations/logEnricherIntegration.js +1 -1
  83. package/dist/js/integrations/logEnricherIntegration.js.map +1 -1
  84. package/dist/js/integrations/modulesloader.js.map +1 -1
  85. package/dist/js/integrations/nativelinkederrors.d.ts.map +1 -1
  86. package/dist/js/integrations/nativelinkederrors.js +1 -0
  87. package/dist/js/integrations/nativelinkederrors.js.map +1 -1
  88. package/dist/js/integrations/primitiveTagIntegration.js.map +1 -1
  89. package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
  90. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  91. package/dist/js/integrations/reactnativeerrorhandlersutils.js.map +1 -1
  92. package/dist/js/integrations/reactnativeinfo.js.map +1 -1
  93. package/dist/js/integrations/release.js +1 -1
  94. package/dist/js/integrations/release.js.map +1 -1
  95. package/dist/js/integrations/rewriteframes.js.map +1 -1
  96. package/dist/js/integrations/screenshot.js +1 -1
  97. package/dist/js/integrations/screenshot.js.map +1 -1
  98. package/dist/js/integrations/sdkinfo.js.map +1 -1
  99. package/dist/js/integrations/spotlight.js.map +1 -1
  100. package/dist/js/integrations/viewhierarchy.js +1 -1
  101. package/dist/js/integrations/viewhierarchy.js.map +1 -1
  102. package/dist/js/misc.js +2 -2
  103. package/dist/js/misc.js.map +1 -1
  104. package/dist/js/options.d.ts +13 -1
  105. package/dist/js/options.d.ts.map +1 -1
  106. package/dist/js/options.js.map +1 -1
  107. package/dist/js/playground/examples.js.map +1 -1
  108. package/dist/js/playground/modal.d.ts +2 -2
  109. package/dist/js/playground/modal.d.ts.map +1 -1
  110. package/dist/js/playground/modal.js +6 -6
  111. package/dist/js/playground/modal.js.map +1 -1
  112. package/dist/js/profiling/cache.js.map +1 -1
  113. package/dist/js/profiling/convertHermesProfile.js.map +1 -1
  114. package/dist/js/profiling/debugid.js.map +1 -1
  115. package/dist/js/profiling/integration.d.ts.map +1 -1
  116. package/dist/js/profiling/integration.js.map +1 -1
  117. package/dist/js/profiling/utils.js.map +1 -1
  118. package/dist/js/replay/CustomMask.d.ts.map +1 -1
  119. package/dist/js/replay/CustomMask.js.map +1 -1
  120. package/dist/js/replay/CustomMask.web.d.ts.map +1 -1
  121. package/dist/js/replay/browserReplay.d.ts.map +1 -1
  122. package/dist/js/replay/browserReplay.js.map +1 -1
  123. package/dist/js/replay/mobilereplay.d.ts.map +1 -1
  124. package/dist/js/replay/mobilereplay.js +21 -2
  125. package/dist/js/replay/mobilereplay.js.map +1 -1
  126. package/dist/js/replay/networkUtils.d.ts +0 -1
  127. package/dist/js/replay/networkUtils.d.ts.map +1 -1
  128. package/dist/js/replay/networkUtils.js.map +1 -1
  129. package/dist/js/replay/xhrUtils.js.map +1 -1
  130. package/dist/js/scopeSync.js.map +1 -1
  131. package/dist/js/sdk.d.ts.map +1 -1
  132. package/dist/js/sdk.js +4 -2
  133. package/dist/js/sdk.js.map +1 -1
  134. package/dist/js/tools/ModulesCollector.js.map +1 -1
  135. package/dist/js/tools/easBuildHooks.js +13 -14
  136. package/dist/js/tools/easBuildHooks.js.map +1 -1
  137. package/dist/js/tools/enableLogger.js +1 -2
  138. package/dist/js/tools/enableLogger.js.map +1 -1
  139. package/dist/js/tools/metroMiddleware.d.ts.map +1 -1
  140. package/dist/js/tools/metroMiddleware.js.map +1 -1
  141. package/dist/js/tools/metroconfig.js +6 -7
  142. package/dist/js/tools/metroconfig.js.map +1 -1
  143. package/dist/js/tools/sentryBabelTransformerUtils.js +7 -7
  144. package/dist/js/tools/sentryBabelTransformerUtils.js.map +1 -1
  145. package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
  146. package/dist/js/tools/sentryMetroSerializer.js +2 -2
  147. package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
  148. package/dist/js/tools/sentryOptionsSerializer.js +1 -2
  149. package/dist/js/tools/sentryOptionsSerializer.js.map +1 -1
  150. package/dist/js/tools/sentryReleaseInjector.d.ts +1 -1
  151. package/dist/js/tools/sentryReleaseInjector.d.ts.map +1 -1
  152. package/dist/js/tools/sentryReleaseInjector.js.map +1 -1
  153. package/dist/js/tools/utils.d.ts.map +1 -1
  154. package/dist/js/tools/utils.js +9 -10
  155. package/dist/js/tools/utils.js.map +1 -1
  156. package/dist/js/tools/vendor/metro/countLines.d.ts.map +1 -1
  157. package/dist/js/tools/vendor/metro/utils.d.ts.map +1 -1
  158. package/dist/js/tools/vendor/metro/utils.js.map +1 -1
  159. package/dist/js/touchevents.d.ts.map +1 -1
  160. package/dist/js/touchevents.js +2 -0
  161. package/dist/js/touchevents.js.map +1 -1
  162. package/dist/js/tracing/expoAsset.js.map +1 -1
  163. package/dist/js/tracing/expoImage.js.map +1 -1
  164. package/dist/js/tracing/expoRouter.js.map +1 -1
  165. package/dist/js/tracing/gesturetracing.js.map +1 -1
  166. package/dist/js/tracing/integrations/appStart.d.ts +9 -1
  167. package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
  168. package/dist/js/tracing/integrations/appStart.js +61 -12
  169. package/dist/js/tracing/integrations/appStart.js.map +1 -1
  170. package/dist/js/tracing/integrations/nativeFrames.d.ts.map +1 -1
  171. package/dist/js/tracing/integrations/nativeFrames.js +35 -22
  172. package/dist/js/tracing/integrations/nativeFrames.js.map +1 -1
  173. package/dist/js/tracing/integrations/stalltracking.d.ts +1 -1
  174. package/dist/js/tracing/integrations/stalltracking.d.ts.map +1 -1
  175. package/dist/js/tracing/integrations/stalltracking.js +4 -1
  176. package/dist/js/tracing/integrations/stalltracking.js.map +1 -1
  177. package/dist/js/tracing/integrations/timeToDisplayIntegration.d.ts.map +1 -1
  178. package/dist/js/tracing/integrations/timeToDisplayIntegration.js +15 -14
  179. package/dist/js/tracing/integrations/timeToDisplayIntegration.js.map +1 -1
  180. package/dist/js/tracing/integrations/userInteraction.d.ts.map +1 -1
  181. package/dist/js/tracing/integrations/userInteraction.js.map +1 -1
  182. package/dist/js/tracing/onSpanEndUtils.d.ts.map +1 -1
  183. package/dist/js/tracing/onSpanEndUtils.js +20 -13
  184. package/dist/js/tracing/onSpanEndUtils.js.map +1 -1
  185. package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
  186. package/dist/js/tracing/reactnativenavigation.js +1 -1
  187. package/dist/js/tracing/reactnativenavigation.js.map +1 -1
  188. package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
  189. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  190. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  191. package/dist/js/tracing/reactnavigation.d.ts +3 -0
  192. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  193. package/dist/js/tracing/reactnavigation.js +7 -3
  194. package/dist/js/tracing/reactnavigation.js.map +1 -1
  195. package/dist/js/tracing/span.d.ts +2 -17
  196. package/dist/js/tracing/span.d.ts.map +1 -1
  197. package/dist/js/tracing/span.js.map +1 -1
  198. package/dist/js/tracing/timeToDisplayFallback.d.ts.map +1 -1
  199. package/dist/js/tracing/timetodisplay.js.map +1 -1
  200. package/dist/js/tracing/timetodisplaynative.d.ts.map +1 -1
  201. package/dist/js/tracing/timetodisplaynative.js.map +1 -1
  202. package/dist/js/tracing/utils.js.map +1 -1
  203. package/dist/js/transports/encodePolyfill.d.ts +1 -1
  204. package/dist/js/transports/encodePolyfill.d.ts.map +1 -1
  205. package/dist/js/transports/encodePolyfill.js.map +1 -1
  206. package/dist/js/transports/native.js.map +1 -1
  207. package/dist/js/utils/AsyncExpiringMap.js.map +1 -1
  208. package/dist/js/utils/encode.js.map +1 -1
  209. package/dist/js/utils/environment.js.map +1 -1
  210. package/dist/js/utils/ignorerequirecyclelogs.js +1 -1
  211. package/dist/js/utils/ignorerequirecyclelogs.js.map +1 -1
  212. package/dist/js/utils/normalize.js.map +1 -1
  213. package/dist/js/utils/outcome.js.map +1 -1
  214. package/dist/js/utils/primitiveConverter.js.map +1 -1
  215. package/dist/js/utils/release.js.map +1 -1
  216. package/dist/js/utils/rnlibraries.js.map +1 -1
  217. package/dist/js/utils/safe.d.ts +1 -1
  218. package/dist/js/utils/safe.d.ts.map +1 -1
  219. package/dist/js/utils/safe.js.map +1 -1
  220. package/dist/js/utils/worldwide.d.ts +0 -1
  221. package/dist/js/utils/worldwide.d.ts.map +1 -1
  222. package/dist/js/utils/xhr.d.ts +0 -1
  223. package/dist/js/utils/xhr.d.ts.map +1 -1
  224. package/dist/js/utils/xhr.js.map +1 -1
  225. package/dist/js/vendor/base64-js/fromByteArray.js.map +1 -1
  226. package/dist/js/vendor/buffer/utf8ToBytes.js.map +1 -1
  227. package/dist/js/version.d.ts +1 -1
  228. package/dist/js/version.js +1 -1
  229. package/dist/js/version.js.map +1 -1
  230. package/dist/js/wrapper.d.ts.map +1 -1
  231. package/dist/js/wrapper.js +5 -6
  232. package/dist/js/wrapper.js.map +1 -1
  233. package/expo-module.config.json +7 -0
  234. package/ios/RNSentry.mm +47 -1
  235. package/ios/RNSentryEvents.h +1 -0
  236. package/ios/RNSentryEvents.m +1 -0
  237. package/ios/RNSentryStart.m +4 -1
  238. package/ios/RNSentryVersion.m +1 -1
  239. package/package.json +15 -15
  240. package/plugin/build/withSentry.js +1 -1
  241. package/plugin/build/withSentryAndroidGradlePlugin.d.ts +1 -1
  242. package/plugin/build/withSentryAndroidGradlePlugin.js +1 -1
  243. package/scripts/sentry-xcode.sh +14 -0
  244. package/sentry.gradle +13 -0
  245. package/src/js/NativeRNSentry.ts +2 -0
  246. package/ts3.8/dist/js/NativeRNSentry.d.ts +2 -0
  247. package/ts3.8/dist/js/feedback/FeedbackWidgetManager.d.ts +3 -1
  248. package/ts3.8/dist/js/feedback/FeedbackWidgetProvider.d.ts +3 -2
  249. package/ts3.8/dist/js/feedback/ScreenshotButton.d.ts +1 -1
  250. package/ts3.8/dist/js/feedback/ShakeToReportBug.d.ts +27 -0
  251. package/ts3.8/dist/js/feedback/integration.d.ts +13 -2
  252. package/ts3.8/dist/js/index.d.ts +1 -1
  253. package/ts3.8/dist/js/integrations/exports.d.ts +1 -0
  254. package/ts3.8/dist/js/integrations/expoupdateslistener.d.ts +38 -0
  255. package/ts3.8/dist/js/options.d.ts +13 -1
  256. package/ts3.8/dist/js/playground/modal.d.ts +2 -2
  257. package/ts3.8/dist/js/replay/networkUtils.d.ts +0 -1
  258. package/ts3.8/dist/js/tracing/integrations/appStart.d.ts +9 -1
  259. package/ts3.8/dist/js/tracing/integrations/stalltracking.d.ts +1 -1
  260. package/ts3.8/dist/js/tracing/reactnavigation.d.ts +3 -0
  261. package/ts3.8/dist/js/tracing/span.d.ts +2 -17
  262. package/ts3.8/dist/js/transports/encodePolyfill.d.ts +1 -1
  263. package/ts3.8/dist/js/utils/safe.d.ts +1 -1
  264. package/ts3.8/dist/js/utils/worldwide.d.ts +0 -1
  265. package/ts3.8/dist/js/utils/xhr.d.ts +0 -1
  266. package/ts3.8/dist/js/version.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"browserReplay.js","sourceRoot":"","sources":["../../../src/js/replay/browserReplay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAU9C,gJAAgJ;AAChJ,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,CAAC,UAA+B,EAAE,EAAU,EAAE;IAC7E,IAAI,MAAM,EAAE,EAAE;QACZ,qEAAqE;QACrE,yBAAyB;QACzB,OAAO,4BAA4B,EAAE,CAAC;KACvC;IAED,OAAO,iBAAiB,iCACnB,OAAO,KACV,IAAI,EAAE,CAAC,2BAA2B,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,EAC5D,MAAM,EAAE,CAAC,kEAAkE,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IACvG,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,4BAA4B,GAAG,GAAW,EAAE;IAChD,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,gEAAgE;QAChE,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;QACf,gEAAgE;QAChE,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;QACxB,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;QAC7B,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;QAC9B,WAAW,EAAE,GAAG,EAAE,CAAC,SAAS;QAC5B,gBAAgB,EAAE,GAAG,EAAE,CAAC,SAAS;KAClC,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC","sourcesContent":["import { replayIntegration } from '@sentry/react';\nimport { notWeb } from '../utils/environment';\nimport type { Replay } from './replayInterface';\n\n/**\n * ReplayConfiguration for browser replay integration.\n *\n * See the [Configuration documentation](https://docs.sentry.io/platforms/javascript/session-replay/configuration/) for more information.\n */\ntype ReplayConfiguration = Parameters<typeof replayIntegration>[0];\n\n// https://github.com/getsentry/sentry-javascript/blob/e00cb04f1bbf494067cd8475d392266ba296987a/packages/replay-internal/src/integration.ts#L109\nconst INTEGRATION_NAME = 'Replay';\n\n/**\n * Browser Replay integration for React Native.\n *\n * See the [Browser Replay documentation](https://docs.sentry.io/platforms/javascript/session-replay/) for more information.\n */\nconst browserReplayIntegration = (options: ReplayConfiguration = {}): Replay => {\n if (notWeb()) {\n // This is required because `replayIntegration` browser check doesn't\n // work for React Native.\n return browserReplayIntegrationNoop();\n }\n\n return replayIntegration({\n ...options,\n mask: ['.sentry-react-native-mask', ...(options.mask || [])],\n unmask: ['.sentry-react-native-unmask:not(.sentry-react-native-mask *) > *', ...(options.unmask || [])],\n });\n};\n\nconst browserReplayIntegrationNoop = (): Replay => {\n return {\n name: INTEGRATION_NAME,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n start: () => {},\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n startBuffering: () => {},\n stop: () => Promise.resolve(),\n flush: () => Promise.resolve(),\n getReplayId: () => undefined,\n getRecordingMode: () => undefined,\n };\n};\n\nexport { browserReplayIntegration };\n"]}
1
+ {"version":3,"file":"browserReplay.js","sourceRoot":"","sources":["../../../src/js/replay/browserReplay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAU9C,gJAAgJ;AAChJ,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,CAAC,UAA+B,EAAE,EAAU,EAAE;IAC7E,IAAI,MAAM,EAAE,EAAE,CAAC;QACb,qEAAqE;QACrE,yBAAyB;QACzB,OAAO,4BAA4B,EAAE,CAAC;IACxC,CAAC;IAED,OAAO,iBAAiB,iCACnB,OAAO,KACV,IAAI,EAAE,CAAC,2BAA2B,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,EAC5D,MAAM,EAAE,CAAC,kEAAkE,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IACvG,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,4BAA4B,GAAG,GAAW,EAAE;IAChD,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,gEAAgE;QAChE,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;QACf,gEAAgE;QAChE,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;QACxB,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;QAC7B,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;QAC9B,WAAW,EAAE,GAAG,EAAE,CAAC,SAAS;QAC5B,gBAAgB,EAAE,GAAG,EAAE,CAAC,SAAS;KAClC,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC","sourcesContent":["import { replayIntegration } from '@sentry/react';\nimport { notWeb } from '../utils/environment';\nimport type { Replay } from './replayInterface';\n\n/**\n * ReplayConfiguration for browser replay integration.\n *\n * See the [Configuration documentation](https://docs.sentry.io/platforms/javascript/session-replay/configuration/) for more information.\n */\ntype ReplayConfiguration = Parameters<typeof replayIntegration>[0];\n\n// https://github.com/getsentry/sentry-javascript/blob/e00cb04f1bbf494067cd8475d392266ba296987a/packages/replay-internal/src/integration.ts#L109\nconst INTEGRATION_NAME = 'Replay';\n\n/**\n * Browser Replay integration for React Native.\n *\n * See the [Browser Replay documentation](https://docs.sentry.io/platforms/javascript/session-replay/) for more information.\n */\nconst browserReplayIntegration = (options: ReplayConfiguration = {}): Replay => {\n if (notWeb()) {\n // This is required because `replayIntegration` browser check doesn't\n // work for React Native.\n return browserReplayIntegrationNoop();\n }\n\n return replayIntegration({\n ...options,\n mask: ['.sentry-react-native-mask', ...(options.mask || [])],\n unmask: ['.sentry-react-native-unmask:not(.sentry-react-native-mask *) > *', ...(options.unmask || [])],\n });\n};\n\nconst browserReplayIntegrationNoop = (): Replay => {\n return {\n name: INTEGRATION_NAME,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n start: () => {},\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n startBuffering: () => {},\n stop: () => Promise.resolve(),\n flush: () => Promise.resolve(),\n getReplayId: () => undefined,\n getRecordingMode: () => undefined,\n };\n};\n\nexport { browserReplayIntegration };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mobilereplay.d.ts","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkC,KAAK,EAAE,SAAS,EAAE,WAAW,EAAU,MAAM,cAAc,CAAC;AAQ1G,eAAO,MAAM,8BAA8B,iBAAiB,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAExD,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;;;;;OAUG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;IAEzC;;;;;;;;;;;;OAYG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;;;;;;;;OAWG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;;;;;;;;;OAWG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE/B;;;;;;;;;;;OAWG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE/B;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IAExC;;;;;;;;OAQG;IACH,mBAAmB,CAAC,EAAE,CA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EAAE,SAAS,KAAK,OAAO,CAAC;CAClE;AAyBD,KAAK,uBAAuB,GAAG,WAAW,GAAG;IAC3C,OAAO,EAAE,mBAAmB,CAAC;IAC7B,WAAW,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;CAClC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,uBAAuB,GAAI,cAAa,mBAAoC,KAAG,uBA+J3F,CAAC"}
@@ -74,8 +74,8 @@ export const mobileReplayIntegration = (initOptions = defaultOptions) => {
74
74
  return nativeReplayId;
75
75
  }
76
76
  function processEvent(event, hint) {
77
- var _a;
78
77
  return __awaiter(this, void 0, void 0, function* () {
78
+ var _a;
79
79
  const hasException = ((_a = event.exception) === null || _a === void 0 ? void 0 : _a.values) && event.exception.values.length > 0;
80
80
  if (!hasException) {
81
81
  // Event is not an error, will not capture replay
@@ -145,6 +145,26 @@ export const mobileReplayIntegration = (initOptions = defaultOptions) => {
145
145
  }
146
146
  });
147
147
  client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);
148
+ // Wrap beforeSend to run processEvent after user's beforeSend
149
+ const clientOptions = client.getOptions();
150
+ const originalBeforeSend = clientOptions.beforeSend;
151
+ clientOptions.beforeSend = (event, hint) => __awaiter(this, void 0, void 0, function* () {
152
+ let result = event;
153
+ if (originalBeforeSend) {
154
+ result = yield originalBeforeSend(event, hint);
155
+ if (result === null) {
156
+ // Event was dropped by user's beforeSend, don't capture replay
157
+ return null;
158
+ }
159
+ }
160
+ try {
161
+ return yield processEvent(result, hint);
162
+ }
163
+ catch (error) {
164
+ debug.error(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} Failed to process event for replay`, error);
165
+ return result;
166
+ }
167
+ });
148
168
  }
149
169
  function getReplayId() {
150
170
  return getCachedReplayId();
@@ -154,7 +174,6 @@ export const mobileReplayIntegration = (initOptions = defaultOptions) => {
154
174
  return {
155
175
  name: MOBILE_REPLAY_INTEGRATION_NAME,
156
176
  setup,
157
- processEvent,
158
177
  options: options,
159
178
  getReplayId: getReplayId,
160
179
  };
@@ -1 +1 @@
1
- {"version":3,"file":"mobilereplay.js","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,CAAC,MAAM,8BAA8B,GAAG,cAAc,CAAC;AAgI7D,MAAM,cAAc,GAAwB;IAC1C,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,IAAI;IACpB,8BAA8B,EAAE,KAAK;IACrC,oBAAoB,EAAE,IAAI;IAC1B,uBAAuB,EAAE,KAAK;IAC9B,kBAAkB,EAAE,WAAW;CAChC,CAAC;AAEF,SAAS,YAAY,CAAC,WAAyC;IAC7D,MAAM,MAAM,mCACP,cAAc,GACd,WAAW,CACf,CAAC;IAEF,IAAI,WAAW,CAAC,oBAAoB,KAAK,SAAS,IAAI,WAAW,CAAC,8BAA8B,KAAK,SAAS,EAAE;QAC9G,MAAM,CAAC,oBAAoB,GAAG,WAAW,CAAC,8BAA8B,CAAC;KAC1E;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAOD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,cAAmC,cAAc,EAA2B,EAAE;IACpH,IAAI,QAAQ,EAAE,EAAE;QACd,KAAK,CAAC,IAAI,CACR,YAAY,8BAA8B,gFAAgF,CAC3H,CAAC;KACH;IACD,IAAI,WAAW,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ACR;QAED,2CAA2C;QAC3C,cAAc,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAE7C,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,GAA2B,EAAE,EAAE;YACrD,IAAI,GAAG,CAAC,SAAS,EAAE;gBACjB,OAAO;aACR;YAED,6CAA6C;YAC7C,MAAM,eAAe,GAAG,iBAAiB,EAAE,CAAC;YAC5C,IAAI,eAAe,EAAE;gBACnB,GAAG,CAAC,SAAS,GAAG,eAAe,CAAC;aACjC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,EAAE,CAAC,eAAe,EAAE,CAAC,MAAc,EAAE,EAAE;YAC5C,gEAAgE;YAChE,MAAM,eAAe,GAAG,iBAAiB,EAAE,CAAC;YAC5C,IAAI,eAAe,EAAE;gBACnB,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;gBAC5C,MAAM,CAAC,UAAU,CAAC,SAAS,GAAG,eAAe,CAAC;aAC/C;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,mCAAmC,CAAC,CAAC;IACxE,CAAC;IAED,SAAS,WAAW;QAClB,OAAO,iBAAiB,EAAE,CAAC;IAC7B,CAAC;IAED,iHAAiH;IACjH,8GAA8G;IAC9G,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,KAAK;QACL,YAAY;QACZ,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,WAAW;KACzB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,2BAA2B,GAAG,GAA4B,EAAE;IAChE,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,OAAO,EAAE,cAAc;QACvB,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,uCAAuC;KACjE,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Client, DynamicSamplingContext, Event, EventHint, Integration, Metric } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { isHardCrash } from '../misc';\nimport { hasHooks } from '../utils/clientutils';\nimport { isExpoGo, notMobileOs } from '../utils/environment';\nimport { NATIVE } from '../wrapper';\nimport { enrichXhrBreadcrumbsForMobileReplay } from './xhrUtils';\n\nexport const MOBILE_REPLAY_INTEGRATION_NAME = 'MobileReplay';\n\n/**\n * Screenshot strategy type for Android Session Replay.\n *\n * - `'canvas'`: Canvas-based screenshot strategy. This strategy does **not** support any masking options, it always masks text and images. Use this if your application has strict PII requirements.\n * - `'pixelCopy'`: Pixel copy screenshot strategy (default). Supports all masking options.\n */\nexport type ScreenshotStrategy = 'canvas' | 'pixelCopy';\n\nexport interface MobileReplayOptions {\n /**\n * Mask all text in recordings\n *\n * @default true\n */\n maskAllText?: boolean;\n\n /**\n * Mask all images in recordings\n *\n * @default true\n */\n maskAllImages?: boolean;\n\n /**\n * Mask all vector graphics in recordings\n * Supports `react-native-svg`\n *\n * @default true\n */\n maskAllVectors?: boolean;\n\n /**\n * Enables the up to 5x faster experimental view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @deprecated Use `enableViewRendererV2` instead.\n * @platform ios\n */\n enableExperimentalViewRenderer?: boolean;\n\n /**\n * Enables up to 5x faster new view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag. [Our benchmarks](https://github.com/getsentry/sentry-cocoa/pull/4940) have shown a significant improvement of\n * **up to 4-5x faster rendering** (reducing `~160ms` to `~36ms` per frame) on older devices.\n *\n * - Experiment: In case you are noticing issues with the new view renderer, please report the issue on [GitHub](https://github.com/getsentry/sentry-cocoa).\n * Eventually, we will remove this feature flag and use the new view renderer by default.\n *\n * @default true\n * @platform ios\n */\n enableViewRendererV2?: boolean;\n\n /**\n * Enables up to 5x faster but incomplete view rendering used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Note: This flag can only be used together with `enableExperimentalViewRenderer` with up to 20% faster render times.\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @default false\n * @platform ios\n */\n enableFastViewRendering?: boolean;\n\n /**\n * Array of view class names to include in subtree traversal during session replay and screenshot capture on iOS.\n *\n * Only views that are instances of these classes (or subclasses) will be traversed.\n * This helps prevent crashes when traversing problematic view hierarchies by allowing you to explicitly include only safe view classes.\n *\n * If both `includedViewClasses` and `excludedViewClasses` are set, `excludedViewClasses` takes precedence:\n * views matching excluded classes won't be traversed even if they match an included class.\n *\n * @default undefined\n * @platform ios\n */\n includedViewClasses?: string[];\n\n /**\n * Array of view class names to exclude from subtree traversal during session replay and screenshot capture on iOS.\n *\n * Views of these classes (or subclasses) will be skipped entirely, including all their children.\n * This helps prevent crashes when traversing problematic view hierarchies by allowing you to explicitly exclude problematic view classes.\n *\n * If both `includedViewClasses` and `excludedViewClasses` are set, `excludedViewClasses` takes precedence:\n * views matching excluded classes won't be traversed even if they match an included class.\n *\n * @default undefined\n * @platform ios\n */\n excludedViewClasses?: string[];\n\n /**\n * Sets the screenshot strategy used by the Session Replay integration on Android.\n *\n * If your application has strict PII requirements we recommend using `'canvas'`.\n * This strategy does **not** support any masking options, it always masks text and images.\n *\n * - Experiment: In case you are noticing issues with the canvas screenshot strategy, please report the issue on [GitHub](https://github.com/getsentry/sentry-java).\n *\n * @default 'pixelCopy'\n * @platform android\n */\n screenshotStrategy?: ScreenshotStrategy;\n\n /**\n * Callback to determine if a replay should be captured for a specific error.\n * When this callback returns `false`, no replay will be captured for the error.\n * This callback is only called when an error occurs and `replaysOnErrorSampleRate` is set.\n *\n * @param event The error event\n * @param hint Additional event information\n * @returns `false` to skip capturing a replay for this error, `true` or `undefined` to proceed with sampling\n */\n beforeErrorSampling?: (event: Event, hint: EventHint) => boolean;\n}\n\nconst defaultOptions: MobileReplayOptions = {\n maskAllText: true,\n maskAllImages: true,\n maskAllVectors: true,\n enableExperimentalViewRenderer: false,\n enableViewRendererV2: true,\n enableFastViewRendering: false,\n screenshotStrategy: 'pixelCopy',\n};\n\nfunction mergeOptions(initOptions: Partial<MobileReplayOptions>): MobileReplayOptions {\n const merged = {\n ...defaultOptions,\n ...initOptions,\n };\n\n if (initOptions.enableViewRendererV2 === undefined && initOptions.enableExperimentalViewRenderer !== undefined) {\n merged.enableViewRendererV2 = initOptions.enableExperimentalViewRenderer;\n }\n\n return merged;\n}\n\ntype MobileReplayIntegration = Integration & {\n options: MobileReplayOptions;\n getReplayId: () => string | null;\n};\n\n/**\n * The Mobile Replay Integration, let's you adjust the default mobile replay options.\n * To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.\n *\n * ```javascript\n * Sentry.init({\n * replaysOnErrorSampleRate: 1.0,\n * replaysSessionSampleRate: 1.0,\n * integrations: [mobileReplayIntegration({\n * // Adjust the default options\n * })],\n * });\n * ```\n *\n * @experimental\n */\nexport const mobileReplayIntegration = (initOptions: MobileReplayOptions = defaultOptions): MobileReplayIntegration => {\n if (isExpoGo()) {\n debug.warn(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported in Expo Go. Use EAS Build or \\`expo prebuild\\` to enable it.`,\n );\n }\n if (notMobileOs()) {\n debug.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported on this platform.`);\n }\n\n if (isExpoGo() || notMobileOs()) {\n return mobileReplayIntegrationNoop();\n }\n\n const options = mergeOptions(initOptions);\n\n // Cache the replay ID in JavaScript to avoid excessive bridge calls\n // This will be updated when we know the replay ID changes (e.g., after captureReplay)\n let cachedReplayId: string | null = null;\n\n function updateCachedReplayId(replayId: string | null): void {\n cachedReplayId = replayId;\n }\n\n function getCachedReplayId(): string | null {\n if (cachedReplayId !== null) {\n return cachedReplayId;\n }\n const nativeReplayId = NATIVE.getCurrentReplayId();\n if (nativeReplayId) {\n cachedReplayId = nativeReplayId;\n }\n return nativeReplayId;\n }\n\n async function processEvent(event: Event, hint: EventHint): Promise<Event> {\n const hasException = event.exception?.values && event.exception.values.length > 0;\n if (!hasException) {\n // Event is not an error, will not capture replay\n return event;\n }\n\n // Check if beforeErrorSampling callback filters out this error\n if (initOptions.beforeErrorSampling) {\n try {\n if (initOptions.beforeErrorSampling(event, hint) === false) {\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sent; beforeErrorSampling conditions not met for event ${event.event_id}.`,\n );\n return event;\n }\n } catch (error) {\n debug.error(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} beforeErrorSampling callback threw an error, proceeding with replay capture`,\n error,\n );\n // Continue with replay capture if callback throws\n }\n }\n\n const replayId = await NATIVE.captureReplay(isHardCrash(event));\n if (replayId) {\n updateCachedReplayId(replayId);\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} Captured recording replay ${replayId} for event ${event.event_id}.`,\n );\n // Add replay_id to error event contexts to link replays to events/traces\n event.contexts = event.contexts || {};\n event.contexts.replay = {\n ...event.contexts.replay,\n replay_id: replayId,\n };\n } else {\n // Check if there's an ongoing recording and update cache if found\n const recordingReplayId = NATIVE.getCurrentReplayId();\n if (recordingReplayId) {\n updateCachedReplayId(recordingReplayId);\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`,\n );\n // Add replay_id to error event contexts to link replays to events/traces\n event.contexts = event.contexts || {};\n event.contexts.replay = {\n ...event.contexts.replay,\n replay_id: recordingReplayId,\n };\n } else {\n updateCachedReplayId(null);\n debug.log(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`);\n }\n }\n\n return event;\n }\n\n function setup(client: Client): void {\n if (!hasHooks(client)) {\n return;\n }\n\n // Initialize the cached replay ID on setup\n cachedReplayId = NATIVE.getCurrentReplayId();\n\n client.on('createDsc', (dsc: DynamicSamplingContext) => {\n if (dsc.replay_id) {\n return;\n }\n\n // Use cached replay ID to avoid bridge calls\n const currentReplayId = getCachedReplayId();\n if (currentReplayId) {\n dsc.replay_id = currentReplayId;\n }\n });\n\n client.on('processMetric', (metric: Metric) => {\n // Add replay_id to metric attributes to link metrics to replays\n const currentReplayId = getCachedReplayId();\n if (currentReplayId) {\n metric.attributes = metric.attributes || {};\n metric.attributes.replay_id = currentReplayId;\n }\n });\n\n client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);\n }\n\n function getReplayId(): string | null {\n return getCachedReplayId();\n }\n\n // TODO: When adding manual API, ensure overlap with the web replay so users can use the same API interchangeably\n // https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setup,\n processEvent,\n options: options,\n getReplayId: getReplayId,\n };\n};\n\nconst mobileReplayIntegrationNoop = (): MobileReplayIntegration => {\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n options: defaultOptions,\n getReplayId: () => null, // Mock implementation for noop version\n };\n};\n"]}
1
+ {"version":3,"file":"mobilereplay.js","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,CAAC,MAAM,8BAA8B,GAAG,cAAc,CAAC;AAgI7D,MAAM,cAAc,GAAwB;IAC1C,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AE,8BAA8B;QACpC,KAAK;QACL,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,WAAW;KACzB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,2BAA2B,GAAG,GAA4B,EAAE;IAChE,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,OAAO,EAAE,cAAc;QACvB,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,uCAAuC;KACjE,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Client, DynamicSamplingContext, ErrorEvent, Event, EventHint, Integration, Metric } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { isHardCrash } from '../misc';\nimport { hasHooks } from '../utils/clientutils';\nimport { isExpoGo, notMobileOs } from '../utils/environment';\nimport { NATIVE } from '../wrapper';\nimport { enrichXhrBreadcrumbsForMobileReplay } from './xhrUtils';\n\nexport const MOBILE_REPLAY_INTEGRATION_NAME = 'MobileReplay';\n\n/**\n * Screenshot strategy type for Android Session Replay.\n *\n * - `'canvas'`: Canvas-based screenshot strategy. This strategy does **not** support any masking options, it always masks text and images. Use this if your application has strict PII requirements.\n * - `'pixelCopy'`: Pixel copy screenshot strategy (default). Supports all masking options.\n */\nexport type ScreenshotStrategy = 'canvas' | 'pixelCopy';\n\nexport interface MobileReplayOptions {\n /**\n * Mask all text in recordings\n *\n * @default true\n */\n maskAllText?: boolean;\n\n /**\n * Mask all images in recordings\n *\n * @default true\n */\n maskAllImages?: boolean;\n\n /**\n * Mask all vector graphics in recordings\n * Supports `react-native-svg`\n *\n * @default true\n */\n maskAllVectors?: boolean;\n\n /**\n * Enables the up to 5x faster experimental view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @deprecated Use `enableViewRendererV2` instead.\n * @platform ios\n */\n enableExperimentalViewRenderer?: boolean;\n\n /**\n * Enables up to 5x faster new view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag. [Our benchmarks](https://github.com/getsentry/sentry-cocoa/pull/4940) have shown a significant improvement of\n * **up to 4-5x faster rendering** (reducing `~160ms` to `~36ms` per frame) on older devices.\n *\n * - Experiment: In case you are noticing issues with the new view renderer, please report the issue on [GitHub](https://github.com/getsentry/sentry-cocoa).\n * Eventually, we will remove this feature flag and use the new view renderer by default.\n *\n * @default true\n * @platform ios\n */\n enableViewRendererV2?: boolean;\n\n /**\n * Enables up to 5x faster but incomplete view rendering used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Note: This flag can only be used together with `enableExperimentalViewRenderer` with up to 20% faster render times.\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @default false\n * @platform ios\n */\n enableFastViewRendering?: boolean;\n\n /**\n * Array of view class names to include in subtree traversal during session replay and screenshot capture on iOS.\n *\n * Only views that are instances of these classes (or subclasses) will be traversed.\n * This helps prevent crashes when traversing problematic view hierarchies by allowing you to explicitly include only safe view classes.\n *\n * If both `includedViewClasses` and `excludedViewClasses` are set, `excludedViewClasses` takes precedence:\n * views matching excluded classes won't be traversed even if they match an included class.\n *\n * @default undefined\n * @platform ios\n */\n includedViewClasses?: string[];\n\n /**\n * Array of view class names to exclude from subtree traversal during session replay and screenshot capture on iOS.\n *\n * Views of these classes (or subclasses) will be skipped entirely, including all their children.\n * This helps prevent crashes when traversing problematic view hierarchies by allowing you to explicitly exclude problematic view classes.\n *\n * If both `includedViewClasses` and `excludedViewClasses` are set, `excludedViewClasses` takes precedence:\n * views matching excluded classes won't be traversed even if they match an included class.\n *\n * @default undefined\n * @platform ios\n */\n excludedViewClasses?: string[];\n\n /**\n * Sets the screenshot strategy used by the Session Replay integration on Android.\n *\n * If your application has strict PII requirements we recommend using `'canvas'`.\n * This strategy does **not** support any masking options, it always masks text and images.\n *\n * - Experiment: In case you are noticing issues with the canvas screenshot strategy, please report the issue on [GitHub](https://github.com/getsentry/sentry-java).\n *\n * @default 'pixelCopy'\n * @platform android\n */\n screenshotStrategy?: ScreenshotStrategy;\n\n /**\n * Callback to determine if a replay should be captured for a specific error.\n * When this callback returns `false`, no replay will be captured for the error.\n * This callback is only called when an error occurs and `replaysOnErrorSampleRate` is set.\n *\n * @param event The error event\n * @param hint Additional event information\n * @returns `false` to skip capturing a replay for this error, `true` or `undefined` to proceed with sampling\n */\n beforeErrorSampling?: (event: Event, hint: EventHint) => boolean;\n}\n\nconst defaultOptions: MobileReplayOptions = {\n maskAllText: true,\n maskAllImages: true,\n maskAllVectors: true,\n enableExperimentalViewRenderer: false,\n enableViewRendererV2: true,\n enableFastViewRendering: false,\n screenshotStrategy: 'pixelCopy',\n};\n\nfunction mergeOptions(initOptions: Partial<MobileReplayOptions>): MobileReplayOptions {\n const merged = {\n ...defaultOptions,\n ...initOptions,\n };\n\n if (initOptions.enableViewRendererV2 === undefined && initOptions.enableExperimentalViewRenderer !== undefined) {\n merged.enableViewRendererV2 = initOptions.enableExperimentalViewRenderer;\n }\n\n return merged;\n}\n\ntype MobileReplayIntegration = Integration & {\n options: MobileReplayOptions;\n getReplayId: () => string | null;\n};\n\n/**\n * The Mobile Replay Integration, let's you adjust the default mobile replay options.\n * To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.\n *\n * ```javascript\n * Sentry.init({\n * replaysOnErrorSampleRate: 1.0,\n * replaysSessionSampleRate: 1.0,\n * integrations: [mobileReplayIntegration({\n * // Adjust the default options\n * })],\n * });\n * ```\n *\n * @experimental\n */\nexport const mobileReplayIntegration = (initOptions: MobileReplayOptions = defaultOptions): MobileReplayIntegration => {\n if (isExpoGo()) {\n debug.warn(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported in Expo Go. Use EAS Build or \\`expo prebuild\\` to enable it.`,\n );\n }\n if (notMobileOs()) {\n debug.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported on this platform.`);\n }\n\n if (isExpoGo() || notMobileOs()) {\n return mobileReplayIntegrationNoop();\n }\n\n const options = mergeOptions(initOptions);\n\n // Cache the replay ID in JavaScript to avoid excessive bridge calls\n // This will be updated when we know the replay ID changes (e.g., after captureReplay)\n let cachedReplayId: string | null = null;\n\n function updateCachedReplayId(replayId: string | null): void {\n cachedReplayId = replayId;\n }\n\n function getCachedReplayId(): string | null {\n if (cachedReplayId !== null) {\n return cachedReplayId;\n }\n const nativeReplayId = NATIVE.getCurrentReplayId();\n if (nativeReplayId) {\n cachedReplayId = nativeReplayId;\n }\n return nativeReplayId;\n }\n\n async function processEvent(event: ErrorEvent, hint: EventHint): Promise<ErrorEvent> {\n const hasException = event.exception?.values && event.exception.values.length > 0;\n if (!hasException) {\n // Event is not an error, will not capture replay\n return event;\n }\n\n // Check if beforeErrorSampling callback filters out this error\n if (initOptions.beforeErrorSampling) {\n try {\n if (initOptions.beforeErrorSampling(event, hint) === false) {\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sent; beforeErrorSampling conditions not met for event ${event.event_id}.`,\n );\n return event;\n }\n } catch (error) {\n debug.error(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} beforeErrorSampling callback threw an error, proceeding with replay capture`,\n error,\n );\n // Continue with replay capture if callback throws\n }\n }\n\n const replayId = await NATIVE.captureReplay(isHardCrash(event));\n if (replayId) {\n updateCachedReplayId(replayId);\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} Captured recording replay ${replayId} for event ${event.event_id}.`,\n );\n // Add replay_id to error event contexts to link replays to events/traces\n event.contexts = event.contexts || {};\n event.contexts.replay = {\n ...event.contexts.replay,\n replay_id: replayId,\n };\n } else {\n // Check if there's an ongoing recording and update cache if found\n const recordingReplayId = NATIVE.getCurrentReplayId();\n if (recordingReplayId) {\n updateCachedReplayId(recordingReplayId);\n debug.log(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`,\n );\n // Add replay_id to error event contexts to link replays to events/traces\n event.contexts = event.contexts || {};\n event.contexts.replay = {\n ...event.contexts.replay,\n replay_id: recordingReplayId,\n };\n } else {\n updateCachedReplayId(null);\n debug.log(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`);\n }\n }\n\n return event;\n }\n\n function setup(client: Client): void {\n if (!hasHooks(client)) {\n return;\n }\n\n // Initialize the cached replay ID on setup\n cachedReplayId = NATIVE.getCurrentReplayId();\n\n client.on('createDsc', (dsc: DynamicSamplingContext) => {\n if (dsc.replay_id) {\n return;\n }\n\n // Use cached replay ID to avoid bridge calls\n const currentReplayId = getCachedReplayId();\n if (currentReplayId) {\n dsc.replay_id = currentReplayId;\n }\n });\n\n client.on('processMetric', (metric: Metric) => {\n // Add replay_id to metric attributes to link metrics to replays\n const currentReplayId = getCachedReplayId();\n if (currentReplayId) {\n metric.attributes = metric.attributes || {};\n metric.attributes.replay_id = currentReplayId;\n }\n });\n\n client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);\n\n // Wrap beforeSend to run processEvent after user's beforeSend\n const clientOptions = client.getOptions();\n const originalBeforeSend = clientOptions.beforeSend;\n clientOptions.beforeSend = async (event: ErrorEvent, hint: EventHint): Promise<ErrorEvent | null> => {\n let result: ErrorEvent | null = event;\n if (originalBeforeSend) {\n result = await originalBeforeSend(event, hint);\n if (result === null) {\n // Event was dropped by user's beforeSend, don't capture replay\n return null;\n }\n }\n try {\n return await processEvent(result, hint);\n } catch (error) {\n debug.error(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} Failed to process event for replay`, error);\n return result;\n }\n };\n }\n\n function getReplayId(): string | null {\n return getCachedReplayId();\n }\n\n // TODO: When adding manual API, ensure overlap with the web replay so users can use the same API interchangeably\n // https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setup,\n options: options,\n getReplayId: getReplayId,\n };\n};\n\nconst mobileReplayIntegrationNoop = (): MobileReplayIntegration => {\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n options: defaultOptions,\n getReplayId: () => null, // Mock implementation for noop version\n };\n};\n"]}
@@ -1,4 +1,3 @@
1
- /// <reference types="react-native" />
2
1
  /** Convert a Content-Length header to number/undefined. */
3
2
  export declare function parseContentLengthHeader(header: string | null | undefined): number | undefined;
4
3
  export type RequestBody = null | Blob | FormData | URLSearchParams | string | ArrayBuffer | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../../../src/js/replay/networkUtils.ts"],"names":[],"mappings":";AAEA,2DAA2D;AAC3D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAO9F;AAED,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,QAAQ,GAAG,eAAe,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;AAEtG,8BAA8B;AAC9B,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAiCjE"}
1
+ {"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../../../src/js/replay/networkUtils.ts"],"names":[],"mappings":"AAEA,2DAA2D;AAC3D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAO9F;AAED,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,QAAQ,GAAG,eAAe,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;AAEtG,8BAA8B;AAC9B,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAA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kB;IAC5C,2DAA2D;IAC3D,iFAAiF;IACjF,2LAA2L;IAC3L,OAAO,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;AAClD,CAAC","sourcesContent":["import { encodeUTF8 } from '../utils/encode';\n\n/** Convert a Content-Length header to number/undefined. */\nexport function parseContentLengthHeader(header: string | null | undefined): number | undefined {\n if (!header) {\n return undefined;\n }\n\n const size = parseInt(header, 10);\n return isNaN(size) ? undefined : size;\n}\n\nexport type RequestBody = null | Blob | FormData | URLSearchParams | string | ArrayBuffer | undefined;\n\n/** Get the size of a body. */\nexport function getBodySize(body: RequestBody): number | undefined {\n if (!body) {\n return undefined;\n }\n\n try {\n if (typeof body === 'string') {\n return encodeUTF8(body).length;\n }\n\n if (body instanceof URLSearchParams) {\n return encodeUTF8(body.toString()).length;\n }\n\n if (body instanceof FormData) {\n const formDataStr = _serializeFormData(body);\n return encodeUTF8(formDataStr).length;\n }\n\n if (body instanceof Blob) {\n return body.size;\n }\n\n if (body instanceof ArrayBuffer) {\n return body.byteLength;\n }\n\n // Currently unhandled types: ArrayBufferView, ReadableStream\n } catch {\n // just return undefined\n }\n\n return undefined;\n}\n\nfunction _serializeFormData(formData: FormData): string {\n // This is a bit simplified, but gives us a decent estimate\n // This converts e.g. { name: 'Anne Smith', age: 13 } to 'name=Anne+Smith&age=13'\n // @ts-expect-error passing FormData to URLSearchParams won't correctly serialize `File` entries, which is fine for this use-case. See https://github.com/microsoft/TypeScript/issues/30584\n return new URLSearchParams(formData).toString();\n}\n"]}
1
+ {"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../../../src/js/replay/networkUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,2DAA2D;AAC3D,MAAM,UAAU,wBAAwB,CAAC,MAAiC;IACxE,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;AACxC,CAAC;AAID,8BAA8B;AAC9B,MAAM,UAAU,WAAW,CAAC,IAAiB;IAC3C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,CAAC;QACH,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;QACjC,CAAC;QAED,IAAI,IAAI,YAAY,eAAe,EAAE,CAAC;YACpC,OAAO,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;QAC5C,CAAC;QAED,IAAI,IAAI,YAAY,QAAQ,EAAE,CAAC;YAC7B,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;YAC7C,OAAO,UAAU,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC;QACxC,CAAC;QAED,IAAI,IAAI,YAAY,IAAI,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;QAED,IAAI,IAAI,YAAY,WAAW,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC,UAAU,CAAC;QACzB,CAAC;QAED,6DAA6D;IAC/D,CAAC;IAAC,WAAM,CAAC;QACP,wBAAwB;IAC1B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,kBAAkB,CAAC,QAAkB;IAC5C,2DAA2D;IAC3D,iFAAiF;IACjF,2LAA2L;IAC3L,OAAO,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;AAClD,CAAC","sourcesContent":["import { encodeUTF8 } from '../utils/encode';\n\n/** Convert a Content-Length header to number/undefined. */\nexport function parseContentLengthHeader(header: string | null | undefined): number | undefined {\n if (!header) {\n return undefined;\n }\n\n const size = parseInt(header, 10);\n return isNaN(size) ? undefined : size;\n}\n\nexport type RequestBody = null | Blob | FormData | URLSearchParams | string | ArrayBuffer | undefined;\n\n/** Get the size of a body. */\nexport function getBodySize(body: RequestBody): number | undefined {\n if (!body) {\n return undefined;\n }\n\n try {\n if (typeof body === 'string') {\n return encodeUTF8(body).length;\n }\n\n if (body instanceof URLSearchParams) {\n return encodeUTF8(body.toString()).length;\n }\n\n if (body instanceof FormData) {\n const formDataStr = _serializeFormData(body);\n return encodeUTF8(formDataStr).length;\n }\n\n if (body instanceof Blob) {\n return body.size;\n }\n\n if (body instanceof ArrayBuffer) {\n return body.byteLength;\n }\n\n // Currently unhandled types: ArrayBufferView, ReadableStream\n } catch {\n // just return undefined\n }\n\n return undefined;\n}\n\nfunction _serializeFormData(formData: FormData): string {\n // This is a bit simplified, but gives us a decent estimate\n // This converts e.g. { name: 'Anne Smith', age: 13 } to 'name=Anne+Smith&age=13'\n // @ts-expect-error passing FormData to URLSearchParams won't correctly serialize `File` entries, which is fine for this use-case. See https://github.com/microsoft/TypeScript/issues/30584\n return new URLSearchParams(formData).toString();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"xhrUtils.js","sourceRoot":"","sources":["../../../src/js/replay/xhrUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAEvE;;GAEG;AACH,MAAM,UAAU,mCAAmC,CAAC,UAAsB,EAAE,IAAgC;IAC1G,IAAI,UAAU,CAAC,QAAQ,KAAK,KAAK,IAAI,CAAC,IAAI,EAAE;QAC1C,OAAO;KACR;IAED,MAAM,OAAO,GAAG,IAAwB,CAAC;IACzC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;QAChB,OAAO;KACR;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,EAAE,cAAc,GAAG,GAAG,EAAE,YAAY,GAAG,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IAEzE,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,GAAG,CAAC,iBAAiB,CAAC,gBAAgB,CAAC;QACrD,CAAC,CAAC,wBAAwB,CAAC,GAAG,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;QACnE,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;IAEjD,UAAU,CAAC,IAAI,GAAG,iBAAiB,iBACjC,eAAe,EAAE,cAAc,EAC/B,aAAa,EAAE,YAAY,EAC3B,iBAAiB,EAAE,OAAO,EAC1B,kBAAkB,EAAE,OAAO,IACxB,UAAU,CAAC,IAAI,EAClB,CAAC;AACL,CAAC;AAOD,SAAS,YAAY,CACnB,IAAgC,EAChC,YAA4C;IAE5C,IAAI;QACF,MAAM,OAAO,GAAG,YAAY,KAAK,MAAM,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1G,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;KAC7B;IAAC,WAAM;QACN,OAAO,SAAS,CAAC;KAClB;AACH,CAAC","sourcesContent":["import type { Breadcrumb, BreadcrumbHint, SentryWrappedXMLHttpRequest, XhrBreadcrumbHint } from '@sentry/core';\nimport { dropUndefinedKeys } from '@sentry/core';\nimport type { RequestBody } from './networkUtils';\nimport { getBodySize, parseContentLengthHeader } from './networkUtils';\n\n/**\n * Enrich an XHR breadcrumb with additional data for Mobile Replay network tab.\n */\nexport function enrichXhrBreadcrumbsForMobileReplay(breadcrumb: Breadcrumb, hint: BreadcrumbHint | undefined): void {\n if (breadcrumb.category !== 'xhr' || !hint) {\n return;\n }\n\n const xhrHint = hint as Partial<XhrHint>;\n if (!xhrHint.xhr) {\n return;\n }\n\n const now = Date.now();\n const { startTimestamp = now, endTimestamp = now, input, xhr } = xhrHint;\n\n const reqSize = getBodySize(input);\n const resSize = xhr.getResponseHeader('content-length')\n ? parseContentLengthHeader(xhr.getResponseHeader('content-length'))\n : _getBodySize(xhr.response, xhr.responseType);\n\n breadcrumb.data = dropUndefinedKeys({\n start_timestamp: startTimestamp,\n end_timestamp: endTimestamp,\n request_body_size: reqSize,\n response_body_size: resSize,\n ...breadcrumb.data,\n });\n}\n\ntype XhrHint = XhrBreadcrumbHint & {\n xhr: XMLHttpRequest & SentryWrappedXMLHttpRequest;\n input?: RequestBody;\n};\n\nfunction _getBodySize(\n body: XMLHttpRequest['response'],\n responseType: XMLHttpRequest['responseType'],\n): number | undefined {\n try {\n const bodyStr = responseType === 'json' && body && typeof body === 'object' ? JSON.stringify(body) : body;\n return getBodySize(bodyStr);\n } catch {\n return undefined;\n }\n}\n"]}
1
+ {"version":3,"file":"xhrUtils.js","sourceRoot":"","sources":["../../../src/js/replay/xhrUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAEvE;;GAEG;AACH,MAAM,UAAU,mCAAmC,CAAC,UAAsB,EAAE,IAAgC;IAC1G,IAAI,UAAU,CAAC,QAAQ,KAAK,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QAC3C,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,IAAwB,CAAC;IACzC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QACjB,OAAO;IACT,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,EAAE,cAAc,GAAG,GAAG,EAAE,YAAY,GAAG,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IAEzE,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,GAAG,CAAC,iBAAiB,CAAC,gBAAgB,CAAC;QACrD,CAAC,CAAC,wBAAwB,CAAC,GAAG,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;QACnE,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;IAEjD,UAAU,CAAC,IAAI,GAAG,iBAAiB,iBACjC,eAAe,EAAE,cAAc,EAC/B,aAAa,EAAE,YAAY,EAC3B,iBAAiB,EAAE,OAAO,EAC1B,kBAAkB,EAAE,OAAO,IACxB,UAAU,CAAC,IAAI,EAClB,CAAC;AACL,CAAC;AAOD,SAAS,YAAY,CACnB,IAAgC,EAChC,YAA4C;IAE5C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,YAAY,KAAK,MAAM,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1G,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC","sourcesContent":["import type { Breadcrumb, BreadcrumbHint, SentryWrappedXMLHttpRequest, XhrBreadcrumbHint } from '@sentry/core';\nimport { dropUndefinedKeys } from '@sentry/core';\nimport type { RequestBody } from './networkUtils';\nimport { getBodySize, parseContentLengthHeader } from './networkUtils';\n\n/**\n * Enrich an XHR breadcrumb with additional data for Mobile Replay network tab.\n */\nexport function enrichXhrBreadcrumbsForMobileReplay(breadcrumb: Breadcrumb, hint: BreadcrumbHint | undefined): void {\n if (breadcrumb.category !== 'xhr' || !hint) {\n return;\n }\n\n const xhrHint = hint as Partial<XhrHint>;\n if (!xhrHint.xhr) {\n return;\n }\n\n const now = Date.now();\n const { startTimestamp = now, endTimestamp = now, input, xhr } = xhrHint;\n\n const reqSize = getBodySize(input);\n const resSize = xhr.getResponseHeader('content-length')\n ? parseContentLengthHeader(xhr.getResponseHeader('content-length'))\n : _getBodySize(xhr.response, xhr.responseType);\n\n breadcrumb.data = dropUndefinedKeys({\n start_timestamp: startTimestamp,\n end_timestamp: endTimestamp,\n request_body_size: reqSize,\n response_body_size: resSize,\n ...breadcrumb.data,\n });\n}\n\ntype XhrHint = XhrBreadcrumbHint & {\n xhr: XMLHttpRequest & SentryWrappedXMLHttpRequest;\n input?: RequestBody;\n};\n\nfunction _getBodySize(\n body: XMLHttpRequest['response'],\n responseType: XMLHttpRequest['responseType'],\n): number | undefined {\n try {\n const bodyStr = responseType === 'json' && body && typeof body === 'object' ? JSON.stringify(body) : body;\n return getBodySize(bodyStr);\n } catch {\n return undefined;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"scopeSync.js","sourceRoot":"","sources":["../../src/js/scopeSync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;GAGG;AACH,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAe,CAAC;AAErD;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAY;IAC7C,IAAI,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QAChC,OAAO;KACR;IACD,iBAAiB,CAAC,GAAG,CAAC,KAAK,EAAE,IAA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,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,GAAW,EAAE,OAAsC,EAAS,EAAE;QACxG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAChC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,GAAW,EAAE,KAAc,EAAS,EAAE;QAClF,KAAK,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;QACvD,4BAA4B;QAC5B,oCAAoC;QACpC,8FAA8F;QAC9F,oCAAoC;QACpC,IAAI;QACJ,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,UAAmC,EAAS,EAAE;QAC3F,6BAA6B;QAC7B,KAAK,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;QACvD,iCAAiC;QACjC,wEAAwE;QACxE,2CAA2C;QAC3C,kCAAkC;QAClC,+FAA+F;QAC/F,kCAAkC;QAClC,KAAK;QACL,MAAM;QACN,EAAE;QACF,gDAAgD;QAChD,yCAAyC;QACzC,IAAI;QACJ,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Breadcrumb, Scope } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { logger } from '@sentry/react';\nimport { DEFAULT_BREADCRUMB_LEVEL } from './breadcrumb';\nimport { fillTyped } from './utils/fill';\nimport { convertToNormalizedObject } from './utils/normalize';\nimport { NATIVE } from './wrapper';\n\n/**\n * This WeakMap is used to keep track of which scopes have been synced to the native SDKs.\n * This ensures that we don't double sync the same scope.\n */\nconst syncedToNativeMap = new WeakMap<Scope, true>();\n\n/**\n * Hooks into the scope set methods and sync new data added to the given scope with the native SDKs.\n */\nexport function enableSyncToNative(scope: Scope): void {\n if (syncedToNativeMap.has(scope)) {\n return;\n }\n syncedToNativeMap.set(scope, true);\n\n fillTyped(scope, 'setUser', original => (user): Scope => {\n NATIVE.setUser(user);\n return original.call(scope, user);\n });\n\n fillTyped(scope, 'setTag', original => (key, value): Scope => {\n NATIVE.setTag(key, NATIVE.primitiveProcessor(value));\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'setTags', original => (tags): Scope => {\n // As native only has setTag, we just loop through each tag key.\n Object.keys(tags).forEach(key => {\n NATIVE.setTag(key, NATIVE.primitiveProcessor(tags[key]));\n });\n return original.call(scope, tags);\n });\n\n fillTyped(scope, 'setExtras', original => (extras): Scope => {\n Object.keys(extras).forEach(key => {\n NATIVE.setExtra(key, extras[key]);\n });\n return original.call(scope, extras);\n });\n\n fillTyped(scope, 'setExtra', original => (key, value): Scope => {\n NATIVE.setExtra(key, value);\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'addBreadcrumb', original => (breadcrumb, maxBreadcrumbs): Scope => {\n const mergedBreadcrumb: Breadcrumb = {\n ...breadcrumb,\n level: breadcrumb.level || DEFAULT_BREADCRUMB_LEVEL,\n data: breadcrumb.data ? convertToNormalizedObject(breadcrumb.data) : undefined,\n };\n\n original.call(scope, mergedBreadcrumb, maxBreadcrumbs);\n\n const finalBreadcrumb = scope.getLastBreadcrumb();\n if (finalBreadcrumb) {\n NATIVE.addBreadcrumb(finalBreadcrumb);\n } else {\n logger.warn('[ScopeSync] Last created breadcrumb is undefined. Skipping sync to native.');\n }\n\n return scope;\n });\n\n fillTyped(scope, 'clearBreadcrumbs', original => (): Scope => {\n NATIVE.clearBreadcrumbs();\n return original.call(scope);\n });\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fillTyped(scope, 'setContext', original => (key: string, context: { [key: string]: any } | null): Scope => {\n NATIVE.setContext(key, context);\n return original.call(scope, key, context);\n });\n\n fillTyped(scope, 'setAttribute', original => (key: string, value: unknown): Scope => {\n debug.warn('This feature is currently not supported.');\n // Only sync primitive types\n // Native layer still not supported\n // if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n // NATIVE.setAttribute(key, value);\n // }\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'setAttributes', original => (attributes: Record<string, unknown>): Scope => {\n // Native layer not supported\n debug.warn('This feature is currently not supported.');\n // Filter to only primitive types\n // const primitiveAttrs: Record<string, string | number | boolean> = {};\n // Object.keys(attributes).forEach(key => {\n // const value = attributes[key];\n // if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n // primitiveAttrs[key] = value;\n // }\n // });\n //\n // if (Object.keys(primitiveAttrs).length > 0) {\n // NATIVE.setAttributes(primitiveAttrs);\n // }\n return original.call(scope, attributes);\n });\n}\n"]}
1
+ {"version":3,"file":"scopeSync.js","sourceRoot":"","sources":["../../src/js/scopeSync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;GAGG;AACH,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAe,CAAC;AAErD;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAY;IAC7C,IAAI,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO;IACT,CAAC;IACD,iBAAiB,CAAC,GAAG,CAAC,KA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AAC,CAAC;IAEH,8DAA8D;IAC9D,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,GAAW,EAAE,OAAsC,EAAS,EAAE;QACxG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAChC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,GAAW,EAAE,KAAc,EAAS,EAAE;QAClF,KAAK,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;QACvD,4BAA4B;QAC5B,oCAAoC;QACpC,8FAA8F;QAC9F,oCAAoC;QACpC,IAAI;QACJ,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,UAAmC,EAAS,EAAE;QAC3F,6BAA6B;QAC7B,KAAK,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;QACvD,iCAAiC;QACjC,wEAAwE;QACxE,2CAA2C;QAC3C,kCAAkC;QAClC,+FAA+F;QAC/F,kCAAkC;QAClC,KAAK;QACL,MAAM;QACN,EAAE;QACF,gDAAgD;QAChD,yCAAyC;QACzC,IAAI;QACJ,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Breadcrumb, Scope } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { logger } from '@sentry/react';\nimport { DEFAULT_BREADCRUMB_LEVEL } from './breadcrumb';\nimport { fillTyped } from './utils/fill';\nimport { convertToNormalizedObject } from './utils/normalize';\nimport { NATIVE } from './wrapper';\n\n/**\n * This WeakMap is used to keep track of which scopes have been synced to the native SDKs.\n * This ensures that we don't double sync the same scope.\n */\nconst syncedToNativeMap = new WeakMap<Scope, true>();\n\n/**\n * Hooks into the scope set methods and sync new data added to the given scope with the native SDKs.\n */\nexport function enableSyncToNative(scope: Scope): void {\n if (syncedToNativeMap.has(scope)) {\n return;\n }\n syncedToNativeMap.set(scope, true);\n\n fillTyped(scope, 'setUser', original => (user): Scope => {\n NATIVE.setUser(user);\n return original.call(scope, user);\n });\n\n fillTyped(scope, 'setTag', original => (key, value): Scope => {\n NATIVE.setTag(key, NATIVE.primitiveProcessor(value));\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'setTags', original => (tags): Scope => {\n // As native only has setTag, we just loop through each tag key.\n Object.keys(tags).forEach(key => {\n NATIVE.setTag(key, NATIVE.primitiveProcessor(tags[key]));\n });\n return original.call(scope, tags);\n });\n\n fillTyped(scope, 'setExtras', original => (extras): Scope => {\n Object.keys(extras).forEach(key => {\n NATIVE.setExtra(key, extras[key]);\n });\n return original.call(scope, extras);\n });\n\n fillTyped(scope, 'setExtra', original => (key, value): Scope => {\n NATIVE.setExtra(key, value);\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'addBreadcrumb', original => (breadcrumb, maxBreadcrumbs): Scope => {\n const mergedBreadcrumb: Breadcrumb = {\n ...breadcrumb,\n level: breadcrumb.level || DEFAULT_BREADCRUMB_LEVEL,\n data: breadcrumb.data ? convertToNormalizedObject(breadcrumb.data) : undefined,\n };\n\n original.call(scope, mergedBreadcrumb, maxBreadcrumbs);\n\n const finalBreadcrumb = scope.getLastBreadcrumb();\n if (finalBreadcrumb) {\n NATIVE.addBreadcrumb(finalBreadcrumb);\n } else {\n logger.warn('[ScopeSync] Last created breadcrumb is undefined. Skipping sync to native.');\n }\n\n return scope;\n });\n\n fillTyped(scope, 'clearBreadcrumbs', original => (): Scope => {\n NATIVE.clearBreadcrumbs();\n return original.call(scope);\n });\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fillTyped(scope, 'setContext', original => (key: string, context: { [key: string]: any } | null): Scope => {\n NATIVE.setContext(key, context);\n return original.call(scope, key, context);\n });\n\n fillTyped(scope, 'setAttribute', original => (key: string, value: unknown): Scope => {\n debug.warn('This feature is currently not supported.');\n // Only sync primitive types\n // Native layer still not supported\n // if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n // NATIVE.setAttribute(key, value);\n // }\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'setAttributes', original => (attributes: Record<string, unknown>): Scope => {\n // Native layer not supported\n debug.warn('This feature is currently not supported.');\n // Filter to only primitive types\n // const primitiveAttrs: Record<string, string | number | boolean> = {};\n // Object.keys(attributes).forEach(key => {\n // const value = attributes[key];\n // if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n // primitiveAttrs[key] = value;\n // }\n // });\n //\n // if (Object.keys(primitiveAttrs).length > 0) {\n // NATIVE.setAttributes(primitiveAttrs);\n // }\n return original.call(scope, attributes);\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA2C,KAAK,EAAE,MAAM,cAAc,CAAC;AAanF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAA4B,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAgCzG;;GAEG;AACH,wBAAgB,IAAI,CAAC,aAAa,EAAE,kBAAkB,GAAG,IAAI,CA0H5D;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpD,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACrC,OAAO,CAAC,EAAE,yBAAyB,GAClC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAsBxB;AAED;;;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AAE,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAUzE;AAED;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAE9D"}
package/dist/js/sdk.js CHANGED
@@ -104,9 +104,11 @@ export function init(passedOptions) {
104
104
  enableNative,
105
105
  })
106
106
  || makeFetchTransport, transportOptions: Object.assign(Object.assign(Object.assign({}, DEFAULT_OPTIONS.transportOptions), ((_f = userOptions.transportOptions) !== null && _f !== void 0 ? _f : {})), { bufferSize: maxQueueSize }), maxQueueSize, integrations: [], stackParser: stackParserFromStackParserOptions(userOptions.stackParser || defaultStackParser), beforeBreadcrumb: chainedBeforeBreadcrumb, initialScope: safeFactory(userOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }) });
107
- if (!('autoInitializeNativeSdk' in userOptions) && RN_GLOBAL_OBJ.__SENTRY_OPTIONS__) {
108
- // Options file is present, native SDK is expected to be initialized
107
+ if (!('autoInitializeNativeSdk' in userOptions) && RN_GLOBAL_OBJ.__SENTRY_OPTIONS__ && !__DEV__) {
108
+ // Options file is present in a release build, native SDK is expected to be initialized
109
109
  // before JS from the native app entry point (e.g. AppDelegate, MainApplication).
110
+ // In dev builds, we always re-initialize from JS to set up the native log bridge
111
+ // and provide runtime values (devServerUrl, defaultSidecarUrl, etc.).
110
112
  // eslint-disable-next-line no-console
111
113
  console.info('[Sentry] Using options file. Native SDK is expected to be initialized before JS, skipping automatic native initialization from JS.');
112
114
  options.autoInitializeNativeSdk = false;
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EACL,KAAK,EACL,SAAS,EACT,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,iCAAiC,EACjC,SAAS,IAAI,aAAa,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE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,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAgB,KAAK;;QACzB,IAAI;YACF,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAE3B,IAAI,MAAM,EAAE;gBACV,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;gBAEpC,OAAO,MAAM,CAAC;aACf;YACD,oCAAoC;SACrC;QAAC,OAAO,CAAC,EAAE,GAAG;QAEf,KAAK,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAEhD,OAAO,KAAK,CAAC;IACf,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,UAAgB,KAAK;;QACzB,IAAI;YACF,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAE3B,IAAI,MAAM,EAAE;gBACV,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;aACtB;SACF;QAAC,OAAO,CAAC,EAAE;YACV,KAAK,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;SACxC;IACH,CAAC;CAAA;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CAAI,QAA6B;IACxD,MAAM,YAAY,GAAG,CAAC,KAAY,EAAiB,EAAE;QACnD,IAAI;YACF,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;SACxB;QAAC,OAAO,CAAC,EAAE;YACV,KAAK,CAAC,KAAK,CAAC,wCAAwC,EAAE,CAAC,CAAC,CAAC;YACzD,OAAO,SAAS,CAAC;SAClB;IACH,CAAC,CAAC;IACF,OAAO,aAAa,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAgB,cAAc;;QAClC,OAAO,MAAM,CAAC,cAAc,EAAE,CAAC;IACjC,CAAC;CAAA","sourcesContent":["/* eslint-disable complexity */\nimport type { Breadcrumb, BreadcrumbHint, Integration, Scope } from '@sentry/core';\nimport {\n debug,\n getClient,\n getGlobalScope,\n getIntegrationsToSetup,\n getIsolationScope,\n initAndBind,\n makeDsn,\n stackParserFromStackParserOptions,\n withScope as coreWithScope,\n} from '@sentry/core';\nimport { defaultStackParser, makeFetchTransport, Profiler } from '@sentry/react';\nimport * as React from 'react';\nimport { ReactNativeClient } from './client';\nimport { FeedbackWidgetProvider } from './feedback/FeedbackWidgetProvider';\nimport { getDevServer } from './integrations/debugsymbolicatorutils';\nimport { getDefaultIntegrations } from './integrations/default';\nimport type { ReactNativeClientOptions, ReactNativeOptions, ReactNativeWrapperOptions } from './options';\nimport { shouldEnableNativeNagger } from './options';\nimport { enableSyncToNative } from './scopeSync';\nimport { TouchEventBoundary } from './touchevents';\nimport { ReactNativeProfiler } from './tracing';\nimport { useEncodePolyfill } from './transports/encodePolyfill';\nimport { DEFAULT_BUFFER_SIZE, makeNativeTransportFactory } from './transports/native';\nimport { getDefaultEnvironment, isExpoGo, isRunningInMetroDevServer, isWeb } from './utils/environment';\nimport { getDefaultRelease } from './utils/release';\nimport { safeFactory, safeTracesSampler } from './utils/safe';\nimport { RN_GLOBAL_OBJ } from './utils/worldwide';\nimport { NATIVE } from './wrapper';\n\nconst DEFAULT_OPTIONS: ReactNativeOptions = {\n enableNativeCrashHandling: true,\n enableNativeNagger: true,\n autoInitializeNativeSdk: true,\n enableAutoPerformanceTracing: true,\n enableWatchdogTerminationTracking: true,\n patchGlobalPromise: true,\n sendClientReports: true,\n maxQueueSize: DEFAULT_BUFFER_SIZE,\n attachStacktrace: true,\n enableCaptureFailedRequests: false,\n enableNdk: true,\n enableAppStartTracking: true,\n enableNativeFramesTracking: true,\n enableStallTracking: true,\n enableUserInteractionTracing: false,\n propagateTraceparent: false,\n};\n\n/**\n * Inits the SDK and returns the final options.\n */\nexport function init(passedOptions: ReactNativeOptions): void {\n if (isRunningInMetroDevServer()) {\n return;\n }\n\n const userOptions = {\n ...RN_GLOBAL_OBJ.__SENTRY_OPTIONS__,\n ...passedOptions,\n };\n\n const maxQueueSize = userOptions.maxQueueSize\n // eslint-disable-next-line deprecation/deprecation\n ?? userOptions.transportOptions?.bufferSize\n ?? DEFAULT_OPTIONS.maxQueueSize;\n\n const enableNative = userOptions.enableNative === undefined || userOptions.enableNative\n ? NATIVE.isNativeAvailable()\n : false;\n\n useEncodePolyfill();\n if (enableNative) {\n enableSyncToNative(getGlobalScope());\n enableSyncToNative(getIsolationScope());\n }\n\n const getURLFromDSN = (dsn: string | undefined): string | undefined => {\n if (!dsn) {\n return undefined;\n }\n const dsnComponents = makeDsn(dsn);\n if (!dsnComponents) {\n debug.error('Failed to extract url from DSN: ', dsn);\n return undefined;\n }\n const port = dsnComponents.port ? `:${dsnComponents.port}` : '';\n return `${dsnComponents.protocol}://${dsnComponents.host}${port}`;\n };\n\n const userBeforeBreadcrumb = safeFactory(userOptions.beforeBreadcrumb, { loggerMessage: 'The beforeBreadcrumb threw an error' });\n\n // Exclude Dev Server and Sentry Dsn request from Breadcrumbs\n const devServerUrl = getDevServer()?.url;\n const dsn = getURLFromDSN(userOptions.dsn);\n const defaultBeforeBreadcrumb = (breadcrumb: Breadcrumb, _hint?: BreadcrumbHint): Breadcrumb | null => {\n const type = breadcrumb.type || '';\n const url = typeof breadcrumb.data?.url === 'string' ? breadcrumb.data.url : '';\n if (type === 'http' && ((devServerUrl && url.startsWith(devServerUrl)) || (dsn && url.startsWith(dsn)))) {\n return null;\n }\n return breadcrumb;\n };\n\n const chainedBeforeBreadcrumb = (breadcrumb: Breadcrumb, hint?: BreadcrumbHint): Breadcrumb | null => {\n let modifiedBreadcrumb = breadcrumb;\n if (userBeforeBreadcrumb) {\n const result = userBeforeBreadcrumb(breadcrumb, hint);\n if (result === null) {\n return null;\n }\n modifiedBreadcrumb = result;\n }\n return defaultBeforeBreadcrumb(modifiedBreadcrumb, hint);\n };\n\n const options: ReactNativeClientOptions = {\n ...DEFAULT_OPTIONS,\n ...userOptions,\n release: userOptions.release ?? getDefaultRelease(),\n enableNative,\n enableNativeNagger: shouldEnableNativeNagger(userOptions.enableNativeNagger),\n // If custom transport factory fails the SDK won't initialize\n transport: userOptions.transport\n || makeNativeTransportFactory({\n enableNative,\n })\n || makeFetchTransport,\n transportOptions: {\n ...DEFAULT_OPTIONS.transportOptions,\n ...(userOptions.transportOptions ?? {}),\n bufferSize: maxQueueSize,\n },\n maxQueueSize,\n integrations: [],\n stackParser: stackParserFromStackParserOptions(userOptions.stackParser || defaultStackParser),\n beforeBreadcrumb: chainedBeforeBreadcrumb,\n initialScope: safeFactory(userOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }),\n };\n\n if (!('autoInitializeNativeSdk' in userOptions) && RN_GLOBAL_OBJ.__SENTRY_OPTIONS__) {\n // Options file is present, native SDK is expected to be initialized\n // before JS from the native app entry point (e.g. AppDelegate, MainApplication).\n // eslint-disable-next-line no-console\n console.info('[Sentry] Using options file. Native SDK is expected to be initialized before JS, skipping automatic native initialization from JS.');\n options.autoInitializeNativeSdk = false;\n }\n\n if ('tracesSampler' in options) {\n options.tracesSampler = safeTracesSampler(options.tracesSampler);\n }\n\n if (!('environment' in options)) {\n options.environment = getDefaultEnvironment();\n }\n\n const defaultIntegrations: false | Integration[] = userOptions.defaultIntegrations === undefined\n ? getDefaultIntegrations(options)\n : userOptions.defaultIntegrations;\n\n options.integrations = getIntegrationsToSetup({\n integrations: safeFactory(userOptions.integrations, { loggerMessage: 'The integrations threw an error' }),\n defaultIntegrations,\n });\n initAndBind(ReactNativeClient, options);\n\n if (isExpoGo()) {\n debug.log('Offline caching, native errors features are not available in Expo Go.');\n debug.log('Use EAS Build / Native Release Build to test these features.');\n }\n\n if (RN_GLOBAL_OBJ.__SENTRY_OPTIONS__) {\n debug.log('Sentry JS initialized with options from the options file.');\n }\n}\n\n/**\n * Inits the Sentry React Native SDK with automatic instrumentation and wrapped features.\n */\nexport function wrap<P extends Record<string, unknown>>(\n RootComponent: React.ComponentType<P>,\n options?: ReactNativeWrapperOptions\n): React.ComponentType<P> {\n const profilerProps = {\n ...(options?.profilerProps),\n name: RootComponent.displayName ?? 'Root',\n updateProps: {}\n };\n\n const ProfilerComponent = isWeb() ? Profiler : ReactNativeProfiler;\n\n const RootApp: React.FC<P> = appProps => {\n return (\n <TouchEventBoundary {...(options?.touchEventBoundaryProps ?? {})}>\n <ProfilerComponent {...profilerProps}>\n <FeedbackWidgetProvider>\n <RootComponent {...appProps} />\n </FeedbackWidgetProvider>\n </ProfilerComponent>\n </TouchEventBoundary>\n );\n };\n\n return RootApp;\n}\n\n/**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\nexport function nativeCrash(): void {\n NATIVE.nativeCrash();\n}\n\n/**\n * Flushes all pending events in the queue to disk.\n * Use this before applying any realtime updates such as code-push or expo updates.\n */\nexport async function flush(): Promise<boolean> {\n try {\n const client = getClient();\n\n if (client) {\n const result = await client.flush();\n\n return result;\n }\n // eslint-disable-next-line no-empty\n } catch (_) { }\n\n debug.error('Failed to flush the event queue.');\n\n return false;\n}\n\n/**\n * Closes the SDK, stops sending events.\n */\nexport async function close(): Promise<void> {\n try {\n const client = getClient();\n\n if (client) {\n await client.close();\n }\n } catch (e) {\n debug.error('Failed to close the SDK');\n }\n}\n\n/**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n *\n * This is essentially a convenience function for:\n *\n * pushScope();\n * callback();\n * popScope();\n *\n * @param callback that will be enclosed into push/popScope.\n */\nexport function withScope<T>(callback: (scope: Scope) => T): T | undefined {\n const safeCallback = (scope: Scope): T | undefined => {\n try {\n return callback(scope);\n } catch (e) {\n debug.error('Error while running withScope callback', e);\n return undefined;\n }\n };\n return coreWithScope(safeCallback);\n}\n\n/**\n * Returns if the app crashed in the last run.\n */\nexport async function crashedLastRun(): Promise<boolean | null> {\n return NATIVE.crashedLastRun();\n}\n"]}
1
+ {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EACL,KAAK,EACL,SAAS,EACT,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,WAA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,KAAK,CAAC,wCAAwC,EAAE,CAAC,CAAC,CAAC;YACzD,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC,CAAC;IACF,OAAO,aAAa,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAgB,cAAc;;QAClC,OAAO,MAAM,CAAC,cAAc,EAAE,CAAC;IACjC,CAAC;CAAA","sourcesContent":["/* eslint-disable complexity */\nimport type { Breadcrumb, BreadcrumbHint, Integration, Scope } from '@sentry/core';\nimport {\n debug,\n getClient,\n getGlobalScope,\n getIntegrationsToSetup,\n getIsolationScope,\n initAndBind,\n makeDsn,\n stackParserFromStackParserOptions,\n withScope as coreWithScope,\n} from '@sentry/core';\nimport { defaultStackParser, makeFetchTransport, Profiler } from '@sentry/react';\nimport * as React from 'react';\nimport { ReactNativeClient } from './client';\nimport { FeedbackWidgetProvider } from './feedback/FeedbackWidgetProvider';\nimport { getDevServer } from './integrations/debugsymbolicatorutils';\nimport { getDefaultIntegrations } from './integrations/default';\nimport type { ReactNativeClientOptions, ReactNativeOptions, ReactNativeWrapperOptions } from './options';\nimport { shouldEnableNativeNagger } from './options';\nimport { enableSyncToNative } from './scopeSync';\nimport { TouchEventBoundary } from './touchevents';\nimport { ReactNativeProfiler } from './tracing';\nimport { useEncodePolyfill } from './transports/encodePolyfill';\nimport { DEFAULT_BUFFER_SIZE, makeNativeTransportFactory } from './transports/native';\nimport { getDefaultEnvironment, isExpoGo, isRunningInMetroDevServer, isWeb } from './utils/environment';\nimport { getDefaultRelease } from './utils/release';\nimport { safeFactory, safeTracesSampler } from './utils/safe';\nimport { RN_GLOBAL_OBJ } from './utils/worldwide';\nimport { NATIVE } from './wrapper';\n\nconst DEFAULT_OPTIONS: ReactNativeOptions = {\n enableNativeCrashHandling: true,\n enableNativeNagger: true,\n autoInitializeNativeSdk: true,\n enableAutoPerformanceTracing: true,\n enableWatchdogTerminationTracking: true,\n patchGlobalPromise: true,\n sendClientReports: true,\n maxQueueSize: DEFAULT_BUFFER_SIZE,\n attachStacktrace: true,\n enableCaptureFailedRequests: false,\n enableNdk: true,\n enableAppStartTracking: true,\n enableNativeFramesTracking: true,\n enableStallTracking: true,\n enableUserInteractionTracing: false,\n propagateTraceparent: false,\n};\n\n/**\n * Inits the SDK and returns the final options.\n */\nexport function init(passedOptions: ReactNativeOptions): void {\n if (isRunningInMetroDevServer()) {\n return;\n }\n\n const userOptions = {\n ...RN_GLOBAL_OBJ.__SENTRY_OPTIONS__,\n ...passedOptions,\n };\n\n const maxQueueSize = userOptions.maxQueueSize\n // eslint-disable-next-line deprecation/deprecation\n ?? userOptions.transportOptions?.bufferSize\n ?? DEFAULT_OPTIONS.maxQueueSize;\n\n const enableNative = userOptions.enableNative === undefined || userOptions.enableNative\n ? NATIVE.isNativeAvailable()\n : false;\n\n useEncodePolyfill();\n if (enableNative) {\n enableSyncToNative(getGlobalScope());\n enableSyncToNative(getIsolationScope());\n }\n\n const getURLFromDSN = (dsn: string | undefined): string | undefined => {\n if (!dsn) {\n return undefined;\n }\n const dsnComponents = makeDsn(dsn);\n if (!dsnComponents) {\n debug.error('Failed to extract url from DSN: ', dsn);\n return undefined;\n }\n const port = dsnComponents.port ? `:${dsnComponents.port}` : '';\n return `${dsnComponents.protocol}://${dsnComponents.host}${port}`;\n };\n\n const userBeforeBreadcrumb = safeFactory(userOptions.beforeBreadcrumb, { loggerMessage: 'The beforeBreadcrumb threw an error' });\n\n // Exclude Dev Server and Sentry Dsn request from Breadcrumbs\n const devServerUrl = getDevServer()?.url;\n const dsn = getURLFromDSN(userOptions.dsn);\n const defaultBeforeBreadcrumb = (breadcrumb: Breadcrumb, _hint?: BreadcrumbHint): Breadcrumb | null => {\n const type = breadcrumb.type || '';\n const url = typeof breadcrumb.data?.url === 'string' ? breadcrumb.data.url : '';\n if (type === 'http' && ((devServerUrl && url.startsWith(devServerUrl)) || (dsn && url.startsWith(dsn)))) {\n return null;\n }\n return breadcrumb;\n };\n\n const chainedBeforeBreadcrumb = (breadcrumb: Breadcrumb, hint?: BreadcrumbHint): Breadcrumb | null => {\n let modifiedBreadcrumb = breadcrumb;\n if (userBeforeBreadcrumb) {\n const result = userBeforeBreadcrumb(breadcrumb, hint);\n if (result === null) {\n return null;\n }\n modifiedBreadcrumb = result;\n }\n return defaultBeforeBreadcrumb(modifiedBreadcrumb, hint);\n };\n\n const options: ReactNativeClientOptions = {\n ...DEFAULT_OPTIONS,\n ...userOptions,\n release: userOptions.release ?? getDefaultRelease(),\n enableNative,\n enableNativeNagger: shouldEnableNativeNagger(userOptions.enableNativeNagger),\n // If custom transport factory fails the SDK won't initialize\n transport: userOptions.transport\n || makeNativeTransportFactory({\n enableNative,\n })\n || makeFetchTransport,\n transportOptions: {\n ...DEFAULT_OPTIONS.transportOptions,\n ...(userOptions.transportOptions ?? {}),\n bufferSize: maxQueueSize,\n },\n maxQueueSize,\n integrations: [],\n stackParser: stackParserFromStackParserOptions(userOptions.stackParser || defaultStackParser),\n beforeBreadcrumb: chainedBeforeBreadcrumb,\n initialScope: safeFactory(userOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }),\n };\n\n if (!('autoInitializeNativeSdk' in userOptions) && RN_GLOBAL_OBJ.__SENTRY_OPTIONS__ && !__DEV__) {\n // Options file is present in a release build, native SDK is expected to be initialized\n // before JS from the native app entry point (e.g. AppDelegate, MainApplication).\n // In dev builds, we always re-initialize from JS to set up the native log bridge\n // and provide runtime values (devServerUrl, defaultSidecarUrl, etc.).\n // eslint-disable-next-line no-console\n console.info('[Sentry] Using options file. Native SDK is expected to be initialized before JS, skipping automatic native initialization from JS.');\n options.autoInitializeNativeSdk = false;\n }\n\n if ('tracesSampler' in options) {\n options.tracesSampler = safeTracesSampler(options.tracesSampler);\n }\n\n if (!('environment' in options)) {\n options.environment = getDefaultEnvironment();\n }\n\n const defaultIntegrations: false | Integration[] = userOptions.defaultIntegrations === undefined\n ? getDefaultIntegrations(options)\n : userOptions.defaultIntegrations;\n\n options.integrations = getIntegrationsToSetup({\n integrations: safeFactory(userOptions.integrations, { loggerMessage: 'The integrations threw an error' }),\n defaultIntegrations,\n });\n initAndBind(ReactNativeClient, options);\n\n if (isExpoGo()) {\n debug.log('Offline caching, native errors features are not available in Expo Go.');\n debug.log('Use EAS Build / Native Release Build to test these features.');\n }\n\n if (RN_GLOBAL_OBJ.__SENTRY_OPTIONS__) {\n debug.log('Sentry JS initialized with options from the options file.');\n }\n}\n\n/**\n * Inits the Sentry React Native SDK with automatic instrumentation and wrapped features.\n */\nexport function wrap<P extends Record<string, unknown>>(\n RootComponent: React.ComponentType<P>,\n options?: ReactNativeWrapperOptions\n): React.ComponentType<P> {\n const profilerProps = {\n ...(options?.profilerProps),\n name: RootComponent.displayName ?? 'Root',\n updateProps: {}\n };\n\n const ProfilerComponent = isWeb() ? Profiler : ReactNativeProfiler;\n\n const RootApp: React.FC<P> = appProps => {\n return (\n <TouchEventBoundary {...(options?.touchEventBoundaryProps ?? {})}>\n <ProfilerComponent {...profilerProps}>\n <FeedbackWidgetProvider>\n <RootComponent {...appProps} />\n </FeedbackWidgetProvider>\n </ProfilerComponent>\n </TouchEventBoundary>\n );\n };\n\n return RootApp;\n}\n\n/**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\nexport function nativeCrash(): void {\n NATIVE.nativeCrash();\n}\n\n/**\n * Flushes all pending events in the queue to disk.\n * Use this before applying any realtime updates such as code-push or expo updates.\n */\nexport async function flush(): Promise<boolean> {\n try {\n const client = getClient();\n\n if (client) {\n const result = await client.flush();\n\n return result;\n }\n // eslint-disable-next-line no-empty\n } catch (_) { }\n\n debug.error('Failed to flush the event queue.');\n\n return false;\n}\n\n/**\n * Closes the SDK, stops sending events.\n */\nexport async function close(): Promise<void> {\n try {\n const client = getClient();\n\n if (client) {\n await client.close();\n }\n } catch (e) {\n debug.error('Failed to close the SDK');\n }\n}\n\n/**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n *\n * This is essentially a convenience function for:\n *\n * pushScope();\n * callback();\n * popScope();\n *\n * @param callback that will be enclosed into push/popScope.\n */\nexport function withScope<T>(callback: (scope: Scope) => T): T | undefined {\n const safeCallback = (scope: Scope): T | undefined => {\n try {\n return callback(scope);\n } catch (e) {\n debug.error('Error while running withScope callback', e);\n return undefined;\n }\n };\n return coreWithScope(safeCallback);\n}\n\n/**\n * Returns if the app crashed in the last run.\n */\nexport async function crashedLastRun(): Promise<boolean | null> {\n return NATIVE.crashedLastRun();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ModulesCollector.js","sourceRoot":"","sources":["../../../src/js/tools/ModulesCollector.ts"],"names":[],"mappings":";;AAAA,uCAAqC;AACrC,2BAAwE;AACxE,+BAAkC;AAElC,YAAK,CAAC,MAAM,EAAE,CAAC;AAEf,6DAA6D;AAC7D,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,YAAK,CAAC;AAOxD;;GAEG;AACH,MAAqB,gBAAgB;IACnC,qBAAqB;IACd,MAAM,CAAC,OAAO,CAAC,OAAkB,EAAE,YAAsB;QAC9D,MAAM,sBAAsB,GAAG,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,UAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAE/G,MAAM,KAAK,GAA2B,EAAE,CAAC;QACzC,MAAM,IAAI,GAAyB,EAAE,CAAC;QAEtC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAa,EAAE,EAAE;YAChC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;gBAC5B,OAAO;aACR;YAED,IAAI,GAAG,GAAG,IAAI,CAAC,CAAC,4BAA4B;YAC5C,IAAI,SAAS,GAAmB,IAAI,CAAC;YAErC,0EAA0E;YAC1E,MAAM,WAAW,GAAG,GAAS,EAAE;gBAC7B,MAAM,S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AO,CAAC,EAAE;YAC/C,YAAK,CAAC,KAAK,CAAC,8DAA8D,aAAa,IAAI,CAAC,CAAC;YAC7F,OAAO;SACR;QAED,MAAM,OAAO,GAAc,GAAG,CAAC,OAAO,CAAC;QACvC,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAE3G,MAAM,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACxD,IAAI,CAAC,IAAA,eAAU,EAAC,oBAAoB,CAAC,EAAE;YACrC,IAAA,cAAS,EAAC,oBAAoB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;SACtD;QACD,IAAA,kBAAa,EAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACnE,YAAK,CAAC,GAAG,CAAC,mCAAmC,iBAAiB,EAAE,CAAC,CAAC;IACpE,CAAC;CACF;AAtHD,mCAsHC","sourcesContent":["import { debug } from '@sentry/core';\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';\nimport { posix, sep } from 'path';\n\ndebug.enable();\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst { dirname, join, resolve, sep: posixSep } = posix;\n\ninterface Package {\n name?: string;\n version?: string;\n}\n\n/**\n * Collects JS modules from source paths.\n */\nexport default class ModulesCollector {\n /** Collect method */\n public static collect(sources: unknown[], modulesPaths: string[]): Record<string, string> {\n const normalizedModulesPaths = modulesPaths.map(modulesPath => resolve(modulesPath.split(sep).join(posixSep)));\n\n const infos: Record<string, string> = {};\n const seen: Record<string, true> = {};\n\n sources.forEach((path: unknown) => {\n if (typeof path !== 'string') {\n return;\n }\n\n let dir = path; // included source file path\n let candidate: Package | null = null;\n\n /** Traverse directories upward in the search of all package.json files */\n const upDirSearch = (): void => {\n const parentDir = dir;\n dir = dirname(parentDir);\n\n if (normalizedModulesPaths.includes(resolve(dir))) {\n if (candidate?.name && candidate?.version) {\n infos[candidate.name] = candidate.version;\n } else if (candidate?.name) {\n infos[candidate.name] = 'unknown';\n }\n return;\n }\n\n if (!dir || parentDir === dir || seen[dir]) {\n return;\n }\n seen[dir] = true;\n\n const pkgPath = join(dir, 'package.json');\n if (!existsSync(pkgPath)) {\n // fast-forward if the package.json doesn't exist\n return upDirSearch();\n }\n\n try {\n const info: Package = JSON.parse(readFileSync(pkgPath, 'utf8'));\n candidate = {\n name: info.name,\n version: info.version,\n };\n } catch (error) {\n debug.error(`Failed to read ${pkgPath}`);\n }\n\n return upDirSearch(); // processed package.json file, continue up search\n };\n\n upDirSearch();\n });\n\n return infos;\n }\n\n /**\n * Runs collection of modules.\n */\n public static run({\n sourceMapPath,\n outputModulesPath,\n modulesPaths,\n collect,\n }: Partial<{\n sourceMapPath: string;\n outputModulesPath: string;\n modulesPaths: string[];\n collect: (sources: unknown[], modulesPaths: string[]) => Record<string, string>;\n }>): void {\n if (!sourceMapPath) {\n debug.error('First argument `source-map-path` is missing!');\n return;\n }\n if (!outputModulesPath) {\n debug.error('Second argument `modules-output-path` is missing!');\n return;\n }\n if (!modulesPaths || modulesPaths.length === 0) {\n debug.error('Third argument `modules-paths` is missing!');\n return;\n }\n\n debug.log('Reading source map from', sourceMapPath);\n debug.log('Saving modules to', outputModulesPath);\n debug.log('Resolving modules from paths', modulesPaths.join(', '));\n\n if (!existsSync(sourceMapPath)) {\n debug.error(`Source map file does not exist at ${sourceMapPath}`);\n return;\n }\n for (const modulesPath of modulesPaths) {\n if (!existsSync(modulesPath)) {\n debug.error(`Modules path does not exist at ${modulesPath}`);\n return;\n }\n }\n\n const map: { sources?: unknown } = JSON.parse(readFileSync(sourceMapPath, 'utf8'));\n if (!map.sources || !Array.isArray(map.sources)) {\n debug.error(`Modules not collected. No sources found in the source map (${sourceMapPath})!`);\n return;\n }\n\n const sources: unknown[] = map.sources;\n const modules = collect ? collect(sources, modulesPaths) : ModulesCollector.collect(sources, modulesPaths);\n\n const outputModulesDirPath = dirname(outputModulesPath);\n if (!existsSync(outputModulesDirPath)) {\n mkdirSync(outputModulesDirPath, { recursive: true });\n }\n writeFileSync(outputModulesPath, JSON.stringify(modules, null, 2));\n debug.log(`Modules collected and saved to: ${outputModulesPath}`);\n }\n}\n"]}
1
+ {"version":3,"file":"ModulesCollector.js","sourceRoot":"","sources":["../../../src/js/tools/ModulesCollector.ts"],"names":[],"mappings":";;AAAA,uCAAqC;AACrC,2BAAwE;AACxE,+BAAkC;AAElC,YAAK,CAAC,MAAM,EAAE,CAAC;AAEf,6DAA6D;AAC7D,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,YAAK,CAAC;AAOxD;;GAEG;AACH,MAAqB,gBAAgB;IACnC,qBAAqB;IACd,MAAM,CAAC,OAAO,CAAC,OAAkB,EAAE,YAAsB;QAC9D,MAAM,sBAAsB,GAAG,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,UAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAE/G,MAAM,KAAK,GAA2B,EAAE,CAAC;QACzC,MAAM,IAAI,GAAyB,EAAE,CAAC;QAEtC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAa,EAAE,EAAE;YAChC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC7B,OAAO;YACT,CAAC;YAED,IAAI,GAAG,GAAG,IAAI,CAAC,CAAC,4BAA4B;YAC5C,IAAI,SAAS,GAAmB,IAAI,CAAC;YAErC,0EAA0E;YAC1E,MAAM,WAAW,GAAG,GAAS,EAAE;gBAC7B,MAAM,SAAS,GAAG,GAAG,CAAC;gBACtB,GAAG,GAAG,OAAO,CAAC,SA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AC,CAAC,CAAC;QACnF,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAChD,YAAK,CAAC,KAAK,CAAC,8DAA8D,aAAa,IAAI,CAAC,CAAC;YAC7F,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAc,GAAG,CAAC,OAAO,CAAC;QACvC,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAE3G,MAAM,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACxD,IAAI,CAAC,IAAA,eAAU,EAAC,oBAAoB,CAAC,EAAE,CAAC;YACtC,IAAA,cAAS,EAAC,oBAAoB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,CAAC;QACD,IAAA,kBAAa,EAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACnE,YAAK,CAAC,GAAG,CAAC,mCAAmC,iBAAiB,EAAE,CAAC,CAAC;IACpE,CAAC;CACF;AAtHD,mCAsHC","sourcesContent":["import { debug } from '@sentry/core';\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';\nimport { posix, sep } from 'path';\n\ndebug.enable();\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst { dirname, join, resolve, sep: posixSep } = posix;\n\ninterface Package {\n name?: string;\n version?: string;\n}\n\n/**\n * Collects JS modules from source paths.\n */\nexport default class ModulesCollector {\n /** Collect method */\n public static collect(sources: unknown[], modulesPaths: string[]): Record<string, string> {\n const normalizedModulesPaths = modulesPaths.map(modulesPath => resolve(modulesPath.split(sep).join(posixSep)));\n\n const infos: Record<string, string> = {};\n const seen: Record<string, true> = {};\n\n sources.forEach((path: unknown) => {\n if (typeof path !== 'string') {\n return;\n }\n\n let dir = path; // included source file path\n let candidate: Package | null = null;\n\n /** Traverse directories upward in the search of all package.json files */\n const upDirSearch = (): void => {\n const parentDir = dir;\n dir = dirname(parentDir);\n\n if (normalizedModulesPaths.includes(resolve(dir))) {\n if (candidate?.name && candidate?.version) {\n infos[candidate.name] = candidate.version;\n } else if (candidate?.name) {\n infos[candidate.name] = 'unknown';\n }\n return;\n }\n\n if (!dir || parentDir === dir || seen[dir]) {\n return;\n }\n seen[dir] = true;\n\n const pkgPath = join(dir, 'package.json');\n if (!existsSync(pkgPath)) {\n // fast-forward if the package.json doesn't exist\n return upDirSearch();\n }\n\n try {\n const info: Package = JSON.parse(readFileSync(pkgPath, 'utf8'));\n candidate = {\n name: info.name,\n version: info.version,\n };\n } catch (error) {\n debug.error(`Failed to read ${pkgPath}`);\n }\n\n return upDirSearch(); // processed package.json file, continue up search\n };\n\n upDirSearch();\n });\n\n return infos;\n }\n\n /**\n * Runs collection of modules.\n */\n public static run({\n sourceMapPath,\n outputModulesPath,\n modulesPaths,\n collect,\n }: Partial<{\n sourceMapPath: string;\n outputModulesPath: string;\n modulesPaths: string[];\n collect: (sources: unknown[], modulesPaths: string[]) => Record<string, string>;\n }>): void {\n if (!sourceMapPath) {\n debug.error('First argument `source-map-path` is missing!');\n return;\n }\n if (!outputModulesPath) {\n debug.error('Second argument `modules-output-path` is missing!');\n return;\n }\n if (!modulesPaths || modulesPaths.length === 0) {\n debug.error('Third argument `modules-paths` is missing!');\n return;\n }\n\n debug.log('Reading source map from', sourceMapPath);\n debug.log('Saving modules to', outputModulesPath);\n debug.log('Resolving modules from paths', modulesPaths.join(', '));\n\n if (!existsSync(sourceMapPath)) {\n debug.error(`Source map file does not exist at ${sourceMapPath}`);\n return;\n }\n for (const modulesPath of modulesPaths) {\n if (!existsSync(modulesPath)) {\n debug.error(`Modules path does not exist at ${modulesPath}`);\n return;\n }\n }\n\n const map: { sources?: unknown } = JSON.parse(readFileSync(sourceMapPath, 'utf8'));\n if (!map.sources || !Array.isArray(map.sources)) {\n debug.error(`Modules not collected. No sources found in the source map (${sourceMapPath})!`);\n return;\n }\n\n const sources: unknown[] = map.sources;\n const modules = collect ? collect(sources, modulesPaths) : ModulesCollector.collect(sources, modulesPaths);\n\n const outputModulesDirPath = dirname(outputModulesPath);\n if (!existsSync(outputModulesDirPath)) {\n mkdirSync(outputModulesDirPath, { recursive: true });\n }\n writeFileSync(outputModulesPath, JSON.stringify(modules, null, 2));\n debug.log(`Modules collected and saved to: ${outputModulesPath}`);\n }\n}\n"]}
@@ -20,7 +20,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
20
20
  });
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.captureEASBuildComplete = exports.captureEASBuildSuccess = exports.captureEASBuildError = exports.getEASBuildEnv = exports.isEASBuild = void 0;
23
+ exports.isEASBuild = isEASBuild;
24
+ exports.getEASBuildEnv = getEASBuildEnv;
25
+ exports.captureEASBuildError = captureEASBuildError;
26
+ exports.captureEASBuildSuccess = captureEASBuildSuccess;
27
+ exports.captureEASBuildComplete = captureEASBuildComplete;
24
28
  const core_1 = require("@sentry/core");
25
29
  const version_1 = require("../version");
26
30
  const SENTRY_DSN_ENV = 'SENTRY_DSN';
@@ -29,7 +33,6 @@ const EAS_BUILD_ENV = 'EAS_BUILD';
29
33
  function isEASBuild() {
30
34
  return process.env[EAS_BUILD_ENV] === 'true';
31
35
  }
32
- exports.isEASBuild = isEASBuild;
33
36
  /** Gets the EAS build environment variables. */
34
37
  function getEASBuildEnv() {
35
38
  return {
@@ -47,7 +50,6 @@ function getEASBuildEnv() {
47
50
  EAS_BUILD_WORKINGDIR: process.env.EAS_BUILD_WORKINGDIR,
48
51
  };
49
52
  }
50
- exports.getEASBuildEnv = getEASBuildEnv;
51
53
  function getEnvelopeEndpoint(dsn) {
52
54
  const { protocol, host, port, path, projectId, publicKey } = dsn;
53
55
  const portStr = port ? `:${port}` : '';
@@ -145,9 +147,9 @@ function createBaseEvent(level, env, customTags) {
145
147
  };
146
148
  }
147
149
  /** Captures an EAS build error event. Call this from the eas-build-on-error hook. */
148
- function captureEASBuildError(options = {}) {
149
- var _a, _b, _c, _d, _e, _f;
150
- return __awaiter(this, void 0, void 0, function* () {
150
+ function captureEASBuildError() {
151
+ return __awaiter(this, arguments, void 0, function* (options = {}) {
152
+ var _a, _b, _c, _d, _e, _f;
151
153
  const dsnString = (_a = options.dsn) !== null && _a !== void 0 ? _a : process.env[SENTRY_DSN_ENV];
152
154
  if (!dsnString) {
153
155
  console.warn('[Sentry] No DSN provided. Set SENTRY_DSN environment variable or pass dsn option.');
@@ -174,11 +176,10 @@ function captureEASBuildError(options = {}) {
174
176
  console.log('[Sentry] Build error captured.');
175
177
  });
176
178
  }
177
- exports.captureEASBuildError = captureEASBuildError;
178
179
  /** Captures an EAS build success event. Call this from the eas-build-on-success hook. */
179
- function captureEASBuildSuccess(options = {}) {
180
- var _a, _b, _c, _d, _e, _f;
181
- return __awaiter(this, void 0, void 0, function* () {
180
+ function captureEASBuildSuccess() {
181
+ return __awaiter(this, arguments, void 0, function* (options = {}) {
182
+ var _a, _b, _c, _d, _e, _f;
182
183
  if (!options.captureSuccessfulBuilds) {
183
184
  console.log('[Sentry] Skipping successful build capture (captureSuccessfulBuilds is false).');
184
185
  return;
@@ -207,10 +208,9 @@ function captureEASBuildSuccess(options = {}) {
207
208
  console.log('[Sentry] Build success captured.');
208
209
  });
209
210
  }
210
- exports.captureEASBuildSuccess = captureEASBuildSuccess;
211
211
  /** Captures an EAS build completion event with status. Call this from the eas-build-on-complete hook. */
212
- function captureEASBuildComplete(options = {}) {
213
- return __awaiter(this, void 0, void 0, function* () {
212
+ function captureEASBuildComplete() {
213
+ return __awaiter(this, arguments, void 0, function* (options = {}) {
214
214
  const env = getEASBuildEnv();
215
215
  const status = env.EAS_BUILD_STATUS;
216
216
  if (status === 'errored') {
@@ -224,5 +224,4 @@ function captureEASBuildComplete(options = {}) {
224
224
  console.log(`[Sentry] Build completed with status: ${status !== null && status !== void 0 ? status : 'unknown'}. No event captured.`);
225
225
  });
226
226
  }
227
- exports.captureEASBuildComplete = captureEASBuildComplete;
228
227
  //# sourceMappingURL=easBuildHooks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"easBuildHooks.js","sourceRoot":"","sources":["../../../src/js/tools/easBuildHooks.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;AAKH,uCAA2D;AAC3D,wCAAyC;AAEzC,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC,MAAM,aAAa,GAAG,WAAW,CAAC;AAgDlC,yDAAyD;AACzD,SAAgB,UAAU;IACxB,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,MAAM,CAAC;AAC/C,CAAC;AAFD,gCAEC;AAED,gDAAgD;AAChD,SAAgB,cAAc;IAC5B,OAAO;QACL,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS;QAChC,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY;QACtC,kBAAkB,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB;QAClD,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;QAChD,oBAAoB,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB;QACtD,yBAAyB,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB;QAChE,qBAAqB,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB;QACxD,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;QAC9C,qBAAqB,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB;QACxD,2BAA2B,EAAE,OAAO,CAAC,GAAG,CAAC,2BAA2B;QACpE,kBAAkB,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB;QAClD,oBAAoB,EAAE,OAAO,CAAC,GAAG,CAAC,o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,GAAG,CAAC;QACxG,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,EAAE,GAAG,kCAAO,OAAO,CAAC,IAAI,KAAE,UAAU,EAAE,YAAY,IAAG,CAAC;QAC1F,KAAK,CAAC,OAAO,GAAG,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;QAC9C,KAAK,CAAC,WAAW,GAAG,CAAC,mBAAmB,EAAE,MAAA,GAAG,CAAC,kBAAkB,mCAAI,SAAS,EAAE,MAAA,GAAG,CAAC,iBAAiB,mCAAI,SAAS,CAAC,CAAC;QACnH,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC5C,IAAI,OAAO;YAAE,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;;CAC9D;AA5BD,wDA4BC;AAED,yGAAyG;AACzG,SAAsB,uBAAuB,CAAC,UAA+B,EAAE;;QAC7E,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,GAAG,CAAC,gBAAgB,CAAC;QACpC,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAC;YACpC,OAAO;SACR;QACD,IAAI,MAAM,KAAK,UAAU,IAAI,OAAO,CAAC,uBAAuB,EAAE;YAC5D,MAAM,sBAAsB,iCAAM,OAAO,KAAE,uBAAuB,EAAE,IAAI,IAAG,CAAC;YAC5E,OAAO;SACR;QACD,OAAO,CAAC,GAAG,CAAC,yCAAyC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,SAAS,sBAAsB,CAAC,CAAC;IAClG,CAAC;CAAA;AAZD,0DAYC","sourcesContent":["/**\n * EAS Build Hooks for Sentry\n *\n * This module provides utilities for capturing EAS build lifecycle events\n * and sending them to Sentry. It supports the following EAS npm hooks:\n * - eas-build-on-error: Captures build failures\n * - eas-build-on-success: Captures successful builds (optional)\n * - eas-build-on-complete: Captures build completion with metrics\n *\n * @see https://docs.expo.dev/build-reference/npm-hooks/\n */\n\n/* eslint-disable no-console */\n\nimport type { DsnComponents } from '@sentry/core';\nimport { dsnToString, makeDsn, uuid4 } from '@sentry/core';\nimport { SDK_VERSION } from '../version';\n\nconst SENTRY_DSN_ENV = 'SENTRY_DSN';\nconst EAS_BUILD_ENV = 'EAS_BUILD';\n\n/**\n * Environment variables provided by EAS Build.\n * @see https://docs.expo.dev/build-reference/variables/\n */\nexport interface EASBuildEnv {\n EAS_BUILD?: string;\n EAS_BUILD_ID?: string;\n EAS_BUILD_PLATFORM?: string;\n EAS_BUILD_PROFILE?: string;\n EAS_BUILD_PROJECT_ID?: string;\n EAS_BUILD_GIT_COMMIT_HASH?: string;\n EAS_BUILD_RUN_FROM_CI?: string;\n EAS_BUILD_STATUS?: string;\n EAS_BUILD_APP_VERSION?: string;\n EAS_BUILD_APP_BUILD_VERSION?: string;\n EAS_BUILD_USERNAME?: string;\n EAS_BUILD_WORKINGDIR?: string;\n}\n\n/** Options for configuring EAS build hook behavior. */\nexport interface EASBuildHookOptions {\n dsn?: string;\n tags?: Record<string, string>;\n captureSuccessfulBuilds?: boolean;\n errorMessage?: string;\n successMessage?: string;\n}\n\ninterface SentryEvent {\n event_id: string;\n timestamp: number;\n platform: string;\n level: 'error' | 'info' | 'warning';\n logger: string;\n environment: string;\n release?: string;\n tags: Record<string, string>;\n contexts: Record<string, Record<string, unknown>>;\n message?: { formatted: string };\n exception?: {\n values: Array<{ type: string; value: string; mechanism: { type: string; handled: boolean } }>;\n };\n fingerprint?: string[];\n sdk: { name: string; version: string };\n}\n\n/** Checks if the current environment is an EAS Build. */\nexport function isEASBuild(): boolean {\n return process.env[EAS_BUILD_ENV] === 'true';\n}\n\n/** Gets the EAS build environment variables. */\nexport function getEASBuildEnv(): EASBuildEnv {\n return {\n EAS_BUILD: process.env.EAS_BUILD,\n EAS_BUILD_ID: process.env.EAS_BUILD_ID,\n EAS_BUILD_PLATFORM: process.env.EAS_BUILD_PLATFORM,\n EAS_BUILD_PROFILE: process.env.EAS_BUILD_PROFILE,\n EAS_BUILD_PROJECT_ID: process.env.EAS_BUILD_PROJECT_ID,\n EAS_BUILD_GIT_COMMIT_HASH: process.env.EAS_BUILD_GIT_COMMIT_HASH,\n EAS_BUILD_RUN_FROM_CI: process.env.EAS_BUILD_RUN_FROM_CI,\n EAS_BUILD_STATUS: process.env.EAS_BUILD_STATUS,\n EAS_BUILD_APP_VERSION: process.env.EAS_BUILD_APP_VERSION,\n EAS_BUILD_APP_BUILD_VERSION: process.env.EAS_BUILD_APP_BUILD_VERSION,\n EAS_BUILD_USERNAME: process.env.EAS_BUILD_USERNAME,\n EAS_BUILD_WORKINGDIR: process.env.EAS_BUILD_WORKINGDIR,\n };\n}\n\nfunction getEnvelopeEndpoint(dsn: DsnComponents): string {\n const { protocol, host, port, path, projectId, publicKey } = dsn;\n const portStr = port ? `:${port}` : '';\n const pathStr = path ? `/${path}` : '';\n return `${protocol}://${host}${portStr}${pathStr}/api/${projectId}/envelope/?sentry_key=${publicKey}&sentry_version=7`;\n}\n\nfunction createEASBuildTags(env: EASBuildEnv): Record<string, string> {\n const tags: Record<string, string> = {};\n if (env.EAS_BUILD_PLATFORM) tags['eas.platform'] = env.EAS_BUILD_PLATFORM;\n if (env.EAS_BUILD_PROFILE) tags['eas.profile'] = env.EAS_BUILD_PROFILE;\n if (env.EAS_BUILD_ID) tags['eas.build_id'] = env.EAS_BUILD_ID;\n if (env.EAS_BUILD_PROJECT_ID) tags['eas.project_id'] = env.EAS_BUILD_PROJECT_ID;\n if (env.EAS_BUILD_RUN_FROM_CI) tags['eas.from_ci'] = env.EAS_BUILD_RUN_FROM_CI;\n if (env.EAS_BUILD_STATUS) tags['eas.status'] = env.EAS_BUILD_STATUS;\n if (env.EAS_BUILD_USERNAME) tags['eas.username'] = env.EAS_BUILD_USERNAME;\n return tags;\n}\n\nfunction createEASBuildContext(env: EASBuildEnv): Record<string, unknown> {\n return {\n build_id: env.EAS_BUILD_ID,\n platform: env.EAS_BUILD_PLATFORM,\n profile: env.EAS_BUILD_PROFILE,\n project_id: env.EAS_BUILD_PROJECT_ID,\n git_commit: env.EAS_BUILD_GIT_COMMIT_HASH,\n from_ci: env.EAS_BUILD_RUN_FROM_CI === 'true',\n status: env.EAS_BUILD_STATUS,\n app_version: env.EAS_BUILD_APP_VERSION,\n build_version: env.EAS_BUILD_APP_BUILD_VERSION,\n username: env.EAS_BUILD_USERNAME,\n working_dir: env.EAS_BUILD_WORKINGDIR,\n };\n}\n\nfunction createEnvelope(event: SentryEvent, dsn: DsnComponents): string {\n const envelopeHeaders = JSON.stringify({\n event_id: event.event_id,\n sent_at: new Date().toISOString(),\n dsn: dsnToString(dsn),\n sdk: event.sdk,\n });\n const itemHeaders = JSON.stringify({ type: 'event', content_type: 'application/json' });\n const itemPayload = JSON.stringify(event);\n return `${envelopeHeaders}\\n${itemHeaders}\\n${itemPayload}`;\n}\n\nasync function sendEvent(event: SentryEvent, dsn: DsnComponents): Promise<boolean> {\n const endpoint = getEnvelopeEndpoint(dsn);\n const envelope = createEnvelope(event, dsn);\n try {\n const response = await fetch(endpoint, {\n method: 'POST',\n headers: { 'Content-Type': 'application/x-sentry-envelope' },\n body: envelope,\n });\n if (response.status >= 200 && response.status < 300) return true;\n console.warn(`[Sentry] Failed to send event: HTTP ${response.status}`);\n return false;\n } catch (error) {\n console.error('[Sentry] Failed to send event:', error);\n return false;\n }\n}\n\nfunction getReleaseFromEASEnv(env: EASBuildEnv): string | undefined {\n // Honour explicit override first\n if (process.env.SENTRY_RELEASE) {\n return process.env.SENTRY_RELEASE;\n }\n // Best approximation without bundle identifier: version+buildNumber\n if (env.EAS_BUILD_APP_VERSION && env.EAS_BUILD_APP_BUILD_VERSION) {\n return `${env.EAS_BUILD_APP_VERSION}+${env.EAS_BUILD_APP_BUILD_VERSION}`;\n }\n return env.EAS_BUILD_APP_VERSION;\n}\n\nfunction createBaseEvent(\n level: 'error' | 'info' | 'warning',\n env: EASBuildEnv,\n customTags?: Record<string, string>,\n): SentryEvent {\n return {\n event_id: uuid4(),\n timestamp: Date.now() / 1000,\n platform: 'node',\n level,\n logger: 'eas-build-hook',\n environment: 'eas-build',\n release: getReleaseFromEASEnv(env),\n tags: { ...createEASBuildTags(env), ...customTags },\n contexts: { eas_build: createEASBuildContext(env), runtime: { name: 'node', version: process.version } },\n sdk: { name: 'sentry.javascript.react-native.eas-build-hooks', version: SDK_VERSION },\n };\n}\n\n/** Captures an EAS build error event. Call this from the eas-build-on-error hook. */\nexport async function captureEASBuildError(options: EASBuildHookOptions = {}): Promise<void> {\n const dsnString = options.dsn ?? process.env[SENTRY_DSN_ENV];\n if (!dsnString) {\n console.warn('[Sentry] No DSN provided. Set SENTRY_DSN environment variable or pass dsn option.');\n return;\n }\n if (!isEASBuild()) {\n console.warn('[Sentry] Not running in EAS Build environment. Skipping error capture.');\n return;\n }\n const dsn = makeDsn(dsnString);\n if (!dsn) {\n console.error('[Sentry] Invalid DSN format.');\n return;\n }\n const env = getEASBuildEnv();\n const errorMessage =\n options.errorMessage ??\n `EAS Build Failed: ${env.EAS_BUILD_PLATFORM ?? 'unknown'} (${env.EAS_BUILD_PROFILE ?? 'unknown'})`;\n const event = createBaseEvent('error', env, { ...options.tags, 'eas.hook': 'on-error' });\n event.exception = {\n values: [{ type: 'EASBuildError', value: errorMessage, mechanism: { type: 'eas-build-hook', handled: true } }],\n };\n event.fingerprint = ['eas-build-error', env.EAS_BUILD_PLATFORM ?? 'unknown', env.EAS_BUILD_PROFILE ?? 'unknown'];\n const success = await sendEvent(event, dsn);\n if (success) console.log('[Sentry] Build error captured.');\n}\n\n/** Captures an EAS build success event. Call this from the eas-build-on-success hook. */\nexport async function captureEASBuildSuccess(options: EASBuildHookOptions = {}): Promise<void> {\n if (!options.captureSuccessfulBuilds) {\n console.log('[Sentry] Skipping successful build capture (captureSuccessfulBuilds is false).');\n return;\n }\n const dsnString = options.dsn ?? process.env[SENTRY_DSN_ENV];\n if (!dsnString) {\n console.warn('[Sentry] No DSN provided. Set SENTRY_DSN environment variable or pass dsn option.');\n return;\n }\n if (!isEASBuild()) {\n console.warn('[Sentry] Not running in EAS Build environment. Skipping success capture.');\n return;\n }\n const dsn = makeDsn(dsnString);\n if (!dsn) {\n console.error('[Sentry] Invalid DSN format.');\n return;\n }\n const env = getEASBuildEnv();\n const successMessage =\n options.successMessage ??\n `EAS Build Succeeded: ${env.EAS_BUILD_PLATFORM ?? 'unknown'} (${env.EAS_BUILD_PROFILE ?? 'unknown'})`;\n const event = createBaseEvent('info', env, { ...options.tags, 'eas.hook': 'on-success' });\n event.message = { formatted: successMessage };\n event.fingerprint = ['eas-build-success', env.EAS_BUILD_PLATFORM ?? 'unknown', env.EAS_BUILD_PROFILE ?? 'unknown'];\n const success = await sendEvent(event, dsn);\n if (success) console.log('[Sentry] Build success captured.');\n}\n\n/** Captures an EAS build completion event with status. Call this from the eas-build-on-complete hook. */\nexport async function captureEASBuildComplete(options: EASBuildHookOptions = {}): Promise<void> {\n const env = getEASBuildEnv();\n const status = env.EAS_BUILD_STATUS;\n if (status === 'errored') {\n await captureEASBuildError(options);\n return;\n }\n if (status === 'finished' && options.captureSuccessfulBuilds) {\n await captureEASBuildSuccess({ ...options, captureSuccessfulBuilds: true });\n return;\n }\n console.log(`[Sentry] Build completed with status: ${status ?? 'unknown'}. No event captured.`);\n}\n"]}
1
+ {"version":3,"file":"easBuildHooks.js","sourceRoot":"","sources":["../../../src/js/tools/easBuildHooks.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;AA0DH,gCAEC;AAGD,wCAeC;AAmGD,oDA0BC;AAGD,wDA4BC;AAGD,0DAYC;AApPD,uCAA2D;AAC3D,wCAAyC;AAEzC,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC,MAAM,aAAa,GAAG,WAAW,CAAC;AAgDlC,yDAAyD;AACzD,SAAgB,UAAU;IACxB,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,MAAM,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O;YAAE,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IAC/D,CAAC;CAAA;AAED,yGAAyG;AACzG,SAAsB,uBAAuB;yDAAC,UAA+B,EAAE;QAC7E,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,GAAG,CAAC,gBAAgB,CAAC;QACpC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAC;YACpC,OAAO;QACT,CAAC;QACD,IAAI,MAAM,KAAK,UAAU,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;YAC7D,MAAM,sBAAsB,iCAAM,OAAO,KAAE,uBAAuB,EAAE,IAAI,IAAG,CAAC;YAC5E,OAAO;QACT,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,yCAAyC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,SAAS,sBAAsB,CAAC,CAAC;IAClG,CAAC;CAAA","sourcesContent":["/**\n * EAS Build Hooks for Sentry\n *\n * This module provides utilities for capturing EAS build lifecycle events\n * and sending them to Sentry. It supports the following EAS npm hooks:\n * - eas-build-on-error: Captures build failures\n * - eas-build-on-success: Captures successful builds (optional)\n * - eas-build-on-complete: Captures build completion with metrics\n *\n * @see https://docs.expo.dev/build-reference/npm-hooks/\n */\n\n/* eslint-disable no-console */\n\nimport type { DsnComponents } from '@sentry/core';\nimport { dsnToString, makeDsn, uuid4 } from '@sentry/core';\nimport { SDK_VERSION } from '../version';\n\nconst SENTRY_DSN_ENV = 'SENTRY_DSN';\nconst EAS_BUILD_ENV = 'EAS_BUILD';\n\n/**\n * Environment variables provided by EAS Build.\n * @see https://docs.expo.dev/build-reference/variables/\n */\nexport interface EASBuildEnv {\n EAS_BUILD?: string;\n EAS_BUILD_ID?: string;\n EAS_BUILD_PLATFORM?: string;\n EAS_BUILD_PROFILE?: string;\n EAS_BUILD_PROJECT_ID?: string;\n EAS_BUILD_GIT_COMMIT_HASH?: string;\n EAS_BUILD_RUN_FROM_CI?: string;\n EAS_BUILD_STATUS?: string;\n EAS_BUILD_APP_VERSION?: string;\n EAS_BUILD_APP_BUILD_VERSION?: string;\n EAS_BUILD_USERNAME?: string;\n EAS_BUILD_WORKINGDIR?: string;\n}\n\n/** Options for configuring EAS build hook behavior. */\nexport interface EASBuildHookOptions {\n dsn?: string;\n tags?: Record<string, string>;\n captureSuccessfulBuilds?: boolean;\n errorMessage?: string;\n successMessage?: string;\n}\n\ninterface SentryEvent {\n event_id: string;\n timestamp: number;\n platform: string;\n level: 'error' | 'info' | 'warning';\n logger: string;\n environment: string;\n release?: string;\n tags: Record<string, string>;\n contexts: Record<string, Record<string, unknown>>;\n message?: { formatted: string };\n exception?: {\n values: Array<{ type: string; value: string; mechanism: { type: string; handled: boolean } }>;\n };\n fingerprint?: string[];\n sdk: { name: string; version: string };\n}\n\n/** Checks if the current environment is an EAS Build. */\nexport function isEASBuild(): boolean {\n return process.env[EAS_BUILD_ENV] === 'true';\n}\n\n/** Gets the EAS build environment variables. */\nexport function getEASBuildEnv(): EASBuildEnv {\n return {\n EAS_BUILD: process.env.EAS_BUILD,\n EAS_BUILD_ID: process.env.EAS_BUILD_ID,\n EAS_BUILD_PLATFORM: process.env.EAS_BUILD_PLATFORM,\n EAS_BUILD_PROFILE: process.env.EAS_BUILD_PROFILE,\n EAS_BUILD_PROJECT_ID: process.env.EAS_BUILD_PROJECT_ID,\n EAS_BUILD_GIT_COMMIT_HASH: process.env.EAS_BUILD_GIT_COMMIT_HASH,\n EAS_BUILD_RUN_FROM_CI: process.env.EAS_BUILD_RUN_FROM_CI,\n EAS_BUILD_STATUS: process.env.EAS_BUILD_STATUS,\n EAS_BUILD_APP_VERSION: process.env.EAS_BUILD_APP_VERSION,\n EAS_BUILD_APP_BUILD_VERSION: process.env.EAS_BUILD_APP_BUILD_VERSION,\n EAS_BUILD_USERNAME: process.env.EAS_BUILD_USERNAME,\n EAS_BUILD_WORKINGDIR: process.env.EAS_BUILD_WORKINGDIR,\n };\n}\n\nfunction getEnvelopeEndpoint(dsn: DsnComponents): string {\n const { protocol, host, port, path, projectId, publicKey } = dsn;\n const portStr = port ? `:${port}` : '';\n const pathStr = path ? `/${path}` : '';\n return `${protocol}://${host}${portStr}${pathStr}/api/${projectId}/envelope/?sentry_key=${publicKey}&sentry_version=7`;\n}\n\nfunction createEASBuildTags(env: EASBuildEnv): Record<string, string> {\n const tags: Record<string, string> = {};\n if (env.EAS_BUILD_PLATFORM) tags['eas.platform'] = env.EAS_BUILD_PLATFORM;\n if (env.EAS_BUILD_PROFILE) tags['eas.profile'] = env.EAS_BUILD_PROFILE;\n if (env.EAS_BUILD_ID) tags['eas.build_id'] = env.EAS_BUILD_ID;\n if (env.EAS_BUILD_PROJECT_ID) tags['eas.project_id'] = env.EAS_BUILD_PROJECT_ID;\n if (env.EAS_BUILD_RUN_FROM_CI) tags['eas.from_ci'] = env.EAS_BUILD_RUN_FROM_CI;\n if (env.EAS_BUILD_STATUS) tags['eas.status'] = env.EAS_BUILD_STATUS;\n if (env.EAS_BUILD_USERNAME) tags['eas.username'] = env.EAS_BUILD_USERNAME;\n return tags;\n}\n\nfunction createEASBuildContext(env: EASBuildEnv): Record<string, unknown> {\n return {\n build_id: env.EAS_BUILD_ID,\n platform: env.EAS_BUILD_PLATFORM,\n profile: env.EAS_BUILD_PROFILE,\n project_id: env.EAS_BUILD_PROJECT_ID,\n git_commit: env.EAS_BUILD_GIT_COMMIT_HASH,\n from_ci: env.EAS_BUILD_RUN_FROM_CI === 'true',\n status: env.EAS_BUILD_STATUS,\n app_version: env.EAS_BUILD_APP_VERSION,\n build_version: env.EAS_BUILD_APP_BUILD_VERSION,\n username: env.EAS_BUILD_USERNAME,\n working_dir: env.EAS_BUILD_WORKINGDIR,\n };\n}\n\nfunction createEnvelope(event: SentryEvent, dsn: DsnComponents): string {\n const envelopeHeaders = JSON.stringify({\n event_id: event.event_id,\n sent_at: new Date().toISOString(),\n dsn: dsnToString(dsn),\n sdk: event.sdk,\n });\n const itemHeaders = JSON.stringify({ type: 'event', content_type: 'application/json' });\n const itemPayload = JSON.stringify(event);\n return `${envelopeHeaders}\\n${itemHeaders}\\n${itemPayload}`;\n}\n\nasync function sendEvent(event: SentryEvent, dsn: DsnComponents): Promise<boolean> {\n const endpoint = getEnvelopeEndpoint(dsn);\n const envelope = createEnvelope(event, dsn);\n try {\n const response = await fetch(endpoint, {\n method: 'POST',\n headers: { 'Content-Type': 'application/x-sentry-envelope' },\n body: envelope,\n });\n if (response.status >= 200 && response.status < 300) return true;\n console.warn(`[Sentry] Failed to send event: HTTP ${response.status}`);\n return false;\n } catch (error) {\n console.error('[Sentry] Failed to send event:', error);\n return false;\n }\n}\n\nfunction getReleaseFromEASEnv(env: EASBuildEnv): string | undefined {\n // Honour explicit override first\n if (process.env.SENTRY_RELEASE) {\n return process.env.SENTRY_RELEASE;\n }\n // Best approximation without bundle identifier: version+buildNumber\n if (env.EAS_BUILD_APP_VERSION && env.EAS_BUILD_APP_BUILD_VERSION) {\n return `${env.EAS_BUILD_APP_VERSION}+${env.EAS_BUILD_APP_BUILD_VERSION}`;\n }\n return env.EAS_BUILD_APP_VERSION;\n}\n\nfunction createBaseEvent(\n level: 'error' | 'info' | 'warning',\n env: EASBuildEnv,\n customTags?: Record<string, string>,\n): SentryEvent {\n return {\n event_id: uuid4(),\n timestamp: Date.now() / 1000,\n platform: 'node',\n level,\n logger: 'eas-build-hook',\n environment: 'eas-build',\n release: getReleaseFromEASEnv(env),\n tags: { ...createEASBuildTags(env), ...customTags },\n contexts: { eas_build: createEASBuildContext(env), runtime: { name: 'node', version: process.version } },\n sdk: { name: 'sentry.javascript.react-native.eas-build-hooks', version: SDK_VERSION },\n };\n}\n\n/** Captures an EAS build error event. Call this from the eas-build-on-error hook. */\nexport async function captureEASBuildError(options: EASBuildHookOptions = {}): Promise<void> {\n const dsnString = options.dsn ?? process.env[SENTRY_DSN_ENV];\n if (!dsnString) {\n console.warn('[Sentry] No DSN provided. Set SENTRY_DSN environment variable or pass dsn option.');\n return;\n }\n if (!isEASBuild()) {\n console.warn('[Sentry] Not running in EAS Build environment. Skipping error capture.');\n return;\n }\n const dsn = makeDsn(dsnString);\n if (!dsn) {\n console.error('[Sentry] Invalid DSN format.');\n return;\n }\n const env = getEASBuildEnv();\n const errorMessage =\n options.errorMessage ??\n `EAS Build Failed: ${env.EAS_BUILD_PLATFORM ?? 'unknown'} (${env.EAS_BUILD_PROFILE ?? 'unknown'})`;\n const event = createBaseEvent('error', env, { ...options.tags, 'eas.hook': 'on-error' });\n event.exception = {\n values: [{ type: 'EASBuildError', value: errorMessage, mechanism: { type: 'eas-build-hook', handled: true } }],\n };\n event.fingerprint = ['eas-build-error', env.EAS_BUILD_PLATFORM ?? 'unknown', env.EAS_BUILD_PROFILE ?? 'unknown'];\n const success = await sendEvent(event, dsn);\n if (success) console.log('[Sentry] Build error captured.');\n}\n\n/** Captures an EAS build success event. Call this from the eas-build-on-success hook. */\nexport async function captureEASBuildSuccess(options: EASBuildHookOptions = {}): Promise<void> {\n if (!options.captureSuccessfulBuilds) {\n console.log('[Sentry] Skipping successful build capture (captureSuccessfulBuilds is false).');\n return;\n }\n const dsnString = options.dsn ?? process.env[SENTRY_DSN_ENV];\n if (!dsnString) {\n console.warn('[Sentry] No DSN provided. Set SENTRY_DSN environment variable or pass dsn option.');\n return;\n }\n if (!isEASBuild()) {\n console.warn('[Sentry] Not running in EAS Build environment. Skipping success capture.');\n return;\n }\n const dsn = makeDsn(dsnString);\n if (!dsn) {\n console.error('[Sentry] Invalid DSN format.');\n return;\n }\n const env = getEASBuildEnv();\n const successMessage =\n options.successMessage ??\n `EAS Build Succeeded: ${env.EAS_BUILD_PLATFORM ?? 'unknown'} (${env.EAS_BUILD_PROFILE ?? 'unknown'})`;\n const event = createBaseEvent('info', env, { ...options.tags, 'eas.hook': 'on-success' });\n event.message = { formatted: successMessage };\n event.fingerprint = ['eas-build-success', env.EAS_BUILD_PLATFORM ?? 'unknown', env.EAS_BUILD_PROFILE ?? 'unknown'];\n const success = await sendEvent(event, dsn);\n if (success) console.log('[Sentry] Build success captured.');\n}\n\n/** Captures an EAS build completion event with status. Call this from the eas-build-on-complete hook. */\nexport async function captureEASBuildComplete(options: EASBuildHookOptions = {}): Promise<void> {\n const env = getEASBuildEnv();\n const status = env.EAS_BUILD_STATUS;\n if (status === 'errored') {\n await captureEASBuildError(options);\n return;\n }\n if (status === 'finished' && options.captureSuccessfulBuilds) {\n await captureEASBuildSuccess({ ...options, captureSuccessfulBuilds: true });\n return;\n }\n console.log(`[Sentry] Build completed with status: ${status ?? 'unknown'}. No event captured.`);\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.enableLogger = void 0;
3
+ exports.enableLogger = enableLogger;
4
4
  const core_1 = require("@sentry/core");
5
5
  /**
6
6
  * Enables debug logger when SENTRY_LOG_LEVEL=debug.
@@ -10,5 +10,4 @@ function enableLogger() {
10
10
  core_1.debug.enable();
11
11
  }
12
12
  }
13
- exports.enableLogger = enableLogger;
14
13
  //# sourceMappingURL=enableLogger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"enableLogger.js","sourceRoot":"","sources":["../../../src/js/tools/enableLogger.ts"],"names":[],"mappings":";;;AAAA,uCAAqC;AAErC;;GAEG;AACH,SAAgB,YAAY;IAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,KAAK,OAAO,EAAE;QAC5C,YAAK,CAAC,MAAM,EAAE,CAAC;KAChB;AACH,CAAC;AAJD,oCAIC","sourcesContent":["import { debug } from '@sentry/core';\n\n/**\n * Enables debug logger when SENTRY_LOG_LEVEL=debug.\n */\nexport function enableLogger(): void {\n if (process.env.SENTRY_LOG_LEVEL === 'debug') {\n debug.enable();\n }\n}\n"]}
1
+ {"version":3,"file":"enableLogger.js","sourceRoot":"","sources":["../../../src/js/tools/enableLogger.ts"],"names":[],"mappings":";;AAKA,oCAIC;AATD,uCAAqC;AAErC;;GAEG;AACH,SAAgB,YAAY;IAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,KAAK,OAAO,EAAE,CAAC;QAC7C,YAAK,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC;AACH,CAAC","sourcesContent":["import { debug } from '@sentry/core';\n\n/**\n * Enables debug logger when SENTRY_LOG_LEVEL=debug.\n */\nexport function enableLogger(): void {\n if (process.env.SENTRY_LOG_LEVEL === 'debug') {\n debug.enable();\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"metroMiddleware.d.ts","sourceRoot":"","sources":["../../../src/js/tools/metroMiddleware.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK7D;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,UAgC1C,CAAC;AA2CF;;GAEG;AACH,eAAO,MAAM,2BAA2B,eAAgB,UAAU,KAAG,UAWpE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,WAAY,YAAY,KAAG,YAY3D,CAAC"}
1
+ {"version":3,"file":"metroMiddleware.d.ts","sourceRoot":"","sources":["../../../src/js/tools/metroMiddleware.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK7D;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,UAgC1C,CAAC;AA2CF;;GAEG;AACH,eAAO,MAAM,2BAA2B,GAAI,YAAY,UAAU,KAAG,UAWpE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,YAAY,KAAG,YAY3D,CAAC"}