11import type { APIRoute , UnresolvedImageTransform } from "astro" ;
22import { getImage } from "astro:assets" ;
33
4- const faviconPngSizes = [ 192 , 384 , 512 , 1024 ] ;
4+ const iconPngSizes = [ 192 , 384 , 512 , 1024 ] ;
55
66interface Manifest {
77 name : string ;
@@ -16,8 +16,8 @@ interface Manifest {
1616}
1717
1818export interface ManifestConfig extends Omit < Manifest , "icons" > {
19- favicon : Omit < UnresolvedImageTransform , "width" | "height" > & {
20- faviconSizes ?: number [ ] ;
19+ icon : Omit < UnresolvedImageTransform , "width" | "height" > & {
20+ iconSizes ?: number [ ] ;
2121 } ;
2222}
2323
@@ -37,21 +37,22 @@ export const buildManifest: ManifestRoute =
3737 theme_color = "#000000" ,
3838 background_color = "#ffffff" ,
3939 id = name . replace ( / [ \s . ] / g, "-" ) . toLowerCase ( ) ,
40- favicon : { src, faviconSizes = faviconPngSizes , ...faviconOptions } ,
40+ icon : { src, iconSizes = iconPngSizes , ...iconOptions } ,
4141 } ) : APIRoute =>
4242 async ( ) => {
4343 const icons = await Promise . all (
44- faviconSizes . map ( async size => {
44+ iconSizes . map ( async size => {
4545 const image = await getImage ( {
4646 src,
4747 width : size ,
4848 height : size ,
49- ...faviconOptions ,
49+ ...iconOptions ,
5050 } ) ;
5151 return {
5252 src : image . src ,
5353 type : `image/${ image . options . format } ` ,
5454 sizes : `${ image . options . width } x${ image . options . height } ` ,
55+ purpose : "any" ,
5556 } ;
5657 } )
5758 ) ;
0 commit comments