substack/module-deps — pull request #39 by mantoni (2014-05-22 16:05:59+00:00)
Title: Don't flag file as not resolvable too early

After hours of tracing, I found my bug of the day!

When looking for a package, say `./lib/package.json`, the file is sometimes marked as unresolvable, even if `./package.json` exists. Whether this works on not depends on the order of `fs.readFile` yields. The `next()` implementation already flags the file as unresolvable correctly when there are no directories left to check.

Also, [this line](https://github.com/substack/module-deps/blob/master/index.js#L142) causes module-deps to return an empty object with just the `__dirname` in it, which makes browserify work in this case. However, I have a `browserify.transform` field in the `package.json` which is then not present, hence the transform is never invoked.

Maybe you have some idea on how to improve error handling in this case.