     [shadow.cljs.devtools.server.runtime :as runtime]
     [clojure.set :as set]
     [clojure.core.async.impl.protocols :as async-prot])
-  (:import (java.io Writer InputStreamReader BufferedReader IOException ByteArrayOutputStream ByteArrayInputStream PrintWriter)
+  (:import (java.io Writer InputStreamReader BufferedReader IOException ByteArrayOutputStream ByteArrayInputStream PrintWriter File)
            [java.net SocketException]
            [java.util List]))
 

        (build-log/log* build-log/stdout state evt)
        ))))

(defn new-build
  [{:keys [build-id] :or {build-id :custom} :as build-config} mode opts]
  (let [{:keys [npm classpath cache-root build-executor babel config] :as runtime}


        node-modules-dir
        (when-let [nmd (get-in build-config [:js-options :node-modules-dir])]
          (let [nmdf (io/file nmd)
                abs-file
                (cond
                  (and (str/ends-with? nmd "node_modules")
                       (.exists nmdf))
                  (.getAbsoluteFile nmdf)

                  (.exists (io/file nmdf "node_modules"))
                  (-> (io/file nmdf "node_modules")
                      (.getAbsoluteFile))

                  (.exists nmdf)
                  (.getAbsoluteFile nmdf)

                  :else
                  (throw (ex-info "invalid :node-modules-dir" {:node-modules-dir nmd})))]

            ;; :node-modules-dir can be a relative path like "./foo" or "../"
            (normalize-file abs-file)))

        ;; FIXME: this should not happen here. move to more appropriate place
        ;; somewhere in build targets maybe
