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

api-extractor-llms

v0.1.0

Published

Render Microsoft API Extractor models into LLM-lean markdown. Pure model loading, TSDoc extraction, type-signature formatting, and per-item markdown rendering.

Readme

api-extractor-llms

npm License: MIT Node.js TypeScript

Turn a Microsoft API Extractor .api.json model into plain markdown that reads cleanly for both people and language models. You get one markdown document per top-level export — an H1, the summary, a fenced ts signature, parameters, returns, container members and examples — with no site chrome, no HTML and no framework coupling.

Why api-extractor-llms

API Extractor already understands your .d.ts surface. What it will not do is hand you docs you can drop into a prompt, a wiki or a static site. That is the gap this package closes. The body of every rendered doc stays the same no matter where it ends up. Two things change between consumers: the frontmatter block at the top and the URL scheme for cross-links. You inject both, so one renderer feeds an RSPress site, an MCP server or a folder of bare .md files.

Install

npm install api-extractor-llms
# or
pnpm add api-extractor-llms

The package is also published to GitHub Packages as @spencerbeggs/api-extractor-llms if you prefer the scoped name; point your registry at https://npm.pkg.github.com for that scope and install it the same way.

This is an ESM-only package. Import it from a module context ("type": "module" or .mjs).

Quick start

Load a model, render it, then write each doc wherever you want. The library does no I/O of its own. File writing is yours.

import { mkdir, writeFile } from "node:fs/promises";
import { loadApiModel, renderPackage } from "api-extractor-llms";

const pkg = await loadApiModel("./temp/my-pkg.api.json");

const docs = renderPackage(pkg, {
  packageName: "my-pkg",
  routeFor: (ref) => `/api/${ref.slug}`,
});

await mkdir("./out", { recursive: true });
for (const doc of docs) {
  await writeFile(`./out/${doc.slug}.md`, doc.markdown);
}

console.log(docs.map((d) => `${d.kind}: ${d.name}`));
// e.g. [ 'function: loadApiModel', 'class: CrossLinker', 'type: RenderedDoc' ]
// (the actual list depends on your model's exports)

Each entry in the returned array is a RenderedDoc with name, kind, slug, summary, packageName and the assembled markdown.

Inject frontmatter

Pass a frontmatter function to prepend a block — YAML, TOML or whatever your target expects. Omit it for bare bodies.

const docs = renderPackage(pkg, {
  packageName: "my-pkg",
  frontmatter: (meta) => `---\ntitle: ${meta.name}\nkind: ${meta.kind}\n---\n\n`,
});

console.log(docs[0].markdown.startsWith("---"));
// true

routeFor and frontmatter are independent. Supply either, both or neither.

Features

  • loadApiModel(path) reads a .api.json file from disk and returns its ApiPackage.
  • renderPackage(pkg, opts) walks the first entry point and returns one RenderedDoc per top-level member.
  • renderItem(item, opts) renders a single API item to a markdown body, with an optional CrossLinker.
  • CrossLinker wraps known item names in prose with links, skipping code spans and existing links, using your injected route scheme.
  • TypeSignatureFormatter formats an API Extractor Excerpt into a clean type signature, wrapping long unions across lines.
  • TSDoc helpers — getSummary, getParams, getReturns, getExamples, getDeprecation, getReleaseTag, hasModifierTag and extractPlainText — pull plain data off an ApiItem with no rendering.

Generating a model

This package consumes the JSON that Microsoft API Extractor produces. Run API Extractor against your project first with docModel.enabled set in your api-extractor.json, then feed the resulting .api.json to loadApiModel.

License

MIT