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

@castarcade/sdk

v0.3.1

Published

Connect a browser game to Cast Arcade lifecycle, input and results.

Readme

@castarcade/sdk

The standalone browser bridge for Cast Arcade developer-beta games. Import createGame, register lifecycle handlers, then call ready(). The host connects one private MessagePort; lifecycle, semantic input, mute, and viewport events arrive only on that port.

reportResult() accepts safe whole-number score rows or positive whole-number elapsedMs rows for started players. Do not mix the two metrics in one report. Optional metadata is a flat object with at most 31 custom keys because account history adds the score or time; keys match [A-Za-z0-9_]{1,64}, and values are booleans, safe whole numbers, or strings of at most 512 Unicode characters without control characters. The complete report is limited to 4 KB.

Browser results can feed a player's private personal history. They are not verified public leaderboard records because players can change browser code. Results are never payout or monetary events. The package has no runtime imports, so index.js may also be vendored into a self-contained game build.

Games declaring play.privateViews: true can replace a started player's phone content with game.setControllerView({ playerId, title?, text?, actions?: [{ id, label? }] }). IDs must belong to the fixed start roster and declared manifest actions. Content is text rendered by the trusted phone UI, never HTML or game-provided components. The complete view is limited to 4 KiB of UTF-8 JSON; title, text and action labels are limited to 80, 2048 and 60 characters respectively. { playerId } clears the view. The method returns false before start, after disposal, when unsupported, or when invalid.

Games declaring play.checkpoint: 'versioned' can call game.saveCheckpoint({ version: 1, state: { round: 2 } }). version is a positive safe integer chosen by the game; state is JSON data. The complete checkpoint is limited to 32 KiB of UTF-8 JSON, 32 nesting levels and bounded node count. Cycles, sparse arrays, accessors, class instances, undefined and non-finite numbers are rejected. The method returns a boolean and snapshots accepted data.

Register createGame({ onRestore(checkpoint) { /* restore game state */ }, start(event) { /* attach players and render restored state */ } }) for recovery. The host sends a capability declaration, optional restore, then the unchanged start event. onRestore runs before start and input; returning a promise delays all subsequent lifecycle messages until it resolves. A missing restore handler, a rejection, a 15-second timeout or more than 256 queued messages aborts recovery and reports a generic host error. Disposal cancels the queue. Do not reset restored state unconditionally in start.

The host scopes recovery to the immutable game release and room session. Checkpoints and phone content are client-reported data; they do not establish verified scores. Older hosts do not enable these optional methods, and older SDKs continue to receive the existing start shape.

For games declaring schema v2 server rules, createGame({ state(display) {} }) receives the bounded server display projection after start. The host must declare an authoritative session; ordinary browser sessions cannot send this callback. Keep rules state and result decisions in the isolated rules module. This handler does not turn browser results or checkpoints into verified records.