How to automatically watch for file changes and perform a custom action inside shell?
The $25 Codekit does watch folders and files for changes and does compress/minify/combine JavaScript and CSS files. 

I know this is only a partial answer for your question, as it is not a generic watcher, but it does fit your example:


  whenever I edit a JavaScript source file to output a compressed
  version