UNPKG

@stacksjs/dtsx

Version:

A modern, fast .d.ts generation tool, powered by Bun.

67 lines (66 loc) 1.68 kB
import type { DtsGenerationConfig, GenerationStats } from '../types'; /** * Factory function for creating webpack plugin */ export declare function dtsxWebpack(options?: WebpackPluginOptions): DtsxWebpackPlugin; /** * Alias matching common naming convention */ export declare const dts: typeof dtsxWebpack; /** * webpack plugin options */ export declare interface WebpackPluginOptions extends Partial<DtsGenerationConfig> { onCompile?: boolean afterEmit?: boolean onWatchRun?: boolean onGenerated?: (stats: GenerationStats) => void onError?: (error: Error) => void } /** * webpack compiler interface (minimal type) */ declare interface WebpackCompiler { hooks: { compile: { tap: (name: string, callback: () => void) => void } afterEmit: { tapAsync: (name: string, callback: (compilation: unknown, done: () => void) => void) => void } watchRun: { tapAsync: (name: string, callback: (compiler: unknown, done: () => void) => void) => void } } options: { entry?: unknown output?: { path?: string } context?: string } } /** * webpack plugin for dtsx * * @example * ```ts * // webpack.config.js * const { DtsxWebpackPlugin } = require('@stacksjs/dtsx/plugins/webpack') * * module.exports = { * entry: './src/index.ts', * output: { * path: path.resolve(__dirname, 'dist'), * }, * plugins: [ * new DtsxWebpackPlugin({ * root: './src', * outdir: './dist', * }), * ], * } * ``` */ export declare class DtsxWebpackPlugin { constructor(options?: WebpackPluginOptions); apply(compiler: WebpackCompiler): void; } /** * Default export */ export default DtsxWebpackPlugin;