jashkenas/coffee-script — pull request #3255 by marchaefner (2013-11-24 01:08:34+00:00)
Title: CLI fixes and refactoring

* Fixes #3235 and a similar bug where some files might be unwatched.
* Fixes a whole slew of bugs I seem to have introduced with #3234 (`node -cw SOME_DIR some_file` ignoring `some_file`, initial compilation with `--join` not happening when a subdirectory contains non-source files, ...)
* Should make the code for compiling and watching less brittle and easier to understand.

This done by

* using only absolute paths (for sources and targets)
* using `path.*` functions instead of string methods
* consolidating path filtering and management of `sources`
* removing some unnecessary asynchronicity

Any mention of `path.exists*` is also being removed. It was moved to `fs` in node 0.7.1 and our `package.json` lists node >=0.8.0 as dependency.

---

Sorry for the monstrous size of this PR. The individual commits, however, should be bite-sized.

It would be extremely helpful if somebody with some time on their hands could pull the code and really try to break it. I'm somewhat limited in testing environments and mischievous imagination. Known issues (and kind of a roadmap):

* When a watched file is deleted, its source-map is not removed (while the corresponding `.js` file is).
* Windows: Deleting a watched directory results in an unhandled `EPERM`
* Paths in source-maps are sometimes more complex than they need to be.