11import {
2- Node ,
32 GatsbyCache ,
43 Reporter ,
54 ParentSpanPluginArgs ,
@@ -12,7 +11,7 @@ import fs from "fs-extra"
1211import path from "path"
1312import { ImageProps , SharpProps } from "../utils"
1413import { watchImage } from "./watcher"
15- import { createRemoteFileNode } from "gatsby-source-filesystem"
14+ import { createRemoteFileNode , FileSystemNode } from "gatsby-source-filesystem"
1615
1716const supportedTypes = new Set ( [ `image/png` , `image/jpeg` , `image/webp` ] )
1817export interface IImageMetadata {
@@ -30,11 +29,11 @@ export async function createImageNode({
3029 fullPath : string
3130 createNodeId : ParentSpanPluginArgs [ "createNodeId" ]
3231 createNode : Actions [ "createNode" ]
33- } ) : Promise < Node | undefined > {
32+ } ) : Promise < FileSystemNode | undefined > {
3433 if ( ! fs . existsSync ( fullPath ) ) {
3534 return undefined
3635 }
37- const file : Node = await createFileNode ( fullPath , createNodeId , { } )
36+ const file : FileSystemNode = await createFileNode ( fullPath , createNodeId , { } )
3837
3938 if ( ! file ) {
4039 return undefined
@@ -73,7 +72,7 @@ export async function writeImages({
7372} ) : Promise < void > {
7473 const promises = [ ...images . entries ( ) ] . map (
7574 async ( [ hash , { src, ...args } ] ) => {
76- let file : Node | undefined
75+ let file : FileSystemNode | undefined
7776 let fullPath
7877 if ( process . env . GATSBY_EXPERIMENTAL_REMOTE_IMAGES && isRemoteURL ( src ) ) {
7978 try {
@@ -155,7 +154,7 @@ export async function writeImages({
155154}
156155
157156export async function writeImage (
158- file : Node ,
157+ file : FileSystemNode ,
159158 args : SharpProps ,
160159 pathPrefix : string ,
161160 reporter : Reporter ,
@@ -176,9 +175,9 @@ export async function writeImage(
176175 // Write the image properties to the cache
177176 await fs . writeJSON ( filename , sharpData )
178177 } else {
179- reporter . warn ( `Could not process image` )
178+ reporter . warn ( `Could not process image ${ file . relativePath } ` )
180179 }
181180 } catch ( e ) {
182- reporter . warn ( `Error processing image` )
181+ reporter . warn ( `Error processing image ${ file . relativePath } . \n ${ e . message } ` )
183182 }
184183}
0 commit comments