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

@r1-runtime/vite-plugin

v0.3.5

Published

Official Vite plugin for R1 — automates Rust→WASM compilation and Tauri import patching.

Readme

@r1-runtime/vite-plugin

Official Vite plugin for R1 — automates Rust→WASM compilation and Tauri import patching.

Features

  • Automatic WASM Compilation: Compiles your src-tauri/ Rust code to WASM during build
  • Import Patching: Rewrites Tauri API imports to use R1 shims
  • Boot Script Injection: Automatically injects R1 runtime initialization
  • Zero Config: Works out of the box with standard Tauri projects

Installation

npm install --save-dev @r1-runtime/vite-plugin

Usage

Add to your vite.config.ts:

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { r1Plugin } from '@r1-runtime/vite-plugin';

export default defineConfig({
  plugins: [
    r1Plugin({ rustSrc: './src-tauri' }),
    react(),
  ],
});

Options

interface R1PluginOptions {
  /**
   * Path to Rust source directory
   * @default './src-tauri'
   */
  rustSrc?: string;

  /**
   * WASM output directory (relative to rustSrc)
   * @default './target/wasm32-unknown-unknown/release'
   */
  wasmOut?: string;

  /**
   * Enable debug logging
   * @default false
   */
  debug?: boolean;
}

What It Does

1. Rust → WASM Compilation

During build, the plugin:

  1. Runs cargo build --target wasm32-unknown-unknown --release
  2. Runs wasm-bindgen to generate JavaScript bindings
  3. Copies WASM files to your public/wasm/ directory

2. Import Patching

Rewrites Tauri imports to use R1 shims:

// Before:
import { invoke } from '@tauri-apps/api/core';
import { readTextFile } from '@tauri-apps/api/fs';

// After (automatically):
import { invoke } from '@r1-runtime/apis/core';
import { readTextFile } from '@r1-runtime/apis/fs';

3. Boot Script Injection

Injects R1 runtime initialization into your HTML:

<script type="module">
  import { R1Runtime } from '@r1-runtime/core';
  const runtime = new R1Runtime();
  await runtime.boot();
  await runtime.loadBackend('/wasm/your_app.wasm');
  window.dispatchEvent(new Event('r1:ready'));
</script>

Build Output

After running npm run build, your dist/ folder will contain:

dist/
├── index.html
├── assets/
│   ├── index-[hash].js
│   └── index-[hash].css
└── wasm/
    ├── your_app_bg.wasm
    └── your_app.js

Deploy this folder to any static hosting service!

Supported Tauri APIs

The plugin automatically patches imports for:

  • @tauri-apps/api/core
  • @tauri-apps/api/fs
  • @tauri-apps/api/path
  • @tauri-apps/api/event
  • @tauri-apps/api/dialog
  • @tauri-apps/api/os
  • @tauri-apps/api/clipboard
  • @tauri-apps/api/window
  • @tauri-apps/plugin-store
  • @tauri-apps/plugin-sql

Requirements

  • Vite 5.0+
  • Rust toolchain with wasm32-unknown-unknown target
  • wasm-bindgen-cli installed

Troubleshooting

"wasm-bindgen not found"

Install it:

cargo install wasm-bindgen-cli

"target wasm32-unknown-unknown not found"

Add the target:

rustup target add wasm32-unknown-unknown

WASM file not found in build

Check that:

  1. Your Cargo.toml has crate-type = ["cdylib"]
  2. Rust code compiles without errors
  3. rustSrc option points to correct directory

License

MIT © 2026 R1 Runtime Team