experimental support for multiple windows (fixes #212, fixes #170)

This commit is contained in:
Eugene Pankov
2018-08-31 15:41:28 +02:00
parent 0749096d9f
commit 4b7b692ace
25 changed files with 577 additions and 395 deletions

15
app/lib/lru.ts Normal file
View File

@@ -0,0 +1,15 @@
let lru = require('lru-cache')({ max: 256, maxAge: 250 })
let fs = require('fs')
let origLstat = fs.realpathSync.bind(fs)
// NB: The biggest offender of thrashing realpathSync is the node module system
// itself, which we can't get into via any sane means.
require('fs').realpathSync = function (p) {
let r = lru.get(p)
if (r) return r
r = origLstat(p)
lru.set(p, r)
return r
}