Adds require.resolve with tests.

An up-to-date implementation #123.