import * as TS from "typescript";
import { MaybeArray } from "helpertypes";
import { Plugin } from "rollup";
interface ExtendedDiagnostic extends TS.Diagnostic {
    scope?: string;
}
interface CustomTransformerOptions {
    program: TS.Program | undefined;
    printer: TS.Printer;
    typescript: typeof TS;
    addDiagnostics(...diagnostics: ExtendedDiagnostic[]): void;
}
type CustomTransformersFunction = (options: CustomTransformerOptions) => TS.CustomTransformers;
// A Record from chunk file names to their stats
type DeclarationStats = Record<string, DeclarationChunkStats>;
interface DeclarationChunkStats {
    // An array of the external type dependencies for a declaration chunk
    externalTypes: ExternalType[];
}
interface ExternalType {
    // The name of the external library that provides the typings. For example, "typescript" or "@types/node"
    library: string;
    // The version of the referenced external library
    version: string;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type BabelConfig = Record<string, any>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type SwcConfig = Record<string, any>;
type Transpiler = "typescript" | "babel" | "swc";
interface TranspilerOptions {
    typescriptSyntax: Transpiler;
    otherSyntax: Transpiler;
}
interface DebugTransformerData {
    kind: "transformer";
    fileName: string;
    text: string;
}
interface DebugEmitData {
    kind: "emit";
    fileName: string;
    text: string;
    fileKind: EmitPathKind;
}
interface DebugMetricsData {
    kind: "metrics";
    fileName?: string;
}
interface DebugTsconfigData {
    kind: "tsconfig";
}
type DebugData = DebugTransformerData | DebugEmitData | DebugMetricsData | DebugTsconfigData;
type DebugOptionCallback = (data: DebugData) => boolean;
interface BrowserslistPathConfig {
    path: string;
}
interface BrowserslistQueryConfig {
    query: string[] | string;
}
type BrowserslistConfig = BrowserslistPathConfig | BrowserslistQueryConfig;
interface TsConfigResolverWithFileName {
    fileName: string;
    hook(resolvedOptions: TS.CompilerOptions): TS.CompilerOptions;
}
type TsConfigResolver = TsConfigResolverWithFileName["hook"];
type OutputPathKind = "declaration" | "declarationMap" | "buildInfo";
type TranspilationPhase = "file" | "chunk";
type EmitPathKind = OutputPathKind | "javascript";
type OutputPathHook = (path: string, kind: OutputPathKind) => string | undefined;
type DiagnosticsHook = (diagnostics: readonly TS.Diagnostic[]) => readonly TS.Diagnostic[] | undefined;
type BabelConfigHook = (config: BabelConfig | undefined, fileName: string | undefined, phase: TranspilationPhase) => BabelConfig | undefined;
type SwcConfigHook = (config: SwcConfig | undefined, fileName: string | undefined, phase: TranspilationPhase) => SwcConfig | undefined;
type DeclarationStatsHook = (stats: DeclarationStats) => DeclarationStats | undefined;
interface HookRecord {
    outputPath: OutputPathHook;
    diagnostics: DiagnosticsHook;
    babelConfig: BabelConfigHook;
    swcConfig: SwcConfigHook;
    declarationStats: DeclarationStatsHook;
}
interface InputCompilerOptions extends Omit<TS.CompilerOptions, "module" | "moduleResolution" | "newLine" | "jsx" | "target"> {
    module: string;
    moduleResolution: string;
    newLine: string;
    jsx: string;
    target: string;
}
interface TypescriptPluginOptions {
    transpiler: Transpiler | TranspilerOptions;
    tsconfig?: string | Partial<TS.CompilerOptions> | Partial<InputCompilerOptions> | TS.ParsedCommandLine | TsConfigResolver | TsConfigResolverWithFileName;
    babelConfig?: string | Partial<BabelConfig>;
    swcConfig?: string | MaybeArray<Partial<SwcConfig>>;
    browserslist?: false | string[] | string | BrowserslistConfig;
    cwd: string;
    transformers?: (TS.CustomTransformers | CustomTransformersFunction)[] | TS.CustomTransformers | CustomTransformersFunction;
    include: string[] | string;
    exclude: string[] | string;
    transpileOnly?: boolean;
    fileSystem: TS.System;
    hook: Partial<HookRecord>;
    debug: boolean | DebugOptionCallback;
    typescript: typeof TS;
}
/**
 * A Rollup plugin that transpiles the given input with Typescript
 */
declare function typescriptRollupPlugin(pluginInputOptions?: Partial<TypescriptPluginOptions>): Plugin;
export { CustomTransformerOptions, CustomTransformersFunction, DeclarationStats, DeclarationChunkStats, ExternalType, typescriptRollupPlugin as default };
export type { TypescriptPluginOptions, BrowserslistConfig, BrowserslistPathConfig, BrowserslistQueryConfig };
