Make `GenJSFiles` flexible enough to handle VirtualFiles

This means not-NPEing due to their lack of physical existence, and properly writing to `baseDir` when it is a VirtualDirectory rather than dumping all its output inconveniently on the filesystem.
Merge pull request #295 from lihaoyi/master

Make `GenJSFiles` flexible enough to handle VirtualFiles