defunctzombie/node-browser-resolve — pull request #48 by wilsonjackson (2014-10-26 07:15:12+00:00)
Title: Implement synchronous api

To keep code duplication down, I factored out the low-hanging fruit (the `find_shims_in_package` and `build_resolve_opts` functions) but I didn't get very aggressive, so there's still a fair amount of repetition. Let me know if/what you want me to adjust.

For tests, I just followed the lead of the -coffee variants and copied the test files with a -sync suffix. Mocha's output is a bit redundant, of course, so if one test were to fail it might prove difficult to find out which one it is, but I didn't want to go ahead and wrap everything in `suite()` blocks without asking you first.

One thing the sync api can't do is return the package object, which appears to be an undocumented feature of both this module and `resolve`, so I figure it's not a big deal. Particularly since it's not returned by `resolve.sync`.

Sorry about the messy diff — the big blocks are mostly unchanged, just code extracted into functions.