import * as ts from 'typescript' ; const transformerProgram = ( program ) => { const transformerFactory = context => { return sourceFile => { const visitor = ( node ) : ts . Node => { if ( ts . isImportDeclaration ( node ) && ts . isStringLiteral ( node . moduleSpecifier ) ) { const typeChecker = program . getTypeChecker ( ) ; const importSymbol = typeChecker . getSymbolAtLocation ( node . moduleSpecifier ) ; const exportSymbols = typeChecker . getExportsOfModule ( importSymbol ) ; exportSymbols . forEach ( symbol => console . log ( `found "${ symbol . escapedName }" export with value "${ symbol . valueDeclaration . getText ( ) }"` ) ) ; return node ; } return ts . visitEachChild ( node , visitor , context ) ; } ; return ts . visitNode ( sourceFile , visitor ) ; } ; } ; return transformerFactory ; } ; export default transformerProgram ;