import * as ts from 'typescript' ; import { FileInfo , Constants } from '../types' ; import { createModuleAst } from '../createModuleAst' ; import { printNode } from './printNode' ; import { emitFile } from './emitFile' ; export const emitModule = ( sourceFile , fileInfo , constants ) => { const fileBody = printNode ( createModuleAst ( sourceFile , fileInfo , constants ) ) ; emitFile ( fileInfo . distDir , fileInfo . distPath , fileBody ) ; } ; export function emitModules ( fileInfos , program , constants ) { fileInfos . map ( fileInfo => { const sourceFile = program . getSourceFile ( fileInfo . filePath ) ; if ( sourceFile ) { emitModule ( sourceFile , fileInfo , constants ) ; } } ) ; }