Static namespace discovery: file path + file text to namespace info.
Files are parsed with edamame, never evaluated. Reader conditionals are
resolved for :clj, auto-resolved keywords (::alias/kw), regexes,
syntax-quote and unknown tagged literals are all tolerated. Like
tools.namespace (which Kaocha uses) the first ns form names the file's
namespace. Metadata is only visible when it is literal in the source.
Static namespace discovery: file path + file text to namespace info. Files are parsed with edamame, never evaluated. Reader conditionals are resolved for `:clj`, auto-resolved keywords (`::alias/kw`), regexes, syntax-quote and unknown tagged literals are all tolerated. Like tools.namespace (which Kaocha uses) the first `ns` form names the file's namespace. Metadata is only visible when it is literal in the source.
(ns-info path text)Parse text, the contents of the file at path, into namespace info:
{:file "test/my/app_test.clj"
:ns 'my.app-test
:requires #{'my.app 'clojure.test} ; libs that get loaded
:as-alias-only #{'my.specs} ; `:as-alias` without loading
:meta {:doc "..." :slow true} ; ns name metadata + attr-map
:vars {'foo {:slow true}}} ; literal metadata on deftests
:vars lists vars defined by top-level deftest, deftest- and defspec
forms (also inside top-level do); tests produced by other macros are
invisible. Top-level (require ...)/(use ...) calls count towards
:requires. A file without an ns form has no :ns. A file whose ns
form cannot be read yields {:file path :error msg}; a read error after
the ns form keeps the info and adds :scan-error. Never throws.
Parse `text`, the contents of the file at `path`, into namespace info:
{:file "test/my/app_test.clj"
:ns 'my.app-test
:requires #{'my.app 'clojure.test} ; libs that get loaded
:as-alias-only #{'my.specs} ; `:as-alias` without loading
:meta {:doc "..." :slow true} ; ns name metadata + attr-map
:vars {'foo {:slow true}}} ; literal metadata on deftests
`:vars` lists vars defined by top-level `deftest`, `deftest-` and `defspec`
forms (also inside top-level `do`); tests produced by other macros are
invisible. Top-level `(require ...)`/`(use ...)` calls count towards
`:requires`. A file without an `ns` form has no `:ns`. A file whose `ns`
form cannot be read yields `{:file path :error msg}`; a read error after
the `ns` form keeps the info and adds `:scan-error`. Never throws.(read-forms text)(read-forms text current-ns)Read every top-level form of text, never evaluating it. Returns
{:forms [...] :error nil-or-message}; on a reader error :forms holds
everything read before it. ::kw reads as :current/kw, or with
namespace current-ns when given.
Read every top-level form of `text`, never evaluating it. Returns
`{:forms [...] :error nil-or-message}`; on a reader error `:forms` holds
everything read before it. `::kw` reads as `:current/kw`, or with
namespace `current-ns` when given.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |