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 🙏

© 2025 – Pkg Stats / Ryan Hefner

espz

v0.1.3

Published

Bundle and flash Espruino code, optimally.

Readme

espz

espz is a simple CLI for interacting with Espruino devices.

Both the REPL and flasher run your code through Babel to add modern syntax support with minimal overhead.

Flashed code is bundled and optimized via Rollup and Terser, so you can use ES Modules.

REPL

The REPL is just like Espruino's REPL, except that it supports ES2017.

Note: Ctrl+C sends a reset signal, which will destroy any currently-executing timers and event handlers. I'll probably change this at some point because it's rarely desirable. For now, just type exit and hit enter to leave the REPL without sending a reset.

# connect to a local device:
espz repl --address /dev/cu.usbserial1234

# connect to an ESP8266 over TCP:
espz repl --address 192.168.55.200

Compile and execute code on device

There are two options here: run the code immediately, or flash the code to .bootcde so that it runs on boot. Personally I find the latter more useful and reliable.

Compile a module and run it on the device:

espz send --address 192.168.55.200 src/index.js

Compile a module and flash it as the device's boot code, then restart:

espz send --boot --address 192.168.55.200 src/index.js

# you can also re-connect to the REPL after rebooting:
espz send --boot --tail --address 192.168.55.200 src/index.js

Compile code for your device to a local file on disk

I'm not sure why you'd ever use this, but if you want to compile code based on a connected device and then store it on your computer rather than flashing it:

espz build --address 192.168.55.200 src/index.js --out out.js

Writing files to the device's flash storage

This is the manual way to add files, not usually important.

espz write --address 192.168.55.200 index.html favicon.ico

CLI Usage

Usage
$ espz <command> [options]

Available Commands
build    Compile modern JS modules for espruino
send     Compile and send modules to espruino
info     Print device information
repl     Start Espruino REPL for the device
write    Write file to device storage

For more info, run any command with the `--help` flag
$ espz build --help
$ espz send --help

Options
--address        TCP host to connect to (espruino.local:23)  (default espruino.local:23)
-v, --version    Displays current version
-h, --help       Displays this message

Example Application

espz includes ambient TypeScript definitions for Espruino's APIs and modules, which extend the official Espruino types with a bunch of things they're missing. The only thing that can be unclear from reading Espruino's docs and the TypeScript defintions is how best to initialize your code, since the technique varies depending on how you choose to flash (as boot code, versus executing the code immediately).

My recommendation is to flash to bootcode via espz send --boot --tail --address x:x:x:x, and use E.on('init') to initialize your application after a short delay:

import Wifi from 'Wifi';

function start() {
	// put your startup logic in here.
	Wifi.connect('foo', { password: 'bar' }, (err) => {
		Wifi.save();
		// etc
	});
}

try {
	E.on('init', () => setTimeout(start, 1000));
} catch (e) {}

Side Note: the .on() mixin used by Espruino's API's doesn't seem to support multiple event handlers like it would imply. Register stuff up-front and delegate in your code instead.