imagetools-core
Advanced tools
Comparing version 3.3.0 to 3.3.1
@@ -1,6 +0,5 @@ | ||
import { ImageTransformation, ImageConfig, TransformFactory } from '../types'; | ||
export declare function generateTransforms(config: ImageConfig, factories: TransformFactory[]): { | ||
import { ImageTransformation, ImageConfig, TransformFactory, Logger } from '../types'; | ||
export declare function generateTransforms(config: ImageConfig, factories: TransformFactory[], logger?: Logger): { | ||
transforms: ImageTransformation[]; | ||
parametersUsed: Set<string>; | ||
warnings: string[]; | ||
}; |
import { TransformOption } from '../types'; | ||
export declare const fitValues: readonly ["cover", "contain", "fill", "inside", "outside"]; | ||
export declare type FitValue = typeof fitValues[number]; | ||
export type FitValue = (typeof fitValues)[number]; | ||
export interface FitOptions { | ||
@@ -5,0 +5,0 @@ fit: FitValue; |
import { TransformFactory } from '../types'; | ||
export declare const formatValues: readonly ["avif", "jpg", "jpeg", "png", "heif", "heic", "webp", "tiff"]; | ||
export declare type FormatValue = typeof formatValues[number]; | ||
export type FormatValue = (typeof formatValues)[number]; | ||
export interface FormatOptions { | ||
@@ -5,0 +5,0 @@ format: FormatValue; |
import { TransformOption } from '../types'; | ||
export declare const kernelValues: readonly ["nearest", "cubic", "mitchell", "lanczos2", "lanczos3"]; | ||
export declare type KernelValue = typeof kernelValues[number]; | ||
export type KernelValue = (typeof kernelValues)[number]; | ||
export interface KernelOptions { | ||
@@ -5,0 +5,0 @@ kernel: KernelValue; |
import { TransformOption } from '../types'; | ||
export declare const positionValues: readonly ["top", "right top", "right", "right bottom", "bottom", "left bottom", "left", "left top", "north", "northeast", "east", "southeast", "south", "southwest", "west", "northwest", "center", "centre", "entropy", "attention"]; | ||
export declare const positionShorthands: string[]; | ||
export declare type PositionValue = typeof positionValues[number]; | ||
export type PositionValue = (typeof positionValues)[number]; | ||
export interface PositionOptions { | ||
@@ -6,0 +6,0 @@ position: PositionValue; |
import { Sharp } from 'sharp'; | ||
export declare type ImageConfig = Record<string, unknown>; | ||
export type ImageConfig = Record<string, unknown>; | ||
export interface Logger { | ||
info: (msg: string) => void; | ||
warn: (msg: string) => void; | ||
error: (msg: string) => void; | ||
} | ||
export interface TransformFactoryContext { | ||
useParam: (parameter: string) => void; | ||
warn: (message: string) => void; | ||
logger: Logger; | ||
} | ||
export declare type TransformFactory<A = Record<string, unknown>> = (metadata: Partial<ImageConfig & A>, ctx: TransformFactoryContext) => ImageTransformation | undefined; | ||
export declare type TransformOption<A = Record<string, unknown>, T = unknown> = (metadata: Partial<ImageConfig & A>, image: Sharp) => T | undefined; | ||
export declare type ImageTransformation = (image: Sharp) => Sharp | Promise<Sharp>; | ||
export type TransformFactory<A = Record<string, unknown>> = (metadata: Partial<ImageConfig & A>, ctx: TransformFactoryContext) => ImageTransformation | undefined; | ||
export type TransformOption<A = Record<string, unknown>, T = unknown> = (metadata: Partial<ImageConfig & A>, image: Sharp) => T | undefined; | ||
export type ImageTransformation = (image: Sharp) => Sharp | Promise<Sharp>; | ||
export interface TransformResult { | ||
@@ -17,3 +22,3 @@ image: Sharp; | ||
*/ | ||
export declare type OutputFormat = (args?: string[]) => (metadata: ImageConfig[]) => unknown; | ||
export type OutputFormat = (args?: string[]) => (metadata: ImageConfig[]) => unknown; | ||
/** | ||
@@ -20,0 +25,0 @@ * The source output format. |
{ | ||
"name": "imagetools-core", | ||
"version": "3.3.0", | ||
"version": "3.3.1", | ||
"types": "dist/index.d.ts", | ||
@@ -38,3 +38,3 @@ "exports": { | ||
"@types/sharp": "^0.31.0", | ||
"@vitest/coverage-c8": "^0.27.0", | ||
"@vitest/coverage-c8": "^0.28.0", | ||
"jest-file-snapshot": "^0.5.0", | ||
@@ -44,7 +44,7 @@ "jest-image-snapshot": "^6.0.0", | ||
"tslib": "^2.4.0", | ||
"typescript": "^4.8.4", | ||
"vitest": "^0.27.0" | ||
"typescript": "^4.9.4", | ||
"vitest": "^0.28.0" | ||
}, | ||
"dependencies": { | ||
"sharp": "^0.31.0" | ||
"sharp": "^0.31.3" | ||
}, | ||
@@ -51,0 +51,0 @@ "scripts": { |
@@ -37,3 +37,3 @@ # imagetools-core | ||
```js | ||
import { loadImage, applyTransforms, builtins } from 'imagetools-core' | ||
import { loadImage, applyTransforms, builtins, generateTransforms } from 'imagetools-core' | ||
@@ -40,0 +40,0 @@ // loadImageFromDisk is a utility function that creates a sharp instances of the specified image |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
130124
38
1267
Updatedsharp@^0.31.3