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

vike-plugin-typedoc

v0.1.0

Published

Headless TypeDoc integration for Vike docs sites — parser, navigation, and context API

Readme

vike-plugin-typedoc

Headless TypeDoc integration for Vike documentation sites.

Installation

npm install vike-plugin-typedoc

Peer dependencies:

  • vike >= 0.4.250
  • vike-react >= 0.5 (if you use the React hooks)
  • react >= 18 (if you use the React hooks)

What It Does

  • Loads TypeDoc JSON files into a cached TypedocContext.
  • Builds package and symbol URLs (default /api/:pkg/:symbol).
  • Builds API navigation trees.
  • Pre-renders markdown fields and auto-links type references.
  • Provides Vike data helpers (withApiPackage, withApiExport) and React hooks (useApiPackage, useApiExport).
  • Provides a Vike config extension that auto-loads context and prerender URLs.

Quick Start

Add the plugin extension and typedoc config:

import { join } from 'node:path';
import vikePluginTypedoc from 'vike-plugin-typedoc/config';
import vikeReact from 'vike-react/config';
import type { Config } from 'vike/types';

const root = process.cwd();

export default {
  extends: [vikeReact, vikePluginTypedoc],
  prerender: true,
  typedoc: {
    typedocDir: join(root, '.typedoc'),
    packagesDir: join(root, 'packages'),
    basePath: '/api',
  },
} satisfies Config;

The plugin expects one TypeDoc JSON file per package slug in typedocDir (for example .typedoc/devkit.json).

Package and Symbol Pages

Package route data loader:

// pages/api/@pkg/+data.ts
import { withApiPackage } from 'vike-plugin-typedoc/server';
import type { PageContextServer } from 'vike/types';

export function data(pageContext: PageContextServer) {
  return withApiPackage(pageContext, pageContext.routeParams.pkg);
}

Package route component:

// pages/api/@pkg/+Page.tsx
import { useApiPackage } from 'vike-plugin-typedoc/client';

export default function Page() {
  const { apiPackage, packageName } = useApiPackage();
  if (!apiPackage) return <h1>Package not found: {packageName}</h1>;
  return <h1>{packageName}</h1>;
}

Symbol route data loader:

// pages/api/@pkg/@symbol/+data.ts
import { withApiExport } from 'vike-plugin-typedoc/server';
import type { PageContextServer } from 'vike/types';

export function data(pageContext: PageContextServer) {
  const { pkg, symbol } = pageContext.routeParams;
  return withApiExport(pageContext, pkg, symbol);
}

Symbol route component:

// pages/api/@pkg/@symbol/+Page.tsx
import { useApiExport } from 'vike-plugin-typedoc/client';

export default function Page() {
  const { apiExport, packageName } = useApiExport();
  if (!apiExport) return <h1>Symbol not found in {packageName}</h1>;
  return <h1>{apiExport.name}</h1>;
}

typedoc Config Options

| Option | Type | Description | |--------|------|-------------| | typedocDir | string | Directory containing *.json TypeDoc output files. | | packageNames | Record<string, string> | Optional slug-to-npm-name overrides. | | packagesDir | string | Reads missing package names from <packagesDir>/<slug>/package.json. | | exclude | string[] | Package slugs to skip when loading docs. | | buildUrl | (packageSlug: string, symbolSlug?: string) => string | Custom URL builder for package and symbol pages. | | basePath | string | Prefix used by default URL builder. Defaults to /api. | | baseUrl | string | Deployment base URL used when generating HTML links. | | remarkPlugins | PluggableList | Extra remark plugins for markdown rendering. | | rehypePlugins | PluggableList | Extra rehype plugins for markdown rendering (for example syntax highlighting). |

Server and Client Entrypoints

  • vike-plugin-typedoc/server:
    • loadTypedocContext()
    • getTypedocContext()
    • withApiPackage()
    • withApiExport()
  • vike-plugin-typedoc/client:
    • useApiPackage()
    • useApiExport()

Headless Utilities (Without Vike Hooks)

Root exports are usable even outside Vike page hooks:

import {
  buildApiNavigation,
  buildMarkdownProcessor,
  buildSymbolsMap,
  combineApiDocs,
  createTypedocContext,
  parseTypedocJson,
} from 'vike-plugin-typedoc';

This is useful if you want to parse TypeDoc JSON once and feed another renderer, while reusing the same symbol-linking logic.

License

MIT