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

@magnaboy/code-analysis

v0.1.1

Published

Reusable coverage, dependency consistency and source-code analysis for Node.js projects.

Readme

@magnaboy/code-analysis

Reusable coverage, dependency consistency and source-code analysis for Node.js projects.

Install

npm i -D @magnaboy/code-analysis

Requires Node 25+ and ESM.

Coverage summaries

The package reads the coverage-summary.json format emitted by Istanbul and Vitest's json-summary reporter.

import { readCoverageSummary, writeCoverageSummary } from '@magnaboy/code-analysis';

const summary = await readCoverageSummary('coverage/coverage-summary.json');
console.log(summary.total.lines.pct);

await writeCoverageSummary({
	packageRoot: process.cwd(),
	includeProvider: true
});

Paths, package names and provider notes can be overridden. Reports use stable file ordering and normalized forward-slash paths so committed summaries remain diffable across platforms.

Regression gates

import { coverageDropError, parseSummaryPercentage } from '@magnaboy/code-analysis';

const previous = parseSummaryPercentage(committedReport);
const error = previous === null ? null : coverageDropError(previous, summary.total.lines.pct, 2);

CLI

code-analysis coverage-summary . --provider

Run code-analysis coverage-summary --help for path options.

JaCoCo

collectJacocoCoverage, parseJacocoXml and writeJacocoCoverageSummary convert JaCoCo XML into the same normalized coverage model and Istanbul-compatible JSON. Source roots are explicit, so the APIs work for Java, Kotlin and mixed JVM projects without assuming an Android layout.

SCC reports

The scc APIs discover native or WSL installations, build shell-free commands, condense per-file output deterministically and write reports only when their contents change. Extensions, minimum file size and report length are configurable.

Function complexity reports

runCodeStatsCli and collectCodeStats from @magnaboy/code-analysis/code-stats include function metrics for TypeScript, TSX and Kotlin in the existing code-statistics run. No additional repository scripts are needed. The parsers ship as WebAssembly dependencies; no JVM, compiler or native parser build is required.

  • TOP-functions.txt: top 40 most complex and longest functions, separately for each language and file kind.
  • functions.txt: all parsed functions, sorted by file and source location for Git diffs.
  • function-issues.txt: syntax the parsers could not read; affected functions are omitted and the CLI warns.

Rows identify the function, module, one-based source location, declaration length and decision complexity. The score starts at 1 and adds one for each if, loop, catch, conditional expression, non-default switch case, Kotlin when condition, logical short-circuit operator or Kotlin Elvis operator. Logical assignments count; optional chaining, default parameters, scope functions and nesting depth do not. This is a versioned decision count, not Biome cognitive complexity or detekt's metric. Compare scores within one language.

Methods, accessors, local functions and lambdas have separate scores. Nested function decisions do not inflate their parent's score. Length is the inclusive declaration span, including comments, blanks and nested functions. Overloads without bodies are omitted. Names include enclosing classes/functions; locations distinguish overloads and anonymous callbacks. Source, test, generated and vendored functions have separate rankings.

The existing --check, --no-stage and default staging behavior include these reports. --since still compares the file ledger only; use git diff on the function reports for their history. Moving declarations changes their recorded locations. Parser versions appear in the headers so upgrades are visible in Git.

Workspace dependency versions

analyzePnpmWorkspaceDependencies finds inconsistent registry dependency specs across pnpm workspace packages. Workspace, catalog, file, link, Git and npm-alias specs are excluded. Analysis and text formatting are separate APIs so callers can produce their own CI output.