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

eleventy-plugin-smol-jsx-utilities

v1.2.1

Published

Small set of utilities for [Eleventy](https://www.11ty.dev) that work with JSX projects (eg, react/preact and mdx).

Readme

Eleventy Plugin Smol Jsx Utilities

Small set of utilities for Eleventy that work with JSX projects (eg, react/preact and mdx).

Installation

npm install --save eleventy-plugin-smol-jsx-utilities

Utilities

ReadFile

This allows you to read a file that is relative to the current file. So for example, if this is your directory structure...

Project Root
├───src
│   └───folder
│   │       index.js
│   │       some-relative-file.txt
│   │       └───nested
│   │           some-other-file.txt
│   └───another
│           some-local-file.txt
└───data
    some-data-file.txt

You could read any of these files with the following from the index.js file.

import { ReadFile } from 'eleventy-plugin-smol-jsx-utilities';

const relativeFile = ReadFile.asText('./some-relative-file.txt');
const otherFile = ReadFile.asText('nested/some-other-file.txt');
const localFile = ReadFile.asText('../another/some-local-file.txt');
const dataFile = ReadFile.asText('data/some-data-file.txt');

Plugins

PassthroughCopyToUrlTransformPlugin

This will look through the generated html and replace any href and src fields that are pointing at passthrough copy files. Similar to the Eleventy inputpath to url plugin.

Just install the plugin like any other in your eleventy config.

import { PassthroughCopyToUrl } from 'eleventy-plugin-smol-jsx-utilities';

export default async (eleventyConfig) => {
  eleventyConfig.addPassthroughCopy({ 'pblc/robots.txt': '.' });
  eleventyConfig.addPassthroughCopy({ 'pblc/folder/mapping.xml': 'sitemap.xml' });
  eleventyConfig.addPassthroughCopy('pblc/favicon/data/**');

  eleventyConfig.addPlugin(PassthroughCopyToUrl.plugin);
}

And the following...

export default function (data) {
	return (
        <head>
            <link href="robots.txt" />
            <link href="folder/mapping.xml" />
            <link href="favicon/data/favicon.ico" />
        </head>
    );
};

Will get converted.

<link href="/robots.txt" />
<link href="/sitemap.xml" />
<link href="/favicon/data/favicon.ico" />

WaitForAll

This will let you run async operations inside of jsx files (so long as you dont need the async operations output).

Just install the plugin like any other in your eleventy config.

import { WaitForAll } from 'eleventy-plugin-smol-jsx-utilities';

export default async (eleventyConfig) => {
  eleventyConfig.addPlugin(WaitForAll.plugin);
}

And then instantiate a long running operation

import path from 'node:path';
import fs from 'node:fs';
import { WaitForAll } from 'eleventy-plugin-smol-jsx-utilities';

export const render = () => {
    // File is guaranteed to be written before Eleventy finishes rendering.
    WaitForAll.add(fs.writeFile('/some/output/file.txt', 'some data'));

    return <div></div>;
}

DirectoryResolver

This will expose the dir attribute from Eleventy in your jsx files for easier consumption.

Just install the plugin like any other in your eleventy config.

import { DirectoryResolver } from 'eleventy-plugin-smol-jsx-utilities';

export default async (eleventyConfig) => {
  eleventyConfig.addPlugin(DirectoryResolver.plugin);
}

And then use the directories as needed

import path from 'node:path';
import fs from 'node:fs';
import { DirectoryResolver } from 'eleventy-plugin-smol-jsx-utilities';

export const render = () => {
    const outputFile = path.join(DirectoryResolver.getOutputDir(), 'my-cool-file.png');
    fs.writeFileSync(outputFile, imgData);

    return <img src={DirectoryResolver.getOutputUrl(outputFile)}>;
}

DeadTagRemover

This removes tags that are effectively useless in the html. For example <script></script> will be deleted.

Currently deletes the following tags if they are empty:

  • <script>
  • <style>
  • <title>
  • <head>

Just install the plugin like any other in your eleventy config.

import { DeadTagRemover } from 'eleventy-plugin-smol-jsx-utilities';

export default async (eleventyConfig) => {
  eleventyConfig.addPlugin(DeadTagRemover.plugin);
}