(defn page-state [uri {:keys [type ns-sym var-sym static? nses cljs-nses-and-vars] :as opts}]
(let [cljs-nses-and-vars (or cljs-nses-and-vars (get-cljs-nses-and-vars))
nses (or nses
(->> (concat (get-clj-nses) (get-cljs-nses cljs-nses-and-vars))
(sort-by #(-> % :sym str))
vec))
vars (case type
:clj (cond
var-sym [(get-clj-var-info ns-sym var-sym)]
ns-sym (get-clj-vars ns-sym))
:cljs (cond
var-sym [(some (fn [var]
(when (-> var :sym (= var-sym))
var))
(get-cljs-vars cljs-nses-and-vars ns-sym))]
ns-sym (get-cljs-vars cljs-nses-and-vars ns-sym))
nil)
rel-path (-> (remove empty? (str/split uri #"/"))
count
(- 1)
(repeat "../")
str/join)]
(merge opts
{:static? static?
:nses nses
:ns-meta (when (= type :clj)
(some-> ns-sym the-ns meta))
:vars vars
:rel-path rel-path
:check-for-updates? (and (not ns-sym)
(not var-sym)
(not static?)
(not (:dev? @*options))
(not (:disable-update-checker? @*options)))})))