Details
Description
In our project (a clojurescript debugger) we want to convert cljs forms or a sequence of forms into javascript so that they can be executed in the javascript console.
We would like something similar to closure/compile-form-seq (https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/closure.clj#L308)
However, we need to supply, the namespace requires and locals in an env like this
{:ns {:name "test.core" :requires {(quote gstring) (quote goog.string)}} :locals {}}
This code seems to do what we want.
(defn compile-form-seq
\"Compile a sequence of forms to a JavaScript source string.\"
[forms env]
(env/ensure
(compiler/with-core-cljs nil
(fn []
(with-out-str
(doseq [form forms]
(compiler/emit (analyzer/analyze env form))))))))
I am not sure why I need env/ensure.
Would you be able to patch compile-form-seq to provide the needed interface, or suggest what we should be doing.
Thanks
Stu
Seems like something useful to add to a cljs.compiler.api namespace.