diff options
author | 2024-01-05 22:47:00 +0800 | |
---|---|---|
committer | 2024-01-05 14:47:00 +0000 | |
commit | 5156c740506cbf6ec85c95e1663c14cbd438d75b (patch) | |
tree | c543655b8e3a1ae3a842f7b4465ae75ccee7d7d6 | |
parent | d87a97e1093ebaad8a23ef79efd02faf82f37b12 (diff) | |
download | astro-5156c740506cbf6ec85c95e1663c14cbd438d75b.tar.gz astro-5156c740506cbf6ec85c95e1663c14cbd438d75b.tar.zst astro-5156c740506cbf6ec85c95e1663c14cbd438d75b.zip |
Fix limitInputPixels type (#9622)
* Fix limitInputPixels type
* Use sharp options
-rw-r--r-- | .changeset/slow-impalas-taste.md | 5 | ||||
-rw-r--r-- | packages/astro/src/@types/astro.ts | 2 | ||||
-rw-r--r-- | packages/astro/src/assets/services/sharp.ts | 4 |
3 files changed, 8 insertions, 3 deletions
diff --git a/.changeset/slow-impalas-taste.md b/.changeset/slow-impalas-taste.md new file mode 100644 index 000000000..9825d5420 --- /dev/null +++ b/.changeset/slow-impalas-taste.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Fixes the Sharp image service `limitInputPixels` option type diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 70a11337b..f32bcefe0 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -1118,7 +1118,7 @@ export interface AstroUserConfig { * @docs * @name image.service.config.limitInputPixels * @kind h4 - * @type {boolean} + * @type {number | boolean} * @default `true` * @version 4.1.0 * @description diff --git a/packages/astro/src/assets/services/sharp.ts b/packages/astro/src/assets/services/sharp.ts index 74bf921d9..5175bfb96 100644 --- a/packages/astro/src/assets/services/sharp.ts +++ b/packages/astro/src/assets/services/sharp.ts @@ -1,4 +1,4 @@ -import type { FormatEnum } from 'sharp'; +import type { FormatEnum, SharpOptions } from 'sharp'; import { AstroError, AstroErrorData } from '../../core/errors/index.js'; import type { ImageOutputFormat, ImageQualityPreset } from '../types.js'; import { @@ -12,7 +12,7 @@ export interface SharpImageServiceConfig { /** * The `limitInputPixels` option passed to Sharp. See https://sharp.pixelplumbing.com/api-constructor for more information */ - limitInputPixels?: number; + limitInputPixels?: SharpOptions['limitInputPixels']; } let sharp: typeof import('sharp'); |