- Downloads
- 383.7K/ mo
- Stars
- 1.8K
- Bundle size
- 120.6 kB
- Updated
- 1h ago
Print Kubb's AST with the official TypeScript compiler.
- Resolve imports and emit exports and JSDoc.
- Rewrite import extensions with
extension. parserTsandparserTsxrun by default alongsideparserMd.
| Parser | File extensions |
|---|---|
parserTs() | .ts, .js |
parserTsx() | .tsx, .jsx |
A custom
parsers array replaces the default set. Include every parser your plugins need. Unmatched files are written as source text.Installation
Ships with kubb, no extra install.
Dependencies
- No plugin dependencies.
- Register custom parsers on
defineConfig.parsers.
Example
Override import extensions while keeping every default parser registered.
kubb.config.ts
import { defineConfig } from 'kubb/config'
import { parserTs, parserTsx } from '@kubb/parser-ts'
import { parserMd } from '@kubb/parser-md'
import { pluginTs } from '@kubb/plugin-ts'
export default defineConfig({
input: './petStore.yaml',
output: { path: './src/gen' },
parsers: [
parserTs({ extension: { '.ts': '.js' } }),
parserTsx(),
parserMd(),
],
plugins: [pluginTs()],
})