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:
parent
1d2559c28b
commit
71332cf969
4 changed files with 31 additions and 16 deletions
5
.changeset/mean-houses-exist.md
Normal file
5
.changeset/mean-houses-exist.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Move sharpImageService and squooshImageService functions to `astro/config` so they can be imported
|
12
packages/astro/config.d.ts
vendored
12
packages/astro/config.d.ts
vendored
|
@ -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;
|
||||
|
|
|
@ -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: {},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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: {},
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue