--- import { getPicture } from '../dist/index.js'; import { warnForMissingAlt } from './index.js'; import type { ImgHTMLAttributes, HTMLAttributes } from './index.js'; import type { ImageMetadata, OutputFormat, TransformOptions } from '../dist/index.js'; interface LocalImageProps extends Omit, Omit, Pick { src: ImageMetadata | Promise<{ default: ImageMetadata }>; /** Defines an alternative text description of the image. Set to an empty string (alt="") if the image is not a key part of the content (it's decoration or a tracking pixel). */ alt: string; sizes: HTMLImageElement['sizes']; widths: number[]; formats?: OutputFormat[]; } interface RemoteImageProps extends Omit, TransformOptions, Pick { src: string; /** Defines an alternative text description of the image. Set to an empty string (alt="") if the image is not a key part of the content (it's decoration or a tracking pixel). */ alt: string; sizes: HTMLImageElement['sizes']; widths: number[]; aspectRatio: TransformOptions['aspectRatio']; formats?: OutputFormat[]; background: TransformOptions['background']; } export type Props = LocalImageProps | RemoteImageProps; const { src, alt, sizes, widths, aspectRatio, background, formats = ['avif', 'webp'], loading = 'lazy', decoding = 'async', ...attrs } = Astro.props as Props; if (alt === undefined || alt === null) { warnForMissingAlt(); } const { image, sources } = await getPicture({ src, widths, formats, aspectRatio, background }); --- {sources.map((attrs) => )}