         (.add ^JSModule cljs-base-closure-module
           (js-source-file (javascript-name source) source))
         (swap! foreign-deps conj source)))
-    {:foreign-deps @foreign-deps
-     :modules modules}))
+    (assoc-in modules [0 1 :foreign-deps] @foreign-deps)))
 
 (comment
   (build "samples/hello/src"


(defn optimize-modules
  "Use the Closure Compiler to optimize one or more Closure JSModules. Returns
   a modules map containing :foreign-deps, a dependency sorted list of foreign
   dependencies, and :modules a dependency sorted list of module name and
   description tuples."
  [opts & sources]
  {:pre [(and (contains? opts :modules)
              (not (contains? opts :output-to)))]}

  )

(defn build-modules
  "Given a list of IJavaScript sources and compiler options return a dependency
   sorted list of module name / description tuples. The module descriptions will
   be augmented with a :closure-module entry holding the Closure JSModule."
  [sources opts]
  (let [find-entry (fn [sources entry]
                     (let [entry (name (comp/munge entry))]
