(sourcePath: string)
| 229 | } |
| 230 | |
| 231 | export async function readJavaScript(sourcePath: string): Promise<string> { |
| 232 | const source = await readFile(sourcePath, "utf-8"); |
| 233 | switch (extname(sourcePath)) { |
| 234 | case ".ts": |
| 235 | return transformJavaScript(source, "ts", sourcePath); |
| 236 | case ".jsx": |
| 237 | return transformJavaScript(source, "jsx", sourcePath); |
| 238 | case ".tsx": |
| 239 | return transformJavaScript(source, "tsx", sourcePath); |
| 240 | } |
| 241 | return source; |
| 242 | } |
| 243 | |
| 244 | export function readJavaScriptSync(sourcePath: string): string { |
| 245 | const source = readFileSync(sourcePath, "utf-8"); |
no test coverage detected