--- // @ts-ignore import loader from 'virtual:image-loader'; import { getPicture } from '../src/get-picture.js'; import type { ImageAttributes, ImageMetadata, OutputFormat, PictureAttributes, TransformOptions } from '../src/types.js'; export interface LocalImageProps extends Omit, Omit, Pick { src: ImageMetadata | Promise<{ default: ImageMetadata }>; alt?: string; sizes: HTMLImageElement['sizes']; widths: number[]; formats?: OutputFormat[]; } export interface RemoteImageProps extends Omit, TransformOptions, Pick { src: string; alt?: string; sizes: HTMLImageElement['sizes']; widths: number[]; aspectRatio: TransformOptions['aspectRatio']; formats?: OutputFormat[]; } export type Props = LocalImageProps | RemoteImageProps; const { src, alt, sizes, widths, aspectRatio, formats = ['avif', 'webp'], loading = 'lazy', decoding = 'async', ...attrs } = Astro.props as Props; const { image, sources } = await getPicture({ loader, src, widths, formats, aspectRatio }); --- {sources.map(attrs => ( ))}