State tracker for client sessions.
State tracker for client sessions.
(calculate-changed-ns-map new-map old-map)
Return a map of namespaces that changed between new-map and old-map. new-map and old-map are maps from namespace names to namespace data, which is the same format of map returned by this function. old-map can also be nil, which is the same as an empty map.
Return a map of namespaces that changed between new-map and old-map. new-map and old-map are maps from namespace names to namespace data, which is the same format of map returned by this function. old-map can also be nil, which is the same as an empty map.
(ensure-clojure-core-present old-ns-map project-ns-map cljs)
Check if old-ns-map
has clojure.core, else add it to
current-ns-map. If cljs
we inject cljs.core instead. cljs
is the
cljs environment grabbed from the message (if present).
Check if `old-ns-map` has clojure.core, else add it to current-ns-map. If `cljs` we inject cljs.core instead. `cljs` is the cljs environment grabbed from the message (if present).
(fast-reduce f coll)
Like (reduce f {} coll), but faster.
Inside f, use assoc!
and conj!
instead of assoc
and conj
.
Like (reduce f {} coll), but faster. Inside f, use `assoc!` and `conj!` instead of `assoc` and `conj`.
(filter-core-and-get-meta refers)
Remove keys whose values are vars in the core namespace.
Remove keys whose values are vars in the core namespace.
(make-transport {:keys [transport session] :as msg})
Return a Transport that defers to transport
and possibly notifies
about the state.
Return a Transport that defers to `transport` and possibly notifies about the state.
(merge-used-aliases new-ns-map old-ns-map val-fn)
Return new-ns-map merged with all of its direct dependencies. val-fn a function that returns namespace objects when called with namespace names.
Return new-ns-map merged with all of its direct dependencies. val-fn a function that returns namespace objects when called with namespace names.
Cache of the namespace info that has been sent to each session.
Each key is a session. Each value is a map from namespace names to
data (as returned by ns-as-map
).
Cache of the namespace info that has been sent to each session. Each key is a session. Each value is a map from namespace names to data (as returned by `ns-as-map`).
Set of nREPL ops that can lead to code being evaluated.
Set of nREPL ops that can lead to code being evaluated.
(update-and-send-cache old-data msg)
(update-and-send-cache old-data msg jar-ns-fn transport-send-fn)
Send a reply to msg with state information assoc'ed. old-data is the ns-cache that needs to be updated (the one associated with msg's session). Return the updated value for it. This function has side-effects (sending the message)!
Two extra entries are sent in the reply. One is the :repl-type, which is either :clj or :cljs.
The other is :changed-namespaces, which is a map from namespace
names to namespace data (as returned by ns-as-map
). This contains
only namespaces which have changed since we last notified the
client.
The 2-arity call is the intended way to use this function.
The 4-arity call is provided for testing under mranderson. Allows substitution of supporting fns in the implementation that don't need to exposed otherwise. Be aware when the implementation details change because this arity (and the tests) will need to change also.
Send a reply to msg with state information assoc'ed. old-data is the ns-cache that needs to be updated (the one associated with msg's session). Return the updated value for it. This function has side-effects (sending the message)! Two extra entries are sent in the reply. One is the :repl-type, which is either :clj or :cljs. The other is :changed-namespaces, which is a map from namespace names to namespace data (as returned by `ns-as-map`). This contains only namespaces which have changed since we last notified the client. The 2-arity call is the intended way to use this function. The 4-arity call is provided for testing under mranderson. Allows substitution of supporting fns in the implementation that don't need to exposed otherwise. Be aware when the implementation details change because this arity (and the tests) will need to change also.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close