@sentry/react-native 5.25.0-alpha.2 → 5.26.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +55 -1
  2. package/RNSentry.podspec +1 -1
  3. package/android/build.gradle +1 -1
  4. package/android/src/main/java/io/sentry/react/RNSentryBreadcrumb.java +87 -0
  5. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +12 -46
  6. package/android/src/main/java/io/sentry/react/RNSentryReplayBreadcrumbConverter.java +22 -13
  7. package/dist/js/NativeRNSentry.d.ts +1 -1
  8. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  9. package/dist/js/NativeRNSentry.js.map +1 -1
  10. package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
  11. package/dist/js/integrations/debugsymbolicator.js +26 -7
  12. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  13. package/dist/js/misc.d.ts +2 -0
  14. package/dist/js/misc.d.ts.map +1 -1
  15. package/dist/js/misc.js +4 -2
  16. package/dist/js/misc.js.map +1 -1
  17. package/dist/js/replay/mobilereplay.d.ts +11 -0
  18. package/dist/js/replay/mobilereplay.d.ts.map +1 -1
  19. package/dist/js/replay/mobilereplay.js +1 -0
  20. package/dist/js/replay/mobilereplay.js.map +1 -1
  21. package/dist/js/tools/enableLogger.d.ts +5 -0
  22. package/dist/js/tools/enableLogger.d.ts.map +1 -0
  23. package/dist/js/tools/enableLogger.js +13 -0
  24. package/dist/js/tools/enableLogger.js.map +1 -0
  25. package/dist/js/tools/metroconfig.d.ts +19 -4
  26. package/dist/js/tools/metroconfig.d.ts.map +1 -1
  27. package/dist/js/tools/metroconfig.js +38 -3
  28. package/dist/js/tools/metroconfig.js.map +1 -1
  29. package/dist/js/tools/sentryBabelTransformer.d.ts +4 -0
  30. package/dist/js/tools/sentryBabelTransformer.d.ts.map +1 -0
  31. package/dist/js/tools/sentryBabelTransformer.js +28 -0
  32. package/dist/js/tools/sentryBabelTransformer.js.map +1 -0
  33. package/dist/js/tools/sentryBabelTransformerUtils.d.ts +18 -0
  34. package/dist/js/tools/sentryBabelTransformerUtils.d.ts.map +1 -0
  35. package/dist/js/tools/sentryBabelTransformerUtils.js +67 -0
  36. package/dist/js/tools/sentryBabelTransformerUtils.js.map +1 -0
  37. package/dist/js/tools/vendor/metro/metroBabelTransformer.d.ts +35 -0
  38. package/dist/js/tools/vendor/metro/metroBabelTransformer.d.ts.map +1 -0
  39. package/dist/js/tools/vendor/metro/metroBabelTransformer.js +3 -0
  40. package/dist/js/tools/vendor/metro/metroBabelTransformer.js.map +1 -0
  41. package/dist/js/utils/error.d.ts +1 -0
  42. package/dist/js/utils/error.d.ts.map +1 -1
  43. package/dist/js/utils/error.js.map +1 -1
  44. package/dist/js/version.d.ts +1 -1
  45. package/dist/js/version.js +1 -1
  46. package/dist/js/version.js.map +1 -1
  47. package/dist/js/wrapper.js +1 -1
  48. package/dist/js/wrapper.js.map +1 -1
  49. package/ios/RNSentry.mm +8 -1
  50. package/ios/RNSentryBreadcrumb.h +4 -0
  51. package/ios/RNSentryBreadcrumb.m +19 -0
  52. package/ios/RNSentryReplay.m +14 -2
  53. package/ios/RNSentryReplayBreadcrumbConverter.m +4 -8
  54. package/package.json +2 -1
  55. package/sentry.gradle +1 -1
  56. package/src/js/NativeRNSentry.ts +1 -1
  57. package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -1
  58. package/ts3.8/dist/js/misc.d.ts +2 -0
  59. package/ts3.8/dist/js/replay/mobilereplay.d.ts +11 -0
  60. package/ts3.8/dist/js/utils/error.d.ts +1 -0
  61. package/ts3.8/dist/js/version.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"mobilereplay.js","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,SA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,GAAG,CAC/H,CAAC;gBACF,OAAO,KAAK,CAAC;aACd;YAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;YAChE,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAM,CAAC,KAAK,CAAC,YAAY,8BAA8B,0BAA0B,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;gBACpG,OAAO,KAAK,CAAC;aACd;YAED,OAAO,KAAK,CAAC;QACf,CAAC;KAAA;IAED,SAAS,KAAK,CAAC,MAAc;QAC3B,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACrB,OAAO;SACR;QAED,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,GAA2B,EAAE,EAAE;YACrD,IAAI,GAAG,CAAC,SAAS,EAAE;gBACjB,OAAO;aACR;YAED,6GAA6G;YAC7G,MAAM,eAAe,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAC;YACpD,IAAI,eAAe,EAAE;gBACnB,GAAG,CAAC,SAAS,GAAG,eAAe,CAAC;aACjC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,mCAAmC,CAAC,CAAC;IACxE,CAAC;IAED,iHAAiH;IACjH,8GAA8G;IAC9G,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,SAAS;YACP,UAAU;QACZ,CAAC;QACD,KAAK;QACL,YAAY;QACZ,OAAO,EAAE,OAAO;KACjB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,2BAA2B,GAAG,GAA4B,EAAE;IAChE,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,SAAS;YACP,UAAU;QACZ,CAAC;QACD,OAAO,EAAE,cAAc;KACxB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Client, DynamicSamplingContext, Event, IntegrationFnResult } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { isHardCrash } from '../misc';\nimport { hasHooks } from '../utils/clientutils';\nimport { isExpoGo, notMobileOs } from '../utils/environment';\nimport { NATIVE } from '../wrapper';\nimport { enrichXhrBreadcrumbsForMobileReplay } from './xhrUtils';\n\nexport const MOBILE_REPLAY_INTEGRATION_NAME = 'MobileReplay';\n\nexport interface MobileReplayOptions {\n /**\n * Mask all text in recordings\n */\n maskAllText?: boolean;\n\n /**\n * Mask all text in recordings\n */\n maskAllImages?: boolean;\n}\n\nconst defaultOptions: Required<MobileReplayOptions> = {\n maskAllText: true,\n maskAllImages: true,\n};\n\ntype MobileReplayIntegration = IntegrationFnResult & {\n options: Required<MobileReplayOptions>;\n};\n\n/**\n * The Mobile Replay Integration, let's you adjust the default mobile replay options.\n * To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.\n *\n * ```javascript\n * Sentry.init({\n * _experiments: {\n * replaysOnErrorSampleRate: 1.0,\n * replaysSessionSampleRate: 1.0,\n * },\n * integrations: [mobileReplayIntegration({\n * // Adjust the default options\n * })],\n * });\n * ```\n *\n * @experimental\n */\nexport const mobileReplayIntegration = (initOptions: MobileReplayOptions = defaultOptions): MobileReplayIntegration => {\n if (isExpoGo()) {\n logger.warn(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported in Expo Go. Use EAS Build or \\`expo prebuild\\` to enable it.`,\n );\n }\n if (notMobileOs()) {\n logger.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported on this platform.`);\n }\n\n if (isExpoGo() || notMobileOs()) {\n return mobileReplayIntegrationNoop();\n }\n\n const options = { ...defaultOptions, ...initOptions };\n\n async function processEvent(event: Event): Promise<Event> {\n const hasException = event.exception && event.exception.values && event.exception.values.length > 0;\n if (!hasException) {\n // Event is not an error, will not capture replay\n return event;\n }\n\n const recordingReplayId = NATIVE.getCurrentReplayId();\n if (recordingReplayId) {\n logger.debug(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`,\n );\n return event;\n }\n\n const replayId = await NATIVE.captureReplay(isHardCrash(event));\n if (!replayId) {\n logger.debug(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`);\n return event;\n }\n\n return event;\n }\n\n function setup(client: Client): void {\n if (!hasHooks(client)) {\n return;\n }\n\n client.on('createDsc', (dsc: DynamicSamplingContext) => {\n if (dsc.replay_id) {\n return;\n }\n\n // TODO: For better performance, we should emit replayId changes on native, and hold the replayId value in JS\n const currentReplayId = NATIVE.getCurrentReplayId();\n if (currentReplayId) {\n dsc.replay_id = currentReplayId;\n }\n });\n\n client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);\n }\n\n // TODO: When adding manual API, ensure overlap with the web replay so users can use the same API interchangeably\n // https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setupOnce() {\n /* Noop */\n },\n setup,\n processEvent,\n options: options,\n };\n};\n\nconst mobileReplayIntegrationNoop = (): MobileReplayIntegration => {\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setupOnce() {\n /* Noop */\n },\n options: defaultOptions,\n };\n};\n"]}
1
+ {"version":3,"file":"mobilereplay.js","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,CAAC,MAAM,8BAA8B,GAAG,cAAc,CAAC;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AC,CAAC;gBACpG,OAAO,KAAK,CAAC;aACd;YAED,OAAO,KAAK,CAAC;QACf,CAAC;KAAA;IAED,SAAS,KAAK,CAAC,MAAc;QAC3B,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACrB,OAAO;SACR;QAED,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,GAA2B,EAAE,EAAE;YACrD,IAAI,GAAG,CAAC,SAAS,EAAE;gBACjB,OAAO;aACR;YAED,6GAA6G;YAC7G,MAAM,eAAe,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAC;YACpD,IAAI,eAAe,EAAE;gBACnB,GAAG,CAAC,SAAS,GAAG,eAAe,CAAC;aACjC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,mCAAmC,CAAC,CAAC;IACxE,CAAC;IAED,iHAAiH;IACjH,8GAA8G;IAC9G,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,SAAS;YACP,UAAU;QACZ,CAAC;QACD,KAAK;QACL,YAAY;QACZ,OAAO,EAAE,OAAO;KACjB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,2BAA2B,GAAG,GAA4B,EAAE;IAChE,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,SAAS;YACP,UAAU;QACZ,CAAC;QACD,OAAO,EAAE,cAAc;KACxB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Client, DynamicSamplingContext, Event, IntegrationFnResult } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { isHardCrash } from '../misc';\nimport { hasHooks } from '../utils/clientutils';\nimport { isExpoGo, notMobileOs } from '../utils/environment';\nimport { NATIVE } from '../wrapper';\nimport { enrichXhrBreadcrumbsForMobileReplay } from './xhrUtils';\n\nexport const MOBILE_REPLAY_INTEGRATION_NAME = 'MobileReplay';\n\nexport interface MobileReplayOptions {\n /**\n * Mask all text in recordings\n *\n * @default true\n */\n maskAllText?: boolean;\n\n /**\n * Mask all text in recordings\n *\n * @default true\n */\n maskAllImages?: boolean;\n\n /**\n * Mask all vector graphics in recordings\n * Supports `react-native-svg`\n *\n * @default true\n */\n maskAllVectors?: boolean;\n}\n\nconst defaultOptions: Required<MobileReplayOptions> = {\n maskAllText: true,\n maskAllImages: true,\n maskAllVectors: true,\n};\n\ntype MobileReplayIntegration = IntegrationFnResult & {\n options: Required<MobileReplayOptions>;\n};\n\n/**\n * The Mobile Replay Integration, let's you adjust the default mobile replay options.\n * To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.\n *\n * ```javascript\n * Sentry.init({\n * _experiments: {\n * replaysOnErrorSampleRate: 1.0,\n * replaysSessionSampleRate: 1.0,\n * },\n * integrations: [mobileReplayIntegration({\n * // Adjust the default options\n * })],\n * });\n * ```\n *\n * @experimental\n */\nexport const mobileReplayIntegration = (initOptions: MobileReplayOptions = defaultOptions): MobileReplayIntegration => {\n if (isExpoGo()) {\n logger.warn(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported in Expo Go. Use EAS Build or \\`expo prebuild\\` to enable it.`,\n );\n }\n if (notMobileOs()) {\n logger.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported on this platform.`);\n }\n\n if (isExpoGo() || notMobileOs()) {\n return mobileReplayIntegrationNoop();\n }\n\n const options = { ...defaultOptions, ...initOptions };\n\n async function processEvent(event: Event): Promise<Event> {\n const hasException = event.exception && event.exception.values && event.exception.values.length > 0;\n if (!hasException) {\n // Event is not an error, will not capture replay\n return event;\n }\n\n const recordingReplayId = NATIVE.getCurrentReplayId();\n if (recordingReplayId) {\n logger.debug(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`,\n );\n return event;\n }\n\n const replayId = await NATIVE.captureReplay(isHardCrash(event));\n if (!replayId) {\n logger.debug(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`);\n return event;\n }\n\n return event;\n }\n\n function setup(client: Client): void {\n if (!hasHooks(client)) {\n return;\n }\n\n client.on('createDsc', (dsc: DynamicSamplingContext) => {\n if (dsc.replay_id) {\n return;\n }\n\n // TODO: For better performance, we should emit replayId changes on native, and hold the replayId value in JS\n const currentReplayId = NATIVE.getCurrentReplayId();\n if (currentReplayId) {\n dsc.replay_id = currentReplayId;\n }\n });\n\n client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);\n }\n\n // TODO: When adding manual API, ensure overlap with the web replay so users can use the same API interchangeably\n // https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setupOnce() {\n /* Noop */\n },\n setup,\n processEvent,\n options: options,\n };\n};\n\nconst mobileReplayIntegrationNoop = (): MobileReplayIntegration => {\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setupOnce() {\n /* Noop */\n },\n options: defaultOptions,\n };\n};\n"]}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Enables debug logger when SENTRY_LOG_LEVEL=debug.
3
+ */
4
+ export declare function enableLogger(): void;
5
+ //# sourceMappingURL=enableLogger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enableLogger.d.ts","sourceRoot":"","sources":["../../../src/js/tools/enableLogger.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAInC"}
@@ -0,0 +1,13 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.enableLogger = void 0;
3
+ const utils_1 = require("@sentry/utils");
4
+ /**
5
+ * Enables debug logger when SENTRY_LOG_LEVEL=debug.
6
+ */
7
+ function enableLogger() {
8
+ if (process.env.SENTRY_LOG_LEVEL === 'debug') {
9
+ utils_1.logger.enable();
10
+ }
11
+ }
12
+ exports.enableLogger = enableLogger;
13
+ //# sourceMappingURL=enableLogger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enableLogger.js","sourceRoot":"","sources":["../../../src/js/tools/enableLogger.ts"],"names":[],"mappings":";;AAAA,yCAAuC;AAEvC;;GAEG;AACH,SAAgB,YAAY;IAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,KAAK,OAAO,EAAE;QAC5C,cAAM,CAAC,MAAM,EAAE,CAAC;KACjB;AACH,CAAC;AAJD,oCAIC","sourcesContent":["import { logger } from '@sentry/utils';\n\n/**\n * Enables debug logger when SENTRY_LOG_LEVEL=debug.\n */\nexport function enableLogger(): void {\n if (process.env.SENTRY_LOG_LEVEL === 'debug') {\n logger.enable();\n }\n}\n"]}
@@ -1,19 +1,34 @@
1
1
  import type { MetroConfig } from 'metro';
2
2
  import type { DefaultConfigOptions } from './vendor/expo/expoconfig';
3
3
  export * from './sentryMetroSerializer';
4
+ export interface SentryMetroConfigOptions {
5
+ /**
6
+ * Annotates React components with Sentry data.
7
+ * @default false
8
+ */
9
+ annotateReactComponents?: boolean;
10
+ }
11
+ export interface SentryExpoConfigOptions {
12
+ /**
13
+ * Pass a custom `getDefaultConfig` function to override the default Expo configuration getter.
14
+ */
15
+ getDefaultConfig?: typeof getSentryExpoConfig;
16
+ }
4
17
  /**
5
18
  * Adds Sentry to the Metro config.
6
19
  *
7
20
  * Adds Debug ID to the output bundle and source maps.
8
21
  * Collapses Sentry frames from the stack trace view in LogBox.
9
22
  */
10
- export declare function withSentryConfig(config: MetroConfig): MetroConfig;
23
+ export declare function withSentryConfig(config: MetroConfig, { annotateReactComponents }?: SentryMetroConfigOptions): MetroConfig;
11
24
  /**
12
25
  * This function returns Default Expo configuration with Sentry plugins.
13
26
  */
14
- export declare function getSentryExpoConfig(projectRoot: string, options?: DefaultConfigOptions & {
15
- getDefaultConfig?: typeof getSentryExpoConfig;
16
- }): MetroConfig;
27
+ export declare function getSentryExpoConfig(projectRoot: string, options?: DefaultConfigOptions & SentryExpoConfigOptions & SentryMetroConfigOptions): MetroConfig;
28
+ /**
29
+ * Adds Sentry Babel transformer to the Metro config.
30
+ */
31
+ export declare function withSentryBabelTransformer(config: MetroConfig): MetroConfig;
17
32
  /**
18
33
  * Collapses Sentry internal frames from the stack trace view in LogBox.
19
34
  */
@@ -1 +1 @@
1
- {"version":3,"file":"metroconfig.d.ts","sourceRoot":"","sources":["../../../src/js/tools/metroconfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAsC,MAAM,OAAO,CAAC;AAI7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE,cAAc,yBAAyB,CAAC;AAExC;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CASjE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,oBAAoB,GAAG;IAAE,gBAAgB,CAAC,EAAE,OAAO,mBAAmB,CAAA;CAAO,GACrF,WAAW,CAab;AA8CD;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAiC1E"}
1
+ {"version":3,"file":"metroconfig.d.ts","sourceRoot":"","sources":["../../../src/js/tools/metroconfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAsC,MAAM,OAAO,CAAC;AAO7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE,cAAc,yBAAyB,CAAC;AAIxC,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,mBAAmB,CAAC;CAC/C;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,WAAW,EACnB,EAAE,uBAA+B,EAAE,GAAE,wBAA6B,GACjE,WAAW,CAYb;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,oBAAoB,GAAG,uBAAuB,GAAG,wBAA6B,GACtF,WAAW,CAkBb;AAsBD;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CA2B3E;AA0BD;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAiC1E"}
@@ -1,20 +1,28 @@
1
1
  Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.withSentryFramesCollapsed = exports.getSentryExpoConfig = exports.withSentryConfig = void 0;
2
+ exports.withSentryFramesCollapsed = exports.withSentryBabelTransformer = exports.getSentryExpoConfig = exports.withSentryConfig = void 0;
3
3
  const tslib_1 = require("tslib");
4
+ const utils_1 = require("@sentry/utils");
5
+ const process = require("process");
4
6
  const process_1 = require("process");
7
+ const enableLogger_1 = require("./enableLogger");
8
+ const sentryBabelTransformerUtils_1 = require("./sentryBabelTransformerUtils");
5
9
  const sentryMetroSerializer_1 = require("./sentryMetroSerializer");
6
10
  tslib_1.__exportStar(require("./sentryMetroSerializer"), exports);
11
+ (0, enableLogger_1.enableLogger)();
7
12
  /**
8
13
  * Adds Sentry to the Metro config.
9
14
  *
10
15
  * Adds Debug ID to the output bundle and source maps.
11
16
  * Collapses Sentry frames from the stack trace view in LogBox.
12
17
  */
13
- function withSentryConfig(config) {
18
+ function withSentryConfig(config, { annotateReactComponents = false } = {}) {
14
19
  setSentryMetroDevServerEnvFlag();
15
20
  let newConfig = config;
16
21
  newConfig = withSentryDebugId(newConfig);
17
22
  newConfig = withSentryFramesCollapsed(newConfig);
23
+ if (annotateReactComponents) {
24
+ newConfig = withSentryBabelTransformer(newConfig);
25
+ }
18
26
  return newConfig;
19
27
  }
20
28
  exports.withSentryConfig = withSentryConfig;
@@ -28,7 +36,11 @@ function getSentryExpoConfig(projectRoot, options = {}) {
28
36
  ...(options.unstable_beforeAssetSerializationPlugins || []),
29
37
  sentryMetroSerializer_1.unstable_beforeAssetSerializationPlugin,
30
38
  ] }));
31
- return withSentryFramesCollapsed(config);
39
+ let newConfig = withSentryFramesCollapsed(config);
40
+ if (options.annotateReactComponents) {
41
+ newConfig = withSentryBabelTransformer(newConfig);
42
+ }
43
+ return newConfig;
32
44
  }
33
45
  exports.getSentryExpoConfig = getSentryExpoConfig;
34
46
  function loadExpoMetroConfigModule() {
@@ -40,6 +52,29 @@ function loadExpoMetroConfigModule() {
40
52
  throw new Error('Unable to load `expo/metro-config`. Make sure you have Expo installed.');
41
53
  }
42
54
  }
55
+ /**
56
+ * Adds Sentry Babel transformer to the Metro config.
57
+ */
58
+ function withSentryBabelTransformer(config) {
59
+ const defaultBabelTransformerPath = config.transformer && config.transformer.babelTransformerPath;
60
+ utils_1.logger.debug('Default Babel transformer path from `config.transformer`:', defaultBabelTransformerPath);
61
+ if (!defaultBabelTransformerPath) {
62
+ // This has to be console.warn because the options is enabled but won't be used
63
+ // eslint-disable-next-line no-console
64
+ console.warn('`transformer.babelTransformerPath` is undefined.');
65
+ // eslint-disable-next-line no-console
66
+ console.warn('Sentry Babel transformer cannot be used. Not adding it...');
67
+ return config;
68
+ }
69
+ if (defaultBabelTransformerPath) {
70
+ (0, sentryBabelTransformerUtils_1.saveDefaultBabelTransformerPath)(defaultBabelTransformerPath);
71
+ process.on('exit', () => {
72
+ (0, sentryBabelTransformerUtils_1.cleanDefaultBabelTransformerPath)();
73
+ });
74
+ }
75
+ return Object.assign(Object.assign({}, config), { transformer: Object.assign(Object.assign({}, config.transformer), { babelTransformerPath: require.resolve('./sentryBabelTransformer') }) });
76
+ }
77
+ exports.withSentryBabelTransformer = withSentryBabelTransformer;
43
78
  function withSentryDebugId(config) {
44
79
  var _a;
45
80
  const customSerializer = (0, sentryMetroSerializer_1.createSentryMetroSerializer)(((_a = config.serializer) === null || _a === void 0 ? void 0 : _a.customSerializer) || undefined);
@@ -1 +1 @@
1
- {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ACpB,gBAAgB,OAElB;AACJ,CAAC;AAQD;;GAEG;AACH,SAAgB,yBAAyB,CAAC,MAAmB;;IAC3D,MAAM,sBAAsB,GAAG,MAAA,MAAM,CAAC,YAAY,0CAAE,cAAc,CAAC;IACnE,MAAM,4BAA4B,GAAG,CAAC,KAAiB,EAAW,EAAE,CAClE,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,8CAA8C,CAAC;YAClE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,0CAA0C,CAAC,CAAC,CAAC;IAErE,MAAM,cAAc,GAAG,CAAC,KAAiB,EAAkC,EAAE;QAC3E,MAAM,8BAA8B,GAAG,CACrC,qBAAsD,EACjC,EAAE,CAAC,iCACrB,qBAAqB,KACxB,QAAQ,EAAE,CAAC,qBAAqB,IAAI,qBAAqB,CAAC,QAAQ,CAAC,IAAI,4BAA4B,CAAC,KAAK,CAAC,IAC1G,CAAC;QAEH,MAAM,yBAAyB,GAAG,CAAC,sBAAsB,IAAI,sBAAsB,CAAC,KAAK,CAAC,CAAC,IAAI,SAAS,CAAC;QAEzG,IAAI,yBAAyB,KAAK,SAAS,IAAI,MAAM,IAAI,yBAAyB,EAAE;YAClF,OAAO,yBAAyB,CAAC,IAAI,CAAsB,qBAAqB,CAAC,EAAE,CACjF,8BAA8B,CAAC,qBAAqB,CAAC,CACtD,CAAC;SACH;QAED,OAAO,8BAA8B,CAAC,yBAAyB,CAAC,CAAC;IACnE,CAAC,CAAC;IAEF,uCACK,MAAM,KACT,YAAY,kCACP,MAAM,CAAC,YAAY,KACtB,cAAc,OAEhB;AACJ,CAAC;AAjCD,8DAiCC;AAED;;;;GAIG;AACH,SAAS,8BAA8B;IACrC,aAAG,CAAC,6BAA6B,GAAG,MAAM,CAAC;AAC7C,CAAC","sourcesContent":["import type { MetroConfig, MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport { env } from 'process';\n\nimport { createSentryMetroSerializer, unstable_beforeAssetSerializationPlugin } from './sentryMetroSerializer';\nimport type { DefaultConfigOptions } from './vendor/expo/expoconfig';\n\nexport * from './sentryMetroSerializer';\n\n/**\n * Adds Sentry to the Metro config.\n *\n * Adds Debug ID to the output bundle and source maps.\n * Collapses Sentry frames from the stack trace view in LogBox.\n */\nexport function withSentryConfig(config: MetroConfig): MetroConfig {\n setSentryMetroDevServerEnvFlag();\n\n let newConfig = config;\n\n newConfig = withSentryDebugId(newConfig);\n newConfig = withSentryFramesCollapsed(newConfig);\n\n return newConfig;\n}\n\n/**\n * This function returns Default Expo configuration with Sentry plugins.\n */\nexport function getSentryExpoConfig(\n projectRoot: string,\n options: DefaultConfigOptions & { getDefaultConfig?: typeof getSentryExpoConfig } = {},\n): MetroConfig {\n setSentryMetroDevServerEnvFlag();\n\n const getDefaultConfig = options.getDefaultConfig || loadExpoMetroConfigModule().getDefaultConfig;\n const config = getDefaultConfig(projectRoot, {\n ...options,\n unstable_beforeAssetSerializationPlugins: [\n ...(options.unstable_beforeAssetSerializationPlugins || []),\n unstable_beforeAssetSerializationPlugin,\n ],\n });\n\n return withSentryFramesCollapsed(config);\n}\n\nfunction loadExpoMetroConfigModule(): {\n getDefaultConfig: (\n projectRoot: string,\n options: {\n unstable_beforeAssetSerializationPlugins?: ((serializationInput: {\n graph: ReadOnlyGraph<MixedOutput>;\n premodules: Module[];\n debugId?: string;\n }) => Module[])[];\n },\n ) => MetroConfig;\n} {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n return require('expo/metro-config');\n } catch (e) {\n throw new Error('Unable to load `expo/metro-config`. Make sure you have Expo installed.');\n }\n}\n\ntype MetroCustomSerializer = Required<Required<MetroConfig>['serializer']>['customSerializer'] | undefined;\n\nfunction withSentryDebugId(config: MetroConfig): MetroConfig {\n const customSerializer = createSentryMetroSerializer(\n config.serializer?.customSerializer || undefined,\n ) as MetroCustomSerializer;\n // MetroConfig types customSerializers as async only, but sync returns are also supported\n // The default serializer is sync\n\n return {\n ...config,\n serializer: {\n ...config.serializer,\n customSerializer,\n },\n };\n}\n\ntype MetroFrame = Parameters<Required<Required<MetroConfig>['symbolicator']>['customizeFrame']>[0];\ntype MetroCustomizeFrame = { readonly collapse?: boolean };\ntype MetroCustomizeFrameReturnValue =\n | ReturnType<Required<Required<MetroConfig>['symbolicator']>['customizeFrame']>\n | undefined;\n\n/**\n * Collapses Sentry internal frames from the stack trace view in LogBox.\n */\nexport function withSentryFramesCollapsed(config: MetroConfig): MetroConfig {\n const originalCustomizeFrame = config.symbolicator?.customizeFrame;\n const collapseSentryInternalFrames = (frame: MetroFrame): boolean =>\n typeof frame.file === 'string' &&\n (frame.file.includes('node_modules/@sentry/utils/cjs/instrument.js') ||\n frame.file.includes('node_modules/@sentry/utils/cjs/logger.js'));\n\n const customizeFrame = (frame: MetroFrame): MetroCustomizeFrameReturnValue => {\n const originalOrSentryCustomizeFrame = (\n originalCustomization: MetroCustomizeFrame | undefined,\n ): MetroCustomizeFrame => ({\n ...originalCustomization,\n collapse: (originalCustomization && originalCustomization.collapse) || collapseSentryInternalFrames(frame),\n });\n\n const maybePromiseCustomization = (originalCustomizeFrame && originalCustomizeFrame(frame)) || undefined;\n\n if (maybePromiseCustomization !== undefined && 'then' in maybePromiseCustomization) {\n return maybePromiseCustomization.then<MetroCustomizeFrame>(originalCustomization =>\n originalOrSentryCustomizeFrame(originalCustomization),\n );\n }\n\n return originalOrSentryCustomizeFrame(maybePromiseCustomization);\n };\n\n return {\n ...config,\n symbolicator: {\n ...config.symbolicator,\n customizeFrame,\n },\n };\n}\n\n/**\n * Sets the `___SENTRY_METRO_DEV_SERVER___` environment flag.\n * This is used to determine if the SDK is running in Node in Metro Dev Server.\n * For example during static routes generation in `expo-router`.\n */\nfunction setSentryMetroDevServerEnvFlag(): void {\n env.___SENTRY_METRO_DEV_SERVER___ = 'true';\n}\n"]}
1
+ {"version":3,"file":"metroconfig.js","sourceRoot":"","sources":["../../../src/js/tools/metroconfig.ts"],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AW,EAAE,CAClE,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,8CAA8C,CAAC;YAClE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,0CAA0C,CAAC,CAAC,CAAC;IAErE,MAAM,cAAc,GAAG,CAAC,KAAiB,EAAkC,EAAE;QAC3E,MAAM,8BAA8B,GAAG,CACrC,qBAAsD,EACjC,EAAE,CAAC,iCACrB,qBAAqB,KACxB,QAAQ,EAAE,CAAC,qBAAqB,IAAI,qBAAqB,CAAC,QAAQ,CAAC,IAAI,4BAA4B,CAAC,KAAK,CAAC,IAC1G,CAAC;QAEH,MAAM,yBAAyB,GAAG,CAAC,sBAAsB,IAAI,sBAAsB,CAAC,KAAK,CAAC,CAAC,IAAI,SAAS,CAAC;QAEzG,IAAI,yBAAyB,KAAK,SAAS,IAAI,MAAM,IAAI,yBAAyB,EAAE;YAClF,OAAO,yBAAyB,CAAC,IAAI,CAAsB,qBAAqB,CAAC,EAAE,CACjF,8BAA8B,CAAC,qBAAqB,CAAC,CACtD,CAAC;SACH;QAED,OAAO,8BAA8B,CAAC,yBAAyB,CAAC,CAAC;IACnE,CAAC,CAAC;IAEF,uCACK,MAAM,KACT,YAAY,kCACP,MAAM,CAAC,YAAY,KACtB,cAAc,OAEhB;AACJ,CAAC;AAjCD,8DAiCC;AAED;;;;GAIG;AACH,SAAS,8BAA8B;IACrC,aAAG,CAAC,6BAA6B,GAAG,MAAM,CAAC;AAC7C,CAAC","sourcesContent":["import { logger } from '@sentry/utils';\nimport type { MetroConfig, MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport * as process from 'process';\nimport { env } from 'process';\n\nimport { enableLogger } from './enableLogger';\nimport { cleanDefaultBabelTransformerPath, saveDefaultBabelTransformerPath } from './sentryBabelTransformerUtils';\nimport { createSentryMetroSerializer, unstable_beforeAssetSerializationPlugin } from './sentryMetroSerializer';\nimport type { DefaultConfigOptions } from './vendor/expo/expoconfig';\n\nexport * from './sentryMetroSerializer';\n\nenableLogger();\n\nexport interface SentryMetroConfigOptions {\n /**\n * Annotates React components with Sentry data.\n * @default false\n */\n annotateReactComponents?: boolean;\n}\n\nexport interface SentryExpoConfigOptions {\n /**\n * Pass a custom `getDefaultConfig` function to override the default Expo configuration getter.\n */\n getDefaultConfig?: typeof getSentryExpoConfig;\n}\n\n/**\n * Adds Sentry to the Metro config.\n *\n * Adds Debug ID to the output bundle and source maps.\n * Collapses Sentry frames from the stack trace view in LogBox.\n */\nexport function withSentryConfig(\n config: MetroConfig,\n { annotateReactComponents = false }: SentryMetroConfigOptions = {},\n): MetroConfig {\n setSentryMetroDevServerEnvFlag();\n\n let newConfig = config;\n\n newConfig = withSentryDebugId(newConfig);\n newConfig = withSentryFramesCollapsed(newConfig);\n if (annotateReactComponents) {\n newConfig = withSentryBabelTransformer(newConfig);\n }\n\n return newConfig;\n}\n\n/**\n * This function returns Default Expo configuration with Sentry plugins.\n */\nexport function getSentryExpoConfig(\n projectRoot: string,\n options: DefaultConfigOptions & SentryExpoConfigOptions & SentryMetroConfigOptions = {},\n): MetroConfig {\n setSentryMetroDevServerEnvFlag();\n\n const getDefaultConfig = options.getDefaultConfig || loadExpoMetroConfigModule().getDefaultConfig;\n const config = getDefaultConfig(projectRoot, {\n ...options,\n unstable_beforeAssetSerializationPlugins: [\n ...(options.unstable_beforeAssetSerializationPlugins || []),\n unstable_beforeAssetSerializationPlugin,\n ],\n });\n\n let newConfig = withSentryFramesCollapsed(config);\n if (options.annotateReactComponents) {\n newConfig = withSentryBabelTransformer(newConfig);\n }\n\n return newConfig;\n}\n\nfunction loadExpoMetroConfigModule(): {\n getDefaultConfig: (\n projectRoot: string,\n options: {\n unstable_beforeAssetSerializationPlugins?: ((serializationInput: {\n graph: ReadOnlyGraph<MixedOutput>;\n premodules: Module[];\n debugId?: string;\n }) => Module[])[];\n },\n ) => MetroConfig;\n} {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n return require('expo/metro-config');\n } catch (e) {\n throw new Error('Unable to load `expo/metro-config`. Make sure you have Expo installed.');\n }\n}\n\n/**\n * Adds Sentry Babel transformer to the Metro config.\n */\nexport function withSentryBabelTransformer(config: MetroConfig): MetroConfig {\n const defaultBabelTransformerPath = config.transformer && config.transformer.babelTransformerPath;\n logger.debug('Default Babel transformer path from `config.transformer`:', defaultBabelTransformerPath);\n\n if (!defaultBabelTransformerPath) {\n // This has to be console.warn because the options is enabled but won't be used\n // eslint-disable-next-line no-console\n console.warn('`transformer.babelTransformerPath` is undefined.');\n // eslint-disable-next-line no-console\n console.warn('Sentry Babel transformer cannot be used. Not adding it...');\n return config;\n }\n\n if (defaultBabelTransformerPath) {\n saveDefaultBabelTransformerPath(defaultBabelTransformerPath);\n process.on('exit', () => {\n cleanDefaultBabelTransformerPath();\n });\n }\n\n return {\n ...config,\n transformer: {\n ...config.transformer,\n babelTransformerPath: require.resolve('./sentryBabelTransformer'),\n },\n };\n}\n\ntype MetroCustomSerializer = Required<Required<MetroConfig>['serializer']>['customSerializer'] | undefined;\n\nfunction withSentryDebugId(config: MetroConfig): MetroConfig {\n const customSerializer = createSentryMetroSerializer(\n config.serializer?.customSerializer || undefined,\n ) as MetroCustomSerializer;\n // MetroConfig types customSerializers as async only, but sync returns are also supported\n // The default serializer is sync\n\n return {\n ...config,\n serializer: {\n ...config.serializer,\n customSerializer,\n },\n };\n}\n\ntype MetroFrame = Parameters<Required<Required<MetroConfig>['symbolicator']>['customizeFrame']>[0];\ntype MetroCustomizeFrame = { readonly collapse?: boolean };\ntype MetroCustomizeFrameReturnValue =\n | ReturnType<Required<Required<MetroConfig>['symbolicator']>['customizeFrame']>\n | undefined;\n\n/**\n * Collapses Sentry internal frames from the stack trace view in LogBox.\n */\nexport function withSentryFramesCollapsed(config: MetroConfig): MetroConfig {\n const originalCustomizeFrame = config.symbolicator?.customizeFrame;\n const collapseSentryInternalFrames = (frame: MetroFrame): boolean =>\n typeof frame.file === 'string' &&\n (frame.file.includes('node_modules/@sentry/utils/cjs/instrument.js') ||\n frame.file.includes('node_modules/@sentry/utils/cjs/logger.js'));\n\n const customizeFrame = (frame: MetroFrame): MetroCustomizeFrameReturnValue => {\n const originalOrSentryCustomizeFrame = (\n originalCustomization: MetroCustomizeFrame | undefined,\n ): MetroCustomizeFrame => ({\n ...originalCustomization,\n collapse: (originalCustomization && originalCustomization.collapse) || collapseSentryInternalFrames(frame),\n });\n\n const maybePromiseCustomization = (originalCustomizeFrame && originalCustomizeFrame(frame)) || undefined;\n\n if (maybePromiseCustomization !== undefined && 'then' in maybePromiseCustomization) {\n return maybePromiseCustomization.then<MetroCustomizeFrame>(originalCustomization =>\n originalOrSentryCustomizeFrame(originalCustomization),\n );\n }\n\n return originalOrSentryCustomizeFrame(maybePromiseCustomization);\n };\n\n return {\n ...config,\n symbolicator: {\n ...config.symbolicator,\n customizeFrame,\n },\n };\n}\n\n/**\n * Sets the `___SENTRY_METRO_DEV_SERVER___` environment flag.\n * This is used to determine if the SDK is running in Node in Metro Dev Server.\n * For example during static routes generation in `expo-router`.\n */\nfunction setSentryMetroDevServerEnvFlag(): void {\n env.___SENTRY_METRO_DEV_SERVER___ = 'true';\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { BabelTransformer } from './vendor/metro/metroBabelTransformer';
2
+ declare const sentryBabelTransformer: BabelTransformer;
3
+ export = sentryBabelTransformer;
4
+ //# sourceMappingURL=sentryBabelTransformer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentryBabelTransformer.d.ts","sourceRoot":"","sources":["../../../src/js/tools/sentryBabelTransformer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAwB,MAAM,sCAAsC,CAAC;AAmCnG,QAAA,MAAM,sBAAsB,kBAAiC,CAAC;AAG9D,SAAS,sBAAsB,CAAC"}
@@ -0,0 +1,28 @@
1
+ const babel_plugin_component_annotate_1 = require("@sentry/babel-plugin-component-annotate");
2
+ const enableLogger_1 = require("./enableLogger");
3
+ const sentryBabelTransformerUtils_1 = require("./sentryBabelTransformerUtils");
4
+ (0, enableLogger_1.enableLogger)();
5
+ /**
6
+ * Creates a Babel transformer with Sentry component annotation plugin.
7
+ */
8
+ function createSentryBabelTransformer() {
9
+ const defaultTransformer = (0, sentryBabelTransformerUtils_1.loadDefaultBabelTransformer)();
10
+ // Using spread operator to avoid any conflicts with the default transformer
11
+ const transform = (...args) => {
12
+ const transformerArgs = args[0];
13
+ addSentryComponentAnnotatePlugin(transformerArgs);
14
+ return defaultTransformer.transform(...args);
15
+ };
16
+ return Object.assign(Object.assign({}, defaultTransformer), { transform });
17
+ }
18
+ function addSentryComponentAnnotatePlugin(args) {
19
+ if (!args || typeof args.filename !== 'string' || !Array.isArray(args.plugins)) {
20
+ return undefined;
21
+ }
22
+ if (!args.filename.includes('node_modules')) {
23
+ args.plugins.push(babel_plugin_component_annotate_1.default);
24
+ }
25
+ }
26
+ const sentryBabelTransformer = createSentryBabelTransformer();
27
+ module.exports = sentryBabelTransformer;
28
+ //# sourceMappingURL=sentryBabelTransformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentryBabelTransformer.js","sourceRoot":"","sources":["../../../src/js/tools/sentryBabelTransformer.ts"],"names":[],"mappings":"AAAA,6FAA8E;AAE9E,iDAA8C;AAC9C,+EAA4E;AAG5E,IAAA,2BAAY,GAAE,CAAC;AAEf;;GAEG;AACH,SAAS,4BAA4B;IACnC,MAAM,kBAAkB,GAAG,IAAA,yDAA2B,GAAE,CAAC;IAEzD,4EAA4E;IAC5E,MAAM,SAAS,GAAkC,CAAC,GAAG,IAAI,EAAE,EAAE;QAC3D,MAAM,eAAe,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAEhC,gCAAgC,CAAC,eAAe,CAAC,CAAC;QAElD,OAAO,kBAAkB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;IAC/C,CAAC,CAAC;IAEF,uCACK,kBAAkB,KACrB,SAAS,IACT;AACJ,CAAC;AAED,SAAS,gCAAgC,CAAC,IAAsC;IAC9E,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;QAC9E,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;QAC3C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,yCAAuB,CAAC,CAAC;KAC5C;AACH,CAAC;AAED,MAAM,sBAAsB,GAAG,4BAA4B,EAAE,CAAC;AAG9D,iBAAS,sBAAsB,CAAC","sourcesContent":["import componentAnnotatePlugin from '@sentry/babel-plugin-component-annotate';\n\nimport { enableLogger } from './enableLogger';\nimport { loadDefaultBabelTransformer } from './sentryBabelTransformerUtils';\nimport type { BabelTransformer, BabelTransformerArgs } from './vendor/metro/metroBabelTransformer';\n\nenableLogger();\n\n/**\n * Creates a Babel transformer with Sentry component annotation plugin.\n */\nfunction createSentryBabelTransformer(): BabelTransformer {\n const defaultTransformer = loadDefaultBabelTransformer();\n\n // Using spread operator to avoid any conflicts with the default transformer\n const transform: BabelTransformer['transform'] = (...args) => {\n const transformerArgs = args[0];\n\n addSentryComponentAnnotatePlugin(transformerArgs);\n\n return defaultTransformer.transform(...args);\n };\n\n return {\n ...defaultTransformer,\n transform,\n };\n}\n\nfunction addSentryComponentAnnotatePlugin(args: BabelTransformerArgs | undefined): void {\n if (!args || typeof args.filename !== 'string' || !Array.isArray(args.plugins)) {\n return undefined;\n }\n\n if (!args.filename.includes('node_modules')) {\n args.plugins.push(componentAnnotatePlugin);\n }\n}\n\nconst sentryBabelTransformer = createSentryBabelTransformer();\n// With TS set to `commonjs` this will be translated to `module.exports = sentryBabelTransformer;`\n// which will be correctly picked up by Metro\nexport = sentryBabelTransformer;\n"]}
@@ -0,0 +1,18 @@
1
+ import type { BabelTransformer } from './vendor/metro/metroBabelTransformer';
2
+ /**
3
+ * Saves default Babel transformer path to the project root.
4
+ */
5
+ export declare function saveDefaultBabelTransformerPath(defaultBabelTransformerPath: string): void;
6
+ /**
7
+ * Reads default Babel transformer path from the project root.
8
+ */
9
+ export declare function readDefaultBabelTransformerPath(): string | undefined;
10
+ /**
11
+ * Cleans default Babel transformer path from the project root.
12
+ */
13
+ export declare function cleanDefaultBabelTransformerPath(): void;
14
+ /**
15
+ * Loads default Babel transformer from `@react-native/metro-config` -> `@react-native/metro-babel-transformer`.
16
+ */
17
+ export declare function loadDefaultBabelTransformer(): BabelTransformer;
18
+ //# sourceMappingURL=sentryBabelTransformerUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentryBabelTransformerUtils.d.ts","sourceRoot":"","sources":["../../../src/js/tools/sentryBabelTransformerUtils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,2BAA2B,EAAE,MAAM,GAAG,IAAI,CASzF;AAED;;GAEG;AACH,wBAAgB,+BAA+B,IAAI,MAAM,GAAG,SAAS,CAQpE;AAED;;GAEG;AACH,wBAAgB,gCAAgC,IAAI,IAAI,CASvD;AAMD;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,gBAAgB,CAS9D"}
@@ -0,0 +1,67 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.loadDefaultBabelTransformer = exports.cleanDefaultBabelTransformerPath = exports.readDefaultBabelTransformerPath = exports.saveDefaultBabelTransformerPath = void 0;
3
+ const utils_1 = require("@sentry/utils");
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const process = require("process");
7
+ /**
8
+ * Saves default Babel transformer path to the project root.
9
+ */
10
+ function saveDefaultBabelTransformerPath(defaultBabelTransformerPath) {
11
+ try {
12
+ fs.mkdirSync(path.join(process.cwd(), '.sentry'), { recursive: true });
13
+ fs.writeFileSync(getDefaultBabelTransformerPath(), defaultBabelTransformerPath);
14
+ utils_1.logger.debug('Saved default Babel transformer path');
15
+ }
16
+ catch (e) {
17
+ // eslint-disable-next-line no-console
18
+ console.error('[Sentry] Failed to save default Babel transformer path:', e);
19
+ }
20
+ }
21
+ exports.saveDefaultBabelTransformerPath = saveDefaultBabelTransformerPath;
22
+ /**
23
+ * Reads default Babel transformer path from the project root.
24
+ */
25
+ function readDefaultBabelTransformerPath() {
26
+ try {
27
+ return fs.readFileSync(getDefaultBabelTransformerPath()).toString();
28
+ }
29
+ catch (e) {
30
+ // eslint-disable-next-line no-console
31
+ console.error('[Sentry] Failed to read default Babel transformer path:', e);
32
+ }
33
+ return undefined;
34
+ }
35
+ exports.readDefaultBabelTransformerPath = readDefaultBabelTransformerPath;
36
+ /**
37
+ * Cleans default Babel transformer path from the project root.
38
+ */
39
+ function cleanDefaultBabelTransformerPath() {
40
+ try {
41
+ fs.unlinkSync(getDefaultBabelTransformerPath());
42
+ utils_1.logger.debug('Cleaned default Babel transformer path');
43
+ }
44
+ catch (e) {
45
+ // We don't want to fail the build if we can't clean the file
46
+ // eslint-disable-next-line no-console
47
+ console.error('[Sentry] Failed to clean default Babel transformer path:', e);
48
+ }
49
+ }
50
+ exports.cleanDefaultBabelTransformerPath = cleanDefaultBabelTransformerPath;
51
+ function getDefaultBabelTransformerPath() {
52
+ return path.join(process.cwd(), '.sentry/.defaultBabelTransformerPath');
53
+ }
54
+ /**
55
+ * Loads default Babel transformer from `@react-native/metro-config` -> `@react-native/metro-babel-transformer`.
56
+ */
57
+ function loadDefaultBabelTransformer() {
58
+ const defaultBabelTransformerPath = readDefaultBabelTransformerPath();
59
+ if (!defaultBabelTransformerPath) {
60
+ throw new Error('Default Babel Transformer Path not found in `.sentry` directory.');
61
+ }
62
+ utils_1.logger.debug(`Loading default Babel transformer from ${defaultBabelTransformerPath}`);
63
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
64
+ return require(defaultBabelTransformerPath);
65
+ }
66
+ exports.loadDefaultBabelTransformer = loadDefaultBabelTransformer;
67
+ //# sourceMappingURL=sentryBabelTransformerUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentryBabelTransformerUtils.js","sourceRoot":"","sources":["../../../src/js/tools/sentryBabelTransformerUtils.ts"],"names":[],"mappings":";;AAAA,yCAAuC;AACvC,yBAAyB;AACzB,6BAA6B;AAC7B,mCAAmC;AAInC;;GAEG;AACH,SAAgB,+BAA+B,CAAC,2BAAmC;IACjF,IAAI;QACF,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACvE,EAAE,CAAC,aAAa,CAAC,8BAA8B,EAAE,EAAE,2BAA2B,CAAC,CAAC;QAChF,cAAM,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;KACtD;IAAC,OAAO,CAAC,EAAE;QACV,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,yDAAyD,EAAE,CAAC,CAAC,CAAC;KAC7E;AACH,CAAC;AATD,0EASC;AAED;;GAEG;AACH,SAAgB,+BAA+B;IAC7C,IAAI;QACF,OAAO,EAAE,CAAC,YAAY,CAAC,8BAA8B,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;KACrE;IAAC,OAAO,CAAC,EAAE;QACV,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,yDAAyD,EAAE,CAAC,CAAC,CAAC;KAC7E;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AARD,0EAQC;AAED;;GAEG;AACH,SAAgB,gCAAgC;IAC9C,IAAI;QACF,EAAE,CAAC,UAAU,CAAC,8BAA8B,EAAE,CAAC,CAAC;QAChD,cAAM,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;KACxD;IAAC,OAAO,CAAC,EAAE;QACV,6DAA6D;QAC7D,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,0DAA0D,EAAE,CAAC,CAAC,CAAC;KAC9E;AACH,CAAC;AATD,4EASC;AAED,SAAS,8BAA8B;IACrC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,sCAAsC,CAAC,CAAC;AAC1E,CAAC;AAED;;GAEG;AACH,SAAgB,2BAA2B;IACzC,MAAM,2BAA2B,GAAG,+BAA+B,EAAE,CAAC;IACtE,IAAI,CAAC,2BAA2B,EAAE;QAChC,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;KACrF;IAED,cAAM,CAAC,KAAK,CAAC,0CAA0C,2BAA2B,EAAE,CAAC,CAAC;IACtF,8DAA8D;IAC9D,OAAO,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAC9C,CAAC;AATD,kEASC","sourcesContent":["import { logger } from '@sentry/utils';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as process from 'process';\n\nimport type { BabelTransformer } from './vendor/metro/metroBabelTransformer';\n\n/**\n * Saves default Babel transformer path to the project root.\n */\nexport function saveDefaultBabelTransformerPath(defaultBabelTransformerPath: string): void {\n try {\n fs.mkdirSync(path.join(process.cwd(), '.sentry'), { recursive: true });\n fs.writeFileSync(getDefaultBabelTransformerPath(), defaultBabelTransformerPath);\n logger.debug('Saved default Babel transformer path');\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error('[Sentry] Failed to save default Babel transformer path:', e);\n }\n}\n\n/**\n * Reads default Babel transformer path from the project root.\n */\nexport function readDefaultBabelTransformerPath(): string | undefined {\n try {\n return fs.readFileSync(getDefaultBabelTransformerPath()).toString();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error('[Sentry] Failed to read default Babel transformer path:', e);\n }\n return undefined;\n}\n\n/**\n * Cleans default Babel transformer path from the project root.\n */\nexport function cleanDefaultBabelTransformerPath(): void {\n try {\n fs.unlinkSync(getDefaultBabelTransformerPath());\n logger.debug('Cleaned default Babel transformer path');\n } catch (e) {\n // We don't want to fail the build if we can't clean the file\n // eslint-disable-next-line no-console\n console.error('[Sentry] Failed to clean default Babel transformer path:', e);\n }\n}\n\nfunction getDefaultBabelTransformerPath(): string {\n return path.join(process.cwd(), '.sentry/.defaultBabelTransformerPath');\n}\n\n/**\n * Loads default Babel transformer from `@react-native/metro-config` -> `@react-native/metro-babel-transformer`.\n */\nexport function loadDefaultBabelTransformer(): BabelTransformer {\n const defaultBabelTransformerPath = readDefaultBabelTransformerPath();\n if (!defaultBabelTransformerPath) {\n throw new Error('Default Babel Transformer Path not found in `.sentry` directory.');\n }\n\n logger.debug(`Loading default Babel transformer from ${defaultBabelTransformerPath}`);\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n return require(defaultBabelTransformerPath);\n}\n"]}
@@ -0,0 +1,35 @@
1
+ export interface CustomTransformOptions {
2
+ [key: string]: unknown;
3
+ }
4
+ export type TransformProfile = 'default' | 'hermes-stable' | 'hermes-canary';
5
+ export interface BabelTransformerOptions {
6
+ readonly customTransformOptions?: CustomTransformOptions;
7
+ readonly dev: boolean;
8
+ readonly enableBabelRCLookup?: boolean;
9
+ readonly enableBabelRuntime: boolean | string;
10
+ readonly extendsBabelConfigPath?: string;
11
+ readonly experimentalImportSupport?: boolean;
12
+ readonly hermesParser?: boolean;
13
+ readonly hot: boolean;
14
+ readonly minify: boolean;
15
+ readonly unstable_disableES6Transforms?: boolean;
16
+ readonly platform: string | null;
17
+ readonly projectRoot: string;
18
+ readonly publicPath: string;
19
+ readonly unstable_transformProfile?: TransformProfile;
20
+ readonly globalPrefix: string;
21
+ }
22
+ export interface BabelTransformerArgs {
23
+ readonly filename: string;
24
+ readonly options: BabelTransformerOptions;
25
+ readonly plugins?: unknown;
26
+ readonly src: string;
27
+ }
28
+ export interface BabelTransformer {
29
+ transform: (args: BabelTransformerArgs) => {
30
+ ast: unknown;
31
+ metadata: unknown;
32
+ };
33
+ getCacheKey?: () => string;
34
+ }
35
+ //# sourceMapp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O,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK;QACzC,GAAG,EAAE,OAAO,CAAC;QACb,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;IACF,WAAW,CAAC,EAAE,MAAM,MAAM,CAAC;CAC5B"}
@@ -0,0 +1,3 @@
1
+ // Vendored / modified from @facebook/metro
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=metroBabelTransformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metroBabelTransformer.js","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/metroBabelTransformer.ts"],"names":[],"mappings":"AAAA,2CAA2C","sourcesContent":["// Vendored / modified from @facebook/metro\n\n// https://github.com/facebook/metro/blob/9b295e5f7ecd9cb6332a199bf9cdc1bd8fddf6d9/packages/metro-babel-transformer/types/index.d.ts\n\n// MIT License\n\n// Copyright (c) Meta Platforms, Inc. and affiliates.\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\nexport interface CustomTransformOptions {\n [key: string]: unknown;\n}\n\nexport type TransformProfile = 'default' | 'hermes-stable' | 'hermes-canary';\n\nexport interface BabelTransformerOptions {\n readonly customTransformOptions?: CustomTransformOptions;\n readonly dev: boolean;\n readonly enableBabelRCLookup?: boolean;\n readonly enableBabelRuntime: boolean | string;\n readonly extendsBabelConfigPath?: string;\n readonly experimentalImportSupport?: boolean;\n readonly hermesParser?: boolean;\n readonly hot: boolean;\n readonly minify: boolean;\n readonly unstable_disableES6Transforms?: boolean;\n readonly platform: string | null;\n readonly projectRoot: string;\n readonly publicPath: string;\n readonly unstable_transformProfile?: TransformProfile;\n readonly globalPrefix: string;\n}\n\nexport interface BabelTransformerArgs {\n readonly filename: string;\n readonly options: BabelTransformerOptions;\n readonly plugins?: unknown;\n readonly src: string;\n}\n\nexport interface BabelTransformer {\n transform: (args: BabelTransformerArgs) => {\n ast: unknown;\n metadata: unknown;\n };\n getCacheKey?: () => string;\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  export interface ExtendedError extends Error {
2
2
  framesToPop?: number | undefined;
3
+ cause?: Error | undefined;
3
4
  }
4
5
  /**
5
6
  * Creates synthetic trace. By default pops 2 frames - `createSyntheticError` and the caller
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/js/utils/error.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAc,SAAQ,KAAK;IAC1C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AAQD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,GAAE,MAAU,GAAG,aAAa,CAI3E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAE3D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,cAAc,EAAE,OAAO,GAAG,cAAc,IAAI;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAOxF"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/js/utils/error.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAc,SAAQ,KAAK;IAC1C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,KAAK,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;CAC3B;AAQD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,GAAE,MAAU,GAAG,aAAa,CAI3E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAE3D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,cAAc,EAAE,OAAO,GAAG,cAAc,IAAI;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAOxF"}
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/js/utils/error.ts"],"names":[],"mappings":"AAIA,mDAAmD;AACnD,oIAAoI;AACpI,0CAA0C;AAC1C,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACrC,MAAM,4BAA4B,GAAG,CAAC,GAAG,0BAA0B,CAAC;AAEpE;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,cAAsB,CAAC;IAC1D,MAAM,KAAK,GAAkB,IAAI,KAAK,EAAE,CAAC;IACzC,KAAK,CAAC,WAAW,GAAG,WAAW,GAAG,4BAA4B,CAAC,CAAC,+CAA+C;IAC/G,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAoB;IACjD,OAAO,KAAK,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,cAAuB;IACjD,OAAO,CACL,cAAc,KAAK,IAAI;QACvB,OAAO,cAAc,KAAK,QAAQ;QAClC,OAAO,IAAI,cAAc;QACzB,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ,CACzC,CAAC;AACJ,CAAC","sourcesContent":["export interface ExtendedError extends Error {\n framesToPop?: number | undefined;\n}\n\n// Sentry Stack Parser is skipping lines not frames\n// https://github.com/getsentry/sentry-javascript/blob/739d904342aaf9327312f409952f14ceff4ae1ab/packages/utils/src/stacktrace.ts#L23\n// 1 for first line with the Error message\nconst SENTRY_STACK_PARSER_OFFSET = 1;\nconst REMOVE_ERROR_CREATION_FRAMES = 2 + SENTRY_STACK_PARSER_OFFSET;\n\n/**\n * Creates synthetic trace. By default pops 2 frames - `createSyntheticError` and the caller\n */\nexport function createSyntheticError(framesToPop: number = 0): ExtendedError {\n const error: ExtendedError = new Error();\n error.framesToPop = framesToPop + REMOVE_ERROR_CREATION_FRAMES; // Skip createSyntheticError's own stack frame.\n return error;\n}\n\n/**\n * Returns the number of frames to pop from the stack trace.\n * @param error ExtendedError\n */\nexport function getFramesToPop(error: ExtendedError): number {\n return error.framesToPop !== undefined ? error.framesToPop : 0;\n}\n\n/**\n * Check if `potentialError` is an object with string stack property.\n */\nexport function isErrorLike(potentialError: unknown): potentialError is { stack: string } {\n return (\n potentialError !== null &&\n typeof potentialError === 'object' &&\n 'stack' in potentialError &&\n typeof potentialError.stack === 'string'\n );\n}\n"]}
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/js/utils/error.ts"],"names":[],"mappings":"AAKA,mDAAmD;AACnD,oIAAoI;AACpI,0CAA0C;AAC1C,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACrC,MAAM,4BAA4B,GAAG,CAAC,GAAG,0BAA0B,CAAC;AAEpE;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,cAAsB,CAAC;IAC1D,MAAM,KAAK,GAAkB,IAAI,KAAK,EAAE,CAAC;IACzC,KAAK,CAAC,WAAW,GAAG,WAAW,GAAG,4BAA4B,CAAC,CAAC,+CAA+C;IAC/G,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAoB;IACjD,OAAO,KAAK,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,cAAuB;IACjD,OAAO,CACL,cAAc,KAAK,IAAI;QACvB,OAAO,cAAc,KAAK,QAAQ;QAClC,OAAO,IAAI,cAAc;QACzB,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ,CACzC,CAAC;AACJ,CAAC","sourcesContent":["export interface ExtendedError extends Error {\n framesToPop?: number | undefined;\n cause?: Error | undefined;\n}\n\n// Sentry Stack Parser is skipping lines not frames\n// https://github.com/getsentry/sentry-javascript/blob/739d904342aaf9327312f409952f14ceff4ae1ab/packages/utils/src/stacktrace.ts#L23\n// 1 for first line with the Error message\nconst SENTRY_STACK_PARSER_OFFSET = 1;\nconst REMOVE_ERROR_CREATION_FRAMES = 2 + SENTRY_STACK_PARSER_OFFSET;\n\n/**\n * Creates synthetic trace. By default pops 2 frames - `createSyntheticError` and the caller\n */\nexport function createSyntheticError(framesToPop: number = 0): ExtendedError {\n const error: ExtendedError = new Error();\n error.framesToPop = framesToPop + REMOVE_ERROR_CREATION_FRAMES; // Skip createSyntheticError's own stack frame.\n return error;\n}\n\n/**\n * Returns the number of frames to pop from the stack trace.\n * @param error ExtendedError\n */\nexport function getFramesToPop(error: ExtendedError): number {\n return error.framesToPop !== undefined ? error.framesToPop : 0;\n}\n\n/**\n * Check if `potentialError` is an object with string stack property.\n */\nexport function isErrorLike(potentialError: unknown): potentialError is { stack: string } {\n return (\n potentialError !== null &&\n typeof potentialError === 'object' &&\n 'stack' in potentialError &&\n typeof potentialError.stack === 'string'\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
2
2
  export declare const SDK_NAME = "sentry.javascript.react-native";
3
- export declare const SDK_VERSION = "5.25.0-alpha.2";
3
+ export declare const SDK_VERSION = "5.26.0-alpha.3";
4
4
  //# sourceMappingURL=version.d.ts.map
@@ -1,4 +1,4 @@
1
1
  export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';
2
2
  export const SDK_NAME = 'sentry.javascript.react-native';
3
- export const SDK_VERSION = '5.25.0-alpha.2';
3
+ export const SDK_VERSION = '5.26.0-alpha.3';
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.25.0-alpha.2';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.26.0-alpha.3';\n"]}
@@ -87,7 +87,7 @@ export const NATIVE = {
87
87
  newBytes.set(EOL, envelopeBytes.length + bytesItemHeader.length + EOL.length + bytesPayload.length);
88
88
  envelopeBytes = newBytes;
89
89
  }
90
- yield RNSentry.captureEnvelope(base64StringFromByteArray(envelopeBytes), { store: hardCrashed });
90
+ yield RNSentry.captureEnvelope(base64StringFromByteArray(envelopeBytes), { hardCrashed });
91
91
  });
92
92
  },
93
93
  /**