Commit c72089e5 by kzc Committed by Marijn Haverbeke

add buble version and options to register.js cache hash (#152)

parent 5292fe36
Pipeline #5400073 passed with stage
in 2 minutes 46 seconds
Showing with 4 additions and 0 deletions
......@@ -43,11 +43,15 @@ if ( home ) {
fs.writeFileSync( path.join( home, '.buble-cache/README.txt' ), 'These files enable a faster startup when using buble/register. You can safely delete this folder at any time. See https://buble.surge.sh/guide/ for more information.' );
}
var optionsStringified = JSON.stringify( options );
require.extensions[ '.js' ] = function ( m, filename ) {
if ( nodeModulesPattern.test( filename ) ) return original( m, filename );
var source = fs.readFileSync( filename, 'utf-8' );
var hash = crypto.createHash( 'sha256' );
hash.update( buble.VERSION );
hash.update( optionsStringified );
hash.update( source );
var key = hash.digest( 'hex' ) + '.json';
var cachepath = path.join( cachedir, key );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment