forked from sveltejs/svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterfaces.ts
93 lines (77 loc) · 1.84 KB
/
interfaces.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import {SourceMap} from 'magic-string';
export interface Node {
start: number;
end: number;
type: string;
[propName: string]: any;
}
export interface Parser {
readonly template: string;
readonly filename?: string;
index: number;
stack: Array<Node>;
html: Node;
css: Node;
js: Node;
metaTags: {};
}
export interface Parsed {
hash: number;
html: Node;
css: Node;
js: Node;
}
export interface Warning {
loc?: { line: number; column: number; pos?: number };
pos?: number;
message: string;
filename?: string;
frame?: string;
toString: () => string;
}
export type ModuleFormat = 'es' | 'amd' | 'cjs' | 'iife' | 'umd' | 'eval';
export interface CompileOptions {
format?: ModuleFormat;
name?: string;
filename?: string;
generate?: string;
globals?: ((id: string) => string) | object;
amd?: {
id?: string;
};
outputFilename?: string;
cssOutputFilename?: string;
dev?: boolean;
immutable?: boolean;
shared?: boolean | string;
cascade?: boolean;
hydratable?: boolean;
legacy?: boolean;
customElement?: CustomElementOptions | true;
css?: boolean;
store?: boolean;
onerror?: (error: Error) => void;
onwarn?: (warning: Warning) => void;
}
export interface GenerateOptions {
name: string;
format: ModuleFormat;
banner?: string;
sharedPath?: string;
helpers?: { name: string, alias: string }[];
}
export interface Visitor {
enter: (node: Node) => void;
leave?: (node: Node) => void;
}
export interface CustomElementOptions {
tag?: string;
props?: string[];
}
export interface PreprocessOptions {
markup?: (options: {content: string, filename: string}) => { code: string, map?: SourceMap | string };
style?: Preprocessor;
script?: Preprocessor;
filename?: string
}
export type Preprocessor = (options: {content: string, attributes: Record<string, string | boolean>, filename?: string}) => { code: string, map?: SourceMap | string };