@sentry/react-native 7.3.0 → 7.5.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 (78) hide show
  1. package/RNSentry.podspec +2 -2
  2. package/android/build.gradle +1 -1
  3. package/android/libs/replay-stubs.jar +0 -0
  4. package/android/replay-stubs/build.gradle +1 -1
  5. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +67 -13
  6. package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
  7. package/android/src/main/java/io/sentry/react/replay/RNSentryReplayFragmentLifecycleTracer.java +137 -0
  8. package/dist/js/NativeRNSentry.d.ts +0 -1
  9. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  10. package/dist/js/NativeRNSentry.js.map +1 -1
  11. package/dist/js/RNSentryReplayMaskNativeComponent.js +1 -1
  12. package/dist/js/RNSentryReplayMaskNativeComponent.js.map +1 -1
  13. package/dist/js/RNSentryReplayUnmaskNativeComponent.js +1 -1
  14. package/dist/js/RNSentryReplayUnmaskNativeComponent.js.map +1 -1
  15. package/dist/js/integrations/default.d.ts.map +1 -1
  16. package/dist/js/integrations/default.js +2 -1
  17. package/dist/js/integrations/default.js.map +1 -1
  18. package/dist/js/integrations/exports.d.ts +2 -0
  19. package/dist/js/integrations/exports.d.ts.map +1 -1
  20. package/dist/js/integrations/exports.js +2 -0
  21. package/dist/js/integrations/exports.js.map +1 -1
  22. package/dist/js/integrations/graphql.d.ts +11 -0
  23. package/dist/js/integrations/graphql.d.ts.map +1 -0
  24. package/dist/js/integrations/graphql.js +9 -0
  25. package/dist/js/integrations/graphql.js.map +1 -0
  26. package/dist/js/integrations/supabase.d.ts +12 -0
  27. package/dist/js/integrations/supabase.d.ts.map +1 -0
  28. package/dist/js/integrations/supabase.js +10 -0
  29. package/dist/js/integrations/supabase.js.map +1 -0
  30. package/dist/js/options.d.ts +25 -1
  31. package/dist/js/options.d.ts.map +1 -1
  32. package/dist/js/options.js.map +1 -1
  33. package/dist/js/replay/mobilereplay.d.ts +22 -0
  34. package/dist/js/replay/mobilereplay.d.ts.map +1 -1
  35. package/dist/js/replay/mobilereplay.js +1 -0
  36. package/dist/js/replay/mobilereplay.js.map +1 -1
  37. package/dist/js/replay/networkUtils.d.ts +0 -1
  38. package/dist/js/replay/networkUtils.d.ts.map +1 -1
  39. package/dist/js/sdk.d.ts.map +1 -1
  40. package/dist/js/sdk.js +1 -0
  41. package/dist/js/sdk.js.map +1 -1
  42. package/dist/js/tools/vendor/metro/utils.js +1 -1
  43. package/dist/js/tools/vendor/metro/utils.js.map +1 -1
  44. package/dist/js/tracing/timetodisplaynative.types.d.ts +0 -1
  45. package/dist/js/tracing/timetodisplaynative.types.d.ts.map +1 -1
  46. package/dist/js/vendor/react-native/index.d.ts +0 -1
  47. package/dist/js/vendor/react-native/index.d.ts.map +1 -1
  48. package/dist/js/version.d.ts +1 -1
  49. package/dist/js/version.js +1 -1
  50. package/dist/js/version.js.map +1 -1
  51. package/dist/js/wrapper.d.ts.map +1 -1
  52. package/dist/js/wrapper.js +2 -3
  53. package/dist/js/wrapper.js.map +1 -1
  54. package/ios/RNSentry+fetchNativeStack.m +0 -2
  55. package/ios/RNSentry.h +0 -1
  56. package/ios/RNSentry.mm +33 -9
  57. package/ios/RNSentryDependencyContainer.m +1 -1
  58. package/ios/RNSentryExperimentalOptions.h +9 -0
  59. package/ios/RNSentryExperimentalOptions.m +9 -0
  60. package/ios/RNSentryOnDrawReporter.m +1 -2
  61. package/ios/RNSentryReplay.h +5 -1
  62. package/ios/RNSentryReplay.mm +10 -6
  63. package/ios/RNSentryVersion.m +1 -1
  64. package/package.json +20 -18
  65. package/sentry.gradle +269 -277
  66. package/src/js/NativeRNSentry.ts +0 -1
  67. package/src/js/RNSentryReplayMaskNativeComponent.ts +1 -1
  68. package/src/js/RNSentryReplayUnmaskNativeComponent.ts +1 -1
  69. package/ts3.8/dist/js/NativeRNSentry.d.ts +0 -1
  70. package/ts3.8/dist/js/integrations/exports.d.ts +2 -0
  71. package/ts3.8/dist/js/integrations/graphql.d.ts +11 -0
  72. package/ts3.8/dist/js/integrations/supabase.d.ts +12 -0
  73. package/ts3.8/dist/js/options.d.ts +25 -1
  74. package/ts3.8/dist/js/replay/mobilereplay.d.ts +22 -0
  75. package/ts3.8/dist/js/replay/networkUtils.d.ts +0 -1
  76. package/ts3.8/dist/js/tracing/timetodisplaynative.types.d.ts +0 -1
  77. package/ts3.8/dist/js/vendor/react-native/index.d.ts +0 -1
  78. package/ts3.8/dist/js/version.d.ts +1 -1
package/sentry.gradle CHANGED
@@ -22,11 +22,262 @@ interface InjectedExecOps {
22
22
 
23
23
  def config = project.hasProperty("sentryCli") ? project.sentryCli : [];
24
24
 
25
+ plugins.withId('com.android.application') {
26
+ def androidComponents = extensions.getByName("androidComponents")
27
+
28
+ androidComponents.onVariants(androidComponents.selector().all()) { v ->
29
+ if (!v.name.toLowerCase().contains("debug")) {
30
+ // separately we then hook into the bundle task of react native to inject
31
+ // sourcemap generation parameters. In case for whatever reason no release
32
+ // was found for the asset folder we just bail.
33
+ def bundleTasks = tasks.findAll { task -> (task.name.startsWith("createBundle") || task.name.startsWith("bundle")) && task.name.endsWith("JsAndAssets") && !task.name.contains("Debug") && task.enabled }
34
+ bundleTasks.each { bundleTask ->
35
+ def shouldCleanUp
36
+ def sourcemapOutput
37
+ def bundleOutput
38
+ def packagerSourcemapOutput
39
+ def bundleCommand
40
+ def props = bundleTask.getProperties()
41
+ def reactRoot = props.get("workingDir")
42
+ if (reactRoot == null) {
43
+ reactRoot = props.get("root").get() // RN 0.71 and above
44
+ }
45
+ def modulesOutput = "$reactRoot/android/app/src/main/assets/modules.json"
46
+ def modulesTask = null
47
+
48
+ (shouldCleanUp, bundleOutput, sourcemapOutput, packagerSourcemapOutput, bundleCommand) = forceSourceMapOutputFromBundleTask(bundleTask)
49
+
50
+ // Lets leave this here if we need to debug
51
+ // println bundleTask.properties
52
+ // .sort{it.key}
53
+ // .collect{it}
54
+ // .findAll{!['class', 'active'].contains(it.key)}
55
+ // .join('\n')
56
+
57
+ def currentVariants = extractCurrentVariants(bundleTask, v)
58
+ if (currentVariants == null) return
59
+
60
+ def previousCliTask = null
61
+ def applicationVariant = null
62
+
63
+ def nameCleanup = "${bundleTask.name}_SentryUploadCleanUp"
64
+ def nameModulesCleanup = "${bundleTask.name}_SentryCollectModulesCleanUp"
65
+ // Upload the source map several times if necessary: once for each release and versionCode.
66
+ currentVariants.each { key, currentVariant ->
67
+ def variant = currentVariant[0]
68
+ def releaseName = currentVariant[1]
69
+ def versionCode = currentVariant[2]
70
+ applicationVariant = currentVariant[3]
71
+
72
+ try {
73
+ if (versionCode instanceof String) {
74
+ versionCode = Integer.parseInt(versionCode)
75
+ versionCode = Math.abs(versionCode)
76
+ }
77
+ } catch (NumberFormatException e) {
78
+ project.logger.info("versionCode: '$versionCode' isn't an Integer, using the plain value.")
79
+ }
80
+
81
+ // The Sentry server distinguishes source maps by release (`--release` in the command
82
+ // below) and distribution identifier (`--dist` below). Give the task a unique name
83
+ // based on where we're uploading to.
84
+ def nameCliTask = "${bundleTask.name}_SentryUpload_${releaseName}_${versionCode}"
85
+ def nameModulesTask = "${bundleTask.name}_SentryCollectModules_${releaseName}_${versionCode}"
86
+
87
+ // If several outputs have the same releaseName and versionCode, we'd do the exact same
88
+ // upload for each of them. No need to repeat.
89
+ try { tasks.named(nameCliTask); return } catch (Exception e) {}
90
+
91
+ /** Upload source map file to the sentry server via CLI call. */
92
+ def cliTask = tasks.register(nameCliTask) {
93
+ onlyIf { shouldSentryAutoUploadGeneral() }
94
+ description = "upload debug symbols to sentry"
95
+ group = 'sentry.io'
96
+
97
+ def extraArgs = []
98
+
99
+ def sentryPackage = resolveSentryReactNativeSDKPath(reactRoot)
100
+ def copyDebugIdScript = config.copyDebugIdScript
101
+ ? file(config.copyDebugIdScript).getAbsolutePath()
102
+ : "$sentryPackage/scripts/copy-debugid.js"
103
+ def hasSourceMapDebugIdScript = config.hasSourceMapDebugIdScript
104
+ ? file(config.hasSourceMapDebugIdScript).getAbsolutePath()
105
+ : "$sentryPackage/scripts/has-sourcemap-debugid.js"
106
+
107
+ def injected = project.objects.newInstance(InjectedExecOps)
108
+ doFirst {
109
+ // Copy Debug ID from packager source map to Hermes composed source map
110
+ injected.execOps.exec {
111
+ def args = ["node",
112
+ copyDebugIdScript,
113
+ packagerSourcemapOutput,
114
+ sourcemapOutput]
115
+ def osCompatibilityCopyCommand = Os.isFamily(Os.FAMILY_WINDOWS) ? ['cmd', '/c'] : []
116
+ commandLine(*osCompatibilityCopyCommand, *args)
117
+ }
118
+
119
+ // Add release and dist for backward compatibility if no Debug ID detected in output soruce map
120
+ def process = ["node", hasSourceMapDebugIdScript, sourcemapOutput].execute(null, new File("$reactRoot"))
121
+ def exitValue = process.waitFor()
122
+ project.logger.lifecycle("Check generated source map for Debug ID: ${process.text}")
123
+
124
+ project.logger.lifecycle("Sentry Source Maps upload will include the release name and dist.")
125
+ extraArgs.addAll([
126
+ "--release", releaseName,
127
+ "--dist", versionCode
128
+ ])
129
+ }
130
+
131
+ doLast {
132
+ injected.execOps.exec {
133
+ workingDir reactRoot
134
+
135
+ def propertiesFile = config.sentryProperties
136
+ ? config.sentryProperties
137
+ : "$reactRoot/android/sentry.properties"
138
+
139
+ if (config.flavorAware) {
140
+ propertiesFile = "$reactRoot/android/sentry-${variant}.properties"
141
+ project.logger.info("For $variant using: $propertiesFile")
142
+ } else {
143
+ environment("SENTRY_PROPERTIES", propertiesFile)
144
+ }
145
+
146
+ Properties sentryProps = new Properties()
147
+ try {
148
+ sentryProps.load(new FileInputStream(propertiesFile))
149
+ } catch (FileNotFoundException e) {
150
+ project.logger.info("file not found '$propertiesFile' for '$variant'")
151
+ }
152
+
153
+ def cliPackage = resolveSentryCliPackagePath(reactRoot)
154
+ def cliExecutable = sentryProps.get("cli.executable", "$cliPackage/bin/sentry-cli")
155
+
156
+ // fix path separator for Windows
157
+ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
158
+ cliExecutable = cliExecutable.replaceAll("/", "\\\\")
159
+ }
160
+
161
+ //
162
+ // based on:
163
+ // https://github.com/getsentry/sentry-cli/blob/master/src/commands/react_native_gradle.rs
164
+ //
165
+ def args = [cliExecutable]
166
+
167
+ args.addAll(!config.logLevel ? [] : [
168
+ "--log-level", config.logLevel // control verbosity of the output
169
+ ])
170
+ args.addAll(!config.flavorAware ? [] : [
171
+ "--url", sentryProps.get("defaults.url"),
172
+ "--auth-token", sentryProps.get("auth.token") ?: System.getenv("SENTRY_AUTH_TOKEN")
173
+ ])
174
+ args.addAll(["react-native", "gradle",
175
+ "--bundle", bundleOutput, // The path to a bundle that should be uploaded.
176
+ "--sourcemap", sourcemapOutput // The path to a sourcemap that should be uploaded.
177
+ ])
178
+ args.addAll(!config.flavorAware ? [] : [
179
+ "--org", sentryProps.get("defaults.org"),
180
+ "--project", sentryProps.get("defaults.project")
181
+ ])
182
+
183
+ args.addAll(extraArgs)
184
+
185
+ project.logger.lifecycle("Sentry-CLI arguments: ${args}")
186
+ def osCompatibility = Os.isFamily(Os.FAMILY_WINDOWS) ? ['cmd', '/c', 'node'] : []
187
+ if (!System.getenv('SENTRY_DOTENV_PATH') && file("$reactRoot/.env.sentry-build-plugin").exists()) {
188
+ environment('SENTRY_DOTENV_PATH', "$reactRoot/.env.sentry-build-plugin")
189
+ }
190
+ commandLine(*osCompatibility, *args)
191
+ }
192
+ }
193
+
194
+ enabled true
195
+ }
196
+
197
+ modulesTask = tasks.register(nameModulesTask, Exec) {
198
+ description = "collect javascript modules from bundle source map"
199
+ group = 'sentry.io'
200
+
201
+ workingDir reactRoot
202
+
203
+ def sentryPackage = resolveSentryReactNativeSDKPath(reactRoot)
204
+
205
+ def collectModulesScript = config.collectModulesScript
206
+ ? file(config.collectModulesScript).getAbsolutePath()
207
+ : "$sentryPackage/dist/js/tools/collectModules.js"
208
+ def modulesPaths = config.modulesPaths
209
+ ? config.modulesPaths.join(',')
210
+ : "$reactRoot/node_modules"
211
+ def args = ["node",
212
+ collectModulesScript,
213
+ sourcemapOutput,
214
+ modulesOutput,
215
+ modulesPaths
216
+ ]
217
+
218
+ if ((new File(collectModulesScript)).exists()) {
219
+ project.logger.info("Sentry-CollectModules arguments: ${args}")
220
+ commandLine(*args)
221
+
222
+ def skip = config.skipCollectModules
223
+ ? config.skipCollectModules == true
224
+ : false
225
+ enabled !skip
226
+ } else {
227
+ project.logger.info("collectModulesScript not found: $collectModulesScript")
228
+ enabled false
229
+ }
230
+ }
231
+
232
+ // chain the upload tasks so they run sequentially in order to run
233
+ // the cliCleanUpTask after the final upload task is run
234
+ if (previousCliTask != null) {
235
+ previousCliTask.configure { finalizedBy cliTask }
236
+ } else {
237
+ bundleTask.configure { finalizedBy cliTask }
238
+ }
239
+ previousCliTask = cliTask
240
+ cliTask.configure { finalizedBy modulesTask }
241
+ }
242
+
243
+ def modulesCleanUpTask = tasks.register(nameModulesCleanup, Delete) {
244
+ description = "clean up collected modules generated file"
245
+ group = 'sentry.io'
246
+
247
+ delete modulesOutput
248
+ }
249
+
250
+ /** Delete sourcemap files */
251
+ def cliCleanUpTask = tasks.register(nameCleanup, Delete) {
252
+ description = "clean up extra sourcemap"
253
+ group = 'sentry.io'
254
+
255
+ delete sourcemapOutput
256
+ delete "$buildDir/intermediates/assets/release/index.android.bundle.map"
257
+ // react native default bundle dir
258
+ }
259
+
260
+ // register clean task extension
261
+ cliCleanUpTask.configure { onlyIf { shouldCleanUp } }
262
+ // due to chaining the last value of previousCliTask will be the final
263
+ // upload task, after which the cleanup can be done
264
+ previousCliTask.configure { finalizedBy cliCleanUpTask }
265
+
266
+ def packageTasks = tasks.matching {
267
+ task -> ("package${applicationVariant}".equalsIgnoreCase(task.name) || "package${applicationVariant}Bundle".equalsIgnoreCase(task.name)) && task.enabled
268
+ }
269
+ packageTasks.configureEach { packageTask ->
270
+ packageTask.dependsOn modulesTask
271
+ packageTask.finalizedBy modulesCleanUpTask
272
+ }
273
+ }
274
+ }
275
+ }
276
+ }
277
+
25
278
  // gradle.projectsEvaluated doesn't work with --configure-on-demand
26
279
  // the task are create too late and not executed
27
280
  project.afterEvaluate {
28
- def releases = extractReleasesInfo()
29
-
30
281
  if (config.flavorAware && config.sentryProperties) {
31
282
  throw new GradleException("Incompatible sentry configuration. " +
32
283
  "You cannot use both `flavorAware` and `sentryProperties`. " +
@@ -49,254 +300,6 @@ project.afterEvaluate {
49
300
  println "* Flavor aware sentry properties *"
50
301
  println "**********************************"
51
302
  }
52
-
53
- // separately we then hook into the bundle task of react native to inject
54
- // sourcemap generation parameters. In case for whatever reason no release
55
- // was found for the asset folder we just bail.
56
- def bundleTasks = tasks.findAll { task -> (task.name.startsWith("createBundle") || task.name.startsWith("bundle")) && task.name.endsWith("JsAndAssets") && !task.name.contains("Debug") && task.enabled }
57
- bundleTasks.each { bundleTask ->
58
- def shouldCleanUp
59
- def sourcemapOutput
60
- def bundleOutput
61
- def packagerSourcemapOutput
62
- def bundleCommand
63
- def props = bundleTask.getProperties()
64
- def reactRoot = props.get("workingDir")
65
- if (reactRoot == null) {
66
- reactRoot = props.get("root").get() // RN 0.71 and above
67
- }
68
- def modulesOutput = "$reactRoot/android/app/src/main/assets/modules.json"
69
- def modulesTask = null
70
-
71
- (shouldCleanUp, bundleOutput, sourcemapOutput, packagerSourcemapOutput, bundleCommand) = forceSourceMapOutputFromBundleTask(bundleTask)
72
-
73
- // Lets leave this here if we need to debug
74
- // println bundleTask.properties
75
- // .sort{it.key}
76
- // .collect{it}
77
- // .findAll{!['class', 'active'].contains(it.key)}
78
- // .join('\n')
79
-
80
- def currentVariants = extractCurrentVariants(bundleTask, releases)
81
- if (currentVariants == null) return
82
-
83
- def previousCliTask = null
84
- def applicationVariant = null
85
-
86
- def nameCleanup = "${bundleTask.name}_SentryUploadCleanUp"
87
- def nameModulesCleanup = "${bundleTask.name}_SentryCollectModulesCleanUp"
88
- // Upload the source map several times if necessary: once for each release and versionCode.
89
- currentVariants.each { key, currentVariant ->
90
- def variant = currentVariant[0]
91
- def releaseName = currentVariant[1]
92
- def versionCode = currentVariant[2]
93
- applicationVariant = currentVariant[3]
94
-
95
- try {
96
- if (versionCode instanceof String) {
97
- versionCode = Integer.parseInt(versionCode)
98
- versionCode = Math.abs(versionCode)
99
- }
100
- } catch (NumberFormatException e) {
101
- project.logger.info("versionCode: '$versionCode' isn't an Integer, using the plain value.")
102
- }
103
-
104
- // The Sentry server distinguishes source maps by release (`--release` in the command
105
- // below) and distribution identifier (`--dist` below). Give the task a unique name
106
- // based on where we're uploading to.
107
- def nameCliTask = "${bundleTask.name}_SentryUpload_${releaseName}_${versionCode}"
108
- def nameModulesTask = "${bundleTask.name}_SentryCollectModules_${releaseName}_${versionCode}"
109
-
110
- // If several outputs have the same releaseName and versionCode, we'd do the exact same
111
- // upload for each of them. No need to repeat.
112
- try { tasks.named(nameCliTask); return } catch (Exception e) {}
113
-
114
- /** Upload source map file to the sentry server via CLI call. */
115
- def cliTask = tasks.create(nameCliTask) {
116
- onlyIf { shouldSentryAutoUploadGeneral() }
117
- description = "upload debug symbols to sentry"
118
- group = 'sentry.io'
119
-
120
- def extraArgs = []
121
-
122
- def sentryPackage = resolveSentryReactNativeSDKPath(reactRoot)
123
- def copyDebugIdScript = config.copyDebugIdScript
124
- ? file(config.copyDebugIdScript).getAbsolutePath()
125
- : "$sentryPackage/scripts/copy-debugid.js"
126
- def hasSourceMapDebugIdScript = config.hasSourceMapDebugIdScript
127
- ? file(config.hasSourceMapDebugIdScript).getAbsolutePath()
128
- : "$sentryPackage/scripts/has-sourcemap-debugid.js"
129
-
130
- def injected = project.objects.newInstance(InjectedExecOps)
131
- doFirst {
132
- // Copy Debug ID from packager source map to Hermes composed source map
133
- injected.execOps.exec {
134
- def args = ["node",
135
- copyDebugIdScript,
136
- packagerSourcemapOutput,
137
- sourcemapOutput]
138
- def osCompatibilityCopyCommand = Os.isFamily(Os.FAMILY_WINDOWS) ? ['cmd', '/c'] : []
139
- commandLine(*osCompatibilityCopyCommand, *args)
140
- }
141
-
142
- // Add release and dist for backward compatibility if no Debug ID detected in output soruce map
143
- def process = ["node", hasSourceMapDebugIdScript, sourcemapOutput].execute(null, new File("$reactRoot"))
144
- def exitValue = process.waitFor()
145
- project.logger.lifecycle("Check generated source map for Debug ID: ${process.text}")
146
-
147
- project.logger.lifecycle("Sentry Source Maps upload will include the release name and dist.")
148
- extraArgs.addAll([
149
- "--release", releaseName,
150
- "--dist", versionCode
151
- ])
152
- }
153
-
154
- doLast {
155
- injected.execOps.exec {
156
- workingDir reactRoot
157
-
158
- def propertiesFile = config.sentryProperties
159
- ? config.sentryProperties
160
- : "$reactRoot/android/sentry.properties"
161
-
162
- if (config.flavorAware) {
163
- propertiesFile = "$reactRoot/android/sentry-${variant}.properties"
164
- project.logger.info("For $variant using: $propertiesFile")
165
- } else {
166
- environment("SENTRY_PROPERTIES", propertiesFile)
167
- }
168
-
169
- Properties sentryProps = new Properties()
170
- try {
171
- sentryProps.load(new FileInputStream(propertiesFile))
172
- } catch (FileNotFoundException e) {
173
- project.logger.info("file not found '$propertiesFile' for '$variant'")
174
- }
175
-
176
- def cliPackage = resolveSentryCliPackagePath(reactRoot)
177
- def cliExecutable = sentryProps.get("cli.executable", "$cliPackage/bin/sentry-cli")
178
-
179
- // fix path separator for Windows
180
- if (Os.isFamily(Os.FAMILY_WINDOWS)) {
181
- cliExecutable = cliExecutable.replaceAll("/", "\\\\")
182
- }
183
-
184
- //
185
- // based on:
186
- // https://github.com/getsentry/sentry-cli/blob/master/src/commands/react_native_gradle.rs
187
- //
188
- def args = [cliExecutable]
189
-
190
- args.addAll(!config.logLevel ? [] : [
191
- "--log-level", config.logLevel // control verbosity of the output
192
- ])
193
- args.addAll(!config.flavorAware ? [] : [
194
- "--url", sentryProps.get("defaults.url"),
195
- "--auth-token", sentryProps.get("auth.token") ?: System.getenv("SENTRY_AUTH_TOKEN")
196
- ])
197
- args.addAll(["react-native", "gradle",
198
- "--bundle", bundleOutput, // The path to a bundle that should be uploaded.
199
- "--sourcemap", sourcemapOutput // The path to a sourcemap that should be uploaded.
200
- ])
201
- args.addAll(!config.flavorAware ? [] : [
202
- "--org", sentryProps.get("defaults.org"),
203
- "--project", sentryProps.get("defaults.project")
204
- ])
205
-
206
- args.addAll(extraArgs)
207
-
208
- project.logger.lifecycle("Sentry-CLI arguments: ${args}")
209
- def osCompatibility = Os.isFamily(Os.FAMILY_WINDOWS) ? ['cmd', '/c', 'node'] : []
210
- if (!System.getenv('SENTRY_DOTENV_PATH') && file("$reactRoot/.env.sentry-build-plugin").exists()) {
211
- environment('SENTRY_DOTENV_PATH', "$reactRoot/.env.sentry-build-plugin")
212
- }
213
- commandLine(*osCompatibility, *args)
214
- }
215
- }
216
-
217
- enabled true
218
- }
219
-
220
- modulesTask = tasks.create(nameModulesTask, Exec) {
221
- description = "collect javascript modules from bundle source map"
222
- group = 'sentry.io'
223
-
224
- workingDir reactRoot
225
-
226
- def sentryPackage = resolveSentryReactNativeSDKPath(reactRoot)
227
-
228
- def collectModulesScript = config.collectModulesScript
229
- ? file(config.collectModulesScript).getAbsolutePath()
230
- : "$sentryPackage/dist/js/tools/collectModules.js"
231
- def modulesPaths = config.modulesPaths
232
- ? config.modulesPaths.join(',')
233
- : "$reactRoot/node_modules"
234
- def args = ["node",
235
- collectModulesScript,
236
- sourcemapOutput,
237
- modulesOutput,
238
- modulesPaths
239
- ]
240
-
241
- if ((new File(collectModulesScript)).exists()) {
242
- project.logger.info("Sentry-CollectModules arguments: ${args}")
243
- commandLine(*args)
244
-
245
- def skip = config.skipCollectModules
246
- ? config.skipCollectModules == true
247
- : false
248
- enabled !skip
249
- } else {
250
- project.logger.info("collectModulesScript not found: $collectModulesScript")
251
- enabled false
252
- }
253
- }
254
-
255
- // chain the upload tasks so they run sequentially in order to run
256
- // the cliCleanUpTask after the final upload task is run
257
- if (previousCliTask != null) {
258
- previousCliTask.finalizedBy cliTask
259
- } else {
260
- bundleTask.finalizedBy cliTask
261
- }
262
- previousCliTask = cliTask
263
- cliTask.finalizedBy modulesTask
264
- }
265
-
266
- def modulesCleanUpTask = tasks.create(name: nameModulesCleanup, type: Delete) {
267
- description = "clean up collected modules generated file"
268
- group = 'sentry.io'
269
-
270
- delete modulesOutput
271
- }
272
-
273
- def packageTasks = tasks.findAll {
274
- task -> (
275
- "package${applicationVariant}".equalsIgnoreCase(task.name)
276
- || "package${applicationVariant}Bundle".equalsIgnoreCase(task.name)
277
- ) && task.enabled
278
- }
279
- packageTasks.each { packageTask ->
280
- packageTask.dependsOn modulesTask
281
- packageTask.finalizedBy modulesCleanUpTask
282
- }
283
-
284
- /** Delete sourcemap files */
285
- def cliCleanUpTask = tasks.create(name: nameCleanup, type: Delete) {
286
- description = "clean up extra sourcemap"
287
- group = 'sentry.io'
288
-
289
- delete sourcemapOutput
290
- delete "$buildDir/intermediates/assets/release/index.android.bundle.map"
291
- // react native default bundle dir
292
- }
293
-
294
- // register clean task extension
295
- cliCleanUpTask.onlyIf { shouldCleanUp }
296
- // due to chaining the last value of previousCliTask will be the final
297
- // upload task, after which the cleanup can be done
298
- previousCliTask.finalizedBy cliCleanUpTask
299
- }
300
303
  }
301
304
 
302
305
  def resolveSentryReactNativeSDKPath(reactRoot) {
@@ -333,29 +336,6 @@ def resolveSentryCliPackagePath(reactRoot) {
333
336
  return cliPackage
334
337
  }
335
338
 
336
- /** Compose lookup map of build variants - to - outputs. */
337
- def extractReleasesInfo() {
338
- def releases = [:]
339
-
340
- android.applicationVariants.each { variant ->
341
-
342
- variant.outputs.each { output ->
343
- def defaultVersionCode = output.getVersionCode()
344
- def versionCode = System.getenv("SENTRY_DIST") ?: defaultVersionCode
345
- def defaultReleaseName = "${variant.getApplicationId()}@${variant.getVersionName()}+${versionCode}"
346
- def releaseName = System.getenv("SENTRY_RELEASE") ?: defaultReleaseName
347
- def variantName = variant.getName()
348
- def outputName = output.getName()
349
- if (releases[variantName] == null) {
350
- releases[variantName] = [:]
351
- }
352
- releases[variantName][outputName] = [outputName, releaseName, versionCode, variantName]
353
- }
354
- }
355
-
356
- return releases
357
- }
358
-
359
339
  /** Extract from arguments collection bundle and sourcemap files output names. */
360
340
  static extractBundleTaskArgumentsLegacy(cmdArgs, Project project) {
361
341
  def bundleOutput = null
@@ -467,7 +447,7 @@ def forceSourceMapOutputFromBundleTask(bundleTask) {
467
447
  }
468
448
 
469
449
  /** compose array with one item - current build flavor name */
470
- static extractCurrentVariants(bundleTask, releases) {
450
+ static extractCurrentVariants(bundleTask, variant) {
471
451
  // examples: bundleLocalReleaseJsAndAssets, createBundleYellowDebugJsAndAssets
472
452
  def pattern = Pattern.compile("(?:create)?(?:B|b)undle([A-Z][A-Za-z0-9_]+)JsAndAssets")
473
453
 
@@ -480,9 +460,21 @@ static extractCurrentVariants(bundleTask, releases) {
480
460
  }
481
461
 
482
462
  def currentVariants = null
483
- releases.each { key, release ->
484
- if (key.equalsIgnoreCase(currentRelease)) {
485
- currentVariants = release
463
+ if (variant.name.equalsIgnoreCase(currentRelease)) {
464
+ currentVariants = [:]
465
+ def variantName = variant.name
466
+ variant.outputs.each { output ->
467
+ def defaultVersionCode = output.versionCode.getOrElse(0)
468
+ def versionCode = System.getenv('SENTRY_DIST') ?: defaultVersionCode
469
+ def appId = variant.applicationId.get()
470
+ def versionName = output.versionName.getOrElse('') // may be empty if not set
471
+ def defaultReleaseName = "${appId}@${versionName}+${versionCode}"
472
+ def releaseName = System.getenv('SENTRY_RELEASE') ?: defaultReleaseName
473
+
474
+ def outputName = output.baseName
475
+
476
+ if (currentVariants[outputName] == null) currentVariants[outputName] = []
477
+ currentVariants[outputName] = [outputName, releaseName, versionCode, variantName]
486
478
  }
487
479
  }
488
480
 
@@ -135,7 +135,6 @@ export type NativeDeviceContextsResponse = {
135
135
  email?: string;
136
136
  username?: string;
137
137
  ipAddress?: string;
138
- segment?: string;
139
138
  data?: Record<string, unknown>;
140
139
  };
141
140
  dist?: string;
@@ -1,7 +1,7 @@
1
1
  import type { HostComponent, ViewProps } from 'react-native';
2
2
  // The default export exists in the file but eslint doesn't see it
3
3
  // eslint-disable-next-line import/default
4
- import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
+ import { codegenNativeComponent } from 'react-native';
5
5
 
6
6
  // If changed to type NativeProps = ViewProps, react native codegen will fail finding the NativeProps type
7
7
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
@@ -1,7 +1,7 @@
1
1
  import type { HostComponent, ViewProps } from 'react-native';
2
2
  // The default export exists in the file but eslint doesn't see it
3
3
  // eslint-disable-next-line import/default
4
- import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
+ import { codegenNativeComponent } from 'react-native';
5
5
 
6
6
  // If changed to type NativeProps = ViewProps, react native codegen will fail finding the NativeProps type
7
7
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
@@ -124,7 +124,6 @@ export type NativeDeviceContextsResponse = {
124
124
  email?: string;
125
125
  username?: string;
126
126
  ipAddress?: string;
127
- segment?: string;
128
127
  data?: Record<string, unknown>;
129
128
  };
130
129
  dist?: string;
@@ -25,5 +25,7 @@ export { timeToDisplayIntegration } from '../tracing/integrations/timeToDisplayI
25
25
  export { breadcrumbsIntegration } from './breadcrumbs';
26
26
  export { primitiveTagIntegration } from './primitiveTagIntegration';
27
27
  export { logEnricherIntegration } from './logEnricherIntegration';
28
+ export { graphqlIntegration } from './graphql';
29
+ export { supabaseIntegration } from './supabase';
28
30
  export { browserApiErrorsIntegration, dedupeIntegration, functionToStringIntegration, globalHandlersIntegration as browserGlobalHandlersIntegration, httpClientIntegration, httpContextIntegration, inboundFiltersIntegration, linkedErrorsIntegration as browserLinkedErrorsIntegration, rewriteFramesIntegration, extraErrorDataIntegration, } from '@sentry/react';
29
31
  //# sourceMappingURL=exports.d.ts.map
@@ -0,0 +1,11 @@
1
+ import type { Integration } from '@sentry/core';
2
+ interface GraphQLReactNativeIntegrationOptions {
3
+ endpoints: Array<string | RegExp>;
4
+ }
5
+ /**
6
+ * This integration ensures that GraphQL requests made in the React Native apps
7
+ * have their GraphQL-specific data captured and attached to spans and breadcrumbs.
8
+ */
9
+ export declare function graphqlIntegration(options: GraphQLReactNativeIntegrationOptions): Integration;
10
+ export {};
11
+ //# sourceMappingURL=graphql.d.ts.map
@@ -0,0 +1,12 @@
1
+ import type { Integration } from '@sentry/core';
2
+ type SupabaseReactNativeIntegrationOptions = {
3
+ supabaseClient: unknown;
4
+ };
5
+ /**
6
+ * Use this integration to instrument your Supabase client.
7
+ *
8
+ * Learn more about Supabase at https://supabase.com
9
+ */
10
+ export declare function supabaseIntegration(options: SupabaseReactNativeIntegrationOptions): Integration;
11
+ export {};
12
+ //# sourceMappingURL=supabase.d.ts.map