| Server IP : 159.203.156.69 / Your IP : 216.73.216.37 Web Server : nginx/1.24.0 System : Linux main-ubuntu 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/tanviranik.com/node_modules/unpic/script/src/ |
Upload File : |
import type { ProviderOperations, ProviderOptions } from "./providers/types.js";
export type { ProviderOperations, ProviderOptions };
/**
* Options to transform an image URL
*/
export interface UrlTransformerOptions<TCDN extends ImageCdn = ImageCdn> extends Pick<ProviderOperations[TCDN], "width" | "height" | "format" | "quality"> {
/** The image URL to transform */
url: string | URL;
/** Specify a provider rather than auto-detecting */
provider?: TCDN;
/** @deprecated Use `provider` */
cdn?: TCDN;
/** Provider to use if none matches */
fallback?: TCDN;
}
/**
* @deprecated Use `ProviderOptions` instead
*/
export type CdnOptions = ProviderOptions;
export interface UrlGeneratorOptions<TParams = Record<string, string>> {
base: string | URL;
width?: number;
height?: number;
format?: string;
params?: TParams;
}
export type ImageCdn = "contentful" | "builder.io" | "cloudimage" | "cloudinary" | "cloudflare" | "imgix" | "shopify" | "wordpress" | "bunny" | "storyblok" | "kontent.ai" | "vercel" | "nextjs" | "scene7" | "keycdn" | "directus" | "imageengine" | "contentstack" | "cloudflare_images" | "ipx" | "astro" | "netlify" | "imagekit" | "uploadcare" | "supabase" | "hygraph" | "appwrite" | "wsrv";
export declare const SupportedProviders: Record<ImageCdn, string>;
export type OperationFormatter<T extends Operations = Operations> = (operations: T) => string;
export type OperationParser<T extends Operations = Operations> = (url: string | URL) => T;
export interface OperationMap<TOperations extends Operations = Operations> {
width?: keyof TOperations | false;
height?: keyof TOperations | false;
format?: keyof TOperations | false;
quality?: keyof TOperations | false;
}
export interface FormatMap {
[key: string]: ImageFormat | (string & {});
}
export type ImageFormat = "jpeg" | "jpg" | "png" | "webp" | "avif";
export interface Operations<TImageFormat = (string & {})> {
width?: number | string;
height?: number | string;
format?: ImageFormat | TImageFormat;
quality?: number | string;
}
export interface ProviderConfig<TOperations extends Operations = Operations> {
/**
* Maps standard operation names to their equivalent with this provider.
* Keys are any of width, height, format, quality. Only include those
* that are different from the standard.
*/
keyMap?: OperationMap<TOperations>;
/**
* Defaults that should always be applied to operations unless overridden.
*/
defaults?: Partial<TOperations>;
/**
* Maps standard format names to their equivalent with this provider.
* Only include those that are different from the standard.
*/
formatMap?: FormatMap;
/**
* Separator between keys and values in the URL. Defaults to "=".
*/
kvSeparator?: string;
/**
* Parameter separator in the URL. Defaults to "&".
*/
paramSeparator?: string;
/**
* If provided, the src URL will be extracted from this parameter.
*/
srcParam?: string;
}
export type URLGenerator<TCDN extends ImageCdn = ImageCdn> = ProviderOptions[TCDN] extends undefined ? (src: string | URL, operations: ProviderOperations[TCDN]) => string : (src: string | URL, operations: ProviderOperations[TCDN], options?: ProviderOptions[TCDN]) => string;
export type URLTransformer<TCDN extends ImageCdn = ImageCdn> = ProviderOptions[TCDN] extends undefined ? (src: string | URL, operations: ProviderOperations[TCDN]) => string : (src: string | URL, operations: ProviderOperations[TCDN], options?: ProviderOptions[TCDN]) => string;
export type TransformerFunction<TOperations extends Operations, TOptions> = TOptions extends undefined ? (src: string | URL, operations: TOperations) => string : (src: string | URL, operations: TOperations, options?: TOptions) => string;
export type URLExtractor<TCDN extends ImageCdn = ImageCdn> = (url: string | URL, options?: ProviderOptions[TCDN]) => (ProviderOptions[TCDN] extends undefined ? {
operations: ProviderOperations[TCDN];
src: string;
} : {
operations: ProviderOperations[TCDN];
src: string;
options: ProviderOptions[TCDN];
}) | null;
export type ExtractedURL<TCDN extends ImageCdn = ImageCdn> = ReturnType<URLExtractor<TCDN>>;
export type ParseURLResult<TCDN extends ImageCdn = ImageCdn> = (ExtractedURL<TCDN> & {
cdn?: TCDN;
}) | undefined;
//# sourceMappingURL=types.d.ts.map