@yoot/yoot
Version:
The core library for yoot, providing a CDN-agnostic, chainable API for image URL transformations and adapter integration.
46 lines (45 loc) • 1.22 kB
TypeScript
import type { Adapter } from './adapter.ts';
export { defineConfig, mergeConfig };
export type { YootConfig };
export { getConfig as _getConfig };
/**
* Sets or replaces the global configuration for Yoot.
*
* @remarks
* To incrementally add or update options, use `mergeConfig`.
*
* @public
* @param options - The complete configuration object to set.
*/
declare const defineConfig: (options: YootConfig) => void;
/**
* Merges the provided options into the existing global Yoot configuration.
*
* @remarks
* Properties in the provided `options` will overwrite existing ones if keys match.
*
* @public
* @param options - Configuration options to merge.
*/
declare const mergeConfig: (options: YootConfig) => void;
/**
* Retrieves the current global Yoot configuration.
*
* @remarks
* Returns a shallow copy, so direct modification of the returned object
* will not affect the internal configuration.
*
* @internal
*/
declare const getConfig: () => YootConfig;
/**
* Configuration options for Yoot.
* @public
*/
type YootConfig = {
/**
* Called when no adapter is found for a given URL.
* @returns An adapter or throws.
*/
onMissingAdapter?: (url: URL) => Adapter | never;
};