11/// <reference path="..\compiler\transformer.ts"/>
22/// <reference path="transpile.ts"/>
33namespace ts {
4- export interface TransformOptions {
5- newLine ?: NewLineKind ;
6- }
7-
84 /**
95 * Transform one or more source files using the supplied transformers.
106 * @param source A `SourceFile` or an array of `SourceFiles`.
117 * @param transformers An array of `Transformer` callbacks used to process the transformation.
128 * @param compilerOptions Optional compiler options.
139 */
14- export function transform ( source : SourceFile | SourceFile [ ] , transformers : Transformer [ ] , transformOptions ?: TransformOptions ) {
15- const compilerOptions = < CompilerOptions > transformOptions || { } ;
10+ export function transform ( source : SourceFile | SourceFile [ ] , transformers : Transformer [ ] , compilerOptions ?: CompilerOptions ) {
11+ const diagnostics : Diagnostic [ ] = [ ] ;
12+ compilerOptions = fixupCompilerOptions ( compilerOptions , diagnostics ) ;
1613 const newLine = getNewLineCharacter ( compilerOptions ) ;
1714 const sourceFiles = isArray ( source ) ? source : [ source ] ;
1815 const fileMap = arrayToMap ( sourceFiles , sourceFile => sourceFile . fileName ) ;
@@ -29,6 +26,8 @@ namespace ts {
2926 isEmitBlocked : ( ) => false ,
3027 writeFile : ( ) => Debug . fail ( "'writeFile()' is not supported during transformation." )
3128 } ;
32- return transformFiles ( /*resolver*/ undefined , emitHost , sourceFiles , transformers ) ;
29+ const result = transformFiles ( /*resolver*/ undefined , emitHost , sourceFiles , transformers ) ;
30+ result . diagnostics = concatenate ( result . diagnostics , diagnostics ) ;
31+ return result ;
3332 }
3433}
0 commit comments