@sentry/react-native 5.16.0-alpha.1 → 5.16.0-alpha.2
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/CHANGELOG.md +38 -0
- package/dist/js/NativeRNSentry.d.ts +1 -1
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/index.js +1 -1
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js +12 -10
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.js +9 -6
- package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
- package/dist/js/integrations/reactnativeinfo.d.ts +1 -1
- package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeinfo.js.map +1 -1
- package/dist/js/measurements.d.ts +0 -7
- package/dist/js/measurements.d.ts.map +1 -1
- package/dist/js/measurements.js +0 -56
- package/dist/js/measurements.js.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.d.ts +7 -0
- package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.js +27 -1
- package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
- package/dist/js/tracing/addTracingExtensions.d.ts +8 -0
- package/dist/js/tracing/addTracingExtensions.d.ts.map +1 -0
- package/dist/js/tracing/addTracingExtensions.js +58 -0
- package/dist/js/tracing/addTracingExtensions.js.map +1 -0
- package/dist/js/tracing/reactnativenavigation.d.ts +1 -1
- package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnativenavigation.js.map +1 -1
- package/dist/js/utils/environment.d.ts +1 -1
- package/dist/js/utils/environment.d.ts.map +1 -1
- package/dist/js/utils/environment.js +5 -1
- package/dist/js/utils/environment.js.map +1 -1
- package/dist/js/utils/rnlibraries.d.ts +3 -0
- package/dist/js/utils/rnlibraries.d.ts.map +1 -0
- package/dist/js/utils/rnlibraries.js +29 -0
- package/dist/js/utils/rnlibraries.js.map +1 -0
- package/dist/js/utils/rnlibraries.web.d.ts +3 -0
- package/dist/js/utils/rnlibraries.web.d.ts.map +1 -0
- package/dist/js/utils/rnlibraries.web.js +2 -0
- package/dist/js/utils/rnlibraries.web.js.map +1 -0
- package/dist/js/utils/rnlibrariesinterface.d.ts +19 -0
- package/dist/js/utils/rnlibrariesinterface.d.ts.map +1 -0
- package/dist/js/utils/rnlibrariesinterface.js +8 -0
- package/dist/js/utils/rnlibrariesinterface.js.map +1 -0
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/package.json +10 -6
- package/src/js/NativeRNSentry.ts +2 -1
- package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -1
- package/ts3.8/dist/js/integrations/reactnativeinfo.d.ts +1 -1
- package/ts3.8/dist/js/measurements.d.ts +0 -7
- package/ts3.8/dist/js/tracing/addTracingExtensions.d.ts +8 -0
- package/ts3.8/dist/js/tracing/reactnativenavigation.d.ts +1 -1
- package/ts3.8/dist/js/utils/environment.d.ts +1 -1
- package/ts3.8/dist/js/utils/rnlibraries.d.ts +3 -0
- package/ts3.8/dist/js/utils/rnlibraries.web.d.ts +3 -0
- package/ts3.8/dist/js/utils/rnlibrariesinterface.d.ts +19 -0
- package/ts3.8/dist/js/version.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentryMetroSerializer.js","sourceRoot":"","sources":["../../../src/js/tools/sentryMetroSerializer.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAEjC,uDAAuD;AAGvD,mCAA0G;AAC1G,gDAAoE;AAIpE,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAC1D,MAAM,oBAAoB,GAAG,aAAa,CA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cesContent":["import * as crypto from 'crypto';\nimport type { MixedOutput, Module } from 'metro';\nimport * as countLines from 'metro/src/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\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 * 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]);\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 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;AAEjC,iCAAoC;AACpC,uDAAuD;AAGvD,mCAA0G;AAC1G,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;;;;GAIG;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ACrC,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,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,qBAAqB,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import * as crypto from 'crypto';\nimport type { MetroConfig, MixedOutput, Module } from 'metro';\nimport { mergeConfig } from 'metro';\nimport * as countLines from 'metro/src/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\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 * This function will overwrite any existing custom serializer with default Expo and Sentry serializers.\n *\n * To use custom serializers, use `createSentryMetroSerializer(customSerializer)` instead.\n */\nexport function withSentryExpoSerializers(config: MetroConfig): MetroConfig {\n const { withExpoSerializers } = loadExpoSerializersModule();\n\n const sentryConfig = {\n serializer: {\n customSerializer: createSentryMetroSerializer(),\n },\n } as MetroConfig;\n\n const finalConfig = mergeConfig(config, sentryConfig);\n return withExpoSerializers(finalConfig);\n}\n\nfunction loadExpoSerializersModule(): {\n withExpoSerializers: (config: MetroConfig) => MetroConfig;\n} {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n return require('@expo/metro-config/build/serializer/withExpoSerializers');\n } catch (e) {\n throw new Error(\n 'Unable to load `withExpoSerializers` from `@expo/metro-config`. Make sure you have Expo installed.',\n );\n }\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]);\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 return code.replace(new RegExp(DEBUG_ID_PLACE_HOLDER, 'g'), debugId);\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Hub, Transaction } from '@sentry/core';
|
|
2
|
+
import type { CustomSamplingContext, TransactionContext } from '@sentry/types';
|
|
3
|
+
/**
|
|
4
|
+
* Adds React Native's extensions. Needs to be called before any transactions are created.
|
|
5
|
+
*/
|
|
6
|
+
export declare function _addTracingExtensions(): void;
|
|
7
|
+
export type StartTransactionFunction = (this: Hub, transactionContext: TransactionContext, customSamplingContext?: CustomSamplingContext) => Transaction;
|
|
8
|
+
//# sourceMappingURL=addTracingExtensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addTracingExtensions.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/addTracingExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAqB,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAKlG;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAiB5C;AAED,MAAM,MAAM,wBAAwB,GAAG,CACrC,IAAI,EAAE,GAAG,EACT,kBAAkB,EAAE,kBAAkB,EACtC,qBAAqB,CAAC,EAAE,qBAAqB,KAC1C,WAAW,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { addTracingExtensions, getCurrentHub, getMainCarrier } from '@sentry/core';
|
|
2
|
+
import { DEFAULT } from '../tracing/ops';
|
|
3
|
+
import { ReactNativeTracing } from '../tracing/reactnativetracing';
|
|
4
|
+
/**
|
|
5
|
+
* Adds React Native's extensions. Needs to be called before any transactions are created.
|
|
6
|
+
*/
|
|
7
|
+
export function _addTracingExtensions() {
|
|
8
|
+
addTracingExtensions();
|
|
9
|
+
const carrier = getMainCarrier();
|
|
10
|
+
if (carrier.__SENTRY__) {
|
|
11
|
+
carrier.__SENTRY__.extensions = carrier.__SENTRY__.extensions || {};
|
|
12
|
+
if (carrier.__SENTRY__.extensions.startTransaction) {
|
|
13
|
+
const originalStartTransaction = carrier.__SENTRY__.extensions.startTransaction;
|
|
14
|
+
/*
|
|
15
|
+
Overwrites the transaction start and finish to start and finish stall tracking.
|
|
16
|
+
Preferably instead of overwriting add a callback method for this in the Transaction itself.
|
|
17
|
+
*/
|
|
18
|
+
const _startTransaction = _patchStartTransaction(originalStartTransaction);
|
|
19
|
+
carrier.__SENTRY__.extensions.startTransaction = _startTransaction;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Overwrite the startTransaction extension method to start and end stall tracking.
|
|
25
|
+
*/
|
|
26
|
+
const _patchStartTransaction = (originalStartTransaction) => {
|
|
27
|
+
/**
|
|
28
|
+
* Method to overwrite with
|
|
29
|
+
*/
|
|
30
|
+
function _startTransaction(transactionContext, customSamplingContext) {
|
|
31
|
+
// Native SDKs require op to be set - for JS Relay sets `default`
|
|
32
|
+
if (!transactionContext.op) {
|
|
33
|
+
transactionContext.op = DEFAULT;
|
|
34
|
+
}
|
|
35
|
+
const transaction = originalStartTransaction.apply(this, [transactionContext, customSamplingContext]);
|
|
36
|
+
const originalStartChild = transaction.startChild.bind(transaction);
|
|
37
|
+
transaction.startChild = (spanContext) => {
|
|
38
|
+
return originalStartChild(Object.assign(Object.assign({}, spanContext), {
|
|
39
|
+
// Native SDKs require op to be set
|
|
40
|
+
op: (spanContext === null || spanContext === void 0 ? void 0 : spanContext.op) || DEFAULT }));
|
|
41
|
+
};
|
|
42
|
+
const reactNativeTracing = getCurrentHub().getIntegration(ReactNativeTracing);
|
|
43
|
+
if (reactNativeTracing) {
|
|
44
|
+
reactNativeTracing.onTransactionStart(transaction);
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
46
|
+
const originalFinish = transaction.finish;
|
|
47
|
+
transaction.finish = (endTimestamp) => {
|
|
48
|
+
if (reactNativeTracing) {
|
|
49
|
+
reactNativeTracing.onTransactionFinish(transaction);
|
|
50
|
+
}
|
|
51
|
+
return originalFinish.apply(transaction, [endTimestamp]);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return transaction;
|
|
55
|
+
}
|
|
56
|
+
return _startTransaction;
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=addTracingExtensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addTracingExtensions.js","sourceRoot":"","sources":["../../../src/js/tracing/addTracingExtensions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnF,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACnC,oBAAoB,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;IACjC,IAAI,OAAO,CAAC,UAAU,EAAE;QACtB,OAAO,CAAC,UAAU,CAAC,UAAU,GAAG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1C,WAAW,CAAC,MAAM,GAAG,CAAC,YAAgC,EAAE,EAAE;gBACxD,IAAI,kBAAkB,EAAE;oBACtB,kBAAkB,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;iBACrD;gBAED,OAAO,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;YAC3D,CAAC,CAAC;SACH;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["import type { Hub, Transaction } from '@sentry/core';\nimport { addTracingExtensions, getCurrentHub, getMainCarrier } from '@sentry/core';\nimport type { CustomSamplingContext, Span, SpanContext, TransactionContext } from '@sentry/types';\n\nimport { DEFAULT } from '../tracing/ops';\nimport { ReactNativeTracing } from '../tracing/reactnativetracing';\n\n/**\n * Adds React Native's extensions. Needs to be called before any transactions are created.\n */\nexport function _addTracingExtensions(): void {\n addTracingExtensions();\n const carrier = getMainCarrier();\n if (carrier.__SENTRY__) {\n carrier.__SENTRY__.extensions = carrier.__SENTRY__.extensions || {};\n if (carrier.__SENTRY__.extensions.startTransaction) {\n const originalStartTransaction = carrier.__SENTRY__.extensions.startTransaction as StartTransactionFunction;\n\n /*\n Overwrites the transaction start and finish to start and finish stall tracking.\n Preferably instead of overwriting add a callback method for this in the Transaction itself.\n */\n const _startTransaction = _patchStartTransaction(originalStartTransaction);\n\n carrier.__SENTRY__.extensions.startTransaction = _startTransaction;\n }\n }\n}\n\nexport type StartTransactionFunction = (\n this: Hub,\n transactionContext: TransactionContext,\n customSamplingContext?: CustomSamplingContext,\n) => Transaction;\n\n/**\n * Overwrite the startTransaction extension method to start and end stall tracking.\n */\nconst _patchStartTransaction = (originalStartTransaction: StartTransactionFunction): StartTransactionFunction => {\n /**\n * Method to overwrite with\n */\n function _startTransaction(\n this: Hub,\n transactionContext: TransactionContext,\n customSamplingContext?: CustomSamplingContext,\n ): Transaction {\n // Native SDKs require op to be set - for JS Relay sets `default`\n if (!transactionContext.op) {\n transactionContext.op = DEFAULT;\n }\n\n const transaction: Transaction = originalStartTransaction.apply(this, [transactionContext, customSamplingContext]);\n const originalStartChild: Transaction['startChild'] = transaction.startChild.bind(transaction);\n transaction.startChild = (\n spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'sampled' | 'traceId' | 'parentSpanId'>>,\n ): Span => {\n return originalStartChild({\n ...spanContext,\n // Native SDKs require op to be set\n op: spanContext?.op || DEFAULT,\n });\n };\n\n const reactNativeTracing = getCurrentHub().getIntegration(ReactNativeTracing);\n\n if (reactNativeTracing) {\n reactNativeTracing.onTransactionStart(transaction);\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalFinish = transaction.finish;\n\n transaction.finish = (endTimestamp: number | undefined) => {\n if (reactNativeTracing) {\n reactNativeTracing.onTransactionFinish(transaction);\n }\n\n return originalFinish.apply(transaction, [endTimestamp]);\n };\n }\n\n return transaction;\n }\n\n return _startTransaction;\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EmitterSubscription } from '
|
|
1
|
+
import type { EmitterSubscription } from '../utils/rnlibrariesinterface';
|
|
2
2
|
import type { OnConfirmRoute, TransactionCreator } from './routingInstrumentation';
|
|
3
3
|
import { InternalRoutingInstrumentation } from './routingInstrumentation';
|
|
4
4
|
import type { BeforeNavigate } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativenavigation.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnativenavigation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reactnativenavigation.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnativenavigation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,8BAA8B,EAAE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CAAC,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;QAEjC,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;IACtC,CAAC;IAED,4DAA4D;IACpD,oBAAoB,CAAC,cAAkC;;QAC7D,IAAI,YAAY,GAAG,MAAA,IAAI,CAAC,eAAe,uEAAQ,cAAc,EAAG,CAAC;QAEjE,mEAAmE;QACnE,IAAI,CAAC,YAAY,EAAE;YACjB,MAAM,CAAC,KAAK,CACV,IAAI,oCAAoC,CAAC,IAAI,6BAA6B,YAAY,2DAA2D,CAClJ,CAAC;YAEF,YAAY,mCACP,cAAc,KACjB,OAAO,EAAE,KAAK,GACf,CAAC;SACH;QAED,IAAI,YAAY,CAAC,OAAO,KAAK,KAAK,EAAE;YAClC,MAAM,CAAC,GAAG,CACR,IAAI,oCAAoC,CAAC,IAAI,gCAAgC,YAAY,CAAC,IAAI,0BAA0B,CACzH,CAAC;SACH;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,wEAAwE;IAChE,yBAAyB;QAC/B,IAAI,IAAI,CAAC,kBAAkB,EAAE;YAC3B,IAAI,CAAC,kBAAkB,CAAC,OAAO,GAAG,KAAK,CAAC;YACxC,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC;YACjC,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;SACrC;QAED,IAAI,CAAC,wBAAwB,EAAE,CAAC;IAClC,CAAC;IAED,wEAAwE;IAChE,wBAAwB;QAC9B,IAAI,OAAO,IAAI,CAAC,mBAAmB,KAAK,WAAW,EAAE;YACnD,YAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACvC,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;SACtC;IACH,CAAC;;AAvKa,wDAAmB,GAAW,yBAAyB,CAAC","sourcesContent":["import type { Transaction as TransactionType, TransactionContext } from '@sentry/types';\nimport { logger } from '@sentry/utils';\nimport type { EmitterSubscription } from 'react-native/Libraries/vendor/emitter/EventEmitter';\n\nimport type { OnConfirmRoute, TransactionCreator } from './routingInstrumentation';\nimport { InternalRoutingInstrumentation } from './routingInstrumentation';\nimport type { BeforeNavigate, RouteChangeContextData } from './types';\nimport { customTransactionSource, defaultTransactionSource, getBlankTransactionContext } from './utils';\n\ninterface ReactNativeNavigationOptions {\n /**\n * How long the instrumentation will wait for the route to mount after a change has been initiated,\n * before the transaction is discarded.\n * Time is in ms.\n *\n * Default: 1000\n */\n routeChangeTimeoutMs: number;\n /**\n * Instrumentation will create a transaction on tab change.\n * By default only navigation commands create transactions.\n *\n * Default: true\n */\n enableTabsInstrumentation: boolean;\n}\n\nconst defaultOptions: ReactNativeNavigationOptions = {\n routeChangeTimeoutMs: 1000,\n enableTabsInstrumentation: true,\n};\n\ninterface ComponentEvent {\n componentId: string;\n}\n\ntype ComponentType = 'Component' | 'TopBarTitle' | 'TopBarBackground' | 'TopBarButton';\n\nexport interface ComponentWillAppearEvent extends ComponentEvent {\n componentName: string;\n passProps?: Record<string | number | symbol, unknown>;\n componentType: ComponentType;\n}\n\nexport interface EventSubscription {\n remove(): void;\n}\n\nexport interface BottomTabPressedEvent {\n tabIndex: number;\n}\n\nexport interface EventsRegistry {\n registerComponentWillAppearListener(callback: (event: ComponentWillAppearEvent) => void): EmitterSubscription;\n registerCommandListener(callback: (name: string, params: unknown) => void): EventSubscription;\n registerBottomTabPressedListener(callback: (event: BottomTabPressedEvent) => void): EmitterSubscription;\n}\n\nexport interface NavigationDelegate {\n events: () => EventsRegistry;\n}\n\n/**\n * Instrumentation for React Native Navigation. See docs or sample app for usage.\n *\n * How this works:\n * - `_onCommand` is called every time a commands happens and sets an IdleTransaction on the scope without any route context.\n * - `_onComponentWillAppear` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.\n * - If `_onComponentWillAppear` isn't called within `options.routeChangeTimeoutMs` of the dispatch, then the transaction is not sampled and finished.\n */\nexport class ReactNativeNavigationInstrumentation extends InternalRoutingInstrumentation {\n public static instrumentationName: string = 'react-native-navigation';\n\n public readonly name: string = ReactNativeNavigationInstrumentation.instrumentationName;\n\n private _navigation: NavigationDelegate;\n private _options: ReactNativeNavigationOptions;\n\n private _prevComponentEvent: ComponentWillAppearEvent | null = null;\n\n private _latestTransaction?: TransactionType;\n private _recentComponentIds: string[] = [];\n private _stateChangeTimeout?: number | undefined;\n\n public constructor(\n /** The react native navigation `NavigationDelegate`. This is usually the import named `Navigation`. */\n navigation: unknown,\n options: Partial<ReactNativeNavigationOptions> = {},\n ) {\n super();\n\n this._navigation = navigation as NavigationDelegate;\n\n this._options = {\n ...defaultOptions,\n ...options,\n };\n }\n\n /**\n * Registers the event listeners for React Native Navigation\n */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void {\n super.registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute);\n\n this._navigation.events().registerCommandListener(this._onNavigation.bind(this));\n\n if (this._options.enableTabsInstrumentation) {\n this._navigation.events().registerBottomTabPressedListener(this._onNavigation.bind(this));\n }\n\n this._navigation.events().registerComponentWillAppearListener(this._onComponentWillAppear.bind(this));\n }\n\n /**\n * To be called when a navigation is initiated. (Command, BottomTabSelected, etc.)\n */\n private _onNavigation(): void {\n if (this._latestTransaction) {\n this._discardLatestTransaction();\n }\n\n this._latestTransaction = this.onRouteWillChange(\n getBlankTransactionContext(ReactNativeNavigationInstrumentation.name),\n );\n\n this._stateChangeTimeout = setTimeout(\n this._discardLatestTransaction.bind(this),\n this._options.routeChangeTimeoutMs,\n );\n }\n\n /**\n * To be called AFTER the state has been changed to populate the transaction with the current route.\n */\n private _onComponentWillAppear(event: ComponentWillAppearEvent): void {\n if (!this._latestTransaction) {\n return;\n }\n\n // We ignore actions that pertain to the same screen.\n const isSameComponent = this._prevComponentEvent && event.componentId === this._prevComponentEvent.componentId;\n if (isSameComponent) {\n this._discardLatestTransaction();\n return;\n }\n\n this._clearStateChangeTimeout();\n\n const originalContext = this._latestTransaction.toContext();\n const routeHasBeenSeen = this._recentComponentIds.includes(event.componentId);\n\n const data: RouteChangeContextData = {\n ...originalContext.data,\n route: {\n ...event,\n name: event.componentName,\n hasBeenSeen: routeHasBeenSeen,\n },\n previousRoute: this._prevComponentEvent\n ? {\n ...this._prevComponentEvent,\n name: this._prevComponentEvent?.componentName,\n }\n : null,\n };\n\n const updatedContext = {\n ...originalContext,\n name: event.componentName,\n tags: {\n ...originalContext.tags,\n 'routing.route.name': event.componentName,\n },\n data,\n };\n\n const finalContext = this._prepareFinalContext(updatedContext);\n this._latestTransaction.updateWithContext(finalContext);\n\n const isCustomName = updatedContext.name !== finalContext.name;\n this._latestTransaction.setName(\n finalContext.name,\n isCustomName ? customTransactionSource : defaultTransactionSource,\n );\n\n this._onConfirmRoute?.(finalContext);\n this._prevComponentEvent = event;\n\n this._latestTransaction = undefined;\n }\n\n /** Creates final transaction context before confirmation */\n private _prepareFinalContext(updatedContext: TransactionContext): TransactionContext {\n let finalContext = this._beforeNavigate?.({ ...updatedContext });\n\n // This block is to catch users not returning a transaction context\n if (!finalContext) {\n logger.error(\n `[${ReactNativeNavigationInstrumentation.name}] beforeNavigate returned ${finalContext}, return context.sampled = false to not send transaction.`,\n );\n\n finalContext = {\n ...updatedContext,\n sampled: false,\n };\n }\n\n if (finalContext.sampled === false) {\n logger.log(\n `[${ReactNativeNavigationInstrumentation.name}] Will not send transaction \"${finalContext.name}\" due to beforeNavigate.`,\n );\n }\n\n return finalContext;\n }\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _discardLatestTransaction(): void {\n if (this._latestTransaction) {\n this._latestTransaction.sampled = false;\n this._latestTransaction.finish();\n this._latestTransaction = undefined;\n }\n\n this._clearStateChangeTimeout();\n }\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _clearStateChangeTimeout(): void {\n if (typeof this._stateChangeTimeout !== 'undefined') {\n clearTimeout(this._stateChangeTimeout);\n this._stateChangeTimeout = undefined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AO,YAAY,CAAC;IACtB,CAAC;IAED,wEAAwE;IAChE,yBAAyB;QAC/B,IAAI,IAAI,CAAC,kBAAkB,EAAE;YAC3B,IAAI,CAAC,kBAAkB,CAAC,OAAO,GAAG,KAAK,CAAC;YACxC,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC;YACjC,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;SACrC;QAED,IAAI,CAAC,wBAAwB,EAAE,CAAC;IAClC,CAAC;IAED,wEAAwE;IAChE,wBAAwB;QAC9B,IAAI,OAAO,IAAI,CAAC,mBAAmB,KAAK,WAAW,EAAE;YACnD,YAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACvC,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;SACtC;IACH,CAAC;;AAvKa,wDAAmB,GAAW,yBAAyB,CAAC","sourcesContent":["import type { Transaction as TransactionType, TransactionContext } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport type { EmitterSubscription } from '../utils/rnlibrariesinterface';\nimport type { OnConfirmRoute, TransactionCreator } from './routingInstrumentation';\nimport { InternalRoutingInstrumentation } from './routingInstrumentation';\nimport type { BeforeNavigate, RouteChangeContextData } from './types';\nimport { customTransactionSource, defaultTransactionSource, getBlankTransactionContext } from './utils';\n\ninterface ReactNativeNavigationOptions {\n /**\n * How long the instrumentation will wait for the route to mount after a change has been initiated,\n * before the transaction is discarded.\n * Time is in ms.\n *\n * Default: 1000\n */\n routeChangeTimeoutMs: number;\n /**\n * Instrumentation will create a transaction on tab change.\n * By default only navigation commands create transactions.\n *\n * Default: true\n */\n enableTabsInstrumentation: boolean;\n}\n\nconst defaultOptions: ReactNativeNavigationOptions = {\n routeChangeTimeoutMs: 1000,\n enableTabsInstrumentation: true,\n};\n\ninterface ComponentEvent {\n componentId: string;\n}\n\ntype ComponentType = 'Component' | 'TopBarTitle' | 'TopBarBackground' | 'TopBarButton';\n\nexport interface ComponentWillAppearEvent extends ComponentEvent {\n componentName: string;\n passProps?: Record<string | number | symbol, unknown>;\n componentType: ComponentType;\n}\n\nexport interface EventSubscription {\n remove(): void;\n}\n\nexport interface BottomTabPressedEvent {\n tabIndex: number;\n}\n\nexport interface EventsRegistry {\n registerComponentWillAppearListener(callback: (event: ComponentWillAppearEvent) => void): EmitterSubscription;\n registerCommandListener(callback: (name: string, params: unknown) => void): EventSubscription;\n registerBottomTabPressedListener(callback: (event: BottomTabPressedEvent) => void): EmitterSubscription;\n}\n\nexport interface NavigationDelegate {\n events: () => EventsRegistry;\n}\n\n/**\n * Instrumentation for React Native Navigation. See docs or sample app for usage.\n *\n * How this works:\n * - `_onCommand` is called every time a commands happens and sets an IdleTransaction on the scope without any route context.\n * - `_onComponentWillAppear` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.\n * - If `_onComponentWillAppear` isn't called within `options.routeChangeTimeoutMs` of the dispatch, then the transaction is not sampled and finished.\n */\nexport class ReactNativeNavigationInstrumentation extends InternalRoutingInstrumentation {\n public static instrumentationName: string = 'react-native-navigation';\n\n public readonly name: string = ReactNativeNavigationInstrumentation.instrumentationName;\n\n private _navigation: NavigationDelegate;\n private _options: ReactNativeNavigationOptions;\n\n private _prevComponentEvent: ComponentWillAppearEvent | null = null;\n\n private _latestTransaction?: TransactionType;\n private _recentComponentIds: string[] = [];\n private _stateChangeTimeout?: number | undefined;\n\n public constructor(\n /** The react native navigation `NavigationDelegate`. This is usually the import named `Navigation`. */\n navigation: unknown,\n options: Partial<ReactNativeNavigationOptions> = {},\n ) {\n super();\n\n this._navigation = navigation as NavigationDelegate;\n\n this._options = {\n ...defaultOptions,\n ...options,\n };\n }\n\n /**\n * Registers the event listeners for React Native Navigation\n */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void {\n super.registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute);\n\n this._navigation.events().registerCommandListener(this._onNavigation.bind(this));\n\n if (this._options.enableTabsInstrumentation) {\n this._navigation.events().registerBottomTabPressedListener(this._onNavigation.bind(this));\n }\n\n this._navigation.events().registerComponentWillAppearListener(this._onComponentWillAppear.bind(this));\n }\n\n /**\n * To be called when a navigation is initiated. (Command, BottomTabSelected, etc.)\n */\n private _onNavigation(): void {\n if (this._latestTransaction) {\n this._discardLatestTransaction();\n }\n\n this._latestTransaction = this.onRouteWillChange(\n getBlankTransactionContext(ReactNativeNavigationInstrumentation.name),\n );\n\n this._stateChangeTimeout = setTimeout(\n this._discardLatestTransaction.bind(this),\n this._options.routeChangeTimeoutMs,\n );\n }\n\n /**\n * To be called AFTER the state has been changed to populate the transaction with the current route.\n */\n private _onComponentWillAppear(event: ComponentWillAppearEvent): void {\n if (!this._latestTransaction) {\n return;\n }\n\n // We ignore actions that pertain to the same screen.\n const isSameComponent = this._prevComponentEvent && event.componentId === this._prevComponentEvent.componentId;\n if (isSameComponent) {\n this._discardLatestTransaction();\n return;\n }\n\n this._clearStateChangeTimeout();\n\n const originalContext = this._latestTransaction.toContext();\n const routeHasBeenSeen = this._recentComponentIds.includes(event.componentId);\n\n const data: RouteChangeContextData = {\n ...originalContext.data,\n route: {\n ...event,\n name: event.componentName,\n hasBeenSeen: routeHasBeenSeen,\n },\n previousRoute: this._prevComponentEvent\n ? {\n ...this._prevComponentEvent,\n name: this._prevComponentEvent?.componentName,\n }\n : null,\n };\n\n const updatedContext = {\n ...originalContext,\n name: event.componentName,\n tags: {\n ...originalContext.tags,\n 'routing.route.name': event.componentName,\n },\n data,\n };\n\n const finalContext = this._prepareFinalContext(updatedContext);\n this._latestTransaction.updateWithContext(finalContext);\n\n const isCustomName = updatedContext.name !== finalContext.name;\n this._latestTransaction.setName(\n finalContext.name,\n isCustomName ? customTransactionSource : defaultTransactionSource,\n );\n\n this._onConfirmRoute?.(finalContext);\n this._prevComponentEvent = event;\n\n this._latestTransaction = undefined;\n }\n\n /** Creates final transaction context before confirmation */\n private _prepareFinalContext(updatedContext: TransactionContext): TransactionContext {\n let finalContext = this._beforeNavigate?.({ ...updatedContext });\n\n // This block is to catch users not returning a transaction context\n if (!finalContext) {\n logger.error(\n `[${ReactNativeNavigationInstrumentation.name}] beforeNavigate returned ${finalContext}, return context.sampled = false to not send transaction.`,\n );\n\n finalContext = {\n ...updatedContext,\n sampled: false,\n };\n }\n\n if (finalContext.sampled === false) {\n logger.log(\n `[${ReactNativeNavigationInstrumentation.name}] Will not send transaction \"${finalContext.name}\" due to beforeNavigate.`,\n );\n }\n\n return finalContext;\n }\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _discardLatestTransaction(): void {\n if (this._latestTransaction) {\n this._latestTransaction.sampled = false;\n this._latestTransaction.finish();\n this._latestTransaction = undefined;\n }\n\n this._clearStateChangeTimeout();\n }\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _clearStateChangeTimeout(): void {\n if (typeof this._stateChangeTimeout !== 'undefined') {\n clearTimeout(this._stateChangeTimeout);\n this._stateChangeTimeout = undefined;\n }\n }\n}\n"]}
|
|
@@ -5,7 +5,7 @@ export declare function isTurboModuleEnabled(): boolean;
|
|
|
5
5
|
/** Checks if the React Native Fabric renderer is running */
|
|
6
6
|
export declare function isFabricEnabled(): boolean;
|
|
7
7
|
/** Returns React Native Version as semver string */
|
|
8
|
-
export declare function getReactNativeVersion(): string;
|
|
8
|
+
export declare function getReactNativeVersion(): string | undefined;
|
|
9
9
|
/** Checks if Expo is present in the runtime */
|
|
10
10
|
export declare function isExpo(): boolean;
|
|
11
11
|
/** Returns Hermes Version if hermes is present in the runtime */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/js/utils/environment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/js/utils/environment.ts"],"names":[],"mappings":"AAGA,0DAA0D;AAC1D,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED,0DAA0D;AAC1D,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED,4DAA4D;AAC5D,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED,oDAAoD;AACpD,wBAAgB,qBAAqB,IAAI,MAAM,GAAG,SAAS,CAM1D;AAED,+CAA+C;AAC/C,wBAAgB,MAAM,IAAI,OAAO,CAEhC;AAED,iEAAiE;AACjE,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAMrD;AAED,mDAAmD;AACnD,wBAAgB,qBAAqB,IAAI,aAAa,GAAG,YAAY,CAEpE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { version as RNV } from 'react-native/Libraries/Core/ReactNativeVersion';
|
|
2
1
|
import { RN_GLOBAL_OBJ } from '../utils/worldwide';
|
|
2
|
+
import { ReactNativeLibraries } from './rnlibraries';
|
|
3
3
|
/** Checks if the React Native Hermes engine is running */
|
|
4
4
|
export function isHermesEnabled() {
|
|
5
5
|
return !!RN_GLOBAL_OBJ.HermesInternal;
|
|
@@ -14,6 +14,10 @@ export function isFabricEnabled() {
|
|
|
14
14
|
}
|
|
15
15
|
/** Returns React Native Version as semver string */
|
|
16
16
|
export function getReactNativeVersion() {
|
|
17
|
+
if (!ReactNativeLibraries.ReactNativeVersion) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
const RNV = ReactNativeLibraries.ReactNativeVersion.version;
|
|
17
21
|
return `${RNV.major}.${RNV.minor}.${RNV.patch}${RNV.prerelease != null ? `-${RNV.prerelease}` : ''}`;
|
|
18
22
|
}
|
|
19
23
|
/** Checks if Expo is present in the runtime */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../src/js/utils/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../src/js/utils/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EA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,CAAC","sourcesContent":["import { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport { ReactNativeLibraries } from './rnlibraries';\n\n/** Checks if the React Native Hermes engine is running */\nexport function isHermesEnabled(): boolean {\n return !!RN_GLOBAL_OBJ.HermesInternal;\n}\n\n/** Checks if the React Native TurboModules are enabled */\nexport function isTurboModuleEnabled(): boolean {\n return RN_GLOBAL_OBJ.__turboModuleProxy != null;\n}\n\n/** Checks if the React Native Fabric renderer is running */\nexport function isFabricEnabled(): boolean {\n return RN_GLOBAL_OBJ.nativeFabricUIManager != null;\n}\n\n/** Returns React Native Version as semver string */\nexport function getReactNativeVersion(): string | undefined {\n if (!ReactNativeLibraries.ReactNativeVersion) {\n return undefined;\n }\n const RNV = ReactNativeLibraries.ReactNativeVersion.version;\n return `${RNV.major}.${RNV.minor}.${RNV.patch}${RNV.prerelease != null ? `-${RNV.prerelease}` : ''}`;\n}\n\n/** Checks if Expo is present in the runtime */\nexport function isExpo(): boolean {\n return RN_GLOBAL_OBJ.expo != null;\n}\n\n/** Returns Hermes Version if hermes is present in the runtime */\nexport function getHermesVersion(): string | undefined {\n return (\n RN_GLOBAL_OBJ.HermesInternal &&\n RN_GLOBAL_OBJ.HermesInternal.getRuntimeProperties &&\n RN_GLOBAL_OBJ.HermesInternal.getRuntimeProperties()['OSS Release Version']\n );\n}\n\n/** Returns default environment based on __DEV__ */\nexport function getDefaultEnvironment(): 'development' | 'production' {\n return typeof __DEV__ !== 'undefined' && __DEV__ ? 'development' : 'production';\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rnlibraries.d.ts","sourceRoot":"","sources":["../../../src/js/utils/rnlibraries.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAE5E,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,6BAA6B,CA4BxE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
import { version as RNV } from 'react-native/Libraries/Core/ReactNativeVersion';
|
|
3
|
+
export const ReactNativeLibraries = {
|
|
4
|
+
Devtools: {
|
|
5
|
+
parseErrorStack: (errorStack) => {
|
|
6
|
+
const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack');
|
|
7
|
+
return parseErrorStack(errorStack);
|
|
8
|
+
},
|
|
9
|
+
symbolicateStackTrace: (stack, extraData) => {
|
|
10
|
+
const symbolicateStackTrace = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');
|
|
11
|
+
return symbolicateStackTrace(stack, extraData);
|
|
12
|
+
},
|
|
13
|
+
getDevServer: () => {
|
|
14
|
+
const getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer');
|
|
15
|
+
return getDevServer();
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
Promise: require('react-native/Libraries/Promise'),
|
|
19
|
+
Utilities: {
|
|
20
|
+
polyfillGlobal: (name, getValue) => {
|
|
21
|
+
const { polyfillGlobal } = require('react-native/Libraries/Utilities/PolyfillFunctions');
|
|
22
|
+
polyfillGlobal(name, getValue);
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
ReactNativeVersion: {
|
|
26
|
+
version: RNV,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=rnlibraries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rnlibraries.js","sourceRoot":"","sources":["../../../src/js/utils/rnlibraries.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,gDAAgD,CAAC;AAKhF,MAAM,CAAC,MAAM,oBAAoB,GAA4C;IAC3E,QAAQ,EAAE;QACR,eAAe,EAAE,CAAC,UAAkB,EAAiC,EAAE;YACrE,MAAM,eAAe,GAAG,OAAO,CAAC,sDAAsD,CAAC,CAAC;YACxF,OAAO,eAAe,CAAC,UAAU,CAAC,CAAC;QACrC,CAAC;QACD,qBAAqB,EAAE,CACrB,KAAoC,EACpC,SAAmC,EACU,EAAE;YAC/C,MAAM,qBAAqB,GAAG,OAAO,CAAC,4DAA4D,CAAC,CAAC;YACpG,OAAO,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACjD,CAAC;QACD,YAAY,EAAE,GAA8B,EAAE;YAC5C,MAAM,YAAY,GAAG,OAAO,CAAC,mDAAmD,CAAC,CAAC;YAClF,OAAO,YAAY,EAAE,CAAC;QACxB,CAAC;KACF;IACD,OAAO,EAAE,OAAO,CAAC,gCAAgC,CAAC;IAClD,SAAS,EAAE;QACT,cAAc,EAAE,CAAI,IAAY,EAAE,QAAiB,EAAQ,EAAE;YAC3D,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,oDAAoD,CAAC,CAAC;YACzF,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjC,CAAC;KACF;IACD,kBAAkB,EAAE;QAClB,OAAO,EAAE,GAAG;KACb;CACF,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\n\nimport { version as RNV } from 'react-native/Libraries/Core/ReactNativeVersion';\n\nimport type * as ReactNative from '../vendor/react-native';\nimport type { ReactNativeLibrariesInterface } from './rnlibrariesinterface';\n\nexport const ReactNativeLibraries: Required<ReactNativeLibrariesInterface> = {\n Devtools: {\n parseErrorStack: (errorStack: string): Array<ReactNative.StackFrame> => {\n const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack');\n return parseErrorStack(errorStack);\n },\n symbolicateStackTrace: (\n stack: Array<ReactNative.StackFrame>,\n extraData?: Record<string, unknown>,\n ): Promise<ReactNative.SymbolicatedStackTrace> => {\n const symbolicateStackTrace = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');\n return symbolicateStackTrace(stack, extraData);\n },\n getDevServer: (): ReactNative.DevServerInfo => {\n const getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer');\n return getDevServer();\n },\n },\n Promise: require('react-native/Libraries/Promise'),\n Utilities: {\n polyfillGlobal: <T>(name: string, getValue: () => T): void => {\n const { polyfillGlobal } = require('react-native/Libraries/Utilities/PolyfillFunctions');\n polyfillGlobal(name, getValue);\n },\n },\n ReactNativeVersion: {\n version: RNV,\n },\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rnlibraries.web.d.ts","sourceRoot":"","sources":["../../../src/js/utils/rnlibraries.web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAE5E,eAAO,MAAM,oBAAoB,EAAE,6BAAkC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rnlibraries.web.js","sourceRoot":"","sources":["../../../src/js/utils/rnlibraries.web.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,oBAAoB,GAAkC,EAAE,CAAC","sourcesContent":["import type { ReactNativeLibrariesInterface } from './rnlibrariesinterface';\n\nexport const ReactNativeLibraries: ReactNativeLibrariesInterface = {};\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { version as RNV } from 'react-native/Libraries/Core/ReactNativeVersion';
|
|
2
|
+
import type * as ReactNative from '../vendor/react-native';
|
|
3
|
+
export type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
export type { EmitterSubscription } from 'react-native/Libraries/vendor/emitter/EventEmitter';
|
|
5
|
+
export interface ReactNativeLibrariesInterface {
|
|
6
|
+
Devtools?: {
|
|
7
|
+
parseErrorStack: (errorStack: string) => Array<ReactNative.StackFrame>;
|
|
8
|
+
symbolicateStackTrace: (stack: Array<ReactNative.StackFrame>, extraData?: Record<string, unknown>) => Promise<ReactNative.SymbolicatedStackTrace>;
|
|
9
|
+
getDevServer: () => ReactNative.DevServerInfo;
|
|
10
|
+
};
|
|
11
|
+
Utilities?: {
|
|
12
|
+
polyfillGlobal: <T>(name: string, getValue: () => T) => void;
|
|
13
|
+
};
|
|
14
|
+
Promise?: typeof Promise;
|
|
15
|
+
ReactNativeVersion?: {
|
|
16
|
+
version: typeof RNV;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=rnlibrariesinterface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rnlibrariesinterface.d.ts","sourceRoot":"","sources":["../../../src/js/utils/rnlibrariesinterface.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,gDAAgD,CAAC;AAErF,OAAO,KAAK,KAAK,WAAW,MAAM,wBAAwB,CAAC;AAE3D,YAAY,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAC9E,YAAY,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAE9F,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,EAAE;QACT,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QACvE,qBAAqB,EAAE,CACrB,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,EACpC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAChC,OAAO,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;QACjD,YAAY,EAAE,MAAM,WAAW,CAAC,aAAa,CAAC;KAC/C,CAAC;IACF,SAAS,CAAC,EAAE;QACV,cAAc,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;KAC9D,CAAC;IACF,OAAO,CAAC,EAAE,OAAO,OAAO,CAAC;IACzB,kBAAkB,CAAC,EAAE;QACnB,OAAO,EAAE,OAAO,GAAG,CAAC;KACrB,CAAC;CACH"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//
|
|
2
|
+
// This interface contains all of react-native internals Libraries used in Sentry RN SDK.
|
|
3
|
+
//
|
|
4
|
+
// Containing the internals in one place enables us to handle platforms
|
|
5
|
+
// that don't have all the internals available. For example react-native-web.
|
|
6
|
+
//
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=rnlibrariesinterface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rnlibrariesinterface.js","sourceRoot":"","sources":["../../../src/js/utils/rnlibrariesinterface.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,yFAAyF;AACzF,EAAE;AACF,uEAAuE;AACvE,6EAA6E;AAC7E,EAAE","sourcesContent":["//\n// This interface contains all of react-native internals Libraries used in Sentry RN SDK.\n//\n// Containing the internals in one place enables us to handle platforms\n// that don't have all the internals available. For example react-native-web.\n//\n\nimport type { version as RNV } from 'react-native/Libraries/Core/ReactNativeVersion';\n\nimport type * as ReactNative from '../vendor/react-native';\n\nexport type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';\nexport type { EmitterSubscription } from 'react-native/Libraries/vendor/emitter/EventEmitter';\n\nexport interface ReactNativeLibrariesInterface {\n Devtools?: {\n parseErrorStack: (errorStack: string) => Array<ReactNative.StackFrame>;\n symbolicateStackTrace: (\n stack: Array<ReactNative.StackFrame>,\n extraData?: Record<string, unknown>,\n ) => Promise<ReactNative.SymbolicatedStackTrace>;\n getDevServer: () => ReactNative.DevServerInfo;\n };\n Utilities?: {\n polyfillGlobal: <T>(name: string, getValue: () => T) => void;\n };\n Promise?: typeof Promise;\n ReactNativeVersion?: {\n version: typeof RNV;\n };\n}\n"]}
|
package/dist/js/version.d.ts
CHANGED
|
@@ -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.16.0-alpha.
|
|
3
|
+
export declare const SDK_VERSION = "5.16.0-alpha.2";
|
|
4
4
|
//# sourceMappingURL=version.d.ts.map
|
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,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.16.0-alpha.
|
|
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.16.0-alpha.2';\n"]}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sentry/react-native",
|
|
3
3
|
"homepage": "https://github.com/getsentry/sentry-react-native",
|
|
4
4
|
"repository": "https://github.com/getsentry/sentry-react-native",
|
|
5
|
-
"version": "5.16.0-alpha.
|
|
5
|
+
"version": "5.16.0-alpha.2",
|
|
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",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"downlevel": "downlevel-dts dist ts3.8/dist --to=3.8",
|
|
27
27
|
"clean": "rimraf dist coverage && yarn clean:plugin",
|
|
28
28
|
"clean:plugin": "expo-module clean plugin",
|
|
29
|
+
"circularDepCheck": "madge --circular dist/js/index.js && madge --circular metro.js && madge --circular expo.js",
|
|
29
30
|
"test": "yarn test:sdk && yarn test:tools",
|
|
30
31
|
"test:sdk": "jest",
|
|
31
32
|
"test:tools": "jest --config jest.config.tools.js",
|
|
@@ -56,13 +57,13 @@
|
|
|
56
57
|
"When bumping make sure to update the version of react, i.e: https://github.com/facebook/react-native/blob/v0.56.0/package.json"
|
|
57
58
|
],
|
|
58
59
|
"peerDependencies": {
|
|
60
|
+
"expo": ">=49.0.0",
|
|
59
61
|
"react": ">=17.0.0",
|
|
60
|
-
"react-native": ">=0.65.0"
|
|
61
|
-
"expo": ">=47.0.0"
|
|
62
|
+
"react-native": ">=0.65.0"
|
|
62
63
|
},
|
|
63
64
|
"dependencies": {
|
|
64
65
|
"@sentry/browser": "7.81.1",
|
|
65
|
-
"@sentry/cli": "2.
|
|
66
|
+
"@sentry/cli": "2.23.0",
|
|
66
67
|
"@sentry/core": "7.81.1",
|
|
67
68
|
"@sentry/hub": "7.81.1",
|
|
68
69
|
"@sentry/integrations": "7.81.1",
|
|
@@ -71,6 +72,8 @@
|
|
|
71
72
|
"@sentry/utils": "7.81.1"
|
|
72
73
|
},
|
|
73
74
|
"devDependencies": {
|
|
75
|
+
"@babel/core": "^7.23.5",
|
|
76
|
+
"@expo/metro-config": "^0.10.7",
|
|
74
77
|
"@sentry-internal/eslint-config-sdk": "7.81.1",
|
|
75
78
|
"@sentry-internal/eslint-plugin-sdk": "7.81.1",
|
|
76
79
|
"@sentry-internal/typescript": "7.80.0",
|
|
@@ -85,14 +88,15 @@
|
|
|
85
88
|
"eslint": "^7.6.0",
|
|
86
89
|
"eslint-plugin-react": "^7.20.6",
|
|
87
90
|
"eslint-plugin-react-native": "^3.8.1",
|
|
88
|
-
"expo": "^
|
|
91
|
+
"expo": "^49.0.21",
|
|
89
92
|
"expo-module-scripts": "^3.1.0",
|
|
90
93
|
"jest": "^29.6.2",
|
|
91
94
|
"jest-environment-jsdom": "^29.6.2",
|
|
95
|
+
"madge": "^6.1.0",
|
|
92
96
|
"metro": "0.76",
|
|
93
97
|
"prettier": "^2.0.5",
|
|
94
98
|
"react": "18.2.0",
|
|
95
|
-
"react-native": "0.72.
|
|
99
|
+
"react-native": "0.72.6",
|
|
96
100
|
"replace-in-file": "^7.0.1",
|
|
97
101
|
"rimraf": "^4.1.1",
|
|
98
102
|
"ts-jest": "^29.1.1",
|
package/src/js/NativeRNSentry.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Package } from '@sentry/types';
|
|
2
2
|
import type { TurboModule } from 'react-native';
|
|
3
3
|
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
import type { UnsafeObject } from './utils/rnlibrariesinterface';
|
|
5
6
|
|
|
6
7
|
// There has to be only one interface and it has to be named `Spec`
|
|
7
8
|
// Only extra allowed definitions are types (probably codegen bug)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Package } from '@sentry/types';
|
|
2
2
|
import type { TurboModule } from 'react-native';
|
|
3
|
-
import type { UnsafeObject } from '
|
|
3
|
+
import type { UnsafeObject } from './utils/rnlibrariesinterface';
|
|
4
4
|
export interface Spec extends TurboModule {
|
|
5
5
|
addBreadcrumb(breadcrumb: UnsafeObject): void;
|
|
6
6
|
captureEnvelope(bytes: string, options: {
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import type { Hub, Transaction } from '@sentry/core';
|
|
2
|
-
import type { CustomSamplingContext, TransactionContext } from '@sentry/types';
|
|
3
1
|
export declare const APP_START_WARM = "app_start_warm";
|
|
4
2
|
export declare const APP_START_COLD = "app_start_cold";
|
|
5
3
|
export declare const STALL_COUNT = "stall_count";
|
|
6
4
|
export declare const STALL_TOTAL_TIME = "stall_total_time";
|
|
7
5
|
export declare const STALL_LONGEST_TIME = "stall_longest_time";
|
|
8
|
-
/**
|
|
9
|
-
* Adds React Native's extensions. Needs to be called before any transactions are created.
|
|
10
|
-
*/
|
|
11
|
-
export declare function _addTracingExtensions(): void;
|
|
12
|
-
export type StartTransactionFunction = (this: Hub, transactionContext: TransactionContext, customSamplingContext?: CustomSamplingContext) => Transaction;
|
|
13
6
|
//# sourceMappingURL=measurements.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Hub, Transaction } from '@sentry/core';
|
|
2
|
+
import type { CustomSamplingContext, TransactionContext } from '@sentry/types';
|
|
3
|
+
/**
|
|
4
|
+
* Adds React Native's extensions. Needs to be called before any transactions are created.
|
|
5
|
+
*/
|
|
6
|
+
export declare function _addTracingExtensions(): void;
|
|
7
|
+
export type StartTransactionFunction = (this: Hub, transactionContext: TransactionContext, customSamplingContext?: CustomSamplingContext) => Transaction;
|
|
8
|
+
//# sourceMappingURL=addTracingExtensions.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EmitterSubscription } from '
|
|
1
|
+
import type { EmitterSubscription } from '../utils/rnlibrariesinterface';
|
|
2
2
|
import type { OnConfirmRoute, TransactionCreator } from './routingInstrumentation';
|
|
3
3
|
import { InternalRoutingInstrumentation } from './routingInstrumentation';
|
|
4
4
|
import type { BeforeNavigate } from './types';
|
|
@@ -5,7 +5,7 @@ export declare function isTurboModuleEnabled(): boolean;
|
|
|
5
5
|
/** Checks if the React Native Fabric renderer is running */
|
|
6
6
|
export declare function isFabricEnabled(): boolean;
|
|
7
7
|
/** Returns React Native Version as semver string */
|
|
8
|
-
export declare function getReactNativeVersion(): string;
|
|
8
|
+
export declare function getReactNativeVersion(): string | undefined;
|
|
9
9
|
/** Checks if Expo is present in the runtime */
|
|
10
10
|
export declare function isExpo(): boolean;
|
|
11
11
|
/** Returns Hermes Version if hermes is present in the runtime */
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { version as RNV } from 'react-native/Libraries/Core/ReactNativeVersion';
|
|
2
|
+
import type * as ReactNative from '../vendor/react-native';
|
|
3
|
+
export type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
export type { EmitterSubscription } from 'react-native/Libraries/vendor/emitter/EventEmitter';
|
|
5
|
+
export interface ReactNativeLibrariesInterface {
|
|
6
|
+
Devtools?: {
|
|
7
|
+
parseErrorStack: (errorStack: string) => Array<ReactNative.StackFrame>;
|
|
8
|
+
symbolicateStackTrace: (stack: Array<ReactNative.StackFrame>, extraData?: Record<string, unknown>) => Promise<ReactNative.SymbolicatedStackTrace>;
|
|
9
|
+
getDevServer: () => ReactNative.DevServerInfo;
|
|
10
|
+
};
|
|
11
|
+
Utilities?: {
|
|
12
|
+
polyfillGlobal: <T>(name: string, getValue: () => T) => void;
|
|
13
|
+
};
|
|
14
|
+
Promise?: typeof Promise;
|
|
15
|
+
ReactNativeVersion?: {
|
|
16
|
+
version: typeof RNV;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=rnlibrariesinterface.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
|
|
2
2
|
export declare const SDK_NAME = "sentry.javascript.react-native";
|
|
3
|
-
export declare const SDK_VERSION = "5.16.0-alpha.
|
|
3
|
+
export declare const SDK_VERSION = "5.16.0-alpha.2";
|
|
4
4
|
//# sourceMappingURL=version.d.ts.map
|