📚 Subject area/topic
astro/assets module
📋 Page(s) affected (or suggested, for new content)
https://docs.astro.build/en/reference/modules/astro-assets/
📋 Description of content that is out-of-date or incorrect
I spotted two documentation issues related to assets, but I don't know yet if we should fix docs or the codebase.
1. Background prop on <Image /> https://docs.astro.build/en/reference/modules/astro-assets/#background
withastro/astro#15153 introduced a background property to control the background color used when images (e.g. png) are flattened. Using our docs code snippet we get a TypeScript error:
Type '{ src: ImageMetadata; alt: string; format: "jpeg"; background: string; }' is not assignable to type 'IntrinsicAttributes & Props'.
Property 'background' does not exist on type 'IntrinsicAttributes & Props'.ts(2322)
Despite that, this works because <Image /> uses getImage() under the hood. But is this the intended usage? I mean, looking at the implementation PR, <Image /> were never mentioned before we update the changeset. And, currently background is only set on ImageTransform.
So, should we add background as valid prop for <Image /> (in the core repo) or should we fix the docs?
Either way, we'll need to update the docs to add ImageTransform.background in https://docs.astro.build/en/reference/modules/astro-assets/#imagetransform
2. Images utilities https://docs.astro.build/en/reference/modules/astro-assets/#imports-from-astroassetsutils
This is a v6 breaking change and the upgrade guide doesn't mention it! Actually, this is even worse: we recommend using emitImageMetadata instead of emitEsmImage but this helper is no longer available, see https://docs.astro.build/en/guides/upgrade-to/v6/#removed-emitesmimage.
Is the breaking change intentional? Those were documented in the Image Service API before moving to that page (see #11158 and #11194).
If this is intentional, we should we remove them from the docs and update the v6 upgrade guide to mention the removal. Otherwise, we'll have to add them back in the core repo.
🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)
For the background issue:
https://stackblitz.com/edit/astro-image-background-prop?file=src%2Fcomponents%2FMyComponent.astro&on=stackblitz
Run astro check or download the repro locally to see the TypeScript error in your editor.
📚 Subject area/topic
astro/assets module
📋 Page(s) affected (or suggested, for new content)
https://docs.astro.build/en/reference/modules/astro-assets/
📋 Description of content that is out-of-date or incorrect
I spotted two documentation issues related to assets, but I don't know yet if we should fix docs or the codebase.
1. Background prop on
<Image />https://docs.astro.build/en/reference/modules/astro-assets/#backgroundwithastro/astro#15153 introduced a
backgroundproperty to control the background color used when images (e.g. png) are flattened. Using our docs code snippet we get a TypeScript error:Despite that, this works because
<Image />usesgetImage()under the hood. But is this the intended usage? I mean, looking at the implementation PR,<Image />were never mentioned before we update the changeset. And, currentlybackgroundis only set onImageTransform.So, should we add
backgroundas valid prop for<Image />(in the core repo) or should we fix the docs?Either way, we'll need to update the docs to add
ImageTransform.backgroundin https://docs.astro.build/en/reference/modules/astro-assets/#imagetransform2. Images utilities https://docs.astro.build/en/reference/modules/astro-assets/#imports-from-astroassetsutils
matchHostname,matchPathname,matchPort, andmatchProtocolwere removed in fix(astro): remove unused re-exports causing Vite build warning astro#16197emitImageMetadata,propsToFilename, andhashTransformwere removed in https://github.com/withastro/astro/pull/14306/changes#diff-d48e632552d390dcbbb96a1bd4d7989897c469b75379973c0d721815fd00c7d8Then,
propsToFilenameandhashTransformwere added toastro/assetsin fix: update Cloudflare adapter's default image service astro#15435This is a v6 breaking change and the upgrade guide doesn't mention it! Actually, this is even worse: we recommend using
emitImageMetadatainstead ofemitEsmImagebut this helper is no longer available, see https://docs.astro.build/en/guides/upgrade-to/v6/#removed-emitesmimage.Is the breaking change intentional? Those were documented in the Image Service API before moving to that page (see #11158 and #11194).
If this is intentional, we should we remove them from the docs and update the v6 upgrade guide to mention the removal. Otherwise, we'll have to add them back in the core repo.
🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)
For the
backgroundissue:https://stackblitz.com/edit/astro-image-background-prop?file=src%2Fcomponents%2FMyComponent.astro&on=stackblitz
Run
astro checkor download the repro locally to see the TypeScript error in your editor.