                     (str "goog.provide('test.app');\n"
                          "goog.require('goog.array');\n"
                          "goog.require('goog.dom.query');"))
+  ;; add dependencies with foreign lib
+  (add-dependencies {:foreign-libs [{:file "samples/hello/src/hello/core.cljs"
+                                     :provides ["example.lib"]}]}
+                    (str "goog.provide('test.app');\n"
+                         "goog.require('example.lib');\n"))
   ;; add dependencies to a JavaScriptFile record
-  (add-dependencies {} (javascript-file (to-url "samples/hello/src/hello/core.cljs")
-                                     ["hello.core"]
-                                     ["goog.array"]))
+  (add-dependencies {} (javascript-file false
+                                        (to-url "samples/hello/src/hello/core.cljs")
+                                        ["hello.core"]
+                                        ["goog.array"]))
   )
 
 ;; Optimize

                    s
                    (slurp (io/reader (-url this))))))

(defrecord JavaScriptFile [^URL url provides requires]
  IJavaScript
  (-url [this] url)
  (-provides [this] provides)
  (-requires [this] requires)
  (-source [this] (slurp (io/reader url))))

(defn javascript-file [^URL url provides requires]
  (JavaScriptFile. url (map name provides) (map name requires)))

(defn map->javascript-file [m]
  (javascript-file (to-url (:file m))
                   (:provides m)
                   (:requires m)))


(extend-protocol IJavaScript
  
  String
  (-foreign? [this] false)
  (-url [this] nil)
  (-provides [this] (:provides (parse-js-ns (string/split-lines this))))
  (-requires [this] (:requires (parse-js-ns (string/split-lines this))))
  (-source [this] this)
  
  clojure.lang.IPersistentMap
  (-foreign? [this] (:foreign this))
  (-url [this] (or (:url this)
                   (to-url (:file this))))
  (-provides [this] (map name (:provides this)))
