{"_id":"@archiyou/gdrr2bp-wasm","name":"@archiyou/gdrr2bp-wasm","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@archiyou/gdrr2bp-wasm","version":"0.1.0","description":"2D guillotine bin packing (goal-driven ruin & recreate) compiled to WebAssembly, with a typed TypeScript wrapper.","license":"MIT","author":{"name":"Mark van der Net","url":"Archiyou"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"keywords":["bin-packing","nesting","guillotine","2d","wasm","archiyou"],"repository":{"type":"git","url":"git+https://github.com/ArchiyouApp/archiyou-web.git","directory":"packages/gdrr2bp-wasm"},"homepage":"https://archiyou.com","bugs":{"url":"https://github.com/ArchiyouApp/archiyou-web/issues"},"publishConfig":{"access":"public"},"devDependencies":{"tsup":"^8.5.1","typescript":"^5.7.3"},"scripts":{"build":"tsup","build:wasm":"wasm-pack build --target bundler","rust:check":"cargo check --target wasm32-unknown-unknown","rust:test":"cargo test"},"_id":"@archiyou/gdrr2bp-wasm@0.1.0","_integrity":"sha512-OwflItey6+B4UFxxJWBPNqD/fZDYp5U0Ang2vgB+PLQ/LIEk6ZeorD+v0QbOx1N+Eq19I7fSVzDTnYfLzi0ALg==","_resolved":"/tmp/b03ace0e5d1827622baa53c8ce696d4f/archiyou-gdrr2bp-wasm-0.1.0.tgz","_from":"file:archiyou-gdrr2bp-wasm-0.1.0.tgz","_nodeVersion":"22.22.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-OwflItey6+B4UFxxJWBPNqD/fZDYp5U0Ang2vgB+PLQ/LIEk6ZeorD+v0QbOx1N+Eq19I7fSVzDTnYfLzi0ALg==","shasum":"3cacab72c36ae9241a5f8bc89d552ba88ef3e452","tarball":"https://registry.npmjs.org/@archiyou/gdrr2bp-wasm/-/gdrr2bp-wasm-0.1.0.tgz","fileCount":7,"unpackedSize":353092,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDQ9IKLKz2uUVK+q0mPwjHL9nbhYeP3CD+LmbIbkF1SpgIgPsRYO2onkAT+BFs6SPz0EXeTdqTJgb825PGOeSFYTgc="}]},"_npmUser":{"name":"mvdnet","email":"info@archiyou.com"},"directories":{},"maintainers":[{"name":"mvdnet","email":"info@archiyou.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/gdrr2bp-wasm_0.1.0_1787166783495_0.03200307477800868"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-19T19:13:03.329Z","0.1.0":"2026-08-19T19:13:03.650Z","modified":"2026-08-19T19:13:03.902Z"},"maintainers":[{"name":"mvdnet","email":"info@archiyou.com"}],"description":"2D guillotine bin packing (goal-driven ruin & recreate) compiled to WebAssembly, with a typed TypeScript wrapper.","homepage":"https://archiyou.com","keywords":["bin-packing","nesting","guillotine","2d","wasm","archiyou"],"repository":{"type":"git","url":"git+https://github.com/ArchiyouApp/archiyou-web.git","directory":"packages/gdrr2bp-wasm"},"author":{"name":"Mark van der Net","url":"Archiyou"},"bugs":{"url":"https://github.com/ArchiyouApp/archiyou-web/issues"},"license":"MIT","readme":"# gdrr2bp-wasm\n\nWebAssembly build of [JeroenGar/gdrr-2bp](https://github.com/JeroenGar/gdrr-2bp) —\na goal-driven *ruin & recreate* heuristic for the **2D guillotine bin-packing /\nnesting problem** (variable-sized bins, optional 90° rotation, guillotine cuts) —\nwith a small typed TypeScript wrapper.\n\n## Install\n\n```bash\nnpm install @archiyou/gdrr2bp-wasm\n```\n\n## Layout\n\n```\nsrc/             vendored gdrr-2bp source + the wasm `solve()` entry point (lib.rs)\nts/BinPacker.ts  the typed BinPacker class + public types and wire mapping\nts/index.ts      barrel re-export\npkg/             generated wasm + JS/TS bindings (built by build.sh)\nexamples/        sample instance + config\ntests/smoke.rs   native end-to-end test\nbuild.sh         wasm-pack build script\n```\n\n## Building\n\n```bash\nrustup target add wasm32-unknown-unknown   # once\ncargo install wasm-pack                     # once\n./build.sh\n```\n\n`./build.sh` runs `wasm-pack build --target bundler` and writes `pkg/`.\n\n## Usage (TypeScript)\n\n```ts\nimport { BinPacker, type Instance } from '@archiyou/gdrr2bp-wasm';\n\n// 1. Load the wasm (separate, awaited step)\nconst bp = await new BinPacker().init();\n\n// 2. Solve — plain camelCase objects, no JSON wrangling\nconst instance: Instance = {\n  name: 'demo',\n  sheets: [{ length: 10, height: 10, cost: 100 }],   // stock omitted = unlimited\n  parts:  [{ length: 5, height: 9, demand: 1, value: 45 }],\n};\n\nconst solution = bp.solve(instance, { maxRunTime: 2 }); // seconds; single-threaded\nconsole.log(solution.stats.usagePct, solution.patterns);\n```\n\n`solve(instance, options)` applies sensible defaults for any option you omit;\nonly `maxRunTime` / `maxRRIterations` have no default (see note below). The\nreturned `Solution` is fully camelCase: `patterns[].sheet`, `patterns[].root`\n(a `CuttingNode` tree), `stats.usagePct`, etc.\n\nFor the raw OR-Datasets wire format there is an escape hatch:\n`bp.solveRaw(instanceJson, configJson): string`.\n\n> **Bound your runs.** Set `maxRunTime` (seconds) and/or `maxRRIterations`. With\n> neither set the solver runs until the optimum's minimum material limit is\n> reached, which may be effectively unbounded for large instances.\n\n## Differences from upstream\n\nThis is a single-threaded port. The following changes were made to the vendored\nsource (each marked `// wasm port:` in the code):\n\n- `std::time::Instant` → `web_time::Instant` (std `Instant` panics on wasm).\n- Dropped the `mimalloc` global allocator and the `ctrlc` handler (no wasm support).\n- The multi-threaded monitor is bypassed; the `lahc` loop enforces `maxRunTime`\n  directly. `nThreads` from the config is ignored.\n- Logging macros write to `console.log` instead of stdout.\n- `getrandom` uses the `wasm_js` backend (see `.cargo/config.toml`).\n\nUpstream algorithm, IO format and results are otherwise unchanged.\n","readmeFilename":"README.md","_rev":"1-8ac7fbd7488f59c78a8ab1088851125f"}