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

@takazudo/zudo-doc-history-server

v4.4.3

Published

Standalone doc git-history service for zudo-doc — HTTP server + CLI batch generator. Decouples expensive `git log --follow` calls from the main build pipeline.

Readme

@takazudo/zudo-doc-history-server

Standalone package for extracting and serving git history of documentation files. Has two modes: an HTTP server for local development and a CLI generator for CI builds.

History extraction runs independently from the zfb site build so expensive git log --follow calls can be generated in a dedicated CI job.

Modes

Server mode (local development)

Runs an HTTP server that serves history on demand. Used by pnpm dev at the repository root, which starts zfb, this server, and the package dev processes concurrently via run-p.

pnpm dev -- \
  --content-dir src/content/docs \
  --locale ja:src/content/docs-ja \
  --port 4322

| Flag | Required | Default | Description | | ------------------ | -------- | ------------- | --------------------------------------------- | | --content-dir | Yes | — | Primary content directory to scan | | --locale <k>:<d> | No | — | Extra locale directory (repeatable) | | --port | No | 4322 | HTTP port | | --host | No | 127.0.0.1 | Network interface to bind (see note below) | | --max-entries | No | 50 | Max commits to include per file |

Security note — --host: The server exposes full git revision history including file content at every commit. It binds to 127.0.0.1 (loopback only) by default so it is not reachable from the LAN. The zfb dev plugin proxies /doc-history/* requests server-side, so both pnpm dev and pnpm dev:network work without LAN exposure. Pass --host 0.0.0.0 only when you have a specific reason to accept remote connections.

Endpoints

  • GET /doc-history/{slug}.json — Full history for a document
  • GET /doc-history/{locale}/{slug}.json — History for a localized document
  • GET /health — Health check

The file index is refreshed every 10 seconds so newly added or renamed files are picked up without restarting the server. All responses include CORS headers.

CLI mode (CI builds)

Generates static {slug}.json files into an output directory. Used by the build-history CI job, which runs in parallel with the zfb build-site job.

pnpm generate -- \
  --content-dir src/content/docs \
  --locale ja:src/content/docs-ja \
  --out-dir dist/doc-history

| Flag | Required | Default | Description | | ------------------ | -------- | ------- | ----------------------------------------- | | --content-dir | Yes | — | Primary content directory to scan | | --locale <k>:<d> | No | — | Extra locale directory (repeatable) | | --out-dir | Yes | — | Output directory for the generated JSONs | | --max-entries | No | 50 | Max commits to include per file |

zfb integration

In dev mode, the zfb plugin implemented at packages/zudo-doc/src/plugins/internal/doc-history/index.ts proxies /doc-history/* requests to this server. In build mode, preBuild produces the current metadata manifest; standard CI deliberately keeps SKIP_DOC_HISTORY unset so that metadata comes from the full clone. The separate build-history job generates per-page revision JSON in parallel by running this package's generate CLI directly — that CLI is unaffected by any of the env vars below and always generates when invoked. SKIP_DOC_HISTORY=1 remains an explicit escape hatch for shallow/custom builds that cannot read Git history (blanks both the preBuild manifest and the zfb plugin's own inline postBuild step); DOC_HISTORY_SKIP_POSTBUILD=1 skips only that inline postBuild step, leaving the preBuild manifest untouched.

Programmatic API

The @takazudo/zudo-doc-history-server/git-history subpath exposes the current async history path (getDocHistoryAsync), the single-pass manifest walk (getAllFilesFirstLastMetaAsync), content-file collection, repository detection, and the pure rename parsers. Server and CLI callers both await getDocHistoryAsync.

Build

pnpm build

Uses tsup to emit ESM output + DTS into dist/.

Design notes

  • Async history extraction — history walks and content reads use execFile / spawn (non-blocking). The only synchronous git call is the cached one-time repository-root probe. The CLI batch generator wraps each file in a semaphore-bounded Promise, and the server uses the same async extraction path.
  • Repo-relative paths — responses use relative file paths to avoid leaking absolute server paths.
  • --follow for renames — file history is tracked across renames with multiple fallback strategies.
  • pnpm --filter CWD — when run via pnpm --filter, the CWD is this package dir. pnpm sets INIT_CWD to the repo root, so pass repo-root-relative content paths (e.g. src/content/docs) without any ../../ prefix.