         (format "\\u%04X" cp))))) ; Any other character is Unicode
 
 (defn- escape-string [^CharSequence s]
-  (let [sb (StringBuilder. (count s))]
+  (let [sb #?(:clj (StringBuilder. (count s))
+              :cljs (StringBuffer.))]
     (doseq [c s]
       (.append sb (escape-char c)))
     (.toString sb)))

(defn- build-affecting-options [opts]
  (select-keys opts [:static-fns :optimize-constants :elide-asserts :target]))

(defn compiled-by-string
  ([] (compiled-by-string nil))
  ([opts]
    (str "// Compiled by ClojureScript "
      (util/clojurescript-version)
      (when opts
        (str " " (pr-str (build-affecting-options opts)))))))

#?(:clj
   (defn compile-file*

                    [cljs.source-map :as sm]
                    [clojure.data.json :as json]
                    [cljs.js-deps :as deps])
     :cljs (:require [goog.string :as gstring]
                     [clojure.string :as string]
                     [cljs.tools.reader :as reader]
                     [cljs.env :as env]
                     [cljs.analyzer :as ana]
                     [cljs.source-map :as sm]))
  #?(:clj (:import java.lang.StringBuilder
                   java.io.File)
     :cljs (:import [goog.string StringBuffer])))

(set! *warn-on-reflection* true)

