@stacksjs/dtsx
Version:
A modern, fast .d.ts generation tool, powered by Bun.
54 lines (53 loc) • 1.3 kB
TypeScript
import type { DtsGenerationConfig, GenerationStats } from '../types';
/**
* Create a tsup plugin for dtsx
*
* @example
* ```ts
* // tsup.config.ts
* import { dtsxPlugin } from '@stacksjs/dtsx/plugins/tsup'
* import { defineConfig } from 'tsup'
*
* export default defineConfig({
* entry: ['./src/index.ts'],
* outDir: './dist',
* plugins: [
* dtsxPlugin({
* root: './src',
* outdir: './dist',
* }),
* ],
* })
* ```
*/
export declare function dtsxPlugin(options?: TsupPluginOptions): TsupPlugin;
/**
* Alias for dtsxPlugin
*/
export declare const tsupDts: typeof dtsxPlugin;
/**
* Alias matching common naming convention
*/
export declare const dts: typeof dtsxPlugin;
/**
* tsup plugin options
*/
export declare interface TsupPluginOptions extends Partial<DtsGenerationConfig> {
onBuildStart?: boolean
onBuildEnd?: boolean
onGenerated?: (stats: GenerationStats) => void
onError?: (error: Error) => void
}
/**
* tsup plugin interface
*/
declare interface TsupPlugin {
name: string
buildStart?: () => void | Promise<void>
buildEnd?: (ctx: { writtenFiles: Array<{ name: string, size: number }> }) => void | Promise<void>
esbuildOptions?: (options: Record<string, unknown>) => void
}
/**
* Default export
*/
export default dtsxPlugin;