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

@michthemaker/vite-plugin-vanjs

v0.2.0

Published

The default Vite plugin for VanJS projects

Downloads

185

Readme

@michthemaker/vite-plugin-vanjs

GitHub license npm version bundle size PRs Welcome

The official Vite plugin for VanJS that brings Hot Module Replacement to your components — edit them in a running app without losing state.


Installation

npm install @michthemaker/vite-plugin-vanjs -D
// vite.config.ts
import { defineConfig } from "vite";
import vanjs from "@michthemaker/vite-plugin-vanjs";

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

How it works

The plugin transforms your component files at dev time to wire up HMR automatically. When you save a file, only the affected components re-render — state is preserved across updates.

// What you write
export const Counter = () => {
  const count = van.state(0);
  return div(button({ onclick: () => count.val++ }, count));
};

// What the plugin wires up (simplified)
export const $$__hmr__Counter = () => { ... };
export const Counter = (props) =>
  __VAN_HMR__.registerRender('src/counter.ts:Counter', $$__hmr__Counter, props);

if (import.meta.hot) {
  import.meta.hot.accept((newModule) => {
    if (newModule) __VAN_HMR__.rerender('src/counter.ts:Counter', newModule.$$__hmr__Counter);
  });
}

None of this touches your production build — it's dev-only.


Rules for HMR to work

For the plugin to detect and wire up a component, follow these rules:

1. Components must be arrow functions

// ✅ supported
export const Button = (props) => div(...);
export const Button = async (props) => div(...);

// ❌ not supported
export function Button(props) { return div(...); }

2. Components must use van.tags

const { div, button } = van.tags;

// ✅ detected — uses a van tag
export const Card = () => div("hello");

// ❌ not detected — no van tags used
export const helper = () => ({ foo: "bar" });

3. Use const, not let or var

// ✅
const Counter = () => div(...);

// ❌
let Counter = () => div(...);

4. All export styles are supported

export const Counter = () => div(...);          // ✅
export default Counter;                          // ✅
export { Counter };                              // ✅
export { Counter as MyCounter };                 // ✅
export { Counter, Button };                      // ✅

Options

vanjs({
  hmr: {
    include: /\.[jt]s$/, // files to transform (default: all .js/.ts)
    exclude: /node_modules/, // files to skip
    entryMatch: /main\.[jt]s$/, // your app entry file(s)
  },
});

State preservation

van.state() are preserved across HMR updates automatically — no extra setup needed.

const count = van.state(0); // survives hot reloads
const doubled = van.derive(() => count.val * 2); // not preserved (need to re-run)

Note: This plugin is for development only. All transforms are stripped in production builds, leaving your original source intact and fully tree-shakeable.