import { HTMLTransformer } from '../languages/html.transformer' ; import { getFileType } from '../../utilities/get-file-type' ; import { AngularExternalTemplate } from '../external-resources/angular-external-resources.interfaces' ; /**
 * Angular External Templates File Transformer
 */ export class AngularExternalTemplatesFileTransformer { param externalTemplate param template public static async inlineExternalTemplate ( externalTemplate , template ) { const preparedTemplate = this . prepareTemplate ( template , getFileType ( externalTemplate . template . path ) ) ; externalTemplate . node . replaceWithText ( 'template' ) ; externalTemplate . template . node . replaceWithText ( `'${ preparedTemplate }'` ) ; } param template param fileType returns private static prepareTemplate ( template , fileType ) { switch ( fileType ) { case 'html' : return HTMLTransformer . minify ( template ) ; default : throw new Error ( `Angular Package Builder: The file type "${ fileType }" is not supported for external templates.` ) ; } } }