UNPKG

2.21 kBTypeScriptView Raw
1import { Options } from 'prettier';
2import { OptimizeOptions } from 'svgo';
3import { Options as Options$1 } from '@svgr/babel-preset';
4import { TransformOptions } from '@babel/core';
5
6interface State {
7 filePath?: string;
8 componentName: string;
9 caller?: {
10 name?: string;
11 previousExport?: string | null;
12 defaultPlugins?: ConfigPlugin[];
13 };
14}
15
16interface Plugin {
17 (code: string, config: Config, state: State): string;
18}
19declare type ConfigPlugin = string | Plugin;
20
21interface Config {
22 ref?: boolean;
23 titleProp?: boolean;
24 expandProps?: boolean | 'start' | 'end';
25 dimensions?: boolean;
26 icon?: boolean | string | number;
27 native?: boolean;
28 svgProps?: {
29 [key: string]: string;
30 };
31 replaceAttrValues?: {
32 [key: string]: string;
33 };
34 runtimeConfig?: boolean;
35 typescript?: boolean;
36 prettier?: boolean;
37 prettierConfig?: Options;
38 svgo?: boolean;
39 svgoConfig?: OptimizeOptions;
40 configFile?: string;
41 template?: Options$1['template'];
42 memo?: boolean;
43 exportType?: 'named' | 'default';
44 namedExport?: string;
45 jsxRuntime?: 'classic' | 'classic-preact' | 'automatic';
46 index?: boolean;
47 plugins?: ConfigPlugin[];
48 jsx?: {
49 babelConfig?: TransformOptions;
50 };
51}
52declare const DEFAULT_CONFIG: Config;
53declare const resolveConfig: {
54 (searchFrom?: string | undefined, configFile?: string | undefined): Promise<Config | null>;
55 sync(searchFrom?: string | undefined, configFile?: string | undefined): Config | null;
56};
57declare const resolveConfigFile: {
58 (filePath: string): Promise<string | null>;
59 sync(filePath: string): string | null;
60};
61declare const loadConfig: {
62 ({ configFile, ...baseConfig }: Config, state?: Pick<State, 'filePath'>): Promise<Config>;
63 sync({ configFile, ...baseConfig }: Config, state?: Pick<State, 'filePath'>): Config;
64};
65
66declare const transform: {
67 (code: string, config?: Config, state?: Partial<State>): Promise<string>;
68 sync(code: string, config?: Config, state?: Partial<State>): string;
69};
70
71export { Config, ConfigPlugin, DEFAULT_CONFIG, Plugin, State, loadConfig, resolveConfig, resolveConfigFile, transform };