   (:require [clojure.string :as string]
             [clojure.java.io :as io]
             [cljs.analyzer :as ana]
+            [cljs.util :as util]
             [cljs.compiler :as comp]
             [cljs.repl :as repl]
             [cljs.closure :as closure]

               (aget (.. js/goog -dependencies_ -nameToPath) name))))))))

(defrecord JscEnv [host port socket response-promise]
  repl/IJavaScriptEnv
  (-setup [this opts]
    (setup this opts))

(defn stack-line->canonical-frame
  "Parses a stack line into a frame representation, returning nil
  if parse failed."
  [stack-line opts]
  (let [[function file line column]
        (rest (re-matches #"(.*)@file://(.*):([0-9]+):([0-9]+)"
                stack-line))]
    (if (and file function line column)
      {:file     (string/replace
                   (.getCanonicalFile (io/file file))
                   (str (System/getProperty "user.dir") File/separator
                     (util/output-directory opts) File/separator)
                   "")
       :function function
       :line     (Long/parseLong line)
       :column   (Long/parseLong column)})))
