substack/watchify — pull request #111 by TheAlphaNerd (2014-11-24 22:34:21+00:00)
Title: Resolve realPath prior to creating watcher (fixes #109)

Async implementation of #110

The first commit abstracts the process of creating a watcher. The second commit uses fs.realpathSync to resolve the true path of a file before registering the watcher. While this is a somewhat naive way to handle the problem (which should probably be solved in chokidar), it is an elegant way to solve the problem until they fix things on their end.

It also stops us from breaking the test suite! The latest version of chokidar causes the test suite to asplode... as does replacing chokidar with gaze (which can be used with an almost identical api). You will notice there is a check to make sure that the real path of the file is not private, this is a check that is necessary if files are living in $TMPDIR