Implements the node.js require.resolve() algorithm