@sentry/react-native 5.3.0 → 5.3.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 +23 -0
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +13 -0
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/breadcrumb.d.ts.map +1 -1
- package/dist/js/breadcrumb.js.map +1 -1
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +4 -5
- package/dist/js/client.js.map +1 -1
- package/dist/js/index.d.ts +1 -2
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +1 -5
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js +1 -3
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/devicecontext.d.ts.map +1 -1
- package/dist/js/integrations/devicecontext.js +2 -4
- package/dist/js/integrations/devicecontext.js.map +1 -1
- package/dist/js/integrations/eventorigin.js +1 -1
- package/dist/js/integrations/eventorigin.js.map +1 -1
- package/dist/js/integrations/factory.d.ts.map +1 -1
- package/dist/js/integrations/factory.js +3 -1
- package/dist/js/integrations/factory.js.map +1 -1
- package/dist/js/integrations/modulesloader.d.ts.map +1 -1
- package/dist/js/integrations/modulesloader.js.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.js +2 -2
- package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
- package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeinfo.js +1 -2
- package/dist/js/integrations/reactnativeinfo.js.map +1 -1
- package/dist/js/integrations/rewriteframes.d.ts.map +1 -1
- package/dist/js/integrations/rewriteframes.js +2 -5
- package/dist/js/integrations/rewriteframes.js.map +1 -1
- package/dist/js/integrations/screenshot.d.ts.map +1 -1
- package/dist/js/integrations/screenshot.js +2 -6
- package/dist/js/integrations/screenshot.js.map +1 -1
- package/dist/js/integrations/sdkinfo.js.map +1 -1
- package/dist/js/integrations/viewhierarchy.js.map +1 -1
- package/dist/js/measurements.d.ts +2 -3
- package/dist/js/measurements.d.ts.map +1 -1
- package/dist/js/measurements.js +5 -8
- package/dist/js/measurements.js.map +1 -1
- package/dist/js/misc.d.ts.map +1 -1
- package/dist/js/misc.js +1 -3
- package/dist/js/misc.js.map +1 -1
- package/dist/js/options.d.ts +6 -6
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/scope.d.ts +2 -2
- package/dist/js/scope.d.ts.map +1 -1
- package/dist/js/scope.js +4 -4
- package/dist/js/scope.js.map +1 -1
- package/dist/js/tools/ModulesCollector.d.ts.map +1 -1
- package/dist/js/tools/ModulesCollector.js +3 -7
- package/dist/js/tools/ModulesCollector.js.map +1 -1
- package/dist/js/tools/collectModules.js +1 -3
- package/dist/js/tools/collectModules.js.map +1 -1
- package/dist/js/tracing/gesturetracing.d.ts.map +1 -1
- package/dist/js/tracing/gesturetracing.js +4 -2
- package/dist/js/tracing/gesturetracing.js.map +1 -1
- package/dist/js/tracing/index.d.ts +3 -3
- package/dist/js/tracing/index.d.ts.map +1 -1
- package/dist/js/tracing/index.js +2 -2
- package/dist/js/tracing/index.js.map +1 -1
- package/dist/js/tracing/nativeframes.d.ts +4 -4
- package/dist/js/tracing/nativeframes.d.ts.map +1 -1
- package/dist/js/tracing/nativeframes.js +15 -15
- package/dist/js/tracing/nativeframes.js.map +1 -1
- package/dist/js/tracing/ops.d.ts.map +1 -1
- package/dist/js/tracing/ops.js.map +1 -1
- package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnativenavigation.js +4 -11
- package/dist/js/tracing/reactnativenavigation.js.map +1 -1
- package/dist/js/tracing/reactnativetracing.d.ts +2 -2
- package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
- package/dist/js/tracing/reactnativetracing.js +20 -16
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/tracing/reactnavigationv4.d.ts.map +1 -1
- package/dist/js/tracing/reactnavigationv4.js +1 -2
- package/dist/js/tracing/reactnavigationv4.js.map +1 -1
- 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 +1 -1
- package/dist/js/tracing/stalltracking.d.ts.map +1 -1
- package/dist/js/tracing/stalltracking.js +9 -17
- package/dist/js/tracing/stalltracking.js.map +1 -1
- package/dist/js/tracing/transaction.d.ts.map +1 -1
- package/dist/js/tracing/transaction.js +2 -1
- package/dist/js/tracing/transaction.js.map +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 +1 -1
- 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.map +1 -1
- package/dist/js/transports/TextEncoder.js.map +1 -1
- package/dist/js/transports/native.d.ts +1 -1
- package/dist/js/transports/native.d.ts.map +1 -1
- package/dist/js/transports/native.js +1 -1
- package/dist/js/transports/native.js.map +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.map +1 -1
- package/dist/js/utils/envelope.js +5 -2
- package/dist/js/utils/envelope.js.map +1 -1
- package/dist/js/utils/outcome.js +1 -1
- package/dist/js/utils/outcome.js.map +1 -1
- package/dist/js/utils/safe.d.ts.map +1 -1
- package/dist/js/utils/safe.js +1 -3
- package/dist/js/utils/safe.js.map +1 -1
- package/dist/js/vendor/buffer/index.d.ts +1 -1
- package/dist/js/vendor/buffer/index.d.ts.map +1 -1
- package/dist/js/vendor/buffer/index.js +1 -1
- package/dist/js/vendor/buffer/index.js.map +1 -1
- package/dist/js/vendor/buffer/utf8ToBytes.d.ts +0 -5
- package/dist/js/vendor/buffer/utf8ToBytes.d.ts.map +1 -1
- package/dist/js/vendor/buffer/utf8ToBytes.js +29 -16
- package/dist/js/vendor/buffer/utf8ToBytes.js.map +1 -1
- package/dist/js/vendor/index.d.ts +1 -1
- package/dist/js/vendor/index.d.ts.map +1 -1
- package/dist/js/vendor/index.js +1 -1
- package/dist/js/vendor/index.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.d.ts.map +1 -1
- package/dist/js/wrapper.js +7 -17
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.mm +6 -3
- package/package.json +18 -13
- package/sentry.gradle +12 -7
- package/src/js/NativeRNSentry.ts +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.3.1
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- Disable `enableNativeCrashHandling` and `enableAutoPerformanceTracing` on Apple ([#2936](https://github.com/getsentry/sentry-react-native/pull/))
|
|
8
|
+
- Mac Catalyst builds successfully
|
|
9
|
+
- `sentry.gradle` Gracefully skip modules collecting if the script doesn't exist ([#2952](https://github.com/getsentry/sentry-react-native/pull/2952))
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
- Bump JavaScript SDK from v7.45.0 to v7.47.0 ([#2946](https://github.com/getsentry/sentry-react-native/pull/2946), [#2958](https://github.com/getsentry/sentry-react-native/pull/2958))
|
|
14
|
+
- [changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#7470)
|
|
15
|
+
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.45.0...7.47.0)
|
|
16
|
+
- Bump Android SDK from v6.16.0 to v6.17.0 ([#2948](https://github.com/getsentry/sentry-react-native/pull/2948))
|
|
17
|
+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#6170)
|
|
18
|
+
- [diff](https://github.com/getsentry/sentry-java/compare/6.16.0...6.17.0)
|
|
19
|
+
- Bump Cocoa SDK from v8.3.3 to v8.4.0 ([#2954](https://github.com/getsentry/sentry-react-native/pull/2954))
|
|
20
|
+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#840)
|
|
21
|
+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.3.3...8.4.0)
|
|
22
|
+
- Bump CLI from v2.16.1 to v2.17.1 ([#2957](https://github.com/getsentry/sentry-react-native/pull/2957), [#2964](https://github.com/getsentry/sentry-react-native/pull/2964))
|
|
23
|
+
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2171)
|
|
24
|
+
- [diff](https://github.com/getsentry/sentry-cli/compare/2.16.1...2.17.1)
|
|
25
|
+
|
|
3
26
|
## 5.3.0
|
|
4
27
|
|
|
5
28
|
### Features
|
package/RNSentry.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -10,6 +10,7 @@ import android.content.res.AssetManager;
|
|
|
10
10
|
import android.util.SparseIntArray;
|
|
11
11
|
|
|
12
12
|
import androidx.annotation.Nullable;
|
|
13
|
+
import androidx.annotation.NonNull;
|
|
13
14
|
import androidx.core.app.FrameMetricsAggregator;
|
|
14
15
|
|
|
15
16
|
import com.facebook.react.bridge.Arguments;
|
|
@@ -51,6 +52,7 @@ import io.sentry.UncaughtExceptionHandlerIntegration;
|
|
|
51
52
|
import io.sentry.android.core.AndroidLogger;
|
|
52
53
|
import io.sentry.android.core.AnrIntegration;
|
|
53
54
|
import io.sentry.android.core.AppStartState;
|
|
55
|
+
import io.sentry.android.core.BuildConfig;
|
|
54
56
|
import io.sentry.android.core.BuildInfoProvider;
|
|
55
57
|
import io.sentry.android.core.CurrentActivityHolder;
|
|
56
58
|
import io.sentry.android.core.NdkIntegration;
|
|
@@ -102,6 +104,17 @@ public class RNSentryModuleImpl {
|
|
|
102
104
|
|
|
103
105
|
public void initNativeSdk(final ReadableMap rnOptions, Promise promise) {
|
|
104
106
|
SentryAndroid.init(this.getReactApplicationContext(), options -> {
|
|
107
|
+
@NonNull final String sdkName = "sentry.java.android.react-native";
|
|
108
|
+
@Nullable SdkVersion sdkVersion = options.getSdkVersion();
|
|
109
|
+
if (sdkVersion == null) {
|
|
110
|
+
sdkVersion = new SdkVersion(sdkName, BuildConfig.VERSION_NAME);
|
|
111
|
+
} else {
|
|
112
|
+
sdkVersion.setName(sdkName);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
options.setSentryClientName(sdkVersion.getName() + "/" + sdkVersion.getVersion());
|
|
116
|
+
options.setSdkVersion(sdkVersion);
|
|
117
|
+
|
|
105
118
|
if (rnOptions.hasKey("debug") && rnOptions.getBoolean("debug")) {
|
|
106
119
|
options.setDebug(true);
|
|
107
120
|
}
|
|
@@ -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,
|
|
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;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAI9E,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,aAAa,CAAC,UAA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;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,oBAAY,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;
|
|
1
|
+
{"version":3,"file":"NativeRNSentry.js","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAwFnD,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';\nimport type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';\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 addBreadcrumb(breadcrumb: UnsafeObject): void;\n captureEnvelope(\n bytes: number[],\n options: {\n store: boolean;\n },\n ): Promise<boolean>;\n captureScreenshot(): Promise<NativeScreenshot[]>;\n clearBreadcrumbs(): void;\n crash(): void;\n closeNativeSdk(): Promise<void>;\n disableNativeFramesTracking(): void;\n fetchNativeRelease(): Promise<NativeReleaseResponse>;\n fetchNativeSdkInfo(): Promise<Package>;\n fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse>;\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}\n\nexport type NativeAppStartResponse = {\n isColdStart: boolean;\n appStartTime: number;\n didFetchAppStart: boolean;\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. (This is not used for Android)\n * https://github.com/getsentry/sentry-cocoa/blob/master/Sources/Sentry/SentryScope.m\n */\nexport type NativeDeviceContextsResponse = {\n [key: string]: unknown;\n tags?: Record<string, string>;\n extra?: Record<string, unknown>;\n context?: 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":"breadcrumb.d.ts","sourceRoot":"","sources":["../../src/js/breadcrumb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG/D,eAAO,MAAM,wBAAwB,EAAE,aAAsB,CAAC;AAE9D,aAAK,mBAAmB,GAAG;KACxB,CAAC,IAAI,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,OAAO;CAC1C,
|
|
1
|
+
{"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../src/js/breadcrumb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG/D,eAAO,MAAM,wBAAwB,EAAE,aAAsB,CAAC;AAE9D,aAAK,mBAAmB,GAAG;KACxB,CAAC,IAAI,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,OAAO;CAC1C,CAAC;AAEF;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,mBAAmB,GAAG,UAAU,CA6B/E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb.js","sourceRoot":"","sources":["../../src/js/breadcrumb.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,MAAM,CAAC,MAAM,wBAAwB,GAAkB,MAAM,CAAC;AAM9D;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAA8B;IACjE,MAAM,UAAU,GAAe,EAAE,CAAC;IAElC,IAAI,OAAO,SAAS,CAAC,IAAI,KAAK,QAAQ,EAAE;QACtC,UAAU,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;KAClC;IACD,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,EAAE;QACvC,UAAU,CAAC,KAAK,GAAG,uBAAuB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;KAC7D;IACD,IAAI,OAAO,SAAS,CAAC,QAAQ,KAAK,QAAQ,EAAE;QAC1C,UAAU,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;KAC1C;IACD,IAAI,OAAO,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AAS,CAAC,QAAQ,CAAC;KAC1C;IACD,IAAI,OAAO,SAAS,CAAC,OAAO,KAAK,QAAQ,EAAE;QACzC,UAAU,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;KACxC;IACD,IAAI,OAAO,SAAS,CAAC,IAAI,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,EAAE;QACjE,UAAU,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;KAClC;IACD,IAAI,OAAO,SAAS,CAAC,SAAS,KAAK,QAAQ,EAAE;QAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAClD,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE;YACrB,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC;SAClC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import type { Breadcrumb, SeverityLevel } from '@sentry/types';\nimport { severityLevelFromString } from '@sentry/utils';\n\nexport const DEFAULT_BREADCRUMB_LEVEL: SeverityLevel = 'info';\n\ntype BreadcrumbCandidate = {\n [K in keyof Partial<Breadcrumb>]: unknown;\n};\n\n/**\n * Convert plain object to a valid Breadcrumb\n */\nexport function breadcrumbFromObject(candidate: BreadcrumbCandidate): Breadcrumb {\n const breadcrumb: Breadcrumb = {};\n\n if (typeof candidate.type === 'string') {\n breadcrumb.type = candidate.type;\n }\n if (typeof candidate.level === 'string') {\n breadcrumb.level = severityLevelFromString(candidate.level);\n }\n if (typeof candidate.event_id === 'string') {\n breadcrumb.event_id = candidate.event_id;\n }\n if (typeof candidate.category === 'string') {\n breadcrumb.category = candidate.category;\n }\n if (typeof candidate.message === 'string') {\n breadcrumb.message = candidate.message;\n }\n if (typeof candidate.data === 'object' && candidate.data !== null) {\n breadcrumb.data = candidate.data;\n }\n if (typeof candidate.timestamp === 'string') {\n const timestamp = Date.parse(candidate.timestamp);\n if (!isNaN(timestamp)) {\n breadcrumb.timestamp = timestamp;\n }\n }\n\n return breadcrumb;\n}\n"]}
|
package/dist/js/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAGV,QAAQ,EACR,KAAK,EACL,SAAS,EAGT,aAAa,EAEb,YAAY,EACb,MAAM,eAAe,CAAC;AAOvB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAO1D;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,UAAU,CAAC,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAGV,QAAQ,EACR,KAAK,EACL,SAAS,EAGT,aAAa,EAEb,YAAY,EACb,MAAM,eAAe,CAAC;AAOvB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAO1D;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,UAAU,CAAC,wBAAwB,CAAC;IACzE,OAAO,CAAC,eAAe,CAAY;IAEnC;;;OAGG;gBACgB,OAAO,EAAE,wBAAwB;IAUpD;;OAEG;IACI,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,GAAE,SAAc,GAAG,WAAW,CAAC,KAAK,CAAC;IAMvF;;OAEG;IACI,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAmBrG;;;OAGG;IACI,WAAW,IAAI,IAAI;IAI1B;;OAEG;IACI,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC;IAOpC;;OAEG;IACI,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IASxD;;OAEG;IACI,iBAAiB,IAAI,IAAI;IAShC;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IA6BjD;;OAEG;YACW,cAAc;IAgB5B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAShC;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAa9B"}
|
package/dist/js/client.js
CHANGED
|
@@ -34,8 +34,7 @@ export class ReactNativeClient extends BaseClient {
|
|
|
34
34
|
* @inheritDoc
|
|
35
35
|
*/
|
|
36
36
|
eventFromException(exception, hint = {}) {
|
|
37
|
-
return Screenshot.attachScreenshotToEventHint(hint, this._options)
|
|
38
|
-
.then(hintWithScreenshot => eventFromException(this._options.stackParser, exception, hintWithScreenshot, this._options.attachStacktrace));
|
|
37
|
+
return Screenshot.attachScreenshotToEventHint(hint, this._options).then(hintWithScreenshot => eventFromException(this._options.stackParser, exception, hintWithScreenshot, this._options.attachStacktrace));
|
|
39
38
|
}
|
|
40
39
|
/**
|
|
41
40
|
* @inheritDoc
|
|
@@ -105,9 +104,9 @@ export class ReactNativeClient extends BaseClient {
|
|
|
105
104
|
}
|
|
106
105
|
let shouldClearOutcomesBuffer = true;
|
|
107
106
|
if (this._transport && this._dsn) {
|
|
108
|
-
this._transport.send(envelope)
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
this._transport.send(envelope).then(null, reason => {
|
|
108
|
+
if (reason instanceof SentryError) {
|
|
109
|
+
// SentryError is thrown by SyncPromise
|
|
111
110
|
shouldClearOutcomesBuffer = false;
|
|
112
111
|
// If this is called asynchronously we want the _outcomesBuffer to be cleared
|
|
113
112
|
logger.error('SentryError while sending event, keeping outcomes buffer:', reason);
|
package/dist/js/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"m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,CAAC;YAEF,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SACxC;IACH,CAAC;CACF","sourcesContent":["import { eventFromException, eventFromMessage } from '@sentry/browser';\nimport { BaseClient } from '@sentry/core';\nimport type {\n ClientReportEnvelope,\n ClientReportItem,\n Envelope,\n Event,\n EventHint,\n Exception,\n Outcome,\n SeverityLevel,\n Thread,\n UserFeedback,\n} from '@sentry/types';\nimport { dateTimestampInSeconds, logger, SentryError } from '@sentry/utils';\nimport { Alert } from 'react-native';\n\nimport { createIntegration } from './integrations/factory';\nimport { Screenshot } from './integrations/screenshot';\nimport { defaultSdkInfo } from './integrations/sdkinfo';\nimport type { ReactNativeClientOptions } from './options';\nimport { ReactNativeTracing } from './tracing';\nimport { createUserFeedbackEnvelope, items } from './utils/envelope';\nimport { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';\nimport { mergeOutcomes } from './utils/outcome';\nimport { NATIVE } from './wrapper';\n\n/**\n * The Sentry React Native SDK Client.\n *\n * @see ReactNativeClientOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {\n\n private _outcomesBuffer: Outcome[];\n\n /**\n * Creates a new React Native SDK instance.\n * @param options Configuration options for this SDK.\n */\n public constructor(options: ReactNativeClientOptions) {\n ignoreRequireCycleLogs();\n options._metadata = options._metadata || {};\n options._metadata.sdk = options._metadata.sdk || defaultSdkInfo;\n super(options);\n\n this._outcomesBuffer = [];\n void this._initNativeSdk();\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint: EventHint = {}): PromiseLike<Event> {\n return Screenshot.attachScreenshotToEventHint(hint, this._options)\n .then(hintWithScreenshot => eventFromException(\n this._options.stackParser,\n exception,\n hintWithScreenshot,\n this._options.attachStacktrace,\n ));\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level?: SeverityLevel, hint?: EventHint): PromiseLike<Event> {\n return eventFromMessage(\n this._options.stackParser,\n message,\n level,\n hint,\n this._options.attachStacktrace,\n ).then((event: Event) => {\n // TMP! Remove this function once JS SDK uses threads for messages\n if (!event.exception?.values || event.exception.values.length <= 0) {\n return event;\n }\n const values = event.exception.values.map((exception: Exception): Thread => ({\n stacktrace: exception.stacktrace,\n }));\n (event as { threads?: { values: Thread[] } }).threads = { values };\n delete event.exception;\n return event;\n });\n }\n\n /**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\n public nativeCrash(): void {\n NATIVE.nativeCrash();\n }\n\n /**\n * @inheritDoc\n */\n public close(): PromiseLike<boolean> {\n // As super.close() flushes queued events, we wait for that to finish before closing the native SDK.\n return super.close().then((result: boolean) => {\n return NATIVE.closeNativeSdk().then(() => result) as PromiseLike<boolean>;\n });\n }\n\n /**\n * Sends user feedback to Sentry.\n */\n public captureUserFeedback(feedback: UserFeedback): void {\n const envelope = createUserFeedbackEnvelope(\n feedback,\n {\n metadata: this._options._metadata,\n dsn: this.getDsn(),\n tunnel: this._options.tunnel,\n },\n );\n this._sendEnvelope(envelope);\n }\n\n /**\n * Sets up the integrations\n */\n public setupIntegrations(): void {\n super.setupIntegrations();\n const tracing = this.getIntegration(ReactNativeTracing);\n const routingName = tracing?.options.routingInstrumentation?.name\n if (routingName) {\n this.addIntegration(createIntegration(routingName));\n }\n }\n\n /**\n * @inheritdoc\n */\n protected _sendEnvelope(envelope: Envelope): void {\n const outcomes = this._clearOutcomes();\n this._outcomesBuffer = mergeOutcomes(this._outcomesBuffer, outcomes);\n\n if (this._options.sendClientReports) {\n this._attachClientReportTo(this._outcomesBuffer, envelope as ClientReportEnvelope);\n }\n\n let shouldClearOutcomesBuffer = true;\n if (this._transport && this._dsn) {\n this._transport.send(envelope)\n .then(null, reason => {\n if (reason instanceof SentryError) { // SentryError is thrown by SyncPromise\n shouldClearOutcomesBuffer = false;\n // If this is called asynchronously we want the _outcomesBuffer to be cleared\n logger.error('SentryError while sending event, keeping outcomes buffer:', reason);\n } else {\n logger.error('Error while sending event:', reason);\n }\n });\n } else {\n logger.error('Transport disabled');\n }\n\n if (shouldClearOutcomesBuffer) {\n this._outcomesBuffer = []; // if send fails synchronously the _outcomesBuffer will stay intact\n }\n }\n\n /**\n * Starts native client with dsn and options\n */\n private async _initNativeSdk(): Promise<void> {\n let didCallNativeInit = false;\n\n try {\n didCallNativeInit = await NATIVE.initNativeSdk(this._options);\n } catch (_) {\n this._showCannotConnectDialog();\n } finally {\n try {\n this._options.onReady?.({ didCallNativeInit });\n } catch (error) {\n logger.error('The OnReady callback threw an error: ', error);\n }\n }\n }\n\n /**\n * If the user is in development mode, and the native nagger is enabled then it will show an alert.\n */\n private _showCannotConnectDialog(): void {\n if (__DEV__ && this._options.enableNativeNagger) {\n Alert.alert(\n 'Sentry',\n 'Warning, could not connect to Sentry native SDK.\\nIf you do not want to use the native component please pass `enableNative: false` in the options.\\nVisit: https://docs.sentry.io/platforms/react-native/#linking for more details.'\n );\n }\n }\n\n /**\n * Attaches a client report from outcomes to the envelope.\n */\n private _attachClientReportTo(outcomes: Outcome[], envelope: ClientReportEnvelope): void {\n if (outcomes.length > 0) {\n const clientReportItem: ClientReportItem = [\n { type: 'client_report' },\n {\n timestamp: dateTimestampInSeconds(),\n discarded_events: outcomes,\n },\n ];\n\n envelope[items].push(clientReportItem);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAa1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,U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G,EAAE,CAAC,CAAC,mEAAmE;SAC/F;IACH,CAAC;IAED;;OAEG;IACW,cAAc;;;YAC1B,IAAI,iBAAiB,GAAG,KAAK,CAAC;YAE9B,IAAI;gBACF,iBAAiB,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAC/D;YAAC,OAAO,CAAC,EAAE;gBACV,IAAI,CAAC,wBAAwB,EAAE,CAAC;aACjC;oBAAS;gBACR,IAAI;oBACF,MAAA,MAAA,IAAI,CAAC,QAAQ,EAAC,OAAO,mDAAG,EAAE,iBAAiB,EAAE,EAAE;iBAChD;gBAAC,OAAO,KAAK,EAAE;oBACd,MAAM,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;iBAC9D;aACF;;KACF;IAED;;OAEG;IACK,wBAAwB;QAC9B,IAAI,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE;YAC/C,KAAK,CAAC,KAAK,CACT,QAAQ,EACR,qOAAqO,CACtO,CAAC;SACH;IACH,CAAC;IAED;;OAEG;IACK,qBAAqB,CAAC,QAAmB,EAAE,QAA8B;QAC/E,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,MAAM,gBAAgB,GAAqB;gBACzC,EAAE,IAAI,EAAE,eAAe,EAAE;gBACzB;oBACE,SAAS,EAAE,sBAAsB,EAAE;oBACnC,gBAAgB,EAAE,QAAQ;iBAC3B;aACF,CAAC;YAEF,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SACxC;IACH,CAAC;CACF","sourcesContent":["import { eventFromException, eventFromMessage } from '@sentry/browser';\nimport { BaseClient } from '@sentry/core';\nimport type {\n ClientReportEnvelope,\n ClientReportItem,\n Envelope,\n Event,\n EventHint,\n Exception,\n Outcome,\n SeverityLevel,\n Thread,\n UserFeedback,\n} from '@sentry/types';\nimport { dateTimestampInSeconds, logger, SentryError } from '@sentry/utils';\nimport { Alert } from 'react-native';\n\nimport { createIntegration } from './integrations/factory';\nimport { Screenshot } from './integrations/screenshot';\nimport { defaultSdkInfo } from './integrations/sdkinfo';\nimport type { ReactNativeClientOptions } from './options';\nimport { ReactNativeTracing } from './tracing';\nimport { createUserFeedbackEnvelope, items } from './utils/envelope';\nimport { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';\nimport { mergeOutcomes } from './utils/outcome';\nimport { NATIVE } from './wrapper';\n\n/**\n * The Sentry React Native SDK Client.\n *\n * @see ReactNativeClientOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {\n private _outcomesBuffer: Outcome[];\n\n /**\n * Creates a new React Native SDK instance.\n * @param options Configuration options for this SDK.\n */\n public constructor(options: ReactNativeClientOptions) {\n ignoreRequireCycleLogs();\n options._metadata = options._metadata || {};\n options._metadata.sdk = options._metadata.sdk || defaultSdkInfo;\n super(options);\n\n this._outcomesBuffer = [];\n void this._initNativeSdk();\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint: EventHint = {}): PromiseLike<Event> {\n return Screenshot.attachScreenshotToEventHint(hint, this._options).then(hintWithScreenshot =>\n eventFromException(this._options.stackParser, exception, hintWithScreenshot, this._options.attachStacktrace),\n );\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level?: SeverityLevel, hint?: EventHint): PromiseLike<Event> {\n return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace).then(\n (event: Event) => {\n // TMP! Remove this function once JS SDK uses threads for messages\n if (!event.exception?.values || event.exception.values.length <= 0) {\n return event;\n }\n const values = event.exception.values.map(\n (exception: Exception): Thread => ({\n stacktrace: exception.stacktrace,\n }),\n );\n (event as { threads?: { values: Thread[] } }).threads = { values };\n delete event.exception;\n return event;\n },\n );\n }\n\n /**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\n public nativeCrash(): void {\n NATIVE.nativeCrash();\n }\n\n /**\n * @inheritDoc\n */\n public close(): PromiseLike<boolean> {\n // As super.close() flushes queued events, we wait for that to finish before closing the native SDK.\n return super.close().then((result: boolean) => {\n return NATIVE.closeNativeSdk().then(() => result) as PromiseLike<boolean>;\n });\n }\n\n /**\n * Sends user feedback to Sentry.\n */\n public captureUserFeedback(feedback: UserFeedback): void {\n const envelope = createUserFeedbackEnvelope(feedback, {\n metadata: this._options._metadata,\n dsn: this.getDsn(),\n tunnel: this._options.tunnel,\n });\n this._sendEnvelope(envelope);\n }\n\n /**\n * Sets up the integrations\n */\n public setupIntegrations(): void {\n super.setupIntegrations();\n const tracing = this.getIntegration(ReactNativeTracing);\n const routingName = tracing?.options.routingInstrumentation?.name;\n if (routingName) {\n this.addIntegration(createIntegration(routingName));\n }\n }\n\n /**\n * @inheritdoc\n */\n protected _sendEnvelope(envelope: Envelope): void {\n const outcomes = this._clearOutcomes();\n this._outcomesBuffer = mergeOutcomes(this._outcomesBuffer, outcomes);\n\n if (this._options.sendClientReports) {\n this._attachClientReportTo(this._outcomesBuffer, envelope as ClientReportEnvelope);\n }\n\n let shouldClearOutcomesBuffer = true;\n if (this._transport && this._dsn) {\n this._transport.send(envelope).then(null, reason => {\n if (reason instanceof SentryError) {\n // SentryError is thrown by SyncPromise\n shouldClearOutcomesBuffer = false;\n // If this is called asynchronously we want the _outcomesBuffer to be cleared\n logger.error('SentryError while sending event, keeping outcomes buffer:', reason);\n } else {\n logger.error('Error while sending event:', reason);\n }\n });\n } else {\n logger.error('Transport disabled');\n }\n\n if (shouldClearOutcomesBuffer) {\n this._outcomesBuffer = []; // if send fails synchronously the _outcomesBuffer will stay intact\n }\n }\n\n /**\n * Starts native client with dsn and options\n */\n private async _initNativeSdk(): Promise<void> {\n let didCallNativeInit = false;\n\n try {\n didCallNativeInit = await NATIVE.initNativeSdk(this._options);\n } catch (_) {\n this._showCannotConnectDialog();\n } finally {\n try {\n this._options.onReady?.({ didCallNativeInit });\n } catch (error) {\n logger.error('The OnReady callback threw an error: ', error);\n }\n }\n }\n\n /**\n * If the user is in development mode, and the native nagger is enabled then it will show an alert.\n */\n private _showCannotConnectDialog(): void {\n if (__DEV__ && this._options.enableNativeNagger) {\n Alert.alert(\n 'Sentry',\n 'Warning, could not connect to Sentry native SDK.\\nIf you do not want to use the native component please pass `enableNative: false` in the options.\\nVisit: https://docs.sentry.io/platforms/react-native/#linking for more details.',\n );\n }\n }\n\n /**\n * Attaches a client report from outcomes to the envelope.\n */\n private _attachClientReportTo(outcomes: Outcome[], envelope: ClientReportEnvelope): void {\n if (outcomes.length > 0) {\n const clientReportItem: ClientReportItem = [\n { type: 'client_report' },\n {\n timestamp: dateTimestampInSeconds(),\n discarded_events: outcomes,\n },\n ];\n\n envelope[items].push(clientReportItem);\n }\n }\n}\n"]}
|
package/dist/js/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export { Breadcrumb, Request, SdkInfo, Event, Exception, StackFrame, Stacktrace, Thread, User, UserFeedback, } from '@sentry/types';
|
|
2
2
|
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, getHubFromCarrier, getCurrentHub, Hub, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startTransaction, } from '@sentry/core';
|
|
3
|
-
import '@sentry/tracing';
|
|
4
3
|
export { Integrations as BrowserIntegrations, ErrorBoundary, withErrorBoundary, createReduxEnhancer, Profiler, useProfiler, withProfiler, } from '@sentry/react';
|
|
5
|
-
export { lastEventId
|
|
4
|
+
export { lastEventId } from '@sentry/browser';
|
|
6
5
|
import * as Integrations from './integrations';
|
|
7
6
|
import { SDK_NAME, SDK_VERSION } from './version';
|
|
8
7
|
export { ReactNativeOptions } from './options';
|
package/dist/js/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,gBAAgB,GACjB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAKtB,OAAO,EACL,YAAY,IAAI,mBAAmB,EACnC,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EACL,IAAI,EACJ,IAAI,EAEJ,OAAO,EAEP,UAAU,EACV,WAAW,EACX,KAAK,EACL,KAAK,EACL,mBAAmB,EACnB,SAAS,EACT,cAAc,GACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EACL,kBAAkB,EAClB,gCAAgC,EAEhC,gCAAgC,EAChC,8BAA8B,EAC9B,oCAAoC,EACpC,sBAAsB,EACtB,iCAAiC,EACjC,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/js/index.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, getHubFromCarrier, getCurrentHub, Hub, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startTransaction, } from '@sentry/core';
|
|
2
|
-
// We need to import it so we patch the hub with global functions
|
|
3
|
-
// aka. this has side effects
|
|
4
|
-
import '@sentry/tracing';
|
|
5
|
-
// Add the React Native SDK's own tracing extensions, this needs to happen AFTER @sentry/tracing's
|
|
6
2
|
import { _addTracingExtensions } from './measurements';
|
|
7
3
|
_addTracingExtensions();
|
|
8
4
|
export { Integrations as BrowserIntegrations, ErrorBoundary, withErrorBoundary, createReduxEnhancer, Profiler, useProfiler, withProfiler, } from '@sentry/react';
|
|
9
|
-
export { lastEventId
|
|
5
|
+
export { lastEventId } from '@sentry/browser';
|
|
10
6
|
import * as Integrations from './integrations';
|
|
11
7
|
import { SDK_NAME, SDK_VERSION } from './version';
|
|
12
8
|
export { ReactNativeClient } from './client';
|
package/dist/js/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,qBAAqB,EAAE,CAAC;AAExB,OAAO,EACL,YAAY,IAAI,mBAAmB,EACnC,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EACL,IAAI,EACJ,IAAI;AACJ,mDAAmD;AACnD,OAAO;AACP,mDAAmD;AACnD,UAAU,EACV,WAAW,EACX,KAAK,EACL,KAAK,EACL,mBAAmB,EACnB,SAAS,EACT,cAAc,GACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EACL,kBAAkB,EAClB,gCAAgC;AAChC,mDAAmD;AACnD,gCAAgC,EAChC,8BAA8B,EAC9B,oCAAoC,EACpC,sBAAsB,EAEtB,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC","sourcesContent":["export {\n Breadcrumb,\n Request,\n SdkInfo,\n Event,\n Exception,\n StackFrame,\n Stacktrace,\n Thread,\n User,\n UserFeedback,\n} from '@sentry/types';\n\nexport {\n addGlobalEventProcessor,\n addBreadcrumb,\n captureException,\n captureEvent,\n captureMessage,\n getHubFromCarrier,\n getCurrentHub,\n Hub,\n Scope,\n setContext,\n setExtra,\n setExtras,\n setTag,\n setTags,\n setUser,\n startTransaction,\n} from '@sentry/core';\n\nimport { _addTracingExtensions } from './measurements';\n_addTracingExtensions();\n\nexport {\n Integrations as BrowserIntegrations,\n ErrorBoundary,\n withErrorBoundary,\n createReduxEnhancer,\n Profiler,\n useProfiler,\n withProfiler,\n} from '@sentry/react';\n\nexport { lastEventId } from '@sentry/browser';\n\nimport * as Integrations from './integrations';\nimport { SDK_NAME, SDK_VERSION } from './version';\nexport { ReactNativeOptions } from './options';\nexport { ReactNativeClient } from './client';\n\nexport {\n init,\n wrap,\n // eslint-disable-next-line deprecation/deprecation\n setDist,\n // eslint-disable-next-line deprecation/deprecation\n setRelease,\n nativeCrash,\n flush,\n close,\n captureUserFeedback,\n withScope,\n configureScope,\n} from './sdk';\nexport { TouchEventBoundary, withTouchEventBoundary } from './touchevents';\n\nexport {\n ReactNativeTracing,\n ReactNavigationV4Instrumentation,\n // eslint-disable-next-line deprecation/deprecation\n ReactNavigationV5Instrumentation,\n ReactNavigationInstrumentation,\n ReactNativeNavigationInstrumentation,\n RoutingInstrumentation,\n ReactNavigationTransactionContext,\n sentryTraceGesture,\n} from './tracing';\n\nexport { Integrations, SDK_NAME, SDK_VERSION };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugsymbolicator.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAoB,WAAW,EAAc,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"debugsymbolicator.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAoB,WAAW,EAAc,MAAM,eAAe,CAAC;AAoB/E;;GAEG;AACH,oBAAY,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,qBAAa,iBAAkB,YAAW,WAAW;IACnD;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAuB;IAC/C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAwB;IAE3C;;OAEG;IACI,SAAS,IAAI,IAAI;IA6BxB;;;OAGG;YACW,YAAY;IAiC1B;;;OAGG;YACW,uCAAuC;IA+CrD;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAW7B;;;;;OAKG;YACW,iBAAiB;CA0BhC"}
|
|
@@ -108,9 +108,7 @@ export class DebugSymbolicator {
|
|
|
108
108
|
if (newFrame.function) {
|
|
109
109
|
const addressAtPos = newFrame.function.indexOf('(address at');
|
|
110
110
|
if (addressAtPos >= 0) {
|
|
111
|
-
newFrame.function = newFrame.function
|
|
112
|
-
.substr(0, addressAtPos)
|
|
113
|
-
.trim();
|
|
111
|
+
newFrame.function = newFrame.function.substr(0, addressAtPos).trim();
|
|
114
112
|
}
|
|
115
113
|
}
|
|
116
114
|
if (inApp) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugsymbolicator.js","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEtE,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AAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;YACzB,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,EACpC;YACA,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;SAChE;IACH,CAAC;IAED;;;;;OAKG;IACW,iBAAiB,CAC7B,KAAiB,EACjB,YAA2B;;;YAE3B,IAAI,QAAQ,CAAC;YAEb,MAAM,QAAQ,eAAG,KAAK,CAAC,QAAQ,0CAAE,KAAK,CAAC,GAAG,oCAAK,EAAE,CAAC;YAElD,IAAI,YAAY,EAAE;gBAChB,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;oBAC1B,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE;wBACvD,QAAQ,GAAG,MAAM,KAAK,CACpB,GAAG,YAAY,EAAE,CAAC,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EACxD;4BACE,MAAM,EAAE,KAAK;yBACd,CACF,CAAC;wBAEF,IAAI,QAAQ,CAAC,EAAE,EAAE;4BACf,MAAM;yBACP;qBACF;iBACF;aACF;YAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,EAAE,EAAE;gBAC3B,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACtC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAElC,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;aACjC;;KACF;;AAjMD;;GAEG;AACW,oBAAE,GAAW,mBAAmB,CAAC","sourcesContent":["import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core';\nimport type { Event, EventHint, Integration, StackFrame } from '@sentry/types';\nimport { addContextToFrame, logger } from '@sentry/utils';\n\nconst INTERNAL_CALLSITES_REGEX = new RegExp(\n ['ReactNativeRenderer-dev\\\\.js$', 'MessageQueue\\\\.js$'].join('|')\n);\n\ninterface GetDevServer {\n (): { url: string };\n}\n\n/**\n * React Native Stack Frame\n */\ninterface ReactNativeFrame {\n // arguments: []\n column: number;\n file: string;\n lineNumber: number;\n methodName: string;\n}\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 class DebugSymbolicator implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'DebugSymbolicator';\n /**\n * @inheritDoc\n */\n public name: string = DebugSymbolicator.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor(async (event: Event, hint?: EventHint) => {\n const self = getCurrentHub().getIntegration(DebugSymbolicator);\n\n if (!self || hint === undefined || hint.originalException === undefined) {\n return event;\n }\n\n const reactError = hint.originalException as ReactNativeError;\n\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack');\n\n let stack;\n try {\n stack = parseErrorStack(reactError);\n } catch (e) {\n // In RN 0.64 `parseErrorStack` now only takes a string\n stack = parseErrorStack(reactError.stack);\n }\n\n await self._symbolicate(event, stack);\n\n event.platform = 'node'; // Setting platform node makes sure we do not show source maps errors\n\n return event;\n });\n }\n\n /**\n * Symbolicates the stack on the device talking to local dev server.\n * Mutates the passed event.\n */\n private async _symbolicate(\n event: Event,\n stack: string | undefined\n ): Promise<void> {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const symbolicateStackTrace = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');\n const prettyStack = await symbolicateStackTrace(stack);\n\n if (prettyStack) {\n let newStack = prettyStack;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (prettyStack.stack) {\n // This has been changed in an react-native version so stack is contained in here\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n newStack = prettyStack.stack;\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const stackWithoutInternalCallsites = newStack.filter(\n (frame: { file?: string }) =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n frame.file && frame.file.match(INTERNAL_CALLSITES_REGEX) === null\n );\n\n const symbolicatedFrames = await this._convertReactNativeFramesToSentryFrames(\n stackWithoutInternalCallsites\n );\n this._replaceFramesInEvent(event, symbolicatedFrames);\n } else {\n logger.error('The stack is null');\n }\n } catch (error) {\n if (error instanceof Error) {\n logger.warn(`Unable to symbolicate stack trace: ${error.message}`);\n }\n }\n }\n\n /**\n * Converts ReactNativeFrames to frames in the Sentry format\n * @param frames ReactNativeFrame[]\n */\n private async _convertReactNativeFramesToSentryFrames(\n frames: ReactNativeFrame[]\n ): Promise<StackFrame[]> {\n let getDevServer: GetDevServer;\n try {\n getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer');\n } catch (_oO) {\n // We can't load devserver URL\n }\n // Below you will find lines marked with :HACK to prevent showing errors in the sentry ui\n // But since this is a debug only feature: This is Fine (TM)\n return Promise.all(\n frames.map(\n async (frame: ReactNativeFrame): Promise<StackFrame> => {\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: StackFrame = {\n colno: frame.column,\n filename: frame.file,\n function: frame.methodName,\n in_app: inApp,\n lineno: inApp ? frame.lineNumber : undefined, // :HACK\n platform: inApp ? 'javascript' : 'node', // :HACK\n };\n\n // The upstream `react-native@0.61` delegates parsing of stacks to `stacktrace-parser`, which is buggy and\n // leaves a trailing `(address at` in the function name.\n // `react-native@0.62` seems to have custom logic to parse hermes frames specially.\n // Anyway, all we do here is throw away the bogus suffix.\n if (newFrame.function) {\n const addressAtPos = newFrame.function.indexOf('(address at');\n if (addressAtPos >= 0) {\n newFrame.function = newFrame.function\n .substr(0, addressAtPos)\n .trim();\n }\n }\n\n if (inApp) {\n await this._addSourceContext(newFrame, getDevServer);\n }\n\n return newFrame;\n }\n )\n );\n }\n\n /**\n * Replaces the frames in the exception of a error.\n * @param event Event\n * @param frames StackFrame[]\n */\n private _replaceFramesInEvent(event: Event, frames: StackFrame[]): void {\n if (\n event.exception &&\n event.exception.values &&\n event.exception.values[0] &&\n event.exception.values[0].stacktrace\n ) {\n event.exception.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 */\n private async _addSourceContext(\n frame: StackFrame,\n getDevServer?: GetDevServer\n ): Promise<void> {\n let response;\n\n const segments = frame.filename?.split('/') ?? [];\n\n if (getDevServer) {\n for (const idx in segments) {\n if (Object.prototype.hasOwnProperty.call(segments, idx)) {\n response = await fetch(\n `${getDevServer().url}${segments.slice(-idx).join('/')}`,\n {\n method: 'GET',\n }\n );\n\n if (response.ok) {\n break;\n }\n }\n }\n }\n\n if (response && response.ok) {\n const content = await response.text();\n const lines = content.split('\\n');\n\n addContextToFrame(lines, frame);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"debugsymbolicator.js","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,wBAAwB,GAAG,IAAI,MAAM,CAAC,CAAC,+BAA+B,EAAE,oBAAoB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AA2B/G,6DAA6D;AAC7D,MAAM,OAAO,iBAAiB;IAA9B;QAKE;;WAEG;QACI,SAAI,GAAW,iBAAiB,CAA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AAiB,CAAC,KAAiB,EAAE,YAA2B;;;YAC5E,IAAI,QAAQ,CAAC;YAEb,MAAM,QAAQ,eAAG,KAAK,CAAC,QAAQ,0CAAE,KAAK,CAAC,GAAG,oCAAK,EAAE,CAAC;YAElD,IAAI,YAAY,EAAE;gBAChB,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;oBAC1B,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE;wBACvD,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,YAAY,EAAE,CAAC,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE;4BAC/E,MAAM,EAAE,KAAK;yBACd,CAAC,CAAC;wBAEH,IAAI,QAAQ,CAAC,EAAE,EAAE;4BACf,MAAM;yBACP;qBACF;iBACF;aACF;YAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,EAAE,EAAE;gBAC3B,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACtC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAElC,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;aACjC;;KACF;;AAhLD;;GAEG;AACW,oBAAE,GAAW,mBAAmB,CAAC","sourcesContent":["import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core';\nimport type { Event, EventHint, Integration, StackFrame } from '@sentry/types';\nimport { addContextToFrame, logger } from '@sentry/utils';\n\nconst INTERNAL_CALLSITES_REGEX = new RegExp(['ReactNativeRenderer-dev\\\\.js$', 'MessageQueue\\\\.js$'].join('|'));\n\ninterface GetDevServer {\n (): { url: string };\n}\n\n/**\n * React Native Stack Frame\n */\ninterface ReactNativeFrame {\n // arguments: []\n column: number;\n file: string;\n lineNumber: number;\n methodName: string;\n}\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 class DebugSymbolicator implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'DebugSymbolicator';\n /**\n * @inheritDoc\n */\n public name: string = DebugSymbolicator.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor(async (event: Event, hint?: EventHint) => {\n const self = getCurrentHub().getIntegration(DebugSymbolicator);\n\n if (!self || hint === undefined || hint.originalException === undefined) {\n return event;\n }\n\n const reactError = hint.originalException as ReactNativeError;\n\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack');\n\n let stack;\n try {\n stack = parseErrorStack(reactError);\n } catch (e) {\n // In RN 0.64 `parseErrorStack` now only takes a string\n stack = parseErrorStack(reactError.stack);\n }\n\n await self._symbolicate(event, stack);\n\n event.platform = 'node'; // Setting platform node makes sure we do not show source maps errors\n\n return event;\n });\n }\n\n /**\n * Symbolicates the stack on the device talking to local dev server.\n * Mutates the passed event.\n */\n private async _symbolicate(event: Event, stack: string | undefined): Promise<void> {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const symbolicateStackTrace = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');\n const prettyStack = await symbolicateStackTrace(stack);\n\n if (prettyStack) {\n let newStack = prettyStack;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (prettyStack.stack) {\n // This has been changed in an react-native version so stack is contained in here\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n newStack = prettyStack.stack;\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const stackWithoutInternalCallsites = newStack.filter(\n (frame: { file?: string }) =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n frame.file && frame.file.match(INTERNAL_CALLSITES_REGEX) === null,\n );\n\n const symbolicatedFrames = await this._convertReactNativeFramesToSentryFrames(stackWithoutInternalCallsites);\n this._replaceFramesInEvent(event, symbolicatedFrames);\n } else {\n logger.error('The stack is null');\n }\n } catch (error) {\n if (error instanceof Error) {\n logger.warn(`Unable to symbolicate stack trace: ${error.message}`);\n }\n }\n }\n\n /**\n * Converts ReactNativeFrames to frames in the Sentry format\n * @param frames ReactNativeFrame[]\n */\n private async _convertReactNativeFramesToSentryFrames(frames: ReactNativeFrame[]): Promise<StackFrame[]> {\n let getDevServer: GetDevServer;\n try {\n getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer');\n } catch (_oO) {\n // We can't load devserver URL\n }\n // Below you will find lines marked with :HACK to prevent showing errors in the sentry ui\n // But since this is a debug only feature: This is Fine (TM)\n return Promise.all(\n frames.map(async (frame: ReactNativeFrame): Promise<StackFrame> => {\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: StackFrame = {\n colno: frame.column,\n filename: frame.file,\n function: frame.methodName,\n in_app: inApp,\n lineno: inApp ? frame.lineNumber : undefined, // :HACK\n platform: inApp ? 'javascript' : 'node', // :HACK\n };\n\n // The upstream `react-native@0.61` delegates parsing of stacks to `stacktrace-parser`, which is buggy and\n // leaves a trailing `(address at` in the function name.\n // `react-native@0.62` seems to have custom logic to parse hermes frames specially.\n // Anyway, all we do here is throw away the bogus suffix.\n if (newFrame.function) {\n const addressAtPos = newFrame.function.indexOf('(address at');\n if (addressAtPos >= 0) {\n newFrame.function = newFrame.function.substr(0, addressAtPos).trim();\n }\n }\n\n if (inApp) {\n await this._addSourceContext(newFrame, getDevServer);\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 */\n private _replaceFramesInEvent(event: Event, frames: StackFrame[]): void {\n if (\n event.exception &&\n event.exception.values &&\n event.exception.values[0] &&\n event.exception.values[0].stacktrace\n ) {\n event.exception.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 */\n private async _addSourceContext(frame: StackFrame, getDevServer?: GetDevServer): Promise<void> {\n let response;\n\n const segments = frame.filename?.split('/') ?? [];\n\n if (getDevServer) {\n for (const idx in segments) {\n if (Object.prototype.hasOwnProperty.call(segments, idx)) {\n response = await fetch(`${getDevServer().url}${segments.slice(-idx).join('/')}`, {\n method: 'GET',\n });\n\n if (response.ok) {\n break;\n }\n }\n }\n }\n\n if (response && response.ok) {\n const content = await response.text();\n const lines = content.split('\\n');\n\n addContextToFrame(lines, frame);\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devicecontext.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/devicecontext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAS,cAAc,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAQ7E,uCAAuC;AACvC,qBAAa,aAAc,YAAW,WAAW;IAC/C;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAmB;IAE3C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAoB;IAEvC;;OAEG;IACI,SAAS,
|
|
1
|
+
{"version":3,"file":"devicecontext.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/devicecontext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAS,cAAc,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAQ7E,uCAAuC;AACvC,qBAAa,aAAc,YAAW,WAAW;IAC/C;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAmB;IAE3C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAoB;IAEvC;;OAEG;IACI,SAAS,CAAC,uBAAuB,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,GAAG,IAAI;CAwE9G"}
|
|
@@ -53,11 +53,9 @@ export class DeviceContext {
|
|
|
53
53
|
}
|
|
54
54
|
const nativeFingerprint = native.fingerprint;
|
|
55
55
|
if (nativeFingerprint) {
|
|
56
|
-
event.fingerprint = ((_a = event.fingerprint) !== null && _a !== void 0 ? _a : []).concat(nativeFingerprint.filter(
|
|
56
|
+
event.fingerprint = ((_a = event.fingerprint) !== null && _a !== void 0 ? _a : []).concat(nativeFingerprint.filter(item => { var _a; return ((_a = event.fingerprint) !== null && _a !== void 0 ? _a : []).indexOf(item) < 0; }));
|
|
57
57
|
}
|
|
58
|
-
const nativeLevel = typeof native['level'] === 'string'
|
|
59
|
-
? severityLevelFromString(native['level'])
|
|
60
|
-
: undefined;
|
|
58
|
+
const nativeLevel = typeof native['level'] === 'string' ? severityLevelFromString(native['level']) : undefined;
|
|
61
59
|
if (!event.level && nativeLevel) {
|
|
62
60
|
event.level = nativeLevel;
|
|
63
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devicecontext.js","sourceRoot":"","sources":["../../../src/js/integrations/devicecontext.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,uCAAuC;AACvC,MAAM,OAAO,aAAa;IAA1B;QAME;;WAEG;QACI,SAAI,GAAW,aAAa,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"devicecontext.js","sourceRoot":"","sources":["../../../src/js/integrations/devicecontext.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAA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C,oBAAoB,CAAC;gBACjD,CAAC,CAAC,SAAS,CAAC;YACd,IAAI,iBAAiB,EAAE;gBACrB,KAAK,CAAC,WAAW,GAAG,iBAAiB,CAAC;aACvC;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAA,CAAC,CAAC;IACL,CAAC;;AApFD;;GAEG;AACW,gBAAE,GAAW,eAAe,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport type { Event, EventProcessor, Hub, Integration } from '@sentry/types';\nimport { logger, severityLevelFromString } from '@sentry/utils';\nimport { AppState } from 'react-native';\n\nimport { breadcrumbFromObject } from '../breadcrumb';\nimport type { NativeDeviceContextsResponse } from '../NativeRNSentry';\nimport { NATIVE } from '../wrapper';\n\n/** Load device context from native. */\nexport class DeviceContext implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'DeviceContext';\n\n /**\n * @inheritDoc\n */\n public name: string = DeviceContext.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void {\n addGlobalEventProcessor(async (event: Event) => {\n const self = getCurrentHub().getIntegration(DeviceContext);\n if (!self) {\n return event;\n }\n\n let native: NativeDeviceContextsResponse | null = null;\n try {\n native = await NATIVE.fetchNativeDeviceContexts();\n } catch (e) {\n logger.log(`Failed to get device context from native: ${e}`);\n }\n\n if (!native) {\n return event;\n }\n\n const nativeUser = native.user;\n if (!event.user && nativeUser) {\n event.user = nativeUser;\n }\n\n let nativeContext = native.context;\n if (AppState.currentState !== 'unknown') {\n nativeContext = nativeContext || {};\n nativeContext.app = {\n ...nativeContext.app,\n in_foreground: AppState.currentState === 'active',\n };\n }\n if (nativeContext) {\n event.contexts = { ...nativeContext, ...event.contexts };\n }\n\n const nativeTags = native.tags;\n if (nativeTags) {\n event.tags = { ...nativeTags, ...event.tags };\n }\n\n const nativeExtra = native.extra;\n if (nativeExtra) {\n event.extra = { ...nativeExtra, ...event.extra };\n }\n\n const nativeFingerprint = native.fingerprint;\n if (nativeFingerprint) {\n event.fingerprint = (event.fingerprint ?? []).concat(\n nativeFingerprint.filter(item => (event.fingerprint ?? []).indexOf(item) < 0),\n );\n }\n\n const nativeLevel = typeof native['level'] === 'string' ? severityLevelFromString(native['level']) : undefined;\n if (!event.level && nativeLevel) {\n event.level = nativeLevel;\n }\n\n const nativeEnvironment = native['environment'];\n if (!event.environment && nativeEnvironment) {\n event.environment = nativeEnvironment;\n }\n\n const nativeBreadcrumbs = Array.isArray(native['breadcrumbs'])\n ? native['breadcrumbs'].map(breadcrumbFromObject)\n : undefined;\n if (nativeBreadcrumbs) {\n event.breadcrumbs = nativeBreadcrumbs;\n }\n\n return event;\n });\n }\n}\n"]}
|
|
@@ -10,7 +10,7 @@ export class EventOrigin {
|
|
|
10
10
|
* @inheritDoc
|
|
11
11
|
*/
|
|
12
12
|
setupOnce(addGlobalEventProcessor) {
|
|
13
|
-
addGlobalEventProcessor(
|
|
13
|
+
addGlobalEventProcessor(event => {
|
|
14
14
|
var _a;
|
|
15
15
|
event.tags = (_a = event.tags) !== null && _a !== void 0 ? _a : {};
|
|
16
16
|
event.tags['event.origin'] = 'javascript';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventorigin.js","sourceRoot":"","sources":["../../../src/js/integrations/eventorigin.ts"],"names":[],"mappings":"AAEA,0CAA0C;AAC1C,MAAM,OAAO,WAAW;IAAxB;QAME;;WAEG;QACI,SAAI,GAAW,WAAW,CAAC,EAAE,CAAC;IAevC,CAAC;IAbC;;OAEG;IACI,SAAS,CAAC,uBAAoD;QACnE,uBAAuB,CAAC,
|
|
1
|
+
{"version":3,"file":"eventorigin.js","sourceRoot":"","sources":["../../../src/js/integrations/eventorigin.ts"],"names":[],"mappings":"AAEA,0CAA0C;AAC1C,MAAM,OAAO,WAAW;IAAxB;QAME;;WAEG;QACI,SAAI,GAAW,WAAW,CAAC,EAAE,CAAC;IAevC,CAAC;IAbC;;OAEG;IACI,SAAS,CAAC,uBAAoD;QACnE,uBAAuB,CAAC,KAAK,CAAC,EAAE;;YAC9B,KAAK,CAAC,IAAI,SAAG,KAAK,CAAC,IAAI,mCAAI,EAAE,CAAC;YAE9B,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,YAAY,CAAC;YAC1C,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,YAAY,CAAC;YAE/C,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;;AAtBD;;GAEG;AACW,cAAE,GAAW,aAAa,CAAC","sourcesContent":["import type { EventProcessor, Integration } from '@sentry/types';\n\n/** Default EventOrigin instrumentation */\nexport class EventOrigin implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'EventOrigin';\n\n /**\n * @inheritDoc\n */\n public name: string = EventOrigin.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(addGlobalEventProcessor: (e: EventProcessor) => void): void {\n addGlobalEventProcessor(event => {\n event.tags = event.tags ?? {};\n\n event.tags['event.origin'] = 'javascript';\n event.tags['event.environment'] = 'javascript';\n\n return event;\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EACzB,SAAS,GAAE,WAAW,CAAC,WAAW,CAEjC,GACA,WAAW,CAKb"}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* Creates an integration out of the provided name and setup function.
|
|
3
3
|
* @hidden
|
|
4
4
|
*/
|
|
5
|
-
export function createIntegration(name, setupOnce = () => {
|
|
5
|
+
export function createIntegration(name, setupOnce = () => {
|
|
6
|
+
/* noop */
|
|
7
|
+
}) {
|
|
6
8
|
return {
|
|
7
9
|
name: name,
|
|
8
10
|
setupOnce,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/js/integrations/factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/js/integrations/factory.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAyB,EACzB,YAAsC,GAAG,EAAE;IACzC,UAAU;AACZ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,IAAI;QACV,SAAS;KACV,CAAC;AACJ,CAAC","sourcesContent":["import type { Integration } from '@sentry/types';\n\n/**\n * Creates an integration out of the provided name and setup function.\n * @hidden\n */\nexport function createIntegration(\n name: Integration['name'],\n setupOnce: Integration['setupOnce'] = () => {\n /* noop */\n },\n): Integration {\n return {\n name: name,\n setupOnce,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modulesloader.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/modulesloader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"modulesloader.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/modulesloader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAKxE,mDAAmD;AACnD,qBAAa,aAAc,YAAW,WAAW;IAC/C;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAmB;IAE3C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAoB;IAEvC;;OAEG;IACI,SAAS,CAAC,uBAAuB,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,GAAG,IAAI;CAsB7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modulesloader.js","sourceRoot":"","sources":["../../../src/js/integrations/modulesloader.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,mDAAmD;AACnD,MAAM,OAAO,aAAa;IAA1B;QAME;;WAEG;QACI,SAAI,GAAW,aAAa,CAAC,EAAE,CAAC;IA2BzC,CAAC;IAzBC;;OAEG;IACI,SAAS,CAAC,uBAAoD;QACnE,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,IAAI,OAAsC,CAAC;QAE3C,uBAAuB,CAAC,CAAO,KAAY,EAAE,EAAE;YAC7C,IAAI,CAAC,OAAO,EAAE;gBACZ,IAAI;oBACF,OAAO,GAAG,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;iBACvC;gBAAC,OAAO,CAAC,EAAE;oBACV,MAAM,CAAC,GAAG,CAAC,sCAAsC,CAAC,EAAE,CAAC,CAAC;iBACvD;gBACD,OAAO,GAAG,IAAI,CAAC;aAChB;YACD,IAAI,OAAO,EAAE;gBACX,KAAK,CAAC,OAAO,mCACR,OAAO,GACP,KAAK,CAAC,OAAO,CACjB,CAAC;aACH;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAA,CAAC,CAAC;IACL,CAAC;;AAlCD;;GAEG;AACW,gBAAE,GAAW,eAAe,CAAC","sourcesContent":["import type { Event,EventProcessor, Integration } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { NATIVE } from '../wrapper';\n\n/** Loads runtime JS modules from prepared file. */\nexport class ModulesLoader implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'ModulesLoader';\n\n /**\n * @inheritDoc\n */\n public name: string = ModulesLoader.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(addGlobalEventProcessor: (e: EventProcessor) => void): void {\n let isSetup = false;\n let modules: Record<string, string> | null;\n\n addGlobalEventProcessor(async (event: Event) => {\n if (!isSetup) {\n try {\n modules = await NATIVE.fetchModules();\n } catch (e) {\n logger.log(`Failed to get modules from native: ${e}`);\n }\n isSetup = true;\n }\n if (modules) {\n event.modules = {\n ...modules,\n ...event.modules,\n };\n }\n return event;\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"modulesloader.js","sourceRoot":"","sources":["../../../src/js/integrations/modulesloader.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,mDAAmD;AACnD,MAAM,OAAO,aAAa;IAA1B;QAME;;WAEG;QACI,SAAI,GAAW,aAAa,CAAC,EAAE,CAAC;IA2BzC,CAAC;IAzBC;;OAEG;IACI,SAAS,CAAC,uBAAoD;QACnE,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,IAAI,OAAsC,CAAC;QAE3C,uBAAuB,CAAC,CAAO,KAAY,EAAE,EAAE;YAC7C,IAAI,CAAC,OAAO,EAAE;gBACZ,IAAI;oBACF,OAAO,GAAG,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;iBACvC;gBAAC,OAAO,CAAC,EAAE;oBACV,MAAM,CAAC,GAAG,CAAC,sCAAsC,CAAC,EAAE,CAAC,CAAC;iBACvD;gBACD,OAAO,GAAG,IAAI,CAAC;aAChB;YACD,IAAI,OAAO,EAAE;gBACX,KAAK,CAAC,OAAO,mCACR,OAAO,GACP,KAAK,CAAC,OAAO,CACjB,CAAC;aACH;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAA,CAAC,CAAC;IACL,CAAC;;AAlCD;;GAEG;AACW,gBAAE,GAAW,eAAe,CAAC","sourcesContent":["import type { Event, EventProcessor, Integration } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { NATIVE } from '../wrapper';\n\n/** Loads runtime JS modules from prepared file. */\nexport class ModulesLoader implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'ModulesLoader';\n\n /**\n * @inheritDoc\n */\n public name: string = ModulesLoader.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(addGlobalEventProcessor: (e: EventProcessor) => void): void {\n let isSetup = false;\n let modules: Record<string, string> | null;\n\n addGlobalEventProcessor(async (event: Event) => {\n if (!isSetup) {\n try {\n modules = await NATIVE.fetchModules();\n } catch (e) {\n logger.log(`Failed to get modules from native: ${e}`);\n }\n isSetup = true;\n }\n if (modules) {\n event.modules = {\n ...modules,\n ...event.modules,\n };\n }\n return event;\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativeerrorhandlers.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,WAAW,EAAiB,MAAM,eAAe,CAAC;AAM3E,uCAAuC;AACvC,UAAU,+BAA+B;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAOD,2CAA2C;AAC3C,qBAAa,wBAAyB,YAAW,WAAW;IAC1D;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAA8B;IAEtD;;OAEG;IACI,IAAI,EAAE,MAAM,CAA+B;IAElD,yBAAyB;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAE3D,kBAAkB;gBACC,OAAO,CAAC,EAAE,OAAO,CAAC,+BAA+B,CAAC;IASrE;;OAEG;IACI,SAAS,IAAI,IAAI;IAKxB;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAUlC;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;
|
|
1
|
+
{"version":3,"file":"reactnativeerrorhandlers.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,WAAW,EAAiB,MAAM,eAAe,CAAC;AAM3E,uCAAuC;AACvC,UAAU,+BAA+B;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAOD,2CAA2C;AAC3C,qBAAa,wBAAyB,YAAW,WAAW;IAC1D;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAA8B;IAEtD;;OAEG;IACI,IAAI,EAAE,MAAM,CAA+B;IAElD,yBAAyB;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAE3D,kBAAkB;gBACC,OAAO,CAAC,EAAE,OAAO,CAAC,+BAA+B,CAAC;IASrE;;OAEG;IACI,SAAS,IAAI,IAAI;IAKxB;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAUlC;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;IAcxB;;OAEG;IACH,OAAO,CAAC,gCAAgC;IAuCxC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAmB5B;;OAEG;IACH,OAAO,CAAC,cAAc;CAoEvB"}
|
|
@@ -42,7 +42,7 @@ export class ReactNativeErrorHandlers {
|
|
|
42
42
|
*/
|
|
43
43
|
_polyfillPromise() {
|
|
44
44
|
/* eslint-disable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires */
|
|
45
|
-
const { polyfillGlobal
|
|
45
|
+
const { polyfillGlobal } = require('react-native/Libraries/Utilities/PolyfillFunctions');
|
|
46
46
|
// Below, we follow the exact way React Native initializes its promise library, and we globally replace it.
|
|
47
47
|
const Promise = require('promise/setimmediate/es6-extensions');
|
|
48
48
|
// As of RN 0.67 only done and finally are used
|
|
@@ -61,7 +61,7 @@ export class ReactNativeErrorHandlers {
|
|
|
61
61
|
// eslint-disable-next-line no-console
|
|
62
62
|
console.warn(`Possible Unhandled Promise Rejection (id: ${id}):\n${rejection}`);
|
|
63
63
|
},
|
|
64
|
-
onHandled:
|
|
64
|
+
onHandled: id => {
|
|
65
65
|
// eslint-disable-next-line no-console
|
|
66
66
|
console.warn(`Promise Rejection Handled (id: ${id})\n` +
|
|
67
67
|
'This means you can ignore any previous messages of the form ' +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativeerrorhandlers.js","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAG9D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAcnD,2CAA2C;AAC3C,MAAM,OAAO,wBAAwB;IAcnC,kBAAkB;IAClB,YAAmB,OAAkD;QATrE;;WAEG;QACI,SAAI,GAAW,wBAAwB,CAAC,EAAE,CAAC;QAOhD,IAAI,CAAC,QAAQ,mBACX,OAAO,EAAE,IAAI,EACb,oBAAoB,EAAE,IAAI,EAC1B,kBAAkB,EAAE,IAAI,IACrB,OAAO,CACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,SAAS;QACd,IAAI,CAAC,0BAA0B,EAAE,CAAC;QAClC,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACK,0BAA0B;QAChC,IAAI,IAAI,CAAC,QAAQ,CAAC,oBAAoB,EAAE;YACtC,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE;gBACpC,IAAI,CAAC,gBAAgB,EAAE,CAAC;aACzB;YAED,IAAI,CAAC,gCAAgC,EAAE,CAAC;YACxC,IAAI,CAAC,oBAAoB,EAAE,CAAC;SAC7B;IACH,CAAC;IACD;;;;;;;;OAQG;IACK,gBAAgB;QACtB,yFAAyF;QACzF,MAAM,EACJ,cAAc,GACf,GAAG,OAAO,CAAC,oDAAoD,CAAC,CAAC;QAElE,2GAA2G;QAC3G,MAAM,OAAO,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;QAE/D,+CAA+C;QAC/C,OAAO,CAA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CAAC;oBAE/B,OAAO;iBACR;gBAED,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;gBAEpC,MAAM,IAAI,GAAc;oBACtB,iBAAiB,EAAE,KAAK;oBACxB,WAAW,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,cAAc,EAAE;iBACrC,CAAC;gBACF,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;gBAE3D,IAAI,OAAO,EAAE;oBACX,KAAK,CAAC,KAAK,GAAG,OAAwB,CAAC;oBAEvC,qBAAqB,CAAC,KAAK,EAAE;wBAC3B,OAAO,EAAE,KAAK;wBACd,IAAI,EAAE,SAAS;qBAChB,CAAC,CAAC;iBACJ;gBAED,UAAU,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;gBAErC,IAAI,CAAC,OAAO,EAAE;oBACZ,KAAK,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;wBAC3D,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;oBACjC,CAAC,CAAC,CAAC;iBACJ;qBAAM;oBACL,gFAAgF;oBAChF,mCAAmC;oBACnC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;iBAChC;YACH,CAAC,CAAA,CAAC,CAAC;SACJ;IACH,CAAC;;AApND;;GAEG;AACW,2BAAE,GAAW,0BAA0B,CAAC","sourcesContent":["import { getCurrentHub } from '@sentry/core';\nimport type { EventHint, Integration, SeverityLevel } from '@sentry/types';\nimport { addExceptionMechanism, logger } from '@sentry/utils';\n\nimport type { ReactNativeClient } from '../client';\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\n\n/** ReactNativeErrorHandlers Options */\ninterface ReactNativeErrorHandlersOptions {\n onerror: boolean;\n onunhandledrejection: boolean;\n patchGlobalPromise: boolean;\n}\n\ninterface PromiseRejectionTrackingOptions {\n onUnhandled: (id: string, error: unknown) => void;\n onHandled: (id: string) => void;\n}\n\n/** ReactNativeErrorHandlers Integration */\nexport class ReactNativeErrorHandlers implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'ReactNativeErrorHandlers';\n\n /**\n * @inheritDoc\n */\n public name: string = ReactNativeErrorHandlers.id;\n\n /** ReactNativeOptions */\n private readonly _options: ReactNativeErrorHandlersOptions;\n\n /** Constructor */\n public constructor(options?: Partial<ReactNativeErrorHandlersOptions>) {\n this._options = {\n onerror: true,\n onunhandledrejection: true,\n patchGlobalPromise: true,\n ...options,\n };\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n this._handleUnhandledRejections();\n this._handleOnError();\n }\n\n /**\n * Handle Promises\n */\n private _handleUnhandledRejections(): void {\n if (this._options.onunhandledrejection) {\n if (this._options.patchGlobalPromise) {\n this._polyfillPromise();\n }\n\n this._attachUnhandledRejectionHandler();\n this._checkPromiseAndWarn();\n }\n }\n /**\n * Polyfill the global promise instance with one we can be sure that we can attach the tracking to.\n *\n * In newer RN versions >=0.63, the global promise is not the same reference as the one imported from the promise library.\n * This is due to a version mismatch between promise versions.\n * Originally we tried a solution where we would have you put a package resolution to ensure the promise instances match. However,\n * - Using a package resolution requires the you to manually troubleshoot.\n * - The package resolution fix no longer works with 0.67 on iOS Hermes.\n */\n private _polyfillPromise(): void {\n /* eslint-disable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires */\n const {\n polyfillGlobal,\n } = require('react-native/Libraries/Utilities/PolyfillFunctions');\n\n // Below, we follow the exact way React Native initializes its promise library, and we globally replace it.\n const Promise = require('promise/setimmediate/es6-extensions');\n\n // As of RN 0.67 only done and finally are used\n require('promise/setimmediate/done');\n require('promise/setimmediate/finally');\n\n polyfillGlobal('Promise', () => Promise);\n /* eslint-enable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires */\n }\n /**\n * Attach the unhandled rejection handler\n */\n private _attachUnhandledRejectionHandler(): void {\n const tracking: {\n disable: () => void;\n enable: (arg: unknown) => void;\n // eslint-disable-next-line import/no-extraneous-dependencies,@typescript-eslint/no-var-requires\n } = require('promise/setimmediate/rejection-tracking');\n\n const promiseRejectionTrackingOptions: PromiseRejectionTrackingOptions = {\n onUnhandled: (id, rejection = {}) => {\n // eslint-disable-next-line no-console\n console.warn(\n `Possible Unhandled Promise Rejection (id: ${id}):\\n${rejection}`\n );\n },\n onHandled: (id) => {\n // eslint-disable-next-line no-console\n console.warn(\n `Promise Rejection Handled (id: ${id})\\n` +\n 'This means you can ignore any previous messages of the form ' +\n `\"Possible Unhandled Promise Rejection (id: ${id}):\"`\n );\n },\n };\n\n tracking.enable({\n allRejections: true,\n onUnhandled: (id: string, error: Error) => {\n if (__DEV__) {\n promiseRejectionTrackingOptions.onUnhandled(id, error);\n }\n\n getCurrentHub().captureException(error, {\n data: { id },\n originalException: error,\n });\n },\n onHandled: (id: string) => {\n promiseRejectionTrackingOptions.onHandled(id);\n },\n });\n }\n /**\n * Checks if the promise is the same one or not, if not it will warn the user\n */\n private _checkPromiseAndWarn(): void {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies\n const Promise = require('promise/setimmediate/es6-extensions');\n\n if (Promise !== RN_GLOBAL_OBJ.Promise) {\n logger.warn(\n 'Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.'\n );\n } else {\n logger.log('Unhandled promise rejections will be caught by Sentry.');\n }\n } catch (e) {\n // Do Nothing\n logger.warn(\n 'Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.'\n );\n }\n }\n /**\n * Handle errors\n */\n private _handleOnError(): void {\n if (this._options.onerror) {\n let handlingFatal = false;\n\n const errorUtils = RN_GLOBAL_OBJ.ErrorUtils;\n if (!errorUtils) {\n logger.warn('ErrorUtils not found. Can be caused by different environment for example react-native-web.');\n return;\n }\n\n const defaultHandler =\n errorUtils.getGlobalHandler && errorUtils.getGlobalHandler();\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n errorUtils.setGlobalHandler(async (error: any, isFatal?: boolean) => {\n // We want to handle fatals, but only in production mode.\n const shouldHandleFatal = isFatal && !__DEV__;\n if (shouldHandleFatal) {\n if (handlingFatal) {\n logger.log(\n 'Encountered multiple fatals in a row. The latest:',\n error\n );\n return;\n }\n handlingFatal = true;\n }\n\n const currentHub = getCurrentHub();\n const client = currentHub.getClient<ReactNativeClient>();\n const scope = currentHub.getScope();\n\n if (!client) {\n logger.error(\n 'Sentry client is missing, the error event might be lost.',\n error\n );\n\n // If there is no client something is fishy, anyway we call the default handler\n defaultHandler(error, isFatal);\n\n return;\n }\n\n const options = client.getOptions();\n\n const hint: EventHint = {\n originalException: error,\n attachments: scope?.getAttachments(),\n };\n const event = await client.eventFromException(error, hint);\n\n if (isFatal) {\n event.level = 'fatal' as SeverityLevel;\n\n addExceptionMechanism(event, {\n handled: false,\n type: 'onerror',\n });\n }\n\n currentHub.captureEvent(event, hint);\n\n if (!__DEV__) {\n void client.flush(options.shutdownTimeout || 2000).then(() => {\n defaultHandler(error, isFatal);\n });\n } else {\n // If in dev, we call the default handler anyway and hope the error will be sent\n // Just for a better dev experience\n defaultHandler(error, isFatal);\n }\n });\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reactnativeerrorhandlers.js","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAG9D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAcnD,2CAA2C;AAC3C,MAAM,OAAO,wBAAwB;IAcnC,kBAAkB;IAClB,YAAmB,OAAkD;QATrE;;WAEG;QACI,SAAI,GAAW,wBAAwB,CAAC,EAAE,CAAC;QAOhD,IAAI,CAAC,QAAQ,mBACX,OAAO,E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AC,CAAC;gBAErC,IAAI,CAAC,OAAO,EAAE;oBACZ,KAAK,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;wBAC3D,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;oBACjC,CAAC,CAAC,CAAC;iBACJ;qBAAM;oBACL,gFAAgF;oBAChF,mCAAmC;oBACnC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;iBAChC;YACH,CAAC,CAAA,CAAC,CAAC;SACJ;IACH,CAAC;;AAzMD;;GAEG;AACW,2BAAE,GAAW,0BAA0B,CAAC","sourcesContent":["import { getCurrentHub } from '@sentry/core';\nimport type { EventHint, Integration, SeverityLevel } from '@sentry/types';\nimport { addExceptionMechanism, logger } from '@sentry/utils';\n\nimport type { ReactNativeClient } from '../client';\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\n\n/** ReactNativeErrorHandlers Options */\ninterface ReactNativeErrorHandlersOptions {\n onerror: boolean;\n onunhandledrejection: boolean;\n patchGlobalPromise: boolean;\n}\n\ninterface PromiseRejectionTrackingOptions {\n onUnhandled: (id: string, error: unknown) => void;\n onHandled: (id: string) => void;\n}\n\n/** ReactNativeErrorHandlers Integration */\nexport class ReactNativeErrorHandlers implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'ReactNativeErrorHandlers';\n\n /**\n * @inheritDoc\n */\n public name: string = ReactNativeErrorHandlers.id;\n\n /** ReactNativeOptions */\n private readonly _options: ReactNativeErrorHandlersOptions;\n\n /** Constructor */\n public constructor(options?: Partial<ReactNativeErrorHandlersOptions>) {\n this._options = {\n onerror: true,\n onunhandledrejection: true,\n patchGlobalPromise: true,\n ...options,\n };\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n this._handleUnhandledRejections();\n this._handleOnError();\n }\n\n /**\n * Handle Promises\n */\n private _handleUnhandledRejections(): void {\n if (this._options.onunhandledrejection) {\n if (this._options.patchGlobalPromise) {\n this._polyfillPromise();\n }\n\n this._attachUnhandledRejectionHandler();\n this._checkPromiseAndWarn();\n }\n }\n /**\n * Polyfill the global promise instance with one we can be sure that we can attach the tracking to.\n *\n * In newer RN versions >=0.63, the global promise is not the same reference as the one imported from the promise library.\n * This is due to a version mismatch between promise versions.\n * Originally we tried a solution where we would have you put a package resolution to ensure the promise instances match. However,\n * - Using a package resolution requires the you to manually troubleshoot.\n * - The package resolution fix no longer works with 0.67 on iOS Hermes.\n */\n private _polyfillPromise(): void {\n /* eslint-disable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires */\n const { polyfillGlobal } = require('react-native/Libraries/Utilities/PolyfillFunctions');\n\n // Below, we follow the exact way React Native initializes its promise library, and we globally replace it.\n const Promise = require('promise/setimmediate/es6-extensions');\n\n // As of RN 0.67 only done and finally are used\n require('promise/setimmediate/done');\n require('promise/setimmediate/finally');\n\n polyfillGlobal('Promise', () => Promise);\n /* eslint-enable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires */\n }\n /**\n * Attach the unhandled rejection handler\n */\n private _attachUnhandledRejectionHandler(): void {\n const tracking: {\n disable: () => void;\n enable: (arg: unknown) => void;\n // eslint-disable-next-line import/no-extraneous-dependencies,@typescript-eslint/no-var-requires\n } = require('promise/setimmediate/rejection-tracking');\n\n const promiseRejectionTrackingOptions: PromiseRejectionTrackingOptions = {\n onUnhandled: (id, rejection = {}) => {\n // eslint-disable-next-line no-console\n console.warn(`Possible Unhandled Promise Rejection (id: ${id}):\\n${rejection}`);\n },\n onHandled: id => {\n // eslint-disable-next-line no-console\n console.warn(\n `Promise Rejection Handled (id: ${id})\\n` +\n 'This means you can ignore any previous messages of the form ' +\n `\"Possible Unhandled Promise Rejection (id: ${id}):\"`,\n );\n },\n };\n\n tracking.enable({\n allRejections: true,\n onUnhandled: (id: string, error: Error) => {\n if (__DEV__) {\n promiseRejectionTrackingOptions.onUnhandled(id, error);\n }\n\n getCurrentHub().captureException(error, {\n data: { id },\n originalException: error,\n });\n },\n onHandled: (id: string) => {\n promiseRejectionTrackingOptions.onHandled(id);\n },\n });\n }\n /**\n * Checks if the promise is the same one or not, if not it will warn the user\n */\n private _checkPromiseAndWarn(): void {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies\n const Promise = require('promise/setimmediate/es6-extensions');\n\n if (Promise !== RN_GLOBAL_OBJ.Promise) {\n logger.warn(\n 'Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.',\n );\n } else {\n logger.log('Unhandled promise rejections will be caught by Sentry.');\n }\n } catch (e) {\n // Do Nothing\n logger.warn(\n 'Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.',\n );\n }\n }\n /**\n * Handle errors\n */\n private _handleOnError(): void {\n if (this._options.onerror) {\n let handlingFatal = false;\n\n const errorUtils = RN_GLOBAL_OBJ.ErrorUtils;\n if (!errorUtils) {\n logger.warn('ErrorUtils not found. Can be caused by different environment for example react-native-web.');\n return;\n }\n\n const defaultHandler = errorUtils.getGlobalHandler && errorUtils.getGlobalHandler();\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n errorUtils.setGlobalHandler(async (error: any, isFatal?: boolean) => {\n // We want to handle fatals, but only in production mode.\n const shouldHandleFatal = isFatal && !__DEV__;\n if (shouldHandleFatal) {\n if (handlingFatal) {\n logger.log('Encountered multiple fatals in a row. The latest:', error);\n return;\n }\n handlingFatal = true;\n }\n\n const currentHub = getCurrentHub();\n const client = currentHub.getClient<ReactNativeClient>();\n const scope = currentHub.getScope();\n\n if (!client) {\n logger.error('Sentry client is missing, the error event might be lost.', error);\n\n // If there is no client something is fishy, anyway we call the default handler\n defaultHandler(error, isFatal);\n\n return;\n }\n\n const options = client.getOptions();\n\n const hint: EventHint = {\n originalException: error,\n attachments: scope?.getAttachments(),\n };\n const event = await client.eventFromException(error, hint);\n\n if (isFatal) {\n event.level = 'fatal' as SeverityLevel;\n\n addExceptionMechanism(event, {\n handled: false,\n type: 'onerror',\n });\n }\n\n currentHub.captureEvent(event, hint);\n\n if (!__DEV__) {\n void client.flush(options.shutdownTimeout || 2000).then(() => {\n defaultHandler(error, isFatal);\n });\n } else {\n // If in dev, we call the default handler anyway and hope the error will be sent\n // Just for a better dev experience\n defaultHandler(error, isFatal);\n }\n });\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativeinfo.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeinfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAoB,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5F,MAAM,WAAW,kBAAmB,SAAQ,OAAO;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,4CAA4C;AAC5C,qBAAa,eAAgB,YAAW,WAAW;IACjD;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAqB;IAE7C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAsB;IAEzC;;OAEG;IACI,SAAS,CAAC,uBAAuB,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"reactnativeinfo.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeinfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAoB,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5F,MAAM,WAAW,kBAAmB,SAAQ,OAAO;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,4CAA4C;AAC5C,qBAAa,eAAgB,YAAW,WAAW;IACjD;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAqB;IAE7C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAsB;IAEzC;;OAEG;IACI,SAAS,CAAC,uBAAuB,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,GAAG,IAAI;CAkCpF"}
|
|
@@ -13,8 +13,7 @@ export class ReactNativeInfo {
|
|
|
13
13
|
*/
|
|
14
14
|
setupOnce(addGlobalEventProcessor) {
|
|
15
15
|
addGlobalEventProcessor((event, hint) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
const reactNativeError = (hint === null || hint === void 0 ? void 0 : hint.originalException) ? hint === null || hint === void 0 ? void 0 : hint.originalException
|
|
17
|
-
: undefined;
|
|
16
|
+
const reactNativeError = (hint === null || hint === void 0 ? void 0 : hint.originalException) ? hint === null || hint === void 0 ? void 0 : hint.originalException : undefined;
|
|
18
17
|
const reactNativeContext = {
|
|
19
18
|
turbo_module: isTurboModuleEnabled(),
|
|
20
19
|
fabric: isFabricEnabled(),
|