forked from sveltejs/rollup-plugin-svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
60 lines (47 loc) · 1.64 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { Plugin, RollupWarning, SourceMap as Mapping } from 'rollup';
import { PreprocessorGroup } from 'svelte/types/compiler/preprocess';
import { CompileOptions } from 'svelte/types/compiler/interfaces';
type Arrayable<T> = T | T[];
type SourceMap = Omit<Mapping, 'toString' | 'toUrl'>;
type WarningHandler = (warning: RollupWarning | string) => void;
declare class CssWriter {
code: string;
filename: string;
warn: WarningHandler;
map: false | SourceMap;
write(file: string, map?: boolean): void;
emit(name: string, source: string): string;
sourcemap(file: string, sourcemap: SourceMap): void;
toString(): string;
}
type CssEmitter = (css: CssWriter) => any;
interface Options {
/** One or more minimatch patterns */
include: Arrayable<string>;
/** One or more minimatch patterns */
exclude: Arrayable<string>;
/**
* By default, all ".svelte" files are compiled
* @default ['.svelte']
*/
extensions: string[];
/**
* Optionally, preprocess components with svelte.preprocess:
* @see https://svelte.dev/docs#svelte_preprocess
*/
preprocess: Arrayable<PreprocessorGroup>;
// {
// style: ({ content }) => {
// return transformStyles(content);
// }
// },
/** Emit CSS as "files" for other plugins to process */
emitCss: boolean;
/** Extract CSS into a separate file (recommended) */
css: false | CssEmitter;
/** Options passed to `svelte.compile` method. */
compilerOptions: CompileOptions;
/** Custom warnings handler; defers to Rollup as default. */
onwarn(warning: RollupWarning, handler: WarningHandler): void;
}
export default function svelte(options?: Partial<Options>): Plugin;