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

@ladrillosjs/vite-plugin

v0.1.2

Published

Precompiles LadrillosJS components at build time so the page never needs script-src 'unsafe-eval'.

Readme

@ladrillosjs/vite-plugin

Precompiles LadrillosJS components at build time, so the shipped page needs neither script-src 'unsafe-eval' nor a runtime HTML parser.

Without it, LadrillosJS fetches each .html component in the browser, parses it, and compiles its expressions with new Function. That is the no-build-step design, and it stays the default. This plugin is the opt-in other half: run the same work at build time and ship the result as plain static JavaScript.

Install

npm i -D @ladrillosjs/vite-plugin

Use

// vite.config.js
import { defineConfig } from "vite";
import ladrillos from "@ladrillosjs/vite-plugin";

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

No source changes. Registrations you already wrote keep working:

import { registerComponent } from "ladrillosjs";

await registerComponent("my-button", "./components/button.html");

At build time that call is replaced with an import of a generated module and a defineCompiled call. Nothing fetches or parses the .html in the browser.

Options

| Option | Default | Meaning | | --- | --- | --- | | runtimeImport | "ladrillosjs/csp" | Which entry the generated artifacts import. ladrillosjs/csp is the one with no Function constructor in it. | | dev | false | Precompile during vite serve too. Off by default so editing a component is a plain reload; turn it on to develop under the CSP you will ship. | | strict | false | Turn "could not precompile this registration" from a warning into a build error. Recommended once you are relying on the CSP. |

What it will not precompile

A registration is only rewritten when its arguments are static. These are left for the runtime and reported:

  • a path that is not a string literal — registerComponent(name, paths[i])
  • a spread — registerComponents([...list])
  • lazy: true — precompiling would define the element up front, which is the opposite of what was asked for
  • a path that resolves to no file, or to two different files

The failure mode is safe: an untouched call still works. It just needs unsafe-eval. Turn on strict to make that a build failure instead.

Path resolution

At runtime a component path resolves against the page URL. On disk, the natural reading is relative to the module doing the registering. The two only coincide when the entry module sits at the web root, so the plugin tries both and requires exactly one to exist. An ambiguous path is reported rather than guessed at.

Requirements

  • The plugin runs the framework's own parser, so it needs a DOM in Node. It installs happy-dom for that.
  • Registrations are read as ESTree, which cannot represent TypeScript, so the plugin runs with enforce: "post" — after Vite's esbuild transform.