diff --git a/packages/integrations/image/src/index.ts b/packages/integrations/image/src/index.ts index f0da97f1e..d1634d172 100644 --- a/packages/integrations/image/src/index.ts +++ b/packages/integrations/image/src/index.ts @@ -47,8 +47,8 @@ export default function integration(options: IntegrationOptions = {}): AstroInte optimizeDeps: { include: [ 'image-size', + '@squoosh/lib', resolvedOptions.serviceEntryPoint === '@astrojs/image/sharp' && 'sharp', - resolvedOptions.serviceEntryPoint === '@astrojs/image/squoosh' && '@squoosh/lib', ].filter(Boolean), }, ssr: { diff --git a/packages/integrations/image/src/lib/get-image.ts b/packages/integrations/image/src/lib/get-image.ts index 15a0d91db..a28db2861 100644 --- a/packages/integrations/image/src/lib/get-image.ts +++ b/packages/integrations/image/src/lib/get-image.ts @@ -1,7 +1,7 @@ /// import type { ImageService, OutputFormat, TransformOptions } from '../loaders/index.js'; import { isSSRService, parseAspectRatio } from '../loaders/index.js'; -import sharp from '../loaders/sharp.js'; +import sharp from '../loaders/squoosh.js'; import { isRemoteImage } from '../utils/paths.js'; import type { ImageMetadata } from '../vite-plugin-astro-image.js'; diff --git a/packages/integrations/image/src/loaders/squoosh.ts b/packages/integrations/image/src/loaders/squoosh.ts index 8b3efe4e7..300b15548 100644 --- a/packages/integrations/image/src/loaders/squoosh.ts +++ b/packages/integrations/image/src/loaders/squoosh.ts @@ -8,12 +8,7 @@ import type { OutputFormat, TransformOptions } from './index.js'; import { isRemoteImage } from '../utils/paths.js'; class SquooshService extends BaseSSRService { - /** - * Squoosh doesn't support multithreading when transforming to AVIF files. - * - * https://github.com/GoogleChromeLabs/squoosh/issues/1111 - */ - #imagePool = new ImagePool(1); + #imagePool = new ImagePool(); async processAvif(image: any, transform: TransformOptions) { const encodeOptions = transform.quality diff --git a/packages/integrations/image/src/vite-plugin-astro-image.ts b/packages/integrations/image/src/vite-plugin-astro-image.ts index f19c557c3..5a43909e5 100644 --- a/packages/integrations/image/src/vite-plugin-astro-image.ts +++ b/packages/integrations/image/src/vite-plugin-astro-image.ts @@ -8,7 +8,7 @@ import slash from 'slash'; import type { Plugin, ResolvedConfig } from 'vite'; import type { IntegrationOptions } from './index.js'; import type { InputFormat } from './loaders/index.js'; -import sharp from './loaders/sharp.js'; +import sharp from './loaders/squoosh.js'; import { metadata } from './utils/metadata.js'; export interface ImageMetadata { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a221ce052..42437ad04 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17188,7 +17188,6 @@ packages: /wasm-feature-detect/1.2.11: resolution: {integrity: sha512-HUqwaodrQGaZgz1lZaNioIkog9tkeEJjrM3eq4aUL04whXOVDRc/o2EGb/8kV0QX411iAYWEqq7fMBmJ6dKS6w==} - dev: false /wcwidth/1.0.1: resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==}