 (defonce ^:private st (cljs/empty-state))
 
 (defonce ^:private current-ns (atom 'cljs.user))
+
+(defn- current-alias-map
+  []
+  (get-in @st [:cljs.analyzer/namespaces @current-ns :requires]))
 
 (defn- all-ns
   "Returns a sequence of all namespaces."

    (binding [ana/*cljs-ns* @current-ns
              env/*compiler* st
              r/*data-readers* tags/*cljs-data-readers*
              r/resolve-symbol ana/resolve-symbol]
      (try
        (r/read {:eof (js-obj) :read-cond :allow :features #{:cljs}} rdr)
        (nil? (rt/peek-char rdr))

  (binding [ana/*cljs-ns* @current-ns
            env/*compiler* st
            r/*data-readers* tags/*cljs-data-readers*
            r/resolve-symbol ana/resolve-symbol
            r/*alias-map* (current-alias-map)]
    (let [reader (rt/string-push-back-reader source)]
      [(r/read {:read-cond :allow :features #{:cljs}} reader) (apply str (read-chars reader))])))

