[ci] format
This commit is contained in:
parent
a397b981f5
commit
57770bbae2
5 changed files with 15 additions and 21 deletions
11
packages/integrations/image/client.d.ts
vendored
11
packages/integrations/image/client.d.ts
vendored
|
@ -1,13 +1,4 @@
|
|||
type InputFormat =
|
||||
| 'avif'
|
||||
| 'gif'
|
||||
| 'heic'
|
||||
| 'heif'
|
||||
| 'jpeg'
|
||||
| 'jpg'
|
||||
| 'png'
|
||||
| 'tiff'
|
||||
| 'webp';
|
||||
type InputFormat = 'avif' | 'gif' | 'heic' | 'heif' | 'jpeg' | 'jpg' | 'png' | 'tiff' | 'webp';
|
||||
|
||||
interface ImageMetadata {
|
||||
src: string;
|
||||
|
|
|
@ -3,5 +3,11 @@ export { default as Image } from './Image.astro';
|
|||
export { default as Picture } from './Picture.astro';
|
||||
|
||||
// TODO: should these directives be removed from astroHTML.JSX?
|
||||
export type ImgHTMLAttributes = Omit<astroHTML.JSX.ImgHTMLAttributes, 'client:list' | 'set:text' | 'set:html' | 'is:raw'>;
|
||||
export type HTMLAttributes = Omit<astroHTML.JSX.HTMLAttributes, 'client:list' | 'set:text' | 'set:html' | 'is:raw'>;
|
||||
export type ImgHTMLAttributes = Omit<
|
||||
astroHTML.JSX.ImgHTMLAttributes,
|
||||
'client:list' | 'set:text' | 'set:html' | 'is:raw'
|
||||
>;
|
||||
export type HTMLAttributes = Omit<
|
||||
astroHTML.JSX.HTMLAttributes,
|
||||
'client:list' | 'set:text' | 'set:html' | 'is:raw'
|
||||
>;
|
||||
|
|
|
@ -9,7 +9,7 @@ import { createPlugin } from './vite-plugin-astro-image.js';
|
|||
export { getImage } from './lib/get-image.js';
|
||||
export { getPicture } from './lib/get-picture.js';
|
||||
export * from './loaders/index.js';
|
||||
export type { ImageMetadata} from './vite-plugin-astro-image.js';
|
||||
export type { ImageMetadata } from './vite-plugin-astro-image.js';
|
||||
|
||||
interface ImageIntegration {
|
||||
loader?: ImageService;
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
/// <reference types="astro/astro-jsx" />
|
||||
import slash from 'slash';
|
||||
import { ROUTE_PATTERN } from '../constants.js';
|
||||
import { ImageService, isSSRService, OutputFormat, TransformOptions } from '../loaders/index.js';
|
||||
import sharp from '../loaders/sharp.js';
|
||||
import {
|
||||
ImageService,
|
||||
isSSRService,
|
||||
OutputFormat,
|
||||
TransformOptions,
|
||||
} from '../loaders/index.js';
|
||||
import { isRemoteImage, parseAspectRatio } from '../utils/images.js';
|
||||
import { ImageMetadata } from '../vite-plugin-astro-image.js';
|
||||
|
||||
|
@ -101,7 +96,9 @@ async function resolveTransform(input: GetImageTransform): Promise<TransformOpti
|
|||
* @param transform @type {TransformOptions} The transformations requested for the optimized image.
|
||||
* @returns @type {ImageAttributes} The HTML attributes to be included on the built `<img />` element.
|
||||
*/
|
||||
export async function getImage(transform: GetImageTransform): Promise<astroHTML.JSX.ImgHTMLAttributes> {
|
||||
export async function getImage(
|
||||
transform: GetImageTransform
|
||||
): Promise<astroHTML.JSX.ImgHTMLAttributes> {
|
||||
if (!transform.src) {
|
||||
throw new Error('[@astrojs/image] `src` is required');
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import sharp from 'sharp';
|
||||
import type { OutputFormat, SSRImageService, TransformOptions } from './index.js';
|
||||
import { isAspectRatioString, isOutputFormat } from '../utils/images.js';
|
||||
import type { OutputFormat, SSRImageService, TransformOptions } from './index.js';
|
||||
|
||||
class SharpService implements SSRImageService {
|
||||
async getImageAttributes(transform: TransformOptions) {
|
||||
|
|
Loading…
Reference in a new issue