From 851edf43ada9e0bf7fa463deb6a03184a9daecdb Mon Sep 17 00:00:00 2001 From: Bartek Polanczyk Date: Mon, 4 Feb 2019 20:33:50 +0100 Subject: [PATCH] Added all the available typings for Imagemin plugins. --- package.json | 4 ++++ src/index.d.ts | 15 ++++++++++----- yarn.lock | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 7367e17..995eaaa 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,10 @@ }, "homepage": "https://github.com/Klathmon/imagemin-webpack-plugin#readme", "dependencies": { + "@types/imagemin-gifsicle": "^5.2.0", + "@types/imagemin-jpegtran": "^5.0.0", + "@types/imagemin-optipng": "^5.2.0", + "@types/imagemin-svgo": "^7.0.0", "@types/webpack": "^4.4.24", "async-throttle": "^1.1.0", "babel-runtime": "^6.18.0", diff --git a/src/index.d.ts b/src/index.d.ts index 9c6bfbd..00019ed 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -1,3 +1,8 @@ +import { Options as GifsicleOptions } from 'imagemin-gifsicle'; +import { Options as JpegTranOptions } from 'imagemin-jpegtran'; +import { Options as OptiPngOptions } from 'imagemin-optipng'; +import { Options as SvgoOptions } from 'imagemin-svgo'; + import { Plugin } from 'webpack'; export default ImageminWebpackPugin; @@ -9,7 +14,7 @@ declare class ImageminWebpackPugin extends Plugin { declare namespace ImageminWebpackPugin { type TestOption = RegExp | string | (() => boolean); - // Keeping it as generic object as including all the other types would be too heavy + // Generic options for plugins missing typings interface ExternalOptions { [key: string]: any; } @@ -18,10 +23,10 @@ declare namespace ImageminWebpackPugin { disable?: boolean; test?: TestOption | TestOption[]; maxConcurrency?: number; - optipng?: ExternalOptions | null; - gifsicle?: ExternalOptions | null; - jpegtran?: ExternalOptions | null; - svgo?: ExternalOptions | null; + optipng?: OptiPngOptions | null; + gifsicle?: GifsicleOptions | null; + jpegtran?: JpegTranOptions | null; + svgo?: SvgoOptions | null; pngquant?: ExternalOptions | null; plugins?: Array> | []; } diff --git a/yarn.lock b/yarn.lock index e8def2a..18f42f1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -99,11 +99,52 @@ resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.0.tgz#d1d55958d1fccc5527d4aba29fc9c4b942f563ff" integrity sha512-7WcbyctkE8GTzogDb0ulRAEw7v8oIS54ft9mQTU7PfM0hp5e+8kpa+HeQ7IQrFbKtJXBKcZ4bh+Em9dTw5L6AQ== +"@types/imagemin-gifsicle@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@types/imagemin-gifsicle/-/imagemin-gifsicle-5.2.0.tgz#349160f17412e26de8d5794e70aad504781ea7d8" + integrity sha512-WohEsNMyGYTc+u6WA7KUvX8g+uLgTJOhqteexGdGZ/TPyS65GuCzMJ1RTaSzqG/cIfLFxbxg/HbGBg8YJrNZaw== + dependencies: + "@types/imagemin" "*" + +"@types/imagemin-jpegtran@^5.0.0": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@types/imagemin-jpegtran/-/imagemin-jpegtran-5.0.0.tgz#44d98874bdcc3f290ce1e158355f33fc90ac2758" + integrity sha512-uwJknBgND9Jx+/d5bJf+mvAjfes0NIDyCeOKFJ9LbEYnp8/PVt0YDGh8K96JemeF84VbhHFxnN62Wz68rVNfFQ== + dependencies: + "@types/imagemin" "*" + +"@types/imagemin-optipng@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@types/imagemin-optipng/-/imagemin-optipng-5.2.0.tgz#83046e0695739661fa738ad253bdbf51bc4f9e9d" + integrity sha512-Qn4gTV1fpPG2WIsUIl10yi2prudOuDIx+D+O0H3aKZRcTCwpMjszBVeRWUqkhG5wADhWO4giLut1sFNr3H2XIQ== + dependencies: + "@types/imagemin" "*" + +"@types/imagemin-svgo@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@types/imagemin-svgo/-/imagemin-svgo-7.0.0.tgz#c9ffe209ed7695c9ae4bebef083f47de2cd98c1e" + integrity sha512-Uq2T4hHE9PvBLB1lZM1+bZUzPc14XCKKWzQqJ47qe4/iuVHavYX4ig/gbBj8W3ZvRAJcQV3nagfoqFUzzdFD4g== + dependencies: + "@types/imagemin" "*" + "@types/svgo" "*" + +"@types/imagemin@*": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@types/imagemin/-/imagemin-6.0.0.tgz#c7b72bb08657396884acfac735c204379b0fe0a4" + integrity sha512-07dAIxWudAi8dHBS7W5JJ1rj4XR+FBLooq1yXXZo2XTv9kbMHKeDjq1pd9ou4Ui6yBZzfezlNxfJM1++fbc5/A== + dependencies: + "@types/node" "*" + "@types/node@*": version "10.12.21" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.21.tgz#7e8a0c34cf29f4e17a36e9bd0ea72d45ba03908e" integrity sha512-CBgLNk4o3XMnqMc0rhb6lc77IwShMEglz05deDcn2lQxyXEZivfwgYJu7SMha9V5XcrP6qZuevTHV/QrN2vjKQ== +"@types/svgo@*": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@types/svgo/-/svgo-1.0.1.tgz#6095fc0119febcf5920ed9cdacdcc0a0d026e4a5" + integrity sha512-tV+xgQS8v4McSQqk+tGDCwTT1Bo/QLqgRPS1M9UgNZHK2cTf6CdwzxcMG7YAQwd/ZPUNgfgvN7tfe4OUv077Lw== + "@types/tapable@*": version "1.0.4" resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.4.tgz#b4ffc7dc97b498c969b360a41eee247f82616370"