Walking and ordering of dependency trees.
A dependency tree here is a nested map of [name version] -> subtree. This
namespace provides depth-first walks for both modes (walk-dep-tree for
unresolved, walk-ordered-deps for resolved), tree expansion
(walk&expand-deps), subtree eviction, and topological ordering.
Walking and ordering of dependency trees. A dependency tree here is a nested map of `[name version] -> subtree`. This namespace provides depth-first walks for both modes (`walk-dep-tree` for unresolved, `walk-ordered-deps` for resolved), tree expansion (`walk&expand-deps`), subtree eviction, and topological ordering.
(evict-subtrees deps subtree-roots)Evict subtrees from a dependency tree.
subtree-roots are defined as a set of dependency names (for example #{'org.clojure/clojure 'org.clojure/clojurescript}
without their versions. Tested on a resolved tree. Assumed that it would evict all subtrees from an unresolved dependency
tree.
Evict subtrees from a dependency tree.
`subtree-roots` are defined as a set of dependency names (for example `#{'org.clojure/clojure 'org.clojure/clojurescript}`
without their versions. Tested on a resolved tree. Assumed that it would evict all subtrees from an unresolved dependency
tree.(path-pred path dep k)True when appending dep's name to path equals k, i.e. dep sits at path
k in the tree. Used to match overrides/expositions to a node by its full
path.
True when appending `dep`'s name to `path` equals `k`, i.e. `dep` sits at path `k` in the tree. Used to match overrides/expositions to a node by its full path.
(topological-order dep-tree)Returns a map of each dependency in dep-tree to its position (an integer) in
topological order. Used to order the resolved tree before walking it.
Returns a map of each dependency in `dep-tree` to its position (an integer) in topological order. Used to order the resolved tree before walking it.
(walk&expand-deps deps resolve-dep-fn overrides)(walk&expand-deps deps resolve-dep-fn overrides path)Walks a dependency tree and expands it with all dependencies as walking.
This essentially means that an unresolved dependency tree is created where all nodes hold their originally defined dependencies as children recursively.
Understands overrides in terms of versions so a node can be overridden at any point of the tree while it is being built. This means that if the old version of the same dependency has different dependencies in its turn than the new version being enforced by overriding the dependencies of the new version will be present in the subtree.
Overrides is a map where keys are paths as vectors to a dependency in an unresolved tree and values are dependencies as a vector. for example
{[mvxcvi/puget fipp] [fipp 0.6.14]}
Walks a dependency tree and expands it with all dependencies as walking.
This essentially means that an unresolved dependency tree is created where all nodes hold their originally
defined dependencies as children recursively.
Understands overrides in terms of versions so a node can be overridden at any point of the tree while it is being built.
This means that if the old version of the same dependency has different dependencies in its turn than the new version
being enforced by overriding the dependencies of the new version will be present in the subtree.
Overrides is a map where keys are paths as vectors to a dependency in an unresolved tree and values are dependencies
as a vector. for example
```
{[mvxcvi/puget fipp] [fipp 0.6.14]}
```
(walk-dep-tree deps pre-fn post-fn paths ctx)Depth-first walk of a dependency tree (used by unresolved-tree mode), side-effecting.
For each node calls (pre-fn ctx paths dep), which must return
[pre-result new-paths]; new-paths is threaded down into the subtree. After
the subtree is processed, calls (post-fn ctx pre-result paths) with this
node's original paths. Return values are discarded.
Depth-first walk of a dependency tree (used by unresolved-tree mode), side-effecting. For each node calls `(pre-fn ctx paths dep)`, which must return `[pre-result new-paths]`; `new-paths` is threaded down into the subtree. After the subtree is processed, calls `(post-fn ctx pre-result paths)` with this node's original `paths`. Return values are discarded.
(walk-deps deps f)(walk-deps deps f level)Depth-first walk of a dependency tree, calling (f dep level) for each node
(root level defaults to 0). Side-effecting; ignores f's return value.
Depth-first walk of a dependency tree, calling `(f dep level)` for each node (root level defaults to 0). Side-effecting; ignores `f`'s return value.
(walk-ordered-deps deps pre-fn post-fn paths ctx)Walks a flat, topologically ordered map of dependencies (used by resolved-tree mode).
First calls (pre-fn ctx paths dep) for every dep, collecting their results.
Then calls post-fn for each dep in reverse order, threading into paths the
:parent-clj-dirs accumulated across all the pre-results, and returns a vector
of the post-fn results in that (reversed) order. Unlike walk-dep-tree, this
returns its post-fn results rather than discarding them - resolved mode
applies the collected renames in one global pass.
Walks a flat, topologically ordered map of dependencies (used by resolved-tree mode). First calls `(pre-fn ctx paths dep)` for every dep, collecting their results. Then calls `post-fn` for each dep in reverse order, threading into `paths` the `:parent-clj-dirs` accumulated across all the pre-results, and returns a vector of the `post-fn` results in that (reversed) order. Unlike `walk-dep-tree`, this returns its `post-fn` results rather than discarding them - resolved mode applies the collected renames in one global pass.
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 |