 
      state)))
 
-
-;; FIXME: manifest should be custom step
-(defn flush-manifest [public-dir modules include-foreign?]
-  (spit
-    (io/file public-dir "manifest.json")
-    (let [data
-          (->> modules
-               (map (fn [{:keys [name js-name entries depends-on default sources foreign-files] :as mod}]
-                      (-> {:name name
-                           :js-name js-name
-                           :entries entries
-                           :depends-on depends-on
-                           :default default
-                           :sources sources}
-                          (cond->
-                            (and include-foreign? (seq foreign-files))
-                            (assoc :foreign (mapv #(select-keys % [:js-name :provides]) foreign-files))))
-                      )))]
-      (with-out-str
-        (json/pprint data :escape-slash false)))))
-
 (defn flush-foreign-bundles
   [{:keys [public-dir build-modules] :as state}]
   (doseq [{:keys [foreign-files] :as mod} build-modules

           (assoc :default-module module-name)
           )))))

(defn flush-to-disk
  "flush all generated sources to disk, not terribly useful, use flush-unoptimized to include source maps"
  [{:keys [work-dir sources] :as state}]
  (with-logged-time
    [state {:type :flush-to-disk}]
    (doseq [{:keys [type name compiled] :as src} (vals sources)
            :when (and (= :cljs type)
                       compiled)]

      (let [{:keys [js-name output]} src
            target (io/file work-dir js-name)]
        (io/make-parents target)
        (spit target output)))
    state))

(defn closure-defines-json [{:keys [closure-defines] :as state}]
  (let [closure-defines
        (reduce-kv


  (with-logged-time
    [state {:type :flush-unoptimized}]

    (doseq [mod build-modules]
      (flush-unoptimized-module! state mod))
