@sentry/react-native 8.5.0 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +2 -2
- package/android/expo-handler/build.gradle +20 -0
- package/android/expo-handler/src/main/java/io/sentry/react/expo/SentryExpoPackage.java +22 -0
- package/android/expo-handler/src/main/java/io/sentry/react/expo/SentryReactNativeHostHandler.java +48 -0
- package/android/expo-stubs/README.md +7 -0
- package/android/expo-stubs/build.gradle +23 -0
- package/android/expo-stubs/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/expo-stubs/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/android/expo-stubs/gradlew +251 -0
- package/android/expo-stubs/gradlew.bat +94 -0
- package/android/expo-stubs/settings.gradle +1 -0
- package/android/expo-stubs/src/main/java/expo/modules/core/interfaces/Package.java +11 -0
- package/android/expo-stubs/src/main/java/expo/modules/core/interfaces/ReactNativeHostHandler.java +7 -0
- package/android/libs/expo-stubs.jar +0 -0
- package/android/libs/replay-stubs.jar +0 -0
- package/android/replay-stubs/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryFrameDelayCollector.java +128 -0
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +63 -11
- package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
- package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +6 -0
- package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +6 -0
- package/dist/js/NativeLogListener.d.ts.map +1 -1
- package/dist/js/NativeLogListener.js.map +1 -1
- package/dist/js/NativeRNSentry.d.ts +1 -0
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/RNSentryReplayMaskNativeComponent.d.ts.map +1 -1
- package/dist/js/RNSentryReplayMaskNativeComponent.js +1 -2
- package/dist/js/RNSentryReplayMaskNativeComponent.js.map +1 -1
- package/dist/js/RNSentryReplayUnmaskNativeComponent.d.ts.map +1 -1
- package/dist/js/RNSentryReplayUnmaskNativeComponent.js +1 -2
- package/dist/js/RNSentryReplayUnmaskNativeComponent.js.map +1 -1
- package/dist/js/breadcrumb.d.ts.map +1 -1
- package/dist/js/breadcrumb.js.map +1 -1
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +1 -1
- package/dist/js/client.js.map +1 -1
- package/dist/js/feedback/FeedbackButton.d.ts +2 -1
- package/dist/js/feedback/FeedbackButton.d.ts.map +1 -1
- package/dist/js/feedback/FeedbackButton.js +5 -4
- package/dist/js/feedback/FeedbackButton.js.map +1 -1
- package/dist/js/feedback/{FeedbackWidget.d.ts → FeedbackForm.d.ts} +5 -5
- package/dist/js/feedback/FeedbackForm.d.ts.map +1 -0
- package/dist/js/feedback/{FeedbackWidget.js → FeedbackForm.js} +32 -30
- package/dist/js/feedback/FeedbackForm.js.map +1 -0
- package/dist/js/feedback/FeedbackForm.styles.d.ts +11 -0
- package/dist/js/feedback/FeedbackForm.styles.d.ts.map +1 -0
- package/dist/js/feedback/{FeedbackWidget.styles.js → FeedbackForm.styles.js} +1 -1
- package/dist/js/feedback/FeedbackForm.styles.js.map +1 -0
- package/dist/js/feedback/{FeedbackWidget.theme.d.ts → FeedbackForm.theme.d.ts} +7 -5
- package/dist/js/feedback/FeedbackForm.theme.d.ts.map +1 -0
- package/dist/js/feedback/{FeedbackWidget.theme.js → FeedbackForm.theme.js} +1 -1
- package/dist/js/feedback/FeedbackForm.theme.js.map +1 -0
- package/{ts3.8/dist/js/feedback/FeedbackWidget.types.d.ts → dist/js/feedback/FeedbackForm.types.d.ts} +305 -299
- package/dist/js/feedback/FeedbackForm.types.d.ts.map +1 -0
- package/dist/js/feedback/FeedbackForm.types.js +2 -0
- package/dist/js/feedback/FeedbackForm.types.js.map +1 -0
- package/dist/js/feedback/{FeedbackWidgetManager.d.ts → FeedbackFormManager.d.ts} +12 -4
- package/dist/js/feedback/FeedbackFormManager.d.ts.map +1 -0
- package/dist/js/feedback/{FeedbackWidgetManager.js → FeedbackFormManager.js} +22 -13
- package/dist/js/feedback/FeedbackFormManager.js.map +1 -0
- package/dist/js/feedback/{FeedbackWidgetProvider.d.ts → FeedbackFormProvider.d.ts} +10 -10
- package/dist/js/feedback/FeedbackFormProvider.d.ts.map +1 -0
- package/dist/js/feedback/{FeedbackWidgetProvider.js → FeedbackFormProvider.js} +18 -15
- package/dist/js/feedback/FeedbackFormProvider.js.map +1 -0
- package/dist/js/feedback/ScreenshotButton.d.ts +2 -2
- package/dist/js/feedback/ScreenshotButton.d.ts.map +1 -1
- package/dist/js/feedback/ScreenshotButton.js +6 -5
- package/dist/js/feedback/ScreenshotButton.js.map +1 -1
- package/dist/js/feedback/ShakeToReportBug.d.ts.map +1 -1
- package/dist/js/feedback/ShakeToReportBug.js.map +1 -1
- package/dist/js/feedback/defaults.d.ts +2 -2
- package/dist/js/feedback/defaults.d.ts.map +1 -1
- package/dist/js/feedback/defaults.js.map +1 -1
- package/dist/js/feedback/integration.d.ts +13 -13
- package/dist/js/feedback/integration.d.ts.map +1 -1
- package/dist/js/feedback/integration.js.map +1 -1
- package/dist/js/feedback/lazy.d.ts +5 -0
- package/dist/js/feedback/lazy.d.ts.map +1 -1
- package/dist/js/feedback/lazy.js +12 -0
- package/dist/js/feedback/lazy.js.map +1 -1
- package/dist/js/feedback/utils.d.ts.map +1 -1
- package/dist/js/feedback/utils.js +1 -0
- package/dist/js/feedback/utils.js.map +1 -1
- package/dist/js/index.d.ts +12 -3
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +12 -3
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/appRegistry.d.ts.map +1 -1
- package/dist/js/integrations/appRegistry.js.map +1 -1
- package/dist/js/integrations/breadcrumbs.d.ts.map +1 -1
- package/dist/js/integrations/breadcrumbs.js +1 -1
- package/dist/js/integrations/breadcrumbs.js.map +1 -1
- package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js +4 -5
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/debugsymbolicatorutils.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -1
- package/dist/js/integrations/default.d.ts.map +1 -1
- package/dist/js/integrations/default.js +1 -2
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/integrations/devicecontext.d.ts.map +1 -1
- package/dist/js/integrations/devicecontext.js +1 -1
- package/dist/js/integrations/devicecontext.js.map +1 -1
- package/dist/js/integrations/expoconstants.d.ts.map +1 -1
- package/dist/js/integrations/expoconstants.js.map +1 -1
- package/dist/js/integrations/expocontext.d.ts.map +1 -1
- package/dist/js/integrations/expocontext.js.map +1 -1
- package/dist/js/integrations/expoupdateslistener.d.ts.map +1 -1
- package/dist/js/integrations/expoupdateslistener.js +0 -1
- package/dist/js/integrations/expoupdateslistener.js.map +1 -1
- package/dist/js/integrations/graphql.d.ts.map +1 -1
- package/dist/js/integrations/graphql.js.map +1 -1
- package/dist/js/integrations/logEnricherIntegration.d.ts.map +1 -1
- package/dist/js/integrations/logEnricherIntegration.js +1 -1
- package/dist/js/integrations/logEnricherIntegration.js.map +1 -1
- package/dist/js/integrations/modulesloader.d.ts.map +1 -1
- package/dist/js/integrations/modulesloader.js.map +1 -1
- package/dist/js/integrations/nativelinkederrors.d.ts.map +1 -1
- package/dist/js/integrations/nativelinkederrors.js +1 -0
- package/dist/js/integrations/nativelinkederrors.js.map +1 -1
- package/dist/js/integrations/primitiveTagIntegration.d.ts.map +1 -1
- package/dist/js/integrations/primitiveTagIntegration.js.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.js +2 -1
- package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlersutils.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlersutils.js +0 -5
- package/dist/js/integrations/reactnativeerrorhandlersutils.js.map +1 -1
- package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeinfo.js.map +1 -1
- package/dist/js/integrations/release.d.ts.map +1 -1
- package/dist/js/integrations/release.js +1 -1
- package/dist/js/integrations/release.js.map +1 -1
- package/dist/js/integrations/rewriteframes.d.ts.map +1 -1
- package/dist/js/integrations/rewriteframes.js.map +1 -1
- package/dist/js/integrations/screenshot.d.ts.map +1 -1
- package/dist/js/integrations/screenshot.js +1 -1
- package/dist/js/integrations/screenshot.js.map +1 -1
- package/dist/js/integrations/sdkinfo.d.ts.map +1 -1
- package/dist/js/integrations/sdkinfo.js.map +1 -1
- package/dist/js/integrations/spotlight.d.ts.map +1 -1
- package/dist/js/integrations/spotlight.js.map +1 -1
- package/dist/js/integrations/supabase.d.ts.map +1 -1
- package/dist/js/integrations/supabase.js.map +1 -1
- package/dist/js/integrations/viewhierarchy.d.ts.map +1 -1
- package/dist/js/integrations/viewhierarchy.js +1 -1
- package/dist/js/integrations/viewhierarchy.js.map +1 -1
- package/dist/js/misc.js.map +1 -1
- package/dist/js/options.d.ts +1 -1
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/playground/examples.d.ts.map +1 -1
- package/dist/js/playground/examples.js.map +1 -1
- package/dist/js/playground/modal.d.ts +2 -2
- package/dist/js/playground/modal.d.ts.map +1 -1
- package/dist/js/playground/modal.js +5 -103
- package/dist/js/playground/modal.js.map +1 -1
- package/dist/js/playground/modal.styles.d.ts +100 -0
- package/dist/js/playground/modal.styles.d.ts.map +1 -0
- package/dist/js/playground/modal.styles.js +98 -0
- package/dist/js/playground/modal.styles.js.map +1 -0
- package/dist/js/profiling/cache.js +2 -2
- package/dist/js/profiling/cache.js.map +1 -1
- package/dist/js/profiling/convertHermesProfile.d.ts.map +1 -1
- package/dist/js/profiling/convertHermesProfile.js.map +1 -1
- package/dist/js/profiling/debugid.d.ts.map +1 -1
- package/dist/js/profiling/debugid.js.map +1 -1
- package/dist/js/profiling/hermes.d.ts.map +1 -1
- package/dist/js/profiling/hermes.js.map +1 -1
- package/dist/js/profiling/integration.d.ts.map +1 -1
- package/dist/js/profiling/integration.js.map +1 -1
- package/dist/js/profiling/types.d.ts.map +1 -1
- package/dist/js/profiling/types.js.map +1 -1
- package/dist/js/profiling/utils.d.ts.map +1 -1
- package/dist/js/profiling/utils.js +1 -1
- package/dist/js/profiling/utils.js.map +1 -1
- package/dist/js/replay/CustomMask.d.ts +1 -1
- package/dist/js/replay/CustomMask.d.ts.map +1 -1
- package/dist/js/replay/CustomMask.js +1 -1
- package/dist/js/replay/CustomMask.js.map +1 -1
- package/dist/js/replay/CustomMask.web.d.ts +1 -1
- package/dist/js/replay/CustomMask.web.d.ts.map +1 -1
- package/dist/js/replay/CustomMask.web.js +2 -2
- package/dist/js/replay/CustomMask.web.js.map +1 -1
- package/dist/js/replay/browserReplay.d.ts.map +1 -1
- package/dist/js/replay/browserReplay.js +0 -2
- package/dist/js/replay/browserReplay.js.map +1 -1
- package/dist/js/replay/mobilereplay.d.ts.map +1 -1
- package/dist/js/replay/mobilereplay.js +21 -2
- package/dist/js/replay/mobilereplay.js.map +1 -1
- package/dist/js/replay/networkUtils.d.ts +0 -1
- package/dist/js/replay/networkUtils.d.ts.map +1 -1
- package/dist/js/replay/networkUtils.js.map +1 -1
- package/dist/js/replay/xhrUtils.d.ts.map +1 -1
- package/dist/js/replay/xhrUtils.js.map +1 -1
- package/dist/js/scopeSync.d.ts.map +1 -1
- package/dist/js/scopeSync.js +1 -1
- package/dist/js/scopeSync.js.map +1 -1
- package/dist/js/sdk.d.ts +21 -0
- package/dist/js/sdk.d.ts.map +1 -1
- package/dist/js/sdk.js +42 -18
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tools/ModulesCollector.js +1 -1
- package/dist/js/tools/ModulesCollector.js.map +1 -1
- package/dist/js/tools/collectModules.js +0 -1
- package/dist/js/tools/collectModules.js.map +1 -1
- package/dist/js/tools/easBuildHooks.d.ts.map +1 -1
- package/dist/js/tools/easBuildHooks.js +13 -14
- package/dist/js/tools/easBuildHooks.js.map +1 -1
- package/dist/js/tools/enableLogger.js +1 -2
- package/dist/js/tools/enableLogger.js.map +1 -1
- package/dist/js/tools/metroMiddleware.d.ts.map +1 -1
- package/dist/js/tools/metroMiddleware.js.map +1 -1
- package/dist/js/tools/metroconfig.d.ts.map +1 -1
- package/dist/js/tools/metroconfig.js +10 -12
- package/dist/js/tools/metroconfig.js.map +1 -1
- package/dist/js/tools/sentryBabelTransformerUtils.d.ts.map +1 -1
- package/dist/js/tools/sentryBabelTransformerUtils.js +9 -10
- package/dist/js/tools/sentryBabelTransformerUtils.js.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.js +6 -7
- package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
- package/dist/js/tools/sentryOptionsSerializer.d.ts.map +1 -1
- package/dist/js/tools/sentryOptionsSerializer.js +3 -5
- package/dist/js/tools/sentryOptionsSerializer.js.map +1 -1
- package/dist/js/tools/sentryReleaseInjector.d.ts +1 -1
- package/dist/js/tools/sentryReleaseInjector.d.ts.map +1 -1
- package/dist/js/tools/sentryReleaseInjector.js.map +1 -1
- package/dist/js/tools/utils.d.ts.map +1 -1
- package/dist/js/tools/utils.js +7 -10
- package/dist/js/tools/utils.js.map +1 -1
- package/dist/js/tools/vendor/metro/countLines.d.ts.map +1 -1
- package/dist/js/tools/vendor/metro/utils.d.ts.map +1 -1
- package/dist/js/tools/vendor/metro/utils.js +5 -5
- package/dist/js/tools/vendor/metro/utils.js.map +1 -1
- package/dist/js/touchevents.d.ts.map +1 -1
- package/dist/js/touchevents.js +19 -19
- package/dist/js/touchevents.js.map +1 -1
- package/dist/js/tracing/expoAsset.js.map +1 -1
- package/dist/js/tracing/expoImage.d.ts.map +1 -1
- package/dist/js/tracing/expoImage.js +1 -1
- package/dist/js/tracing/expoImage.js.map +1 -1
- package/dist/js/tracing/expoRouter.d.ts.map +1 -1
- package/dist/js/tracing/expoRouter.js.map +1 -1
- package/dist/js/tracing/gesturetracing.d.ts.map +1 -1
- package/dist/js/tracing/gesturetracing.js.map +1 -1
- package/dist/js/tracing/integrations/appStart.d.ts +19 -1
- package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
- package/dist/js/tracing/integrations/appStart.js +144 -9
- package/dist/js/tracing/integrations/appStart.js.map +1 -1
- package/dist/js/tracing/integrations/nativeFrames.d.ts.map +1 -1
- package/dist/js/tracing/integrations/nativeFrames.js +47 -1
- package/dist/js/tracing/integrations/nativeFrames.js.map +1 -1
- package/dist/js/tracing/integrations/stalltracking.d.ts +1 -1
- package/dist/js/tracing/integrations/stalltracking.d.ts.map +1 -1
- package/dist/js/tracing/integrations/stalltracking.js +4 -2
- package/dist/js/tracing/integrations/stalltracking.js.map +1 -1
- package/dist/js/tracing/integrations/timeToDisplayIntegration.d.ts.map +1 -1
- package/dist/js/tracing/integrations/timeToDisplayIntegration.js +15 -15
- package/dist/js/tracing/integrations/timeToDisplayIntegration.js.map +1 -1
- package/dist/js/tracing/integrations/userInteraction.d.ts.map +1 -1
- package/dist/js/tracing/integrations/userInteraction.js.map +1 -1
- package/dist/js/tracing/onSpanEndUtils.d.ts.map +1 -1
- package/dist/js/tracing/onSpanEndUtils.js +43 -14
- package/dist/js/tracing/onSpanEndUtils.js.map +1 -1
- package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnativenavigation.js.map +1 -1
- package/dist/js/tracing/reactnativeprofiler.d.ts.map +1 -1
- package/dist/js/tracing/reactnativeprofiler.js +2 -2
- package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
- package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
- package/dist/js/tracing/reactnativetracing.js +0 -1
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/tracing/reactnavigation.d.ts +3 -0
- package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnavigation.js +6 -4
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/tracing/span.d.ts +2 -17
- package/dist/js/tracing/span.d.ts.map +1 -1
- package/dist/js/tracing/span.js +1 -1
- package/dist/js/tracing/span.js.map +1 -1
- package/dist/js/tracing/timeToDisplayFallback.d.ts.map +1 -1
- package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
- package/dist/js/tracing/timetodisplay.js +42 -19
- package/dist/js/tracing/timetodisplay.js.map +1 -1
- package/dist/js/tracing/timetodisplaynative.d.ts +1 -1
- package/dist/js/tracing/timetodisplaynative.d.ts.map +1 -1
- package/dist/js/tracing/timetodisplaynative.js +5 -4
- package/dist/js/tracing/timetodisplaynative.js.map +1 -1
- package/dist/js/tracing/types.js.map +1 -1
- package/dist/js/tracing/utils.d.ts.map +1 -1
- package/dist/js/tracing/utils.js.map +1 -1
- package/dist/js/transports/encodePolyfill.d.ts +1 -1
- package/dist/js/transports/encodePolyfill.d.ts.map +1 -1
- package/dist/js/transports/encodePolyfill.js.map +1 -1
- package/dist/js/transports/native.d.ts.map +1 -1
- package/dist/js/transports/native.js.map +1 -1
- package/dist/js/utils/AsyncExpiringMap.js.map +1 -1
- package/dist/js/utils/encode.js.map +1 -1
- package/dist/js/utils/envelope.d.ts.map +1 -1
- package/dist/js/utils/envelope.js.map +1 -1
- package/dist/js/utils/environment.d.ts.map +1 -1
- package/dist/js/utils/environment.js.map +1 -1
- package/dist/js/utils/expomodules.d.ts.map +1 -1
- package/dist/js/utils/expomodules.js.map +1 -1
- package/dist/js/utils/fill.js +1 -1
- package/dist/js/utils/fill.js.map +1 -1
- package/dist/js/utils/ignorerequirecyclelogs.js.map +1 -1
- package/dist/js/utils/normalize.js +2 -2
- package/dist/js/utils/normalize.js.map +1 -1
- package/dist/js/utils/outcome.js.map +1 -1
- package/dist/js/utils/primitiveConverter.js.map +1 -1
- package/dist/js/utils/release.js.map +1 -1
- package/dist/js/utils/rnlibraries.d.ts.map +1 -1
- package/dist/js/utils/rnlibraries.js +1 -7
- package/dist/js/utils/rnlibraries.js.map +1 -1
- package/dist/js/utils/safe.d.ts.map +1 -1
- package/dist/js/utils/safe.js.map +1 -1
- package/dist/js/utils/span.d.ts.map +1 -1
- package/dist/js/utils/span.js.map +1 -1
- package/dist/js/utils/worldwide.d.ts +0 -1
- package/dist/js/utils/worldwide.d.ts.map +1 -1
- package/dist/js/utils/worldwide.js.map +1 -1
- package/dist/js/utils/xhr.d.ts +0 -1
- package/dist/js/utils/xhr.d.ts.map +1 -1
- package/dist/js/utils/xhr.js.map +1 -1
- package/dist/js/vendor/base64-js/fromByteArray.js +1 -1
- package/dist/js/vendor/base64-js/fromByteArray.js.map +1 -1
- package/dist/js/vendor/buffer/utf8ToBytes.js +1 -1
- package/dist/js/vendor/buffer/utf8ToBytes.js.map +1 -1
- package/dist/js/vendor/react-native/index.d.ts.map +1 -1
- package/dist/js/vendor/react-native/index.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts +1 -0
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +20 -9
- package/dist/js/wrapper.js.map +1 -1
- package/expo-module.config.json +7 -0
- package/ios/RNSentry.mm +18 -1
- package/ios/RNSentryReplay.mm +1 -1
- package/ios/RNSentrySDK.m +1 -1
- package/ios/RNSentryStart.m +4 -1
- package/ios/RNSentryTimeToDisplay.m +48 -32
- package/ios/RNSentryVersion.m +1 -1
- package/ios/SentryScreenFramesWrapper.h +2 -0
- package/ios/SentryScreenFramesWrapper.m +35 -0
- package/package.json +18 -22
- package/plugin/build/logger.js +1 -1
- package/plugin/build/utils.js +2 -0
- package/plugin/build/withSentry.js +1 -2
- package/plugin/build/withSentryAndroid.js +2 -0
- package/plugin/build/withSentryAndroidGradlePlugin.d.ts +1 -1
- package/plugin/build/withSentryAndroidGradlePlugin.js +1 -1
- package/plugin/build/withSentryIOS.js +1 -3
- package/scripts/eas-build-hook.js +0 -2
- package/scripts/expo-upload-sourcemaps.js +0 -1
- package/src/js/NativeRNSentry.ts +3 -0
- package/src/js/RNSentryReplayMaskNativeComponent.ts +2 -3
- package/src/js/RNSentryReplayUnmaskNativeComponent.ts +2 -3
- package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -0
- package/ts3.8/dist/js/feedback/FeedbackButton.d.ts +2 -1
- package/ts3.8/dist/js/feedback/{FeedbackWidget.d.ts → FeedbackForm.d.ts} +5 -5
- package/ts3.8/dist/js/feedback/FeedbackForm.styles.d.ts +11 -0
- package/ts3.8/dist/js/feedback/{FeedbackWidget.theme.d.ts → FeedbackForm.theme.d.ts} +7 -5
- package/{dist/js/feedback/FeedbackWidget.types.d.ts → ts3.8/dist/js/feedback/FeedbackForm.types.d.ts} +305 -299
- package/ts3.8/dist/js/feedback/{FeedbackWidgetManager.d.ts → FeedbackFormManager.d.ts} +12 -4
- package/ts3.8/dist/js/feedback/{FeedbackWidgetProvider.d.ts → FeedbackFormProvider.d.ts} +10 -10
- package/ts3.8/dist/js/feedback/ScreenshotButton.d.ts +2 -2
- package/ts3.8/dist/js/feedback/defaults.d.ts +2 -2
- package/ts3.8/dist/js/feedback/integration.d.ts +13 -13
- package/ts3.8/dist/js/feedback/lazy.d.ts +5 -0
- package/ts3.8/dist/js/index.d.ts +12 -3
- package/ts3.8/dist/js/options.d.ts +1 -1
- package/ts3.8/dist/js/playground/modal.d.ts +2 -2
- package/ts3.8/dist/js/playground/modal.styles.d.ts +100 -0
- package/ts3.8/dist/js/replay/CustomMask.d.ts +1 -1
- package/ts3.8/dist/js/replay/CustomMask.web.d.ts +1 -1
- package/ts3.8/dist/js/replay/networkUtils.d.ts +0 -1
- package/ts3.8/dist/js/sdk.d.ts +21 -0
- package/ts3.8/dist/js/tracing/integrations/appStart.d.ts +19 -1
- package/ts3.8/dist/js/tracing/integrations/stalltracking.d.ts +1 -1
- package/ts3.8/dist/js/tracing/reactnavigation.d.ts +3 -0
- package/ts3.8/dist/js/tracing/span.d.ts +2 -17
- package/ts3.8/dist/js/tracing/timetodisplaynative.d.ts +1 -1
- package/ts3.8/dist/js/transports/encodePolyfill.d.ts +1 -1
- package/ts3.8/dist/js/utils/worldwide.d.ts +0 -1
- package/ts3.8/dist/js/utils/xhr.d.ts +0 -1
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/ts3.8/dist/js/wrapper.d.ts +1 -0
- package/dist/js/feedback/FeedbackWidget.d.ts.map +0 -1
- package/dist/js/feedback/FeedbackWidget.js.map +0 -1
- package/dist/js/feedback/FeedbackWidget.styles.d.ts +0 -11
- package/dist/js/feedback/FeedbackWidget.styles.d.ts.map +0 -1
- package/dist/js/feedback/FeedbackWidget.styles.js.map +0 -1
- package/dist/js/feedback/FeedbackWidget.theme.d.ts.map +0 -1
- package/dist/js/feedback/FeedbackWidget.theme.js.map +0 -1
- package/dist/js/feedback/FeedbackWidget.types.d.ts.map +0 -1
- package/dist/js/feedback/FeedbackWidget.types.js +0 -2
- package/dist/js/feedback/FeedbackWidget.types.js.map +0 -1
- package/dist/js/feedback/FeedbackWidgetManager.d.ts.map +0 -1
- package/dist/js/feedback/FeedbackWidgetManager.js.map +0 -1
- package/dist/js/feedback/FeedbackWidgetProvider.d.ts.map +0 -1
- package/dist/js/feedback/FeedbackWidgetProvider.js.map +0 -1
- package/ts3.8/dist/js/feedback/FeedbackWidget.styles.d.ts +0 -11
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,EACL,KAAK,EACL,SAAS,EACT,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,iCAAiC,EACjC,SAAS,IAAI,aAAa,GAC3B,MAAM,cAAc,CAAC;AACtB,OA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MAAM,CAAC,WAAW,EAAE,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAgB,KAAK;;QACzB,IAAI;YACF,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAE3B,IAAI,MAAM,EAAE;gBACV,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;gBAEpC,OAAO,MAAM,CAAC;aACf;YACD,oCAAoC;SACrC;QAAC,OAAO,CAAC,EAAE,GAAG;QAEf,KAAK,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAEhD,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,KAAK,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;SACxC;IACH,CAAC;CAAA;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,KAAK,CAAC,KAAK,CAAC,wCAAwC,EAAE,CAAC,CAAC,CAAC;YACzD,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 type { Breadcrumb, BreadcrumbHint, Integration, Scope } from '@sentry/core';\nimport {\n debug,\n getClient,\n getGlobalScope,\n getIntegrationsToSetup,\n getIsolationScope,\n initAndBind,\n makeDsn,\n stackParserFromStackParserOptions,\n withScope as coreWithScope,\n} from '@sentry/core';\nimport { defaultStackParser, makeFetchTransport, Profiler } from '@sentry/react';\nimport * as React from 'react';\nimport { ReactNativeClient } from './client';\nimport { FeedbackWidgetProvider } from './feedback/FeedbackWidgetProvider';\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, isWeb } from './utils/environment';\nimport { getDefaultRelease } from './utils/release';\nimport { safeFactory, safeTracesSampler } from './utils/safe';\nimport { RN_GLOBAL_OBJ } from './utils/worldwide';\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 propagateTraceparent: 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 userOptions = {\n ...RN_GLOBAL_OBJ.__SENTRY_OPTIONS__,\n ...passedOptions,\n };\n\n const maxQueueSize = userOptions.maxQueueSize\n // eslint-disable-next-line deprecation/deprecation\n ?? userOptions.transportOptions?.bufferSize\n ?? DEFAULT_OPTIONS.maxQueueSize;\n\n const enableNative = userOptions.enableNative === undefined || userOptions.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 | undefined): string | undefined => {\n if (!dsn) {\n return undefined;\n }\n const dsnComponents = makeDsn(dsn);\n if (!dsnComponents) {\n debug.error('Failed to extract url from DSN: ', dsn);\n return undefined;\n }\n const port = dsnComponents.port ? `:${dsnComponents.port}` : '';\n return `${dsnComponents.protocol}://${dsnComponents.host}${port}`;\n };\n\n const userBeforeBreadcrumb = safeFactory(userOptions.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(userOptions.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 ...userOptions,\n release: userOptions.release ?? getDefaultRelease(),\n enableNative,\n enableNativeNagger: shouldEnableNativeNagger(userOptions.enableNativeNagger),\n // If custom transport factory fails the SDK won't initialize\n transport: userOptions.transport\n || makeNativeTransportFactory({\n enableNative,\n })\n || makeFetchTransport,\n transportOptions: {\n ...DEFAULT_OPTIONS.transportOptions,\n ...(userOptions.transportOptions ?? {}),\n bufferSize: maxQueueSize,\n },\n maxQueueSize,\n integrations: [],\n stackParser: stackParserFromStackParserOptions(userOptions.stackParser || defaultStackParser),\n beforeBreadcrumb: chainedBeforeBreadcrumb,\n initialScope: safeFactory(userOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }),\n };\n\n if (!('autoInitializeNativeSdk' in userOptions) && RN_GLOBAL_OBJ.__SENTRY_OPTIONS__) {\n // Options file is present, native SDK is expected to be initialized\n // before JS from the native app entry point (e.g. AppDelegate, MainApplication).\n // eslint-disable-next-line no-console\n console.info('[Sentry] Using options file. Native SDK is expected to be initialized before JS, skipping automatic native initialization from JS.');\n options.autoInitializeNativeSdk = false;\n }\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[] = userOptions.defaultIntegrations === undefined\n ? getDefaultIntegrations(options)\n : userOptions.defaultIntegrations;\n\n options.integrations = getIntegrationsToSetup({\n integrations: safeFactory(userOptions.integrations, { loggerMessage: 'The integrations threw an error' }),\n defaultIntegrations,\n });\n initAndBind(ReactNativeClient, options);\n\n if (isExpoGo()) {\n debug.log('Offline caching, native errors features are not available in Expo Go.');\n debug.log('Use EAS Build / Native Release Build to test these features.');\n }\n\n if (RN_GLOBAL_OBJ.__SENTRY_OPTIONS__) {\n debug.log('Sentry JS initialized with options from the options file.');\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 updateProps: {}\n };\n\n const ProfilerComponent = isWeb() ? Profiler : ReactNativeProfiler;\n\n const RootApp: React.FC<P> = appProps => {\n return (\n <TouchEventBoundary {...(options?.touchEventBoundaryProps ?? {})}>\n <ProfilerComponent {...profilerProps}>\n <FeedbackWidgetProvider>\n <RootComponent {...appProps} />\n </FeedbackWidgetProvider>\n </ProfilerComponent>\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 debug.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 debug.error('Failed to close the SDK');\n }\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 debug.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":";;;;;;;;;AAGA,OAAO,EACL,KAAK,EACL,SAAS,EACT,cAAc,EACd,sB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GAAG,CAAC,KAAY,EAAiB,EAAE;QACnD,IAAI,CAAC;YACH,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,KAAK,CAAC,KAAK,CAAC,wCAAwC,EAAE,CAAC,CAAC,CAAC;YACzD,OAAO,SAAS,CAAC;QACnB,CAAC;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":["/* oxlint-disable eslint(complexity) */\nimport type { Breadcrumb, BreadcrumbHint, Integration, Scope } from '@sentry/core';\n\nimport {\n debug,\n getClient,\n getGlobalScope,\n getIntegrationsToSetup,\n getIsolationScope,\n initAndBind,\n makeDsn,\n stackParserFromStackParserOptions,\n withScope as coreWithScope,\n} from '@sentry/core';\nimport { defaultStackParser, makeFetchTransport, Profiler } from '@sentry/react';\nimport * as React from 'react';\n\nimport type { ReactNativeClientOptions, ReactNativeOptions, ReactNativeWrapperOptions } from './options';\n\nimport { ReactNativeClient } from './client';\nimport { FeedbackFormProvider } from './feedback/FeedbackFormProvider';\nimport { getDevServer } from './integrations/debugsymbolicatorutils';\nimport { getDefaultIntegrations } from './integrations/default';\nimport { shouldEnableNativeNagger } from './options';\nimport { enableSyncToNative } from './scopeSync';\nimport { TouchEventBoundary } from './touchevents';\nimport { ReactNativeProfiler } from './tracing';\nimport { _appLoaded } from './tracing/integrations/appStart';\nimport { useEncodePolyfill } from './transports/encodePolyfill';\nimport { DEFAULT_BUFFER_SIZE, makeNativeTransportFactory } from './transports/native';\nimport { getDefaultEnvironment, isExpoGo, isRunningInMetroDevServer, isWeb } from './utils/environment';\nimport { getDefaultRelease } from './utils/release';\nimport { safeFactory, safeTracesSampler } from './utils/safe';\nimport { RN_GLOBAL_OBJ } from './utils/worldwide';\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 propagateTraceparent: 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 userOptions = {\n ...RN_GLOBAL_OBJ.__SENTRY_OPTIONS__,\n ...passedOptions,\n };\n\n const maxQueueSize =\n userOptions.maxQueueSize ?? userOptions.transportOptions?.bufferSize ?? DEFAULT_OPTIONS.maxQueueSize;\n\n const enableNative =\n userOptions.enableNative === undefined || userOptions.enableNative ? NATIVE.isNativeAvailable() : false;\n\n useEncodePolyfill();\n if (enableNative) {\n enableSyncToNative(getGlobalScope());\n enableSyncToNative(getIsolationScope());\n }\n\n const getURLFromDSN = (dsn: string | undefined): string | undefined => {\n if (!dsn) {\n return undefined;\n }\n const dsnComponents = makeDsn(dsn);\n if (!dsnComponents) {\n debug.error('Failed to extract url from DSN: ', dsn);\n return undefined;\n }\n const port = dsnComponents.port ? `:${dsnComponents.port}` : '';\n return `${dsnComponents.protocol}://${dsnComponents.host}${port}`;\n };\n\n const userBeforeBreadcrumb = safeFactory(userOptions.beforeBreadcrumb, {\n loggerMessage: 'The beforeBreadcrumb threw an error',\n });\n\n // Exclude Dev Server and Sentry Dsn request from Breadcrumbs\n const devServerUrl = getDevServer()?.url;\n const dsn = getURLFromDSN(userOptions.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 ...userOptions,\n release: userOptions.release ?? getDefaultRelease(),\n enableNative,\n enableNativeNagger: shouldEnableNativeNagger(userOptions.enableNativeNagger),\n // If custom transport factory fails the SDK won't initialize\n transport:\n userOptions.transport ||\n makeNativeTransportFactory({\n enableNative,\n }) ||\n makeFetchTransport,\n transportOptions: {\n ...DEFAULT_OPTIONS.transportOptions,\n ...(userOptions.transportOptions ?? {}),\n bufferSize: maxQueueSize,\n },\n maxQueueSize,\n integrations: [],\n stackParser: stackParserFromStackParserOptions(userOptions.stackParser || defaultStackParser),\n beforeBreadcrumb: chainedBeforeBreadcrumb,\n initialScope: safeFactory(userOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }),\n };\n\n if (!('autoInitializeNativeSdk' in userOptions) && RN_GLOBAL_OBJ.__SENTRY_OPTIONS__ && !__DEV__) {\n // Options file is present in a release build, native SDK is expected to be initialized\n // before JS from the native app entry point (e.g. AppDelegate, MainApplication).\n // In dev builds, we always re-initialize from JS to set up the native log bridge\n // and provide runtime values (devServerUrl, defaultSidecarUrl, etc.).\n // oxlint-disable-next-line eslint(no-console)\n console.info(\n '[Sentry] Using options file. Native SDK is expected to be initialized before JS, skipping automatic native initialization from JS.',\n );\n options.autoInitializeNativeSdk = false;\n }\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[] =\n userOptions.defaultIntegrations === undefined ? getDefaultIntegrations(options) : userOptions.defaultIntegrations;\n\n options.integrations = getIntegrationsToSetup({\n integrations: safeFactory(userOptions.integrations, { loggerMessage: 'The integrations threw an error' }),\n defaultIntegrations,\n });\n initAndBind(ReactNativeClient, options);\n\n if (isExpoGo()) {\n debug.log('Offline caching, native errors features are not available in Expo Go.');\n debug.log('Use EAS Build / Native Release Build to test these features.');\n }\n\n if (RN_GLOBAL_OBJ.__SENTRY_OPTIONS__) {\n debug.log('Sentry JS initialized with options from the options file.');\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 updateProps: {},\n };\n\n const ProfilerComponent = isWeb() ? Profiler : ReactNativeProfiler;\n\n const RootApp: React.FC<P> = appProps => {\n return (\n <TouchEventBoundary {...(options?.touchEventBoundaryProps ?? {})}>\n <ProfilerComponent {...profilerProps}>\n <FeedbackFormProvider>\n <RootComponent {...appProps} />\n </FeedbackFormProvider>\n </ProfilerComponent>\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 * Signals that the application has finished loading and is ready for user interaction.\n *\n * Call this when your app is truly ready — after async initialization, data loading,\n * splash screen dismissal, auth session restore, etc. This marks the end of the app start span,\n * giving you a more accurate measurement of perceived startup time.\n *\n * If not called, the SDK falls back to the root component mount time (via `Sentry.wrap()`)\n * or JS bundle execution start.\n *\n * @experimental This API is subject to change in future versions.\n *\n * @example\n * ```ts\n * await loadRemoteConfig();\n * await restoreSession();\n * SplashScreen.hide();\n * Sentry.appLoaded();\n * ```\n */\nexport function appLoaded(): void {\n // oxlint-disable-next-line typescript-eslint(no-floating-promises)\n _appLoaded();\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 } catch (_) {}\n\n debug.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 debug.error('Failed to close the SDK');\n }\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 debug.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"]}
|
|
@@ -4,7 +4,7 @@ const core_1 = require("@sentry/core");
|
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
core_1.debug.enable();
|
|
7
|
-
//
|
|
7
|
+
// oxlint-disable-next-line typescript-eslint(unbound-method)
|
|
8
8
|
const { dirname, join, resolve, sep: posixSep } = path_1.posix;
|
|
9
9
|
/**
|
|
10
10
|
* Collects JS modules from source paths.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModulesCollector.js","sourceRoot":"","sources":["../../../src/js/tools/ModulesCollector.ts"],"names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C","sourcesContent":["import { debug } from '@sentry/core';\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';\nimport { posix, sep } from 'path';\n\ndebug.enable();\n\n// oxlint-disable-next-line typescript-eslint(unbound-method)\nconst { dirname, join, resolve, sep: posixSep } = posix;\n\ninterface Package {\n name?: string;\n version?: string;\n}\n\n/**\n * Collects JS modules from source paths.\n */\nexport default class ModulesCollector {\n /** Collect method */\n public static collect(sources: unknown[], modulesPaths: string[]): Record<string, string> {\n const normalizedModulesPaths = modulesPaths.map(modulesPath => resolve(modulesPath.split(sep).join(posixSep)));\n\n const infos: Record<string, string> = {};\n const seen: Record<string, true> = {};\n\n sources.forEach((path: unknown) => {\n if (typeof path !== 'string') {\n return;\n }\n\n let dir = path; // included source file path\n let candidate: Package | null = null;\n\n /** Traverse directories upward in the search of all package.json files */\n const upDirSearch = (): void => {\n const parentDir = dir;\n dir = dirname(parentDir);\n\n if (normalizedModulesPaths.includes(resolve(dir))) {\n if (candidate?.name && candidate?.version) {\n infos[candidate.name] = candidate.version;\n } else if (candidate?.name) {\n infos[candidate.name] = 'unknown';\n }\n return;\n }\n\n if (!dir || parentDir === dir || seen[dir]) {\n return;\n }\n seen[dir] = true;\n\n const pkgPath = join(dir, 'package.json');\n if (!existsSync(pkgPath)) {\n // fast-forward if the package.json doesn't exist\n return upDirSearch();\n }\n\n try {\n const info: Package = JSON.parse(readFileSync(pkgPath, 'utf8'));\n candidate = {\n name: info.name,\n version: info.version,\n };\n } catch (error) {\n debug.error(`Failed to read ${pkgPath}`);\n }\n\n return upDirSearch(); // processed package.json file, continue up search\n };\n\n upDirSearch();\n });\n\n return infos;\n }\n\n /**\n * Runs collection of modules.\n */\n public static run({\n sourceMapPath,\n outputModulesPath,\n modulesPaths,\n collect,\n }: Partial<{\n sourceMapPath: string;\n outputModulesPath: string;\n modulesPaths: string[];\n collect: (sources: unknown[], modulesPaths: string[]) => Record<string, string>;\n }>): void {\n if (!sourceMapPath) {\n debug.error('First argument `source-map-path` is missing!');\n return;\n }\n if (!outputModulesPath) {\n debug.error('Second argument `modules-output-path` is missing!');\n return;\n }\n if (!modulesPaths || modulesPaths.length === 0) {\n debug.error('Third argument `modules-paths` is missing!');\n return;\n }\n\n debug.log('Reading source map from', sourceMapPath);\n debug.log('Saving modules to', outputModulesPath);\n debug.log('Resolving modules from paths', modulesPaths.join(', '));\n\n if (!existsSync(sourceMapPath)) {\n debug.error(`Source map file does not exist at ${sourceMapPath}`);\n return;\n }\n for (const modulesPath of modulesPaths) {\n if (!existsSync(modulesPath)) {\n debug.error(`Modules path does not exist at ${modulesPath}`);\n return;\n }\n }\n\n const map: { sources?: unknown } = JSON.parse(readFileSync(sourceMapPath, 'utf8'));\n if (!map.sources || !Array.isArray(map.sources)) {\n debug.error(`Modules not collected. No sources found in the source map (${sourceMapPath})!`);\n return;\n }\n\n const sources: unknown[] = map.sources;\n const modules = collect ? collect(sources, modulesPaths) : ModulesCollector.collect(sources, modulesPaths);\n\n const outputModulesDirPath = dirname(outputModulesPath);\n if (!existsSync(outputModulesDirPath)) {\n mkdirSync(outputModulesDirPath, { recursive: true });\n }\n writeFileSync(outputModulesPath, JSON.stringify(modules, null, 2));\n debug.log(`Modules collected and saved to: ${outputModulesPath}`);\n }\n}\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
4
3
|
const process_1 = require("process");
|
|
5
4
|
const ModulesCollector_1 = require("./ModulesCollector");
|
|
6
5
|
const sourceMapPath = process_1.argv[2];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectModules.js","sourceRoot":"","sources":["../../../src/js/tools/collectModules.ts"],"names":[],"mappings":";;AAAA
|
|
1
|
+
{"version":3,"file":"collectModules.js","sourceRoot":"","sources":["../../../src/js/tools/collectModules.ts"],"names":[],"mappings":";;AAAA,qCAA+B;AAE/B,yDAAkD;AAElD,MAAM,aAAa,GAAuB,cAAI,CAAC,CAAC,CAAC,CAAC;AAClD,MAAM,iBAAiB,GAAuB,cAAI,CAAC,CAAC,CAAC,CAAC;AACtD,MAAM,YAAY,GAAa,cAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,cAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAEjE,0BAAgB,CAAC,GAAG,CAAC,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC,CAAC","sourcesContent":["import { argv } from 'process';\n\nimport ModulesCollector from './ModulesCollector';\n\nconst sourceMapPath: string | undefined = argv[2];\nconst outputModulesPath: string | undefined = argv[3];\nconst modulesPaths: string[] = argv[4] ? argv[4].split(',') : [];\n\nModulesCollector.run({ sourceMapPath, outputModulesPath, modulesPaths });\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"easBuildHooks.d.ts","sourceRoot":"","sources":["../../../src/js/tools/easBuildHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"easBuildHooks.d.ts","sourceRoot":"","sources":["../../../src/js/tools/easBuildHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAaH;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,uDAAuD;AACvD,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAoBD,yDAAyD;AACzD,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED,gDAAgD;AAChD,wBAAgB,cAAc,IAAI,WAAW,CAe5C;AAkGD,qFAAqF;AACrF,wBAAsB,oBAAoB,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0B3F;AAED,yFAAyF;AACzF,wBAAsB,sBAAsB,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4B7F;AAED,yGAAyG;AACzG,wBAAsB,uBAAuB,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAY9F"}
|
|
@@ -20,7 +20,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.
|
|
23
|
+
exports.isEASBuild = isEASBuild;
|
|
24
|
+
exports.getEASBuildEnv = getEASBuildEnv;
|
|
25
|
+
exports.captureEASBuildError = captureEASBuildError;
|
|
26
|
+
exports.captureEASBuildSuccess = captureEASBuildSuccess;
|
|
27
|
+
exports.captureEASBuildComplete = captureEASBuildComplete;
|
|
24
28
|
const core_1 = require("@sentry/core");
|
|
25
29
|
const version_1 = require("../version");
|
|
26
30
|
const SENTRY_DSN_ENV = 'SENTRY_DSN';
|
|
@@ -29,7 +33,6 @@ const EAS_BUILD_ENV = 'EAS_BUILD';
|
|
|
29
33
|
function isEASBuild() {
|
|
30
34
|
return process.env[EAS_BUILD_ENV] === 'true';
|
|
31
35
|
}
|
|
32
|
-
exports.isEASBuild = isEASBuild;
|
|
33
36
|
/** Gets the EAS build environment variables. */
|
|
34
37
|
function getEASBuildEnv() {
|
|
35
38
|
return {
|
|
@@ -47,7 +50,6 @@ function getEASBuildEnv() {
|
|
|
47
50
|
EAS_BUILD_WORKINGDIR: process.env.EAS_BUILD_WORKINGDIR,
|
|
48
51
|
};
|
|
49
52
|
}
|
|
50
|
-
exports.getEASBuildEnv = getEASBuildEnv;
|
|
51
53
|
function getEnvelopeEndpoint(dsn) {
|
|
52
54
|
const { protocol, host, port, path, projectId, publicKey } = dsn;
|
|
53
55
|
const portStr = port ? `:${port}` : '';
|
|
@@ -145,9 +147,9 @@ function createBaseEvent(level, env, customTags) {
|
|
|
145
147
|
};
|
|
146
148
|
}
|
|
147
149
|
/** Captures an EAS build error event. Call this from the eas-build-on-error hook. */
|
|
148
|
-
function captureEASBuildError(
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
function captureEASBuildError() {
|
|
151
|
+
return __awaiter(this, arguments, void 0, function* (options = {}) {
|
|
152
|
+
var _a, _b, _c, _d, _e, _f;
|
|
151
153
|
const dsnString = (_a = options.dsn) !== null && _a !== void 0 ? _a : process.env[SENTRY_DSN_ENV];
|
|
152
154
|
if (!dsnString) {
|
|
153
155
|
console.warn('[Sentry] No DSN provided. Set SENTRY_DSN environment variable or pass dsn option.');
|
|
@@ -174,11 +176,10 @@ function captureEASBuildError(options = {}) {
|
|
|
174
176
|
console.log('[Sentry] Build error captured.');
|
|
175
177
|
});
|
|
176
178
|
}
|
|
177
|
-
exports.captureEASBuildError = captureEASBuildError;
|
|
178
179
|
/** Captures an EAS build success event. Call this from the eas-build-on-success hook. */
|
|
179
|
-
function captureEASBuildSuccess(
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
function captureEASBuildSuccess() {
|
|
181
|
+
return __awaiter(this, arguments, void 0, function* (options = {}) {
|
|
182
|
+
var _a, _b, _c, _d, _e, _f;
|
|
182
183
|
if (!options.captureSuccessfulBuilds) {
|
|
183
184
|
console.log('[Sentry] Skipping successful build capture (captureSuccessfulBuilds is false).');
|
|
184
185
|
return;
|
|
@@ -207,10 +208,9 @@ function captureEASBuildSuccess(options = {}) {
|
|
|
207
208
|
console.log('[Sentry] Build success captured.');
|
|
208
209
|
});
|
|
209
210
|
}
|
|
210
|
-
exports.captureEASBuildSuccess = captureEASBuildSuccess;
|
|
211
211
|
/** Captures an EAS build completion event with status. Call this from the eas-build-on-complete hook. */
|
|
212
|
-
function captureEASBuildComplete(
|
|
213
|
-
return __awaiter(this,
|
|
212
|
+
function captureEASBuildComplete() {
|
|
213
|
+
return __awaiter(this, arguments, void 0, function* (options = {}) {
|
|
214
214
|
const env = getEASBuildEnv();
|
|
215
215
|
const status = env.EAS_BUILD_STATUS;
|
|
216
216
|
if (status === 'errored') {
|
|
@@ -224,5 +224,4 @@ function captureEASBuildComplete(options = {}) {
|
|
|
224
224
|
console.log(`[Sentry] Build completed with status: ${status !== null && status !== void 0 ? status : 'unknown'}. No event captured.`);
|
|
225
225
|
});
|
|
226
226
|
}
|
|
227
|
-
exports.captureEASBuildComplete = captureEASBuildComplete;
|
|
228
227
|
//# sourceMappingURL=easBuildHooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"easBuildHooks.js","sourceRoot":"","sources":["../../../src/js/tools/easBuildHooks.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;AAKH,uCAA2D;AAC3D,wCAAyC;AAEzC,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC,MAAM,aAAa,GAAG,WAAW,CAAC;AAgDlC,yDAAyD;AACzD,SAAgB,UAAU;IACxB,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,K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AACzG,SAAsB,uBAAuB,CAAC,UAA+B,EAAE;;QAC7E,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,GAAG,CAAC,gBAAgB,CAAC;QACpC,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAC;YACpC,OAAO;SACR;QACD,IAAI,MAAM,KAAK,UAAU,IAAI,OAAO,CAAC,uBAAuB,EAAE;YAC5D,MAAM,sBAAsB,iCAAM,OAAO,KAAE,uBAAuB,EAAE,IAAI,IAAG,CAAC;YAC5E,OAAO;SACR;QACD,OAAO,CAAC,GAAG,CAAC,yCAAyC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,SAAS,sBAAsB,CAAC,CAAC;IAClG,CAAC;CAAA;AAZD,0DAYC","sourcesContent":["/**\n * EAS Build Hooks for Sentry\n *\n * This module provides utilities for capturing EAS build lifecycle events\n * and sending them to Sentry. It supports the following EAS npm hooks:\n * - eas-build-on-error: Captures build failures\n * - eas-build-on-success: Captures successful builds (optional)\n * - eas-build-on-complete: Captures build completion with metrics\n *\n * @see https://docs.expo.dev/build-reference/npm-hooks/\n */\n\n/* eslint-disable no-console */\n\nimport type { DsnComponents } from '@sentry/core';\nimport { dsnToString, makeDsn, uuid4 } from '@sentry/core';\nimport { SDK_VERSION } from '../version';\n\nconst SENTRY_DSN_ENV = 'SENTRY_DSN';\nconst EAS_BUILD_ENV = 'EAS_BUILD';\n\n/**\n * Environment variables provided by EAS Build.\n * @see https://docs.expo.dev/build-reference/variables/\n */\nexport interface EASBuildEnv {\n EAS_BUILD?: string;\n EAS_BUILD_ID?: string;\n EAS_BUILD_PLATFORM?: string;\n EAS_BUILD_PROFILE?: string;\n EAS_BUILD_PROJECT_ID?: string;\n EAS_BUILD_GIT_COMMIT_HASH?: string;\n EAS_BUILD_RUN_FROM_CI?: string;\n EAS_BUILD_STATUS?: string;\n EAS_BUILD_APP_VERSION?: string;\n EAS_BUILD_APP_BUILD_VERSION?: string;\n EAS_BUILD_USERNAME?: string;\n EAS_BUILD_WORKINGDIR?: string;\n}\n\n/** Options for configuring EAS build hook behavior. */\nexport interface EASBuildHookOptions {\n dsn?: string;\n tags?: Record<string, string>;\n captureSuccessfulBuilds?: boolean;\n errorMessage?: string;\n successMessage?: string;\n}\n\ninterface SentryEvent {\n event_id: string;\n timestamp: number;\n platform: string;\n level: 'error' | 'info' | 'warning';\n logger: string;\n environment: string;\n release?: string;\n tags: Record<string, string>;\n contexts: Record<string, Record<string, unknown>>;\n message?: { formatted: string };\n exception?: {\n values: Array<{ type: string; value: string; mechanism: { type: string; handled: boolean } }>;\n };\n fingerprint?: string[];\n sdk: { name: string; version: string };\n}\n\n/** Checks if the current environment is an EAS Build. */\nexport function isEASBuild(): boolean {\n return process.env[EAS_BUILD_ENV] === 'true';\n}\n\n/** Gets the EAS build environment variables. */\nexport function getEASBuildEnv(): EASBuildEnv {\n return {\n EAS_BUILD: process.env.EAS_BUILD,\n EAS_BUILD_ID: process.env.EAS_BUILD_ID,\n EAS_BUILD_PLATFORM: process.env.EAS_BUILD_PLATFORM,\n EAS_BUILD_PROFILE: process.env.EAS_BUILD_PROFILE,\n EAS_BUILD_PROJECT_ID: process.env.EAS_BUILD_PROJECT_ID,\n EAS_BUILD_GIT_COMMIT_HASH: process.env.EAS_BUILD_GIT_COMMIT_HASH,\n EAS_BUILD_RUN_FROM_CI: process.env.EAS_BUILD_RUN_FROM_CI,\n EAS_BUILD_STATUS: process.env.EAS_BUILD_STATUS,\n EAS_BUILD_APP_VERSION: process.env.EAS_BUILD_APP_VERSION,\n EAS_BUILD_APP_BUILD_VERSION: process.env.EAS_BUILD_APP_BUILD_VERSION,\n EAS_BUILD_USERNAME: process.env.EAS_BUILD_USERNAME,\n EAS_BUILD_WORKINGDIR: process.env.EAS_BUILD_WORKINGDIR,\n };\n}\n\nfunction getEnvelopeEndpoint(dsn: DsnComponents): string {\n const { protocol, host, port, path, projectId, publicKey } = dsn;\n const portStr = port ? `:${port}` : '';\n const pathStr = path ? `/${path}` : '';\n return `${protocol}://${host}${portStr}${pathStr}/api/${projectId}/envelope/?sentry_key=${publicKey}&sentry_version=7`;\n}\n\nfunction createEASBuildTags(env: EASBuildEnv): Record<string, string> {\n const tags: Record<string, string> = {};\n if (env.EAS_BUILD_PLATFORM) tags['eas.platform'] = env.EAS_BUILD_PLATFORM;\n if (env.EAS_BUILD_PROFILE) tags['eas.profile'] = env.EAS_BUILD_PROFILE;\n if (env.EAS_BUILD_ID) tags['eas.build_id'] = env.EAS_BUILD_ID;\n if (env.EAS_BUILD_PROJECT_ID) tags['eas.project_id'] = env.EAS_BUILD_PROJECT_ID;\n if (env.EAS_BUILD_RUN_FROM_CI) tags['eas.from_ci'] = env.EAS_BUILD_RUN_FROM_CI;\n if (env.EAS_BUILD_STATUS) tags['eas.status'] = env.EAS_BUILD_STATUS;\n if (env.EAS_BUILD_USERNAME) tags['eas.username'] = env.EAS_BUILD_USERNAME;\n return tags;\n}\n\nfunction createEASBuildContext(env: EASBuildEnv): Record<string, unknown> {\n return {\n build_id: env.EAS_BUILD_ID,\n platform: env.EAS_BUILD_PLATFORM,\n profile: env.EAS_BUILD_PROFILE,\n project_id: env.EAS_BUILD_PROJECT_ID,\n git_commit: env.EAS_BUILD_GIT_COMMIT_HASH,\n from_ci: env.EAS_BUILD_RUN_FROM_CI === 'true',\n status: env.EAS_BUILD_STATUS,\n app_version: env.EAS_BUILD_APP_VERSION,\n build_version: env.EAS_BUILD_APP_BUILD_VERSION,\n username: env.EAS_BUILD_USERNAME,\n working_dir: env.EAS_BUILD_WORKINGDIR,\n };\n}\n\nfunction createEnvelope(event: SentryEvent, dsn: DsnComponents): string {\n const envelopeHeaders = JSON.stringify({\n event_id: event.event_id,\n sent_at: new Date().toISOString(),\n dsn: dsnToString(dsn),\n sdk: event.sdk,\n });\n const itemHeaders = JSON.stringify({ type: 'event', content_type: 'application/json' });\n const itemPayload = JSON.stringify(event);\n return `${envelopeHeaders}\\n${itemHeaders}\\n${itemPayload}`;\n}\n\nasync function sendEvent(event: SentryEvent, dsn: DsnComponents): Promise<boolean> {\n const endpoint = getEnvelopeEndpoint(dsn);\n const envelope = createEnvelope(event, dsn);\n try {\n const response = await fetch(endpoint, {\n method: 'POST',\n headers: { 'Content-Type': 'application/x-sentry-envelope' },\n body: envelope,\n });\n if (response.status >= 200 && response.status < 300) return true;\n console.warn(`[Sentry] Failed to send event: HTTP ${response.status}`);\n return false;\n } catch (error) {\n console.error('[Sentry] Failed to send event:', error);\n return false;\n }\n}\n\nfunction getReleaseFromEASEnv(env: EASBuildEnv): string | undefined {\n // Honour explicit override first\n if (process.env.SENTRY_RELEASE) {\n return process.env.SENTRY_RELEASE;\n }\n // Best approximation without bundle identifier: version+buildNumber\n if (env.EAS_BUILD_APP_VERSION && env.EAS_BUILD_APP_BUILD_VERSION) {\n return `${env.EAS_BUILD_APP_VERSION}+${env.EAS_BUILD_APP_BUILD_VERSION}`;\n }\n return env.EAS_BUILD_APP_VERSION;\n}\n\nfunction createBaseEvent(\n level: 'error' | 'info' | 'warning',\n env: EASBuildEnv,\n customTags?: Record<string, string>,\n): SentryEvent {\n return {\n event_id: uuid4(),\n timestamp: Date.now() / 1000,\n platform: 'node',\n level,\n logger: 'eas-build-hook',\n environment: 'eas-build',\n release: getReleaseFromEASEnv(env),\n tags: { ...createEASBuildTags(env), ...customTags },\n contexts: { eas_build: createEASBuildContext(env), runtime: { name: 'node', version: process.version } },\n sdk: { name: 'sentry.javascript.react-native.eas-build-hooks', version: SDK_VERSION },\n };\n}\n\n/** Captures an EAS build error event. Call this from the eas-build-on-error hook. */\nexport async function captureEASBuildError(options: EASBuildHookOptions = {}): Promise<void> {\n const dsnString = options.dsn ?? process.env[SENTRY_DSN_ENV];\n if (!dsnString) {\n console.warn('[Sentry] No DSN provided. Set SENTRY_DSN environment variable or pass dsn option.');\n return;\n }\n if (!isEASBuild()) {\n console.warn('[Sentry] Not running in EAS Build environment. Skipping error capture.');\n return;\n }\n const dsn = makeDsn(dsnString);\n if (!dsn) {\n console.error('[Sentry] Invalid DSN format.');\n return;\n }\n const env = getEASBuildEnv();\n const errorMessage =\n options.errorMessage ??\n `EAS Build Failed: ${env.EAS_BUILD_PLATFORM ?? 'unknown'} (${env.EAS_BUILD_PROFILE ?? 'unknown'})`;\n const event = createBaseEvent('error', env, { ...options.tags, 'eas.hook': 'on-error' });\n event.exception = {\n values: [{ type: 'EASBuildError', value: errorMessage, mechanism: { type: 'eas-build-hook', handled: true } }],\n };\n event.fingerprint = ['eas-build-error', env.EAS_BUILD_PLATFORM ?? 'unknown', env.EAS_BUILD_PROFILE ?? 'unknown'];\n const success = await sendEvent(event, dsn);\n if (success) console.log('[Sentry] Build error captured.');\n}\n\n/** Captures an EAS build success event. Call this from the eas-build-on-success hook. */\nexport async function captureEASBuildSuccess(options: EASBuildHookOptions = {}): Promise<void> {\n if (!options.captureSuccessfulBuilds) {\n console.log('[Sentry] Skipping successful build capture (captureSuccessfulBuilds is false).');\n return;\n }\n const dsnString = options.dsn ?? process.env[SENTRY_DSN_ENV];\n if (!dsnString) {\n console.warn('[Sentry] No DSN provided. Set SENTRY_DSN environment variable or pass dsn option.');\n return;\n }\n if (!isEASBuild()) {\n console.warn('[Sentry] Not running in EAS Build environment. Skipping success capture.');\n return;\n }\n const dsn = makeDsn(dsnString);\n if (!dsn) {\n console.error('[Sentry] Invalid DSN format.');\n return;\n }\n const env = getEASBuildEnv();\n const successMessage =\n options.successMessage ??\n `EAS Build Succeeded: ${env.EAS_BUILD_PLATFORM ?? 'unknown'} (${env.EAS_BUILD_PROFILE ?? 'unknown'})`;\n const event = createBaseEvent('info', env, { ...options.tags, 'eas.hook': 'on-success' });\n event.message = { formatted: successMessage };\n event.fingerprint = ['eas-build-success', env.EAS_BUILD_PLATFORM ?? 'unknown', env.EAS_BUILD_PROFILE ?? 'unknown'];\n const success = await sendEvent(event, dsn);\n if (success) console.log('[Sentry] Build success captured.');\n}\n\n/** Captures an EAS build completion event with status. Call this from the eas-build-on-complete hook. */\nexport async function captureEASBuildComplete(options: EASBuildHookOptions = {}): Promise<void> {\n const env = getEASBuildEnv();\n const status = env.EAS_BUILD_STATUS;\n if (status === 'errored') {\n await captureEASBuildError(options);\n return;\n }\n if (status === 'finished' && options.captureSuccessfulBuilds) {\n await captureEASBuildSuccess({ ...options, captureSuccessfulBuilds: true });\n return;\n }\n console.log(`[Sentry] Build completed with status: ${status ?? 'unknown'}. No event captured.`);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"easBuildHooks.js","sourceRoot":"","sources":["../../../src/js/tools/easBuildHooks.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;AA4DH,gCAEC;AAGD,wCAeC;AAmGD,oDA0BC;AAGD,wDA4BC;AAGD,0DAYC;AArPD,uCAA2D;AAE3D,wCAAyC;AAEzC,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC,MAAM,aAAa,GAAG,WAAW,CAAC;AAgDlC,yDAAyD;AACzD,SAAgB,UAAU;IACxB,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,MAAM,CAAC;AAC/C,CAAC;AAED,gDAAgD;AAChD,SAAgB,cAAc;IAC5B,OAAO;QACL,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS;QAChC,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY;QACtC,kBAAkB,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB;QAClD,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;QAChD,oBAAoB,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB;QACtD,yBAAyB,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB;QAChE,qBAAqB,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB;QACxD,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;QAC9C,qBAAqB,EAAE,OAAO,CAAC,GAAG,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G,CAAC,yCAAyC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,SAAS,sBAAsB,CAAC,CAAC;IAClG,CAAC;CAAA","sourcesContent":["/**\n * EAS Build Hooks for Sentry\n *\n * This module provides utilities for capturing EAS build lifecycle events\n * and sending them to Sentry. It supports the following EAS npm hooks:\n * - eas-build-on-error: Captures build failures\n * - eas-build-on-success: Captures successful builds (optional)\n * - eas-build-on-complete: Captures build completion with metrics\n *\n * @see https://docs.expo.dev/build-reference/npm-hooks/\n */\n\n/* oxlint-disable eslint(no-console) */\n\nimport type { DsnComponents } from '@sentry/core';\n\nimport { dsnToString, makeDsn, uuid4 } from '@sentry/core';\n\nimport { SDK_VERSION } from '../version';\n\nconst SENTRY_DSN_ENV = 'SENTRY_DSN';\nconst EAS_BUILD_ENV = 'EAS_BUILD';\n\n/**\n * Environment variables provided by EAS Build.\n * @see https://docs.expo.dev/build-reference/variables/\n */\nexport interface EASBuildEnv {\n EAS_BUILD?: string;\n EAS_BUILD_ID?: string;\n EAS_BUILD_PLATFORM?: string;\n EAS_BUILD_PROFILE?: string;\n EAS_BUILD_PROJECT_ID?: string;\n EAS_BUILD_GIT_COMMIT_HASH?: string;\n EAS_BUILD_RUN_FROM_CI?: string;\n EAS_BUILD_STATUS?: string;\n EAS_BUILD_APP_VERSION?: string;\n EAS_BUILD_APP_BUILD_VERSION?: string;\n EAS_BUILD_USERNAME?: string;\n EAS_BUILD_WORKINGDIR?: string;\n}\n\n/** Options for configuring EAS build hook behavior. */\nexport interface EASBuildHookOptions {\n dsn?: string;\n tags?: Record<string, string>;\n captureSuccessfulBuilds?: boolean;\n errorMessage?: string;\n successMessage?: string;\n}\n\ninterface SentryEvent {\n event_id: string;\n timestamp: number;\n platform: string;\n level: 'error' | 'info' | 'warning';\n logger: string;\n environment: string;\n release?: string;\n tags: Record<string, string>;\n contexts: Record<string, Record<string, unknown>>;\n message?: { formatted: string };\n exception?: {\n values: Array<{ type: string; value: string; mechanism: { type: string; handled: boolean } }>;\n };\n fingerprint?: string[];\n sdk: { name: string; version: string };\n}\n\n/** Checks if the current environment is an EAS Build. */\nexport function isEASBuild(): boolean {\n return process.env[EAS_BUILD_ENV] === 'true';\n}\n\n/** Gets the EAS build environment variables. */\nexport function getEASBuildEnv(): EASBuildEnv {\n return {\n EAS_BUILD: process.env.EAS_BUILD,\n EAS_BUILD_ID: process.env.EAS_BUILD_ID,\n EAS_BUILD_PLATFORM: process.env.EAS_BUILD_PLATFORM,\n EAS_BUILD_PROFILE: process.env.EAS_BUILD_PROFILE,\n EAS_BUILD_PROJECT_ID: process.env.EAS_BUILD_PROJECT_ID,\n EAS_BUILD_GIT_COMMIT_HASH: process.env.EAS_BUILD_GIT_COMMIT_HASH,\n EAS_BUILD_RUN_FROM_CI: process.env.EAS_BUILD_RUN_FROM_CI,\n EAS_BUILD_STATUS: process.env.EAS_BUILD_STATUS,\n EAS_BUILD_APP_VERSION: process.env.EAS_BUILD_APP_VERSION,\n EAS_BUILD_APP_BUILD_VERSION: process.env.EAS_BUILD_APP_BUILD_VERSION,\n EAS_BUILD_USERNAME: process.env.EAS_BUILD_USERNAME,\n EAS_BUILD_WORKINGDIR: process.env.EAS_BUILD_WORKINGDIR,\n };\n}\n\nfunction getEnvelopeEndpoint(dsn: DsnComponents): string {\n const { protocol, host, port, path, projectId, publicKey } = dsn;\n const portStr = port ? `:${port}` : '';\n const pathStr = path ? `/${path}` : '';\n return `${protocol}://${host}${portStr}${pathStr}/api/${projectId}/envelope/?sentry_key=${publicKey}&sentry_version=7`;\n}\n\nfunction createEASBuildTags(env: EASBuildEnv): Record<string, string> {\n const tags: Record<string, string> = {};\n if (env.EAS_BUILD_PLATFORM) tags['eas.platform'] = env.EAS_BUILD_PLATFORM;\n if (env.EAS_BUILD_PROFILE) tags['eas.profile'] = env.EAS_BUILD_PROFILE;\n if (env.EAS_BUILD_ID) tags['eas.build_id'] = env.EAS_BUILD_ID;\n if (env.EAS_BUILD_PROJECT_ID) tags['eas.project_id'] = env.EAS_BUILD_PROJECT_ID;\n if (env.EAS_BUILD_RUN_FROM_CI) tags['eas.from_ci'] = env.EAS_BUILD_RUN_FROM_CI;\n if (env.EAS_BUILD_STATUS) tags['eas.status'] = env.EAS_BUILD_STATUS;\n if (env.EAS_BUILD_USERNAME) tags['eas.username'] = env.EAS_BUILD_USERNAME;\n return tags;\n}\n\nfunction createEASBuildContext(env: EASBuildEnv): Record<string, unknown> {\n return {\n build_id: env.EAS_BUILD_ID,\n platform: env.EAS_BUILD_PLATFORM,\n profile: env.EAS_BUILD_PROFILE,\n project_id: env.EAS_BUILD_PROJECT_ID,\n git_commit: env.EAS_BUILD_GIT_COMMIT_HASH,\n from_ci: env.EAS_BUILD_RUN_FROM_CI === 'true',\n status: env.EAS_BUILD_STATUS,\n app_version: env.EAS_BUILD_APP_VERSION,\n build_version: env.EAS_BUILD_APP_BUILD_VERSION,\n username: env.EAS_BUILD_USERNAME,\n working_dir: env.EAS_BUILD_WORKINGDIR,\n };\n}\n\nfunction createEnvelope(event: SentryEvent, dsn: DsnComponents): string {\n const envelopeHeaders = JSON.stringify({\n event_id: event.event_id,\n sent_at: new Date().toISOString(),\n dsn: dsnToString(dsn),\n sdk: event.sdk,\n });\n const itemHeaders = JSON.stringify({ type: 'event', content_type: 'application/json' });\n const itemPayload = JSON.stringify(event);\n return `${envelopeHeaders}\\n${itemHeaders}\\n${itemPayload}`;\n}\n\nasync function sendEvent(event: SentryEvent, dsn: DsnComponents): Promise<boolean> {\n const endpoint = getEnvelopeEndpoint(dsn);\n const envelope = createEnvelope(event, dsn);\n try {\n const response = await fetch(endpoint, {\n method: 'POST',\n headers: { 'Content-Type': 'application/x-sentry-envelope' },\n body: envelope,\n });\n if (response.status >= 200 && response.status < 300) return true;\n console.warn(`[Sentry] Failed to send event: HTTP ${response.status}`);\n return false;\n } catch (error) {\n console.error('[Sentry] Failed to send event:', error);\n return false;\n }\n}\n\nfunction getReleaseFromEASEnv(env: EASBuildEnv): string | undefined {\n // Honour explicit override first\n if (process.env.SENTRY_RELEASE) {\n return process.env.SENTRY_RELEASE;\n }\n // Best approximation without bundle identifier: version+buildNumber\n if (env.EAS_BUILD_APP_VERSION && env.EAS_BUILD_APP_BUILD_VERSION) {\n return `${env.EAS_BUILD_APP_VERSION}+${env.EAS_BUILD_APP_BUILD_VERSION}`;\n }\n return env.EAS_BUILD_APP_VERSION;\n}\n\nfunction createBaseEvent(\n level: 'error' | 'info' | 'warning',\n env: EASBuildEnv,\n customTags?: Record<string, string>,\n): SentryEvent {\n return {\n event_id: uuid4(),\n timestamp: Date.now() / 1000,\n platform: 'node',\n level,\n logger: 'eas-build-hook',\n environment: 'eas-build',\n release: getReleaseFromEASEnv(env),\n tags: { ...createEASBuildTags(env), ...customTags },\n contexts: { eas_build: createEASBuildContext(env), runtime: { name: 'node', version: process.version } },\n sdk: { name: 'sentry.javascript.react-native.eas-build-hooks', version: SDK_VERSION },\n };\n}\n\n/** Captures an EAS build error event. Call this from the eas-build-on-error hook. */\nexport async function captureEASBuildError(options: EASBuildHookOptions = {}): Promise<void> {\n const dsnString = options.dsn ?? process.env[SENTRY_DSN_ENV];\n if (!dsnString) {\n console.warn('[Sentry] No DSN provided. Set SENTRY_DSN environment variable or pass dsn option.');\n return;\n }\n if (!isEASBuild()) {\n console.warn('[Sentry] Not running in EAS Build environment. Skipping error capture.');\n return;\n }\n const dsn = makeDsn(dsnString);\n if (!dsn) {\n console.error('[Sentry] Invalid DSN format.');\n return;\n }\n const env = getEASBuildEnv();\n const errorMessage =\n options.errorMessage ??\n `EAS Build Failed: ${env.EAS_BUILD_PLATFORM ?? 'unknown'} (${env.EAS_BUILD_PROFILE ?? 'unknown'})`;\n const event = createBaseEvent('error', env, { ...options.tags, 'eas.hook': 'on-error' });\n event.exception = {\n values: [{ type: 'EASBuildError', value: errorMessage, mechanism: { type: 'eas-build-hook', handled: true } }],\n };\n event.fingerprint = ['eas-build-error', env.EAS_BUILD_PLATFORM ?? 'unknown', env.EAS_BUILD_PROFILE ?? 'unknown'];\n const success = await sendEvent(event, dsn);\n if (success) console.log('[Sentry] Build error captured.');\n}\n\n/** Captures an EAS build success event. Call this from the eas-build-on-success hook. */\nexport async function captureEASBuildSuccess(options: EASBuildHookOptions = {}): Promise<void> {\n if (!options.captureSuccessfulBuilds) {\n console.log('[Sentry] Skipping successful build capture (captureSuccessfulBuilds is false).');\n return;\n }\n const dsnString = options.dsn ?? process.env[SENTRY_DSN_ENV];\n if (!dsnString) {\n console.warn('[Sentry] No DSN provided. Set SENTRY_DSN environment variable or pass dsn option.');\n return;\n }\n if (!isEASBuild()) {\n console.warn('[Sentry] Not running in EAS Build environment. Skipping success capture.');\n return;\n }\n const dsn = makeDsn(dsnString);\n if (!dsn) {\n console.error('[Sentry] Invalid DSN format.');\n return;\n }\n const env = getEASBuildEnv();\n const successMessage =\n options.successMessage ??\n `EAS Build Succeeded: ${env.EAS_BUILD_PLATFORM ?? 'unknown'} (${env.EAS_BUILD_PROFILE ?? 'unknown'})`;\n const event = createBaseEvent('info', env, { ...options.tags, 'eas.hook': 'on-success' });\n event.message = { formatted: successMessage };\n event.fingerprint = ['eas-build-success', env.EAS_BUILD_PLATFORM ?? 'unknown', env.EAS_BUILD_PROFILE ?? 'unknown'];\n const success = await sendEvent(event, dsn);\n if (success) console.log('[Sentry] Build success captured.');\n}\n\n/** Captures an EAS build completion event with status. Call this from the eas-build-on-complete hook. */\nexport async function captureEASBuildComplete(options: EASBuildHookOptions = {}): Promise<void> {\n const env = getEASBuildEnv();\n const status = env.EAS_BUILD_STATUS;\n if (status === 'errored') {\n await captureEASBuildError(options);\n return;\n }\n if (status === 'finished' && options.captureSuccessfulBuilds) {\n await captureEASBuildSuccess({ ...options, captureSuccessfulBuilds: true });\n return;\n }\n console.log(`[Sentry] Build completed with status: ${status ?? 'unknown'}. No event captured.`);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enableLogger =
|
|
3
|
+
exports.enableLogger = enableLogger;
|
|
4
4
|
const core_1 = require("@sentry/core");
|
|
5
5
|
/**
|
|
6
6
|
* Enables debug logger when SENTRY_LOG_LEVEL=debug.
|
|
@@ -10,5 +10,4 @@ function enableLogger() {
|
|
|
10
10
|
core_1.debug.enable();
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
exports.enableLogger = enableLogger;
|
|
14
13
|
//# sourceMappingURL=enableLogger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enableLogger.js","sourceRoot":"","sources":["../../../src/js/tools/enableLogger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"enableLogger.js","sourceRoot":"","sources":["../../../src/js/tools/enableLogger.ts"],"names":[],"mappings":";;AAKA,oCAIC;AATD,uCAAqC;AAErC;;GAEG;AACH,SAAgB,YAAY;IAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,KAAK,OAAO,EAAE,CAAC;QAC7C,YAAK,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC;AACH,CAAC","sourcesContent":["import { debug } from '@sentry/core';\n\n/**\n * Enables debug logger when SENTRY_LOG_LEVEL=debug.\n */\nexport function enableLogger(): void {\n if (process.env.SENTRY_LOG_LEVEL === 'debug') {\n debug.enable();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metroMiddleware.d.ts","sourceRoot":"","sources":["../../../src/js/tools/metroMiddleware.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"metroMiddleware.d.ts","sourceRoot":"","sources":["../../../src/js/tools/metroMiddleware.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ7D;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,UAgC1C,CAAC;AA2CF;;GAEG;AACH,eAAO,MAAM,2BAA2B,GAAI,YAAY,UAAU,KAAG,UAWpE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,YAAY,KAAG,YAY3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metroMiddleware.js","sourceRoot":"","sources":["../../../src/js/tools/metroMiddleware.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"metroMiddleware.js","sourceRoot":"","sources":["../../../src/js/tools/metroMiddleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,uCAAwD;AACxD,2BAA8B;AAC9B,+BAAiC;AAEjC,MAAM,aAAa,GAAG,IAAA,gBAAS,EAAC,aAAQ,CAAC,CAAC;AAE1C;;;GAGG;AACI,MAAM,4BAA4B,GAAe,CACtD,OAAwB,EACxB,QAAwB,EACxB,KAAiB,EACF,EAAE;IACjB,YAAK,CAAC,GAAG,CAAC,yEAAyE,CAAC,CAAC;IACrF,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,CAAC;QACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,YAAK,CAAC,GAAG,CAAC,4DAA4D,EAAE,CAAC,CAAC,CAAC;QAC3E,UAAU,CAAC,QAAQ,EAAE,+CAA+C,CAAC,CAAC;QACtE,OAAO;IACT,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACzB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,YAAK,CAAC,GAAG,CAAC,oDAAoD,EAAE,KAAK,CAAC,CAAC;QACvE,UAAU,CAAC,QAAQ,EAAE,0CAA0C,CAAC,CAAC;QACjE,OAAO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M,CAAC,iBAAiB,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/core';\nimport type { IncomingMessage, ServerResponse } from 'http';\nimport type { InputConfigT, Middleware } from 'metro-config';\n\nimport { addContextToFrame, debug } from '@sentry/core';\nimport { readFile } from 'fs';\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 _next: () => void,\n): Promise<void> => {\n debug.log('[@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 debug.log('[@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 debug.log('[@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 debug.log('[@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 debug.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 debug.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: () => void) => {\n if (request.url?.startsWith(SENTRY_CONTEXT_REQUEST_PATH)) {\n return stackFramesContextMiddleware(request, response, next);\n }\n return (middleware as (req: IncomingMessage, res: ServerResponse, next: () => void) => void)(\n request,\n response,\n next,\n );\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metroconfig.d.ts","sourceRoot":"","sources":["../../../src/js/tools/metroconfig.ts"],"names":[],"mappings":"
|
|
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;AAQ7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAYrE,cAAc,yBAAyB,CAAC;AAIxC,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,uBAAuB,CAAC,EACpB,OAAO,GACP;QACE,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;IACN;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;OAIG;IACH,gCAAgC,CAAC,EAAE,OAAO,CAAC;IAC3C;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvG;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,WAAW,EACnB,EACE,uBAA+B,EAC/B,gBAAuB,EACvB,gCAAuC,EACvC,WAAkB,GACnB,GAAE,wBAA6B,GAC/B,WAAW,CAsBb;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,oBAAoB,GAAG,uBAAuB,GAAG,wBAA6B,GACtF,WAAW,CAgCb;AAqBD;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,WAAW,EACnB,uBAAuB,EAAE,IAAI,GAAG;IAAE,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAC/D,WAAW,CA8Bb;AA0BD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,OAAO,GAAG,SAAS,GAAG,WAAW,CA+C1G;AAgBD;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CA4CpF;AAQD;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAiC1E"}
|
|
@@ -14,7 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.withSentryConfig = withSentryConfig;
|
|
18
|
+
exports.getSentryExpoConfig = getSentryExpoConfig;
|
|
19
|
+
exports.withSentryBabelTransformer = withSentryBabelTransformer;
|
|
20
|
+
exports.withSentryResolver = withSentryResolver;
|
|
21
|
+
exports.withSentryExcludeServerOnlyResolver = withSentryExcludeServerOnlyResolver;
|
|
22
|
+
exports.withSentryFramesCollapsed = withSentryFramesCollapsed;
|
|
18
23
|
const core_1 = require("@sentry/core");
|
|
19
24
|
const process = require("process");
|
|
20
25
|
const process_1 = require("process");
|
|
@@ -52,7 +57,6 @@ function withSentryConfig(config, { annotateReactComponents = false, includeWebR
|
|
|
52
57
|
}
|
|
53
58
|
return newConfig;
|
|
54
59
|
}
|
|
55
|
-
exports.withSentryConfig = withSentryConfig;
|
|
56
60
|
/**
|
|
57
61
|
* This function returns Default Expo configuration with Sentry plugins.
|
|
58
62
|
*/
|
|
@@ -81,10 +85,8 @@ function getSentryExpoConfig(projectRoot, options = {}) {
|
|
|
81
85
|
}
|
|
82
86
|
return newConfig;
|
|
83
87
|
}
|
|
84
|
-
exports.getSentryExpoConfig = getSentryExpoConfig;
|
|
85
88
|
function loadExpoMetroConfigModule() {
|
|
86
89
|
try {
|
|
87
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
88
90
|
return require('expo/metro-config');
|
|
89
91
|
}
|
|
90
92
|
catch (e) {
|
|
@@ -100,9 +102,9 @@ function withSentryBabelTransformer(config, annotateReactComponents) {
|
|
|
100
102
|
core_1.debug.log('Default Babel transformer path from `config.transformer`:', defaultBabelTransformerPath);
|
|
101
103
|
if (!defaultBabelTransformerPath) {
|
|
102
104
|
// This has to be console.warn because the options is enabled but won't be used
|
|
103
|
-
//
|
|
105
|
+
// oxlint-disable-next-line eslint(no-console)
|
|
104
106
|
console.warn('`transformer.babelTransformerPath` is undefined.');
|
|
105
|
-
//
|
|
107
|
+
// oxlint-disable-next-line eslint(no-console)
|
|
106
108
|
console.warn('Sentry Babel transformer cannot be used. Not adding it...');
|
|
107
109
|
return config;
|
|
108
110
|
}
|
|
@@ -116,7 +118,6 @@ function withSentryBabelTransformer(config, annotateReactComponents) {
|
|
|
116
118
|
}
|
|
117
119
|
return Object.assign(Object.assign({}, config), { transformer: Object.assign(Object.assign({}, config.transformer), { babelTransformerPath: require.resolve('./sentryBabelTransformer') }) });
|
|
118
120
|
}
|
|
119
|
-
exports.withSentryBabelTransformer = withSentryBabelTransformer;
|
|
120
121
|
function withSentryDebugId(config) {
|
|
121
122
|
var _a;
|
|
122
123
|
const customSerializer = (0, sentryMetroSerializer_1.createSentryMetroSerializer)(((_a = config.serializer) === null || _a === void 0 ? void 0 : _a.customSerializer) || undefined);
|
|
@@ -143,7 +144,7 @@ function withSentryResolver(config, includeWebReplay) {
|
|
|
143
144
|
}
|
|
144
145
|
// Prior 0.68, resolve context.resolveRequest is sentryResolver itself, where on later version it is the default resolver.
|
|
145
146
|
if (context.resolveRequest === sentryResolverRequest) {
|
|
146
|
-
//
|
|
147
|
+
// oxlint-disable-next-line eslint(no-console)
|
|
147
148
|
console.error(`Error: [@sentry/react-native/metro] Can not resolve the defaultResolver on Metro older than 0.68.
|
|
148
149
|
Please follow one of the following options:
|
|
149
150
|
- Include your resolverRequest on your metroconfig.
|
|
@@ -157,7 +158,6 @@ Please follow one of the following options:
|
|
|
157
158
|
};
|
|
158
159
|
return Object.assign(Object.assign({}, config), { resolver: Object.assign(Object.assign({}, config.resolver), { resolveRequest: sentryResolverRequest }) });
|
|
159
160
|
}
|
|
160
|
-
exports.withSentryResolver = withSentryResolver;
|
|
161
161
|
/**
|
|
162
162
|
* Matches relative import paths to server-only AI/MCP modules within `@sentry/core`.
|
|
163
163
|
*
|
|
@@ -189,7 +189,7 @@ function withSentryExcludeServerOnlyResolver(config) {
|
|
|
189
189
|
}
|
|
190
190
|
// Prior 0.68, context.resolveRequest is sentryServerOnlyResolverRequest itself, which would cause infinite recursion.
|
|
191
191
|
if (context.resolveRequest === sentryServerOnlyResolverRequest) {
|
|
192
|
-
//
|
|
192
|
+
// oxlint-disable-next-line eslint(no-console)
|
|
193
193
|
console.error(`Error: [@sentry/react-native/metro] Can not resolve the defaultResolver on Metro older than 0.68.
|
|
194
194
|
Please include your resolverRequest on your metroconfig or update your Metro version to 0.68 or higher.
|
|
195
195
|
If you are still facing issues, report the issue at http://www.github.com/getsentry/sentry-react-native/issues`);
|
|
@@ -200,7 +200,6 @@ If you are still facing issues, report the issue at http://www.github.com/getsen
|
|
|
200
200
|
};
|
|
201
201
|
return Object.assign(Object.assign({}, config), { resolver: Object.assign(Object.assign({}, config.resolver), { resolveRequest: sentryServerOnlyResolverRequest }) });
|
|
202
202
|
}
|
|
203
|
-
exports.withSentryExcludeServerOnlyResolver = withSentryExcludeServerOnlyResolver;
|
|
204
203
|
/**
|
|
205
204
|
* Collapses Sentry internal frames from the stack trace view in LogBox.
|
|
206
205
|
*/
|
|
@@ -220,7 +219,6 @@ function withSentryFramesCollapsed(config) {
|
|
|
220
219
|
};
|
|
221
220
|
return Object.assign(Object.assign({}, config), { symbolicator: Object.assign(Object.assign({}, config.symbolicator), { customizeFrame }) });
|
|
222
221
|
}
|
|
223
|
-
exports.withSentryFramesCollapsed = withSentryFramesCollapsed;
|
|
224
222
|
/**
|
|
225
223
|
* Sets the `___SENTRY_METRO_DEV_SERVER___` environment flag.
|
|
226
224
|
* This is used to determine if the SDK is running in Node in Metro Dev Server.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metroconfig.js","sourceRoot":"","sources":["../../../src/js/tools/metroconfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uCAAqC;AAGrC,mCAAmC;AACnC,qCAA8B;AAC9B,iDAA8C;AAC9C,uDAAyD;AACzD,+EAGuC;AACvC,mEAAqH;AACrH,uEAAsE;AACtE,mEAAyE;AAIzE,0DAAwC;AAExC,IAAA,2BAAY,GAAE,CAAC;AA+Cf;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC9B,MAAmB,EACnB,EACE,uBAAuB,GAAG,KAAK,EAC/B,gBAAgB,GAAG,IAAI,EACvB,gCAAgC,GAAG,IAAI,EACvC,WAAW,GAAG,IAAI,MACU,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,EAAE,uBAAuB,CAAC,CAAC;KAC5E;IACD,IAAI,gBAAgB,KAAK,KAAK,EAAE;QAC9B,SAAS,GAAG,kBAAkB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;KAC7D;IACD,SAAS,GAAG,mCAAmC,CAAC,SAAS,CAAC,CAAC;IAC3D,IAAI,gCAAgC,EAAE;QACpC,SAAS,GAAG,IAAA,sCAAoB,EAAC,SAAS,CAAC,CAAC;KAC7C;IACD,IAAI,WAAW,EAAE;QACf,SAAS,GAA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ourcesContent":["import { debug } from '@sentry/core';\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';\nimport { enableLogger } from './enableLogger';\nimport { withSentryMiddleware } from './metroMiddleware';\nimport {\n setSentryBabelTransformerOptions,\n setSentryDefaultBabelTransformerPathEnv,\n} from './sentryBabelTransformerUtils';\nimport { createSentryMetroSerializer, unstableBeforeAssetSerializationDebugIdPlugin } from './sentryMetroSerializer';\nimport { withSentryOptionsFromFile } from './sentryOptionsSerializer';\nimport { unstableReleaseConstantsPlugin } from './sentryReleaseInjector';\nimport type { MetroCustomSerializer } from './utils';\nimport type { DefaultConfigOptions } from './vendor/expo/expoconfig';\n\nexport * from './sentryMetroSerializer';\n\nenableLogger();\n\nexport interface SentryMetroConfigOptions {\n /**\n * Annotates React components with Sentry data.\n * @default false\n */\n annotateReactComponents?:\n | boolean\n | {\n ignoredComponents?: string[];\n };\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 * Load Sentry Options from a file. If `true` it will use the default path.\n * If `false` it will not load any options from a file. Only options provided in the code will be used.\n * If `string` it will use the provided path.\n *\n * @default '{projectRoot}/sentry.options.json'\n */\n optionsFile?: string | boolean;\n}\n\nexport interface SentryExpoConfigOptions {\n /**\n * Pass a custom `getDefaultConfig` function to override the default Expo configuration getter.\n */\n getDefaultConfig?: (projectRoot: string, options?: Record<string, unknown>) => Record<string, unknown>;\n\n /**\n * For Expo Web, inject `release` and `version` options from `app.json`, the Expo Application Config.\n *\n * @default true\n */\n injectReleaseForWeb?: boolean;\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 optionsFile = 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, annotateReactComponents);\n }\n if (includeWebReplay === false) {\n newConfig = withSentryResolver(newConfig, includeWebReplay);\n }\n newConfig = withSentryExcludeServerOnlyResolver(newConfig);\n if (enableSourceContextInDevelopment) {\n newConfig = withSentryMiddleware(newConfig);\n }\n if (optionsFile) {\n newConfig = withSentryOptionsFromFile(newConfig, optionsFile);\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 ...(options.injectReleaseForWeb ?? true ? [unstableReleaseConstantsPlugin(projectRoot)] : []),\n unstableBeforeAssetSerializationDebugIdPlugin,\n ],\n });\n\n let newConfig = withSentryFramesCollapsed(config);\n if (options.annotateReactComponents) {\n newConfig = withSentryBabelTransformer(newConfig, options.annotateReactComponents);\n }\n\n if (options.includeWebReplay === false) {\n newConfig = withSentryResolver(newConfig, options.includeWebReplay);\n }\n newConfig = withSentryExcludeServerOnlyResolver(newConfig);\n\n if (options.enableSourceContextInDevelopment ?? true) {\n newConfig = withSentryMiddleware(newConfig);\n }\n\n if (options.optionsFile ?? true) {\n newConfig = withSentryOptionsFromFile(newConfig, options.optionsFile ?? true);\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(\n config: MetroConfig,\n annotateReactComponents: true | { ignoredComponents?: string[] },\n): MetroConfig {\n const defaultBabelTransformerPath = config.transformer?.babelTransformerPath;\n debug.log('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 setSentryDefaultBabelTransformerPathEnv(defaultBabelTransformerPath);\n }\n\n if (typeof annotateReactComponents === 'object') {\n setSentryBabelTransformerOptions({\n annotateReactComponents,\n });\n }\n\n return {\n ...config,\n transformer: {\n ...config.transformer,\n babelTransformerPath: require.resolve('./sentryBabelTransformer'),\n },\n };\n}\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).match(/@sentry(?:-internal)?\\/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\n/**\n * Matches relative import paths to server-only AI/MCP modules within `@sentry/core`.\n *\n * Metro passes the module name as-written in the source code, so for imports inside\n * `@sentry/core`'s barrel file like `export { ... } from './integrations/mcp-server/index.js'`,\n * the `moduleName` will be `./integrations/mcp-server/index.js`.\n */\nconst SERVER_ONLY_MODULE_RE =\n /\\/(mcp-server|tracing\\/(vercel-ai|openai|anthropic-ai|google-genai|langchain|langgraph)|utils\\/ai)(\\/|$)/;\n\nfunction isFromSentryCore(originModulePath: string): boolean {\n return originModulePath.includes('@sentry/core');\n}\n\n/**\n * Excludes server-only AI/MCP modules from native (Android/iOS) bundles.\n */\nexport function withSentryExcludeServerOnlyResolver(config: MetroConfig): MetroConfig {\n const originalResolver = config.resolver?.resolveRequest as CustomResolver | CustomResolverBeforeMetro068 | undefined;\n\n const sentryServerOnlyResolverRequest: CustomResolver = (\n context: CustomResolutionContext,\n moduleName: string,\n platform: string | null,\n oldMetroModuleName?: string,\n ) => {\n if (\n (platform === 'android' || platform === 'ios') &&\n isFromSentryCore((context as { originModulePath?: string }).originModulePath ?? '') &&\n SERVER_ONLY_MODULE_RE.test(oldMetroModuleName ?? moduleName)\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, context.resolveRequest is sentryServerOnlyResolverRequest itself, which would cause infinite recursion.\n if (context.resolveRequest === sentryServerOnlyResolverRequest) {\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 include your resolverRequest on your metroconfig or update your Metro version to 0.68 or higher.\nIf 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: sentryServerOnlyResolverRequest,\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/core/cjs/instrument.js') ||\n frame.file.includes('node_modules/@sentry/core/cjs/debug.js'));\n\n const customizeFrame = (frame: MetroFrame): MetroCustomizeFrameReturnValue => {\n const originalOrSentryCustomizeFrame = (\n originalCustomization: MetroCustomizeFrame | undefined,\n ): MetroCustomizeFrame => ({\n ...originalCustomization,\n collapse: originalCustomization?.collapse || collapseSentryInternalFrames(frame),\n });\n\n const maybePromiseCustomization = 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":";;;;;;;;;;;;;;;;AA2EA,4CA8BC;AAKD,kDAmCC;AAwBD,gEAiCC;AA6BD,gDA+CC;AAmBD,kFA4CC;AAWD,8DAiCC;AA9XD,uCAAqC;AACrC,mCAAmC;AACnC,qCAA8B;AAK9B,iDAA8C;AAC9C,uDAAyD;AACzD,+EAGuC;AACvC,mEAAqH;AACrH,uEAAsE;AACtE,mEAAyE;AAEzE,0DAAwC;AAExC,IAAA,2BAAY,GAAE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AC,6CAA6C,CAAC;YACjE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,wCAAwC,CAAC,CAAC,CAAC;IAEnE,MAAM,cAAc,GAAG,CAAC,KAAiB,EAAkC,EAAE;QAC3E,MAAM,8BAA8B,GAAG,CACrC,qBAAsD,EACjC,EAAE,CAAC,iCACrB,qBAAqB,KACxB,QAAQ,EAAE,CAAA,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,QAAQ,KAAI,4BAA4B,CAAC,KAAK,CAAC,IAChF,CAAC;QAEH,MAAM,yBAAyB,GAAG,CAAA,sBAAsB,aAAtB,sBAAsB,uBAAtB,sBAAsB,CAAG,KAAK,CAAC,KAAI,SAAS,CAAC;QAE/E,IAAI,yBAAyB,KAAK,SAAS,IAAI,MAAM,IAAI,yBAAyB,EAAE,CAAC;YACnF,OAAO,yBAAyB,CAAC,IAAI,CAAsB,qBAAqB,CAAC,EAAE,CACjF,8BAA8B,CAAC,qBAAqB,CAAC,CACtD,CAAC;QACJ,CAAC;QAED,OAAO,8BAA8B,CAAC,yBAAyB,CAAC,CAAC;IACnE,CAAC,CAAC;IAEF,uCACK,MAAM,KACT,YAAY,kCACP,MAAM,CAAC,YAAY,KACtB,cAAc,OAEhB;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,8BAA8B;IACrC,aAAG,CAAC,6BAA6B,GAAG,MAAM,CAAC;AAC7C,CAAC","sourcesContent":["import type { MetroConfig, MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport type { CustomResolutionContext, CustomResolver, Resolution } from 'metro-resolver';\n\nimport { debug } from '@sentry/core';\nimport * as process from 'process';\nimport { env } from 'process';\n\nimport type { MetroCustomSerializer } from './utils';\nimport type { DefaultConfigOptions } from './vendor/expo/expoconfig';\n\nimport { enableLogger } from './enableLogger';\nimport { withSentryMiddleware } from './metroMiddleware';\nimport {\n setSentryBabelTransformerOptions,\n setSentryDefaultBabelTransformerPathEnv,\n} from './sentryBabelTransformerUtils';\nimport { createSentryMetroSerializer, unstableBeforeAssetSerializationDebugIdPlugin } from './sentryMetroSerializer';\nimport { withSentryOptionsFromFile } from './sentryOptionsSerializer';\nimport { unstableReleaseConstantsPlugin } from './sentryReleaseInjector';\n\nexport * from './sentryMetroSerializer';\n\nenableLogger();\n\nexport interface SentryMetroConfigOptions {\n /**\n * Annotates React components with Sentry data.\n * @default false\n */\n annotateReactComponents?:\n | boolean\n | {\n ignoredComponents?: string[];\n };\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 * Load Sentry Options from a file. If `true` it will use the default path.\n * If `false` it will not load any options from a file. Only options provided in the code will be used.\n * If `string` it will use the provided path.\n *\n * @default '{projectRoot}/sentry.options.json'\n */\n optionsFile?: string | boolean;\n}\n\nexport interface SentryExpoConfigOptions {\n /**\n * Pass a custom `getDefaultConfig` function to override the default Expo configuration getter.\n */\n getDefaultConfig?: (projectRoot: string, options?: Record<string, unknown>) => Record<string, unknown>;\n\n /**\n * For Expo Web, inject `release` and `version` options from `app.json`, the Expo Application Config.\n *\n * @default true\n */\n injectReleaseForWeb?: boolean;\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 optionsFile = 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, annotateReactComponents);\n }\n if (includeWebReplay === false) {\n newConfig = withSentryResolver(newConfig, includeWebReplay);\n }\n newConfig = withSentryExcludeServerOnlyResolver(newConfig);\n if (enableSourceContextInDevelopment) {\n newConfig = withSentryMiddleware(newConfig);\n }\n if (optionsFile) {\n newConfig = withSentryOptionsFromFile(newConfig, optionsFile);\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 ...((options.injectReleaseForWeb ?? true) ? [unstableReleaseConstantsPlugin(projectRoot)] : []),\n unstableBeforeAssetSerializationDebugIdPlugin,\n ],\n });\n\n let newConfig = withSentryFramesCollapsed(config);\n if (options.annotateReactComponents) {\n newConfig = withSentryBabelTransformer(newConfig, options.annotateReactComponents);\n }\n\n if (options.includeWebReplay === false) {\n newConfig = withSentryResolver(newConfig, options.includeWebReplay);\n }\n newConfig = withSentryExcludeServerOnlyResolver(newConfig);\n\n if (options.enableSourceContextInDevelopment ?? true) {\n newConfig = withSentryMiddleware(newConfig);\n }\n\n if (options.optionsFile ?? true) {\n newConfig = withSentryOptionsFromFile(newConfig, options.optionsFile ?? true);\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 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(\n config: MetroConfig,\n annotateReactComponents: true | { ignoredComponents?: string[] },\n): MetroConfig {\n const defaultBabelTransformerPath = config.transformer?.babelTransformerPath;\n debug.log('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 // oxlint-disable-next-line eslint(no-console)\n console.warn('`transformer.babelTransformerPath` is undefined.');\n // oxlint-disable-next-line eslint(no-console)\n console.warn('Sentry Babel transformer cannot be used. Not adding it...');\n return config;\n }\n\n if (defaultBabelTransformerPath) {\n setSentryDefaultBabelTransformerPathEnv(defaultBabelTransformerPath);\n }\n\n if (typeof annotateReactComponents === 'object') {\n setSentryBabelTransformerOptions({\n annotateReactComponents,\n });\n }\n\n return {\n ...config,\n transformer: {\n ...config.transformer,\n babelTransformerPath: require.resolve('./sentryBabelTransformer'),\n },\n };\n}\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).match(/@sentry(?:-internal)?\\/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 // oxlint-disable-next-line eslint(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\n/**\n * Matches relative import paths to server-only AI/MCP modules within `@sentry/core`.\n *\n * Metro passes the module name as-written in the source code, so for imports inside\n * `@sentry/core`'s barrel file like `export { ... } from './integrations/mcp-server/index.js'`,\n * the `moduleName` will be `./integrations/mcp-server/index.js`.\n */\nconst SERVER_ONLY_MODULE_RE =\n /\\/(mcp-server|tracing\\/(vercel-ai|openai|anthropic-ai|google-genai|langchain|langgraph)|utils\\/ai)(\\/|$)/;\n\nfunction isFromSentryCore(originModulePath: string): boolean {\n return originModulePath.includes('@sentry/core');\n}\n\n/**\n * Excludes server-only AI/MCP modules from native (Android/iOS) bundles.\n */\nexport function withSentryExcludeServerOnlyResolver(config: MetroConfig): MetroConfig {\n const originalResolver = config.resolver?.resolveRequest as CustomResolver | CustomResolverBeforeMetro068 | undefined;\n\n const sentryServerOnlyResolverRequest: CustomResolver = (\n context: CustomResolutionContext,\n moduleName: string,\n platform: string | null,\n oldMetroModuleName?: string,\n ) => {\n if (\n (platform === 'android' || platform === 'ios') &&\n isFromSentryCore((context as { originModulePath?: string }).originModulePath ?? '') &&\n SERVER_ONLY_MODULE_RE.test(oldMetroModuleName ?? moduleName)\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, context.resolveRequest is sentryServerOnlyResolverRequest itself, which would cause infinite recursion.\n if (context.resolveRequest === sentryServerOnlyResolverRequest) {\n // oxlint-disable-next-line eslint(no-console)\n console.error(\n `Error: [@sentry/react-native/metro] Can not resolve the defaultResolver on Metro older than 0.68.\nPlease include your resolverRequest on your metroconfig or update your Metro version to 0.68 or higher.\nIf 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: sentryServerOnlyResolverRequest,\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/core/cjs/instrument.js') ||\n frame.file.includes('node_modules/@sentry/core/cjs/debug.js'));\n\n const customizeFrame = (frame: MetroFrame): MetroCustomizeFrameReturnValue => {\n const originalOrSentryCustomizeFrame = (\n originalCustomization: MetroCustomizeFrame | undefined,\n ): MetroCustomizeFrame => ({\n ...originalCustomization,\n collapse: originalCustomization?.collapse || collapseSentryInternalFrames(frame),\n });\n\n const maybePromiseCustomization = 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"]}
|