If a user explicitly defines an XDG_CACHE_HOME, it should be used. This is already the case on posix systems:
function posix (id) {
const cacheHome = process.env.XDG_CACHE_HOME || path.join(os.homedir(), '.cache')
return path.join(cacheHome, id)
}
It would make sense to do the same on darwin/macOS:
function darwin (id) {
const cacheHome = process.env.XDG_CACHE_HOME || path.join(os.homedir(), 'Library', 'Caches')
return path.join(cacheHome, id)
}