defaulting to Sharp for the initial @next release

This commit is contained in:
Tony Sullivan 2022-09-12 16:26:01 -05:00
parent e6e375cceb
commit 1a8d4f7f60
3 changed files with 6 additions and 4 deletions

View file

@ -32,7 +32,7 @@ export interface IntegrationOptions {
export default function integration(options: IntegrationOptions = {}): AstroIntegration { export default function integration(options: IntegrationOptions = {}): AstroIntegration {
const resolvedOptions = { const resolvedOptions = {
serviceEntryPoint: '@astrojs/image/squoosh', serviceEntryPoint: '@astrojs/image/sharp',
logLevel: 'info' as LoggerLevel, logLevel: 'info' as LoggerLevel,
...options, ...options,
}; };
@ -106,7 +106,9 @@ export default function integration(options: IntegrationOptions = {}): AstroInte
: {}; : {};
}, },
'astro:build:done': async ({ dir }) => { 'astro:build:done': async ({ dir }) => {
if (resolvedOptions.serviceEntryPoint === '@astrojs/image/squoosh') {
await copyLibFiles(_config.output === 'static' ? dir : _buildConfig.server); await copyLibFiles(_config.output === 'static' ? dir : _buildConfig.server);
}
if (_config.output === 'static') { if (_config.output === 'static') {
// for SSG builds, build all requested image transforms to dist // for SSG builds, build all requested image transforms to dist

View file

@ -6,7 +6,7 @@ import type {
TransformOptions, TransformOptions,
} from '../loaders/index.js'; } from '../loaders/index.js';
import { isSSRService, parseAspectRatio } from '../loaders/index.js'; import { isSSRService, parseAspectRatio } from '../loaders/index.js';
import sharp from '../loaders/squoosh.js'; import sharp from '../loaders/sharp.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';

View file

@ -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/squoosh.js'; import sharp from './loaders/sharp.js';
import { metadata } from './utils/metadata.js'; import { metadata } from './utils/metadata.js';
export interface ImageMetadata { export interface ImageMetadata {