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

peakern

v1.0.0

Published

PEAC is a modular firmware composition and execution platform for embedded and runtime systems.

Readme

PEAC System

PEAC is a modular firmware composition and execution platform for embedded and runtime systems.

It combines:

  • JavaScript for high-level behavior
  • C++ for hardware and native capabilities
  • A minimal runtime (PEAC) for orchestration
  • A plugin system based on hooks and events

Core Idea

Build firmware once, iterate behavior continuously.

PEAC separates:

  • Slow system construction (C++, firmware build)
  • Fast iteration (JavaScript deployment)

Commands:

  • peac flash → rebuild firmware (C++ + bindings)
  • peac deploy → update JavaScript only

Architecture

JavaScript (user logic) → QuickJS (embedded runtime) → peabind (binding generator) → C++ plugins (hardware logic) → PlatformIO / ESP-IDF / Arduino → Hardware (ESP32 and similar devices)


Components

peac (Runtime Platform)

PEAC is the runtime system that:

  • Executes JavaScript on embedded devices
  • Hosts plugin execution via hook-channel
  • Manages lifecycle and event loop
  • Selects JS engine (e.g. QuickJS)

Example:

peac deploy --engine=quickjs peac flash


peabind (Binding Layer)

peabind connects JavaScript and C++.

It:

  • Parses IDL definitions
  • Generates C++/JS glue code
  • Hides engine-specific APIs
  • Produces engine-agnostic plugins

Key idea: Plugins do not depend on the JS engine.


hook-channel (Plugin System)

A minimal hook-based execution system.

Core API:

await channel.dispatch("eventName", event)

Features:

  • Plugins register functions per hook name
  • Ordered execution
  • Shared mutable event object

Example plugin:

export function build(ev) { ev.messages.push("hello"); }

Execution modes:

  • Async: channel.dispatch(...)
  • Sync: channel.dispatchSync(...)

peabrain (Application Layer)

peabrain is a machine control application built on PEAC.

It:

  • Controls machines
  • Uses plugins and bindings
  • Runs user-defined automation logic

Example:

let motor = masterDevice.getRemoteDevice(123, { profile: MOTR_PROFILE }); motor.targetPosition = 1000;


canopener (CANopen Stack)

C++ CANopen implementation.

It:

  • Runs standalone or as PEAC plugin
  • Controls industrial devices
  • Supports motors and distributed systems

Plugin System

Plugins are standard Node modules.

Discovered from:

  • package.json dependencies
  • extraModuleDirs

Filtered by keywords and exports.


Plugin Example

{ "keywords": ["peac-plugin"], "exports": { "./main": "./plugin.js" } }


Plugin Code

export function init(ev) {}

export function tick(ev) {}

export function build(ev) { ev.files.push("output.cpp"); }


Hook Model

Single primitive:

channel.dispatch("hookName", event)

Design:

  • Shared event object
  • Ordered execution
  • Deterministic behavior

Patterns:

Side effect: ev.files.push(...)

Accumulation: ev.config.value = 42


Build System (peac flash)

Pipeline:

  1. Discover plugins
  2. Collect IDLs + sources
  3. Merge IDLs
  4. Generate bindings (peabind)
  5. Generate PlatformIO project
  6. Compile firmware

Output:

.target/ platformio.ini src/ bindings.cpp main.cpp


Deployment (peac deploy)

Fast iteration without firmware rebuild.

Flow:

  • Upload JavaScript to device storage
  • Device reloads runtime
  • QuickJS executes script

Example:

upload main.js → /main.js reboot device

Runtime:

JS_Eval(ctx, script, ...)


Object Model (peabind)

Cross-language ownership model:

JS object → handle (int) → C++ registry → shared_ptr

Rules:

  • C++ owns lifetime via shared_ptr
  • JS holds opaque handles
  • GC triggers cleanup via FinalizationRegistry

Guarantees:

  • No dangling pointers
  • No double free
  • Stable identity mapping

Event Loop

Runs inside embedded firmware loop:

void loop() { processTimers(); runJS(); }

Supports:

  • setTimeout
  • setInterval
  • async tasks

PlatformIO Integration

Generated project:

[env:esp32dev] platform = espressif32 board = esp32dev framework = arduino


Design Principles

1. Separation of concerns

  • peac = runtime
  • peabind = binding layer
  • plugins = functionality
  • PlatformIO = build system

2. Minimal primitives

  • hooks
  • events
  • bindings

3. Deterministic execution

  • explicit discovery
  • ordered execution

4. Engine independence

  • plugins are engine-agnostic

5. Fast iteration

  • firmware rarely changes
  • JS changes frequently

Summary

PEAC is a modular embedded runtime where:

  • JavaScript controls behavior
  • C++ provides hardware capabilities
  • Plugins extend the system via hooks
  • A minimal runtime orchestrates everything