diff --git a/packages/core/src/lib/apply-transforms.ts b/packages/core/src/lib/apply-transforms.ts index 4cf6cd3a..0cb18f36 100644 --- a/packages/core/src/lib/apply-transforms.ts +++ b/packages/core/src/lib/apply-transforms.ts @@ -15,7 +15,9 @@ export async function applyTransforms(transforms: ImageTransformation[], image: image.withMetadata() } - image = transforms.reduce((img, transform) => transform(img), image) + for (const transform of transforms) { + image = await transform(image) + } return { image, diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index f67f0f42..ec137087 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -11,7 +11,7 @@ export type TransformFactory = (metadata: Partial, ctx: export type TransformOption = (metadata: Partial, image: Sharp) => T | undefined -export type ImageTransformation = (image: Sharp) => Sharp +export type ImageTransformation = (image: Sharp) => Sharp | Promise export interface TransformResult { image: Sharp,