rsbuild-plugin-dts
Version:
Rsbuild plugin that supports emitting declaration files for TypeScript.
39 lines (38 loc) • 1.06 kB
TypeScript
import { type RsbuildConfig, type RsbuildPlugin } from '@rsbuild/core';
import ts from 'typescript';
export type DtsRedirect = {
path?: boolean;
extension?: boolean;
};
export type PluginDtsOptions = {
bundle?: boolean;
distPath?: string;
build?: boolean;
abortOnError?: boolean;
dtsExtension?: string;
autoExternal?: boolean | {
dependencies?: boolean;
devDependencies?: boolean;
peerDependencies?: boolean;
};
banner?: string;
footer?: string;
redirect?: DtsRedirect;
};
export type DtsEntry = {
name?: string;
path?: string;
};
export type DtsGenOptions = PluginDtsOptions & {
name: string;
cwd: string;
isWatch: boolean;
dtsEntry: DtsEntry[];
dtsEmitPath: string;
build?: boolean;
tsconfigPath: string;
tsConfigResult: ts.ParsedCommandLine;
userExternals?: NonNullable<RsbuildConfig['output']>['externals'];
};
export declare const PLUGIN_DTS_NAME = "rsbuild:dts";
export declare const pluginDts: (options?: PluginDtsOptions) => RsbuildPlugin;