import { StyleAst } from './parser/ast' ; import { StyleDefinition } from './types' ; import { assertIsReady } from './utils/async' ; export interface AlterOptions { filter ( fileName ) : boolean ; } param def param options example export const alterProjectStyles = ( def , options ) : StyleDefinition => { assertIsReady ( def ) ; return { ... def , ast : Object . keys ( def . ast ) . reduce ( ( acc , file ) => { const astFile = def . ast [ file ] ; const shouldRemove = ! options . filter || ! options . filter ( file ) ; if ( shouldRemove ) { return acc ; } acc [ file ] = astFile ; return acc ; } , { } as StyleAst ) , } ; } ;