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

@tsotchkecorp/moonlab

v1.2.1

Published

WebAssembly quantum computing simulator core

Readme

@tsotchkecorp/moonlab

WebAssembly + WebGPU bindings for the Moonlab quantum simulator.

The v1.2.1 binding includes the real C quantum-annealing engine:

import { annealQubo } from '@tsotchkecorp/moonlab';

const result = await annealQubo([-1, 1, 1, -1], 1, {
  totalTime: 12, numSteps: 1200, numSamples: 128,
  seed: 0x123456789abcdef0n,
});

Build

The Wasm artefact is produced by Emscripten compiling the C core under emscripten/CMakeLists.txt.

Prerequisites

  • emsdk (Emscripten SDK) installed and activated. Source it before building so $EMSDK is in the environment:

    # one-time install
    git clone https://github.com/emscripten-core/emsdk.git ~/emsdk
    cd ~/emsdk && ./emsdk install latest && ./emsdk activate latest
    
    # in every shell where you want to build
    source ~/emsdk/emsdk_env.sh

    After sourcing, which emcc should print a path inside the emsdk install and echo $EMSDK should print the install root. The build:wasm script reads $EMSDK directly to locate the Emscripten.cmake toolchain file.

  • Node 20+ and pnpm for the TypeScript build and test suite.

Commands

| Command | What it does | |---|---| | pnpm build:wasm | Runs CMake under the Emscripten toolchain at emscripten/build/, produces moonlab.js + moonlab.wasm. | | pnpm build:ts | TypeScript build via tsup (CJS + ESM + .d.ts to dist/). | | pnpm build | Both of the above, in order. | | pnpm test | vitest run against the Wasm + TS surface. | | pnpm webgpu:smoke | End-to-end WebGPU dispatch sanity check (requires a runtime that exposes GPU — Node 22 with --experimental-webgpu, or Deno). |

Build flavours

emscripten/ ships two BLAS strategies for the linear-algebra core inside the Wasm build:

  • build-clapack-wasm.sh — bundles a tiny CLAPACK shim (f2c_stub.c) so the binary stays small and dependency-free.
  • build-openblas-wasm.sh — links against an emscripten-built OpenBLAS for full-throttle SVD / QR. Larger artefact, faster math.

pnpm build:wasm invokes the default emscripten/CMakeLists.txt build which uses the CLAPACK shim. Use the matching shell script directly if you want the OpenBLAS variant.

Troubleshooting

  • Could not find toolchain file: $EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake — $EMSDK is unset. Source emsdk_env.sh and retry.

  • The TS bundle compiles but importing ./wasm fails at runtime — dist/moonlab.wasm is stale. The webgpu:* scripts copy the latest artefact from emscripten/build/ automatically; if you ran build:ts standalone, run pnpm build:wasm first or just pnpm build.