@@ -50,8 +50,92 @@ export interface MemoryStream extends OutputStream {
50
50
toString ( ) : string ;
51
51
}
52
52
53
- /** Compiler API options. */
53
+ /** Compiler options. */
54
54
interface CompilerOptions {
55
+ /** Prints just the compiler's version and exits. */
56
+ version ?: boolean ;
57
+ /** Prints the help message and exits. */
58
+ help ?: boolean ;
59
+ /** Optimizes the module. */
60
+ optimize ?: boolean ;
61
+ /** How much to focus on optimizing code. */
62
+ optimizeLevel ?: number ;
63
+ /** How much to focus on shrinking code size. */
64
+ shrinkLevel ?: number ;
65
+ /** Re-optimizes until no further improvements can be made. */
66
+ converge ?: boolean ;
67
+ /** Validates the module using Binaryen. Exits if invalid. */
68
+ validate ?: boolean ;
69
+ /** Specifies the base directory of input and output files. */
70
+ baseDir ?: string ;
71
+ /** Specifies the output file. File extension indicates format. */
72
+ outFile ?: string ;
73
+ /** Specifies the binary output file (.wasm). */
74
+ binaryFile ?: string ;
75
+ /** Specifies the text output file (.wat). */
76
+ textFile ?: string ;
77
+ /** Specifies the asm.js output file (.js). */
78
+ asmjsFile ?: string ;
79
+ /** Specifies the WebIDL output file (.webidl). */
80
+ idlFile ?: string ;
81
+ /** Specifies the TypeScript definition output file (.d.ts). */
82
+ tsdFile ?: string ;
83
+ /** Enables source map generation. Optionally takes the URL. */
84
+ sourceMap ?: boolean | string ;
85
+ /** Specifies the runtime variant to include in the program. */
86
+ runtime ?: string ;
87
+ /** Disallows the use of unsafe features in user code. */
88
+ noUnsafe ?: boolean ;
89
+ /** Enables debug information in emitted binaries. */
90
+ debug ?: boolean ;
91
+ /** Replaces assertions with just their value without trapping. */
92
+ noAssert ?: boolean ;
93
+ /** Performs compilation as usual but does not emit code. */
94
+ noEmit ?: boolean ;
95
+ /** Imports the memory provided as 'env.memory'. */
96
+ importMemory ?: boolean ;
97
+ /** Declare memory as shared by settings the max shared memory. */
98
+ sharedMemory ?: number ;
99
+ /** Sets the start offset of compiler-generated static memory. */
100
+ memoryBase ?: number ;
101
+ /** Imports the function table provided as 'env.table'. */
102
+ importTable ?: boolean ;
103
+ /** Exports the function table as 'table'. */
104
+ exportTable ?: boolean ;
105
+ /** Exports an explicit start function to be called manually. */
106
+ explicitStart ?: boolean ;
107
+ /** "Adds one or multiple paths to custom library components. */
108
+ lib ?: string | string [ ] ;
109
+ /** Adds one or multiple paths to package resolution. */
110
+ path ?: string | string [ ] ;
111
+ /** Aliases a global object under another name. */
112
+ use ?: string | string [ ] ;
113
+ /** Sets the trap mode to use. */
114
+ trapMode ?: "allow" | "clamp" | "js" ;
115
+ /** Specifies additional Binaryen passes to run. */
116
+ runPasses ?: string | string [ ] ;
117
+ /** Enables WebAssembly features that are disabled by default. */
118
+ enable ?: string | string [ ] ;
119
+ /** Disables WebAssembly features that are enabled by default. */
120
+ disable ?: string | string [ ] ;
121
+ /** Specifies the path to a custom transform to 'require'. */
122
+ transform ?: string | string [ ] ;
123
+ /** Make yourself sad for no good reason. */
124
+ pedantic ?: boolean ;
125
+ /** Enables tracing of package resolution. */
126
+ traceResolution ?: boolean ;
127
+ /** Lists files to be compiled and exits. */
128
+ listFiles ?: boolean ;
129
+ /** Prints measuring information on I/O and compile times. */
130
+ measure ?: boolean ;
131
+ /** Prints the module's runtime type information to stderr. */
132
+ printrtti ?: boolean ;
133
+ /** Disables terminal colors. */
134
+ noColors ?: boolean ;
135
+ }
136
+
137
+ /** Compiler API options. */
138
+ interface APIOptions {
55
139
/** Standard output stream to use. */
56
140
stdout ?: OutputStream ;
57
141
/** Standard error stream to use. */
@@ -77,7 +161,7 @@ export function compileString(sources: { [key: string]: string } | string, optio
77
161
}
78
162
79
163
/** Runs the command line utility using the specified arguments array. */
80
- export function main ( argv : string [ ] , options : CompilerOptions , callback ?: ( err : Error | null ) => number ) : number ;
164
+ export function main ( argv : string [ ] , options : APIOptions , callback ?: ( err : Error | null ) => number ) : number ;
81
165
export function main ( argv : string [ ] , callback ?: ( err : Error | null ) => number ) : number ;
82
166
83
167
/** Checks diagnostics emitted so far for errors. */
0 commit comments