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

react-package-analyzer

v0.0.2

Published

Analyze package usage patterns in React JavaScript projects

Readme

React Package Analyzer

A powerful tool for analyzing component usage patterns in React applications. This tool helps you track and understand how UI components from various libraries are used throughout your codebase, making migration planning, dependency management, and codebase analysis easier.

Features

  • Track component usage from multiple UI libraries simultaneously
  • Detect import patterns and component distribution
  • Generate detailed reports in JSON and Markdown formats
  • Automatic detection of import aliases from jsconfig.json or tsconfig.json
  • Dependency chain analysis to understand component relationships
  • Library-agnostic design that works with any React UI component library

Philosophy

React Package Analyzer is built on four core principles:

  • Library-agnostic: Works with any React-based UI library
  • Application-agnostic: Compatible with any React application structure
  • Usage-focused: Analyzes how components are actually used in your codebase
  • Data-driven: Provides objective metrics based on actual usage patterns

For a deeper exploration of these principles and the design philosophy behind this tool, see our Core Philosophy document.

Installation

npm install react-package-analyzer

Usage

The React Package Analyzer is configured using a simple configuration file in your project root.

1. Create a configuration file

Create a file named react-import-analyzer.config.js in your project root:

module.exports = {
    // UI libraries to analyze
    packagesToTrack: [
        '@mui/material',
        '@chakra-ui/react',
    ],
    
    // Output formats (json, markdown, or both)
    format: 'json,markdown',
    
    // GitHub repo URL for linking in reports (optional)
    repoUrl: 'https://github.com/username/project/blob/main',
    
    // Files to include in analysis
    include: 'src/**/*.{js,jsx,ts,tsx}',
    
    // Output directory for reports
    outputDir: './import-analysis'
}

2. Import aliases

The analyzer automatically detects import aliases from your jsconfig.json or tsconfig.json file:

{
  "compilerOptions": {
    "baseUrl": "src",
    "paths": {
      "@components/*": ["components/*"],
      "@pages/*": ["pages/*"],
      "@hooks/*": ["hooks/*"],
      "@utils/*": ["utils/*"],
      "@layouts/*": ["components/layouts/*"]
    }
  },
  "include": ["src"]
}

This allows the analyzer to correctly resolve imports that use aliases like:

import { Button } from '@components/ui/Button';

3. Run the analyzer

After setting up your configuration file, simply run the following command from your project's root directory:

analyze-imports

The tool will automatically detect and use your react-import-analyzer.config.js file.

You can also specify a different configuration file:

analyze-imports --config custom-config.js

Example project structure

Here's an example project structure showing where to place the configuration file:

my-react-app/
├── src/
│   ├── components/
│   ├── pages/
│   └── ...
├── jsconfig.json
├── react-import-analyzer.config.js
└── package.json

Output

The analyzer generates several output files in your specified output directory:

  • raw.jsonl: Detailed component usage data for each file
  • detailed.json: Comprehensive statistics about component usage
  • summary.json: High-level statistics about component usage
  • dependency-chains.json: Maps relationships between files
  • import-intersections.json: Analysis of component import relationships
  • report.md: Human-readable markdown report of all findings

Schema Documentation

For detailed information about the output file formats, please see the schema documentation.

Documentation

  • Core Philosophy - Learn about the underlying principles and design decisions
  • Markdown Reports - Detailed explanation of the generated markdown reports
  • Data Output - Comprehensive guide to the data files produced during analysis

License

MIT See LICENSE for the full license text.