-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
78 lines (67 loc) · 1.59 KB
/
index.d.ts
File metadata and controls
78 lines (67 loc) · 1.59 KB
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
/**
* Options for the compile function.
*/
export interface CompileOptions {
/**
* The JSX source code to compile.
*/
source: string;
/**
* If specified, sourcemaps are generated inline using the given string as the original
* filename.
*
* Do not set this property if you do not want sourcemaps to be generated.
*/
sourcemapFilename?: string;
/**
* The name of the `S.js` package to import.
* @default '@surplus/s'
*/
importName?: string;
/**
* Treat warnings as errors.
* @default false
*/
warningsAsErrors?: boolean;
/**
* Minify the output.
* @default false
*/
minify?: boolean;
/**
* Allow TypeScript syntax in the input.
* @default false
*/
typescript?: boolean;
}
/**
* Result of the compilation process.
*/
export interface CompileResult {
/**
* The compiled code, or null if compilation failed.
*/
code: string | null;
/**
* Array of error messages from the compilation.
*/
errors: string[];
/**
* Array of warning messages from the compilation.
*/
warnings: string[];
/**
* Joined string of all error messages, or null if no errors.
*/
readonly errorString: string | null;
/**
* Joined string of all warning messages, or null if no warnings.
*/
readonly warningString: string | null;
}
/**
* Compiles JSX source code using the Surplus compiler.
* @param options Compilation options.
* @returns The compilation result.
*/
export function compile(options: CompileOptions): CompileResult;