@callstack/repack-dev-server 6.0.0-canary-20250321121727 → 6.0.0-canary-20250430092041

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.
@@ -1,12 +1,22 @@
1
1
  import fastifyPlugin from 'fastify-plugin';
2
2
  import { Symbolicator } from './Symbolicator.js';
3
+ function getStackFromRequestBody(request) {
4
+ let body;
5
+ if (request.headers['content-type'] === 'application/json') {
6
+ // RN >= 0.79 uses application/json
7
+ body = request.body;
8
+ }
9
+ else {
10
+ // RN < 0.79 uses text/plain
11
+ body = JSON.parse(request.body);
12
+ }
13
+ return body.stack;
14
+ }
3
15
  async function symbolicatePlugin(instance, { delegate, }) {
4
16
  const symbolicator = new Symbolicator(delegate.symbolicator);
5
17
  instance.post('/symbolicate', async (request, reply) => {
6
- // React Native sends stack as JSON but tests content-type to text/plain, so
7
- // we cannot use JSON schema to validate the body.
8
18
  try {
9
- const { stack } = JSON.parse(request.body);
19
+ const stack = getStackFromRequestBody(request);
10
20
  const platform = Symbolicator.inferPlatformFromStack(stack);
11
21
  if (!platform) {
12
22
  request.log.debug({ msg: 'Received stack', stack });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@callstack/repack-dev-server",
3
3
  "description": "A bundler-agnostic development server for React Native applications as part of @callstack/repack.",
4
4
  "license": "MIT",
5
- "version": "6.0.0-canary-20250321121727",
5
+ "version": "6.0.0-canary-20250430092041",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
@@ -50,7 +50,7 @@
50
50
  "@types/babel__code-frame": "^7.0.6",
51
51
  "@types/node": "^18",
52
52
  "@types/ws": "^8.18.0",
53
- "typescript": "^5.7.2"
53
+ "typescript": "^5.8.3"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "tsc -b",