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

pulscheck

v0.1.0

Published

Runtime race condition detection for frontend apps. One function call, four detectors, zero config.

Readme

PulsCheck

CI License npm

Runtime race condition detection for frontend apps. One function call, four detectors, zero config.

Install

npm install -D pulscheck

Setup (pick your framework)

Vite / Vite + React

// main.ts (or main.tsx)
import { devMode } from "pulscheck";

if (import.meta.env.DEV) {
  devMode();
}

Next.js (App Router)

// app/providers.tsx
"use client";
import { devMode } from "pulscheck";

if (process.env.NODE_ENV === "development") {
  devMode();
}

export function Providers({ children }: { children: React.ReactNode }) {
  return <>{children}</>;
}

Create React App / Webpack

// src/index.tsx
import { devMode } from "pulscheck";

if (process.env.NODE_ENV === "development") {
  devMode();
}

Any JS app (no framework)

import { devMode } from "pulscheck";
devMode();

That's it. Open your browser console. PulsCheck reports race conditions as they happen:

🛑 [CRITICAL] Stale response for "fetch:/api/search" resolved last — confirmed data corruption
   Pattern: response-reorder
   Requests were sent in order [...] but responses arrived as [...].
   Location: src/hooks/useSearch.ts:20
   Fix: CONFIRMED STALE: The oldest request resolved last — its data overwrote the fresh result.

What it catches

Runtime detection (4 patterns)

| Pattern | Example | Severity | |---------|---------|----------| | after-teardown | fetch completes after component unmounts | critical if the late event is a render/setState; otherwise warning | | response-reorder | slow search response overwrites fast one | critical if generation tracking confirms the stale response resolved last; otherwise warning | | double-trigger | two identical fetches fire 0.3ms apart | critical if parameters match; info if parameters differ | | dangling-async | operation started but never completed before teardown | warning |

The default reporter surfaces warning and critical findings; info findings require passing { minSeverity: "info" } to devMode().

Static analysis CLI (1 rule)

npx pulscheck scan src/

Ships a single cleanup-aware AST rule — fetch-no-abort-in-effect — that catches fetch() inside useEffect / useLayoutEffect / useInsertionEffect without an AbortController wired into cleanup. It walks nested closures and checks for a matching .abort() call in the effect's return function. The equivalent rules for setTimeout, setInterval, and addEventListener already live in @eslint-react/eslint-plugin (no-leaked-timeout, no-leaked-interval, no-leaked-event-listener), so we don't duplicate them.

Known limitation. The AST scanner does not follow calls into helper functions defined outside the effect body. The runtime detector is the authoritative path for real coverage.

React integration (optional)

Provider

import { TwProvider } from "pulscheck/react";

function App() {
  return (
    <TwProvider>
      <YourApp />
    </TwProvider>
  );
}

Scoped Effects

Drop-in useEffect replacement that tracks component lifecycle boundaries:

import { useScopedEffect } from "pulscheck/react";

function UserProfile({ id }) {
  useScopedEffect(() => {
    fetch(`/api/user/${id}`).then(r => r.json()).then(setUser);
    const interval = setInterval(pollStatus, 5000);
    return () => clearInterval(interval);
  }, [id]);
}

CI

npx pulscheck scan src/                   # text output
npx pulscheck ci src/ --fail-on critical  # SARIF + exit code

Drop straight into GitHub Actions — no wrapper action needed:

- uses: actions/checkout@v4
- uses: actions/setup-node@v4
  with:
    node-version: 20
- run: npx -y pulscheck ci src/ --fail-on critical --out pulscheck.sarif
- uses: github/codeql-action/upload-sarif@v3
  if: always()
  with:
    sarif_file: pulscheck.sarif

How it works

PulsCheck patches eight globals — fetch, setTimeout, setInterval, clearTimeout, clearInterval, addEventListener, removeEventListener, and WebSocket — using a sentinel symbol (Symbol.for("tw.patched")) to prevent double-patching across hot module replacement. Each intercepted call is recorded as a timestamped PulseEvent with its source code location, extracted from new Error().stack.

Events are stored in a ring buffer with a default capacity of 10,000 events. Four heuristic detectors run over the trace every 5,000 ms via the built-in reporter. Findings are structurally deduplicated by a fingerprint of pattern, sorted labels, and call site — so one logical bug produces one report, not one per occurrence.

Dev-only by convention. devMode() is meant to be gated behind import.meta.env.DEV or process.env.NODE_ENV === "development" at the call site. There is no automatic production stripping inside the package itself — if you call devMode() unconditionally, it will run in production.

API

Runtime

import { devMode, instrument, restore, analyze, VERSION } from "pulscheck";

| Function | Description | |----------|-------------| | devMode(opts?) | One-line activation: instruments + starts reporter | | instrument(opts?) | Patch globals, returns cleanup function | | restore() | Remove all patches | | analyze(events) | Run detectors on an event array |

React

import { TwProvider, useScopedEffect, usePulse, usePulseMount } from "pulscheck/react";

Testing

import { withPulsCheck, assertClean } from "pulscheck/testing";

withPulsCheck(fn) runs a callback inside a captured pulse trace and returns { findings, issues, trace, expectClean() }. Pass { instrument: true } to also patch fetch, timers, events, and WebSocket for the duration of the call.

CLI

pulscheck scan [dir]           # Scan for patterns
pulscheck ci [dir]             # CI mode (SARIF + exit code)
pulscheck --version

Why not React Query / SWR?

React Query and SWR prevent race conditions by managing the request lifecycle. PulsCheck detects race conditions in code that doesn't use those libraries — or in code that uses them incorrectly. If your whole app uses React Query correctly, you probably don't need PulsCheck.

License

Apache 2.0. See LICENSE.