@stacksjs/dtsx
Version:
A modern, fast .d.ts generation tool, powered by Bun.
58 lines (57 loc) • 1.14 kB
TypeScript
import type { DtsGenerationConfig, GenerationStats } from '../types';
/**
* Create a Bun build plugin for dtsx
*
* @example
* ```ts
* // build.ts
* import { dts } from '@stacksjs/dtsx/plugins/bun'
*
* await Bun.build({
* entrypoints: ['./src/index.ts'],
* outdir: './dist',
* plugins: [
* dts({
* root: './src',
* outdir: './dist',
* }),
* ],
* })
* ```
*/
export declare function dts(options?: BunPluginOptions): BunPlugin;
/**
* Alias for dts
*/
export declare const bunDts: typeof dts;
/**
* Bun plugin options
*/
export declare interface BunPluginOptions extends Partial<DtsGenerationConfig> {
preBuild?: boolean
postBuild?: boolean
onGenerated?: (stats: GenerationStats) => void
onError?: (error: Error) => void
failOnError?: boolean
}
/**
* Bun plugin interface
*/
declare interface BunPlugin {
name: string
setup: (build: BunBuild) => void | Promise<void>
}
/**
* Bun build interface (minimal type)
*/
declare interface BunBuild {
config: {
entrypoints: string[]
outdir?: string
root?: string
}
}
/**
* Default export
*/
export default dts;