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

vite-plugin-wite

v0.0.1

Published

Vite plugin for importing .wasm files built with wite

Readme

vite-plugin-wite

Vite plugin for importing .wasm files as ES modules with full TypeScript support.

Features

  • Import .wasm files directly from TypeScript/JavaScript
  • Auto-generated .d.ts type definitions from wasm exports
  • Component Model support (extracts core module automatically)
  • Built-in shims for spectest and wasi_snapshot_preview1 imports
  • Custom import shims for arbitrary wasm host modules
  • HMR support in dev mode
  • Rollup asset emission in build mode

Install

npm install vite-plugin-wite

Usage

vite.config.ts

import { defineConfig } from "vite";
import wite from "vite-plugin-wite";

export default defineConfig({
  plugins: [wite()],
  build: {
    target: "esnext",
  },
});

Import wasm

import { add } from "./add.wasm";

console.log(add(1, 2)); // 3

The plugin parses the wasm binary, generates a JS wrapper that calls WebAssembly.instantiateStreaming, and re-exports all wasm exports as named ES module exports.

A .d.ts file is auto-generated next to the .wasm file:

// add.wasm.d.ts (auto-generated)
export declare function add(a0: number, a1: number): number;
export declare const memory: WebAssembly.Memory;

Options

wite({
  // Custom import shims for wasm modules that require host imports.
  // Key: module name, Value: JS code string providing the import object.
  shims: {
    "my:host": `const __shim_my_host = { log: (x) => console.log(x) };`,
  },

  // Generate .d.ts files alongside .wasm files (default: true)
  dts: true,
});

Component Model

When the plugin detects a Component Model wasm binary (magic bytes \0asm\x0d\x00\x01\x00), it automatically extracts the first embedded core module and uses that for instantiation.

This works for components with primitive types only (i32, i64, f32, f64). Components using string, list, or record types require canonical ABI adapters which are not yet supported.

Built-in Shims

| Module | Description | |---|---| | spectest | MoonBit's println output via print_char | | wasi_snapshot_preview1 | Stub that returns 0 for all WASI calls |

For unknown import modules, a Proxy stub is generated that returns 0 for any call.

License

MIT