(defn get-cljs-nses-and-vars-dynamically []
(when-let [*env (:*cljs-env @*options)]
(require 'cljs.analyzer.api)
(let [all-ns (resolve (symbol "cljs.analyzer.api" "all-ns"))
ns-publics (resolve (symbol "cljs.analyzer.api" "ns-publics"))]
(reduce
(fn [m ns-sym]
(let [var-map (reduce
(fn [m [var-sym {:keys [doc arglists anonymous] :as parsed-var}]]
(if anonymous
m
(assoc m var-sym
{:sym var-sym
:meta {:doc doc
:arglists (if (= 'quote (first arglists))
(second arglists)
arglists)}
:examples (get-examples ns-sym var-sym)
:methods (some-> parsed-var
:protocol-info
:methods
keys
sort)
:protocol (some-> parsed-var
:protocol
name
symbol)})))
{}
(ns-publics *env ns-sym))
vars (var-map->vars ns-sym var-map)]
(assoc m ns-sym vars)))
{}
(all-ns *env)))))