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

@archiyou/gdrr2bp-wasm

v0.1.0

Published

2D guillotine bin packing (goal-driven ruin & recreate) compiled to WebAssembly, with a typed TypeScript wrapper.

Readme

gdrr2bp-wasm

WebAssembly build of JeroenGar/gdrr-2bp — a goal-driven ruin & recreate heuristic for the 2D guillotine bin-packing / nesting problem (variable-sized bins, optional 90° rotation, guillotine cuts) — with a small typed TypeScript wrapper.

Install

npm install @archiyou/gdrr2bp-wasm

Layout

src/             vendored gdrr-2bp source + the wasm `solve()` entry point (lib.rs)
ts/BinPacker.ts  the typed BinPacker class + public types and wire mapping
ts/index.ts      barrel re-export
pkg/             generated wasm + JS/TS bindings (built by build.sh)
examples/        sample instance + config
tests/smoke.rs   native end-to-end test
build.sh         wasm-pack build script

Building

rustup target add wasm32-unknown-unknown   # once
cargo install wasm-pack                     # once
./build.sh

./build.sh runs wasm-pack build --target bundler and writes pkg/.

Usage (TypeScript)

import { BinPacker, type Instance } from '@archiyou/gdrr2bp-wasm';

// 1. Load the wasm (separate, awaited step)
const bp = await new BinPacker().init();

// 2. Solve — plain camelCase objects, no JSON wrangling
const instance: Instance = {
  name: 'demo',
  sheets: [{ length: 10, height: 10, cost: 100 }],   // stock omitted = unlimited
  parts:  [{ length: 5, height: 9, demand: 1, value: 45 }],
};

const solution = bp.solve(instance, { maxRunTime: 2 }); // seconds; single-threaded
console.log(solution.stats.usagePct, solution.patterns);

solve(instance, options) applies sensible defaults for any option you omit; only maxRunTime / maxRRIterations have no default (see note below). The returned Solution is fully camelCase: patterns[].sheet, patterns[].root (a CuttingNode tree), stats.usagePct, etc.

For the raw OR-Datasets wire format there is an escape hatch: bp.solveRaw(instanceJson, configJson): string.

Bound your runs. Set maxRunTime (seconds) and/or maxRRIterations. With neither set the solver runs until the optimum's minimum material limit is reached, which may be effectively unbounded for large instances.

Differences from upstream

This is a single-threaded port. The following changes were made to the vendored source (each marked // wasm port: in the code):

  • std::time::Instant → web_time::Instant (std Instant panics on wasm).
  • Dropped the mimalloc global allocator and the ctrlc handler (no wasm support).
  • The multi-threaded monitor is bypassed; the lahc loop enforces maxRunTime directly. nThreads from the config is ignored.
  • Logging macros write to console.log instead of stdout.
  • getrandom uses the wasm_js backend (see .cargo/config.toml).

Upstream algorithm, IO format and results are otherwise unchanged.