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

@cabn/engine

v0.3.0

Published

Phaser 3 + zustand + mitt game engine that renders a cabn world bundle as a walkable game, with a React bridge (CabnGame) and HUD components.

Readme

@cabn/engine

The cabn game engine: a Phaser 3 + zustand + mitt walkable renderer for a converted world bundle, plus a React bridge (CabnGame) and its HUD components (tool hotbar, spyglass, orb search, bag, quill editor, run parchment, and more).

Install

npm install @cabn/engine react react-dom

Usage

import { CabnGame } from "@cabn/engine";

function App() {
	return <CabnGame worldUrl="/worlds/my-world/world.json" />;
}

Two optional props cover hosting:

  • assetBaseUrl (default "/assets"): where the host serves cabn's sprite set (originals/, placeholders/, as copied from assets/generated), for example a CDN prefix. It is one setting per page: the last CabnGame mounted sets it for all. Changing it re-creates the game.
  • pets (default true): false removes the AI pets entirely. No sprite, corner button, setup panel or chat.

createCabnGame(container, target, { assetBaseUrl, pets }) takes the same options.

A world whose showcase.json names a hero site (cabn.json sites[].hero) stands that site's arch between the spawn bonfire and the arch ring, with a pulsing gold glow (static under reduced motion). A fresh visit spawns close enough that the site's live page is the first thing in view. On a shelf, walking up to a cabin whose entry has a description, links or a hero url shows them in a card (ShelfWorldCard). Up to 8 cabins keep the classic 480px ring, and more widen it so neighbours never overlap.

Real code execution (LocalRunProvider) is not part of the main entry point — it lives behind @cabn/engine/local-exec, meant only for a cabn serve --allow-exec host page. Every other consumer, including this package's main export, only ever simulates a run (TraceProvider).

The same split applies to repository writes: CabnGame's optional owner prop takes an OwnerCapability, and the HTTP client that implements it (createOwnerGitClient) lives behind @cabn/engine/owner, imported only by a cabn serve --owner host page. Git history (the rift, universe picker, pensieve and map timeline) needs no capability: it reads the bundle's read-only git/ directory with isomorphic-git (a lazy chunk, loaded on first use, with a Buffer polyfill) and converts other branches in the browser on demand. A host needs no configuration for it, but a bundler must be able to split dynamic imports for it to stay out of the first load.

Portal previews

PortalPreview renders a portal's richPreview payload (code with syntax colours, rendered markdown from structured data, an image, or a text blurb) in the pixel UI style — usable as a small in-world overlay or a larger expanded view. richPreview is optional on Portal (absent on a bundle built before this feature); PortalPreview shows a "sealed" placeholder when it's missing, same as for a binary file.

import { PortalPreview } from "@cabn/engine";

<PortalPreview
	preview={portal.richPreview}
	fileName={portal.file.name}
	worldBaseUrl={worldBaseUrl} // the directory world.json was fetched from
	variant="expanded"
/>;

PortalEmbed renders the live sandboxed iframe for a richPreview.kind === "url" override (a cabn.json author opted a file into showing a webpage instead of its own content). It re-checks the url's origin against the manifest's allowedEmbedOrigins at render time — never trusts that cabn.json was already validated at convert time — and falls back to a static title/link card if embedding isn't possible or times out.

import { PortalEmbed } from "@cabn/engine";

<PortalEmbed
	url={preview.url}
	title={preview.title}
	fallbackImage={preview.fallbackImage}
	allowedEmbedOrigins={manifest.allowedEmbedOrigins}
	worldBaseUrl={worldBaseUrl}
	active={isApproachedOrOpen}
/>;

Hosting requirement: a page that renders PortalEmbed must set a Content-Security-Policy with a frame-src directive listing exactly the bundle's allowedEmbedOrigins — the iframe sandbox attribute alone doesn't stop the host page's own CSP from blocking the frame, and CSP is enforced by the browser regardless of what this component does. For example, if cabn.json allowlists https://example.com:

Content-Security-Policy: frame-src https://example.com

Do not use a wildcard here — list every allowlisted origin explicitly, same "no wildcards" rule allowedEmbedOrigins itself follows (see @cabn/world-schema's isHttpsOrigin).

License

MIT — see LICENSE.

The DotGothic16 pixel font is bundled (as a self-hosted, Latin-subset, base64-embedded woff2 — see src/react/fonts/dotGothic16.ts) under the SIL Open Font License 1.1: third-party-licenses/DotGothic16-OFL.txt.