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

@lediv/vite-plugin

v0.2.1

Published

Vite plugin for building Lediv projects

Readme

@lediv/vite-plugin

Vite plugin for building Lediv projects. Serves and builds multi-page HTML applications with component resolution, template evaluation, font injection, and mount script chunking.

Install

npm install @lediv/vite-plugin

Requires vite as a peer dependency.

Usage

import { defineConfig } from 'vite';
import lediv from '@lediv/vite-plugin';

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

The plugin expects a pages/ directory and an optional components/ directory at the Vite root.

Options

lediv({
  preloadFonts: true,
});

| Option | Type | Default | Description | | -------------- | --------- | ------- | ---------------------------------------------------------------- | | preloadFonts | boolean | false | Emit <link rel="preload"> tags for fonts detected in each page |

Dev server

The plugin registers a middleware that:

  • Responds to /fonts/:id/latin-wght-normal.woff2 requests directly from the bundled font assets.
  • Matches request URLs to HTML files under pages/ and serves the built result through transformIndexHtml.
  • Triggers a full page reload on HMR changes inside pages/ or components/.

Build

On build the plugin:

  1. Collects all .html files under pages/ recursively.
  2. Resolves component trees and evaluates template logic for each page.
  3. Emits inline mount scripts as separate JS chunks (one per component instance).
  4. Copies required WOFF2 font files to dist/fonts/:id/.
  5. Emits final HTML files as build assets, verbatim. Nothing is minified: the output is the HTML you authored, and compression on the wire (gzip/brotli) recovers almost all of what minifying would have saved.
  6. Copies a _redirects file from the Vite root into the output, unchanged, if there is one.

Redirects

A _redirects file at the Vite root is copied to the root of the build output as-is, whether or not the project has any pages. That is the file Netlify and Cloudflare Pages read to serve redirects, and it is the same file Lediv reads when it publishes the project, so the rules a project was written with keep working after you export it and deploy it yourself.

The plugin does not parse or validate the file. The rule syntax is documented at https://lediv.com/docs/redirects.

Build utilities entry point

import { buildPage, buildPageFromSource } from '@lediv/vite-plugin/build';

buildPage is the low-level page builder used by the plugin. It accepts a page name and options, reads the source HTML, resolves components, injects font CSS, and returns { html, usedFonts, mountScripts }.

import type { BuildPageOptions, BuildPageResult } from '@lediv/vite-plugin/build';

License

MIT