elm-sourcemap

July 8, 2022 ยท View on GitHub

A builder for Source Maps (revision 3).

Source Map is a collection of mappings from a generated (often minified) file to the original source code (across multiple files if needed).

Usage

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"
}

-}