Adds require.resolve with tests.
Merge #553 r=@tcr: Adds require.resolve with tests.

An up-to-date implementation #123.