Source Map Parser logo

Source Map Parser

by MasonChow

This project implements a WebAssembly-based Source Map parser that can map JavaScript error stack traces back to source code and extract relevant context information. Developers can easily map JavaScript error stack traces back to source code for quick problem identification and resolution.

View on GitHub

Last updated: N/A

What is Source Map Parser?

A WebAssembly-based Source Map parser that maps JavaScript error stack traces back to source code and extracts relevant context information.

How to use Source Map Parser?

The tool can be used directly with NPX or by downloading build artifacts from the GitHub Release page. Runtime parameters like resource cache size and context line offset can be configured via environment variables. The MCP service provides tools for getting usage instructions and parsing stack information.

Key features of Source Map Parser

  • Stack Parsing

  • Batch Processing

  • Context Extraction

  • MCP Integration

Use cases of Source Map Parser

  • Debugging JavaScript applications

  • Error tracking and resolution

  • Analyzing stack traces

  • Improving code quality

  • Integrating with MCP services

FAQ from Source Map Parser

WebAssembly Module Loading Failure

Ensure Node.js version is 18 or higher. If it's lower than 18, please upgrade Node.js. If Node.js version is 18+ but you still encounter issues, use the command: npx --node-arg=--experimental-wasm-reftypes -y source-map-parser-mcp@latest

How to set the maximum memory space occupied by resource cache?

Set the SOURCE_MAP_PARSER_RESOURCE_CACHE_MAX_SIZE environment variable. Default is 200MB.

How to define the number of context code lines to display around the error location?

Set the SOURCE_MAP_PARSER_CONTEXT_OFFSET_LINE environment variable. Default is 1 line.

How to parse stack information?

Use the parse_stack tool in the MCP service, providing stack traces and Source Map addresses.

How to handle cases where Source Maps are not directly exposed to browsers?

Use prompt rules to guide the model to complete path conversion, for example, converting /assets/index.js to source_backup/index.js.map.