@sentry/react-native 6.1.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -9
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +132 -125
- package/android/src/main/java/io/sentry/react/RNSentryTimeToDisplay.java +42 -0
- package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +5 -0
- package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +5 -0
- package/dist/js/NativeRNSentry.d.ts +1 -0
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +5 -2
- package/dist/js/client.js.map +1 -1
- package/dist/js/index.d.ts +2 -2
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +1 -1
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/spotlight.d.ts +4 -0
- package/dist/js/integrations/spotlight.d.ts.map +1 -1
- package/dist/js/integrations/spotlight.js +4 -1
- package/dist/js/integrations/spotlight.js.map +1 -1
- package/dist/js/tracing/reactnavigation.js +7 -7
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/utils/ignorerequirecyclelogs.d.ts +6 -1
- package/dist/js/utils/ignorerequirecyclelogs.d.ts.map +1 -1
- package/dist/js/utils/ignorerequirecyclelogs.js +6 -2
- package/dist/js/utils/ignorerequirecyclelogs.js.map +1 -1
- package/dist/js/utils/sentryeventemitterfallback.d.ts +19 -0
- package/dist/js/utils/sentryeventemitterfallback.d.ts.map +1 -0
- package/dist/js/utils/sentryeventemitterfallback.js +78 -0
- package/dist/js/utils/sentryeventemitterfallback.js.map +1 -0
- package/dist/js/vendor/react-native/index.d.ts +1 -1
- package/dist/js/vendor/react-native/index.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/dist/js/wrapper.d.ts +3 -0
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +6 -0
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.h +8 -12
- package/ios/RNSentry.mm +382 -303
- package/ios/RNSentryBreadcrumb.h +2 -2
- package/ios/RNSentryBreadcrumb.m +7 -6
- package/ios/RNSentryDependencyContainer.h +2 -2
- package/ios/RNSentryDependencyContainer.m +7 -6
- package/ios/RNSentryFramesTrackerListener.h +6 -6
- package/ios/RNSentryFramesTrackerListener.m +10 -8
- package/ios/RNSentryId.m +2 -1
- package/ios/RNSentryOnDrawReporter.h +5 -5
- package/ios/RNSentryOnDrawReporter.m +26 -24
- package/ios/RNSentryRNSScreen.h +1 -1
- package/ios/RNSentryRNSScreen.m +18 -18
- package/ios/RNSentryReplay.m +42 -53
- package/ios/RNSentryReplayBreadcrumbConverter.h +3 -4
- package/ios/RNSentryReplayBreadcrumbConverter.m +139 -132
- package/ios/RNSentryTimeToDisplay.h +7 -0
- package/ios/RNSentryTimeToDisplay.m +44 -0
- package/package.json +16 -15
- package/scripts/sentry-xcode-debug-files.sh +2 -0
- package/sentry.gradle +10 -2
- package/src/js/NativeRNSentry.ts +1 -0
- package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -0
- package/ts3.8/dist/js/index.d.ts +2 -2
- package/ts3.8/dist/js/integrations/spotlight.d.ts +4 -0
- package/ts3.8/dist/js/utils/ignorerequirecyclelogs.d.ts +6 -1
- package/ts3.8/dist/js/utils/sentryeventemitterfallback.d.ts +19 -0
- package/ts3.8/dist/js/vendor/react-native/index.d.ts +1 -1
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/ts3.8/dist/js/wrapper.d.ts +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spotlight.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/spotlight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyD,WAAW,EAAE,MAAM,eAAe,CAAC;AAMxG,KAAK,sCAAsC,GAAG;IAC5C;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,UAAmC,GACpC,GAAE,sCAA2C,GAAG,WAAW,CAc3D"}
|
|
1
|
+
{"version":3,"file":"spotlight.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/spotlight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyD,WAAW,EAAE,MAAM,eAAe,CAAC;AAMxG,KAAK,sCAAsC,GAAG;IAC5C;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,UAAmC,GACpC,GAAE,sCAA2C,GAAG,WAAW,CAc3D;AAgDD;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAQ7C"}
|
|
@@ -52,7 +52,10 @@ function sendEnvelopesToSidecar(client, sidecarUrl) {
|
|
|
52
52
|
xhr.send(serializeEnvelope(spotlightEnvelope));
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Gets the default Spotlight sidecar URL.
|
|
57
|
+
*/
|
|
58
|
+
export function getDefaultSidecarUrl() {
|
|
56
59
|
var _a;
|
|
57
60
|
try {
|
|
58
61
|
const { url } = (_a = ReactNativeLibraries.Devtools) === null || _a === void 0 ? void 0 : _a.getDevServer();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spotlight.js","sourceRoot":"","sources":["../../../src/js/integrations/spotlight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,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KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAC1B,CAAC;iBACH;aACF;QACH,CAAC,CAAC;QAEF,GAAG,CAAC,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;;IAClC,IAAI;QACF,MAAM,EAAE,GAAG,EAAE,GAAG,MAAA,oBAAoB,CAAC,QAAQ,0CAAE,YAAY,EAAE,CAAC;QAC9D,OAAO,UAAU,qBAAqB,CAAC,GAAG,CAAC,cAAc,CAAC;KAC3D;IAAC,OAAO,GAAG,EAAE;QACZ,8BAA8B;KAC/B;IACD,OAAO,8BAA8B,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,SAAS,qBAAqB,CAAC,SAAiB;IAC9C,MAAM,KAAK,GAAG,oCAAoC,CAAC;IACnD,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEvC,IAAI,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE;QACzB,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;KACnB;SAAM;QACL,qBAAqB;QACrB,OAAO,IAAI,CAAC;KACb;AACH,CAAC","sourcesContent":["import type { BaseTransportOptions, Client, ClientOptions, Envelope, Integration } from '@sentry/types';\nimport { logger, serializeEnvelope } from '@sentry/utils';\n\nimport { ReactNativeLibraries } from '../utils/rnlibraries';\nimport { createStealthXhr, XHR_READYSTATE_DONE } from '../utils/xhr';\n\ntype SpotlightReactNativeIntegrationOptions = {\n /**\n * The URL of the Sidecar instance to connect and forward events to.\n * If not set, Spotlight will try to connect to the Sidecar running on localhost:8969.\n *\n * @default \"http://localhost:8969/stream\"\n */\n sidecarUrl?: string;\n};\n\n/**\n * Use this integration to send errors and transactions to Spotlight.\n *\n * Learn more about spotlight at https://spotlightjs.com\n */\nexport function spotlightIntegration({\n sidecarUrl = getDefaultSidecarUrl(),\n}: SpotlightReactNativeIntegrationOptions = {}): Integration {\n logger.info('[Spotlight] Using Sidecar URL', sidecarUrl);\n\n return {\n name: 'Spotlight',\n\n setupOnce(): void {\n // nothing to do here\n },\n\n setup(client: Client<ClientOptions<BaseTransportOptions>>): void {\n setup(client, sidecarUrl);\n },\n };\n}\n\nfunction setup(client: Client, sidecarUrl: string): void {\n sendEnvelopesToSidecar(client, sidecarUrl);\n}\n\nfunction sendEnvelopesToSidecar(client: Client, sidecarUrl: string): void {\n if (!client.on) {\n return;\n }\n\n client.on('beforeEnvelope', (originalEnvelope: Envelope) => {\n // TODO: This is a workaround for spotlight/sidecar not supporting images\n const spotlightEnvelope: Envelope = [...originalEnvelope];\n const envelopeItems = [...originalEnvelope[1]].filter(\n item => typeof item[0].content_type !== 'string' || !item[0].content_type.startsWith('image'),\n );\n\n spotlightEnvelope[1] = envelopeItems as Envelope[1];\n\n const xhr = createStealthXhr();\n if (!xhr) {\n logger.error('[Spotlight] Sentry SDK can not create XHR object');\n return;\n }\n\n xhr.open('POST', sidecarUrl, true);\n xhr.setRequestHeader('Content-Type', 'application/x-sentry-envelope');\n\n xhr.onreadystatechange = function () {\n if (xhr.readyState === XHR_READYSTATE_DONE) {\n const status = xhr.status;\n if (status === 0 || (status >= 200 && status < 400)) {\n // The request has been completed successfully\n } else {\n // Handle the error\n logger.error(\n \"[Spotlight] Sentry SDK can't connect to Spotlight is it running? See https://spotlightjs.com to download it.\",\n new Error(xhr.statusText),\n );\n }\n }\n };\n\n xhr.send(serializeEnvelope(spotlightEnvelope));\n });\n}\n\n/**\n * Gets the default Spotlight sidecar URL.\n */\nexport function getDefaultSidecarUrl(): string {\n try {\n const { url } = ReactNativeLibraries.Devtools?.getDevServer();\n return `http://${getHostnameFromString(url)}:8969/stream`;\n } catch (_oO) {\n // We can't load devserver URL\n }\n return 'http://localhost:8969/stream';\n}\n\n/**\n * React Native implementation of the URL class is missing the `hostname` property.\n */\nfunction getHostnameFromString(urlString: string): string | null {\n const regex = /^(?:\\w+:)?\\/\\/([^/:]+)(:\\d+)?(.*)$/;\n const matches = urlString.match(regex);\n\n if (matches && matches[1]) {\n return matches[1];\n } else {\n // Invalid URL format\n return null;\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable max-lines */
|
|
2
2
|
import { addBreadcrumb, getActiveSpan, getClient, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_OK, spanToJSON, startInactiveSpan, } from '@sentry/core';
|
|
3
3
|
import { isPlainObject, logger, timestampInSeconds } from '@sentry/utils';
|
|
4
|
-
import {
|
|
4
|
+
import { createSentryFallbackEventEmitter } from '../utils/sentryeventemitterfallback';
|
|
5
5
|
import { isSentrySpan } from '../utils/span';
|
|
6
6
|
import { RN_GLOBAL_OBJ } from '../utils/worldwide';
|
|
7
7
|
import { NATIVE } from '../wrapper';
|
|
@@ -34,8 +34,8 @@ export const reactNavigationIntegration = ({ routeChangeTimeoutMs = 1000, enable
|
|
|
34
34
|
let stateChangeTimeout;
|
|
35
35
|
let recentRouteKeys = [];
|
|
36
36
|
if (enableTimeToInitialDisplay) {
|
|
37
|
-
newScreenFrameEventEmitter =
|
|
38
|
-
newScreenFrameEventEmitter.initAsync(
|
|
37
|
+
newScreenFrameEventEmitter = createSentryFallbackEventEmitter();
|
|
38
|
+
newScreenFrameEventEmitter.initAsync();
|
|
39
39
|
NATIVE.initNativeReactNavigationNewFrameTracking().catch((reason) => {
|
|
40
40
|
logger.error(`${INTEGRATION_NAME} Failed to initialize native new frame tracking: ${reason}`);
|
|
41
41
|
});
|
|
@@ -164,9 +164,8 @@ export const reactNavigationIntegration = ({ routeChangeTimeoutMs = 1000, enable
|
|
|
164
164
|
isAutoInstrumented: true,
|
|
165
165
|
});
|
|
166
166
|
const navigationSpanWithTtid = latestNavigationSpan;
|
|
167
|
-
!routeHasBeenSeen &&
|
|
168
|
-
|
|
169
|
-
(newScreenFrameEventEmitter === null || newScreenFrameEventEmitter === void 0 ? void 0 : newScreenFrameEventEmitter.once(NewFrameEventName, ({ newFrameTimestampInSeconds }) => {
|
|
167
|
+
if (!routeHasBeenSeen && latestTtidSpan) {
|
|
168
|
+
newScreenFrameEventEmitter === null || newScreenFrameEventEmitter === void 0 ? void 0 : newScreenFrameEventEmitter.onceNewFrame(({ newFrameTimestampInSeconds }) => {
|
|
170
169
|
const activeSpan = getActiveSpan();
|
|
171
170
|
if (activeSpan && manualInitialDisplaySpans.has(activeSpan)) {
|
|
172
171
|
logger.warn('[ReactNavigationInstrumentation] Detected manual instrumentation for the current active span.');
|
|
@@ -175,7 +174,8 @@ export const reactNavigationIntegration = ({ routeChangeTimeoutMs = 1000, enable
|
|
|
175
174
|
latestTtidSpan.setStatus({ code: SPAN_STATUS_OK });
|
|
176
175
|
latestTtidSpan.end(newFrameTimestampInSeconds);
|
|
177
176
|
setSpanDurationAsMeasurementOnSpan('time_to_initial_display', latestTtidSpan, navigationSpanWithTtid);
|
|
178
|
-
})
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
179
|
navigationProcessingSpan === null || navigationProcessingSpan === void 0 ? void 0 : navigationProcessingSpan.updateName(`Processing navigation to ${route.name}`);
|
|
180
180
|
navigationProcessingSpan === null || navigationProcessingSpan === void 0 ? void 0 : navigationProcessingSpan.setStatus({ code: SPAN_STATUS_OK });
|
|
181
181
|
navigationProcessingSpan === null || navigationProcessingSpan === void 0 ? void 0 : navigationProcessingSpan.end(stateChangedTimestamp);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnavigation.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigation.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EACL,aAAa,EACb,aAAa,EACb,SAAS,EACT,4BAA4B,EAC5B,gCAAgC,EAChC,cAAc,EACd,UAAU,EACV,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAA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,EAAE;YACxD,eAAe,GAAG,eAAe,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,GAAG,2BAA2B,CAAC,CAAC;SAC/F;IACH,CAAC,CAAC;IAEF,wEAAwE;IACxE,MAAM,yBAAyB,GAAG,GAAS,EAAE;QAC3C,IAAI,oBAAoB,EAAE;YACxB,IAAI,YAAY,CAAC,oBAAoB,CAAC,EAAE;gBACtC,oBAAoB,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC;aAC1C;YACD,qCAAqC;YACrC,oBAAoB,CAAC,GAAG,EAAE,CAAC;YAC3B,oBAAoB,GAAG,SAAS,CAAC;SAClC;QACD,IAAI,wBAAwB,EAAE;YAC5B,wBAAwB,GAAG,SAAS,CAAC;SACtC;IACH,CAAC,CAAC;IAEF,MAAM,uBAAuB,GAAG,GAAS,EAAE;QACzC,IAAI,OAAO,kBAAkB,KAAK,WAAW,EAAE;YAC7C,YAAY,CAAC,kBAAkB,CAAC,CAAC;YACjC,kBAAkB,GAAG,SAAS,CAAC;SAChC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,aAAa;QACb,2BAA2B;KAC5B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport {\n addBreadcrumb,\n getActiveSpan,\n getClient,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_OK,\n spanToJSON,\n startInactiveSpan,\n} from '@sentry/core';\nimport type { Client, Integration, Span } from '@sentry/types';\nimport { isPlainObject, logger, timestampInSeconds } from '@sentry/utils';\n\nimport type { NewFrameEvent, SentryEventEmitter } from '../utils/sentryeventemitter';\nimport { createSentryEventEmitter, NewFrameEventName } from '../utils/sentryeventemitter';\nimport { isSentrySpan } from '../utils/span';\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport { NATIVE } from '../wrapper';\nimport { ignoreEmptyBackNavigation } from './onSpanEndUtils';\nimport { SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION } from './origin';\nimport type { ReactNativeTracingIntegration } from './reactnativetracing';\nimport { getReactNativeTracingIntegration } from './reactnativetracing';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from './semanticAttributes';\nimport {\n DEFAULT_NAVIGATION_SPAN_NAME,\n defaultIdleOptions,\n getDefaultIdleNavigationSpanOptions,\n startIdleNavigationSpan as startGenericIdleNavigationSpan,\n} from './span';\nimport { manualInitialDisplaySpans, startTimeToInitialDisplaySpan } from './timetodisplay';\nimport { setSpanDurationAsMeasurementOnSpan } from './utils';\n\nexport const INTEGRATION_NAME = 'ReactNavigation';\n\nconst NAVIGATION_HISTORY_MAX_SIZE = 200;\n\ninterface ReactNavigationIntegrationOptions {\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 *\n * @default 1_000 (ms)\n */\n routeChangeTimeoutMs: number;\n\n /**\n * Time to initial display measures the time it takes from\n * navigation dispatch to the render of the first frame of the new screen.\n *\n * @default false\n */\n enableTimeToInitialDisplay: boolean;\n\n /**\n * Does not sample transactions that are from routes that have been seen any more and don't have any spans.\n * This removes a lot of the clutter as most back navigation transactions are now ignored.\n *\n * @default true\n */\n ignoreEmptyBackNavigationTransactions: boolean;\n}\n\n/**\n * Instrumentation for React-Navigation V5 and above. See docs or sample app for usage.\n *\n * How this works:\n * - `_onDispatch` is called every time a dispatch happens and sets an IdleTransaction on the scope without any route context.\n * - `_onStateChange` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.\n * - If `_onStateChange` isn't called within `STATE_CHANGE_TIMEOUT_DURATION` of the dispatch, then the transaction is not sampled and finished.\n */\nexport const reactNavigationIntegration = ({\n routeChangeTimeoutMs = 1_000,\n enableTimeToInitialDisplay = false,\n ignoreEmptyBackNavigationTransactions = true,\n}: Partial<ReactNavigationIntegrationOptions> = {}): Integration & {\n /**\n * Pass the ref to the navigation container to register it to the instrumentation\n * @param navigationContainerRef Ref to a `NavigationContainer`\n */\n registerNavigationContainer: (navigationContainerRef: unknown) => void;\n} => {\n let navigationContainer: NavigationContainer | undefined;\n let newScreenFrameEventEmitter: SentryEventEmitter | undefined;\n\n let tracing: ReactNativeTracingIntegration | undefined;\n let idleSpanOptions: Parameters<typeof startGenericIdleNavigationSpan>[1] = defaultIdleOptions;\n let latestRoute: NavigationRoute | undefined;\n\n let latestNavigationSpan: Span | undefined;\n let navigationProcessingSpan: Span | undefined;\n\n let initialStateHandled: boolean = false;\n let stateChangeTimeout: ReturnType<typeof setTimeout> | undefined;\n let recentRouteKeys: string[] = [];\n\n if (enableTimeToInitialDisplay) {\n newScreenFrameEventEmitter = createSentryEventEmitter();\n newScreenFrameEventEmitter.initAsync(NewFrameEventName);\n NATIVE.initNativeReactNavigationNewFrameTracking().catch((reason: unknown) => {\n logger.error(`${INTEGRATION_NAME} Failed to initialize native new frame tracking: ${reason}`);\n });\n }\n\n /**\n * Set the initial state and start initial navigation span for the current screen.\n */\n const afterAllSetup = (client: Client): void => {\n tracing = getReactNativeTracingIntegration(client);\n if (tracing) {\n idleSpanOptions = {\n finalTimeout: tracing.options.finalTimeoutMs,\n idleTimeout: tracing.options.idleTimeoutMs,\n };\n }\n\n if (initialStateHandled) {\n // We create an initial state here to ensure a transaction gets created before the first route mounts.\n return undefined;\n }\n\n startIdleNavigationSpan();\n\n if (!navigationContainer) {\n // This is expected as navigation container is registered after the root component is mounted.\n return undefined;\n }\n\n // Navigation container already registered, just populate with route state\n updateLatestNavigationSpanWithCurrentRoute();\n initialStateHandled = true;\n };\n\n const registerNavigationContainer = (navigationContainerRef: unknown): void => {\n /* We prevent duplicate routing instrumentation to be initialized on fast refreshes\n\n Explanation: If the user triggers a fast refresh on the file that the instrumentation is\n initialized in, it will initialize a new instance and will cause undefined behavior.\n */\n if (RN_GLOBAL_OBJ.__sentry_rn_v5_registered) {\n logger.log(\n `${INTEGRATION_NAME} Instrumentation already exists, but register has been called again, doing nothing.`,\n );\n return undefined;\n }\n\n if (isPlainObject(navigationContainerRef) && 'current' in navigationContainerRef) {\n navigationContainer = navigationContainerRef.current as NavigationContainer;\n } else {\n navigationContainer = navigationContainerRef as NavigationContainer;\n }\n if (!navigationContainer) {\n logger.warn(`${INTEGRATION_NAME} Received invalid navigation container ref!`);\n return undefined;\n }\n\n // This action is emitted on every dispatch\n navigationContainer.addListener('__unsafe_action__', startIdleNavigationSpan);\n navigationContainer.addListener('state', updateLatestNavigationSpanWithCurrentRoute);\n RN_GLOBAL_OBJ.__sentry_rn_v5_registered = true;\n\n if (initialStateHandled) {\n return undefined;\n }\n\n if (!latestNavigationSpan) {\n logger.log(`${INTEGRATION_NAME} Navigation container registered, but integration has not been setup yet.`);\n return undefined;\n }\n\n // Navigation Container is registered after the first navigation\n // Initial navigation span was started, after integration setup,\n // so now we populate it with the current route.\n updateLatestNavigationSpanWithCurrentRoute();\n initialStateHandled = true;\n };\n\n /**\n * To be called on every React-Navigation action dispatch.\n * It does not name the transaction or populate it with route information. Instead, it waits for the state to fully change\n * and gets the route information from there, @see updateLatestNavigationSpanWithCurrentRoute\n */\n const startIdleNavigationSpan = (): void => {\n if (latestNavigationSpan) {\n logger.log(`${INTEGRATION_NAME} A transaction was detected that turned out to be a noop, discarding.`);\n _discardLatestTransaction();\n clearStateChangeTimeout();\n }\n\n latestNavigationSpan = startGenericIdleNavigationSpan(\n tracing && tracing.options.beforeStartSpan\n ? tracing.options.beforeStartSpan(getDefaultIdleNavigationSpanOptions())\n : getDefaultIdleNavigationSpanOptions(),\n idleSpanOptions,\n );\n latestNavigationSpan?.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION);\n if (ignoreEmptyBackNavigationTransactions) {\n ignoreEmptyBackNavigation(getClient(), latestNavigationSpan);\n }\n\n if (enableTimeToInitialDisplay) {\n navigationProcessingSpan = startInactiveSpan({\n op: 'navigation.processing',\n name: 'Navigation processing',\n startTime: latestNavigationSpan && spanToJSON(latestNavigationSpan).start_timestamp,\n });\n navigationProcessingSpan.setAttribute(\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION,\n );\n }\n\n stateChangeTimeout = setTimeout(_discardLatestTransaction, routeChangeTimeoutMs);\n };\n\n /**\n * To be called AFTER the state has been changed to populate the transaction with the current route.\n */\n const updateLatestNavigationSpanWithCurrentRoute = (): void => {\n const stateChangedTimestamp = timestampInSeconds();\n const previousRoute = latestRoute;\n\n if (!navigationContainer) {\n logger.warn(`${INTEGRATION_NAME} Missing navigation container ref. Route transactions will not be sent.`);\n return undefined;\n }\n\n const route = navigationContainer.getCurrentRoute();\n if (!route) {\n logger.debug(`[${INTEGRATION_NAME}] Navigation state changed, but no route is rendered.`);\n return undefined;\n }\n\n if (!latestNavigationSpan) {\n logger.debug(\n `[${INTEGRATION_NAME}] Navigation state changed, but navigation transaction was not started on dispatch.`,\n );\n return undefined;\n }\n\n if (previousRoute && previousRoute.key === route.key) {\n logger.debug(`[${INTEGRATION_NAME}] Navigation state changed, but route is the same as previous.`);\n pushRecentRouteKey(route.key);\n latestRoute = route;\n\n // Clear the latest transaction as it has been handled.\n latestNavigationSpan = undefined;\n return undefined;\n }\n\n const routeHasBeenSeen = recentRouteKeys.includes(route.key);\n const latestTtidSpan =\n !routeHasBeenSeen &&\n enableTimeToInitialDisplay &&\n startTimeToInitialDisplaySpan({\n name: `${route.name} initial display`,\n isAutoInstrumented: true,\n });\n\n const navigationSpanWithTtid = latestNavigationSpan;\n !routeHasBeenSeen &&\n latestTtidSpan &&\n newScreenFrameEventEmitter?.once(NewFrameEventName, ({ newFrameTimestampInSeconds }: NewFrameEvent) => {\n const activeSpan = getActiveSpan();\n if (activeSpan && manualInitialDisplaySpans.has(activeSpan)) {\n logger.warn('[ReactNavigationInstrumentation] Detected manual instrumentation for the current active span.');\n return;\n }\n\n latestTtidSpan.setStatus({ code: SPAN_STATUS_OK });\n latestTtidSpan.end(newFrameTimestampInSeconds);\n setSpanDurationAsMeasurementOnSpan('time_to_initial_display', latestTtidSpan, navigationSpanWithTtid);\n });\n\n navigationProcessingSpan?.updateName(`Processing navigation to ${route.name}`);\n navigationProcessingSpan?.setStatus({ code: SPAN_STATUS_OK });\n navigationProcessingSpan?.end(stateChangedTimestamp);\n navigationProcessingSpan = undefined;\n\n if (spanToJSON(latestNavigationSpan).description === DEFAULT_NAVIGATION_SPAN_NAME) {\n latestNavigationSpan.updateName(route.name);\n }\n latestNavigationSpan.setAttributes({\n 'route.name': route.name,\n 'route.key': route.key,\n // TODO: filter PII params instead of dropping them all\n // 'route.params': {},\n 'route.has_been_seen': routeHasBeenSeen,\n 'previous_route.name': previousRoute?.name,\n 'previous_route.key': previousRoute?.key,\n // TODO: filter PII params instead of dropping them all\n // 'previous_route.params': {},\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n });\n\n // Clear the timeout so the transaction does not get cancelled.\n clearStateChangeTimeout();\n\n addBreadcrumb({\n category: 'navigation',\n type: 'navigation',\n message: `Navigation to ${route.name}`,\n data: {\n from: previousRoute?.name,\n to: route.name,\n },\n });\n\n tracing?.setCurrentRoute(route.key);\n\n pushRecentRouteKey(route.key);\n latestRoute = route;\n // Clear the latest transaction as it has been handled.\n latestNavigationSpan = undefined;\n };\n\n /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */\n const pushRecentRouteKey = (key: string): void => {\n recentRouteKeys.push(key);\n\n if (recentRouteKeys.length > NAVIGATION_HISTORY_MAX_SIZE) {\n recentRouteKeys = recentRouteKeys.slice(recentRouteKeys.length - NAVIGATION_HISTORY_MAX_SIZE);\n }\n };\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n const _discardLatestTransaction = (): void => {\n if (latestNavigationSpan) {\n if (isSentrySpan(latestNavigationSpan)) {\n latestNavigationSpan['_sampled'] = false;\n }\n // TODO: What if it's not SentrySpan?\n latestNavigationSpan.end();\n latestNavigationSpan = undefined;\n }\n if (navigationProcessingSpan) {\n navigationProcessingSpan = undefined;\n }\n };\n\n const clearStateChangeTimeout = (): void => {\n if (typeof stateChangeTimeout !== 'undefined') {\n clearTimeout(stateChangeTimeout);\n stateChangeTimeout = undefined;\n }\n };\n\n return {\n name: INTEGRATION_NAME,\n afterAllSetup,\n registerNavigationContainer,\n };\n};\n\nexport interface NavigationRoute {\n name: string;\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params?: Record<string, any>;\n}\n\ninterface NavigationContainer {\n addListener: (type: string, listener: () => void) => void;\n getCurrentRoute: () => NavigationRoute;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reactnavigation.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigation.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EACL,aAAa,EACb,aAAa,EACb,SAAS,EACT,4BAA4B,EAC5B,gCAAgC,EAChC,cAAc,EACd,UAAU,EACV,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAI1E,OAAO,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,4CAA4C,EAAE,MAAM,UAAU,CAAC;AAExE,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,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B,KAAK,WAAW,EAAE;YAC7C,YAAY,CAAC,kBAAkB,CAAC,CAAC;YACjC,kBAAkB,GAAG,SAAS,CAAC;SAChC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,aAAa;QACb,2BAA2B;KAC5B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport {\n addBreadcrumb,\n getActiveSpan,\n getClient,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_OK,\n spanToJSON,\n startInactiveSpan,\n} from '@sentry/core';\nimport type { Client, Integration, Span } from '@sentry/types';\nimport { isPlainObject, logger, timestampInSeconds } from '@sentry/utils';\n\nimport type { NewFrameEvent } from '../utils/sentryeventemitter';\nimport type { SentryEventEmitterFallback } from '../utils/sentryeventemitterfallback';\nimport { createSentryFallbackEventEmitter } from '../utils/sentryeventemitterfallback';\nimport { isSentrySpan } from '../utils/span';\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport { NATIVE } from '../wrapper';\nimport { ignoreEmptyBackNavigation } from './onSpanEndUtils';\nimport { SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION } from './origin';\nimport type { ReactNativeTracingIntegration } from './reactnativetracing';\nimport { getReactNativeTracingIntegration } from './reactnativetracing';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from './semanticAttributes';\nimport {\n DEFAULT_NAVIGATION_SPAN_NAME,\n defaultIdleOptions,\n getDefaultIdleNavigationSpanOptions,\n startIdleNavigationSpan as startGenericIdleNavigationSpan,\n} from './span';\nimport { manualInitialDisplaySpans, startTimeToInitialDisplaySpan } from './timetodisplay';\nimport { setSpanDurationAsMeasurementOnSpan } from './utils';\nexport const INTEGRATION_NAME = 'ReactNavigation';\n\nconst NAVIGATION_HISTORY_MAX_SIZE = 200;\n\ninterface ReactNavigationIntegrationOptions {\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 *\n * @default 1_000 (ms)\n */\n routeChangeTimeoutMs: number;\n\n /**\n * Time to initial display measures the time it takes from\n * navigation dispatch to the render of the first frame of the new screen.\n *\n * @default false\n */\n enableTimeToInitialDisplay: boolean;\n\n /**\n * Does not sample transactions that are from routes that have been seen any more and don't have any spans.\n * This removes a lot of the clutter as most back navigation transactions are now ignored.\n *\n * @default true\n */\n ignoreEmptyBackNavigationTransactions: boolean;\n}\n\n/**\n * Instrumentation for React-Navigation V5 and above. See docs or sample app for usage.\n *\n * How this works:\n * - `_onDispatch` is called every time a dispatch happens and sets an IdleTransaction on the scope without any route context.\n * - `_onStateChange` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.\n * - If `_onStateChange` isn't called within `STATE_CHANGE_TIMEOUT_DURATION` of the dispatch, then the transaction is not sampled and finished.\n */\nexport const reactNavigationIntegration = ({\n routeChangeTimeoutMs = 1_000,\n enableTimeToInitialDisplay = false,\n ignoreEmptyBackNavigationTransactions = true,\n}: Partial<ReactNavigationIntegrationOptions> = {}): Integration & {\n /**\n * Pass the ref to the navigation container to register it to the instrumentation\n * @param navigationContainerRef Ref to a `NavigationContainer`\n */\n registerNavigationContainer: (navigationContainerRef: unknown) => void;\n} => {\n let navigationContainer: NavigationContainer | undefined;\n let newScreenFrameEventEmitter: SentryEventEmitterFallback | undefined;\n\n let tracing: ReactNativeTracingIntegration | undefined;\n let idleSpanOptions: Parameters<typeof startGenericIdleNavigationSpan>[1] = defaultIdleOptions;\n let latestRoute: NavigationRoute | undefined;\n\n let latestNavigationSpan: Span | undefined;\n let navigationProcessingSpan: Span | undefined;\n\n let initialStateHandled: boolean = false;\n let stateChangeTimeout: ReturnType<typeof setTimeout> | undefined;\n let recentRouteKeys: string[] = [];\n\n if (enableTimeToInitialDisplay) {\n newScreenFrameEventEmitter = createSentryFallbackEventEmitter();\n newScreenFrameEventEmitter.initAsync();\n NATIVE.initNativeReactNavigationNewFrameTracking().catch((reason: unknown) => {\n logger.error(`${INTEGRATION_NAME} Failed to initialize native new frame tracking: ${reason}`);\n });\n }\n\n /**\n * Set the initial state and start initial navigation span for the current screen.\n */\n const afterAllSetup = (client: Client): void => {\n tracing = getReactNativeTracingIntegration(client);\n if (tracing) {\n idleSpanOptions = {\n finalTimeout: tracing.options.finalTimeoutMs,\n idleTimeout: tracing.options.idleTimeoutMs,\n };\n }\n\n if (initialStateHandled) {\n // We create an initial state here to ensure a transaction gets created before the first route mounts.\n return undefined;\n }\n\n startIdleNavigationSpan();\n\n if (!navigationContainer) {\n // This is expected as navigation container is registered after the root component is mounted.\n return undefined;\n }\n\n // Navigation container already registered, just populate with route state\n updateLatestNavigationSpanWithCurrentRoute();\n initialStateHandled = true;\n };\n\n const registerNavigationContainer = (navigationContainerRef: unknown): void => {\n /* We prevent duplicate routing instrumentation to be initialized on fast refreshes\n\n Explanation: If the user triggers a fast refresh on the file that the instrumentation is\n initialized in, it will initialize a new instance and will cause undefined behavior.\n */\n if (RN_GLOBAL_OBJ.__sentry_rn_v5_registered) {\n logger.log(\n `${INTEGRATION_NAME} Instrumentation already exists, but register has been called again, doing nothing.`,\n );\n return undefined;\n }\n\n if (isPlainObject(navigationContainerRef) && 'current' in navigationContainerRef) {\n navigationContainer = navigationContainerRef.current as NavigationContainer;\n } else {\n navigationContainer = navigationContainerRef as NavigationContainer;\n }\n if (!navigationContainer) {\n logger.warn(`${INTEGRATION_NAME} Received invalid navigation container ref!`);\n return undefined;\n }\n\n // This action is emitted on every dispatch\n navigationContainer.addListener('__unsafe_action__', startIdleNavigationSpan);\n navigationContainer.addListener('state', updateLatestNavigationSpanWithCurrentRoute);\n RN_GLOBAL_OBJ.__sentry_rn_v5_registered = true;\n\n if (initialStateHandled) {\n return undefined;\n }\n\n if (!latestNavigationSpan) {\n logger.log(`${INTEGRATION_NAME} Navigation container registered, but integration has not been setup yet.`);\n return undefined;\n }\n\n // Navigation Container is registered after the first navigation\n // Initial navigation span was started, after integration setup,\n // so now we populate it with the current route.\n updateLatestNavigationSpanWithCurrentRoute();\n initialStateHandled = true;\n };\n\n /**\n * To be called on every React-Navigation action dispatch.\n * It does not name the transaction or populate it with route information. Instead, it waits for the state to fully change\n * and gets the route information from there, @see updateLatestNavigationSpanWithCurrentRoute\n */\n const startIdleNavigationSpan = (): void => {\n if (latestNavigationSpan) {\n logger.log(`${INTEGRATION_NAME} A transaction was detected that turned out to be a noop, discarding.`);\n _discardLatestTransaction();\n clearStateChangeTimeout();\n }\n\n latestNavigationSpan = startGenericIdleNavigationSpan(\n tracing && tracing.options.beforeStartSpan\n ? tracing.options.beforeStartSpan(getDefaultIdleNavigationSpanOptions())\n : getDefaultIdleNavigationSpanOptions(),\n idleSpanOptions,\n );\n latestNavigationSpan?.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION);\n if (ignoreEmptyBackNavigationTransactions) {\n ignoreEmptyBackNavigation(getClient(), latestNavigationSpan);\n }\n\n if (enableTimeToInitialDisplay) {\n navigationProcessingSpan = startInactiveSpan({\n op: 'navigation.processing',\n name: 'Navigation processing',\n startTime: latestNavigationSpan && spanToJSON(latestNavigationSpan).start_timestamp,\n });\n navigationProcessingSpan.setAttribute(\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION,\n );\n }\n\n stateChangeTimeout = setTimeout(_discardLatestTransaction, routeChangeTimeoutMs);\n };\n\n /**\n * To be called AFTER the state has been changed to populate the transaction with the current route.\n */\n const updateLatestNavigationSpanWithCurrentRoute = (): void => {\n const stateChangedTimestamp = timestampInSeconds();\n const previousRoute = latestRoute;\n\n if (!navigationContainer) {\n logger.warn(`${INTEGRATION_NAME} Missing navigation container ref. Route transactions will not be sent.`);\n return undefined;\n }\n\n const route = navigationContainer.getCurrentRoute();\n if (!route) {\n logger.debug(`[${INTEGRATION_NAME}] Navigation state changed, but no route is rendered.`);\n return undefined;\n }\n\n if (!latestNavigationSpan) {\n logger.debug(\n `[${INTEGRATION_NAME}] Navigation state changed, but navigation transaction was not started on dispatch.`,\n );\n return undefined;\n }\n\n if (previousRoute && previousRoute.key === route.key) {\n logger.debug(`[${INTEGRATION_NAME}] Navigation state changed, but route is the same as previous.`);\n pushRecentRouteKey(route.key);\n latestRoute = route;\n\n // Clear the latest transaction as it has been handled.\n latestNavigationSpan = undefined;\n return undefined;\n }\n\n const routeHasBeenSeen = recentRouteKeys.includes(route.key);\n const latestTtidSpan =\n !routeHasBeenSeen &&\n enableTimeToInitialDisplay &&\n startTimeToInitialDisplaySpan({\n name: `${route.name} initial display`,\n isAutoInstrumented: true,\n });\n\n const navigationSpanWithTtid = latestNavigationSpan;\n if (!routeHasBeenSeen && latestTtidSpan) {\n newScreenFrameEventEmitter?.onceNewFrame(({ newFrameTimestampInSeconds }: NewFrameEvent) => {\n const activeSpan = getActiveSpan();\n if (activeSpan && manualInitialDisplaySpans.has(activeSpan)) {\n logger.warn('[ReactNavigationInstrumentation] Detected manual instrumentation for the current active span.');\n return;\n }\n\n latestTtidSpan.setStatus({ code: SPAN_STATUS_OK });\n latestTtidSpan.end(newFrameTimestampInSeconds);\n setSpanDurationAsMeasurementOnSpan('time_to_initial_display', latestTtidSpan, navigationSpanWithTtid);\n });\n }\n\n navigationProcessingSpan?.updateName(`Processing navigation to ${route.name}`);\n navigationProcessingSpan?.setStatus({ code: SPAN_STATUS_OK });\n navigationProcessingSpan?.end(stateChangedTimestamp);\n navigationProcessingSpan = undefined;\n\n if (spanToJSON(latestNavigationSpan).description === DEFAULT_NAVIGATION_SPAN_NAME) {\n latestNavigationSpan.updateName(route.name);\n }\n latestNavigationSpan.setAttributes({\n 'route.name': route.name,\n 'route.key': route.key,\n // TODO: filter PII params instead of dropping them all\n // 'route.params': {},\n 'route.has_been_seen': routeHasBeenSeen,\n 'previous_route.name': previousRoute?.name,\n 'previous_route.key': previousRoute?.key,\n // TODO: filter PII params instead of dropping them all\n // 'previous_route.params': {},\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n });\n\n // Clear the timeout so the transaction does not get cancelled.\n clearStateChangeTimeout();\n\n addBreadcrumb({\n category: 'navigation',\n type: 'navigation',\n message: `Navigation to ${route.name}`,\n data: {\n from: previousRoute?.name,\n to: route.name,\n },\n });\n\n tracing?.setCurrentRoute(route.key);\n\n pushRecentRouteKey(route.key);\n latestRoute = route;\n // Clear the latest transaction as it has been handled.\n latestNavigationSpan = undefined;\n };\n\n /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */\n const pushRecentRouteKey = (key: string): void => {\n recentRouteKeys.push(key);\n\n if (recentRouteKeys.length > NAVIGATION_HISTORY_MAX_SIZE) {\n recentRouteKeys = recentRouteKeys.slice(recentRouteKeys.length - NAVIGATION_HISTORY_MAX_SIZE);\n }\n };\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n const _discardLatestTransaction = (): void => {\n if (latestNavigationSpan) {\n if (isSentrySpan(latestNavigationSpan)) {\n latestNavigationSpan['_sampled'] = false;\n }\n // TODO: What if it's not SentrySpan?\n latestNavigationSpan.end();\n latestNavigationSpan = undefined;\n }\n if (navigationProcessingSpan) {\n navigationProcessingSpan = undefined;\n }\n };\n\n const clearStateChangeTimeout = (): void => {\n if (typeof stateChangeTimeout !== 'undefined') {\n clearTimeout(stateChangeTimeout);\n stateChangeTimeout = undefined;\n }\n };\n\n return {\n name: INTEGRATION_NAME,\n afterAllSetup,\n registerNavigationContainer,\n };\n};\n\nexport interface NavigationRoute {\n name: string;\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params?: Record<string, any>;\n}\n\ninterface NavigationContainer {\n addListener: (type: string, listener: () => void) => void;\n getCurrentRoute: () => NavigationRoute;\n}\n"]}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
interface ReactNativeVersion {
|
|
2
|
+
major: number;
|
|
3
|
+
minor: number;
|
|
4
|
+
}
|
|
1
5
|
/**
|
|
2
6
|
* This is a workaround for using fetch on RN, this is a known issue in react-native and only generates a warning.
|
|
3
7
|
*/
|
|
4
|
-
export declare function ignoreRequireCycleLogs(): void;
|
|
8
|
+
export declare function ignoreRequireCycleLogs(version?: ReactNativeVersion): void;
|
|
9
|
+
export {};
|
|
5
10
|
//# sourceMappingURL=ignorerequirecyclelogs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ignorerequirecyclelogs.d.ts","sourceRoot":"","sources":["../../../src/js/utils/ignorerequirecyclelogs.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"ignorerequirecyclelogs.d.ts","sourceRoot":"","sources":["../../../src/js/utils/ignorerequirecyclelogs.ts"],"names":[],"mappings":"AAEA,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAMzE"}
|
|
@@ -2,7 +2,11 @@ import { LogBox } from 'react-native';
|
|
|
2
2
|
/**
|
|
3
3
|
* This is a workaround for using fetch on RN, this is a known issue in react-native and only generates a warning.
|
|
4
4
|
*/
|
|
5
|
-
export function ignoreRequireCycleLogs() {
|
|
6
|
-
|
|
5
|
+
export function ignoreRequireCycleLogs(version) {
|
|
6
|
+
if (version && version.major === 0 && version.minor < 70) {
|
|
7
|
+
// Do not ignore require cycle logs on React Native versions >= 0.70
|
|
8
|
+
// https://github.com/getsentry/sentry-react-native/issues/3484#issuecomment-1877034820
|
|
9
|
+
LogBox.ignoreLogs(['Require cycle:']);
|
|
10
|
+
}
|
|
7
11
|
}
|
|
8
12
|
//# sourceMappingURL=ignorerequirecyclelogs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ignorerequirecyclelogs.js","sourceRoot":"","sources":["../../../src/js/utils/ignorerequirecyclelogs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ignorerequirecyclelogs.js","sourceRoot":"","sources":["../../../src/js/utils/ignorerequirecyclelogs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAOtC;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAA4B;IACjE,IAAI,OAAO,IAAI,OAAO,CAAC,KAAK,KAAK,CAAC,IAAI,OAAO,CAAC,KAAK,GAAG,EAAE,EAAE;QACxD,oEAAoE;QACpE,uFAAuF;QACvF,MAAM,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;KACvC;AACH,CAAC","sourcesContent":["import { LogBox } from 'react-native';\n\ninterface ReactNativeVersion {\n major: number;\n minor: number;\n}\n\n/**\n * This is a workaround for using fetch on RN, this is a known issue in react-native and only generates a warning.\n */\nexport function ignoreRequireCycleLogs(version?: ReactNativeVersion): void {\n if (version && version.major === 0 && version.minor < 70) {\n // Do not ignore require cycle logs on React Native versions >= 0.70\n // https://github.com/getsentry/sentry-react-native/issues/3484#issuecomment-1877034820\n LogBox.ignoreLogs(['Require cycle:']);\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SentryEventEmitter } from './sentryeventemitter';
|
|
2
|
+
export declare const FALLBACK_TIMEOUT_MS = 10000;
|
|
3
|
+
export type FallBackNewFrameEvent = {
|
|
4
|
+
newFrameTimestampInSeconds: number;
|
|
5
|
+
isFallback?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export interface SentryEventEmitterFallback {
|
|
8
|
+
/**
|
|
9
|
+
* Initializes the fallback event emitter
|
|
10
|
+
* This method is synchronous in JS but the event emitter starts asynchronously.
|
|
11
|
+
*/
|
|
12
|
+
initAsync: () => void;
|
|
13
|
+
onceNewFrame: (listener: (event: FallBackNewFrameEvent) => void) => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates emitter that allows to listen to UI Frame events when ready.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createSentryFallbackEventEmitter(emitter?: SentryEventEmitter, fallbackTimeoutMs?: number): SentryEventEmitterFallback;
|
|
19
|
+
//# sourceMappingURL=sentryeventemitterfallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentryeventemitterfallback.d.ts","sourceRoot":"","sources":["../../../src/js/utils/sentryeventemitterfallback.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG9E,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAE1C,MAAM,MAAM,qBAAqB,GAAG;IAAE,0BAA0B,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AACjG,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,YAAY,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,KAAK,IAAI,CAAC;CAC1E;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,GAAE,kBAA+C,EACxD,iBAAiB,SAAsB,GACtC,0BAA0B,CAyE5B"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { logger, timestampInSeconds } from '@sentry/utils';
|
|
2
|
+
import { NATIVE } from '../wrapper';
|
|
3
|
+
import { createSentryEventEmitter, NewFrameEventName } from './sentryeventemitter';
|
|
4
|
+
export const FALLBACK_TIMEOUT_MS = 10000;
|
|
5
|
+
/**
|
|
6
|
+
* Creates emitter that allows to listen to UI Frame events when ready.
|
|
7
|
+
*/
|
|
8
|
+
export function createSentryFallbackEventEmitter(emitter = createSentryEventEmitter(), fallbackTimeoutMs = FALLBACK_TIMEOUT_MS) {
|
|
9
|
+
let fallbackTimeout;
|
|
10
|
+
let animationFrameTimestampSeconds;
|
|
11
|
+
let nativeNewFrameTimestampSeconds;
|
|
12
|
+
function getAnimationFrameTimestampSeconds() {
|
|
13
|
+
// https://reactnative.dev/docs/timers#timers
|
|
14
|
+
// NOTE: The current implementation of requestAnimationFrame is the same
|
|
15
|
+
// as setTimeout(0). This isn't exactly how requestAnimationFrame
|
|
16
|
+
// is supposed to work on web, so it doesn't get called when UI Frames are rendered.: https://github.com/facebook/react-native/blob/5106933c750fee2ce49fe1945c3e3763eebc92bc/packages/react-native/ReactCommon/react/runtime/TimerManager.cpp#L442-L443
|
|
17
|
+
requestAnimationFrame(() => {
|
|
18
|
+
if (fallbackTimeout === undefined) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
animationFrameTimestampSeconds = timestampInSeconds();
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function getNativeNewFrameTimestampSeconds() {
|
|
25
|
+
NATIVE.getNewScreenTimeToDisplay()
|
|
26
|
+
.then(resolve => {
|
|
27
|
+
if (fallbackTimeout === undefined) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
nativeNewFrameTimestampSeconds = resolve !== null && resolve !== void 0 ? resolve : undefined;
|
|
31
|
+
})
|
|
32
|
+
.catch(reason => {
|
|
33
|
+
logger.error('Failed to receive Native fallback timestamp.', reason);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
initAsync() {
|
|
38
|
+
emitter.initAsync(NewFrameEventName);
|
|
39
|
+
},
|
|
40
|
+
onceNewFrame(listener) {
|
|
41
|
+
animationFrameTimestampSeconds = undefined;
|
|
42
|
+
nativeNewFrameTimestampSeconds = undefined;
|
|
43
|
+
const internalListener = (event) => {
|
|
44
|
+
if (fallbackTimeout !== undefined) {
|
|
45
|
+
clearTimeout(fallbackTimeout);
|
|
46
|
+
fallbackTimeout = undefined;
|
|
47
|
+
}
|
|
48
|
+
animationFrameTimestampSeconds = undefined;
|
|
49
|
+
nativeNewFrameTimestampSeconds = undefined;
|
|
50
|
+
listener(event);
|
|
51
|
+
};
|
|
52
|
+
fallbackTimeout = setTimeout(() => {
|
|
53
|
+
if (nativeNewFrameTimestampSeconds) {
|
|
54
|
+
logger.log('Native event emitter did not reply in time');
|
|
55
|
+
return listener({
|
|
56
|
+
newFrameTimestampInSeconds: nativeNewFrameTimestampSeconds,
|
|
57
|
+
isFallback: true,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
else if (animationFrameTimestampSeconds) {
|
|
61
|
+
logger.log('[Sentry] Native event emitter did not reply in time. Using JavaScript fallback emitter.');
|
|
62
|
+
return listener({
|
|
63
|
+
newFrameTimestampInSeconds: animationFrameTimestampSeconds,
|
|
64
|
+
isFallback: true,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
emitter.removeListener(NewFrameEventName, internalListener);
|
|
69
|
+
logger.error('Failed to receive any fallback timestamp.');
|
|
70
|
+
}
|
|
71
|
+
}, fallbackTimeoutMs);
|
|
72
|
+
getNativeNewFrameTimestampSeconds();
|
|
73
|
+
getAnimationFrameTimestampSeconds();
|
|
74
|
+
emitter.once(NewFrameEventName, internalListener);
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=sentryeventemitterfallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentryeventemitterfallback.js","sourceRoot":"","sources":["../../../src/js/utils/sentryeventemitterfallback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEnF,MAAM,CAAC,MAAM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,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC,CAAC;YACF,eAAe,GAAG,UAAU,CAAC,GAAG,EAAE;gBAChC,IAAI,8BAA8B,EAAE;oBAClC,MAAM,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;oBACzD,OAAO,QAAQ,CAAC;wBACd,0BAA0B,EAAE,8BAA8B;wBAC1D,UAAU,EAAE,IAAI;qBACjB,CAAC,CAAC;iBACJ;qBAAM,IAAI,8BAA8B,EAAE;oBACzC,MAAM,CAAC,GAAG,CAAC,yFAAyF,CAAC,CAAC;oBACtG,OAAO,QAAQ,CAAC;wBACd,0BAA0B,EAAE,8BAA8B;wBAC1D,UAAU,EAAE,IAAI;qBACjB,CAAC,CAAC;iBACJ;qBAAM;oBACL,OAAO,CAAC,cAAc,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;oBAC5D,MAAM,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;iBAC3D;YACH,CAAC,EAAE,iBAAiB,CAAC,CAAC;YAEtB,iCAAiC,EAAE,CAAC;YACpC,iCAAiC,EAAE,CAAC;YACpC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;QACpD,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { logger, timestampInSeconds } from '@sentry/utils';\n\nimport { NATIVE } from '../wrapper';\nimport type { NewFrameEvent, SentryEventEmitter } from './sentryeventemitter';\nimport { createSentryEventEmitter, NewFrameEventName } from './sentryeventemitter';\n\nexport const FALLBACK_TIMEOUT_MS = 10_000;\n\nexport type FallBackNewFrameEvent = { newFrameTimestampInSeconds: number; isFallback?: boolean };\nexport interface SentryEventEmitterFallback {\n /**\n * Initializes the fallback event emitter\n * This method is synchronous in JS but the event emitter starts asynchronously.\n */\n initAsync: () => void;\n onceNewFrame: (listener: (event: FallBackNewFrameEvent) => void) => void;\n}\n\n/**\n * Creates emitter that allows to listen to UI Frame events when ready.\n */\nexport function createSentryFallbackEventEmitter(\n emitter: SentryEventEmitter = createSentryEventEmitter(),\n fallbackTimeoutMs = FALLBACK_TIMEOUT_MS,\n): SentryEventEmitterFallback {\n let fallbackTimeout: ReturnType<typeof setTimeout> | undefined;\n let animationFrameTimestampSeconds: number | undefined;\n let nativeNewFrameTimestampSeconds: number | undefined;\n\n function getAnimationFrameTimestampSeconds(): void {\n // https://reactnative.dev/docs/timers#timers\n // NOTE: The current implementation of requestAnimationFrame is the same\n // as setTimeout(0). This isn't exactly how requestAnimationFrame\n // is supposed to work on web, so it doesn't get called when UI Frames are rendered.: https://github.com/facebook/react-native/blob/5106933c750fee2ce49fe1945c3e3763eebc92bc/packages/react-native/ReactCommon/react/runtime/TimerManager.cpp#L442-L443\n requestAnimationFrame(() => {\n if (fallbackTimeout === undefined) {\n return;\n }\n animationFrameTimestampSeconds = timestampInSeconds();\n });\n }\n\n function getNativeNewFrameTimestampSeconds(): void {\n NATIVE.getNewScreenTimeToDisplay()\n .then(resolve => {\n if (fallbackTimeout === undefined) {\n return;\n }\n nativeNewFrameTimestampSeconds = resolve ?? undefined;\n })\n .catch(reason => {\n logger.error('Failed to receive Native fallback timestamp.', reason);\n });\n }\n\n return {\n initAsync() {\n emitter.initAsync(NewFrameEventName);\n },\n\n onceNewFrame(listener: (event: FallBackNewFrameEvent) => void) {\n animationFrameTimestampSeconds = undefined;\n nativeNewFrameTimestampSeconds = undefined;\n\n const internalListener = (event: NewFrameEvent): void => {\n if (fallbackTimeout !== undefined) {\n clearTimeout(fallbackTimeout);\n fallbackTimeout = undefined;\n }\n animationFrameTimestampSeconds = undefined;\n nativeNewFrameTimestampSeconds = undefined;\n listener(event);\n };\n fallbackTimeout = setTimeout(() => {\n if (nativeNewFrameTimestampSeconds) {\n logger.log('Native event emitter did not reply in time');\n return listener({\n newFrameTimestampInSeconds: nativeNewFrameTimestampSeconds,\n isFallback: true,\n });\n } else if (animationFrameTimestampSeconds) {\n logger.log('[Sentry] Native event emitter did not reply in time. Using JavaScript fallback emitter.');\n return listener({\n newFrameTimestampInSeconds: animationFrameTimestampSeconds,\n isFallback: true,\n });\n } else {\n emitter.removeListener(NewFrameEventName, internalListener);\n logger.error('Failed to receive any fallback timestamp.');\n }\n }, fallbackTimeoutMs);\n\n getNativeNewFrameTimestampSeconds();\n getAnimationFrameTimestampSeconds();\n emitter.once(NewFrameEventName, internalListener);\n },\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/js/vendor/react-native/index.ts"],"names":[],"mappings":"AAAA,cAAc","sourcesContent":["// 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// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/Core/NativeExceptionsManager.js#L17\nexport type StackFrame = {\n column?: number;\n file?: string;\n lineNumber?: number;\n methodName: string;\n collapse?: boolean;\n};\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/Core/Devtools/symbolicateStackTrace.js#L17\nexport type CodeFrame = Readonly<{\n content: string;\n location?: {\n [key: string]: unknown;\n row: number;\n column: number;\n };\n fileName: string;\n}>;\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/Core/Devtools/symbolicateStackTrace.js#L27\nexport type SymbolicatedStackTrace =\n | Readonly<{\n stack: Array<StackFrame>;\n codeFrame?: CodeFrame;\n }>\n | Array<StackFrame>;\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/Core/Devtools/getDevServer.js#L17\nexport type DevServerInfo = {\n [key: string]: unknown;\n url: string;\n fullBundleUrl?: string;\n bundleLoadedFromServer: boolean;\n};\n\n// Adapted from https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/TurboModule/RCTExport.d.ts#L10\ntype TurboModule = {\n getConstants?(): object;\n};\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/TurboModule/TurboModuleRegistry.d.ts#L12\nexport type TurboModuleRegistry = {\n get<T extends TurboModule>(name: string): T | null;\n getEnforcing<T extends TurboModule>(name: string): T;\n};\n\n// Adapted from https://github.com/facebook/react-native/blob/3f8340975b35767b192e3118f05d2b039676052e/packages/react-native/types/public/ReactNativeTypes.d.ts#L137\nexport interface HostComponent<P> extends Pick<React.ComponentClass<P>, Exclude<keyof React.ComponentClass<P>, 'new'>> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (props: P, context?: any): React.Component<P> & Readonly<unknown>;\n}\n\n// Adapted from https://github.com/facebook/react-native/blob/575ab7862553d7ad7bc753951ed19dcd50d59b95/packages/react-native/Libraries/Utilities/Platform.d.ts#L23-L28\nexport type ReactNativeVersion = {\n version: {\n major: number;\n minor: number;\n patch: number;\n prerelease?:
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/js/vendor/react-native/index.ts"],"names":[],"mappings":"AAAA,cAAc","sourcesContent":["// 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// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/Core/NativeExceptionsManager.js#L17\nexport type StackFrame = {\n column?: number;\n file?: string;\n lineNumber?: number;\n methodName: string;\n collapse?: boolean;\n};\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/Core/Devtools/symbolicateStackTrace.js#L17\nexport type CodeFrame = Readonly<{\n content: string;\n location?: {\n [key: string]: unknown;\n row: number;\n column: number;\n };\n fileName: string;\n}>;\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/Core/Devtools/symbolicateStackTrace.js#L27\nexport type SymbolicatedStackTrace =\n | Readonly<{\n stack: Array<StackFrame>;\n codeFrame?: CodeFrame;\n }>\n | Array<StackFrame>;\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/Core/Devtools/getDevServer.js#L17\nexport type DevServerInfo = {\n [key: string]: unknown;\n url: string;\n fullBundleUrl?: string;\n bundleLoadedFromServer: boolean;\n};\n\n// Adapted from https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/TurboModule/RCTExport.d.ts#L10\ntype TurboModule = {\n getConstants?(): object;\n};\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/TurboModule/TurboModuleRegistry.d.ts#L12\nexport type TurboModuleRegistry = {\n get<T extends TurboModule>(name: string): T | null;\n getEnforcing<T extends TurboModule>(name: string): T;\n};\n\n// Adapted from https://github.com/facebook/react-native/blob/3f8340975b35767b192e3118f05d2b039676052e/packages/react-native/types/public/ReactNativeTypes.d.ts#L137\nexport interface HostComponent<P> extends Pick<React.ComponentClass<P>, Exclude<keyof React.ComponentClass<P>, 'new'>> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (props: P, context?: any): React.Component<P> & Readonly<unknown>;\n}\n\n// Adapted from https://github.com/facebook/react-native/blob/575ab7862553d7ad7bc753951ed19dcd50d59b95/packages/react-native/Libraries/Utilities/Platform.d.ts#L23-L28\nexport type ReactNativeVersion = {\n version: {\n major: number;\n minor: number;\n patch: number;\n prerelease?: string | null | undefined;\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,OAAO,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,OAAO,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '6.2.0';\n"]}
|
package/dist/js/wrapper.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export interface Screenshot {
|
|
|
15
15
|
filename: string;
|
|
16
16
|
}
|
|
17
17
|
export type NativeSdkOptions = Partial<ReactNativeClientOptions> & {
|
|
18
|
+
defaultSidecarUrl: string | undefined;
|
|
19
|
+
} & {
|
|
18
20
|
mobileReplayOptions: MobileReplayOptions | undefined;
|
|
19
21
|
};
|
|
20
22
|
interface SentryNativeWrapper {
|
|
@@ -70,6 +72,7 @@ interface SentryNativeWrapper {
|
|
|
70
72
|
captureReplay(isHardCrash: boolean): Promise<string | null>;
|
|
71
73
|
getCurrentReplayId(): string | null;
|
|
72
74
|
crashedLastRun(): Promise<boolean | null>;
|
|
75
|
+
getNewScreenTimeToDisplay(): Promise<number | null | undefined>;
|
|
73
76
|
}
|
|
74
77
|
/**
|
|
75
78
|
* Our internal interface for calling native functions
|
package/dist/js/wrapper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../src/js/wrapper.ts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AAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IACvD,kBAAkB,IAAI,WAAW,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAErD,cAAc,CAAC,iBAAiB,EAAE,OAAO,GAAG,OAAO,CAAC;IACpD,aAAa,IAAI;QACf,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC;QAC9B,aAAa,CAAC,EAAE,kBAAkB,CAAC;QACnC,cAAc,CAAC,EAAE,yBAAyB,CAAC;KAC5C,GAAG,IAAI,CAAC;IAET,sBAAsB,IAAI,MAAM,GAAG,IAAI,CAAC;IAExC;;OAEG;IACH,wBAAwB,CAAC,gBAAgB,EAAE,MAAM,EAAE,GAAG,iBAAiB,GAAG,IAAI,CAAC;IAC/E,yCAAyC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3D,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC5D,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAAC;IAEpC,cAAc,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAC1C,yBAAyB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACjE;AAID;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,mBAqpBpB,CAAC"}
|
package/dist/js/wrapper.js
CHANGED
|
@@ -527,6 +527,12 @@ export const NATIVE = {
|
|
|
527
527
|
return typeof result === 'boolean' ? result : null;
|
|
528
528
|
});
|
|
529
529
|
},
|
|
530
|
+
getNewScreenTimeToDisplay() {
|
|
531
|
+
if (!this.enableNative || !this._isModuleLoaded(RNSentry)) {
|
|
532
|
+
return Promise.resolve(null);
|
|
533
|
+
}
|
|
534
|
+
return RNSentry.getNewScreenTimeToDisplay();
|
|
535
|
+
},
|
|
530
536
|
/**
|
|
531
537
|
* Gets the event from envelopeItem and applies the level filter to the selected event.
|
|
532
538
|
* @param data An envelope item containing the event.
|