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

@shipvo/capacitor

v0.0.4

Published

Signed over-the-air updates for Capacitor web bundles: the same release decisions and trust model as the Shipvo React Native runtime.

Downloads

1,010

Readme

@shipvo/capacitor

Signed over-the-air updates for the web bundle of a Capacitor app. It makes the same release decisions and keeps the same trust model as @shipvo/runtime (see docs/adapters.md).

The core is TypeScript and makes every decision: it verifies the signature and the hash, stages, promotes and rolls back. The native layer only stores bytes and switches the web view.

| Platform | Native layer | |---|---| | Android | android/: stores the verified bundle zip in app-private files and the state in SharedPreferences; switches the web view with Bridge.setServerBasePath to the unpacked bundle | | iOS | Next slice, tracked in its own issue. It will use the same JavaScript core and the same boot and bootAndServe calls as Android. |

Android

android/ is a Capacitor plugin named Shipvo. It backs KeyValueStore with SharedPreferences and BundleFiles with the app-private files directory, and points the web view at the staged bundle. A web bundle is a zip of your web assets with an index.html at its root.

  1. Register it in MainActivity with registerPlugin(ShipvoPlugin.class) before super.onCreate.
  2. Include the module in settings.gradle and add implementation project(':shipvo-capacitor') (see apps/capacitor-sample/android).
  3. When the page loads, call bootAndServe. It runs boot() (rollback included) and tells native to serve the chosen file. Native checks the sha-256 the core verified once more before it unpacks, and refuses zip entries that leave the directory.
import { registerPlugin } from "@capacitor/core";
import { ShipvoCapacitor, NativeStore, NativeFiles, bootAndServe, bootAndSwitch } from "@shipvo/capacitor";
import type { ShipvoNativePlugin } from "@shipvo/capacitor";

const native = registerPlugin<ShipvoNativePlugin>("Shipvo");
const shipvo: ShipvoCapacitor = new ShipvoCapacitor({
  appId: "tide", shellMajor: 1, shellVersion: "1.2.0", platform: "android",
  publicKey: "<base64 Ed25519 key>", baseUrl: "https://cp.example.com",
  store: new NativeStore(native), files: new NativeFiles(native),
  onReload: async () => { await bootAndSwitch(shipvo, native); },
});
await bootAndServe(shipvo, native);
await shipvo.markHealthy();

Each launch starts on the embedded bundle, then bootAndServe switches to the pending or current release. The page of a served bundle runs the same code; it resumes the release boot() already chose and does not count another trial boot.

Tests: pnpm --filter @shipvo/capacitor test runs the stage, apply, crash and rollback sequence through the native bridge. The plugin's JVM tests run with ./gradlew :shipvo-capacitor:testDebugUnitTest in apps/capacitor-sample/android (after pnpm --filter capacitor-sample sync).

Install

npm install @shipvo/capacitor

Example

import { ShipvoCapacitor, MemoryStore, MemoryFiles } from "@shipvo/capacitor";

const shipvo = new ShipvoCapacitor({
  appId: "tide", shellMajor: 1, shellVersion: "1.2.0", platform: "android",
  publicKey: "<base64 Ed25519 key baked into the shell>",
  baseUrl: "https://cp.example.com",
  store: new MemoryStore(), files: new MemoryFiles(), // Android: NativeStore and NativeFiles
});

const { release, file } = await shipvo.boot();      // which bundle to serve
const r = await shipvo.checkForUpdate({ apply: false });
if (r.status === "staged") console.log("staged release", r.release);
await shipvo.markHealthy();                         // promotes a pending release that is running
console.log((await shipvo.consumeEvents()).events);

How a web bundle is described

The signed release pointer has kind: "web" (new, optional field in @shipvo/schema). core is the one archive file: url, size and sha256. This package refuses a pointer without kind: "web", so a React Native pointer cannot be replayed into a web shell.

API

ShipvoCapacitor implements ShipvoCapacitorPlugin, the same methods as Native in packages/runtime/src/index.ts, all async:

| Method | What it does | |---|---| | getState() | Cohort, band, running, current, pending, previous and blocked release | | checkForUpdate({ apply }) | Fetch the pointer, verify, download, verify, stage. apply: true then calls onReload | | markHealthy() | Promotes the pending release if it is the one running | | consumeEvents() | Returns and clears queued events: applied, rolled_back, crash_loop_revert, verify_failed, download_failed, pointer_rejected:<why> | | rollback() | Drops pending, blocks current, goes back to previous | | reload() | Calls onReload | | boot() | Native layer only. Picks pending (3 trial boots), else current, else the embedded bundle (release 0). Applies the crash-loop window and the new-shell reset | | markStable() | Native layer only. Clears the boot counter after the app stayed up |

Checks, in order: Ed25519 signature of the exact body bytes (WebCrypto), kind, platform, app and major, band, newer than current/pending/blocked, min_shell_version, then size and sha-256 of the bundle. A bad signature or hash is never staged. A hash mismatch also blocks that release.

Not shared yet: bsdiff patches (rule 9) and Hermes bytecode (rule 6, not relevant to plain web assets). Needs Node 20+ or a web view with WebCrypto Ed25519.