Class for transforming stack traces from React Native application with using Source Map.
Raw stack frames produced by React Native, points to some location from the bundle
eg index.bundle?platform=ios:567:1234
. By using Source Map for that bundle Symbolicator
produces frames that point to source code inside your project eg Hello.tsx:10:9
.
• new Symbolicator(projectRoot
, logger
, readFileFromWdm
, readSourceMapFromWdm
)
Constructs new Symbolicator
instance.
Name | Type | Description |
---|---|---|
projectRoot |
string |
Absolute path to root directory of the project. |
logger |
FastifyLoggerInstance |
Fastify logger instance. |
readFileFromWdm |
(fileUrl : string ) => Promise <string > |
Function to read arbitrary file from webpack-dev-middleware. |
readSourceMapFromWdm |
(fileUrl : string ) => Promise <string > |
Function to read Source Map file from webpack-dev-middleware. |
packages/repack/src/server/Symbolicator.ts:103
• sourceMapConsumerCache: Record
<string
, SourceMapConsumer
> = {}
Cache with initialized SourceMapConsumer
to improve symbolication performance.
packages/repack/src/server/Symbolicator.ts:93
▸ process(stack
): Promise
<SymbolicatorResults
>
Process raw React Native stack frames and transform them using Source Maps.
Method will try to symbolicate as much data as possible, but if the Source Maps
are not available, invalid or the original positions/data is not found in Source Maps,
the method will return raw values - the same as supplied with stack
parameter.
For example out of 10 frames, it's possible that only first 7 will be symbolicated and the
remaining 3 will be unchanged.
Name | Type | Description |
---|---|---|
stack |
ReactNativeStackFrame [] |
Raw stack frames. |
Promise
<SymbolicatorResults
>
Symbolicated stack frames.
packages/repack/src/server/Symbolicator.ts:121
▸ Static
inferPlatformFromStack(stack
): undefined
| string
Infer platform from stack frames.
Usually at least one frame has file
field with the bundle URL eg:
http://localhost:8081/index.bundle?platform=ios&...
, which can be used to infer platform.
Name | Type | Description |
---|---|---|
stack |
ReactNativeStackFrame [] |
Array of stack frames. |
undefined
| string
Inferred platform or undefined
if cannot infer.