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

svelte-readme

v3.6.3

Published

Develop and demo your Svelte components in your README.md

Readme

svelte-readme

Develop and demo your Svelte components in your README.md.

Readme Driven Development

This project embraces the concept of Readme Driven Development (RDD) – or more generally, documentation driven development.

This module enables the README.md to be used for:

  • developing a Svelte component
  • demoing a Svelte component
  • documentation
    • installation
    • usage
    • API
    • metadata
      • links to Changelog, License etc.

How it works

At its core, this library is a simple Svelte preprocessor.

  1. Use the svelte entry defined in your project package.json
  2. Use README.md as the Svelte source code
  3. Parse Markdown using Markdown It
  4. Run code within svelte code fence blocks so that demos are juxtaposed with code

GitHub Markdown CSS is used for styling to maintain a consistent style with github.com.

Libraries

Usage

This library exports two methods:

  • createConfig (default export): creates a Rollup InputOptions object for you
  • preprocessReadme: standalone Svelte markup preprocessor

createConfig is tightly coupled with Rollup. At a minimum, package.json#svelte and package.json#name are required.

package.json

{
  "name": "my-svelte-component",
  "svelte": "./src/index.js",
  "main": "./lib/index.js",
  "module": "./lib/index.mjs",
  "scripts": {
    "dev": "rollup -cw",
    "build": "rollup -c",
    "prepack": "BUNDLE=true rollup -c"
  },
  "homepage": "https://github.com/metonym/svelte-readme"
}

rollup.config.js

The default export from "svelte-readme" will create a Rollup configuration used to develop and generate the demo.

import resolve from "@rollup/plugin-node-resolve";
import svelte from "rollup-plugin-svelte";
import svelteReadme from "svelte-readme";
import pkg from "./package.json";

export default () => {
  if (process.env.BUNDLE !== "true") {
    return svelteReadme();
  }

  return ["es", "umd"].map((format) => {
    const UMD = format === "umd";

    return {
      input: pkg.svelte,
      output: {
        format,
        file: UMD ? pkg.main : pkg.module,
        name: UMD ? pkg.name : undefined,
      },
      plugins: [svelte(), resolve()],
    };
  });
};

API

interface CreateConfigOptions {
  /**
   * set to `true` to minify the HTML/JS
   * @default false
   */
  minify: boolean;

  /**
   * set the folder to emit the files
   * @default "dist"
   */
  outDir: string;

  /**
   * custom CSS appended to the <style> block
   * @default ""
   */
  style: string;

  /**
   * set to `true` to omit the default GitHub styles
   * @default false
   */
  disableDefaultCSS: boolean;

  /**
   * value to prepend to relative URLs (i.e. GitHub repo URL)
   * @default undefined
   */
  prefixUrl: string;

  /**
   * `rollup-plugin-svelte` options
   * @default {}
   */
  svelte: RollupPluginSvelteOptions;

  /**
   * Rollup plugins
   * @default {[]}
   */
  plugins: Plugin[];

  /**
   * Rollup output options
   * @default {{}}
   */
  output: OutputOptions;
}

Limitations

Comments in script blocks

Single line comments in Svelte script blocks are not supported.

Use multi-line comments instead.

- let toggled; // comment
+ let toggled; /** comment */

Prior art

This project is inspired by MDsveX.

Changelog

CHANGELOG.md

License

MIT