From 44c64cf5869db64f417999021f4360244e78d578 Mon Sep 17 00:00:00 2001 From: "Jocelyn Badgley (Twipped)" <joc@twipped.com> Date: Tue, 7 Apr 2020 09:47:32 -0700 Subject: [PATCH] Fix bugs in cache with hashing and local time check --- build/cache.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build/cache.js b/build/cache.js index 9a569dd..06e4682 100644 --- a/build/cache.js +++ b/build/cache.js @@ -47,7 +47,10 @@ module.exports = exports = class Manifest { } hash ({ action, input, output, ...task }) { - if (!isFunction(action)) throw new Error('Task action is not a task action (function).'); + if (!isFunction(action)) { + console.error({ action, input, output }); + throw new Error('Task action is not a task action (function).'); + } const name = action.name; const hash = [ @@ -57,9 +60,9 @@ module.exports = exports = class Manifest { ]; // if this is an image operation, include the format and width in the hash - if (name === 'image') hash.splice(1, 0, [ task.width, task.format ]); + if (name === 'image') hash.splice(1, 0, task.width, task.format); - return hash.join('.'); + return hash.filter(Boolean).join('.'); } has (task) { @@ -103,7 +106,7 @@ module.exports = exports = class Manifest { if (!local && !cTime) { // This is a remote file and we don't have a cached copy, run it return result; - } else if (local && !iTime) { + } else if (local && !result.iTime) { // we've never seen this file before, build new return result; }