新增调试信息

This commit is contained in:
2025-10-27 22:15:25 +08:00
parent ae62457d8c
commit 04642cb2f0
5479 changed files with 683397 additions and 3450 deletions
+43
View File
@@ -0,0 +1,43 @@
/**
* Modules
*/
var path = require('path')
/**
* Vars
*/
var relative = path.relative
var lastCwd = process.cwd()
var cache = Object.create(null)
/**
* 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 = Object.create(null)
lastCwd = cwd
}
if (cache[from] && cache[from][to]) return cache[from][to]
var result = relative.call(path, from, to)
cache[from] = cache[from] || Object.create(null)
cache[from][to] = result
return result
}