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

@noiselang/core

v0.7.0

Published

The Noise probabilistic language engine, compiled to WebAssembly. Parse and run .noise programs (with variable introspection) from any JS/TS project — the .wasm ships in the package and bundles into your build.

Downloads

757

Readme

@noiselang/core

The Noise probabilistic-language engine, compiled to WebAssembly and wrapped in a small typed API. Parse and run .noise programs — including variable introspection — from any JavaScript/TypeScript project.

The .wasm binary ships inside this package. The generated glue references it with new URL('noise_bg.wasm', import.meta.url), so any bundler that understands that pattern (Vite, Rollup, webpack 5, esbuild) fingerprints the binary and emits it as an asset of your build. No copying files into public/, no CDN, no runtime configuration.

Install

npm add @noiselang/core   # or: pnpm add / yarn add

Usage

import { run } from '@noiselang/core';

const result = await run(`
  coin ~ rand::bernoulli(0.5);
  P(coin)
`);

console.log(result.value);   // e.g. "0.4997"
console.log(result.stats);   // { forcings, samples, ops, rng_draws }
console.log(result.elapsedMs);

run never throws — parse/eval failures come back on result.error (with a source span).

The module instantiates lazily on first use. To warm it up ahead of time (e.g. on app mount):

import { load } from '@noiselang/core';
await load();

Variable introspection

Run a program and interrogate its retained scope without editing the source — describe a variable's distribution, correlate two, or explain what drives one:

import { runWithIntrospection } from '@noiselang/core';

const r = await runWithIntrospection(src, [
  { vars: ['height'] },                       // describe(height)
  { vars: ['weight'], explain: true },        // explain(weight)
  { vars: ['height', 'weight'] },             // corr(height, weight)
]);

r.bindings;        // live top-level variables (for a picker)
r.introspections;  // one tagged result per request, in order
r.log;             // Print lines + plot::* charts, in source order

Passing [] still returns bindings, so a plain run can populate a variable picker.

Bundler notes

  • Vite — works out of the box for app builds. If Vite's dependency optimizer trips on the import.meta.url asset reference in dev, add the package to optimizeDeps.exclude:
    // vite.config.js
    export default { optimizeDeps: { exclude: ['@noiselang/core'] } }
  • Node.js — the module targets browsers/bundlers (it uses fetch to load the .wasm). For a server runtime, instantiate the raw wasm-pack glue under @noiselang/core/wasm yourself.

API

| Export | Description | | --- | --- | | run(src) | Parse + evaluate a program → NoiseResult. | | runWithIntrospection(src, requests) | Run + resolve introspection requests → NoiseIntrospectResult. | | version() | The engine (crate) version string. | | load() | Force one-time WASM instantiation (optional warm-up). |

Full types (NoiseResult, NoiseStats, Introspection, IntrospectRequest, …) are exported.

License

MIT