Replace CWD in hash function

Replace the CWD from `what` passed into hash function. Implementing
@bnkr's suggestion in issue #517. All tests pass.
Strip cwd from paths before hashing

I have altered the change proposed in issue #517 so that only strips the
cwd when it is a path passed in for hashing. Tests included.
use path.relative and this.basedir instead of replace() on the id
3.30.5
using the commondir of the files array or the dirname of the current path
3.31.0