A builder for Source Maps (revision 3).
- Spec
mozilla/source-map
: reference JS implementation- Visualizer
Source Map is a collection of mappings from a generated (often minified) file to the original source code (across multiple files if needed).
import SourceMap
SourceMap.empty
|> SourceMap.withFile "elm.min.js"
|> SourceMap.addMapping
{ generatedLine = 3
, generatedColumn = 10
, source = "Main.elm"
, originalLine = 10
, originalColumn = 1
, name = Just "init"
}
|> SourceMap.toString
{-->
{
"version": 3,
"sources": [
"Main.elm"
],
"names": [
"init"
],
"mappings": ";;SASAA",
"file": "elm.min.js"
}
-}