diff --git a/CHANGELOG.md b/CHANGELOG.md index 80629d682..e4aa48035 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # v0.7.0 (Fri Sep 06 2019) -#### 🚀 Enhancement +#### 🚀 Enhancement - `@jimp/core`, `jimp`, `@jimp/utils` - Feature scanIterator [#781](https://github.com/oliver-moran/jimp/pull/781) ([@ozelot379](https://github.com/ozelot379)) @@ -13,7 +13,7 @@ # v0.6.8 (Tue Sep 03 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `jimp` - Remove dependency '@babel/polyfill' and add 'regenerator-runtime' [#783](https://github.com/oliver-moran/jimp/pull/783) ([@ebual](https://github.com/ebual) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -27,7 +27,7 @@ # v0.6.7 (Tue Sep 03 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/plugin-crop` - Plugin crop/fix safety checks [#743](https://github.com/oliver-moran/jimp/pull/743) ([@jagaSto](https://github.com/jagaSto)) @@ -40,7 +40,7 @@ # v0.6.6 (Tue Sep 03 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/plugin-crop` - Fix cropping full width slices [#741](https://github.com/oliver-moran/jimp/pull/741) ([@NiGhTTraX](https://github.com/NiGhTTraX)) @@ -53,7 +53,7 @@ # v0.6.5 (Tue Sep 03 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `jimp` - Fix types [#778](https://github.com/oliver-moran/jimp/pull/778) ([@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -64,13 +64,13 @@ - `jimp` - export more interfaces [#732](https://github.com/oliver-moran/jimp/pull/732) ([@pvolyntsev](https://github.com/pvolyntsev)) -#### 🏠 Internal +#### 🏠 Internal - Add Automated Releases [#784](https://github.com/oliver-moran/jimp/pull/784) ([@hipstersmoothie](https://github.com/hipstersmoothie)) - `@jimp/cli`, `@jimp/core`, `jimp`, `@jimp/plugin-crop`, `@jimp/plugin-rotate` - [WIP] circle ci time! [#777](https://github.com/oliver-moran/jimp/pull/777) ([@hipstersmoothie](https://github.com/hipstersmoothie)) -#### 📝 Documentation +#### 📝 Documentation - Replace `npm` usage with `yarn` [#782](https://github.com/oliver-moran/jimp/pull/782) ([@pvolyntsev](https://github.com/pvolyntsev)) - Add Nimp to readme.md. [#766](https://github.com/oliver-moran/jimp/pull/766) ([@pvolyntsev](https://github.com/pvolyntsev)) @@ -81,9 +81,9 @@ - `@jimp/plugin-gaussian` - fix gaussian example [#767](https://github.com/oliver-moran/jimp/pull/767) ([@Armanio](https://github.com/Armanio)) -#### ⚠️ Pushed to master +#### ⚠️ Pushed to master -- trust github.com ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- trust github.com ([@hipstersmoothie](https://github.com/hipstersmoothie)) #### Authors: 6 @@ -92,4 +92,4 @@ - Shen Yiming ([@soimy](https://github.com/soimy)) - Rob Moore ([@robert-moore](https://github.com/robert-moore)) - Ahmad Awais ⚡️ ([@ahmadawais](https://github.com/ahmadawais)) -- Arman ([@Armanio](https://github.com/Armanio)) \ No newline at end of file +- Arman ([@Armanio](https://github.com/Armanio)) diff --git a/packages/core/index.d.ts b/packages/core/index.d.ts new file mode 100644 index 000000000..2b9148248 --- /dev/null +++ b/packages/core/index.d.ts @@ -0,0 +1,335 @@ +export function addConstants(constants: [string, string | number], jimpInstance?: Jimp): void; +export function addJimpMethods(methods: [string, Function], jimpInstance?: Jimp): void; +export function jimpEvMethod(methodName: string, evName: string, method: Function): void; +export function jimpEvChange(methodName: string, method: Function): void; +export function addType(mime: string, extensions: string[]): void; + +interface BaseJimp { + prototype: Jimp; + // Constants + AUTO: -1; + // blend modes + BLEND_SOURCE_OVER: string; + BLEND_DESTINATION_OVER: string; + BLEND_MULTIPLY: string; + BLEND_SCREEN: string; + BLEND_OVERLAY: string; + BLEND_DARKEN: string; + BLEND_LIGHTEN: string; + BLEND_HARDLIGHT: string; + BLEND_DIFFERENCE: string; + BLEND_EXCLUSION: string; + // Align modes for cover, contain, bit masks + HORIZONTAL_ALIGN_LEFT: 1; + HORIZONTAL_ALIGN_CENTER: 2; + HORIZONTAL_ALIGN_RIGHT: 4; + VERTICAL_ALIGN_TOP: 8; + VERTICAL_ALIGN_MIDDLE: 16; + VERTICAL_ALIGN_BOTTOM: 32; + // Edge Handling + EDGE_EXTEND: 1; + EDGE_WRAP: 2; + EDGE_CROP: 3; + // Properties + bitmap: Bitmap; + _quality: number; + _deflateLevel: number; + _deflateStrategy: number; + _filterType: number; + _rgba: boolean; + _background: number; + _originalMime: string; + // Constructors + new(path: string, cb?: ImageCallback): Jimp; + new(urlOptions: URLOptions, cb?: ImageCallback): Jimp; + new(image: Jimp, cb?: ImageCallback): Jimp; + new(data: Buffer, cb?: ImageCallback): Jimp; + new(data: Bitmap, cb?: ImageCallback): Jimp; + new(w: number, h: number, cb?: ImageCallback): Jimp; + new( + w: number, + h: number, + background?: number | string, + cb?: ImageCallback + ): Jimp; + // For custom constructors when using Jimp.appendConstructorOption + new(...args: any[]): Jimp; + // Methods + on( + event: T, + cb: (data: ListenerData) => any + ): any; + parseBitmap( + data: Buffer, + path: string | null | undefined, + cb?: ImageCallback + ): void; + hasAlpha(): boolean; + getHeight(): number; + getWidth(): number; + inspect(): string; + toString(): string; + getMIME(): string; + getExtension(): string; + distanceFromHash(hash: string): number; + write(path: string, cb?: ImageCallback): this; + writeAsync(path: string): Promise; + deflateLevel(l: number, cb?: ImageCallback): this; + deflateStrategy(s: number, cb?: ImageCallback): this; + colorType(s: number, cb?: ImageCallback): this; + filterType(f: number, cb?: ImageCallback): this; + rgba(bool: boolean, cb?: ImageCallback): this; + quality(n: number, cb?: ImageCallback): this; + getBase64(mime: string, cb: GenericCallback): this; + getBase64Async(mime: string): Promise; + hash(cb?: GenericCallback): string; + hash( + base: number | null | undefined, + cb?: GenericCallback + ): string; + getBuffer(mime: string, cb: GenericCallback): this; + getBufferAsync(mime: string): Promise; + getPixelIndex( + x: number, + y: number, + cb?: GenericCallback + ): number; + getPixelIndex( + x: number, + y: number, + edgeHandling: string, + cb?: GenericCallback + ): number; + getPixelColor( + x: number, + y: number, + cb?: GenericCallback + ): number; + getPixelColour( + x: number, + y: number, + cb?: GenericCallback + ): number; + setPixelColor(hex: number, x: number, y: number, cb?: ImageCallback): this; + setPixelColour(hex: number, x: number, y: number, cb?: ImageCallback): this; + clone(cb?: ImageCallback): this; + cloneQuiet(cb?: ImageCallback): this; + background(hex: number, cb?: ImageCallback): this; + backgroundQuiet(hex: number, cb?: ImageCallback): this; + scan( + x: number, + y: number, + w: number, + h: number, + f: (this: this, x: number, y: number, idx: number) => any, + cb?: ImageCallback + ): this; + scanQuiet( + x: number, + y: number, + w: number, + h: number, + f: (this: this, x: number, y: number, idx: number) => any, + cb?: ImageCallback + ): this; + scanIterator( + x: number, + y: number, + w: number, + h: number + ): IterableIterator<{x: number, y: number, idx: number, image: Jimp}>; + + // Effect methods + composite( + src: Jimp, + x: number, + y: number, + options?: BlendMode, + cb?: ImageCallback + ): this; + + // Functions + appendConstructorOption( + name: string, + test: (...args: T[]) => boolean, + run: ( + this: Jimp, + resolve: (jimp: Jimp) => any, + reject: (reason: Error) => any, + ...args: T[] + ) => any + ): void; + read(path: string): Promise; + read(image: Jimp): Promise; + read(data: Buffer): Promise; + read(w: number, h: number, background?: number | string): Promise; + create(path: string): Promise; + create(image: Jimp): Promise; + create(data: Buffer): Promise; + create(w: number, h: number, background?: number | string): Promise; + rgbaToInt( + r: number, + g: number, + b: number, + a: number, + cb: GenericCallback + ): number; + intToRGBA(i: number, cb?: GenericCallback): RGBA; + cssColorToHex(cssColor: string): number; + limit255(n: number): number; + diff( + img1: Jimp, + img2: Jimp, + threshold?: number + ): { + percent: number; + image: Jimp; + }; + distance(img1: Jimp, img2: Jimp): number; + compareHashes(hash1: string, hash2: string): number; + colorDiff(rgba1: RGB, rgba2: RGB): number; + colorDiff(rgba1: RGBA, rgba2: RGBA): number; +} + +export interface Image { + bitmap: Bitmap; +} + +// This must be exported to fix the "index signature missing" error +export interface IllformedPlugin { + class?: never; + constants?: never; + [classFunc: string]: Function +} + +export type DecoderFn = (data: Buffer) => Bitmap +export type EncoderFn = (image: ImageType) => Buffer + +interface WellFormedPlugin { + mime?: { + [MIME_TYPE: string]: string[]; + }; + hasAlpha?: { + [MIME_SPECIAL: string]: boolean; + }; + constants?: { + // Contants to assign to the Jimp instance + [MIME_SPECIAL: string]: any; + }; + decoders?: { + [MIME_TYPE: string]: DecoderFn; + }; + encoders?: { + // Jimp Image + [MIME_TYPE: string]: EncoderFn; + }; + // Extend the Jimp class with the following constants, etc + class?: any; +} + +type ClassOrConstantPlugin = WellFormedPlugin & ( + Required, 'class'>> | Required, 'constants'>> + ); + +// A Jimp type requires mime, but not class +export type JimpType = WellFormedPlugin & Required, 'mime'>>; + +// Jimp plugin either MUST have class OR constant or be illformed +export type JimpPlugin = ClassOrConstantPlugin | IllformedPlugin; + +export type PluginFunction = () => JimpPlugin; +export type TypeFunction = () => JimpType; + +// This is required as providing type arrays gives a union of all the generic +// types in the array rather than an intersection +type UnionToIntersection = + (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never + +// The values to be extracted from a WellFormedPlugin to put onto the Jimp instance +type WellFormedValues = T['class'] & T['constants']; + +// Jimp generic to be able to put plugins and types into, thus allowing +// `configure` from `@jimp/custom` to have proper typings +export type Jimp = + BaseJimp + & UnionToIntersection> + & UnionToIntersection<(P extends WellFormedPlugin ? WellFormedValues

: P)> + +export type GenericCallback = ( + this: TThis, + err: Error | null, + value: T +) => U; + +export type ImageCallback = ( + this: Jimp, + err: Error | null, + value: Jimp, + coords: { + x: number; + y: number; + } +) => U; + +type BlendMode = { + mode: string; + opacitySource: number; + opacityDest: number; +}; + +type ChangeName = 'background' | 'scan' | 'crop'; + +type ListenableName = + | 'any' + | 'initialized' + | 'before-change' + | 'changed' + | 'before-clone' + | 'cloned' + | ChangeName; + +type ListenerData = T extends 'any' + ? any + : T extends ChangeName + ? { + eventName: 'before-change' | 'changed'; + methodName: T; + [key: string]: any; + } + : { + eventName: T; + methodName: T extends 'initialized' + ? 'constructor' + : T extends 'before-change' | 'changed' + ? ChangeName + : T extends 'before-clone' | 'cloned' ? 'clone' : any; + }; + +type URLOptions = { + url: string; + compression?: boolean; + headers: { + [key: string]: any; + }; +}; + +export interface Bitmap { + data: Buffer; + width: number; + height: number; +} + +export interface RGB { + r: number; + g: number; + b: number; +} + +export interface RGBA { + r: number; + g: number; + b: number; + a: number; +} + +export default Jimp; diff --git a/packages/core/package.json b/packages/core/package.json index d3cc39711..f526587b7 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -4,10 +4,11 @@ "description": "Jimp core", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "files": [ "dist", "es", - "jimp.d.ts", + "index.d.ts", "fonts" ], "repository": { diff --git a/packages/custom/README.md b/packages/custom/README.md index a083c37ee..e7892bb6a 100644 --- a/packages/custom/README.md +++ b/packages/custom/README.md @@ -69,7 +69,7 @@ jimp = configure( To define a new Jimp image type write a function the takes the current Jimp configuration. In this function you can extend Jimp's internal data structures. -This function must return and array whose first element is the mime type and second element is an array of valid file extensions. +This function must return an object whose key is the mime type and value is an array of valid file extensions. ```js const special = require('special-js'); @@ -77,7 +77,7 @@ const special = require('special-js'); const MIME_TYPE = 'image/special'; export default () => ({ - mime: [MIME_TYPE, ['spec', 'special']], + mime: {[MIME_TYPE], ['spec', 'special']}, constants: { MIME_SPECIAL: MIME_TYPE diff --git a/packages/custom/index.d.ts b/packages/custom/index.d.ts new file mode 100644 index 000000000..2413bb64a --- /dev/null +++ b/packages/custom/index.d.ts @@ -0,0 +1,14 @@ +import { + Jimp, + JimpPlugin, + JimpType, + TypeFunction, + PluginFunction +} from '@jimp/core'; + +export default function configure(configuration: { + types?: TypeFunction[], + plugins?: PluginFunction[] +}, jimpInstance?: JimpInst): JimpInst & Jimp; diff --git a/packages/custom/package.json b/packages/custom/package.json index 35c71da55..c68e9e0cc 100644 --- a/packages/custom/package.json +++ b/packages/custom/package.json @@ -4,6 +4,7 @@ "description": "Interface to customize jimp configuration", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", "build:watch": "npm run build:node:debug -- -- --watch --verbose", diff --git a/packages/jimp/README.md b/packages/jimp/README.md index 40ef8aec6..509f104ed 100644 --- a/packages/jimp/README.md +++ b/packages/jimp/README.md @@ -318,14 +318,14 @@ Jimp.VERTICAL_ALIGN_BOTTOM; Where the align mode changes the position of the associated axis as described in the table below. -Align Mode | Axis Point ---- | --- -`Jimp.HORIZONTAL_ALIGN_LEFT` | Positions the x-axis at the left of the image -`Jimp.HORIZONTAL_ALIGN_CENTER` | Positions the x-axis at the center of the image -`Jimp.HORIZONTAL_ALIGN_RIGHT` | Positions the x-axis at the right of the image -`Jimp.VERTICAL_ALIGN_TOP` | Positions the y-axis at the top of the image -`Jimp.VERTICAL_ALIGN_MIDDLE` | Positions the y-axis at the center of the image -`Jimp.VERTICAL_ALIGN_BOTTOM` | Positions the y-axis at the bottom of the image +| Align Mode | Axis Point | +| ------------------------------ | ----------------------------------------------- | +| `Jimp.HORIZONTAL_ALIGN_LEFT` | Positions the x-axis at the left of the image | +| `Jimp.HORIZONTAL_ALIGN_CENTER` | Positions the x-axis at the center of the image | +| `Jimp.HORIZONTAL_ALIGN_RIGHT` | Positions the x-axis at the right of the image | +| `Jimp.VERTICAL_ALIGN_TOP` | Positions the y-axis at the top of the image | +| `Jimp.VERTICAL_ALIGN_MIDDLE` | Positions the y-axis at the center of the image | +| `Jimp.VERTICAL_ALIGN_BOTTOM` | Positions the y-axis at the bottom of the image | For example: @@ -640,8 +640,12 @@ image.scan(0, 0, image.bitmap.width, image.bitmap.height, function(x, y, idx) { It's possible to make an iterator scan with a `for ... of`, if you want to `break` the scan before it reaches the end, but note, that this iterator has a huge performance implication: ```js -for (const { x, y, idx, image } of image.scanIterator(0, 0, image.bitmap.width, image.bitmap.height)) { - +for (const { x, y, idx, image } of image.scanIterator( + 0, + 0, + image.bitmap.width, + image.bitmap.height +)) { } ``` diff --git a/packages/jimp/index.d.ts b/packages/jimp/index.d.ts new file mode 100644 index 000000000..6256448a8 --- /dev/null +++ b/packages/jimp/index.d.ts @@ -0,0 +1,27 @@ +import { + Jimp as JimpType, + Bitmap, + RGB, + RGBA +} from '@jimp/core'; +import typeFn from '@jimp/types'; +import pluginFn from '@jimp/plugins'; + +type Types = ReturnType; +type Plugins = ReturnType; + +declare const Jimp: JimpType; +export default Jimp; + +export { + Bitmap, + RGB, + RGBA +} + +export { + FontChar, + FontInfo, + FontCommon, + Font +} from '@jimp/plugin-print'; diff --git a/packages/jimp/jimp.d.ts b/packages/jimp/jimp.d.ts deleted file mode 100644 index 8d4ab890d..000000000 --- a/packages/jimp/jimp.d.ts +++ /dev/null @@ -1,535 +0,0 @@ -declare const Jimp: Jimp; - -export default Jimp; - -export interface Jimp { - // Constructors - new (path: string, cb?: ImageCallback): Jimp; - new (urlOptions: URLOptions, cb?: ImageCallback): Jimp; - new (image: Jimp, cb?: ImageCallback): Jimp; - new (data: Buffer, cb?: ImageCallback): Jimp; - new (data: Bitmap, cb?: ImageCallback): Jimp; - new (w: number, h: number, cb?: ImageCallback): Jimp; - new ( - w: number, - h: number, - background?: number | string, - cb?: ImageCallback - ): Jimp; - // For custom constructors when using Jimp.appendConstructorOption - new (...args: any[]): Jimp; - prototype: Jimp; - - // Constants - AUTO: -1; - - // supported mime types - MIME_PNG: 'image/png'; - MIME_TIFF: 'image/tiff'; - MIME_JPEG: 'image/jpeg'; - MIME_JGD: 'image/jgd'; - MIME_BMP: 'image/bmp'; - MIME_X_MS_BMP: 'image/x-ms-bmp'; - MIME_GIF: 'image/gif'; - // PNG filter types - PNG_FILTER_AUTO: -1; - PNG_FILTER_NONE: 0; - PNG_FILTER_SUB: 1; - PNG_FILTER_UP: 2; - PNG_FILTER_AVERAGE: 3; - PNG_FILTER_PATH: 4; - - // resize methods - RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor'; - RESIZE_BILINEAR: 'bilinearInterpolation'; - RESIZE_BICUBIC: 'bicubicInterpolation'; - RESIZE_HERMITE: 'hermiteInterpolation'; - RESIZE_BEZIER: 'bezierInterpolation'; - - // blend modes - BLEND_SOURCE_OVER: string; - BLEND_DESTINATION_OVER: string; - BLEND_MULTIPLY: string; - BLEND_SCREEN: string; - BLEND_OVERLAY: string; - BLEND_DARKEN: string; - BLEND_LIGHTEN: string; - BLEND_HARDLIGHT: string; - BLEND_DIFFERENCE: string; - BLEND_EXCLUSION: string; - - // Align modes for cover, contain, bit masks - HORIZONTAL_ALIGN_LEFT: 1; - HORIZONTAL_ALIGN_CENTER: 2; - HORIZONTAL_ALIGN_RIGHT: 4; - - VERTICAL_ALIGN_TOP: 8; - VERTICAL_ALIGN_MIDDLE: 16; - VERTICAL_ALIGN_BOTTOM: 32; - - // Font locations - FONT_SANS_8_BLACK: string; - FONT_SANS_10_BLACK: string; - FONT_SANS_12_BLACK: string; - FONT_SANS_14_BLACK: string; - FONT_SANS_16_BLACK: string; - FONT_SANS_32_BLACK: string; - FONT_SANS_64_BLACK: string; - FONT_SANS_128_BLACK: string; - - FONT_SANS_8_WHITE: string; - FONT_SANS_16_WHITE: string; - FONT_SANS_32_WHITE: string; - FONT_SANS_64_WHITE: string; - FONT_SANS_128_WHITE: string; - - // Edge Handling - EDGE_EXTEND: 1; - EDGE_WRAP: 2; - EDGE_CROP: 3; - - // Properties - bitmap: Bitmap; - - _quality: number; - _deflateLevel: number; - _deflateStrategy: number; - _filterType: number; - _rgba: boolean; - _background: number; - _originalMime: string; - - // Methods - on( - event: T, - cb: (data: ListenerData) => any - ): any; - parseBitmap( - data: Buffer, - path: string | null | undefined, - cb?: ImageCallback - ): void; - hasAlpha(): boolean; - getHeight(): number; - getWidth(): number; - inspect(): string; - toString(): string; - getMIME(): string; - getExtension(): string; - distanceFromHash(hash: string): number; - write(path: string, cb?: ImageCallback): this; - writeAsync(path: string): Promise; - deflateLevel(l: number, cb?: ImageCallback): this; - deflateStrategy(s: number, cb?: ImageCallback): this; - colorType(s: number, cb?: ImageCallback): this; - filterType(f: number, cb?: ImageCallback): this; - rgba(bool: boolean, cb?: ImageCallback): this; - quality(n: number, cb?: ImageCallback): this; - getBase64(mime: string, cb: GenericCallback): this; - getBase64Async(mime: string): Promise; - hash(cb?: GenericCallback): string; - hash( - base: number | null | undefined, - cb?: GenericCallback - ): string; - getBuffer(mime: string, cb: GenericCallback): this; - getBufferAsync(mime: string): Promise; - getPixelIndex( - x: number, - y: number, - cb?: GenericCallback - ): number; - getPixelIndex( - x: number, - y: number, - edgeHandling: string, - cb?: GenericCallback - ): number; - getPixelColor( - x: number, - y: number, - cb?: GenericCallback - ): number; - getPixelColour( - x: number, - y: number, - cb?: GenericCallback - ): number; - setPixelColor(hex: number, x: number, y: number, cb?: ImageCallback): this; - setPixelColour(hex: number, x: number, y: number, cb?: ImageCallback): this; - clone(cb?: ImageCallback): this; - cloneQuiet(cb?: ImageCallback): this; - background(hex: number, cb?: ImageCallback): this; - backgroundQuiet(hex: number, cb?: ImageCallback): this; - scan( - x: number, - y: number, - w: number, - h: number, - f: (this: this, x: number, y: number, idx: number) => any, - cb?: ImageCallback - ): this; - scanQuiet( - x: number, - y: number, - w: number, - h: number, - f: (this: this, x: number, y: number, idx: number) => any, - cb?: ImageCallback - ): this; - scanIterator( - x: number, - y: number, - w: number, - h: number - ): IterableIterator<{x: number, y: number, idx: number, image: Jimp}>; - crop(x: number, y: number, w: number, h: number, cb?: ImageCallback): this; - cropQuiet( - x: number, - y: number, - w: number, - h: number, - cb?: ImageCallback - ): this; - - // Color methods - brightness(val: number, cb?: ImageCallback): this; - contrast(val: number, cb?: ImageCallback): this; - posterize(n: number, cb?: ImageCallback): this; - greyscale(cb?: ImageCallback): this; - grayscale(cb?: ImageCallback): this; - opacity(f: number, cb?: ImageCallback): this; - sepia(cb?: ImageCallback): this; - fade(f: number, cb?: ImageCallback): this; - convolution(kernel: number[][], cb?: ImageCallback): this; - convolution( - kernel: number[][], - edgeHandling: string, - cb?: ImageCallback - ): this; - opaque(cb?: ImageCallback): this; - pixelate(size: number, cb?: ImageCallback): this; - pixelate( - size: number, - x: number, - y: number, - w: number, - h: number, - cb?: ImageCallback - ): this; - convolute(kernel: number[][], cb?: ImageCallback): this; - convolute( - kernel: number[][], - x: number, - y: number, - w: number, - h: number, - cb?: ImageCallback - ): this; - color(actions: ColorAction[], cb?: ImageCallback): this; - colour(actions: ColorAction[], cb?: ImageCallback): this; - - // Shape methods - rotate(deg: number, cb?: ImageCallback): this; - rotate(deg: number, mode: string | boolean, cb?: ImageCallback): this; - flip(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this; - mirror(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this; - resize(w: number, h: number, cb?: ImageCallback): this; - resize(w: number, h: number, mode?: string, cb?: ImageCallback): this; - cover(w: number, h: number, cb?: ImageCallback): this; - cover(w: number, h: number, alignBits?: number, cb?: ImageCallback): this; - cover( - w: number, - h: number, - alignBits?: number, - mode?: string, - cb?: ImageCallback - ): this; - contain(w: number, h: number, cb?: ImageCallback): this; - contain(w: number, h: number, mode?: string, cb?: ImageCallback): this; - contain(w: number, h: number, alignBits?: number, cb?: ImageCallback): this; - contain( - w: number, - h: number, - alignBits?: number, - mode?: string, - cb?: ImageCallback - ): this; - scale(f: number, cb?: ImageCallback): this; - scale(f: number, mode?: string, cb?: ImageCallback): this; - scaleToFit(w: number, h: number, cb?: ImageCallback): this; - scaleToFit(w: number, h: number, mode?: string, cb?: ImageCallback): this; - displace(map: Jimp, offset: number, cb?: ImageCallback): this; - autocrop(tolerance?: number, cb?: ImageCallback): this; - autocrop(cropOnlyFrames?: boolean, cb?: ImageCallback): this; - autocrop( - tolerance?: number, - cropOnlyFrames?: boolean, - cb?: ImageCallback - ): this; - autocrop( - options: { - tolerance?: number; - cropOnlyFrames?: boolean; - cropSymmetric?: boolean; - leaveBorder?: number; - }, - cb?: ImageCallback - ): this; - - // Text methods - print( - font: Font, - x: number, - y: number, - text: PrintableText, - cb?: ImageCallback - ): this; - print( - font: Font, - x: number, - y: number, - text: PrintableText, - maxWidth?: number, - cb?: ImageCallback - ): this; - print( - font: Font, - x: number, - y: number, - text: PrintableText, - maxWidth?: number, - maxHeight?: number, - cb?: ImageCallback - ): this; - - // Effect methods - blur(r: number, cb?: ImageCallback): this; - dither565(cb?: ImageCallback): this; - dither16(cb?: ImageCallback): this; - histogram(): { - r: number[]; - g: number[]; - b: number[]; - }; - normalize(cb?: ImageCallback): this; - invert(cb?: ImageCallback): this; - gaussian(r: number, cb?: ImageCallback): this; - composite( - src: Jimp, - x: number, - y: number, - options?: BlendMode, - cb?: ImageCallback - ): this; - blit(src: Jimp, x: number, y: number, cb?: ImageCallback): this; - blit( - src: Jimp, - x: number, - y: number, - srcx: number, - srcy: number, - srcw: number, - srch: number, - cb?: ImageCallback - ): this; - mask(src: Jimp, x: number, y: number, cb?: ImageCallback): this; - - // Functions - appendConstructorOption( - name: string, - test: (...args: T[]) => boolean, - run: ( - this: Jimp, - resolve: (jimp: Jimp) => any, - reject: (reason: Error) => any, - ...args: T[] - ) => any - ): void; - read(path: string): Promise; - read(image: Jimp): Promise; - read(data: Buffer): Promise; - read(w: number, h: number, background?: number | string): Promise; - create(path: string): Promise; - create(image: Jimp): Promise; - create(data: Buffer): Promise; - create(w: number, h: number, background?: number | string): Promise; - rgbaToInt( - r: number, - g: number, - b: number, - a: number, - cb: GenericCallback - ): number; - intToRGBA(i: number, cb?: GenericCallback): RGBA; - cssColorToHex(cssColor: string): number; - limit255(n: number): number; - diff( - img1: Jimp, - img2: Jimp, - threshold?: number - ): { - percent: number; - image: Jimp; - }; - distance(img1: Jimp, img2: Jimp): number; - compareHashes(hash1: string, hash2: string): number; - colorDiff(rgba1: RGB, rgba2: RGB): number; - colorDiff(rgba1: RGBA, rgba2: RGBA): number; - loadFont(file: string): Promise; - loadFont(file: string, cb: GenericCallback): Promise; - measureText(font: Font, text: PrintableText): number; - measureTextHeight(font: Font, text: PrintableText, maxWidth: number): number; -} - -type GenericCallback = ( - this: TThis, - err: Error | null, - value: T -) => U; - -type ImageCallback = ( - this: Jimp, - err: Error | null, - value: Jimp, - coords: { - x: number; - y: number; - } -) => U; - -type ColorActionName = - | 'mix' - | 'tint' - | 'shade' - | 'xor' - | 'red' - | 'green' - | 'blue' - | 'hue'; - -type ColorAction = { - apply: ColorActionName; - params: any; -}; - -type BlendMode = { - mode: string; - opacitySource: number; - opacityDest: number; -}; - -type ChangeName = 'background' | 'scan' | 'crop'; - -type ListenableName = - | 'any' - | 'initialized' - | 'before-change' - | 'changed' - | 'before-clone' - | 'cloned' - | ChangeName; - -type ListenerData = T extends 'any' - ? any - : T extends ChangeName - ? { - eventName: 'before-change' | 'changed'; - methodName: T; - [key: string]: any; - } - : { - eventName: T; - methodName: T extends 'initialized' - ? 'constructor' - : T extends 'before-change' | 'changed' - ? ChangeName - : T extends 'before-clone' | 'cloned' ? 'clone' : any; - }; - -type PrintableText = - | any - | { - text: string; - alignmentX: number; - alignmentY: number; - }; - -type URLOptions = { - url: string; - compression?: boolean; - headers: { - [key: string]: any; - }; -}; - -export interface Bitmap { - data: Buffer; - width: number; - height: number; -} -export interface RGB { - r: number; - g: number; - b: number; -} -export interface RGBA { - r: number; - g: number; - b: number; - a: number; -} - -export interface FontChar { - id: number; - x: number; - y: number; - width: number; - height: number; - xoffset: number; - yoffset: number; - xadvance: number; - page: number; - chnl: number; -} - -export interface FontInfo { - face: string; - size: number; - bold: number; - italic: number; - charset: string; - unicode: number; - stretchH: number; - smooth: number; - aa: number; - padding: [number, number, number, number]; - spacing: [number, number]; -} - -export interface FontCommon { - lineHeight: number; - base: number; - scaleW: number; - scaleH: number; - pages: number; - packed: number; - alphaChnl: number; - redChnl: number; - greenChnl: number; - blueChnl: number; -} - -export interface Font { - chars: { - [char: string]: FontChar; - }; - kernings: { - [firstString: string]: { - [secondString: string]: number; - }; - }; - pages: string[]; - common: FontCommon; - info: FontInfo; -} diff --git a/packages/jimp/package.json b/packages/jimp/package.json index e304b8633..3e6e960f7 100644 --- a/packages/jimp/package.json +++ b/packages/jimp/package.json @@ -5,13 +5,13 @@ "main": "dist/index.js", "module": "es/index.js", "browser": "browser/lib/jimp.js", - "types": "jimp.d.ts", + "types": "index.d.ts", "tonicExampleFilename": "example.js", "files": [ "browser", "dist", "es", - "jimp.d.ts", + "index.d.ts", "fonts" ], "repository": { diff --git a/packages/plugin-blit/index.d.ts b/packages/plugin-blit/index.d.ts new file mode 100644 index 000000000..d62d0c577 --- /dev/null +++ b/packages/plugin-blit/index.d.ts @@ -0,0 +1,17 @@ +import { Jimp, ImageCallback, IllformedPlugin } from '@jimp/core'; + +interface Blit extends IllformedPlugin { + blit(src: Jimp, x: number, y: number, cb?: ImageCallback): this; + blit( + src: Jimp, + x: number, + y: number, + srcx: number, + srcy: number, + srcw: number, + srch: number, + cb?: ImageCallback + ): this; +} + +export default function(): Blit; diff --git a/packages/plugin-blit/package.json b/packages/plugin-blit/package.json index 5a80262c3..cdac06818 100644 --- a/packages/plugin-blit/package.json +++ b/packages/plugin-blit/package.json @@ -4,6 +4,7 @@ "description": "Blit an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/plugin-blur/index.d.ts b/packages/plugin-blur/index.d.ts new file mode 100644 index 000000000..e8c8b7e74 --- /dev/null +++ b/packages/plugin-blur/index.d.ts @@ -0,0 +1,7 @@ +import { IllformedPlugin, ImageCallback } from '@jimp/core'; + +interface Blur extends IllformedPlugin { + blur(r: number, cb?: ImageCallback): this; +} + +export default function(): Blur; diff --git a/packages/plugin-blur/package.json b/packages/plugin-blur/package.json index 96ae5d7e8..b37becdf5 100644 --- a/packages/plugin-blur/package.json +++ b/packages/plugin-blur/package.json @@ -4,6 +4,7 @@ "description": "blur an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", "build:watch": "npm run build:node:debug -- -- --watch --verbose", diff --git a/packages/plugin-circle/index.d.ts b/packages/plugin-circle/index.d.ts new file mode 100644 index 000000000..eb40488df --- /dev/null +++ b/packages/plugin-circle/index.d.ts @@ -0,0 +1,12 @@ +import { ImageCallback } from '@jimp/core'; + +interface Circle { + circle(options?: { + radius: number, + x: number, + y: number + }, cb?: ImageCallback): this; + circle(cb?: ImageCallback): this; +} + +export default function(): Circle; diff --git a/packages/plugin-circle/package.json b/packages/plugin-circle/package.json index 183737689..b76c29ffd 100644 --- a/packages/plugin-circle/package.json +++ b/packages/plugin-circle/package.json @@ -4,6 +4,7 @@ "description": "Creates a circle out of an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/plugin-color/index.d.ts b/packages/plugin-color/index.d.ts new file mode 100644 index 000000000..b77e925ad --- /dev/null +++ b/packages/plugin-color/index.d.ts @@ -0,0 +1,56 @@ +import { IllformedPlugin, ImageCallback } from '@jimp/core'; + +type ColorActionName = + | 'mix' + | 'tint' + | 'shade' + | 'xor' + | 'red' + | 'green' + | 'blue' + | 'hue'; + +type ColorAction = { + apply: ColorActionName; + params: any; +}; + +interface Color extends IllformedPlugin { + brightness(val: number, cb?: ImageCallback): this; + contrast(val: number, cb?: ImageCallback): this; + posterize(n: number, cb?: ImageCallback): this; + greyscale(cb?: ImageCallback): this; + grayscale(cb?: ImageCallback): this; + opacity(f: number, cb?: ImageCallback): this; + sepia(cb?: ImageCallback): this; + fade(f: number, cb?: ImageCallback): this; + convolution(kernel: number[][], cb?: ImageCallback): this; + convolution( + kernel: number[][], + edgeHandling: string, + cb?: ImageCallback + ): this; + opaque(cb?: ImageCallback): this; + pixelate(size: number, cb?: ImageCallback): this; + pixelate( + size: number, + x: number, + y: number, + w: number, + h: number, + cb?: ImageCallback + ): this; + convolute(kernel: number[][], cb?: ImageCallback): this; + convolute( + kernel: number[][], + x: number, + y: number, + w: number, + h: number, + cb?: ImageCallback + ): this; + color(actions: ColorAction[], cb?: ImageCallback): this; + colour(actions: ColorAction[], cb?: ImageCallback): this; +} + +export default function(): Color; diff --git a/packages/plugin-color/package.json b/packages/plugin-color/package.json index 2b1a4a45a..78103f59c 100644 --- a/packages/plugin-color/package.json +++ b/packages/plugin-color/package.json @@ -4,6 +4,7 @@ "description": "Bitmap manipulation to adjust the color in an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/plugin-contain/index.d.ts b/packages/plugin-contain/index.d.ts new file mode 100644 index 000000000..517e2fa1f --- /dev/null +++ b/packages/plugin-contain/index.d.ts @@ -0,0 +1,16 @@ +import { IllformedPlugin, ImageCallback } from '@jimp/core'; + +interface Contain extends IllformedPlugin { + contain(w: number, h: number, cb?: ImageCallback): this; + contain(w: number, h: number, mode?: string, cb?: ImageCallback): this; + contain(w: number, h: number, alignBits?: number, cb?: ImageCallback): this; + contain( + w: number, + h: number, + alignBits?: number, + mode?: string, + cb?: ImageCallback + ): this; +} + +export default function(): Contain; diff --git a/packages/plugin-contain/package.json b/packages/plugin-contain/package.json index 14f36694e..b8c1cd301 100644 --- a/packages/plugin-contain/package.json +++ b/packages/plugin-contain/package.json @@ -4,6 +4,7 @@ "description": "contain an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/plugin-cover/index.d.ts b/packages/plugin-cover/index.d.ts new file mode 100644 index 000000000..114c86642 --- /dev/null +++ b/packages/plugin-cover/index.d.ts @@ -0,0 +1,15 @@ +import { IllformedPlugin, ImageCallback } from '@jimp/core'; + +interface Cover extends IllformedPlugin { + cover(w: number, h: number, cb?: ImageCallback): this; + cover(w: number, h: number, alignBits?: number, cb?: ImageCallback): this; + cover( + w: number, + h: number, + alignBits?: number, + mode?: string, + cb?: ImageCallback + ): this; +} + +export default function(): Cover; diff --git a/packages/plugin-cover/package.json b/packages/plugin-cover/package.json index 9c2de2c21..dcb58a821 100644 --- a/packages/plugin-cover/package.json +++ b/packages/plugin-cover/package.json @@ -4,6 +4,7 @@ "description": "cover an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/plugin-crop/index.d.ts b/packages/plugin-crop/index.d.ts new file mode 100644 index 000000000..91bb96521 --- /dev/null +++ b/packages/plugin-crop/index.d.ts @@ -0,0 +1,33 @@ +import { Jimp, ImageCallback } from '@jimp/core'; + +interface Crop { + class: { + crop(x: number, y: number, w: number, h: number, cb?: ImageCallback): This; + cropQuiet( + x: number, + y: number, + w: number, + h: number, + cb?: ImageCallback + ): This; + + autocrop(tolerance?: number, cb?: ImageCallback): This; + autocrop(cropOnlyFrames?: boolean, cb?: ImageCallback): This; + autocrop( + tolerance?: number, + cropOnlyFrames?: boolean, + cb?: ImageCallback + ): This; + autocrop( + options: { + tolerance?: number; + cropOnlyFrames?: boolean; + cropSymmetric?: boolean; + leaveBorder?: number; + }, + cb?: ImageCallback + ): This; + } +} + +export default function(): Crop; diff --git a/packages/plugin-crop/package.json b/packages/plugin-crop/package.json index dc81c80f5..13eed4d3a 100644 --- a/packages/plugin-crop/package.json +++ b/packages/plugin-crop/package.json @@ -4,6 +4,7 @@ "description": "crop an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/plugin-crop/test/crop.test.js b/packages/plugin-crop/test/crop.test.js index 92144f812..88f64973b 100644 --- a/packages/plugin-crop/test/crop.test.js +++ b/packages/plugin-crop/test/crop.test.js @@ -7,13 +7,7 @@ const jimp = configure({ plugins: [crop] }, Jimp); describe('crop', () => { // 6x5 size - const testImage = mkJGD( - ' ◆◆ ', - ' ◆▦▦◆ ', - '◆▦▦▦▦◆', - ' ◆▦▦◆ ', - ' ◆◆ ' - ); + const testImage = mkJGD(' ◆◆ ', ' ◆▦▦◆ ', '◆▦▦▦▦◆', ' ◆▦▦◆ ', ' ◆◆ '); it('full width from top', async () => { const imgSrc = await jimp.read(testImage); @@ -21,12 +15,7 @@ describe('crop', () => { imgSrc .crop(0, 0, 6, 2) .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ◆◆ ', - ' ◆▦▦◆ ', - ) - ); + .should.be.sameJGD(mkJGD(' ◆◆ ', ' ◆▦▦◆ ')); }); it('full width from bottom', async () => { @@ -35,43 +24,25 @@ describe('crop', () => { imgSrc .crop(0, 3, 6, 2) .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ◆▦▦◆ ', - ' ◆◆ ' - ) - ); + .should.be.sameJGD(mkJGD(' ◆▦▦◆ ', ' ◆◆ ')); }); - + it('full width from middle', async () => { const imgSrc = await jimp.read(testImage); imgSrc .crop(0, 2, 6, 2) .getJGDSync() - .should.be.sameJGD( - mkJGD( - '◆▦▦▦▦◆', - ' ◆▦▦◆ ' - ) - ); + .should.be.sameJGD(mkJGD('◆▦▦▦▦◆', ' ◆▦▦◆ ')); }); - + it('full height from left', async () => { const imgSrc = await jimp.read(testImage); imgSrc .crop(0, 0, 2, 5) .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ◆', - '◆▦', - ' ◆', - ' ' - ) - ); + .should.be.sameJGD(mkJGD(' ', ' ◆', '◆▦', ' ◆', ' ')); }); it('full height from right', async () => { @@ -80,15 +51,7 @@ describe('crop', () => { imgSrc .crop(4, 0, 2, 5) .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - '◆ ', - '▦◆', - '◆ ', - ' ' - ) - ); + .should.be.sameJGD(mkJGD(' ', '◆ ', '▦◆', '◆ ', ' ')); }); it('full height from middle', async () => { @@ -97,14 +60,6 @@ describe('crop', () => { imgSrc .crop(2, 0, 2, 5) .getJGDSync() - .should.be.sameJGD( - mkJGD( - '◆◆', - '▦▦', - '▦▦', - '▦▦', - '◆◆' - ) - ); + .should.be.sameJGD(mkJGD('◆◆', '▦▦', '▦▦', '▦▦', '◆◆')); }); }); diff --git a/packages/plugin-displace/index.d.ts b/packages/plugin-displace/index.d.ts new file mode 100644 index 000000000..ae8a90e2d --- /dev/null +++ b/packages/plugin-displace/index.d.ts @@ -0,0 +1,7 @@ +import { Jimp, ImageCallback, IllformedPlugin } from '@jimp/core'; + +interface Displace extends IllformedPlugin { + displace(map: Jimp, offset: number, cb?: ImageCallback): this; +} + +export default function(): Displace; diff --git a/packages/plugin-displace/package.json b/packages/plugin-displace/package.json index fd94bf729..9b3f38b65 100644 --- a/packages/plugin-displace/package.json +++ b/packages/plugin-displace/package.json @@ -4,6 +4,7 @@ "description": "displace an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", "build:watch": "npm run build:node:debug -- -- --watch --verbose", diff --git a/packages/plugin-dither/index.d.ts b/packages/plugin-dither/index.d.ts new file mode 100644 index 000000000..3b03b7413 --- /dev/null +++ b/packages/plugin-dither/index.d.ts @@ -0,0 +1,8 @@ +import { IllformedPlugin, ImageCallback } from '@jimp/core'; + +interface Dither extends IllformedPlugin { + dither565(cb?: ImageCallback): this; + dither16(cb?: ImageCallback): this; +} + +export default function(): Dither; diff --git a/packages/plugin-dither/package.json b/packages/plugin-dither/package.json index 51af633a8..d1afe92c2 100644 --- a/packages/plugin-dither/package.json +++ b/packages/plugin-dither/package.json @@ -4,6 +4,7 @@ "description": "Dither an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", "build:watch": "npm run build:node:debug -- -- --watch --verbose", diff --git a/packages/plugin-fisheye/index.d.ts b/packages/plugin-fisheye/index.d.ts new file mode 100644 index 000000000..6944a727b --- /dev/null +++ b/packages/plugin-fisheye/index.d.ts @@ -0,0 +1,8 @@ +import { ImageCallback } from '@jimp/core'; + +interface Fisheye { + fishEye(opts?: { r: number }, cb?: ImageCallback): this; + fishEye(cb?: ImageCallback): this; +} + +export default function(): Fisheye; diff --git a/packages/plugin-fisheye/package.json b/packages/plugin-fisheye/package.json index 245d84639..e42de6d7a 100644 --- a/packages/plugin-fisheye/package.json +++ b/packages/plugin-fisheye/package.json @@ -4,6 +4,7 @@ "description": "Apply a fisheye effect to an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/plugin-flip/index.d.ts b/packages/plugin-flip/index.d.ts new file mode 100644 index 000000000..01e072ff9 --- /dev/null +++ b/packages/plugin-flip/index.d.ts @@ -0,0 +1,8 @@ +import { IllformedPlugin, ImageCallback } from '@jimp/core'; + +interface Flip extends IllformedPlugin { + flip(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this; + mirror(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this; +} + +export default function(): Flip; diff --git a/packages/plugin-flip/package.json b/packages/plugin-flip/package.json index 1d44ab03c..635082f57 100644 --- a/packages/plugin-flip/package.json +++ b/packages/plugin-flip/package.json @@ -4,6 +4,7 @@ "description": "flip an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", "build:watch": "npm run build:node:debug -- -- --watch --verbose", diff --git a/packages/plugin-gaussian/index.d.ts b/packages/plugin-gaussian/index.d.ts new file mode 100644 index 000000000..011f3eeef --- /dev/null +++ b/packages/plugin-gaussian/index.d.ts @@ -0,0 +1,7 @@ +import { IllformedPlugin, ImageCallback } from '@jimp/core'; + +interface Gaussian extends IllformedPlugin { + gaussian(r: number, cb?: ImageCallback): this; +} + +export default function(): Gaussian; diff --git a/packages/plugin-gaussian/package.json b/packages/plugin-gaussian/package.json index d8446961c..5693f30aa 100644 --- a/packages/plugin-gaussian/package.json +++ b/packages/plugin-gaussian/package.json @@ -4,6 +4,7 @@ "description": "gaussian blur an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", "build:watch": "npm run build:node:debug -- -- --watch --verbose", diff --git a/packages/plugin-invert/index.d.ts b/packages/plugin-invert/index.d.ts new file mode 100644 index 000000000..57fa40dbc --- /dev/null +++ b/packages/plugin-invert/index.d.ts @@ -0,0 +1,7 @@ +import { IllformedPlugin, ImageCallback } from '@jimp/core'; + +interface Invert extends IllformedPlugin { + invert(cb?: ImageCallback): this; +} + +export default function(): Invert; diff --git a/packages/plugin-invert/package.json b/packages/plugin-invert/package.json index 18c889ab2..37d54a8ef 100644 --- a/packages/plugin-invert/package.json +++ b/packages/plugin-invert/package.json @@ -4,6 +4,7 @@ "description": "invert an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", "build:watch": "npm run build:node:debug -- -- --watch --verbose", diff --git a/packages/plugin-mask/index.d.ts b/packages/plugin-mask/index.d.ts new file mode 100644 index 000000000..b8d4ea106 --- /dev/null +++ b/packages/plugin-mask/index.d.ts @@ -0,0 +1,7 @@ +import { IllformedPlugin, ImageCallback, Jimp } from '@jimp/core'; + +interface Mask extends IllformedPlugin { + mask(src: Jimp, x: number, y: number, cb?: ImageCallback): this; +} + +export default function(): Mask; diff --git a/packages/plugin-mask/package.json b/packages/plugin-mask/package.json index e5b1f942d..d6fb4e4b6 100644 --- a/packages/plugin-mask/package.json +++ b/packages/plugin-mask/package.json @@ -4,6 +4,7 @@ "description": "mask an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/plugin-normalize/index.d.ts b/packages/plugin-normalize/index.d.ts new file mode 100644 index 000000000..105d639be --- /dev/null +++ b/packages/plugin-normalize/index.d.ts @@ -0,0 +1,7 @@ +import { IllformedPlugin, ImageCallback } from '@jimp/core'; + +interface Normalize extends IllformedPlugin { + normalize(cb ?: ImageCallback): this; +} + +export default function(): Normalize; diff --git a/packages/plugin-normalize/package.json b/packages/plugin-normalize/package.json index 0c6c7a625..238dfb065 100644 --- a/packages/plugin-normalize/package.json +++ b/packages/plugin-normalize/package.json @@ -4,6 +4,7 @@ "description": "normalize an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/plugin-print/index.d.ts b/packages/plugin-print/index.d.ts new file mode 100644 index 000000000..2fda985e5 --- /dev/null +++ b/packages/plugin-print/index.d.ts @@ -0,0 +1,119 @@ +import { Jimp, GenericCallback, ImageCallback } from '@jimp/core'; + +export interface FontChar { + id: number; + x: number; + y: number; + width: number; + height: number; + xoffset: number; + yoffset: number; + xadvance: number; + page: number; + chnl: number; +} + +export interface FontInfo { + face: string; + size: number; + bold: number; + italic: number; + charset: string; + unicode: number; + stretchH: number; + smooth: number; + aa: number; + padding: [number, number, number, number]; + spacing: [number, number]; +} + +export interface FontCommon { + lineHeight: number; + base: number; + scaleW: number; + scaleH: number; + pages: number; + packed: number; + alphaChnl: number; + redChnl: number; + greenChnl: number; + blueChnl: number; +} + +interface Font { + chars: { + [char: string]: FontChar; + }; + kernings: { + [firstString: string]: { + [secondString: string]: number; + }; + }; + pages: string[]; + common: FontCommon; + info: FontInfo; +} + +type PrintableText = + | any + | { + text: string; + alignmentX: number; + alignmentY: number; +}; + +interface Print { + constants: { + measureText(font: Font, text: PrintableText): number; + measureTextHeight(font: Font, text: PrintableText, maxWidth: number): number; + + // Font locations + FONT_SANS_8_BLACK: string; + FONT_SANS_10_BLACK: string; + FONT_SANS_12_BLACK: string; + FONT_SANS_14_BLACK: string; + FONT_SANS_16_BLACK: string; + FONT_SANS_32_BLACK: string; + FONT_SANS_64_BLACK: string; + FONT_SANS_128_BLACK: string; + + FONT_SANS_8_WHITE: string; + FONT_SANS_16_WHITE: string; + FONT_SANS_32_WHITE: string; + FONT_SANS_64_WHITE: string; + FONT_SANS_128_WHITE: string; + + loadFont(file: string): Promise; + loadFont(file: string, cb: GenericCallback): Promise; + } + + class: { + // Text methods + print( + font: Font, + x: number, + y: number, + text: PrintableText, + cb?: ImageCallback + ): This; + print( + font: Font, + x: number, + y: number, + text: PrintableText, + maxWidth?: number, + cb?: ImageCallback + ): This; + print( + font: Font, + x: number, + y: number, + text: PrintableText, + maxWidth?: number, + maxHeight?: number, + cb?: ImageCallback + ): This; + } +} + +export default function(): Print; diff --git a/packages/plugin-print/package.json b/packages/plugin-print/package.json index e0df6bbce..200ac2f75 100644 --- a/packages/plugin-print/package.json +++ b/packages/plugin-print/package.json @@ -4,6 +4,7 @@ "description": "print an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/plugin-resize/index.d.ts b/packages/plugin-resize/index.d.ts new file mode 100644 index 000000000..30a70eac2 --- /dev/null +++ b/packages/plugin-resize/index.d.ts @@ -0,0 +1,19 @@ +import { Jimp, ImageCallback } from '@jimp/core'; + +interface Resize { + constants: { + // resize methods + RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor'; + RESIZE_BILINEAR: 'bilinearInterpolation'; + RESIZE_BICUBIC: 'bicubicInterpolation'; + RESIZE_HERMITE: 'hermiteInterpolation'; + RESIZE_BEZIER: 'bezierInterpolation'; + } + + class: { + resize(w: number, h: number, cb?: ImageCallback): This; + resize(w: number, h: number, mode?: string, cb?: ImageCallback): This; + } +} + +export default function(): Resize; diff --git a/packages/plugin-resize/package.json b/packages/plugin-resize/package.json index dcb7281b2..016cba869 100644 --- a/packages/plugin-resize/package.json +++ b/packages/plugin-resize/package.json @@ -4,6 +4,7 @@ "description": "Resize an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/plugin-rotate/index.d.ts b/packages/plugin-rotate/index.d.ts new file mode 100644 index 000000000..771dabe3b --- /dev/null +++ b/packages/plugin-rotate/index.d.ts @@ -0,0 +1,8 @@ +import { IllformedPlugin, ImageCallback } from '@jimp/core'; + +interface Rotate extends IllformedPlugin { + rotate(deg: number, cb?: ImageCallback): this; + rotate(deg: number, mode: string | boolean, cb?: ImageCallback): this; +} + +export default function(): Rotate; diff --git a/packages/plugin-rotate/package.json b/packages/plugin-rotate/package.json index 51df16b47..1c0a164d4 100644 --- a/packages/plugin-rotate/package.json +++ b/packages/plugin-rotate/package.json @@ -4,6 +4,7 @@ "description": "Rotate an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/plugin-scale/index.d.ts b/packages/plugin-scale/index.d.ts new file mode 100644 index 000000000..ac04589c6 --- /dev/null +++ b/packages/plugin-scale/index.d.ts @@ -0,0 +1,10 @@ +import { IllformedPlugin, ImageCallback } from '@jimp/core'; + +interface Scale extends IllformedPlugin { + scale(f: number, cb?: ImageCallback): this; + scale(f: number, mode?: string, cb?: ImageCallback): this; + scaleToFit(w: number, h: number, cb?: ImageCallback): this; + scaleToFit(w: number, h: number, mode?: string, cb?: ImageCallback): this; +} + +export default function(): Scale; diff --git a/packages/plugin-scale/package.json b/packages/plugin-scale/package.json index fb63d6f71..5e410602c 100644 --- a/packages/plugin-scale/package.json +++ b/packages/plugin-scale/package.json @@ -4,6 +4,7 @@ "description": "scale an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", "build:watch": "npm run build:node:debug -- -- --watch --verbose", diff --git a/packages/plugin-shadow/index.d.ts b/packages/plugin-shadow/index.d.ts new file mode 100644 index 000000000..81a13f19c --- /dev/null +++ b/packages/plugin-shadow/index.d.ts @@ -0,0 +1,14 @@ +import { ImageCallback } from '@jimp/core'; + +interface Shadow { + shadow(options?: { + size?: number, + opacity?: number, + x?: number, + y?: number + }, + cb?: ImageCallback): this; + shadow(cb?: ImageCallback): this; +} + +export default function(): Shadow; diff --git a/packages/plugin-shadow/package.json b/packages/plugin-shadow/package.json index b72822fac..401b184cc 100644 --- a/packages/plugin-shadow/package.json +++ b/packages/plugin-shadow/package.json @@ -4,6 +4,7 @@ "description": "Creates a shadow on an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/plugin-threshold/index.d.ts b/packages/plugin-threshold/index.d.ts new file mode 100644 index 000000000..527f1a229 --- /dev/null +++ b/packages/plugin-threshold/index.d.ts @@ -0,0 +1,11 @@ +import { ImageCallback } from '@jimp/core'; + +interface Threshold { + threshold(opts: { + max: number, + replace?: number, + autoGreyscale?: boolean + }, cb?: ImageCallback): this; +} + +export default function(): Threshold; diff --git a/packages/plugin-threshold/package.json b/packages/plugin-threshold/package.json index 250aefd98..4e8df2fdd 100644 --- a/packages/plugin-threshold/package.json +++ b/packages/plugin-threshold/package.json @@ -4,6 +4,7 @@ "description": "Lightens an image.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/plugins/index.d.ts b/packages/plugins/index.d.ts new file mode 100644 index 000000000..66a8f0928 --- /dev/null +++ b/packages/plugins/index.d.ts @@ -0,0 +1,63 @@ +import dither from '@jimp/plugin-dither'; +import resize from '@jimp/plugin-resize'; +import blit from '@jimp/plugin-blit'; +import rotate from '@jimp/plugin-rotate'; +import color from '@jimp/plugin-color'; +import print from '@jimp/plugin-print'; +import blur from '@jimp/plugin-blur'; +import crop from '@jimp/plugin-crop'; +import normalize from '@jimp/plugin-normalize'; +import invert from '@jimp/plugin-invert'; +import gaussian from '@jimp/plugin-gaussian'; +import flip from '@jimp/plugin-flip'; +import mask from '@jimp/plugin-mask'; +import scale from '@jimp/plugin-scale'; +import displace from '@jimp/plugin-displace'; +import contain from '@jimp/plugin-contain'; +import cover from '@jimp/plugin-cover'; + +type DitherRet = ReturnType +type ResizeRet = ReturnType +type BlitRet = ReturnType +type RotateRet = ReturnType +type ColorRet = ReturnType +type PrintRet = ReturnType +type BlurRet = ReturnType +type CropRet = ReturnType +type NormalizeRet = ReturnType +type InvertRet = ReturnType +type GaussianRet = ReturnType +type FlipRet = ReturnType +type MaskRet = ReturnType +type ScaleRet = ReturnType +type DisplaceRet = ReturnType +type ContainRet = ReturnType +type CoverRet = ReturnType + +/** + * This is made union and not intersection to avoid issues with + * `IllformedPlugin` and `WellFormedPlugin` when using typings with Jimp + * generic + * + * In reality, this should be an intersection but our type data isn't + * clever enough to figure out what's a class and what's not/etc + */ +type Plugins = DitherRet | + ResizeRet | + BlitRet | + RotateRet | + ColorRet | + PrintRet | + BlurRet | + CropRet | + NormalizeRet | + InvertRet | + GaussianRet | + FlipRet | + MaskRet | + ScaleRet | + DisplaceRet | + ContainRet | + CoverRet; + +export default function(jimpEvChange: any): Plugins; diff --git a/packages/plugins/package.json b/packages/plugins/package.json index dfec8a65f..f288ed1f3 100644 --- a/packages/plugins/package.json +++ b/packages/plugins/package.json @@ -4,6 +4,7 @@ "description": "Default Jimp plugin.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", "build:watch": "npm run build:node:debug -- -- --watch --verbose", diff --git a/packages/type-bmp/index.d.ts b/packages/type-bmp/index.d.ts new file mode 100644 index 000000000..bbb9baec6 --- /dev/null +++ b/packages/type-bmp/index.d.ts @@ -0,0 +1,24 @@ +import { DecoderFn, EncoderFn } from '@jimp/core'; + +interface Bmp { + constants: { + MIME_BMP: 'image/bmp'; + MIME_X_MS_BMP: 'image/x-ms-bmp'; + } + + mime: { + 'image/bmp': string[] + } + + decoders: { + 'image/bmp': DecoderFn + 'image/x-ms-bmp': DecoderFn + } + + encoders: { + 'image/bmp': EncoderFn + 'image/x-ms-bmp': EncoderFn + } +} + +export default function(): Bmp; diff --git a/packages/type-bmp/package.json b/packages/type-bmp/package.json index 3059ea590..2693bab70 100644 --- a/packages/type-bmp/package.json +++ b/packages/type-bmp/package.json @@ -4,6 +4,7 @@ "description": "Default Jimp bmp encoder/decoder.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/type-gif/index.d.ts b/packages/type-gif/index.d.ts new file mode 100644 index 000000000..59ac07783 --- /dev/null +++ b/packages/type-gif/index.d.ts @@ -0,0 +1,17 @@ +import { DecoderFn } from '@jimp/core'; + +interface Gif { + mime: { + 'image/gif': string[] + } + + constants: { + MIME_GIF: 'image/gif'; + } + + decoders: { + 'image/gif': DecoderFn + } +} + +export default function(): Gif; diff --git a/packages/type-gif/package.json b/packages/type-gif/package.json index 01149f39d..3c34e5157 100644 --- a/packages/type-gif/package.json +++ b/packages/type-gif/package.json @@ -4,6 +4,7 @@ "description": "Default Jimp gif encoder/decoder.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", "build:watch": "npm run build:node:debug -- -- --watch --verbose", diff --git a/packages/type-jpeg/index.d.ts b/packages/type-jpeg/index.d.ts new file mode 100644 index 000000000..0fc8e66c9 --- /dev/null +++ b/packages/type-jpeg/index.d.ts @@ -0,0 +1,25 @@ +import { Jimp, DecoderFn, EncoderFn, ImageCallback } from '@jimp/core'; + +interface Jpeg { + mime: { 'image/jpeg': string[] }, + + constants: { + 'image/jpeg': string + } + + encoders: { + 'image/jpeg': EncoderFn + } + + decoders: { + 'image/jpeg': DecoderFn + } + + class: { + MIME_JPEG: 'image/jpeg'; + _quality: number; + quality: (n: number, cb?: ImageCallback) => This; + } +} + +export default function(): Jpeg; diff --git a/packages/type-jpeg/package.json b/packages/type-jpeg/package.json index 34ee5101d..bf18bb7d7 100644 --- a/packages/type-jpeg/package.json +++ b/packages/type-jpeg/package.json @@ -4,6 +4,7 @@ "description": "Default Jimp jpeg encoder/decoder.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/type-png/index.d.ts b/packages/type-png/index.d.ts new file mode 100644 index 000000000..37bd1e72d --- /dev/null +++ b/packages/type-png/index.d.ts @@ -0,0 +1,38 @@ +import { Jimp, DecoderFn, EncoderFn, ImageCallback } from '@jimp/core'; + +interface PNG { + + mime: { 'image/png': string[] }, + + hasAlpha: { 'image/png': true }, + + decoders: { + 'image/png': DecoderFn + } + encoders: { + 'image/png': EncoderFn + } + + class: { + _deflateLevel: number, + _deflateStrategy: number, + _filterType: number, + _colorType: number, + deflateLevel(l: number, cb?: ImageCallback): This; + deflateStrategy(s: number, cb?: ImageCallback): This; + filterType(f: number, cb?: ImageCallback): This; + colorType(s: number, cb?: ImageCallback): This; + } + constants: { + MIME_PNG: 'image/png'; + // PNG filter types + PNG_FILTER_AUTO: -1; + PNG_FILTER_NONE: 0; + PNG_FILTER_SUB: 1; + PNG_FILTER_UP: 2; + PNG_FILTER_AVERAGE: 3; + PNG_FILTER_PATH: 4; + } +} + +export default function(): PNG; diff --git a/packages/type-png/package.json b/packages/type-png/package.json index 6b8877e3e..5b9c7ebee 100644 --- a/packages/type-png/package.json +++ b/packages/type-png/package.json @@ -4,6 +4,7 @@ "description": "Default Jimp png encoder/decoder.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/type-tiff/index.d.ts b/packages/type-tiff/index.d.ts new file mode 100644 index 000000000..fdd0c5fef --- /dev/null +++ b/packages/type-tiff/index.d.ts @@ -0,0 +1,16 @@ +import { DecoderFn, EncoderFn } from '@jimp/core'; + +interface Tiff { + mime: { 'image/tiff': string[] } + decoders: { + 'image/tiff': DecoderFn + } + encoders: { + 'image/tiff': EncoderFn + } + constants: { + MIME_TIFF: 'image/tiff'; + } +} + +export default function(): Tiff; diff --git a/packages/type-tiff/package.json b/packages/type-tiff/package.json index b52eafd2b..072b1ab6e 100644 --- a/packages/type-tiff/package.json +++ b/packages/type-tiff/package.json @@ -4,6 +4,7 @@ "description": "Default Jimp tiff encoder/decoder.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "test": "cross-env BABEL_ENV=test mocha --require @babel/register", "test:watch": "npm run test -- --reporter min --watch", diff --git a/packages/types/index.d.ts b/packages/types/index.d.ts new file mode 100644 index 000000000..ec2df4ec9 --- /dev/null +++ b/packages/types/index.d.ts @@ -0,0 +1,27 @@ +import jpeg from '@jimp/jpeg'; +import png from '@jimp/png'; +import bmp from '@jimp/bmp'; +import tiff from '@jimp/tiff'; +import gif from '@jimp/gif'; + +type JpegRet = ReturnType +type PngRet = ReturnType +type BmpRet = ReturnType +type TiffRet = ReturnType +type GifRet = ReturnType + +/** + * This is made union and not intersection to avoid issues with + * `IllformedPlugin` and `WellFormedPlugin` when using typings with Jimp + * generic + * + * In reality, this should be an intersection but our type data isn't + * clever enough to figure out what's a class and what's not/etc + */ +type Types = JpegRet | + PngRet | + BmpRet | + TiffRet | + GifRet + +export default function(): Types; diff --git a/packages/types/package.json b/packages/types/package.json index 20a3d2c68..eb8c246ff 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -4,6 +4,7 @@ "description": "Default Jimp encoder/decoders.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", "build:watch": "npm run build:node:debug -- -- --watch --verbose", @@ -27,6 +28,9 @@ "peerDependencies": { "@jimp/custom": ">=0.3.5" }, + "devDependencies": { + "@types/node": "^12.6.8" + }, "publishConfig": { "access": "public" } diff --git a/packages/utils/README.md b/packages/utils/README.md index 01678e733..98cbfb74d 100644 --- a/packages/utils/README.md +++ b/packages/utils/README.md @@ -56,7 +56,12 @@ function removeRed(image) { It's possible to make an iterator scan with a `for ... of`, if you want to `break` the scan before it reaches the end, but note, that this iterator has a huge performance implication: ```js -for (const { x, y, idx, image } of scanIterator(image, 0, 0, image.bitmap.width, image.bitmap.height)) { - +for (const { x, y, idx, image } of scanIterator( + image, + 0, + 0, + image.bitmap.width, + image.bitmap.height +)) { } ``` diff --git a/packages/utils/index.d.ts b/packages/utils/index.d.ts new file mode 100644 index 000000000..f4eb2edcf --- /dev/null +++ b/packages/utils/index.d.ts @@ -0,0 +1,9 @@ +import { Image } from './../../types/src/index.d'; +import { ThrowStatement } from 'typescript'; + +export function isNodePattern(cb: Function): true; +export function isNodePattern(cb: Omit): false; + +export function throwError(error: string | Error, cb?: (err: Error) => void): ThrowStatement; + +export function scan(image: Image, x: number, y: number, w: number, h: number, f: (image: Image, _x: number, _y: number, idx: number) => void): Image; diff --git a/packages/utils/package.json b/packages/utils/package.json index cf3330e82..3041ff9e3 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -4,6 +4,7 @@ "description": "Utils for jimp extensions.", "main": "dist/index.js", "module": "es/index.js", + "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", "build:watch": "npm run build:node:debug -- -- --watch --verbose", diff --git a/yarn.lock b/yarn.lock index c9a0ce884..4a983c7a1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1620,6 +1620,11 @@ version "10.9.2" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.9.2.tgz#f0ab8dced5cd6c56b26765e1c0d9e4fdcc9f2a00" +"@types/node@^12.6.8": + version "12.6.8" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.8.tgz#e469b4bf9d1c9832aee4907ba8a051494357c12c" + integrity sha512-aX+gFgA5GHcDi89KG5keey2zf0WfZk/HAQotEamsK2kbey+8yGKcson0hbK8E+v0NArlCJQCqMP161YhV6ZXLg== + "@types/yargs@^11.1.1": version "11.1.1" resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-11.1.1.tgz#2e724257167fd6b615dbe4e54301e65fe597433f"