UNPKG

2.32 kBTypeScriptView Raw
1import { Options } from 'prettier';
2import { Config as Config$1 } 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}
19type ConfigPlugin = string | Plugin;
20
21interface Config {
22 ref?: boolean;
23 titleProp?: boolean;
24 descProp?: boolean;
25 expandProps?: boolean | 'start' | 'end';
26 dimensions?: boolean;
27 icon?: boolean | string | number;
28 native?: boolean;
29 svgProps?: {
30 [key: string]: string;
31 };
32 replaceAttrValues?: {
33 [key: string]: string;
34 };
35 runtimeConfig?: boolean;
36 typescript?: boolean;
37 prettier?: boolean;
38 prettierConfig?: Options;
39 svgo?: boolean;
40 svgoConfig?: Config$1;
41 configFile?: string;
42 template?: Options$1['template'];
43 memo?: boolean;
44 exportType?: 'named' | 'default';
45 namedExport?: string;
46 jsxRuntime?: 'classic' | 'classic-preact' | 'automatic';
47 jsxRuntimeImport?: {
48 source: string;
49 namespace?: string;
50 specifiers?: string[];
51 defaultSpecifier?: string;
52 };
53 index?: boolean;
54 plugins?: ConfigPlugin[];
55 jsx?: {
56 babelConfig?: TransformOptions;
57 };
58}
59declare const DEFAULT_CONFIG: Config;
60declare const resolveConfig: {
61 (searchFrom?: string, configFile?: string): Promise<Config | null>;
62 sync(searchFrom?: string, configFile?: string): Config | null;
63};
64declare const resolveConfigFile: {
65 (filePath: string): Promise<string | null>;
66 sync(filePath: string): string | null;
67};
68declare const loadConfig: {
69 ({ configFile, ...baseConfig }: Config, state?: Pick<State, 'filePath'>): Promise<Config>;
70 sync({ configFile, ...baseConfig }: Config, state?: Pick<State, 'filePath'>): Config;
71};
72
73declare const transform: {
74 (code: string, config?: Config, state?: Partial<State>): Promise<string>;
75 sync(code: string, config?: Config, state?: Partial<State>): string;
76};
77
78export { Config, ConfigPlugin, DEFAULT_CONFIG, Plugin, State, loadConfig, resolveConfig, resolveConfigFile, transform };