import { resolve as resolvePath } from 'path' ; import watch from 'node-watch' ; export function startWatch ( sourceRoots , cb ) { const filter = ( fn ) => { return ( evt , filename ) => { if ( ! /node_modules/ . test ( filename ) && /\.sandbox.ts$/ . test ( filename ) ) { fn ( filename ) ; } } ; } ; sourceRoots . forEach ( sourceRoot => watch ( resolvePath ( sourceRoot ) , { recursive : true } , filter ( cb ) ) ) ; }