imagetools-core
Advanced tools
Comparing version 4.0.3 to 4.0.4
@@ -0,3 +1,3 @@ | ||
import { createHash } from 'node:crypto'; | ||
import sharp from 'sharp'; | ||
import { createHash } from 'crypto'; | ||
@@ -100,2 +100,3 @@ const METADATA = Symbol('image metadata'); | ||
return; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const fixedFormat = format; | ||
@@ -486,8 +487,9 @@ return function formatTransform(image) { | ||
* Should be replaced with something more legible but works for now. | ||
* @internal | ||
*/ | ||
const cartesian = (...a) => a.reduce((a, b) => a.flatMap((d) => b.map((e) => [d, e].flat()))); | ||
const cartesian = (...a) => | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
a.reduce((a, b) => a.flatMap((d) => b.map((e) => [d, e].flat()))); | ||
/** | ||
* This function builds up all possible combinations the given entries can be combined | ||
* an returns it as an array of objects that can be given to a the transforms. | ||
* and returns it as an array of objects that can be given to a the transforms. | ||
* @param entries The url parameter entries | ||
@@ -500,3 +502,3 @@ * @returns An array of directive options | ||
.filter(([k]) => !(k in outputFormats)) | ||
.map(([key, values]) => values.map((v) => [[key, v]])); | ||
.map(([key, values]) => values.map((v) => [key, v])); | ||
// do a cartesian product on all entries to get all combinations we need to produce | ||
@@ -508,3 +510,3 @@ const combinations = singleArgumentEntries | ||
// and return as an array of objects | ||
const out = combinations.map((options) => Object.fromEntries([...options, ...metadataAddons])); | ||
const out = combinations.map((options) => Object.fromEntries([[...options, ...metadataAddons]])); | ||
return out.length ? out : [Object.fromEntries(metadataAddons)]; | ||
@@ -511,0 +513,0 @@ } |
@@ -5,6 +5,6 @@ import { Sharp } from 'sharp'; | ||
interface Sharp { | ||
[METADATA]: Record<string, any>; | ||
[METADATA]: Record<string, unknown>; | ||
} | ||
} | ||
export declare function setMetadata(image: Sharp, key: string, value: any): void; | ||
export declare function getMetadata(image: Sharp, key: string): any; | ||
export declare function setMetadata(image: Sharp, key: string, value: unknown): void; | ||
export declare function getMetadata(image: Sharp, key: string): unknown; |
import { OutputFormat } from '../index.js'; | ||
/** | ||
* This function calculates the cartesian product of two or more arrays and is straight from stackoverflow ;) | ||
* Should be replaced with something more legible but works for now. | ||
* @internal | ||
*/ | ||
export declare const cartesian: (...a: any[]) => any; | ||
/** | ||
* This function builds up all possible combinations the given entries can be combined | ||
* an returns it as an array of objects that can be given to a the transforms. | ||
* and returns it as an array of objects that can be given to a the transforms. | ||
* @param entries The url parameter entries | ||
@@ -12,0 +6,0 @@ * @returns An array of directive options |
import { TransformOption } from '../types.js'; | ||
export declare const fitValues: readonly ["cover", "contain", "fill", "inside", "outside"]; | ||
export declare const fitValues: string[]; | ||
export type FitValue = (typeof fitValues)[number]; | ||
@@ -4,0 +4,0 @@ export interface FitOptions { |
{ | ||
"name": "imagetools-core", | ||
"version": "4.0.3", | ||
"version": "4.0.4", | ||
"type": "module", | ||
@@ -32,15 +32,15 @@ "types": "dist/index.d.ts", | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "^11.0.0", | ||
"@types/jest-image-snapshot": "^6.0.0", | ||
"@types/sharp": "^0.31.0", | ||
"@vitest/coverage-c8": "^0.31.0", | ||
"@rollup/plugin-typescript": "^11.1.2", | ||
"@types/jest-image-snapshot": "^6.1.0", | ||
"@types/sharp": "^0.32.0", | ||
"@vitest/coverage-v8": "^0.33.0", | ||
"jest-file-snapshot": "^0.5.0", | ||
"jest-image-snapshot": "^6.0.0", | ||
"rollup": "^3.2.3", | ||
"tslib": "^2.4.0", | ||
"typescript": "^5.0.0", | ||
"vitest": "^0.31.0" | ||
"jest-image-snapshot": "^6.2.0", | ||
"rollup": "^3.26.3", | ||
"tslib": "^2.6.1", | ||
"typescript": "^5.1.6", | ||
"vitest": "^0.33.0" | ||
}, | ||
"dependencies": { | ||
"sharp": "^0.32.0" | ||
"sharp": "^0.32.4" | ||
}, | ||
@@ -47,0 +47,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
76816
793
Updatedsharp@^0.32.4