/** @babel */ /** @jsx etch.dom */ import path from 'path' import etch from 'etch' export default class CachePanelView { constructor () { etch.initialize(this) } update () {} destroy () { return etch.destroy(this) } render () { return (
Compile Cache
CoffeeScript files compiled Loading…
Babel files compiled Loading…
Typescript files compiled Loading…
CSON files compiled Loading…
Less files compiled Loading…
) } populate () { const compileCacheStats = this.getCompileCacheStats() if (compileCacheStats) { this.refs.coffeeCompileCount.classList.add('highlight-info') this.refs.coffeeCompileCount.textContent = compileCacheStats['.coffee'].misses this.refs.babelCompileCount.classList.add('highlight-info') this.refs.babelCompileCount.textContent = compileCacheStats['.js'].misses this.refs.typescriptCompileCount.classList.add('highlight-info') this.refs.typescriptCompileCount.textContent = compileCacheStats['.ts'].misses } this.refs.csonCompileCount.classList.add('highlight-info') this.refs.csonCompileCount.textContent = this.getCsonCompiles() this.refs.lessCompileCount.classList.add('highlight-info') this.refs.lessCompileCount.textContent = this.getLessCompiles() } getCompileCacheStats () { try { return require(path.join(atom.getLoadSettings().resourcePath, 'src', 'compile-cache')).getCacheStats() } catch (error) { return null } } getCsonCompiles () { try { const CSON = require(path.join(atom.getLoadSettings().resourcePath, 'node_modules', 'season')) if (CSON.getCacheMisses) { return CSON.getCacheMisses() || 0 } else { return 0 } } catch (error) { return 0 } } getLessCompiles () { const lessCache = atom.themes.lessCache if (lessCache && lessCache.cache && lessCache.cache.stats && lessCache.cache.stats.misses) { return lessCache.cache.stats.misses || 0 } else { return 0 } } }