Source Map Parser

Source Map Parser

masonchow

Maps minified JavaScript stack traces back to original source code locations using source maps. Helps developers debug production errors by showing the actual source code that caused the error.

2284 views3Local (stdio)

What it does

  • Parse error stack traces from minified JavaScript
  • Look up original source code context for specific positions
  • Extract all source files from source maps
  • Map production errors back to development code

Best for

Frontend developers debugging production JavaScript errorsDevOps teams analyzing minified code crashesError monitoring and debugging workflows
WebAssembly-based parserWorks with downloadable source map URLs

Tools (3)

parse_stack

# Parse Error Stack Trace This tool allows you to parse error stack traces by providing the following: - A downloadable source map URL. - The line and column numbers from the stack trace. The tool will map the provided stack trace information to the corresponding source code location using the source map. It also supports fetching additional context lines around the error location for better debugging. ## Parameters: - **stacks**: An array of stack trace objects, each containing: - **line**: The line number in the stack trace. - **column**: The column number in the stack trace. - **sourceMapUrl**: The URL of the source map file corresponding to the stack trace. - **ctxOffset** (optional): The number of additional context lines to include before and after the error location in the source code. Defaults to 5. ## Returns: - A JSON object containing the parsed stack trace information, including the mapped source code location and context lines. - If parsing fails, an error message will be returned for the corresponding stack trace.

lookup_context

# Lookup Source Code Context This tool looks up original source code context for a specific line and column position in compiled/minified code. ## Parameters: - **line**: The line number in the compiled code (1-based) - **column**: The column number in the compiled code - **sourceMapUrl**: The URL of the source map file - **contextLines** (optional): Number of context lines to include before and after the target line (default: 5) ## Returns: - A JSON object containing the source code context snippet with file path, target line info, and surrounding context lines - Returns null if the position cannot be mapped

unpack_sources

# Unpack Source Map Sources This tool extracts all source files and their content from a source map. ## Parameters: - **sourceMapUrl**: The URL of the source map file to unpack ## Returns: - A JSON object containing: - **sources**: Object with source file paths as keys and their content as values - **sourceRoot**: The source root path from the source map - **file**: The original file name - **totalSources**: Total number of source files found

Alternatives