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

unplugin-build-meta

v1.0.5

Published

Provide build metadata as a virutal module

Readme

unplugin-build-meta

npm version npm downloads

Import build metadata into your JavaScript/TypeScript projects for Vite, Webpack, Rollup, esbuild and more. Powered by unplugin.

Install

npm install -D unplugin-build-meta

Usage

[!TIP] You can view all examples here.

// vite.config.ts
import buildMeta from "unplugin-build-meta/vite";

export default defineConfig({
  plugins: [
    buildMeta({ /* options */ }),
  ],
});

// rollup.config.js
import buildMeta from "unplugin-build-meta/rollup";

export default {
  plugins: [
    buildMeta({ /* options */ }),
  ],
};

// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require("unplugin-build-meta/webpack").default({ /* options */ }),
  ],
};

// nuxt.config.js
export default defineNuxtConfig({
  modules: [
    ["unplugin-build-meta/nuxt", { /* options */ }]
  ],
});

// astro.config.mjs
import { defineConfig } from "astro/config";
import buildMeta from "unplugin-build-meta/astro";

// https://astro.build/config
export default defineConfig({
  integrations: [
    buildMeta({
      /* options */
    })
  ]
});

// esbuild.config.js
import { build } from "esbuild";
import buildMeta from "unplugin-build-meta/esbuild";

build({
  /* ... */
  plugins: [
    buildMeta({
      /* options */
    }),
  ],
});

// farm.config.ts
import { defineConfig } from "@farmfe/core";
import vue from "@vitejs/plugin-vue";
import buildMeta from "unplugin-build-meta/farm";

export default defineConfig({
  vitePlugins: [
    vue(),
  ],
  plugins: [
    buildMeta({
      /* options */
    })
  ]
});

// rspack.config.mjs
import rspack from "@rspack/core";
import buildMeta from "unplugin-build-meta/rspack";

/** @type {import('@rspack/core').Configuration} */
export default {
  plugins: [
    new rspack.HtmlRspackPlugin({
      template: "./index.html"
    }),
    buildMeta()
  ],
};

// rolldown.config.js
import { defineConfig } from "rolldown";
import buildMeta from "unplugin-build-meta/rolldown";

export default defineConfig({
  input: "./index.js",
  plugins: [
    buildMeta({
      /* options */
    }),
  ],
});

Configuration

buildMeta({
  // Whether to enable the git module (enabled by default)
  git: true,

  // Additional custom modules to include
  extraModules: [
    // Your custom modules here
  ]
});

By default, the git module is enabled. You can:

  • Disable the git module by setting git: false
  • Add custom modules using the extraModules array
  • Create custom modules using defineBuildMetaModule

Modules

Git Module

The git module provides access to repository metadata from your code.

Import it in your code:

// Import all git metadata
import * as git from "virtual:build-meta/git";

// Or import specific values
import { branch, sha, shortSha } from "virtual:build-meta/git";

Available properties (all properties are nullable):

| Property | Type | Description | |----------|------|-------------| | branch | string \| null | Current git branch name | | sha | string \| null | Full git commit hash | | shortSha | string \| null | First 10 characters of the commit hash | | latestCommitMessage | string \| null | Latest commit message | | commitAuthorName | string \| null | Commit author name | | commitAuthorEmail | string \| null | Commit author email | | commitAuthorDate | string \| null | Commit author date | | commitCommitterName | string \| null | Committer name | | commitCommitterEmail | string \| null | Committer email | | commitCommitterDate | string \| null | Committer date | | tag | string \| null | Current tag (if any) | | tags | string[] \| null | All tags pointing at current commit | | lastTag | string \| null | Latest tag in the repository | | repositoryUrl | string \| null | Repository URL (for GitHub repositories) |

Runtime Module

The runtime module provides access to Node.js runtime information from your code.

Import it in your code:

// Import all runtime information
import * as runtime from "virtual:build-meta/runtime";

// Or import specific values
import { arch, platform, versions } from "virtual:build-meta/runtime";

Available properties:

| Property | Type | Description | |----------|------|-------------| | platform | NodeJS.Platform | The operating system platform (e.g., 'linux', 'darwin', 'win32') | | arch | NodeJS.Architecture | The CPU architecture (e.g., 'x64', 'arm64') | | versions | NodeJS.ProcessVersions | Version strings of Node.js and its dependencies |

TypeScript

To get proper type support, make sure to include the type declarations:

{
  "compilerOptions": {
    "types": [
      "unplugin-build-meta/types"
    ]
  }
}

📄 License

Published under MIT License.