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

@darcas/rollup-plugin-license-json

v1.1.3

Published

A Vite plugin to generate a JSON file with detailed information about third-party licenses, using rollup-plugin-license.

Readme

LicensePluginJson

NPM Last Update NPM Version NPM Downloads NPM License

LicensePluginJson is a Vite-compatible plugin that uses rollup-plugin-license to generate a JSON file containing detailed information about third-party licenses in your project.

Installation

To use this plugin, install it via npm:

npm install @darcas/rollup-plugin-license-json

Or, if you're using yarn:

yarn add @darcas/rollup-plugin-license-json

Usage

In your vite.config.mts just add:

import LicensePluginJson from '@darcas/rollup-plugin-license-json';
import { defineConfig } from 'vite'

export default defineConfig({
    //...
    plugins: [
        //...
        LicensePluginJson(join(__dirname, 'dist', 'licenses.json'), {
            debug: true,
            thirdParty: {
                includePrivate: true,
                multipleVersions: true,
            }
        }),
        //...
    ],
    //...
});

Parameters

LicensePluginJson accepts 2 parameters:

  • file (string, required): The path where the JSON file will be generated.
  • options (object, optional): See the rollup-plugin-license plugin

You can't override the thirdParty.output option.

Output

The plugin generates a JSON file with the following structure for each dependency:

type LicensePluginJsonRecord = {
    readonly author: {
        readonly name: string
        readonly email: string | null
        readonly url: string | null
    } | null
    readonly description: string
    readonly homepage: string
    readonly license: string
    readonly licenseText: string
    readonly name: string
    readonly version: string
}

Key Notes

  • licenseText: If the license text is empty or unavailable, it will be omitted.
  • Formatting: HTML tags are removed, and newlines are replaced with <br> tags to preserve readability.

Example

Assuming your project contains the following dependencies:

  • axios
  • lodash

The generated JSON file might look like this:

[
  {
    "name": "axios",
    "version": "0.21.4",
    "author": {
      "name": "Matt Zabriskie",
      "email": "[email protected]"
    },
    "description": "Promise based HTTP client for the browser and node.js",
    "homepage": "https://axios-http.com/",
    "license": "MIT",
    "licenseText": "Permission is hereby granted, free of charge, to any person..."
  },
  {
    "name": "lodash",
    "version": "4.17.21",
    "author": {
      "name": "John-David Dalton",
      "email": "[email protected]"
    },
    "description": "A modern JavaScript utility library delivering modularity, performance, and extras.",
    "homepage": "https://lodash.com/",
    "license": "MIT",
    "licenseText": "Permission is hereby granted, free of charge, to any person..."
  }
]

How to use

<script lang="ts" setup>
import { type LicensePluginJsonRecord } from '@darcas/rollup-plugin-license-json';
import axios from "axios";
import orderBy from 'lodash/orderBy';

const licenses = ref<LicensePluginJsonRecord[]>([]);

onMounted(async () => {
    const response = await axios.get('/licenses.json', {
        headers: {
            Accept: 'application/json',
        },
    });

    if (response.status === 200) {
        licenses.value = orderBy(response.data, ['name'], ['asc']);
    }
});
</script>

Based On

LicensePluginJson is built on top of rollup-plugin-license. It uses its core functionality to extract and format license information for third-party dependencies. Ensure that your project setup supports Rollup-compatible plugins, as Vite uses Rollup under the hood.

Contributing

If you'd like to contribute to the project, feel free to fork it and create a pull request. Please ensure that your changes are well-tested and properly documented.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Made with ❤️ by Dario Casertano (DarCas).