        (every? #(str/starts-with? (str %) "goog.") provides)
        ))
 
-(defn flush-unoptmized-module!
+(defn flush-unoptimized-module!
   [{:keys [dev-inline-js public-dir public-path unoptimizable] :as state}
    {:keys [default js-name name prepend prepend-js append-js sources web-worker] :as mod}]
   (let [inlineable-sources

    (flush-manifest public-dir build-modules)

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

    state
    ))

   (with-logged-time
     [state {:type :flush-sources
             :source-names source-names}]
     (doseq [{:keys [type js-name name input output last-modified source-map] :as src}
             (->> source-names
                  (map #(get-in state [:sources %])))
             :let [js-file
                   (io/file public-dir cljs-runtime-path js-name)

                   src-file
                   (io/file public-dir cljs-runtime-path name)

                   src-map?
                   (and source-map (:source-map state))

                   src-map-file
                   (io/file public-dir cljs-runtime-path (str js-name ".map"))]

             ;; skip files we already have
             :when (or (not (.exists js-file))
                       (zero? last-modified)
                       ;; js is not compiled but maybe modified
                       (> (or (:compiled-at src) last-modified)
                          (.lastModified js-file))
                       (and src-map? (or (not (.exists src-file))
                                         (not (.exists src-map-file)))))]

       (io/make-parents js-file)

       ;; must not modify output in any way, will mess up source maps otherwise
       (spit js-file output)

       (when src-map?
         ;; spit original source, needed for source maps
         (spit src-file @input)

         (spit src-map-file
           (sm/encode
             {name source-map}
             ;; very important that :lines is accurate for closure source maps, otherwise unused
             {:lines
              (-> (StringReader. output)
                  (BufferedReader.)
                  (line-seq)
                  (count))
              :file js-name
              :preamble-line-count 0})))

       ;; foreign libs should play nice with goog require/import and tell what they provide
       ;; FIXME: this modifies the ouput, but foreign files have no source maps anyways
       (when (:foreign src)
         (spit js-file (make-foreign-js-source src) :append true)))

     state)))


;; FIXME: manifest should be custom step
