diff --git a/.npmignore b/.npmignore index e492717cb4..2603c8292e 100644 --- a/.npmignore +++ b/.npmignore @@ -18,3 +18,7 @@ !scripts/sentry-xcode.sh !scripts/sentry-xcode-debug-files.sh !scripts/sentry_utils.rb + +# Metro +!/metro.js +!/metro.d.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e37bbe454..0de14c30c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ ## Unreleased +### Features + +- New simplified Sentry Metro Serializer export ([#3450](https://github.com/getsentry/sentry-react-native/pull/3450)) + + ```js + const { createSentryMetroSerializer } = require('@sentry/react-native/metro'); + ``` + ### Fixes - Encode envelopes using Base64, fix array length limit when transferring over Bridge. ([#2852](https://github.com/getsentry/sentry-react-native/pull/2852)) diff --git a/metro.d.ts b/metro.d.ts new file mode 100644 index 0000000000..e9c3b36e0b --- /dev/null +++ b/metro.d.ts @@ -0,0 +1 @@ +export * from './dist/js/tools/sentryMetroSerializer'; diff --git a/metro.js b/metro.js new file mode 100644 index 0000000000..20002a7979 --- /dev/null +++ b/metro.js @@ -0,0 +1 @@ +module.exports = require('./dist/js/tools/sentryMetroSerializer'); diff --git a/samples/react-native/metro.config.js b/samples/react-native/metro.config.js index 720cf0c216..8905e10901 100644 --- a/samples/react-native/metro.config.js +++ b/samples/react-native/metro.config.js @@ -2,9 +2,7 @@ const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config'); const path = require('path'); const blacklist = require('metro-config/src/defaults/exclusionList'); -const { - createSentryMetroSerializer, -} = require('../../dist/js/tools/sentryMetroSerializer'); +const { createSentryMetroSerializer } = require('../../metro'); const parentDir = path.resolve(__dirname, '../..'); /** diff --git a/test/react-native/rn.patch.metro.config.js b/test/react-native/rn.patch.metro.config.js index d7e2d1db39..0c8ac36091 100755 --- a/test/react-native/rn.patch.metro.config.js +++ b/test/react-native/rn.patch.metro.config.js @@ -16,8 +16,7 @@ logger.info('Patching Metro config: ', args.path); const configFilePath = args.path; -const importSerializer = - "const {createSentryMetroSerializer} = require('@sentry/react-native/dist/js/tools/sentryMetroSerializer');"; +const importSerializer = "const {createSentryMetroSerializer} = require('@sentry/react-native/metro');"; const serializerValue = 'serializer: { customSerializer: createSentryMetroSerializer(), },'; const enterSerializerBefore = '};';