Usage examples for the @roku-sdk/stack-decoder TypeScript API, using the source maps bundled in bundle-dev-example/ and bundle-prod-example/.

Setup

To install the dependencies, run this command from the workspace root:

pnpm install

Examples

Every example supports development and production bundles through the BUILD_VARIANT environment variable (defaults to dev).

ScriptDevProdDescription
basic-decodepnpm basic:devpnpm basic:proddecodeStack with buildDir, with a source map file, SHA auto-detection, and context control
error-handlingpnpm errors:devpnpm errors:prodStackDecoderError for invalid options and source maps, unmappable frames, a buildDir that does not exist, and edge cases
batch-processingpnpm batch:devpnpm batch:prodloadSourceMap for cached loading and inline source map reuse across multiple traces
sentry-integrationpnpm sentry:devpnpm sentry:prodbeforeSend hook: device crash through the frame pipeline of Sentry with context lines
bugsnag-integrationpnpm bugsnag:devpnpm bugsnag:prodonError hook: device crash through the frame pipeline of Bugsnag

Run all examples at once:

pnpm all:dev     # Development build (bundle-dev-example)
pnpm all:prod    # Production build (bundle-prod-example)

API coverage

This table shows which example files use each export:

ExportExample files
decodeStackAll examples
loadSourceMapbatch-processing
StackDecoderErrorerror-handling
DecodeOptions.buildDirbasic-decode, batch-processing
DecodeOptions.sourceMapbasic-decode, batch-processing, sentry-integration, bugsnag-integration
DecodeOptions.contextLinesbasic-decode, sentry-integration
DecodeOptions.shabasic-decode (detected automatically from the trace)
DecodedFramesentry-integration, bugsnag-integration

Did this page help you?