@sentry/react-native 6.6.0 → 6.7.0-alpha.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 +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryCompositeOptionsConfiguration.java +25 -0
- package/android/src/main/java/io/sentry/react/RNSentryJsonConverter.java +76 -0
- package/android/src/main/java/io/sentry/react/RNSentryJsonUtils.java +41 -0
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +2 -280
- package/android/src/main/java/io/sentry/react/RNSentrySDK.java +68 -0
- package/android/src/main/java/io/sentry/react/RNSentryStart.java +365 -0
- package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
- package/dist/js/sdk.d.ts.map +1 -1
- package/dist/js/sdk.js +21 -10
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tools/metroconfig.d.ts +9 -1
- package/dist/js/tools/metroconfig.d.ts.map +1 -1
- package/dist/js/tools/metroconfig.js +9 -2
- package/dist/js/tools/metroconfig.js.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.js +1 -0
- package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
- package/dist/js/tools/sentryOptionsSerializer.d.ts +6 -0
- package/dist/js/tools/sentryOptionsSerializer.d.ts.map +1 -0
- package/dist/js/tools/sentryOptionsSerializer.js +91 -0
- package/dist/js/tools/sentryOptionsSerializer.js.map +1 -0
- package/dist/js/tools/utils.d.ts +2 -1
- package/dist/js/tools/utils.d.ts.map +1 -1
- package/dist/js/tools/utils.js.map +1 -1
- package/dist/js/utils/worldwide.d.ts +2 -0
- 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/ios/RNSentry.h +3 -5
- package/ios/RNSentry.mm +2 -169
- package/ios/RNSentrySDK.h +31 -0
- package/ios/RNSentrySDK.m +71 -0
- package/ios/RNSentryStart.h +26 -0
- package/ios/RNSentryStart.m +222 -0
- package/ios/RNSentryVersion.m +1 -1
- package/package.json +10 -10
- package/scripts/sentry-xcode.sh +19 -0
- package/sentry.gradle +52 -1
- package/ts3.8/dist/js/utils/worldwide.d.ts +2 -0
- package/ts3.8/dist/js/version.d.ts +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#import <Sentry/Sentry.h>
|
|
2
|
+
|
|
3
|
+
@interface RNSentrySDK : NSObject
|
|
4
|
+
SENTRY_NO_INIT
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @experimental
|
|
8
|
+
* Inits and configures Sentry for React Native applications using `sentry.options.json`
|
|
9
|
+
* configuration file.
|
|
10
|
+
*
|
|
11
|
+
* @discussion Call this method on the main thread. When calling it from a background thread, the
|
|
12
|
+
* SDK starts on the main thread async.
|
|
13
|
+
*/
|
|
14
|
+
+ (void)start;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @experimental
|
|
18
|
+
* Inits and configures Sentry for React Native applicationsusing `sentry.options.json`
|
|
19
|
+
* configuration file and `configureOptions` callback.
|
|
20
|
+
*
|
|
21
|
+
* The `configureOptions` callback can overwrite the config file options
|
|
22
|
+
* and add non-serializable items to the options object.
|
|
23
|
+
*
|
|
24
|
+
* @discussion Call this method on the main thread. When calling it from a background thread, the
|
|
25
|
+
* SDK starts on the main thread async.
|
|
26
|
+
*/
|
|
27
|
+
+ (void)startWithConfigureOptions:
|
|
28
|
+
(void (^_Nullable)(SentryOptions *_Nonnull options))configureOptions
|
|
29
|
+
NS_SWIFT_NAME(start(configureOptions:));
|
|
30
|
+
|
|
31
|
+
@end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#import "RNSentrySDK.h"
|
|
2
|
+
#import "RNSentryStart.h"
|
|
3
|
+
|
|
4
|
+
static NSString *SENTRY_OPTIONS_RESOURCE_NAME = @"sentry.options";
|
|
5
|
+
static NSString *SENTRY_OPTIONS_RESOURCE_TYPE = @"json";
|
|
6
|
+
|
|
7
|
+
@implementation RNSentrySDK
|
|
8
|
+
|
|
9
|
+
+ (void)start
|
|
10
|
+
{
|
|
11
|
+
[self startWithConfigureOptions:nil];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
+ (void)startWithConfigureOptions:(void (^)(SentryOptions *options))configureOptions
|
|
15
|
+
{
|
|
16
|
+
NSString *path = [[NSBundle mainBundle] pathForResource:SENTRY_OPTIONS_RESOURCE_NAME
|
|
17
|
+
ofType:SENTRY_OPTIONS_RESOURCE_TYPE];
|
|
18
|
+
|
|
19
|
+
[self start:path configureOptions:configureOptions];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
+ (void)start:(NSString *)path configureOptions:(void (^)(SentryOptions *options))configureOptions
|
|
23
|
+
{
|
|
24
|
+
NSError *readError = nil;
|
|
25
|
+
NSError *parseError = nil;
|
|
26
|
+
NSError *optionsError = nil;
|
|
27
|
+
|
|
28
|
+
NSData *_Nullable content = nil;
|
|
29
|
+
if (path != nil) {
|
|
30
|
+
content = [NSData dataWithContentsOfFile:path options:0 error:&readError];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
NSDictionary *dict = nil;
|
|
34
|
+
if (content != nil) {
|
|
35
|
+
dict = [NSJSONSerialization JSONObjectWithData:content options:0 error:&parseError];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (readError != nil) {
|
|
39
|
+
NSLog(@"[RNSentry] Failed to load options from %@, with error: %@", path,
|
|
40
|
+
readError.localizedDescription);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (parseError != nil) {
|
|
44
|
+
NSLog(@"[RNSentry] Failed to parse JSON from %@, with error: %@", path,
|
|
45
|
+
parseError.localizedDescription);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
SentryOptions *options = nil;
|
|
49
|
+
if (dict != nil) {
|
|
50
|
+
options = [RNSentryStart createOptionsWithDictionary:dict error:&optionsError];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (optionsError != nil) {
|
|
54
|
+
NSLog(@"[RNSentry] Failed to parse options from %@, with error: %@", path,
|
|
55
|
+
optionsError.localizedDescription);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (options == nil) {
|
|
59
|
+
// Fallback in case that options file could not be parsed.
|
|
60
|
+
options = [[SentryOptions alloc] init];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[RNSentryStart updateWithReactDefaults:options];
|
|
64
|
+
if (configureOptions != nil) {
|
|
65
|
+
configureOptions(options);
|
|
66
|
+
}
|
|
67
|
+
[RNSentryStart updateWithReactFinals:options];
|
|
68
|
+
[RNSentryStart startWithOptions:options];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#import <Sentry/SentryDefines.h>
|
|
2
|
+
#import <Sentry/SentryOptions.h>
|
|
3
|
+
|
|
4
|
+
@interface RNSentryStart : NSObject
|
|
5
|
+
SENTRY_NO_INIT
|
|
6
|
+
|
|
7
|
+
+ (void)startWithOptions:(NSDictionary *_Nonnull)javascriptOptions
|
|
8
|
+
error:(NSError *_Nullable *_Nullable)errorPointer;
|
|
9
|
+
|
|
10
|
+
+ (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)options
|
|
11
|
+
error:(NSError *_Nonnull *_Nonnull)errorPointer;
|
|
12
|
+
|
|
13
|
+
+ (void)updateWithReactDefaults:(SentryOptions *)options;
|
|
14
|
+
+ (void)updateWithReactFinals:(SentryOptions *)options;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @experimental
|
|
18
|
+
* Inits and configures Sentry for React Native applications. Make sure to
|
|
19
|
+
* set a valid DSN.
|
|
20
|
+
*
|
|
21
|
+
* @discussion Call this method on the main thread. When calling it from a background thread, the
|
|
22
|
+
* SDK starts on the main thread async.
|
|
23
|
+
*/
|
|
24
|
+
+ (void)startWithOptions:(SentryOptions *)options NS_SWIFT_NAME(start(options:));
|
|
25
|
+
|
|
26
|
+
@end
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
#import "RNSentryStart.h"
|
|
2
|
+
#import "RNSentryReplay.h"
|
|
3
|
+
#import "RNSentryVersion.h"
|
|
4
|
+
|
|
5
|
+
#import <Sentry/PrivateSentrySDKOnly.h>
|
|
6
|
+
#import <Sentry/Sentry.h>
|
|
7
|
+
#import <Sentry/SentryOptions+HybridSDKs.h>
|
|
8
|
+
|
|
9
|
+
@implementation RNSentryStart
|
|
10
|
+
|
|
11
|
+
+ (void)startWithOptions:(NSDictionary *_Nonnull)javascriptOptions
|
|
12
|
+
error:(NSError *_Nullable *_Nullable)errorPointer
|
|
13
|
+
{
|
|
14
|
+
SentryOptions *options = [self createOptionsWithDictionary:javascriptOptions
|
|
15
|
+
error:errorPointer];
|
|
16
|
+
[self updateWithReactDefaults:options];
|
|
17
|
+
[self updateWithReactFinals:options];
|
|
18
|
+
[self startWithOptions:options];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
+ (void)startWithOptions:(SentryOptions *)options NS_SWIFT_NAME(start(options:))
|
|
22
|
+
{
|
|
23
|
+
NSString *sdkVersion = [PrivateSentrySDKOnly getSdkVersionString];
|
|
24
|
+
[PrivateSentrySDKOnly setSdkName:NATIVE_SDK_NAME andVersionString:sdkVersion];
|
|
25
|
+
[PrivateSentrySDKOnly addSdkPackage:REACT_NATIVE_SDK_PACKAGE_NAME
|
|
26
|
+
version:REACT_NATIVE_SDK_PACKAGE_VERSION];
|
|
27
|
+
|
|
28
|
+
[SentrySDK startWithOptions:options];
|
|
29
|
+
|
|
30
|
+
#if SENTRY_TARGET_REPLAY_SUPPORTED
|
|
31
|
+
[RNSentryReplay postInit];
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
[self postDidBecomeActiveNotification];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
+ (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)options
|
|
38
|
+
error:(NSError *_Nonnull *_Nonnull)errorPointer
|
|
39
|
+
{
|
|
40
|
+
NSMutableDictionary *mutableOptions = [options mutableCopy];
|
|
41
|
+
|
|
42
|
+
#if SENTRY_TARGET_REPLAY_SUPPORTED
|
|
43
|
+
[RNSentryReplay updateOptions:mutableOptions];
|
|
44
|
+
#endif
|
|
45
|
+
|
|
46
|
+
SentryOptions *sentryOptions = [[SentryOptions alloc] initWithDict:mutableOptions
|
|
47
|
+
didFailWithError:errorPointer];
|
|
48
|
+
if (*errorPointer != nil) {
|
|
49
|
+
return nil;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Exclude Dev Server and Sentry Dsn request from Breadcrumbs
|
|
53
|
+
NSString *dsn = [self getURLFromDSN:[mutableOptions valueForKey:@"dsn"]];
|
|
54
|
+
// TODO: For Auto Init from JS dev server is resolved automatically, for init from options file
|
|
55
|
+
// dev server has to be specified manually
|
|
56
|
+
NSString *devServerUrl = [mutableOptions valueForKey:@"devServerUrl"];
|
|
57
|
+
sentryOptions.beforeBreadcrumb
|
|
58
|
+
= ^SentryBreadcrumb *_Nullable(SentryBreadcrumb *_Nonnull breadcrumb)
|
|
59
|
+
{
|
|
60
|
+
NSString *url = breadcrumb.data[@"url"] ?: @"";
|
|
61
|
+
|
|
62
|
+
if ([@"http" isEqualToString:breadcrumb.type]
|
|
63
|
+
&& ((dsn != nil && [url hasPrefix:dsn])
|
|
64
|
+
|| (devServerUrl != nil && [url hasPrefix:devServerUrl]))) {
|
|
65
|
+
return nil;
|
|
66
|
+
}
|
|
67
|
+
return breadcrumb;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// JS options.enableNativeCrashHandling equals to native options.enableCrashHandler
|
|
71
|
+
if ([mutableOptions valueForKey:@"enableNativeCrashHandling"] != nil) {
|
|
72
|
+
BOOL enableNativeCrashHandling = [mutableOptions[@"enableNativeCrashHandling"] boolValue];
|
|
73
|
+
|
|
74
|
+
if (!enableNativeCrashHandling) {
|
|
75
|
+
NSMutableArray *integrations = sentryOptions.integrations.mutableCopy;
|
|
76
|
+
[integrations removeObject:@"SentryCrashIntegration"];
|
|
77
|
+
sentryOptions.integrations = integrations;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Set spotlight option
|
|
82
|
+
if ([mutableOptions valueForKey:@"spotlight"] != nil) {
|
|
83
|
+
id spotlightValue = [mutableOptions valueForKey:@"spotlight"];
|
|
84
|
+
if ([spotlightValue isKindOfClass:[NSString class]]) {
|
|
85
|
+
NSLog(@"Using Spotlight on address: %@", spotlightValue);
|
|
86
|
+
sentryOptions.enableSpotlight = true;
|
|
87
|
+
sentryOptions.spotlightUrl = spotlightValue;
|
|
88
|
+
} else if ([spotlightValue isKindOfClass:[NSNumber class]]) {
|
|
89
|
+
sentryOptions.enableSpotlight = [spotlightValue boolValue];
|
|
90
|
+
// TODO: For Auto init from JS set automatically for init from options file have to be
|
|
91
|
+
// set manually
|
|
92
|
+
id defaultSpotlightUrl = [mutableOptions valueForKey:@"defaultSidecarUrl"];
|
|
93
|
+
if (defaultSpotlightUrl != nil) {
|
|
94
|
+
sentryOptions.spotlightUrl = defaultSpotlightUrl;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return sentryOptions;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* This function updates the options with RNSentry defaults. These default can be
|
|
104
|
+
* overwritten by users during manual native initialization.
|
|
105
|
+
*/
|
|
106
|
+
+ (void)updateWithReactDefaults:(SentryOptions *)options
|
|
107
|
+
{
|
|
108
|
+
// Failed requests are captured only in JS to avoid duplicates
|
|
109
|
+
options.enableCaptureFailedRequests = NO;
|
|
110
|
+
|
|
111
|
+
// Tracing is only enabled in JS to avoid duplicate navigation spans
|
|
112
|
+
options.tracesSampleRate = nil;
|
|
113
|
+
options.tracesSampler = nil;
|
|
114
|
+
options.enableTracing = NO;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* This function updates options with changes RNSentry users should not change
|
|
119
|
+
* and so this is applied after the configureOptions callback during manual native initialization.
|
|
120
|
+
*/
|
|
121
|
+
+ (void)updateWithReactFinals:(SentryOptions *)options
|
|
122
|
+
{
|
|
123
|
+
SentryBeforeSendEventCallback userBeforeSend = options.beforeSend;
|
|
124
|
+
options.beforeSend = ^SentryEvent *(SentryEvent *event)
|
|
125
|
+
{
|
|
126
|
+
// Unhandled JS Exception are processed by the SDK on JS layer
|
|
127
|
+
// To avoid duplicates we drop them in the native SDKs
|
|
128
|
+
if (nil != event.exceptions.firstObject.type &&
|
|
129
|
+
[event.exceptions.firstObject.type rangeOfString:@"Unhandled JS Exception"].location
|
|
130
|
+
!= NSNotFound) {
|
|
131
|
+
return nil;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
[self setEventOriginTag:event];
|
|
135
|
+
if (userBeforeSend == nil) {
|
|
136
|
+
return event;
|
|
137
|
+
} else {
|
|
138
|
+
return userBeforeSend(event);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// App Start Hybrid mode doesn't wait for didFinishLaunchNotification and the
|
|
143
|
+
// didBecomeVisibleNotification as they will be missed when auto initializing from JS
|
|
144
|
+
// App Start measurements are created right after the tracking starts
|
|
145
|
+
PrivateSentrySDKOnly.appStartMeasurementHybridSDKMode = options.enableAutoPerformanceTracing;
|
|
146
|
+
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
|
|
147
|
+
// Frames Tracking Hybrid Mode ensures tracking
|
|
148
|
+
// is enabled without tracing enabled in the native SDK
|
|
149
|
+
PrivateSentrySDKOnly.framesTrackingMeasurementHybridSDKMode
|
|
150
|
+
= options.enableAutoPerformanceTracing;
|
|
151
|
+
#endif
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
+ (void)setEventOriginTag:(SentryEvent *)event
|
|
155
|
+
{
|
|
156
|
+
if (event.sdk != nil) {
|
|
157
|
+
NSString *sdkName = event.sdk[@"name"];
|
|
158
|
+
|
|
159
|
+
// If the event is from react native, it gets set
|
|
160
|
+
// there and we do not handle it here.
|
|
161
|
+
if ([sdkName isEqual:NATIVE_SDK_NAME]) {
|
|
162
|
+
[self setEventEnvironmentTag:event origin:@"ios" environment:@"native"];
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
+ (void)setEventEnvironmentTag:(SentryEvent *)event
|
|
168
|
+
origin:(NSString *)origin
|
|
169
|
+
environment:(NSString *)environment
|
|
170
|
+
{
|
|
171
|
+
NSMutableDictionary *newTags = [NSMutableDictionary new];
|
|
172
|
+
|
|
173
|
+
if (nil != event.tags && [event.tags count] > 0) {
|
|
174
|
+
[newTags addEntriesFromDictionary:event.tags];
|
|
175
|
+
}
|
|
176
|
+
if (nil != origin) {
|
|
177
|
+
[newTags setValue:origin forKey:@"event.origin"];
|
|
178
|
+
}
|
|
179
|
+
if (nil != environment) {
|
|
180
|
+
[newTags setValue:environment forKey:@"event.environment"];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
event.tags = newTags;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
+ (NSString *_Nullable)getURLFromDSN:(NSString *)dsn
|
|
187
|
+
{
|
|
188
|
+
NSURL *url = [NSURL URLWithString:dsn];
|
|
189
|
+
if (!url) {
|
|
190
|
+
return nil;
|
|
191
|
+
}
|
|
192
|
+
return [NSString stringWithFormat:@"%@://%@", url.scheme, url.host];
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
static bool sentHybridSdkDidBecomeActive = NO;
|
|
196
|
+
|
|
197
|
+
+ (void)postDidBecomeActiveNotification
|
|
198
|
+
{
|
|
199
|
+
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
|
|
200
|
+
BOOL appIsActive =
|
|
201
|
+
[[UIApplication sharedApplication] applicationState] == UIApplicationStateActive;
|
|
202
|
+
#else
|
|
203
|
+
BOOL appIsActive = [[NSApplication sharedApplication] isActive];
|
|
204
|
+
#endif
|
|
205
|
+
|
|
206
|
+
// If the app is active/in foreground, and we have not sent the SentryHybridSdkDidBecomeActive
|
|
207
|
+
// notification, send it.
|
|
208
|
+
if (appIsActive && !sentHybridSdkDidBecomeActive
|
|
209
|
+
&& (PrivateSentrySDKOnly.options.enableAutoSessionTracking
|
|
210
|
+
|| PrivateSentrySDKOnly.options.enableWatchdogTerminationTracking)) {
|
|
211
|
+
// Updates Native App State Manager
|
|
212
|
+
// https://github.com/getsentry/sentry-cocoa/blob/888a145b144b8077e03151a886520f332e47e297/Sources/Sentry/SentryAppStateManager.m#L136
|
|
213
|
+
// Triggers Session Tracker
|
|
214
|
+
// https://github.com/getsentry/sentry-cocoa/blob/888a145b144b8077e03151a886520f332e47e297/Sources/Sentry/SentrySessionTracker.m#L144
|
|
215
|
+
[[NSNotificationCenter defaultCenter] postNotificationName:@"SentryHybridSdkDidBecomeActive"
|
|
216
|
+
object:nil];
|
|
217
|
+
|
|
218
|
+
sentHybridSdkDidBecomeActive = true;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
@end
|
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.7.0-alpha.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.7.0-alpha.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",
|
|
@@ -66,22 +66,22 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@sentry/babel-plugin-component-annotate": "2.20.1",
|
|
69
|
-
"@sentry/browser": "8.
|
|
69
|
+
"@sentry/browser": "8.54.0",
|
|
70
70
|
"@sentry/cli": "2.41.1",
|
|
71
|
-
"@sentry/core": "8.
|
|
72
|
-
"@sentry/react": "8.
|
|
73
|
-
"@sentry/types": "8.
|
|
74
|
-
"@sentry/utils": "8.
|
|
71
|
+
"@sentry/core": "8.54.0",
|
|
72
|
+
"@sentry/react": "8.54.0",
|
|
73
|
+
"@sentry/types": "8.54.0",
|
|
74
|
+
"@sentry/utils": "8.54.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@babel/core": "^7.25.2",
|
|
78
78
|
"@expo/metro-config": "0.19.5",
|
|
79
79
|
"@mswjs/interceptors": "^0.25.15",
|
|
80
80
|
"@react-native/babel-preset": "0.76.3",
|
|
81
|
-
"@sentry-internal/eslint-config-sdk": "8.
|
|
82
|
-
"@sentry-internal/eslint-plugin-sdk": "8.
|
|
83
|
-
"@sentry-internal/typescript": "8.
|
|
84
|
-
"@sentry/wizard": "3.
|
|
81
|
+
"@sentry-internal/eslint-config-sdk": "8.54.0",
|
|
82
|
+
"@sentry-internal/eslint-plugin-sdk": "8.54.0",
|
|
83
|
+
"@sentry-internal/typescript": "8.54.0",
|
|
84
|
+
"@sentry/wizard": "3.40.0",
|
|
85
85
|
"@testing-library/react-native": "^12.7.2",
|
|
86
86
|
"@types/jest": "^29.5.3",
|
|
87
87
|
"@types/node": "^20.9.3",
|
package/scripts/sentry-xcode.sh
CHANGED
|
@@ -51,3 +51,22 @@ 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,9 +15,60 @@ 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
|
+
|
|
18
22
|
def config = project.hasProperty("sentryCli") ? project.sentryCli : [];
|
|
19
23
|
|
|
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
|
+
|
|
20
60
|
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
|
+
|
|
21
72
|
def releases = extractReleasesInfo()
|
|
22
73
|
|
|
23
74
|
if (config.flavorAware && config.sentryProperties) {
|
|
@@ -1,6 +1,7 @@
|
|
|
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';
|
|
4
5
|
import type { ExpoGlobalObject } from './expoglobalobject';
|
|
5
6
|
/** Internal Global object interface with common and Sentry specific properties */
|
|
6
7
|
export interface ReactNativeInternalGlobal extends InternalGlobal {
|
|
@@ -23,6 +24,7 @@ export interface ReactNativeInternalGlobal extends InternalGlobal {
|
|
|
23
24
|
__BUNDLE_START_TIME__?: number;
|
|
24
25
|
nativePerformanceNow?: () => number;
|
|
25
26
|
TextEncoder?: TextEncoder;
|
|
27
|
+
__SENTRY_OPTIONS__?: ReactNativeOptions;
|
|
26
28
|
}
|
|
27
29
|
type TextEncoder = {
|
|
28
30
|
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.7.0-alpha.0";
|
|
4
4
|
//# sourceMappingURL=version.d.ts.map
|