@sentry/react-native 5.16.0 → 5.17.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/CHANGELOG.md +35 -0
- package/RNSentry.podspec +1 -0
- package/dist/js/integrations/default.d.ts.map +1 -1
- package/dist/js/integrations/default.js +7 -2
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/sdk.d.ts.map +1 -1
- package/dist/js/sdk.js +4 -1
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tools/metroconfig.d.ts +19 -0
- package/dist/js/tools/metroconfig.d.ts.map +1 -0
- package/dist/js/tools/metroconfig.js +67 -0
- package/dist/js/tools/metroconfig.js.map +1 -0
- package/dist/js/tools/sentryMetroSerializer.d.ts +7 -4
- package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.js +3 -19
- package/dist/js/tools/sentryMetroSerializer.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/metro.d.ts +1 -1
- package/metro.js +1 -1
- package/package.json +2 -2
- package/scripts/sentry-xcode-debug-files.sh +5 -4
- package/scripts/sentry-xcode.sh +2 -2
- package/sentry.gradle +3 -4
- package/ts3.8/dist/js/version.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.17.0
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- New Sentry Metro configuration function `withSentryConfig` ([#3478](https://github.com/getsentry/sentry-react-native/pull/3478))
|
|
8
|
+
- Ensures all Sentry configuration is added to your Metro config
|
|
9
|
+
- Includes `createSentryMetroSerializer`
|
|
10
|
+
- Collapses Sentry internal frames from the stack trace view in LogBox
|
|
11
|
+
|
|
12
|
+
```javascript
|
|
13
|
+
const { getDefaultConfig } = require('@react-native/metro-config');
|
|
14
|
+
const { withSentryConfig } = require('@sentry/react-native/metro');
|
|
15
|
+
|
|
16
|
+
const config = getDefaultConfig(__dirname);
|
|
17
|
+
module.exports = withSentryConfig(config);
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- Add experimental visionOS support ([#3467](https://github.com/getsentry/sentry-react-native/pull/3467))
|
|
21
|
+
- To set up [`react-native-visionos`](https://github.com/callstack/react-native-visionos) with the Sentry React Native SDK follow [the standard `iOS` guides](https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#ios).
|
|
22
|
+
- Xcode project is located in `visionos` folder instead of `ios`.
|
|
23
|
+
|
|
24
|
+
### Fixes
|
|
25
|
+
|
|
26
|
+
- Fix `WITH_ENVIRONMENT` overwrite in `sentry-xcode-debug-files.sh` ([#3525](https://github.com/getsentry/sentry-react-native/pull/3525))
|
|
27
|
+
- Sentry CLI 2.25.1 fixes background debug files uploads during Xcode builds ([#3486](https://github.com/getsentry/sentry-react-native/pull/3486))
|
|
28
|
+
- Performance Tracing should be disabled by default ([#3533](https://github.com/getsentry/sentry-react-native/pull/3533))
|
|
29
|
+
- Use `$NODE_BINARY` to execute Sentry CLI in Xcode scripts ([#3493](https://github.com/getsentry/sentry-react-native/pull/3493))
|
|
30
|
+
- Return auto Release and Dist to source maps auto upload ([#3540](https://github.com/getsentry/sentry-react-native/pull/3540))
|
|
31
|
+
|
|
32
|
+
### Dependencies
|
|
33
|
+
|
|
34
|
+
- Bump CLI from v2.23.0 to v2.25.2 ([#3486](https://github.com/getsentry/sentry-react-native/pull/3486))
|
|
35
|
+
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2252)
|
|
36
|
+
- [diff](https://github.com/getsentry/sentry-cli/compare/2.23.0...2.25.2)
|
|
37
|
+
|
|
3
38
|
## 5.16.0
|
|
4
39
|
|
|
5
40
|
This release ships with a beta version of our new built-in Expo SDK 50 support,
|
package/RNSentry.podspec
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/default.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/default.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAkB3D;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,wBAAwB,GAAG,WAAW,EAAE,CAoEvF"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { hasTracingEnabled } from '@sentry/core';
|
|
2
1
|
import { HttpClient } from '@sentry/integrations';
|
|
3
2
|
import { Integrations as BrowserReactIntegrations } from '@sentry/react';
|
|
4
3
|
import { HermesProfiling } from '../profiling/integration';
|
|
@@ -65,7 +64,13 @@ export function getDefaultIntegrations(options) {
|
|
|
65
64
|
integrations.push(new HermesProfiling());
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
|
-
|
|
67
|
+
// hasTracingEnabled from `@sentry/core` only check if tracesSampler or tracesSampleRate keys are present
|
|
68
|
+
// that's different from prev imp here and might lead misconfiguration
|
|
69
|
+
// `tracesSampleRate: undefined` should not enable tracing
|
|
70
|
+
const hasTracingEnabled = options.enableTracing ||
|
|
71
|
+
typeof options.tracesSampleRate === 'number' ||
|
|
72
|
+
typeof options.tracesSampler === 'function';
|
|
73
|
+
if (hasTracingEnabled && options.enableAutoPerformanceTracing) {
|
|
69
74
|
integrations.push(new ReactNativeTracing());
|
|
70
75
|
}
|
|
71
76
|
if (options.enableCaptureFailedRequests) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../../src/js/integrations/default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../../src/js/integrations/default.ts"],"names":[],"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C;QACvC,IAAI,OAAO,CAAC,gBAAgB,EAAE;YAC5B,YAAY,CAAC,IAAI,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC;SACrC;QACD,IAAI,OAAO,CAAC,mBAAmB,EAAE;YAC/B,YAAY,CAAC,IAAI,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;SACxC;QACD,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,OAAO,CAAC,YAAY,CAAC,kBAAkB,KAAK,QAAQ,EAAE;YACvF,YAAY,CAAC,IAAI,CAAC,IAAI,eAAe,EAAE,CAAC,CAAC;SAC1C;KACF;IAED,yGAAyG;IACzG,sEAAsE;IACtE,0DAA0D;IAC1D,MAAM,iBAAiB,GACrB,OAAO,CAAC,aAAa;QACrB,OAAO,OAAO,CAAC,gBAAgB,KAAK,QAAQ;QAC5C,OAAO,OAAO,CAAC,aAAa,KAAK,UAAU,CAAC;IAC9C,IAAI,iBAAiB,IAAI,OAAO,CAAC,4BAA4B,EAAE;QAC7D,YAAY,CAAC,IAAI,CAAC,IAAI,kBAAkB,EAAE,CAAC,CAAC;KAC7C;IACD,IAAI,OAAO,CAAC,2BAA2B,EAAE;QACvC,YAAY,CAAC,IAAI,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC;KACrC;IAED,IAAI,QAAQ,EAAE,EAAE;QACd,YAAY,CAAC,IAAI,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC;KACtC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import { HttpClient } from '@sentry/integrations';\nimport { Integrations as BrowserReactIntegrations } from '@sentry/react';\nimport type { Integration } from '@sentry/types';\n\nimport type { ReactNativeClientOptions } from '../options';\nimport { HermesProfiling } from '../profiling/integration';\nimport { ReactNativeTracing } from '../tracing';\nimport { isExpoGo, notWeb } from '../utils/environment';\nimport { DebugSymbolicator } from './debugsymbolicator';\nimport { DeviceContext } from './devicecontext';\nimport { EventOrigin } from './eventorigin';\nimport { ExpoContext } from './expocontext';\nimport { ModulesLoader } from './modulesloader';\nimport { NativeLinkedErrors } from './nativelinkederrors';\nimport { ReactNativeErrorHandlers } from './reactnativeerrorhandlers';\nimport { ReactNativeInfo } from './reactnativeinfo';\nimport { Release } from './release';\nimport { createReactNativeRewriteFrames } from './rewriteframes';\nimport { Screenshot } from './screenshot';\nimport { SdkInfo } from './sdkinfo';\nimport { ViewHierarchy } from './viewhierarchy';\n\n/**\n * Returns the default ReactNative integrations based on the current environment.\n *\n * Native integrations are only returned when native is enabled.\n *\n * Web integrations are only returned when running on web.\n */\nexport function getDefaultIntegrations(options: ReactNativeClientOptions): Integration[] {\n const integrations: Integration[] = [];\n\n if (notWeb()) {\n integrations.push(\n new ReactNativeErrorHandlers({\n patchGlobalPromise: options.patchGlobalPromise,\n }),\n );\n integrations.push(new NativeLinkedErrors());\n } else {\n integrations.push(new BrowserReactIntegrations.TryCatch());\n integrations.push(new BrowserReactIntegrations.GlobalHandlers());\n integrations.push(new BrowserReactIntegrations.LinkedErrors());\n }\n\n // @sentry/react default integrations\n integrations.push(new BrowserReactIntegrations.InboundFilters());\n integrations.push(new BrowserReactIntegrations.FunctionToString());\n integrations.push(new BrowserReactIntegrations.Breadcrumbs());\n integrations.push(new BrowserReactIntegrations.Dedupe());\n integrations.push(new BrowserReactIntegrations.HttpContext());\n // end @sentry/react-native default integrations\n\n integrations.push(new Release());\n integrations.push(new EventOrigin());\n integrations.push(new SdkInfo());\n integrations.push(new ReactNativeInfo());\n\n if (__DEV__ && notWeb()) {\n integrations.push(new DebugSymbolicator());\n }\n\n integrations.push(createReactNativeRewriteFrames());\n\n if (options.enableNative) {\n integrations.push(new DeviceContext());\n integrations.push(new ModulesLoader());\n if (options.attachScreenshot) {\n integrations.push(new Screenshot());\n }\n if (options.attachViewHierarchy) {\n integrations.push(new ViewHierarchy());\n }\n if (options._experiments && typeof options._experiments.profilesSampleRate === 'number') {\n integrations.push(new HermesProfiling());\n }\n }\n\n // hasTracingEnabled from `@sentry/core` only check if tracesSampler or tracesSampleRate keys are present\n // that's different from prev imp here and might lead misconfiguration\n // `tracesSampleRate: undefined` should not enable tracing\n const hasTracingEnabled =\n options.enableTracing ||\n typeof options.tracesSampleRate === 'number' ||\n typeof options.tracesSampler === 'function';\n if (hasTracingEnabled && options.enableAutoPerformanceTracing) {\n integrations.push(new ReactNativeTracing());\n }\n if (options.enableCaptureFailedRequests) {\n integrations.push(new HttpClient());\n }\n\n if (isExpoGo()) {\n integrations.push(new ExpoContext());\n }\n\n return integrations;\n}\n"]}
|
package/dist/js/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAA0B,GAAG,EAAmC,MAAM,cAAc,CAAC;AAM5F,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAA4B,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AA4BzG;;GAEG;AACH,wBAAgB,IAAI,CAAC,aAAa,EAAE,kBAAkB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAA0B,GAAG,EAAmC,MAAM,cAAc,CAAC;AAM5F,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAA4B,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AA4BzG;;GAEG;AACH,wBAAgB,IAAI,CAAC,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAwD5D;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,CAsBxB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAKlC;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,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CASxF;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CASlG"}
|
package/dist/js/sdk.js
CHANGED
|
@@ -47,7 +47,10 @@ export function init(passedOptions) {
|
|
|
47
47
|
|| makeNativeTransportFactory({
|
|
48
48
|
enableNative,
|
|
49
49
|
})
|
|
50
|
-
|| 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' })
|
|
50
|
+
|| 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' }) });
|
|
51
|
+
if ('tracesSampler' in options) {
|
|
52
|
+
options.tracesSampler = safeTracesSampler(options.tracesSampler);
|
|
53
|
+
}
|
|
51
54
|
if (!('environment' in options)) {
|
|
52
55
|
options.environment = getDefaultEnvironment();
|
|
53
56
|
}
|
package/dist/js/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,sBAAsB,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC5F,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,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,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C;AAC1C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgC;IAC7D,MAAM,YAAY,GAAG,CAAC,KAAY,EAAQ,EAAE;QAC1C,IAAI;YACF,QAAQ,CAAC,KAAK,CAAC,CAAC;SACjB;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,KAAK,CAAC,6CAA6C,EAAE,CAAC,CAAC,CAAC;SAChE;IACH,CAAC,CAAC;IACF,aAAa,EAAE,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport type { Scope } from '@sentry/core';\nimport { getIntegrationsToSetup, Hub, initAndBind, makeMain, setExtra } from '@sentry/core';\nimport {\n defaultStackParser,\n getCurrentHub,\n makeFetchTransport,\n} from '@sentry/react';\nimport type { Integration, 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 { ReactNativeScope } from './scope';\nimport { TouchEventBoundary } from './touchevents';\nimport { ReactNativeProfiler, ReactNativeTracing } from './tracing';\nimport { DEFAULT_BUFFER_SIZE, makeNativeTransportFactory } from './transports/native';\nimport { makeUtf8TextEncoder } from './transports/TextEncoder';\nimport { getDefaultEnvironment, isExpoGo } 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 transportOptions: {\n textEncoder: makeUtf8TextEncoder(),\n },\n sendClientReports: true,\n maxQueueSize: DEFAULT_BUFFER_SIZE,\n attachStacktrace: true,\n enableCaptureFailedRequests: false,\n enableNdk: true,\n};\n\n/**\n * Inits the SDK and returns the final options.\n */\nexport function init(passedOptions: ReactNativeOptions): void {\n const reactNativeHub = new Hub(undefined, new ReactNativeScope());\n makeMain(reactNativeHub);\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 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 tracesSampler: safeTracesSampler(passedOptions.tracesSampler),\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 tracingIntegration = getCurrentHub().getIntegration(ReactNativeTracing);\n if (tracingIntegration) {\n tracingIntegration.useAppStartWithProfiler = true;\n }\n\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 * Deprecated. Sets the release on the event.\n * NOTE: Does not set the release on sessions.\n * @deprecated\n */\nexport function setRelease(release: string): void {\n setExtra('__sentry_release', release);\n}\n\n/**\n * Deprecated. Sets the dist on the event.\n * NOTE: Does not set the dist on sessions.\n * @deprecated\n */\nexport function setDist(dist: string): void {\n setExtra('__sentry_dist', dist);\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 const client = getCurrentHub().getClient<ReactNativeClient>();\n if (client) {\n client.nativeCrash();\n }\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 = getCurrentHub().getClient<ReactNativeClient>();\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 = getCurrentHub().getClient<ReactNativeClient>();\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 getCurrentHub().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(callback: (scope: Scope) => void): ReturnType<Hub['withScope']> {\n const safeCallback = (scope: Scope): void => {\n try {\n callback(scope);\n } catch (e) {\n logger.error('Error while running withScope callback', e);\n }\n };\n getCurrentHub().withScope(safeCallback);\n}\n\n/**\n * Callback to set context information onto the scope.\n * @param callback Callback function that receives Scope.\n */\nexport function configureScope(callback: (scope: Scope) => void): ReturnType<Hub['configureScope']> {\n const safeCallback = (scope: Scope): void => {\n try {\n callback(scope);\n } catch (e) {\n logger.error('Error while running configureScope callback', e);\n }\n };\n getCurrentHub().configureScope(safeCallback);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,sBAAsB,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC5F,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,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,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO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YAAY,GAAG,CAAC,KAAY,EAAQ,EAAE;QAC1C,IAAI;YACF,QAAQ,CAAC,KAAK,CAAC,CAAC;SACjB;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,KAAK,CAAC,6CAA6C,EAAE,CAAC,CAAC,CAAC;SAChE;IACH,CAAC,CAAC;IACF,aAAa,EAAE,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport type { Scope } from '@sentry/core';\nimport { getIntegrationsToSetup, Hub, initAndBind, makeMain, setExtra } from '@sentry/core';\nimport {\n defaultStackParser,\n getCurrentHub,\n makeFetchTransport,\n} from '@sentry/react';\nimport type { Integration, 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 { ReactNativeScope } from './scope';\nimport { TouchEventBoundary } from './touchevents';\nimport { ReactNativeProfiler, ReactNativeTracing } from './tracing';\nimport { DEFAULT_BUFFER_SIZE, makeNativeTransportFactory } from './transports/native';\nimport { makeUtf8TextEncoder } from './transports/TextEncoder';\nimport { getDefaultEnvironment, isExpoGo } 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 transportOptions: {\n textEncoder: makeUtf8TextEncoder(),\n },\n sendClientReports: true,\n maxQueueSize: DEFAULT_BUFFER_SIZE,\n attachStacktrace: true,\n enableCaptureFailedRequests: false,\n enableNdk: true,\n};\n\n/**\n * Inits the SDK and returns the final options.\n */\nexport function init(passedOptions: ReactNativeOptions): void {\n const reactNativeHub = new Hub(undefined, new ReactNativeScope());\n makeMain(reactNativeHub);\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 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 tracingIntegration = getCurrentHub().getIntegration(ReactNativeTracing);\n if (tracingIntegration) {\n tracingIntegration.useAppStartWithProfiler = true;\n }\n\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 * Deprecated. Sets the release on the event.\n * NOTE: Does not set the release on sessions.\n * @deprecated\n */\nexport function setRelease(release: string): void {\n setExtra('__sentry_release', release);\n}\n\n/**\n * Deprecated. Sets the dist on the event.\n * NOTE: Does not set the dist on sessions.\n * @deprecated\n */\nexport function setDist(dist: string): void {\n setExtra('__sentry_dist', dist);\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 const client = getCurrentHub().getClient<ReactNativeClient>();\n if (client) {\n client.nativeCrash();\n }\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 = getCurrentHub().getClient<ReactNativeClient>();\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 = getCurrentHub().getClient<ReactNativeClient>();\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 getCurrentHub().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(callback: (scope: Scope) => void): ReturnType<Hub['withScope']> {\n const safeCallback = (scope: Scope): void => {\n try {\n callback(scope);\n } catch (e) {\n logger.error('Error while running withScope callback', e);\n }\n };\n getCurrentHub().withScope(safeCallback);\n}\n\n/**\n * Callback to set context information onto the scope.\n * @param callback Callback function that receives Scope.\n */\nexport function configureScope(callback: (scope: Scope) => void): ReturnType<Hub['configureScope']> {\n const safeCallback = (scope: Scope): void => {\n try {\n callback(scope);\n } catch (e) {\n logger.error('Error while running configureScope callback', e);\n }\n };\n getCurrentHub().configureScope(safeCallback);\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { MetroConfig } from 'metro';
|
|
2
|
+
import type { DefaultConfigOptions } from './vendor/expo/expoconfig';
|
|
3
|
+
export * from './sentryMetroSerializer';
|
|
4
|
+
/**
|
|
5
|
+
* Adds Sentry to the Metro config.
|
|
6
|
+
*
|
|
7
|
+
* Adds Debug ID to the output bundle and source maps.
|
|
8
|
+
* Collapses Sentry frames from the stack trace view in LogBox.
|
|
9
|
+
*/
|
|
10
|
+
export declare function withSentryConfig(config: MetroConfig): MetroConfig;
|
|
11
|
+
/**
|
|
12
|
+
* This function returns Default Expo configuration with Sentry plugins.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getSentryExpoConfig(projectRoot: string, options?: DefaultConfigOptions): MetroConfig;
|
|
15
|
+
/**
|
|
16
|
+
* Collapses Sentry internal frames from the stack trace view in LogBox.
|
|
17
|
+
*/
|
|
18
|
+
export declare function withSentryFramesCollapsed(config: MetroConfig): MetroConfig;
|
|
19
|
+
//# sourceMappingURL=metroconfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metroconfig.d.ts","sourceRoot":"","sources":["../../../src/js/tools/metroconfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAsC,MAAM,OAAO,CAAC;AAG7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE,cAAc,yBAAyB,CAAC;AAExC;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAOjE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,WAAW,CAWxG;AA8CD;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAiC1E"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.withSentryFramesCollapsed = exports.getSentryExpoConfig = exports.withSentryConfig = void 0;
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const sentryMetroSerializer_1 = require("./sentryMetroSerializer");
|
|
5
|
+
tslib_1.__exportStar(require("./sentryMetroSerializer"), exports);
|
|
6
|
+
/**
|
|
7
|
+
* Adds Sentry to the Metro config.
|
|
8
|
+
*
|
|
9
|
+
* Adds Debug ID to the output bundle and source maps.
|
|
10
|
+
* Collapses Sentry frames from the stack trace view in LogBox.
|
|
11
|
+
*/
|
|
12
|
+
function withSentryConfig(config) {
|
|
13
|
+
let newConfig = config;
|
|
14
|
+
newConfig = withSentryDebugId(newConfig);
|
|
15
|
+
newConfig = withSentryFramesCollapsed(newConfig);
|
|
16
|
+
return newConfig;
|
|
17
|
+
}
|
|
18
|
+
exports.withSentryConfig = withSentryConfig;
|
|
19
|
+
/**
|
|
20
|
+
* This function returns Default Expo configuration with Sentry plugins.
|
|
21
|
+
*/
|
|
22
|
+
function getSentryExpoConfig(projectRoot, options = {}) {
|
|
23
|
+
const { getDefaultConfig } = loadExpoMetroConfigModule();
|
|
24
|
+
const config = getDefaultConfig(projectRoot, Object.assign(Object.assign({}, options), { unstable_beforeAssetSerializationPlugins: [
|
|
25
|
+
...(options.unstable_beforeAssetSerializationPlugins || []),
|
|
26
|
+
sentryMetroSerializer_1.unstable_beforeAssetSerializationPlugin,
|
|
27
|
+
] }));
|
|
28
|
+
return withSentryFramesCollapsed(config);
|
|
29
|
+
}
|
|
30
|
+
exports.getSentryExpoConfig = getSentryExpoConfig;
|
|
31
|
+
function loadExpoMetroConfigModule() {
|
|
32
|
+
try {
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
34
|
+
return require('expo/metro-config');
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
throw new Error('Unable to load `expo/metro-config`. Make sure you have Expo installed.');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function withSentryDebugId(config) {
|
|
41
|
+
var _a;
|
|
42
|
+
const customSerializer = (0, sentryMetroSerializer_1.createSentryMetroSerializer)(((_a = config.serializer) === null || _a === void 0 ? void 0 : _a.customSerializer) || undefined);
|
|
43
|
+
// MetroConfig types customSerializers as async only, but sync returns are also supported
|
|
44
|
+
// The default serializer is sync
|
|
45
|
+
return Object.assign(Object.assign({}, config), { serializer: Object.assign(Object.assign({}, config.serializer), { customSerializer }) });
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Collapses Sentry internal frames from the stack trace view in LogBox.
|
|
49
|
+
*/
|
|
50
|
+
function withSentryFramesCollapsed(config) {
|
|
51
|
+
var _a;
|
|
52
|
+
const originalCustomizeFrame = (_a = config.symbolicator) === null || _a === void 0 ? void 0 : _a.customizeFrame;
|
|
53
|
+
const collapseSentryInternalFrames = (frame) => typeof frame.file === 'string' &&
|
|
54
|
+
(frame.file.includes('node_modules/@sentry/utils/cjs/instrument.js') ||
|
|
55
|
+
frame.file.includes('node_modules/@sentry/utils/cjs/logger.js'));
|
|
56
|
+
const customizeFrame = (frame) => {
|
|
57
|
+
const originalOrSentryCustomizeFrame = (originalCustomization) => (Object.assign(Object.assign({}, originalCustomization), { collapse: (originalCustomization && originalCustomization.collapse) || collapseSentryInternalFrames(frame) }));
|
|
58
|
+
const maybePromiseCustomization = (originalCustomizeFrame && originalCustomizeFrame(frame)) || undefined;
|
|
59
|
+
if (maybePromiseCustomization !== undefined && 'then' in maybePromiseCustomization) {
|
|
60
|
+
return maybePromiseCustomization.then(originalCustomization => originalOrSentryCustomizeFrame(originalCustomization));
|
|
61
|
+
}
|
|
62
|
+
return originalOrSentryCustomizeFrame(maybePromiseCustomization);
|
|
63
|
+
};
|
|
64
|
+
return Object.assign(Object.assign({}, config), { symbolicator: Object.assign(Object.assign({}, config.symbolicator), { customizeFrame }) });
|
|
65
|
+
}
|
|
66
|
+
exports.withSentryFramesCollapsed = withSentryFramesCollapsed;
|
|
67
|
+
//# sourceMappingURL=metroconfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metroconfig.js","sourceRoot":"","sources":["../../../src/js/tools/metroconfig.ts"],"names":[],"mappings":";;;AAEA,mEAA+G;AAG/G,kEAAwC;AAExC;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,MAAmB;IAClD,IAAI,SAAS,GAAG,MAAM,CAAC;IAEvB,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACzC,SAAS,GAAG,yBAAyB,CAAC,SAAS,CAAC,CAAC;IAEjD,OAAO,SAAS,CAAC;AACnB,CAAC;AAPD,4CAOC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,WAAmB,EAAE,UAAgC,EAAE;IACzF,MAAM,EAAE,gBAAgB,EAAE,GAAG,yBAAyB,EAAE,CAAC;IACzD,MAAM,MAAM,GAAG,gBAAgB,CAAC,WAAW,kCACtC,OAAO,KACV,wCAAwC,EAAE;YACxC,GAAG,CAAC,OAAO,CAAC,wCAAwC,IAAI,EAAE,CAAC;YAC3D,+DA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AC;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","sourcesContent":["import type { MetroConfig, MixedOutput, Module, ReadOnlyGraph } from 'metro';\n\nimport { createSentryMetroSerializer, unstable_beforeAssetSerializationPlugin } from './sentryMetroSerializer';\nimport type { DefaultConfigOptions } from './vendor/expo/expoconfig';\n\nexport * from './sentryMetroSerializer';\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(config: MetroConfig): MetroConfig {\n let newConfig = config;\n\n newConfig = withSentryDebugId(newConfig);\n newConfig = withSentryFramesCollapsed(newConfig);\n\n return newConfig;\n}\n\n/**\n * This function returns Default Expo configuration with Sentry plugins.\n */\nexport function getSentryExpoConfig(projectRoot: string, options: DefaultConfigOptions = {}): MetroConfig {\n const { getDefaultConfig } = loadExpoMetroConfigModule();\n const config = getDefaultConfig(projectRoot, {\n ...options,\n unstable_beforeAssetSerializationPlugins: [\n ...(options.unstable_beforeAssetSerializationPlugins || []),\n unstable_beforeAssetSerializationPlugin,\n ],\n });\n\n return withSentryFramesCollapsed(config);\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\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\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"]}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MixedOutput, Module, ReadOnlyGraph } from 'metro';
|
|
2
2
|
import type { MetroSerializer } from './utils';
|
|
3
|
-
import type { DefaultConfigOptions } from './vendor/expo/expoconfig';
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
4
|
+
* Adds Sentry Debug ID polyfill module to the bundle.
|
|
6
5
|
*/
|
|
7
|
-
export declare function
|
|
6
|
+
export declare function unstable_beforeAssetSerializationPlugin({ premodules, debugId, }: {
|
|
7
|
+
graph: ReadOnlyGraph<MixedOutput>;
|
|
8
|
+
premodules: Module[];
|
|
9
|
+
debugId?: string;
|
|
10
|
+
}): Module[];
|
|
8
11
|
/**
|
|
9
12
|
* Creates a Metro serializer that adds Debug ID module to the plain bundle.
|
|
10
13
|
* The Debug ID module is a virtual module that provides a debug ID in runtime.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentryMetroSerializer.d.ts","sourceRoot":"","sources":["../../../src/js/tools/sentryMetroSerializer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"sentryMetroSerializer.d.ts","sourceRoot":"","sources":["../../../src/js/tools/sentryMetroSerializer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGhE,OAAO,KAAK,EAAU,eAAe,EAA4D,MAAM,SAAS,CAAC;AAYjH;;GAEG;AACH,wBAAgB,uCAAuC,CAAC,EACtD,UAAU,EACV,OAAO,GACR,EAAE;IACD,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,EAAE,CAcX;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,sBAAuB,eAAe,KAAG,eAsDhF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.createSentryMetroSerializer = exports.
|
|
2
|
+
exports.createSentryMetroSerializer = exports.unstable_beforeAssetSerializationPlugin = void 0;
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const crypto = require("crypto");
|
|
5
5
|
const countLines = require("metro/src/lib/countLines");
|
|
@@ -11,16 +11,8 @@ const PRELUDE_MODULE_PATH = '__prelude__';
|
|
|
11
11
|
const SOURCE_MAP_COMMENT = '//# sourceMappingURL=';
|
|
12
12
|
const DEBUG_ID_COMMENT = '//# debugId=';
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Adds Sentry Debug ID polyfill module to the bundle.
|
|
15
15
|
*/
|
|
16
|
-
function getSentryExpoConfig(projectRoot, options = {}) {
|
|
17
|
-
const { getDefaultConfig } = loadExpoMetroConfigModule();
|
|
18
|
-
return getDefaultConfig(projectRoot, Object.assign(Object.assign({}, options), { unstable_beforeAssetSerializationPlugins: [
|
|
19
|
-
...(options.unstable_beforeAssetSerializationPlugins || []),
|
|
20
|
-
unstable_beforeAssetSerializationPlugin,
|
|
21
|
-
] }));
|
|
22
|
-
}
|
|
23
|
-
exports.getSentryExpoConfig = getSentryExpoConfig;
|
|
24
16
|
function unstable_beforeAssetSerializationPlugin({ premodules, debugId, }) {
|
|
25
17
|
if (!debugId) {
|
|
26
18
|
return premodules;
|
|
@@ -34,15 +26,7 @@ function unstable_beforeAssetSerializationPlugin({ premodules, debugId, }) {
|
|
|
34
26
|
const debugIdModule = createDebugIdModule(debugId);
|
|
35
27
|
return [...addDebugIdModule(premodules, debugIdModule)];
|
|
36
28
|
}
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
40
|
-
return require('expo/metro-config');
|
|
41
|
-
}
|
|
42
|
-
catch (e) {
|
|
43
|
-
throw new Error('Unable to load `expo/metro-config`. Make sure you have Expo installed.');
|
|
44
|
-
}
|
|
45
|
-
}
|
|
29
|
+
exports.unstable_beforeAssetSerializationPlugin = unstable_beforeAssetSerializationPlugin;
|
|
46
30
|
/**
|
|
47
31
|
* Creates a Metro serializer that adds Debug ID module to the plain bundle.
|
|
48
32
|
* The Debug ID module is a virtual module that provides a debug ID in runtime.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentryMetroSerializer.js","sourceRoot":"","sources":["../../../src/js/tools/sentryMetroSerializer.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAEjC,uDAAuD;AAGvD,mCAA0G;AAE1G,gDAAoE;AAIpE,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAC1D,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAC3C,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAC1C,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AACnD,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC;;GAEG;AACH,SAAgB,mBAAmB,CAAC,WAAmB,EAAE,UAAgC,EAAE;IACzF,MAAM,EAAE,gBAAgB,EAAE,GAAG,yBAAyB,EAAE,CAAC;IACzD,OAAO,gBAAgB,CAAC,WAAW,kCAC9B,OAAO,KACV,wCAAwC,EAAE;YACxC,GAAG,CAAC,OAAO,CAAC,wCAAwC,IAAI,EAAE,CAAC;YAC3D,uCAAuC;SACxC,IACD,CAAC;AACL,CAAC;AATD,kDASC;AAED,SAAS,uCAAuC,CAAC,EAC/C,UAAU,EACV,OAAO,GAKR;IACC,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,UAAU,CAAC;KACnB;IAED,MAAM,mBAAmB,GAAG,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;IACvG,IAAI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AAM,CAAC,IAAI,CAAC,CAAC;IAEzB,MAAM,OAAO,GAAG,IAAA,oBAAY,EAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACjD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,OAAe;IAClD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,qBAAqB,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import * as crypto from 'crypto';\nimport type { MetroConfig, MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport * as countLines from 'metro/src/lib/countLines';\n\nimport type { Bundle, MetroSerializer, MetroSerializerOutput, SerializedBundle, VirtualJSOutput } from './utils';\nimport { createDebugIdSnippet, createSet, determineDebugIdFromBundleSource, stringToUUID } from './utils';\nimport type { DefaultConfigOptions } from './vendor/expo/expoconfig';\nimport { createDefaultMetroSerializer } from './vendor/metro/utils';\n\ntype SourceMap = Record<string, unknown>;\n\nconst DEBUG_ID_PLACE_HOLDER = '__debug_id_place_holder__';\nconst DEBUG_ID_MODULE_PATH = '__debugid__';\nconst PRELUDE_MODULE_PATH = '__prelude__';\nconst SOURCE_MAP_COMMENT = '//# sourceMappingURL=';\nconst DEBUG_ID_COMMENT = '//# debugId=';\n\n/**\n * This function returns Default Expo configuration with Sentry plugins.\n */\nexport function getSentryExpoConfig(projectRoot: string, options: DefaultConfigOptions = {}): MetroConfig {\n const { getDefaultConfig } = loadExpoMetroConfigModule();\n return getDefaultConfig(projectRoot, {\n ...options,\n unstable_beforeAssetSerializationPlugins: [\n ...(options.unstable_beforeAssetSerializationPlugins || []),\n unstable_beforeAssetSerializationPlugin,\n ],\n });\n}\n\nfunction unstable_beforeAssetSerializationPlugin({\n premodules,\n debugId,\n}: {\n graph: ReadOnlyGraph<MixedOutput>;\n premodules: Module[];\n debugId?: string;\n}): Module[] {\n if (!debugId) {\n return premodules;\n }\n\n const debugIdModuleExists = premodules.findIndex(module => module.path === DEBUG_ID_MODULE_PATH) != -1;\n if (debugIdModuleExists) {\n // eslint-disable-next-line no-console\n console.warn('\\n\\nDebug ID module found. Skipping Sentry Debug ID module...\\n\\n');\n return premodules;\n }\n\n const debugIdModule = createDebugIdModule(debugId);\n return [...addDebugIdModule(premodules, debugIdModule)];\n}\n\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 * Creates a Metro serializer that adds Debug ID module to the plain bundle.\n * The Debug ID module is a virtual module that provides a debug ID in runtime.\n *\n * RAM Bundles do not support custom serializers.\n */\nexport const createSentryMetroSerializer = (customSerializer?: MetroSerializer): MetroSerializer => {\n const serializer = customSerializer || createDefaultMetroSerializer();\n return async function (entryPoint, preModules, graph, options) {\n if (graph.transformOptions.hot) {\n return serializer(entryPoint, preModules, graph, options);\n }\n\n const debugIdModuleExists = preModules.findIndex(module => module.path === DEBUG_ID_MODULE_PATH) != -1;\n if (debugIdModuleExists) {\n // eslint-disable-next-line no-console\n console.warn('Debug ID module found. Skipping Sentry Debug ID module...');\n return serializer(entryPoint, preModules, graph, options);\n }\n\n const debugIdModule = createDebugIdModule(DEBUG_ID_PLACE_HOLDER);\n options.sentryBundleCallback = createSentryBundleCallback(debugIdModule);\n const modifiedPreModules = addDebugIdModule(preModules, debugIdModule);\n\n // Run wrapped serializer\n const serializerResult = serializer(entryPoint, modifiedPreModules, graph, options);\n const { code: bundleCode, map: bundleMapString } = await extractSerializerResult(serializerResult);\n\n // Add debug id comment to the bundle\n const debugId = determineDebugIdFromBundleSource(bundleCode);\n if (!debugId) {\n throw new Error(\n 'Debug ID was not found in the bundle. Call `options.sentryBundleCallback` if you are using a custom serializer.',\n );\n }\n // Only print debug id for command line builds => not hot reload from dev server\n // eslint-disable-next-line no-console\n console.log('info ' + `Bundle Debug ID: ${debugId}`);\n\n const debugIdComment = `${DEBUG_ID_COMMENT}${debugId}`;\n const indexOfSourceMapComment = bundleCode.lastIndexOf(SOURCE_MAP_COMMENT);\n const bundleCodeWithDebugId =\n indexOfSourceMapComment === -1\n ? // If source map comment is missing lets just add the debug id comment\n `${bundleCode}\\n${debugIdComment}`\n : // If source map comment is present lets add the debug id comment before it\n `${bundleCode.substring(0, indexOfSourceMapComment) + debugIdComment}\\n${bundleCode.substring(\n indexOfSourceMapComment,\n )}`;\n\n const bundleMap: SourceMap = JSON.parse(bundleMapString);\n // For now we write both fields until we know what will become the standard - if ever.\n bundleMap['debug_id'] = debugId;\n bundleMap['debugId'] = debugId;\n\n return {\n code: bundleCodeWithDebugId,\n map: JSON.stringify(bundleMap),\n };\n };\n};\n\n/**\n * This function is expected to be called after serializer creates the final bundle object\n * and before the source maps are generated.\n *\n * It injects a debug ID into the bundle and returns the modified bundle.\n *\n * Access it via `options.sentryBundleCallback` in your custom serializer.\n */\nfunction createSentryBundleCallback(debugIdModule: Module<VirtualJSOutput> & { setSource: (code: string) => void }) {\n return (bundle: Bundle) => {\n const debugId = calculateDebugId(bundle);\n debugIdModule.setSource(injectDebugId(debugIdModule.getSource().toString(), debugId));\n bundle.pre = injectDebugId(bundle.pre, debugId);\n return bundle;\n };\n}\n\nfunction addDebugIdModule(\n preModules: readonly Module<MixedOutput>[],\n debugIdModule: Module<VirtualJSOutput>,\n): readonly Module<MixedOutput>[] {\n const modifiedPreModules = [...preModules];\n if (\n modifiedPreModules.length > 0 &&\n modifiedPreModules[0] !== undefined &&\n modifiedPreModules[0].path === PRELUDE_MODULE_PATH\n ) {\n // prelude module must be first as it measures the bundle startup time\n modifiedPreModules.unshift(preModules[0]);\n modifiedPreModules[1] = debugIdModule;\n } else {\n modifiedPreModules.unshift(debugIdModule);\n }\n return modifiedPreModules;\n}\n\nasync function extractSerializerResult(serializerResult: MetroSerializerOutput): Promise<SerializedBundle> {\n if (typeof serializerResult === 'string') {\n return { code: serializerResult, map: '{}' };\n }\n\n if ('map' in serializerResult) {\n return { code: serializerResult.code, map: serializerResult.map };\n }\n\n const awaitedResult = await serializerResult;\n if (typeof awaitedResult === 'string') {\n return { code: awaitedResult, map: '{}' };\n }\n\n return { code: awaitedResult.code, map: awaitedResult.map };\n}\n\nfunction createDebugIdModule(debugId: string): Module<VirtualJSOutput> & { setSource: (code: string) => void } {\n let debugIdCode = createDebugIdSnippet(debugId);\n\n return {\n setSource: (code: string) => {\n debugIdCode = code;\n },\n dependencies: new Map(),\n getSource: () => Buffer.from(debugIdCode),\n inverseDependencies: createSet(),\n path: DEBUG_ID_MODULE_PATH,\n output: [\n {\n type: 'js/script/virtual',\n data: {\n code: debugIdCode,\n lineCount: countLines(debugIdCode),\n map: [],\n },\n },\n ],\n };\n}\n\nfunction calculateDebugId(bundle: Bundle): string {\n const hash = crypto.createHash('md5');\n hash.update(bundle.pre);\n for (const [, code] of bundle.modules) {\n hash.update(code);\n }\n hash.update(bundle.post);\n\n const debugId = stringToUUID(hash.digest('hex'));\n return debugId;\n}\n\nfunction injectDebugId(code: string, debugId: string): string {\n return code.replace(new RegExp(DEBUG_ID_PLACE_HOLDER, 'g'), debugId);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sentryMetroSerializer.js","sourceRoot":"","sources":["../../../src/js/tools/sentryMetroSerializer.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAEjC,uDAAuD;AAGvD,mCAA0G;AAC1G,gDAAoE;AAIpE,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAC1D,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAC3C,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAC1C,MAAM,kBAAkB,GAAG,uBAAuB,CAA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M,CAAC,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE;QACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KACnB;IACD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEzB,MAAM,OAAO,GAAG,IAAA,oBAAY,EAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACjD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,OAAe;IAClD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,qBAAqB,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import * as crypto from 'crypto';\nimport type { MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport * as countLines from 'metro/src/lib/countLines';\n\nimport type { Bundle, MetroSerializer, MetroSerializerOutput, SerializedBundle, VirtualJSOutput } from './utils';\nimport { createDebugIdSnippet, createSet, determineDebugIdFromBundleSource, stringToUUID } from './utils';\nimport { createDefaultMetroSerializer } from './vendor/metro/utils';\n\ntype SourceMap = Record<string, unknown>;\n\nconst DEBUG_ID_PLACE_HOLDER = '__debug_id_place_holder__';\nconst DEBUG_ID_MODULE_PATH = '__debugid__';\nconst PRELUDE_MODULE_PATH = '__prelude__';\nconst SOURCE_MAP_COMMENT = '//# sourceMappingURL=';\nconst DEBUG_ID_COMMENT = '//# debugId=';\n\n/**\n * Adds Sentry Debug ID polyfill module to the bundle.\n */\nexport function unstable_beforeAssetSerializationPlugin({\n premodules,\n debugId,\n}: {\n graph: ReadOnlyGraph<MixedOutput>;\n premodules: Module[];\n debugId?: string;\n}): Module[] {\n if (!debugId) {\n return premodules;\n }\n\n const debugIdModuleExists = premodules.findIndex(module => module.path === DEBUG_ID_MODULE_PATH) != -1;\n if (debugIdModuleExists) {\n // eslint-disable-next-line no-console\n console.warn('\\n\\nDebug ID module found. Skipping Sentry Debug ID module...\\n\\n');\n return premodules;\n }\n\n const debugIdModule = createDebugIdModule(debugId);\n return [...addDebugIdModule(premodules, debugIdModule)];\n}\n\n/**\n * Creates a Metro serializer that adds Debug ID module to the plain bundle.\n * The Debug ID module is a virtual module that provides a debug ID in runtime.\n *\n * RAM Bundles do not support custom serializers.\n */\nexport const createSentryMetroSerializer = (customSerializer?: MetroSerializer): MetroSerializer => {\n const serializer = customSerializer || createDefaultMetroSerializer();\n return async function (entryPoint, preModules, graph, options) {\n if (graph.transformOptions.hot) {\n return serializer(entryPoint, preModules, graph, options);\n }\n\n const debugIdModuleExists = preModules.findIndex(module => module.path === DEBUG_ID_MODULE_PATH) != -1;\n if (debugIdModuleExists) {\n // eslint-disable-next-line no-console\n console.warn('Debug ID module found. Skipping Sentry Debug ID module...');\n return serializer(entryPoint, preModules, graph, options);\n }\n\n const debugIdModule = createDebugIdModule(DEBUG_ID_PLACE_HOLDER);\n options.sentryBundleCallback = createSentryBundleCallback(debugIdModule);\n const modifiedPreModules = addDebugIdModule(preModules, debugIdModule);\n\n // Run wrapped serializer\n const serializerResult = serializer(entryPoint, modifiedPreModules, graph, options);\n const { code: bundleCode, map: bundleMapString } = await extractSerializerResult(serializerResult);\n\n // Add debug id comment to the bundle\n const debugId = determineDebugIdFromBundleSource(bundleCode);\n if (!debugId) {\n throw new Error(\n 'Debug ID was not found in the bundle. Call `options.sentryBundleCallback` if you are using a custom serializer.',\n );\n }\n // Only print debug id for command line builds => not hot reload from dev server\n // eslint-disable-next-line no-console\n console.log('info ' + `Bundle Debug ID: ${debugId}`);\n\n const debugIdComment = `${DEBUG_ID_COMMENT}${debugId}`;\n const indexOfSourceMapComment = bundleCode.lastIndexOf(SOURCE_MAP_COMMENT);\n const bundleCodeWithDebugId =\n indexOfSourceMapComment === -1\n ? // If source map comment is missing lets just add the debug id comment\n `${bundleCode}\\n${debugIdComment}`\n : // If source map comment is present lets add the debug id comment before it\n `${bundleCode.substring(0, indexOfSourceMapComment) + debugIdComment}\\n${bundleCode.substring(\n indexOfSourceMapComment,\n )}`;\n\n const bundleMap: SourceMap = JSON.parse(bundleMapString);\n // For now we write both fields until we know what will become the standard - if ever.\n bundleMap['debug_id'] = debugId;\n bundleMap['debugId'] = debugId;\n\n return {\n code: bundleCodeWithDebugId,\n map: JSON.stringify(bundleMap),\n };\n };\n};\n\n/**\n * This function is expected to be called after serializer creates the final bundle object\n * and before the source maps are generated.\n *\n * It injects a debug ID into the bundle and returns the modified bundle.\n *\n * Access it via `options.sentryBundleCallback` in your custom serializer.\n */\nfunction createSentryBundleCallback(debugIdModule: Module<VirtualJSOutput> & { setSource: (code: string) => void }) {\n return (bundle: Bundle) => {\n const debugId = calculateDebugId(bundle);\n debugIdModule.setSource(injectDebugId(debugIdModule.getSource().toString(), debugId));\n bundle.pre = injectDebugId(bundle.pre, debugId);\n return bundle;\n };\n}\n\nfunction addDebugIdModule(\n preModules: readonly Module<MixedOutput>[],\n debugIdModule: Module<VirtualJSOutput>,\n): readonly Module<MixedOutput>[] {\n const modifiedPreModules = [...preModules];\n if (\n modifiedPreModules.length > 0 &&\n modifiedPreModules[0] !== undefined &&\n modifiedPreModules[0].path === PRELUDE_MODULE_PATH\n ) {\n // prelude module must be first as it measures the bundle startup time\n modifiedPreModules.unshift(preModules[0]);\n modifiedPreModules[1] = debugIdModule;\n } else {\n modifiedPreModules.unshift(debugIdModule);\n }\n return modifiedPreModules;\n}\n\nasync function extractSerializerResult(serializerResult: MetroSerializerOutput): Promise<SerializedBundle> {\n if (typeof serializerResult === 'string') {\n return { code: serializerResult, map: '{}' };\n }\n\n if ('map' in serializerResult) {\n return { code: serializerResult.code, map: serializerResult.map };\n }\n\n const awaitedResult = await serializerResult;\n if (typeof awaitedResult === 'string') {\n return { code: awaitedResult, map: '{}' };\n }\n\n return { code: awaitedResult.code, map: awaitedResult.map };\n}\n\nfunction createDebugIdModule(debugId: string): Module<VirtualJSOutput> & { setSource: (code: string) => void } {\n let debugIdCode = createDebugIdSnippet(debugId);\n\n return {\n setSource: (code: string) => {\n debugIdCode = code;\n },\n dependencies: new Map(),\n getSource: () => Buffer.from(debugIdCode),\n inverseDependencies: createSet(),\n path: DEBUG_ID_MODULE_PATH,\n output: [\n {\n type: 'js/script/virtual',\n data: {\n code: debugIdCode,\n lineCount: countLines(debugIdCode),\n map: [],\n },\n },\n ],\n };\n}\n\nfunction calculateDebugId(bundle: Bundle): string {\n const hash = crypto.createHash('md5');\n hash.update(bundle.pre);\n for (const [, code] of bundle.modules) {\n hash.update(code);\n }\n hash.update(bundle.post);\n\n const debugId = stringToUUID(hash.digest('hex'));\n return debugId;\n}\n\nfunction injectDebugId(code: string, debugId: string): string {\n return code.replace(new RegExp(DEBUG_ID_PLACE_HOLDER, 'g'), debugId);\n}\n"]}
|
package/dist/js/version.d.ts
CHANGED
package/dist/js/version.js
CHANGED
package/dist/js/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.17.0';\n"]}
|
package/metro.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './dist/js/tools/
|
|
1
|
+
export * from './dist/js/tools/metroconfig';
|
package/metro.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('./dist/js/tools/
|
|
1
|
+
module.exports = require('./dist/js/tools/metroconfig');
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sentry/react-native",
|
|
3
3
|
"homepage": "https://github.com/getsentry/sentry-react-native",
|
|
4
4
|
"repository": "https://github.com/getsentry/sentry-react-native",
|
|
5
|
-
"version": "5.
|
|
5
|
+
"version": "5.17.0",
|
|
6
6
|
"description": "Official Sentry SDK for react-native",
|
|
7
7
|
"typings": "dist/js/index.d.ts",
|
|
8
8
|
"types": "dist/js/index.d.ts",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@sentry/browser": "7.81.1",
|
|
70
|
-
"@sentry/cli": "2.
|
|
70
|
+
"@sentry/cli": "2.25.2",
|
|
71
71
|
"@sentry/core": "7.81.1",
|
|
72
72
|
"@sentry/hub": "7.81.1",
|
|
73
73
|
"@sentry/integrations": "7.81.1",
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
# print commands before executing them and stop on first error
|
|
6
6
|
set -x -e
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
[ -z "$WITH_ENVIRONMENT" ] && WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
|
|
9
|
+
|
|
10
10
|
if [ -f "$WITH_ENVIRONMENT" ]; then
|
|
11
|
-
|
|
11
|
+
# load envs if loader file exists (since rn 0.68)
|
|
12
|
+
. "$WITH_ENVIRONMENT"
|
|
12
13
|
fi
|
|
13
14
|
|
|
14
15
|
LOCAL_NODE_BINARY=${NODE_BINARY:-node}
|
|
@@ -25,7 +26,7 @@ EXTRA_ARGS="$SENTRY_CLI_EXTRA_ARGS $SENTRY_CLI_DEBUG_FILES_UPLOAD_EXTRA_ARGS $IN
|
|
|
25
26
|
UPLOAD_DEBUG_FILES="\"$SENTRY_CLI_EXECUTABLE\" debug-files upload $EXTRA_ARGS \"$DWARF_DSYM_FOLDER_PATH\""
|
|
26
27
|
|
|
27
28
|
if [ "$SENTRY_DISABLE_AUTO_UPLOAD" != true ]; then
|
|
28
|
-
/bin/sh -c "$UPLOAD_DEBUG_FILES"
|
|
29
|
+
/bin/sh -c "\"$LOCAL_NODE_BINARY\" $UPLOAD_DEBUG_FILES"
|
|
29
30
|
else
|
|
30
31
|
echo "SENTRY_DISABLE_AUTO_UPLOAD=true, skipping debug files upload"
|
|
31
32
|
fi
|
package/scripts/sentry-xcode.sh
CHANGED
|
@@ -17,13 +17,13 @@ LOCAL_NODE_BINARY=${NODE_BINARY:-node}
|
|
|
17
17
|
|
|
18
18
|
REACT_NATIVE_XCODE=$1
|
|
19
19
|
|
|
20
|
-
[[ "$AUTO_RELEASE"
|
|
20
|
+
[[ "$AUTO_RELEASE" == false ]] && [[ -z "$BUNDLE_COMMAND" || "$BUNDLE_COMMAND" != "ram-bundle" ]] && NO_AUTO_RELEASE="--no-auto-release"
|
|
21
21
|
ARGS="$NO_AUTO_RELEASE $SENTRY_CLI_EXTRA_ARGS $SENTRY_CLI_RN_XCODE_EXTRA_ARGS"
|
|
22
22
|
|
|
23
23
|
REACT_NATIVE_XCODE_WITH_SENTRY="\"$SENTRY_CLI_EXECUTABLE\" react-native xcode $ARGS \"$REACT_NATIVE_XCODE\""
|
|
24
24
|
|
|
25
25
|
if [ "$SENTRY_DISABLE_AUTO_UPLOAD" != true ]; then
|
|
26
|
-
/bin/sh -c "$REACT_NATIVE_XCODE_WITH_SENTRY"
|
|
26
|
+
/bin/sh -c "\"$LOCAL_NODE_BINARY\" $REACT_NATIVE_XCODE_WITH_SENTRY"
|
|
27
27
|
else
|
|
28
28
|
echo "SENTRY_DISABLE_AUTO_UPLOAD=true, skipping sourcemaps upload"
|
|
29
29
|
/bin/sh -c "$REACT_NATIVE_XCODE"
|
package/sentry.gradle
CHANGED
|
@@ -130,10 +130,9 @@ gradle.projectsEvaluated {
|
|
|
130
130
|
def process = ["node", hasSourceMapDebugIdScript, sourcemapOutput].execute(null, new File("$reactRoot"))
|
|
131
131
|
def exitValue = process.waitFor()
|
|
132
132
|
project.logger.lifecycle("Check generated source map for Debug ID: ${process.text}")
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
extraArgs.addAll(notIncludeRelease ? [] : [
|
|
133
|
+
|
|
134
|
+
project.logger.lifecycle("Sentry Source Maps upload will include the release name and dist.")
|
|
135
|
+
extraArgs.addAll([
|
|
137
136
|
"--release", releaseName,
|
|
138
137
|
"--dist", versionCode
|
|
139
138
|
])
|