cljs.js/append-source-map
function | removed v1.7.28 | added v1.7.10 | Edit |
(append-source-map state name source sb sm-data {:keys [output-dir asset-path], :as opts})
(defn append-source-map
[state name source sb sm-data {:keys [output-dir asset-path] :as opts}]
(let [t (.valueOf (js/Date.))
smn (if name
(string/replace (munge (str name)) "." "/")
(str "cljs-" t))
ts (.valueOf (js/Date.))
out (or output-dir asset-path)
src (cond-> (str smn ".cljs?rel=" ts)
out (prefix (str out "/")))
file (cond-> (str smn ".js?rel=" ts)
out (prefix (str out "/")))
json (sm/encode {src (:source-map sm-data)}
{:lines (+ (:gen-line sm-data) 3)
:file file :sources-content [source]})]
(when (:verbose opts) (debug-prn json))
(swap! state assoc-in
[:source-maps name] (sm/invert-reverse-map (:source-map sm-data)))
(.append sb
(str "\n//# sourceURL=" file
"\n//# sourceMappingURL=data:application/json;base64,"
(base64/encodeString json)))))