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

ascua-router

v0.2.1

Published

El router de Ascua: la ruta es un signal. Sin contexto, sin componente que instalar.

Readme

ascua-router

El router de Ascua en 1,03 kB gzip. La ruta es un signal: leerla dentro de una closure hace que ese nodo siga a la URL, igual que con cualquier otro dato.

stil add ascua-router      # o npm install ascua-router
import { links, mountRoutes, path } from "ascua-router";

links();   // los <a href="/…"> navegan sin recargar

const app = view`
  <div class="app">
    <nav>
      <a href="/" class=${() => (path() === "/" ? "activa" : "")}>Inicio</a>
      <a href="/pedidos">Pedidos</a>
    </nav>
    <main></main>
  </div>`;

mountRoutes(app.querySelector("main")!, [
  { pattern: "/", view: () => Inicio() },
  { pattern: "/pedidos", view: () => Pedidos() },
  { pattern: "/pedidos/:id", view: ({ id }) => Pedido({ id }) },
  { view: () => NoEncontrado() },           // sin patrón: el fallback
]);

mountRoutes es el show del runtime por debajo: mientras la ruta resuelva a lo mismo no se toca el DOM, y al cambiar se libera la vista anterior entera —efectos, memos, listeners, onCleanup— antes de construir la siguiente. Devuelve cómo soltarla.

Lo que hay

| | | |---|---| | path() | La ruta actual con su query. Reactiva. | | navigate(destino, { replace }) | Cambia de ruta. replace no apila historial — lo que quieres tras un login. | | links(raiz?, { base? }) | Intercepta los clicks en enlaces internos. Devuelve cómo soltarlo. | | match(pattern, contra?) | Los parámetros que captura, o null. | | query() | Un URLSearchParams con lo que va tras ?. | | stripQuery(valor) | El camino a secas. | | mountRoutes(padre, rutas) | Monta la vista de la ruta actual. |

Los patrones admiten :nombre para capturar un segmento y * para quedarse con el resto, que llega como rest. /pedidos y /pedidos/ son la misma ruta; /pedidos y /pedidos/4821 no.

links() respeta lo que un enlace significa: un click con ⌘ o ctrl, uno con el botón central, un target o un download siguen abriendo como siempre, y los enlaces externos no se tocan.

Si la aplicación vive bajo un camino y el resto del sitio son otras páginas —la portada en /, el juego en /jugar/—, links(document, { base: "/jugar/" }) solo intercepta lo que cuelga de /jugar/: el enlace a / carga la portada. Para un enlace suelto, rel="external".

Al desplegar

Las rutas son del cliente, así que el servidor tiene que devolver el index.html para cualquier camino — si no, recargar en /pedidos da 404. Cada hosting lo llama de una forma; con el httpd de busybox, que es lo que usa Hull con serve: static, basta un httpd.conf junto al sitio:

E404:/index.html

Licencia

MIT OR Apache-2.0