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: {
|
optimizeDeps: {
|
||||||
include: [
|
include: [
|
||||||
'image-size',
|
'image-size',
|
||||||
|
'@squoosh/lib',
|
||||||
resolvedOptions.serviceEntryPoint === '@astrojs/image/sharp' && 'sharp',
|
resolvedOptions.serviceEntryPoint === '@astrojs/image/sharp' && 'sharp',
|
||||||
resolvedOptions.serviceEntryPoint === '@astrojs/image/squoosh' && '@squoosh/lib',
|
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
},
|
},
|
||||||
ssr: {
|
ssr: {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/// <reference types="astro/astro-jsx" />
|
/// <reference types="astro/astro-jsx" />
|
||||||
import type { ImageService, OutputFormat, TransformOptions } from '../loaders/index.js';
|
import type { ImageService, OutputFormat, TransformOptions } from '../loaders/index.js';
|
||||||
import { isSSRService, parseAspectRatio } 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 { isRemoteImage } from '../utils/paths.js';
|
||||||
import type { ImageMetadata } from '../vite-plugin-astro-image.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';
|
import { isRemoteImage } from '../utils/paths.js';
|
||||||
|
|
||||||
class SquooshService extends BaseSSRService {
|
class SquooshService extends BaseSSRService {
|
||||||
/**
|
#imagePool = new ImagePool();
|
||||||
* Squoosh doesn't support multithreading when transforming to AVIF files.
|
|
||||||
*
|
|
||||||
* https://github.com/GoogleChromeLabs/squoosh/issues/1111
|
|
||||||
*/
|
|
||||||
#imagePool = new ImagePool(1);
|
|
||||||
|
|
||||||
async processAvif(image: any, transform: TransformOptions) {
|
async processAvif(image: any, transform: TransformOptions) {
|
||||||
const encodeOptions = transform.quality
|
const encodeOptions = transform.quality
|
||||||
|
|
|
@ -8,7 +8,7 @@ import slash from 'slash';
|
||||||
import type { Plugin, ResolvedConfig } from 'vite';
|
import type { Plugin, ResolvedConfig } from 'vite';
|
||||||
import type { IntegrationOptions } from './index.js';
|
import type { IntegrationOptions } from './index.js';
|
||||||
import type { InputFormat } from './loaders/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';
|
import { metadata } from './utils/metadata.js';
|
||||||
|
|
||||||
export interface ImageMetadata {
|
export interface ImageMetadata {
|
||||||
|
|
|
@ -17188,7 +17188,6 @@ packages:
|
||||||
|
|
||||||
/wasm-feature-detect/1.2.11:
|
/wasm-feature-detect/1.2.11:
|
||||||
resolution: {integrity: sha512-HUqwaodrQGaZgz1lZaNioIkog9tkeEJjrM3eq4aUL04whXOVDRc/o2EGb/8kV0QX411iAYWEqq7fMBmJ6dKS6w==}
|
resolution: {integrity: sha512-HUqwaodrQGaZgz1lZaNioIkog9tkeEJjrM3eq4aUL04whXOVDRc/o2EGb/8kV0QX411iAYWEqq7fMBmJ6dKS6w==}
|
||||||
dev: false
|
|
||||||
|
|
||||||
/wcwidth/1.0.1:
|
/wcwidth/1.0.1:
|
||||||
resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==}
|
resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==}
|
||||||
|
|
Loading…
Reference in a new issue