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

@lox-space/wasm

v0.1.0

Published

WebAssembly bindings for Lox (https://github.com/lox-space/lox)

Readme

@lox-space/wasm

WebAssembly bindings for Lox Space orbital mechanics, providing high-performance calculations for web applications.

Overview

This package contains Rust code compiled to WebAssembly that can be used by the Vite-based apps in the Kerolox monorepo (particularly the planetarium app). It provides performance-critical orbital mechanics calculations.

Prerequisites

  • Rust (latest stable)
  • wasm-pack - Install with: cargo install wasm-pack

Building

Build the WASM package:

pnpm build

This runs wasm-pack build --target web --out-dir pkg which:

  • Compiles Rust to WebAssembly
  • Generates JavaScript bindings
  • Creates TypeScript type definitions
  • Outputs everything to the pkg/ directory

Testing

Run Rust tests:

pnpm test

Or directly with cargo:

cargo test

Usage in Vite Apps

The planetarium app has been configured with vite-plugin-wasm to support WASM imports.

Basic Import

import init, { greet, orbital_velocity } from "@lox-space/wasm";

// Initialize the WASM module (required before use)
await init();

// Use exported functions
const message = greet("World");
console.log(message); // "Hello, World! Welcome to Lox Space WASM."

// Calculate orbital velocity (μ = 398600.4418 km³/s², r = 6700 km)
const velocity = orbital_velocity(398600.4418, 6700.0);
console.log(`Orbital velocity: ${velocity.toFixed(2)} km/s`);

In React Components

import { useEffect, useState } from "react";
import init, { orbital_velocity } from "@lox-space/wasm";

function OrbitalCalculator() {
  const [wasmReady, setWasmReady] = useState(false);

  useEffect(() => {
    init().then(() => setWasmReady(true));
  }, []);

  if (!wasmReady) {
    return <div>Loading WASM...</div>;
  }

  const velocity = orbital_velocity(398600.4418, 6700.0);

  return <div>Orbital velocity: {velocity.toFixed(2)} km/s</div>;
}

Available Functions

greet(name: string): string

A simple greeting function demonstrating string handling.

orbital_velocity(gravitational_parameter: f64, radius: f64): f64

Calculate orbital velocity using the formula: v = sqrt(μ / r)

  • gravitational_parameter: Standard gravitational parameter (μ) in km³/s²
  • radius: Orbital radius in km
  • Returns: Orbital velocity in km/s

deg_to_rad(degrees: f64): f64

Convert degrees to radians.

rad_to_deg(radians: f64): f64

Convert radians to degrees.

Architecture

  • Source: Rust code in src/lib.rs
  • Build Output: JavaScript bindings and WASM binary in pkg/
  • Target: web - optimized for browser use with ES modules
  • Build Tool: wasm-pack with wasm-bindgen

Development Notes

  • The WASM module automatically initializes panic hooks for better error messages in the browser console
  • Functions are decorated with #[wasm_bindgen] to expose them to JavaScript
  • The build output includes TypeScript definitions for type safety
  • The Vite plugin handles async WASM initialization automatically

Adding New Functions

  1. Add your function to src/lib.rs with the #[wasm_bindgen] attribute:
#[wasm_bindgen]
pub fn your_function(param: f64) -> f64 {
    // Your implementation
    param * 2.0
}
  1. Rebuild the package:
pnpm build
  1. The function will be automatically exported and available for import in TypeScript/JavaScript.

License

MIT