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

@snap-calliope/bridge

v1.1.0

Published

Snap!Out main-process IPC handler for the Calliope mini v3 USB serial transport.

Downloads

271

Readme

@snap-calliope/bridge

Snap!Out main-process IPC handler for the Calliope mini v3 USB serial transport.

This package is the main-process peer of @snap-calliope/extension: the extension runs in the renderer and communicates with this module (running in Electron's main process) via the calliope:* IPC channels.

Responsibilities

  • Detect and open the Calliope serial port (USB VID 0x0D28 / PID 0x0204 — DAPLink / nRF52820).
  • Perform the Microbit More v2 serial handshake and validate the firmware version against the expected hardware/protocol constants.
  • Parse the incoming byte stream with a state-machine frame parser that mirrors CalliopeSerial.cpp.
  • Forward decoded frames to the renderer via executeJavaScript(__snapCalliopeEmit …).
  • Accept outgoing command frames from the renderer via IPC and write them to the serial port.

Wire format

Device → host:  [ 0xFF | RES_READ(0x01)  | ch_hi | ch_lo | len | payload... | chk8 ]
Host → device:  [ 0xFF | REQ_WRITE(0x10) | ch_hi | ch_lo | len | payload... | chk8 ]

The checksum is sum(all preceding bytes) % 0xFF. Identical to the Python serial_test.py reference implementation. Channel IDs and payload layouts are defined in firmware/src/CalliopeCommon.h.

IPC channels

| Channel | Direction | Payload | Description | |---|---|---|---| | calliope:connect | renderer → main | — | Open serial port; performs version handshake | | calliope:disconnect | renderer → main | — | Close serial port | | calliope:command | renderer → main | { frames: number[][] } | Write command frames to device | | calliope:frame | main → renderer | { channel: number, data: number[] } | Incoming sensor / event frame | | calliope:disconnected | main → renderer | — | Port closed unexpectedly |

The renderer-bound channels (calliope:frame, calliope:disconnected) are delivered by calling window.__snapCalliopeEmit(channel, payload) via executeJavaScript, following the same pattern used by the Snap!Net bridge.

Usage

In the Snap!Out main process (typically main.js):

const calliopeIpc = require('@snap-calliope/bridge');

// Register IPC handlers once at startup; pass an optional logger.
calliopeIpc.register(logger);

// Release the serial port cleanly on app quit.
app.on('will-quit', () => calliopeIpc.shutdown());

The renderer-side window.__SNAP_CALLIOPE_IPC__ bridge object (assembled by inject.js) must be injected before the extension is loaded so that transport/usb.js can find it.

File structure

src/
  calliope-ipc.js   — IPC handler, serial port management, frame parser / dispatcher

Dependencies

  • serialport — Node.js serial port access (peer dependency of Electron's main process).

License

AGPL-3.0-or-later