(options?: api.CompilerOptions)
| 180 | } |
| 181 | |
| 182 | function getFormatDiagnosticsHost(options?: api.CompilerOptions): ts.FormatDiagnosticsHost { |
| 183 | const basePath = options ? options.basePath : undefined; |
| 184 | return { |
| 185 | getCurrentDirectory: () => basePath || ts.sys.getCurrentDirectory(), |
| 186 | // We need to normalize the path separators here because by default, TypeScript |
| 187 | // compiler hosts use posix canonical paths. In order to print consistent diagnostics, |
| 188 | // we also normalize the paths. |
| 189 | getCanonicalFileName: (fileName) => fileName.replace(/\\/g, '/'), |
| 190 | getNewLine: () => { |
| 191 | // Manually determine the proper new line string based on the passed compiler |
| 192 | // options. There is no public TypeScript function that returns the corresponding |
| 193 | // new line string. see: https://github.com/Microsoft/TypeScript/issues/29581 |
| 194 | if (options && options.newLine !== undefined) { |
| 195 | return options.newLine === ts.NewLineKind.LineFeed ? '\n' : '\r\n'; |
| 196 | } |
| 197 | return ts.sys.newLine; |
| 198 | }, |
| 199 | }; |
| 200 | } |
| 201 | |
| 202 | function reportErrorsAndExit( |
| 203 | allDiagnostics: ReadonlyArray<ts.Diagnostic>, |
no test coverage detected
searching dependent graphs…