UNPKG

1.22 kBTypeScriptView Raw
1import { Plugin, RollupWarning } from 'rollup';
2import { PreprocessorGroup } from 'svelte/types/compiler/preprocess';
3import { CompileOptions } from 'svelte/types/compiler/interfaces';
4
5type Arrayable<T> = T | T[];
6
7type WarningHandler = (warning: RollupWarning | string) => void;
8
9interface Options {
10 /** One or more minimatch patterns */
11 include: Arrayable<string>;
12
13 /** One or more minimatch patterns */
14 exclude: Arrayable<string>;
15
16 /**
17 * By default, all ".svelte" files are compiled
18 * @default ['.svelte']
19 */
20 extensions: string[];
21
22 /**
23 * Optionally, preprocess components with svelte.preprocess:
24 * @see https://svelte.dev/docs#svelte_preprocess
25 */
26 preprocess: Arrayable<PreprocessorGroup>;
27 // {
28 // style: ({ content }) => {
29 // return transformStyles(content);
30 // }
31 // },
32
33 /** Emit Svelte styles as virtual CSS files for other plugins to process. */
34 emitCss: boolean;
35
36 /** Options passed to `svelte.compile` method. */
37 compilerOptions: CompileOptions;
38
39 /** Custom warnings handler; defers to Rollup as default. */
40 onwarn(warning: RollupWarning, handler: WarningHandler): void;
41}
42
43export default function svelte(options?: Partial<Options>): Plugin;