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

weasyprint-tsx

v0.1.5

Published

Write PDFs in TSX. Uses [Bun](https://bun.sh) to bundle your Preact components into HTML, then [WeasyPrint](https://weasyprint.org) to render them as PDF.

Readme

weasyprint-tsx

Write PDFs in TSX. Uses Bun to bundle your Preact components into HTML, then WeasyPrint to render them as PDF.

Requirements

Quick start

bunx @weasyprint-tsx/create my-doc
cd my-doc
bun install
bun run dev

Open http://localhost:3000 to preview the document live. The PDF is written to output.pdf on every save.

Scripts

| Script | Effect | |--------|--------| | bun run dev | Watch src/, rebuild HTML + PDF on change, serve preview at port 3000 | | bun run build | Build once and write output.pdf |

Project structure

my-doc/
├── src/
│   ├── index.tsx          # Document root — must export a default Preact component
│   └── index.css          # Styles — must begin with @import "tailwindcss"
├── weasyprint-tsx.config.ts
└── package.json

src/index.tsx must export a default component that renders a complete HTML document (<html>, <head>, <body>). WeasyPrint receives the full HTML string.

Configuration

Create or edit weasyprint-tsx.config.ts at the project root:

import type { Config } from "@weasyprint-tsx/build";

const config: Config = {
  io: { output: "report.pdf" },
  weasyprint: { path: "weasyprint", optimize_images: true },
};

export default config;

io

| Field | Default | Description | |-------|---------|-------------| | input | "src/index.tsx" | Entry point | | output | "output.pdf" | Output PDF path | | buildDir | ".build" | Intermediate HTML directory | | media_type | "print" | CSS media type passed to WeasyPrint |

weasyprint

| Field | Default | Description | |-------|---------|-------------| | path | "weasyprint" | Path to the WeasyPrint binary | | verbose | false | Print WeasyPrint stdout | | dpi | — | Output resolution | | optimize_images | — | Compress images in output | | pdf_forms | — | Enable PDF form fields | | pdf_variant | — | "pdf/a-1b", "pdf/a-2b", "pdf/a-3b", "pdf/a-4b", "pdf/ua-1" | | cache | — | WeasyPrint font/image cache folder | | full_fonts | — | Embed full font files (not just subsets) | | srgb | — | Force sRGB color profile | | jpeg_quality | — | JPEG compression quality (0–95) |

dev

| Field | Default | Description | |-------|---------|-------------| | port | 3000 | Dev server port | | watch | "src" | Directory to watch for changes |

pdf

| Field | Default | Description | |-------|---------|-------------| | stylesheets | [] | Additional CSS files passed to WeasyPrint via --stylesheet |

UI components

@weasyprint-tsx/ui provides print-optimized Preact components. See packages/ui/README.md for the full API.

import { H1, H2, Page, UL, LI, Table, Entry, Chart } from "@weasyprint-tsx/ui";