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

isolated-deps

v0.1.0

Published

Deterministically install dependencies into an isolated cache root.

Readme

optional-deps-lib

Deterministically install optional tooling dependencies into an isolated cache root instead of mutating the user's project.

optional-deps-lib is a small runtime helper for library authors who need to bootstrap optional packages on demand while keeping those installs reproducible and separate from the consumer's app.

Why this exists

  • Keeps optional tooling installs outside the user's project directory.
  • Lets the client choose exact dependency specs and versions.
  • Verifies installed packages after each install attempt instead of trusting exit codes alone.
  • Recovers from partial installs by retrying and, if needed, recreating only the isolated cache root.

Installation

npm install optional-deps-lib

How it works

  1. optional-deps-lib resolves an isolated cache directory for optional packages.
  2. It writes a small manifest with the exact specs requested by the client.
  3. It detects the active package manager (npm, pnpm, yarn, or bun).
  4. It installs the requested packages into the cache root.
  5. It re-checks resolution from the cache root before reporting success.

The default cache root is versioned so installs remain deterministic across library upgrades.

Usage

import {
  installOptionalDependencies,
  resolveOptionalInstallRoot,
  hasDependency
} from 'optional-deps-lib'

async function ensurePostcss(projectPath) {
  if (hasDependency(projectPath, 'postcss')) {
    return null
  }

  const installed = await installOptionalDependencies('PostCSS', ['[email protected]'])

  if (!installed) {
    throw new Error('Failed to install PostCSS support')
  }

  return resolveOptionalInstallRoot()
}

Supported package managers

  • npm
  • pnpm
  • yarn
  • bun

The installer also contains Windows and WSL-specific path handling so isolated installs can run in the same environment where the user launched the host tool.

Deterministic package versions

This package does not ship its own dependency catalog.

Clients are expected to pass exact dependency specs such as:

That keeps version policy with the consuming tool while this library focuses on isolated installation, package-manager execution, and verification.

API

  • installOptionalDependencies(integration, dependencySpecs, options?)
  • installOptionalDependenciesBatch(plans)
  • resolveOptionalInstallRoot()
  • resolveDevelopInstallRoot()
  • hasDependency(projectPath, dependency)

installOptionalDependencies(integration, dependencySpecs, options?)

Installs the requested exact dependency specs into the isolated cache root and verifies they can be resolved afterward.

installOptionalDependenciesBatch(plans)

Installs several integration plans in sequence and stops on the first failure.

resolveOptionalInstallRoot()

Returns the versioned isolated cache directory used for optional installs.

resolveDevelopInstallRoot()

Resolves the host extension-develop installation root when this package is used inside that runtime.

hasDependency(projectPath, dependency)

Checks whether the nearest project package.json already declares the given dependency.

Guarantees

  • Optional installs are isolated from the consumer project.
  • User project lockfiles are not modified by bootstrap installs.
  • Install success is verified via follow-up resolution checks.
  • Recovery only resets the isolated optional dependency root.

License

MIT (c) Cezar Augusto.