From 046c67f45805f21e43d2d4bfc69191c6d2af6372 Mon Sep 17 00:00:00 2001 From: Peter Hedenskog Date: Tue, 21 Jan 2025 14:28:48 +0100 Subject: [PATCH] Add missing fallback for missing Jimp dependencies (#2257) * Add missing fallback for missing Jimp dependencies * lint --- lib/support/images/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/support/images/index.js b/lib/support/images/index.js index 28860ed2e..aa90925ee 100644 --- a/lib/support/images/index.js +++ b/lib/support/images/index.js @@ -1,6 +1,9 @@ import path from 'node:path'; import { pathToFolder } from '../pathToFolder.js'; import { loadCustomJimp } from '../../screenshot/loadCustomJimp.js'; +import { getLogger } from '@sitespeed.io/log'; +const log = getLogger('browsertime'); + export async function savePngWithoutResize( name, data, @@ -38,6 +41,11 @@ export async function savePng( buffer, path.join(pathToFolder(url, options), dir) ); + } else { + log.info( + 'Missing Jimp dependency so you can only save images as png at viewport size' + ); + return savePngWithoutResize(name, data, url, storageManager, dir, options); } } export async function saveJpg( @@ -63,5 +71,10 @@ export async function saveJpg( buffer, path.join(pathToFolder(url, options), dir) ); + } else { + log.info( + 'Missing Jimp dependency so you can only save images as png at viewport size' + ); + return savePngWithoutResize(name, data, url, storageManager, dir, options); } }