 (ns adzerk.boot-cljs.middleware
   (:require [adzerk.boot-cljs.util :as util]
             [boot.file :as file]
+            [boot.util :as butil]
             [clojure.java.io :as io]
             [clojure.string :as string]))
 

        (spit (format-ns-forms (main-ns-forms cljs-ns init-nss init-fns)))))
    (-> ctx
        (update-in [:opts :asset-path] #(if % % asset-path))
        (assoc-in [:opts :output-dir] out-path)
        (assoc-in [:opts :output-to] js-path)
        (assoc-in [:opts :main] cljs-ns))))

(defn modules
  "If .cljs.edn file contains modules declaration, use it to create options

            :core      {:output-to \"<tmp-dir>/js/main/core.js\" ...}}"
  [{:keys [tmp-out main] :as ctx}]
  (if-let [modules (:modules main)]
    (set-option ctx :modules (assoc (into {} (map (fn [[k v]]
                                                    (let [js-path (util/path tmp-out (cljs-edn-path->module-path (:rel-path main) k))]
                                                      [k (assoc v :output-to js-path)]))
                                                  modules))
                                    :cljs-base {:output-to (:output-to (:opts ctx))}))
    ctx))

(defn source-map
