source: imaps-frontend/node_modules/@vitejs/plugin-react/dist/index.d.mts

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.8 KB
Line 
1import { TransformOptions, ParserOptions } from '@babel/core';
2import { PluginOption, ResolvedConfig } from 'vite';
3
4interface Options {
5 include?: string | RegExp | Array<string | RegExp>;
6 exclude?: string | RegExp | Array<string | RegExp>;
7 /**
8 * Control where the JSX factory is imported from.
9 * https://esbuild.github.io/api/#jsx-import-source
10 * @default 'react'
11 */
12 jsxImportSource?: string;
13 /**
14 * Note: Skipping React import with classic runtime is not supported from v4
15 * @default "automatic"
16 */
17 jsxRuntime?: 'classic' | 'automatic';
18 /**
19 * Babel configuration applied in both dev and prod.
20 */
21 babel?: BabelOptions | ((id: string, options: {
22 ssr?: boolean;
23 }) => BabelOptions);
24}
25type BabelOptions = Omit<TransformOptions, 'ast' | 'filename' | 'root' | 'sourceFileName' | 'sourceMaps' | 'inputSourceMap'>;
26/**
27 * The object type used by the `options` passed to plugins with
28 * an `api.reactBabel` method.
29 */
30interface ReactBabelOptions extends BabelOptions {
31 plugins: Extract<BabelOptions['plugins'], any[]>;
32 presets: Extract<BabelOptions['presets'], any[]>;
33 overrides: Extract<BabelOptions['overrides'], any[]>;
34 parserOpts: ParserOptions & {
35 plugins: Extract<ParserOptions['plugins'], any[]>;
36 };
37}
38type ReactBabelHook = (babelConfig: ReactBabelOptions, context: ReactBabelHookContext, config: ResolvedConfig) => void;
39type ReactBabelHookContext = {
40 ssr: boolean;
41 id: string;
42};
43type ViteReactPluginApi = {
44 /**
45 * Manipulate the Babel options of `@vitejs/plugin-react`
46 */
47 reactBabel?: ReactBabelHook;
48};
49declare function viteReact(opts?: Options): PluginOption[];
50declare namespace viteReact {
51 var preambleCode: string;
52}
53
54export { type BabelOptions, type Options, type ReactBabelOptions, type ViteReactPluginApi, viteReact as default };
Note: See TracBrowser for help on using the repository browser.