import type { Plugin } from "vite"; import type { ApiExtractorConfig } from "../extractor/config.js"; import type { ApiExtractor } from "../extractor/ApiExtractor.js"; /** The non-readonly properties can be modified up till Vite's configResolved hook. */ export interface ApiExtractorPluginConfig { /** * The name of the API Extractor config file to use. * Pass empty string to disable config loading. * * @default "api-extractor.config.ts" */ configFilePath?: string; /** * Override the config file. This option is discouraged - specify the options * in the config file as much as possible. The config file is read by ESLint * rules, Astro docs generator, and other tools. For consistent results, use * the same settings everywhere. * * It is safe to use this for setting .afterCreate() hook as long as you don't * mutate the api.json in it. */ unsafeConfigOverride?: ApiExtractorConfig; serve?: ApiExtractorPluginServeConfig; /** * A callback for after ApiExtractor instance is created, but before it is * used for any extraction. * * @param extractor */ afterExtractorCreated?(extractor: ApiExtractor): void; } export interface ApiExtractorPluginServeConfig { /** * Whether to run the extractor in the Vite dev server. By default, extractor * only runs during build. * * If running during server, ensure your ApiExtractorConfig settings are * serve-appropriate (like fullTypeCheck, whether dtsEmitPath is set, etc). * * @default false */ extract?: boolean; } /** * A vite plugin that runs both type checking and api-extractor. * Supports dev server, build, and build watch modes. * * @param pluginConfig */ export function useApiExtractor(pluginConfig?: ApiExtractorPluginConfig): Plugin;