@sentry/react-native 5.25.0-alpha.2 → 5.26.0-alpha.3
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 +55 -1
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryBreadcrumb.java +87 -0
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +12 -46
- package/android/src/main/java/io/sentry/react/RNSentryReplayBreadcrumbConverter.java +22 -13
- package/dist/js/NativeRNSentry.d.ts +1 -1
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js +26 -7
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/misc.d.ts +2 -0
- package/dist/js/misc.d.ts.map +1 -1
- package/dist/js/misc.js +4 -2
- package/dist/js/misc.js.map +1 -1
- package/dist/js/replay/mobilereplay.d.ts +11 -0
- package/dist/js/replay/mobilereplay.d.ts.map +1 -1
- package/dist/js/replay/mobilereplay.js +1 -0
- package/dist/js/replay/mobilereplay.js.map +1 -1
- package/dist/js/tools/enableLogger.d.ts +5 -0
- package/dist/js/tools/enableLogger.d.ts.map +1 -0
- package/dist/js/tools/enableLogger.js +13 -0
- package/dist/js/tools/enableLogger.js.map +1 -0
- package/dist/js/tools/metroconfig.d.ts +19 -4
- package/dist/js/tools/metroconfig.d.ts.map +1 -1
- package/dist/js/tools/metroconfig.js +38 -3
- package/dist/js/tools/metroconfig.js.map +1 -1
- package/dist/js/tools/sentryBabelTransformer.d.ts +4 -0
- package/dist/js/tools/sentryBabelTransformer.d.ts.map +1 -0
- package/dist/js/tools/sentryBabelTransformer.js +28 -0
- package/dist/js/tools/sentryBabelTransformer.js.map +1 -0
- package/dist/js/tools/sentryBabelTransformerUtils.d.ts +18 -0
- package/dist/js/tools/sentryBabelTransformerUtils.d.ts.map +1 -0
- package/dist/js/tools/sentryBabelTransformerUtils.js +67 -0
- package/dist/js/tools/sentryBabelTransformerUtils.js.map +1 -0
- package/dist/js/tools/vendor/metro/metroBabelTransformer.d.ts +35 -0
- package/dist/js/tools/vendor/metro/metroBabelTransformer.d.ts.map +1 -0
- package/dist/js/tools/vendor/metro/metroBabelTransformer.js +3 -0
- package/dist/js/tools/vendor/metro/metroBabelTransformer.js.map +1 -0
- package/dist/js/utils/error.d.ts +1 -0
- package/dist/js/utils/error.d.ts.map +1 -1
- package/dist/js/utils/error.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.js +1 -1
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.mm +8 -1
- package/ios/RNSentryBreadcrumb.h +4 -0
- package/ios/RNSentryBreadcrumb.m +19 -0
- package/ios/RNSentryReplay.m +14 -2
- package/ios/RNSentryReplayBreadcrumbConverter.m +4 -8
- package/package.json +2 -1
- package/sentry.gradle +1 -1
- package/src/js/NativeRNSentry.ts +1 -1
- package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -1
- package/ts3.8/dist/js/misc.d.ts +2 -0
- package/ts3.8/dist/js/replay/mobilereplay.d.ts +11 -0
- package/ts3.8/dist/js/utils/error.d.ts +1 -0
- package/ts3.8/dist/js/version.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.26.0-alpha.3
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- Redact `react-native-svg` SVGs when `maskAllVectors` ([#3930](https://github.com/getsentry/sentry-react-native/pull/3930))
|
|
8
|
+
- Add `annotateReactComponents` option to `@sentry/react-native/metro` ([#3916](https://github.com/getsentry/sentry-react-native/pull/3916))
|
|
9
|
+
|
|
10
|
+
```js
|
|
11
|
+
// For Expo
|
|
12
|
+
const { getSentryExpoConfig } = require("@sentry/react-native/metro");
|
|
13
|
+
const config = getSentryExpoConfig(__dirname, { annotateReactComponents: true });
|
|
14
|
+
|
|
15
|
+
// For RN
|
|
16
|
+
const { getDefaultConfig } = require('@react-native/metro-config');
|
|
17
|
+
const { withSentryConfig } = require('@sentry/react-native/metro');
|
|
18
|
+
module.exports = withSentryConfig(getDefaultConfig(__dirname), { annotateReactComponents: true });
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Fixes
|
|
22
|
+
|
|
23
|
+
- Add `app.foreground/background` breadcrumbs to iOS Replays ([#3932](https://github.com/getsentry/sentry-react-native/pull/3932))
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
- Bump Android SDK from v7.11.0-alpha.2 to v7.12.0-alpha.4 ([#3830](https://github.com/getsentry/sentry-react-native/pull/3830))
|
|
28
|
+
- [changelog](https://github.com/getsentry/sentry-java/blob/7.12.0-alpha.3/CHANGELOG.md#7120-alpha4)
|
|
29
|
+
- [diff](https://github.com/getsentry/sentry-java/compare/7.11.0-alpha.2...7.12.0-alpha.4)
|
|
30
|
+
- Bump Cocoa SDK from v8.30.0 to v8.30.1 ([#3936](https://github.com/getsentry/sentry-react-native/pull/3936))
|
|
31
|
+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8301)
|
|
32
|
+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.30.0...8.30.1)
|
|
33
|
+
|
|
34
|
+
## 5.25.0
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
- Improved Touch Event Breadcrumb components structure ([#3899](https://github.com/getsentry/sentry-react-native/pull/3899))
|
|
39
|
+
- Set `currentScreen` on native scope ([#3927](https://github.com/getsentry/sentry-react-native/pull/3927))
|
|
40
|
+
|
|
41
|
+
### Fixes
|
|
42
|
+
|
|
43
|
+
- `error.cause` chain is locally symbolicated in development builds ([#3920](https://github.com/getsentry/sentry-react-native/pull/3920))
|
|
44
|
+
- `sentry-expo-upload-sourcemaps` no longer requires Sentry url when uploading sourcemaps to `sentry.io` ([#3915](https://github.com/getsentry/sentry-react-native/pull/3915))
|
|
45
|
+
- Flavor aware Android builds use `SENTRY_AUTH_TOKEN` env as fallback when token not found in `sentry-flavor-type.properties`. ([#3917](https://github.com/getsentry/sentry-react-native/pull/3917))
|
|
46
|
+
- `mechanism.handled:false` should crash current session ([#3900](https://github.com/getsentry/sentry-react-native/pull/3900))
|
|
47
|
+
|
|
48
|
+
### Dependencies
|
|
49
|
+
|
|
50
|
+
- Bump Cocoa SDK from v8.29.1 to v8.30.0 ([#3914](https://github.com/getsentry/sentry-react-native/pull/3914))
|
|
51
|
+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8300)
|
|
52
|
+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.29.1...8.30.0)
|
|
53
|
+
- Bump Android SDK from v7.10.0 to v7.11.0 ([#3926](https://github.com/getsentry/sentry-react-native/pull/3926))
|
|
54
|
+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7110)
|
|
55
|
+
- [diff](https://github.com/getsentry/sentry-java/compare/7.10.0...7.11.0)
|
|
56
|
+
|
|
3
57
|
## 5.25.0-alpha.2
|
|
4
58
|
|
|
5
59
|
### Features
|
|
@@ -483,7 +537,7 @@ see [the Expo guide](https://docs.sentry.io/platforms/react-native/manual-setup/
|
|
|
483
537
|
const { getSentryExpoConfig } = require("@sentry/react-native/metro");
|
|
484
538
|
|
|
485
539
|
// const config = getDefaultConfig(__dirname);
|
|
486
|
-
const config = getSentryExpoConfig(
|
|
540
|
+
const config = getSentryExpoConfig(__dirname);
|
|
487
541
|
```
|
|
488
542
|
|
|
489
543
|
- New `npx sentry-expo-upload-sourcemaps` for simple EAS Update (`npx expo export`) source maps upload ([#3491](https://github.com/getsentry/sentry-react-native/pull/3491), [#3510](https://github.com/getsentry/sentry-react-native/pull/3510), [#3515](https://github.com/getsentry/sentry-react-native/pull/3515), [#3507](https://github.com/getsentry/sentry-react-native/pull/3507))
|
package/RNSentry.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
package io.sentry.react;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
4
|
+
|
|
5
|
+
import org.jetbrains.annotations.NotNull;
|
|
6
|
+
import org.jetbrains.annotations.Nullable;
|
|
7
|
+
|
|
8
|
+
import java.util.Map;
|
|
9
|
+
|
|
10
|
+
import io.sentry.Breadcrumb;
|
|
11
|
+
import io.sentry.SentryLevel;
|
|
12
|
+
|
|
13
|
+
public class RNSentryBreadcrumb {
|
|
14
|
+
|
|
15
|
+
@Nullable
|
|
16
|
+
public static String getCurrentScreenFrom(ReadableMap from) {
|
|
17
|
+
final @Nullable String maybeCategory = from.hasKey("category") ? from.getString("category") : null;
|
|
18
|
+
if (maybeCategory == null || !maybeCategory.equals("navigation")) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
final @Nullable ReadableMap maybeData = from.hasKey("data") ? from.getMap("data") : null;
|
|
23
|
+
if (maybeData == null) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
// getString might throw if cast to string fails (data.to is not enforced by TS to be a string)
|
|
29
|
+
return maybeData.hasKey("to") ? maybeData.getString("to") : null;
|
|
30
|
+
} catch (Throwable exception) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@NotNull
|
|
36
|
+
public static Breadcrumb fromMap(ReadableMap from) {
|
|
37
|
+
final @NotNull Breadcrumb breadcrumb = new Breadcrumb();
|
|
38
|
+
|
|
39
|
+
if (from.hasKey("message")) {
|
|
40
|
+
breadcrumb.setMessage(from.getString("message"));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (from.hasKey("type")) {
|
|
44
|
+
breadcrumb.setType(from.getString("type"));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (from.hasKey("category")) {
|
|
48
|
+
breadcrumb.setCategory(from.getString("category"));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (from.hasKey("level")) {
|
|
52
|
+
switch (from.getString("level")) {
|
|
53
|
+
case "fatal":
|
|
54
|
+
breadcrumb.setLevel(SentryLevel.FATAL);
|
|
55
|
+
break;
|
|
56
|
+
case "warning":
|
|
57
|
+
breadcrumb.setLevel(SentryLevel.WARNING);
|
|
58
|
+
break;
|
|
59
|
+
case "debug":
|
|
60
|
+
breadcrumb.setLevel(SentryLevel.DEBUG);
|
|
61
|
+
break;
|
|
62
|
+
case "error":
|
|
63
|
+
breadcrumb.setLevel(SentryLevel.ERROR);
|
|
64
|
+
break;
|
|
65
|
+
case "info":
|
|
66
|
+
default:
|
|
67
|
+
breadcrumb.setLevel(SentryLevel.INFO);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
if (from.hasKey("data")) {
|
|
74
|
+
final ReadableMap data = from.getMap("data");
|
|
75
|
+
for (final Map.Entry<String, Object> entry : data.toHashMap().entrySet()) {
|
|
76
|
+
final Object value = entry.getValue();
|
|
77
|
+
// data is ConcurrentHashMap and can't have null values
|
|
78
|
+
if (value != null) {
|
|
79
|
+
breadcrumb.setData(entry.getKey(), entry.getValue());
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return breadcrumb;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}
|
|
@@ -41,9 +41,11 @@ import java.io.IOException;
|
|
|
41
41
|
import java.io.InputStream;
|
|
42
42
|
import java.nio.charset.Charset;
|
|
43
43
|
import java.util.HashMap;
|
|
44
|
+
import java.util.HashSet;
|
|
44
45
|
import java.util.List;
|
|
45
46
|
import java.util.Map;
|
|
46
47
|
import java.util.Properties;
|
|
48
|
+
import java.util.Set;
|
|
47
49
|
import java.util.concurrent.CountDownLatch;
|
|
48
50
|
|
|
49
51
|
import io.sentry.Breadcrumb;
|
|
@@ -326,6 +328,11 @@ public class RNSentryModuleImpl {
|
|
|
326
328
|
androidReplayOptions.setRedactAllText(!rnMobileReplayOptions.hasKey("maskAllText") || rnMobileReplayOptions.getBoolean("maskAllText"));
|
|
327
329
|
androidReplayOptions.setRedactAllImages(!rnMobileReplayOptions.hasKey("maskAllImages") || rnMobileReplayOptions.getBoolean("maskAllImages"));
|
|
328
330
|
|
|
331
|
+
final boolean redactVectors = !rnMobileReplayOptions.hasKey("maskAllVectors") || rnMobileReplayOptions.getBoolean("maskAllVectors");
|
|
332
|
+
if (redactVectors) {
|
|
333
|
+
androidReplayOptions.addClassToRedact("com.horcrux.svg.SvgView"); // react-native-svg
|
|
334
|
+
}
|
|
335
|
+
|
|
329
336
|
return androidReplayOptions;
|
|
330
337
|
}
|
|
331
338
|
|
|
@@ -452,7 +459,7 @@ public class RNSentryModuleImpl {
|
|
|
452
459
|
byte[] bytes = Base64.decode(rawBytes, Base64.DEFAULT);
|
|
453
460
|
|
|
454
461
|
try {
|
|
455
|
-
InternalSentrySdk.captureEnvelope(bytes);
|
|
462
|
+
InternalSentrySdk.captureEnvelope(bytes, !options.hasKey("hardCrashed") || !options.getBoolean("hardCrashed"));
|
|
456
463
|
} catch (Throwable e) {
|
|
457
464
|
logger.log(SentryLevel.ERROR, "Error while capturing envelope");
|
|
458
465
|
promise.resolve(false);
|
|
@@ -605,53 +612,12 @@ public class RNSentryModuleImpl {
|
|
|
605
612
|
|
|
606
613
|
public void addBreadcrumb(final ReadableMap breadcrumb) {
|
|
607
614
|
Sentry.configureScope(scope -> {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
if (breadcrumb.hasKey("message")) {
|
|
611
|
-
breadcrumbInstance.setMessage(breadcrumb.getString("message"));
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
if (breadcrumb.hasKey("type")) {
|
|
615
|
-
breadcrumbInstance.setType(breadcrumb.getString("type"));
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
if (breadcrumb.hasKey("category")) {
|
|
619
|
-
breadcrumbInstance.setCategory(breadcrumb.getString("category"));
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
if (breadcrumb.hasKey("level")) {
|
|
623
|
-
switch (breadcrumb.getString("level")) {
|
|
624
|
-
case "fatal":
|
|
625
|
-
breadcrumbInstance.setLevel(SentryLevel.FATAL);
|
|
626
|
-
break;
|
|
627
|
-
case "warning":
|
|
628
|
-
breadcrumbInstance.setLevel(SentryLevel.WARNING);
|
|
629
|
-
break;
|
|
630
|
-
case "debug":
|
|
631
|
-
breadcrumbInstance.setLevel(SentryLevel.DEBUG);
|
|
632
|
-
break;
|
|
633
|
-
case "error":
|
|
634
|
-
breadcrumbInstance.setLevel(SentryLevel.ERROR);
|
|
635
|
-
break;
|
|
636
|
-
case "info":
|
|
637
|
-
default:
|
|
638
|
-
breadcrumbInstance.setLevel(SentryLevel.INFO);
|
|
639
|
-
break;
|
|
640
|
-
}
|
|
641
|
-
}
|
|
615
|
+
scope.addBreadcrumb(RNSentryBreadcrumb.fromMap(breadcrumb));
|
|
642
616
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
final Object value = entry.getValue();
|
|
647
|
-
// data is ConcurrentHashMap and can't have null values
|
|
648
|
-
if (value != null) {
|
|
649
|
-
breadcrumbInstance.setData(entry.getKey(), entry.getValue());
|
|
650
|
-
}
|
|
651
|
-
}
|
|
617
|
+
final @Nullable String screen = RNSentryBreadcrumb.getCurrentScreenFrom(breadcrumb);
|
|
618
|
+
if (screen != null) {
|
|
619
|
+
scope.setScreen(screen);
|
|
652
620
|
}
|
|
653
|
-
|
|
654
|
-
scope.addBreadcrumb(breadcrumbInstance);
|
|
655
621
|
});
|
|
656
622
|
}
|
|
657
623
|
|
|
@@ -29,23 +29,20 @@ public final class RNSentryReplayBreadcrumbConverter extends DefaultReplayBreadc
|
|
|
29
29
|
breadcrumb.getCategory().equals("sentry.transaction")) {
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
|
+
if (breadcrumb.getCategory().equals("http")) {
|
|
33
|
+
// Drop native http breadcrumbs to avoid duplicates
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
32
36
|
|
|
33
37
|
if (breadcrumb.getCategory().equals("touch")) {
|
|
34
38
|
return convertTouchBreadcrumb(breadcrumb);
|
|
35
39
|
}
|
|
36
40
|
if (breadcrumb.getCategory().equals("navigation")) {
|
|
37
|
-
|
|
38
|
-
rrWebBreadcrumb.setCategory(breadcrumb.getCategory());
|
|
39
|
-
rrWebBreadcrumb.setData(breadcrumb.getData());
|
|
40
|
-
return rrWebBreadcrumb;
|
|
41
|
+
return convertNavigationBreadcrumb(breadcrumb);
|
|
41
42
|
}
|
|
42
43
|
if (breadcrumb.getCategory().equals("xhr")) {
|
|
43
44
|
return convertNetworkBreadcrumb(breadcrumb);
|
|
44
45
|
}
|
|
45
|
-
if (breadcrumb.getCategory().equals("http")) {
|
|
46
|
-
// Drop native http breadcrumbs to avoid duplicates
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
46
|
|
|
50
47
|
RRWebEvent nativeBreadcrumb = super.convert(breadcrumb);
|
|
51
48
|
|
|
@@ -60,6 +57,14 @@ public final class RNSentryReplayBreadcrumbConverter extends DefaultReplayBreadc
|
|
|
60
57
|
return nativeBreadcrumb;
|
|
61
58
|
}
|
|
62
59
|
|
|
60
|
+
@TestOnly
|
|
61
|
+
public @NotNull RRWebEvent convertNavigationBreadcrumb(final @NotNull Breadcrumb breadcrumb) {
|
|
62
|
+
final RRWebBreadcrumbEvent rrWebBreadcrumb = new RRWebBreadcrumbEvent();
|
|
63
|
+
rrWebBreadcrumb.setCategory(breadcrumb.getCategory());
|
|
64
|
+
setRRWebEventDefaultsFrom(rrWebBreadcrumb, breadcrumb);
|
|
65
|
+
return rrWebBreadcrumb;
|
|
66
|
+
}
|
|
67
|
+
|
|
63
68
|
@TestOnly
|
|
64
69
|
public @NotNull RRWebEvent convertTouchBreadcrumb(final @NotNull Breadcrumb breadcrumb) {
|
|
65
70
|
final RRWebBreadcrumbEvent rrWebBreadcrumb = new RRWebBreadcrumbEvent();
|
|
@@ -69,11 +74,7 @@ public final class RNSentryReplayBreadcrumbConverter extends DefaultReplayBreadc
|
|
|
69
74
|
rrWebBreadcrumb.setMessage(RNSentryReplayBreadcrumbConverter
|
|
70
75
|
.getTouchPathMessage(breadcrumb.getData("path")));
|
|
71
76
|
|
|
72
|
-
rrWebBreadcrumb
|
|
73
|
-
rrWebBreadcrumb.setData(breadcrumb.getData());
|
|
74
|
-
rrWebBreadcrumb.setTimestamp(breadcrumb.getTimestamp().getTime());
|
|
75
|
-
rrWebBreadcrumb.setBreadcrumbTimestamp(breadcrumb.getTimestamp().getTime() / 1000.0);
|
|
76
|
-
rrWebBreadcrumb.setBreadcrumbType("default");
|
|
77
|
+
setRRWebEventDefaultsFrom(rrWebBreadcrumb, breadcrumb);
|
|
77
78
|
return rrWebBreadcrumb;
|
|
78
79
|
}
|
|
79
80
|
|
|
@@ -175,4 +176,12 @@ public final class RNSentryReplayBreadcrumbConverter extends DefaultReplayBreadc
|
|
|
175
176
|
rrWebSpanEvent.setData(data);
|
|
176
177
|
return rrWebSpanEvent;
|
|
177
178
|
}
|
|
179
|
+
|
|
180
|
+
private void setRRWebEventDefaultsFrom(final @NotNull RRWebBreadcrumbEvent rrWebBreadcrumb, final @NotNull Breadcrumb breadcrumb) {
|
|
181
|
+
rrWebBreadcrumb.setLevel(breadcrumb.getLevel());
|
|
182
|
+
rrWebBreadcrumb.setData(breadcrumb.getData());
|
|
183
|
+
rrWebBreadcrumb.setTimestamp(breadcrumb.getTimestamp().getTime());
|
|
184
|
+
rrWebBreadcrumb.setBreadcrumbTimestamp(breadcrumb.getTimestamp().getTime() / 1000.0);
|
|
185
|
+
rrWebBreadcrumb.setBreadcrumbType("default");
|
|
186
|
+
}
|
|
178
187
|
}
|
|
@@ -6,7 +6,7 @@ export interface Spec extends TurboModule {
|
|
|
6
6
|
removeListeners: (id: number) => void;
|
|
7
7
|
addBreadcrumb(breadcrumb: UnsafeObject): void;
|
|
8
8
|
captureEnvelope(bytes: string, options: {
|
|
9
|
-
|
|
9
|
+
hardCrashed: boolean;
|
|
10
10
|
}): Promise<boolean>;
|
|
11
11
|
captureScreenshot(): Promise<NativeScreenshot[] | undefined | null>;
|
|
12
12
|
clearBreadcrumbs(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeRNSentry.d.ts","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAIjE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,aAAa,CAAC,UAAU,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9C,eAAe,CACb,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;QACP,
|
|
1
|
+
{"version":3,"file":"NativeRNSentry.d.ts","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAIjE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,WAAW,EAAE,CAAC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AC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC,CAAC;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC,EAAE,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;;AAGF,wBAAkE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeRNSentry.js","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAwJnD,2DAA2D;AAC3D,eAAe,mBAAmB,CAAC,YAAY,CAAO,UAAU,CAAC,CAAC","sourcesContent":["import type { Package } from '@sentry/types';\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nimport type { UnsafeObject } from './utils/rnlibrariesinterface';\n\n// There has to be only one interface and it has to be named `Spec`\n// Only extra allowed definitions are types (probably codegen bug)\nexport interface Spec extends TurboModule {\n addListener: (eventType: string) => void;\n removeListeners: (id: number) => void;\n addBreadcrumb(breadcrumb: UnsafeObject): void;\n captureEnvelope(\n bytes: string,\n options: {\n
|
|
1
|
+
{"version":3,"file":"NativeRNSentry.js","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAwJnD,2DAA2D;AAC3D,eAAe,mBAAmB,CAAC,YAAY,CAAO,UAAU,CAAC,CAAC","sourcesContent":["import type { Package } from '@sentry/types';\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nimport type { UnsafeObject } from './utils/rnlibrariesinterface';\n\n// There has to be only one interface and it has to be named `Spec`\n// Only extra allowed definitions are types (probably codegen bug)\nexport interface Spec extends TurboModule {\n addListener: (eventType: string) => void;\n removeListeners: (id: number) => void;\n addBreadcrumb(breadcrumb: UnsafeObject): void;\n captureEnvelope(\n bytes: string,\n options: {\n hardCrashed: boolean;\n },\n ): Promise<boolean>;\n captureScreenshot(): Promise<NativeScreenshot[] | undefined | null>;\n clearBreadcrumbs(): void;\n crash(): void;\n closeNativeSdk(): Promise<void>;\n disableNativeFramesTracking(): void;\n fetchNativeRelease(): Promise<NativeReleaseResponse>;\n fetchNativeSdkInfo(): Promise<Package | null>;\n fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse | null>;\n fetchNativeAppStart(): Promise<NativeAppStartResponse | null>;\n fetchNativeFrames(): Promise<NativeFramesResponse | null>;\n initNativeSdk(options: UnsafeObject): Promise<boolean>;\n setUser(defaultUserKeys: UnsafeObject | null, otherUserKeys: UnsafeObject | null): void;\n setContext(key: string, value: UnsafeObject | null): void;\n setExtra(key: string, value: string): void;\n setTag(key: string, value: string): void;\n enableNativeFramesTracking(): void;\n fetchModules(): Promise<string | undefined | null>;\n fetchViewHierarchy(): Promise<number[] | undefined | null>;\n startProfiling(): { started?: boolean; error?: string };\n stopProfiling(): {\n profile?: string;\n nativeProfile?: UnsafeObject;\n androidProfile?: UnsafeObject;\n error?: string;\n };\n fetchNativePackageName(): string | undefined | null;\n fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | undefined | null;\n initNativeReactNavigationNewFrameTracking(): Promise<void>;\n captureReplay(isHardCrash: boolean): Promise<string | undefined | null>;\n getCurrentReplayId(): string | undefined | null;\n}\n\nexport type NativeStackFrame = {\n platform: string;\n /**\n * The instruction address of this frame.\n * Formatted as hex with 0x prefix.\n */\n instruction_addr: string;\n package?: string;\n /**\n * The debug image address of this frame.\n * Formatted as hex with 0x prefix.\n */\n image_addr?: string;\n in_app?: boolean;\n /**\n * The symbol name of this frame.\n * If symbolicated locally.\n */\n function?: string;\n /**\n * The symbol address of this frame.\n * If symbolicated locally.\n * Formatted as hex with 0x prefix.\n */\n symbol_addr?: string;\n};\n\nexport type NativeDebugImage = {\n name?: string;\n type?: string;\n uuid?: string;\n debug_id?: string;\n image_addr?: string;\n image_size?: number;\n code_file?: string;\n image_vmaddr?: string;\n};\n\nexport type NativeStackFrames = {\n frames: NativeStackFrame[];\n debugMetaImages?: NativeDebugImage[];\n};\n\nexport type NativeAppStartResponse = {\n type: 'cold' | 'warm' | 'unknown';\n has_fetched: boolean;\n app_start_timestamp_ms?: number;\n spans: {\n description: string;\n start_timestamp_ms: number;\n end_timestamp_ms: number;\n }[];\n};\n\nexport type NativeFramesResponse = {\n totalFrames: number;\n slowFrames: number;\n frozenFrames: number;\n};\n\nexport type NativeReleaseResponse = {\n build: string;\n id: string;\n version: string;\n};\n\n/**\n * This type describes serialized scope from sentry-cocoa and sentry-android\n * https://github.com/getsentry/sentry-cocoa/blob/master/Sources/Sentry/SentryScope.m\n * https://github.com/getsentry/sentry-java/blob/a461f7e125b65240004e6162b341f383ce2e1394/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java#L32\n */\nexport type NativeDeviceContextsResponse = {\n [key: string]: unknown;\n tags?: Record<string, string>;\n extra?: Record<string, unknown>;\n contexts?: Record<string, Record<string, unknown>>;\n user?: {\n userId?: string;\n email?: string;\n username?: string;\n ipAddress?: string;\n segment?: string;\n data?: Record<string, unknown>;\n };\n dist?: string;\n environment?: string;\n fingerprint?: string[];\n level?: string;\n breadcrumbs?: {\n level?: string;\n timestamp?: string;\n category?: string;\n type?: string;\n message?: string;\n data?: Record<string, unknown>;\n }[];\n};\n\nexport type NativeScreenshot = {\n data: number[];\n contentType: string;\n filename: string;\n};\n\n// The export must be here to pass codegen even if not used\nexport default TurboModuleRegistry.getEnforcing<Spec>('RNSentry');\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugsymbolicator.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"debugsymbolicator.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EAEpB,MAAM,eAAe,CAAC;AAavB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,6DAA6D;AAC7D,eAAO,MAAM,4BAA4B,QAAO,mBAQ/C,CAAC;AAEF;;;;GAIG;AAEH,eAAO,MAAM,iBAAiB,+BAGI,CAAC"}
|
|
@@ -24,17 +24,23 @@ export const debugSymbolicatorIntegration = () => {
|
|
|
24
24
|
// eslint-disable-next-line deprecation/deprecation
|
|
25
25
|
export const DebugSymbolicator = convertIntegrationFnToClass(INTEGRATION_NAME, debugSymbolicatorIntegration);
|
|
26
26
|
function processEvent(event, hint) {
|
|
27
|
+
var _a;
|
|
27
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
if (event.exception && isErrorLike(hint.originalException)) {
|
|
29
|
+
if (((_a = event.exception) === null || _a === void 0 ? void 0 : _a.values) && isErrorLike(hint.originalException)) {
|
|
29
30
|
// originalException is ErrorLike object
|
|
30
|
-
const
|
|
31
|
-
|
|
31
|
+
const errorGroup = getExceptionGroup(hint.originalException);
|
|
32
|
+
for (const [index, error] of errorGroup.entries()) {
|
|
33
|
+
const symbolicatedFrames = yield symbolicate(error.stack, getFramesToPop(error));
|
|
34
|
+
symbolicatedFrames && replaceExceptionFramesInException(event.exception.values[index], symbolicatedFrames);
|
|
35
|
+
}
|
|
32
36
|
}
|
|
33
37
|
else if (hint.syntheticException && isErrorLike(hint.syntheticException)) {
|
|
34
38
|
// syntheticException is Error object
|
|
35
39
|
const symbolicatedFrames = yield symbolicate(hint.syntheticException.stack, getFramesToPop(hint.syntheticException));
|
|
36
40
|
if (event.exception) {
|
|
37
|
-
symbolicatedFrames &&
|
|
41
|
+
symbolicatedFrames &&
|
|
42
|
+
event.exception.values &&
|
|
43
|
+
replaceExceptionFramesInException(event.exception.values[0], symbolicatedFrames);
|
|
38
44
|
}
|
|
39
45
|
else if (event.threads) {
|
|
40
46
|
// RN JS doesn't have threads
|
|
@@ -108,9 +114,9 @@ function convertReactNativeFramesToSentryFrames(frames) {
|
|
|
108
114
|
* @param event Event
|
|
109
115
|
* @param frames StackFrame[]
|
|
110
116
|
*/
|
|
111
|
-
function
|
|
112
|
-
if (
|
|
113
|
-
|
|
117
|
+
function replaceExceptionFramesInException(exception, frames) {
|
|
118
|
+
if (exception === null || exception === void 0 ? void 0 : exception.stacktrace) {
|
|
119
|
+
exception.stacktrace.frames = frames.reverse();
|
|
114
120
|
}
|
|
115
121
|
}
|
|
116
122
|
/**
|
|
@@ -154,4 +160,17 @@ function addSourceContext(frame) {
|
|
|
154
160
|
addContextToFrame(lines, frame);
|
|
155
161
|
});
|
|
156
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Return a list containing the original exception and also the cause if found.
|
|
165
|
+
*
|
|
166
|
+
* @param originalException The original exception.
|
|
167
|
+
*/
|
|
168
|
+
function getExceptionGroup(originalException) {
|
|
169
|
+
const err = originalException;
|
|
170
|
+
const errorGroup = [];
|
|
171
|
+
for (let cause = err; isErrorLike(cause); cause = cause.cause) {
|
|
172
|
+
errorGroup.push(cause);
|
|
173
|
+
}
|
|
174
|
+
return errorGroup;
|
|
175
|
+
}
|
|
157
176
|
//# sourceMappingURL=debugsymbolicator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugsymbolicator.js","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAS3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEpH,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AAE7C,sEAAsE;AACtE,MAAM,wBAAwB,GAAG,IAAI,MAAM,CAAC,CAAC,+BAA+B,EAAE,oBAAoB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAY/G,6DAA6D;AAC7D,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAwB,EAAE;IACpE,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,GAAG,EAAE;YACd,UAAU;QACZ,CAAC;QACD,YAAY;KACb,CA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Aa,GAAkB,IAAI,CAAC;QAExC,MAAM,QAAQ,GAAG,MAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,KAAK,CAAC,GAAG,CAAC,mCAAI,EAAE,CAAC;QAElD,MAAM,SAAS,GAAG,MAAA,YAAY,EAAE,0CAAE,GAAG,CAAC;QACtC,IAAI,CAAC,SAAS,EAAE;YACd,OAAO;SACR;QAED,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;YAC1B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE;gBACxD,SAAS;aACV;YAED,aAAa,GAAG,MAAM,kBAAkB,CAAC,SAAS,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;YACpE,IAAI,aAAa,EAAE;gBACjB,MAAM;aACP;SACF;QAED,IAAI,CAAC,aAAa,EAAE;YAClB,OAAO;SACR;QAED,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxC,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;;CACjC","sourcesContent":["import { convertIntegrationFnToClass } from '@sentry/core';\nimport type {\n Event,\n EventHint,\n Integration,\n IntegrationClass,\n IntegrationFnResult,\n StackFrame as SentryStackFrame,\n} from '@sentry/types';\nimport { addContextToFrame, logger } from '@sentry/utils';\n\nimport { getFramesToPop, isErrorLike } from '../utils/error';\nimport type * as ReactNative from '../vendor/react-native';\nimport { fetchSourceContext, getDevServer, parseErrorStack, symbolicateStackTrace } from './debugsymbolicatorutils';\n\nconst INTEGRATION_NAME = 'DebugSymbolicator';\n\n// eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\nconst INTERNAL_CALLSITES_REGEX = new RegExp(['ReactNativeRenderer-dev\\\\.js$', 'MessageQueue\\\\.js$'].join('|'));\n\n/**\n * React Native Error\n */\nexport type ReactNativeError = Error & {\n framesToPop?: number;\n jsEngine?: string;\n preventSymbolication?: boolean;\n componentStack?: string;\n};\n\n/** Tries to symbolicate the JS stack trace on the device. */\nexport const debugSymbolicatorIntegration = (): IntegrationFnResult => {\n return {\n name: INTEGRATION_NAME,\n setupOnce: () => {\n /* noop */\n },\n processEvent,\n };\n};\n\n/**\n * Tries to symbolicate the JS stack trace on the device.\n *\n * @deprecated Use `debugSymbolicatorIntegration()` instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport const DebugSymbolicator = convertIntegrationFnToClass(\n INTEGRATION_NAME,\n debugSymbolicatorIntegration,\n) as IntegrationClass<Integration>;\n\nasync function processEvent(event: Event, hint: EventHint): Promise<Event> {\n if (event.exception && isErrorLike(hint.originalException)) {\n // originalException is ErrorLike object\n const symbolicatedFrames = await symbolicate(\n hint.originalException.stack,\n getFramesToPop(hint.originalException as Error),\n );\n symbolicatedFrames && replaceExceptionFramesInEvent(event, symbolicatedFrames);\n } else if (hint.syntheticException && isErrorLike(hint.syntheticException)) {\n // syntheticException is Error object\n const symbolicatedFrames = await symbolicate(\n hint.syntheticException.stack,\n getFramesToPop(hint.syntheticException),\n );\n\n if (event.exception) {\n symbolicatedFrames && replaceExceptionFramesInEvent(event, symbolicatedFrames);\n } else if (event.threads) {\n // RN JS doesn't have threads\n symbolicatedFrames && replaceThreadFramesInEvent(event, symbolicatedFrames);\n }\n }\n\n return event;\n}\n\n/**\n * Symbolicates the stack on the device talking to local dev server.\n * Mutates the passed event.\n */\nasync function symbolicate(rawStack: string, skipFirstFrames: number = 0): Promise<SentryStackFrame[] | null> {\n try {\n const parsedStack = parseErrorStack(rawStack);\n\n const prettyStack = await symbolicateStackTrace(parsedStack);\n if (!prettyStack) {\n logger.error('React Native DevServer could not symbolicate the stack trace.');\n return null;\n }\n\n // This has been changed in an react-native version so stack is contained in here\n const newStack = prettyStack.stack || prettyStack;\n\n // https://github.com/getsentry/sentry-javascript/blob/739d904342aaf9327312f409952f14ceff4ae1ab/packages/utils/src/stacktrace.ts#L23\n // Match SentryParser which counts lines of stack (-1 for first line with the Error message)\n const skipFirstAdjustedToSentryStackParser = Math.max(skipFirstFrames - 1, 0);\n const stackWithoutPoppedFrames = skipFirstAdjustedToSentryStackParser\n ? newStack.slice(skipFirstAdjustedToSentryStackParser)\n : newStack;\n\n const stackWithoutInternalCallsites = stackWithoutPoppedFrames.filter(\n (frame: { file?: string }) => frame.file && frame.file.match(INTERNAL_CALLSITES_REGEX) === null,\n );\n\n return await convertReactNativeFramesToSentryFrames(stackWithoutInternalCallsites);\n } catch (error) {\n if (error instanceof Error) {\n logger.warn(`Unable to symbolicate stack trace: ${error.message}`);\n }\n return null;\n }\n}\n\n/**\n * Converts ReactNativeFrames to frames in the Sentry format\n * @param frames ReactNativeFrame[]\n */\nasync function convertReactNativeFramesToSentryFrames(frames: ReactNative.StackFrame[]): Promise<SentryStackFrame[]> {\n return Promise.all(\n frames.map(async (frame: ReactNative.StackFrame): Promise<SentryStackFrame> => {\n let inApp = !!frame.column && !!frame.lineNumber;\n inApp =\n inApp &&\n frame.file !== undefined &&\n !frame.file.includes('node_modules') &&\n !frame.file.includes('native code');\n\n const newFrame: SentryStackFrame = {\n lineno: frame.lineNumber,\n colno: frame.column,\n filename: frame.file,\n function: frame.methodName,\n in_app: inApp,\n };\n\n if (inApp) {\n await addSourceContext(newFrame);\n }\n\n return newFrame;\n }),\n );\n}\n\n/**\n * Replaces the frames in the exception of a error.\n * @param event Event\n * @param frames StackFrame[]\n */\nfunction replaceExceptionFramesInEvent(event: Event, frames: SentryStackFrame[]): void {\n if (event.exception && event.exception.values && event.exception.values[0] && event.exception.values[0].stacktrace) {\n event.exception.values[0].stacktrace.frames = frames.reverse();\n }\n}\n\n/**\n * Replaces the frames in the thread of a message.\n * @param event Event\n * @param frames StackFrame[]\n */\nfunction replaceThreadFramesInEvent(event: Event, frames: SentryStackFrame[]): void {\n if (event.threads && event.threads.values && event.threads.values[0] && event.threads.values[0].stacktrace) {\n event.threads.values[0].stacktrace.frames = frames.reverse();\n }\n}\n\n/**\n * This tries to add source context for in_app Frames\n *\n * @param frame StackFrame\n * @param getDevServer function from RN to get DevServer URL\n */\nasync function addSourceContext(frame: SentryStackFrame): Promise<void> {\n let sourceContext: string | null = null;\n\n const segments = frame.filename?.split('/') ?? [];\n\n const serverUrl = getDevServer()?.url;\n if (!serverUrl) {\n return;\n }\n\n for (const idx in segments) {\n if (!Object.prototype.hasOwnProperty.call(segments, idx)) {\n continue;\n }\n\n sourceContext = await fetchSourceContext(serverUrl, segments, -idx);\n if (sourceContext) {\n break;\n }\n }\n\n if (!sourceContext) {\n return;\n }\n\n const lines = sourceContext.split('\\n');\n addContextToFrame(lines, frame);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"debugsymbolicator.js","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAU3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEpH,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AAE7C,sEAAsE;AACtE,MAAM,wBAAwB,GAAG,IAAI,MAAM,CAAC,CAAC,+BAA+B,EAAE,oBAAoB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAY/G,6DAA6D;AAC7D,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAwB,EAAE;IACpE,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,GAAG,EAAE;YACd,UAAU;QACZ,CAAC;QACD,YAAY;KACb,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,mDAAmD;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,2BAA2B,CAC1D,gB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kB,IAAI,CAAC;QAExC,MAAM,QAAQ,GAAG,MAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,KAAK,CAAC,GAAG,CAAC,mCAAI,EAAE,CAAC;QAElD,MAAM,SAAS,GAAG,MAAA,YAAY,EAAE,0CAAE,GAAG,CAAC;QACtC,IAAI,CAAC,SAAS,EAAE;YACd,OAAO;SACR;QAED,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;YAC1B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE;gBACxD,SAAS;aACV;YAED,aAAa,GAAG,MAAM,kBAAkB,CAAC,SAAS,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;YACpE,IAAI,aAAa,EAAE;gBACjB,MAAM;aACP;SACF;QAED,IAAI,CAAC,aAAa,EAAE;YAClB,OAAO;SACR;QAED,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxC,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;;CACjC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,iBAA0B;IACnD,MAAM,GAAG,GAAG,iBAAkC,CAAC;IAC/C,MAAM,UAAU,GAAkC,EAAE,CAAC;IACrD,KAAK,IAAI,KAAK,GAA8B,GAAG,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE;QACxF,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACxB;IACD,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import { convertIntegrationFnToClass } from '@sentry/core';\nimport type {\n Event,\n EventHint,\n Exception,\n Integration,\n IntegrationClass,\n IntegrationFnResult,\n StackFrame as SentryStackFrame,\n} from '@sentry/types';\nimport { addContextToFrame, logger } from '@sentry/utils';\n\nimport type { ExtendedError } from '../utils/error';\nimport { getFramesToPop, isErrorLike } from '../utils/error';\nimport type * as ReactNative from '../vendor/react-native';\nimport { fetchSourceContext, getDevServer, parseErrorStack, symbolicateStackTrace } from './debugsymbolicatorutils';\n\nconst INTEGRATION_NAME = 'DebugSymbolicator';\n\n// eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\nconst INTERNAL_CALLSITES_REGEX = new RegExp(['ReactNativeRenderer-dev\\\\.js$', 'MessageQueue\\\\.js$'].join('|'));\n\n/**\n * React Native Error\n */\nexport type ReactNativeError = Error & {\n framesToPop?: number;\n jsEngine?: string;\n preventSymbolication?: boolean;\n componentStack?: string;\n};\n\n/** Tries to symbolicate the JS stack trace on the device. */\nexport const debugSymbolicatorIntegration = (): IntegrationFnResult => {\n return {\n name: INTEGRATION_NAME,\n setupOnce: () => {\n /* noop */\n },\n processEvent,\n };\n};\n\n/**\n * Tries to symbolicate the JS stack trace on the device.\n *\n * @deprecated Use `debugSymbolicatorIntegration()` instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport const DebugSymbolicator = convertIntegrationFnToClass(\n INTEGRATION_NAME,\n debugSymbolicatorIntegration,\n) as IntegrationClass<Integration>;\n\nasync function processEvent(event: Event, hint: EventHint): Promise<Event> {\n if (event.exception?.values && isErrorLike(hint.originalException)) {\n // originalException is ErrorLike object\n const errorGroup = getExceptionGroup(hint.originalException);\n for (const [index, error] of errorGroup.entries()) {\n const symbolicatedFrames = await symbolicate(error.stack, getFramesToPop(error));\n\n symbolicatedFrames && replaceExceptionFramesInException(event.exception.values[index], symbolicatedFrames);\n }\n } else if (hint.syntheticException && isErrorLike(hint.syntheticException)) {\n // syntheticException is Error object\n const symbolicatedFrames = await symbolicate(\n hint.syntheticException.stack,\n getFramesToPop(hint.syntheticException),\n );\n\n if (event.exception) {\n symbolicatedFrames &&\n event.exception.values &&\n replaceExceptionFramesInException(event.exception.values[0], symbolicatedFrames);\n } else if (event.threads) {\n // RN JS doesn't have threads\n symbolicatedFrames && replaceThreadFramesInEvent(event, symbolicatedFrames);\n }\n }\n\n return event;\n}\n\n/**\n * Symbolicates the stack on the device talking to local dev server.\n * Mutates the passed event.\n */\nasync function symbolicate(rawStack: string, skipFirstFrames: number = 0): Promise<SentryStackFrame[] | null> {\n try {\n const parsedStack = parseErrorStack(rawStack);\n\n const prettyStack = await symbolicateStackTrace(parsedStack);\n if (!prettyStack) {\n logger.error('React Native DevServer could not symbolicate the stack trace.');\n return null;\n }\n\n // This has been changed in an react-native version so stack is contained in here\n const newStack = prettyStack.stack || prettyStack;\n\n // https://github.com/getsentry/sentry-javascript/blob/739d904342aaf9327312f409952f14ceff4ae1ab/packages/utils/src/stacktrace.ts#L23\n // Match SentryParser which counts lines of stack (-1 for first line with the Error message)\n const skipFirstAdjustedToSentryStackParser = Math.max(skipFirstFrames - 1, 0);\n const stackWithoutPoppedFrames = skipFirstAdjustedToSentryStackParser\n ? newStack.slice(skipFirstAdjustedToSentryStackParser)\n : newStack;\n\n const stackWithoutInternalCallsites = stackWithoutPoppedFrames.filter(\n (frame: { file?: string }) => frame.file && frame.file.match(INTERNAL_CALLSITES_REGEX) === null,\n );\n\n return await convertReactNativeFramesToSentryFrames(stackWithoutInternalCallsites);\n } catch (error) {\n if (error instanceof Error) {\n logger.warn(`Unable to symbolicate stack trace: ${error.message}`);\n }\n return null;\n }\n}\n\n/**\n * Converts ReactNativeFrames to frames in the Sentry format\n * @param frames ReactNativeFrame[]\n */\nasync function convertReactNativeFramesToSentryFrames(frames: ReactNative.StackFrame[]): Promise<SentryStackFrame[]> {\n return Promise.all(\n frames.map(async (frame: ReactNative.StackFrame): Promise<SentryStackFrame> => {\n let inApp = !!frame.column && !!frame.lineNumber;\n inApp =\n inApp &&\n frame.file !== undefined &&\n !frame.file.includes('node_modules') &&\n !frame.file.includes('native code');\n\n const newFrame: SentryStackFrame = {\n lineno: frame.lineNumber,\n colno: frame.column,\n filename: frame.file,\n function: frame.methodName,\n in_app: inApp,\n };\n\n if (inApp) {\n await addSourceContext(newFrame);\n }\n\n return newFrame;\n }),\n );\n}\n\n/**\n * Replaces the frames in the exception of a error.\n * @param event Event\n * @param frames StackFrame[]\n */\nfunction replaceExceptionFramesInException(exception: Exception, frames: SentryStackFrame[]): void {\n if (exception?.stacktrace) {\n exception.stacktrace.frames = frames.reverse();\n }\n}\n\n/**\n * Replaces the frames in the thread of a message.\n * @param event Event\n * @param frames StackFrame[]\n */\nfunction replaceThreadFramesInEvent(event: Event, frames: SentryStackFrame[]): void {\n if (event.threads && event.threads.values && event.threads.values[0] && event.threads.values[0].stacktrace) {\n event.threads.values[0].stacktrace.frames = frames.reverse();\n }\n}\n\n/**\n * This tries to add source context for in_app Frames\n *\n * @param frame StackFrame\n * @param getDevServer function from RN to get DevServer URL\n */\nasync function addSourceContext(frame: SentryStackFrame): Promise<void> {\n let sourceContext: string | null = null;\n\n const segments = frame.filename?.split('/') ?? [];\n\n const serverUrl = getDevServer()?.url;\n if (!serverUrl) {\n return;\n }\n\n for (const idx in segments) {\n if (!Object.prototype.hasOwnProperty.call(segments, idx)) {\n continue;\n }\n\n sourceContext = await fetchSourceContext(serverUrl, segments, -idx);\n if (sourceContext) {\n break;\n }\n }\n\n if (!sourceContext) {\n return;\n }\n\n const lines = sourceContext.split('\\n');\n addContextToFrame(lines, frame);\n}\n\n/**\n * Return a list containing the original exception and also the cause if found.\n *\n * @param originalException The original exception.\n */\nfunction getExceptionGroup(originalException: unknown): (Error & { stack: string })[] {\n const err = originalException as ExtendedError;\n const errorGroup: (Error & { stack: string })[] = [];\n for (let cause: ExtendedError | undefined = err; isErrorLike(cause); cause = cause.cause) {\n errorGroup.push(cause);\n }\n return errorGroup;\n}\n"]}
|
package/dist/js/misc.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ type EnvelopeItemPayload = EnvelopeItem[1];
|
|
|
3
3
|
/**
|
|
4
4
|
* Extracts the hard crash information from the event exceptions.
|
|
5
5
|
* No exceptions or undefined handled are not hard crashes.
|
|
6
|
+
*
|
|
7
|
+
* Hard crashes are only unhandled error, not user set unhandled mechanisms.
|
|
6
8
|
*/
|
|
7
9
|
export declare function isHardCrash(payload: EnvelopeItemPayload): boolean;
|
|
8
10
|
export {};
|
package/dist/js/misc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../src/js/misc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,eAAe,CAAC;AAE7D,KAAK,mBAAmB,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;AAE3C
|
|
1
|
+
{"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../src/js/misc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,eAAe,CAAC;AAE7D,KAAK,mBAAmB,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;AAE3C;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CASjE"}
|
package/dist/js/misc.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Extracts the hard crash information from the event exceptions.
|
|
3
3
|
* No exceptions or undefined handled are not hard crashes.
|
|
4
|
+
*
|
|
5
|
+
* Hard crashes are only unhandled error, not user set unhandled mechanisms.
|
|
4
6
|
*/
|
|
5
7
|
export function isHardCrash(payload) {
|
|
6
|
-
var _a
|
|
8
|
+
var _a;
|
|
7
9
|
const values = typeof payload !== 'string' && 'exception' in payload && ((_a = payload.exception) === null || _a === void 0 ? void 0 : _a.values) ? payload.exception.values : [];
|
|
8
10
|
for (const exception of values) {
|
|
9
|
-
if (
|
|
11
|
+
if (exception.mechanism && exception.mechanism.handled === false && exception.mechanism.type === 'onerror') {
|
|
10
12
|
return true;
|
|
11
13
|
}
|
|
12
14
|
}
|
package/dist/js/misc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"misc.js","sourceRoot":"","sources":["../../src/js/misc.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"misc.js","sourceRoot":"","sources":["../../src/js/misc.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,OAA4B;;IACtD,MAAM,MAAM,GACV,OAAO,OAAO,KAAK,QAAQ,IAAI,WAAW,IAAI,OAAO,KAAI,MAAA,OAAO,CAAC,SAAS,0CAAE,MAAM,CAAA,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrH,KAAK,MAAM,SAAS,IAAI,MAAM,EAAE;QAC9B,IAAI,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC,SAAS,CAAC,OAAO,KAAK,KAAK,IAAI,SAAS,CAAC,SAAS,CAAC,IAAI,KAAK,SAAS,EAAE;YAC1G,OAAO,IAAI,CAAC;SACb;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import type { EnvelopeItem, Exception } from '@sentry/types';\n\ntype EnvelopeItemPayload = EnvelopeItem[1];\n\n/**\n * Extracts the hard crash information from the event exceptions.\n * No exceptions or undefined handled are not hard crashes.\n *\n * Hard crashes are only unhandled error, not user set unhandled mechanisms.\n */\nexport function isHardCrash(payload: EnvelopeItemPayload): boolean {\n const values: Exception[] =\n typeof payload !== 'string' && 'exception' in payload && payload.exception?.values ? payload.exception.values : [];\n for (const exception of values) {\n if (exception.mechanism && exception.mechanism.handled === false && exception.mechanism.type === 'onerror') {\n return true;\n }\n }\n return false;\n}\n"]}
|
|
@@ -3,12 +3,23 @@ export declare const MOBILE_REPLAY_INTEGRATION_NAME = "MobileReplay";
|
|
|
3
3
|
export interface MobileReplayOptions {
|
|
4
4
|
/**
|
|
5
5
|
* Mask all text in recordings
|
|
6
|
+
*
|
|
7
|
+
* @default true
|
|
6
8
|
*/
|
|
7
9
|
maskAllText?: boolean;
|
|
8
10
|
/**
|
|
9
11
|
* Mask all text in recordings
|
|
12
|
+
*
|
|
13
|
+
* @default true
|
|
10
14
|
*/
|
|
11
15
|
maskAllImages?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Mask all vector graphics in recordings
|
|
18
|
+
* Supports `react-native-svg`
|
|
19
|
+
*
|
|
20
|
+
* @default true
|
|
21
|
+
*/
|
|
22
|
+
maskAllVectors?: boolean;
|
|
12
23
|
}
|
|
13
24
|
type MobileReplayIntegration = IntegrationFnResult & {
|
|
14
25
|
options: Required<MobileReplayOptions>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobilereplay.d.ts","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyC,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAShG,eAAO,MAAM,8BAA8B,iBAAiB,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC
|
|
1
|
+
{"version":3,"file":"mobilereplay.d.ts","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyC,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAShG,eAAO,MAAM,8BAA8B,iBAAiB,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAQD,KAAK,uBAAuB,GAAG,mBAAmB,GAAG;IACnD,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uBAAuB,iBAAiB,mBAAmB,KAAoB,uBAuE3F,CAAC"}
|