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

@vocoder/unplugin

v0.1.4

Published

Build plugin for Vocoder — injects translations as virtual modules at build time

Readme

@vocoder/unplugin

Build plugin for Vocoder that fetches translations at build time and injects them as virtual modules. Works with Vite, Next.js, Webpack, Rollup, and esbuild.

Installation

npm install @vocoder/unplugin

Setup

Vite

// vite.config.ts
import vocoder from '@vocoder/unplugin/vite';

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

Next.js

// next.config.js
const { withVocoder } = require('@vocoder/unplugin/next');

module.exports = withVocoder({
  // your Next.js config
});

Webpack

// webpack.config.js
const vocoder = require('@vocoder/unplugin/webpack');

module.exports = {
  plugins: [vocoder()],
};

Rollup

// rollup.config.js
import vocoder from '@vocoder/unplugin/rollup';

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

esbuild

import vocoder from '@vocoder/unplugin/esbuild';

await esbuild.build({
  plugins: [vocoder()],
});

How It Works

The plugin runs at build time and does the following:

  1. Detects your repository by reading .git/config and parsing the origin remote URL into a canonical format (github:owner/repo, gitlab:owner/repo, etc.)

  2. Detects the branch from CI environment variables or .git/HEAD. Supported CI providers: GitHub Actions, Vercel, Netlify, Cloudflare Pages, GitLab CI, Bitbucket Pipelines, CircleCI, Render.

  3. Computes a fingerprint -- an opaque 12-character hex string derived from sha256(repoCanonical + ":" + scopePath + ":" + branch). The scope path is the relative path from the git root to the current working directory, which supports monorepos.

  4. Fetches translations from the Vocoder API using the fingerprint. The response includes all locales and their translations in a single request.

  5. Creates virtual modules that the bundler resolves at import time:

    • virtual:vocoder/manifest -- exports config (source locale, target locales, locale metadata) and loaders (per-locale dynamic import functions)
    • virtual:vocoder/translations/{locale} -- exports the translation map for a single locale
  6. Enables background refresh -- injects metadata so @vocoder/react can check for newer translations at runtime without blocking the initial page load

Zero Configuration

The plugin requires no configuration files, API keys, or environment variables. Everything is auto-detected from git.

Offline Fallback

Translations are cached to node_modules/.vocoder/cache/ after each successful fetch. If the API is unreachable on a subsequent build, the plugin uses the cached translations. If no cache exists, the build proceeds with empty translations (source text is shown).

Monorepo Support

In a monorepo, each package can be a separate Vocoder project. The plugin computes the scope path (relative path from git root to process.cwd()) and includes it in the fingerprint. Run the plugin from each package's build step and it will fetch the correct translations for that package.

Build Output

During the build, the plugin logs:

[vocoder] github:owner/repo @ main -> a1b2c3d4e5f6
[vocoder] Loaded 3 locale(s), 42 translation(s)

If no translations are available yet (before the first vocoder sync):

[vocoder] No translations available yet -- source text will be shown.

License

MIT