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

@studiolambda/router

v3.0.2

Published

Lightweight, isomorphic and framework agnostic router for modern UIs

Readme

Lambda Router

Lightweight, isomorphic and framework agnostic router for modern UIs

Lambda Router is a client-side routing library designed for single-page applications. It provides a core URL pattern matcher that works in any JavaScript environment, plus a full-featured React integration with components, hooks, and navigation management.

The React integration requires React 19 and browser Navigation API support. For SSR or fixed-location rendering tests, pass createMemoryNavigation; it is not an interactive memory history or browser polyfill.

Documentation

Find out about the project and discover the features at the Documentation

Installation

npm i @studiolambda/router

Mandatory route checks

Use .guard() for checks that must finish before route content or a custom form action runs. Throw or reject to deny access; returning normally permits it. Guards receive { params, url }, without a redirect controller.

import { createRouter, Router } from '@studiolambda/router/react'

// session, preload/action functions, and PrivatePage are application-owned.
const matcher = createRouter(route => {
  route('/private')
    .guard(async () => {
      if (!(await session.isAuthenticated())) throw new Error('access denied')
    })
    .prefetch(loadPrivateData)
    .formHandler(savePrivateData)
    .render(PrivatePage)
})

// Place an application error boundary above Router for initial guard errors.
<Router matcher={matcher} fallback={<p>Checking access…</p>} />

Guards run on initial rendering (including SSR) and during precommit for intercepted navigations and custom form actions, before prefetch. Noncancelable interceptable events run both checks after URL commit but before rendering or executing an action; failure does not roll back the committed URL. Group guards run parent-first. Async initial checks suspend before middleware and content; streaming SSR waits for them. renderToString cannot await async checks and emits the Suspense fallback instead. Initial failures reach an ancestor React error boundary on the client, or the SSR host; navigation failures use the Navigation API's error flow (onNavigateError). The host owns error responses and initial redirects. Checks must be idempotent: remounts, StrictMode retries, and SSR/hydration may repeat them. Avoid sharing request-specific sessions in global state on the server.

Migration from authentication in .prefetch(): move the mandatory access check to .guard(). Keep preloading in .prefetch(). Legacy prefetch still does not run on initial rendering. Hover/viewport prefetch remains optional, uses a no-op redirect controller, and does not run guards. Only preload data that is safe to request speculatively. Custom form actions now await prefetch as well as guards; a throwing/rejecting prefetch prevents the action. A call to controller.redirect() is not equivalent to throwing an access denial. Successful precommit redirects rematch and check the destination, then render it without running the abandoned form action or passing its body to a target action. Postcommit redirect attempts reject and prevent content/action updates. POSTs without an explicit custom formHandler remain native browser submissions and run neither guards nor prefetch.

These checks control router UI and intercepted JavaScript actions. They are not a server authorization boundary. Every backend request must authenticate and authorize independently, including speculative reads and native form submissions that bypass this Router.

Integration caveats

  • Router renders the registered route and does not accept children. Use middleware for layouts and shared navigation UI that needs router hooks. Middleware composes rendered content; it does not gate prefetch or actions.
  • Speculative prefetch records one attempt per pathname per matcher, ignoring query/hash and retaining failures. once={false} keeps a DOM trigger active but does not bypass that cache. clearPrefetchCache(matcher) clears attempts, not application data, in-flight work, or one-shot listeners. Handle expected speculative failures inside the preload callback when using Link or usePrefetchEffect, which do not observe returned promises.
  • useNavigationSignal() exposes a native NavigateEvent signal, not a route-unmount cancellation guarantee. It is null initially; a completed navigation's signal need not abort on a later navigation.
  • Memory navigation keeps one fixed URL. Its navigation/traversal methods return resolved promises without changing location or emitting events.
  • Postcommit checks cannot undo a committed URL. Their controller rejects redirect/addHandler with InvalidStateError. Native redirect also rejects traverse/reload attempts; Router does not synthesize a second navigation.

Repository guidance

Read AGENTS.md before modifying code. Maintain the affected repository skill and references in the same change, including API examples and validation guidance.