@sentry/react-native 7.5.0 → 7.6.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.
package/README.md CHANGED
@@ -12,6 +12,7 @@ _Bad software is everywhere, and we're tired of it. Sentry is on a mission to he
12
12
  [![npm version](https://img.shields.io/npm/v/@sentry/react-native.svg)](https://www.npmjs.com/package/@sentry/react-native)
13
13
  [![npm dm](https://img.shields.io/npm/dm/@sentry/react-native.svg)](https://www.npmjs.com/package/@sentry/react-native)
14
14
  [![npm dt](https://img.shields.io/npm/dt/@sentry/react-native.svg)](https://www.npmjs.com/package/@sentry/react-native)
15
+ [![X Follow](https://img.shields.io/twitter/follow/sentry?label=sentry&style=social)](https://x.com/intent/follow?screen_name=sentry)
15
16
  [![Discord Chat](https://img.shields.io/discord/621778831602221064?logo=discord&logoColor=ffffff&color=7389D8)](https://discord.gg/PXa5Apfe7K)
16
17
  [![Runs with Expo](https://img.shields.io/badge/Runs%20with%20Expo-4630EB.svg?style=flat-square&logo=EXPO&labelColor=f3f3f3&logoColor=000)](https://expo.dev/)
17
18
 
@@ -94,4 +95,4 @@ If you are coming from `react-native-sentry` which was our SDK `< 1.0` you shoul
94
95
  - [![Discord Chat](https://img.shields.io/discord/621778831602221064?logo=discord&logoColor=ffffff&color=7389D8)](https://discord.gg/PXa5Apfe7K)
95
96
  - [![Stack Overflow](https://img.shields.io/badge/stack%20overflow-sentry-green.svg)](http://stackoverflow.com/questions/tagged/sentry)
96
97
  - [![Code of Conduct](https://img.shields.io/badge/code%20of%20conduct-sentry-green.svg)](https://github.com/getsentry/.github/blob/main/CODE_OF_CONDUCT.md)
97
- - [![Twitter Follow](https://img.shields.io/twitter/follow/getsentry?label=getsentry&style=social)](https://twitter.com/intent/follow?screen_name=getsentry)
98
+ - [![X Follow](https://img.shields.io/twitter/follow/sentry?label=sentry&style=social)](https://x.com/intent/follow?screen_name=sentry)
package/RNSentry.podspec CHANGED
@@ -46,7 +46,7 @@ Pod::Spec.new do |s|
46
46
 
47
47
  s.compiler_flags = other_cflags
48
48
 
49
- s.dependency 'Sentry/HybridSDK', '8.57.1'
49
+ s.dependency 'Sentry/HybridSDK', '8.57.2'
50
50
 
51
51
  if defined? install_modules_dependencies
52
52
  # Default React Native dependencies for 0.71 and above (new and legacy architecture)
Binary file
@@ -242,6 +242,9 @@ public class RNSentryModuleImpl {
242
242
  if (rnOptions.hasKey("debug") && rnOptions.getBoolean("debug")) {
243
243
  options.setDebug(true);
244
244
  }
245
+ if (rnOptions.hasKey("enabled")) {
246
+ options.setEnabled(rnOptions.getBoolean("enabled"));
247
+ }
245
248
  if (rnOptions.hasKey("dsn") && rnOptions.getString("dsn") != null) {
246
249
  String dsn = rnOptions.getString("dsn");
247
250
  logger.log(SentryLevel.INFO, String.format("Starting with DSN: '%s'", dsn));
@@ -2,7 +2,7 @@ package io.sentry.react;
2
2
 
3
3
  class RNSentryVersion {
4
4
  static final String REACT_NATIVE_SDK_PACKAGE_NAME = "npm:@sentry/react-native";
5
- static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "7.5.0";
5
+ static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "7.6.0";
6
6
  static final String NATIVE_SDK_NAME = "sentry.native.android.react-native";
7
7
  static final String ANDROID_SDK_NAME = "sentry.java.android.react-native";
8
8
  static final String REACT_NATIVE_SDK_NAME = "sentry.javascript.react-native";
@@ -1 +1 @@
1
- {"version":3,"file":"sentryMetroSerializer.d.ts","sourceRoot":"","sources":["../../../src/js/tools/sentryMetroSerializer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,KAAK,EAAU,eAAe,EAA4D,MAAM,SAAS,CAAC;AAkBjH;;GAEG;AACH,wBAAgB,6CAA6C,CAAC,EAC5D,UAAU,EACV,OAAO,GACR,EAAE;IACD,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,EAAE,CAcX;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,sBAAuB,eAAe,KAAG,eAsDhF,CAAC"}
1
+ {"version":3,"file":"sentryMetroSerializer.d.ts","sourceRoot":"","sources":["../../../src/js/tools/sentryMetroSerializer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,KAAK,EAAU,eAAe,EAA4D,MAAM,SAAS,CAAC;AAkBjH;;GAEG;AACH,wBAAgB,6CAA6C,CAAC,EAC5D,UAAU,EACV,OAAO,GACR,EAAE;IACD,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,EAAE,CAcX;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,sBAAuB,eAAe,KAAG,eA8DhF,CAAC"}
@@ -60,9 +60,19 @@ const createSentryMetroSerializer = (customSerializer) => {
60
60
  const serializerResult = serializer(entryPoint, modifiedPreModules, graph, options);
61
61
  const { code: bundleCode, map: bundleMapString } = yield extractSerializerResult(serializerResult);
62
62
  // Add debug id comment to the bundle
63
- const debugId = (0, utils_1.determineDebugIdFromBundleSource)(bundleCode);
63
+ let debugId = (0, utils_1.determineDebugIdFromBundleSource)(bundleCode);
64
64
  if (!debugId) {
65
- throw new Error('Debug ID was not found in the bundle. Call `options.sentryBundleCallback` if you are using a custom serializer.');
65
+ // For lazy-loaded chunks or bundles without the debug ID module,
66
+ // calculate the debug ID from the bundle content.
67
+ // This ensures Metro 0.83.2+ code-split bundles get debug IDs.
68
+ // That needs to be done because when Metro 0.83.2 stopped importing `BabelSourceMapSegment`
69
+ // from `@babel/generator` and defined it locally, it subtly changed the source map output format.
70
+ // https://github.com/facebook/metro/blob/main/packages/metro-source-map/src/source-map.js#L47
71
+ const hash = crypto.createHash('md5');
72
+ hash.update(bundleCode);
73
+ debugId = (0, utils_1.stringToUUID)(hash.digest('hex'));
74
+ // eslint-disable-next-line no-console
75
+ console.log('info ' + `Bundle Debug ID (calculated): ${debugId}`);
66
76
  }
67
77
  // Only print debug id for command line builds => not hot reload from dev server
68
78
  // eslint-disable-next-line no-console
@@ -1 +1 @@
1
- {"version":3,"file":"sentryMetroSerializer.js","sourceRoot":"","sources":["../../../src/js/tools/sentryMetroSerializer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAiC;AAIjC,mCAMiB;AACjB,gDAAoE;AAIpE,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAC1D,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAE3C,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AACnD,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC;;GAEG;AACH,SAAgB,6CAA6C,CAAC,EAC5D,UAAU,EACV,OAAO,GAKR;IACC,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,UAAU,CAAC;KACnB;IAED,MAAM,mBAAmB,GAAG,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;IACvG,IAAI,mBAAmB,EAAE;QACvB,sCAAsC;QACtC,OAAO,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC;QAClF,OAAO,UAAU,CAAC;KACnB;IAED,MAAM,aAAa,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,IAAA,qBAAa,EAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAClD,CAAC;AArBD,sGAqBC;AAED;;;;;GAKG;AACI,MAAM,2BAA2B,GAAG,CAAC,gBAAkC,EAAmB,EAAE;IACjG,MAAM,UAAU,GA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AI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,qBAAqB,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import * as crypto from 'crypto';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport type { MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport type { Bundle, MetroSerializer, MetroSerializerOutput, SerializedBundle, VirtualJSOutput } from './utils';\nimport {\n createDebugIdSnippet,\n createVirtualJSModule,\n determineDebugIdFromBundleSource,\n prependModule,\n stringToUUID,\n} from './utils';\nimport { createDefaultMetroSerializer } from './vendor/metro/utils';\n\ntype SourceMap = Record<string, unknown>;\n\nconst DEBUG_ID_PLACE_HOLDER = '__debug_id_place_holder__';\nconst DEBUG_ID_MODULE_PATH = '__debugid__';\n\nconst SOURCE_MAP_COMMENT = '//# sourceMappingURL=';\nconst DEBUG_ID_COMMENT = '//# debugId=';\n\n/**\n * Adds Sentry Debug ID polyfill module to the bundle.\n */\nexport function unstableBeforeAssetSerializationDebugIdPlugin({\n premodules,\n debugId,\n}: {\n graph: ReadOnlyGraph<MixedOutput>;\n premodules: Module[];\n debugId?: string;\n}): Module[] {\n if (!debugId) {\n return premodules;\n }\n\n const debugIdModuleExists = premodules.findIndex(module => module.path === DEBUG_ID_MODULE_PATH) != -1;\n if (debugIdModuleExists) {\n // eslint-disable-next-line no-console\n console.warn('\\n\\nDebug ID module found. Skipping Sentry Debug ID module...\\n\\n');\n return premodules;\n }\n\n const debugIdModule = createDebugIdModule(debugId);\n return prependModule(premodules, debugIdModule);\n}\n\n/**\n * Creates a Metro serializer that adds Debug ID module to the plain bundle.\n * The Debug ID module is a virtual module that provides a debug ID in runtime.\n *\n * RAM Bundles do not support custom serializers.\n */\nexport const createSentryMetroSerializer = (customSerializer?: MetroSerializer): MetroSerializer => {\n const serializer = customSerializer || createDefaultMetroSerializer();\n return async function (entryPoint, preModules, graph, options) {\n if (graph.transformOptions.hot) {\n return serializer(entryPoint, preModules, graph, options);\n }\n\n const debugIdModuleExists = preModules.findIndex(module => module.path === DEBUG_ID_MODULE_PATH) != -1;\n if (debugIdModuleExists) {\n // eslint-disable-next-line no-console\n console.warn('Debug ID module found. Skipping Sentry Debug ID module...');\n return serializer(entryPoint, preModules, graph, options);\n }\n\n const debugIdModule = createDebugIdModule(DEBUG_ID_PLACE_HOLDER);\n options.sentryBundleCallback = createSentryBundleCallback(debugIdModule);\n const modifiedPreModules = prependModule(preModules, debugIdModule);\n\n // Run wrapped serializer\n const serializerResult = serializer(entryPoint, modifiedPreModules, graph, options);\n const { code: bundleCode, map: bundleMapString } = await extractSerializerResult(serializerResult);\n\n // Add debug id comment to the bundle\n const debugId = determineDebugIdFromBundleSource(bundleCode);\n if (!debugId) {\n throw new Error(\n 'Debug ID was not found in the bundle. Call `options.sentryBundleCallback` if you are using a custom serializer.',\n );\n }\n // Only print debug id for command line builds => not hot reload from dev server\n // eslint-disable-next-line no-console\n console.log('info ' + `Bundle Debug ID: ${debugId}`);\n\n const debugIdComment = `${DEBUG_ID_COMMENT}${debugId}`;\n const indexOfSourceMapComment = bundleCode.lastIndexOf(SOURCE_MAP_COMMENT);\n const bundleCodeWithDebugId =\n indexOfSourceMapComment === -1\n ? // If source map comment is missing lets just add the debug id comment\n `${bundleCode}\\n${debugIdComment}`\n : // If source map comment is present lets add the debug id comment before it\n `${bundleCode.substring(0, indexOfSourceMapComment) + debugIdComment}\\n${bundleCode.substring(\n indexOfSourceMapComment,\n )}`;\n\n const bundleMap: SourceMap = JSON.parse(bundleMapString);\n // For now we write both fields until we know what will become the standard - if ever.\n bundleMap['debug_id'] = debugId;\n bundleMap['debugId'] = debugId;\n\n return {\n code: bundleCodeWithDebugId,\n map: JSON.stringify(bundleMap),\n };\n };\n};\n\n/**\n * This function is expected to be called after serializer creates the final bundle object\n * and before the source maps are generated.\n *\n * It injects a debug ID into the bundle and returns the modified bundle.\n *\n * Access it via `options.sentryBundleCallback` in your custom serializer.\n */\nfunction createSentryBundleCallback(debugIdModule: Module<VirtualJSOutput> & { setSource: (code: string) => void }) {\n return (bundle: Bundle) => {\n const debugId = calculateDebugId(bundle);\n debugIdModule.setSource(injectDebugId(debugIdModule.getSource().toString(), debugId));\n bundle.pre = injectDebugId(bundle.pre, debugId);\n return bundle;\n };\n}\n\nasync function extractSerializerResult(serializerResult: MetroSerializerOutput): Promise<SerializedBundle> {\n if (typeof serializerResult === 'string') {\n return { code: serializerResult, map: '{}' };\n }\n\n if ('map' in serializerResult) {\n return { code: serializerResult.code, map: serializerResult.map };\n }\n\n const awaitedResult = await serializerResult;\n if (typeof awaitedResult === 'string') {\n return { code: awaitedResult, map: '{}' };\n }\n\n return { code: awaitedResult.code, map: awaitedResult.map };\n}\n\nfunction createDebugIdModule(debugId: string): Module<VirtualJSOutput> & { setSource: (code: string) => void } {\n return createVirtualJSModule(DEBUG_ID_MODULE_PATH, createDebugIdSnippet(debugId));\n}\n\nfunction calculateDebugId(bundle: Bundle): string {\n const hash = crypto.createHash('md5');\n hash.update(bundle.pre);\n for (const [, code] of bundle.modules) {\n hash.update(code);\n }\n hash.update(bundle.post);\n\n const debugId = stringToUUID(hash.digest('hex'));\n return debugId;\n}\n\nfunction injectDebugId(code: string, debugId: string): string {\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n return code.replace(new RegExp(DEBUG_ID_PLACE_HOLDER, 'g'), debugId);\n}\n"]}
1
+ {"version":3,"file":"sentryMetroSerializer.js","sourceRoot":"","sources":["../../../src/js/tools/sentryMetroSerializer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAiC;AAIjC,mCAMiB;AACjB,gDAAoE;AAIpE,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAC1D,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAE3C,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AACnD,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC;;GAEG;AACH,SAAgB,6CAA6C,CAAC,EAC5D,UAAU,EACV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AI,OAAO,aAAa,KAAK,QAAQ,EAAE;YACrC,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;SAC3C;QAED,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;IAC9D,CAAC;CAAA;AAED,SAAS,mBAAmB,CAAC,OAAe;IAC1C,OAAO,IAAA,6BAAqB,EAAC,oBAAoB,EAAE,IAAA,4BAAoB,EAAC,OAAO,CAAC,CAAC,CAAC;AACpF,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAc;IACtC,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACxB,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE;QACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KACnB;IACD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEzB,MAAM,OAAO,GAAG,IAAA,oBAAY,EAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACjD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,OAAe;IAClD,sEAAsE;IACtE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,qBAAqB,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import * as crypto from 'crypto';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport type { MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport type { Bundle, MetroSerializer, MetroSerializerOutput, SerializedBundle, VirtualJSOutput } from './utils';\nimport {\n createDebugIdSnippet,\n createVirtualJSModule,\n determineDebugIdFromBundleSource,\n prependModule,\n stringToUUID,\n} from './utils';\nimport { createDefaultMetroSerializer } from './vendor/metro/utils';\n\ntype SourceMap = Record<string, unknown>;\n\nconst DEBUG_ID_PLACE_HOLDER = '__debug_id_place_holder__';\nconst DEBUG_ID_MODULE_PATH = '__debugid__';\n\nconst SOURCE_MAP_COMMENT = '//# sourceMappingURL=';\nconst DEBUG_ID_COMMENT = '//# debugId=';\n\n/**\n * Adds Sentry Debug ID polyfill module to the bundle.\n */\nexport function unstableBeforeAssetSerializationDebugIdPlugin({\n premodules,\n debugId,\n}: {\n graph: ReadOnlyGraph<MixedOutput>;\n premodules: Module[];\n debugId?: string;\n}): Module[] {\n if (!debugId) {\n return premodules;\n }\n\n const debugIdModuleExists = premodules.findIndex(module => module.path === DEBUG_ID_MODULE_PATH) != -1;\n if (debugIdModuleExists) {\n // eslint-disable-next-line no-console\n console.warn('\\n\\nDebug ID module found. Skipping Sentry Debug ID module...\\n\\n');\n return premodules;\n }\n\n const debugIdModule = createDebugIdModule(debugId);\n return prependModule(premodules, debugIdModule);\n}\n\n/**\n * Creates a Metro serializer that adds Debug ID module to the plain bundle.\n * The Debug ID module is a virtual module that provides a debug ID in runtime.\n *\n * RAM Bundles do not support custom serializers.\n */\nexport const createSentryMetroSerializer = (customSerializer?: MetroSerializer): MetroSerializer => {\n const serializer = customSerializer || createDefaultMetroSerializer();\n return async function (entryPoint, preModules, graph, options) {\n if (graph.transformOptions.hot) {\n return serializer(entryPoint, preModules, graph, options);\n }\n\n const debugIdModuleExists = preModules.findIndex(module => module.path === DEBUG_ID_MODULE_PATH) != -1;\n if (debugIdModuleExists) {\n // eslint-disable-next-line no-console\n console.warn('Debug ID module found. Skipping Sentry Debug ID module...');\n return serializer(entryPoint, preModules, graph, options);\n }\n\n const debugIdModule = createDebugIdModule(DEBUG_ID_PLACE_HOLDER);\n options.sentryBundleCallback = createSentryBundleCallback(debugIdModule);\n const modifiedPreModules = prependModule(preModules, debugIdModule);\n\n // Run wrapped serializer\n const serializerResult = serializer(entryPoint, modifiedPreModules, graph, options);\n const { code: bundleCode, map: bundleMapString } = await extractSerializerResult(serializerResult);\n\n // Add debug id comment to the bundle\n let debugId = determineDebugIdFromBundleSource(bundleCode);\n if (!debugId) {\n // For lazy-loaded chunks or bundles without the debug ID module,\n // calculate the debug ID from the bundle content.\n // This ensures Metro 0.83.2+ code-split bundles get debug IDs.\n // That needs to be done because when Metro 0.83.2 stopped importing `BabelSourceMapSegment`\n // from `@babel/generator` and defined it locally, it subtly changed the source map output format.\n // https://github.com/facebook/metro/blob/main/packages/metro-source-map/src/source-map.js#L47\n const hash = crypto.createHash('md5');\n hash.update(bundleCode);\n debugId = stringToUUID(hash.digest('hex'));\n // eslint-disable-next-line no-console\n console.log('info ' + `Bundle Debug ID (calculated): ${debugId}`);\n }\n // Only print debug id for command line builds => not hot reload from dev server\n // eslint-disable-next-line no-console\n console.log('info ' + `Bundle Debug ID: ${debugId}`);\n\n const debugIdComment = `${DEBUG_ID_COMMENT}${debugId}`;\n const indexOfSourceMapComment = bundleCode.lastIndexOf(SOURCE_MAP_COMMENT);\n const bundleCodeWithDebugId =\n indexOfSourceMapComment === -1\n ? // If source map comment is missing lets just add the debug id comment\n `${bundleCode}\\n${debugIdComment}`\n : // If source map comment is present lets add the debug id comment before it\n `${bundleCode.substring(0, indexOfSourceMapComment) + debugIdComment}\\n${bundleCode.substring(\n indexOfSourceMapComment,\n )}`;\n\n const bundleMap: SourceMap = JSON.parse(bundleMapString);\n // For now we write both fields until we know what will become the standard - if ever.\n bundleMap['debug_id'] = debugId;\n bundleMap['debugId'] = debugId;\n\n return {\n code: bundleCodeWithDebugId,\n map: JSON.stringify(bundleMap),\n };\n };\n};\n\n/**\n * This function is expected to be called after serializer creates the final bundle object\n * and before the source maps are generated.\n *\n * It injects a debug ID into the bundle and returns the modified bundle.\n *\n * Access it via `options.sentryBundleCallback` in your custom serializer.\n */\nfunction createSentryBundleCallback(debugIdModule: Module<VirtualJSOutput> & { setSource: (code: string) => void }) {\n return (bundle: Bundle) => {\n const debugId = calculateDebugId(bundle);\n debugIdModule.setSource(injectDebugId(debugIdModule.getSource().toString(), debugId));\n bundle.pre = injectDebugId(bundle.pre, debugId);\n return bundle;\n };\n}\n\nasync function extractSerializerResult(serializerResult: MetroSerializerOutput): Promise<SerializedBundle> {\n if (typeof serializerResult === 'string') {\n return { code: serializerResult, map: '{}' };\n }\n\n if ('map' in serializerResult) {\n return { code: serializerResult.code, map: serializerResult.map };\n }\n\n const awaitedResult = await serializerResult;\n if (typeof awaitedResult === 'string') {\n return { code: awaitedResult, map: '{}' };\n }\n\n return { code: awaitedResult.code, map: awaitedResult.map };\n}\n\nfunction createDebugIdModule(debugId: string): Module<VirtualJSOutput> & { setSource: (code: string) => void } {\n return createVirtualJSModule(DEBUG_ID_MODULE_PATH, createDebugIdSnippet(debugId));\n}\n\nfunction calculateDebugId(bundle: Bundle): string {\n const hash = crypto.createHash('md5');\n hash.update(bundle.pre);\n for (const [, code] of bundle.modules) {\n hash.update(code);\n }\n hash.update(bundle.post);\n\n const debugId = stringToUUID(hash.digest('hex'));\n return debugId;\n}\n\nfunction injectDebugId(code: string, debugId: string): string {\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n return code.replace(new RegExp(DEBUG_ID_PLACE_HOLDER, 'g'), debugId);\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 = "7.5.0";
3
+ export declare const SDK_VERSION = "7.6.0";
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 = '7.5.0';
3
+ export const SDK_VERSION = '7.6.0';
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,OAAO,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '7.5.0';\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,OAAO,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '7.6.0';\n"]}
@@ -2,14 +2,6 @@
2
2
  #import "RNSentryBreadcrumb.h"
3
3
  #import "RNSentryId.h"
4
4
  #import <Sentry/PrivateSentrySDKOnly.h>
5
- #import <Sentry/SentryAppStartMeasurement.h>
6
- #import <Sentry/SentryBreadcrumb.h>
7
- #import <Sentry/SentryDebugMeta.h>
8
- #import <Sentry/SentryEvent.h>
9
- #import <Sentry/SentryException.h>
10
- #import <Sentry/SentryFormatter.h>
11
- #import <Sentry/SentryOptions.h>
12
- #import <Sentry/SentryUser.h>
13
5
  @import Sentry;
14
6
 
15
7
  // This method was moved to a new category so we can use `@import Sentry` to use Sentry's Swift
package/ios/RNSentry.h CHANGED
@@ -20,8 +20,7 @@ typedef int (*SymbolicateCallbackType)(const void *, Dl_info *);
20
20
 
21
21
  @interface RNSentry : RCTEventEmitter <RCTBridgeModule>
22
22
 
23
- - (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)options
24
- error:(NSError *_Nullable *_Nonnull)errorPointer;
23
+ - (NSMutableDictionary *)prepareOptions:(NSDictionary *)options;
25
24
 
26
25
  - (void)setEventOriginTag:(SentryEvent *)event;
27
26
 
package/ios/RNSentry.mm CHANGED
@@ -26,8 +26,6 @@
26
26
  #import <Sentry/SentryException.h>
27
27
  #import <Sentry/SentryFormatter.h>
28
28
  #import <Sentry/SentryGeo.h>
29
- #import <Sentry/SentryOptions.h>
30
- #import <Sentry/SentryOptionsInternal.h>
31
29
  #import <Sentry/SentryScreenFrames.h>
32
30
  #import <Sentry/SentryUser.h>
33
31
 
@@ -85,24 +83,68 @@ static bool hasFetchedAppStart;
85
83
  return self;
86
84
  }
87
85
 
86
+ - (NSMutableDictionary *)prepareOptions:(NSDictionary *)options
87
+ {
88
+ SentryBeforeSendEventCallback beforeSend = ^SentryEvent *(SentryEvent *event) {
89
+ // We don't want to send an event after startup that came from a Unhandled JS Exception of
90
+ // React Native because we sent it already before the app crashed.
91
+ if (nil != event.exceptions.firstObject.type &&
92
+ [event.exceptions.firstObject.type rangeOfString:@"Unhandled JS Exception"].location
93
+ != NSNotFound) {
94
+ return nil;
95
+ }
96
+
97
+ // Regex and Str are set when one of them has value so we only need to check one of them.
98
+ if (self->_ignoreErrorPatternsStr || self->_ignoreErrorPatternsRegex) {
99
+ for (SentryException *exception in event.exceptions) {
100
+ if ([self shouldIgnoreError:exception.value]) {
101
+ return nil;
102
+ }
103
+ }
104
+ if ([self shouldIgnoreError:event.message.message]) {
105
+ return nil;
106
+ }
107
+ }
108
+
109
+ [self setEventOriginTag:event];
110
+ return event;
111
+ };
112
+
113
+ NSMutableDictionary *mutableOptions = [options mutableCopy];
114
+ [mutableOptions setValue:beforeSend forKey:@"beforeSend"];
115
+
116
+ // remove performance traces sample rate and traces sampler since we don't want to synchronize
117
+ // these configurations to the Native SDKs. The user could tho initialize the SDK manually and
118
+ // set themselves.
119
+ [mutableOptions removeObjectForKey:@"tracesSampleRate"];
120
+ [mutableOptions removeObjectForKey:@"tracesSampler"];
121
+ [mutableOptions removeObjectForKey:@"enableTracing"];
122
+
123
+ [self trySetIgnoreErrors:mutableOptions];
124
+
125
+ return mutableOptions;
126
+ }
127
+
88
128
  RCT_EXPORT_MODULE()
89
129
  RCT_EXPORT_METHOD(initNativeSdk : (NSDictionary *_Nonnull)options resolve : (
90
130
  RCTPromiseResolveBlock)resolve rejecter : (RCTPromiseRejectBlock)reject)
91
131
  {
132
+ NSMutableDictionary *mutableOptions = [self prepareOptions:options];
133
+ #if SENTRY_TARGET_REPLAY_SUPPORTED
134
+ BOOL isSessionReplayEnabled = [RNSentryReplay updateOptions:mutableOptions];
135
+ #else
136
+ // Defaulting to false for unsupported targets
137
+ BOOL isSessionReplayEnabled = NO;
138
+ #endif
92
139
  NSError *error = nil;
93
- SentryOptions *sentryOptions = [self createOptionsWithDictionary:options error:&error];
140
+ [SentrySDKWrapper setupWithDictionary:mutableOptions
141
+ isSessionReplayEnabled:isSessionReplayEnabled
142
+ error:&error];
94
143
  if (error != nil) {
95
144
  reject(@"SentryReactNative", error.localizedDescription, error);
96
145
  return;
97
146
  }
98
147
 
99
- NSString *sdkVersion = [PrivateSentrySDKOnly getSdkVersionString];
100
- [PrivateSentrySDKOnly setSdkName:NATIVE_SDK_NAME andVersionString:sdkVersion];
101
- [PrivateSentrySDKOnly addSdkPackage:REACT_NATIVE_SDK_PACKAGE_NAME
102
- version:REACT_NATIVE_SDK_PACKAGE_VERSION];
103
-
104
- [SentrySDKWrapper startWithOptions:sentryOptions];
105
-
106
148
  #if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
107
149
  BOOL appIsActive =
108
150
  [[UIApplication sharedApplication] applicationState] == UIApplicationStateActive;
@@ -113,8 +155,8 @@ RCT_EXPORT_METHOD(initNativeSdk : (NSDictionary *_Nonnull)options resolve : (
113
155
  // If the app is active/in foreground, and we have not sent the SentryHybridSdkDidBecomeActive
114
156
  // notification, send it.
115
157
  if (appIsActive && !sentHybridSdkDidBecomeActive
116
- && (PrivateSentrySDKOnly.options.enableAutoSessionTracking
117
- || PrivateSentrySDKOnly.options.enableWatchdogTerminationTracking)) {
158
+ && ([SentrySDKWrapper enableAutoSessionTracking] ||
159
+ [SentrySDKWrapper enableWatchdogTerminationTracking])) {
118
160
  [[NSNotificationCenter defaultCenter] postNotificationName:@"SentryHybridSdkDidBecomeActive"
119
161
  object:nil];
120
162
 
@@ -128,7 +170,7 @@ RCT_EXPORT_METHOD(initNativeSdk : (NSDictionary *_Nonnull)options resolve : (
128
170
  resolve(@YES);
129
171
  }
130
172
 
131
- - (void)trySetIgnoreErrors:(NSMutableDictionary *)options
173
+ - (void)trySetIgnoreErrors:(NSDictionary *)options
132
174
  {
133
175
  NSArray *ignoreErrorsStr = nil;
134
176
  NSArray *ignoreErrorsRegex = nil;
@@ -194,144 +236,6 @@ RCT_EXPORT_METHOD(initNativeSdk : (NSDictionary *_Nonnull)options resolve : (
194
236
  return NO;
195
237
  }
196
238
 
197
- - (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)options
198
- error:(NSError *_Nonnull *_Nonnull)errorPointer
199
- {
200
- SentryBeforeSendEventCallback beforeSend = ^SentryEvent *(SentryEvent *event) {
201
- // We don't want to send an event after startup that came from a Unhandled JS Exception of
202
- // React Native because we sent it already before the app crashed.
203
- if (nil != event.exceptions.firstObject.type &&
204
- [event.exceptions.firstObject.type rangeOfString:@"Unhandled JS Exception"].location
205
- != NSNotFound) {
206
- return nil;
207
- }
208
-
209
- // Regex and Str are set when one of them has value so we only need to check one of them.
210
- if (self->_ignoreErrorPatternsStr || self->_ignoreErrorPatternsRegex) {
211
- for (SentryException *exception in event.exceptions) {
212
- if ([self shouldIgnoreError:exception.value]) {
213
- return nil;
214
- }
215
- }
216
- if ([self shouldIgnoreError:event.message.message]) {
217
- return nil;
218
- }
219
- }
220
-
221
- [self setEventOriginTag:event];
222
- return event;
223
- };
224
-
225
- NSMutableDictionary *mutableOptions = [options mutableCopy];
226
- [mutableOptions setValue:beforeSend forKey:@"beforeSend"];
227
-
228
- // remove performance traces sample rate and traces sampler since we don't want to synchronize
229
- // these configurations to the Native SDKs. The user could tho initialize the SDK manually and
230
- // set themselves.
231
- [mutableOptions removeObjectForKey:@"tracesSampleRate"];
232
- [mutableOptions removeObjectForKey:@"tracesSampler"];
233
- [mutableOptions removeObjectForKey:@"enableTracing"];
234
-
235
- #if SENTRY_TARGET_REPLAY_SUPPORTED
236
- BOOL isSessionReplayEnabled = [RNSentryReplay updateOptions:mutableOptions];
237
- #else
238
- // Defaulting to false for unsupported targets
239
- BOOL isSessionReplayEnabled = NO;
240
- #endif
241
-
242
- SentryOptions *sentryOptions = [SentryOptionsInternal initWithDict:mutableOptions
243
- didFailWithError:errorPointer];
244
- if (*errorPointer != nil) {
245
- return nil;
246
- }
247
-
248
- // Exclude Dev Server and Sentry Dsn request from Breadcrumbs
249
- NSString *dsn = [self getURLFromDSN:[mutableOptions valueForKey:@"dsn"]];
250
- NSString *devServerUrl = [mutableOptions valueForKey:@"devServerUrl"];
251
- sentryOptions.beforeBreadcrumb
252
- = ^SentryBreadcrumb *_Nullable(SentryBreadcrumb *_Nonnull breadcrumb)
253
- {
254
- NSString *url = breadcrumb.data[@"url"] ?: @"";
255
-
256
- if ([@"http" isEqualToString:breadcrumb.type]
257
- && ((dsn != nil && [url hasPrefix:dsn])
258
- || (devServerUrl != nil && [url hasPrefix:devServerUrl]))) {
259
- return nil;
260
- }
261
- return breadcrumb;
262
- };
263
-
264
- if ([mutableOptions valueForKey:@"enableNativeCrashHandling"] != nil) {
265
- BOOL enableNativeCrashHandling = [mutableOptions[@"enableNativeCrashHandling"] boolValue];
266
-
267
- if (!enableNativeCrashHandling) {
268
- sentryOptions.enableCrashHandler = NO;
269
- }
270
- }
271
-
272
- // Set spotlight option
273
- if ([mutableOptions valueForKey:@"spotlight"] != nil) {
274
- id spotlightValue = [mutableOptions valueForKey:@"spotlight"];
275
- if ([spotlightValue isKindOfClass:[NSString class]]) {
276
- NSLog(@"Using Spotlight on address: %@", spotlightValue);
277
- sentryOptions.enableSpotlight = true;
278
- sentryOptions.spotlightUrl = spotlightValue;
279
- } else if ([spotlightValue isKindOfClass:[NSNumber class]]) {
280
- sentryOptions.enableSpotlight = [spotlightValue boolValue];
281
- id defaultSpotlightUrl = [mutableOptions valueForKey:@"defaultSidecarUrl"];
282
- if (defaultSpotlightUrl != nil) {
283
- sentryOptions.spotlightUrl = defaultSpotlightUrl;
284
- }
285
- }
286
- }
287
-
288
- if ([mutableOptions valueForKey:@"enableLogs"] != nil) {
289
- id enableLogsValue = [mutableOptions valueForKey:@"enableLogs"];
290
- if ([enableLogsValue isKindOfClass:[NSNumber class]]) {
291
- [RNSentryExperimentalOptions setEnableLogs:[enableLogsValue boolValue]
292
- sentryOptions:sentryOptions];
293
- }
294
- }
295
- [self trySetIgnoreErrors:mutableOptions];
296
-
297
- // Enable the App start and Frames tracking measurements
298
- if ([mutableOptions valueForKey:@"enableAutoPerformanceTracing"] != nil) {
299
- BOOL enableAutoPerformanceTracing =
300
- [mutableOptions[@"enableAutoPerformanceTracing"] boolValue];
301
- PrivateSentrySDKOnly.appStartMeasurementHybridSDKMode = enableAutoPerformanceTracing;
302
- #if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
303
- PrivateSentrySDKOnly.framesTrackingMeasurementHybridSDKMode = enableAutoPerformanceTracing;
304
- #endif
305
- }
306
-
307
- // Failed requests can only be enabled in one SDK to avoid duplicates
308
- sentryOptions.enableCaptureFailedRequests = NO;
309
-
310
- NSDictionary *experiments = options[@"_experiments"];
311
- if (experiments != nil && [experiments isKindOfClass:[NSDictionary class]]) {
312
- BOOL enableUnhandledCPPExceptions =
313
- [experiments[@"enableUnhandledCPPExceptionsV2"] boolValue];
314
- [RNSentryExperimentalOptions setEnableUnhandledCPPExceptionsV2:enableUnhandledCPPExceptions
315
- sentryOptions:sentryOptions];
316
- }
317
-
318
- if (isSessionReplayEnabled) {
319
- [RNSentryExperimentalOptions setEnableSessionReplayInUnreliableEnvironment:YES
320
- sentryOptions:sentryOptions];
321
- }
322
-
323
- return sentryOptions;
324
- }
325
-
326
- - (NSString *_Nullable)getURLFromDSN:(NSString *)dsn
327
- {
328
- NSURL *url = [NSURL URLWithString:dsn];
329
- if (!url) {
330
- return nil;
331
- }
332
- return [NSString stringWithFormat:@"%@://%@", url.scheme, url.host];
333
- }
334
-
335
239
  - (void)setEventOriginTag:(SentryEvent *)event
336
240
  {
337
241
  if (event.sdk != nil) {
@@ -460,7 +364,7 @@ RCT_EXPORT_METHOD(fetchNativeLogAttributes : (RCTPromiseResolveBlock)resolve rej
460
364
  contexts[@"os"] = os;
461
365
  }
462
366
 
463
- NSString *releaseName = SentrySDKInternal.options.releaseName;
367
+ NSString *releaseName = [SentrySDKWrapper releaseName];
464
368
  if (releaseName) {
465
369
  contexts[@"release"] = releaseName;
466
370
  }
@@ -492,7 +396,7 @@ RCT_EXPORT_METHOD(fetchNativeLogAttributes : (RCTPromiseResolveBlock)resolve rej
492
396
  RCT_EXPORT_METHOD(fetchNativeDeviceContexts : (RCTPromiseResolveBlock)resolve rejecter : (
493
397
  RCTPromiseRejectBlock)reject)
494
398
  {
495
- if (PrivateSentrySDKOnly.options.debug) {
399
+ if ([SentrySDKWrapper debug]) {
496
400
  NSLog(@"Bridge call to: deviceContexts");
497
401
  }
498
402
  __block NSMutableDictionary<NSString *, id> *serializedScope;
@@ -507,7 +411,7 @@ RCT_EXPORT_METHOD(fetchNativeDeviceContexts : (RCTPromiseResolveBlock)resolve re
507
411
  forKey:@"user"];
508
412
  }
509
413
 
510
- if (PrivateSentrySDKOnly.options.debug) {
414
+ if ([SentrySDKWrapper debug]) {
511
415
  NSData *data = [NSJSONSerialization dataWithJSONObject:serializedScope
512
416
  options:0
513
417
  error:nil];
@@ -3,4 +3,4 @@
3
3
  NSString *const NATIVE_SDK_NAME = @"sentry.cocoa.react-native";
4
4
  NSString *const REACT_NATIVE_SDK_NAME = @"sentry.javascript.react-native";
5
5
  NSString *const REACT_NATIVE_SDK_PACKAGE_NAME = @"npm:@sentry/react-native";
6
- NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"7.5.0";
6
+ NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"7.6.0";
@@ -15,4 +15,20 @@
15
15
 
16
16
  + (void)startWithOptions:(SentryOptions *)options;
17
17
 
18
+ + (SentryOptions *)createOptionsWithDictionary:(NSDictionary *)options
19
+ isSessionReplayEnabled:(BOOL)isSessionReplayEnabled
20
+ error:(NSError **)errorPointer;
21
+
22
+ + (void)setupWithDictionary:(NSDictionary *)options
23
+ isSessionReplayEnabled:(BOOL)isSessionReplayEnabled
24
+ error:(NSError **)errorPointer;
25
+
26
+ + (BOOL)debug;
27
+
28
+ + (NSString *)releaseName;
29
+
30
+ + (BOOL)enableAutoSessionTracking;
31
+
32
+ + (BOOL)enableWatchdogTerminationTracking;
33
+
18
34
  @end
@@ -1,4 +1,6 @@
1
1
  #import "SentrySDKWrapper.h"
2
+ #import "RNSentryExperimentalOptions.h"
3
+ #import "RNSentryVersion.h"
2
4
  @import Sentry;
3
5
 
4
6
  @implementation SentrySDKWrapper
@@ -28,4 +30,137 @@
28
30
  [SentrySDK configureScope:callback];
29
31
  }
30
32
 
33
+ + (SentryOptions *)createOptionsWithDictionary:(NSDictionary *)options
34
+ isSessionReplayEnabled:(BOOL)isSessionReplayEnabled
35
+ error:(NSError *__autoreleasing *)errorPointer
36
+ {
37
+ NSString *dsn = [self getURLFromDSN:[options valueForKey:@"dsn"]];
38
+ SentryOptions *sentryOptions = [SentryOptionsInternal initWithDict:options
39
+ didFailWithError:errorPointer];
40
+ if (*errorPointer != nil) {
41
+ return nil;
42
+ }
43
+
44
+ // Exclude Dev Server and Sentry Dsn request from Breadcrumbs
45
+ NSString *devServerUrl = [options valueForKey:@"devServerUrl"];
46
+ sentryOptions.beforeBreadcrumb
47
+ = ^SentryBreadcrumb *_Nullable(SentryBreadcrumb *_Nonnull breadcrumb)
48
+ {
49
+ NSString *url = breadcrumb.data[@"url"] ?: @"";
50
+
51
+ if ([@"http" isEqualToString:breadcrumb.type]
52
+ && ((dsn != nil && [url hasPrefix:dsn])
53
+ || (devServerUrl != nil && [url hasPrefix:devServerUrl]))) {
54
+ return nil;
55
+ }
56
+ return breadcrumb;
57
+ };
58
+
59
+ if ([options valueForKey:@"enableNativeCrashHandling"] != nil) {
60
+ BOOL enableNativeCrashHandling = [options[@"enableNativeCrashHandling"] boolValue];
61
+
62
+ if (!enableNativeCrashHandling) {
63
+ sentryOptions.enableCrashHandler = NO;
64
+ }
65
+ }
66
+
67
+ // Set spotlight option
68
+ if ([options valueForKey:@"spotlight"] != nil) {
69
+ id spotlightValue = [options valueForKey:@"spotlight"];
70
+ if ([spotlightValue isKindOfClass:[NSString class]]) {
71
+ NSLog(@"Using Spotlight on address: %@", spotlightValue);
72
+ sentryOptions.enableSpotlight = true;
73
+ sentryOptions.spotlightUrl = spotlightValue;
74
+ } else if ([spotlightValue isKindOfClass:[NSNumber class]]) {
75
+ sentryOptions.enableSpotlight = [spotlightValue boolValue];
76
+ id defaultSpotlightUrl = [options valueForKey:@"defaultSidecarUrl"];
77
+ if (defaultSpotlightUrl != nil) {
78
+ sentryOptions.spotlightUrl = defaultSpotlightUrl;
79
+ }
80
+ }
81
+ }
82
+
83
+ if ([options valueForKey:@"enableLogs"] != nil) {
84
+ id enableLogsValue = [options valueForKey:@"enableLogs"];
85
+ if ([enableLogsValue isKindOfClass:[NSNumber class]]) {
86
+ [RNSentryExperimentalOptions setEnableLogs:[enableLogsValue boolValue]
87
+ sentryOptions:sentryOptions];
88
+ }
89
+ }
90
+
91
+ // Enable the App start and Frames tracking measurements
92
+ if ([options valueForKey:@"enableAutoPerformanceTracing"] != nil) {
93
+ BOOL enableAutoPerformanceTracing = [options[@"enableAutoPerformanceTracing"] boolValue];
94
+ PrivateSentrySDKOnly.appStartMeasurementHybridSDKMode = enableAutoPerformanceTracing;
95
+ #if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
96
+ PrivateSentrySDKOnly.framesTrackingMeasurementHybridSDKMode = enableAutoPerformanceTracing;
97
+ #endif
98
+ }
99
+
100
+ // Failed requests can only be enabled in one SDK to avoid duplicates
101
+ sentryOptions.enableCaptureFailedRequests = NO;
102
+
103
+ NSDictionary *experiments = options[@"_experiments"];
104
+ if (experiments != nil && [experiments isKindOfClass:[NSDictionary class]]) {
105
+ BOOL enableUnhandledCPPExceptions =
106
+ [experiments[@"enableUnhandledCPPExceptionsV2"] boolValue];
107
+ [RNSentryExperimentalOptions setEnableUnhandledCPPExceptionsV2:enableUnhandledCPPExceptions
108
+ sentryOptions:sentryOptions];
109
+ }
110
+
111
+ if (isSessionReplayEnabled) {
112
+ [RNSentryExperimentalOptions setEnableSessionReplayInUnreliableEnvironment:YES
113
+ sentryOptions:sentryOptions];
114
+ }
115
+ return sentryOptions;
116
+ }
117
+
118
+ + (NSString *_Nullable)getURLFromDSN:(NSString *)dsn
119
+ {
120
+ NSURL *url = [NSURL URLWithString:dsn];
121
+ if (!url) {
122
+ return nil;
123
+ }
124
+ return [NSString stringWithFormat:@"%@://%@", url.scheme, url.host];
125
+ }
126
+
127
+ + (void)setupWithDictionary:(NSDictionary *_Nonnull)options
128
+ isSessionReplayEnabled:(BOOL)isSessionReplayEnabled
129
+ error:(NSError *_Nonnull *_Nonnull)errorPointer
130
+ {
131
+ SentryOptions *sentryOptions = [self createOptionsWithDictionary:options
132
+ isSessionReplayEnabled:isSessionReplayEnabled
133
+ error:errorPointer];
134
+ if (!options) {
135
+ return;
136
+ }
137
+
138
+ NSString *sdkVersion = [PrivateSentrySDKOnly getSdkVersionString];
139
+ [PrivateSentrySDKOnly setSdkName:NATIVE_SDK_NAME andVersionString:sdkVersion];
140
+ [PrivateSentrySDKOnly addSdkPackage:REACT_NATIVE_SDK_PACKAGE_NAME
141
+ version:REACT_NATIVE_SDK_PACKAGE_VERSION];
142
+
143
+ [SentrySDKWrapper startWithOptions:sentryOptions];
144
+ }
145
+
146
+ + (BOOL)debug
147
+ {
148
+ return PrivateSentrySDKOnly.options.debug;
149
+ }
150
+
151
+ + (NSString *)releaseName
152
+ {
153
+ return PrivateSentrySDKOnly.options.releaseName;
154
+ }
155
+
156
+ + (BOOL)enableAutoSessionTracking
157
+ {
158
+ return PrivateSentrySDKOnly.options.enableAutoSessionTracking;
159
+ }
160
+
161
+ + (BOOL)enableWatchdogTerminationTracking
162
+ {
163
+ return PrivateSentrySDKOnly.options.enableWatchdogTerminationTracking;
164
+ }
165
+
31
166
  @end
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sentry/react-native",
3
3
  "homepage": "https://github.com/getsentry/sentry-react-native",
4
4
  "repository": "https://github.com/getsentry/sentry-react-native",
5
- "version": "7.5.0",
5
+ "version": "7.6.0",
6
6
  "description": "Official Sentry SDK for react-native",
7
7
  "typings": "dist/js/index.d.ts",
8
8
  "types": "dist/js/index.d.ts",
@@ -69,20 +69,20 @@
69
69
  },
70
70
  "dependencies": {
71
71
  "@sentry/babel-plugin-component-annotate": "4.6.0",
72
- "@sentry/browser": "10.22.0",
73
- "@sentry/cli": "2.57.0",
74
- "@sentry/core": "10.22.0",
75
- "@sentry/react": "10.22.0",
76
- "@sentry/types": "10.22.0"
72
+ "@sentry/browser": "10.24.0",
73
+ "@sentry/cli": "2.58.0",
74
+ "@sentry/core": "10.24.0",
75
+ "@sentry/react": "10.24.0",
76
+ "@sentry/types": "10.24.0"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@babel/core": "^7.26.7",
80
80
  "@expo/metro-config": "~0.20.0",
81
81
  "@mswjs/interceptors": "^0.25.15",
82
82
  "@react-native/babel-preset": "0.80.0",
83
- "@sentry-internal/eslint-config-sdk": "10.22.0",
84
- "@sentry-internal/eslint-plugin-sdk": "10.22.0",
85
- "@sentry-internal/typescript": "10.22.0",
83
+ "@sentry-internal/eslint-config-sdk": "10.24.0",
84
+ "@sentry-internal/eslint-plugin-sdk": "10.24.0",
85
+ "@sentry-internal/typescript": "10.24.0",
86
86
  "@sentry/wizard": "6.6.0",
87
87
  "@testing-library/react-native": "^13.2.2",
88
88
  "@types/jest": "^29.5.13",
@@ -9,7 +9,7 @@ export interface SentryAndroidGradlePluginOptions {
9
9
  includeNativeSources?: boolean;
10
10
  includeSourceContext?: boolean;
11
11
  }
12
- export declare const sentryAndroidGradlePluginVersion = "5.12.1";
12
+ export declare const sentryAndroidGradlePluginVersion = "5.12.2";
13
13
  /**
14
14
  * Adds the Sentry Android Gradle Plugin to the project.
15
15
  * https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#enable-sentry-agp
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withSentryAndroidGradlePlugin = exports.sentryAndroidGradlePluginVersion = void 0;
4
4
  const config_plugins_1 = require("@expo/config-plugins");
5
5
  const utils_1 = require("./utils");
6
- exports.sentryAndroidGradlePluginVersion = '5.12.1';
6
+ exports.sentryAndroidGradlePluginVersion = '5.12.2';
7
7
  /**
8
8
  * Adds the Sentry Android Gradle Plugin to the project.
9
9
  * https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#enable-sentry-agp
@@ -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 = "7.5.0";
3
+ export declare const SDK_VERSION = "7.6.0";
4
4
  //# sourceMappingURL=version.d.ts.map