import * as ts from "typescript" ; import * as tsu from "@derander/tsunami" ; export function addImportToFile ( sourceFile , namespaceAliases , moduleSpecifier , symbolName , options ) { const builder = tsu . ImportBlockBuilder . fromFile ( sourceFile ) ; if ( namespaceAliases . has ( moduleSpecifier ) ) { builder . addNamespaceSpecifier ( moduleSpecifier , namespaceAliases . get ( moduleSpecifier ) ! ) ; } else { builder . addImportBinding ( moduleSpecifier , { symbolName } ) ; } return ( new tsu . ImportEditor ( new tsu . SimpleImportBlockFormatter ( options ) ) ) . applyImportBlockToFile ( sourceFile , builder . build ( ) ) ; }