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

@bradthomasbrown/machine

v1.0.0

Published

Abstract machine framework library with dubious usefulness.

Downloads

13

Readme

machine

It seems to help, at least ourselves, to have a framework and foundation with which to make machines. In our case, we are going to create an EVM execution client. This appears to be something one can make with at least a few machine types. For instance, we chose to interpret "execution contexts" as "single-context machines". We will not interpret subcontext creation and execution as recursive execution, but rather the creation of a new machine, a blocking of the old machine, and another "higher" kind of machine will orchestrate the potential creation, destruction, switching or pointing, and general control flow of single-context machines. This may be a "transaction machine". Instead of a program counter in the context of a transaction machine, it may have a "machine pointer". There may later be "block machines" and then later again a "blockchain" machine. Asynchronous machines may be helpful for GPU programming architecture and design.

This library then serves as a collection of various machine frameworks.

Examples

  • 6873f5 ("an instruction-parsing-with-artifacts machine")
    • EVM single-context machine
    • x86_64 machine (instruction artifacts can accumulate information from REX prefixes, ModRM bytes, etc.)
    • A "thread"
  • a06785 ("an instruction-less machine")
    • EVM single-transaction machine
    • An "operating system"

Installation

npm i @bradthomasbrown/machine

Usage

// NOTE: this is more a less a vague and loose guidelines on how we understand the "machine" concept and how to use it
//       it seems to help us work with and build machines, but it may just be more of a "personal style" than particularly useful to anyone
import { createMachine } from "@bradthomasbrown/machine/a06785";

type Context = {
    counter:number
}

function execute(context:Context) {
    context.counter++;
}


function continuePredicate(context:Context) {
    if (context.counter < 10) return true;
    return false;
}

function initialize(context:Context) {
    context.counter = 0;
}


const Machine = createMachine(execute, continuePredicate, initialize);

const machine = new Machine({ counter: 0 });

// machine at start
console.log(machine.context.counter); // 0
console.log(machine.continue()); // true

// machine can be issued step commands
for (let i = 0; i < 5; i++) machine.step();
console.log(machine.context.counter); // 5
console.log(machine.continue()); // true

// machine does nothing when it shouldn't continue, but allows step commands to be issued
for (let i = 0; i < 10; i++) machine.step(); 
console.log(machine.context.counter); // 10
console.log(machine.continue()); // false

// this machine has an initialization method
machine.initialize();
console.log(machine.context.counter); // 0
console.log(machine.continue()); // true

// run should be the same as stepping until it shouldn't continue
machine.run();
console.log(machine.context.counter); // 10
console.log(machine.continue()); // false

// one more step to show that nothing changes, but step is permitted
machine.step();
console.log(machine.context.counter); // 10
console.log(machine.continue()); // false