@sentry/react-native 6.1.0 → 6.3.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/README.md +5 -9
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryBreadcrumb.java +6 -0
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +183 -127
- package/android/src/main/java/io/sentry/react/RNSentryTimeToDisplay.java +42 -0
- 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 +1 -0
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +7 -2
- package/dist/js/client.js.map +1 -1
- package/dist/js/index.d.ts +2 -2
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +1 -1
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js +4 -37
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/debugsymbolicatorutils.d.ts +6 -2
- package/dist/js/integrations/debugsymbolicatorutils.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicatorutils.js +44 -27
- package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -1
- package/dist/js/integrations/default.d.ts.map +1 -1
- package/dist/js/integrations/default.js +11 -7
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/integrations/devicecontext.d.ts.map +1 -1
- package/dist/js/integrations/devicecontext.js +7 -3
- package/dist/js/integrations/devicecontext.js.map +1 -1
- package/dist/js/integrations/spotlight.d.ts +4 -0
- package/dist/js/integrations/spotlight.d.ts.map +1 -1
- package/dist/js/integrations/spotlight.js +4 -1
- package/dist/js/integrations/spotlight.js.map +1 -1
- package/dist/js/sdk.d.ts.map +1 -1
- package/dist/js/sdk.js +40 -2
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tools/metroMiddleware.d.ts +15 -0
- package/dist/js/tools/metroMiddleware.d.ts.map +1 -0
- package/dist/js/tools/metroMiddleware.js +105 -0
- package/dist/js/tools/metroMiddleware.js.map +1 -0
- package/dist/js/tools/metroconfig.d.ts +7 -1
- package/dist/js/tools/metroconfig.d.ts.map +1 -1
- package/dist/js/tools/metroconfig.js +9 -1
- package/dist/js/tools/metroconfig.js.map +1 -1
- package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
- package/dist/js/tracing/reactnativetracing.js +17 -1
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/tracing/reactnavigation.js +7 -7
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/utils/ignorerequirecyclelogs.d.ts +6 -1
- package/dist/js/utils/ignorerequirecyclelogs.d.ts.map +1 -1
- package/dist/js/utils/ignorerequirecyclelogs.js +6 -2
- package/dist/js/utils/ignorerequirecyclelogs.js.map +1 -1
- package/dist/js/utils/sentryeventemitterfallback.d.ts +19 -0
- package/dist/js/utils/sentryeventemitterfallback.d.ts.map +1 -0
- package/dist/js/utils/sentryeventemitterfallback.js +78 -0
- package/dist/js/utils/sentryeventemitterfallback.js.map +1 -0
- package/dist/js/vendor/react-native/index.d.ts +1 -1
- package/dist/js/vendor/react-native/index.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 +4 -0
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +6 -0
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.h +8 -12
- package/ios/RNSentry.mm +417 -303
- package/ios/RNSentryBreadcrumb.h +2 -2
- package/ios/RNSentryBreadcrumb.m +13 -6
- package/ios/RNSentryDependencyContainer.h +2 -2
- package/ios/RNSentryDependencyContainer.m +7 -6
- package/ios/RNSentryFramesTrackerListener.h +6 -6
- package/ios/RNSentryFramesTrackerListener.m +10 -8
- package/ios/RNSentryId.m +2 -1
- package/ios/RNSentryOnDrawReporter.h +5 -5
- package/ios/RNSentryOnDrawReporter.m +26 -24
- package/ios/RNSentryRNSScreen.h +1 -1
- package/ios/RNSentryRNSScreen.m +18 -18
- package/ios/RNSentryReplay.m +42 -53
- package/ios/RNSentryReplayBreadcrumbConverter.h +3 -4
- package/ios/RNSentryReplayBreadcrumbConverter.m +139 -132
- package/ios/RNSentryTimeToDisplay.h +7 -0
- package/ios/RNSentryTimeToDisplay.m +44 -0
- package/package.json +17 -16
- package/scripts/expo-upload-sourcemaps.js +16 -0
- package/scripts/sentry-xcode-debug-files.sh +6 -0
- package/scripts/sentry-xcode.sh +4 -0
- package/sentry.gradle +13 -2
- package/src/js/NativeRNSentry.ts +1 -0
- package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -0
- package/ts3.8/dist/js/index.d.ts +2 -2
- package/ts3.8/dist/js/integrations/debugsymbolicatorutils.d.ts +6 -2
- package/ts3.8/dist/js/integrations/spotlight.d.ts +4 -0
- package/ts3.8/dist/js/utils/ignorerequirecyclelogs.d.ts +6 -1
- package/ts3.8/dist/js/utils/sentryeventemitterfallback.d.ts +19 -0
- package/ts3.8/dist/js/vendor/react-native/index.d.ts +1 -1
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/ts3.8/dist/js/wrapper.d.ts +4 -0
|
@@ -5,162 +5,169 @@
|
|
|
5
5
|
#if SENTRY_TARGET_REPLAY_SUPPORTED
|
|
6
6
|
|
|
7
7
|
@implementation RNSentryReplayBreadcrumbConverter {
|
|
8
|
-
|
|
8
|
+
SentrySRDefaultBreadcrumbConverter *defaultConverter;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
- (instancetype _Nonnull)init
|
|
12
|
-
|
|
13
|
-
self
|
|
14
|
-
[SentrySessionReplayIntegration createDefaultBreadcrumbConverter];
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
- (instancetype _Nonnull)init
|
|
12
|
+
{
|
|
13
|
+
if (self = [super init]) {
|
|
14
|
+
self->defaultConverter = [SentrySessionReplayIntegration createDefaultBreadcrumbConverter];
|
|
15
|
+
}
|
|
16
|
+
return self;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
- (id<SentryRRWebEvent> _Nullable)convertFrom:
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
- (id<SentryRRWebEvent> _Nullable)convertFrom:(SentryBreadcrumb *_Nonnull)breadcrumb
|
|
20
|
+
{
|
|
21
|
+
assert(breadcrumb.timestamp != nil);
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
if ([breadcrumb.category isEqualToString:@"sentry.event"] ||
|
|
24
|
+
[breadcrumb.category isEqualToString:@"sentry.transaction"]) {
|
|
25
|
+
// Do not add Sentry Event breadcrumbs to replay
|
|
26
|
+
return nil;
|
|
27
|
+
}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
if ([breadcrumb.category isEqualToString:@"http"]) {
|
|
30
|
+
// Drop native network breadcrumbs to avoid duplicates
|
|
31
|
+
return nil;
|
|
32
|
+
}
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
if ([breadcrumb.category isEqualToString:@"touch"]) {
|
|
35
|
+
return [self convertTouch:breadcrumb];
|
|
36
|
+
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if ([breadcrumb.category isEqualToString:@"xhr"]) {
|
|
48
|
-
return [self convertNavigation:breadcrumb];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
SentryRRWebEvent *nativeBreadcrumb =
|
|
52
|
-
[self->defaultConverter convertFrom:breadcrumb];
|
|
53
|
-
|
|
54
|
-
// ignore native navigation breadcrumbs
|
|
55
|
-
if (nativeBreadcrumb && nativeBreadcrumb.data &&
|
|
56
|
-
nativeBreadcrumb.data[@"payload"] &&
|
|
57
|
-
nativeBreadcrumb.data[@"payload"][@"category"] &&
|
|
58
|
-
[nativeBreadcrumb.data[@"payload"][@"category"]
|
|
59
|
-
isEqualToString:@"navigation"]) {
|
|
60
|
-
return nil;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return nativeBreadcrumb;
|
|
64
|
-
}
|
|
38
|
+
if ([breadcrumb.category isEqualToString:@"navigation"]) {
|
|
39
|
+
return [SentrySessionReplayIntegration createBreadcrumbwithTimestamp:breadcrumb.timestamp
|
|
40
|
+
category:breadcrumb.category
|
|
41
|
+
message:nil
|
|
42
|
+
level:breadcrumb.level
|
|
43
|
+
data:breadcrumb.data];
|
|
44
|
+
}
|
|
65
45
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
46
|
+
if ([breadcrumb.category isEqualToString:@"xhr"]) {
|
|
47
|
+
return [self convertNavigation:breadcrumb];
|
|
48
|
+
}
|
|
70
49
|
|
|
71
|
-
|
|
72
|
-
NSString* message = [RNSentryReplayBreadcrumbConverter getTouchPathMessageFrom:path];
|
|
50
|
+
SentryRRWebEvent *nativeBreadcrumb = [self->defaultConverter convertFrom:breadcrumb];
|
|
73
51
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
52
|
+
// ignore native navigation breadcrumbs
|
|
53
|
+
if (nativeBreadcrumb && nativeBreadcrumb.data && nativeBreadcrumb.data[@"payload"]
|
|
54
|
+
&& nativeBreadcrumb.data[@"payload"][@"category"] &&
|
|
55
|
+
[nativeBreadcrumb.data[@"payload"][@"category"] isEqualToString:@"navigation"]) {
|
|
56
|
+
return nil;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return nativeBreadcrumb;
|
|
80
60
|
}
|
|
81
61
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
62
|
+
- (id<SentryRRWebEvent> _Nullable)convertTouch:(SentryBreadcrumb *_Nonnull)breadcrumb
|
|
63
|
+
{
|
|
64
|
+
if (breadcrumb.data == nil) {
|
|
65
|
+
return nil;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
NSMutableArray *path = [breadcrumb.data valueForKey:@"path"];
|
|
69
|
+
NSString *message = [RNSentryReplayBreadcrumbConverter getTouchPathMessageFrom:path];
|
|
86
70
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
71
|
+
return [SentrySessionReplayIntegration createBreadcrumbwithTimestamp:breadcrumb.timestamp
|
|
72
|
+
category:@"ui.tap"
|
|
73
|
+
message:message
|
|
74
|
+
level:breadcrumb.level
|
|
75
|
+
data:breadcrumb.data];
|
|
76
|
+
}
|
|
91
77
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return nil; // There should be no nil (undefined) from JS, but to be safe we check it here
|
|
78
|
+
+ (NSString *_Nullable)getTouchPathMessageFrom:(NSArray *_Nullable)path
|
|
79
|
+
{
|
|
80
|
+
if (path == nil) {
|
|
81
|
+
return nil;
|
|
97
82
|
}
|
|
98
83
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
BOOL hasLabel = [label isKindOfClass:[NSString class]];
|
|
103
|
-
if (!hasName && !hasLabel) {
|
|
104
|
-
return nil; // This again should never be allowed in JS, but to be safe we check it here
|
|
105
|
-
}
|
|
106
|
-
if (hasLabel) {
|
|
107
|
-
[message appendString:(NSString *)label];
|
|
108
|
-
} else if (hasName) {
|
|
109
|
-
[message appendString:(NSString *)name];
|
|
84
|
+
NSInteger pathCount = [path count];
|
|
85
|
+
if (pathCount <= 0) {
|
|
86
|
+
return nil;
|
|
110
87
|
}
|
|
111
88
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
89
|
+
NSMutableString *message = [[NSMutableString alloc] init];
|
|
90
|
+
for (NSInteger i = MIN(3, pathCount - 1); i >= 0; i--) {
|
|
91
|
+
NSDictionary *item = [path objectAtIndex:i];
|
|
92
|
+
if (item == nil) {
|
|
93
|
+
return nil; // There should be no nil (undefined) from JS, but to be safe we check it
|
|
94
|
+
// here
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
id name = [item objectForKey:@"name"];
|
|
98
|
+
id label = [item objectForKey:@"label"];
|
|
99
|
+
BOOL hasName = [name isKindOfClass:[NSString class]];
|
|
100
|
+
BOOL hasLabel = [label isKindOfClass:[NSString class]];
|
|
101
|
+
if (!hasName && !hasLabel) {
|
|
102
|
+
return nil; // This again should never be allowed in JS, but to be safe we check it here
|
|
103
|
+
}
|
|
104
|
+
if (hasLabel) {
|
|
105
|
+
[message appendString:(NSString *)label];
|
|
106
|
+
} else if (hasName) {
|
|
107
|
+
[message appendString:(NSString *)name];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
id element = [item objectForKey:@"element"];
|
|
111
|
+
id file = [item objectForKey:@"file"];
|
|
112
|
+
BOOL hasElement = [element isKindOfClass:[NSString class]];
|
|
113
|
+
BOOL hasFile = [file isKindOfClass:[NSString class]];
|
|
114
|
+
if (hasElement && hasFile) {
|
|
115
|
+
[message appendFormat:@"(%@, %@)", (NSString *)element, (NSString *)file];
|
|
116
|
+
} else if (hasElement) {
|
|
117
|
+
[message appendFormat:@"(%@)", (NSString *)element];
|
|
118
|
+
} else if (hasFile) {
|
|
119
|
+
[message appendFormat:@"(%@)", (NSString *)file];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (i > 0) {
|
|
123
|
+
[message appendString:@" > "];
|
|
124
|
+
}
|
|
122
125
|
}
|
|
123
126
|
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
return message;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
- (id<SentryRRWebEvent> _Nullable)convertNavigation:(SentryBreadcrumb *_Nonnull)breadcrumb
|
|
131
|
+
{
|
|
132
|
+
NSNumber *startTimestamp = [breadcrumb.data[@"start_timestamp"] isKindOfClass:[NSNumber class]]
|
|
133
|
+
? breadcrumb.data[@"start_timestamp"]
|
|
134
|
+
: nil;
|
|
135
|
+
NSNumber *endTimestamp = [breadcrumb.data[@"end_timestamp"] isKindOfClass:[NSNumber class]]
|
|
136
|
+
? breadcrumb.data[@"end_timestamp"]
|
|
137
|
+
: nil;
|
|
138
|
+
NSString *url =
|
|
139
|
+
[breadcrumb.data[@"url"] isKindOfClass:[NSString class]] ? breadcrumb.data[@"url"] : nil;
|
|
140
|
+
|
|
141
|
+
if (startTimestamp == nil || endTimestamp == nil || url == nil) {
|
|
142
|
+
return nil;
|
|
126
143
|
}
|
|
127
|
-
}
|
|
128
144
|
|
|
129
|
-
|
|
130
|
-
|
|
145
|
+
NSMutableDictionary *data = [[NSMutableDictionary alloc] init];
|
|
146
|
+
if ([breadcrumb.data[@"method"] isKindOfClass:[NSString class]]) {
|
|
147
|
+
data[@"method"] = breadcrumb.data[@"method"];
|
|
148
|
+
}
|
|
149
|
+
if ([breadcrumb.data[@"status_code"] isKindOfClass:[NSNumber class]]) {
|
|
150
|
+
data[@"statusCode"] = breadcrumb.data[@"status_code"];
|
|
151
|
+
}
|
|
152
|
+
if ([breadcrumb.data[@"request_body_size"] isKindOfClass:[NSNumber class]]) {
|
|
153
|
+
data[@"requestBodySize"] = breadcrumb.data[@"request_body_size"];
|
|
154
|
+
}
|
|
155
|
+
if ([breadcrumb.data[@"response_body_size"] isKindOfClass:[NSNumber class]]) {
|
|
156
|
+
data[@"responseBodySize"] = breadcrumb.data[@"response_body_size"];
|
|
157
|
+
}
|
|
131
158
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
NSMutableDictionary* data = [[NSMutableDictionary alloc] init];
|
|
145
|
-
if ([breadcrumb.data[@"method"] isKindOfClass:[NSString class]]) {
|
|
146
|
-
data[@"method"] = breadcrumb.data[@"method"];
|
|
147
|
-
}
|
|
148
|
-
if ([breadcrumb.data[@"status_code"] isKindOfClass:[NSNumber class]]) {
|
|
149
|
-
data[@"statusCode"] = breadcrumb.data[@"status_code"];
|
|
150
|
-
}
|
|
151
|
-
if ([breadcrumb.data[@"request_body_size"] isKindOfClass:[NSNumber class]]) {
|
|
152
|
-
data[@"requestBodySize"] = breadcrumb.data[@"request_body_size"];
|
|
153
|
-
}
|
|
154
|
-
if ([breadcrumb.data[@"response_body_size"] isKindOfClass:[NSNumber class]]) {
|
|
155
|
-
data[@"responseBodySize"] = breadcrumb.data[@"response_body_size"];
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return [SentrySessionReplayIntegration
|
|
159
|
-
createNetworkBreadcrumbWithTimestamp:[NSDate dateWithTimeIntervalSince1970:(startTimestamp.doubleValue / 1000)]
|
|
160
|
-
endTimestamp:[NSDate dateWithTimeIntervalSince1970:(endTimestamp.doubleValue / 1000)]
|
|
161
|
-
operation:@"resource.http"
|
|
162
|
-
description:url
|
|
163
|
-
data:data];
|
|
159
|
+
return [SentrySessionReplayIntegration
|
|
160
|
+
createNetworkBreadcrumbWithTimestamp:[NSDate
|
|
161
|
+
dateWithTimeIntervalSince1970:(startTimestamp
|
|
162
|
+
.doubleValue
|
|
163
|
+
/ 1000)]
|
|
164
|
+
endTimestamp:[NSDate
|
|
165
|
+
dateWithTimeIntervalSince1970:(endTimestamp
|
|
166
|
+
.doubleValue
|
|
167
|
+
/ 1000)]
|
|
168
|
+
operation:@"resource.http"
|
|
169
|
+
description:url
|
|
170
|
+
data:data];
|
|
164
171
|
}
|
|
165
172
|
|
|
166
173
|
@end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#import "RNSentryTimeToDisplay.h"
|
|
2
|
+
#import <QuartzCore/QuartzCore.h>
|
|
3
|
+
#import <React/RCTLog.h>
|
|
4
|
+
|
|
5
|
+
@implementation RNSentryTimeToDisplay {
|
|
6
|
+
CADisplayLink *displayLink;
|
|
7
|
+
RCTResponseSenderBlock resolveBlock;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Rename requestAnimationFrame to getTimeToDisplay
|
|
11
|
+
- (void)getTimeToDisplay:(RCTResponseSenderBlock)callback
|
|
12
|
+
{
|
|
13
|
+
// Store the resolve block to use in the callback.
|
|
14
|
+
resolveBlock = callback;
|
|
15
|
+
|
|
16
|
+
#if TARGET_OS_IOS
|
|
17
|
+
// Create and add a display link to get the callback after the screen is rendered.
|
|
18
|
+
displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(handleDisplayLink:)];
|
|
19
|
+
[displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
|
|
20
|
+
#else
|
|
21
|
+
resolveBlock(@[]); // Return nothing if not iOS.
|
|
22
|
+
#endif
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#if TARGET_OS_IOS
|
|
26
|
+
- (void)handleDisplayLink:(CADisplayLink *)link
|
|
27
|
+
{
|
|
28
|
+
// Get the current time
|
|
29
|
+
NSTimeInterval currentTime =
|
|
30
|
+
[[NSDate date] timeIntervalSince1970] * 1000.0; // Convert to milliseconds
|
|
31
|
+
|
|
32
|
+
// Ensure the callback is valid and pass the current time back
|
|
33
|
+
if (resolveBlock) {
|
|
34
|
+
resolveBlock(@[ @(currentTime) ]); // Call the callback with the current time
|
|
35
|
+
resolveBlock = nil; // Clear the block after it's called
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Invalidate the display link to stop future callbacks
|
|
39
|
+
[displayLink invalidate];
|
|
40
|
+
displayLink = nil;
|
|
41
|
+
}
|
|
42
|
+
#endif
|
|
43
|
+
|
|
44
|
+
@end
|
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.3.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",
|
|
@@ -66,22 +66,23 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@sentry/babel-plugin-component-annotate": "2.20.1",
|
|
69
|
-
"@sentry/browser": "8.
|
|
70
|
-
"@sentry/cli": "2.
|
|
71
|
-
"@sentry/core": "8.
|
|
72
|
-
"@sentry/react": "8.
|
|
73
|
-
"@sentry/types": "8.
|
|
74
|
-
"@sentry/utils": "8.
|
|
69
|
+
"@sentry/browser": "8.38.0",
|
|
70
|
+
"@sentry/cli": "2.38.2",
|
|
71
|
+
"@sentry/core": "8.38.0",
|
|
72
|
+
"@sentry/react": "8.38.0",
|
|
73
|
+
"@sentry/types": "8.38.0",
|
|
74
|
+
"@sentry/utils": "8.38.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@babel/core": "^7.23.5",
|
|
78
78
|
"@expo/metro-config": "0.17.5",
|
|
79
79
|
"@mswjs/interceptors": "^0.25.15",
|
|
80
|
-
"@
|
|
81
|
-
"@sentry-internal/eslint-
|
|
82
|
-
"@sentry-internal/
|
|
83
|
-
"@sentry/
|
|
84
|
-
"@
|
|
80
|
+
"@react-native/babel-preset": "0.75.4",
|
|
81
|
+
"@sentry-internal/eslint-config-sdk": "8.38.0",
|
|
82
|
+
"@sentry-internal/eslint-plugin-sdk": "8.38.0",
|
|
83
|
+
"@sentry-internal/typescript": "8.38.0",
|
|
84
|
+
"@sentry/wizard": "3.34.4",
|
|
85
|
+
"@testing-library/react-native": "^12.7.2",
|
|
85
86
|
"@types/jest": "^29.5.3",
|
|
86
87
|
"@types/node": "^20.9.3",
|
|
87
88
|
"@types/react": "^18.2.64",
|
|
@@ -97,7 +98,7 @@
|
|
|
97
98
|
"eslint": "^7.6.0",
|
|
98
99
|
"eslint-plugin-react": "^7.20.6",
|
|
99
100
|
"eslint-plugin-react-native": "^3.8.1",
|
|
100
|
-
"expo": "^
|
|
101
|
+
"expo": "^52.0.0",
|
|
101
102
|
"expo-module-scripts": "3.1.0",
|
|
102
103
|
"jest": "^29.6.2",
|
|
103
104
|
"jest-environment-jsdom": "^29.6.2",
|
|
@@ -105,9 +106,9 @@
|
|
|
105
106
|
"madge": "^6.1.0",
|
|
106
107
|
"metro": "0.80.10",
|
|
107
108
|
"prettier": "^2.0.5",
|
|
108
|
-
"react": "18.
|
|
109
|
-
"react-native": "0.
|
|
110
|
-
"react-test-renderer": "^18.
|
|
109
|
+
"react": "18.3.1",
|
|
110
|
+
"react-native": "0.75.4",
|
|
111
|
+
"react-test-renderer": "^18.3.1",
|
|
111
112
|
"rimraf": "^4.1.1",
|
|
112
113
|
"ts-jest": "^29.1.1",
|
|
113
114
|
"typescript": "4.9.5",
|
|
@@ -102,6 +102,20 @@ function groupAssets(assetPaths) {
|
|
|
102
102
|
return groups;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
function loadDotenv(dotenvPath) {
|
|
106
|
+
try {
|
|
107
|
+
const dotenvFile = fs.readFileSync(dotenvPath, 'utf-8');
|
|
108
|
+
// NOTE: Do not use the dotenv.config API directly to read the dotenv file! For some ungodly reason, it falls back to reading `${process.cwd()}/.env` which is absolutely not what we want.
|
|
109
|
+
// dotenv is dependency of @expo/env, so we can just require it here
|
|
110
|
+
const dotenvResult = require('dotenv').parse(dotenvFile);
|
|
111
|
+
|
|
112
|
+
Object.assign(process.env, dotenvResult);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
console.warn('⚠️ Failed to load environment variables using dotenv.');
|
|
115
|
+
console.warn(error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
105
119
|
process.env.NODE_ENV = process.env.NODE_ENV || 'development'; // Ensures precedence .env.development > .env (the same as @expo/cli)
|
|
106
120
|
const projectRoot = '.'; // Assume script is run from the project root
|
|
107
121
|
try {
|
|
@@ -111,6 +125,8 @@ try {
|
|
|
111
125
|
console.warn(error);
|
|
112
126
|
}
|
|
113
127
|
|
|
128
|
+
loadDotenv(path.join(projectRoot, '.env.sentry-build-plugin'));
|
|
129
|
+
|
|
114
130
|
let sentryOrg = getEnvVar(SENTRY_ORG);
|
|
115
131
|
let sentryUrl = getEnvVar(SENTRY_URL);
|
|
116
132
|
let sentryProject = getEnvVar(SENTRY_PROJECT);
|
|
@@ -17,7 +17,11 @@ set -e
|
|
|
17
17
|
|
|
18
18
|
LOCAL_NODE_BINARY=${NODE_BINARY:-node}
|
|
19
19
|
|
|
20
|
+
# The project root by default is one level up from the ios directory
|
|
21
|
+
RN_PROJECT_ROOT="${PROJECT_DIR}/.."
|
|
22
|
+
|
|
20
23
|
[ -z "$SENTRY_PROPERTIES" ] && export SENTRY_PROPERTIES=sentry.properties
|
|
24
|
+
[ -z "$SENTRY_DOTENV_PATH" ] && export SENTRY_DOTENV_PATH="$RN_PROJECT_ROOT/.env.sentry-build-plugin"
|
|
21
25
|
|
|
22
26
|
[ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_PACKAGE_PATH=$("$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))")
|
|
23
27
|
[ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_EXECUTABLE="${SENTRY_CLI_PACKAGE_PATH}/bin/sentry-cli"
|
|
@@ -35,6 +39,8 @@ XCODE_BUILD_CONFIGURATION="${CONFIGURATION}"
|
|
|
35
39
|
|
|
36
40
|
if [ "$SENTRY_DISABLE_AUTO_UPLOAD" == true ]; then
|
|
37
41
|
echo "SENTRY_DISABLE_AUTO_UPLOAD=true, skipping debug files upload"
|
|
42
|
+
elif [ "$SENTRY_DISABLE_XCODE_DEBUG_UPLOAD" == true ]; then
|
|
43
|
+
echo "SENTRY_DISABLE_XCODE_DEBUG_UPLOAD=true, skipping native debug files upload"
|
|
38
44
|
elif echo "$XCODE_BUILD_CONFIGURATION" | grep -iq "debug"; then # case insensitive check for "debug"
|
|
39
45
|
echo "Skipping debug files upload for *Debug* configuration"
|
|
40
46
|
else
|
package/scripts/sentry-xcode.sh
CHANGED
|
@@ -9,7 +9,11 @@ set -x -e
|
|
|
9
9
|
|
|
10
10
|
LOCAL_NODE_BINARY=${NODE_BINARY:-node}
|
|
11
11
|
|
|
12
|
+
# The project root by default is one level up from the ios directory
|
|
13
|
+
RN_PROJECT_ROOT="${PROJECT_DIR}/.."
|
|
14
|
+
|
|
12
15
|
[ -z "$SENTRY_PROPERTIES" ] && export SENTRY_PROPERTIES=sentry.properties
|
|
16
|
+
[ -z "$SENTRY_DOTENV_PATH" ] && export SENTRY_DOTENV_PATH="$RN_PROJECT_ROOT/.env.sentry-build-plugin"
|
|
13
17
|
[ -z "$SOURCEMAP_FILE" ] && export SOURCEMAP_FILE="$DERIVED_FILE_DIR/main.jsbundle.map"
|
|
14
18
|
|
|
15
19
|
[ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_PACKAGE_PATH=$("$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))")
|
package/sentry.gradle
CHANGED
|
@@ -3,10 +3,18 @@ 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.
|
|
6
|
+
project.ext.shouldSentryAutoUploadNative = { ->
|
|
7
|
+
return System.getenv('SENTRY_DISABLE_NATIVE_DEBUG_UPLOAD') != 'true'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
project.ext.shouldSentryAutoUploadGeneral = { ->
|
|
7
11
|
return System.getenv('SENTRY_DISABLE_AUTO_UPLOAD') != 'true'
|
|
8
12
|
}
|
|
9
13
|
|
|
14
|
+
project.ext.shouldSentryAutoUpload = { ->
|
|
15
|
+
return shouldSentryAutoUploadGeneral() && shouldSentryAutoUploadNative()
|
|
16
|
+
}
|
|
17
|
+
|
|
10
18
|
def config = project.hasProperty("sentryCli") ? project.sentryCli : [];
|
|
11
19
|
|
|
12
20
|
gradle.projectsEvaluated {
|
|
@@ -98,7 +106,7 @@ gradle.projectsEvaluated {
|
|
|
98
106
|
|
|
99
107
|
/** Upload source map file to the sentry server via CLI call. */
|
|
100
108
|
def cliTask = tasks.create(nameCliTask) {
|
|
101
|
-
onlyIf {
|
|
109
|
+
onlyIf { shouldSentryAutoUploadGeneral() }
|
|
102
110
|
description = "upload debug symbols to sentry"
|
|
103
111
|
group = 'sentry.io'
|
|
104
112
|
|
|
@@ -195,6 +203,9 @@ gradle.projectsEvaluated {
|
|
|
195
203
|
|
|
196
204
|
project.logger.lifecycle("Sentry-CLI arguments: ${args}")
|
|
197
205
|
def osCompatibility = Os.isFamily(Os.FAMILY_WINDOWS) ? ['cmd', '/c', 'node'] : []
|
|
206
|
+
if (!System.getenv('SENTRY_DOTENV_PATH')) {
|
|
207
|
+
environment('SENTRY_DOTENV_PATH', "$reactRoot/.env.sentry-build-plugin")
|
|
208
|
+
}
|
|
198
209
|
commandLine(*osCompatibility, *args)
|
|
199
210
|
}
|
|
200
211
|
}
|
package/src/js/NativeRNSentry.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type { UnsafeObject } from './utils/rnlibrariesinterface';
|
|
|
9
9
|
export interface Spec extends TurboModule {
|
|
10
10
|
addListener: (eventType: string) => void;
|
|
11
11
|
removeListeners: (id: number) => void;
|
|
12
|
+
getNewScreenTimeToDisplay(): Promise<number | undefined | null>;
|
|
12
13
|
addBreadcrumb(breadcrumb: UnsafeObject): void;
|
|
13
14
|
captureEnvelope(
|
|
14
15
|
bytes: string,
|
|
@@ -4,6 +4,7 @@ import type { UnsafeObject } from './utils/rnlibrariesinterface';
|
|
|
4
4
|
export interface Spec extends TurboModule {
|
|
5
5
|
addListener: (eventType: string) => void;
|
|
6
6
|
removeListeners: (id: number) => void;
|
|
7
|
+
getNewScreenTimeToDisplay(): Promise<number | undefined | null>;
|
|
7
8
|
addBreadcrumb(breadcrumb: UnsafeObject): void;
|
|
8
9
|
captureEnvelope(bytes: string, options: {
|
|
9
10
|
hardCrashed: boolean;
|
package/ts3.8/dist/js/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { Breadcrumb, Request, SdkInfo, Event, Exception, StackFrame, Stacktrace, Thread, User, UserFeedback, } from '@sentry/types';
|
|
2
|
-
export { addBreadcrumb, captureException, captureEvent, captureMessage, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, spanToJSON, spanIsSampled, setMeasurement, getCurrentScope, getGlobalScope, getIsolationScope, getClient, setCurrentClient, addEventProcessor, metricsDefault as metrics, } from '@sentry/core';
|
|
1
|
+
export type { Breadcrumb, Request, SdkInfo, Event, Exception, SeverityLevel, StackFrame, Stacktrace, Thread, User, UserFeedback, } from '@sentry/types';
|
|
2
|
+
export { addBreadcrumb, captureException, captureEvent, captureMessage, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, getRootSpan, withActiveSpan, suppressTracing, spanToJSON, spanIsSampled, setMeasurement, getCurrentScope, getGlobalScope, getIsolationScope, getClient, setCurrentClient, addEventProcessor, metricsDefault as metrics, } from '@sentry/core';
|
|
3
3
|
export { ErrorBoundary, withErrorBoundary, createReduxEnhancer, Profiler, useProfiler, withProfiler, } from '@sentry/react';
|
|
4
4
|
export * from './integrations/exports';
|
|
5
5
|
export { SDK_NAME, SDK_VERSION } from './version';
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import type { StackFrame as SentryStackFrame } from '@sentry/types';
|
|
1
2
|
import type * as ReactNative from '../vendor/react-native';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* Fetches source context for the Sentry Middleware (/__sentry/context)
|
|
5
|
+
*
|
|
6
|
+
* @param frame StackFrame
|
|
7
|
+
* @param getDevServer function from RN to get DevServer URL
|
|
4
8
|
*/
|
|
5
|
-
export declare function fetchSourceContext(
|
|
9
|
+
export declare function fetchSourceContext(frames: SentryStackFrame[]): Promise<SentryStackFrame[]>;
|
|
6
10
|
/**
|
|
7
11
|
* Loads and calls RN Core Devtools parseErrorStack function.
|
|
8
12
|
*/
|
|
@@ -14,5 +14,9 @@ type SpotlightReactNativeIntegrationOptions = {
|
|
|
14
14
|
* Learn more about spotlight at https://spotlightjs.com
|
|
15
15
|
*/
|
|
16
16
|
export declare function spotlightIntegration({ sidecarUrl, }?: SpotlightReactNativeIntegrationOptions): Integration;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the default Spotlight sidecar URL.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getDefaultSidecarUrl(): string;
|
|
17
21
|
export {};
|
|
18
22
|
//# sourceMappingURL=spotlight.d.ts.map
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
interface ReactNativeVersion {
|
|
2
|
+
major: number;
|
|
3
|
+
minor: number;
|
|
4
|
+
}
|
|
1
5
|
/**
|
|
2
6
|
* This is a workaround for using fetch on RN, this is a known issue in react-native and only generates a warning.
|
|
3
7
|
*/
|
|
4
|
-
export declare function ignoreRequireCycleLogs(): void;
|
|
8
|
+
export declare function ignoreRequireCycleLogs(version?: ReactNativeVersion): void;
|
|
9
|
+
export {};
|
|
5
10
|
//# sourceMappingURL=ignorerequirecyclelogs.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SentryEventEmitter } from './sentryeventemitter';
|
|
2
|
+
export declare const FALLBACK_TIMEOUT_MS = 10000;
|
|
3
|
+
export type FallBackNewFrameEvent = {
|
|
4
|
+
newFrameTimestampInSeconds: number;
|
|
5
|
+
isFallback?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export interface SentryEventEmitterFallback {
|
|
8
|
+
/**
|
|
9
|
+
* Initializes the fallback event emitter
|
|
10
|
+
* This method is synchronous in JS but the event emitter starts asynchronously.
|
|
11
|
+
*/
|
|
12
|
+
initAsync: () => void;
|
|
13
|
+
onceNewFrame: (listener: (event: FallBackNewFrameEvent) => void) => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates emitter that allows to listen to UI Frame events when ready.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createSentryFallbackEventEmitter(emitter?: SentryEventEmitter, fallbackTimeoutMs?: number): SentryEventEmitterFallback;
|
|
19
|
+
//# sourceMappingURL=sentryeventemitterfallback.d.ts.map
|
|
@@ -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.3.0-beta.1";
|
|
4
4
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -15,6 +15,9 @@ export interface Screenshot {
|
|
|
15
15
|
filename: string;
|
|
16
16
|
}
|
|
17
17
|
export type NativeSdkOptions = Partial<ReactNativeClientOptions> & {
|
|
18
|
+
devServerUrl: string | undefined;
|
|
19
|
+
defaultSidecarUrl: string | undefined;
|
|
20
|
+
} & {
|
|
18
21
|
mobileReplayOptions: MobileReplayOptions | undefined;
|
|
19
22
|
};
|
|
20
23
|
interface SentryNativeWrapper {
|
|
@@ -70,6 +73,7 @@ interface SentryNativeWrapper {
|
|
|
70
73
|
captureReplay(isHardCrash: boolean): Promise<string | null>;
|
|
71
74
|
getCurrentReplayId(): string | null;
|
|
72
75
|
crashedLastRun(): Promise<boolean | null>;
|
|
76
|
+
getNewScreenTimeToDisplay(): Promise<number | null | undefined>;
|
|
73
77
|
}
|
|
74
78
|
/**
|
|
75
79
|
* Our internal interface for calling native functions
|