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:
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!
Implement async support for returning package a module was resolved f…
Document package option.
Published as 0.4.0. Thanks!