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

@chiljs/react

v0.4.0

Published

Headless React hooks for the CHIL token exchange. No markup, no styles, no renderer.

Readme

@chiljs/react

Headless React hooks for CHIL. No markup, no styles, no QR renderer.

const transport = createTransport();

function Upload({ token }: { token: string | null }) {
  const { phase, progress, reason, canRetry, send } = useUploadSession({ token, transport });
  ...
}

function Panel() {
  const { url, phase, regenerate } = useHandoffSession({ transport, mint });
  return url ? <QrCode value={url} /> : null;
}

useUploadSession claims on mount and exposes checking | ready | sending | sent | error. useHandoffSession mints, polls, and distinguishes received from expired from invalid — they call for different words and different next moves.

Both return reason codes rather than sentences. The copy and the language are yours.

The URL

<origin><path>?token=…#k=… — the token in the query because the page reads it back, the key in the fragment because a browser never sends one to the server. Neither placement is an application's choice, so neither is overridable.

useHandoffSession({
  mint,
  transport,
  origin: 'https://send.example.com', // defaults to location.origin
  path: '/hand-off',                  // defaults to /
  params: { debug: '1' },             // the server sees these
  fragment: { locale },               // it never sees these
  recipient,
});

For a shape those cannot express — a hash router, a shortener, a signed redirector — transform state.url where you render it:

const { url } = useHandoffSession({ mint, transport, recipient });
return url ? <QrCode value={hashRouted(url)} /> : null;

There is deliberately no buildUrl. It replaced the one line that places the key, so a consumer who reached for it to add a query parameter shipped plaintext from a deployment that had asked for encryption.

Encryption

Off unless you pass the keys. Two more hooks cover the encrypted path — what it protects against, and what it costs, is in @chiljs/crypto.

// Requester — the public key rides in the URL fragment, which the server never sees.
const { recipient } = useRecipient(() => createRecipient({ scope: room }));
const { url } = useHandoffSession({ mint, transport, recipient: recipient ?? undefined });

// Sender — build the sealer from the fragment.
const [seal, setSeal] = useState<SealerLike>();
useEffect(() => {
  const key = keyFromFragment();
  if (key) void createSealer(key).then(setSeal);
}, []);
const { send } = useUploadSession({ token, transport, seal, requireSeal: true });

// Dashboard — fetch, decrypt, object URL, revoked on unmount.
const { src, reason } = useDecrypted(fileUrl, recipient);

seal is asynchronous to build, so it arrives undefined on the first render and defined on a later one. That is expected and costs a re-claim, not a code.

requireSeal refuses in error with seal-required rather than downgrading to plaintext when the fragment was stripped in transit — by a link rewriter, a chat preview generator, a shortener. It refuses at send, not at claim, so the sender still reaches a working page.

useRecipient reads its callback once. Remount to change scope.

Types

SealerLike and RecipientLike are re-exported here, so the encrypted path needs no second import. Both are types — import type, or a bundler fails at runtime looking for a value that was never there. From @chiljs/crypto, Sealer satisfies SealerLike, and Recipient satisfies both RecipientLike and the RecipientHandle that useDecrypted takes. No casts either way.

React 18+ (useSyncExternalStore). React 19 works.

Full documentation: the repository README.

MIT.