Kit
Kit API
The kubb/kit reference for authoring plugins, generators, resolvers, renderers, adapters, parsers, and storage backends, plus the ast namespace, Diagnostics, the engine surface, and the testing helpers.
Import authoring APIs from kubb/kit, included with the kubb package.
Big concepts
| Concept | Entry point | What it does |
|---|---|---|
| Plugins | definePlugin | The main extension point. Owns file naming, the output folder, and the lifecycle hooks. |
| Generators | defineGenerator | Walks the AST and emits files. A plugin registers one or more. |
| Resolvers | createResolver | Decides file names and output paths. Other plugins read them by name. |
| Renderers | createRenderer, jsxRenderer | Turns the elements a generator returns into FileNodes. |
| Adapters | createAdapter | Converts an input spec into the universal AST every plugin reads. |
| Parsers | defineParser | Turns a FileNode into the source string written to disk. |
| Storage | createStorage, fsStorage, memoryStorage | Decides where generated files land. |
Other parts
| Part | Entry point | What it does |
|---|---|---|
| AST and node builders | ast | The namespace behind factory builders, visitors, guards, macros, and printers. |
| Diagnostics | Diagnostics | Builds and narrows the structured errors Kubb collects during a build. |
| Engine and configuration | defineConfig, createKubb | The kubb-package surface that runs your plugins. |
| Lifecycle hooks | KubbHooks | Every kubb:* hook a build fires, its payload, and when it fires. |
| Testing | kubb/kit/testing | Vitest-backed helpers for testing plugins, generators, and adapters. |