2020-11-12 20:24:08 +01:00
|
|
|
export const VALID_LOADERS = [
|
|
|
|
'default',
|
|
|
|
'imgix',
|
|
|
|
'cloudinary',
|
|
|
|
'akamai',
|
2021-07-08 21:35:19 +02:00
|
|
|
'custom',
|
2020-11-12 20:24:08 +01:00
|
|
|
] as const
|
|
|
|
|
|
|
|
export type LoaderValue = typeof VALID_LOADERS[number]
|
|
|
|
|
2021-10-12 01:17:47 +02:00
|
|
|
type ImageFormat = 'image/avif' | 'image/webp'
|
|
|
|
|
2022-02-06 02:49:52 +01:00
|
|
|
/**
|
|
|
|
* Image configurations
|
|
|
|
*
|
|
|
|
* @see [Image configuration options](https://nextjs.org/docs/api-reference/next/image#configuration-options)
|
|
|
|
*/
|
2021-09-09 00:03:52 +02:00
|
|
|
export type ImageConfigComplete = {
|
2022-02-06 02:49:52 +01:00
|
|
|
/** @see [Device sizes documentation](https://nextjs.org/docs/api-reference/next/image#device-sizes) */
|
2020-11-12 20:24:08 +01:00
|
|
|
deviceSizes: number[]
|
2022-02-06 02:49:52 +01:00
|
|
|
|
|
|
|
/** @see [Image sizing documentation](https://nextjs.org/docs/basic-features/image-optimization#image-sizing) */
|
2020-11-12 20:24:08 +01:00
|
|
|
imageSizes: number[]
|
2022-02-06 02:49:52 +01:00
|
|
|
|
|
|
|
/** @see [Image loaders configuration](https://nextjs.org/docs/basic-features/image-optimization#loaders) */
|
2020-11-12 20:24:08 +01:00
|
|
|
loader: LoaderValue
|
2022-02-06 02:49:52 +01:00
|
|
|
|
|
|
|
/** @see [Image loader configuration](https://nextjs.org/docs/api-reference/next/image#loader-configuration) */
|
2020-11-12 20:24:08 +01:00
|
|
|
path: string
|
2022-02-06 02:49:52 +01:00
|
|
|
|
|
|
|
/** @see [Image domains configuration](https://nextjs.org/docs/basic-features/image-optimization#domains) */
|
2022-02-16 20:28:22 +01:00
|
|
|
domains: string[]
|
2022-02-06 02:49:52 +01:00
|
|
|
|
|
|
|
/** @see [Cache behavior](https://nextjs.org/docs/api-reference/next/image#caching-behavior) */
|
2022-02-16 20:28:22 +01:00
|
|
|
disableStaticImages: boolean
|
2022-02-06 02:49:52 +01:00
|
|
|
|
|
|
|
/** @see [Cache behavior](https://nextjs.org/docs/api-reference/next/image#caching-behavior) */
|
2022-02-16 20:28:22 +01:00
|
|
|
minimumCacheTTL: number
|
2022-02-06 02:49:52 +01:00
|
|
|
|
|
|
|
/** @see [Acceptable formats](https://nextjs.org/docs/api-reference/next/image#acceptable-formats) */
|
2022-02-16 20:28:22 +01:00
|
|
|
formats: ImageFormat[]
|
|
|
|
|
|
|
|
/** @see [Dangerously Allow SVG](https://nextjs.org/docs/api-reference/next/image#dangerously-allow-svg) */
|
|
|
|
dangerouslyAllowSVG: boolean
|
|
|
|
|
|
|
|
/** @see [Dangerously Allow SVG](https://nextjs.org/docs/api-reference/next/image#dangerously-allow-svg) */
|
|
|
|
contentSecurityPolicy: string
|
2020-11-12 20:24:08 +01:00
|
|
|
}
|
|
|
|
|
2021-09-09 00:03:52 +02:00
|
|
|
export type ImageConfig = Partial<ImageConfigComplete>
|
|
|
|
|
|
|
|
export const imageConfigDefault: ImageConfigComplete = {
|
2020-11-12 20:24:08 +01:00
|
|
|
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
|
|
|
|
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
|
|
|
|
path: '/_next/image',
|
|
|
|
loader: 'default',
|
|
|
|
domains: [],
|
2021-06-07 14:43:14 +02:00
|
|
|
disableStaticImages: false,
|
2021-07-15 21:55:12 +02:00
|
|
|
minimumCacheTTL: 60,
|
2021-10-22 23:08:03 +02:00
|
|
|
formats: ['image/webp'],
|
2022-02-16 20:28:22 +01:00
|
|
|
dangerouslyAllowSVG: false,
|
|
|
|
contentSecurityPolicy: `script-src 'none'; frame-src 'none'; sandbox;`,
|
2020-11-12 20:24:08 +01:00
|
|
|
}
|