             [shadow.build.config :as config]
             [shadow.build.output :as output]
             [shadow.build.closure :as closure]
+            [shadow.build.modules :as modules]
             [shadow.build.data :as data]
             [shadow.build.log :as log]
             [shadow.core-ext :as core-ext]

        )))

(defn flush-manifest
  [{:keys [build-options] :as state} include-foreign?]
  (let [data
        (->> (or (::closure/modules state)
                 (:build-modules state))

      (->> optimized
           (map #(hash-optimized-module % state module-hash-names))
           (into [])))))

;; in case the module is loaded by shadow.loader and not via its generated index file
(defn append-module-sources-set-loaded-calls [{:keys [build-modules] :as state}]
  (reduce
    (fn [state {:keys [module-id sources] :as mod}]
      (let [set-loaded-info
            (->> sources
                 (map #(get-in state [:sources %]))
                 (map #(str "SHADOW_ENV.setLoaded(" (pr-str (:output-name %)) ");"))
                 (str/join "\n"))

            append-id
            [::modules/append module-id]]

        (update-in state [:sources append-id :source] str ";\n" set-loaded-info)))
    state
    build-modules))

(defn inject-loader-setup-dev
  [state config]
