@sentry/react-native 5.17.0 → 5.19.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 (111) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +1 -1
  3. package/RNSentry.podspec +1 -1
  4. package/android/build.gradle +1 -1
  5. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +117 -26
  6. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +4 -3
  7. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +6 -5
  8. package/dist/js/NativeRNSentry.d.ts +3 -2
  9. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  10. package/dist/js/NativeRNSentry.js.map +1 -1
  11. package/dist/js/client.d.ts.map +1 -1
  12. package/dist/js/client.js +14 -19
  13. package/dist/js/client.js.map +1 -1
  14. package/dist/js/index.d.ts +1 -1
  15. package/dist/js/index.d.ts.map +1 -1
  16. package/dist/js/index.js +5 -1
  17. package/dist/js/index.js.map +1 -1
  18. package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
  19. package/dist/js/integrations/debugsymbolicator.js +22 -6
  20. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  21. package/dist/js/integrations/default.d.ts.map +1 -1
  22. package/dist/js/integrations/default.js +6 -0
  23. package/dist/js/integrations/default.js.map +1 -1
  24. package/dist/js/integrations/index.d.ts +1 -0
  25. package/dist/js/integrations/index.d.ts.map +1 -1
  26. package/dist/js/integrations/index.js +1 -0
  27. package/dist/js/integrations/index.js.map +1 -1
  28. package/dist/js/integrations/nativelinkederrors.d.ts +6 -2
  29. package/dist/js/integrations/nativelinkederrors.d.ts.map +1 -1
  30. package/dist/js/integrations/nativelinkederrors.js +63 -72
  31. package/dist/js/integrations/nativelinkederrors.js.map +1 -1
  32. package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
  33. package/dist/js/integrations/reactnativeerrorhandlers.js +2 -0
  34. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  35. package/dist/js/integrations/rewriteframes.d.ts +2 -2
  36. package/dist/js/integrations/rewriteframes.d.ts.map +1 -1
  37. package/dist/js/integrations/rewriteframes.js.map +1 -1
  38. package/dist/js/integrations/spotlight.d.ts +18 -0
  39. package/dist/js/integrations/spotlight.d.ts.map +1 -0
  40. package/dist/js/integrations/spotlight.js +84 -0
  41. package/dist/js/integrations/spotlight.js.map +1 -0
  42. package/dist/js/options.d.ts +19 -0
  43. package/dist/js/options.d.ts.map +1 -1
  44. package/dist/js/options.js.map +1 -1
  45. package/dist/js/profiling/cache.d.ts +3 -3
  46. package/dist/js/profiling/cache.d.ts.map +1 -1
  47. package/dist/js/profiling/cache.js.map +1 -1
  48. package/dist/js/profiling/integration.d.ts +7 -3
  49. package/dist/js/profiling/integration.d.ts.map +1 -1
  50. package/dist/js/profiling/integration.js +16 -5
  51. package/dist/js/profiling/integration.js.map +1 -1
  52. package/dist/js/profiling/nativeTypes.d.ts +8 -0
  53. package/dist/js/profiling/nativeTypes.d.ts.map +1 -1
  54. package/dist/js/profiling/nativeTypes.js.map +1 -1
  55. package/dist/js/profiling/types.d.ts +59 -2
  56. package/dist/js/profiling/types.d.ts.map +1 -1
  57. package/dist/js/profiling/types.js.map +1 -1
  58. package/dist/js/profiling/utils.d.ts +9 -5
  59. package/dist/js/profiling/utils.d.ts.map +1 -1
  60. package/dist/js/profiling/utils.js +16 -1
  61. package/dist/js/profiling/utils.js.map +1 -1
  62. package/dist/js/sdk.d.ts +1 -1
  63. package/dist/js/sdk.d.ts.map +1 -1
  64. package/dist/js/sdk.js +3 -2
  65. package/dist/js/sdk.js.map +1 -1
  66. package/dist/js/tools/sentryMetroSerializer.js +1 -0
  67. package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
  68. package/dist/js/tracing/addTracingExtensions.d.ts.map +1 -1
  69. package/dist/js/tracing/addTracingExtensions.js.map +1 -1
  70. package/dist/js/tracing/nativeframes.d.ts.map +1 -1
  71. package/dist/js/tracing/nativeframes.js +3 -1
  72. package/dist/js/tracing/nativeframes.js.map +1 -1
  73. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  74. package/dist/js/tracing/reactnativetracing.js +3 -1
  75. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  76. package/dist/js/utils/worldwide.d.ts +2 -0
  77. package/dist/js/utils/worldwide.d.ts.map +1 -1
  78. package/dist/js/utils/worldwide.js.map +1 -1
  79. package/dist/js/utils/xhr.d.ts +20 -0
  80. package/dist/js/utils/xhr.d.ts.map +1 -0
  81. package/dist/js/utils/xhr.js +31 -0
  82. package/dist/js/utils/xhr.js.map +1 -0
  83. package/dist/js/version.d.ts +1 -1
  84. package/dist/js/version.js +1 -1
  85. package/dist/js/version.js.map +1 -1
  86. package/dist/js/wrapper.d.ts +4 -3
  87. package/dist/js/wrapper.d.ts.map +1 -1
  88. package/dist/js/wrapper.js +19 -19
  89. package/dist/js/wrapper.js.map +1 -1
  90. package/ios/RNSentry.mm +5 -8
  91. package/package.json +16 -12
  92. package/scripts/expo-upload-sourcemaps.js +54 -12
  93. package/scripts/sentry-xcode-debug-files.sh +5 -2
  94. package/src/js/NativeRNSentry.ts +8 -3
  95. package/ts3.8/dist/js/NativeRNSentry.d.ts +3 -2
  96. package/ts3.8/dist/js/index.d.ts +1 -1
  97. package/ts3.8/dist/js/integrations/index.d.ts +1 -0
  98. package/ts3.8/dist/js/integrations/nativelinkederrors.d.ts +6 -2
  99. package/ts3.8/dist/js/integrations/rewriteframes.d.ts +2 -2
  100. package/ts3.8/dist/js/integrations/spotlight.d.ts +18 -0
  101. package/ts3.8/dist/js/options.d.ts +19 -0
  102. package/ts3.8/dist/js/profiling/cache.d.ts +3 -3
  103. package/ts3.8/dist/js/profiling/integration.d.ts +7 -3
  104. package/ts3.8/dist/js/profiling/nativeTypes.d.ts +8 -0
  105. package/ts3.8/dist/js/profiling/types.d.ts +59 -2
  106. package/ts3.8/dist/js/profiling/utils.d.ts +9 -5
  107. package/ts3.8/dist/js/sdk.d.ts +1 -1
  108. package/ts3.8/dist/js/utils/worldwide.d.ts +2 -0
  109. package/ts3.8/dist/js/utils/xhr.d.ts +20 -0
  110. package/ts3.8/dist/js/version.d.ts +1 -1
  111. package/ts3.8/dist/js/wrapper.d.ts +4 -3
@@ -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,EAChB,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,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,EACtB,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC","sourcesContent":["export type {\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 startInactiveSpan,\n startSpan,\n startSpanManual,\n getActiveSpan,\n} from '@sentry/core';\n\nimport { _addTracingExtensions } from './tracing/addTracingExtensions';\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 type { 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 sentryTraceGesture,\n} from './tracing';\nexport type { ReactNavigationTransactionContext } from './tracing';\nexport { Integrations, SDK_NAME, SDK_VERSION };\n"]}
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;AAEhB,WAAW;AACX,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,aAAa,EACb,UAAU,EACV,aAAa,EACb,cAAc;AAEd,YAAY;AACZ,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,OAAO,GACR,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,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,EACtB,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC","sourcesContent":["export type {\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\n // v8 spans\n startInactiveSpan,\n startSpan,\n startSpanManual,\n getActiveSpan,\n spanToJSON,\n spanIsSampled,\n setMeasurement,\n\n // v8 scopes\n getCurrentScope,\n getGlobalScope,\n getIsolationScope,\n getClient,\n setCurrentClient,\n addEventProcessor,\n metrics,\n} from '@sentry/core';\n\nimport { _addTracingExtensions } from './tracing/addTracingExtensions';\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 type { 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 sentryTraceGesture,\n} from './tracing';\nexport type { ReactNavigationTransactionContext } from './tracing';\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":"AAAA,OAAO,KAAK,EAAoB,cAAc,EAAE,GAAG,EAAE,WAAW,EAAkC,MAAM,eAAe,CAAC;AASxH;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,6DAA6D;AAC7D,qBAAa,iBAAkB,YAAW,WAAW;IACnD;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAuB;IAC/C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAwB;IAE3C;;OAEG;IACI,SAAS,CAAC,uBAAuB,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,GAAG,IAAI;IAmC7G;;;OAGG;YACW,YAAY;IAiC1B;;;OAGG;YACW,uCAAuC;IA2BrD;;;;OAIG;IACH,OAAO,CAAC,8BAA8B;IAWtC;;;;OAIG;IACH,OAAO,CAAC,2BAA2B;IAMnC;;;;;OAKG;YACW,iBAAiB;IA6B/B;;OAEG;YACW,mBAAmB;IAWjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAU9B;;OAEG;IACH,OAAO,CAAC,aAAa;CAQtB"}
1
+ {"version":3,"file":"debugsymbolicator.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,cAAc,EAAE,GAAG,EAAE,WAAW,EAAkC,MAAM,eAAe,CAAC;AAWxH;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,6DAA6D;AAC7D,qBAAa,iBAAkB,YAAW,WAAW;IACnD;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAuB;IAC/C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAwB;IAE3C;;OAEG;IACI,SAAS,CAAC,uBAAuB,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,GAAG,IAAI;IAmC7G;;;OAGG;YACW,YAAY;IAiC1B;;;OAGG;YACW,uCAAuC;IA2BrD;;;;OAIG;IACH,OAAO,CAAC,8BAA8B;IAWtC;;;;OAIG;IACH,OAAO,CAAC,2BAA2B;IAMnC;;;;;OAKG;YACW,iBAAiB;IA6B/B;;OAEG;YACW,mBAAmB;IA2BjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAU9B;;OAEG;IACH,OAAO,CAAC,aAAa;CAQtB"}
@@ -2,6 +2,8 @@ import { __awaiter } from "tslib";
2
2
  import { addContextToFrame, logger } from '@sentry/utils';
3
3
  import { getFramesToPop, isErrorLike } from '../utils/error';
4
4
  import { ReactNativeLibraries } from '../utils/rnlibraries';
5
+ import { createStealthXhr, XHR_READYSTATE_DONE } from '../utils/xhr';
6
+ // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor
5
7
  const INTERNAL_CALLSITES_REGEX = new RegExp(['ReactNativeRenderer-dev\\.js$', 'MessageQueue\\.js$'].join('|'));
6
8
  /** Tries to symbolicate the JS stack trace on the device. */
7
9
  export class DebugSymbolicator {
@@ -158,13 +160,27 @@ export class DebugSymbolicator {
158
160
  */
159
161
  _fetchSourceContext(url, segments, start) {
160
162
  return __awaiter(this, void 0, void 0, function* () {
161
- const response = yield fetch(`${url}${segments.slice(start).join('/')}`, {
162
- method: 'GET',
163
+ return new Promise(resolve => {
164
+ const fullUrl = `${url}${segments.slice(start).join('/')}`;
165
+ const xhr = createStealthXhr();
166
+ if (!xhr) {
167
+ resolve(null);
168
+ return;
169
+ }
170
+ xhr.open('GET', fullUrl, true);
171
+ xhr.send();
172
+ xhr.onreadystatechange = () => {
173
+ if (xhr.readyState === XHR_READYSTATE_DONE) {
174
+ if (xhr.status !== 200) {
175
+ resolve(null);
176
+ }
177
+ resolve(xhr.responseText);
178
+ }
179
+ };
180
+ xhr.onerror = () => {
181
+ resolve(null);
182
+ };
163
183
  });
164
- if (response.ok) {
165
- return response.text();
166
- }
167
- return null;
168
184
  });
169
185
  }
170
186
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"debugsymbolicator.js","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAG5D,MAAM,wBAAwB,GAAG,IAAI,MAAM,CAAC,CAAC,+BAA+B,EAAE,oBAAoB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAY/G,6DAA6D;AAC7D,MAAM,OAAO,iBAAiB;IAA9B;QAKE;;WAEG;QACI,SAAI,GAAW,iBAAiB,CAAC,EAAE,CAAC;IA0N7C,CAAC;IAxNC;;OAEG;IACI,SAAS,CAAC,uBAA2D,EAAE,aAAwB;QACpG,uBAAuB,CAAC,CAAO,KAAY,EAAE,IAAe,EAAE,EAAE;YA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AC,UAAkB;QACzC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE;YAClC,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;SACzD;QACD,OAAO,oBAAoB,CAAC,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACK,sBAAsB,CAC5B,KAAoC,EACpC,SAAmC;QAEnC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE;YAClC,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;SACzD;QACD,OAAO,oBAAoB,CAAC,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC/E,CAAC;IAED;;OAEG;IACK,aAAa;;QACnB,IAAI;YACF,OAAO,MAAA,oBAAoB,CAAC,QAAQ,0CAAE,YAAY,EAAE,CAAC;SACtD;QAAC,OAAO,GAAG,EAAE;YACZ,8BAA8B;SAC/B;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;;AAhOD;;GAEG;AACW,oBAAE,GAAW,mBAAmB,CAAC","sourcesContent":["import type { Event, EventHint, EventProcessor, Hub, Integration, StackFrame as SentryStackFrame } from '@sentry/types';\nimport { addContextToFrame, logger } from '@sentry/utils';\n\nimport { getFramesToPop, isErrorLike } from '../utils/error';\nimport { ReactNativeLibraries } from '../utils/rnlibraries';\nimport type * as ReactNative from '../vendor/react-native';\n\nconst INTERNAL_CALLSITES_REGEX = new RegExp(['ReactNativeRenderer-dev\\\\.js$', 'MessageQueue\\\\.js$'].join('|'));\n\n/**\n * React Native Error\n */\nexport type ReactNativeError = Error & {\n framesToPop?: number;\n jsEngine?: string;\n preventSymbolication?: boolean;\n componentStack?: string;\n};\n\n/** Tries to symbolicate the JS stack trace on the device. */\nexport 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(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void {\n addGlobalEventProcessor(async (event: Event, hint: EventHint) => {\n const self = getCurrentHub().getIntegration(DebugSymbolicator);\n\n if (!self) {\n return event;\n }\n\n if (event.exception && isErrorLike(hint.originalException)) {\n // originalException is ErrorLike object\n const symbolicatedFrames = await this._symbolicate(\n hint.originalException.stack,\n getFramesToPop(hint.originalException as Error),\n );\n symbolicatedFrames && this._replaceExceptionFramesInEvent(event, symbolicatedFrames);\n } else if (hint.syntheticException && isErrorLike(hint.syntheticException)) {\n // syntheticException is Error object\n const symbolicatedFrames = await this._symbolicate(\n hint.syntheticException.stack,\n getFramesToPop(hint.syntheticException),\n );\n\n if (event.exception) {\n symbolicatedFrames && this._replaceExceptionFramesInEvent(event, symbolicatedFrames);\n } else if (event.threads) {\n // RN JS doesn't have threads\n // syntheticException is used for Sentry.captureMessage() threads\n symbolicatedFrames && this._replaceThreadFramesInEvent(event, symbolicatedFrames);\n }\n }\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(rawStack: string, skipFirstFrames: number = 0): Promise<SentryStackFrame[] | null> {\n try {\n const parsedStack = this._parseErrorStack(rawStack);\n\n const prettyStack = await this._symbolicateStackTrace(parsedStack);\n if (!prettyStack) {\n logger.error('React Native DevServer could not symbolicate the stack trace.');\n return null;\n }\n\n // This has been changed in an react-native version so stack is contained in here\n const newStack = prettyStack.stack || prettyStack;\n\n // https://github.com/getsentry/sentry-javascript/blob/739d904342aaf9327312f409952f14ceff4ae1ab/packages/utils/src/stacktrace.ts#L23\n // Match SentryParser which counts lines of stack (-1 for first line with the Error message)\n const skipFirstAdjustedToSentryStackParser = Math.max(skipFirstFrames - 1, 0);\n const stackWithoutPoppedFrames = skipFirstAdjustedToSentryStackParser\n ? newStack.slice(skipFirstAdjustedToSentryStackParser)\n : newStack;\n\n const stackWithoutInternalCallsites = stackWithoutPoppedFrames.filter(\n (frame: { file?: string }) => frame.file && frame.file.match(INTERNAL_CALLSITES_REGEX) === null,\n );\n\n return await this._convertReactNativeFramesToSentryFrames(stackWithoutInternalCallsites);\n } catch (error) {\n if (error instanceof Error) {\n logger.warn(`Unable to symbolicate stack trace: ${error.message}`);\n }\n return null;\n }\n }\n\n /**\n * Converts ReactNativeFrames to frames in the Sentry format\n * @param frames ReactNativeFrame[]\n */\n private async _convertReactNativeFramesToSentryFrames(frames: ReactNative.StackFrame[]): Promise<SentryStackFrame[]> {\n return Promise.all(\n frames.map(async (frame: ReactNative.StackFrame): Promise<SentryStackFrame> => {\n let inApp = !!frame.column && !!frame.lineNumber;\n inApp =\n inApp &&\n frame.file !== undefined &&\n !frame.file.includes('node_modules') &&\n !frame.file.includes('native code');\n\n const newFrame: SentryStackFrame = {\n lineno: frame.lineNumber,\n colno: frame.column,\n filename: frame.file,\n function: frame.methodName,\n in_app: inApp,\n };\n\n if (inApp) {\n await this._addSourceContext(newFrame);\n }\n\n return newFrame;\n }),\n );\n }\n\n /**\n * Replaces the frames in the exception of a error.\n * @param event Event\n * @param frames StackFrame[]\n */\n private _replaceExceptionFramesInEvent(event: Event, frames: SentryStackFrame[]): 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 * Replaces the frames in the thread of a message.\n * @param event Event\n * @param frames StackFrame[]\n */\n private _replaceThreadFramesInEvent(event: Event, frames: SentryStackFrame[]): void {\n if (event.threads && event.threads.values && event.threads.values[0] && event.threads.values[0].stacktrace) {\n event.threads.values[0].stacktrace.frames = frames.reverse();\n }\n }\n\n /**\n * This tries to add source context for in_app Frames\n *\n * @param frame StackFrame\n * @param getDevServer function from RN to get DevServer URL\n */\n private async _addSourceContext(frame: SentryStackFrame): Promise<void> {\n let sourceContext: string | null = null;\n\n const segments = frame.filename?.split('/') ?? [];\n\n const serverUrl = this._getDevServer()?.url;\n if (!serverUrl) {\n return;\n }\n\n for (const idx in segments) {\n if (!Object.prototype.hasOwnProperty.call(segments, idx)) {\n continue;\n }\n\n sourceContext = await this._fetchSourceContext(serverUrl, segments, -idx);\n if (sourceContext) {\n break;\n }\n }\n\n if (!sourceContext) {\n return;\n }\n\n const lines = sourceContext.split('\\n');\n addContextToFrame(lines, frame);\n }\n\n /**\n * Get source context for segment\n */\n private async _fetchSourceContext(url: string, segments: Array<string>, start: number): Promise<string | null> {\n const response = await fetch(`${url}${segments.slice(start).join('/')}`, {\n method: 'GET',\n });\n\n if (response.ok) {\n return response.text();\n }\n return null;\n }\n\n /**\n * Loads and calls RN Core Devtools parseErrorStack function.\n */\n private _parseErrorStack(errorStack: string): Array<ReactNative.StackFrame> {\n if (!ReactNativeLibraries.Devtools) {\n throw new Error('React Native Devtools not available.');\n }\n return ReactNativeLibraries.Devtools.parseErrorStack(errorStack);\n }\n\n /**\n * Loads and calls RN Core Devtools symbolicateStackTrace function.\n */\n private _symbolicateStackTrace(\n stack: Array<ReactNative.StackFrame>,\n extraData?: Record<string, unknown>,\n ): Promise<ReactNative.SymbolicatedStackTrace> {\n if (!ReactNativeLibraries.Devtools) {\n throw new Error('React Native Devtools not available.');\n }\n return ReactNativeLibraries.Devtools.symbolicateStackTrace(stack, extraData);\n }\n\n /**\n * Loads and returns the RN DevServer URL.\n */\n private _getDevServer(): ReactNative.DevServerInfo | undefined {\n try {\n return ReactNativeLibraries.Devtools?.getDevServer();\n } catch (_oO) {\n // We can't load devserver URL\n }\n return undefined;\n }\n}\n"]}
1
+ {"version":3,"file":"debugsymbolicator.js","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,M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C,oBAAoB,CAAC,QAAQ,EAAE;YAClC,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;SACzD;QACD,OAAO,oBAAoB,CAAC,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC/E,CAAC;IAED;;OAEG;IACK,aAAa;;QACnB,IAAI;YACF,OAAO,MAAA,oBAAoB,CAAC,QAAQ,0CAAE,YAAY,EAAE,CAAC;SACtD;QAAC,OAAO,GAAG,EAAE;YACZ,8BAA8B;SAC/B;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;;AAhPD;;GAEG;AACW,oBAAE,GAAW,mBAAmB,CAAC","sourcesContent":["import type { Event, EventHint, EventProcessor, Hub, Integration, StackFrame as SentryStackFrame } from '@sentry/types';\nimport { addContextToFrame, logger } from '@sentry/utils';\n\nimport { getFramesToPop, isErrorLike } from '../utils/error';\nimport { ReactNativeLibraries } from '../utils/rnlibraries';\nimport { createStealthXhr, XHR_READYSTATE_DONE } from '../utils/xhr';\nimport type * as ReactNative from '../vendor/react-native';\n\n// eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\nconst INTERNAL_CALLSITES_REGEX = new RegExp(['ReactNativeRenderer-dev\\\\.js$', 'MessageQueue\\\\.js$'].join('|'));\n\n/**\n * React Native Error\n */\nexport type ReactNativeError = Error & {\n framesToPop?: number;\n jsEngine?: string;\n preventSymbolication?: boolean;\n componentStack?: string;\n};\n\n/** Tries to symbolicate the JS stack trace on the device. */\nexport 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(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void {\n addGlobalEventProcessor(async (event: Event, hint: EventHint) => {\n const self = getCurrentHub().getIntegration(DebugSymbolicator);\n\n if (!self) {\n return event;\n }\n\n if (event.exception && isErrorLike(hint.originalException)) {\n // originalException is ErrorLike object\n const symbolicatedFrames = await this._symbolicate(\n hint.originalException.stack,\n getFramesToPop(hint.originalException as Error),\n );\n symbolicatedFrames && this._replaceExceptionFramesInEvent(event, symbolicatedFrames);\n } else if (hint.syntheticException && isErrorLike(hint.syntheticException)) {\n // syntheticException is Error object\n const symbolicatedFrames = await this._symbolicate(\n hint.syntheticException.stack,\n getFramesToPop(hint.syntheticException),\n );\n\n if (event.exception) {\n symbolicatedFrames && this._replaceExceptionFramesInEvent(event, symbolicatedFrames);\n } else if (event.threads) {\n // RN JS doesn't have threads\n // syntheticException is used for Sentry.captureMessage() threads\n symbolicatedFrames && this._replaceThreadFramesInEvent(event, symbolicatedFrames);\n }\n }\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(rawStack: string, skipFirstFrames: number = 0): Promise<SentryStackFrame[] | null> {\n try {\n const parsedStack = this._parseErrorStack(rawStack);\n\n const prettyStack = await this._symbolicateStackTrace(parsedStack);\n if (!prettyStack) {\n logger.error('React Native DevServer could not symbolicate the stack trace.');\n return null;\n }\n\n // This has been changed in an react-native version so stack is contained in here\n const newStack = prettyStack.stack || prettyStack;\n\n // https://github.com/getsentry/sentry-javascript/blob/739d904342aaf9327312f409952f14ceff4ae1ab/packages/utils/src/stacktrace.ts#L23\n // Match SentryParser which counts lines of stack (-1 for first line with the Error message)\n const skipFirstAdjustedToSentryStackParser = Math.max(skipFirstFrames - 1, 0);\n const stackWithoutPoppedFrames = skipFirstAdjustedToSentryStackParser\n ? newStack.slice(skipFirstAdjustedToSentryStackParser)\n : newStack;\n\n const stackWithoutInternalCallsites = stackWithoutPoppedFrames.filter(\n (frame: { file?: string }) => frame.file && frame.file.match(INTERNAL_CALLSITES_REGEX) === null,\n );\n\n return await this._convertReactNativeFramesToSentryFrames(stackWithoutInternalCallsites);\n } catch (error) {\n if (error instanceof Error) {\n logger.warn(`Unable to symbolicate stack trace: ${error.message}`);\n }\n return null;\n }\n }\n\n /**\n * Converts ReactNativeFrames to frames in the Sentry format\n * @param frames ReactNativeFrame[]\n */\n private async _convertReactNativeFramesToSentryFrames(frames: ReactNative.StackFrame[]): Promise<SentryStackFrame[]> {\n return Promise.all(\n frames.map(async (frame: ReactNative.StackFrame): Promise<SentryStackFrame> => {\n let inApp = !!frame.column && !!frame.lineNumber;\n inApp =\n inApp &&\n frame.file !== undefined &&\n !frame.file.includes('node_modules') &&\n !frame.file.includes('native code');\n\n const newFrame: SentryStackFrame = {\n lineno: frame.lineNumber,\n colno: frame.column,\n filename: frame.file,\n function: frame.methodName,\n in_app: inApp,\n };\n\n if (inApp) {\n await this._addSourceContext(newFrame);\n }\n\n return newFrame;\n }),\n );\n }\n\n /**\n * Replaces the frames in the exception of a error.\n * @param event Event\n * @param frames StackFrame[]\n */\n private _replaceExceptionFramesInEvent(event: Event, frames: SentryStackFrame[]): 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 * Replaces the frames in the thread of a message.\n * @param event Event\n * @param frames StackFrame[]\n */\n private _replaceThreadFramesInEvent(event: Event, frames: SentryStackFrame[]): void {\n if (event.threads && event.threads.values && event.threads.values[0] && event.threads.values[0].stacktrace) {\n event.threads.values[0].stacktrace.frames = frames.reverse();\n }\n }\n\n /**\n * This tries to add source context for in_app Frames\n *\n * @param frame StackFrame\n * @param getDevServer function from RN to get DevServer URL\n */\n private async _addSourceContext(frame: SentryStackFrame): Promise<void> {\n let sourceContext: string | null = null;\n\n const segments = frame.filename?.split('/') ?? [];\n\n const serverUrl = this._getDevServer()?.url;\n if (!serverUrl) {\n return;\n }\n\n for (const idx in segments) {\n if (!Object.prototype.hasOwnProperty.call(segments, idx)) {\n continue;\n }\n\n sourceContext = await this._fetchSourceContext(serverUrl, segments, -idx);\n if (sourceContext) {\n break;\n }\n }\n\n if (!sourceContext) {\n return;\n }\n\n const lines = sourceContext.split('\\n');\n addContextToFrame(lines, frame);\n }\n\n /**\n * Get source context for segment\n */\n private async _fetchSourceContext(url: string, segments: Array<string>, start: number): Promise<string | null> {\n return new Promise(resolve => {\n const fullUrl = `${url}${segments.slice(start).join('/')}`;\n\n const xhr = createStealthXhr();\n if (!xhr) {\n resolve(null);\n return;\n }\n\n xhr.open('GET', fullUrl, true);\n xhr.send();\n\n xhr.onreadystatechange = (): void => {\n if (xhr.readyState === XHR_READYSTATE_DONE) {\n if (xhr.status !== 200) {\n resolve(null);\n }\n resolve(xhr.responseText);\n }\n };\n xhr.onerror = (): void => {\n resolve(null);\n };\n });\n }\n\n /**\n * Loads and calls RN Core Devtools parseErrorStack function.\n */\n private _parseErrorStack(errorStack: string): Array<ReactNative.StackFrame> {\n if (!ReactNativeLibraries.Devtools) {\n throw new Error('React Native Devtools not available.');\n }\n return ReactNativeLibraries.Devtools.parseErrorStack(errorStack);\n }\n\n /**\n * Loads and calls RN Core Devtools symbolicateStackTrace function.\n */\n private _symbolicateStackTrace(\n stack: Array<ReactNative.StackFrame>,\n extraData?: Record<string, unknown>,\n ): Promise<ReactNative.SymbolicatedStackTrace> {\n if (!ReactNativeLibraries.Devtools) {\n throw new Error('React Native Devtools not available.');\n }\n return ReactNativeLibraries.Devtools.symbolicateStackTrace(stack, extraData);\n }\n\n /**\n * Loads and returns the RN DevServer URL.\n */\n private _getDevServer(): ReactNative.DevServerInfo | undefined {\n try {\n return ReactNativeLibraries.Devtools?.getDevServer();\n } catch (_oO) {\n // We can't load devserver URL\n }\n return undefined;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/default.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAkB3D;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,wBAAwB,GAAG,WAAW,EAAE,CAoEvF"}
1
+ {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/default.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAmB3D;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,wBAAwB,GAAG,WAAW,EAAE,CA4EvF"}
@@ -15,6 +15,7 @@ import { Release } from './release';
15
15
  import { createReactNativeRewriteFrames } from './rewriteframes';
16
16
  import { Screenshot } from './screenshot';
17
17
  import { SdkInfo } from './sdkinfo';
18
+ import { Spotlight } from './spotlight';
18
19
  import { ViewHierarchy } from './viewhierarchy';
19
20
  /**
20
21
  * Returns the default ReactNative integrations based on the current environment.
@@ -79,6 +80,11 @@ export function getDefaultIntegrations(options) {
79
80
  if (isExpoGo()) {
80
81
  integrations.push(new ExpoContext());
81
82
  }
83
+ if (options.enableSpotlight) {
84
+ integrations.push(Spotlight({
85
+ sidecarUrl: options.spotlightSidecarUrl,
86
+ }));
87
+ }
82
88
  return integrations;
83
89
  }
84
90
  //# sourceMappingURL=default.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"default.js","sourceRoot":"","sources":["../../../src/js/integrations/default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,IAAI,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAIzE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD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Ae,EAAE,CAAC,CAAC;SAC1C;KACF;IAED,yGAAyG;IACzG,sEAAsE;IACtE,0DAA0D;IAC1D,MAAM,iBAAiB,GACrB,OAAO,CAAC,aAAa;QACrB,OAAO,OAAO,CAAC,gBAAgB,KAAK,QAAQ;QAC5C,OAAO,OAAO,CAAC,aAAa,KAAK,UAAU,CAAC;IAC9C,IAAI,iBAAiB,IAAI,OAAO,CAAC,4BAA4B,EAAE;QAC7D,YAAY,CAAC,IAAI,CAAC,IAAI,kBAAkB,EAAE,CAAC,CAAC;KAC7C;IACD,IAAI,OAAO,CAAC,2BAA2B,EAAE;QACvC,YAAY,CAAC,IAAI,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC;KACrC;IAED,IAAI,QAAQ,EAAE,EAAE;QACd,YAAY,CAAC,IAAI,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC;KACtC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import { HttpClient } from '@sentry/integrations';\nimport { Integrations as BrowserReactIntegrations } from '@sentry/react';\nimport type { Integration } from '@sentry/types';\n\nimport type { ReactNativeClientOptions } from '../options';\nimport { HermesProfiling } from '../profiling/integration';\nimport { ReactNativeTracing } from '../tracing';\nimport { isExpoGo, notWeb } from '../utils/environment';\nimport { DebugSymbolicator } from './debugsymbolicator';\nimport { DeviceContext } from './devicecontext';\nimport { EventOrigin } from './eventorigin';\nimport { ExpoContext } from './expocontext';\nimport { ModulesLoader } from './modulesloader';\nimport { NativeLinkedErrors } from './nativelinkederrors';\nimport { ReactNativeErrorHandlers } from './reactnativeerrorhandlers';\nimport { ReactNativeInfo } from './reactnativeinfo';\nimport { Release } from './release';\nimport { createReactNativeRewriteFrames } from './rewriteframes';\nimport { Screenshot } from './screenshot';\nimport { SdkInfo } from './sdkinfo';\nimport { ViewHierarchy } from './viewhierarchy';\n\n/**\n * Returns the default ReactNative integrations based on the current environment.\n *\n * Native integrations are only returned when native is enabled.\n *\n * Web integrations are only returned when running on web.\n */\nexport function getDefaultIntegrations(options: ReactNativeClientOptions): Integration[] {\n const integrations: Integration[] = [];\n\n if (notWeb()) {\n integrations.push(\n new ReactNativeErrorHandlers({\n patchGlobalPromise: options.patchGlobalPromise,\n }),\n );\n integrations.push(new NativeLinkedErrors());\n } else {\n integrations.push(new BrowserReactIntegrations.TryCatch());\n integrations.push(new BrowserReactIntegrations.GlobalHandlers());\n integrations.push(new BrowserReactIntegrations.LinkedErrors());\n }\n\n // @sentry/react default integrations\n integrations.push(new BrowserReactIntegrations.InboundFilters());\n integrations.push(new BrowserReactIntegrations.FunctionToString());\n integrations.push(new BrowserReactIntegrations.Breadcrumbs());\n integrations.push(new BrowserReactIntegrations.Dedupe());\n integrations.push(new BrowserReactIntegrations.HttpContext());\n // end @sentry/react-native default integrations\n\n integrations.push(new Release());\n integrations.push(new EventOrigin());\n integrations.push(new SdkInfo());\n integrations.push(new ReactNativeInfo());\n\n if (__DEV__ && notWeb()) {\n integrations.push(new DebugSymbolicator());\n }\n\n integrations.push(createReactNativeRewriteFrames());\n\n if (options.enableNative) {\n integrations.push(new DeviceContext());\n integrations.push(new ModulesLoader());\n if (options.attachScreenshot) {\n integrations.push(new Screenshot());\n }\n if (options.attachViewHierarchy) {\n integrations.push(new ViewHierarchy());\n }\n if (options._experiments && typeof options._experiments.profilesSampleRate === 'number') {\n integrations.push(new HermesProfiling());\n }\n }\n\n // hasTracingEnabled from `@sentry/core` only check if tracesSampler or tracesSampleRate keys are present\n // that's different from prev imp here and might lead misconfiguration\n // `tracesSampleRate: undefined` should not enable tracing\n const hasTracingEnabled =\n options.enableTracing ||\n typeof options.tracesSampleRate === 'number' ||\n typeof options.tracesSampler === 'function';\n if (hasTracingEnabled && options.enableAutoPerformanceTracing) {\n integrations.push(new ReactNativeTracing());\n }\n if (options.enableCaptureFailedRequests) {\n integrations.push(new HttpClient());\n }\n\n if (isExpoGo()) {\n integrations.push(new ExpoContext());\n }\n\n return integrations;\n}\n"]}
1
+ {"version":3,"file":"default.js","s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C,IAAI,aAAa,EAAE,CAAC,CAAC;QACvC,YAAY,CAAC,IAAI,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;QACvC,IAAI,OAAO,CAAC,gBAAgB,EAAE;YAC5B,YAAY,CAAC,IAAI,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC;SACrC;QACD,IAAI,OAAO,CAAC,mBAAmB,EAAE;YAC/B,YAAY,CAAC,IAAI,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;SACxC;QACD,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,OAAO,CAAC,YAAY,CAAC,kBAAkB,KAAK,QAAQ,EAAE;YACvF,YAAY,CAAC,IAAI,CAAC,IAAI,eAAe,EAAE,CAAC,CAAC;SAC1C;KACF;IAED,yGAAyG;IACzG,sEAAsE;IACtE,0DAA0D;IAC1D,MAAM,iBAAiB,GACrB,OAAO,CAAC,aAAa;QACrB,OAAO,OAAO,CAAC,gBAAgB,KAAK,QAAQ;QAC5C,OAAO,OAAO,CAAC,aAAa,KAAK,UAAU,CAAC;IAC9C,IAAI,iBAAiB,IAAI,OAAO,CAAC,4BAA4B,EAAE;QAC7D,YAAY,CAAC,IAAI,CAAC,IAAI,kBAAkB,EAAE,CAAC,CAAC;KAC7C;IACD,IAAI,OAAO,CAAC,2BAA2B,EAAE;QACvC,YAAY,CAAC,IAAI,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC;KACrC;IAED,IAAI,QAAQ,EAAE,EAAE;QACd,YAAY,CAAC,IAAI,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC;KACtC;IAED,IAAI,OAAO,CAAC,eAAe,EAAE;QAC3B,YAAY,CAAC,IAAI,CACf,SAAS,CAAC;YACR,UAAU,EAAE,OAAO,CAAC,mBAAmB;SACxC,CAAC,CACH,CAAC;KACH;IAED,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import { HttpClient } from '@sentry/integrations';\nimport { Integrations as BrowserReactIntegrations } from '@sentry/react';\nimport type { Integration } from '@sentry/types';\n\nimport type { ReactNativeClientOptions } from '../options';\nimport { HermesProfiling } from '../profiling/integration';\nimport { ReactNativeTracing } from '../tracing';\nimport { isExpoGo, notWeb } from '../utils/environment';\nimport { DebugSymbolicator } from './debugsymbolicator';\nimport { DeviceContext } from './devicecontext';\nimport { EventOrigin } from './eventorigin';\nimport { ExpoContext } from './expocontext';\nimport { ModulesLoader } from './modulesloader';\nimport { NativeLinkedErrors } from './nativelinkederrors';\nimport { ReactNativeErrorHandlers } from './reactnativeerrorhandlers';\nimport { ReactNativeInfo } from './reactnativeinfo';\nimport { Release } from './release';\nimport { createReactNativeRewriteFrames } from './rewriteframes';\nimport { Screenshot } from './screenshot';\nimport { SdkInfo } from './sdkinfo';\nimport { Spotlight } from './spotlight';\nimport { ViewHierarchy } from './viewhierarchy';\n\n/**\n * Returns the default ReactNative integrations based on the current environment.\n *\n * Native integrations are only returned when native is enabled.\n *\n * Web integrations are only returned when running on web.\n */\nexport function getDefaultIntegrations(options: ReactNativeClientOptions): Integration[] {\n const integrations: Integration[] = [];\n\n if (notWeb()) {\n integrations.push(\n new ReactNativeErrorHandlers({\n patchGlobalPromise: options.patchGlobalPromise,\n }),\n );\n integrations.push(new NativeLinkedErrors());\n } else {\n integrations.push(new BrowserReactIntegrations.TryCatch());\n integrations.push(new BrowserReactIntegrations.GlobalHandlers());\n integrations.push(new BrowserReactIntegrations.LinkedErrors());\n }\n\n // @sentry/react default integrations\n integrations.push(new BrowserReactIntegrations.InboundFilters());\n integrations.push(new BrowserReactIntegrations.FunctionToString());\n integrations.push(new BrowserReactIntegrations.Breadcrumbs());\n integrations.push(new BrowserReactIntegrations.Dedupe());\n integrations.push(new BrowserReactIntegrations.HttpContext());\n // end @sentry/react-native default integrations\n\n integrations.push(new Release());\n integrations.push(new EventOrigin());\n integrations.push(new SdkInfo());\n integrations.push(new ReactNativeInfo());\n\n if (__DEV__ && notWeb()) {\n integrations.push(new DebugSymbolicator());\n }\n\n integrations.push(createReactNativeRewriteFrames());\n\n if (options.enableNative) {\n integrations.push(new DeviceContext());\n integrations.push(new ModulesLoader());\n if (options.attachScreenshot) {\n integrations.push(new Screenshot());\n }\n if (options.attachViewHierarchy) {\n integrations.push(new ViewHierarchy());\n }\n if (options._experiments && typeof options._experiments.profilesSampleRate === 'number') {\n integrations.push(new HermesProfiling());\n }\n }\n\n // hasTracingEnabled from `@sentry/core` only check if tracesSampler or tracesSampleRate keys are present\n // that's different from prev imp here and might lead misconfiguration\n // `tracesSampleRate: undefined` should not enable tracing\n const hasTracingEnabled =\n options.enableTracing ||\n typeof options.tracesSampleRate === 'number' ||\n typeof options.tracesSampler === 'function';\n if (hasTracingEnabled && options.enableAutoPerformanceTracing) {\n integrations.push(new ReactNativeTracing());\n }\n if (options.enableCaptureFailedRequests) {\n integrations.push(new HttpClient());\n }\n\n if (isExpoGo()) {\n integrations.push(new ExpoContext());\n }\n\n if (options.enableSpotlight) {\n integrations.push(\n Spotlight({\n sidecarUrl: options.spotlightSidecarUrl,\n }),\n );\n }\n\n return integrations;\n}\n"]}
@@ -7,4 +7,5 @@ export { SdkInfo } from './sdkinfo';
7
7
  export { ReactNativeInfo } from './reactnativeinfo';
8
8
  export { ModulesLoader } from './modulesloader';
9
9
  export { HermesProfiling } from '../profiling/integration';
10
+ export { Spotlight } from './spotlight';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -7,4 +7,5 @@ export { SdkInfo } from './sdkinfo';
7
7
  export { ReactNativeInfo } from './reactnativeinfo';
8
8
  export { ModulesLoader } from './modulesloader';
9
9
  export { HermesProfiling } from '../profiling/integration';
10
+ export { Spotlight } from './spotlight';
10
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/js/integrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export { DebugSymbolicator } from './debugsymbolicator';\nexport { DeviceContext } from './devicecontext';\nexport { ReactNativeErrorHandlers } from './reactnativeerrorhandlers';\nexport { Release } from './release';\nexport { EventOrigin } from './eventorigin';\nexport { SdkInfo } from './sdkinfo';\nexport { ReactNativeInfo } from './reactnativeinfo';\nexport { ModulesLoader } from './modulesloader';\nexport { HermesProfiling } from '../profiling/integration';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/js/integrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { DebugSymbolicator } from './debugsymbolicator';\nexport { DeviceContext } from './devicecontext';\nexport { ReactNativeErrorHandlers } from './reactnativeerrorhandlers';\nexport { Release } from './release';\nexport { EventOrigin } from './eventorigin';\nexport { SdkInfo } from './sdkinfo';\nexport { ReactNativeInfo } from './reactnativeinfo';\nexport { ModulesLoader } from './modulesloader';\nexport { HermesProfiling } from '../profiling/integration';\nexport { Spotlight } from './spotlight';\n"]}
@@ -1,4 +1,4 @@
1
- import type { EventProcessor, Hub, Integration } from '@sentry/types';
1
+ import type { Client, Event, EventHint, EventProcessor, Hub, Integration } from '@sentry/types';
2
2
  interface LinkedErrorsOptions {
3
3
  key: string;
4
4
  limit: number;
@@ -25,7 +25,11 @@ export declare class NativeLinkedErrors implements Integration {
25
25
  /**
26
26
  * @inheritDoc
27
27
  */
28
- setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void;
28
+ setupOnce(_addGlobalEventProcessor: (callback: EventProcessor) => void, _getCurrentHub: () => Hub): void;
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ preprocessEvent(event: Event, hint: EventHint | undefined, client: Client): void;
29
33
  /**
30
34
  * Enriches passed event with linked exceptions and native debug meta images.
31
35
  */
@@ -1 +1 @@
1
- {"version":3,"file":"nativelinkederrors.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/nativelinkederrors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,cAAc,EAGd,GAAG,EACH,WAAW,EAGZ,MAAM,eAAe,CAAC;AASvB,UAAU,mBAAmB;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,qBAAa,kBAAmB,YAAW,WAAW;IACpD;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAwB;IAEhD;;OAEG;IACI,IAAI,EAAE,MAAM,CAAyB;IAE5C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA6B;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+B;IACtD,OAAO,CAAC,cAAc,CAAuB;IAE7C;;OAEG;gBACgB,OAAO,GAAE,OAAO,CAAC,mBAAmB,CAAM;IAK7D;;OAEG;IACI,SAAS,CAAC,uBAAuB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;IAqDtB;;OAEG;IACH,OAAO,CAAC,+BAA+B;IAkCvC;;OAEG;IACH,OAAO,CAAC,uCAAuC;IAsB/C;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAI3B;;OAEG;IACH,OAAO,CAAC,uBAAuB;CAGhC"}
@@ -1,4 +1,3 @@
1
- import { __awaiter } from "tslib";
2
1
  import { exceptionFromError } from '@sentry/browser';
3
2
  import { isInstanceOf, isPlainObject } from '@sentry/utils';
4
3
  import { NATIVE } from '../wrapper';
@@ -23,77 +22,71 @@ export class NativeLinkedErrors {
23
22
  /**
24
23
  * @inheritDoc
25
24
  */
26
- setupOnce(addGlobalEventProcessor, getCurrentHub) {
27
- const client = getCurrentHub().getClient();
28
- if (!client) {
29
- return;
25
+ setupOnce(_addGlobalEventProcessor, _getCurrentHub) {
26
+ /* noop */
27
+ }
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ preprocessEvent(event, hint, client) {
32
+ if (this._nativePackage === null) {
33
+ this._nativePackage = this._fetchNativePackage();
30
34
  }
31
- addGlobalEventProcessor((event, hint) => __awaiter(this, void 0, void 0, function* () {
32
- if (this._nativePackage === null) {
33
- this._nativePackage = yield this._fetchNativePackage();
34
- }
35
- const self = getCurrentHub().getIntegration(NativeLinkedErrors);
36
- return self ? this._handler(client.getOptions().stackParser, self._key, self._limit, event, hint) : event;
37
- }));
35
+ this._handler(client.getOptions().stackParser, this._key, this._limit, event, hint);
38
36
  }
39
37
  /**
40
38
  * Enriches passed event with linked exceptions and native debug meta images.
41
39
  */
42
40
  _handler(parser, key, limit, event, hint) {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- if (!event.exception || !event.exception.values || !hint || !isInstanceOf(hint.originalException, Error)) {
45
- return event;
46
- }
47
- const { exceptions: linkedErrors, debugImages } = yield this._walkErrorTree(parser, limit, hint.originalException, key);
48
- event.exception.values = [...event.exception.values, ...linkedErrors];
49
- event.debug_meta = event.debug_meta || {};
50
- event.debug_meta.images = event.debug_meta.images || [];
51
- event.debug_meta.images.push(...(debugImages || []));
52
- return event;
53
- });
41
+ if (!event.exception || !event.exception.values || !hint || !isInstanceOf(hint.originalException, Error)) {
42
+ return;
43
+ }
44
+ const { exceptions: linkedErrors, debugImages } = this._walkErrorTree(parser, limit, hint.originalException, key);
45
+ event.exception.values = [...event.exception.values, ...linkedErrors];
46
+ event.debug_meta = event.debug_meta || {};
47
+ event.debug_meta.images = event.debug_meta.images || [];
48
+ event.debug_meta.images.push(...(debugImages || []));
54
49
  }
55
50
  /**
56
51
  * Walks linked errors and created Sentry exceptions chain.
57
52
  * Collects debug images from native errors stack frames.
58
53
  */
59
54
  _walkErrorTree(parser, limit, error, key, exceptions = [], debugImages = []) {
60
- return __awaiter(this, void 0, void 0, function* () {
61
- const linkedError = error[key];
62
- if (!linkedError || exceptions.length + 1 >= limit) {
63
- return {
64
- exceptions,
65
- debugImages,
66
- };
67
- }
68
- let exception;
69
- let exceptionDebugImages;
70
- if ('stackElements' in linkedError) {
71
- // isJavaException
72
- exception = this._exceptionFromJavaStackElements(linkedError);
73
- }
74
- else if ('stackReturnAddresses' in linkedError) {
75
- // isObjCException
76
- const { appleException, appleDebugImages } = yield this._exceptionFromAppleStackReturnAddresses(linkedError);
77
- exception = appleException;
78
- exceptionDebugImages = appleDebugImages;
79
- }
80
- else if (isInstanceOf(linkedError, Error)) {
81
- exception = exceptionFromError(parser, error[key]);
82
- }
83
- else if (isPlainObject(linkedError)) {
84
- exception = {
85
- type: typeof linkedError.name === 'string' ? linkedError.name : undefined,
86
- value: typeof linkedError.message === 'string' ? linkedError.message : undefined,
87
- };
88
- }
89
- else {
90
- return {
91
- exceptions,
92
- debugImages,
93
- };
94
- }
95
- return this._walkErrorTree(parser, limit, linkedError, key, [...exceptions, exception], [...debugImages, ...(exceptionDebugImages || [])]);
96
- });
55
+ const linkedError = error[key];
56
+ if (!linkedError || exceptions.length + 1 >= limit) {
57
+ return {
58
+ exceptions,
59
+ debugImages,
60
+ };
61
+ }
62
+ let exception;
63
+ let exceptionDebugImages;
64
+ if ('stackElements' in linkedError) {
65
+ // isJavaException
66
+ exception = this._exceptionFromJavaStackElements(linkedError);
67
+ }
68
+ else if ('stackReturnAddresses' in linkedError) {
69
+ // isObjCException
70
+ const { appleException, appleDebugImages } = this._exceptionFromAppleStackReturnAddresses(linkedError);
71
+ exception = appleException;
72
+ exceptionDebugImages = appleDebugImages;
73
+ }
74
+ else if (isInstanceOf(linkedError, Error)) {
75
+ exception = exceptionFromError(parser, error[key]);
76
+ }
77
+ else if (isPlainObject(linkedError)) {
78
+ exception = {
79
+ type: typeof linkedError.name === 'string' ? linkedError.name : undefined,
80
+ value: typeof linkedError.message === 'string' ? linkedError.message : undefined,
81
+ };
82
+ }
83
+ else {
84
+ return {
85
+ exceptions,
86
+ debugImages,
87
+ };
88
+ }
89
+ return this._walkErrorTree(parser, limit, linkedError, key, [...exceptions, exception], [...debugImages, ...(exceptionDebugImages || [])]);
97
90
  }
98
91
  /**
99
92
  * Converts a Java Throwable to an SentryException
@@ -122,19 +115,17 @@ export class NativeLinkedErrors {
122
115
  * Converts StackAddresses to a SentryException with DebugMetaImages
123
116
  */
124
117
  _exceptionFromAppleStackReturnAddresses(objCException) {
125
- return __awaiter(this, void 0, void 0, function* () {
126
- const nativeStackFrames = yield this._fetchNativeStackFrames(objCException.stackReturnAddresses);
127
- return {
128
- appleException: {
129
- type: objCException.name,
130
- value: objCException.message,
131
- stacktrace: {
132
- frames: (nativeStackFrames && nativeStackFrames.frames.reverse()) || [],
133
- },
118
+ const nativeStackFrames = this._fetchNativeStackFrames(objCException.stackReturnAddresses);
119
+ return {
120
+ appleException: {
121
+ type: objCException.name,
122
+ value: objCException.message,
123
+ stacktrace: {
124
+ frames: (nativeStackFrames && nativeStackFrames.frames.reverse()) || [],
134
125
  },
135
- appleDebugImages: (nativeStackFrames && nativeStackFrames.debugMetaImages) || [],
136
- };
137
- });
126
+ },
127
+ appleDebugImages: (nativeStackFrames && nativeStackFrames.debugMetaImages) || [],
128
+ };
138
129
  }
139
130
  /**
140
131
  * Fetches the native package/image name from the native layer
@@ -1 +1 @@
1
- {"version":3,"file":"nativelinkederrors.js","sourceRoot":"","sources":["../../../src/js/integrations/nativelinkederrors.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAarD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG5D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,MAAM,aAAa,GAAG,CAAC,CAAC;AAOxB;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAe7B;;OAEG;IACH,YAAmB,UAAwC,EAAE;QAZ7D;;WAEG;QACI,SAAI,GAAW,kBAAkB,CAAC,EAAE,CAAC;QAIpC,mBAAc,GAAkB,IAAI,CAAC;QAM3C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,IAAI,WAAW,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,aAAa,CAAC;IAC/C,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,uBAA2D,EAAE,aAAwB;QACpG,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAE,CAAC;QAC3C,IAAI,CAAC,MAAM,EAAE;YACX,OAAO;SACR;QAED,uBAAuB,CAAC,CAAO,KAAY,EAAE,IAAgB,EAAE,EAAE;YAC/D,IAAI,IAAI,CAAC,cAAc,KAAK,IAAI,EAAE;gBAChC,IAAI,CAAC,cAAc,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;aACxD;YACD,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;YAChE,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,WAAW,EAAE,IAAI,CAA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C;IAED;;OAEG;IACK,uBAAuB,CAAC,gBAA0B;QACxD,OAAO,MAAM,CAAC,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;IAC3D,CAAC;;AAvMD;;GAEG;AACW,qBAAE,GAAW,oBAAoB,CAAC","sourcesContent":["import { exceptionFromError } from '@sentry/browser';\nimport type {\n DebugImage,\n Event,\n EventHint,\n EventProcessor,\n Exception,\n ExtendedError,\n Hub,\n Integration,\n StackFrame,\n StackParser,\n} from '@sentry/types';\nimport { isInstanceOf, isPlainObject } from '@sentry/utils';\n\nimport type { NativeStackFrames } from '../NativeRNSentry';\nimport { NATIVE } from '../wrapper';\n\nconst DEFAULT_KEY = 'cause';\nconst DEFAULT_LIMIT = 5;\n\ninterface LinkedErrorsOptions {\n key: string;\n limit: number;\n}\n\n/**\n * Processes JS and RN native linked errors.\n */\nexport class NativeLinkedErrors implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'NativeLinkedErrors';\n\n /**\n * @inheritDoc\n */\n public name: string = NativeLinkedErrors.id;\n\n private readonly _key: LinkedErrorsOptions['key'];\n private readonly _limit: LinkedErrorsOptions['limit'];\n private _nativePackage: string | null = null;\n\n /**\n * @inheritDoc\n */\n public constructor(options: Partial<LinkedErrorsOptions> = {}) {\n this._key = options.key || DEFAULT_KEY;\n this._limit = options.limit || DEFAULT_LIMIT;\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void {\n const client = getCurrentHub().getClient();\n if (!client) {\n return;\n }\n\n addGlobalEventProcessor(async (event: Event, hint?: EventHint) => {\n if (this._nativePackage === null) {\n this._nativePackage = await this._fetchNativePackage();\n }\n const self = getCurrentHub().getIntegration(NativeLinkedErrors);\n return self ? this._handler(client.getOptions().stackParser, self._key, self._limit, event, hint) : event;\n });\n }\n\n /**\n * Enriches passed event with linked exceptions and native debug meta images.\n */\n private async _handler(\n parser: StackParser,\n key: string,\n limit: number,\n event: Event,\n hint?: EventHint,\n ): Promise<Event | null> {\n if (!event.exception || !event.exception.values || !hint || !isInstanceOf(hint.originalException, Error)) {\n return event;\n }\n const { exceptions: linkedErrors, debugImages } = await this._walkErrorTree(\n parser,\n limit,\n hint.originalException as ExtendedError,\n key,\n );\n event.exception.values = [...event.exception.values, ...linkedErrors];\n\n event.debug_meta = event.debug_meta || {};\n event.debug_meta.images = event.debug_meta.images || [];\n event.debug_meta.images.push(...(debugImages || []));\n\n return event;\n }\n\n /**\n * Walks linked errors and created Sentry exceptions chain.\n * Collects debug images from native errors stack frames.\n */\n private async _walkErrorTree(\n parser: StackParser,\n limit: number,\n error: ExtendedError,\n key: string,\n exceptions: Exception[] = [],\n debugImages: DebugImage[] = [],\n ): Promise<{\n exceptions: Exception[];\n debugImages?: DebugImage[];\n }> {\n const linkedError = error[key];\n if (!linkedError || exceptions.length + 1 >= limit) {\n return {\n exceptions,\n debugImages,\n };\n }\n\n let exception: Exception;\n let exceptionDebugImages: DebugImage[] | undefined;\n if ('stackElements' in linkedError) {\n // isJavaException\n exception = this._exceptionFromJavaStackElements(linkedError);\n } else if ('stackReturnAddresses' in linkedError) {\n // isObjCException\n const { appleException, appleDebugImages } = await this._exceptionFromAppleStackReturnAddresses(linkedError);\n exception = appleException;\n exceptionDebugImages = appleDebugImages;\n } else if (isInstanceOf(linkedError, Error)) {\n exception = exceptionFromError(parser, error[key]);\n } else if (isPlainObject(linkedError)) {\n exception = {\n type: typeof linkedError.name === 'string' ? linkedError.name : undefined,\n value: typeof linkedError.message === 'string' ? linkedError.message : undefined,\n };\n } else {\n return {\n exceptions,\n debugImages,\n };\n }\n\n return this._walkErrorTree(\n parser,\n limit,\n linkedError,\n key,\n [...exceptions, exception],\n [...debugImages, ...(exceptionDebugImages || [])],\n );\n }\n\n /**\n * Converts a Java Throwable to an SentryException\n */\n private _exceptionFromJavaStackElements(javaThrowable: {\n name: string;\n message: string;\n stackElements: {\n className: string;\n fileName: string;\n methodName: string;\n lineNumber: number;\n }[];\n }): Exception {\n return {\n type: javaThrowable.name,\n value: javaThrowable.message,\n stacktrace: {\n frames: javaThrowable.stackElements\n .map(\n stackElement =>\n <StackFrame>{\n platform: 'java',\n module: stackElement.className,\n filename: stackElement.fileName,\n lineno: stackElement.lineNumber >= 0 ? stackElement.lineNumber : undefined,\n function: stackElement.methodName,\n in_app:\n this._nativePackage !== null && stackElement.className.startsWith(this._nativePackage)\n ? true\n : undefined,\n },\n )\n .reverse(),\n },\n };\n }\n\n /**\n * Converts StackAddresses to a SentryException with DebugMetaImages\n */\n private async _exceptionFromAppleStackReturnAddresses(objCException: {\n name: string;\n message: string;\n stackReturnAddresses: number[];\n }): Promise<{\n appleException: Exception;\n appleDebugImages: DebugImage[];\n }> {\n const nativeStackFrames = await this._fetchNativeStackFrames(objCException.stackReturnAddresses);\n\n return {\n appleException: {\n type: objCException.name,\n value: objCException.message,\n stacktrace: {\n frames: (nativeStackFrames && nativeStackFrames.frames.reverse()) || [],\n },\n },\n appleDebugImages: (nativeStackFrames && (nativeStackFrames.debugMetaImages as DebugImage[])) || [],\n };\n }\n\n /**\n * Fetches the native package/image name from the native layer\n */\n private _fetchNativePackage(): Promise<string | null> {\n return NATIVE.fetchNativePackageName();\n }\n\n /**\n * Fetches native debug image information on iOS\n */\n private _fetchNativeStackFrames(instructionsAddr: number[]): Promise<NativeStackFrames | null> {\n return NATIVE.fetchNativeStackFramesBy(instructionsAddr);\n }\n}\n"]}
1
+ {"version":3,"file":"nativelinkederrors.js","sourceRoot":"","sources":["../../../src/js/integrations/nativelinkederrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAcrD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG5D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,MAAM,aAAa,GAAG,CAAC,CAAC;AAOxB;;GAEG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BAAiB,GAAG,IAAI,CAAC,uBAAuB,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC;QAE3F,OAAO;YACL,cAAc,EAAE;gBACd,IAAI,EAAE,aAAa,CAAC,IAAI;gBACxB,KAAK,EAAE,aAAa,CAAC,OAAO;gBAC5B,UAAU,EAAE;oBACV,MAAM,EAAE,CAAC,iBAAiB,IAAI,iBAAiB,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE;iBACxE;aACF;YACD,gBAAgB,EAAE,CAAC,iBAAiB,IAAK,iBAAiB,CAAC,eAAgC,CAAC,IAAI,EAAE;SACnG,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,mBAAmB;QACzB,OAAO,MAAM,CAAC,sBAAsB,EAAE,CAAC;IACzC,CAAC;IAED;;OAEG;IACK,uBAAuB,CAAC,gBAA0B;QACxD,OAAO,MAAM,CAAC,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;IAC3D,CAAC;;AA/LD;;GAEG;AACW,qBAAE,GAAW,oBAAoB,CAAC","sourcesContent":["import { exceptionFromError } from '@sentry/browser';\nimport type {\n Client,\n DebugImage,\n Event,\n EventHint,\n EventProcessor,\n Exception,\n ExtendedError,\n Hub,\n Integration,\n StackFrame,\n StackParser,\n} from '@sentry/types';\nimport { isInstanceOf, isPlainObject } from '@sentry/utils';\n\nimport type { NativeStackFrames } from '../NativeRNSentry';\nimport { NATIVE } from '../wrapper';\n\nconst DEFAULT_KEY = 'cause';\nconst DEFAULT_LIMIT = 5;\n\ninterface LinkedErrorsOptions {\n key: string;\n limit: number;\n}\n\n/**\n * Processes JS and RN native linked errors.\n */\nexport class NativeLinkedErrors implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'NativeLinkedErrors';\n\n /**\n * @inheritDoc\n */\n public name: string = NativeLinkedErrors.id;\n\n private readonly _key: LinkedErrorsOptions['key'];\n private readonly _limit: LinkedErrorsOptions['limit'];\n private _nativePackage: string | null = null;\n\n /**\n * @inheritDoc\n */\n public constructor(options: Partial<LinkedErrorsOptions> = {}) {\n this._key = options.key || DEFAULT_KEY;\n this._limit = options.limit || DEFAULT_LIMIT;\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(_addGlobalEventProcessor: (callback: EventProcessor) => void, _getCurrentHub: () => Hub): void {\n /* noop */\n }\n\n /**\n * @inheritDoc\n */\n public preprocessEvent(event: Event, hint: EventHint | undefined, client: Client): void {\n if (this._nativePackage === null) {\n this._nativePackage = this._fetchNativePackage();\n }\n\n this._handler(client.getOptions().stackParser, this._key, this._limit, event, hint);\n }\n\n /**\n * Enriches passed event with linked exceptions and native debug meta images.\n */\n private _handler(parser: StackParser, key: string, limit: number, event: Event, hint?: EventHint): void {\n if (!event.exception || !event.exception.values || !hint || !isInstanceOf(hint.originalException, Error)) {\n return;\n }\n const { exceptions: linkedErrors, debugImages } = this._walkErrorTree(\n parser,\n limit,\n hint.originalException as ExtendedError,\n key,\n );\n event.exception.values = [...event.exception.values, ...linkedErrors];\n\n event.debug_meta = event.debug_meta || {};\n event.debug_meta.images = event.debug_meta.images || [];\n event.debug_meta.images.push(...(debugImages || []));\n }\n\n /**\n * Walks linked errors and created Sentry exceptions chain.\n * Collects debug images from native errors stack frames.\n */\n private _walkErrorTree(\n parser: StackParser,\n limit: number,\n error: ExtendedError,\n key: string,\n exceptions: Exception[] = [],\n debugImages: DebugImage[] = [],\n ): {\n exceptions: Exception[];\n debugImages?: DebugImage[];\n } {\n const linkedError = error[key];\n if (!linkedError || exceptions.length + 1 >= limit) {\n return {\n exceptions,\n debugImages,\n };\n }\n\n let exception: Exception;\n let exceptionDebugImages: DebugImage[] | undefined;\n if ('stackElements' in linkedError) {\n // isJavaException\n exception = this._exceptionFromJavaStackElements(linkedError);\n } else if ('stackReturnAddresses' in linkedError) {\n // isObjCException\n const { appleException, appleDebugImages } = this._exceptionFromAppleStackReturnAddresses(linkedError);\n exception = appleException;\n exceptionDebugImages = appleDebugImages;\n } else if (isInstanceOf(linkedError, Error)) {\n exception = exceptionFromError(parser, error[key]);\n } else if (isPlainObject(linkedError)) {\n exception = {\n type: typeof linkedError.name === 'string' ? linkedError.name : undefined,\n value: typeof linkedError.message === 'string' ? linkedError.message : undefined,\n };\n } else {\n return {\n exceptions,\n debugImages,\n };\n }\n\n return this._walkErrorTree(\n parser,\n limit,\n linkedError,\n key,\n [...exceptions, exception],\n [...debugImages, ...(exceptionDebugImages || [])],\n );\n }\n\n /**\n * Converts a Java Throwable to an SentryException\n */\n private _exceptionFromJavaStackElements(javaThrowable: {\n name: string;\n message: string;\n stackElements: {\n className: string;\n fileName: string;\n methodName: string;\n lineNumber: number;\n }[];\n }): Exception {\n return {\n type: javaThrowable.name,\n value: javaThrowable.message,\n stacktrace: {\n frames: javaThrowable.stackElements\n .map(\n stackElement =>\n <StackFrame>{\n platform: 'java',\n module: stackElement.className,\n filename: stackElement.fileName,\n lineno: stackElement.lineNumber >= 0 ? stackElement.lineNumber : undefined,\n function: stackElement.methodName,\n in_app:\n this._nativePackage !== null && stackElement.className.startsWith(this._nativePackage)\n ? true\n : undefined,\n },\n )\n .reverse(),\n },\n };\n }\n\n /**\n * Converts StackAddresses to a SentryException with DebugMetaImages\n */\n private _exceptionFromAppleStackReturnAddresses(objCException: {\n name: string;\n message: string;\n stackReturnAddresses: number[];\n }): {\n appleException: Exception;\n appleDebugImages: DebugImage[];\n } {\n const nativeStackFrames = this._fetchNativeStackFrames(objCException.stackReturnAddresses);\n\n return {\n appleException: {\n type: objCException.name,\n value: objCException.message,\n stacktrace: {\n frames: (nativeStackFrames && nativeStackFrames.frames.reverse()) || [],\n },\n },\n appleDebugImages: (nativeStackFrames && (nativeStackFrames.debugMetaImages as DebugImage[])) || [],\n };\n }\n\n /**\n * Fetches the native package/image name from the native layer\n */\n private _fetchNativePackage(): string | null {\n return NATIVE.fetchNativePackageName();\n }\n\n /**\n * Fetches native debug image information on iOS\n */\n private _fetchNativeStackFrames(instructionsAddr: number[]): NativeStackFrames | null {\n return NATIVE.fetchNativeStackFramesBy(instructionsAddr);\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;AAQ3E,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;IAiBxB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAM3B;;OAEG;IACH,OAAO,CAAC,gCAAgC;IAoCxC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAsC5B;;OAEG;IACH,OAAO,CAAC,cAAc;IAqEtB;;OAEG;IACH,OAAO,CAAC,sBAAsB;CAO/B"}
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;AAQ3E,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;IAiBxB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAM3B;;OAEG;IACH,OAAO,CAAC,gCAAgC;IAoCxC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAsC5B;;OAEG;IACH,OAAO,CAAC,cAAc;IA6EtB;;OAEG;IACH,OAAO,CAAC,sBAAsB;CAO/B"}
@@ -182,6 +182,8 @@ export class ReactNativeErrorHandlers {
182
182
  if (!__DEV__) {
183
183
  void client.flush(options.shutdownTimeout || 2000).then(() => {
184
184
  defaultHandler(error, isFatal);
185
+ }, (reason) => {
186
+ logger.error('[ReactNativeErrorHandlers] Error while flushing the event cache after uncaught error.', reason);
185
187
  });
186
188
  }
187
189
  else {
@@ -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,oBAAoB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAA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B,gGAAgG;QAChG,OAAO,OAAO,CAAC,yCAAyC,CAAC,CAAC;IAC5D,CAAC;;AAjPD;;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 { createSyntheticError, isErrorLike } from '../utils/error';\nimport { ReactNativeLibraries } from '../utils/rnlibraries';\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 if (!ReactNativeLibraries.Utilities) {\n logger.warn('Could not polyfill Promise. React Native Libraries Utilities not found.');\n return;\n }\n\n const Promise = this._getPromisePolyfill();\n\n // As of RN 0.67 only done and finally are used\n // eslint-disable-next-line import/no-extraneous-dependencies\n require('promise/setimmediate/done');\n // eslint-disable-next-line import/no-extraneous-dependencies\n require('promise/setimmediate/finally');\n\n ReactNativeLibraries.Utilities.polyfillGlobal('Promise', () => Promise);\n }\n\n /**\n * Single source of truth for the Promise implementation we want to use.\n * This is important for verifying that the rejected promise tracing will work as expected.\n */\n private _getPromisePolyfill(): unknown {\n /* eslint-disable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires */\n // Below, we follow the exact way React Native initializes its promise library, and we globally replace it.\n return require('promise/setimmediate/es6-extensions');\n }\n\n /**\n * Attach the unhandled rejection handler\n */\n private _attachUnhandledRejectionHandler(): void {\n const tracking = this._loadRejectionTracking();\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: unknown) => {\n if (__DEV__) {\n promiseRejectionTrackingOptions.onUnhandled(id, error);\n }\n\n getCurrentHub().captureException(error, {\n data: { id },\n originalException: error,\n syntheticException: isErrorLike(error) ? undefined : createSyntheticError(),\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 // `promise` package is a dependency of react-native, therefore it is always available.\n // but it is possible that the user has installed a different version of promise\n // or dependency that uses a different version.\n // We have to check if the React Native Promise and the `promise` package Promise are using the same reference.\n // If they are not, likely there are multiple versions of the `promise` package installed.\n const ReactNativePromise = ReactNativeLibraries.Promise;\n // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies\n const PromisePackagePromise = require('promise/setimmediate/es6-extensions');\n const UsedPromisePolyfill = this._getPromisePolyfill();\n\n if (ReactNativePromise !== PromisePackagePromise) {\n logger.warn(\n 'You appear to have multiple versions of the \"promise\" package installed. ' +\n 'This may cause unexpected behavior like undefined `Promise.allSettled`. ' +\n 'Please install the `promise` package manually using the exact version as the React Native package. ' +\n 'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.',\n );\n }\n\n // This only make sense if the user disabled the integration Polyfill\n if (UsedPromisePolyfill !== RN_GLOBAL_OBJ.Promise) {\n logger.warn(\n 'Unhandled promise rejections will not be caught by Sentry. ' +\n 'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.',\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. ' +\n 'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.',\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 /**\n * Loads and returns rejection tracking module\n */\n private _loadRejectionTracking(): {\n disable: () => void;\n enable: (arg: unknown) => void;\n } {\n // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies\n return require('promise/setimmediate/rejection-tracking');\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,oBAAoB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAcnD,2CAA2C;AAC3C,MAAM,OAAO,wBAAwB;IAcnC,kBAAkB;IAClB,YA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AED;;OAEG;IACK,sBAAsB;QAI5B,gGAAgG;QAChG,OAAO,OAAO,CAAC,yCAAyC,CAAC,CAAC;IAC5D,CAAC;;AAzPD;;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 { createSyntheticError, isErrorLike } from '../utils/error';\nimport { ReactNativeLibraries } from '../utils/rnlibraries';\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 if (!ReactNativeLibraries.Utilities) {\n logger.warn('Could not polyfill Promise. React Native Libraries Utilities not found.');\n return;\n }\n\n const Promise = this._getPromisePolyfill();\n\n // As of RN 0.67 only done and finally are used\n // eslint-disable-next-line import/no-extraneous-dependencies\n require('promise/setimmediate/done');\n // eslint-disable-next-line import/no-extraneous-dependencies\n require('promise/setimmediate/finally');\n\n ReactNativeLibraries.Utilities.polyfillGlobal('Promise', () => Promise);\n }\n\n /**\n * Single source of truth for the Promise implementation we want to use.\n * This is important for verifying that the rejected promise tracing will work as expected.\n */\n private _getPromisePolyfill(): unknown {\n /* eslint-disable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires */\n // Below, we follow the exact way React Native initializes its promise library, and we globally replace it.\n return require('promise/setimmediate/es6-extensions');\n }\n\n /**\n * Attach the unhandled rejection handler\n */\n private _attachUnhandledRejectionHandler(): void {\n const tracking = this._loadRejectionTracking();\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: unknown) => {\n if (__DEV__) {\n promiseRejectionTrackingOptions.onUnhandled(id, error);\n }\n\n getCurrentHub().captureException(error, {\n data: { id },\n originalException: error,\n syntheticException: isErrorLike(error) ? undefined : createSyntheticError(),\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 // `promise` package is a dependency of react-native, therefore it is always available.\n // but it is possible that the user has installed a different version of promise\n // or dependency that uses a different version.\n // We have to check if the React Native Promise and the `promise` package Promise are using the same reference.\n // If they are not, likely there are multiple versions of the `promise` package installed.\n const ReactNativePromise = ReactNativeLibraries.Promise;\n // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies\n const PromisePackagePromise = require('promise/setimmediate/es6-extensions');\n const UsedPromisePolyfill = this._getPromisePolyfill();\n\n if (ReactNativePromise !== PromisePackagePromise) {\n logger.warn(\n 'You appear to have multiple versions of the \"promise\" package installed. ' +\n 'This may cause unexpected behavior like undefined `Promise.allSettled`. ' +\n 'Please install the `promise` package manually using the exact version as the React Native package. ' +\n 'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.',\n );\n }\n\n // This only make sense if the user disabled the integration Polyfill\n if (UsedPromisePolyfill !== RN_GLOBAL_OBJ.Promise) {\n logger.warn(\n 'Unhandled promise rejections will not be caught by Sentry. ' +\n 'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.',\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. ' +\n 'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.',\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 () => {\n defaultHandler(error, isFatal);\n },\n (reason: unknown) => {\n logger.error(\n '[ReactNativeErrorHandlers] Error while flushing the event cache after uncaught error.',\n reason,\n );\n },\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 /**\n * Loads and returns rejection tracking module\n */\n private _loadRejectionTracking(): {\n disable: () => void;\n enable: (arg: unknown) => void;\n } {\n // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies\n return require('promise/setimmediate/rejection-tracking');\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { RewriteFrames } from '@sentry/integrations';
1
+ import type { Integration } from '@sentry/types';
2
2
  export declare const ANDROID_DEFAULT_BUNDLE_NAME = "app:///index.android.bundle";
3
3
  export declare const IOS_DEFAULT_BUNDLE_NAME = "app:///main.jsbundle";
4
4
  /**
@@ -7,5 +7,5 @@ export declare const IOS_DEFAULT_BUNDLE_NAME = "app:///main.jsbundle";
7
7
  * and removes file://, 'address at' prefixes, CodePush postfix,
8
8
  * and Expo bundle postfix.
9
9
  */
10
- export declare function createReactNativeRewriteFrames(): RewriteFrames;
10
+ export declare function createReactNativeRewriteFrames(): Integration;
11
11
  //# sourceMappingURL=rewriteframes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rewriteframes.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/rewriteframes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAMrD,eAAO,MAAM,2BAA2B,gCAAgC,CAAC;AACzE,eAAO,MAAM,uBAAuB,yBAAyB,CAAC;AAE9D;;;;;GAKG;AACH,wBAAgB,8BAA8B,IAAI,aAAa,CAsD9D"}
1
+ {"version":3,"file":"rewriteframes.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/rewriteframes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,eAAe,CAAC;AAK7D,eAAO,MAAM,2BAA2B,gCAAgC,CAAC;AACzE,eAAO,MAAM,uBAAuB,yBAAyB,CAAC;AAE9D;;;;;GAKG;AACH,wBAAgB,8BAA8B,IAAI,WAAW,CAsD5D"}