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

@place-ts/capability

v0.1.0

Published

Scoped capability handlers — runtime foundation for Phase 4 typed effects. Replaces React-style implicit context globals with explicit, lexically-scoped providers.

Readme

Capability System

Effect handler installation, scoped tracking contexts, permission enforcement at boundaries. The system that gives Direction E ("capability-passed scopes") a home.

Status: v0.1 + Phase 4 v0.1 shipping. Runtime: defineCapability / provide / install / use / tryUse plus the withCapability bridge in @place-ts/component. Phase 4 v0.1 adds requires(...caps)(fn) for typed-effect annotation + runtime early-error, plus placeholder type aliases (Effect, IO, Mutate, Async, Throws<E>, Read<S>). Reactive-scope integration (Phase 5) and compile-time scope enforcement (Phase 6+ build step) deferred. 20 tests.

Shipping API

import { defineCapability } from '@place-ts/capability'
import { withCapability } from '@place-ts/component'

interface Logger { log(msg: string): void }
const Log = defineCapability<Logger>('Log')

// Consumer:
const Action = component(() => {
  const log = Log.use()                          // throws if not provided
  return button({ onClick: () => log.log('!') }, 'click')
})

// Provider:
mount(
  withCapability(Log, { log: console.log }, <Action />),
  document.body,
)

Capability.provide(impl, body) is the synchronous primitive for non-component code. withCapability(cap, impl, view) is the bridge that keeps the impl in scope for the entire mounted view's lifetime — necessary because component HOC bodies run at mount time, after provide would have already unwound.

Phase 4 v0.1 — typed effects (manual annotation)

Wrap a function with requires(...caps) to (1) brand it at the type level with Requires<C> and (2) check at call time that every cap is installed, throwing a clear early-error before the body runs.

import { defineCapability, requires } from '@place-ts/capability'

const Logger = defineCapability<{ log(msg: string): void }>('Logger')
const Network = defineCapability<{ fetch(url: string): Promise<string> }>('Network')

const fetchUser = requires(Logger, Network)((id: string) => {
  Logger.use().log(`fetching ${id}`)
  return Network.use().fetch(`/users/${id}`)
})
// fetchUser type: typeof inner & Requires<readonly [LoggerCap, NetworkCap]>
// fetchUser('42'): if either cap is missing, throws with a hint to use
//   withCapability(...) or .install(impl).

This does not enforce capability scoping at the type level. TypeScript's structural type system can't verify "this call site is inside a withCapability(Logger, ...) block" without compiler help. The brand documents the requirement; the runtime check catches forgotten installs at the earliest possible point. Compile-time enforcement is deferred to a future build-system phase.

The effect kind aliases (IO, Mutate, Async, Throws<E>, Read<S>) ship as placeholders — vocabulary is locked, semantics arrive as workloads demand them.

See docs/01-phase4-typed-effects.md for the design rationale and the considered alternatives.

What's deferred

  • Compile-time scope enforcement. A build step that reads Requires<C> brands and checks the call-site is inside the right withCapability lexical scope. Land when the build system has shape.
  • Effect inference (deriving requirements from function bodies without manual annotation). Probably a custom TS transform.
  • Async-safe propagation across await boundaries. Capabilities work synchronously now; an async boundary loses the stack. This is Phase 5 (reactive scopes).
  • Effect polymorphism (<E extends Effect>(fn) => Effect<E | IO>). Hard without higher-kinded types.
  • Reactive integration with @place-ts/reactivity scopes (Phase 5).