@sentry/react-native 6.2.0 → 6.3.0-beta.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.
Files changed (50) hide show
  1. package/RNSentry.podspec +1 -1
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/io/sentry/react/RNSentryBreadcrumb.java +6 -0
  4. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +52 -3
  5. package/dist/js/client.d.ts.map +1 -1
  6. package/dist/js/client.js +3 -1
  7. package/dist/js/client.js.map +1 -1
  8. package/dist/js/integrations/debugsymbolicator.js +4 -37
  9. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  10. package/dist/js/integrations/debugsymbolicatorutils.d.ts +6 -2
  11. package/dist/js/integrations/debugsymbolicatorutils.d.ts.map +1 -1
  12. package/dist/js/integrations/debugsymbolicatorutils.js +44 -27
  13. package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -1
  14. package/dist/js/integrations/default.d.ts.map +1 -1
  15. package/dist/js/integrations/default.js +11 -7
  16. package/dist/js/integrations/default.js.map +1 -1
  17. package/dist/js/integrations/devicecontext.d.ts.map +1 -1
  18. package/dist/js/integrations/devicecontext.js +7 -3
  19. package/dist/js/integrations/devicecontext.js.map +1 -1
  20. package/dist/js/sdk.d.ts.map +1 -1
  21. package/dist/js/sdk.js +40 -2
  22. package/dist/js/sdk.js.map +1 -1
  23. package/dist/js/tools/metroMiddleware.d.ts +15 -0
  24. package/dist/js/tools/metroMiddleware.d.ts.map +1 -0
  25. package/dist/js/tools/metroMiddleware.js +105 -0
  26. package/dist/js/tools/metroMiddleware.js.map +1 -0
  27. package/dist/js/tools/metroconfig.d.ts +7 -1
  28. package/dist/js/tools/metroconfig.d.ts.map +1 -1
  29. package/dist/js/tools/metroconfig.js +9 -1
  30. package/dist/js/tools/metroconfig.js.map +1 -1
  31. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  32. package/dist/js/tracing/reactnativetracing.js +17 -1
  33. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  34. package/dist/js/version.d.ts +1 -1
  35. package/dist/js/version.d.ts.map +1 -1
  36. package/dist/js/version.js +1 -1
  37. package/dist/js/version.js.map +1 -1
  38. package/dist/js/wrapper.d.ts +1 -0
  39. package/dist/js/wrapper.d.ts.map +1 -1
  40. package/dist/js/wrapper.js.map +1 -1
  41. package/ios/RNSentry.mm +35 -0
  42. package/ios/RNSentryBreadcrumb.m +6 -0
  43. package/package.json +10 -10
  44. package/scripts/expo-upload-sourcemaps.js +16 -0
  45. package/scripts/sentry-xcode-debug-files.sh +4 -0
  46. package/scripts/sentry-xcode.sh +4 -0
  47. package/sentry.gradle +3 -0
  48. package/ts3.8/dist/js/integrations/debugsymbolicatorutils.d.ts +6 -2
  49. package/ts3.8/dist/js/version.d.ts +1 -1
  50. package/ts3.8/dist/js/wrapper.d.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"devicecontext.js","sourceRoot":"","sources":["../../../src/js/integrations/devicecontext.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEzC,uCAAuC;AACvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAgB,EAAE;IACxD,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,GAAG,EAAE;YACd,UAAU;QACZ,CAAC;QACD,YAAY;KACb,CAAC;AACJ,CAAC,CAAC;AAEF,SAAe,YAAY,CAAC,KAAY;;;QACtC,IAAI,MAAM,GAAwC,IAAI,CAAC;QACvD,IAAI;YACF,MAAM,GAAG,MAAM,MAAM,CAAC,yBAAyB,EAAE,C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,GAAG,CAAC,MAAA,KAAK,CAAC,WAAW,mCAAI,EAAE,CAAC,CAAC,MAAM,CAClD,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,WAAC,OAAA,CAAC,MAAA,KAAK,CAAC,WAAW,mCAAI,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,EAAA,CAAC,CAC9E,CAAC;SACH;QAED,MAAM,WAAW,GAAG,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,uBAAuB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC/G,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,WAAW,EAAE;YAC/B,KAAK,CAAC,KAAK,GAAG,WAAW,CAAC;SAC3B;QAED,MAAM,iBAAiB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;QAChD,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,iBAAiB,EAAE;YAC3C,KAAK,CAAC,WAAW,GAAG,iBAAiB,CAAC;SACvC;QAED,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YAC5D,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,oBAAoB,CAAC;YACjD,CAAC,CAAC,SAAS,CAAC;QACd,IAAI,iBAAiB,EAAE;YACrB,KAAK,CAAC,WAAW,GAAG,iBAAiB,CAAC;SACvC;QAED,OAAO,KAAK,CAAC;;CACd","sourcesContent":["/* eslint-disable complexity */\nimport type { Event, Integration } from '@sentry/types';\nimport { logger, severityLevelFromString } from '@sentry/utils';\nimport { AppState } from 'react-native';\n\nimport { breadcrumbFromObject } from '../breadcrumb';\nimport type { NativeDeviceContextsResponse } from '../NativeRNSentry';\nimport { NATIVE } from '../wrapper';\n\nconst INTEGRATION_NAME = 'DeviceContext';\n\n/** Load device context from native. */\nexport const deviceContextIntegration = (): Integration => {\n return {\n name: INTEGRATION_NAME,\n setupOnce: () => {\n /* noop */\n },\n processEvent,\n };\n};\n\nasync function processEvent(event: Event): Promise<Event> {\n let native: NativeDeviceContextsResponse | null = null;\n try {\n native = await NATIVE.fetchNativeDeviceContexts();\n } catch (e) {\n logger.log(`Failed to get device context from native: ${e}`);\n }\n\n if (!native) {\n return event;\n }\n\n const nativeUser = native.user;\n if (!event.user && nativeUser) {\n event.user = nativeUser;\n }\n\n let nativeContexts = native.contexts;\n if (AppState.currentState !== 'unknown') {\n nativeContexts = nativeContexts || {};\n nativeContexts.app = {\n ...nativeContexts.app,\n in_foreground: AppState.currentState === 'active',\n };\n }\n if (nativeContexts) {\n event.contexts = { ...nativeContexts, ...event.contexts };\n if (nativeContexts.app) {\n event.contexts.app = { ...nativeContexts.app, ...event.contexts.app };\n }\n }\n\n const nativeTags = native.tags;\n if (nativeTags) {\n event.tags = { ...nativeTags, ...event.tags };\n }\n\n const nativeExtra = native.extra;\n if (nativeExtra) {\n event.extra = { ...nativeExtra, ...event.extra };\n }\n\n const nativeFingerprint = native.fingerprint;\n if (nativeFingerprint) {\n event.fingerprint = (event.fingerprint ?? []).concat(\n nativeFingerprint.filter(item => (event.fingerprint ?? []).indexOf(item) < 0),\n );\n }\n\n const nativeLevel = typeof native['level'] === 'string' ? severityLevelFromString(native['level']) : undefined;\n if (!event.level && nativeLevel) {\n event.level = nativeLevel;\n }\n\n const nativeEnvironment = native['environment'];\n if (!event.environment && nativeEnvironment) {\n event.environment = nativeEnvironment;\n }\n\n const nativeBreadcrumbs = Array.isArray(native['breadcrumbs'])\n ? native['breadcrumbs'].map(breadcrumbFromObject)\n : undefined;\n if (nativeBreadcrumbs) {\n event.breadcrumbs = nativeBreadcrumbs;\n }\n\n return event;\n}\n"]}
1
+ {"version":3,"file":"devicecontext.js","sourceRoot":"","sources":["../../../src/js/integrations/devicecontext.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,uBAA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AAG,iBAAiB,CAAC;SACvC;QAED,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YAC5D,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,oBAAoB,CAAC;YACjD,CAAC,CAAC,SAAS,CAAC;QACd,IAAI,iBAAiB,EAAE;YACrB,MAAM,cAAc,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,GAAG,cAAc,mCAAI,GAAG,CAAC,CAAC,kBAAkB;YACrF,KAAK,CAAC,WAAW,GAAG,iBAAiB;iBAClC,MAAM,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,4CAA4C;iBAC5E,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,eAAC,OAAA,CAAC,MAAA,CAAC,CAAC,SAAS,mCAAI,CAAC,CAAC,GAAG,CAAC,MAAA,CAAC,CAAC,SAAS,mCAAI,CAAC,CAAC,CAAA,EAAA,CAAC,CAAC,oBAAoB;iBAC5E,KAAK,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,+BAA+B;SAC3D;QAED,OAAO,KAAK,CAAC;;CACd","sourcesContent":["/* eslint-disable complexity */\nimport type { Client, Event, EventHint, Integration } from '@sentry/types';\nimport { logger, severityLevelFromString } from '@sentry/utils';\nimport { AppState } from 'react-native';\n\nimport { breadcrumbFromObject } from '../breadcrumb';\nimport type { NativeDeviceContextsResponse } from '../NativeRNSentry';\nimport { NATIVE } from '../wrapper';\n\nconst INTEGRATION_NAME = 'DeviceContext';\n\n/** Load device context from native. */\nexport const deviceContextIntegration = (): Integration => {\n return {\n name: INTEGRATION_NAME,\n setupOnce: () => {\n /* noop */\n },\n processEvent,\n };\n};\n\nasync function processEvent(event: Event, _hint: EventHint, client: Client): Promise<Event> {\n let native: NativeDeviceContextsResponse | null = null;\n try {\n native = await NATIVE.fetchNativeDeviceContexts();\n } catch (e) {\n logger.log(`Failed to get device context from native: ${e}`);\n }\n\n if (!native) {\n return event;\n }\n\n const nativeUser = native.user;\n if (!event.user && nativeUser) {\n event.user = nativeUser;\n }\n\n let nativeContexts = native.contexts;\n if (AppState.currentState !== 'unknown') {\n nativeContexts = nativeContexts || {};\n nativeContexts.app = {\n ...nativeContexts.app,\n in_foreground: AppState.currentState === 'active',\n };\n }\n if (nativeContexts) {\n event.contexts = { ...nativeContexts, ...event.contexts };\n if (nativeContexts.app) {\n event.contexts.app = { ...nativeContexts.app, ...event.contexts.app };\n }\n }\n\n const nativeTags = native.tags;\n if (nativeTags) {\n event.tags = { ...nativeTags, ...event.tags };\n }\n\n const nativeExtra = native.extra;\n if (nativeExtra) {\n event.extra = { ...nativeExtra, ...event.extra };\n }\n\n const nativeFingerprint = native.fingerprint;\n if (nativeFingerprint) {\n event.fingerprint = (event.fingerprint ?? []).concat(\n nativeFingerprint.filter(item => (event.fingerprint ?? []).indexOf(item) < 0),\n );\n }\n\n const nativeLevel = typeof native['level'] === 'string' ? severityLevelFromString(native['level']) : undefined;\n if (!event.level && nativeLevel) {\n event.level = nativeLevel;\n }\n\n const nativeEnvironment = native['environment'];\n if (!event.environment && nativeEnvironment) {\n event.environment = nativeEnvironment;\n }\n\n const nativeBreadcrumbs = Array.isArray(native['breadcrumbs'])\n ? native['breadcrumbs'].map(breadcrumbFromObject)\n : undefined;\n if (nativeBreadcrumbs) {\n const maxBreadcrumbs = client?.getOptions().maxBreadcrumbs ?? 100; // Default is 100.\n event.breadcrumbs = nativeBreadcrumbs\n .concat(event.breadcrumbs || []) // concatenate the native and js breadcrumbs\n .sort((a, b) => (a.timestamp ?? 0) - (b.timestamp ?? 0)) // sort by timestamp\n .slice(-maxBreadcrumbs); // keep the last maxBreadcrumbs\n }\n\n return event;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAe,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wBAAgB,IAAI,CAAC,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAuG5D;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpD,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACrC,OAAO,CAAC,EAAE,yBAAyB,GAClC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAiBxB;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED;;;GAGG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,CAe9C;AAED;;GAEG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAU3C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAEhE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAUzE;AAED;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAE9D"}
package/dist/js/sdk.js CHANGED
@@ -5,6 +5,7 @@ import { defaultStackParser, makeFetchTransport, } from '@sentry/react';
5
5
  import { logger, stackParserFromStackParserOptions } from '@sentry/utils';
6
6
  import * as React from 'react';
7
7
  import { ReactNativeClient } from './client';
8
+ import { getDevServer } from './integrations/debugsymbolicatorutils';
8
9
  import { getDefaultIntegrations } from './integrations/default';
9
10
  import { shouldEnableNativeNagger } from './options';
10
11
  import { enableSyncToNative } from './scopeSync';
@@ -36,7 +37,7 @@ const DEFAULT_OPTIONS = {
36
37
  * Inits the SDK and returns the final options.
37
38
  */
38
39
  export function init(passedOptions) {
39
- var _a, _b, _c, _d;
40
+ var _a, _b, _c, _d, _e;
40
41
  if (isRunningInMetroDevServer()) {
41
42
  return;
42
43
  }
@@ -49,13 +50,50 @@ export function init(passedOptions) {
49
50
  enableSyncToNative(getGlobalScope());
50
51
  enableSyncToNative(getIsolationScope());
51
52
  }
53
+ const getURLFromDSN = (dsn) => {
54
+ if (!dsn) {
55
+ return undefined;
56
+ }
57
+ try {
58
+ const url = new URL(dsn);
59
+ return `${url.protocol}//${url.host}`;
60
+ }
61
+ catch (e) {
62
+ logger.error('Failed to extract url from DSN', e);
63
+ return undefined;
64
+ }
65
+ };
66
+ const userBeforeBreadcrumb = safeFactory(passedOptions.beforeBreadcrumb, { loggerMessage: 'The beforeBreadcrumb threw an error' });
67
+ // Exclude Dev Server and Sentry Dsn request from Breadcrumbs
68
+ const devServerUrl = (_d = getDevServer()) === null || _d === void 0 ? void 0 : _d.url;
69
+ const dsn = getURLFromDSN(passedOptions.dsn);
70
+ const defaultBeforeBreadcrumb = (breadcrumb, _hint) => {
71
+ var _a;
72
+ const type = breadcrumb.type || '';
73
+ const url = typeof ((_a = breadcrumb.data) === null || _a === void 0 ? void 0 : _a.url) === 'string' ? breadcrumb.data.url : '';
74
+ if (type === 'http' && ((devServerUrl && url.startsWith(devServerUrl)) || (dsn && url.startsWith(dsn)))) {
75
+ return null;
76
+ }
77
+ return breadcrumb;
78
+ };
79
+ const chainedBeforeBreadcrumb = (breadcrumb, hint) => {
80
+ let modifiedBreadcrumb = breadcrumb;
81
+ if (userBeforeBreadcrumb) {
82
+ const result = userBeforeBreadcrumb(breadcrumb, hint);
83
+ if (result === null) {
84
+ return null;
85
+ }
86
+ modifiedBreadcrumb = result;
87
+ }
88
+ return defaultBeforeBreadcrumb(modifiedBreadcrumb, hint);
89
+ };
52
90
  const options = Object.assign(Object.assign(Object.assign({}, DEFAULT_OPTIONS), passedOptions), { enableNative, enableNativeNagger: shouldEnableNativeNagger(passedOptions.enableNativeNagger),
53
91
  // If custom transport factory fails the SDK won't initialize
54
92
  transport: passedOptions.transport
55
93
  || makeNativeTransportFactory({
56
94
  enableNative,
57
95
  })
58
- || makeFetchTransport, transportOptions: Object.assign(Object.assign(Object.assign({}, DEFAULT_OPTIONS.transportOptions), ((_d = passedOptions.transportOptions) !== null && _d !== void 0 ? _d : {})), { bufferSize: maxQueueSize }), maxQueueSize, integrations: [], stackParser: stackParserFromStackParserOptions(passedOptions.stackParser || defaultStackParser), beforeBreadcrumb: safeFactory(passedOptions.beforeBreadcrumb, { loggerMessage: 'The beforeBreadcrumb threw an error' }), initialScope: safeFactory(passedOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }) });
96
+ || makeFetchTransport, transportOptions: Object.assign(Object.assign(Object.assign({}, DEFAULT_OPTIONS.transportOptions), ((_e = passedOptions.transportOptions) !== null && _e !== void 0 ? _e : {})), { bufferSize: maxQueueSize }), maxQueueSize, integrations: [], stackParser: stackParserFromStackParserOptions(passedOptions.stackParser || defaultStackParser), beforeBreadcrumb: chainedBeforeBreadcrumb, initialScope: safeFactory(passedOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }) });
59
97
  if ('tracesSampler' in options) {
60
98
  options.tracesSampler = safeTracesSampler(options.tracesSampler);
61
99
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":";AAAA,+BAA+B;AAC/B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAC,sBAAsB,EAAE,iBAAiB,EAAC,WAAW,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,cAAc,CAAC;AAC3I,OAAO,EACL,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,MAAM,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EAAE,wBAAwB,EAAE,M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M,CAAC;aACf;YACD,oCAAoC;SACrC;QAAC,OAAO,CAAC,EAAE,GAAG;QAEf,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAEjD,OAAO,KAAK,CAAC;IACf,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,UAAgB,KAAK;;QACzB,IAAI;YACF,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAE3B,IAAI,MAAM,EAAE;gBACV,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;aACtB;SACF;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;SACzC;IACH,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAsB;;IACxD,MAAA,SAAS,EAAqB,0CAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CAAI,QAA6B;IACxD,MAAM,YAAY,GAAG,CAAC,KAAY,EAAiB,EAAE;QACnD,IAAI;YACF,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;SACxB;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,KAAK,CAAC,wCAAwC,EAAE,CAAC,CAAC,CAAC;YAC1D,OAAO,SAAS,CAAC;SAClB;IACH,CAAC,CAAC;IACF,OAAO,aAAa,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAgB,cAAc;;QAClC,OAAO,MAAM,CAAC,cAAc,EAAE,CAAC;IACjC,CAAC;CAAA","sourcesContent":["/* eslint-disable complexity */\nimport { getClient, getGlobalScope,getIntegrationsToSetup, getIsolationScope,initAndBind, withScope as coreWithScope } from '@sentry/core';\nimport {\n defaultStackParser,\n makeFetchTransport,\n} from '@sentry/react';\nimport type { Integration, Scope,UserFeedback } from '@sentry/types';\nimport { logger, stackParserFromStackParserOptions } from '@sentry/utils';\nimport * as React from 'react';\n\nimport { ReactNativeClient } from './client';\nimport { getDefaultIntegrations } from './integrations/default';\nimport type { ReactNativeClientOptions, ReactNativeOptions, ReactNativeWrapperOptions } from './options';\nimport { shouldEnableNativeNagger } from './options';\nimport { enableSyncToNative } from './scopeSync';\nimport { TouchEventBoundary } from './touchevents';\nimport { ReactNativeProfiler } from './tracing';\nimport { useEncodePolyfill } from './transports/encodePolyfill';\nimport { DEFAULT_BUFFER_SIZE, makeNativeTransportFactory } from './transports/native';\nimport { getDefaultEnvironment, isExpoGo, isRunningInMetroDevServer } from './utils/environment';\nimport { safeFactory, safeTracesSampler } from './utils/safe';\nimport { NATIVE } from './wrapper';\n\nconst DEFAULT_OPTIONS: ReactNativeOptions = {\n enableNativeCrashHandling: true,\n enableNativeNagger: true,\n autoInitializeNativeSdk: true,\n enableAutoPerformanceTracing: true,\n enableWatchdogTerminationTracking: true,\n patchGlobalPromise: true,\n sendClientReports: true,\n maxQueueSize: DEFAULT_BUFFER_SIZE,\n attachStacktrace: true,\n enableCaptureFailedRequests: false,\n enableNdk: true,\n enableAppStartTracking: true,\n enableNativeFramesTracking: true,\n enableStallTracking: true,\n enableUserInteractionTracing: false,\n};\n\n/**\n * Inits the SDK and returns the final options.\n */\nexport function init(passedOptions: ReactNativeOptions): void {\n if (isRunningInMetroDevServer()) {\n return;\n }\n\n const maxQueueSize = passedOptions.maxQueueSize\n // eslint-disable-next-line deprecation/deprecation\n ?? passedOptions.transportOptions?.bufferSize\n ?? DEFAULT_OPTIONS.maxQueueSize;\n\n const enableNative = passedOptions.enableNative === undefined || passedOptions.enableNative\n ? NATIVE.isNativeAvailable()\n : false;\n\n useEncodePolyfill();\n if (enableNative) {\n enableSyncToNative(getGlobalScope());\n enableSyncToNative(getIsolationScope());\n }\n\n const options: ReactNativeClientOptions = {\n ...DEFAULT_OPTIONS,\n ...passedOptions,\n enableNative,\n enableNativeNagger: shouldEnableNativeNagger(passedOptions.enableNativeNagger),\n // If custom transport factory fails the SDK won't initialize\n transport: passedOptions.transport\n || makeNativeTransportFactory({\n enableNative,\n })\n || makeFetchTransport,\n transportOptions: {\n ...DEFAULT_OPTIONS.transportOptions,\n ...(passedOptions.transportOptions ?? {}),\n bufferSize: maxQueueSize,\n },\n maxQueueSize,\n integrations: [],\n stackParser: stackParserFromStackParserOptions(passedOptions.stackParser || defaultStackParser),\n beforeBreadcrumb: safeFactory(passedOptions.beforeBreadcrumb, { loggerMessage: 'The beforeBreadcrumb threw an error' }),\n initialScope: safeFactory(passedOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }),\n };\n if ('tracesSampler' in options) {\n options.tracesSampler = safeTracesSampler(options.tracesSampler);\n }\n\n if (!('environment' in options)) {\n options.environment = getDefaultEnvironment();\n }\n\n const defaultIntegrations: false | Integration[] = passedOptions.defaultIntegrations === undefined\n ? getDefaultIntegrations(options)\n : passedOptions.defaultIntegrations;\n\n options.integrations = getIntegrationsToSetup({\n integrations: safeFactory(passedOptions.integrations, { loggerMessage: 'The integrations threw an error' }),\n defaultIntegrations,\n });\n initAndBind(ReactNativeClient, options);\n\n if (isExpoGo()) {\n logger.info('Offline caching, native errors features are not available in Expo Go.');\n logger.info('Use EAS Build / Native Release Build to test these features.');\n }\n}\n\n/**\n * Inits the Sentry React Native SDK with automatic instrumentation and wrapped features.\n */\nexport function wrap<P extends Record<string, unknown>>(\n RootComponent: React.ComponentType<P>,\n options?: ReactNativeWrapperOptions\n): React.ComponentType<P> {\n const profilerProps = {\n ...(options?.profilerProps ?? {}),\n name: RootComponent.displayName ?? 'Root',\n };\n\n const RootApp: React.FC<P> = (appProps) => {\n return (\n <TouchEventBoundary {...(options?.touchEventBoundaryProps ?? {})}>\n <ReactNativeProfiler {...profilerProps}>\n <RootComponent {...appProps} />\n </ReactNativeProfiler>\n </TouchEventBoundary>\n );\n };\n\n return RootApp;\n}\n\n/**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\nexport function nativeCrash(): void {\n NATIVE.nativeCrash();\n}\n\n/**\n * Flushes all pending events in the queue to disk.\n * Use this before applying any realtime updates such as code-push or expo updates.\n */\nexport async function flush(): Promise<boolean> {\n try {\n const client = getClient();\n\n if (client) {\n const result = await client.flush();\n\n return result;\n }\n // eslint-disable-next-line no-empty\n } catch (_) { }\n\n logger.error('Failed to flush the event queue.');\n\n return false;\n}\n\n/**\n * Closes the SDK, stops sending events.\n */\nexport async function close(): Promise<void> {\n try {\n const client = getClient();\n\n if (client) {\n await client.close();\n }\n } catch (e) {\n logger.error('Failed to close the SDK');\n }\n}\n\n/**\n * Captures user feedback and sends it to Sentry.\n */\nexport function captureUserFeedback(feedback: UserFeedback): void {\n getClient<ReactNativeClient>()?.captureUserFeedback(feedback);\n}\n\n/**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n *\n * This is essentially a convenience function for:\n *\n * pushScope();\n * callback();\n * popScope();\n *\n * @param callback that will be enclosed into push/popScope.\n */\nexport function withScope<T>(callback: (scope: Scope) => T): T | undefined {\n const safeCallback = (scope: Scope): T | undefined => {\n try {\n return callback(scope);\n } catch (e) {\n logger.error('Error while running withScope callback', e);\n return undefined;\n }\n };\n return coreWithScope(safeCallback);\n}\n\n/**\n * Returns if the app crashed in the last run.\n */\nexport async function crashedLastRun(): Promise<boolean | null> {\n return NATIVE.crashedLastRun();\n}\n"]}
1
+ {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":";AAAA,+BAA+B;AAC/B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAC,sBAAsB,EAAE,iBAAiB,EAAC,WAAW,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,cAAc,CAAC;AAC3I,OAAO,EACL,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,MAAM,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,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wC,EAAE,CAAC,CAAC,CAAC;YAC1D,OAAO,SAAS,CAAC;SAClB;IACH,CAAC,CAAC;IACF,OAAO,aAAa,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAgB,cAAc;;QAClC,OAAO,MAAM,CAAC,cAAc,EAAE,CAAC;IACjC,CAAC;CAAA","sourcesContent":["/* eslint-disable complexity */\nimport { getClient, getGlobalScope,getIntegrationsToSetup, getIsolationScope,initAndBind, withScope as coreWithScope } from '@sentry/core';\nimport {\n defaultStackParser,\n makeFetchTransport,\n} from '@sentry/react';\nimport type { Breadcrumb, BreadcrumbHint, Integration, Scope, UserFeedback } from '@sentry/types';\nimport { logger, stackParserFromStackParserOptions } from '@sentry/utils';\nimport * as React from 'react';\n\nimport { ReactNativeClient } from './client';\nimport { getDevServer } from './integrations/debugsymbolicatorutils';\nimport { getDefaultIntegrations } from './integrations/default';\nimport type { ReactNativeClientOptions, ReactNativeOptions, ReactNativeWrapperOptions } from './options';\nimport { shouldEnableNativeNagger } from './options';\nimport { enableSyncToNative } from './scopeSync';\nimport { TouchEventBoundary } from './touchevents';\nimport { ReactNativeProfiler } from './tracing';\nimport { useEncodePolyfill } from './transports/encodePolyfill';\nimport { DEFAULT_BUFFER_SIZE, makeNativeTransportFactory } from './transports/native';\nimport { getDefaultEnvironment, isExpoGo, isRunningInMetroDevServer } from './utils/environment';\nimport { safeFactory, safeTracesSampler } from './utils/safe';\nimport { NATIVE } from './wrapper';\n\nconst DEFAULT_OPTIONS: ReactNativeOptions = {\n enableNativeCrashHandling: true,\n enableNativeNagger: true,\n autoInitializeNativeSdk: true,\n enableAutoPerformanceTracing: true,\n enableWatchdogTerminationTracking: true,\n patchGlobalPromise: true,\n sendClientReports: true,\n maxQueueSize: DEFAULT_BUFFER_SIZE,\n attachStacktrace: true,\n enableCaptureFailedRequests: false,\n enableNdk: true,\n enableAppStartTracking: true,\n enableNativeFramesTracking: true,\n enableStallTracking: true,\n enableUserInteractionTracing: false,\n};\n\n/**\n * Inits the SDK and returns the final options.\n */\nexport function init(passedOptions: ReactNativeOptions): void {\n if (isRunningInMetroDevServer()) {\n return;\n }\n\n const maxQueueSize = passedOptions.maxQueueSize\n // eslint-disable-next-line deprecation/deprecation\n ?? passedOptions.transportOptions?.bufferSize\n ?? DEFAULT_OPTIONS.maxQueueSize;\n\n const enableNative = passedOptions.enableNative === undefined || passedOptions.enableNative\n ? NATIVE.isNativeAvailable()\n : false;\n\n useEncodePolyfill();\n if (enableNative) {\n enableSyncToNative(getGlobalScope());\n enableSyncToNative(getIsolationScope());\n }\n\n const getURLFromDSN = (dsn: string | null): string | undefined => {\n if (!dsn) {\n return undefined;\n }\n try {\n const url = new URL(dsn);\n return `${url.protocol}//${url.host}`;\n } catch (e) {\n logger.error('Failed to extract url from DSN', e);\n return undefined;\n }\n };\n\n const userBeforeBreadcrumb = safeFactory(passedOptions.beforeBreadcrumb, { loggerMessage: 'The beforeBreadcrumb threw an error' });\n\n // Exclude Dev Server and Sentry Dsn request from Breadcrumbs\n const devServerUrl = getDevServer()?.url;\n const dsn = getURLFromDSN(passedOptions.dsn);\n const defaultBeforeBreadcrumb = (breadcrumb: Breadcrumb, _hint?: BreadcrumbHint): Breadcrumb | null => {\n const type = breadcrumb.type || '';\n const url = typeof breadcrumb.data?.url === 'string' ? breadcrumb.data.url : '';\n if (type === 'http' && ((devServerUrl && url.startsWith(devServerUrl)) || (dsn && url.startsWith(dsn)))) {\n return null;\n }\n return breadcrumb;\n };\n\n const chainedBeforeBreadcrumb = (breadcrumb: Breadcrumb, hint?: BreadcrumbHint): Breadcrumb | null => {\n let modifiedBreadcrumb = breadcrumb;\n if (userBeforeBreadcrumb) {\n const result = userBeforeBreadcrumb(breadcrumb, hint);\n if (result === null) {\n return null;\n }\n modifiedBreadcrumb = result;\n }\n return defaultBeforeBreadcrumb(modifiedBreadcrumb, hint);\n };\n\n const options: ReactNativeClientOptions = {\n ...DEFAULT_OPTIONS,\n ...passedOptions,\n enableNative,\n enableNativeNagger: shouldEnableNativeNagger(passedOptions.enableNativeNagger),\n // If custom transport factory fails the SDK won't initialize\n transport: passedOptions.transport\n || makeNativeTransportFactory({\n enableNative,\n })\n || makeFetchTransport,\n transportOptions: {\n ...DEFAULT_OPTIONS.transportOptions,\n ...(passedOptions.transportOptions ?? {}),\n bufferSize: maxQueueSize,\n },\n maxQueueSize,\n integrations: [],\n stackParser: stackParserFromStackParserOptions(passedOptions.stackParser || defaultStackParser),\n beforeBreadcrumb: chainedBeforeBreadcrumb,\n initialScope: safeFactory(passedOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }),\n };\n if ('tracesSampler' in options) {\n options.tracesSampler = safeTracesSampler(options.tracesSampler);\n }\n\n if (!('environment' in options)) {\n options.environment = getDefaultEnvironment();\n }\n\n const defaultIntegrations: false | Integration[] = passedOptions.defaultIntegrations === undefined\n ? getDefaultIntegrations(options)\n : passedOptions.defaultIntegrations;\n\n options.integrations = getIntegrationsToSetup({\n integrations: safeFactory(passedOptions.integrations, { loggerMessage: 'The integrations threw an error' }),\n defaultIntegrations,\n });\n initAndBind(ReactNativeClient, options);\n\n if (isExpoGo()) {\n logger.info('Offline caching, native errors features are not available in Expo Go.');\n logger.info('Use EAS Build / Native Release Build to test these features.');\n }\n}\n\n/**\n * Inits the Sentry React Native SDK with automatic instrumentation and wrapped features.\n */\nexport function wrap<P extends Record<string, unknown>>(\n RootComponent: React.ComponentType<P>,\n options?: ReactNativeWrapperOptions\n): React.ComponentType<P> {\n const profilerProps = {\n ...(options?.profilerProps ?? {}),\n name: RootComponent.displayName ?? 'Root',\n };\n\n const RootApp: React.FC<P> = (appProps) => {\n return (\n <TouchEventBoundary {...(options?.touchEventBoundaryProps ?? {})}>\n <ReactNativeProfiler {...profilerProps}>\n <RootComponent {...appProps} />\n </ReactNativeProfiler>\n </TouchEventBoundary>\n );\n };\n\n return RootApp;\n}\n\n/**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\nexport function nativeCrash(): void {\n NATIVE.nativeCrash();\n}\n\n/**\n * Flushes all pending events in the queue to disk.\n * Use this before applying any realtime updates such as code-push or expo updates.\n */\nexport async function flush(): Promise<boolean> {\n try {\n const client = getClient();\n\n if (client) {\n const result = await client.flush();\n\n return result;\n }\n // eslint-disable-next-line no-empty\n } catch (_) { }\n\n logger.error('Failed to flush the event queue.');\n\n return false;\n}\n\n/**\n * Closes the SDK, stops sending events.\n */\nexport async function close(): Promise<void> {\n try {\n const client = getClient();\n\n if (client) {\n await client.close();\n }\n } catch (e) {\n logger.error('Failed to close the SDK');\n }\n}\n\n/**\n * Captures user feedback and sends it to Sentry.\n */\nexport function captureUserFeedback(feedback: UserFeedback): void {\n getClient<ReactNativeClient>()?.captureUserFeedback(feedback);\n}\n\n/**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n *\n * This is essentially a convenience function for:\n *\n * pushScope();\n * callback();\n * popScope();\n *\n * @param callback that will be enclosed into push/popScope.\n */\nexport function withScope<T>(callback: (scope: Scope) => T): T | undefined {\n const safeCallback = (scope: Scope): T | undefined => {\n try {\n return callback(scope);\n } catch (e) {\n logger.error('Error while running withScope callback', e);\n return undefined;\n }\n };\n return coreWithScope(safeCallback);\n}\n\n/**\n * Returns if the app crashed in the last run.\n */\nexport async function crashedLastRun(): Promise<boolean | null> {\n return NATIVE.crashedLastRun();\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import type { InputConfigT, Middleware } from 'metro-config';
2
+ /**
3
+ * Accepts Sentry formatted stack frames and
4
+ * adds source context to the in app frames.
5
+ */
6
+ export declare const stackFramesContextMiddleware: Middleware;
7
+ /**
8
+ * Creates a middleware that adds source context to the Sentry formatted stack frames.
9
+ */
10
+ export declare const createSentryMetroMiddleware: (middleware: HandleFunction) => HandleFunction;
11
+ /**
12
+ * Adds the Sentry middleware to the Metro server config.
13
+ */
14
+ export declare const withSentryMiddleware: (config: InputConfigT) => InputConfigT;
15
+ //# sourceMappingURL=metroMiddleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metroMiddleware.d.ts","sourceRoot":"","sources":["../../../src/js/tools/metroMiddleware.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK7D;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,UA+B1C,CAAC;AA2CF;;GAEG;AACH,eAAO,MAAM,2BAA2B,gDAOvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,WAAY,YAAY,KAAG,YAY3D,CAAC"}
@@ -0,0 +1,105 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.withSentryMiddleware = exports.createSentryMetroMiddleware = exports.stackFramesContextMiddleware = void 0;
3
+ const tslib_1 = require("tslib");
4
+ const utils_1 = require("@sentry/utils");
5
+ const fs_1 = require("fs");
6
+ const util_1 = require("util");
7
+ const readFileAsync = (0, util_1.promisify)(fs_1.readFile);
8
+ /**
9
+ * Accepts Sentry formatted stack frames and
10
+ * adds source context to the in app frames.
11
+ */
12
+ const stackFramesContextMiddleware = (request, response) => tslib_1.__awaiter(this, void 0, void 0, function* () {
13
+ utils_1.logger.debug('[@sentry/react-native/metro] Received request for stack frames context.');
14
+ request.setEncoding('utf8');
15
+ const rawBody = yield getRawBody(request);
16
+ let body = {};
17
+ try {
18
+ body = JSON.parse(rawBody);
19
+ }
20
+ catch (e) {
21
+ utils_1.logger.debug('[@sentry/react-native/metro] Could not parse request body.', e);
22
+ badRequest(response, 'Invalid request body. Expected a JSON object.');
23
+ return;
24
+ }
25
+ const stack = body.stack;
26
+ if (!Array.isArray(stack)) {
27
+ utils_1.logger.debug('[@sentry/react-native/metro] Invalid stack frames.', stack);
28
+ badRequest(response, 'Invalid stack frames. Expected an array.');
29
+ return;
30
+ }
31
+ const stackWithSourceContext = yield Promise.all(stack.map(addSourceContext));
32
+ response.setHeader('Content-Type', 'application/json');
33
+ response.statusCode = 200;
34
+ response.end(JSON.stringify({ stack: stackWithSourceContext }));
35
+ utils_1.logger.debug('[@sentry/react-native/metro] Sent stack frames context.');
36
+ });
37
+ exports.stackFramesContextMiddleware = stackFramesContextMiddleware;
38
+ function addSourceContext(frame) {
39
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
40
+ if (!frame.in_app) {
41
+ return frame;
42
+ }
43
+ try {
44
+ if (typeof frame.filename !== 'string') {
45
+ utils_1.logger.warn('[@sentry/react-native/metro] Could not read source context for frame without filename.');
46
+ return frame;
47
+ }
48
+ const source = yield readFileAsync(frame.filename, { encoding: 'utf8' });
49
+ const lines = source.split('\n');
50
+ (0, utils_1.addContextToFrame)(lines, frame);
51
+ }
52
+ catch (error) {
53
+ utils_1.logger.warn('[@sentry/react-native/metro] Could not read source context for frame.', error);
54
+ }
55
+ return frame;
56
+ });
57
+ }
58
+ function badRequest(response, message) {
59
+ response.statusCode = 400;
60
+ response.end(message);
61
+ }
62
+ function getRawBody(request) {
63
+ return new Promise((resolve, reject) => {
64
+ let data = '';
65
+ request.on('data', chunk => {
66
+ data += chunk;
67
+ });
68
+ request.on('end', () => {
69
+ resolve(data);
70
+ });
71
+ request.on('error', reject);
72
+ });
73
+ }
74
+ const SENTRY_MIDDLEWARE_PATH = '/__sentry';
75
+ const SENTRY_CONTEXT_REQUEST_PATH = `${SENTRY_MIDDLEWARE_PATH}/context`;
76
+ /**
77
+ * Creates a middleware that adds source context to the Sentry formatted stack frames.
78
+ */
79
+ const createSentryMetroMiddleware = (middleware) => {
80
+ return (request, response, next) => {
81
+ var _a;
82
+ if ((_a = request.url) === null || _a === void 0 ? void 0 : _a.startsWith(SENTRY_CONTEXT_REQUEST_PATH)) {
83
+ return (0, exports.stackFramesContextMiddleware)(request, response);
84
+ }
85
+ return middleware(request, response, next);
86
+ };
87
+ };
88
+ exports.createSentryMetroMiddleware = createSentryMetroMiddleware;
89
+ /**
90
+ * Adds the Sentry middleware to the Metro server config.
91
+ */
92
+ const withSentryMiddleware = (config) => {
93
+ if (!config.server) {
94
+ // @ts-expect-error server is typed read only
95
+ config.server = {};
96
+ }
97
+ const originalEnhanceMiddleware = config.server.enhanceMiddleware;
98
+ config.server.enhanceMiddleware = (middleware, server) => {
99
+ const sentryMiddleware = (0, exports.createSentryMetroMiddleware)(middleware);
100
+ return originalEnhanceMiddleware ? originalEnhanceMiddleware(sentryMiddleware, server) : sentryMiddleware;
101
+ };
102
+ return config;
103
+ };
104
+ exports.withSentryMiddleware = withSentryMiddleware;
105
+ //# sourceMappingURL=metroMiddleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metroMiddleware.js","sourceRoot":"","sources":["../../../src/js/tools/metroMiddleware.ts"],"names":[],"mappings":";;;AACA,yCAA0D;AAC1D,2BAA8B;AAG9B,+BAAiC;AAEjC,MAAM,aAAa,GAAG,IAAA,gBAAS,EAAC,aAAQ,CAAC,CAAC;AAE1C;;;GAGG;AACI,MAAM,4BAA4B,GAAe,CACtD,OAAwB,EACxB,QAAwB,EACT,EAAE;IACjB,cAAM,CAAC,KAAK,CAAC,yEAAyE,CAAC,CAAC;IACxF,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5B,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;IAE1C,IAAI,IAAI,GAEJ,EAAE,CAAC;IACP,IAAI;QACF,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC5B;IAAC,OAAO,CAAC,EAAE;QACV,cAAM,CAAC,KAAK,CAAC,4DAA4D,EAAE,CAAC,CAAC,CAAC;QAC9E,UAAU,CAAC,QAAQ,EAAE,+CAA+C,CAAC,CAAC;QACtE,OAAO;KACR;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACzB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACzB,cAAM,CAAC,KAAK,CAAC,oDAAoD,EAAE,KAAK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iB,CAAC;IAClE,MAAM,CAAC,MAAM,CAAC,iBAAiB,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE;QACvD,MAAM,gBAAgB,GAAG,IAAA,mCAA2B,EAAC,UAAU,CAAC,CAAC;QACjE,OAAO,yBAAyB,CAAC,CAAC,CAAC,yBAAyB,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC;IAC5G,CAAC,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAZW,QAAA,oBAAoB,wBAY/B","sourcesContent":["import type { StackFrame } from '@sentry/types';\nimport { addContextToFrame, logger } from '@sentry/utils';\nimport { readFile } from 'fs';\nimport type { IncomingMessage, ServerResponse } from 'http';\nimport type { InputConfigT, Middleware } from 'metro-config';\nimport { promisify } from 'util';\n\nconst readFileAsync = promisify(readFile);\n\n/**\n * Accepts Sentry formatted stack frames and\n * adds source context to the in app frames.\n */\nexport const stackFramesContextMiddleware: Middleware = async (\n request: IncomingMessage,\n response: ServerResponse,\n): Promise<void> => {\n logger.debug('[@sentry/react-native/metro] Received request for stack frames context.');\n request.setEncoding('utf8');\n const rawBody = await getRawBody(request);\n\n let body: {\n stack?: Partial<StackFrame>[];\n } = {};\n try {\n body = JSON.parse(rawBody);\n } catch (e) {\n logger.debug('[@sentry/react-native/metro] Could not parse request body.', e);\n badRequest(response, 'Invalid request body. Expected a JSON object.');\n return;\n }\n\n const stack = body.stack;\n if (!Array.isArray(stack)) {\n logger.debug('[@sentry/react-native/metro] Invalid stack frames.', stack);\n badRequest(response, 'Invalid stack frames. Expected an array.');\n return;\n }\n\n const stackWithSourceContext = await Promise.all(stack.map(addSourceContext));\n response.setHeader('Content-Type', 'application/json');\n response.statusCode = 200;\n response.end(JSON.stringify({ stack: stackWithSourceContext }));\n logger.debug('[@sentry/react-native/metro] Sent stack frames context.');\n};\n\nasync function addSourceContext(frame: StackFrame): Promise<StackFrame> {\n if (!frame.in_app) {\n return frame;\n }\n\n try {\n if (typeof frame.filename !== 'string') {\n logger.warn('[@sentry/react-native/metro] Could not read source context for frame without filename.');\n return frame;\n }\n\n const source = await readFileAsync(frame.filename, { encoding: 'utf8' });\n const lines = source.split('\\n');\n addContextToFrame(lines, frame);\n } catch (error) {\n logger.warn('[@sentry/react-native/metro] Could not read source context for frame.', error);\n }\n return frame;\n}\n\nfunction badRequest(response: ServerResponse, message: string): void {\n response.statusCode = 400;\n response.end(message);\n}\n\nfunction getRawBody(request: IncomingMessage): Promise<string> {\n return new Promise((resolve, reject) => {\n let data = '';\n request.on('data', chunk => {\n data += chunk;\n });\n request.on('end', () => {\n resolve(data);\n });\n request.on('error', reject);\n });\n}\n\nconst SENTRY_MIDDLEWARE_PATH = '/__sentry';\nconst SENTRY_CONTEXT_REQUEST_PATH = `${SENTRY_MIDDLEWARE_PATH}/context`;\n\n/**\n * Creates a middleware that adds source context to the Sentry formatted stack frames.\n */\nexport const createSentryMetroMiddleware = (middleware: Middleware): Middleware => {\n return (request: IncomingMessage, response: ServerResponse, next: unknown) => {\n if (request.url?.startsWith(SENTRY_CONTEXT_REQUEST_PATH)) {\n return stackFramesContextMiddleware(request, response);\n }\n return middleware(request, response, next);\n };\n};\n\n/**\n * Adds the Sentry middleware to the Metro server config.\n */\nexport const withSentryMiddleware = (config: InputConfigT): InputConfigT => {\n if (!config.server) {\n // @ts-expect-error server is typed read only\n config.server = {};\n }\n\n const originalEnhanceMiddleware = config.server.enhanceMiddleware;\n config.server.enhanceMiddleware = (middleware, server) => {\n const sentryMiddleware = createSentryMetroMiddleware(middleware);\n return originalEnhanceMiddleware ? originalEnhanceMiddleware(sentryMiddleware, server) : sentryMiddleware;\n };\n return config;\n};\n"]}
@@ -12,6 +12,12 @@ export interface SentryMetroConfigOptions {
12
12
  * @default true
13
13
  */
14
14
  includeWebReplay?: boolean;
15
+ /**
16
+ * Add Sentry Metro Server Middleware which
17
+ * enables the app to fetch stack frames source context.
18
+ * @default true
19
+ */
20
+ enableSourceContextInDevelopment?: boolean;
15
21
  }
16
22
  export interface SentryExpoConfigOptions {
17
23
  /**
@@ -25,7 +31,7 @@ export interface SentryExpoConfigOptions {
25
31
  * Adds Debug ID to the output bundle and source maps.
26
32
  * Collapses Sentry frames from the stack trace view in LogBox.
27
33
  */
28
- export declare function withSentryConfig(config: MetroConfig, { annotateReactComponents, includeWebReplay }?: SentryMetroConfigOptions): MetroConfig;
34
+ export declare function withSentryConfig(config: MetroConfig, { annotateReactComponents, includeWebReplay, enableSourceContextInDevelopment, }?: SentryMetroConfigOptions): MetroConfig;
29
35
  /**
30
36
  * This function returns Default Expo configuration with Sentry plugins.
31
37
  */
@@ -1 +1 @@
1
- {"version":3,"file":"metroconfig.d.ts","sourceRoot":"","sources":["../../../src/js/tools/metroconfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAsC,MAAM,OAAO,CAAC;AAQ7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,cAAc,yBAAyB,CAAC;AAIxC,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,mBAAmB,CAAC;CAC/C;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,WAAW,EACnB,EAAE,uBAA+B,EAAE,gBAAuB,EAAE,GAAE,wBAA6B,GAC1F,WAAW,CAeb;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,oBAAoB,GAAG,uBAAuB,GAAG,wBAA6B,GACtF,WAAW,CAsBb;AAsBD;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CA2B3E;AA4BD;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AM,EAAE,WAAW,GAAG,WAAW,CAiC1E"}
@@ -8,6 +8,7 @@ const enableLogger_1 = require("./enableLogger");
8
8
  const sentryBabelTransformerUtils_1 = require("./sentryBabelTransformerUtils");
9
9
  const sentryMetroSerializer_1 = require("./sentryMetroSerializer");
10
10
  tslib_1.__exportStar(require("./sentryMetroSerializer"), exports);
11
+ const metroMiddleware_1 = require("./metroMiddleware");
11
12
  (0, enableLogger_1.enableLogger)();
12
13
  /**
13
14
  * Adds Sentry to the Metro config.
@@ -15,7 +16,7 @@ tslib_1.__exportStar(require("./sentryMetroSerializer"), exports);
15
16
  * Adds Debug ID to the output bundle and source maps.
16
17
  * Collapses Sentry frames from the stack trace view in LogBox.
17
18
  */
18
- function withSentryConfig(config, { annotateReactComponents = false, includeWebReplay = true } = {}) {
19
+ function withSentryConfig(config, { annotateReactComponents = false, includeWebReplay = true, enableSourceContextInDevelopment = true, } = {}) {
19
20
  setSentryMetroDevServerEnvFlag();
20
21
  let newConfig = config;
21
22
  newConfig = withSentryDebugId(newConfig);
@@ -26,6 +27,9 @@ function withSentryConfig(config, { annotateReactComponents = false, includeWebR
26
27
  if (includeWebReplay === false) {
27
28
  newConfig = withSentryResolver(newConfig, includeWebReplay);
28
29
  }
30
+ if (enableSourceContextInDevelopment) {
31
+ newConfig = (0, metroMiddleware_1.withSentryMiddleware)(newConfig);
32
+ }
29
33
  return newConfig;
30
34
  }
31
35
  exports.withSentryConfig = withSentryConfig;
@@ -33,6 +37,7 @@ exports.withSentryConfig = withSentryConfig;
33
37
  * This function returns Default Expo configuration with Sentry plugins.
34
38
  */
35
39
  function getSentryExpoConfig(projectRoot, options = {}) {
40
+ var _a;
36
41
  setSentryMetroDevServerEnvFlag();
37
42
  const getDefaultConfig = options.getDefaultConfig || loadExpoMetroConfigModule().getDefaultConfig;
38
43
  const config = getDefaultConfig(projectRoot, Object.assign(Object.assign({}, options), { unstable_beforeAssetSerializationPlugins: [
@@ -46,6 +51,9 @@ function getSentryExpoConfig(projectRoot, options = {}) {
46
51
  if (options.includeWebReplay === false) {
47
52
  newConfig = withSentryResolver(newConfig, options.includeWebReplay);
48
53
  }
54
+ if ((_a = options.enableSourceContextInDevelopment) !== null && _a !== void 0 ? _a : true) {
55
+ newConfig = (0, metroMiddleware_1.withSentryMiddleware)(newConfig);
56
+ }
49
57
  return newConfig;
50
58
  }
51
59
  exports.getSentryExpoConfig = getSentryExpoConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"metroconfig.js","sourceRoot":"","sources":["../../../src/js/tools/metroconfig.ts"],"names":[],"mappings":";;;AAAA,yCAAuC;AAGvC,mCAAmC;AACnC,qCAA8B;AAE9B,iDAA8C;AAC9C,+EAAkH;AAClH,mEAA+G;AAE/G,kEAAwC;AAExC,IAAA,2BAAY,GAAE,CAAC;AAsBf;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC9B,MAAmB,EACnB,EAAE,uBAAuB,GAAG,KAAK,EAAE,gBAAgB,GAAG,IAAI,KAA+B,EAAE;IAE3F,8BAA8B,EAAE,CAAC;IAEjC,IAAI,SAAS,GAAG,MAAM,CAAC;IAEvB,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACzC,SAAS,GAAG,yBAAyB,CAAC,SAAS,CAAC,CAAC;IACjD,IAAI,uBAAuB,EAAE;QAC3B,SAAS,GAAG,0BAA0B,CAAC,SAAS,CAAC,CAAC;KACnD;IACD,IAAI,gBAAgB,KAAK,KAAK,EAAE;QAC9B,SAAS,GAAG,kBAAkB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;KAC7D;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAlBD,4CAkBC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CACjC,WAAmB,EACnB,UAAqF,EAAE;IAEvF,8BAA8B,EAAE,CAAC;IAEjC,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,yBAAyB,EAAE,CAAC,gBAAgB,CAAC;IAClG,MAAM,MAAM,GA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CAAC,qBAAqB,CAAC,CACtD,CAAC;SACH;QAED,OAAO,8BAA8B,CAAC,yBAAyB,CAAC,CAAC;IACnE,CAAC,CAAC;IAEF,uCACK,MAAM,KACT,YAAY,kCACP,MAAM,CAAC,YAAY,KACtB,cAAc,OAEhB;AACJ,CAAC;AAjCD,8DAiCC;AAED;;;;GAIG;AACH,SAAS,8BAA8B;IACrC,aAAG,CAAC,6BAA6B,GAAG,MAAM,CAAC;AAC7C,CAAC","sourcesContent":["import { logger } from '@sentry/utils';\nimport type { MetroConfig, MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport type { CustomResolutionContext, CustomResolver, Resolution } from 'metro-resolver';\nimport * as process from 'process';\nimport { env } from 'process';\n\nimport { enableLogger } from './enableLogger';\nimport { cleanDefaultBabelTransformerPath, saveDefaultBabelTransformerPath } from './sentryBabelTransformerUtils';\nimport { createSentryMetroSerializer, unstable_beforeAssetSerializationPlugin } from './sentryMetroSerializer';\nimport type { DefaultConfigOptions } from './vendor/expo/expoconfig';\nexport * from './sentryMetroSerializer';\n\nenableLogger();\n\nexport interface SentryMetroConfigOptions {\n /**\n * Annotates React components with Sentry data.\n * @default false\n */\n annotateReactComponents?: boolean;\n /**\n * Adds the Sentry replay package for web.\n * @default true\n */\n includeWebReplay?: boolean;\n}\n\nexport interface SentryExpoConfigOptions {\n /**\n * Pass a custom `getDefaultConfig` function to override the default Expo configuration getter.\n */\n getDefaultConfig?: typeof getSentryExpoConfig;\n}\n\n/**\n * Adds Sentry to the Metro config.\n *\n * Adds Debug ID to the output bundle and source maps.\n * Collapses Sentry frames from the stack trace view in LogBox.\n */\nexport function withSentryConfig(\n config: MetroConfig,\n { annotateReactComponents = false, includeWebReplay = true }: SentryMetroConfigOptions = {},\n): MetroConfig {\n setSentryMetroDevServerEnvFlag();\n\n let newConfig = config;\n\n newConfig = withSentryDebugId(newConfig);\n newConfig = withSentryFramesCollapsed(newConfig);\n if (annotateReactComponents) {\n newConfig = withSentryBabelTransformer(newConfig);\n }\n if (includeWebReplay === false) {\n newConfig = withSentryResolver(newConfig, includeWebReplay);\n }\n\n return newConfig;\n}\n\n/**\n * This function returns Default Expo configuration with Sentry plugins.\n */\nexport function getSentryExpoConfig(\n projectRoot: string,\n options: DefaultConfigOptions & SentryExpoConfigOptions & SentryMetroConfigOptions = {},\n): MetroConfig {\n setSentryMetroDevServerEnvFlag();\n\n const getDefaultConfig = options.getDefaultConfig || loadExpoMetroConfigModule().getDefaultConfig;\n const config = getDefaultConfig(projectRoot, {\n ...options,\n unstable_beforeAssetSerializationPlugins: [\n ...(options.unstable_beforeAssetSerializationPlugins || []),\n unstable_beforeAssetSerializationPlugin,\n ],\n });\n\n let newConfig = withSentryFramesCollapsed(config);\n if (options.annotateReactComponents) {\n newConfig = withSentryBabelTransformer(newConfig);\n }\n\n if (options.includeWebReplay === false) {\n newConfig = withSentryResolver(newConfig, options.includeWebReplay);\n }\n\n return newConfig;\n}\n\nfunction loadExpoMetroConfigModule(): {\n getDefaultConfig: (\n projectRoot: string,\n options: {\n unstable_beforeAssetSerializationPlugins?: ((serializationInput: {\n graph: ReadOnlyGraph<MixedOutput>;\n premodules: Module[];\n debugId?: string;\n }) => Module[])[];\n },\n ) => MetroConfig;\n} {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n return require('expo/metro-config');\n } catch (e) {\n throw new Error('Unable to load `expo/metro-config`. Make sure you have Expo installed.');\n }\n}\n\n/**\n * Adds Sentry Babel transformer to the Metro config.\n */\nexport function withSentryBabelTransformer(config: MetroConfig): MetroConfig {\n const defaultBabelTransformerPath = config.transformer && config.transformer.babelTransformerPath;\n logger.debug('Default Babel transformer path from `config.transformer`:', defaultBabelTransformerPath);\n\n if (!defaultBabelTransformerPath) {\n // This has to be console.warn because the options is enabled but won't be used\n // eslint-disable-next-line no-console\n console.warn('`transformer.babelTransformerPath` is undefined.');\n // eslint-disable-next-line no-console\n console.warn('Sentry Babel transformer cannot be used. Not adding it...');\n return config;\n }\n\n if (defaultBabelTransformerPath) {\n saveDefaultBabelTransformerPath(defaultBabelTransformerPath);\n process.on('exit', () => {\n cleanDefaultBabelTransformerPath();\n });\n }\n\n return {\n ...config,\n transformer: {\n ...config.transformer,\n babelTransformerPath: require.resolve('./sentryBabelTransformer'),\n },\n };\n}\n\ntype MetroCustomSerializer = Required<Required<MetroConfig>['serializer']>['customSerializer'] | undefined;\n\nfunction withSentryDebugId(config: MetroConfig): MetroConfig {\n const customSerializer = createSentryMetroSerializer(\n config.serializer?.customSerializer || undefined,\n ) as MetroCustomSerializer;\n // MetroConfig types customSerializers as async only, but sync returns are also supported\n // The default serializer is sync\n\n return {\n ...config,\n serializer: {\n ...config.serializer,\n customSerializer,\n },\n };\n}\n\n// Based on: https://github.com/facebook/metro/blob/c21daba415ea26511e157f794689caab9abe8236/packages/metro-resolver/src/resolve.js#L86-L91\ntype CustomResolverBeforeMetro068 = (\n context: CustomResolutionContext,\n realModuleName: string,\n platform: string | null,\n moduleName?: string,\n) => Resolution;\n\n/**\n * Includes `@sentry/replay` packages based on the `includeWebReplay` flag and current bundle `platform`.\n */\nexport function withSentryResolver(config: MetroConfig, includeWebReplay: boolean | undefined): MetroConfig {\n const originalResolver = config.resolver?.resolveRequest as CustomResolver | CustomResolverBeforeMetro068 | undefined;\n\n const sentryResolverRequest: CustomResolver = (\n context: CustomResolutionContext,\n moduleName: string,\n platform: string | null,\n oldMetroModuleName?: string,\n ) => {\n if (\n (includeWebReplay === false ||\n (includeWebReplay === undefined && (platform === 'android' || platform === 'ios'))) &&\n (oldMetroModuleName ?? moduleName).includes('@sentry/replay')\n ) {\n return { type: 'empty' } as Resolution;\n }\n if (originalResolver) {\n return oldMetroModuleName\n ? originalResolver(context, moduleName, platform, oldMetroModuleName)\n : originalResolver(context, moduleName, platform);\n }\n\n // Prior 0.68, resolve context.resolveRequest is sentryResolver itself, where on later version it is the default resolver.\n if (context.resolveRequest === sentryResolverRequest) {\n // eslint-disable-next-line no-console\n console.error(\n `Error: [@sentry/react-native/metro] Can not resolve the defaultResolver on Metro older than 0.68.\nPlease follow one of the following options:\n- Include your resolverRequest on your metroconfig.\n- Update your Metro version to 0.68 or higher.\n- Set includeWebReplay as true on your metro config.\n- If you are still facing issues, report the issue at http://www.github.com/getsentry/sentry-react-native/issues`,\n );\n // Return required for test.\n return process.exit(-1);\n }\n\n return context.resolveRequest(context, moduleName, platform);\n };\n\n return {\n ...config,\n resolver: {\n ...config.resolver,\n resolveRequest: sentryResolverRequest,\n },\n };\n}\n\ntype MetroFrame = Parameters<Required<Required<MetroConfig>['symbolicator']>['customizeFrame']>[0];\ntype MetroCustomizeFrame = { readonly collapse?: boolean };\ntype MetroCustomizeFrameReturnValue =\n | ReturnType<Required<Required<MetroConfig>['symbolicator']>['customizeFrame']>\n | undefined;\n\n/**\n * Collapses Sentry internal frames from the stack trace view in LogBox.\n */\nexport function withSentryFramesCollapsed(config: MetroConfig): MetroConfig {\n const originalCustomizeFrame = config.symbolicator?.customizeFrame;\n const collapseSentryInternalFrames = (frame: MetroFrame): boolean =>\n typeof frame.file === 'string' &&\n (frame.file.includes('node_modules/@sentry/utils/cjs/instrument.js') ||\n frame.file.includes('node_modules/@sentry/utils/cjs/logger.js'));\n\n const customizeFrame = (frame: MetroFrame): MetroCustomizeFrameReturnValue => {\n const originalOrSentryCustomizeFrame = (\n originalCustomization: MetroCustomizeFrame | undefined,\n ): MetroCustomizeFrame => ({\n ...originalCustomization,\n collapse: (originalCustomization && originalCustomization.collapse) || collapseSentryInternalFrames(frame),\n });\n\n const maybePromiseCustomization = (originalCustomizeFrame && originalCustomizeFrame(frame)) || undefined;\n\n if (maybePromiseCustomization !== undefined && 'then' in maybePromiseCustomization) {\n return maybePromiseCustomization.then<MetroCustomizeFrame>(originalCustomization =>\n originalOrSentryCustomizeFrame(originalCustomization),\n );\n }\n\n return originalOrSentryCustomizeFrame(maybePromiseCustomization);\n };\n\n return {\n ...config,\n symbolicator: {\n ...config.symbolicator,\n customizeFrame,\n },\n };\n}\n\n/**\n * Sets the `___SENTRY_METRO_DEV_SERVER___` environment flag.\n * This is used to determine if the SDK is running in Node in Metro Dev Server.\n * For example during static routes generation in `expo-router`.\n */\nfunction setSentryMetroDevServerEnvFlag(): void {\n env.___SENTRY_METRO_DEV_SERVER___ = 'true';\n}\n"]}
1
+ {"version":3,"file":"metroconfig.js","sourceRoot":"","sources":["../../../src/js/tools/metroconfig.ts"],"names":[],"mappings":";;;AAAA,yCAAuC;AAGvC,mCAAmC;AACnC,qCAA8B;AAE9B,iDAA8C;AAC9C,+EAAkH;AAClH,mEAA+G;AAE/G,kEAAwC;AACxC,uDAAyD;AAEzD,IAAA,2BAAY,GAAE,CAAC;AA4Bf;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC9B,MAAmB,EACnB,EACE,uBAAuB,GAAG,KAAK,EAC/B,gBAAgB,GAAG,IAAI,EACvB,gCAAgC,GAAG,IAAI,MACX,EAAE;IAEhC,8BAA8B,EAAE,CAAC;IAEjC,IAAI,SAAS,GAAG,MAAM,CAAC;IAEvB,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACzC,SAAS,GAAG,yBAAyB,CAAC,SAAS,CAAC,CAAC;IACjD,IAAI,uBAAuB,EAAE;QAC3B,SAAS,GAAG,0BAA0B,CAAC,SAAS,CAAC,CAAC;KACnD;IACD,IAAI,gBAAgB,KAAK,KAAK,EAAE;QAC9B,SAAS,GAAG,kBAAkB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;KAC7D;IACD,IAAI,gCAAgC,EAAE;QACpC,SAAS,GAAG,IAAA,sCAAoB,EAAC,SAAS,CAAC,CAAC;KAC7C;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAzBD,4CAyBC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CACjC,WAAmB,EACnB,UAAqF,EAAE;;IAEvF,8BAA8B,EAAE,CAAC;IAEjC,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,yBAAyB,EAAE,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C,IAAI,SAAS,CAAC;QAEzG,IAAI,yBAAyB,KAAK,SAAS,IAAI,MAAM,IAAI,yBAAyB,EAAE;YAClF,OAAO,yBAAyB,CAAC,IAAI,CAAsB,qBAAqB,CAAC,EAAE,CACjF,8BAA8B,CAAC,qBAAqB,CAAC,CACtD,CAAC;SACH;QAED,OAAO,8BAA8B,CAAC,yBAAyB,CAAC,CAAC;IACnE,CAAC,CAAC;IAEF,uCACK,MAAM,KACT,YAAY,kCACP,MAAM,CAAC,YAAY,KACtB,cAAc,OAEhB;AACJ,CAAC;AAjCD,8DAiCC;AAED;;;;GAIG;AACH,SAAS,8BAA8B;IACrC,aAAG,CAAC,6BAA6B,GAAG,MAAM,CAAC;AAC7C,CAAC","sourcesContent":["import { logger } from '@sentry/utils';\nimport type { MetroConfig, MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport type { CustomResolutionContext, CustomResolver, Resolution } from 'metro-resolver';\nimport * as process from 'process';\nimport { env } from 'process';\n\nimport { enableLogger } from './enableLogger';\nimport { cleanDefaultBabelTransformerPath, saveDefaultBabelTransformerPath } from './sentryBabelTransformerUtils';\nimport { createSentryMetroSerializer, unstable_beforeAssetSerializationPlugin } from './sentryMetroSerializer';\nimport type { DefaultConfigOptions } from './vendor/expo/expoconfig';\nexport * from './sentryMetroSerializer';\nimport { withSentryMiddleware } from './metroMiddleware';\n\nenableLogger();\n\nexport interface SentryMetroConfigOptions {\n /**\n * Annotates React components with Sentry data.\n * @default false\n */\n annotateReactComponents?: boolean;\n /**\n * Adds the Sentry replay package for web.\n * @default true\n */\n includeWebReplay?: boolean;\n /**\n * Add Sentry Metro Server Middleware which\n * enables the app to fetch stack frames source context.\n * @default true\n */\n enableSourceContextInDevelopment?: boolean;\n}\n\nexport interface SentryExpoConfigOptions {\n /**\n * Pass a custom `getDefaultConfig` function to override the default Expo configuration getter.\n */\n getDefaultConfig?: typeof getSentryExpoConfig;\n}\n\n/**\n * Adds Sentry to the Metro config.\n *\n * Adds Debug ID to the output bundle and source maps.\n * Collapses Sentry frames from the stack trace view in LogBox.\n */\nexport function withSentryConfig(\n config: MetroConfig,\n {\n annotateReactComponents = false,\n includeWebReplay = true,\n enableSourceContextInDevelopment = true,\n }: SentryMetroConfigOptions = {},\n): MetroConfig {\n setSentryMetroDevServerEnvFlag();\n\n let newConfig = config;\n\n newConfig = withSentryDebugId(newConfig);\n newConfig = withSentryFramesCollapsed(newConfig);\n if (annotateReactComponents) {\n newConfig = withSentryBabelTransformer(newConfig);\n }\n if (includeWebReplay === false) {\n newConfig = withSentryResolver(newConfig, includeWebReplay);\n }\n if (enableSourceContextInDevelopment) {\n newConfig = withSentryMiddleware(newConfig);\n }\n\n return newConfig;\n}\n\n/**\n * This function returns Default Expo configuration with Sentry plugins.\n */\nexport function getSentryExpoConfig(\n projectRoot: string,\n options: DefaultConfigOptions & SentryExpoConfigOptions & SentryMetroConfigOptions = {},\n): MetroConfig {\n setSentryMetroDevServerEnvFlag();\n\n const getDefaultConfig = options.getDefaultConfig || loadExpoMetroConfigModule().getDefaultConfig;\n const config = getDefaultConfig(projectRoot, {\n ...options,\n unstable_beforeAssetSerializationPlugins: [\n ...(options.unstable_beforeAssetSerializationPlugins || []),\n unstable_beforeAssetSerializationPlugin,\n ],\n });\n\n let newConfig = withSentryFramesCollapsed(config);\n if (options.annotateReactComponents) {\n newConfig = withSentryBabelTransformer(newConfig);\n }\n\n if (options.includeWebReplay === false) {\n newConfig = withSentryResolver(newConfig, options.includeWebReplay);\n }\n\n if (options.enableSourceContextInDevelopment ?? true) {\n newConfig = withSentryMiddleware(newConfig);\n }\n\n return newConfig;\n}\n\nfunction loadExpoMetroConfigModule(): {\n getDefaultConfig: (\n projectRoot: string,\n options: {\n unstable_beforeAssetSerializationPlugins?: ((serializationInput: {\n graph: ReadOnlyGraph<MixedOutput>;\n premodules: Module[];\n debugId?: string;\n }) => Module[])[];\n },\n ) => MetroConfig;\n} {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n return require('expo/metro-config');\n } catch (e) {\n throw new Error('Unable to load `expo/metro-config`. Make sure you have Expo installed.');\n }\n}\n\n/**\n * Adds Sentry Babel transformer to the Metro config.\n */\nexport function withSentryBabelTransformer(config: MetroConfig): MetroConfig {\n const defaultBabelTransformerPath = config.transformer && config.transformer.babelTransformerPath;\n logger.debug('Default Babel transformer path from `config.transformer`:', defaultBabelTransformerPath);\n\n if (!defaultBabelTransformerPath) {\n // This has to be console.warn because the options is enabled but won't be used\n // eslint-disable-next-line no-console\n console.warn('`transformer.babelTransformerPath` is undefined.');\n // eslint-disable-next-line no-console\n console.warn('Sentry Babel transformer cannot be used. Not adding it...');\n return config;\n }\n\n if (defaultBabelTransformerPath) {\n saveDefaultBabelTransformerPath(defaultBabelTransformerPath);\n process.on('exit', () => {\n cleanDefaultBabelTransformerPath();\n });\n }\n\n return {\n ...config,\n transformer: {\n ...config.transformer,\n babelTransformerPath: require.resolve('./sentryBabelTransformer'),\n },\n };\n}\n\ntype MetroCustomSerializer = Required<Required<MetroConfig>['serializer']>['customSerializer'] | undefined;\n\nfunction withSentryDebugId(config: MetroConfig): MetroConfig {\n const customSerializer = createSentryMetroSerializer(\n config.serializer?.customSerializer || undefined,\n ) as MetroCustomSerializer;\n // MetroConfig types customSerializers as async only, but sync returns are also supported\n // The default serializer is sync\n\n return {\n ...config,\n serializer: {\n ...config.serializer,\n customSerializer,\n },\n };\n}\n\n// Based on: https://github.com/facebook/metro/blob/c21daba415ea26511e157f794689caab9abe8236/packages/metro-resolver/src/resolve.js#L86-L91\ntype CustomResolverBeforeMetro068 = (\n context: CustomResolutionContext,\n realModuleName: string,\n platform: string | null,\n moduleName?: string,\n) => Resolution;\n\n/**\n * Includes `@sentry/replay` packages based on the `includeWebReplay` flag and current bundle `platform`.\n */\nexport function withSentryResolver(config: MetroConfig, includeWebReplay: boolean | undefined): MetroConfig {\n const originalResolver = config.resolver?.resolveRequest as CustomResolver | CustomResolverBeforeMetro068 | undefined;\n\n const sentryResolverRequest: CustomResolver = (\n context: CustomResolutionContext,\n moduleName: string,\n platform: string | null,\n oldMetroModuleName?: string,\n ) => {\n if (\n (includeWebReplay === false ||\n (includeWebReplay === undefined && (platform === 'android' || platform === 'ios'))) &&\n (oldMetroModuleName ?? moduleName).includes('@sentry/replay')\n ) {\n return { type: 'empty' } as Resolution;\n }\n if (originalResolver) {\n return oldMetroModuleName\n ? originalResolver(context, moduleName, platform, oldMetroModuleName)\n : originalResolver(context, moduleName, platform);\n }\n\n // Prior 0.68, resolve context.resolveRequest is sentryResolver itself, where on later version it is the default resolver.\n if (context.resolveRequest === sentryResolverRequest) {\n // eslint-disable-next-line no-console\n console.error(\n `Error: [@sentry/react-native/metro] Can not resolve the defaultResolver on Metro older than 0.68.\nPlease follow one of the following options:\n- Include your resolverRequest on your metroconfig.\n- Update your Metro version to 0.68 or higher.\n- Set includeWebReplay as true on your metro config.\n- If you are still facing issues, report the issue at http://www.github.com/getsentry/sentry-react-native/issues`,\n );\n // Return required for test.\n return process.exit(-1);\n }\n\n return context.resolveRequest(context, moduleName, platform);\n };\n\n return {\n ...config,\n resolver: {\n ...config.resolver,\n resolveRequest: sentryResolverRequest,\n },\n };\n}\n\ntype MetroFrame = Parameters<Required<Required<MetroConfig>['symbolicator']>['customizeFrame']>[0];\ntype MetroCustomizeFrame = { readonly collapse?: boolean };\ntype MetroCustomizeFrameReturnValue =\n | ReturnType<Required<Required<MetroConfig>['symbolicator']>['customizeFrame']>\n | undefined;\n\n/**\n * Collapses Sentry internal frames from the stack trace view in LogBox.\n */\nexport function withSentryFramesCollapsed(config: MetroConfig): MetroConfig {\n const originalCustomizeFrame = config.symbolicator?.customizeFrame;\n const collapseSentryInternalFrames = (frame: MetroFrame): boolean =>\n typeof frame.file === 'string' &&\n (frame.file.includes('node_modules/@sentry/utils/cjs/instrument.js') ||\n frame.file.includes('node_modules/@sentry/utils/cjs/logger.js'));\n\n const customizeFrame = (frame: MetroFrame): MetroCustomizeFrameReturnValue => {\n const originalOrSentryCustomizeFrame = (\n originalCustomization: MetroCustomizeFrame | undefined,\n ): MetroCustomizeFrame => ({\n ...originalCustomization,\n collapse: (originalCustomization && originalCustomization.collapse) || collapseSentryInternalFrames(frame),\n });\n\n const maybePromiseCustomization = (originalCustomizeFrame && originalCustomizeFrame(frame)) || undefined;\n\n if (maybePromiseCustomization !== undefined && 'then' in maybePromiseCustomization) {\n return maybePromiseCustomization.then<MetroCustomizeFrame>(originalCustomization =>\n originalOrSentryCustomizeFrame(originalCustomization),\n );\n }\n\n return originalOrSentryCustomizeFrame(maybePromiseCustomization);\n };\n\n return {\n ...config,\n symbolicator: {\n ...config.symbolicator,\n customizeFrame,\n },\n };\n}\n\n/**\n * Sets the `___SENTRY_METRO_DEV_SERVER___` environment flag.\n * This is used to determine if the SDK is running in Node in Metro Dev Server.\n * For example during static routes generation in `expo-router`.\n */\nfunction setSentryMetroDevServerEnvFlag(): void {\n env.___SENTRY_METRO_DEV_SERVER___ = 'true';\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"reactnativetracing.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAS,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAKlF,eAAO,MAAM,gBAAgB,uBAAuB,CAAC;AAErD,MAAM,WAAW,yBAAyB;IACxC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAE3B;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,gBAAgB,CAAC;IAElE;;;;;OAKG;IACH,0BAA0B,CAAC,CAAC,IAAI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D,eAAO,MAAM,gCAAgC,EAAE,yBAI9C,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,6BAA6B,aAC/B,QAAQ,yBAAyB,CAAC;aAElC,yBAAyB;WAC3B,uBAAuB;6BACL,MAAM,KAAK,IAAI;CA6DzC,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAE7F;;GAEG;AACH,wBAAgB,uCAAuC,IAAI,6BAA6B,GAAG,SAAS,CAOnG;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,MAAM,GAAG,6BAA6B,GAAG,SAAS,CAE1G"}
@@ -2,6 +2,7 @@
2
2
  import { instrumentOutgoingRequests } from '@sentry/browser';
3
3
  import { getClient } from '@sentry/core';
4
4
  import { isWeb } from '../utils/environment';
5
+ import { getDevServer } from './../integrations/debugsymbolicatorutils';
5
6
  import { addDefaultOpForSpanFrom, defaultIdleOptions } from './span';
6
7
  export const INTEGRATION_NAME = 'ReactNativeTracing';
7
8
  function getDefaultTracePropagationTargets() {
@@ -16,11 +17,26 @@ export const defaultReactNativeTracingOptions = {
16
17
  enableHTTPTimings: true,
17
18
  };
18
19
  export const reactNativeTracingIntegration = (options = {}) => {
19
- var _a, _b, _c;
20
+ var _a, _b, _c, _d;
20
21
  const state = {
21
22
  currentRoute: undefined,
22
23
  };
23
24
  const finalOptions = Object.assign(Object.assign(Object.assign({}, defaultReactNativeTracingOptions), options), { beforeStartSpan: (_a = options.beforeStartSpan) !== null && _a !== void 0 ? _a : ((options) => options), finalTimeoutMs: (_b = options.finalTimeoutMs) !== null && _b !== void 0 ? _b : defaultIdleOptions.finalTimeout, idleTimeoutMs: (_c = options.idleTimeoutMs) !== null && _c !== void 0 ? _c : defaultIdleOptions.idleTimeout });
25
+ const userShouldCreateSpanForRequest = finalOptions.shouldCreateSpanForRequest;
26
+ // Drop Dev Server Spans
27
+ const devServerUrl = (_d = getDevServer()) === null || _d === void 0 ? void 0 : _d.url;
28
+ const finalShouldCreateSpanForRequest = devServerUrl === undefined
29
+ ? userShouldCreateSpanForRequest
30
+ : (url) => {
31
+ if (url.startsWith(devServerUrl)) {
32
+ return false;
33
+ }
34
+ if (userShouldCreateSpanForRequest) {
35
+ return userShouldCreateSpanForRequest(url);
36
+ }
37
+ return true;
38
+ };
39
+ finalOptions.shouldCreateSpanForRequest = finalShouldCreateSpanForRequest;
24
40
  const setup = (client) => {
25
41
  addDefaultOpForSpanFrom(client);
26
42
  instrumentOutgoingRequests(client, {
@@ -1 +1 @@
1
- {"version":3,"file":"reactnativetracing.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnativetracing.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAErE,MAAM,CAAC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AAuDrD,SAAS,iCAAiC;IACxC,IAAI,KAAK,EAAE,EAAE;QACX,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,gCAAgC,GAA8B;IACzE,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,IAAI;IACd,iBAAiB,EAAE,IAAI;CACxB,CAAC;AAMF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,UAA8C,EAAE,EAKhD,EAAE;;IACF,MAAM,KAAK,GAA4B;QACrC,YAAY,EAAE,SAAS;KACxB,CAAC;IAEF,MAAM,YAAY,iDACb,gCAAgC,GAChC,OAAO,K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OAAO,SAAS,CAAC;KAClB;IAED,OAAO,gCAAgC,CAAC,MAAM,CAAC,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gCAAgC,CAAC,MAAc;IAC7D,OAAO,MAAM,CAAC,oBAAoB,CAAC,gBAAgB,CAA8C,CAAC;AACpG,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport { instrumentOutgoingRequests } from '@sentry/browser';\nimport { getClient } from '@sentry/core';\nimport type { Client, Event, Integration, StartSpanOptions } from '@sentry/types';\n\nimport { isWeb } from '../utils/environment';\nimport { addDefaultOpForSpanFrom, defaultIdleOptions } from './span';\n\nexport const INTEGRATION_NAME = 'ReactNativeTracing';\n\nexport interface ReactNativeTracingOptions {\n /**\n * The time that has to pass without any span being created.\n * If this time is exceeded, the idle span will finish.\n *\n * @default 1_000 (ms)\n */\n idleTimeoutMs?: number;\n\n /**\n * The max. time an idle span may run.\n * If this time is exceeded, the idle span will finish no matter what.\n *\n * @default 60_0000 (ms)\n */\n finalTimeoutMs?: number;\n\n /**\n * Flag to disable patching all together for fetch requests.\n *\n * @default true\n */\n traceFetch: boolean;\n\n /**\n * Flag to disable patching all together for xhr requests.\n *\n * @default true\n */\n traceXHR: boolean;\n\n /**\n * If true, Sentry will capture http timings and add them to the corresponding http spans.\n *\n * @default true\n */\n enableHTTPTimings: boolean;\n\n /**\n * A callback which is called before a span for a navigation is started.\n * It receives the options passed to `startSpan`, and expects to return an updated options object.\n */\n beforeStartSpan?: (options: StartSpanOptions) => StartSpanOptions;\n\n /**\n * This function will be called before creating a span for a request with the given url.\n * Return false if you don't want a span for the given url.\n *\n * @default (url: string) => true\n */\n shouldCreateSpanForRequest?(this: void, url: string): boolean;\n}\n\nfunction getDefaultTracePropagationTargets(): RegExp[] | undefined {\n if (isWeb()) {\n return undefined;\n }\n return [/.*/];\n}\n\nexport const defaultReactNativeTracingOptions: ReactNativeTracingOptions = {\n traceFetch: true,\n traceXHR: true,\n enableHTTPTimings: true,\n};\n\nexport type ReactNativeTracingState = {\n currentRoute: string | undefined;\n};\n\nexport const reactNativeTracingIntegration = (\n options: Partial<ReactNativeTracingOptions> = {},\n): Integration & {\n options: ReactNativeTracingOptions;\n state: ReactNativeTracingState;\n setCurrentRoute: (route: string) => void;\n} => {\n const state: ReactNativeTracingState = {\n currentRoute: undefined,\n };\n\n const finalOptions = {\n ...defaultReactNativeTracingOptions,\n ...options,\n beforeStartSpan: options.beforeStartSpan ?? ((options: StartSpanOptions) => options),\n finalTimeoutMs: options.finalTimeoutMs ?? defaultIdleOptions.finalTimeout,\n idleTimeoutMs: options.idleTimeoutMs ?? defaultIdleOptions.idleTimeout,\n };\n\n const setup = (client: Client): void => {\n addDefaultOpForSpanFrom(client);\n\n instrumentOutgoingRequests(client, {\n traceFetch: finalOptions.traceFetch,\n traceXHR: finalOptions.traceXHR,\n shouldCreateSpanForRequest: finalOptions.shouldCreateSpanForRequest,\n tracePropagationTargets: client.getOptions().tracePropagationTargets || getDefaultTracePropagationTargets(),\n });\n };\n\n const processEvent = (event: Event): Event => {\n if (event.contexts && state.currentRoute) {\n event.contexts.app = { view_names: [state.currentRoute], ...event.contexts.app };\n }\n return event;\n };\n\n return {\n name: INTEGRATION_NAME,\n setup,\n processEvent,\n options: finalOptions,\n state,\n setCurrentRoute: (route: string) => {\n state.currentRoute = route;\n },\n };\n};\n\nexport type ReactNativeTracingIntegration = ReturnType<typeof reactNativeTracingIntegration>;\n\n/**\n * Returns the current React Native Tracing integration.\n */\nexport function getCurrentReactNativeTracingIntegration(): ReactNativeTracingIntegration | undefined {\n const client = getClient();\n if (!client) {\n return undefined;\n }\n\n return getReactNativeTracingIntegration(client);\n}\n\n/**\n * Returns React Native Tracing integration of given client.\n */\nexport function getReactNativeTracingIntegration(client: Client): ReactNativeTracingIntegration | undefined {\n return client.getIntegrationByName(INTEGRATION_NAME) as ReactNativeTracingIntegration | undefined;\n}\n"]}
1
+ {"version":3,"file":"reactnativetracing.js","sourceRoot":"","sources":["../../../src/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M,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,gCAAgC,CAAC,MAAM,CAAC,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gCAAgC,CAAC,MAAc;IAC7D,OAAO,MAAM,CAAC,oBAAoB,CAAC,gBAAgB,CAA8C,CAAC;AACpG,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport { instrumentOutgoingRequests } from '@sentry/browser';\nimport { getClient } from '@sentry/core';\nimport type { Client, Event, Integration, StartSpanOptions } from '@sentry/types';\n\nimport { isWeb } from '../utils/environment';\nimport { getDevServer } from './../integrations/debugsymbolicatorutils';\nimport { addDefaultOpForSpanFrom, defaultIdleOptions } from './span';\n\nexport const INTEGRATION_NAME = 'ReactNativeTracing';\n\nexport interface ReactNativeTracingOptions {\n /**\n * The time that has to pass without any span being created.\n * If this time is exceeded, the idle span will finish.\n *\n * @default 1_000 (ms)\n */\n idleTimeoutMs?: number;\n\n /**\n * The max. time an idle span may run.\n * If this time is exceeded, the idle span will finish no matter what.\n *\n * @default 60_0000 (ms)\n */\n finalTimeoutMs?: number;\n\n /**\n * Flag to disable patching all together for fetch requests.\n *\n * @default true\n */\n traceFetch: boolean;\n\n /**\n * Flag to disable patching all together for xhr requests.\n *\n * @default true\n */\n traceXHR: boolean;\n\n /**\n * If true, Sentry will capture http timings and add them to the corresponding http spans.\n *\n * @default true\n */\n enableHTTPTimings: boolean;\n\n /**\n * A callback which is called before a span for a navigation is started.\n * It receives the options passed to `startSpan`, and expects to return an updated options object.\n */\n beforeStartSpan?: (options: StartSpanOptions) => StartSpanOptions;\n\n /**\n * This function will be called before creating a span for a request with the given url.\n * Return false if you don't want a span for the given url.\n *\n * @default (url: string) => true\n */\n shouldCreateSpanForRequest?(this: void, url: string): boolean;\n}\n\nfunction getDefaultTracePropagationTargets(): RegExp[] | undefined {\n if (isWeb()) {\n return undefined;\n }\n return [/.*/];\n}\n\nexport const defaultReactNativeTracingOptions: ReactNativeTracingOptions = {\n traceFetch: true,\n traceXHR: true,\n enableHTTPTimings: true,\n};\n\nexport type ReactNativeTracingState = {\n currentRoute: string | undefined;\n};\n\nexport const reactNativeTracingIntegration = (\n options: Partial<ReactNativeTracingOptions> = {},\n): Integration & {\n options: ReactNativeTracingOptions;\n state: ReactNativeTracingState;\n setCurrentRoute: (route: string) => void;\n} => {\n const state: ReactNativeTracingState = {\n currentRoute: undefined,\n };\n\n const finalOptions = {\n ...defaultReactNativeTracingOptions,\n ...options,\n beforeStartSpan: options.beforeStartSpan ?? ((options: StartSpanOptions) => options),\n finalTimeoutMs: options.finalTimeoutMs ?? defaultIdleOptions.finalTimeout,\n idleTimeoutMs: options.idleTimeoutMs ?? defaultIdleOptions.idleTimeout,\n };\n\n const userShouldCreateSpanForRequest = finalOptions.shouldCreateSpanForRequest;\n\n // Drop Dev Server Spans\n const devServerUrl = getDevServer()?.url;\n const finalShouldCreateSpanForRequest =\n devServerUrl === undefined\n ? userShouldCreateSpanForRequest\n : (url: string): boolean => {\n if (url.startsWith(devServerUrl)) {\n return false;\n }\n if (userShouldCreateSpanForRequest) {\n return userShouldCreateSpanForRequest(url);\n }\n return true;\n };\n\n finalOptions.shouldCreateSpanForRequest = finalShouldCreateSpanForRequest;\n\n const setup = (client: Client): void => {\n addDefaultOpForSpanFrom(client);\n\n instrumentOutgoingRequests(client, {\n traceFetch: finalOptions.traceFetch,\n traceXHR: finalOptions.traceXHR,\n shouldCreateSpanForRequest: finalOptions.shouldCreateSpanForRequest,\n tracePropagationTargets: client.getOptions().tracePropagationTargets || getDefaultTracePropagationTargets(),\n });\n };\n\n const processEvent = (event: Event): Event => {\n if (event.contexts && state.currentRoute) {\n event.contexts.app = { view_names: [state.currentRoute], ...event.contexts.app };\n }\n return event;\n };\n\n return {\n name: INTEGRATION_NAME,\n setup,\n processEvent,\n options: finalOptions,\n state,\n setCurrentRoute: (route: string) => {\n state.currentRoute = route;\n },\n };\n};\n\nexport type ReactNativeTracingIntegration = ReturnType<typeof reactNativeTracingIntegration>;\n\n/**\n * Returns the current React Native Tracing integration.\n */\nexport function getCurrentReactNativeTracingIntegration(): ReactNativeTracingIntegration | undefined {\n const client = getClient();\n if (!client) {\n return undefined;\n }\n\n return getReactNativeTracingIntegration(client);\n}\n\n/**\n * Returns React Native Tracing integration of given client.\n */\nexport function getReactNativeTracingIntegration(client: Client): ReactNativeTracingIntegration | undefined {\n return client.getIntegrationByName(INTEGRATION_NAME) as ReactNativeTracingIntegration | undefined;\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
2
2
  export declare const SDK_NAME = "sentry.javascript.react-native";
3
- export declare const SDK_VERSION = "6.2.0";
3
+ export declare const SDK_VERSION = "6.3.0-beta.2";
4
4
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,6BAA6B,CAAC;AAC3D,eAAO,MAAM,QAAQ,mCAAmC,CAAC;AACzD,eAAO,MAAM,WAAW,UAAU,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,6BAA6B,CAAC;AAC3D,eAAO,MAAM,QAAQ,mCAAmC,CAAC;AACzD,eAAO,MAAM,WAAW,iBAAiB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';
2
2
  export const SDK_NAME = 'sentry.javascript.react-native';
3
- export const SDK_VERSION = '6.2.0';
3
+ export const SDK_VERSION = '6.3.0-beta.2';
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '6.2.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '6.3.0-beta.2';\n"]}
@@ -15,6 +15,7 @@ export interface Screenshot {
15
15
  filename: string;
16
16
  }
17
17
  export type NativeSdkOptions = Partial<ReactNativeClientOptions> & {
18
+ devServerUrl: string | undefined;
18
19
  defaultSidecarUrl: string | undefined;
19
20
  } & {
20
21
  mobileReplayOptions: MobileReplayOptions | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../src/js/wrapper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,EACP,aAAa,EACb,IAAI,EACL,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAiB,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGvD,OAAO,KAAK,EACV,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,qBAAqB,EAErB,iBAAiB,EACjB,IAAI,EACL,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAC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