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

vite-plugin-image-types

v1.5.5

Published

This [vite](https://vitejs.dev/) plugin generates a type file for the image paths in the `public` directory.

Readme

vite-plugin-image-types

This vite plugin generates a type file for the image paths in the public directory.

Features

🔥 Generate image types as part of the development process

Installation

# using npm
npm install -D vite-plugin-image-types

Usage

Vite config

import { imageTypes } from "vite-plugin-image-types";

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

Options

| Name | Type | Description | Default | | ------------------------ | --------------------------------------------- | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | | imageDir | string | The relative directory (from the public directory) to search for image files. | "" | | outputFile | string | Path to the generated TypeScript file containing image types. | "src/types/ImagePaths.ts" | | imagePathName | string | The name of the generated string union type representing all image paths. | "ImagePath" | | imageInformationName | string | The name of the generated object type that includes file metadata (e.g., width, height). | "ImageFile" | | exportImageInformation | boolean. | Whether to export the image information type along with image paths. | false | | excludeDirs | string[] | List of directories to exclude from image scanning. | [] | | fileExtensions | string[] | Allowed image file extensions to include. | [".png", ".jpg", ".jpeg", ".gif", ".svg", ".ico", ".webp", ".bmp", ".tiff", ".avif"] | | watchMode | "vite" | "chokidar" | "hybrid" | File watching strategy: Vite’s built-in, Chokidar, or a hybrid approach. | "hybrid" | | debounceMs | number | Debounce time in milliseconds for batching updates. | 250 | | eslintFormat | boolean | Whether to automatically format the output file using ESLint’s auto-fix. | false | | prettierFormat | boolean | Whether to format the output file with Prettier. | false | | logLevel | "none" | "error" | "warn" | "info" | Log verbosity level. | "info" |

Example Output

// src/types/ImagePaths.ts
export type ImagePath = "/logo.ico" | "/logo.png";

export type ImageFile = { title: string; path: ImagePath | (string & {}); aspectRatio: string };

const ImageFiles: Record<ImagePath, ImageFile> = {
  "/logo.ico": {
    title: "logo.ico",
    path: "/logo.ico",
    aspectRatio: "257 / 257",
  },
  "/logo.png": {
    title: "logo.png",
    path: "/logo.png",
    aspectRatio: "126 / 126",
  },
};

export { ImageFiles };

Publishing to npm

To publish a new version of this package to npm, follow these steps:

  1. Login to npm (if not already logged in):

    npm login
  2. Bump the version according to semver:

    # patch release (bug fixes)
    npm version patch
    # minor release (new features, backwards compatible)
    npm version minor
    # major release (breaking changes)
    npm version major
  3. Publish to npm:

    npm run publish

Note: Make sure you have the necessary permissions to publish to the vite-plugin-image-types package on npm.