substack/node-resolve — pull request #21 by jaredhanson (2013-06-08 18:50:06+00:00)
Title: Supply package from which module was resolved to callback.

This patch will adds an `opts.package` options, which the caller sets to the package metadata of the package which the module is being resolved from. The callback takes a third (optional) argument which is the package metadata of the package from which the resolved module was found in.

For modules in the same package, this will be identical to the `opts.package` option passed in. If the module was loaded from a different package, it will be different, obviously.

This is part of a larger set of forthcoming patches that is ultimately designed to address the following issues:

https://github.com/substack/module-deps/issues/7
https://github.com/substack/module-deps/issues/13

Also, I only implemented this for the async resolve. It didn't seem useful to return an array from the sync resolve just to pass an optional package, and `browser-resolve` and `module-deps` don't use the sync version anyway.

I will update this PR with the other relevant PRs as I submit them. Cheers!