[ci] format

This commit is contained in:
tony-sull 2022-07-27 15:41:22 +00:00 committed by fredkbot
parent a397b981f5
commit 57770bbae2
5 changed files with 15 additions and 21 deletions

View file

@ -1,13 +1,4 @@
type InputFormat = type InputFormat = 'avif' | 'gif' | 'heic' | 'heif' | 'jpeg' | 'jpg' | 'png' | 'tiff' | 'webp';
| 'avif'
| 'gif'
| 'heic'
| 'heif'
| 'jpeg'
| 'jpg'
| 'png'
| 'tiff'
| 'webp';
interface ImageMetadata { interface ImageMetadata {
src: string; src: string;

View file

@ -3,5 +3,11 @@ export { default as Image } from './Image.astro';
export { default as Picture } from './Picture.astro'; export { default as Picture } from './Picture.astro';
// TODO: should these directives be removed from astroHTML.JSX? // 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 ImgHTMLAttributes = Omit<
export type HTMLAttributes = Omit<astroHTML.JSX.HTMLAttributes, 'client:list' | 'set:text' | 'set:html' | 'is:raw'>; 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'
>;

View file

@ -9,7 +9,7 @@ import { createPlugin } from './vite-plugin-astro-image.js';
export { getImage } from './lib/get-image.js'; export { getImage } from './lib/get-image.js';
export { getPicture } from './lib/get-picture.js'; export { getPicture } from './lib/get-picture.js';
export * from './loaders/index.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 { interface ImageIntegration {
loader?: ImageService; loader?: ImageService;

View file

@ -1,13 +1,8 @@
/// <reference types="astro/astro-jsx" /> /// <reference types="astro/astro-jsx" />
import slash from 'slash'; import slash from 'slash';
import { ROUTE_PATTERN } from '../constants.js'; import { ROUTE_PATTERN } from '../constants.js';
import { ImageService, isSSRService, OutputFormat, TransformOptions } from '../loaders/index.js';
import sharp from '../loaders/sharp.js'; import sharp from '../loaders/sharp.js';
import {
ImageService,
isSSRService,
OutputFormat,
TransformOptions,
} from '../loaders/index.js';
import { isRemoteImage, parseAspectRatio } from '../utils/images.js'; import { isRemoteImage, parseAspectRatio } from '../utils/images.js';
import { ImageMetadata } from '../vite-plugin-astro-image.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. * @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. * @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) { if (!transform.src) {
throw new Error('[@astrojs/image] `src` is required'); throw new Error('[@astrojs/image] `src` is required');
} }

View file

@ -1,6 +1,6 @@
import sharp from 'sharp'; import sharp from 'sharp';
import type { OutputFormat, SSRImageService, TransformOptions } from './index.js';
import { isAspectRatioString, isOutputFormat } from '../utils/images.js'; import { isAspectRatioString, isOutputFormat } from '../utils/images.js';
import type { OutputFormat, SSRImageService, TransformOptions } from './index.js';
class SharpService implements SSRImageService { class SharpService implements SSRImageService {
async getImageAttributes(transform: TransformOptions) { async getImageAttributes(transform: TransformOptions) {