(
jsDocMarker: string,
generate: (program: ts.Program, classDeclaration: ts.ClassDeclaration) => ts.SourceFile
)
| 82 | } |
| 83 | |
| 84 | export default function createEmitter( |
| 85 | jsDocMarker: string, |
| 86 | generate: (program: ts.Program, classDeclaration: ts.ClassDeclaration) => ts.SourceFile |
| 87 | ) { |
| 88 | function scanSourceFile(program: ts.Program, sourceFile: ts.SourceFile) { |
| 89 | for (const stmt of sourceFile.statements) { |
| 90 | if (ts.isClassDeclaration(stmt) && ts.getJSDocTags(stmt).some(t => t.tagName.text === jsDocMarker)) { |
| 91 | generateClass(program, stmt, generate); |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | return function emit(program: ts.Program, _diagnostics: ts.Diagnostic[]) { |
| 97 | for (const file of program.getRootFileNames()) { |
| 98 | scanSourceFile(program, program.getSourceFile(file)!); |
| 99 | } |
| 100 | }; |
| 101 | } |
no test coverage detected