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

@quatico/websmith-api

v0.8.5

Published

Addon API library for the websmith compiler

Readme

@quatico/websmith-api

The websmith API package provides interfaces and functionality to implement compiler addons to customize the compilation output.

Compiler addons can be used to modify the compilation artifacts before, during and after the compiled output is created. Even non-script files can be created and processed in the compilation process. Use the websmith command with an addon:

  • To generate additional configuration or documentation based on the original source code,
  • To create additional new source files and add them to the compilation process, or
  • To change module dependencies with new or modified imports/exports.

Compiler addons can also access all transpiled files as whole and reason about the entire compilation target. The standard API for TypeScript transformers is fully integrated, thus existing ts.CustomTransformers can be simply called from within an addon.

For a general introduction to websmith see the websmith github repository.

Getting started

The websmith API package is a peer dependency of the websmith compiler and provides the interfaces and functionality to implement compiler addons.

Installation

Install the API package using pnpm:

pnpm add --dev @quatico/websmith-api

Implementing compiler addons

Create an directory e.g. my-code-generator in the addons folder in your project folder and add an ECMAScript module named addon.ts:

// ./addons/component-doc-generator/addon.ts
import type { AddonContext, AddonActivator } from "@quatico/websmith-api";
import { readFileSync, writeFileSync } from "fs";

export type ComponentDocConfig = {
    apiCollectionPath: string;
};

export const activate: AddonActivator = (ctx: AddonContext<ComponentDocConfig>) => {
    // Use one of the register methods to add a generator to the compilation process.
    ctx.registerGenerator((fileName: string, content: string): void => {
        const { apiCollectionPath } = ctx.getProfileConfig();
        // Collect all TypeScript files containing foo in their filename
        if (/\/.*Component.*\\.ts$/.test(fileName)) {
            writeFileSync(apiCollectionPath, readFileSync(apiCollectionPath).toString() + `\n- ${fileName}`);
        }
    });
};

The addon.ts file must export an activate function implementing the AddonActivator interface. The AddonActivator type is a function that takes an AddonContext object as argument. You can use the AddonContext object to register a "generator", "processor", transformer" or "resultProcessor to the compilation process.

For more information on how to implement addons, see the write your own addon documentation.

Activate a compiler addon

You can activate your addon by using the --addons command line parameter when calling the websmith compiler. Add the --addons parameter to the build command in the package.json file:

// ./package.json
{
    "scripts": {
        "build": "websmith --addons component-doc-generator"
    }
}

See the compiler README for more options on how to use addons.