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

@czap/edge

v0.10.0

Published

Choose the right UI state at the CDN edge for LiteShip: read Client Hints into a device tier, serve a content-addressed boundary cache, and compile the theme for first paint.

Readme

@czap/edge

Detects a visitor's device capability tier from HTTP headers at the server or CDN edge, and caches compiled boundary CSS so the first paint is already adapted.

You usually don't install this directly — it arrives as a dependency of @czap/cloudflare and @czap/astro. Install one of those instead unless you are writing an adapter for a host LiteShip doesn't cover yet.

Install

pnpm add @czap/cloudflare   # brings @czap/edge with it
# direct use: pnpm add @czap/edge effect@beta

For direct use, install the Effect 4 beta peer with pnpm add effect@beta — a bare pnpm add effect installs 3.x and fails the peer check.

30 seconds

import { ClientHints, EdgeTier } from '@czap/edge';

export default {
  async fetch(request: Request): Promise<Response> {
    const tier = EdgeTier.detectTier(request.headers);
    const html = `<!doctype html><html ${EdgeTier.tierDataAttributes(tier)}><body>${tier.capLevel}</body></html>`;
    return new Response(html, {
      headers: {
        'content-type': 'text/html',
        'Accept-CH': ClientHints.acceptCHHeader(),
      },
    });
  },
};

The served <html> element carries data-czap-tier, data-czap-motion, and data-czap-design attributes — the same capability/motion/visual-fidelity triple the browser-side detector would compute, available before any client JavaScript runs.

ClientHints.responsiveMediaCapabilities(headers) derives the Save-Data / DPR slice that @czap/core's selectCandidates responsive-media law consumes, and responsiveMediaVaryHeader() is the Vary axis (Sec-CH-DPR, Save-Data) a CDN keys those representations on. Both are production-wired through @czap/astro's czapMiddleware (and @czap/cloudflare through it) as of #140 — a Save-Data client is never advertised a heavy image candidate.

Where it sits

A host-agnostic edge layer: it only parses headers and strings, touching no platform APIs, which keeps host adapters like @czap/cloudflare down to binding glue. It depends on @czap/detect (the same pure tier-mapping functions the browser runs, so edge and client agree on tiers) and @czap/core (shared tier types and branded ids). The KV-backed boundary cache (createBoundaryCache) keys entries by the boundary's content address, the device tier, the boundary name, and a fingerprint of the resolved theme — so an entry only serves a request whose inputs match, and editing a boundary mints a new key. (A bundled compile() whose output depends on build-time content the boundary id doesn't cover bumps prefix to version it.) See the package surfaces map for the full layout.

If it does nothing

If every visitor detects as the lowest tier, the browser is not sending Sec-CH-* headers — it only does so after a response opts in. Send Accept-CH: ClientHints.acceptCHHeader() as above; the very first request still falls back to conservative defaults by design.

Docs


Part of LiteShip — powered by the CZAP engine (Content-Zoned Adaptive Projection), distributed as @czap/* packages.