function getPlaceholderUrlFromMediaItemNode(node, pluginOptions) {
  let placeholderSizeByWidth
  let placeholderSizeByName

  node.mediaDetails?.sizes?.forEach(size => {
    if (
      size.name ===
      (pluginOptions?.type?.MediaItem?.placeholderSizeName ||
        `gatsby-image-placeholder`)
    ) {
      placeholderSizeByName = size
    } else if (Number(size.width) <= 20) {
      placeholderSizeByWidth = size
    }
  })

  const placeHolderSize = placeholderSizeByName || placeholderSizeByWidth

  return placeHolderSize?.sourceUrl
}
Takes in a MediaItem node from WPGraphQL as well as Gatsby plugin options and returns the correct placeholder URL for GatsbyImage

The user must set the placeholderSizeName plugin option, or otherwise create an image size in WP where the name is `gatsby-image-placeholder`