Skip to main content

Module sourcemap

Module sourcemap 

Source
Expand description

Source map: tracks JS source locations → generated Zig line numbers.

Two output formats:

  • Inline comments: // @src(file.js:42) embedded in generated Zig
  • JSON mapping file: { "mappings": [...] } for tooling

Structs§

LineIndex
Pre-computed line-start byte offsets for O(log n) byte→line lookup.
SourceMap
Accumulated source map for a single JS→Zig translation.
SourceMapping
A single mapping entry: one Zig output line ↔ one JS source location.

Functions§

count_lines
Count newlines in a string to determine the current 1-based line number. The line after the last newline is the current line being written.