Current Dev State

This commit is contained in:
Tim Lorsbach
2025-06-23 20:13:54 +02:00
parent b4f9bb277d
commit ded50edaa2
22617 changed files with 4345095 additions and 174 deletions

View File

@ -0,0 +1,43 @@
/**
* Modules
*/
var path = require('path')
/**
* Vars
*/
var relative = path.relative
var lastCwd = process.cwd()
var cache = {}
/**
* Expose cachedPathRelative
*/
module.exports = cachedPathRelative
/**
* cachedPathRelative
*/
function cachedPathRelative (from, to) {
// If the current working directory changes, we need
// to invalidate the cache
var cwd = process.cwd()
if (cwd !== lastCwd) {
cache = {}
lastCwd = cwd
}
if (cache[from] && cache[from][to]) return cache[from][to]
var result = relative.call(path, from, to)
cache[from] = cache[from] || {}
cache[from][to] = result
return result
}