WIP: investigating memory leaks in Squoosh
This commit is contained in:
parent
51e4a80c3c
commit
4705a0ff1b
5 changed files with 4 additions and 10 deletions
|
@ -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: {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference types="astro/astro-jsx" />
|
||||
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';
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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==}
|
||||
|
|
Loading…
Reference in a new issue