Track dependencies

Thanks to @sdether for the initial work on this in #1252.  The API has been changed a bit and the output has been simplified a lot so it just returns an array of strings rather than a structured object.  As an additional bonus, the tests pass on windows.

[closes #1252]