(defn encode
"Take an internal source map representation represented as nested
sorted maps of file, line, column and return a source map v3 JSON
string."
[m opts]
(let [source-map-file-contents (encode* m opts)]
(if (true? (:source-map-pretty-print opts))
(with-out-str
(json/pprint
source-map-file-contents
:escape-slash false))
(json/write-str source-map-file-contents))))