@sentry/react-native 5.0.0-alpha.9 → 5.0.0-beta.1
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/CHANGELOG.md +134 -3
- package/README.md +1 -1
- package/RNSentry.podspec +5 -5
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +100 -21
- package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +5 -0
- package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +5 -0
- package/dist/js/NativeRNSentry.d.ts +36 -3
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/breadcrumb.d.ts +11 -0
- package/dist/js/breadcrumb.d.ts.map +1 -0
- package/dist/js/breadcrumb.js +34 -0
- package/dist/js/breadcrumb.js.map +1 -0
- package/dist/js/client.d.ts +4 -5
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +22 -35
- package/dist/js/client.js.map +1 -1
- package/dist/js/index.d.ts +1 -0
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +1 -0
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/debugsymbolicator.d.ts +1 -1
- package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/devicecontext.d.ts +2 -2
- package/dist/js/integrations/devicecontext.d.ts.map +1 -1
- package/dist/js/integrations/devicecontext.js +45 -11
- package/dist/js/integrations/devicecontext.js.map +1 -1
- package/dist/js/integrations/eventorigin.d.ts +1 -1
- package/dist/js/integrations/eventorigin.d.ts.map +1 -1
- package/dist/js/integrations/eventorigin.js.map +1 -1
- package/dist/js/integrations/modulesloader.d.ts +1 -1
- package/dist/js/integrations/modulesloader.d.ts.map +1 -1
- package/dist/js/integrations/modulesloader.js +8 -2
- package/dist/js/integrations/modulesloader.js.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.d.ts +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.js +4 -3
- package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
- package/dist/js/integrations/reactnativeinfo.d.ts +1 -1
- package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeinfo.js.map +1 -1
- package/dist/js/integrations/release.d.ts +1 -1
- package/dist/js/integrations/release.d.ts.map +1 -1
- package/dist/js/integrations/release.js.map +1 -1
- package/dist/js/integrations/screenshot.d.ts +23 -0
- package/dist/js/integrations/screenshot.d.ts.map +1 -0
- package/dist/js/integrations/screenshot.js +39 -0
- package/dist/js/integrations/screenshot.js.map +1 -0
- package/dist/js/integrations/sdkinfo.d.ts +1 -1
- package/dist/js/integrations/sdkinfo.d.ts.map +1 -1
- package/dist/js/integrations/sdkinfo.js.map +1 -1
- package/dist/js/measurements.d.ts +4 -0
- package/dist/js/measurements.d.ts.map +1 -1
- package/dist/js/measurements.js +11 -0
- package/dist/js/measurements.js.map +1 -1
- package/dist/js/misc.d.ts +1 -1
- package/dist/js/misc.d.ts.map +1 -1
- package/dist/js/misc.js.map +1 -1
- package/dist/js/options.d.ts +18 -11
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/scope.d.ts +1 -1
- package/dist/js/scope.d.ts.map +1 -1
- package/dist/js/scope.js +4 -2
- package/dist/js/scope.js.map +1 -1
- package/dist/js/sdk.d.ts +4 -3
- package/dist/js/sdk.d.ts.map +1 -1
- package/dist/js/sdk.js +11 -6
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tools/ModulesCollector.d.ts +10 -1
- package/dist/js/tools/ModulesCollector.d.ts.map +1 -1
- package/dist/js/tools/ModulesCollector.js +51 -1
- package/dist/js/tools/ModulesCollector.js.map +1 -1
- package/dist/js/tools/collectModules.js +6 -27
- package/dist/js/tools/collectModules.js.map +1 -1
- package/dist/js/touchevents.d.ts +4 -0
- package/dist/js/touchevents.d.ts.map +1 -1
- package/dist/js/touchevents.js +10 -5
- package/dist/js/touchevents.js.map +1 -1
- package/dist/js/tracing/nativeframes.d.ts +2 -2
- package/dist/js/tracing/nativeframes.d.ts.map +1 -1
- package/dist/js/tracing/nativeframes.js.map +1 -1
- package/dist/js/tracing/reactnativenavigation.d.ts +4 -3
- package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnativenavigation.js +1 -1
- package/dist/js/tracing/reactnativenavigation.js.map +1 -1
- package/dist/js/tracing/reactnativetracing.d.ts +5 -5
- package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
- package/dist/js/tracing/reactnativetracing.js +1 -1
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/tracing/reactnavigation.d.ts +3 -2
- package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnavigation.js +1 -1
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/tracing/reactnavigationv4.d.ts +4 -3
- package/dist/js/tracing/reactnavigationv4.d.ts.map +1 -1
- package/dist/js/tracing/reactnavigationv4.js +1 -1
- package/dist/js/tracing/reactnavigationv4.js.map +1 -1
- package/dist/js/tracing/routingInstrumentation.d.ts +3 -3
- package/dist/js/tracing/routingInstrumentation.d.ts.map +1 -1
- package/dist/js/tracing/routingInstrumentation.js.map +1 -1
- package/dist/js/tracing/stalltracking.d.ts +2 -2
- package/dist/js/tracing/stalltracking.d.ts.map +1 -1
- package/dist/js/tracing/stalltracking.js.map +1 -1
- package/dist/js/tracing/types.d.ts +1 -1
- package/dist/js/tracing/types.d.ts.map +1 -1
- package/dist/js/tracing/types.js.map +1 -1
- package/dist/js/tracing/utils.d.ts +2 -2
- package/dist/js/tracing/utils.d.ts.map +1 -1
- package/dist/js/tracing/utils.js.map +1 -1
- package/dist/js/transports/TextEncoder.d.ts +1 -1
- package/dist/js/transports/TextEncoder.d.ts.map +1 -1
- package/dist/js/transports/TextEncoder.js.map +1 -1
- package/dist/js/transports/native.d.ts +7 -3
- package/dist/js/transports/native.d.ts.map +1 -1
- package/dist/js/transports/native.js +10 -1
- package/dist/js/transports/native.js.map +1 -1
- package/dist/js/user.d.ts +1 -1
- package/dist/js/user.d.ts.map +1 -1
- package/dist/js/user.js.map +1 -1
- package/dist/js/utils/envelope.d.ts +1 -1
- package/dist/js/utils/envelope.d.ts.map +1 -1
- package/dist/js/utils/envelope.js.map +1 -1
- package/dist/js/utils/ignorerequirecyclelogs.d.ts +6 -0
- package/dist/js/utils/ignorerequirecyclelogs.d.ts.map +1 -0
- package/dist/js/utils/ignorerequirecyclelogs.js +15 -0
- package/dist/js/utils/ignorerequirecyclelogs.js.map +1 -0
- package/dist/js/utils/outcome.d.ts +1 -1
- package/dist/js/utils/outcome.d.ts.map +1 -1
- package/dist/js/utils/outcome.js.map +1 -1
- package/dist/js/utils/safe.d.ts +1 -1
- package/dist/js/utils/safe.d.ts.map +1 -1
- package/dist/js/utils/safe.js.map +1 -1
- package/dist/js/utils/worldwide.d.ts +1 -1
- 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.d.ts +9 -3
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +30 -6
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.h +5 -0
- package/ios/RNSentry.mm +80 -49
- package/package.json +24 -23
- package/scripts/collect-modules.sh +1 -1
- package/sentry.gradle +46 -15
- package/src/js/NativeRNSentry.ts +38 -3
- package/ios/RNSentry.xcodeproj/project.pbxproj +0 -472
- package/ios/RNSentry.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/RNSentry.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
package/ios/RNSentry.mm
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
#import <Sentry/Sentry.h>
|
|
10
10
|
#import <Sentry/PrivateSentrySDKOnly.h>
|
|
11
11
|
#import <Sentry/SentryScreenFrames.h>
|
|
12
|
+
#import <Sentry/SentryOptions+HybridSDKs.h>
|
|
12
13
|
|
|
13
14
|
// Thanks to this guard, we won't import this header when we build for the old architecture.
|
|
14
15
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
@@ -49,7 +50,35 @@ RCT_EXPORT_METHOD(initNativeSdk:(NSDictionary *_Nonnull)options
|
|
|
49
50
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
50
51
|
{
|
|
51
52
|
NSError *error = nil;
|
|
53
|
+
SentryOptions* sentryOptions = [self createOptionsWithDictionary:options error:&error];
|
|
54
|
+
if (error != nil) {
|
|
55
|
+
reject(@"SentryReactNative", error.localizedDescription, error);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
[SentrySDK startWithOptions:sentryOptions];
|
|
60
|
+
|
|
61
|
+
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
|
|
62
|
+
BOOL appIsActive = [[UIApplication sharedApplication] applicationState] == UIApplicationStateActive;
|
|
63
|
+
#else
|
|
64
|
+
BOOL appIsActive = [[NSApplication sharedApplication] isActive];
|
|
65
|
+
#endif
|
|
66
|
+
|
|
67
|
+
// If the app is active/in foreground, and we have not sent the SentryHybridSdkDidBecomeActive notification, send it.
|
|
68
|
+
if (appIsActive && !sentHybridSdkDidBecomeActive && (PrivateSentrySDKOnly.options.enableAutoSessionTracking || PrivateSentrySDKOnly.options.enableWatchdogTerminationTracking)) {
|
|
69
|
+
[[NSNotificationCenter defaultCenter]
|
|
70
|
+
postNotificationName:@"SentryHybridSdkDidBecomeActive"
|
|
71
|
+
object:nil];
|
|
52
72
|
|
|
73
|
+
sentHybridSdkDidBecomeActive = true;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
resolve(@YES);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
- (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)options
|
|
80
|
+
error: (NSError *_Nonnull *_Nonnull) errorPointer
|
|
81
|
+
{
|
|
53
82
|
SentryBeforeSendEventCallback beforeSend = ^SentryEvent*(SentryEvent *event) {
|
|
54
83
|
// We don't want to send an event after startup that came from a Unhandled JS Exception of react native
|
|
55
84
|
// Because we sent it already before the app crashed.
|
|
@@ -73,10 +102,9 @@ RCT_EXPORT_METHOD(initNativeSdk:(NSDictionary *_Nonnull)options
|
|
|
73
102
|
[mutableOptions removeObjectForKey:@"tracesSampleRate"];
|
|
74
103
|
[mutableOptions removeObjectForKey:@"tracesSampler"];
|
|
75
104
|
|
|
76
|
-
SentryOptions *sentryOptions = [[SentryOptions alloc] initWithDict:mutableOptions didFailWithError
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
return;
|
|
105
|
+
SentryOptions *sentryOptions = [[SentryOptions alloc] initWithDict:mutableOptions didFailWithError:errorPointer];
|
|
106
|
+
if (*errorPointer != nil) {
|
|
107
|
+
return nil;
|
|
80
108
|
}
|
|
81
109
|
|
|
82
110
|
if ([mutableOptions valueForKey:@"enableNativeCrashHandling"] != nil) {
|
|
@@ -90,36 +118,16 @@ RCT_EXPORT_METHOD(initNativeSdk:(NSDictionary *_Nonnull)options
|
|
|
90
118
|
}
|
|
91
119
|
|
|
92
120
|
// Enable the App start and Frames tracking measurements
|
|
93
|
-
if ([mutableOptions valueForKey:@"
|
|
94
|
-
BOOL
|
|
121
|
+
if ([mutableOptions valueForKey:@"enableAutoPerformanceTracing"] != nil) {
|
|
122
|
+
BOOL enableAutoPerformanceTracing = (BOOL)[mutableOptions valueForKey:@"enableAutoPerformanceTracing"];
|
|
95
123
|
|
|
96
|
-
PrivateSentrySDKOnly.appStartMeasurementHybridSDKMode =
|
|
124
|
+
PrivateSentrySDKOnly.appStartMeasurementHybridSDKMode = enableAutoPerformanceTracing;
|
|
97
125
|
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
|
|
98
|
-
PrivateSentrySDKOnly.framesTrackingMeasurementHybridSDKMode =
|
|
99
|
-
#endif
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
[SentrySDK startWithOptionsObject:sentryOptions];
|
|
103
|
-
|
|
104
|
-
#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
|
|
105
|
-
BOOL appIsActive = [[UIApplication sharedApplication] applicationState] == UIApplicationStateActive;
|
|
106
|
-
#else
|
|
107
|
-
BOOL appIsActive = [[NSApplication sharedApplication] isActive];
|
|
126
|
+
PrivateSentrySDKOnly.framesTrackingMeasurementHybridSDKMode = enableAutoPerformanceTracing;
|
|
108
127
|
#endif
|
|
109
|
-
|
|
110
|
-
// If the app is active/in foreground, and we have not sent the SentryHybridSdkDidBecomeActive notification, send it.
|
|
111
|
-
if (appIsActive && !sentHybridSdkDidBecomeActive && (PrivateSentrySDKOnly.options.enableAutoSessionTracking || PrivateSentrySDKOnly.options.enableOutOfMemoryTracking)) {
|
|
112
|
-
[[NSNotificationCenter defaultCenter]
|
|
113
|
-
postNotificationName:@"SentryHybridSdkDidBecomeActive"
|
|
114
|
-
object:nil];
|
|
115
|
-
|
|
116
|
-
sentHybridSdkDidBecomeActive = true;
|
|
117
128
|
}
|
|
118
129
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
resolve(@YES);
|
|
130
|
+
return sentryOptions;
|
|
123
131
|
}
|
|
124
132
|
|
|
125
133
|
- (void)setEventOriginTag:(SentryEvent *)event {
|
|
@@ -175,33 +183,27 @@ RCT_EXPORT_METHOD(fetchNativeDeviceContexts:(RCTPromiseResolveBlock)resolve
|
|
|
175
183
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
176
184
|
{
|
|
177
185
|
NSLog(@"Bridge call to: deviceContexts");
|
|
178
|
-
NSMutableDictionary<NSString *, id> *contexts
|
|
186
|
+
__block NSMutableDictionary<NSString *, id> *contexts;
|
|
179
187
|
// Temp work around until sorted out this API in sentry-cocoa.
|
|
180
188
|
// TODO: If the callback isnt' executed the promise wouldn't be resolved.
|
|
181
189
|
[SentrySDK configureScope:^(SentryScope * _Nonnull scope) {
|
|
182
|
-
NSDictionary<NSString *, id>
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
[user addEntriesFromDictionary:[tempUser valueForKey:@"user"]];
|
|
191
|
-
} else {
|
|
192
|
-
[user setValue:PrivateSentrySDKOnly.installationID forKey:@"id"];
|
|
190
|
+
NSDictionary<NSString *, id> *serializedScope = [scope serialize];
|
|
191
|
+
contexts = [serializedScope mutableCopy];
|
|
192
|
+
|
|
193
|
+
NSDictionary<NSString *, id> *user = [contexts valueForKey:@"user"];
|
|
194
|
+
if (user == nil) {
|
|
195
|
+
[contexts
|
|
196
|
+
setValue:@{ @"id": PrivateSentrySDKOnly.installationID }
|
|
197
|
+
forKey:@"user"];
|
|
193
198
|
}
|
|
194
|
-
[contexts setValue:user forKey:@"user"];
|
|
195
199
|
|
|
196
|
-
if (tempContexts != nil) {
|
|
197
|
-
[contexts setValue:tempContexts forKey:@"context"];
|
|
198
|
-
}
|
|
199
200
|
if (PrivateSentrySDKOnly.options.debug) {
|
|
200
201
|
NSData *data = [NSJSONSerialization dataWithJSONObject:contexts options:0 error:nil];
|
|
201
202
|
NSString *debugContext = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
|
202
203
|
NSLog(@"Contexts: %@", debugContext);
|
|
203
204
|
}
|
|
204
205
|
}];
|
|
206
|
+
|
|
205
207
|
resolve(contexts);
|
|
206
208
|
}
|
|
207
209
|
|
|
@@ -306,6 +308,35 @@ RCT_EXPORT_METHOD(captureEnvelope:(NSArray * _Nonnull)bytes
|
|
|
306
308
|
resolve(@YES);
|
|
307
309
|
}
|
|
308
310
|
|
|
311
|
+
RCT_EXPORT_METHOD(captureScreenshot: (RCTPromiseResolveBlock)resolve
|
|
312
|
+
rejecter: (RCTPromiseRejectBlock)reject)
|
|
313
|
+
{
|
|
314
|
+
NSArray<NSData *>* rawScreenshots = [PrivateSentrySDKOnly captureScreenshots];
|
|
315
|
+
NSMutableArray *screenshotsArray = [NSMutableArray arrayWithCapacity:[rawScreenshots count]];
|
|
316
|
+
|
|
317
|
+
int counter = 1;
|
|
318
|
+
for (NSData* raw in rawScreenshots) {
|
|
319
|
+
NSMutableArray *screenshot = [NSMutableArray arrayWithCapacity:raw.length];
|
|
320
|
+
const char *bytes = (char*) [raw bytes];
|
|
321
|
+
for (int i = 0; i < [raw length]; i++) {
|
|
322
|
+
[screenshot addObject:[[NSNumber alloc] initWithChar:bytes[i]]];
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
NSString* filename = @"screenshot.png";
|
|
326
|
+
if (counter > 1) {
|
|
327
|
+
filename = [NSString stringWithFormat:@"screenshot-%d.png", counter];
|
|
328
|
+
}
|
|
329
|
+
[screenshotsArray addObject:@{
|
|
330
|
+
@"data": screenshot,
|
|
331
|
+
@"contentType": @"image/png",
|
|
332
|
+
@"filename": filename,
|
|
333
|
+
}];
|
|
334
|
+
counter++;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
resolve(screenshotsArray);
|
|
338
|
+
}
|
|
339
|
+
|
|
309
340
|
RCT_EXPORT_METHOD(setUser:(NSDictionary *)userKeys
|
|
310
341
|
otherUserKeys:(NSDictionary *)userDataKeys
|
|
311
342
|
)
|
|
@@ -344,12 +375,12 @@ RCT_EXPORT_METHOD(addBreadcrumb:(NSDictionary *)breadcrumb)
|
|
|
344
375
|
sentryLevel = kSentryLevelFatal;
|
|
345
376
|
} else if ([levelString isEqualToString:@"warning"]) {
|
|
346
377
|
sentryLevel = kSentryLevelWarning;
|
|
347
|
-
} else if ([levelString isEqualToString:@"
|
|
348
|
-
sentryLevel =
|
|
378
|
+
} else if ([levelString isEqualToString:@"error"]) {
|
|
379
|
+
sentryLevel = kSentryLevelError;
|
|
349
380
|
} else if ([levelString isEqualToString:@"debug"]) {
|
|
350
381
|
sentryLevel = kSentryLevelDebug;
|
|
351
382
|
} else {
|
|
352
|
-
sentryLevel =
|
|
383
|
+
sentryLevel = kSentryLevelInfo;
|
|
353
384
|
}
|
|
354
385
|
[breadcrumbInstance setLevel:sentryLevel];
|
|
355
386
|
|
|
@@ -419,7 +450,7 @@ RCT_EXPORT_METHOD(enableNativeFramesTracking)
|
|
|
419
450
|
{
|
|
420
451
|
// Do nothing on iOS, this bridge method only has an effect on android.
|
|
421
452
|
// If you're starting the Cocoa SDK manually,
|
|
422
|
-
// you can set the '
|
|
453
|
+
// you can set the 'enableAutoPerformanceTracing: true' option and
|
|
423
454
|
// the 'tracesSampleRate' or 'tracesSampler' option.
|
|
424
455
|
}
|
|
425
456
|
|
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": "5.0.0-
|
|
5
|
+
"version": "5.0.0-beta.1",
|
|
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",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"build:tools": "tsc -p tsconfig.build.tools.json",
|
|
18
18
|
"clean": "rimraf dist coverage",
|
|
19
19
|
"test": "jest",
|
|
20
|
-
"lint": "eslint .",
|
|
20
|
+
"lint": "eslint --config .eslintrc.js .",
|
|
21
21
|
"test:watch": "jest --watch",
|
|
22
22
|
"run-ios": "cd sample && yarn react-native run-ios",
|
|
23
23
|
"run-android": "cd sample && yarn react-native run-android"
|
|
@@ -39,38 +39,38 @@
|
|
|
39
39
|
],
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": ">=17.0.0",
|
|
42
|
-
"react-native": ">=0.
|
|
42
|
+
"react-native": ">=0.65.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@sentry/browser": "7.
|
|
46
|
-
"@sentry/cli": "2.
|
|
47
|
-
"@sentry/core": "7.
|
|
48
|
-
"@sentry/hub": "7.
|
|
49
|
-
"@sentry/integrations": "7.
|
|
50
|
-
"@sentry/react": "7.
|
|
51
|
-
"@sentry/tracing": "7.
|
|
52
|
-
"@sentry/types": "7.
|
|
53
|
-
"@sentry/utils": "7.
|
|
45
|
+
"@sentry/browser": "7.32.1",
|
|
46
|
+
"@sentry/cli": "2.10.0",
|
|
47
|
+
"@sentry/core": "7.32.1",
|
|
48
|
+
"@sentry/hub": "7.32.1",
|
|
49
|
+
"@sentry/integrations": "7.32.1",
|
|
50
|
+
"@sentry/react": "7.32.1",
|
|
51
|
+
"@sentry/tracing": "7.32.1",
|
|
52
|
+
"@sentry/types": "7.32.1",
|
|
53
|
+
"@sentry/utils": "7.32.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@sentry-internal/eslint-config-sdk": "7.
|
|
57
|
-
"@sentry-internal/eslint-plugin-sdk": "7.
|
|
56
|
+
"@sentry-internal/eslint-config-sdk": "7.32.1",
|
|
57
|
+
"@sentry-internal/eslint-plugin-sdk": "7.32.1",
|
|
58
58
|
"@sentry/typescript": "^5.20.1",
|
|
59
59
|
"@sentry/wizard": "2.2.0",
|
|
60
|
-
"@types/jest": "^
|
|
60
|
+
"@types/jest": "^29.2.5",
|
|
61
61
|
"@types/react": "^18.0.25",
|
|
62
|
-
"
|
|
63
|
-
"babel-jest": "^26.1.0",
|
|
62
|
+
"babel-jest": "^29.3.1",
|
|
64
63
|
"eslint": "^7.6.0",
|
|
65
64
|
"eslint-plugin-react": "^7.20.6",
|
|
66
65
|
"eslint-plugin-react-native": "^3.8.1",
|
|
67
|
-
"jest": "^
|
|
66
|
+
"jest": "^29.3.1",
|
|
67
|
+
"jest-environment-jsdom": "^29.4.1",
|
|
68
68
|
"prettier": "^2.0.5",
|
|
69
|
-
"react": "
|
|
70
|
-
"react-native": "
|
|
69
|
+
"react": "18.2.0",
|
|
70
|
+
"react-native": "0.71.0",
|
|
71
71
|
"replace-in-file": "^6.0.0",
|
|
72
|
-
"rimraf": "^
|
|
73
|
-
"ts-jest": "^
|
|
72
|
+
"rimraf": "^4.1.1",
|
|
73
|
+
"ts-jest": "^29.0.5",
|
|
74
74
|
"typescript": "3.8.3"
|
|
75
75
|
},
|
|
76
76
|
"rnpm": {
|
|
@@ -97,7 +97,8 @@
|
|
|
97
97
|
"js"
|
|
98
98
|
],
|
|
99
99
|
"testPathIgnorePatterns": [
|
|
100
|
-
"<rootDir>/sample/"
|
|
100
|
+
"<rootDir>/sample/",
|
|
101
|
+
"<rootDir>/test/e2e/"
|
|
101
102
|
],
|
|
102
103
|
"testEnvironment": "node",
|
|
103
104
|
"testMatch": [
|
package/sentry.gradle
CHANGED
|
@@ -34,13 +34,16 @@ gradle.projectsEvaluated {
|
|
|
34
34
|
// separately we then hook into the bundle task of react native to inject
|
|
35
35
|
// sourcemap generation parameters. In case for whatever reason no release
|
|
36
36
|
// was found for the asset folder we just bail.
|
|
37
|
-
def bundleTasks = tasks.findAll { task -> task.name.startsWith("bundle") && task.name.endsWith("JsAndAssets") && !task.name.contains("Debug") && task.enabled }
|
|
37
|
+
def bundleTasks = tasks.findAll { task -> (task.name.startsWith("createBundle") || task.name.startsWith("bundle")) && task.name.endsWith("JsAndAssets") && !task.name.contains("Debug") && task.enabled }
|
|
38
38
|
bundleTasks.each { bundleTask ->
|
|
39
39
|
def shouldCleanUp
|
|
40
40
|
def sourcemapOutput
|
|
41
41
|
def bundleOutput
|
|
42
42
|
def props = bundleTask.getProperties()
|
|
43
43
|
def reactRoot = props.get("workingDir")
|
|
44
|
+
if (reactRoot == null) {
|
|
45
|
+
reactRoot = props.get("root").get() // RN 0.71 and above
|
|
46
|
+
}
|
|
44
47
|
def modulesOutput = "$reactRoot/android/app/src/main/assets/modules.json"
|
|
45
48
|
def modulesTask = null
|
|
46
49
|
|
|
@@ -194,19 +197,24 @@ gradle.projectsEvaluated {
|
|
|
194
197
|
}
|
|
195
198
|
previousCliTask = cliTask
|
|
196
199
|
cliTask.finalizedBy modulesTask
|
|
200
|
+
}
|
|
197
201
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
202
|
+
def modulesCleanUpTask = tasks.create(name: nameModulesCleanup, type: Delete) {
|
|
203
|
+
description = "clean up collected modules generated file"
|
|
204
|
+
group = 'sentry.io'
|
|
201
205
|
|
|
202
|
-
|
|
203
|
-
|
|
206
|
+
delete modulesOutput
|
|
207
|
+
}
|
|
204
208
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
209
|
+
def variantTaskName = variant.replaceAll("[\\s\\-()]", "") // variant is dev-release beta-release etc.
|
|
210
|
+
// task.name could be packageDev-debugRelease but in that case currentVariants == null
|
|
211
|
+
// because of the regex in `extractCurrentVariants` and this code doesn't run
|
|
212
|
+
def packageTasks = tasks.findAll {
|
|
213
|
+
task -> "package${variantTaskName}".equalsIgnoreCase(task.name) && task.enabled
|
|
214
|
+
}
|
|
215
|
+
packageTasks.each { packageTask ->
|
|
216
|
+
packageTask.dependsOn modulesTask
|
|
217
|
+
packageTask.finalizedBy modulesCleanUpTask
|
|
210
218
|
}
|
|
211
219
|
|
|
212
220
|
/** Delete sourcemap files */
|
|
@@ -251,7 +259,7 @@ def extractReleasesInfo() {
|
|
|
251
259
|
}
|
|
252
260
|
|
|
253
261
|
/** Extract from arguments collection bundle and sourcemap files output names. */
|
|
254
|
-
static
|
|
262
|
+
static extractBundleTaskArgumentsLegacy(cmdArgs, Project project) {
|
|
255
263
|
def bundleOutput = null
|
|
256
264
|
def sourcemapOutput = null
|
|
257
265
|
|
|
@@ -295,6 +303,26 @@ static extractBundleTaskArguments(cmdArgs, Project project) {
|
|
|
295
303
|
return [bundleOutput, sourcemapOutput]
|
|
296
304
|
}
|
|
297
305
|
|
|
306
|
+
/** Extract bundle and sourcemap paths from bundle task props.
|
|
307
|
+
* Based on https://github.dev/facebook/react-native/blob/473eb1dd870a4f62c4ebcba27e12bde1e99e3d07/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleHermesCTask.kt#L109
|
|
308
|
+
* Output source map path is the same for both Hermes and JSC.
|
|
309
|
+
*/
|
|
310
|
+
static extractBundleTaskArgumentsRN71AndAbove(bundleTask, logger) {
|
|
311
|
+
def props = bundleTask.getProperties()
|
|
312
|
+
def bundleAssetName = props.bundleAssetName?.get()
|
|
313
|
+
|
|
314
|
+
if (bundleAssetName == null) {
|
|
315
|
+
return [null, null]
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
def bundleFile = new File(props.jsBundleDir.get().asFile.absolutePath, bundleAssetName)
|
|
319
|
+
def outputSourceMap = new File(props.jsSourceMapsDir.get().asFile.absolutePath, "${bundleAssetName}.map")
|
|
320
|
+
|
|
321
|
+
logger.info("bundleFile: `${bundleFile}`")
|
|
322
|
+
logger.info("outputSourceMap: `${outputSourceMap}`")
|
|
323
|
+
return [bundleFile, outputSourceMap]
|
|
324
|
+
}
|
|
325
|
+
|
|
298
326
|
/** Force Bundle task to produce sourcemap files if they are not pre-configured by user yet. */
|
|
299
327
|
def forceSourceMapOutputFromBundleTask(bundleTask) {
|
|
300
328
|
def props = bundleTask.getProperties()
|
|
@@ -304,7 +332,10 @@ def forceSourceMapOutputFromBundleTask(bundleTask) {
|
|
|
304
332
|
def bundleOutput = null
|
|
305
333
|
def sourcemapOutput = null
|
|
306
334
|
|
|
307
|
-
(bundleOutput, sourcemapOutput) =
|
|
335
|
+
(bundleOutput, sourcemapOutput) = extractBundleTaskArgumentsRN71AndAbove(bundleTask, logger)
|
|
336
|
+
if (bundleOutput == null) {
|
|
337
|
+
(bundleOutput, sourcemapOutput) = extractBundleTaskArgumentsLegacy(cmdArgs, project)
|
|
338
|
+
}
|
|
308
339
|
|
|
309
340
|
if (sourcemapOutput == null) {
|
|
310
341
|
sourcemapOutput = bundleOutput + ".map"
|
|
@@ -327,8 +358,8 @@ def forceSourceMapOutputFromBundleTask(bundleTask) {
|
|
|
327
358
|
|
|
328
359
|
/** compose array with one item - current build flavor name */
|
|
329
360
|
static extractCurrentVariants(bundleTask, releases) {
|
|
330
|
-
// examples: bundleLocalReleaseJsAndAssets,
|
|
331
|
-
def pattern = Pattern.compile("
|
|
361
|
+
// examples: bundleLocalReleaseJsAndAssets, createBundleYellowDebugJsAndAssets
|
|
362
|
+
def pattern = Pattern.compile("(?:create)?(?:B|b)undle([A-Z][A-Za-z0-9_]+)JsAndAssets")
|
|
332
363
|
|
|
333
364
|
def currentRelease = ""
|
|
334
365
|
|
package/src/js/NativeRNSentry.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Package } from '@sentry/types';
|
|
2
|
-
import { TurboModule
|
|
1
|
+
import type { Package } from '@sentry/types';
|
|
2
|
+
import type { TurboModule} from 'react-native';
|
|
3
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
4
|
import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
5
|
|
|
5
6
|
// There has to be only one interface and it has to be named `Spec`
|
|
@@ -12,6 +13,7 @@ export interface Spec extends TurboModule {
|
|
|
12
13
|
store: boolean,
|
|
13
14
|
},
|
|
14
15
|
): Promise<boolean>;
|
|
16
|
+
captureScreenshot(): Promise<NativeScreenshot[]>;
|
|
15
17
|
clearBreadcrumbs(): void;
|
|
16
18
|
crash(): void;
|
|
17
19
|
closeNativeSdk(): Promise<void>;
|
|
@@ -51,9 +53,42 @@ export type NativeReleaseResponse = {
|
|
|
51
53
|
version: string;
|
|
52
54
|
};
|
|
53
55
|
|
|
56
|
+
/**
|
|
57
|
+
* This type describes serialized scope from sentry-cocoa. (This is not used for Android)
|
|
58
|
+
* https://github.com/getsentry/sentry-cocoa/blob/master/Sources/Sentry/SentryScope.m
|
|
59
|
+
*/
|
|
54
60
|
export type NativeDeviceContextsResponse = {
|
|
55
|
-
[key: string]:
|
|
61
|
+
[key: string]: unknown;
|
|
62
|
+
tags?: Record<string, string>;
|
|
63
|
+
extra?: Record<string, unknown>;
|
|
64
|
+
context?: Record<string, Record<string, unknown>>;
|
|
65
|
+
user?: {
|
|
66
|
+
userId?: string;
|
|
67
|
+
email?: string;
|
|
68
|
+
username?: string;
|
|
69
|
+
ipAddress?: string;
|
|
70
|
+
segment?: string;
|
|
71
|
+
data?: Record<string, unknown>;
|
|
72
|
+
};
|
|
73
|
+
dist?: string;
|
|
74
|
+
environment?: string;
|
|
75
|
+
fingerprint?: string[];
|
|
76
|
+
level?: string;
|
|
77
|
+
breadcrumbs?: {
|
|
78
|
+
level?: string;
|
|
79
|
+
timestamp?: string;
|
|
80
|
+
category?: string;
|
|
81
|
+
type?: string;
|
|
82
|
+
message?: string;
|
|
83
|
+
data?: Record<string, unknown>;
|
|
84
|
+
}[];
|
|
56
85
|
};
|
|
57
86
|
|
|
87
|
+
export type NativeScreenshot = {
|
|
88
|
+
data: number[];
|
|
89
|
+
contentType: string;
|
|
90
|
+
filename: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
58
93
|
// The export must be here to pass codegen even if not used
|
|
59
94
|
export default TurboModuleRegistry.getEnforcing<Spec>('RNSentry');
|