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

lean4.js

v0.0.2

Published

Run Lean 4 in the browser via WebAssembly

Readme

lean4.js

Run Lean 4 in the browser via WebAssembly.

This project is mainly based on cauli's work to compile Lean 4 to WASM: cauli/lean4, with a web playground reference from cauli/lean4-wasm-in-browser.

Install

npm install lean4.js

Usage

import { Lean4 } from 'lean4.js'

const lean = new Lean4()
await lean.init()

const result = await lean.run('#eval 2 + 2')
console.log(result.stdout)   // "4"
console.log(result.exitCode) // 0

lean.dispose()

WASM assets are loaded from cloudflare R2 automatically. No extra setup needed.

Note: Your page must be served with COOP/COEP headers for SharedArrayBuffer support. See COOP/COEP setup below.

What This Project Contributes

  1. Reduced unnecessary .olean artifacts in lean-lib (for example, private artifacts such as olean.private), bringing the lean-lib size down to about 90+ MB and the full bundle to about 300+ MB. This is acceptable for now, and there is still room for further size optimization.
  2. Published lean4.js to npm for easier integration and reuse.
  3. Deployed a web playground so people can try it directly in the browser.

Current Limits and Future Work

  1. Even running a minimal Lean file still takes close to 1 minute, which is hard to use in production today.
  2. We tried to support --server/--worker mode in the browser, but this attempt failed. If startup can be paid only once (instead of per run), the project would become much more practical.

API

new Lean4(options?)

| Option | Type | Default | Description | |--------|------|---------|-------------| | basePath | string | cloudflare R2 | URL where WASM assets are served. Override for self-hosting | | onProgress | (msg: string) => void | — | Progress callback during init | | timeout | number | 120000 | Execution timeout in ms |

lean.init(): Promise<void>

Downloads and caches the .olean library bundle. Must be called before run(). Uses IndexedDB to cache for subsequent visits.

lean.run(code, options?): Promise<RunResult>

Runs Lean 4 code in an isolated iframe.

| Option | Type | Default | Description | |--------|------|---------|-------------| | flags | string[] | ['--json'] | Lean CLI flags |

Returns { stdout: string, stderr: string, exitCode: number }.

lean.dispose(): void

Cleans up resources.

COOP/COEP Headers

SharedArrayBuffer requires these server headers:

Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp

Vite

import { lean4Plugin } from 'lean4.js/vite'

export default defineConfig({
  plugins: [lean4Plugin()],
})

Other frameworks

Add headers in your server/hosting config (Nginx, Vercel, Netlify, etc.).

Self-hosting WASM assets

If you prefer not to use the CDN:

npx lean4-wasm-copy public/lean4-wasm
const lean = new Lean4({ basePath: '/lean4-wasm' })

License

MIT

Thanks