diff options
Diffstat (limited to 'node_modules/ava/lib/caching-precompiler.js')
-rw-r--r-- | node_modules/ava/lib/caching-precompiler.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/node_modules/ava/lib/caching-precompiler.js b/node_modules/ava/lib/caching-precompiler.js index 937309bf0..f6e5e47c3 100644 --- a/node_modules/ava/lib/caching-precompiler.js +++ b/node_modules/ava/lib/caching-precompiler.js @@ -33,6 +33,7 @@ class CachingPrecompiler { this.fileHashes = {}; this.transform = this._createTransform(); } + precompileFile(filePath) { if (!this.fileHashes[filePath]) { const source = stripBomBuf(fs.readFileSync(filePath)); @@ -41,11 +42,13 @@ class CachingPrecompiler { return this.fileHashes[filePath]; } + // Conditionally called by caching-transform when precompiling is required _init() { this.babel = require('babel-core'); return this._transform; } + _transform(code, filePath, hash) { code = code.toString(); @@ -79,6 +82,7 @@ class CachingPrecompiler { return `${result.code}\n${comment}`; } + _createTransform() { const salt = packageHash.sync([ require.resolve('../package.json'), @@ -93,6 +97,7 @@ class CachingPrecompiler { ext: '.js' }); } + _generateHash(code, filePath, salt) { const hash = md5Hex([code, filePath, salt]); this.fileHashes[filePath] = hash; |