(program: ts.Program, _diagnostics: ts.Diagnostic[])
| 215 | return sourceFile; |
| 216 | }); |
| 217 | export default function emitWithIndex(program: ts.Program, _diagnostics: ts.Diagnostic[]) { |
| 218 | allJsonTypes = new Map<string, string>(); |
| 219 | |
| 220 | emit(program, _diagnostics); |
| 221 | |
| 222 | const statements = Array.from(allJsonTypes.entries()).map(type => |
| 223 | ts.factory.createExportDeclaration( |
| 224 | undefined, |
| 225 | true, |
| 226 | ts.factory.createNamedExports([ |
| 227 | ts.factory.createExportSpecifier(false, undefined, ts.factory.createIdentifier(type[0])) |
| 228 | ]), |
| 229 | ts.factory.createStringLiteral(type[1]) |
| 230 | ) |
| 231 | ); |
| 232 | |
| 233 | const sourceFile = ts.factory.createSourceFile( |
| 234 | [...statements], |
| 235 | ts.factory.createToken(ts.SyntaxKind.EndOfFileToken), |
| 236 | ts.NodeFlags.None |
| 237 | ); |
| 238 | |
| 239 | generateFile(program, sourceFile, '_jsonbarrel.ts'); |
| 240 | } |
nothing calls this directly
no test coverage detected