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

depsweep-cli

v1.0.0

Published

Find unused and undeclared dependencies in a JS/Node project. Zero dependencies, no config required.

Readme

depsweep

Find unused and undeclared dependencies in a JS/Node project. Zero dependencies, no config required.

The problem

Every project accumulates dead weight over time — a package gets added for one experiment, the experiment gets ripped out, the package.json entry doesn't. Multiply that by a year of development and you've got a slower install, a bigger bundle, and security scanners flagging CVEs in packages nothing actually uses anymore.

The opposite bug is worse: code imports a package that was never added to package.json, and it works — because something else pulled it in as a transitive dependency. It works right up until that other package changes its own dependencies, and your build breaks with no obvious cause.

depsweep finds both, in one pass, with no setup beyond having a package.json.

Install

npm install --save-dev depsweep

Or run it without installing:

npx depsweep .

Usage

depsweep              # scan the current directory
depsweep ./packages/api
depsweep . --json     # machine-readable output, for scripting
Scanned 42 source file(s), 18 declared dependencies.

Declared but never imported (2):
  - left-pad
  - moment
  If any of these are used indirectly (CLI scripts, config files), that's expected — double-check before removing.

Imported but not declared in package.json (1):
  - chalk
  These work today because something else pulled them in as a transitive dependency — a version bump elsewhere could silently break your build.

Exit code 0 when clean, 1 when something was found — safe to use in CI. A ready-to-use workflow is included at .github/workflows/depsweep.yml.

How it works

depsweep walks your source tree (.js, .jsx, .ts, .tsx, .mjs, .cjs, .vue, skipping node_modules, dist, build, etc.), extracts every import / require() / dynamic import() specifier, and resolves each one to a package name. It then compares that set against dependencies + devDependencies in package.json.

Node builtins (fs, path, http, ...) are always excluded from "missing." A short list of packages that are almost always used indirectly rather than imported — typescript, eslint, webpack, jest, and similar build/lint/test tooling — is excluded from "unused" by default, since flagging those is nearly always a false positive.

False positives — read this before deleting anything

Static analysis can't see everything:

  • A package loaded by string reference in a config file (an ESLint plugin name, a Babel preset, a Webpack loader) won't show up as "used," even though removing it would break your build. depsweep flags it as unused; that doesn't mean it's safe to remove without checking your config files first.
  • A package only referenced in a script under "scripts" in package.json (a CLI tool) also won't be detected as used in source.
  • Type-only packages (@types/*) are generally not imported in runtime code and will often show as unused — that's expected for most of them.

Treat depsweep's output as a prioritized list to review, not an automatic deletion list.

Why this exists

Most dependency-checking tools either require a config file before they'll run, or come bundled inside a much larger linting suite. depsweep is one small, standalone tool that does this one job with zero setup — point it at a project and read the output.

Built by Cybergeon Technologies.

License

MIT © Cybergeon Technologies — see LICENSE.