| import { ParserOptions, TransformOptions } from "@babel/core"; |
| import { Plugin, ResolvedConfig } from "vite"; |
|
|
| |
| interface Options { |
| include?: string | RegExp | Array<string | RegExp>; |
| exclude?: string | RegExp | Array<string | RegExp>; |
| |
| |
| |
| |
| |
| jsxImportSource?: string; |
| |
| |
| |
| |
| jsxRuntime?: 'classic' | 'automatic'; |
| |
| |
| |
| babel?: BabelOptions | ((id: string, options: { |
| ssr?: boolean; |
| }) => BabelOptions); |
| |
| |
| |
| |
| |
| |
| |
| reactRefreshHost?: string; |
| |
| |
| |
| disableOxcRecommendation?: boolean; |
| } |
| type BabelOptions = Omit<TransformOptions, 'ast' | 'filename' | 'root' | 'sourceFileName' | 'sourceMaps' | 'inputSourceMap'>; |
| |
| |
| |
| |
| interface ReactBabelOptions extends BabelOptions { |
| plugins: Extract<BabelOptions['plugins'], any[]>; |
| presets: Extract<BabelOptions['presets'], any[]>; |
| overrides: Extract<BabelOptions['overrides'], any[]>; |
| parserOpts: ParserOptions & { |
| plugins: Extract<ParserOptions['plugins'], any[]>; |
| }; |
| } |
| type ReactBabelHook = (babelConfig: ReactBabelOptions, context: ReactBabelHookContext, config: ResolvedConfig) => void; |
| type ReactBabelHookContext = { |
| ssr: boolean; |
| id: string; |
| }; |
| type ViteReactPluginApi = { |
| |
| |
| |
| reactBabel?: ReactBabelHook; |
| }; |
| declare function viteReact(opts?: Options): Plugin[]; |
| declare namespace viteReact { |
| var preambleCode: string; |
| } |
| |
| export { BabelOptions, Options, ReactBabelOptions, ViteReactPluginApi, viteReact as default }; |