cljs.repl.browser/parse-file
function | removed v1.7.10 | added v0.0-3053 | Edit |
(parse-file {:keys [host host-port port], :as repl-env} file {:keys [asset-path], :as opts})
(defn parse-file [{:keys [host host-port port] :as repl-env} file {:keys [asset-path] :as opts}]
(let [base-url-pattern (Pattern/compile (str "http://" host ":" (or host-port port) "/"))]
(if (re-find base-url-pattern file)
(-> file
(string/replace base-url-pattern "")
(string/replace
(Pattern/compile
(str "^" (or asset-path (util/output-directory opts)) "/")) ""))
(if-let [asset-root (:asset-root opts)]
(string/replace file asset-root "")
(throw
(ex-info (str "Could not relativize URL " file)
{:type :parse-stacktrace
:reason :relativize-url}))))))