Types
SourceInfo = object mappings: seq[Mapping] names, files: seq[string]
SourceMap = object version*: int sources*: seq[string] names*: seq[string] mappings*: string file*: string
Procs
proc addSegment(info: var SourceInfo; original, generated: int; name: string = "") {....raises: [], tags: [].}
- Adds a new segment into the current line
proc encode(values: seq[int]): string {....raises: [], tags: [].}
- Encodes a series of integers into a VLQ base64 encoded string
proc newLine(info: var SourceInfo; file: string; line: int) {....raises: [], tags: [].}
- Starts a new line in the mappings. Call addSegment after this to add segments into the line
proc toSourceMap(info: SourceInfo; file: string): SourceMap {....raises: [], tags: [].}
- Convert from high level SourceInfo into the required SourceMap object
Iterators
iterator tokenize(line: string): (int, string) {....raises: [], tags: [].}
- Goes through a line and splits it into Nim identifiers and normal JS code. This allows us to map mangled names back to Nim names. Yields (column, name). Doesn't yield anything but identifiers. See mangleName in compiler/jsgen.nim for how name mangling is done