@@ -18,10 +18,6 @@ const Util = require("./src/util.js");
18
18
19
19
const debug = require ( "debug" ) ( "Eleventy:Image" ) ;
20
20
21
- const KEYS = {
22
- requested : "requested"
23
- } ;
24
-
25
21
const GLOBAL_OPTIONS = {
26
22
widths : [ "auto" ] ,
27
23
formats : [ "webp" , "jpeg" ] , // "png", "svg", "avif"
@@ -545,7 +541,7 @@ class Image {
545
541
let fullStats = this . getFullStats ( metadata ) ;
546
542
for ( let outputFormat in fullStats ) {
547
543
for ( let stat of fullStats [ outputFormat ] ) {
548
- if ( this . options . useCache && diskCache . isCached ( stat . outputPath , input , this . options . generatedVia !== KEYS . requested ) ) {
544
+ if ( this . options . useCache && diskCache . isCached ( stat . outputPath , input , ! Util . isRequested ( this . options . generatedVia ) ) ) {
549
545
// Cached images already exist in output
550
546
let contents ;
551
547
if ( this . options . dryRun ) {
@@ -756,7 +752,7 @@ function logProcessedMessage(eleventyConfig, src, opts) {
756
752
}
757
753
758
754
function setupLogger ( eleventyConfig , opts ) {
759
- if ( typeof eleventyConfig ?. logger ?. logWithOptions !== "function" || opts . generatedVia === KEYS . requested ) {
755
+ if ( typeof eleventyConfig ?. logger ?. logWithOptions !== "function" || Util . isRequested ( opts . generatedVia ) ) {
760
756
return ;
761
757
}
762
758
@@ -811,7 +807,7 @@ function queueImage(src, opts) {
811
807
if ( resolvedOptions . useCache ) {
812
808
// we don’t know the output format yet, but this hash is just for the in memory cache
813
809
key = img . getInMemoryCacheKey ( ) ;
814
- let cached = memCache . get ( key , ! opts . transformOnRequest && opts . generatedVia !== KEYS . requested ) ;
810
+ let cached = memCache . get ( key , ! opts . transformOnRequest && ! Util . isRequested ( opts . generatedVia ) ) ;
815
811
if ( cached ) {
816
812
return cached ;
817
813
}
@@ -884,7 +880,6 @@ module.exports.statsSync = Image.statsSync;
884
880
module . exports . statsByDimensionsSync = Image . statsByDimensionsSync ;
885
881
module . exports . getFormats = Image . getFormatsArray ;
886
882
module . exports . getWidths = Image . getValidWidths ;
887
- module . exports . keys = KEYS ;
888
883
889
884
module . exports . getHash = function getHash ( src , options ) {
890
885
let img = new Image ( src , options ) ;
0 commit comments