Simple interface wanted to convert cljs forms to js

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

1 {:ns {:name "test.core" :requires {(quote gstring) (quote goog.string)}} :locals {}}

This code seems to do what we want.

1 2 3 4 5 6 7 8 9 (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

Environment

None

Status

Assignee

Unassigned

Reporter

Stuart Mitchell

Labels

Approval

None

Patch

None

Affects versions

0.0-3211

Priority

Minor
Configure