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

firefly-as

v0.2.0

Published

AssemblyScript SDK for making Firefly Zero games

Readme

firefly-as

The AssemblyScript SDK for making Firefly Zero games.

Installation

npm install --save firefly-as

Examples

Callbacks:

export function boot(): void {
    // ...
}

export function update(): void {
    // ...
}

export function render(): void {
    // ...
}

export function handle_menu(i: i32): void {
    // ...
}

export function cheat(cmd: i32, val: i32): i32 {
    // ...
}

Graphics:

import * as ff from "firefly-as/assembly";

ff.clearScreen(ff.Color.White);

ff.setColor(ff.Color.White, ff.RGB.new(255, 0, 0));

ff.drawPoint(ff.Point.new(10, 20), ff.Color.Red);

ff.drawLine(
    ff.Point.new(10, 20),
    ff.Point.new(30, 40),
    ff.LineStyle.new(ff.Color.Black, 1)
);

ff.drawRect(
    ff.Point.new(10, 20),
    ff.Size.new(30, 40),
    ff.Style.solid(ff.Color.Blue)
);

ff.drawRoundedRect(
    ff.Point.new(10, 20),
    ff.Size.new(30, 40),
    ff.Size.new(4, 4),
    ff.Style.outlined(ff.Color.Blue, 1)
);

ff.drawCircle(
    ff.Point.new(10, 20),
    30,
    ff.Style.new(ff.Color.LightBlue, ff.Color.Black, 1)
);

ff.drawEllipse(
    ff.Point.new(10, 20),
    ff.Size.New(30, 40),
    ff.Style.solid(ff.Color.Gray)
);

ff.drawTriangle(
    ff.Point.new(50, 20),
    ff.Point.new(30, 50),
    ff.Point.new(70, 50),
    ff.Style.new(ff.Color.LightBlue, ff.Color.DarkBlue, 1)
);

ff.drawArc(
    ff.Point.new(50, 20),
    20,
    ff.Angle.fromRadians(0),
    ff.Angle.fromDegrees(90),
    ff.Style.new(ff.Color.LightBlue, ff.Color.DarkBlue, 1)
);

ff.drawSector(
    ff.Point.new(50, 20),
    20,
    ff.Angle.fromRadians(0),
    ff.Angle.fromDegrees(90),
    ff.Style.new(ff.Color.LightBlue, ff.Color.DarkBlue, 1)
);

ff.drawQr(
    "https://fireflyzero.com/",
    ff.Point.new(50, 20),
    ff.Color.Black,
    ff.Color.White,
);

const font = ff.must(ff.loadFile("font")).toFont();
ff.drawText(
    "oh hi mark",
    font,
    ff.Point.new(50, 20),
    ff.Color.DarkGray,
);

const img = ff.must(ff.loadFile("cat")).toImage();
ff.drawImage(img, ff.Point.new(50, 20));

const sub = img.sub(ff.Point.new(8, 0), ff.Size.new(8, 8));
ff.drawSubImage(sub, ff.Point.new(50, 20));

const canvas = ff.Canvas.new(ff.Size.new(60, 60));
ff.setCanvas(canvas);
ff.clearScreen(ff.Color.Red);
ff.unsetCanvas();

Files:

if (ff.fileExists("img")) {
    // ...
}

const fileSize = ff.getFileSize("img");


const file = ff.loadFile("img");
if (file !== null) {
    // ...
}

const buf = new Uint8Array(20);
ff.dumpFile("save", buf);

ff.removeFile("save");

Multiplayer:

const peer = ff.getMe();

const peers = getPeers().toArray();
for (const peer in peers) {
    // ...
}

const buf = new Uint8Array(20);
const stash = ff.loadStash(peer, buf);

if (stash !== null) {
    ff.saveStash(peer, stash);
}

Input:

const pad = ff.readPad(peer);
if (pad !== null) {
    [pad.x, pad.y];
}

const btns = ff.readButtons(peer);
if (btns.s || btns.w) {
    // ...
}

Menu:

ff.addMenuItem(1, "open inventory");

ff.removeMenuItem(1);

ff.openMenu();

Boards (scoreboards) and badges (achievements):

const BADGE_1 = ff.Badge.new(1);
const BADGE_2 = ff.Badge.new(2);

let progress = ff.getProgress(peer, BADGE_1);
[progress.done, progress.goal];

progress = ff.addProgress(peer, BADGE_1, 100);

const BOARD_1 = ff.Board.new(1);
const BOARD_2 = ff.Board.new(2);

let bestScore = firefly.getScore(peer, BOARD_1);

bestScore = firefly.addScore(peer, BOARD_1, 10);

Misc:

ff.logDebug("I'm going back to 505");

ff.logError("Something happened!");

ff.setSeed(13);

const randVal = ff.getRandom();

const name = ff.getName(peer);

License

MIT License. You can do whatever you want with the SDK, modify it, embed into any apps and games. Have fun!