W3cubDocs

/Nim

sourcemap

Source Edit

Types

SourceMap = object
  version*: int
  sources*: seq[string]
  names*: seq[string]
  mappings*: string
  file*: string
Source Edit

Procs

func encode(values: seq[int]): string {....raises: [], tags: [], forbids: [].}
Encodes a series of integers into a VLQ base64 encoded string Source Edit
proc genSourceMap(source: string; outFile: string): SourceMap {.
    ...raises: [ValueError], tags: [], forbids: [].}
Source Edit
func parse(source: string): SourceInfo {....raises: [ValueError], tags: [],
    forbids: [].}
Parses the JS output for embedded line info So it can convert those into a series of mappings Source Edit
func toSourceMap(info: SourceInfo; file: string): SourceMap {....raises: [],
    tags: [], forbids: [].}
Convert from high level SourceInfo into the required SourceMap object Source Edit

Iterators

iterator tokenize(line: string): (int, string) {....raises: [], tags: [],
    forbids: [].}
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 Source Edit

© 2006–2024 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/compiler/sourcemap.html