shtylman/node-browser-resolve — pull request #23 by jaredhanson (2013-06-08 21:05:17+00:00)
Title: Allow browser replacement with directory and pass package option through.

This patch allows browser replacements to point to directories, such as:

```
"browser": {
"module-a": "./shims/module-a/",
}
```

When this occurs, rather than returning immediately, the normal resolution procedure kicks in, allowing any `package.json` files in the directory to be processed. This makes it easy to shim entire modules with entire browser-replacement modules, rather than trying to pick off files internal to the module itself.

This also adds an `opts.package` option, allowing metadata from the loading package to be passed through to `node-resolve`.

NOTE: this depends on the pull request here, which adds `opts.package` to `node-resolve` itself.

https://github.com/substack/node-resolve/pull/21

This is ultimately in service to the following two issues:

substack/module-deps#7
substack/module-deps#13

I have a remaining patch to `module-deps` to finalize, which allows package metadata (including any browserify transforms) to survive the resolution process and be applied correctly.