@sentry/react-native 6.7.0-alpha.0 → 6.8.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.
- package/RNSentry.podspec +2 -2
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +280 -2
- package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
- package/dist/js/integrations/debugsymbolicator.js +9 -1
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/debugsymbolicatorutils.js +9 -1
- package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -1
- package/dist/js/integrations/devicecontext.js +9 -1
- package/dist/js/integrations/devicecontext.js.map +1 -1
- package/dist/js/integrations/modulesloader.js +9 -1
- package/dist/js/integrations/modulesloader.js.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.js +9 -1
- package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
- package/dist/js/integrations/release.js +9 -1
- package/dist/js/integrations/release.js.map +1 -1
- package/dist/js/integrations/screenshot.js +9 -1
- package/dist/js/integrations/screenshot.js.map +1 -1
- package/dist/js/integrations/sdkinfo.js +9 -1
- package/dist/js/integrations/sdkinfo.js.map +1 -1
- package/dist/js/integrations/viewhierarchy.js +9 -1
- package/dist/js/integrations/viewhierarchy.js.map +1 -1
- package/dist/js/replay/mobilereplay.js +9 -1
- package/dist/js/replay/mobilereplay.js.map +1 -1
- package/dist/js/sdk.d.ts.map +1 -1
- package/dist/js/sdk.js +19 -22
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tools/metroMiddleware.js +11 -3
- package/dist/js/tools/metroMiddleware.js.map +1 -1
- package/dist/js/tools/metroconfig.d.ts +7 -11
- package/dist/js/tools/metroconfig.d.ts.map +1 -1
- package/dist/js/tools/metroconfig.js +25 -14
- package/dist/js/tools/metroconfig.js.map +1 -1
- package/dist/js/tools/sentryBabelTransformer.d.ts +1 -2
- package/dist/js/tools/sentryBabelTransformer.d.ts.map +1 -1
- package/dist/js/tools/sentryBabelTransformer.js +1 -23
- package/dist/js/tools/sentryBabelTransformer.js.map +1 -1
- package/dist/js/tools/sentryBabelTransformerUtils.d.ts +18 -0
- package/dist/js/tools/sentryBabelTransformerUtils.d.ts.map +1 -1
- package/dist/js/tools/sentryBabelTransformerUtils.js +71 -1
- package/dist/js/tools/sentryBabelTransformerUtils.js.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.js +11 -4
- package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
- package/dist/js/tools/utils.d.ts +1 -2
- package/dist/js/tools/utils.d.ts.map +1 -1
- package/dist/js/tools/utils.js.map +1 -1
- package/dist/js/tracing/integrations/appStart.js +9 -1
- package/dist/js/tracing/integrations/appStart.js.map +1 -1
- package/dist/js/tracing/integrations/nativeFrames.js +9 -1
- package/dist/js/tracing/integrations/nativeFrames.js.map +1 -1
- package/dist/js/utils/worldwide.d.ts +0 -2
- package/dist/js/utils/worldwide.d.ts.map +1 -1
- package/dist/js/utils/worldwide.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.d.ts.map +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.js +20 -1
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.h +5 -3
- package/ios/RNSentry.mm +210 -19
- package/ios/RNSentryVersion.m +1 -1
- package/package.json +8 -8
- package/plugin/build/withSentry.d.ts +2 -0
- package/plugin/build/withSentry.js +10 -0
- package/plugin/build/withSentryAndroidGradlePlugin.d.ts +15 -0
- package/plugin/build/withSentryAndroidGradlePlugin.js +91 -0
- package/scripts/collect-modules.sh +5 -5
- package/scripts/sentry-xcode.sh +0 -19
- package/sentry.gradle +1 -52
- package/ts3.8/dist/js/utils/worldwide.d.ts +0 -2
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryCompositeOptionsConfiguration.java +0 -25
- package/android/src/main/java/io/sentry/react/RNSentryJsonConverter.java +0 -76
- package/android/src/main/java/io/sentry/react/RNSentryJsonUtils.java +0 -41
- package/android/src/main/java/io/sentry/react/RNSentrySDK.java +0 -68
- package/android/src/main/java/io/sentry/react/RNSentryStart.java +0 -365
- package/dist/js/tools/sentryOptionsSerializer.d.ts +0 -6
- package/dist/js/tools/sentryOptionsSerializer.d.ts.map +0 -1
- package/dist/js/tools/sentryOptionsSerializer.js +0 -91
- package/dist/js/tools/sentryOptionsSerializer.js.map +0 -1
- package/ios/RNSentrySDK.h +0 -31
- package/ios/RNSentrySDK.m +0 -71
- package/ios/RNSentryStart.h +0 -26
- package/ios/RNSentryStart.m +0 -222
package/ios/RNSentry.mm
CHANGED
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
# import "RNSentryRNSScreen.h"
|
|
50
50
|
#endif
|
|
51
51
|
|
|
52
|
-
#import "RNSentryStart.h"
|
|
53
52
|
#import "RNSentryVersion.h"
|
|
54
53
|
|
|
55
54
|
@interface
|
|
@@ -64,6 +63,7 @@ SentrySDK (RNSentry)
|
|
|
64
63
|
static bool hasFetchedAppStart;
|
|
65
64
|
|
|
66
65
|
@implementation RNSentry {
|
|
66
|
+
bool sentHybridSdkDidBecomeActive;
|
|
67
67
|
bool hasListeners;
|
|
68
68
|
RNSentryTimeToDisplay *_timeToDisplay;
|
|
69
69
|
}
|
|
@@ -94,14 +94,181 @@ RCT_EXPORT_METHOD(initNativeSdk
|
|
|
94
94
|
: (RCTPromiseRejectBlock)reject)
|
|
95
95
|
{
|
|
96
96
|
NSError *error = nil;
|
|
97
|
-
[
|
|
97
|
+
SentryOptions *sentryOptions = [self createOptionsWithDictionary:options error:&error];
|
|
98
98
|
if (error != nil) {
|
|
99
99
|
reject(@"SentryReactNative", error.localizedDescription, error);
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
|
+
|
|
103
|
+
NSString *sdkVersion = [PrivateSentrySDKOnly getSdkVersionString];
|
|
104
|
+
[PrivateSentrySDKOnly setSdkName:NATIVE_SDK_NAME andVersionString:sdkVersion];
|
|
105
|
+
[PrivateSentrySDKOnly addSdkPackage:REACT_NATIVE_SDK_PACKAGE_NAME
|
|
106
|
+
version:REACT_NATIVE_SDK_PACKAGE_VERSION];
|
|
107
|
+
|
|
108
|
+
[SentrySDK startWithOptions:sentryOptions];
|
|
109
|
+
|
|
110
|
+
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
|
|
111
|
+
BOOL appIsActive =
|
|
112
|
+
[[UIApplication sharedApplication] applicationState] == UIApplicationStateActive;
|
|
113
|
+
#else
|
|
114
|
+
BOOL appIsActive = [[NSApplication sharedApplication] isActive];
|
|
115
|
+
#endif
|
|
116
|
+
|
|
117
|
+
// If the app is active/in foreground, and we have not sent the SentryHybridSdkDidBecomeActive
|
|
118
|
+
// notification, send it.
|
|
119
|
+
if (appIsActive && !sentHybridSdkDidBecomeActive
|
|
120
|
+
&& (PrivateSentrySDKOnly.options.enableAutoSessionTracking
|
|
121
|
+
|| PrivateSentrySDKOnly.options.enableWatchdogTerminationTracking)) {
|
|
122
|
+
[[NSNotificationCenter defaultCenter] postNotificationName:@"SentryHybridSdkDidBecomeActive"
|
|
123
|
+
object:nil];
|
|
124
|
+
|
|
125
|
+
sentHybridSdkDidBecomeActive = true;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
#if SENTRY_TARGET_REPLAY_SUPPORTED
|
|
129
|
+
[RNSentryReplay postInit];
|
|
130
|
+
#endif
|
|
131
|
+
|
|
102
132
|
resolve(@YES);
|
|
103
133
|
}
|
|
104
134
|
|
|
135
|
+
- (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)options
|
|
136
|
+
error:(NSError *_Nonnull *_Nonnull)errorPointer
|
|
137
|
+
{
|
|
138
|
+
SentryBeforeSendEventCallback beforeSend = ^SentryEvent *(SentryEvent *event)
|
|
139
|
+
{
|
|
140
|
+
// We don't want to send an event after startup that came from a Unhandled JS Exception of
|
|
141
|
+
// react native Because we sent it already before the app crashed.
|
|
142
|
+
if (nil != event.exceptions.firstObject.type &&
|
|
143
|
+
[event.exceptions.firstObject.type rangeOfString:@"Unhandled JS Exception"].location
|
|
144
|
+
!= NSNotFound) {
|
|
145
|
+
return nil;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
[self setEventOriginTag:event];
|
|
149
|
+
|
|
150
|
+
return event;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
NSMutableDictionary *mutableOptions = [options mutableCopy];
|
|
154
|
+
[mutableOptions setValue:beforeSend forKey:@"beforeSend"];
|
|
155
|
+
|
|
156
|
+
// remove performance traces sample rate and traces sampler since we don't want to synchronize
|
|
157
|
+
// these configurations to the Native SDKs. The user could tho initialize the SDK manually and
|
|
158
|
+
// set themselves.
|
|
159
|
+
[mutableOptions removeObjectForKey:@"tracesSampleRate"];
|
|
160
|
+
[mutableOptions removeObjectForKey:@"tracesSampler"];
|
|
161
|
+
[mutableOptions removeObjectForKey:@"enableTracing"];
|
|
162
|
+
|
|
163
|
+
#if SENTRY_TARGET_REPLAY_SUPPORTED
|
|
164
|
+
[RNSentryReplay updateOptions:mutableOptions];
|
|
165
|
+
#endif
|
|
166
|
+
|
|
167
|
+
SentryOptions *sentryOptions = [[SentryOptions alloc] initWithDict:mutableOptions
|
|
168
|
+
didFailWithError:errorPointer];
|
|
169
|
+
if (*errorPointer != nil) {
|
|
170
|
+
return nil;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Exclude Dev Server and Sentry Dsn request from Breadcrumbs
|
|
174
|
+
NSString *dsn = [self getURLFromDSN:[mutableOptions valueForKey:@"dsn"]];
|
|
175
|
+
NSString *devServerUrl = [mutableOptions valueForKey:@"devServerUrl"];
|
|
176
|
+
sentryOptions.beforeBreadcrumb
|
|
177
|
+
= ^SentryBreadcrumb *_Nullable(SentryBreadcrumb *_Nonnull breadcrumb)
|
|
178
|
+
{
|
|
179
|
+
NSString *url = breadcrumb.data[@"url"] ?: @"";
|
|
180
|
+
|
|
181
|
+
if ([@"http" isEqualToString:breadcrumb.type]
|
|
182
|
+
&& ((dsn != nil && [url hasPrefix:dsn])
|
|
183
|
+
|| (devServerUrl != nil && [url hasPrefix:devServerUrl]))) {
|
|
184
|
+
return nil;
|
|
185
|
+
}
|
|
186
|
+
return breadcrumb;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
if ([mutableOptions valueForKey:@"enableNativeCrashHandling"] != nil) {
|
|
190
|
+
BOOL enableNativeCrashHandling = [mutableOptions[@"enableNativeCrashHandling"] boolValue];
|
|
191
|
+
|
|
192
|
+
if (!enableNativeCrashHandling) {
|
|
193
|
+
NSMutableArray *integrations = sentryOptions.integrations.mutableCopy;
|
|
194
|
+
[integrations removeObject:@"SentryCrashIntegration"];
|
|
195
|
+
sentryOptions.integrations = integrations;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Set spotlight option
|
|
200
|
+
if ([mutableOptions valueForKey:@"spotlight"] != nil) {
|
|
201
|
+
id spotlightValue = [mutableOptions valueForKey:@"spotlight"];
|
|
202
|
+
if ([spotlightValue isKindOfClass:[NSString class]]) {
|
|
203
|
+
NSLog(@"Using Spotlight on address: %@", spotlightValue);
|
|
204
|
+
sentryOptions.enableSpotlight = true;
|
|
205
|
+
sentryOptions.spotlightUrl = spotlightValue;
|
|
206
|
+
} else if ([spotlightValue isKindOfClass:[NSNumber class]]) {
|
|
207
|
+
sentryOptions.enableSpotlight = [spotlightValue boolValue];
|
|
208
|
+
id defaultSpotlightUrl = [mutableOptions valueForKey:@"defaultSidecarUrl"];
|
|
209
|
+
if (defaultSpotlightUrl != nil) {
|
|
210
|
+
sentryOptions.spotlightUrl = defaultSpotlightUrl;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Enable the App start and Frames tracking measurements
|
|
216
|
+
if ([mutableOptions valueForKey:@"enableAutoPerformanceTracing"] != nil) {
|
|
217
|
+
BOOL enableAutoPerformanceTracing =
|
|
218
|
+
[mutableOptions[@"enableAutoPerformanceTracing"] boolValue];
|
|
219
|
+
PrivateSentrySDKOnly.appStartMeasurementHybridSDKMode = enableAutoPerformanceTracing;
|
|
220
|
+
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
|
|
221
|
+
PrivateSentrySDKOnly.framesTrackingMeasurementHybridSDKMode = enableAutoPerformanceTracing;
|
|
222
|
+
#endif
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Failed requests can only be enabled in one SDK to avoid duplicates
|
|
226
|
+
sentryOptions.enableCaptureFailedRequests = NO;
|
|
227
|
+
|
|
228
|
+
return sentryOptions;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
- (NSString *_Nullable)getURLFromDSN:(NSString *)dsn
|
|
232
|
+
{
|
|
233
|
+
NSURL *url = [NSURL URLWithString:dsn];
|
|
234
|
+
if (!url) {
|
|
235
|
+
return nil;
|
|
236
|
+
}
|
|
237
|
+
return [NSString stringWithFormat:@"%@://%@", url.scheme, url.host];
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
- (void)setEventOriginTag:(SentryEvent *)event
|
|
241
|
+
{
|
|
242
|
+
if (event.sdk != nil) {
|
|
243
|
+
NSString *sdkName = event.sdk[@"name"];
|
|
244
|
+
|
|
245
|
+
// If the event is from react native, it gets set
|
|
246
|
+
// there and we do not handle it here.
|
|
247
|
+
if ([sdkName isEqual:NATIVE_SDK_NAME]) {
|
|
248
|
+
[self setEventEnvironmentTag:event origin:@"ios" environment:@"native"];
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
- (void)setEventEnvironmentTag:(SentryEvent *)event
|
|
254
|
+
origin:(NSString *)origin
|
|
255
|
+
environment:(NSString *)environment
|
|
256
|
+
{
|
|
257
|
+
NSMutableDictionary *newTags = [NSMutableDictionary new];
|
|
258
|
+
|
|
259
|
+
if (nil != event.tags && [event.tags count] > 0) {
|
|
260
|
+
[newTags addEntriesFromDictionary:event.tags];
|
|
261
|
+
}
|
|
262
|
+
if (nil != origin) {
|
|
263
|
+
[newTags setValue:origin forKey:@"event.origin"];
|
|
264
|
+
}
|
|
265
|
+
if (nil != environment) {
|
|
266
|
+
[newTags setValue:environment forKey:@"event.environment"];
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
event.tags = newTags;
|
|
270
|
+
}
|
|
271
|
+
|
|
105
272
|
RCT_EXPORT_METHOD(initNativeReactNavigationNewFrameTracking
|
|
106
273
|
: (RCTPromiseResolveBlock)resolve rejecter
|
|
107
274
|
: (RCTPromiseRejectBlock)reject)
|
|
@@ -474,26 +641,50 @@ RCT_EXPORT_METHOD(fetchViewHierarchy
|
|
|
474
641
|
RCT_EXPORT_METHOD(setUser : (NSDictionary *)userKeys otherUserKeys : (NSDictionary *)userDataKeys)
|
|
475
642
|
{
|
|
476
643
|
[SentrySDK configureScope:^(SentryScope *_Nonnull scope) {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
SentryUser *userInstance = [[SentryUser alloc] init];
|
|
481
|
-
|
|
482
|
-
if (nil != userKeys) {
|
|
483
|
-
[userInstance setUserId:userKeys[@"id"]];
|
|
484
|
-
[userInstance setIpAddress:userKeys[@"ip_address"]];
|
|
485
|
-
[userInstance setEmail:userKeys[@"email"]];
|
|
486
|
-
[userInstance setUsername:userKeys[@"username"]];
|
|
487
|
-
[userInstance setSegment:userKeys[@"segment"]];
|
|
488
|
-
}
|
|
644
|
+
[scope setUser:[RNSentry userFrom:userKeys otherUserKeys:userDataKeys]];
|
|
645
|
+
}];
|
|
646
|
+
}
|
|
489
647
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
648
|
+
+ (SentryUser *_Nullable)userFrom:(NSDictionary *)userKeys
|
|
649
|
+
otherUserKeys:(NSDictionary *)userDataKeys
|
|
650
|
+
{
|
|
651
|
+
// we can safely ignore userDataKeys since if original JS user was null userKeys will be null
|
|
652
|
+
if ([userKeys isKindOfClass:NSDictionary.class]) {
|
|
653
|
+
SentryUser *userInstance = [[SentryUser alloc] init];
|
|
493
654
|
|
|
494
|
-
|
|
655
|
+
id userId = [userKeys valueForKey:@"id"];
|
|
656
|
+
if ([userId isKindOfClass:NSString.class]) {
|
|
657
|
+
[userInstance setUserId:userId];
|
|
495
658
|
}
|
|
496
|
-
|
|
659
|
+
id ipAddress = [userKeys valueForKey:@"ip_address"];
|
|
660
|
+
if ([ipAddress isKindOfClass:NSString.class]) {
|
|
661
|
+
[userInstance setIpAddress:ipAddress];
|
|
662
|
+
}
|
|
663
|
+
id email = [userKeys valueForKey:@"email"];
|
|
664
|
+
if ([email isKindOfClass:NSString.class]) {
|
|
665
|
+
[userInstance setEmail:email];
|
|
666
|
+
}
|
|
667
|
+
id username = [userKeys valueForKey:@"username"];
|
|
668
|
+
if ([username isKindOfClass:NSString.class]) {
|
|
669
|
+
[userInstance setUsername:username];
|
|
670
|
+
}
|
|
671
|
+
id segment = [userKeys valueForKey:@"segment"];
|
|
672
|
+
if ([segment isKindOfClass:NSString.class]) {
|
|
673
|
+
[userInstance setSegment:segment];
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
if ([userDataKeys isKindOfClass:NSDictionary.class]) {
|
|
677
|
+
[userInstance setData:userDataKeys];
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
return userInstance;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
if (![[NSNull null] isEqual:userKeys] && nil != userKeys) {
|
|
684
|
+
NSLog(@"[RNSentry] Method setUser received unexpected type of userKeys.");
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
return nil;
|
|
497
688
|
}
|
|
498
689
|
|
|
499
690
|
RCT_EXPORT_METHOD(addBreadcrumb : (NSDictionary *)breadcrumb)
|
package/ios/RNSentryVersion.m
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
NSString *const NATIVE_SDK_NAME = @"sentry.cocoa.react-native";
|
|
4
4
|
NSString *const REACT_NATIVE_SDK_NAME = @"sentry.javascript.react-native";
|
|
5
5
|
NSString *const REACT_NATIVE_SDK_PACKAGE_NAME = @"npm:@sentry/react-native";
|
|
6
|
-
NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"6.
|
|
6
|
+
NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"6.8.0";
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sentry/react-native",
|
|
3
3
|
"homepage": "https://github.com/getsentry/sentry-react-native",
|
|
4
4
|
"repository": "https://github.com/getsentry/sentry-react-native",
|
|
5
|
-
"version": "6.
|
|
5
|
+
"version": "6.8.0",
|
|
6
6
|
"description": "Official Sentry SDK for react-native",
|
|
7
7
|
"typings": "dist/js/index.d.ts",
|
|
8
8
|
"types": "dist/js/index.d.ts",
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
"react-native": ">=0.65.0"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@sentry/babel-plugin-component-annotate": "2.
|
|
68
|
+
"@sentry/babel-plugin-component-annotate": "3.2.0",
|
|
69
69
|
"@sentry/browser": "8.54.0",
|
|
70
|
-
"@sentry/cli": "2.
|
|
70
|
+
"@sentry/cli": "2.42.1",
|
|
71
71
|
"@sentry/core": "8.54.0",
|
|
72
72
|
"@sentry/react": "8.54.0",
|
|
73
73
|
"@sentry/types": "8.54.0",
|
|
@@ -77,13 +77,13 @@
|
|
|
77
77
|
"@babel/core": "^7.25.2",
|
|
78
78
|
"@expo/metro-config": "0.19.5",
|
|
79
79
|
"@mswjs/interceptors": "^0.25.15",
|
|
80
|
-
"@react-native/babel-preset": "0.
|
|
80
|
+
"@react-native/babel-preset": "0.77.1",
|
|
81
81
|
"@sentry-internal/eslint-config-sdk": "8.54.0",
|
|
82
82
|
"@sentry-internal/eslint-plugin-sdk": "8.54.0",
|
|
83
83
|
"@sentry-internal/typescript": "8.54.0",
|
|
84
|
-
"@sentry/wizard": "3.
|
|
84
|
+
"@sentry/wizard": "3.42.0",
|
|
85
85
|
"@testing-library/react-native": "^12.7.2",
|
|
86
|
-
"@types/jest": "^29.5.
|
|
86
|
+
"@types/jest": "^29.5.13",
|
|
87
87
|
"@types/node": "^20.9.3",
|
|
88
88
|
"@types/react": "^18.2.64",
|
|
89
89
|
"@types/uglify-js": "^3.17.2",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@types/xmlhttprequest": "^1.8.2",
|
|
92
92
|
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
|
93
93
|
"@typescript-eslint/parser": "^5.48.0",
|
|
94
|
-
"babel-jest": "^29.6.
|
|
94
|
+
"babel-jest": "^29.6.3",
|
|
95
95
|
"babel-plugin-module-resolver": "^5.0.0",
|
|
96
96
|
"babel-preset-fbjs": "^3.4.0",
|
|
97
97
|
"downlevel-dts": "^0.11.0",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"metro": "0.81.0",
|
|
108
108
|
"prettier": "^2.0.5",
|
|
109
109
|
"react": "18.3.1",
|
|
110
|
-
"react-native": "0.
|
|
110
|
+
"react-native": "0.77.1",
|
|
111
111
|
"react-test-renderer": "^18.3.1",
|
|
112
112
|
"rimraf": "^4.1.1",
|
|
113
113
|
"ts-jest": "^29.1.1",
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { ConfigPlugin } from 'expo/config-plugins';
|
|
2
|
+
import type { SentryAndroidGradlePluginOptions } from './withSentryAndroidGradlePlugin';
|
|
2
3
|
interface PluginProps {
|
|
3
4
|
organization?: string;
|
|
4
5
|
project?: string;
|
|
5
6
|
authToken?: string;
|
|
6
7
|
url?: string;
|
|
8
|
+
experimental_android?: SentryAndroidGradlePluginOptions;
|
|
7
9
|
}
|
|
8
10
|
export declare function getSentryProperties(props: PluginProps | void): string | null;
|
|
9
11
|
declare const withSentry: ConfigPlugin<void | PluginProps>;
|
|
@@ -4,6 +4,7 @@ exports.withSentry = exports.getSentryProperties = void 0;
|
|
|
4
4
|
const config_plugins_1 = require("expo/config-plugins");
|
|
5
5
|
const utils_1 = require("./utils");
|
|
6
6
|
const withSentryAndroid_1 = require("./withSentryAndroid");
|
|
7
|
+
const withSentryAndroidGradlePlugin_1 = require("./withSentryAndroidGradlePlugin");
|
|
7
8
|
const withSentryIOS_1 = require("./withSentryIOS");
|
|
8
9
|
const withSentryPlugin = (config, props) => {
|
|
9
10
|
const sentryProperties = getSentryProperties(props);
|
|
@@ -19,6 +20,15 @@ const withSentryPlugin = (config, props) => {
|
|
|
19
20
|
catch (e) {
|
|
20
21
|
(0, utils_1.warnOnce)(`There was a problem with configuring your native Android project: ${e}`);
|
|
21
22
|
}
|
|
23
|
+
// if `enableAndroidGradlePlugin` is provided configure the Sentry Android Gradle Plugin
|
|
24
|
+
if (props?.experimental_android && props?.experimental_android?.enableAndroidGradlePlugin) {
|
|
25
|
+
try {
|
|
26
|
+
cfg = (0, withSentryAndroidGradlePlugin_1.withSentryAndroidGradlePlugin)(cfg, props.experimental_android);
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
(0, utils_1.warnOnce)(`There was a problem with configuring Sentry Android Gradle Plugin: ${e}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
22
32
|
try {
|
|
23
33
|
cfg = (0, withSentryIOS_1.withSentryIOS)(cfg, sentryProperties);
|
|
24
34
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface SentryAndroidGradlePluginOptions {
|
|
2
|
+
enableAndroidGradlePlugin?: boolean;
|
|
3
|
+
includeProguardMapping?: boolean;
|
|
4
|
+
dexguardEnabled?: boolean;
|
|
5
|
+
autoUploadNativeSymbols?: boolean;
|
|
6
|
+
autoUploadProguardMapping?: boolean;
|
|
7
|
+
uploadNativeSymbols?: boolean;
|
|
8
|
+
includeNativeSources?: boolean;
|
|
9
|
+
includeSourceContext?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Adds the Sentry Android Gradle Plugin to the project.
|
|
13
|
+
* https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#enable-sentry-agp
|
|
14
|
+
*/
|
|
15
|
+
export declare function withSentryAndroidGradlePlugin(config: any, { includeProguardMapping, dexguardEnabled, autoUploadProguardMapping, uploadNativeSymbols, autoUploadNativeSymbols, includeNativeSources, includeSourceContext, }?: SentryAndroidGradlePluginOptions): any;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withSentryAndroidGradlePlugin = void 0;
|
|
4
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
/**
|
|
7
|
+
* Adds the Sentry Android Gradle Plugin to the project.
|
|
8
|
+
* https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#enable-sentry-agp
|
|
9
|
+
*/
|
|
10
|
+
function withSentryAndroidGradlePlugin(config, { includeProguardMapping = true, dexguardEnabled = false, autoUploadProguardMapping = true, uploadNativeSymbols = true, autoUploadNativeSymbols = true, includeNativeSources = true, includeSourceContext = false, } = {}) {
|
|
11
|
+
const version = '4.14.1';
|
|
12
|
+
// Modify android/build.gradle
|
|
13
|
+
const withSentryProjectBuildGradle = (config) => {
|
|
14
|
+
return (0, config_plugins_1.withProjectBuildGradle)(config, (projectBuildGradle) => {
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
16
|
+
if (!projectBuildGradle.modResults || !projectBuildGradle.modResults.contents) {
|
|
17
|
+
(0, utils_1.warnOnce)('android/build.gradle content is missing or undefined.');
|
|
18
|
+
return config;
|
|
19
|
+
}
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
21
|
+
if (projectBuildGradle.modResults.language !== 'groovy') {
|
|
22
|
+
(0, utils_1.warnOnce)('Cannot configure Sentry in android/build.gradle because it is not in Groovy.');
|
|
23
|
+
return config;
|
|
24
|
+
}
|
|
25
|
+
const dependency = `classpath("io.sentry:sentry-android-gradle-plugin:${version}")`;
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
27
|
+
if (projectBuildGradle.modResults.contents.includes(dependency)) {
|
|
28
|
+
(0, utils_1.warnOnce)('sentry-android-gradle-plugin dependency in already in android/build.gradle.');
|
|
29
|
+
return config;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
33
|
+
const updatedContents = projectBuildGradle.modResults.contents.replace(/dependencies\s*{/, `dependencies {\n ${dependency}`);
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
35
|
+
if (updatedContents === projectBuildGradle.modResults.contents) {
|
|
36
|
+
(0, utils_1.warnOnce)('Failed to inject the dependency. Could not find `dependencies` in build.gradle.');
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
40
|
+
projectBuildGradle.modResults.contents = updatedContents;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
(0, utils_1.warnOnce)(`An error occurred while trying to modify build.gradle`);
|
|
45
|
+
}
|
|
46
|
+
return projectBuildGradle;
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
// Modify android/app/build.gradle
|
|
50
|
+
const withSentryAppBuildGradle = (config) => {
|
|
51
|
+
return (0, config_plugins_1.withAppBuildGradle)(config, (config) => {
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
53
|
+
if (config.modResults.language !== 'groovy') {
|
|
54
|
+
(0, utils_1.warnOnce)('Cannot configure Sentry in android/app/build.gradle because it is not in Groovy.');
|
|
55
|
+
return config;
|
|
56
|
+
}
|
|
57
|
+
const sentryPlugin = `apply plugin: "io.sentry.android.gradle"`;
|
|
58
|
+
const sentryConfig = `
|
|
59
|
+
sentry {
|
|
60
|
+
autoUploadProguardMapping = ${autoUploadProguardMapping}
|
|
61
|
+
includeProguardMapping = ${includeProguardMapping}
|
|
62
|
+
dexguardEnabled = ${dexguardEnabled}
|
|
63
|
+
uploadNativeSymbols = ${uploadNativeSymbols}
|
|
64
|
+
autoUploadNativeSymbols = ${autoUploadNativeSymbols}
|
|
65
|
+
includeNativeSources = ${includeNativeSources}
|
|
66
|
+
includeSourceContext = ${includeSourceContext}
|
|
67
|
+
tracingInstrumentation {
|
|
68
|
+
enabled = false
|
|
69
|
+
}
|
|
70
|
+
autoInstallation {
|
|
71
|
+
enabled = false
|
|
72
|
+
}
|
|
73
|
+
}`;
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
75
|
+
let contents = config.modResults.contents;
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
77
|
+
if (!contents.includes(sentryPlugin)) {
|
|
78
|
+
contents = `${sentryPlugin}\n${contents}`;
|
|
79
|
+
}
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
81
|
+
if (!contents.includes('sentry {')) {
|
|
82
|
+
contents = `${contents}\n${sentryConfig}`;
|
|
83
|
+
}
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
85
|
+
config.modResults.contents = contents;
|
|
86
|
+
return config;
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
return withSentryAppBuildGradle(withSentryProjectBuildGradle(config));
|
|
90
|
+
}
|
|
91
|
+
exports.withSentryAndroidGradlePlugin = withSentryAndroidGradlePlugin;
|
|
@@ -28,7 +28,7 @@ if [[ -n "$NODE_BINARY" ]]; then
|
|
|
28
28
|
nodePath="$NODE_BINARY"
|
|
29
29
|
fi
|
|
30
30
|
|
|
31
|
-
thisFilePath=$(dirname $0)
|
|
31
|
+
thisFilePath=$(dirname "$0")
|
|
32
32
|
collectModulesScript="$thisFilePath/../dist/js/tools/collectModules.js"
|
|
33
33
|
|
|
34
34
|
destination="$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH"
|
|
@@ -44,11 +44,11 @@ else
|
|
|
44
44
|
modulesPaths="$MODULES_PATHS"
|
|
45
45
|
fi
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
echo
|
|
47
|
+
if ! command -v "$nodePath" >/dev/null 2>&1; then
|
|
48
|
+
echo "[sentry/collect-modules.sh] $nodePath not found! Modules won't be collected." \
|
|
49
49
|
"Please export NODE_BINARY in 'Build Phase' - 'Bundle React Native code and images'" \
|
|
50
50
|
"to an absolute path of your node binary. Check your node path by 'which node'."
|
|
51
51
|
exit 0 # Don't fail the build but inform about the problem
|
|
52
|
-
|
|
52
|
+
fi
|
|
53
53
|
|
|
54
|
-
$nodePath "$collectModulesScript" "$sourceMap" "$modulesOutput" "$modulesPaths"
|
|
54
|
+
"$nodePath" "$collectModulesScript" "$sourceMap" "$modulesOutput" "$modulesPaths"
|
package/scripts/sentry-xcode.sh
CHANGED
|
@@ -51,22 +51,3 @@ fi
|
|
|
51
51
|
if [ -f "$SENTRY_COLLECT_MODULES" ]; then
|
|
52
52
|
/bin/sh "$SENTRY_COLLECT_MODULES"
|
|
53
53
|
fi
|
|
54
|
-
|
|
55
|
-
SENTRY_OPTIONS_FILE_ERROR_MESSAGE_POSTFIX="Skipping options file copy. To disable this behavior, set SENTRY_COPY_OPTIONS_FILE=false in your environment variables."
|
|
56
|
-
SENTRY_OPTIONS_FILE_NAME="sentry.options.json"
|
|
57
|
-
SENTRY_OPTIONS_FILE_DESTINATION_PATH="$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/$SENTRY_OPTIONS_FILE_NAME"
|
|
58
|
-
[ -z "$SENTRY_OPTIONS_FILE_PATH" ] && SENTRY_OPTIONS_FILE_PATH="$RN_PROJECT_ROOT/$SENTRY_OPTIONS_FILE_NAME"
|
|
59
|
-
[ -z "$SENTRY_COPY_OPTIONS_FILE" ] && SENTRY_COPY_OPTIONS_FILE=true
|
|
60
|
-
|
|
61
|
-
if [ "$SENTRY_COPY_OPTIONS_FILE" = true ]; then
|
|
62
|
-
if [[ -z "$CONFIGURATION_BUILD_DIR" ]]; then
|
|
63
|
-
echo "[Sentry] CONFIGURATION_BUILD_DIR is not set. $SENTRY_OPTIONS_FILE_ERROR_MESSAGE_POSTFIX" 1>&2
|
|
64
|
-
elif [[ -z "$UNLOCALIZED_RESOURCES_FOLDER_PATH" ]]; then
|
|
65
|
-
echo "[Sentry] UNLOCALIZED_RESOURCES_FOLDER_PATH is not set. $SENTRY_OPTIONS_FILE_ERROR_MESSAGE_POSTFIX" 1>&2
|
|
66
|
-
elif [ ! -f "$SENTRY_OPTIONS_FILE_PATH" ]; then
|
|
67
|
-
echo "[Sentry] $SENTRY_OPTIONS_FILE_PATH not found. $SENTRY_OPTIONS_FILE_ERROR_MESSAGE_POSTFIX" 1>&2
|
|
68
|
-
else
|
|
69
|
-
cp "$SENTRY_OPTIONS_FILE_PATH" "$SENTRY_OPTIONS_FILE_DESTINATION_PATH"
|
|
70
|
-
echo "[Sentry] Copied $SENTRY_OPTIONS_FILE_PATH to $SENTRY_OPTIONS_FILE_DESTINATION_PATH"
|
|
71
|
-
fi
|
|
72
|
-
fi
|
package/sentry.gradle
CHANGED
|
@@ -3,7 +3,7 @@ import org.apache.tools.ant.taskdefs.condition.Os
|
|
|
3
3
|
import java.util.regex.Matcher
|
|
4
4
|
import java.util.regex.Pattern
|
|
5
5
|
|
|
6
|
-
project.ext.shouldSentryAutoUploadNative = { ->
|
|
6
|
+
project.ext.shouldSentryAutoUploadNative = { ->
|
|
7
7
|
return System.getenv('SENTRY_DISABLE_NATIVE_DEBUG_UPLOAD') != 'true'
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -15,60 +15,9 @@ project.ext.shouldSentryAutoUpload = { ->
|
|
|
15
15
|
return shouldSentryAutoUploadGeneral() && shouldSentryAutoUploadNative()
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
project.ext.shouldCopySentryOptionsFile = { -> // If not set, default to true
|
|
19
|
-
return System.getenv('SENTRY_COPY_OPTIONS_FILE') != 'false'
|
|
20
|
-
}
|
|
21
|
-
|
|
22
18
|
def config = project.hasProperty("sentryCli") ? project.sentryCli : [];
|
|
23
19
|
|
|
24
|
-
def configFile = "sentry.options.json" // Sentry condiguration file
|
|
25
|
-
def androidAssetsDir = new File("$rootDir/app/src/main/assets") // Path to Android assets folder
|
|
26
|
-
|
|
27
|
-
tasks.register("copySentryJsonConfiguration") {
|
|
28
|
-
onlyIf { shouldCopySentryOptionsFile() }
|
|
29
|
-
doLast {
|
|
30
|
-
def appRoot = project.rootDir.parentFile ?: project.rootDir
|
|
31
|
-
def sentryOptionsFile = new File(appRoot, configFile)
|
|
32
|
-
if (sentryOptionsFile.exists()) {
|
|
33
|
-
if (!androidAssetsDir.exists()) {
|
|
34
|
-
androidAssetsDir.mkdirs()
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
copy {
|
|
38
|
-
from sentryOptionsFile
|
|
39
|
-
into androidAssetsDir
|
|
40
|
-
rename { String fileName -> configFile }
|
|
41
|
-
}
|
|
42
|
-
logger.lifecycle("Copied ${configFile} to Android assets")
|
|
43
|
-
} else {
|
|
44
|
-
logger.warn("${configFile} not found in app root (${appRoot})")
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
tasks.register("cleanupTemporarySentryJsonConfiguration") {
|
|
50
|
-
onlyIf { shouldCopySentryOptionsFile() }
|
|
51
|
-
doLast {
|
|
52
|
-
def sentryOptionsFile = new File(androidAssetsDir, configFile)
|
|
53
|
-
if (sentryOptionsFile.exists()) {
|
|
54
|
-
logger.lifecycle("Deleting temporary file: ${sentryOptionsFile.path}")
|
|
55
|
-
sentryOptionsFile.delete()
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
20
|
gradle.projectsEvaluated {
|
|
61
|
-
// Add a task that copies the sentry.options.json file before the build starts
|
|
62
|
-
tasks.named("preBuild").configure {
|
|
63
|
-
dependsOn("copySentryJsonConfiguration")
|
|
64
|
-
}
|
|
65
|
-
// Cleanup sentry.options.json from assets after the build
|
|
66
|
-
tasks.matching { task ->
|
|
67
|
-
task.name == "build" || task.name.startsWith("assemble") || task.name.startsWith("install")
|
|
68
|
-
}.configureEach {
|
|
69
|
-
finalizedBy("cleanupTemporarySentryJsonConfiguration")
|
|
70
|
-
}
|
|
71
|
-
|
|
72
21
|
def releases = extractReleasesInfo()
|
|
73
22
|
|
|
74
23
|
if (config.flavorAware && config.sentryProperties) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react-native" />
|
|
2
2
|
import type { InternalGlobal } from '@sentry/core';
|
|
3
3
|
import type { ErrorUtils } from 'react-native/types';
|
|
4
|
-
import type { ReactNativeOptions } from '../options';
|
|
5
4
|
import type { ExpoGlobalObject } from './expoglobalobject';
|
|
6
5
|
/** Internal Global object interface with common and Sentry specific properties */
|
|
7
6
|
export interface ReactNativeInternalGlobal extends InternalGlobal {
|
|
@@ -24,7 +23,6 @@ export interface ReactNativeInternalGlobal extends InternalGlobal {
|
|
|
24
23
|
__BUNDLE_START_TIME__?: number;
|
|
25
24
|
nativePerformanceNow?: () => number;
|
|
26
25
|
TextEncoder?: TextEncoder;
|
|
27
|
-
__SENTRY_OPTIONS__?: ReactNativeOptions;
|
|
28
26
|
}
|
|
29
27
|
type TextEncoder = {
|
|
30
28
|
new (): TextEncoder;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
|
|
2
2
|
export declare const SDK_NAME = "sentry.javascript.react-native";
|
|
3
|
-
export declare const SDK_VERSION = "6.
|
|
3
|
+
export declare const SDK_VERSION = "6.8.0";
|
|
4
4
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
package io.sentry.react;
|
|
2
|
-
|
|
3
|
-
import io.sentry.Sentry.OptionsConfiguration;
|
|
4
|
-
import io.sentry.android.core.SentryAndroidOptions;
|
|
5
|
-
import java.util.List;
|
|
6
|
-
import org.jetbrains.annotations.NotNull;
|
|
7
|
-
|
|
8
|
-
class RNSentryCompositeOptionsConfiguration implements OptionsConfiguration<SentryAndroidOptions> {
|
|
9
|
-
private final @NotNull List<OptionsConfiguration<SentryAndroidOptions>> configurations;
|
|
10
|
-
|
|
11
|
-
@SafeVarargs
|
|
12
|
-
protected RNSentryCompositeOptionsConfiguration(
|
|
13
|
-
@NotNull OptionsConfiguration<SentryAndroidOptions>... configurations) {
|
|
14
|
-
this.configurations = List.of(configurations);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@Override
|
|
18
|
-
public void configure(@NotNull SentryAndroidOptions options) {
|
|
19
|
-
for (OptionsConfiguration<SentryAndroidOptions> configuration : configurations) {
|
|
20
|
-
if (configuration != null) {
|
|
21
|
-
configuration.configure(options);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|