0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-06 22:10:10 -05:00

fix: move service functions from astro/assets to astro/config so it can be imported (#6995)

* fix: move service functions from astro/assets to astro/config so people can import it

* chore: changeset
This commit is contained in:
Erika 2023-05-04 21:57:23 +02:00 committed by GitHub
parent 1d2559c28b
commit 71332cf969
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 16 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Move sharpImageService and squooshImageService functions to `astro/config` so they can be imported

View file

@ -1,6 +1,7 @@
type ViteUserConfig = import('vite').UserConfig;
type ViteUserConfigFn = import('vite').UserConfigFn;
type AstroUserConfig = import('./dist/@types/astro.js').AstroUserConfig;
type ImageServiceConfig = import('./dist/@types/astro.js').ImageServiceConfig;
/**
* See the full Astro Configuration API Documentation
@ -12,3 +13,14 @@ export function defineConfig(config: AstroUserConfig): AstroUserConfig;
* Use Astro to generate a fully resolved Vite config
*/
export function getViteConfig(config: ViteUserConfig): ViteUserConfigFn;
/**
* Return the configuration needed to use the Sharp-based image service
* See: https://docs.astro.build/en/guides/assets/#using-sharp
*/
export function sharpImageService(): ImageServiceConfig;
/**
* Return the configuration needed to use the Squoosh-based image service
*/
export function squooshImageService(): ImageServiceConfig;

View file

@ -1 +1,15 @@
export { defineConfig, getViteConfig } from './dist/config/index.js';
export function sharpImageService() {
return {
entrypoint: 'astro/assets/services/sharp',
config: {},
};
}
export function squooshImageService() {
return {
entrypoint: 'astro/assets/services/squoosh',
config: {},
};
}

View file

@ -1,21 +1,5 @@
import type { ImageServiceConfig } from '../@types/astro.js';
export { getConfiguredImageService, getImage } from './internal.js';
export { baseService, isLocalService } from './services/service.js';
export { type LocalImageProps, type RemoteImageProps } from './types.js';
export { emitESMImage } from './utils/emitAsset.js';
export { imageMetadata } from './utils/metadata.js';
export function sharpImageService(): ImageServiceConfig {
return {
entrypoint: 'astro/assets/services/sharp',
config: {},
};
}
export function squooshImageService(): ImageServiceConfig {
return {
entrypoint: 'astro/assets/services/squoosh',
config: {},
};
}