ariya/phantomjs — pull request #11972 by alxarch (2014-02-11 20:26:22+00:00)
Title: Adds require.resolve() functionality for better combatibility with node modules.

The ability to know the filename that will be resolved by require comes in handy in many cases.

One example would be to use the resolved filename with `page.injectJs()` for injection of modules installed via `npm`.

```sh
npm install jquery
```

```js
// In a module:
page.injectJs(require.resolve("jquery"));
```

As things stand now, i use the `module._getFilename()` method to achieve the same.
Adding it to `resolve` would make it easier to have code that runs both on node and phantomjs.

See http://nodejs.org/api/modules.html#modules_all_together for examples in nodejs.