npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@regibyte/cljam-integrant

v0.1.5

Published

Data-driven system composition for cljam (port of Integrant)

Downloads

740

Readme

@regibyte/cljam-integrant

npm license

Data-driven system composition for @regibyte/cljam. A port of Integrant.

Define your system as a data map. Integrant resolves dependencies, starts components in topological order, and stops them in reverse. All lifecycle operations are async.


Installation

npm install @regibyte/cljam-integrant
# peer dependency
npm install @regibyte/cljam

Setup

import { createSession, nodePreset } from '@regibyte/cljam'
import { library as integrantLib } from '@regibyte/cljam-integrant'

const session = createSession({
  ...nodePreset(),
  libraries: [integrantLib],
})

Usage

Define a config

(ns my-app.system
  (:require [cljam.integrant.core :as ig]))

(def config
  {:app/db     {:url "postgresql://localhost/mydb"}
   :app/server {:port 3000 :db (ig/ref :app/db)}})

ig/ref declares a dependency. :app/server depends on :app/db — Integrant will start :app/db first and inject the started value.

Implement lifecycle methods

(defmethod ig/init-key :app/db [_ {:keys [url]}]
  (connect! url))   ;; return the running component

(defmethod ig/init-key :app/server [_ {:keys [port db]}]
  (start-server! port db))

(defmethod ig/halt-key! :app/db [_ db]
  (disconnect! db))

(defmethod ig/halt-key! :app/server [_ server]
  (stop-server! server))

Start and stop

(def *system (atom nil))

;; Start — returns a pending (Promise)
(-> (ig/init config)
    (then #(reset! *system %)))

;; Stop — also async
(-> (ig/halt! @*system)
    (then #(println "system stopped")))

Partial start

Pass a set of keys to start only part of the system:

;; Start only :app/db and its dependencies
(ig/init config #{:app/db})

Dev-mode hot reload

suspend! and resume allow you to reload code without restarting unchanged components:

;; Suspend the running system (calls suspend-key! in reverse order)
(-> (ig/suspend! @*system)
    (then (fn [_]
            ;; reload new config / code here...
            (ig/resume new-config @*system))))

resume-key defaults to calling init-key again. Override it to reuse the existing component when the config hasn't changed:

(defmethod ig/resume-key :app/db [key value old-value old-impl]
  (if (= value old-value)
    old-impl      ;; config unchanged — reuse the connection
    (init-key key value)))

References

| Constructor | Description | |---|---| | (ig/ref key) | Declares a dependency on key. Resolved to the started component during init. | | (ig/refset key) | Like ref, but collects all matching keys into a set. | | (ig/ref? x) | True if x is a ref | | (ig/refset? x) | True if x is a refset | | (ig/reflike? x) | True if x is a ref or refset |

Refs are plain Clojure maps — they're printable and inspectable at the REPL before the system starts.


API Reference

Lifecycle multimethods

Dispatch on the config key (qualified keyword).

| Multimethod | Signature | Default | |---|---|---| | init-key | (key value) → component | — (must implement) | | halt-key! | (key component) → nil | Returns nil | | suspend-key! | (key component) → nil | Calls halt-key! | | resume-key | (key value old-value old-impl) → component | Calls init-key | | assert-key | (key value) → nil | Returns nil | | resolve-key | (key value) → value | Returns value unchanged |

System operations

All return a CljPending (Promise).

| Function | Description | |---|---| | (ig/init config) | Start all components in dependency order | | (ig/init config keys) | Start only the given keys (and their dependencies) | | (ig/halt! system) | Stop all components in reverse order | | (ig/halt! system keys) | Stop only the given keys | | (ig/suspend! system) | Suspend all components (for hot reload) | | (ig/suspend! system keys) | Suspend only the given keys | | (ig/resume config system) | Restart, reusing unchanged components | | (ig/resume config system keys) | Resume only the given keys |

Utilities

| Function | Description | |---|---| | (ig/build config init-fn) | Low-level init with a custom init function | | (ig/run! system f) | Call (f key component) for each key in dependency order | | (ig/reverse-run! system f) | Same, in reverse order | | (ig/fold system f init-val) | Synchronous reduce over the system in dependency order | | (ig/find-derived m key) | Find all entries whose key matches (strict equality) | | (ig/find-derived-1 m key) | Like find-derived, but throws if more than one match |


License

MIT