Skip to content

Commit

Permalink
feat(metro): New simplified Sentry Metro Serializer export
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich committed Dec 4, 2023
1 parent 4b4b999 commit d164636
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@
!scripts/sentry-xcode.sh
!scripts/sentry-xcode-debug-files.sh
!scripts/sentry_utils.rb

# Metro
!/metro.js
!/metro.d.ts
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions metro.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './dist/js/tools/sentryMetroSerializer';
1 change: 1 addition & 0 deletions metro.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./dist/js/tools/sentryMetroSerializer');
4 changes: 1 addition & 3 deletions samples/react-native/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, '../..');

/**
Expand Down
3 changes: 1 addition & 2 deletions test/react-native/rn.patch.metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '};';

Expand Down

0 comments on commit d164636

Please sign in to comment.