From 0e6de2c31dbf8c21277481f112e99c52b913940f Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 27 Dec 2017 19:33:54 +0100 Subject: node_modules --- node_modules/ava/lib/caching-precompiler.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'node_modules/ava/lib/caching-precompiler.js') 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; -- cgit v1.2.3