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

@jo-hemphill/favigen

v2.0.0

Published

Library-first favicon and web app icon generator for bundlers and other integrating applications.

Readme

Favigen

Favigen turns one SVG or raster logo into favicon and app icon assets. Build tools can inspect the plan, render selected assets, and bind the emitted filenames and URLs before generating HTML tags or handing icon entries to a manifest provider.

Favigen 2 is ESM-only and requires Node.js 22.12 or newer. Use import in an ES module, or await import('@jo-hemphill/favigen') from asynchronous CommonJS code.

Install from the npm registry with either package manager.

pnpm add @jo-hemphill/favigen
npm install @jo-hemphill/favigen

Jimp handles raster processing, and WebAssembly codecs handle SVG and WebP. A standard install includes the codecs and needs no platform-specific image addons.

To build from source, use Node.js 22.18 or later in the 22.x line, or Node.js 24 or newer, and the pnpm version in package.json. Run pnpm install --frozen-lockfile, pnpm test, and pnpm pack.

Generate icons from one source

import { bindIcons, iconTags, planIcons, prepareSource, renderIcons } from '@jo-hemphill/favigen';

const source = await prepareSource('./assets/logo.svg');
const plan = planIcons(source);
const icons = await renderIcons(plan);

const bindings = new Map(icons.map((icon) => [icon.id, {
  outputFileName: `assets/${icon.name}`,
  url: `/assets/${icon.name}`,
}]));

const tags = iconTags(bindIcons(icons, bindings));

Write or emit each icon's bytes through your build tool. In the example, replace the illustrative bindings with its actual filenames and URLs. The default plan contains a multi-size ICO, 32 and 48 px PNGs, and a 180 px Apple touch icon. Use profile: 'pwa' to add 192 and 512 px app icons with both ordinary and maskable variants.

Paths, byte arrays and array buffers are accepted. Raster sources can be static PNG, JPEG or WebP. SVG input supports self-contained vector artwork with outlined text and local references. Favigen checks vector visibility at the selected crop and target size, so a tiny mark in a large canvas can still render when you choose a tight crop. A target that would be blank raises an error. Export complex SVG artwork with filters, stylesheet blocks or embedded images to PNG if it is outside the supported subset.

Customize a specific role

const plan = planIcons(source, {
  profile: 'pwa',
  variants: {
    favicon: { source: await prepareSource('./assets/small-mark.png'), trim: true },
    touch: { background: '#182230' },
  },
  targets: {
    'app.any.192': { crop: [0.125, 0, 0.75, 1] },
  },
});

contain fits the whole crop. cover fills the padded area and clips overflow at that boundary. Crop coordinates are normalized fractions of the oriented source rectangle, after optional transparent-margin trimming. position anchors the artwork along two axes and padding reserves a fraction of the output size on each edge. Use a solid hex background or choose transparent on roles that support it. Use resample: 'nearest' for pixel art. Inspect plan.diagnostics for small-icon aspect ratio and raster upscaling feedback.

Render and publish independently

  • renderIcon(plan, id) renders one icon. renderIcons(plan, { ids }) renders a subset or the entire plan.
  • The default bounded memory cache reuses matching render recipes. Pass createDiskCache(directory) to reuse matching bytes across processes, or pass cache: false to bypass caching. ICO and PNG assets can share cached planes.
  • bindIcons strips the binary payload from the published records and attaches actual bundle names and URLs. Rebind the same rendered icons for each deployment or manifest location.
  • manifestIcons(publication) builds app icon entries for your manifest provider. buildBasicManifest(publication, options) returns an optional basic manifest payload. The caller owns file emission and the manifest link. Use manifestUrl and urlStyle: 'relative' for links relative to a nested manifest, and set appUrl when the app and asset deployment bases differ.

The draft Favigen class and one-shot favigen(source, options) entry point remain available. The legacy image hook uses Jimp 2 and accepts positional resize and contain, along with getBufferAsync, getWidth, and getHeight. See the Jimp 2 migration guide for other image methods. Use the staged API for SVG and incremental rendering. See the design proposal for the Vite adapter and validation plan.