@sentry/react-native 6.21.0 → 6.22.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/RNSentry.podspec +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
- package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.js +2 -8
- package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
- package/dist/js/tools/vendor/metro/countLines.d.ts +3 -0
- package/dist/js/tools/vendor/metro/countLines.d.ts.map +1 -0
- package/dist/js/tools/vendor/metro/countLines.js +26 -0
- package/dist/js/tools/vendor/metro/countLines.js.map +1 -0
- package/dist/js/tools/vendor/metro/utils.d.ts.map +1 -1
- package/dist/js/tools/vendor/metro/utils.js +17 -8
- package/dist/js/tools/vendor/metro/utils.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/ios/RNSentry+fetchNativeStack.m +1 -4
- package/ios/RNSentry.h +0 -5
- package/ios/RNSentry.mm +54 -14
- package/ios/RNSentryVersion.m +1 -1
- package/package.json +1 -1
- package/scripts/expo-upload-sourcemaps.js +1 -1
- package/ts3.8/dist/js/version.d.ts +1 -1
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.
|
|
49
|
+
s.dependency 'Sentry/HybridSDK', '8.56.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)
|
|
@@ -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 = "6.
|
|
5
|
+
static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "6.22.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;
|
|
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;AAEhE,OAAO,KAAK,EAAU,eAAe,EAA4D,MAAM,SAAS,CAAC;AAajH;;GAEG;AACH,wBAAgB,uCAAuC,CAAC,EACtD,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"}
|
|
@@ -11,14 +11,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
11
11
|
exports.createSentryMetroSerializer = exports.unstable_beforeAssetSerializationPlugin = void 0;
|
|
12
12
|
const crypto = require("crypto");
|
|
13
13
|
const utils_1 = require("./utils");
|
|
14
|
+
const countLines_1 = require("./vendor/metro/countLines");
|
|
14
15
|
const utils_2 = require("./vendor/metro/utils");
|
|
15
|
-
let countLines;
|
|
16
|
-
try {
|
|
17
|
-
countLines = require('metro/private/lib/countLines');
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
countLines = require('metro/src/lib/countLines');
|
|
21
|
-
}
|
|
22
16
|
const DEBUG_ID_PLACE_HOLDER = '__debug_id_place_holder__';
|
|
23
17
|
const DEBUG_ID_MODULE_PATH = '__debugid__';
|
|
24
18
|
const PRELUDE_MODULE_PATH = '__prelude__';
|
|
@@ -153,7 +147,7 @@ function createDebugIdModule(debugId) {
|
|
|
153
147
|
type: 'js/script/virtual',
|
|
154
148
|
data: {
|
|
155
149
|
code: debugIdCode,
|
|
156
|
-
lineCount:
|
|
150
|
+
lineCount: (0, countLines_1.default)(debugIdCode),
|
|
157
151
|
map: [],
|
|
158
152
|
},
|
|
159
153
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentryMetroSerializer.js","sourceRoot":"","sources":["../../../src/js/tools/sentryMetroSerializer.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAAiC;AAMjC,mCAA0G;AAC1G,gDAAoE;AAEpE,IAAI,UAAiC,CAAC;AACtC,IAAI;IACF,UAAU,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;CACtD;AAAC,OAAO,CAAC,EAAE;IACV,UAAU,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;CAClD;AAID,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAC1D,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAC3C,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAC1C,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AACnD,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC;;GAEG;AACH,SAAgB,uCAAuC,CAAC,EACtD,UAAU,EACV,OAAO,GAKR;IACC,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,UAAU,CAAC;KACnB;IAED,MAAM,mBAAmB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O,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 * as countLinesType from 'metro/private/lib/countLines';\n\nimport type { Bundle, MetroSerializer, MetroSerializerOutput, SerializedBundle, VirtualJSOutput } from './utils';\nimport { createDebugIdSnippet, createSet, determineDebugIdFromBundleSource, stringToUUID } from './utils';\nimport { createDefaultMetroSerializer } from './vendor/metro/utils';\n\nlet countLines: typeof countLinesType;\ntry {\n countLines = require('metro/private/lib/countLines');\n} catch (e) {\n countLines = require('metro/src/lib/countLines');\n}\n\ntype SourceMap = Record<string, unknown>;\n\nconst DEBUG_ID_PLACE_HOLDER = '__debug_id_place_holder__';\nconst DEBUG_ID_MODULE_PATH = '__debugid__';\nconst PRELUDE_MODULE_PATH = '__prelude__';\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 unstable_beforeAssetSerializationPlugin({\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 [...addDebugIdModule(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 = addDebugIdModule(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\nfunction addDebugIdModule(\n preModules: readonly Module<MixedOutput>[],\n debugIdModule: Module<VirtualJSOutput>,\n): readonly Module<MixedOutput>[] {\n const modifiedPreModules = [...preModules];\n if (\n modifiedPreModules.length > 0 &&\n modifiedPreModules[0] !== undefined &&\n modifiedPreModules[0].path === PRELUDE_MODULE_PATH\n ) {\n // prelude module must be first as it measures the bundle startup time\n modifiedPreModules.unshift(preModules[0] as Module<VirtualJSOutput>);\n modifiedPreModules[1] = debugIdModule;\n } else {\n modifiedPreModules.unshift(debugIdModule);\n }\n return modifiedPreModules;\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 let debugIdCode = createDebugIdSnippet(debugId);\n\n return {\n setSource: (code: string) => {\n debugIdCode = code;\n },\n dependencies: new Map(),\n getSource: () => Buffer.from(debugIdCode),\n inverseDependencies: createSet(),\n path: DEBUG_ID_MODULE_PATH,\n output: [\n {\n type: 'js/script/virtual',\n data: {\n code: debugIdCode,\n lineCount: countLines(debugIdCode),\n map: [],\n },\n },\n ],\n };\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;AAKjC,mCAA0G;AAC1G,0DAAmD;AACnD,gDAAoE;AAIpE,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAC1D,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAC3C,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAC1C,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AACnD,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC;;GAEG;AACH,SAAgB,uCAAuC,CAAC,EACtD,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,OA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AAM,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';\n\nimport type { Bundle, MetroSerializer, MetroSerializerOutput, SerializedBundle, VirtualJSOutput } from './utils';\nimport { createDebugIdSnippet, createSet, determineDebugIdFromBundleSource, stringToUUID } from './utils';\nimport countLines from './vendor/metro/countLines';\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__';\nconst PRELUDE_MODULE_PATH = '__prelude__';\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 unstable_beforeAssetSerializationPlugin({\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 [...addDebugIdModule(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 = addDebugIdModule(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\nfunction addDebugIdModule(\n preModules: readonly Module<MixedOutput>[],\n debugIdModule: Module<VirtualJSOutput>,\n): readonly Module<MixedOutput>[] {\n const modifiedPreModules = [...preModules];\n if (\n modifiedPreModules.length > 0 &&\n modifiedPreModules[0] !== undefined &&\n modifiedPreModules[0].path === PRELUDE_MODULE_PATH\n ) {\n // prelude module must be first as it measures the bundle startup time\n modifiedPreModules.unshift(preModules[0] as Module<VirtualJSOutput>);\n modifiedPreModules[1] = debugIdModule;\n } else {\n modifiedPreModules.unshift(debugIdModule);\n }\n return modifiedPreModules;\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 let debugIdCode = createDebugIdSnippet(debugId);\n\n return {\n setSource: (code: string) => {\n debugIdCode = code;\n },\n dependencies: new Map(),\n getSource: () => Buffer.from(debugIdCode),\n inverseDependencies: createSet(),\n path: DEBUG_ID_MODULE_PATH,\n output: [\n {\n type: 'js/script/virtual',\n data: {\n code: debugIdCode,\n lineCount: countLines(debugIdCode),\n map: [],\n },\n },\n ],\n };\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countLines.d.ts","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/countLines.ts"],"names":[],"mappings":"iCAgCwB,MAAM,KAAG,MAAM;AAAvC,wBAAoF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Vendored from @facebook/metro
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// https://github.com/facebook/metro/blob/93d68cca249202fd3eb52672217e725d90e44eb4/packages/metro/src/lib/countLines.js
|
|
4
|
+
// MIT License
|
|
5
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
// in the Software without restriction, including without limitation the rights
|
|
9
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
// furnished to do so, subject to the following conditions:
|
|
12
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
// copies or substantial portions of the Software.
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
// SOFTWARE.
|
|
21
|
+
// This is exported as private from `metro` and as such breaking changes can appear anytime.
|
|
22
|
+
// In the past these were related to the way the function is exported. Never to the function itself.
|
|
23
|
+
// Thus it should be more stable to vendor it.
|
|
24
|
+
const newline = /\r\n?|\n|\u2028|\u2029/g;
|
|
25
|
+
exports.default = (string) => (string.match(newline) || []).length + 1;
|
|
26
|
+
//# sourceMappingURL=countLines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countLines.js","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/countLines.ts"],"names":[],"mappings":"AAAA,gCAAgC;;AAEhC,uHAAuH;AAEvH,cAAc;AAEd,qDAAqD;AAErD,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAE3D,iFAAiF;AACjF,kDAAkD;AAElD,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,YAAY;AAEZ,4FAA4F;AAC5F,oGAAoG;AACpG,8CAA8C;AAE9C,MAAM,OAAO,GAAG,yBAAyB,CAAC;AAE1C,kBAAe,CAAC,MAAc,EAAU,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC","sourcesContent":["// Vendored from @facebook/metro\n\n// https://github.com/facebook/metro/blob/93d68cca249202fd3eb52672217e725d90e44eb4/packages/metro/src/lib/countLines.js\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\n// This is exported as private from `metro` and as such breaking changes can appear anytime.\n// In the past these were related to the way the function is exported. Never to the function itself.\n// Thus it should be more stable to vendor it.\n\nconst newline = /\\r\\n?|\\n|\\u2028|\\u2029/g;\n\nexport default (string: string): number => (string.match(newline) || []).length + 1;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/utils.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAe,MAAM,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/utils.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAe,MAAM,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAuChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAYnD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,UACpB,aAAa;2BAIK,MAAM,KAAK,MAAM;MAEzC,SAAS,MAAM,EAMjB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,QAAO,eAqC/C,CAAC"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
// Vendored / modified from @facebook/metro
|
|
2
|
+
var _a, _b;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.createDefaultMetroSerializer = exports.getSortedModules = void 0;
|
|
4
|
-
let
|
|
5
|
+
let baseJSBundleModule;
|
|
5
6
|
try {
|
|
6
|
-
|
|
7
|
+
baseJSBundleModule = require('metro/private/DeltaBundler/Serializers/baseJSBundle');
|
|
7
8
|
}
|
|
8
|
-
catch (
|
|
9
|
-
|
|
9
|
+
catch (_c) {
|
|
10
|
+
baseJSBundleModule = require('metro/src/DeltaBundler/Serializers/baseJSBundle');
|
|
10
11
|
}
|
|
12
|
+
const baseJSBundle = typeof baseJSBundleModule === 'function'
|
|
13
|
+
? baseJSBundleModule
|
|
14
|
+
: // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
15
|
+
(_a = baseJSBundleModule === null || baseJSBundleModule === void 0 ? void 0 : baseJSBundleModule.baseJSBundle) !== null && _a !== void 0 ? _a : baseJSBundleModule === null || baseJSBundleModule === void 0 ? void 0 : baseJSBundleModule.default;
|
|
11
16
|
let sourceMapString;
|
|
12
17
|
try {
|
|
13
18
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
@@ -22,13 +27,17 @@ catch (e) {
|
|
|
22
27
|
sourceMapString = sourceMapString.sourceMapString;
|
|
23
28
|
}
|
|
24
29
|
}
|
|
25
|
-
let
|
|
30
|
+
let bundleToStringModule;
|
|
26
31
|
try {
|
|
27
|
-
|
|
32
|
+
bundleToStringModule = require('metro/private/lib/bundleToString');
|
|
28
33
|
}
|
|
29
|
-
catch (
|
|
30
|
-
|
|
34
|
+
catch (_d) {
|
|
35
|
+
bundleToStringModule = require('metro/src/lib/bundleToString');
|
|
31
36
|
}
|
|
37
|
+
const bundleToString = typeof bundleToStringModule === 'function'
|
|
38
|
+
? bundleToStringModule
|
|
39
|
+
: // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
40
|
+
(_b = bundleToStringModule === null || bundleToStringModule === void 0 ? void 0 : bundleToStringModule.bundleToString) !== null && _b !== void 0 ? _b : bundleToStringModule === null || bundleToStringModule === void 0 ? void 0 : bundleToStringModule.default;
|
|
32
41
|
/**
|
|
33
42
|
* This function ensures that modules in source maps are sorted in the same
|
|
34
43
|
* order as in a plain JS bundle.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/utils.ts"],"names":[],"mappings":"AAAA,2CAA2C
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/js/tools/vendor/metro/utils.ts"],"names":[],"mappings":"AAAA,2CAA2C;;;;AAgC3C,IAAI,kBAAuB,CAAC;AAC5B,IAAI;IACF,kBAAkB,GAAG,OAAO,CAAC,qDAAqD,CAAC,CAAC;CACrF;AAAC,WAAM;IACN,kBAAkB,GAAG,OAAO,CAAC,iDAAiD,CAAC,CAAC;CACjF;AAED,MAAM,YAAY,GAChB,OAAO,kBAAkB,KAAK,UAAU;IACtC,CAAC,CAAC,kBAAkB;IACpB,CAAC,CAAC,sEAAsE;QACtE,MAAA,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,YAAY,mCAAI,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,OAAO,CAAC;AAEtE,IAAI,eAA2C,CAAC;AAChD,IAAI;IACF,8DAA8D;IAC9D,MAAM,qBAAqB,GAAG,OAAO,CAAC,wDAAwD,CAAC,CAAC;IAChG,eAAe,GAAI,qBAAyE,CAAC,eAAe,CAAC;CAC9G;AAAC,OAAO,CAAC,EAAE;IACV,eAAe,GAAG,OAAO,CAAC,oDAAoD,CAAC,CAAC;IAChF,IAAI,iBAAiB,IAAI,eAAe,EAAE;QAC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C,oBAAoB,CAAC,MAAM,CAAC,CAAC;SAC/C;QACD,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,KAAK,CAAC,gBAAgB,CAAC,GAAG,EAAE;YAC9B,sEAAsE;YACtE,OAAO,IAAI,CAAC;SACb;QAED,IAAI,uBAA2D,CAAC;QAChE,IAAI,OAAO,eAAe,KAAK,UAAU,EAAE;YACzC,uBAAuB,GAAG,eAAe,CAAC;SAC3C;aAAM,IACL,OAAO,eAAe,KAAK,QAAQ;YACnC,eAAe,IAAI,IAAI;YACvB,iBAAiB,IAAI,eAAe;YACpC,OAAO,eAAe,CAAC,iBAAiB,CAAC,KAAK,UAAU,EACxD;YACA,uBAAuB,GAAI,eAA4C,CAAC,eAAe,CAAC;SACzF;aAAM;YACL,MAAM,IAAI,KAAK,CAAC;;;CAGrB,CAAC,CAAC;SACE;QAED,oEAAoE;QACpE,MAAM,GAAG,GAAG,uBAAuB,CAAC,CAAC,GAAG,UAAU,EAAE,GAAG,IAAA,wBAAgB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE;YACxF,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;YAChD,qBAAqB,EAAE,OAAO,CAAC,qBAAqB;SACrD,CAAC,CAAC;QACH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC,CAAC;AArCW,QAAA,4BAA4B,gCAqCvC","sourcesContent":["// Vendored / modified from @facebook/metro\n\n// https://github.com/facebook/metro/commit/9b85f83c9cc837d8cd897aa7723be7da5b296067\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\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport type { MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport type * as baseJSBundleType from 'metro/private/DeltaBundler/Serializers/baseJSBundle';\nimport type * as sourceMapStringType from 'metro/private/DeltaBundler/Serializers/sourceMapString';\nimport type * as bundleToStringType from 'metro/private/lib/bundleToString';\n\nlet baseJSBundleModule: any;\ntry {\n baseJSBundleModule = require('metro/private/DeltaBundler/Serializers/baseJSBundle');\n} catch {\n baseJSBundleModule = require('metro/src/DeltaBundler/Serializers/baseJSBundle');\n}\n\nconst baseJSBundle: typeof baseJSBundleType =\n typeof baseJSBundleModule === 'function'\n ? baseJSBundleModule\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n baseJSBundleModule?.baseJSBundle ?? baseJSBundleModule?.default;\n\nlet sourceMapString: typeof sourceMapStringType;\ntry {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const sourceMapStringModule = require('metro/private/DeltaBundler/Serializers/sourceMapString');\n sourceMapString = (sourceMapStringModule as { sourceMapString: typeof sourceMapStringType }).sourceMapString;\n} catch (e) {\n sourceMapString = require('metro/src/DeltaBundler/Serializers/sourceMapString');\n if ('sourceMapString' in sourceMapString) {\n // Changed to named export in https://github.com/facebook/metro/commit/34148e61200a508923315fbe387b26d1da27bf4b\n // Metro 0.81.0 and 0.80.10 patch\n sourceMapString = (sourceMapString as { sourceMapString: typeof sourceMapStringType }).sourceMapString;\n }\n}\n\nlet bundleToStringModule: any;\ntry {\n bundleToStringModule = require('metro/private/lib/bundleToString');\n} catch {\n bundleToStringModule = require('metro/src/lib/bundleToString');\n}\n\nimport type { MetroSerializer } from '../../utils';\nconst bundleToString: typeof bundleToStringType =\n typeof bundleToStringModule === 'function'\n ? bundleToStringModule\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n bundleToStringModule?.bundleToString ?? bundleToStringModule?.default;\n\ntype NewSourceMapStringExport = {\n // Since Metro v0.80.10 https://github.com/facebook/metro/compare/v0.80.9...v0.80.10#diff-1b836d1729e527a725305eef0cec22e44605af2700fa413f4c2489ea1a03aebcL28\n sourceMapString: typeof sourceMapString;\n};\n\n/**\n * This function ensures that modules in source maps are sorted in the same\n * order as in a plain JS bundle.\n *\n * https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/Server.js#L984\n */\nexport const getSortedModules = (\n graph: ReadOnlyGraph,\n {\n createModuleId,\n }: {\n createModuleId: (file: string) => number;\n },\n): readonly Module[] => {\n const modules = [...graph.dependencies.values()];\n // Sort by IDs\n return modules.sort(\n (a: Module<MixedOutput>, b: Module<MixedOutput>) => createModuleId(a.path) - createModuleId(b.path),\n );\n};\n\n/**\n * Creates the default Metro plain bundle serializer.\n * Because Metro exports only the intermediate serializer functions, we need to\n * assemble the final serializer ourselves. We have to work with the modules the same as Metro does\n * to avoid unexpected changes in the final bundle.\n *\n * This is used when the user does not provide a custom serializer.\n *\n * https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/Server.js#L244-L277\n */\nexport const createDefaultMetroSerializer = (): MetroSerializer => {\n return (entryPoint, preModules, graph, options) => {\n // baseJSBundle assigns IDs to modules in a consistent order\n let bundle = baseJSBundle(entryPoint, preModules, graph, options);\n if (options.sentryBundleCallback && !graph.transformOptions.hot) {\n bundle = options.sentryBundleCallback(bundle);\n }\n const { code } = bundleToString(bundle);\n if (graph.transformOptions.hot) {\n // Hot means running in dev server, sourcemaps are generated on demand\n return code;\n }\n\n let sourceMapStringFunction: typeof sourceMapString | undefined;\n if (typeof sourceMapString === 'function') {\n sourceMapStringFunction = sourceMapString;\n } else if (\n typeof sourceMapString === 'object' &&\n sourceMapString != null &&\n 'sourceMapString' in sourceMapString &&\n typeof sourceMapString['sourceMapString'] === 'function'\n ) {\n sourceMapStringFunction = (sourceMapString as NewSourceMapStringExport).sourceMapString;\n } else {\n throw new Error(`\n[@sentry/react-native/metro] Cannot find sourceMapString function in 'metro/src/DeltaBundler/Serializers/sourceMapString'.\nPlease check the version of Metro you are using and report the issue at http://www.github.com/getsentry/sentry-react-native/issues\n`);\n }\n\n // Always generate source maps, can't use Sentry without source maps\n const map = sourceMapStringFunction([...preModules, ...getSortedModules(graph, options)], {\n processModuleFilter: options.processModuleFilter,\n shouldAddToIgnoreList: options.shouldAddToIgnoreList,\n });\n return { code, map };\n };\n};\n"]}
|
package/dist/js/version.d.ts
CHANGED
package/dist/js/version.js
CHANGED
package/dist/js/version.js.map
CHANGED
|
@@ -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,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '6.
|
|
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,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '6.22.0';\n"]}
|
|
@@ -22,11 +22,8 @@ RNSentry (fetchNativeStack)
|
|
|
22
22
|
- (NSDictionary *)fetchNativeStackFramesBy:(NSArray<NSNumber *> *)instructionsAddr
|
|
23
23
|
symbolicate:(SymbolicateCallbackType)symbolicate
|
|
24
24
|
{
|
|
25
|
-
#if CROSS_PLATFORM_TEST
|
|
26
25
|
BOOL shouldSymbolicateLocally = [SentrySDKInternal.options debug];
|
|
27
|
-
|
|
28
|
-
BOOL shouldSymbolicateLocally = [SentrySDK.options debug];
|
|
29
|
-
#endif
|
|
26
|
+
|
|
30
27
|
NSString *appPackageName = [[NSBundle mainBundle] executablePath];
|
|
31
28
|
|
|
32
29
|
NSMutableSet<NSString *> *_Nonnull imagesAddrToRetrieveDebugMetaImages =
|
package/ios/RNSentry.h
CHANGED
|
@@ -15,12 +15,7 @@ typedef int (*SymbolicateCallbackType)(const void *, Dl_info *);
|
|
|
15
15
|
@class SentryOptions;
|
|
16
16
|
@class SentryEvent;
|
|
17
17
|
|
|
18
|
-
#if CROSS_PLATFORM_TEST
|
|
19
18
|
@interface SentrySDKInternal : NSObject
|
|
20
|
-
#else
|
|
21
|
-
@interface
|
|
22
|
-
SentrySDK (Private)
|
|
23
|
-
#endif
|
|
24
19
|
@property (nonatomic, nullable, readonly, class) SentryOptions *options;
|
|
25
20
|
@end
|
|
26
21
|
|
package/ios/RNSentry.mm
CHANGED
|
@@ -28,16 +28,9 @@
|
|
|
28
28
|
#import <Sentry/SentryException.h>
|
|
29
29
|
#import <Sentry/SentryFormatter.h>
|
|
30
30
|
#import <Sentry/SentryOptions.h>
|
|
31
|
-
#import <Sentry/
|
|
32
|
-
|
|
33
|
-
#if __has_include(<Sentry/SentryOptions+HybridSDKs.h>)
|
|
34
|
-
# define USE_SENTRY_OPTIONS 1
|
|
35
|
-
# import <Sentry/SentryOptions+HybridSDKs.h>
|
|
36
|
-
#else
|
|
37
|
-
# define USE_SENTRY_OPTIONS 0
|
|
38
|
-
# import <Sentry/SentryOptionsInternal.h>
|
|
39
|
-
#endif
|
|
31
|
+
#import <Sentry/SentryOptionsInternal.h>
|
|
40
32
|
#import <Sentry/SentryScreenFrames.h>
|
|
33
|
+
#import <Sentry/SentryUser.h>
|
|
41
34
|
|
|
42
35
|
// This guard prevents importing Hermes in JSC apps
|
|
43
36
|
#if SENTRY_PROFILING_ENABLED
|
|
@@ -169,13 +162,8 @@ RCT_EXPORT_METHOD(initNativeSdk
|
|
|
169
162
|
[RNSentryReplay updateOptions:mutableOptions];
|
|
170
163
|
#endif
|
|
171
164
|
|
|
172
|
-
#if USE_SENTRY_OPTIONS
|
|
173
|
-
SentryOptions *sentryOptions = [[SentryOptions alloc] initWithDict:mutableOptions
|
|
174
|
-
didFailWithError:errorPointer];
|
|
175
|
-
#else
|
|
176
165
|
SentryOptions *sentryOptions = [SentryOptionsInternal initWithDict:mutableOptions
|
|
177
166
|
didFailWithError:errorPointer];
|
|
178
|
-
#endif
|
|
179
167
|
if (*errorPointer != nil) {
|
|
180
168
|
return nil;
|
|
181
169
|
}
|
|
@@ -364,6 +352,58 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSDictionary *, fetchNativeStackFramesBy
|
|
|
364
352
|
return [self fetchNativeStackFramesBy:instructionsAddr symbolicate:dladdr];
|
|
365
353
|
}
|
|
366
354
|
|
|
355
|
+
RCT_EXPORT_METHOD(fetchNativeLogAttributes
|
|
356
|
+
: (RCTPromiseResolveBlock)resolve rejecter
|
|
357
|
+
: (RCTPromiseRejectBlock)reject)
|
|
358
|
+
{
|
|
359
|
+
__block NSMutableDictionary<NSString *, id> *result = [NSMutableDictionary new];
|
|
360
|
+
|
|
361
|
+
[SentrySDKWrapper configureScope:^(SentryScope *_Nonnull scope) {
|
|
362
|
+
// Serialize to get contexts dictionary
|
|
363
|
+
NSDictionary *serializedScope = [scope serialize];
|
|
364
|
+
NSDictionary *allContexts = serializedScope[@"context"]; // It's singular here, annoyingly
|
|
365
|
+
|
|
366
|
+
NSMutableDictionary *contexts = [NSMutableDictionary new];
|
|
367
|
+
|
|
368
|
+
NSDictionary *device = allContexts[@"device"];
|
|
369
|
+
if ([device isKindOfClass:[NSDictionary class]]) {
|
|
370
|
+
contexts[@"device"] = device;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
NSDictionary *os = allContexts[@"os"];
|
|
374
|
+
if ([os isKindOfClass:[NSDictionary class]]) {
|
|
375
|
+
contexts[@"os"] = os;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
NSString *releaseName = SentrySDKInternal.options.releaseName;
|
|
379
|
+
if (releaseName) {
|
|
380
|
+
contexts[@"release"] = releaseName;
|
|
381
|
+
}
|
|
382
|
+
// Merge extra context
|
|
383
|
+
NSDictionary *extraContext = [PrivateSentrySDKOnly getExtraContext];
|
|
384
|
+
|
|
385
|
+
if (extraContext) {
|
|
386
|
+
NSDictionary *extraDevice = extraContext[@"device"];
|
|
387
|
+
if ([extraDevice isKindOfClass:[NSDictionary class]]) {
|
|
388
|
+
NSMutableDictionary *mergedDevice =
|
|
389
|
+
[contexts[@"device"] mutableCopy] ?: [NSMutableDictionary new];
|
|
390
|
+
[mergedDevice addEntriesFromDictionary:extraDevice];
|
|
391
|
+
contexts[@"device"] = mergedDevice;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
NSDictionary *extraOS = extraContext[@"os"];
|
|
395
|
+
if ([extraOS isKindOfClass:[NSDictionary class]]) {
|
|
396
|
+
NSMutableDictionary *mergedOS =
|
|
397
|
+
[contexts[@"os"] mutableCopy] ?: [NSMutableDictionary new];
|
|
398
|
+
[mergedOS addEntriesFromDictionary:extraOS];
|
|
399
|
+
contexts[@"os"] = mergedOS;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
result[@"contexts"] = contexts;
|
|
403
|
+
}];
|
|
404
|
+
resolve(result);
|
|
405
|
+
}
|
|
406
|
+
|
|
367
407
|
RCT_EXPORT_METHOD(fetchNativeDeviceContexts
|
|
368
408
|
: (RCTPromiseResolveBlock)resolve rejecter
|
|
369
409
|
: (RCTPromiseRejectBlock)reject)
|
package/ios/RNSentryVersion.m
CHANGED
|
@@ -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 = @"6.
|
|
6
|
+
NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"6.22.0";
|
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": "6.
|
|
5
|
+
"version": "6.22.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",
|
|
@@ -131,7 +131,7 @@ try {
|
|
|
131
131
|
|
|
132
132
|
const sentryBuildPluginPath = path.join(projectRoot, '.env.sentry-build-plugin');
|
|
133
133
|
if (fs.existsSync(sentryBuildPluginPath)) {
|
|
134
|
-
loadDotenv();
|
|
134
|
+
loadDotenv(sentryBuildPluginPath);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
let sentryOrg = getEnvVar(SENTRY_ORG);
|