New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

imagetools-core

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imagetools-core - npm Package Compare versions

Comparing version 2.7.6 to 2.8.0

dist/__tests__/apply-transforms.spec.d.ts

124

CHANGELOG.md
# Change Log
## 2.8.0
### Minor Changes
- c70b97e: Add metadata whitelist
## 2.7.6

@@ -9,4 +15,4 @@

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
All notable changes to this project will be documented in this file. See
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.

@@ -29,3 +35,4 @@ ## [2.7.5](https://github.com/JonasKruckenberg/imagetools/compare/imagetools-core@2.7.4...imagetools-core@2.7.5) (2021-05-11)

- Revert to older sharp version ([9a6ce0a](https://github.com/JonasKruckenberg/imagetools/commit/9a6ce0a9ee00150944aebeb12badf356a2f71279))
- Revert to older sharp version
([9a6ce0a](https://github.com/JonasKruckenberg/imagetools/commit/9a6ce0a9ee00150944aebeb12badf356a2f71279))

@@ -36,3 +43,4 @@ ## [2.7.1](https://github.com/JonasKruckenberg/imagetools/compare/imagetools-core@2.7.0...imagetools-core@2.7.1) (2021-05-11)

- Revert to older sharp version ([9a6ce0a](https://github.com/JonasKruckenberg/imagetools/commit/9a6ce0a9ee00150944aebeb12badf356a2f71279))
- Revert to older sharp version
([9a6ce0a](https://github.com/JonasKruckenberg/imagetools/commit/9a6ce0a9ee00150944aebeb12badf356a2f71279))

@@ -43,10 +51,17 @@ # [2.7.0](https://github.com/JonasKruckenberg/imagetools/compare/imagetools-core@2.6.0...imagetools-core@2.7.0) (2021-05-07)

- Refactor & resize directive ([5b2fca0](https://github.com/JonasKruckenberg/imagetools/commit/5b2fca0b3ef02ddf7cb9667648de68df9316c448)), closes [#91](https://github.com/JonasKruckenberg/imagetools/issues/91)
- update background directive ([d01b446](https://github.com/JonasKruckenberg/imagetools/commit/d01b44672b1ffadc41bf2497a82d63244176d1cf))
- use replace with regex for older node versions ([8e86de1](https://github.com/JonasKruckenberg/imagetools/commit/8e86de17658fbcdf8fb9b07f683f2dfc29e09ca3))
- Refactor & resize directive
([5b2fca0](https://github.com/JonasKruckenberg/imagetools/commit/5b2fca0b3ef02ddf7cb9667648de68df9316c448)), closes
[#91](https://github.com/JonasKruckenberg/imagetools/issues/91)
- update background directive
([d01b446](https://github.com/JonasKruckenberg/imagetools/commit/d01b44672b1ffadc41bf2497a82d63244176d1cf))
- use replace with regex for older node versions
([8e86de1](https://github.com/JonasKruckenberg/imagetools/commit/8e86de17658fbcdf8fb9b07f683f2dfc29e09ca3))
### Features
- Allow # symbols in src urls ([b5beedd](https://github.com/JonasKruckenberg/imagetools/commit/b5beedd3707167aad9302737d1012f35a3f19776))
- Allow ImageTransform functions to be async ([da3e726](https://github.com/JonasKruckenberg/imagetools/commit/da3e7264d8ae3276dfe76d3394e8764c783d9d50)), closes [#88](https://github.com/JonasKruckenberg/imagetools/issues/88)
- Allow # symbols in src urls
([b5beedd](https://github.com/JonasKruckenberg/imagetools/commit/b5beedd3707167aad9302737d1012f35a3f19776))
- Allow ImageTransform functions to be async
([da3e726](https://github.com/JonasKruckenberg/imagetools/commit/da3e7264d8ae3276dfe76d3394e8764c783d9d50)), closes
[#88](https://github.com/JonasKruckenberg/imagetools/issues/88)

@@ -57,9 +72,14 @@ # [2.6.0](https://github.com/JonasKruckenberg/imagetools/compare/imagetools-core@2.5.0...imagetools-core@2.6.0) (2021-05-07)

- update background directive ([d01b446](https://github.com/JonasKruckenberg/imagetools/commit/d01b44672b1ffadc41bf2497a82d63244176d1cf))
- use replace with regex for older node versions ([8e86de1](https://github.com/JonasKruckenberg/imagetools/commit/8e86de17658fbcdf8fb9b07f683f2dfc29e09ca3))
- update background directive
([d01b446](https://github.com/JonasKruckenberg/imagetools/commit/d01b44672b1ffadc41bf2497a82d63244176d1cf))
- use replace with regex for older node versions
([8e86de1](https://github.com/JonasKruckenberg/imagetools/commit/8e86de17658fbcdf8fb9b07f683f2dfc29e09ca3))
### Features
- Allow # symbols in src urls ([b5beedd](https://github.com/JonasKruckenberg/imagetools/commit/b5beedd3707167aad9302737d1012f35a3f19776))
- Allow ImageTransform functions to be async ([da3e726](https://github.com/JonasKruckenberg/imagetools/commit/da3e7264d8ae3276dfe76d3394e8764c783d9d50)), closes [#88](https://github.com/JonasKruckenberg/imagetools/issues/88)
- Allow # symbols in src urls
([b5beedd](https://github.com/JonasKruckenberg/imagetools/commit/b5beedd3707167aad9302737d1012f35a3f19776))
- Allow ImageTransform functions to be async
([da3e726](https://github.com/JonasKruckenberg/imagetools/commit/da3e7264d8ae3276dfe76d3394e8764c783d9d50)), closes
[#88](https://github.com/JonasKruckenberg/imagetools/issues/88)

@@ -70,3 +90,5 @@ # [2.5.0](https://github.com/JonasKruckenberg/imagetools/compare/imagetools-core@2.3.3...imagetools-core@2.5.0) (2021-05-07)

- Allow ImageTransform functions to be async ([da3e726](https://github.com/JonasKruckenberg/imagetools/commit/da3e7264d8ae3276dfe76d3394e8764c783d9d50)), closes [#88](https://github.com/JonasKruckenberg/imagetools/issues/88)
- Allow ImageTransform functions to be async
([da3e726](https://github.com/JonasKruckenberg/imagetools/commit/da3e7264d8ae3276dfe76d3394e8764c783d9d50)), closes
[#88](https://github.com/JonasKruckenberg/imagetools/issues/88)

@@ -85,3 +107,4 @@ ## [2.3.3](https://github.com/JonasKruckenberg/imagetools/compare/imagetools-core@2.3.2...imagetools-core@2.3.3) (2021-05-03)

- include private metadata when applying the transforms ([cc46d1b](https://github.com/JonasKruckenberg/imagetools/commit/cc46d1bce74c1f7202c4d57651be29c5d2356c77))
- include private metadata when applying the transforms
([cc46d1b](https://github.com/JonasKruckenberg/imagetools/commit/cc46d1bce74c1f7202c4d57651be29c5d2356c77))

@@ -92,8 +115,12 @@ # [2.3.0](https://github.com/JonasKruckenberg/imagetools/compare/imagetools-core@2.2.0...imagetools-core@2.3.0) (2021-04-28)

- exclude test files from generated types ([a86d29c](https://github.com/JonasKruckenberg/imagetools/commit/a86d29c0b070b57860878fe80627d402eea82eaf))
- exclude test files from generated types
([a86d29c](https://github.com/JonasKruckenberg/imagetools/commit/a86d29c0b070b57860878fe80627d402eea82eaf))
### Features
- Add aspect ratio support to the resize directive ([#71](https://github.com/JonasKruckenberg/imagetools/issues/71)) ([8e905da](https://github.com/JonasKruckenberg/imagetools/commit/8e905da98b9878973b79dcc36c770547bb49058f))
- Adding `ar` shorthand for aspect and support for numeric values for aspect ([#74](https://github.com/JonasKruckenberg/imagetools/issues/74)) ([e96b7e3](https://github.com/JonasKruckenberg/imagetools/commit/e96b7e322a50768e7a8b395af42035c53dcb76d8))
- Add aspect ratio support to the resize directive ([#71](https://github.com/JonasKruckenberg/imagetools/issues/71))
([8e905da](https://github.com/JonasKruckenberg/imagetools/commit/8e905da98b9878973b79dcc36c770547bb49058f))
- Adding `ar` shorthand for aspect and support for numeric values for aspect
([#74](https://github.com/JonasKruckenberg/imagetools/issues/74))
([e96b7e3](https://github.com/JonasKruckenberg/imagetools/commit/e96b7e322a50768e7a8b395af42035c53dcb76d8))

@@ -104,8 +131,12 @@ # [2.2.0](https://github.com/JonasKruckenberg/imagetools/compare/imagetools-core@2.1.0...imagetools-core@2.2.0) (2021-04-28)

- exclude test files from generated types ([a86d29c](https://github.com/JonasKruckenberg/imagetools/commit/a86d29c0b070b57860878fe80627d402eea82eaf))
- exclude test files from generated types
([a86d29c](https://github.com/JonasKruckenberg/imagetools/commit/a86d29c0b070b57860878fe80627d402eea82eaf))
### Features
- Add aspect ratio support to the resize directive ([#71](https://github.com/JonasKruckenberg/imagetools/issues/71)) ([8e905da](https://github.com/JonasKruckenberg/imagetools/commit/8e905da98b9878973b79dcc36c770547bb49058f))
- Adding `ar` shorthand for aspect and support for numeric values for aspect ([#74](https://github.com/JonasKruckenberg/imagetools/issues/74)) ([e96b7e3](https://github.com/JonasKruckenberg/imagetools/commit/e96b7e322a50768e7a8b395af42035c53dcb76d8))
- Add aspect ratio support to the resize directive ([#71](https://github.com/JonasKruckenberg/imagetools/issues/71))
([8e905da](https://github.com/JonasKruckenberg/imagetools/commit/8e905da98b9878973b79dcc36c770547bb49058f))
- Adding `ar` shorthand for aspect and support for numeric values for aspect
([#74](https://github.com/JonasKruckenberg/imagetools/issues/74))
([e96b7e3](https://github.com/JonasKruckenberg/imagetools/commit/e96b7e322a50768e7a8b395af42035c53dcb76d8))

@@ -116,8 +147,12 @@ # [2.1.0](https://github.com/JonasKruckenberg/imagetools/compare/imagetools-core@0.1.0...imagetools-core@2.1.0) (2021-04-28)

- exclude test files from generated types ([a86d29c](https://github.com/JonasKruckenberg/imagetools/commit/a86d29c0b070b57860878fe80627d402eea82eaf))
- exclude test files from generated types
([a86d29c](https://github.com/JonasKruckenberg/imagetools/commit/a86d29c0b070b57860878fe80627d402eea82eaf))
### Features
- Add aspect ratio support to the resize directive ([#71](https://github.com/JonasKruckenberg/imagetools/issues/71)) ([8e905da](https://github.com/JonasKruckenberg/imagetools/commit/8e905da98b9878973b79dcc36c770547bb49058f))
- Adding `ar` shorthand for aspect and support for numeric values for aspect ([#74](https://github.com/JonasKruckenberg/imagetools/issues/74)) ([e96b7e3](https://github.com/JonasKruckenberg/imagetools/commit/e96b7e322a50768e7a8b395af42035c53dcb76d8))
- Add aspect ratio support to the resize directive ([#71](https://github.com/JonasKruckenberg/imagetools/issues/71))
([8e905da](https://github.com/JonasKruckenberg/imagetools/commit/8e905da98b9878973b79dcc36c770547bb49058f))
- Adding `ar` shorthand for aspect and support for numeric values for aspect
([#74](https://github.com/JonasKruckenberg/imagetools/issues/74))
([e96b7e3](https://github.com/JonasKruckenberg/imagetools/commit/e96b7e322a50768e7a8b395af42035c53dcb76d8))

@@ -160,9 +195,14 @@ # [2.0.0](https://github.com/JonasKruckenberg/imagetools/compare/imagetools-core@0.1.0...imagetools-core@2.0.0) (2021-04-12)

- cache key generation ([e09434c](https://github.com/JonasKruckenberg/vite-imagetools/commit/e09434c65548230bfdce964264c0f9cc83aadd86))
- support nodejs LTS versions ([4abccc5](https://github.com/JonasKruckenberg/vite-imagetools/commit/4abccc53700ad55d04dc0c2142b6dc8d69ebf122)), closes [#51](https://github.com/JonasKruckenberg/vite-imagetools/issues/51)
- update cache key geneartion to match spec ([7f0a0e8](https://github.com/JonasKruckenberg/vite-imagetools/commit/7f0a0e8bf20189e12425ffaed2026120b7b5260d))
- cache key generation
([e09434c](https://github.com/JonasKruckenberg/vite-imagetools/commit/e09434c65548230bfdce964264c0f9cc83aadd86))
- support nodejs LTS versions
([4abccc5](https://github.com/JonasKruckenberg/vite-imagetools/commit/4abccc53700ad55d04dc0c2142b6dc8d69ebf122)),
closes [#51](https://github.com/JonasKruckenberg/vite-imagetools/issues/51)
- update cache key geneartion to match spec
([7f0a0e8](https://github.com/JonasKruckenberg/vite-imagetools/commit/7f0a0e8bf20189e12425ffaed2026120b7b5260d))
### Features
- allow metadata removal to be toggled by option ([5d0c781](https://github.com/JonasKruckenberg/vite-imagetools/commit/5d0c781c0a0511725c7d615e97b1e9b0c902009e))
- allow metadata removal to be toggled by option
([5d0c781](https://github.com/JonasKruckenberg/vite-imagetools/commit/5d0c781c0a0511725c7d615e97b1e9b0c902009e))

@@ -173,3 +213,5 @@ # [0.1.0-next.9](https://github.com/JonasKruckenberg/vite-imagetools/compare/imagetools-core@0.1.0-next.8...imagetools-core@0.1.0-next.9) (2021-03-30)

- support nodejs LTS versions ([4abccc5](https://github.com/JonasKruckenberg/vite-imagetools/commit/4abccc53700ad55d04dc0c2142b6dc8d69ebf122)), closes [#51](https://github.com/JonasKruckenberg/vite-imagetools/issues/51)
- support nodejs LTS versions
([4abccc5](https://github.com/JonasKruckenberg/vite-imagetools/commit/4abccc53700ad55d04dc0c2142b6dc8d69ebf122)),
closes [#51](https://github.com/JonasKruckenberg/vite-imagetools/issues/51)

@@ -180,3 +222,4 @@ # [0.1.0-next.8](https://github.com/JonasKruckenberg/vite-imagetools/compare/imagetools-core@0.1.0-next.7...imagetools-core@0.1.0-next.8) (2021-03-19)

- **imagetools-core:** Add image id generation utility ([9e0673d](https://github.com/JonasKruckenberg/vite-imagetools/commit/9e0673d039273283022be761fa8a1e06f5305d1c))
- **imagetools-core:** Add image id generation utility
([9e0673d](https://github.com/JonasKruckenberg/vite-imagetools/commit/9e0673d039273283022be761fa8a1e06f5305d1c))

@@ -187,3 +230,4 @@ # [0.1.0-next.7](https://github.com/JonasKruckenberg/vite-imagetools/compare/imagetools-core@0.1.0-next.6...imagetools-core@0.1.0-next.7) (2021-03-16)

- readd metadata annotations ([afa0b4b](https://github.com/JonasKruckenberg/vite-imagetools/commit/afa0b4b60c77560b30166ed47bcebeb20198e1b2))
- readd metadata annotations
([afa0b4b](https://github.com/JonasKruckenberg/vite-imagetools/commit/afa0b4b60c77560b30166ed47bcebeb20198e1b2))

@@ -206,3 +250,4 @@ # [0.1.0-next.6](https://github.com/JonasKruckenberg/vite-imagetools/compare/imagetools-core@0.1.0-next.5...imagetools-core@0.1.0-next.6) (2021-03-15)

- fix imagetools core ([5a09e00](https://github.com/JonasKruckenberg/vite-imagetools/commit/5a09e00a518d154773599eaa0a9879352c3b923e))
- fix imagetools core
([5a09e00](https://github.com/JonasKruckenberg/vite-imagetools/commit/5a09e00a518d154773599eaa0a9879352c3b923e))

@@ -221,12 +266,17 @@ # [0.1.0-next.2](https://github.com/JonasKruckenberg/vite-imagetools/compare/imagetools-core@0.1.0-next.1...imagetools-core@0.1.0-next.2) (2021-03-15)

- blur directive argument parsing ([e48448d](https://github.com/JonasKruckenberg/vite-imagetools/commit/e48448db86f2eceb667bd57ce99eefa57506ea3c))
- consolidate functions into main ([0772934](https://github.com/JonasKruckenberg/vite-imagetools/commit/0772934bd6306867498c82d1c681a614a3347503))
- blur directive argument parsing
([e48448d](https://github.com/JonasKruckenberg/vite-imagetools/commit/e48448db86f2eceb667bd57ce99eefa57506ea3c))
- consolidate functions into main
([0772934](https://github.com/JonasKruckenberg/vite-imagetools/commit/0772934bd6306867498c82d1c681a614a3347503))
### Features
- add caching utils ([2cc2d90](https://github.com/JonasKruckenberg/vite-imagetools/commit/2cc2d9062184f69c012cab086f76a608a2eb2f1e))
- add util functions ([c36d840](https://github.com/JonasKruckenberg/vite-imagetools/commit/c36d840605ae6da20df8903e39009920e863efe9))
- add caching utils
([2cc2d90](https://github.com/JonasKruckenberg/vite-imagetools/commit/2cc2d9062184f69c012cab086f76a608a2eb2f1e))
- add util functions
([c36d840](https://github.com/JonasKruckenberg/vite-imagetools/commit/c36d840605ae6da20df8903e39009920e863efe9))
### Reverts
- Revert "Publish" ([c0186f1](https://github.com/JonasKruckenberg/vite-imagetools/commit/c0186f12c595b6cedf3341a8de018f9a7f48a7c4))
- Revert "Publish"
([c0186f1](https://github.com/JonasKruckenberg/vite-imagetools/commit/c0186f12c595b6cedf3341a8de018f9a7f48a7c4))

@@ -1,3 +0,3 @@

import { Sharp } from "sharp";
import { ImageTransformation, TransformResult } from "../types";
import { Sharp } from 'sharp';
import { ImageTransformation, TransformResult } from '../types';
export declare function applyTransforms(transforms: ImageTransformation[], image: Sharp, removeMetadata?: boolean): Promise<TransformResult>;

@@ -1,2 +0,2 @@

import { ImageTransformation, ImageConfig, TransformFactory } from "../types";
import { ImageTransformation, ImageConfig, TransformFactory } from '../types';
export declare function generateTransforms(config: ImageConfig, factories: TransformFactory[]): {

@@ -3,0 +3,0 @@ transforms: ImageTransformation[];

@@ -1,2 +0,2 @@

import { Sharp } from "sharp";
import { Sharp } from 'sharp';
export declare const METADATA: unique symbol;

@@ -3,0 +3,0 @@ declare module 'sharp' {

@@ -0,1 +1,2 @@

import { OutputFormat } from '..';
/**

@@ -13,4 +14,2 @@ * This function calculates the cartesian product of two or more array and is straight from stackoverflow ;)

*/
export declare function resolveConfigs(entries: Array<[string, string[]]>): {
[k: string]: string;
}[];
export declare function resolveConfigs(entries: Array<[string, string[]]>, outputFormats: Record<string, OutputFormat>): Record<string, string | string[]>[];

@@ -1,2 +0,2 @@

import { TransformOption } from "../types";
import { TransformOption } from '../types';
export interface BackgroundOptions {

@@ -3,0 +3,0 @@ background: string;

@@ -1,2 +0,2 @@

import { TransformFactory } from "../types";
import { TransformFactory } from '../types';
export interface BlurOptions {

@@ -3,0 +3,0 @@ blur: string;

@@ -1,2 +0,2 @@

import { TransformOption } from "../types";
import { TransformOption } from '../types';
export declare const fitValues: readonly ["cover", "contain", "fill", "inside", "outside"];

@@ -3,0 +3,0 @@ export declare type FitValue = typeof fitValues[number];

@@ -1,2 +0,2 @@

import { TransformFactory } from "../types";
import { TransformFactory } from '../types';
export interface FlattenOptions {

@@ -3,0 +3,0 @@ flatten: '' | 'true';

@@ -1,2 +0,2 @@

import { TransformFactory } from "../types";
import { TransformFactory } from '../types';
export interface FlipOptions {

@@ -3,0 +3,0 @@ flip: '' | 'true';

@@ -1,2 +0,2 @@

import { TransformFactory } from "../types";
import { TransformFactory } from '../types';
export interface FlopOptions {

@@ -3,0 +3,0 @@ flop: '' | 'true';

@@ -1,2 +0,2 @@

import { TransformFactory } from "../types";
import { TransformFactory } from '../types';
export declare const formatValues: readonly ["avif", "jpg", "jpeg", "png", "heif", "heic", "webp", "tiff"];

@@ -3,0 +3,0 @@ export declare type FormatValue = typeof formatValues[number];

@@ -1,2 +0,2 @@

import { TransformFactory } from "../types";
import { TransformFactory } from '../types';
export interface GrayscaleOptions {

@@ -3,0 +3,0 @@ grayscale: '' | 'true';

@@ -1,2 +0,2 @@

import { TransformFactory } from "../types";
import { TransformFactory } from '../types';
export interface HSBOptions {

@@ -3,0 +3,0 @@ hue: string;

@@ -1,2 +0,2 @@

import { TransformFactory } from "../types";
import { TransformFactory } from '../types';
export interface InvertOptions {

@@ -3,0 +3,0 @@ invert: '' | 'true';

@@ -1,2 +0,2 @@

import { TransformOption } from "../types";
import { TransformOption } from '../types';
export declare const kernelValues: readonly ["nearest", "cubic", "mitchell", "lanczos2", "lanczos3"];

@@ -3,0 +3,0 @@ export declare type KernelValue = typeof kernelValues[number];

@@ -1,2 +0,2 @@

import { TransformFactory } from "../types";
import { TransformFactory } from '../types';
export interface MedianOptions {

@@ -3,0 +3,0 @@ median: string;

@@ -1,2 +0,2 @@

import { TransformFactory } from "../types";
import { TransformFactory } from '../types';
export interface NormalizeOptions {

@@ -3,0 +3,0 @@ normalize: '' | 'true';

@@ -1,2 +0,2 @@

import { TransformOption } from "../types";
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"];

@@ -3,0 +3,0 @@ export declare const positionShorthands: string[];

@@ -1,2 +0,2 @@

import { TransformOption } from "../types";
import { TransformOption } from '../types';
export interface ProgressiveOptions {

@@ -3,0 +3,0 @@ progressive: '' | 'true';

@@ -1,2 +0,2 @@

import { TransformOption } from "../types";
import { TransformOption } from '../types';
export interface QualityOptions {

@@ -3,0 +3,0 @@ quality: string;

@@ -1,2 +0,2 @@

import { TransformFactory } from "../types";
import { TransformFactory } from '../types';
export interface ResizeOptions {

@@ -3,0 +3,0 @@ width: string;

@@ -1,2 +0,2 @@

import { TransformFactory } from "../types";
import { TransformFactory } from '../types';
export interface RotateOptions {

@@ -3,0 +3,0 @@ rotate: string;

@@ -1,2 +0,2 @@

import { TransformFactory } from "../types";
import { TransformFactory } from '../types';
export interface TintOptions {

@@ -3,0 +3,0 @@ tint: string;

@@ -1,3 +0,3 @@

import { Sharp } from "sharp";
export declare type ImageConfig = Record<string, any>;
import { Sharp } from 'sharp';
export declare type ImageConfig = Record<string, unknown>;
export interface TransformFactoryContext {

@@ -7,9 +7,9 @@ useParam: (parameter: string) => void;

}
export declare type TransformFactory<A = {}> = (metadata: Partial<ImageConfig & A>, ctx: TransformFactoryContext) => ImageTransformation | undefined;
export declare type TransformOption<A = {}, T = any> = (metadata: Partial<ImageConfig & A>, image: Sharp) => T | undefined;
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 interface TransformResult {
image: Sharp;
metadata: Record<string, any>;
metadata: Record<string, unknown>;
}
export declare type OutputFormat = (metadata: ImageConfig[]) => any;
export declare type OutputFormat = (args?: string[]) => (metadata: ImageConfig[]) => unknown;

@@ -1,4 +0,4 @@

import sharp from "sharp";
import { ImageConfig } from "./types";
import sharp from 'sharp';
import { ImageConfig } from './types';
export declare function loadImage(path: string): sharp.Sharp;
export declare function generateImageID(url: URL, config: ImageConfig): string;
{
"name": "imagetools-core",
"version": "2.7.6",
"version": "2.8.0",
"main": "dist/index.cjs",

@@ -5,0 +5,0 @@ "module": "dist/index.mjs",

# imagetools-core
<!-- badges -->
![npm (tag)](https://img.shields.io/npm/v/imagetools-core)

@@ -8,7 +9,7 @@ [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)

A toolbox of import directives that can transform your image at compile-time.
All of the image transformations are powered by [sharp](https://sharp.pixelplumbing.com).
A toolbox of import directives that can transform your image at compile-time. All of the image transformations are
powered by [sharp](https://sharp.pixelplumbing.com).
> This package holds all transforms and core utility functions needed to integrate imagetools with any builtool,<br>
> or to create a standalone transformation server!
> This package holds all transforms and core utility functions needed to integrate imagetools with any builtool,<br> or
> to create a standalone transformation server!

@@ -37,12 +38,12 @@ > [Read the docs to learn more!](../../docs/README.md)

```js
import { loadImage, applyTransforms, builtins } from "imagetools-core"
import { loadImage, applyTransforms, builtins } from 'imagetools-core'
// loadImageFromDisk is a utility function that creates a sharp instances of the specified image
const image = loadImage("./example.jpg")
// loadImageFromDisk is a utility function that creates a sharp instances of the specified image
const image = loadImage('./example.jpg')
// our image configuration
const config = {
width: "400",
height: "300",
format: "webp"
width: '400',
height: '300',
format: 'webp'
}

@@ -62,3 +63,3 @@

```js
import { parseURL, resolveConfigs } from "imagetools-core"
import { parseURL, resolveConfigs } from 'imagetools-core'

@@ -70,3 +71,3 @@ const src = new URL('file:///example.jpg?w=300;500;700&format=webp')

// this function handles the ArgumentList logic
// this function handles the ArgumentList logic
// and produces an array of config objects that can be passed to generateTransforms

@@ -78,6 +79,7 @@ const configs = resolveConfigs(parameters)

Feel free to dive in! [Open an issue](https://github.com/JonasKruckenberg/imagetools/issues/new) or submit PRs!
All information to get you started hacking on imagetools is in [CONTRIBUTING.md](../../CONTRIBUTING.md)!
Feel free to dive in! [Open an issue](https://github.com/JonasKruckenberg/imagetools/issues/new) or submit PRs! All
information to get you started hacking on imagetools is in [CONTRIBUTING.md](../../CONTRIBUTING.md)!
## License
[MIT © Jonas Kruckenberg.](./LICENSE)
[MIT © Jonas Kruckenberg.](./LICENSE)

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc