@sentry/react-native 5.14.1 → 5.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/RNSentry.podspec +1 -1
  3. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +3 -5
  4. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +1 -1
  5. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +1 -1
  6. package/dist/js/NativeRNSentry.d.ts +1 -1
  7. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  8. package/dist/js/NativeRNSentry.js.map +1 -1
  9. package/dist/js/index.d.ts +4 -3
  10. package/dist/js/index.d.ts.map +1 -1
  11. package/dist/js/index.js.map +1 -1
  12. package/dist/js/integrations/debugsymbolicator.d.ts +25 -3
  13. package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
  14. package/dist/js/integrations/debugsymbolicator.js +109 -70
  15. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  16. package/dist/js/integrations/reactnativeerrorhandlers.d.ts +4 -0
  17. package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
  18. package/dist/js/integrations/reactnativeerrorhandlers.js +10 -1
  19. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  20. package/dist/js/tracing/index.d.ts +3 -2
  21. package/dist/js/tracing/index.d.ts.map +1 -1
  22. package/dist/js/tracing/index.js.map +1 -1
  23. package/dist/js/utils/error.d.ts +19 -0
  24. package/dist/js/utils/error.d.ts.map +1 -0
  25. package/dist/js/utils/error.js +30 -0
  26. package/dist/js/utils/error.js.map +1 -0
  27. package/dist/js/vendor/base64-js/fromByteArray.d.ts +5 -0
  28. package/dist/js/vendor/base64-js/fromByteArray.d.ts.map +1 -0
  29. package/dist/js/vendor/base64-js/fromByteArray.js +61 -0
  30. package/dist/js/vendor/base64-js/fromByteArray.js.map +1 -0
  31. package/dist/js/vendor/base64-js/index.d.ts +2 -0
  32. package/dist/js/vendor/base64-js/index.d.ts.map +1 -0
  33. package/dist/js/vendor/base64-js/index.js +2 -0
  34. package/dist/js/vendor/base64-js/index.js.map +1 -0
  35. package/dist/js/vendor/index.d.ts +2 -0
  36. package/dist/js/vendor/index.d.ts.map +1 -1
  37. package/dist/js/vendor/index.js +2 -0
  38. package/dist/js/vendor/index.js.map +1 -1
  39. package/dist/js/vendor/react-native/index.d.ts +27 -0
  40. package/dist/js/vendor/react-native/index.d.ts.map +1 -0
  41. package/dist/js/vendor/react-native/index.js +3 -0
  42. package/dist/js/vendor/react-native/index.js.map +1 -0
  43. package/dist/js/version.d.ts +1 -1
  44. package/dist/js/version.js +1 -1
  45. package/dist/js/version.js.map +1 -1
  46. package/dist/js/wrapper.d.ts.map +1 -1
  47. package/dist/js/wrapper.js +18 -12
  48. package/dist/js/wrapper.js.map +1 -1
  49. package/ios/RNSentry.mm +2 -6
  50. package/metro.d.ts +1 -0
  51. package/metro.js +1 -0
  52. package/package.json +4 -4
  53. package/{sample-new-architecture → samples/react-native}/react-native.config.js +1 -1
  54. package/scripts/sentry-xcode.sh +1 -1
  55. package/src/js/NativeRNSentry.ts +1 -1
  56. package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -1
  57. package/ts3.8/dist/js/index.d.ts +4 -3
  58. package/ts3.8/dist/js/integrations/debugsymbolicator.d.ts +25 -3
  59. package/ts3.8/dist/js/integrations/reactnativeerrorhandlers.d.ts +4 -0
  60. package/ts3.8/dist/js/tracing/index.d.ts +3 -2
  61. package/ts3.8/dist/js/utils/error.d.ts +19 -0
  62. package/ts3.8/dist/js/vendor/base64-js/fromByteArray.d.ts +5 -0
  63. package/ts3.8/dist/js/vendor/base64-js/index.d.ts +2 -0
  64. package/ts3.8/dist/js/vendor/index.d.ts +2 -0
  65. package/ts3.8/dist/js/vendor/react-native/index.d.ts +27 -0
  66. package/ts3.8/dist/js/version.d.ts +1 -1
package/ios/RNSentry.mm CHANGED
@@ -396,16 +396,12 @@ RCT_EXPORT_METHOD(fetchNativeRelease:(RCTPromiseResolveBlock)resolve
396
396
  });
397
397
  }
398
398
 
399
- RCT_EXPORT_METHOD(captureEnvelope:(NSArray * _Nonnull)bytes
399
+ RCT_EXPORT_METHOD(captureEnvelope:(NSString * _Nonnull)rawBytes
400
400
  options: (NSDictionary * _Nonnull)options
401
401
  resolve:(RCTPromiseResolveBlock)resolve
402
402
  rejecter:(RCTPromiseRejectBlock)reject)
403
403
  {
404
- NSMutableData *data = [[NSMutableData alloc] initWithCapacity: [bytes count]];
405
- for(NSNumber *number in bytes) {
406
- char byte = [number charValue];
407
- [data appendBytes: &byte length: 1];
408
- }
404
+ NSData *data = [[NSData alloc] initWithBase64EncodedString:rawBytes options:0];
409
405
 
410
406
  SentryEnvelope *envelope = [PrivateSentrySDKOnly envelopeWithData:data];
411
407
  if (envelope == nil) {
package/metro.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/js/tools/sentryMetroSerializer';
package/metro.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/js/tools/sentryMetroSerializer');
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sentry/react-native",
3
3
  "homepage": "https://github.com/getsentry/sentry-react-native",
4
4
  "repository": "https://github.com/getsentry/sentry-react-native",
5
- "version": "5.14.1",
5
+ "version": "5.15.0",
6
6
  "description": "Official Sentry SDK for react-native",
7
7
  "typings": "dist/js/index.d.ts",
8
8
  "types": "dist/js/index.d.ts",
@@ -34,8 +34,8 @@
34
34
  "lint:eslint": "eslint --config .eslintrc.js .",
35
35
  "lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
36
36
  "test:watch": "jest --watch",
37
- "run-ios": "cd sample-new-architecture && yarn react-native run-ios",
38
- "run-android": "cd sample-new-architecture && yarn react-native run-android",
37
+ "run-ios": "cd samples/react-native && yarn react-native run-ios",
38
+ "run-android": "cd samples/react-native && yarn react-native run-android",
39
39
  "yalc:add:sentry-javascript": "yalc add @sentry/browser @sentry/core @sentry/hub @sentry/integrations @sentry/react @sentry/types @sentry/utils"
40
40
  },
41
41
  "keywords": [
@@ -70,7 +70,7 @@
70
70
  "devDependencies": {
71
71
  "@sentry-internal/eslint-config-sdk": "7.81.1",
72
72
  "@sentry-internal/eslint-plugin-sdk": "7.81.1",
73
- "@sentry/typescript": "^5.20.1",
73
+ "@sentry-internal/typescript": "7.80.0",
74
74
  "@sentry/wizard": "3.16.3",
75
75
  "@types/jest": "^29.5.3",
76
76
  "@types/node": "^20.9.3",
@@ -6,7 +6,7 @@ const path = require('path');
6
6
  module.exports = {
7
7
  dependencies: {
8
8
  RNSentry: {
9
- root: path.resolve(__dirname, '..'),
9
+ root: path.resolve(__dirname, '../../'),
10
10
  },
11
11
  },
12
12
  };
@@ -25,7 +25,7 @@ else
25
25
  /bin/sh -c "$REACT_NATIVE_XCODE"
26
26
  fi
27
27
 
28
- [ -z "$SENTRY_COLLECT_MODULES" ] && SENTRY_COLLECT_MODULES="../../scripts/collect-modules.sh"
28
+ [ -z "$SENTRY_COLLECT_MODULES" ] && SENTRY_COLLECT_MODULES="../node_modules/@sentry/react-native/scripts/collect-modules.sh"
29
29
 
30
30
  if [ -f "$SENTRY_COLLECT_MODULES" ]; then
31
31
  /bin/sh "$SENTRY_COLLECT_MODULES"
@@ -8,7 +8,7 @@ import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
8
8
  export interface Spec extends TurboModule {
9
9
  addBreadcrumb(breadcrumb: UnsafeObject): void;
10
10
  captureEnvelope(
11
- bytes: number[],
11
+ bytes: string,
12
12
  options: {
13
13
  store: boolean;
14
14
  },
@@ -3,7 +3,7 @@ import type { TurboModule } from 'react-native';
3
3
  import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
4
4
  export interface Spec extends TurboModule {
5
5
  addBreadcrumb(breadcrumb: UnsafeObject): void;
6
- captureEnvelope(bytes: number[], options: {
6
+ captureEnvelope(bytes: string, options: {
7
7
  store: boolean;
8
8
  }): Promise<boolean>;
9
9
  captureScreenshot(): Promise<NativeScreenshot[] | undefined | null>;
@@ -1,13 +1,14 @@
1
- export { Breadcrumb, Request, SdkInfo, Event, Exception, StackFrame, Stacktrace, Thread, User, UserFeedback, } from '@sentry/types';
1
+ export type { 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, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, } from '@sentry/core';
3
3
  export { Integrations as BrowserIntegrations, ErrorBoundary, withErrorBoundary, createReduxEnhancer, Profiler, useProfiler, withProfiler, } from '@sentry/react';
4
4
  export { lastEventId } from '@sentry/browser';
5
5
  import * as Integrations from './integrations';
6
6
  import { SDK_NAME, SDK_VERSION } from './version';
7
- export { ReactNativeOptions } from './options';
7
+ export type { ReactNativeOptions } from './options';
8
8
  export { ReactNativeClient } from './client';
9
9
  export { init, wrap, setDist, setRelease, nativeCrash, flush, close, captureUserFeedback, withScope, configureScope, } from './sdk';
10
10
  export { TouchEventBoundary, withTouchEventBoundary } from './touchevents';
11
- export { ReactNativeTracing, ReactNavigationV4Instrumentation, ReactNavigationV5Instrumentation, ReactNavigationInstrumentation, ReactNativeNavigationInstrumentation, RoutingInstrumentation, ReactNavigationTransactionContext, sentryTraceGesture, } from './tracing';
11
+ export { ReactNativeTracing, ReactNavigationV4Instrumentation, ReactNavigationV5Instrumentation, ReactNavigationInstrumentation, ReactNativeNavigationInstrumentation, RoutingInstrumentation, sentryTraceGesture, } from './tracing';
12
+ export type { ReactNavigationTransactionContext } from './tracing';
12
13
  export { Integrations, SDK_NAME, SDK_VERSION };
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { Integration } from '@sentry/types';
1
+ import type { EventProcessor, Hub, Integration } from '@sentry/types';
2
2
  /**
3
3
  * React Native Error
4
4
  */
@@ -21,7 +21,7 @@ export declare class DebugSymbolicator implements Integration {
21
21
  /**
22
22
  * @inheritDoc
23
23
  */
24
- setupOnce(): void;
24
+ setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void;
25
25
  /**
26
26
  * Symbolicates the stack on the device talking to local dev server.
27
27
  * Mutates the passed event.
@@ -37,7 +37,13 @@ export declare class DebugSymbolicator implements Integration {
37
37
  * @param event Event
38
38
  * @param frames StackFrame[]
39
39
  */
40
- private _replaceFramesInEvent;
40
+ private _replaceExceptionFramesInEvent;
41
+ /**
42
+ * Replaces the frames in the thread of a message.
43
+ * @param event Event
44
+ * @param frames StackFrame[]
45
+ */
46
+ private _replaceThreadFramesInEvent;
41
47
  /**
42
48
  * This tries to add source context for in_app Frames
43
49
  *
@@ -45,5 +51,21 @@ export declare class DebugSymbolicator implements Integration {
45
51
  * @param getDevServer function from RN to get DevServer URL
46
52
  */
47
53
  private _addSourceContext;
54
+ /**
55
+ * Get source context for segment
56
+ */
57
+ private _fetchSourceContext;
58
+ /**
59
+ * Loads and calls RN Core Devtools parseErrorStack function.
60
+ */
61
+ private _parseErrorStack;
62
+ /**
63
+ * Loads and calls RN Core Devtools symbolicateStackTrace function.
64
+ */
65
+ private _symbolicateStackTrace;
66
+ /**
67
+ * Loads and returns the RN DevServer URL.
68
+ */
69
+ private _getDevServer;
48
70
  }
49
71
  //# sourceMappingURL=debugsymbolicator.d.ts.map
@@ -54,6 +54,10 @@ export declare class ReactNativeErrorHandlers implements Integration {
54
54
  * Handle errors
55
55
  */
56
56
  private _handleOnError;
57
+ /**
58
+ * Loads and returns rejection tracking module
59
+ */
60
+ private _loadRejectionTracking;
57
61
  }
58
62
  export {};
59
63
  //# sourceMappingURL=reactnativeerrorhandlers.d.ts.map
@@ -1,9 +1,10 @@
1
1
  export { ReactNativeTracing } from './reactnativetracing';
2
- export { RoutingInstrumentation, RoutingInstrumentationInstance } from './routingInstrumentation';
2
+ export type { RoutingInstrumentationInstance } from './routingInstrumentation';
3
+ export { RoutingInstrumentation } from './routingInstrumentation';
3
4
  export { ReactNavigationInstrumentation, ReactNavigationV5Instrumentation, } from './reactnavigation';
4
5
  export { ReactNavigationV4Instrumentation } from './reactnavigationv4';
5
6
  export { ReactNativeNavigationInstrumentation } from './reactnativenavigation';
6
- export { ReactNavigationCurrentRoute, ReactNavigationRoute, ReactNavigationTransactionContext } from './types';
7
+ export type { ReactNavigationCurrentRoute, ReactNavigationRoute, ReactNavigationTransactionContext } from './types';
7
8
  export { ReactNativeProfiler } from './reactnativeprofiler';
8
9
  export { sentryTraceGesture } from './gesturetracing';
9
10
  export * from './ops';
@@ -0,0 +1,19 @@
1
+ export interface ExtendedError extends Error {
2
+ framesToPop?: number | undefined;
3
+ }
4
+ /**
5
+ * Creates synthetic trace. By default pops 2 frames - `createSyntheticError` and the caller
6
+ */
7
+ export declare function createSyntheticError(framesToPop?: number): ExtendedError;
8
+ /**
9
+ * Returns the number of frames to pop from the stack trace.
10
+ * @param error ExtendedError
11
+ */
12
+ export declare function getFramesToPop(error: ExtendedError): number;
13
+ /**
14
+ * Check if `potentialError` is an object with string stack property.
15
+ */
16
+ export declare function isErrorLike(potentialError: unknown): potentialError is {
17
+ stack: string;
18
+ };
19
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Converts a Uint8Array or Array of bytes into a string representation of base64.
3
+ */
4
+ export declare function base64StringFromByteArray(uint8: Uint8Array | number[]): string;
5
+ //# sourceMappingURL=fromByteArray.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { base64StringFromByteArray } from './fromByteArray';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,4 @@
1
1
  export { utf8ToBytes } from './buffer';
2
+ export * from './react-native';
3
+ export { base64StringFromByteArray } from './base64-js';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,27 @@
1
+ export type StackFrame = {
2
+ column?: number;
3
+ file?: string;
4
+ lineNumber?: number;
5
+ methodName: string;
6
+ collapse?: boolean;
7
+ };
8
+ export type CodeFrame = Readonly<{
9
+ content: string;
10
+ location?: {
11
+ [key: string]: unknown;
12
+ row: number;
13
+ column: number;
14
+ };
15
+ fileName: string;
16
+ }>;
17
+ export type SymbolicatedStackTrace = Readonly<{
18
+ stack: Array<StackFrame>;
19
+ codeFrame?: CodeFrame;
20
+ }>;
21
+ export type DevServerInfo = {
22
+ [key: string]: unknown;
23
+ url: string;
24
+ fullBundleUrl?: string;
25
+ bundleLoadedFromServer: boolean;
26
+ };
27
+ //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
1
  export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
2
2
  export declare const SDK_NAME = "sentry.javascript.react-native";
3
- export declare const SDK_VERSION = "5.14.1";
3
+ export declare const SDK_VERSION = "5.15.0";
4
4
  //# sourceMappingURL=version.d.ts.map