🐎 Load 6to5 version directly from package.json

This prevents the entire library from being required just to check the
cache so when 6to5 is being used and all files are cached it should shave
~250ms off startup.
This commit is contained in:
Kevin Sawicki 2015-02-03 13:36:26 -08:00
parent a788a7e9b7
commit 47bd093d68

View File

@ -95,9 +95,9 @@ getCachePath = (sourceCode) ->
digest = crypto.createHash('sha1').update(sourceCode, 'utf8').digest('hex')
unless jsCacheDir?
to5 ?= require '6to5-core'
to5Version = require('6to5-core/package.json').version
cacheDir = path.join(fs.absolute('~/.atom'), 'compile-cache')
jsCacheDir = path.join(cacheDir, 'js', '6to5', create6to5VersionAndOptionsDigest(to5.version, defaultOptions))
jsCacheDir = path.join(cacheDir, 'js', '6to5', create6to5VersionAndOptionsDigest(to5Version, defaultOptions))
path.join(jsCacheDir, "#{digest}.js")