import { SUPPORTED_FORMATS } from './types'; export interface ImageSource { src: string; type: string; sizes: string; } export function generateImageSources( src: string, sizes?: string, ): ImageSource[] { const baseUrl = src.replace(/\.[^/.]+$/, ''); const sizesVal = sizes ?? '100vw'; return SUPPORTED_FORMATS.map((format) => ({ src: `${baseUrl}.${format}`, type: `image/${format}`, sizes: sizesVal, })); }