Skip to content
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

ConceptEntry pointWhat it does
PluginsdefinePluginThe main extension point. Owns file naming, the output folder, and the lifecycle hooks.
GeneratorsdefineGeneratorWalks the AST and emits files. A plugin registers one or more.
ResolverscreateResolverDecides file names and output paths. Other plugins read them by name.
RendererscreateRenderer, jsxRendererTurns the elements a generator returns into FileNodes.
AdapterscreateAdapterConverts an input spec into the universal AST every plugin reads.
ParsersdefineParserTurns a FileNode into the source string written to disk.
StoragecreateStorage, fsStorage, memoryStorageDecides where generated files land.

Other parts

PartEntry pointWhat it does
AST and node buildersastThe namespace behind factory builders, visitors, guards, macros, and printers.
DiagnosticsDiagnosticsBuilds and narrows the structured errors Kubb collects during a build.
Engine and configurationdefineConfig, createKubbThe kubb-package surface that runs your plugins.
Lifecycle hooksKubbHooksEvery kubb:* hook a build fires, its payload, and when it fires.
Testingkubb/kit/testingVitest-backed helpers for testing plugins, generators, and adapters.

See also