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

@acryldev/router

v0.1.1

Published

The ACRYL router, one Cordis service: plugin-owned routes and middleware on Web-standard Request and Response, with an in-process fetch every surface can call

Readme

@acryldev/router

The ACRYL router: the application API (Acryl, context, middleware, validation, helpers) and one Cordis service, ctx.router, that mounts a plugin's app and lets every surface call it. Part of the ACRYL Framework (specs 046 and 047).

What it gives you

import { Acryl } from '@acryldev/router'

export const name = 'notes'
export const inject = ['router']

export function apply(ctx: Context): void {
  const app = new Acryl()
    .get('/:id', c => c.json({ id: c.req.param('id') }))
    .post('/', async c => c.json(await c.req.json(), 201))

  ctx.router.route('/api/notes', app)
  ctx.inject(['routerHttp'], inner => { inner.routerHttp.mount('/api/notes') })   // only where HTTP exists
}
  • Web-standard types. Handlers take a context and return a Response. Nothing in a handler knows whether the caller is a browser, the Desktop window, the terminal UI or a test.
  • In-process fetch. ctx.router.fetch(request, connection?) and ctx.router.request(path, init?) run the same handler with no socket. Web and Desktop reach it over HTTP through @acryldev/router-http; a standalone process uses @acryldev/node-server.
  • Owned mounts. A mount belongs to the plugin that made it and goes away when that plugin unloads; route also returns a remover. A mount is a snapshot of the app's routes at the call.
  • Nothing outlives its owner. Unloading a plugin ends the requests and streams its code is serving; disposing the router ends all of them and answers new requests with 503. Both wait for running work, bounded by disposeGraceMs.
  • Transport facts beside the request. connectionOf(c) is the socket's peer address and local port, set by the adapter; an in-process call has none, and loopbackOnly refuses it unless told otherwise.

Entry points

| Import | Contents | | --- | --- | | @acryldev/router | Acryl, HTTPException, connectionOf, the router service and its types | | @acryldev/router/middleware | the built-in middleware, including loopbackOnly | | @acryldev/router/helpers | streaming, cookies, validation, factory, testing, connection info and more | | @acryldev/router/client | the typed client for a running server, without Cordis | | @acryldev/router/tsconfig.app.json | the TypeScript profile an app extends |

Configuration

| Option | Default | Meaning | | --- | --- | --- | | trailingSlash | strict | strict keeps /a and /a/ distinct; ignore treats them as one path | | disposeGraceMs | 2000 | how long an unload or disposal waits for aborted requests, their bodies and their waitUntil work |

Layout

  • src/core/: the ported application core with its own suite beside it (*.test.ts); scripts/verify-port.mjs at the repo root keeps it identical to its recorded source except for the deviations listed in provenance.json.
  • src/service.ts: the Router service: mounts, composition, the in-process fetch, ownership and disposal.
  • src/connection.ts, src/middleware/loopback-only.ts, src/helpers/schema-validator.ts: the ACRYL additions.
  • tests/: the service through Cordis (lifecycle, reload, replacement, disposal), the Loader, and the shadow-context proofs.
  • scripts/bench-remount.mjs: the cost of composing after a mount change.

Documentation: docs/framework/. Row id and package name: @acryldev/router.