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

qwik-llms-txt

v0.2.0

Published

Vite plugin for Qwik City that auto-generates llms.txt and llms-full.txt from SSG pages

Downloads

656

Readme

qwik-llms-txt

npm version License: MIT

Vite plugin for Qwik City that auto-generates llms.txt and llms-full.txt from your SSG pages, following the llmstxt.org standard.

What is llms.txt?

A proposed standard for websites to expose their content to LLMs in a structured way:

  • llms.txt — Index with page titles, URLs, and descriptions
  • llms-full.txt — Full content of every page in clean Markdown

Install

bun add -d qwik-llms-txt
# or
npm install -D qwik-llms-txt

Usage

Add the plugin to your Qwik City adapter's Vite config:

// adapters/static/vite.config.ts
import { qwikLlmsTxt } from "qwik-llms-txt";

export default defineConfig({
  plugins: [
    // ... other plugins
    qwikLlmsTxt({
      origin: "https://example.com",
    }),
  ],
});

After bun run build, you'll find llms.txt and llms-full.txt in your dist/ directory.

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | origin | string | required | Base URL of your site | | title | string | from index.html | Site title | | description | string | from index.html | Site description | | outDir | string | "dist" | SSG output directory | | exclude | string[] | [] | Route patterns to exclude (glob) | | include | string[] | ["/**"] | Route patterns to include (glob) | | wellKnown | boolean | false | Also generate .well-known/llms.txt | | contentSelector | string | "main, article" | CSS selector for main content | | stripSelectors | string[] | ["nav", "footer", ...] | Elements to remove before extraction | | verbose | boolean | false | Log progress to console | | sections | Record<string, SectionConfig> | {} | Per-section llms.txt generation | | dynamicRoutes | () => Promise<ParsedPage[]> | — | Inject extra pages not in dist/ |

Output Example

llms.txt

# My Qwik Site

> A modern framework for building instant web apps

## Pages

- [Home](https://example.com/): Welcome to our site
- [Blog](https://example.com/blog/): Latest articles about web development
- [About](https://example.com/about/): Learn more about our team

llms-full.txt

# My Qwik Site

> A modern framework for building instant web apps

---

## Home

URL: https://example.com/

# Welcome to My Qwik Site

This is the homepage of our **amazing** site built with Qwik.

---

## Blog

URL: https://example.com/blog/

# Blog

## Getting Started with Qwik

Qwik is a new kind of framework that delivers instant loading.

Sections

Generate a separate llms.txt (and optionally llms-full.txt) for each section of your site:

qwikLlmsTxt({
  origin: "https://example.com",
  sections: {
    "/blog/": {
      title: "Blog",
      description: "Latest articles",
    },
    "/docs/": {
      title: "Documentation",
      description: "Guides and API reference",
      fullTxt: false, // skip llms-full.txt for this section
    },
  },
})

This generates dist/blog/llms.txt, dist/blog/llms-full.txt, and dist/docs/llms.txt — each containing only pages within that prefix. The global llms.txt still includes all pages.

Dynamic Routes

Inject pages that aren't pre-rendered in dist/ (SSR routes, CMS content, etc.):

qwikLlmsTxt({
  origin: "https://example.com",
  dynamicRoutes: async () => {
    const res = await fetch("https://api.example.com/posts");
    const posts = await res.json();
    return posts.map(post => ({
      path: `/blog/${post.slug}/`,
      title: post.title,
      description: post.excerpt,
      content: post.content, // plain text or markdown
    }));
  },
})

Dynamic pages are merged with static pages. If a route exists in both, the static version wins. If dynamicRoutes throws, the build continues with static pages only.

How It Works

  1. During Vite's closeBundle, registers a process.on('beforeExit') hook
  2. Qwik's SSG runs after Vite's bundle phase, writing HTML files to dist/
  3. When the process is about to exit, the hook fires — all SSG pages exist
  4. Scans dist/ for all .html files
  5. Parses each page to extract title, description, and content
  6. Converts content HTML to clean Markdown (strips nav, footer, scripts, etc.)
  7. Writes llms.txt (index) and llms-full.txt (full content)

Programmatic Usage

You can also use generate() directly as a post-build step:

import { generate } from "qwik-llms-txt";

await generate({
  origin: "https://example.com",
  outDir: "dist",
});

Deduplication

The plugin automatically prevents multiple executions per build. Qwik's build process can trigger the beforeExit hook more than once — the plugin detects this and only runs generation once. If options change (e.g. in watch mode), it re-runs automatically.

License

MIT