@sentry/react-native 6.15.0 → 7.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +11 -14
  3. package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
  4. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  5. package/dist/js/NativeRNSentry.js.map +1 -1
  6. package/dist/js/client.d.ts.map +1 -1
  7. package/dist/js/client.js +5 -1
  8. package/dist/js/client.js.map +1 -1
  9. package/dist/js/feedback/FeedbackButton.d.ts.map +1 -1
  10. package/dist/js/feedback/FeedbackButton.js +1 -1
  11. package/dist/js/feedback/FeedbackButton.js.map +1 -1
  12. package/dist/js/feedback/FeedbackWidget.d.ts +1 -1
  13. package/dist/js/feedback/FeedbackWidget.d.ts.map +1 -1
  14. package/dist/js/feedback/FeedbackWidget.js +60 -46
  15. package/dist/js/feedback/FeedbackWidget.js.map +1 -1
  16. package/dist/js/feedback/FeedbackWidget.styles.d.ts.map +1 -1
  17. package/dist/js/feedback/FeedbackWidget.styles.js.map +1 -1
  18. package/dist/js/feedback/FeedbackWidget.theme.d.ts.map +1 -1
  19. package/dist/js/feedback/FeedbackWidget.theme.js.map +1 -1
  20. package/dist/js/feedback/FeedbackWidget.types.d.ts +30 -30
  21. package/dist/js/feedback/FeedbackWidget.types.d.ts.map +1 -1
  22. package/dist/js/feedback/FeedbackWidget.types.js.map +1 -1
  23. package/dist/js/feedback/FeedbackWidgetManager.d.ts.map +1 -1
  24. package/dist/js/feedback/FeedbackWidgetManager.js +6 -3
  25. package/dist/js/feedback/FeedbackWidgetManager.js.map +1 -1
  26. package/dist/js/feedback/FeedbackWidgetProvider.d.ts.map +1 -1
  27. package/dist/js/feedback/FeedbackWidgetProvider.js +9 -10
  28. package/dist/js/feedback/FeedbackWidgetProvider.js.map +1 -1
  29. package/dist/js/feedback/ScreenshotButton.d.ts.map +1 -1
  30. package/dist/js/feedback/ScreenshotButton.js.map +1 -1
  31. package/dist/js/feedback/defaults.d.ts +1 -1
  32. package/dist/js/feedback/defaults.d.ts.map +1 -1
  33. package/dist/js/feedback/defaults.js.map +1 -1
  34. package/dist/js/feedback/integration.d.ts +1 -1
  35. package/dist/js/feedback/integration.d.ts.map +1 -1
  36. package/dist/js/feedback/integration.js +1 -1
  37. package/dist/js/feedback/integration.js.map +1 -1
  38. package/dist/js/feedback/lazy.d.ts.map +1 -1
  39. package/dist/js/feedback/lazy.js.map +1 -1
  40. package/dist/js/feedback/utils.d.ts.map +1 -1
  41. package/dist/js/feedback/utils.js +2 -2
  42. package/dist/js/feedback/utils.js.map +1 -1
  43. package/dist/js/index.d.ts +3 -3
  44. package/dist/js/index.d.ts.map +1 -1
  45. package/dist/js/index.js +2 -2
  46. package/dist/js/index.js.map +1 -1
  47. package/dist/js/integrations/appRegistry.d.ts.map +1 -1
  48. package/dist/js/integrations/appRegistry.js.map +1 -1
  49. package/dist/js/integrations/breadcrumbs.d.ts +47 -0
  50. package/dist/js/integrations/breadcrumbs.d.ts.map +1 -0
  51. package/dist/js/integrations/breadcrumbs.js +15 -0
  52. package/dist/js/integrations/breadcrumbs.js.map +1 -0
  53. package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
  54. package/dist/js/integrations/debugsymbolicator.js +2 -1
  55. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  56. package/dist/js/integrations/debugsymbolicatorutils.d.ts.map +1 -1
  57. package/dist/js/integrations/debugsymbolicatorutils.js +12 -2
  58. package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -1
  59. package/dist/js/integrations/default.d.ts.map +1 -1
  60. package/dist/js/integrations/default.js +9 -5
  61. package/dist/js/integrations/default.js.map +1 -1
  62. package/dist/js/integrations/devicecontext.d.ts.map +1 -1
  63. package/dist/js/integrations/devicecontext.js.map +1 -1
  64. package/dist/js/integrations/expocontext.d.ts.map +1 -1
  65. package/dist/js/integrations/expocontext.js.map +1 -1
  66. package/dist/js/integrations/exports.d.ts +2 -1
  67. package/dist/js/integrations/exports.d.ts.map +1 -1
  68. package/dist/js/integrations/exports.js +2 -1
  69. package/dist/js/integrations/exports.js.map +1 -1
  70. package/dist/js/integrations/modulesloader.d.ts.map +1 -1
  71. package/dist/js/integrations/modulesloader.js.map +1 -1
  72. package/dist/js/integrations/nativelinkederrors.d.ts.map +1 -1
  73. package/dist/js/integrations/nativelinkederrors.js +4 -3
  74. package/dist/js/integrations/nativelinkederrors.js.map +1 -1
  75. package/dist/js/integrations/reactnativeerrorhandlers.js +2 -1
  76. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  77. package/dist/js/integrations/reactnativeerrorhandlersutils.d.ts.map +1 -1
  78. package/dist/js/integrations/reactnativeerrorhandlersutils.js.map +1 -1
  79. package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
  80. package/dist/js/integrations/reactnativeinfo.js.map +1 -1
  81. package/dist/js/integrations/release.d.ts.map +1 -1
  82. package/dist/js/integrations/release.js.map +1 -1
  83. package/dist/js/integrations/rewriteframes.d.ts.map +1 -1
  84. package/dist/js/integrations/rewriteframes.js.map +1 -1
  85. package/dist/js/integrations/screenshot.d.ts.map +1 -1
  86. package/dist/js/integrations/screenshot.js +3 -3
  87. package/dist/js/integrations/screenshot.js.map +1 -1
  88. package/dist/js/integrations/sdkinfo.d.ts.map +1 -1
  89. package/dist/js/integrations/sdkinfo.js.map +1 -1
  90. package/dist/js/integrations/spotlight.d.ts.map +1 -1
  91. package/dist/js/integrations/spotlight.js +8 -4
  92. package/dist/js/integrations/spotlight.js.map +1 -1
  93. package/dist/js/integrations/viewhierarchy.d.ts.map +1 -1
  94. package/dist/js/integrations/viewhierarchy.js +2 -1
  95. package/dist/js/integrations/viewhierarchy.js.map +1 -1
  96. package/dist/js/options.d.ts +8 -1
  97. package/dist/js/options.d.ts.map +1 -1
  98. package/dist/js/options.js.map +1 -1
  99. package/dist/js/profiling/cache.d.ts +1 -1
  100. package/dist/js/profiling/convertHermesProfile.d.ts.map +1 -1
  101. package/dist/js/profiling/convertHermesProfile.js +18 -5
  102. package/dist/js/profiling/convertHermesProfile.js.map +1 -1
  103. package/dist/js/profiling/debugid.d.ts.map +1 -1
  104. package/dist/js/profiling/debugid.js +9 -1
  105. package/dist/js/profiling/debugid.js.map +1 -1
  106. package/dist/js/profiling/hermes.d.ts +1 -1
  107. package/dist/js/profiling/hermes.d.ts.map +1 -1
  108. package/dist/js/profiling/hermes.js.map +1 -1
  109. package/dist/js/profiling/integration.d.ts.map +1 -1
  110. package/dist/js/profiling/integration.js +2 -1
  111. package/dist/js/profiling/integration.js.map +1 -1
  112. package/dist/js/profiling/types.d.ts.map +1 -1
  113. package/dist/js/profiling/types.js.map +1 -1
  114. package/dist/js/profiling/utils.d.ts.map +1 -1
  115. package/dist/js/profiling/utils.js +15 -17
  116. package/dist/js/profiling/utils.js.map +1 -1
  117. package/dist/js/replay/CustomMask.d.ts.map +1 -1
  118. package/dist/js/replay/CustomMask.js +1 -1
  119. package/dist/js/replay/CustomMask.js.map +1 -1
  120. package/dist/js/replay/browserReplay.d.ts +13 -1
  121. package/dist/js/replay/browserReplay.d.ts.map +1 -1
  122. package/dist/js/replay/browserReplay.js +26 -0
  123. package/dist/js/replay/browserReplay.js.map +1 -1
  124. package/dist/js/replay/mobilereplay.d.ts.map +1 -1
  125. package/dist/js/replay/mobilereplay.js +2 -7
  126. package/dist/js/replay/mobilereplay.js.map +1 -1
  127. package/dist/js/replay/networkUtils.d.ts.map +1 -1
  128. package/dist/js/replay/networkUtils.js +4 -11
  129. package/dist/js/replay/networkUtils.js.map +1 -1
  130. package/dist/js/replay/replayInterface.d.ts +52 -0
  131. package/dist/js/replay/replayInterface.d.ts.map +1 -0
  132. package/dist/js/replay/replayInterface.js +2 -0
  133. package/dist/js/replay/replayInterface.js.map +1 -0
  134. package/dist/js/replay/xhrUtils.d.ts.map +1 -1
  135. package/dist/js/replay/xhrUtils.js.map +1 -1
  136. package/dist/js/scopeSync.d.ts.map +1 -1
  137. package/dist/js/scopeSync.js +7 -1
  138. package/dist/js/scopeSync.js.map +1 -1
  139. package/dist/js/sdk.d.ts +1 -6
  140. package/dist/js/sdk.d.ts.map +1 -1
  141. package/dist/js/sdk.js +3 -16
  142. package/dist/js/sdk.js.map +1 -1
  143. package/dist/js/tools/ModulesCollector.js +1 -0
  144. package/dist/js/tools/ModulesCollector.js.map +1 -1
  145. package/dist/js/tools/collectModules.js +1 -0
  146. package/dist/js/tools/collectModules.js.map +1 -1
  147. package/dist/js/tools/enableLogger.js +1 -0
  148. package/dist/js/tools/enableLogger.js.map +1 -1
  149. package/dist/js/tools/metroMiddleware.js +2 -1
  150. package/dist/js/tools/metroMiddleware.js.map +1 -1
  151. package/dist/js/tools/metroconfig.d.ts.map +1 -1
  152. package/dist/js/tools/metroconfig.js +6 -4
  153. package/dist/js/tools/metroconfig.js.map +1 -1
  154. package/dist/js/tools/sentryBabelTransformer.js +1 -0
  155. package/dist/js/tools/sentryBabelTransformer.js.map +1 -1
  156. package/dist/js/tools/sentryBabelTransformerUtils.d.ts.map +1 -1
  157. package/dist/js/tools/sentryBabelTransformerUtils.js +2 -1
  158. package/dist/js/tools/sentryBabelTransformerUtils.js.map +1 -1
  159. package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
  160. package/dist/js/tools/sentryMetroSerializer.js +1 -0
  161. package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
  162. package/dist/js/tools/utils.js +1 -0
  163. package/dist/js/tools/utils.js.map +1 -1
  164. package/dist/js/tools/vendor/expo/expoconfig.js +1 -0
  165. package/dist/js/tools/vendor/expo/expoconfig.js.map +1 -1
  166. package/dist/js/tools/vendor/metro/metroBabelTransformer.js +1 -0
  167. package/dist/js/tools/vendor/metro/metroBabelTransformer.js.map +1 -1
  168. package/dist/js/tools/vendor/metro/utils.d.ts.map +1 -1
  169. package/dist/js/tools/vendor/metro/utils.js +1 -0
  170. package/dist/js/tools/vendor/metro/utils.js.map +1 -1
  171. package/dist/js/touchevents.d.ts.map +1 -1
  172. package/dist/js/touchevents.js +4 -0
  173. package/dist/js/touchevents.js.map +1 -1
  174. package/dist/js/tracing/gesturetracing.d.ts.map +1 -1
  175. package/dist/js/tracing/gesturetracing.js.map +1 -1
  176. package/dist/js/tracing/integrations/appStart.d.ts +1 -1
  177. package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
  178. package/dist/js/tracing/integrations/appStart.js +10 -3
  179. package/dist/js/tracing/integrations/appStart.js.map +1 -1
  180. package/dist/js/tracing/integrations/nativeFrames.d.ts.map +1 -1
  181. package/dist/js/tracing/integrations/nativeFrames.js.map +1 -1
  182. package/dist/js/tracing/integrations/stalltracking.d.ts +1 -1
  183. package/dist/js/tracing/integrations/stalltracking.d.ts.map +1 -1
  184. package/dist/js/tracing/integrations/stalltracking.js.map +1 -1
  185. package/dist/js/tracing/integrations/timeToDisplayIntegration.d.ts.map +1 -1
  186. package/dist/js/tracing/integrations/timeToDisplayIntegration.js +14 -10
  187. package/dist/js/tracing/integrations/timeToDisplayIntegration.js.map +1 -1
  188. package/dist/js/tracing/integrations/userInteraction.d.ts.map +1 -1
  189. package/dist/js/tracing/integrations/userInteraction.js.map +1 -1
  190. package/dist/js/tracing/onSpanEndUtils.d.ts +1 -1
  191. package/dist/js/tracing/onSpanEndUtils.d.ts.map +1 -1
  192. package/dist/js/tracing/onSpanEndUtils.js +2 -1
  193. package/dist/js/tracing/onSpanEndUtils.js.map +1 -1
  194. package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
  195. package/dist/js/tracing/reactnativenavigation.js +1 -1
  196. package/dist/js/tracing/reactnativenavigation.js.map +1 -1
  197. package/dist/js/tracing/reactnativeprofiler.d.ts +3 -1
  198. package/dist/js/tracing/reactnativeprofiler.d.ts.map +1 -1
  199. package/dist/js/tracing/reactnativeprofiler.js +2 -1
  200. package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
  201. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  202. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  203. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  204. package/dist/js/tracing/reactnavigation.js +5 -4
  205. package/dist/js/tracing/reactnavigation.js.map +1 -1
  206. package/dist/js/tracing/span.d.ts.map +1 -1
  207. package/dist/js/tracing/span.js +5 -5
  208. package/dist/js/tracing/span.js.map +1 -1
  209. package/dist/js/tracing/timeToDisplayFallback.d.ts +1 -1
  210. package/dist/js/tracing/timeToDisplayFallback.d.ts.map +1 -1
  211. package/dist/js/tracing/timeToDisplayFallback.js.map +1 -1
  212. package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
  213. package/dist/js/tracing/timetodisplay.js +13 -13
  214. package/dist/js/tracing/timetodisplay.js.map +1 -1
  215. package/dist/js/tracing/timetodisplaynative.d.ts.map +1 -1
  216. package/dist/js/tracing/timetodisplaynative.js.map +1 -1
  217. package/dist/js/tracing/utils.d.ts.map +1 -1
  218. package/dist/js/tracing/utils.js.map +1 -1
  219. package/dist/js/transports/encodePolyfill.d.ts +4 -0
  220. package/dist/js/transports/encodePolyfill.d.ts.map +1 -1
  221. package/dist/js/transports/encodePolyfill.js +17 -3
  222. package/dist/js/transports/encodePolyfill.js.map +1 -1
  223. package/dist/js/transports/native.d.ts.map +1 -1
  224. package/dist/js/transports/native.js.map +1 -1
  225. package/dist/js/utils/AsyncExpiringMap.d.ts.map +1 -1
  226. package/dist/js/utils/AsyncExpiringMap.js +8 -4
  227. package/dist/js/utils/AsyncExpiringMap.js.map +1 -1
  228. package/dist/js/utils/carrier.d.ts +5 -0
  229. package/dist/js/utils/carrier.d.ts.map +1 -0
  230. package/dist/js/utils/carrier.js +11 -0
  231. package/dist/js/utils/carrier.js.map +1 -0
  232. package/dist/js/utils/encode.d.ts +5 -0
  233. package/dist/js/utils/encode.d.ts.map +1 -0
  234. package/dist/js/utils/encode.js +13 -0
  235. package/dist/js/utils/encode.js.map +1 -0
  236. package/dist/js/utils/envelope.d.ts.map +1 -1
  237. package/dist/js/utils/envelope.js +1 -2
  238. package/dist/js/utils/envelope.js.map +1 -1
  239. package/dist/js/utils/environment.d.ts.map +1 -1
  240. package/dist/js/utils/environment.js +5 -6
  241. package/dist/js/utils/environment.js.map +1 -1
  242. package/dist/js/utils/rnlibraries.d.ts.map +1 -1
  243. package/dist/js/utils/rnlibraries.js.map +1 -1
  244. package/dist/js/utils/safe.d.ts.map +1 -1
  245. package/dist/js/utils/safe.js.map +1 -1
  246. package/dist/js/utils/worldwide.d.ts +3 -2
  247. package/dist/js/utils/worldwide.d.ts.map +1 -1
  248. package/dist/js/utils/worldwide.js.map +1 -1
  249. package/dist/js/vendor/base64-js/fromByteArray.d.ts.map +1 -1
  250. package/dist/js/vendor/base64-js/fromByteArray.js +6 -0
  251. package/dist/js/vendor/base64-js/fromByteArray.js.map +1 -1
  252. package/dist/js/version.d.ts +1 -1
  253. package/dist/js/version.d.ts.map +1 -1
  254. package/dist/js/version.js +1 -1
  255. package/dist/js/version.js.map +1 -1
  256. package/dist/js/wrapper.d.ts.map +1 -1
  257. package/dist/js/wrapper.js +10 -8
  258. package/dist/js/wrapper.js.map +1 -1
  259. package/ios/RNSentryVersion.m +1 -1
  260. package/package.json +9 -10
  261. package/plugin/build/withSentry.js +3 -3
  262. package/plugin/build/withSentryAndroidGradlePlugin.js +3 -3
  263. package/scripts/expo-upload-sourcemaps.js +2 -2
  264. package/src/js/NativeRNSentry.ts +0 -1
  265. package/ts3.8/dist/js/feedback/FeedbackWidget.d.ts +1 -1
  266. package/ts3.8/dist/js/feedback/FeedbackWidget.types.d.ts +30 -30
  267. package/ts3.8/dist/js/feedback/defaults.d.ts +1 -1
  268. package/ts3.8/dist/js/feedback/integration.d.ts +1 -1
  269. package/ts3.8/dist/js/index.d.ts +3 -3
  270. package/ts3.8/dist/js/integrations/breadcrumbs.d.ts +47 -0
  271. package/ts3.8/dist/js/integrations/exports.d.ts +2 -1
  272. package/ts3.8/dist/js/options.d.ts +8 -1
  273. package/ts3.8/dist/js/profiling/cache.d.ts +1 -1
  274. package/ts3.8/dist/js/profiling/hermes.d.ts +1 -1
  275. package/ts3.8/dist/js/replay/browserReplay.d.ts +13 -1
  276. package/ts3.8/dist/js/replay/replayInterface.d.ts +52 -0
  277. package/ts3.8/dist/js/sdk.d.ts +1 -6
  278. package/ts3.8/dist/js/tracing/integrations/appStart.d.ts +1 -1
  279. package/ts3.8/dist/js/tracing/integrations/stalltracking.d.ts +1 -1
  280. package/ts3.8/dist/js/tracing/onSpanEndUtils.d.ts +1 -1
  281. package/ts3.8/dist/js/tracing/reactnativeprofiler.d.ts +3 -1
  282. package/ts3.8/dist/js/tracing/timeToDisplayFallback.d.ts +1 -1
  283. package/ts3.8/dist/js/transports/encodePolyfill.d.ts +4 -0
  284. package/ts3.8/dist/js/utils/carrier.d.ts +5 -0
  285. package/ts3.8/dist/js/utils/encode.d.ts +5 -0
  286. package/ts3.8/dist/js/utils/worldwide.d.ts +3 -2
  287. package/ts3.8/dist/js/version.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"sentryMetroSerializer.js","sourceRoot":"","sources":["../../../src/js/tools/sentryMetroSerializer.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAAiC;AAGjC,6DAA6D;AAC7D,uDAAuD;AAGvD,mCAA0G;AAC1G,gDAAoE;AAIpE,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAC1D,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAC3C,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAC1C,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AACnD,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC;;GAEG;AACH,SAAgB,uCAAuC,CAAC,EACtD,UAAU,EACV,OAAO,GAKR;IACC,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,UAAU,CAAC;KACnB;IAED,MAAM,mBAAmB,GAAG,UAAU,C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oBAAY,EAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACjD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,OAAe;IAClD,sEAAsE;IACtE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,qBAAqB,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import * as crypto from 'crypto';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport type { MixedOutput, Module, ReadOnlyGraph } from 'metro';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as countLines from 'metro/src/lib/countLines';\n\nimport type { Bundle, MetroSerializer, MetroSerializerOutput, SerializedBundle, VirtualJSOutput } from './utils';\nimport { createDebugIdSnippet, createSet, determineDebugIdFromBundleSource, stringToUUID } from './utils';\nimport { createDefaultMetroSerializer } from './vendor/metro/utils';\n\ntype SourceMap = Record<string, unknown>;\n\nconst DEBUG_ID_PLACE_HOLDER = '__debug_id_place_holder__';\nconst DEBUG_ID_MODULE_PATH = '__debugid__';\nconst PRELUDE_MODULE_PATH = '__prelude__';\nconst SOURCE_MAP_COMMENT = '//# sourceMappingURL=';\nconst DEBUG_ID_COMMENT = '//# debugId=';\n\n/**\n * Adds Sentry Debug ID polyfill module to the bundle.\n */\nexport function unstable_beforeAssetSerializationPlugin({\n premodules,\n debugId,\n}: {\n graph: ReadOnlyGraph<MixedOutput>;\n premodules: Module[];\n debugId?: string;\n}): Module[] {\n if (!debugId) {\n return premodules;\n }\n\n const debugIdModuleExists = premodules.findIndex(module => module.path === DEBUG_ID_MODULE_PATH) != -1;\n if (debugIdModuleExists) {\n // eslint-disable-next-line no-console\n console.warn('\\n\\nDebug ID module found. Skipping Sentry Debug ID module...\\n\\n');\n return premodules;\n }\n\n const debugIdModule = createDebugIdModule(debugId);\n return [...addDebugIdModule(premodules, debugIdModule)];\n}\n\n/**\n * Creates a Metro serializer that adds Debug ID module to the plain bundle.\n * The Debug ID module is a virtual module that provides a debug ID in runtime.\n *\n * RAM Bundles do not support custom serializers.\n */\nexport const createSentryMetroSerializer = (customSerializer?: MetroSerializer): MetroSerializer => {\n const serializer = customSerializer || createDefaultMetroSerializer();\n return async function (entryPoint, preModules, graph, options) {\n if (graph.transformOptions.hot) {\n return serializer(entryPoint, preModules, graph, options);\n }\n\n const debugIdModuleExists = preModules.findIndex(module => module.path === DEBUG_ID_MODULE_PATH) != -1;\n if (debugIdModuleExists) {\n // eslint-disable-next-line no-console\n console.warn('Debug ID module found. Skipping Sentry Debug ID module...');\n return serializer(entryPoint, preModules, graph, options);\n }\n\n const debugIdModule = createDebugIdModule(DEBUG_ID_PLACE_HOLDER);\n options.sentryBundleCallback = createSentryBundleCallback(debugIdModule);\n const modifiedPreModules = addDebugIdModule(preModules, debugIdModule);\n\n // Run wrapped serializer\n const serializerResult = serializer(entryPoint, modifiedPreModules, graph, options);\n const { code: bundleCode, map: bundleMapString } = await extractSerializerResult(serializerResult);\n\n // Add debug id comment to the bundle\n const debugId = determineDebugIdFromBundleSource(bundleCode);\n if (!debugId) {\n throw new Error(\n 'Debug ID was not found in the bundle. Call `options.sentryBundleCallback` if you are using a custom serializer.',\n );\n }\n // Only print debug id for command line builds => not hot reload from dev server\n // eslint-disable-next-line no-console\n console.log('info ' + `Bundle Debug ID: ${debugId}`);\n\n const debugIdComment = `${DEBUG_ID_COMMENT}${debugId}`;\n const indexOfSourceMapComment = bundleCode.lastIndexOf(SOURCE_MAP_COMMENT);\n const bundleCodeWithDebugId =\n indexOfSourceMapComment === -1\n ? // If source map comment is missing lets just add the debug id comment\n `${bundleCode}\\n${debugIdComment}`\n : // If source map comment is present lets add the debug id comment before it\n `${bundleCode.substring(0, indexOfSourceMapComment) + debugIdComment}\\n${bundleCode.substring(\n indexOfSourceMapComment,\n )}`;\n\n const bundleMap: SourceMap = JSON.parse(bundleMapString);\n // For now we write both fields until we know what will become the standard - if ever.\n bundleMap['debug_id'] = debugId;\n bundleMap['debugId'] = debugId;\n\n return {\n code: bundleCodeWithDebugId,\n map: JSON.stringify(bundleMap),\n };\n };\n};\n\n/**\n * This function is expected to be called after serializer creates the final bundle object\n * and before the source maps are generated.\n *\n * It injects a debug ID into the bundle and returns the modified bundle.\n *\n * Access it via `options.sentryBundleCallback` in your custom serializer.\n */\nfunction createSentryBundleCallback(debugIdModule: Module<VirtualJSOutput> & { setSource: (code: string) => void }) {\n return (bundle: Bundle) => {\n const debugId = calculateDebugId(bundle);\n debugIdModule.setSource(injectDebugId(debugIdModule.getSource().toString(), debugId));\n bundle.pre = injectDebugId(bundle.pre, debugId);\n return bundle;\n };\n}\n\nfunction addDebugIdModule(\n preModules: readonly Module<MixedOutput>[],\n debugIdModule: Module<VirtualJSOutput>,\n): readonly Module<MixedOutput>[] {\n const modifiedPreModules = [...preModules];\n if (\n modifiedPreModules.length > 0 &&\n modifiedPreModules[0] !== undefined &&\n modifiedPreModules[0].path === PRELUDE_MODULE_PATH\n ) {\n // prelude module must be first as it measures the bundle startup time\n modifiedPreModules.unshift(preModules[0] as Module<VirtualJSOutput>);\n modifiedPreModules[1] = debugIdModule;\n } else {\n modifiedPreModules.unshift(debugIdModule);\n }\n return modifiedPreModules;\n}\n\nasync function extractSerializerResult(serializerResult: MetroSerializerOutput): Promise<SerializedBundle> {\n if (typeof serializerResult === 'string') {\n return { code: serializerResult, map: '{}' };\n }\n\n if ('map' in serializerResult) {\n return { code: serializerResult.code, map: serializerResult.map };\n }\n\n const awaitedResult = await serializerResult;\n if (typeof awaitedResult === 'string') {\n return { code: awaitedResult, map: '{}' };\n }\n\n return { code: awaitedResult.code, map: awaitedResult.map };\n}\n\nfunction createDebugIdModule(debugId: string): Module<VirtualJSOutput> & { setSource: (code: string) => void } {\n let debugIdCode = createDebugIdSnippet(debugId);\n\n return {\n setSource: (code: string) => {\n debugIdCode = code;\n },\n dependencies: new Map(),\n getSource: () => Buffer.from(debugIdCode),\n inverseDependencies: createSet(),\n path: DEBUG_ID_MODULE_PATH,\n output: [\n {\n type: 'js/script/virtual',\n data: {\n code: debugIdCode,\n lineCount: countLines(debugIdCode),\n map: [],\n },\n },\n ],\n };\n}\n\nfunction calculateDebugId(bundle: Bundle): string {\n const hash = crypto.createHash('md5');\n hash.update(bundle.pre);\n for (const [, code] of bundle.modules) {\n hash.update(code);\n }\n hash.update(bundle.post);\n\n const debugId = stringToUUID(hash.digest('hex'));\n return debugId;\n}\n\nfunction injectDebugId(code: string, debugId: string): string {\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n return code.replace(new RegExp(DEBUG_ID_PLACE_HOLDER, 'g'), debugId);\n}\n"]}
1
+ {"version":3,"file":"sentryMetroSerializer.js","sourceRoot":"","sources":["../../../src/js/tools/sentryMetroSerializer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAiC;AAGjC,6DAA6D;AAC7D,uDAAuD;AAEvD,mCAA0G;AAC1G,gDAAoE;AAIpE,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAC1D,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAC3C,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAC1C,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AACnD,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC;;GAEG;AACH,SAAgB,uCAAuC,CAAC,EACtD,UAAU,EACV,OAAO,GAKR;IACC,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,UAAU,CAAC;KACnB;IAED,MAAM,mBAAmB,GAAG,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;IACvG,IAAI,mBAAmB,EAAE;QACvB,sCAAsC;QACtC,OAAO,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC;QAClF,OAAO,UAAU,CAAC;KACnB;IAED,MAAM,aAAa,GAAG,mBAAmB,CAAC,OAAO,CA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ourcesContent":["import * as crypto from 'crypto';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport type { MixedOutput, Module, ReadOnlyGraph } from 'metro';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as countLines from 'metro/src/lib/countLines';\nimport type { Bundle, MetroSerializer, MetroSerializerOutput, SerializedBundle, VirtualJSOutput } from './utils';\nimport { createDebugIdSnippet, createSet, determineDebugIdFromBundleSource, stringToUUID } from './utils';\nimport { createDefaultMetroSerializer } from './vendor/metro/utils';\n\ntype SourceMap = Record<string, unknown>;\n\nconst DEBUG_ID_PLACE_HOLDER = '__debug_id_place_holder__';\nconst DEBUG_ID_MODULE_PATH = '__debugid__';\nconst PRELUDE_MODULE_PATH = '__prelude__';\nconst SOURCE_MAP_COMMENT = '//# sourceMappingURL=';\nconst DEBUG_ID_COMMENT = '//# debugId=';\n\n/**\n * Adds Sentry Debug ID polyfill module to the bundle.\n */\nexport function unstable_beforeAssetSerializationPlugin({\n premodules,\n debugId,\n}: {\n graph: ReadOnlyGraph<MixedOutput>;\n premodules: Module[];\n debugId?: string;\n}): Module[] {\n if (!debugId) {\n return premodules;\n }\n\n const debugIdModuleExists = premodules.findIndex(module => module.path === DEBUG_ID_MODULE_PATH) != -1;\n if (debugIdModuleExists) {\n // eslint-disable-next-line no-console\n console.warn('\\n\\nDebug ID module found. Skipping Sentry Debug ID module...\\n\\n');\n return premodules;\n }\n\n const debugIdModule = createDebugIdModule(debugId);\n return [...addDebugIdModule(premodules, debugIdModule)];\n}\n\n/**\n * Creates a Metro serializer that adds Debug ID module to the plain bundle.\n * The Debug ID module is a virtual module that provides a debug ID in runtime.\n *\n * RAM Bundles do not support custom serializers.\n */\nexport const createSentryMetroSerializer = (customSerializer?: MetroSerializer): MetroSerializer => {\n const serializer = customSerializer || createDefaultMetroSerializer();\n return async function (entryPoint, preModules, graph, options) {\n if (graph.transformOptions.hot) {\n return serializer(entryPoint, preModules, graph, options);\n }\n\n const debugIdModuleExists = preModules.findIndex(module => module.path === DEBUG_ID_MODULE_PATH) != -1;\n if (debugIdModuleExists) {\n // eslint-disable-next-line no-console\n console.warn('Debug ID module found. Skipping Sentry Debug ID module...');\n return serializer(entryPoint, preModules, graph, options);\n }\n\n const debugIdModule = createDebugIdModule(DEBUG_ID_PLACE_HOLDER);\n options.sentryBundleCallback = createSentryBundleCallback(debugIdModule);\n const modifiedPreModules = addDebugIdModule(preModules, debugIdModule);\n\n // Run wrapped serializer\n const serializerResult = serializer(entryPoint, modifiedPreModules, graph, options);\n const { code: bundleCode, map: bundleMapString } = await extractSerializerResult(serializerResult);\n\n // Add debug id comment to the bundle\n const debugId = determineDebugIdFromBundleSource(bundleCode);\n if (!debugId) {\n throw new Error(\n 'Debug ID was not found in the bundle. Call `options.sentryBundleCallback` if you are using a custom serializer.',\n );\n }\n // Only print debug id for command line builds => not hot reload from dev server\n // eslint-disable-next-line no-console\n console.log('info ' + `Bundle Debug ID: ${debugId}`);\n\n const debugIdComment = `${DEBUG_ID_COMMENT}${debugId}`;\n const indexOfSourceMapComment = bundleCode.lastIndexOf(SOURCE_MAP_COMMENT);\n const bundleCodeWithDebugId =\n indexOfSourceMapComment === -1\n ? // If source map comment is missing lets just add the debug id comment\n `${bundleCode}\\n${debugIdComment}`\n : // If source map comment is present lets add the debug id comment before it\n `${bundleCode.substring(0, indexOfSourceMapComment) + debugIdComment}\\n${bundleCode.substring(\n indexOfSourceMapComment,\n )}`;\n\n const bundleMap: SourceMap = JSON.parse(bundleMapString);\n // For now we write both fields until we know what will become the standard - if ever.\n bundleMap['debug_id'] = debugId;\n bundleMap['debugId'] = debugId;\n\n return {\n code: bundleCodeWithDebugId,\n map: JSON.stringify(bundleMap),\n };\n };\n};\n\n/**\n * This function is expected to be called after serializer creates the final bundle object\n * and before the source maps are generated.\n *\n * It injects a debug ID into the bundle and returns the modified bundle.\n *\n * Access it via `options.sentryBundleCallback` in your custom serializer.\n */\nfunction createSentryBundleCallback(debugIdModule: Module<VirtualJSOutput> & { setSource: (code: string) => void }) {\n return (bundle: Bundle) => {\n const debugId = calculateDebugId(bundle);\n debugIdModule.setSource(injectDebugId(debugIdModule.getSource().toString(), debugId));\n bundle.pre = injectDebugId(bundle.pre, debugId);\n return bundle;\n };\n}\n\nfunction addDebugIdModule(\n preModules: readonly Module<MixedOutput>[],\n debugIdModule: Module<VirtualJSOutput>,\n): readonly Module<MixedOutput>[] {\n const modifiedPreModules = [...preModules];\n if (\n modifiedPreModules.length > 0 &&\n modifiedPreModules[0] !== undefined &&\n modifiedPreModules[0].path === PRELUDE_MODULE_PATH\n ) {\n // prelude module must be first as it measures the bundle startup time\n modifiedPreModules.unshift(preModules[0] as Module<VirtualJSOutput>);\n modifiedPreModules[1] = debugIdModule;\n } else {\n modifiedPreModules.unshift(debugIdModule);\n }\n return modifiedPreModules;\n}\n\nasync function extractSerializerResult(serializerResult: MetroSerializerOutput): Promise<SerializedBundle> {\n if (typeof serializerResult === 'string') {\n return { code: serializerResult, map: '{}' };\n }\n\n if ('map' in serializerResult) {\n return { code: serializerResult.code, map: serializerResult.map };\n }\n\n const awaitedResult = await serializerResult;\n if (typeof awaitedResult === 'string') {\n return { code: awaitedResult, map: '{}' };\n }\n\n return { code: awaitedResult.code, map: awaitedResult.map };\n}\n\nfunction createDebugIdModule(debugId: string): Module<VirtualJSOutput> & { setSource: (code: string) => void } {\n let debugIdCode = createDebugIdSnippet(debugId);\n\n return {\n setSource: (code: string) => {\n debugIdCode = code;\n },\n dependencies: new Map(),\n getSource: () => Buffer.from(debugIdCode),\n inverseDependencies: createSet(),\n path: DEBUG_ID_MODULE_PATH,\n output: [\n {\n type: 'js/script/virtual',\n data: {\n code: debugIdCode,\n lineCount: countLines(debugIdCode),\n map: [],\n },\n },\n ],\n };\n}\n\nfunction calculateDebugId(bundle: Bundle): string {\n const hash = crypto.createHash('md5');\n hash.update(bundle.pre);\n for (const [, code] of bundle.modules) {\n hash.update(code);\n }\n hash.update(bundle.post);\n\n const debugId = stringToUUID(hash.digest('hex'));\n return debugId;\n}\n\nfunction injectDebugId(code: string, debugId: string): string {\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n return code.replace(new RegExp(DEBUG_ID_PLACE_HOLDER, 'g'), debugId);\n}\n"]}
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  Object.defineProperty(exports, "__esModule", { value: true });
2
3
  exports.createSet = exports.determineDebugIdFromBundleSource = exports.stringToUUID = exports.createDebugIdSnippet = void 0;
3
4
  const crypto = require("crypto");
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/js/tools/utils.ts"],"names":[],"mappings":";;AAAA,iCAAiC;AAsCjC;;GAEG;AACH,SAAgB,oBAAoB,CAAC,OAAe;IAClD,OAAO,+JAA+J,OAAO,2CAA2C,OAAO,eAAe,CAAC;AACjP,CAAC;AAFD,oDAEC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,GAAW;IACtC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAErC,oFAAoF;IACpF,uBAAuB;IACvB,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAW,CAAC;IAE9F,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC,SAAS,CACjF,EAAE,EACF,EAAE,CACH,IAAI,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;AACtF,CAAC;AAbD,oCAaC;AAED;;;;;;;GAOG;AACH,SAAgB,gCAAgC,CAAC,IAAY;IAC3D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CACtB,mGAAmG,CACpG,CAAC;IACF,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACtC,CAAC;AALD,4EAKC;AAED;;;;GAIG;AACH,SAAS,iBAAiB;IACxB,IAAI;QACF,iGAAiG;QACjG,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;QACnE,OAAO,GAAG,EAAE,CAAC,IAAI,QAAQ,EAAE,CAAC;KAC7B;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,YAAY,KAAK,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,kBAAkB,EAAE;YACtE,OAAO,GAAG,EAAE,CAAC,IAAI,GAAG,EAAoC,CAAC;SAC1D;aAAM;YACL,MAAM,CAAC,CAAC;SACT;KACF;AACH,CAAC;AAEY,QAAA,SAAS,GAAG,iBAAiB,EAAE,CAAC","sourcesContent":["import * as crypto from 'crypto';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport type { Module, ReadOnlyGraph, SerializerOptions } from 'metro';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport type CountingSet from 'metro/src/lib/CountingSet';\n\n// Variant of MixedOutput\n// https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/DeltaBundler/types.flow.js#L21\nexport type VirtualJSOutput = {\n type: 'js/script/virtual';\n data: {\n code: string;\n lineCount: number;\n map: [];\n };\n};\n\nexport type Bundle = {\n modules: Array<[id: number, code: string]>;\n post: string;\n pre: string;\n};\n\nexport type SentryMetroSerializerOptionsExtras = {\n sentryBundleCallback?: (bundle: Bundle) => Bundle;\n};\n\nexport type SerializedBundle = { code: string; map: string };\n\nexport type MetroSerializerOutput = string | SerializedBundle | Promise<string | SerializedBundle>;\n\nexport type MetroSerializer = (\n entryPoint: string,\n preModules: ReadonlyArray<Module>,\n graph: ReadOnlyGraph,\n options: SerializerOptions & SentryMetroSerializerOptionsExtras,\n) => MetroSerializerOutput;\n\n/**\n * Returns minified Debug ID code snippet.\n */\nexport function createDebugIdSnippet(debugId: string): string {\n return `var _sentryDebugIds,_sentryDebugIdIdentifier;void 0===_sentryDebugIds&&(_sentryDebugIds={});try{var stack=(new Error).stack;stack&&(_sentryDebugIds[stack]=\"${debugId}\",_sentryDebugIdIdentifier=\"sentry-dbid-${debugId}\")}catch(e){}`;\n}\n\n/**\n * Deterministically hashes a string and turns the hash into a uuid.\n *\n * https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/58271f1af2ade6b3e64d393d70376ae53bc5bd2f/packages/bundler-plugin-core/src/utils.ts#L174\n */\nexport function stringToUUID(str: string): string {\n const md5sum = crypto.createHash('md5');\n md5sum.update(str);\n const md5Hash = md5sum.digest('hex');\n\n // Position 16 is fixed to either 8, 9, a, or b in the uuid v4 spec (10xx in binary)\n // RFC 4122 section 4.4\n const v4variant = ['8', '9', 'a', 'b'][md5Hash.substring(16, 17).charCodeAt(0) % 4] as string;\n\n return `${md5Hash.substring(0, 8)}-${md5Hash.substring(8, 12)}-4${md5Hash.substring(\n 13,\n 16,\n )}-${v4variant}${md5Hash.substring(17, 20)}-${md5Hash.substring(20)}`.toLowerCase();\n}\n\n/**\n * Looks for a particular string pattern (`sdbid-[debug ID]`) in the bundle\n * source and extracts the bundle's debug ID from it.\n *\n * The string pattern is injected via the debug ID injection snipped.\n *\n * https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/40f918458ed449d8b3eabaf64d13c08218213f65/packages/bundler-plugin-core/src/debug-id-upload.ts#L293-L294\n */\nexport function determineDebugIdFromBundleSource(code: string): string | undefined {\n const match = code.match(\n /sentry-dbid-([0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12})/,\n );\n return match ? match[1] : undefined;\n}\n\n/**\n * CountingSet was added in Metro 0.72.0 before that NodeJS Set was used.\n *\n * https://github.com/facebook/metro/blob/fc29a1177f883144674cf85a813b58567f69d545/packages/metro/src/lib/CountingSet.js\n */\nfunction resolveSetCreator(): () => CountingSet<string> {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-extraneous-dependencies\n const { default: MetroSet } = require('metro/src/lib/CountingSet');\n return () => new MetroSet();\n } catch (e) {\n if (e instanceof Error && 'code' in e && e.code === 'MODULE_NOT_FOUND') {\n return () => new Set() as unknown as CountingSet<string>;\n } else {\n throw e;\n }\n }\n}\n\nexport const createSet = resolveSetCreator();\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/js/tools/utils.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAsCjC;;GAEG;AACH,SAAgB,oBAAoB,CAAC,OAAe;IAClD,OAAO,+JAA+J,OAAO,2CAA2C,OAAO,eAAe,CAAC;AACjP,CAAC;AAFD,oDAEC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,GAAW;IACtC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAErC,oFAAoF;IACpF,uBAAuB;IACvB,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAW,CAAC;IAE9F,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC,SAAS,CACjF,EAAE,EACF,EAAE,CACH,IAAI,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;AACtF,CAAC;AAbD,oCAaC;AAED;;;;;;;GAOG;AACH,SAAgB,gCAAgC,CAAC,IAAY;IAC3D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CACtB,mGAAmG,CACpG,CAAC;IACF,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACtC,CAAC;AALD,4EAKC;AAED;;;;GAIG;AACH,SAAS,iBAAiB;IACxB,IAAI;QACF,iGAAiG;QACjG,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;QACnE,OAAO,GAAG,EAAE,CAAC,IAAI,QAAQ,EAAE,CAAC;KAC7B;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,YAAY,KAAK,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,kBAAkB,EAAE;YACtE,OAAO,GAAG,EAAE,CAAC,IAAI,GAAG,EAAoC,CAAC;SAC1D;aAAM;YACL,MAAM,CAAC,CAAC;SACT;KACF;AACH,CAAC;AAEY,QAAA,SAAS,GAAG,iBAAiB,EAAE,CAAC","sourcesContent":["import * as crypto from 'crypto';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport type { Module, ReadOnlyGraph, SerializerOptions } from 'metro';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport type CountingSet from 'metro/src/lib/CountingSet';\n\n// Variant of MixedOutput\n// https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/DeltaBundler/types.flow.js#L21\nexport type VirtualJSOutput = {\n type: 'js/script/virtual';\n data: {\n code: string;\n lineCount: number;\n map: [];\n };\n};\n\nexport type Bundle = {\n modules: Array<[id: number, code: string]>;\n post: string;\n pre: string;\n};\n\nexport type SentryMetroSerializerOptionsExtras = {\n sentryBundleCallback?: (bundle: Bundle) => Bundle;\n};\n\nexport type SerializedBundle = { code: string; map: string };\n\nexport type MetroSerializerOutput = string | SerializedBundle | Promise<string | SerializedBundle>;\n\nexport type MetroSerializer = (\n entryPoint: string,\n preModules: ReadonlyArray<Module>,\n graph: ReadOnlyGraph,\n options: SerializerOptions & SentryMetroSerializerOptionsExtras,\n) => MetroSerializerOutput;\n\n/**\n * Returns minified Debug ID code snippet.\n */\nexport function createDebugIdSnippet(debugId: string): string {\n return `var _sentryDebugIds,_sentryDebugIdIdentifier;void 0===_sentryDebugIds&&(_sentryDebugIds={});try{var stack=(new Error).stack;stack&&(_sentryDebugIds[stack]=\"${debugId}\",_sentryDebugIdIdentifier=\"sentry-dbid-${debugId}\")}catch(e){}`;\n}\n\n/**\n * Deterministically hashes a string and turns the hash into a uuid.\n *\n * https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/58271f1af2ade6b3e64d393d70376ae53bc5bd2f/packages/bundler-plugin-core/src/utils.ts#L174\n */\nexport function stringToUUID(str: string): string {\n const md5sum = crypto.createHash('md5');\n md5sum.update(str);\n const md5Hash = md5sum.digest('hex');\n\n // Position 16 is fixed to either 8, 9, a, or b in the uuid v4 spec (10xx in binary)\n // RFC 4122 section 4.4\n const v4variant = ['8', '9', 'a', 'b'][md5Hash.substring(16, 17).charCodeAt(0) % 4] as string;\n\n return `${md5Hash.substring(0, 8)}-${md5Hash.substring(8, 12)}-4${md5Hash.substring(\n 13,\n 16,\n )}-${v4variant}${md5Hash.substring(17, 20)}-${md5Hash.substring(20)}`.toLowerCase();\n}\n\n/**\n * Looks for a particular string pattern (`sdbid-[debug ID]`) in the bundle\n * source and extracts the bundle's debug ID from it.\n *\n * The string pattern is injected via the debug ID injection snipped.\n *\n * https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/40f918458ed449d8b3eabaf64d13c08218213f65/packages/bundler-plugin-core/src/debug-id-upload.ts#L293-L294\n */\nexport function determineDebugIdFromBundleSource(code: string): string | undefined {\n const match = code.match(\n /sentry-dbid-([0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12})/,\n );\n return match ? match[1] : undefined;\n}\n\n/**\n * CountingSet was added in Metro 0.72.0 before that NodeJS Set was used.\n *\n * https://github.com/facebook/metro/blob/fc29a1177f883144674cf85a813b58567f69d545/packages/metro/src/lib/CountingSet.js\n */\nfunction resolveSetCreator(): () => CountingSet<string> {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-extraneous-dependencies\n const { default: MetroSet } = require('metro/src/lib/CountingSet');\n return () => new MetroSet();\n } catch (e) {\n if (e instanceof Error && 'code' in e && e.code === 'MODULE_NOT_FOUND') {\n return () => new Set() as unknown as CountingSet<string>;\n } else {\n throw e;\n }\n }\n}\n\nexport const createSet = resolveSetCreator();\n"]}
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  // The MIT License (MIT)
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  //# sourceMappingURL=expoconfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"expoconfig.js","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/expo/expoconfig.ts"],"names":[],"mappings":"AAAA,wBAAwB","sourcesContent":["// The MIT License (MIT)\n\n// Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nimport type { MixedOutput, Module, ReadOnlyGraph } from 'metro';\n\n// https://github.com/expo/expo/blob/44d03f59e25b01fbfee82075da18dd7f8ce44e96/packages/%40expo/metro-config/src/ExpoMetroConfig.ts\nexport interface DefaultConfigOptions {\n /** @deprecated */\n mode?: 'exotic';\n /**\n * **Experimental:** Enable CSS support for Metro web, and shim on native.\n *\n * This is an experimental feature and may change in the future. The underlying implementation\n * is subject to change, and native support for CSS Modules may be added in the future during a non-major SDK release.\n */\n isCSSEnabled?: boolean;\n /**\n * **Experimental:** Modify premodules before a code asset is serialized\n *\n * This is an experimental feature and may change in the future. The underlying implementation\n * is subject to change.\n */\n unstable_beforeAssetSerializationPlugins?: ((serializationInput: {\n graph: ReadOnlyGraph<MixedOutput>;\n premodules: Module[];\n debugId?: string;\n }) => Module[])[];\n}\n"]}
1
+ {"version":3,"file":"expoconfig.js","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/expo/expoconfig.ts"],"names":[],"mappings":";AAAA,wBAAwB","sourcesContent":["// The MIT License (MIT)\n\n// Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nimport type { MixedOutput, Module, ReadOnlyGraph } from 'metro';\n\n// https://github.com/expo/expo/blob/44d03f59e25b01fbfee82075da18dd7f8ce44e96/packages/%40expo/metro-config/src/ExpoMetroConfig.ts\nexport interface DefaultConfigOptions {\n /** @deprecated */\n mode?: 'exotic';\n /**\n * **Experimental:** Enable CSS support for Metro web, and shim on native.\n *\n * This is an experimental feature and may change in the future. The underlying implementation\n * is subject to change, and native support for CSS Modules may be added in the future during a non-major SDK release.\n */\n isCSSEnabled?: boolean;\n /**\n * **Experimental:** Modify premodules before a code asset is serialized\n *\n * This is an experimental feature and may change in the future. The underlying implementation\n * is subject to change.\n */\n unstable_beforeAssetSerializationPlugins?: ((serializationInput: {\n graph: ReadOnlyGraph<MixedOutput>;\n premodules: Module[];\n debugId?: string;\n }) => Module[])[];\n}\n"]}
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  // Vendored / modified from @facebook/metro
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  //# sourceMappingURL=metroBabelTransformer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"metroBabelTransformer.js","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/metroBabelTransformer.ts"],"names":[],"mappings":"AAAA,2CAA2C","sourcesContent":["// Vendored / modified from @facebook/metro\n\n// https://github.com/facebook/metro/blob/9b295e5f7ecd9cb6332a199bf9cdc1bd8fddf6d9/packages/metro-babel-transformer/types/index.d.ts\n\n// MIT License\n\n// Copyright (c) Meta Platforms, Inc. and affiliates.\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nexport interface CustomTransformOptions {\n [key: string]: unknown;\n}\n\nexport type TransformProfile = 'default' | 'hermes-stable' | 'hermes-canary';\n\nexport interface BabelTransformerOptions {\n readonly customTransformOptions?: CustomTransformOptions;\n readonly dev: boolean;\n readonly enableBabelRCLookup?: boolean;\n readonly enableBabelRuntime: boolean | string;\n readonly extendsBabelConfigPath?: string;\n readonly experimentalImportSupport?: boolean;\n readonly hermesParser?: boolean;\n readonly hot: boolean;\n readonly minify: boolean;\n readonly unstable_disableES6Transforms?: boolean;\n readonly platform: string | null;\n readonly projectRoot: string;\n readonly publicPath: string;\n readonly unstable_transformProfile?: TransformProfile;\n readonly globalPrefix: string;\n}\n\nexport interface BabelTransformerArgs {\n readonly filename: string;\n readonly options: BabelTransformerOptions;\n readonly plugins?: unknown;\n readonly src: string;\n}\n\nexport interface BabelTransformer {\n transform: (args: BabelTransformerArgs) => {\n ast: unknown;\n metadata: unknown;\n };\n getCacheKey?: () => string;\n}\n"]}
1
+ {"version":3,"file":"metroBabelTransformer.js","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/metroBabelTransformer.ts"],"names":[],"mappings":";AAAA,2CAA2C","sourcesContent":["// Vendored / modified from @facebook/metro\n\n// https://github.com/facebook/metro/blob/9b295e5f7ecd9cb6332a199bf9cdc1bd8fddf6d9/packages/metro-babel-transformer/types/index.d.ts\n\n// MIT License\n\n// Copyright (c) Meta Platforms, Inc. and affiliates.\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nexport interface CustomTransformOptions {\n [key: string]: unknown;\n}\n\nexport type TransformProfile = 'default' | 'hermes-stable' | 'hermes-canary';\n\nexport interface BabelTransformerOptions {\n readonly customTransformOptions?: CustomTransformOptions;\n readonly dev: boolean;\n readonly enableBabelRCLookup?: boolean;\n readonly enableBabelRuntime: boolean | string;\n readonly extendsBabelConfigPath?: string;\n readonly experimentalImportSupport?: boolean;\n readonly hermesParser?: boolean;\n readonly hot: boolean;\n readonly minify: boolean;\n readonly unstable_disableES6Transforms?: boolean;\n readonly platform: string | null;\n readonly projectRoot: string;\n readonly publicPath: string;\n readonly unstable_transformProfile?: TransformProfile;\n readonly globalPrefix: string;\n}\n\nexport interface BabelTransformerArgs {\n readonly filename: string;\n readonly options: BabelTransformerOptions;\n readonly plugins?: unknown;\n readonly src: string;\n}\n\nexport interface BabelTransformer {\n transform: (args: BabelTransformerArgs) => {\n ast: unknown;\n metadata: unknown;\n };\n getCacheKey?: () => string;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/utils.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAe,MAAM,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAQhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAOnD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,UACpB,aAAa;2BAIK,MAAM,KAAK,MAAM;MAEzC,SAAS,MAAM,EAMjB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,QAAO,eAqC/C,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/utils.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAe,MAAM,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAOhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAOnD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,UACpB,aAAa;2BAIK,MAAM,KAAK,MAAM;MAEzC,SAAS,MAAM,EAMjB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,QAAO,eAqC/C,CAAC"}
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  // Vendored / modified from @facebook/metro
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.createDefaultMetroSerializer = exports.getSortedModules = void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/utils.ts"],"names":[],"mappings":"AAAA,2CAA2C;;;AA4B3C,6DAA6D;AAC7D,gFAAgF;AAChF,6DAA6D;AAC7D,sFAAsF;AACtF,6DAA6D;AAC7D,+DAA+D;AAS/D;;;;;GAKG;AACI,MAAM,gBAAgB,GAAG,CAC9B,KAAoB,EACpB,EACE,cAAc,GAGf,EACkB,EAAE;IACrB,MAAM,OAAO,GAAG,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;IACjD,cAAc;IACd,OAAO,OAAO,CAAC,IAAI,CACjB,CAAC,CAAsB,EAAE,CAAsB,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CACpG,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,gBAAgB,oBAa3B;AAEF;;;;;;;;;GASG;AACI,MAAM,4BAA4B,GAAG,GAAoB,EAAE;IAChE,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAChD,4DAA4D;QAC5D,IAAI,MAAM,GAAG,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAClE,IAAI,OAAO,CAAC,oBAAoB,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,EAAE;YAC/D,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;SAC/C;QACD,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,KAAK,CAAC,gBAAgB,CAAC,GAAG,EAAE;YAC9B,sEAAsE;YACtE,OAAO,IAAI,CAAC;SACb;QAED,IAAI,uBAA2D,CAAC;QAChE,IAAI,OAAO,eAAe,KAAK,UAAU,EAAE;YACzC,uBAAuB,GAAG,eAAe,CAAC;SAC3C;aAAM,IACL,OAAO,eAAe,KAAK,QAAQ;YACnC,eAAe,IAAI,IAAI;YACvB,iBAAiB,IAAI,eAAe;YACpC,OAAO,eAAe,CAAC,iBAAiB,CAAC,KAAK,UAAU,EACxD;YACA,uBAAuB,GAAI,eAA4C,CAAC,eAAe,CAAC;SACzF;aAAM;YACL,MAAM,IAAI,KAAK,CAAC;;;CAGrB,CAAC,CAAC;SACE;QAED,oEAAoE;QACpE,MAAM,GAAG,GAAG,uBAAuB,CAAC,CAAC,GAAG,UAAU,EAAE,GAAG,IAAA,wBAAgB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE;YACxF,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;YAChD,qBAAqB,EAAE,OAAO,CAAC,qBAAqB;SACrD,CAAC,CAAC;QACH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC,CAAC;AArCW,QAAA,4BAA4B,gCAqCvC","sourcesContent":["// Vendored / modified from @facebook/metro\n\n// https://github.com/facebook/metro/commit/9b85f83c9cc837d8cd897aa7723be7da5b296067\n\n// MIT License\n\n// Copyright (c) Meta Platforms, Inc. and affiliates.\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport type { MixedOutput, Module, ReadOnlyGraph } from 'metro';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as baseJSBundle from 'metro/src/DeltaBundler/Serializers/baseJSBundle';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as sourceMapString from 'metro/src/DeltaBundler/Serializers/sourceMapString';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as bundleToString from 'metro/src/lib/bundleToString';\n\nimport type { MetroSerializer } from '../../utils';\n\ntype NewSourceMapStringExport = {\n // Since Metro v0.80.10 https://github.com/facebook/metro/compare/v0.80.9...v0.80.10#diff-1b836d1729e527a725305eef0cec22e44605af2700fa413f4c2489ea1a03aebcL28\n sourceMapString: typeof sourceMapString;\n};\n\n/**\n * This function ensures that modules in source maps are sorted in the same\n * order as in a plain JS bundle.\n *\n * https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/Server.js#L984\n */\nexport const getSortedModules = (\n graph: ReadOnlyGraph,\n {\n createModuleId,\n }: {\n createModuleId: (file: string) => number;\n },\n): readonly Module[] => {\n const modules = [...graph.dependencies.values()];\n // Sort by IDs\n return modules.sort(\n (a: Module<MixedOutput>, b: Module<MixedOutput>) => createModuleId(a.path) - createModuleId(b.path),\n );\n};\n\n/**\n * Creates the default Metro plain bundle serializer.\n * Because Metro exports only the intermediate serializer functions, we need to\n * assemble the final serializer ourselves. We have to work with the modules the same as Metro does\n * to avoid unexpected changes in the final bundle.\n *\n * This is used when the user does not provide a custom serializer.\n *\n * https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/Server.js#L244-L277\n */\nexport const createDefaultMetroSerializer = (): MetroSerializer => {\n return (entryPoint, preModules, graph, options) => {\n // baseJSBundle assigns IDs to modules in a consistent order\n let bundle = baseJSBundle(entryPoint, preModules, graph, options);\n if (options.sentryBundleCallback && !graph.transformOptions.hot) {\n bundle = options.sentryBundleCallback(bundle);\n }\n const { code } = bundleToString(bundle);\n if (graph.transformOptions.hot) {\n // Hot means running in dev server, sourcemaps are generated on demand\n return code;\n }\n\n let sourceMapStringFunction: typeof sourceMapString | undefined;\n if (typeof sourceMapString === 'function') {\n sourceMapStringFunction = sourceMapString;\n } else if (\n typeof sourceMapString === 'object' &&\n sourceMapString != null &&\n 'sourceMapString' in sourceMapString &&\n typeof sourceMapString['sourceMapString'] === 'function'\n ) {\n sourceMapStringFunction = (sourceMapString as NewSourceMapStringExport).sourceMapString;\n } else {\n throw new Error(`\n[@sentry/react-native/metro] Cannot find sourceMapString function in 'metro/src/DeltaBundler/Serializers/sourceMapString'.\nPlease check the version of Metro you are using and report the issue at http://www.github.com/getsentry/sentry-react-native/issues\n`);\n }\n\n // Always generate source maps, can't use Sentry without source maps\n const map = sourceMapStringFunction([...preModules, ...getSortedModules(graph, options)], {\n processModuleFilter: options.processModuleFilter,\n shouldAddToIgnoreList: options.shouldAddToIgnoreList,\n });\n return { code, map };\n };\n};\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/utils.ts"],"names":[],"mappings":";AAAA,2CAA2C;;;AA4B3C,6DAA6D;AAC7D,gFAAgF;AAChF,6DAA6D;AAC7D,sFAA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AU,EACxD;YACA,uBAAuB,GAAI,eAA4C,CAAC,eAAe,CAAC;SACzF;aAAM;YACL,MAAM,IAAI,KAAK,CAAC;;;CAGrB,CAAC,CAAC;SACE;QAED,oEAAoE;QACpE,MAAM,GAAG,GAAG,uBAAuB,CAAC,CAAC,GAAG,UAAU,EAAE,GAAG,IAAA,wBAAgB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE;YACxF,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;YAChD,qBAAqB,EAAE,OAAO,CAAC,qBAAqB;SACrD,CAAC,CAAC;QACH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC,CAAC;AArCW,QAAA,4BAA4B,gCAqCvC","sourcesContent":["// Vendored / modified from @facebook/metro\n\n// https://github.com/facebook/metro/commit/9b85f83c9cc837d8cd897aa7723be7da5b296067\n\n// MIT License\n\n// Copyright (c) Meta Platforms, Inc. and affiliates.\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport type { MixedOutput, Module, ReadOnlyGraph } from 'metro';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as baseJSBundle from 'metro/src/DeltaBundler/Serializers/baseJSBundle';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as sourceMapString from 'metro/src/DeltaBundler/Serializers/sourceMapString';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as bundleToString from 'metro/src/lib/bundleToString';\nimport type { MetroSerializer } from '../../utils';\n\ntype NewSourceMapStringExport = {\n // Since Metro v0.80.10 https://github.com/facebook/metro/compare/v0.80.9...v0.80.10#diff-1b836d1729e527a725305eef0cec22e44605af2700fa413f4c2489ea1a03aebcL28\n sourceMapString: typeof sourceMapString;\n};\n\n/**\n * This function ensures that modules in source maps are sorted in the same\n * order as in a plain JS bundle.\n *\n * https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/Server.js#L984\n */\nexport const getSortedModules = (\n graph: ReadOnlyGraph,\n {\n createModuleId,\n }: {\n createModuleId: (file: string) => number;\n },\n): readonly Module[] => {\n const modules = [...graph.dependencies.values()];\n // Sort by IDs\n return modules.sort(\n (a: Module<MixedOutput>, b: Module<MixedOutput>) => createModuleId(a.path) - createModuleId(b.path),\n );\n};\n\n/**\n * Creates the default Metro plain bundle serializer.\n * Because Metro exports only the intermediate serializer functions, we need to\n * assemble the final serializer ourselves. We have to work with the modules the same as Metro does\n * to avoid unexpected changes in the final bundle.\n *\n * This is used when the user does not provide a custom serializer.\n *\n * https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/Server.js#L244-L277\n */\nexport const createDefaultMetroSerializer = (): MetroSerializer => {\n return (entryPoint, preModules, graph, options) => {\n // baseJSBundle assigns IDs to modules in a consistent order\n let bundle = baseJSBundle(entryPoint, preModules, graph, options);\n if (options.sentryBundleCallback && !graph.transformOptions.hot) {\n bundle = options.sentryBundleCallback(bundle);\n }\n const { code } = bundleToString(bundle);\n if (graph.transformOptions.hot) {\n // Hot means running in dev server, sourcemaps are generated on demand\n return code;\n }\n\n let sourceMapStringFunction: typeof sourceMapString | undefined;\n if (typeof sourceMapString === 'function') {\n sourceMapStringFunction = sourceMapString;\n } else if (\n typeof sourceMapString === 'object' &&\n sourceMapString != null &&\n 'sourceMapString' in sourceMapString &&\n typeof sourceMapString['sourceMapString'] === 'function'\n ) {\n sourceMapStringFunction = (sourceMapString as NewSourceMapStringExport).sourceMapString;\n } else {\n throw new Error(`\n[@sentry/react-native/metro] Cannot find sourceMapString function in 'metro/src/DeltaBundler/Serializers/sourceMapString'.\nPlease check the version of Metro you are using and report the issue at http://www.github.com/getsentry/sentry-react-native/issues\n`);\n }\n\n // Always generate source maps, can't use Sentry without source maps\n const map = sourceMapStringFunction([...preModules, ...getSortedModules(graph, options)], {\n processModuleFilter: options.processModuleFilter,\n shouldAddToIgnoreList: options.shouldAddToIgnoreList,\n });\n return { code, map };\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"touchevents.d.ts","sourceRoot":"","sources":["../../src/js/touchevents.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,MAAM,MAAM,uBAAuB,GAAG;IACpC;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACrC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7C;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;C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;CACpB,CAAC;AAqCF;;GAEG;AACH,cAAM,kBAAmB,SAAQ,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC;IACvE,OAAc,WAAW,EAAE,MAAM,CAAiC;IAClE,OAAc,YAAY,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAK1D;IAEF,SAAgB,IAAI,EAAE,MAAM,CAAwB;IAEpD;;OAEG;IACI,iBAAiB,IAAI,IAAI;IAKhC;;OAEG;IACI,MAAM,IAAI,KAAK,CAAC,SAAS;IAYhC;;OAEG;IACH,OAAO,CAAC,cAAc;IAsBtB;;OAEG;IACH,OAAO,CAAC,cAAc;IAoBtB;;;OAGG;IAEH,OAAO,CAAC,aAAa;IAyCrB;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAuB1B;AA0DD;;;;GAIG;AACH,QAAA,MAAM,sBAAsB,mBAEV,MAAM,aAAa,CAAC,GAAG,CAAC,kBACxB,uBAAuB,KACtC,MAAM,iBAUR,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC"}
@@ -47,6 +47,10 @@ class TouchEventBoundary extends React.Component {
47
47
  _logTouchEvent(touchPath, label) {
48
48
  const level = 'info';
49
49
  const root = touchPath[0];
50
+ if (!root) {
51
+ logger.warn('[TouchEvents] No root component found in touch path.');
52
+ return;
53
+ }
50
54
  const detail = label ? label : `${root.name}${root.file ? ` (${root.file})` : ''}`;
51
55
  const crumb = {
52
56
  category: this.props.breadcrumbCategory,
@@ -1 +1 @@
1
- {"version":3,"file":"touchevents.js","sourceRoot":"","sources":["../../src/js/touchevents.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,EAAE,gCAAgC,EAAE,MAAM,cAAc,CAAC;AACrH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,iBAAiB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Q,CAAY,CAAC,MAAM,GAAG,CAAC;YAC5G,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAW;YAC3B,CAAC,CAAC,SAAS,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,MAAM,sBAAsB,GAAG;AAC7B,8DAA8D;AAC9D,cAAwC,EACxC,aAAuC,EACd,EAAE;IAC3B,MAAM,gBAAgB,GAA4B,KAAK,CAAC,EAAE,CAAC,CACzD,oBAAC,kBAAkB,oBAAK,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,EAAE,CAAC;QAC3C,oBAAC,cAAc,oBAAK,KAAK,EAAI,CACV,CACtB,CAAC;IAEF,gBAAgB,CAAC,WAAW,GAAG,wBAAwB,CAAC;IAExD,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC","sourcesContent":["import type { SeverityLevel } from '@sentry/core';\nimport { addBreadcrumb, dropUndefinedKeys, getClient, logger, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\nimport * as React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport { StyleSheet, View } from 'react-native';\n\nimport { createIntegration } from './integrations/factory';\nimport { startUserInteractionSpan } from './tracing/integrations/userInteraction';\nimport { UI_ACTION_TOUCH } from './tracing/ops';\nimport { SPAN_ORIGIN_AUTO_INTERACTION } from './tracing/origin';\n\nexport type TouchEventBoundaryProps = {\n /**\n * The category assigned to the breadcrumb that is logged by the touch event.\n */\n breadcrumbCategory?: string;\n /**\n * The type assigned to the breadcrumb that is logged by the touch event.\n */\n breadcrumbType?: string;\n /**\n * The max number of components to display when logging a touch's component tree.\n */\n maxComponentTreeSize?: number;\n /**\n * Component name(s) to ignore when logging the touch event. This prevents unhelpful logs such as\n * \"Touch event within element: View\" where you still can't tell which View it occurred in.\n */\n ignoreNames?: Array<string | RegExp>;\n /**\n * Deprecated, use ignoreNames instead\n * @deprecated\n */\n ignoredDisplayNames?: Array<string | RegExp>;\n /**\n * React Node wrapped by TouchEventBoundary.\n */\n children?: React.ReactNode;\n /**\n * Label Name used to identify the touched element.\n */\n labelName?: string;\n};\n\nconst touchEventStyles = StyleSheet.create({\n wrapperView: {\n flex: 1,\n },\n});\n\nconst DEFAULT_BREADCRUMB_CATEGORY = 'touch';\nconst DEFAULT_BREADCRUMB_TYPE = 'user';\nconst DEFAULT_MAX_COMPONENT_TREE_SIZE = 20;\n\nconst SENTRY_LABEL_PROP_KEY = 'sentry-label';\nconst SENTRY_COMPONENT_PROP_KEY = 'data-sentry-component';\nconst SENTRY_ELEMENT_PROP_KEY = 'data-sentry-element';\nconst SENTRY_FILE_PROP_KEY = 'data-sentry-source-file';\n\ninterface ElementInstance {\n elementType?: {\n displayName?: string;\n name?: string;\n };\n memoizedProps?: Record<string, unknown>;\n return?: ElementInstance;\n}\n\ninterface TouchedComponentInfo {\n name?: string;\n label?: string;\n element?: string;\n file?: string;\n}\n\ninterface PrivateGestureResponderEvent extends GestureResponderEvent {\n _targetInst?: ElementInstance;\n}\n\n/**\n * Boundary to log breadcrumbs for interaction events.\n */\nclass TouchEventBoundary extends React.Component<TouchEventBoundaryProps> {\n public static displayName: string = '__Sentry.TouchEventBoundary';\n public static defaultProps: Partial<TouchEventBoundaryProps> = {\n breadcrumbCategory: DEFAULT_BREADCRUMB_CATEGORY,\n breadcrumbType: DEFAULT_BREADCRUMB_TYPE,\n ignoreNames: [],\n maxComponentTreeSize: DEFAULT_MAX_COMPONENT_TREE_SIZE,\n };\n\n public readonly name: string = 'TouchEventBoundary';\n\n /**\n * Registers the TouchEventBoundary as a Sentry Integration.\n */\n public componentDidMount(): void {\n const client = getClient();\n client?.addIntegration?.(createIntegration(this.name));\n }\n\n /**\n *\n */\n public render(): React.ReactNode {\n return (\n <View\n style={touchEventStyles.wrapperView}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onTouchStart={this._onTouchStart.bind(this) as any}\n >\n {this.props.children}\n </View>\n );\n }\n\n /**\n * Logs the touch event given the component tree names and a label.\n */\n private _logTouchEvent(touchPath: TouchedComponentInfo[], label?: string): void {\n const level = 'info' as SeverityLevel;\n\n const root = touchPath[0];\n const detail = label ? label : `${root.name}${root.file ? ` (${root.file})` : ''}`;\n\n const crumb = {\n category: this.props.breadcrumbCategory,\n data: { path: touchPath },\n level: level,\n message: `Touch event within element: ${detail}`,\n type: this.props.breadcrumbType,\n };\n addBreadcrumb(crumb);\n\n logger.log(`[TouchEvents] ${crumb.message}`);\n }\n\n /**\n * Checks if the name is supposed to be ignored.\n */\n private _isNameIgnored(name: string): boolean {\n let ignoreNames = this.props.ignoreNames || [];\n // eslint-disable-next-line deprecation/deprecation\n if (this.props.ignoredDisplayNames) {\n // This is to make it compatible with prior version.\n // eslint-disable-next-line deprecation/deprecation\n ignoreNames = [...ignoreNames, ...this.props.ignoredDisplayNames];\n }\n\n return ignoreNames.some(\n (ignoreName: string | RegExp) =>\n (typeof ignoreName === 'string' && name === ignoreName) ||\n (ignoreName instanceof RegExp && name.match(ignoreName)),\n );\n }\n\n // Originally was going to clean the names of any HOCs as well but decided that it might hinder debugging effectively. Will leave here in case\n // private readonly _cleanName = (name: string): string =>\n // name.replace(/.*\\(/g, \"\").replace(/\\)/g, \"\");\n\n /**\n * Traverses through the component tree when a touch happens and logs it.\n * @param e\n */\n // eslint-disable-next-line complexity\n private _onTouchStart(e: PrivateGestureResponderEvent): void {\n if (!e._targetInst) {\n return;\n }\n\n let currentInst: ElementInstance | undefined = e._targetInst;\n const touchPath: TouchedComponentInfo[] = [];\n\n while (\n currentInst &&\n // maxComponentTreeSize will always be defined as we have a defaultProps. But ts needs a check so this is here.\n this.props.maxComponentTreeSize &&\n touchPath.length < this.props.maxComponentTreeSize\n ) {\n if (\n // If the loop gets to the boundary itself, break.\n currentInst.elementType?.displayName === TouchEventBoundary.displayName\n ) {\n break;\n }\n\n const info = getTouchedComponentInfo(currentInst, this.props.labelName);\n this._pushIfNotIgnored(touchPath, info);\n\n currentInst = currentInst.return;\n }\n\n const label = touchPath.find(info => info.label)?.label;\n if (touchPath.length > 0) {\n this._logTouchEvent(touchPath, label);\n }\n\n const span = startUserInteractionSpan({\n elementId: label,\n op: UI_ACTION_TOUCH,\n });\n if (span) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_INTERACTION);\n }\n }\n\n /**\n * Pushes the name to the componentTreeNames array if it is not ignored.\n */\n private _pushIfNotIgnored(touchPath: TouchedComponentInfo[], value: TouchedComponentInfo | undefined): boolean {\n if (!value) {\n return false;\n }\n\n if (!value.name && !value.label) {\n return false;\n }\n if (value.name && this._isNameIgnored(value.name)) {\n return false;\n }\n if (value.label && this._isNameIgnored(value.label)) {\n return false;\n }\n\n // Deduplicate same subsequent items.\n if (touchPath.length > 0 && JSON.stringify(touchPath[touchPath.length - 1]) === JSON.stringify(value)) {\n return false;\n }\n\n touchPath.push(value);\n return true;\n }\n}\n\nfunction getTouchedComponentInfo(currentInst: ElementInstance, labelKey: string | undefined): TouchedComponentInfo | undefined {\n const displayName = currentInst.elementType?.displayName;\n\n const props = currentInst.memoizedProps;\n if (!props) {\n // Early return if no props are available, as we can't extract any useful information\n if (displayName) {\n return {\n name: displayName,\n };\n }\n return undefined;\n }\n\n return dropUndefinedKeys<TouchedComponentInfo>({\n // provided by @sentry/babel-plugin-component-annotate\n name: getComponentName(props) || displayName,\n element: getElementName(props),\n file: getFileName(props),\n\n // `sentry-label` or user defined label key\n label: getLabelValue(props, labelKey),\n });\n}\n\nfunction getComponentName(props: Record<string, unknown>): string | undefined {\n return typeof props[SENTRY_COMPONENT_PROP_KEY] === 'string' &&\n props[SENTRY_COMPONENT_PROP_KEY].length > 0 &&\n props[SENTRY_COMPONENT_PROP_KEY] !== 'unknown' &&\n props[SENTRY_COMPONENT_PROP_KEY] || undefined;\n}\n\nfunction getElementName(props: Record<string, unknown>): string | undefined {\n return typeof props[SENTRY_ELEMENT_PROP_KEY] === 'string' &&\n props[SENTRY_ELEMENT_PROP_KEY].length > 0 &&\n props[SENTRY_ELEMENT_PROP_KEY] !== 'unknown' &&\n props[SENTRY_ELEMENT_PROP_KEY] || undefined;\n}\n\nfunction getFileName(props: Record<string, unknown>): string | undefined {\n return typeof props[SENTRY_FILE_PROP_KEY] === 'string' &&\n props[SENTRY_FILE_PROP_KEY].length > 0 &&\n props[SENTRY_FILE_PROP_KEY] !== 'unknown' &&\n props[SENTRY_FILE_PROP_KEY] || undefined;\n}\n\nfunction getLabelValue(props: Record<string, unknown>, labelKey: string | undefined): string | undefined {\n return typeof props[SENTRY_LABEL_PROP_KEY] === 'string' && props[SENTRY_LABEL_PROP_KEY].length > 0\n ? props[SENTRY_LABEL_PROP_KEY] as string\n // For some reason type narrowing doesn't work as expected with indexing when checking it all in one go in\n // the \"check-label\" if sentence, so we have to assign it to a variable here first\n : typeof labelKey === 'string' && typeof props[labelKey] == 'string' && (props[labelKey] as string).length > 0\n ? props[labelKey] as string\n : undefined;\n}\n\n/**\n * Convenience Higher-Order-Component for TouchEventBoundary\n * @param WrappedComponent any React Component\n * @param boundaryProps TouchEventBoundaryProps\n */\nconst withTouchEventBoundary = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n InnerComponent: React.ComponentType<any>,\n boundaryProps?: TouchEventBoundaryProps,\n): React.FunctionComponent => {\n const WrappedComponent: React.FunctionComponent = props => (\n <TouchEventBoundary {...(boundaryProps ?? {})}>\n <InnerComponent {...props} />\n </TouchEventBoundary>\n );\n\n WrappedComponent.displayName = 'WithTouchEventBoundary';\n\n return WrappedComponent;\n};\n\nexport { TouchEventBoundary, withTouchEventBoundary };\n"]}
1
+ {"version":3,"file":"touchevents.js","sourceRoot":"","sources":["../../src/js/touchevents.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,EAAE,gCAAgC,EAAE,MAAM,cAAc,CAAC;AACrH,OAAO,KAAK,KAA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AAG,CAAC;QAChG,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAW;QACxC,0GAA0G;QAC1G,kFAAkF;QAClF,CAAC,CAAC,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAK,KAAK,CAAC,QAAQ,CAAY,CAAC,MAAM,GAAG,CAAC;YAC5G,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAW;YAC3B,CAAC,CAAC,SAAS,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,MAAM,sBAAsB,GAAG;AAC7B,8DAA8D;AAC9D,cAAwC,EACxC,aAAuC,EACd,EAAE;IAC3B,MAAM,gBAAgB,GAA4B,KAAK,CAAC,EAAE,CAAC,CACzD,oBAAC,kBAAkB,oBAAK,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,EAAE,CAAC;QAC3C,oBAAC,cAAc,oBAAK,KAAK,EAAI,CACV,CACtB,CAAC;IAEF,gBAAgB,CAAC,WAAW,GAAG,wBAAwB,CAAC;IAExD,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC","sourcesContent":["import type { SeverityLevel } from '@sentry/core';\nimport { addBreadcrumb, dropUndefinedKeys, getClient, logger, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\nimport * as React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport { StyleSheet, View } from 'react-native';\nimport { createIntegration } from './integrations/factory';\nimport { startUserInteractionSpan } from './tracing/integrations/userInteraction';\nimport { UI_ACTION_TOUCH } from './tracing/ops';\nimport { SPAN_ORIGIN_AUTO_INTERACTION } from './tracing/origin';\n\nexport type TouchEventBoundaryProps = {\n /**\n * The category assigned to the breadcrumb that is logged by the touch event.\n */\n breadcrumbCategory?: string;\n /**\n * The type assigned to the breadcrumb that is logged by the touch event.\n */\n breadcrumbType?: string;\n /**\n * The max number of components to display when logging a touch's component tree.\n */\n maxComponentTreeSize?: number;\n /**\n * Component name(s) to ignore when logging the touch event. This prevents unhelpful logs such as\n * \"Touch event within element: View\" where you still can't tell which View it occurred in.\n */\n ignoreNames?: Array<string | RegExp>;\n /**\n * Deprecated, use ignoreNames instead\n * @deprecated\n */\n ignoredDisplayNames?: Array<string | RegExp>;\n /**\n * React Node wrapped by TouchEventBoundary.\n */\n children?: React.ReactNode;\n /**\n * Label Name used to identify the touched element.\n */\n labelName?: string;\n};\n\nconst touchEventStyles = StyleSheet.create({\n wrapperView: {\n flex: 1,\n },\n});\n\nconst DEFAULT_BREADCRUMB_CATEGORY = 'touch';\nconst DEFAULT_BREADCRUMB_TYPE = 'user';\nconst DEFAULT_MAX_COMPONENT_TREE_SIZE = 20;\n\nconst SENTRY_LABEL_PROP_KEY = 'sentry-label';\nconst SENTRY_COMPONENT_PROP_KEY = 'data-sentry-component';\nconst SENTRY_ELEMENT_PROP_KEY = 'data-sentry-element';\nconst SENTRY_FILE_PROP_KEY = 'data-sentry-source-file';\n\ninterface ElementInstance {\n elementType?: {\n displayName?: string;\n name?: string;\n };\n memoizedProps?: Record<string, unknown>;\n return?: ElementInstance;\n}\n\ninterface TouchedComponentInfo {\n name?: string;\n label?: string;\n element?: string;\n file?: string;\n}\n\ninterface PrivateGestureResponderEvent extends GestureResponderEvent {\n _targetInst?: ElementInstance;\n}\n\n/**\n * Boundary to log breadcrumbs for interaction events.\n */\nclass TouchEventBoundary extends React.Component<TouchEventBoundaryProps> {\n public static displayName: string = '__Sentry.TouchEventBoundary';\n public static defaultProps: Partial<TouchEventBoundaryProps> = {\n breadcrumbCategory: DEFAULT_BREADCRUMB_CATEGORY,\n breadcrumbType: DEFAULT_BREADCRUMB_TYPE,\n ignoreNames: [],\n maxComponentTreeSize: DEFAULT_MAX_COMPONENT_TREE_SIZE,\n };\n\n public readonly name: string = 'TouchEventBoundary';\n\n /**\n * Registers the TouchEventBoundary as a Sentry Integration.\n */\n public componentDidMount(): void {\n const client = getClient();\n client?.addIntegration?.(createIntegration(this.name));\n }\n\n /**\n *\n */\n public render(): React.ReactNode {\n return (\n <View\n style={touchEventStyles.wrapperView}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onTouchStart={this._onTouchStart.bind(this) as any}\n >\n {this.props.children}\n </View>\n );\n }\n\n /**\n * Logs the touch event given the component tree names and a label.\n */\n private _logTouchEvent(touchPath: TouchedComponentInfo[], label?: string): void {\n const level = 'info' as SeverityLevel;\n\n const root = touchPath[0];\n if (!root) {\n logger.warn('[TouchEvents] No root component found in touch path.');\n return;\n }\n\n const detail = label ? label : `${root.name}${root.file ? ` (${root.file})` : ''}`;\n const crumb = {\n category: this.props.breadcrumbCategory,\n data: { path: touchPath },\n level: level,\n message: `Touch event within element: ${detail}`,\n type: this.props.breadcrumbType,\n };\n addBreadcrumb(crumb);\n\n logger.log(`[TouchEvents] ${crumb.message}`);\n }\n\n /**\n * Checks if the name is supposed to be ignored.\n */\n private _isNameIgnored(name: string): boolean {\n let ignoreNames = this.props.ignoreNames || [];\n // eslint-disable-next-line deprecation/deprecation\n if (this.props.ignoredDisplayNames) {\n // This is to make it compatible with prior version.\n // eslint-disable-next-line deprecation/deprecation\n ignoreNames = [...ignoreNames, ...this.props.ignoredDisplayNames];\n }\n\n return ignoreNames.some(\n (ignoreName: string | RegExp) =>\n (typeof ignoreName === 'string' && name === ignoreName) ||\n (ignoreName instanceof RegExp && name.match(ignoreName)),\n );\n }\n\n // Originally was going to clean the names of any HOCs as well but decided that it might hinder debugging effectively. Will leave here in case\n // private readonly _cleanName = (name: string): string =>\n // name.replace(/.*\\(/g, \"\").replace(/\\)/g, \"\");\n\n /**\n * Traverses through the component tree when a touch happens and logs it.\n * @param e\n */\n // eslint-disable-next-line complexity\n private _onTouchStart(e: PrivateGestureResponderEvent): void {\n if (!e._targetInst) {\n return;\n }\n\n let currentInst: ElementInstance | undefined = e._targetInst;\n const touchPath: TouchedComponentInfo[] = [];\n\n while (\n currentInst &&\n // maxComponentTreeSize will always be defined as we have a defaultProps. But ts needs a check so this is here.\n this.props.maxComponentTreeSize &&\n touchPath.length < this.props.maxComponentTreeSize\n ) {\n if (\n // If the loop gets to the boundary itself, break.\n currentInst.elementType?.displayName === TouchEventBoundary.displayName\n ) {\n break;\n }\n\n const info = getTouchedComponentInfo(currentInst, this.props.labelName);\n this._pushIfNotIgnored(touchPath, info);\n\n currentInst = currentInst.return;\n }\n\n const label = touchPath.find(info => info.label)?.label;\n if (touchPath.length > 0) {\n this._logTouchEvent(touchPath, label);\n }\n\n const span = startUserInteractionSpan({\n elementId: label,\n op: UI_ACTION_TOUCH,\n });\n if (span) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_INTERACTION);\n }\n }\n\n /**\n * Pushes the name to the componentTreeNames array if it is not ignored.\n */\n private _pushIfNotIgnored(touchPath: TouchedComponentInfo[], value: TouchedComponentInfo | undefined): boolean {\n if (!value) {\n return false;\n }\n\n if (!value.name && !value.label) {\n return false;\n }\n if (value.name && this._isNameIgnored(value.name)) {\n return false;\n }\n if (value.label && this._isNameIgnored(value.label)) {\n return false;\n }\n\n // Deduplicate same subsequent items.\n if (touchPath.length > 0 && JSON.stringify(touchPath[touchPath.length - 1]) === JSON.stringify(value)) {\n return false;\n }\n\n touchPath.push(value);\n return true;\n }\n}\n\nfunction getTouchedComponentInfo(currentInst: ElementInstance, labelKey: string | undefined): TouchedComponentInfo | undefined {\n const displayName = currentInst.elementType?.displayName;\n\n const props = currentInst.memoizedProps;\n if (!props) {\n // Early return if no props are available, as we can't extract any useful information\n if (displayName) {\n return {\n name: displayName,\n };\n }\n return undefined;\n }\n\n return dropUndefinedKeys<TouchedComponentInfo>({\n // provided by @sentry/babel-plugin-component-annotate\n name: getComponentName(props) || displayName,\n element: getElementName(props),\n file: getFileName(props),\n\n // `sentry-label` or user defined label key\n label: getLabelValue(props, labelKey),\n });\n}\n\nfunction getComponentName(props: Record<string, unknown>): string | undefined {\n return typeof props[SENTRY_COMPONENT_PROP_KEY] === 'string' &&\n props[SENTRY_COMPONENT_PROP_KEY].length > 0 &&\n props[SENTRY_COMPONENT_PROP_KEY] !== 'unknown' &&\n props[SENTRY_COMPONENT_PROP_KEY] || undefined;\n}\n\nfunction getElementName(props: Record<string, unknown>): string | undefined {\n return typeof props[SENTRY_ELEMENT_PROP_KEY] === 'string' &&\n props[SENTRY_ELEMENT_PROP_KEY].length > 0 &&\n props[SENTRY_ELEMENT_PROP_KEY] !== 'unknown' &&\n props[SENTRY_ELEMENT_PROP_KEY] || undefined;\n}\n\nfunction getFileName(props: Record<string, unknown>): string | undefined {\n return typeof props[SENTRY_FILE_PROP_KEY] === 'string' &&\n props[SENTRY_FILE_PROP_KEY].length > 0 &&\n props[SENTRY_FILE_PROP_KEY] !== 'unknown' &&\n props[SENTRY_FILE_PROP_KEY] || undefined;\n}\n\nfunction getLabelValue(props: Record<string, unknown>, labelKey: string | undefined): string | undefined {\n return typeof props[SENTRY_LABEL_PROP_KEY] === 'string' && props[SENTRY_LABEL_PROP_KEY].length > 0\n ? props[SENTRY_LABEL_PROP_KEY] as string\n // For some reason type narrowing doesn't work as expected with indexing when checking it all in one go in\n // the \"check-label\" if sentence, so we have to assign it to a variable here first\n : typeof labelKey === 'string' && typeof props[labelKey] == 'string' && (props[labelKey] as string).length > 0\n ? props[labelKey] as string\n : undefined;\n}\n\n/**\n * Convenience Higher-Order-Component for TouchEventBoundary\n * @param WrappedComponent any React Component\n * @param boundaryProps TouchEventBoundaryProps\n */\nconst withTouchEventBoundary = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n InnerComponent: React.ComponentType<any>,\n boundaryProps?: TouchEventBoundaryProps,\n): React.FunctionComponent => {\n const WrappedComponent: React.FunctionComponent = props => (\n <TouchEventBoundary {...(boundaryProps ?? {})}>\n <InnerComponent {...props} />\n </TouchEventBoundary>\n );\n\n WrappedComponent.displayName = 'WithTouchEventBoundary';\n\n return WrappedComponent;\n};\n\nexport { TouchEventBoundary, withTouchEventBoundary };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"gesturetracing.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/gesturetracing.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,2BAA2B,YAAY,CAAC;AACrD,eAAO,MAAM,uBAAuB,SAAS,CAAC;AAE9C,eAAO,MAAM,sBAAsB,QAA0B,CAAC;AAC9D,eAAO,MAAM,uBAAuB,YAAY,CAAC;AAwBjD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ;AACzC;;;GAGG;AACH,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,GAChB,QAAQ,CA+CV"}
1
+ {"version":3,"file":"gesturetracing.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/gesturetracing.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,2BAA2B,YAAY,CAAC;AACrD,eAAO,MAAM,uBAAuB,SAAS,CAAC;AAE9C,eAAO,MAAM,sBAAsB,QAA0B,CAAC;AAC9D,eAAO,MAAM,uBAAuB,YAAY,CAAC;AAwBjD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ;AACzC;;;GAGG;AACH,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,GAChB,QAAQ,CA+CV"}
@@ -1 +1 @@
1
- {"version":3,"file":"gesturetracing.js","sourceRoot":"","sources":["../../../src/js/tracing/gesturetracing.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,gCAAgC,EAAE,MAAM,cAAc,CAAC;AAEvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExD,MAAM,CAAC,MAAM,2BAA2B,GAAG,SAAS,CAAC;AACrD,MAAM,CAAC,MAAM,uBAAu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ACH,MAAM,gBAAgB,GAAG;IACvB,kBAAkB,EAAE,kBAAkB;IACtC,iBAAiB,EAAE,iBAAiB;IACpC,KAAK,EAAE,OAAO;IACd,YAAY,EAAE,aAAa;IAC3B,QAAQ,EAAE,UAAU;IACpB,eAAe,EAAE,gBAAgB;IACjC,KAAK,EAAE,OAAO;IACd,YAAY,EAAE,aAAa;IAC3B,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,WAAW;IACvB,UAAU,EAAE,WAAW;CACf,CAAC","sourcesContent":["import type { Breadcrumb } from '@sentry/core';\nimport { addBreadcrumb, logger, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\n\nimport { startUserInteractionSpan } from './integrations/userInteraction';\nimport { UI_ACTION } from './ops';\nimport { SPAN_ORIGIN_AUTO_INTERACTION } from './origin';\n\nexport const DEFAULT_BREADCRUMB_CATEGORY = 'gesture';\nexport const DEFAULT_BREADCRUMB_TYPE = 'user';\n\nexport const GESTURE_POSTFIX_LENGTH = 'GestureHandler'.length;\nexport const ACTION_GESTURE_FALLBACK = 'gesture';\n\n/**\n * Internal interface following RNGH 2 Gesture Event API.\n * We need to use this to avoid importing RNGH 2 types and depending on it.\n * https://github.com/software-mansion/react-native-gesture-handler/blob/f0868f7ccf678c947ef65519ebf97ae149a10289/src/handlers/gestures/gesture.ts#L55\n * @hidden\n */\ntype GestureEvent = Record<string, unknown>;\n\n/**\n * Internal interface for RNGH 2 Gesture API.\n * We need to use this to avoid importing RNGH 2 types and depending on it.\n * https://github.com/software-mansion/react-native-gesture-handler/blob/2.9.0/src/handlers/gestures/gesture.ts#L120\n * @hidden\n */\ninterface BaseGesture {\n handlers?: {\n onBegin?: (event: GestureEvent) => void;\n onEnd?: (event: GestureEvent) => void;\n };\n handlerName: string;\n}\n\n/**\n * Patches React Native Gesture Handler v2 Gesture to start a transaction on gesture begin with the appropriate label.\n * Example: ShoppingCartScreen.dismissGesture\n */\nexport function sentryTraceGesture<GestureT>(\n /**\n * Label of the gesture to be used in transaction name.\n * Example: dismissGesture\n */\n label: string,\n gesture: GestureT,\n): GestureT {\n const gestureCandidate = gesture as unknown as BaseGesture | undefined | null;\n if (!gestureCandidate) {\n logger.warn('[GestureTracing] Gesture can not be undefined');\n return gesture;\n }\n if (!gestureCandidate.handlers) {\n logger.warn(\n '[GestureTracing] Can not wrap gesture without handlers. If you want to wrap a gesture composition wrap individual gestures.',\n );\n return gesture;\n }\n if (!label) {\n logger.warn('[GestureTracing] Can not wrap gesture without name.');\n return gesture;\n }\n const name =\n gestureCandidate.handlerName.length > GESTURE_POSTFIX_LENGTH\n ? gestureCandidate.handlerName\n .substring(0, gestureCandidate.handlerName.length - GESTURE_POSTFIX_LENGTH)\n .toLowerCase()\n : ACTION_GESTURE_FALLBACK;\n\n const originalOnBegin = gestureCandidate.handlers.onBegin;\n (gesture as unknown as Required<BaseGesture>).handlers.onBegin = (event: GestureEvent) => {\n const span = startUserInteractionSpan({ elementId: label, op: `${UI_ACTION}.${name}` });\n if (span) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_INTERACTION);\n }\n\n addGestureBreadcrumb(`Gesture ${label} begin.`, { event, name });\n\n if (originalOnBegin) {\n originalOnBegin(event);\n }\n };\n\n const originalOnEnd = gestureCandidate.handlers.onEnd;\n (gesture as unknown as Required<BaseGesture>).handlers.onEnd = (event: GestureEvent) => {\n addGestureBreadcrumb(`Gesture ${label} end.`, { event, name });\n\n if (originalOnEnd) {\n originalOnEnd(event);\n }\n };\n\n return gesture;\n}\n\nfunction addGestureBreadcrumb(\n message: string,\n options: {\n event: Record<string, unknown> | undefined | null;\n name: string;\n },\n): void {\n const { event, name } = options;\n const crumb: Breadcrumb = {\n message,\n level: 'info',\n type: DEFAULT_BREADCRUMB_TYPE,\n category: DEFAULT_BREADCRUMB_CATEGORY,\n };\n\n if (event) {\n const data: Record<string, unknown> = {\n gesture: name,\n };\n for (const key of Object.keys(GestureEventKeys)) {\n const eventKey = GestureEventKeys[key as keyof typeof GestureEventKeys];\n if (eventKey in event) {\n data[eventKey] = event[eventKey];\n }\n }\n crumb.data = data;\n }\n\n addBreadcrumb(crumb);\n\n logger.log(`[GestureTracing] ${crumb.message}`);\n}\n\n/**\n * Selected keys from RNGH 2 Gesture Event API.\n * We only want to send relevant data to save on payload size.\n * @hidden\n */\nconst GestureEventKeys = {\n NUMBER_OF_POINTERS: 'numberOfPointers',\n NUMBER_OF_TOUCHES: 'numberOfTouches',\n FORCE: 'force',\n FORCE_CHANGE: 'forceChange',\n ROTATION: 'rotation',\n ROTATION_CHANGE: 'rotationChange',\n SCALE: 'scale',\n SCALE_CHANGE: 'scaleChange',\n DURATION: 'duration',\n VELOCITY: 'velocity',\n VELOCITY_X: 'velocityX',\n VELOCITY_Y: 'velocityY',\n} as const;\n"]}
1
+ {"version":3,"file":"gesturetracing.js","sourceRoot":"","sources":["../../../src/js/tracing/gesturetracing.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,gCAAgC,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExD,MAAM,CAAC,MAAM,2BAA2B,GAAG,SAAS,CAAC;AACrD,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAE9C,MAAM,CAAC,MAAM,sBAAsB,GAAG,gBAAgB,CAAC,MAAM,CAAC;AAC9D,MAAM,CAAC,MAAM,uBAAuB,GAAG,SAAS,CAAC;AAwBjD;;;GAGG;AACH,MAAM,UAAU,kBAAkB;AAChC;;;GAGG;AACH,KAAa,EACb,OAAiB;IAEjB,MAAM,gBAAgB,GAAG,OAAoD,CAAC;IAC9E,IAAI,CAAC,gBAAgB,EAAE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,EAAE,WAAW;IACvB,UAAU,EAAE,WAAW;CACf,CAAC","sourcesContent":["import type { Breadcrumb } from '@sentry/core';\nimport { addBreadcrumb, logger, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\nimport { startUserInteractionSpan } from './integrations/userInteraction';\nimport { UI_ACTION } from './ops';\nimport { SPAN_ORIGIN_AUTO_INTERACTION } from './origin';\n\nexport const DEFAULT_BREADCRUMB_CATEGORY = 'gesture';\nexport const DEFAULT_BREADCRUMB_TYPE = 'user';\n\nexport const GESTURE_POSTFIX_LENGTH = 'GestureHandler'.length;\nexport const ACTION_GESTURE_FALLBACK = 'gesture';\n\n/**\n * Internal interface following RNGH 2 Gesture Event API.\n * We need to use this to avoid importing RNGH 2 types and depending on it.\n * https://github.com/software-mansion/react-native-gesture-handler/blob/f0868f7ccf678c947ef65519ebf97ae149a10289/src/handlers/gestures/gesture.ts#L55\n * @hidden\n */\ntype GestureEvent = Record<string, unknown>;\n\n/**\n * Internal interface for RNGH 2 Gesture API.\n * We need to use this to avoid importing RNGH 2 types and depending on it.\n * https://github.com/software-mansion/react-native-gesture-handler/blob/2.9.0/src/handlers/gestures/gesture.ts#L120\n * @hidden\n */\ninterface BaseGesture {\n handlers?: {\n onBegin?: (event: GestureEvent) => void;\n onEnd?: (event: GestureEvent) => void;\n };\n handlerName: string;\n}\n\n/**\n * Patches React Native Gesture Handler v2 Gesture to start a transaction on gesture begin with the appropriate label.\n * Example: ShoppingCartScreen.dismissGesture\n */\nexport function sentryTraceGesture<GestureT>(\n /**\n * Label of the gesture to be used in transaction name.\n * Example: dismissGesture\n */\n label: string,\n gesture: GestureT,\n): GestureT {\n const gestureCandidate = gesture as unknown as BaseGesture | undefined | null;\n if (!gestureCandidate) {\n logger.warn('[GestureTracing] Gesture can not be undefined');\n return gesture;\n }\n if (!gestureCandidate.handlers) {\n logger.warn(\n '[GestureTracing] Can not wrap gesture without handlers. If you want to wrap a gesture composition wrap individual gestures.',\n );\n return gesture;\n }\n if (!label) {\n logger.warn('[GestureTracing] Can not wrap gesture without name.');\n return gesture;\n }\n const name =\n gestureCandidate.handlerName.length > GESTURE_POSTFIX_LENGTH\n ? gestureCandidate.handlerName\n .substring(0, gestureCandidate.handlerName.length - GESTURE_POSTFIX_LENGTH)\n .toLowerCase()\n : ACTION_GESTURE_FALLBACK;\n\n const originalOnBegin = gestureCandidate.handlers.onBegin;\n (gesture as unknown as Required<BaseGesture>).handlers.onBegin = (event: GestureEvent) => {\n const span = startUserInteractionSpan({ elementId: label, op: `${UI_ACTION}.${name}` });\n if (span) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_INTERACTION);\n }\n\n addGestureBreadcrumb(`Gesture ${label} begin.`, { event, name });\n\n if (originalOnBegin) {\n originalOnBegin(event);\n }\n };\n\n const originalOnEnd = gestureCandidate.handlers.onEnd;\n (gesture as unknown as Required<BaseGesture>).handlers.onEnd = (event: GestureEvent) => {\n addGestureBreadcrumb(`Gesture ${label} end.`, { event, name });\n\n if (originalOnEnd) {\n originalOnEnd(event);\n }\n };\n\n return gesture;\n}\n\nfunction addGestureBreadcrumb(\n message: string,\n options: {\n event: Record<string, unknown> | undefined | null;\n name: string;\n },\n): void {\n const { event, name } = options;\n const crumb: Breadcrumb = {\n message,\n level: 'info',\n type: DEFAULT_BREADCRUMB_TYPE,\n category: DEFAULT_BREADCRUMB_CATEGORY,\n };\n\n if (event) {\n const data: Record<string, unknown> = {\n gesture: name,\n };\n for (const key of Object.keys(GestureEventKeys)) {\n const eventKey = GestureEventKeys[key as keyof typeof GestureEventKeys];\n if (eventKey in event) {\n data[eventKey] = event[eventKey];\n }\n }\n crumb.data = data;\n }\n\n addBreadcrumb(crumb);\n\n logger.log(`[GestureTracing] ${crumb.message}`);\n}\n\n/**\n * Selected keys from RNGH 2 Gesture Event API.\n * We only want to send relevant data to save on payload size.\n * @hidden\n */\nconst GestureEventKeys = {\n NUMBER_OF_POINTERS: 'numberOfPointers',\n NUMBER_OF_TOUCHES: 'numberOfTouches',\n FORCE: 'force',\n FORCE_CHANGE: 'forceChange',\n ROTATION: 'rotation',\n ROTATION_CHANGE: 'rotationChange',\n SCALE: 'scale',\n SCALE_CHANGE: 'scaleChange',\n DURATION: 'duration',\n VELOCITY: 'velocity',\n VELOCITY_X: 'velocityX',\n VELOCITY_Y: 'velocityY',\n} as const;\n"]}
@@ -48,6 +48,6 @@ export declare const appStartIntegration: ({ standalone, }?: {
48
48
  *
49
49
  * @default false
50
50
  */
51
- standalone?: boolean;
51
+ standalone?: boolean | undefined;
52
52
  }) => AppStartIntegration;
53
53
  //# sourceMappingURL=appStart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"appStart.d.ts","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/appStart.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,WAAW,EAAoC,MAAM,cAAc,CAAC;AAiCjG,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC9C,yBAAyB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD,CAAC;AAqBF;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAUzF;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAM7E;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAG9E;AAED;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,gBAAiB,MAAM,KAAG,IAGhE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,sCAAsC,IAAI,IAAI,CAE7D;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB;IAG9B;;;;;OAKG;iBACU,OAAO;MACb,mBA0QR,CAAC"}
1
+ {"version":3,"file":"appStart.d.ts","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/appStart.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,WAAW,EAAoC,MAAM,cAAc,CAAC;AAgCjG,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC9C,yBAAyB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD,CAAC;AAqBF;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAUzF;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAM7E;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAG9E;AAED;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,gBAAiB,MAAM,KAAG,IAGhE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,sCAAsC,IAAI,IAAI,CAE7D;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB;IAG9B;;;;;OAKG;;MAEI,mBAiRR,CAAC"}
@@ -160,6 +160,12 @@ export const appStartIntegration = ({ standalone = false, } = {}) => {
160
160
  };
161
161
  function captureStandaloneAppStart() {
162
162
  return __awaiter(this, void 0, void 0, function* () {
163
+ if (!_client) {
164
+ // If client is not set, SDK was not initialized, logger is thus disabled
165
+ // eslint-disable-next-line no-console
166
+ console.warn('[AppStart] Could not capture App Start, missing client, call `Sentry.init` first.');
167
+ return;
168
+ }
163
169
  if (!standalone) {
164
170
  logger.debug('[AppStart] App start tracking is enabled. App start will be added to the first transaction as a child span.');
165
171
  return;
@@ -191,6 +197,7 @@ export const appStartIntegration = ({ standalone = false, } = {}) => {
191
197
  });
192
198
  }
193
199
  function attachAppStartToTransactionEvent(event) {
200
+ var _a;
194
201
  return __awaiter(this, void 0, void 0, function* () {
195
202
  if (appStartDataFlushed) {
196
203
  // App start data is only relevant for the first transaction of the app run
@@ -200,7 +207,7 @@ export const appStartIntegration = ({ standalone = false, } = {}) => {
200
207
  logger.warn('[AppStart] No first started active root span id recorded. Can not attach app start.');
201
208
  return;
202
209
  }
203
- if (!event.contexts || !event.contexts.trace) {
210
+ if (!((_a = event.contexts) === null || _a === void 0 ? void 0 : _a.trace)) {
204
211
  logger.warn('[AppStart] Transaction event is missing trace context. Can not attach app start.');
205
212
  return;
206
213
  }
@@ -275,7 +282,7 @@ export const appStartIntegration = ({ standalone = false, } = {}) => {
275
282
  const op = appStart.type === 'cold' ? APP_START_COLD_OP : APP_START_WARM_OP;
276
283
  const appStartSpanJSON = createSpanJSON({
277
284
  op,
278
- description: appStart.type === 'cold' ? 'Cold App Start' : 'Warm App Start',
285
+ description: appStart.type === 'cold' ? 'Cold Start' : 'Warm Start',
279
286
  start_timestamp: appStartTimestampSeconds,
280
287
  timestamp: appStartEndTimestampSeconds,
281
288
  trace_id: event.contexts.trace.trace_id,
@@ -297,7 +304,7 @@ export const appStartIntegration = ({ standalone = false, } = {}) => {
297
304
  };
298
305
  event.measurements = event.measurements || {};
299
306
  event.measurements[measurementKey] = measurementValue;
300
- logger.debug(`[AppStart] Added app start measurement to transaction event.`, JSON.stringify(measurementValue, undefined, 2));
307
+ logger.debug('[AppStart] Added app start measurement to transaction event.', JSON.stringify(measurementValue, undefined, 2));
301
308
  });
302
309
  }
303
310
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"appStart.js","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/appStart.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,MAAM,EACN,gCAAgC,EAChC,sB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CAAC,kBAAkB,GAAG,IAAI;YAC1D,SAAS,EAAE,eAAe,CAAC,gBAAgB,GAAG,IAAI;YAClD,MAAM,EAAE,0BAA0B;SACnC,CAAC,CAAC;KACJ;AACH,CAAC","sourcesContent":["/* eslint-disable complexity, max-lines */\nimport type { Client, Event, Integration, Span, SpanJSON, TransactionEvent } from '@sentry/core';\nimport {\n getCapturedScopesOnSpan,\n getClient,\n getCurrentScope,\n logger,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n startInactiveSpan,\n timestampInSeconds,\n} from '@sentry/core';\n\nimport { getAppRegistryIntegration } from '../../integrations/appRegistry';\nimport {\n APP_START_COLD as APP_START_COLD_MEASUREMENT,\n APP_START_WARM as APP_START_WARM_MEASUREMENT,\n} from '../../measurements';\nimport type { NativeAppStartResponse } from '../../NativeRNSentry';\nimport type { ReactNativeClientOptions } from '../../options';\nimport { convertSpanToTransaction, isRootSpan, setEndTimeValue } from '../../utils/span';\nimport { NATIVE } from '../../wrapper';\nimport {\n APP_START_COLD as APP_START_COLD_OP,\n APP_START_WARM as APP_START_WARM_OP,\n UI_LOAD as UI_LOAD_OP,\n} from '../ops';\nimport { SPAN_ORIGIN_AUTO_APP_START, SPAN_ORIGIN_MANUAL_APP_START } from '../origin';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '../semanticAttributes';\nimport { setMainThreadInfo } from '../span';\nimport { createChildSpanJSON, createSpanJSON, getBundleStartTimestampMs } from '../utils';\n\nconst INTEGRATION_NAME = 'AppStart';\n\nexport type AppStartIntegration = Integration & {\n captureStandaloneAppStart: () => Promise<void>;\n};\n\n/**\n * We filter out app start more than 60s.\n * This could be due to many different reasons.\n * We've seen app starts with hours, days and even months.\n */\nconst MAX_APP_START_DURATION_MS = 60_000;\n\n/** We filter out App starts which timestamp is 60s and more before the transaction start */\nconst MAX_APP_START_AGE_MS = 60_000;\n\n/** App Start transaction name */\nconst APP_START_TX_NAME = 'App Start';\n\nlet recordedAppStartEndTimestampMs: number | undefined = undefined;\nlet isRecordedAppStartEndTimestampMsManual = false;\n\nlet rootComponentCreationTimestampMs: number | undefined = undefined;\nlet isRootComponentCreationTimestampMsManual = false;\n\n/**\n * Records the application start end.\n * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.\n */\nexport function captureAppStart(): Promise<void> {\n return _captureAppStart({ isManual: true });\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport async function _captureAppStart({ isManual }: { isManual: boolean }): Promise<void> {\n const client = getClient();\n if (!client) {\n logger.warn('[AppStart] Could not capture App Start, missing client.');\n return;\n }\n\n isRecordedAppStartEndTimestampMsManual = isManual;\n _setAppStartEndTimestampMs(timestampInSeconds() * 1000);\n await client.getIntegrationByName<AppStartIntegration>(INTEGRATION_NAME)?.captureStandaloneAppStart();\n}\n\n/**\n * Sets the root component first constructor call timestamp.\n * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.\n */\nexport function setRootComponentCreationTimestampMs(timestampMs: number): void {\n recordedAppStartEndTimestampMs &&\n logger.warn('Setting Root component creation timestamp after app start end is set.');\n rootComponentCreationTimestampMs && logger.warn('Overwriting already set root component creation timestamp.');\n rootComponentCreationTimestampMs = timestampMs;\n isRootComponentCreationTimestampMsManual = true;\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport function _setRootComponentCreationTimestampMs(timestampMs: number): void {\n setRootComponentCreationTimestampMs(timestampMs);\n isRootComponentCreationTimestampMsManual = false;\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport const _setAppStartEndTimestampMs = (timestampMs: number): void => {\n recordedAppStartEndTimestampMs && logger.warn('Overwriting already set app start.');\n recordedAppStartEndTimestampMs = timestampMs;\n};\n\n/**\n * For testing purposes only.\n *\n * @private\n */\nexport function _clearRootComponentCreationTimestampMs(): void {\n rootComponentCreationTimestampMs = undefined;\n}\n\n/**\n * Adds AppStart spans from the native layer to the transaction event.\n */\nexport const appStartIntegration = ({\n standalone = false,\n}: {\n /**\n * Should the integration send App Start as a standalone root span (transaction)?\n * If false, App Start will be added as a child span to the first transaction.\n *\n * @default false\n */\n standalone?: boolean;\n} = {}): AppStartIntegration => {\n let _client: Client | undefined = undefined;\n let isEnabled = true;\n let appStartDataFlushed = false;\n let afterAllSetupCalled = false;\n let firstStartedActiveRootSpanId: string | undefined = undefined;\n\n const setup = (client: Client): void => {\n _client = client;\n const { enableAppStartTracking } = client.getOptions() as ReactNativeClientOptions;\n\n if (!enableAppStartTracking) {\n isEnabled = false;\n logger.warn('[AppStart] App start tracking is disabled.');\n }\n\n client.on('spanStart', recordFirstStartedActiveRootSpanId);\n };\n\n const afterAllSetup = (client: Client): void => {\n if (afterAllSetupCalled) {\n return;\n }\n afterAllSetupCalled = true;\n\n // TODO: automatically set standalone based on the presence of the native layer navigation integration\n\n getAppRegistryIntegration(client)?.onRunApplication(() => {\n if (appStartDataFlushed) {\n logger.log('[AppStartIntegration] Resetting app start data flushed flag based on runApplication call.');\n appStartDataFlushed = false;\n firstStartedActiveRootSpanId = undefined;\n } else {\n logger.log(\n '[AppStartIntegration] Waiting for initial app start was flush, before updating based on runApplication call.',\n );\n }\n });\n };\n\n const processEvent = async (event: Event): Promise<Event> => {\n if (!isEnabled || standalone) {\n return event;\n }\n\n if (event.type !== 'transaction') {\n // App start data is only relevant for transactions\n return event;\n }\n\n await attachAppStartToTransactionEvent(event as TransactionEvent);\n\n return event;\n };\n\n const recordFirstStartedActiveRootSpanId = (rootSpan: Span): void => {\n if (firstStartedActiveRootSpanId) {\n return;\n }\n\n if (!isRootSpan(rootSpan)) {\n return;\n }\n\n setFirstStartedActiveRootSpanId(rootSpan.spanContext().spanId);\n };\n\n /**\n * For testing purposes only.\n * @private\n */\n const setFirstStartedActiveRootSpanId = (spanId: string | undefined): void => {\n firstStartedActiveRootSpanId = spanId;\n logger.debug('[AppStart] First started active root span id recorded.', firstStartedActiveRootSpanId);\n };\n\n async function captureStandaloneAppStart(): Promise<void> {\n if (!standalone) {\n logger.debug(\n '[AppStart] App start tracking is enabled. App start will be added to the first transaction as a child span.',\n );\n return;\n }\n\n logger.debug('[AppStart] App start tracking standalone root span (transaction).');\n\n const span = startInactiveSpan({\n forceTransaction: true,\n name: APP_START_TX_NAME,\n op: UI_LOAD_OP,\n });\n if (span instanceof SentryNonRecordingSpan) {\n // Tracing is disabled or the transaction was sampled\n return;\n }\n\n setEndTimeValue(span, timestampInSeconds());\n _client.emit('spanEnd', span);\n\n const event = convertSpanToTransaction(span);\n if (!event) {\n logger.warn('[AppStart] Failed to convert App Start span to transaction.');\n return;\n }\n\n await attachAppStartToTransactionEvent(event);\n if (!event.spans || event.spans.length === 0) {\n // No spans were added to the transaction, so we don't need to send it\n return;\n }\n\n const scope = getCapturedScopesOnSpan(span).scope || getCurrentScope();\n scope.captureEvent(event);\n }\n\n async function attachAppStartToTransactionEvent(event: TransactionEvent): Promise<void> {\n if (appStartDataFlushed) {\n // App start data is only relevant for the first transaction of the app run\n return;\n }\n\n if (!firstStartedActiveRootSpanId) {\n logger.warn('[AppStart] No first started active root span id recorded. Can not attach app start.');\n return;\n }\n\n if (!event.contexts || !event.contexts.trace) {\n logger.warn('[AppStart] Transaction event is missing trace context. Can not attach app start.');\n return;\n }\n\n if (firstStartedActiveRootSpanId !== event.contexts.trace.span_id) {\n logger.warn(\n '[AppStart] First started active root span id does not match the transaction event span id. Can not attached app start.',\n );\n return;\n }\n\n const appStart = await NATIVE.fetchNativeAppStart();\n if (!appStart) {\n logger.warn('[AppStart] Failed to retrieve the app start metrics from the native layer.');\n return;\n }\n if (appStart.has_fetched) {\n logger.warn('[AppStart] Measured app start metrics were already reported from the native layer.');\n return;\n }\n\n const appStartTimestampMs = appStart.app_start_timestamp_ms;\n if (!appStartTimestampMs) {\n logger.warn('[AppStart] App start timestamp could not be loaded from the native layer.');\n return;\n }\n\n const appStartEndTimestampMs = recordedAppStartEndTimestampMs || getBundleStartTimestampMs();\n if (!appStartEndTimestampMs) {\n logger.warn(\n '[AppStart] Javascript failed to record app start end. `setAppStartEndTimestampMs` was not called nor could the bundle start be found.',\n );\n return;\n }\n\n const isAppStartWithinBounds =\n !!event.start_timestamp && appStartTimestampMs >= event.start_timestamp * 1_000 - MAX_APP_START_AGE_MS;\n if (!__DEV__ && !isAppStartWithinBounds) {\n logger.warn('[AppStart] App start timestamp is too far in the past to be used for app start span.');\n return;\n }\n\n const appStartDurationMs = appStartEndTimestampMs - appStartTimestampMs;\n if (!__DEV__ && appStartDurationMs >= MAX_APP_START_DURATION_MS) {\n // Dev builds can have long app start waiting over minute for the first bundle to be produced\n logger.warn('[AppStart] App start duration is over a minute long, not adding app start span.');\n return;\n }\n\n if (appStartDurationMs < 0) {\n // This can happen when MainActivity on Android is recreated,\n // and the app start end timestamp is not updated, for example\n // due to missing `Sentry.wrap(RootComponent)` call.\n logger.warn(\n '[AppStart] Last recorded app start end timestamp is before the app start timestamp.',\n 'This is usually caused by missing `Sentry.wrap(RootComponent)` call.',\n );\n return;\n }\n\n appStartDataFlushed = true;\n\n event.contexts.trace.data = event.contexts.trace.data || {};\n event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_OP] = UI_LOAD_OP;\n event.contexts.trace.op = UI_LOAD_OP;\n\n const origin = isRecordedAppStartEndTimestampMsManual ? SPAN_ORIGIN_MANUAL_APP_START : SPAN_ORIGIN_AUTO_APP_START;\n event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = origin;\n event.contexts.trace.origin = origin;\n\n const appStartTimestampSeconds = appStartTimestampMs / 1000;\n event.start_timestamp = appStartTimestampSeconds;\n\n event.spans = event.spans || [];\n /** event.spans reference */\n const children: SpanJSON[] = event.spans;\n\n const maybeTtidSpan = children.find(({ op }) => op === 'ui.load.initial_display');\n if (maybeTtidSpan) {\n maybeTtidSpan.start_timestamp = appStartTimestampSeconds;\n setSpanDurationAsMeasurementOnTransactionEvent(event, 'time_to_initial_display', maybeTtidSpan);\n }\n\n const maybeTtfdSpan = children.find(({ op }) => op === 'ui.load.full_display');\n if (maybeTtfdSpan) {\n maybeTtfdSpan.start_timestamp = appStartTimestampSeconds;\n setSpanDurationAsMeasurementOnTransactionEvent(event, 'time_to_full_display', maybeTtfdSpan);\n }\n\n const appStartEndTimestampSeconds = appStartEndTimestampMs / 1000;\n if (event.timestamp && event.timestamp < appStartEndTimestampSeconds) {\n logger.debug(\n '[AppStart] Transaction event timestamp is before app start end. Adjusting transaction event timestamp.',\n );\n event.timestamp = appStartEndTimestampSeconds;\n }\n\n const op = appStart.type === 'cold' ? APP_START_COLD_OP : APP_START_WARM_OP;\n const appStartSpanJSON: SpanJSON = createSpanJSON({\n op,\n description: appStart.type === 'cold' ? 'Cold App Start' : 'Warm App Start',\n start_timestamp: appStartTimestampSeconds,\n timestamp: appStartEndTimestampSeconds,\n trace_id: event.contexts.trace.trace_id,\n parent_span_id: event.contexts.trace.span_id,\n origin,\n });\n const jsExecutionSpanJSON = createJSExecutionStartSpan(appStartSpanJSON, rootComponentCreationTimestampMs);\n\n const appStartSpans = [\n appStartSpanJSON,\n ...(jsExecutionSpanJSON ? [jsExecutionSpanJSON] : []),\n ...convertNativeSpansToSpanJSON(appStartSpanJSON, appStart.spans),\n ];\n\n children.push(...appStartSpans);\n logger.debug('[AppStart] Added app start spans to transaction event.', JSON.stringify(appStartSpans, undefined, 2));\n\n const measurementKey = appStart.type === 'cold' ? APP_START_COLD_MEASUREMENT : APP_START_WARM_MEASUREMENT;\n const measurementValue = {\n value: appStartDurationMs,\n unit: 'millisecond',\n };\n event.measurements = event.measurements || {};\n event.measurements[measurementKey] = measurementValue;\n logger.debug(\n `[AppStart] Added app start measurement to transaction event.`,\n JSON.stringify(measurementValue, undefined, 2),\n );\n }\n\n return {\n name: INTEGRATION_NAME,\n setup,\n afterAllSetup,\n processEvent,\n captureStandaloneAppStart,\n setFirstStartedActiveRootSpanId,\n } as AppStartIntegration;\n};\n\nfunction setSpanDurationAsMeasurementOnTransactionEvent(event: TransactionEvent, label: string, span: SpanJSON): void {\n if (!span.timestamp || !span.start_timestamp) {\n logger.warn('Span is missing start or end timestamp. Cam not set measurement on transaction event.');\n return;\n }\n\n event.measurements = event.measurements || {};\n event.measurements[label] = {\n value: (span.timestamp - span.start_timestamp) * 1000,\n unit: 'millisecond',\n };\n}\n\n/**\n * Adds JS Execution before React Root. If `Sentry.wrap` is not used, create a span for the start of JS Bundle execution.\n */\nfunction createJSExecutionStartSpan(\n parentSpan: SpanJSON,\n rootComponentCreationTimestampMs: number | undefined,\n): SpanJSON | undefined {\n const bundleStartTimestampMs = getBundleStartTimestampMs();\n if (!bundleStartTimestampMs) {\n return undefined;\n }\n\n const bundleStartTimestampSeconds = bundleStartTimestampMs / 1000;\n if (bundleStartTimestampSeconds < parentSpan.start_timestamp) {\n logger.warn('Bundle start timestamp is before the app start span start timestamp. Skipping JS execution span.');\n return undefined;\n }\n\n if (!rootComponentCreationTimestampMs) {\n logger.warn('Missing the root component first constructor call timestamp.');\n return createChildSpanJSON(parentSpan, {\n description: 'JS Bundle Execution Start',\n start_timestamp: bundleStartTimestampSeconds,\n timestamp: bundleStartTimestampSeconds,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n }\n\n return createChildSpanJSON(parentSpan, {\n description: 'JS Bundle Execution Before React Root',\n start_timestamp: bundleStartTimestampSeconds,\n timestamp: rootComponentCreationTimestampMs / 1000,\n origin: isRootComponentCreationTimestampMsManual ? SPAN_ORIGIN_MANUAL_APP_START : SPAN_ORIGIN_AUTO_APP_START,\n });\n}\n\n/**\n * Adds native spans to the app start span.\n */\nfunction convertNativeSpansToSpanJSON(parentSpan: SpanJSON, nativeSpans: NativeAppStartResponse['spans']): SpanJSON[] {\n return nativeSpans\n .filter(span => span.start_timestamp_ms / 1000 >= parentSpan.start_timestamp)\n .map(span => {\n if (span.description === 'UIKit init') {\n return setMainThreadInfo(createUIKitSpan(parentSpan, span));\n }\n\n return setMainThreadInfo(\n createChildSpanJSON(parentSpan, {\n description: span.description,\n start_timestamp: span.start_timestamp_ms / 1000,\n timestamp: span.end_timestamp_ms / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n }),\n );\n });\n}\n\n/**\n * UIKit init is measured by the native layers till the native SDK start\n * RN initializes the native SDK later, the end timestamp would be wrong\n */\nfunction createUIKitSpan(parentSpan: SpanJSON, nativeUIKitSpan: NativeAppStartResponse['spans'][number]): SpanJSON {\n const bundleStart = getBundleStartTimestampMs();\n\n // If UIKit init ends after the bundle start, the native SDK was auto-initialized\n // and so the end timestamp is incorrect.\n // The timestamps can't equal, as RN initializes after UIKit.\n if (bundleStart && bundleStart < nativeUIKitSpan.end_timestamp_ms) {\n return createChildSpanJSON(parentSpan, {\n description: 'UIKit Init to JS Exec Start',\n start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n timestamp: bundleStart / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n } else {\n return createChildSpanJSON(parentSpan, {\n description: 'UIKit Init',\n start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n timestamp: nativeUIKitSpan.end_timestamp_ms / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"appStart.js","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/appStart.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,MAAM,EACN,gCAAgC,EAChC,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACL,cAAc,IAAI,0BAA0B,EAC5C,cAAc,IAAI,0BAA0B,GAC7C,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC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,kBAAkB,GAAG,IAAI,IAAI,UAAU,CAAC,eAAe,CAAC;SAC5E,GAAG,CAAC,IAAI,CAAC,EAAE;QACV,IAAI,IAAI,CAAC,WAAW,KAAK,YAAY,EAAE;YACrC,OAAO,iBAAiB,CAAC,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;SAC7D;QAED,OAAO,iBAAiB,CACtB,mBAAmB,CAAC,UAAU,EAAE;YAC9B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,eAAe,EAAE,IAAI,CAAC,kBAAkB,GAAG,IAAI;YAC/C,SAAS,EAAE,IAAI,CAAC,gBAAgB,GAAG,IAAI;YACvC,MAAM,EAAE,0BAA0B;SACnC,CAAC,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,UAAoB,EAAE,eAAwD;IACrG,MAAM,WAAW,GAAG,yBAAyB,EAAE,CAAC;IAEhD,iFAAiF;IACjF,yCAAyC;IACzC,6DAA6D;IAC7D,IAAI,WAAW,IAAI,WAAW,GAAG,eAAe,CAAC,gBAAgB,EAAE;QACjE,OAAO,mBAAmB,CAAC,UAAU,EAAE;YACrC,WAAW,EAAE,6BAA6B;YAC1C,eAAe,EAAE,eAAe,CAAC,kBAAkB,GAAG,IAAI;YAC1D,SAAS,EAAE,WAAW,GAAG,IAAI;YAC7B,MAAM,EAAE,0BAA0B;SACnC,CAAC,CAAC;KACJ;SAAM;QACL,OAAO,mBAAmB,CAAC,UAAU,EAAE;YACrC,WAAW,EAAE,YAAY;YACzB,eAAe,EAAE,eAAe,CAAC,kBAAkB,GAAG,IAAI;YAC1D,SAAS,EAAE,eAAe,CAAC,gBAAgB,GAAG,IAAI;YAClD,MAAM,EAAE,0BAA0B;SACnC,CAAC,CAAC;KACJ;AACH,CAAC","sourcesContent":["/* eslint-disable complexity, max-lines */\nimport type { Client, Event, Integration, Span, SpanJSON, TransactionEvent } from '@sentry/core';\nimport {\n getCapturedScopesOnSpan,\n getClient,\n getCurrentScope,\n logger,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n startInactiveSpan,\n timestampInSeconds,\n} from '@sentry/core';\nimport { getAppRegistryIntegration } from '../../integrations/appRegistry';\nimport {\n APP_START_COLD as APP_START_COLD_MEASUREMENT,\n APP_START_WARM as APP_START_WARM_MEASUREMENT,\n} from '../../measurements';\nimport type { NativeAppStartResponse } from '../../NativeRNSentry';\nimport type { ReactNativeClientOptions } from '../../options';\nimport { convertSpanToTransaction, isRootSpan, setEndTimeValue } from '../../utils/span';\nimport { NATIVE } from '../../wrapper';\nimport {\n APP_START_COLD as APP_START_COLD_OP,\n APP_START_WARM as APP_START_WARM_OP,\n UI_LOAD as UI_LOAD_OP,\n} from '../ops';\nimport { SPAN_ORIGIN_AUTO_APP_START, SPAN_ORIGIN_MANUAL_APP_START } from '../origin';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '../semanticAttributes';\nimport { setMainThreadInfo } from '../span';\nimport { createChildSpanJSON, createSpanJSON, getBundleStartTimestampMs } from '../utils';\n\nconst INTEGRATION_NAME = 'AppStart';\n\nexport type AppStartIntegration = Integration & {\n captureStandaloneAppStart: () => Promise<void>;\n};\n\n/**\n * We filter out app start more than 60s.\n * This could be due to many different reasons.\n * We've seen app starts with hours, days and even months.\n */\nconst MAX_APP_START_DURATION_MS = 60_000;\n\n/** We filter out App starts which timestamp is 60s and more before the transaction start */\nconst MAX_APP_START_AGE_MS = 60_000;\n\n/** App Start transaction name */\nconst APP_START_TX_NAME = 'App Start';\n\nlet recordedAppStartEndTimestampMs: number | undefined = undefined;\nlet isRecordedAppStartEndTimestampMsManual = false;\n\nlet rootComponentCreationTimestampMs: number | undefined = undefined;\nlet isRootComponentCreationTimestampMsManual = false;\n\n/**\n * Records the application start end.\n * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.\n */\nexport function captureAppStart(): Promise<void> {\n return _captureAppStart({ isManual: true });\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport async function _captureAppStart({ isManual }: { isManual: boolean }): Promise<void> {\n const client = getClient();\n if (!client) {\n logger.warn('[AppStart] Could not capture App Start, missing client.');\n return;\n }\n\n isRecordedAppStartEndTimestampMsManual = isManual;\n _setAppStartEndTimestampMs(timestampInSeconds() * 1000);\n await client.getIntegrationByName<AppStartIntegration>(INTEGRATION_NAME)?.captureStandaloneAppStart();\n}\n\n/**\n * Sets the root component first constructor call timestamp.\n * Used automatically by `Sentry.wrap` and `Sentry.ReactNativeProfiler`.\n */\nexport function setRootComponentCreationTimestampMs(timestampMs: number): void {\n recordedAppStartEndTimestampMs &&\n logger.warn('Setting Root component creation timestamp after app start end is set.');\n rootComponentCreationTimestampMs && logger.warn('Overwriting already set root component creation timestamp.');\n rootComponentCreationTimestampMs = timestampMs;\n isRootComponentCreationTimestampMsManual = true;\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport function _setRootComponentCreationTimestampMs(timestampMs: number): void {\n setRootComponentCreationTimestampMs(timestampMs);\n isRootComponentCreationTimestampMsManual = false;\n}\n\n/**\n * For internal use only.\n *\n * @private\n */\nexport const _setAppStartEndTimestampMs = (timestampMs: number): void => {\n recordedAppStartEndTimestampMs && logger.warn('Overwriting already set app start.');\n recordedAppStartEndTimestampMs = timestampMs;\n};\n\n/**\n * For testing purposes only.\n *\n * @private\n */\nexport function _clearRootComponentCreationTimestampMs(): void {\n rootComponentCreationTimestampMs = undefined;\n}\n\n/**\n * Adds AppStart spans from the native layer to the transaction event.\n */\nexport const appStartIntegration = ({\n standalone = false,\n}: {\n /**\n * Should the integration send App Start as a standalone root span (transaction)?\n * If false, App Start will be added as a child span to the first transaction.\n *\n * @default false\n */\n standalone?: boolean;\n} = {}): AppStartIntegration => {\n let _client: Client | undefined = undefined;\n let isEnabled = true;\n let appStartDataFlushed = false;\n let afterAllSetupCalled = false;\n let firstStartedActiveRootSpanId: string | undefined = undefined;\n\n const setup = (client: Client): void => {\n _client = client;\n const { enableAppStartTracking } = client.getOptions() as ReactNativeClientOptions;\n\n if (!enableAppStartTracking) {\n isEnabled = false;\n logger.warn('[AppStart] App start tracking is disabled.');\n }\n\n client.on('spanStart', recordFirstStartedActiveRootSpanId);\n };\n\n const afterAllSetup = (client: Client): void => {\n if (afterAllSetupCalled) {\n return;\n }\n afterAllSetupCalled = true;\n\n // TODO: automatically set standalone based on the presence of the native layer navigation integration\n\n getAppRegistryIntegration(client)?.onRunApplication(() => {\n if (appStartDataFlushed) {\n logger.log('[AppStartIntegration] Resetting app start data flushed flag based on runApplication call.');\n appStartDataFlushed = false;\n firstStartedActiveRootSpanId = undefined;\n } else {\n logger.log(\n '[AppStartIntegration] Waiting for initial app start was flush, before updating based on runApplication call.',\n );\n }\n });\n };\n\n const processEvent = async (event: Event): Promise<Event> => {\n if (!isEnabled || standalone) {\n return event;\n }\n\n if (event.type !== 'transaction') {\n // App start data is only relevant for transactions\n return event;\n }\n\n await attachAppStartToTransactionEvent(event as TransactionEvent);\n\n return event;\n };\n\n const recordFirstStartedActiveRootSpanId = (rootSpan: Span): void => {\n if (firstStartedActiveRootSpanId) {\n return;\n }\n\n if (!isRootSpan(rootSpan)) {\n return;\n }\n\n setFirstStartedActiveRootSpanId(rootSpan.spanContext().spanId);\n };\n\n /**\n * For testing purposes only.\n * @private\n */\n const setFirstStartedActiveRootSpanId = (spanId: string | undefined): void => {\n firstStartedActiveRootSpanId = spanId;\n logger.debug('[AppStart] First started active root span id recorded.', firstStartedActiveRootSpanId);\n };\n\n async function captureStandaloneAppStart(): Promise<void> {\n if (!_client) {\n // If client is not set, SDK was not initialized, logger is thus disabled\n // eslint-disable-next-line no-console\n console.warn('[AppStart] Could not capture App Start, missing client, call `Sentry.init` first.');\n return;\n }\n\n if (!standalone) {\n logger.debug(\n '[AppStart] App start tracking is enabled. App start will be added to the first transaction as a child span.',\n );\n return;\n }\n\n logger.debug('[AppStart] App start tracking standalone root span (transaction).');\n\n const span = startInactiveSpan({\n forceTransaction: true,\n name: APP_START_TX_NAME,\n op: UI_LOAD_OP,\n });\n if (span instanceof SentryNonRecordingSpan) {\n // Tracing is disabled or the transaction was sampled\n return;\n }\n\n setEndTimeValue(span, timestampInSeconds());\n _client.emit('spanEnd', span);\n\n const event = convertSpanToTransaction(span);\n if (!event) {\n logger.warn('[AppStart] Failed to convert App Start span to transaction.');\n return;\n }\n\n await attachAppStartToTransactionEvent(event);\n if (!event.spans || event.spans.length === 0) {\n // No spans were added to the transaction, so we don't need to send it\n return;\n }\n\n const scope = getCapturedScopesOnSpan(span).scope || getCurrentScope();\n scope.captureEvent(event);\n }\n\n async function attachAppStartToTransactionEvent(event: TransactionEvent): Promise<void> {\n if (appStartDataFlushed) {\n // App start data is only relevant for the first transaction of the app run\n return;\n }\n\n if (!firstStartedActiveRootSpanId) {\n logger.warn('[AppStart] No first started active root span id recorded. Can not attach app start.');\n return;\n }\n\n if (!event.contexts?.trace) {\n logger.warn('[AppStart] Transaction event is missing trace context. Can not attach app start.');\n return;\n }\n\n if (firstStartedActiveRootSpanId !== event.contexts.trace.span_id) {\n logger.warn(\n '[AppStart] First started active root span id does not match the transaction event span id. Can not attached app start.',\n );\n return;\n }\n\n const appStart = await NATIVE.fetchNativeAppStart();\n if (!appStart) {\n logger.warn('[AppStart] Failed to retrieve the app start metrics from the native layer.');\n return;\n }\n if (appStart.has_fetched) {\n logger.warn('[AppStart] Measured app start metrics were already reported from the native layer.');\n return;\n }\n\n const appStartTimestampMs = appStart.app_start_timestamp_ms;\n if (!appStartTimestampMs) {\n logger.warn('[AppStart] App start timestamp could not be loaded from the native layer.');\n return;\n }\n\n const appStartEndTimestampMs = recordedAppStartEndTimestampMs || getBundleStartTimestampMs();\n if (!appStartEndTimestampMs) {\n logger.warn(\n '[AppStart] Javascript failed to record app start end. `setAppStartEndTimestampMs` was not called nor could the bundle start be found.',\n );\n return;\n }\n\n const isAppStartWithinBounds =\n !!event.start_timestamp && appStartTimestampMs >= event.start_timestamp * 1_000 - MAX_APP_START_AGE_MS;\n if (!__DEV__ && !isAppStartWithinBounds) {\n logger.warn('[AppStart] App start timestamp is too far in the past to be used for app start span.');\n return;\n }\n\n const appStartDurationMs = appStartEndTimestampMs - appStartTimestampMs;\n if (!__DEV__ && appStartDurationMs >= MAX_APP_START_DURATION_MS) {\n // Dev builds can have long app start waiting over minute for the first bundle to be produced\n logger.warn('[AppStart] App start duration is over a minute long, not adding app start span.');\n return;\n }\n\n if (appStartDurationMs < 0) {\n // This can happen when MainActivity on Android is recreated,\n // and the app start end timestamp is not updated, for example\n // due to missing `Sentry.wrap(RootComponent)` call.\n logger.warn(\n '[AppStart] Last recorded app start end timestamp is before the app start timestamp.',\n 'This is usually caused by missing `Sentry.wrap(RootComponent)` call.',\n );\n return;\n }\n\n appStartDataFlushed = true;\n\n event.contexts.trace.data = event.contexts.trace.data || {};\n event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_OP] = UI_LOAD_OP;\n event.contexts.trace.op = UI_LOAD_OP;\n\n const origin = isRecordedAppStartEndTimestampMsManual ? SPAN_ORIGIN_MANUAL_APP_START : SPAN_ORIGIN_AUTO_APP_START;\n event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = origin;\n event.contexts.trace.origin = origin;\n\n const appStartTimestampSeconds = appStartTimestampMs / 1000;\n event.start_timestamp = appStartTimestampSeconds;\n\n event.spans = event.spans || [];\n /** event.spans reference */\n const children: SpanJSON[] = event.spans;\n\n const maybeTtidSpan = children.find(({ op }) => op === 'ui.load.initial_display');\n if (maybeTtidSpan) {\n maybeTtidSpan.start_timestamp = appStartTimestampSeconds;\n setSpanDurationAsMeasurementOnTransactionEvent(event, 'time_to_initial_display', maybeTtidSpan);\n }\n\n const maybeTtfdSpan = children.find(({ op }) => op === 'ui.load.full_display');\n if (maybeTtfdSpan) {\n maybeTtfdSpan.start_timestamp = appStartTimestampSeconds;\n setSpanDurationAsMeasurementOnTransactionEvent(event, 'time_to_full_display', maybeTtfdSpan);\n }\n\n const appStartEndTimestampSeconds = appStartEndTimestampMs / 1000;\n if (event.timestamp && event.timestamp < appStartEndTimestampSeconds) {\n logger.debug(\n '[AppStart] Transaction event timestamp is before app start end. Adjusting transaction event timestamp.',\n );\n event.timestamp = appStartEndTimestampSeconds;\n }\n\n const op = appStart.type === 'cold' ? APP_START_COLD_OP : APP_START_WARM_OP;\n const appStartSpanJSON: SpanJSON = createSpanJSON({\n op,\n description: appStart.type === 'cold' ? 'Cold Start' : 'Warm Start',\n start_timestamp: appStartTimestampSeconds,\n timestamp: appStartEndTimestampSeconds,\n trace_id: event.contexts.trace.trace_id,\n parent_span_id: event.contexts.trace.span_id,\n origin,\n });\n const jsExecutionSpanJSON = createJSExecutionStartSpan(appStartSpanJSON, rootComponentCreationTimestampMs);\n\n const appStartSpans = [\n appStartSpanJSON,\n ...(jsExecutionSpanJSON ? [jsExecutionSpanJSON] : []),\n ...convertNativeSpansToSpanJSON(appStartSpanJSON, appStart.spans),\n ];\n\n children.push(...appStartSpans);\n logger.debug('[AppStart] Added app start spans to transaction event.', JSON.stringify(appStartSpans, undefined, 2));\n\n const measurementKey = appStart.type === 'cold' ? APP_START_COLD_MEASUREMENT : APP_START_WARM_MEASUREMENT;\n const measurementValue = {\n value: appStartDurationMs,\n unit: 'millisecond',\n };\n event.measurements = event.measurements || {};\n event.measurements[measurementKey] = measurementValue;\n logger.debug(\n '[AppStart] Added app start measurement to transaction event.',\n JSON.stringify(measurementValue, undefined, 2),\n );\n }\n\n return {\n name: INTEGRATION_NAME,\n setup,\n afterAllSetup,\n processEvent,\n captureStandaloneAppStart,\n setFirstStartedActiveRootSpanId,\n } as AppStartIntegration;\n};\n\nfunction setSpanDurationAsMeasurementOnTransactionEvent(event: TransactionEvent, label: string, span: SpanJSON): void {\n if (!span.timestamp || !span.start_timestamp) {\n logger.warn('Span is missing start or end timestamp. Cam not set measurement on transaction event.');\n return;\n }\n\n event.measurements = event.measurements || {};\n event.measurements[label] = {\n value: (span.timestamp - span.start_timestamp) * 1000,\n unit: 'millisecond',\n };\n}\n\n/**\n * Adds JS Execution before React Root. If `Sentry.wrap` is not used, create a span for the start of JS Bundle execution.\n */\nfunction createJSExecutionStartSpan(\n parentSpan: SpanJSON,\n rootComponentCreationTimestampMs: number | undefined,\n): SpanJSON | undefined {\n const bundleStartTimestampMs = getBundleStartTimestampMs();\n if (!bundleStartTimestampMs) {\n return undefined;\n }\n\n const bundleStartTimestampSeconds = bundleStartTimestampMs / 1000;\n if (bundleStartTimestampSeconds < parentSpan.start_timestamp) {\n logger.warn('Bundle start timestamp is before the app start span start timestamp. Skipping JS execution span.');\n return undefined;\n }\n\n if (!rootComponentCreationTimestampMs) {\n logger.warn('Missing the root component first constructor call timestamp.');\n return createChildSpanJSON(parentSpan, {\n description: 'JS Bundle Execution Start',\n start_timestamp: bundleStartTimestampSeconds,\n timestamp: bundleStartTimestampSeconds,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n }\n\n return createChildSpanJSON(parentSpan, {\n description: 'JS Bundle Execution Before React Root',\n start_timestamp: bundleStartTimestampSeconds,\n timestamp: rootComponentCreationTimestampMs / 1000,\n origin: isRootComponentCreationTimestampMsManual ? SPAN_ORIGIN_MANUAL_APP_START : SPAN_ORIGIN_AUTO_APP_START,\n });\n}\n\n/**\n * Adds native spans to the app start span.\n */\nfunction convertNativeSpansToSpanJSON(parentSpan: SpanJSON, nativeSpans: NativeAppStartResponse['spans']): SpanJSON[] {\n return nativeSpans\n .filter(span => span.start_timestamp_ms / 1000 >= parentSpan.start_timestamp)\n .map(span => {\n if (span.description === 'UIKit init') {\n return setMainThreadInfo(createUIKitSpan(parentSpan, span));\n }\n\n return setMainThreadInfo(\n createChildSpanJSON(parentSpan, {\n description: span.description,\n start_timestamp: span.start_timestamp_ms / 1000,\n timestamp: span.end_timestamp_ms / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n }),\n );\n });\n}\n\n/**\n * UIKit init is measured by the native layers till the native SDK start\n * RN initializes the native SDK later, the end timestamp would be wrong\n */\nfunction createUIKitSpan(parentSpan: SpanJSON, nativeUIKitSpan: NativeAppStartResponse['spans'][number]): SpanJSON {\n const bundleStart = getBundleStartTimestampMs();\n\n // If UIKit init ends after the bundle start, the native SDK was auto-initialized\n // and so the end timestamp is incorrect.\n // The timestamps can't equal, as RN initializes after UIKit.\n if (bundleStart && bundleStart < nativeUIKitSpan.end_timestamp_ms) {\n return createChildSpanJSON(parentSpan, {\n description: 'UIKit Init to JS Exec Start',\n start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n timestamp: bundleStart / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n } else {\n return createChildSpanJSON(parentSpan, {\n description: 'UIKit Init',\n start_timestamp: nativeUIKitSpan.start_timestamp_ms / 1000,\n timestamp: nativeUIKitSpan.end_timestamp_ms / 1000,\n origin: SPAN_ORIGIN_AUTO_APP_START,\n });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"nativeFrames.d.ts","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/nativeFrames.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,WAAW,EAAE,YAAY,EAAE,eAAe,EAAQ,MAAM,cAAc,CAAC;AAmCpG,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,YAAY,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IACvD,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IACtD,aAAa,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;CACzD;AAOD,eAAO,MAAM,8BAA8B,WAAY,OAAO,GAAG,SAAS,KAAG,WAAW,GAAG,SAQ1F,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAO,WA6K1C,CAAC"}
1
+ {"version":3,"file":"nativeFrames.d.ts","sourceRoot":"","sources":["../../../../src/js/tracing/integrations/nativeFrames.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,WAAW,EAAE,YAAY,EAAE,eAAe,EAAQ,MAAM,cAAc,CAAC;AAkCpG,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,YAAY,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IACvD,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IACtD,aAAa,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;CACzD;AAOD,eAAO,MAAM,8BAA8B,WAAY,OAAO,GAAG,SAAS,KAAG,WAAW,GAAG,SAQ1F,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAO,WA6K1C,CAAC"}