@powerlines/plugin-image-compression 0.2.279 → 0.2.281

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
2
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
- const require_pretty_bytes = require('./node_modules/.pnpm/@stryke_string-format@0.17.1/node_modules/@stryke/string-format/dist/pretty-bytes.cjs');
3
+ const require_pretty_bytes = require('./node_modules/.pnpm/@stryke_string-format@0.17.2/node_modules/@stryke/string-format/dist/pretty-bytes.cjs');
4
4
  let __stryke_convert_to_array = require("@stryke/convert/to-array");
5
5
  let __stryke_fs_list_files = require("@stryke/fs/list-files");
6
6
  let __stryke_fs_read_file = require("@stryke/fs/read-file");
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { prettyBytes } from "./node_modules/.pnpm/@stryke_string-format@0.17.1/node_modules/@stryke/string-format/dist/pretty-bytes.mjs";
1
+ import { prettyBytes } from "./node_modules/.pnpm/@stryke_string-format@0.17.2/node_modules/@stryke/string-format/dist/pretty-bytes.mjs";
2
2
  import { toArray } from "@stryke/convert/to-array";
3
3
  import { listFiles } from "@stryke/fs/list-files";
4
4
  import { readFile } from "@stryke/fs/read-file";
@@ -114,5 +114,4 @@ const plugin = (options = {}) => {
114
114
  var src_default = plugin;
115
115
 
116
116
  //#endregion
117
- export { src_default as default, plugin };
118
- //# sourceMappingURL=index.mjs.map
117
+ export { src_default as default, plugin };
@@ -1,5 +1,5 @@
1
1
 
2
- //#region ../../node_modules/.pnpm/@stryke+string-format@0.17.1/node_modules/@stryke/string-format/dist/pretty-bytes.mjs
2
+ //#region ../../node_modules/.pnpm/@stryke+string-format@0.17.2/node_modules/@stryke/string-format/dist/pretty-bytes.mjs
3
3
  const BYTE_UNITS = [
4
4
  "B",
5
5
  "kB",
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@stryke+string-format@0.17.1/node_modules/@stryke/string-format/dist/pretty-bytes.mjs
1
+ //#region ../../node_modules/.pnpm/@stryke+string-format@0.17.2/node_modules/@stryke/string-format/dist/pretty-bytes.mjs
2
2
  const BYTE_UNITS = [
3
3
  "B",
4
4
  "kB",
@@ -124,5 +124,4 @@ function prettyBytes(number, options) {
124
124
  }
125
125
 
126
126
  //#endregion
127
- export { prettyBytes };
128
- //# sourceMappingURL=pretty-bytes.mjs.map
127
+ export { prettyBytes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-image-compression",
3
- "version": "0.2.279",
3
+ "version": "0.2.281",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin to optimize images used by the project.",
6
6
  "repository": {
@@ -95,22 +95,22 @@
95
95
  "powerlines-plugin"
96
96
  ],
97
97
  "dependencies": {
98
- "@stryke/convert": "^0.6.51",
99
- "@stryke/fs": "^0.33.55",
100
- "@stryke/path": "^0.26.17",
98
+ "@stryke/convert": "^0.6.52",
99
+ "@stryke/fs": "^0.33.56",
100
+ "@stryke/path": "^0.26.18",
101
101
  "chalk": "5.6.2",
102
102
  "defu": "^6.1.4",
103
103
  "jiti": "^2.6.1",
104
- "powerlines": "^0.40.17",
104
+ "powerlines": "^0.40.19",
105
105
  "sharp": "^0.34.5",
106
106
  "svgo": "^4.0.1"
107
107
  },
108
108
  "devDependencies": {
109
- "@powerlines/plugin-plugin": "^0.12.281",
110
- "@storm-software/config": "^1.135.22",
109
+ "@powerlines/plugin-plugin": "^0.12.283",
110
+ "@storm-software/config": "^1.135.27",
111
111
  "@types/node": "^25.4.0"
112
112
  },
113
113
  "publishConfig": { "access": "public" },
114
114
  "types": "./dist/index.d.cts",
115
- "gitHead": "dde0f2e2684c65303dc81833f1d39c2c77910e22"
115
+ "gitHead": "7496a546473274494be487ebc33cf267ed5cd1f0"
116
116
  }
package/dist/index.d.cts DELETED
@@ -1,22 +0,0 @@
1
- import { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig } from "./types/plugin.cjs";
2
- import "./types/index.cjs";
3
- import { Plugin } from "powerlines";
4
-
5
- //#region src/index.d.ts
6
- declare module "powerlines" {
7
- interface Config {
8
- imageCompression?: ImageCompressionPluginOptions;
9
- }
10
- }
11
- /**
12
- * A Powerlines plugin to optimize image assets used by the project.
13
- *
14
- * @see https://sharp.pixelplumbing.com
15
- *
16
- * @param options - The plugin options.
17
- * @returns A Powerlines plugin instance.
18
- */
19
- declare const plugin: <TContext extends ImageCompressionPluginContext = ImageCompressionPluginContext>(options?: ImageCompressionPluginOptions) => Plugin<TContext>;
20
- //#endregion
21
- export { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig, plugin as default, plugin };
22
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;IAmCwB,gBAAA,CAAA,EAID,6BAJC;EAAA;;;;AAgBxB;;;;;;AAIS,cAJI,MAIJ,EAAA,CAAA,iBAHU,6BAGV,GAH0C,6BAG1C,CAAA,CAAA,OAAA,CAAA,EADE,6BACF,EAAA,GAAN,MAAM,CAAC,QAAD,CAAA"}
package/dist/index.d.mts DELETED
@@ -1,22 +0,0 @@
1
- import { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig } from "./types/plugin.mjs";
2
- import "./types/index.mjs";
3
- import { Plugin } from "powerlines";
4
-
5
- //#region src/index.d.ts
6
- declare module "powerlines" {
7
- interface Config {
8
- imageCompression?: ImageCompressionPluginOptions;
9
- }
10
- }
11
- /**
12
- * A Powerlines plugin to optimize image assets used by the project.
13
- *
14
- * @see https://sharp.pixelplumbing.com
15
- *
16
- * @param options - The plugin options.
17
- * @returns A Powerlines plugin instance.
18
- */
19
- declare const plugin: <TContext extends ImageCompressionPluginContext = ImageCompressionPluginContext>(options?: ImageCompressionPluginOptions) => Plugin<TContext>;
20
- //#endregion
21
- export { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig, plugin as default, plugin };
22
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;IAmCwB,gBAAA,CAAA,EAID,6BAJC;EAAA;;;;AAgBxB;;;;;;AAIS,cAJI,MAIJ,EAAA,CAAA,iBAHU,6BAGV,GAH0C,6BAG1C,CAAA,CAAA,OAAA,CAAA,EADE,6BACF,EAAA,GAAN,MAAM,CAAC,QAAD,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { readFile } from \"@stryke/fs/read-file\";\nimport { writeFile } from \"@stryke/fs/write-file\";\nimport { findFileExtensionSafe } from \"@stryke/path/find\";\nimport { prettyBytes } from \"@stryke/string-format/pretty-bytes\";\nimport chalk from \"chalk\";\nimport { Buffer } from \"node:buffer\";\nimport { stat } from \"node:fs/promises\";\nimport type { Plugin } from \"powerlines\";\nimport { replacePathTokens } from \"powerlines/plugin-utils\";\nimport { optimize } from \"svgo\";\nimport {\n ImageCompressionPluginContext,\n ImageCompressionPluginOptions\n} from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n imageCompression?: ImageCompressionPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to optimize image assets used by the project.\n *\n * @see https://sharp.pixelplumbing.com\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends ImageCompressionPluginContext = ImageCompressionPluginContext\n>(\n options: ImageCompressionPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"image-compression\",\n config() {\n return {\n imageCompression: {\n filter:\n \"{root}/**/*.{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl}\",\n svg: {},\n jpeg: {},\n png: {},\n webp: {},\n avif: {},\n heif: {},\n tiff: {},\n jp2: {},\n jxl: {},\n ...options\n }\n };\n },\n async configResolved() {\n if (!this.config.imageCompression.filter) {\n throw new Error(\n \"ImageCompression plugin requires a filter or glob pattern to be specified in the configuration.\"\n );\n }\n\n this.config.imageCompression.filter = toArray(\n this.config.imageCompression.filter\n )\n .map(path => replacePathTokens(this, path))\n .filter(Boolean);\n },\n async prepare() {\n await Promise.all(\n toArray(this.config.imageCompression.filter).map(async path => {\n await Promise.all(\n (await listFiles(path)).map(async file => {\n const outputPath = this.config.imageCompression.outputPath\n ? replacePathTokens(\n this,\n this.config.imageCompression.outputPath\n ).replace(/\\{fileName\\}/g, file.split(\"/\").pop() || \"output\")\n : file;\n\n const start = performance.now();\n const originalSize = (await stat(file)).size;\n let compressedSize = 0;\n\n const extension = findFileExtensionSafe(file).toLowerCase();\n if (!extension) {\n this.error(\n ` ✘ Failed to optimize ${file} - Unable to determine file extension`\n );\n return;\n }\n\n if (extension === \"svg\") {\n const result = optimize(await readFile(file), {\n multipass: true,\n path: file,\n ...this.config.imageCompression.svg\n });\n if (result.data) {\n compressedSize = Buffer.byteLength(result.data, \"utf8\");\n await writeFile(outputPath, result.data);\n }\n } else {\n let image = await import(\"sharp\").then(sharpModule =>\n sharpModule.default(file, { animated: extension === \"gif\" })\n );\n\n switch (extension) {\n case \"jpeg\":\n case \"jpg\":\n image = image.jpeg(this.config.imageCompression.jpeg);\n break;\n case \"png\":\n image = image.png(this.config.imageCompression.png);\n break;\n case \"webp\":\n image = image.webp(this.config.imageCompression.webp);\n break;\n case \"avif\":\n image = image.avif(this.config.imageCompression.avif);\n break;\n case \"gif\":\n image = image.gif(this.config.imageCompression.gif);\n break;\n case \"heif\":\n image = image.heif(this.config.imageCompression.heif);\n break;\n case \"tiff\":\n image = image.tiff(this.config.imageCompression.tiff);\n break;\n case \"jp2\":\n image = image.jp2(this.config.imageCompression.jp2);\n break;\n case \"jxl\":\n image = image.jxl(this.config.imageCompression.jxl);\n break;\n }\n\n const result = await image.toFile(outputPath);\n compressedSize = result.size;\n }\n\n if (!compressedSize) {\n this.error(` ✘ Failed to optimize ${file} - No data returned`);\n return;\n }\n\n if (compressedSize >= originalSize) {\n this.error(\n ` ✘ Failed to optimize ${file} - Compression output was not smaller than the original`\n );\n return;\n }\n\n this.info(\n ` ✔ Successfully optimized ${\n file\n }: ${chalk.redBright(prettyBytes(originalSize))} -> ${chalk.greenBright(\n prettyBytes(compressedSize)\n )} (${chalk.green(\n (100 - (compressedSize / originalSize) * 100).toFixed(2)\n )}%) in ${(performance.now() - start).toFixed(2)} ms`\n );\n })\n );\n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Q,EAAE,CACzD,CAAC,SAAS,YAAY,KAAK,GAAG,OAAO,QAAQ,EAAE,CAAC,KAClD;MACD,CACH;KACD,CACH;;EAEJ;;AAGH,kBAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"pretty-bytes.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+string-format@0.17.1/node_modules/@stryke/string-format/dist/pretty-bytes.mjs"],"sourcesContent":["//#region src/pretty-bytes.ts\nconst BYTE_UNITS = [\n\t\"B\",\n\t\"kB\",\n\t\"MB\",\n\t\"GB\",\n\t\"TB\",\n\t\"PB\",\n\t\"EB\",\n\t\"ZB\",\n\t\"YB\"\n];\nconst BIBYTE_UNITS = [\n\t\"B\",\n\t\"KiB\",\n\t\"MiB\",\n\t\"GiB\",\n\t\"TiB\",\n\t\"PiB\",\n\t\"EiB\",\n\t\"ZiB\",\n\t\"YiB\"\n];\nconst BIT_UNITS = [\n\t\"b\",\n\t\"kbit\",\n\t\"Mbit\",\n\t\"Gbit\",\n\t\"Tbit\",\n\t\"Pbit\",\n\t\"Ebit\",\n\t\"Zbit\",\n\t\"Ybit\"\n];\nconst BIBIT_UNITS = [\n\t\"b\",\n\t\"kibit\",\n\t\"Mibit\",\n\t\"Gibit\",\n\t\"Tibit\",\n\t\"Pibit\",\n\t\"Eibit\",\n\t\"Zibit\",\n\t\"Yibit\"\n];\n/**\n* Formats the given number using `Number#toLocaleString`.\n*\n* @remarks\n* - If locale is a string, the value is expected to be a locale-key (for example: `de`).\n* - If locale is true, the system default locale is used for translation.\n* - If no value for locale is specified, the number is returned unmodified.\n*\n* @param number - The number to format.\n* @param locale - The locale to use for formatting the number.\n* @param options - The options to use for formatting the number.\n* @returns The formatted number.\n*/\nconst toLocaleString = (number, locale, options = {}) => {\n\tlet result = number;\n\tlet _locale = locale;\n\tif (typeof _locale === \"string\") {\n\t\tif (!_locale) _locale = process.env.STORM_LOCALE || \"en-US\";\n\t\tif (Array.isArray(_locale)) result = number?.toLocaleString(_locale, options);\n\t} else if (_locale === true || options !== void 0) result = number?.toLocaleString(void 0, options);\n\treturn String(result);\n};\n/**\n* Convert bytes to a human readable string: `1337` → `1.34 kB`.\n*\n* @param number - The number to format.\n*\n* @example\n* ```ts\n* import { prettyBytes } from '@stryke/string-fns/pretty-bytes';\n*\n* prettyBytes(1337);\n* //=> '1.34 kB'\n*\n* prettyBytes(100);\n* //=> '100 B'\n*\n* // Display file size differences\n* prettyBytes(42, {signed: true});\n* //=> '+42 B'\n*\n* // Localized output using German locale\n* prettyBytes(1337, {locale: 'de'});\n* //=> '1,34 kB'\n* ```\n*\n* @param number - The number to format.\n* @param options - The options to use.\n* @returns The formatted string.\n*/\nfunction prettyBytes(number, options) {\n\tlet _number = number;\n\tif (!Number.isFinite(_number)) throw new TypeError(`Expected a finite number, got ${typeof _number}: ${_number}`);\n\tconst opts = {\n\t\tbits: false,\n\t\tbinary: false,\n\t\tspace: true,\n\t\t...options\n\t};\n\tconst UNITS = opts.bits ? opts.binary ? BIBIT_UNITS : BIT_UNITS : opts.binary ? BIBYTE_UNITS : BYTE_UNITS;\n\tconst separator = opts.space ? \" \" : \"\";\n\tif (opts.signed && _number === 0) return ` 0${separator}${UNITS[0]}`;\n\tconst isNegative = _number < 0;\n\tconst prefix = isNegative ? \"-\" : opts.signed ? \"+\" : \"\";\n\tif (isNegative) _number = -_number;\n\tlet localeOptions;\n\tif (opts.minimumFractionDigits !== void 0) localeOptions = { minimumFractionDigits: opts.minimumFractionDigits };\n\tif (opts.maximumFractionDigits !== void 0) localeOptions = {\n\t\tmaximumFractionDigits: opts.maximumFractionDigits,\n\t\t...localeOptions\n\t};\n\tif (_number < 1) return prefix + toLocaleString(_number, opts.locale, localeOptions) + separator + UNITS[0];\n\tconst exponent = Math.min(Math.floor(opts.binary ? Math.log(_number) / Math.log(1024) : Math.log10(_number) / 3), UNITS.length - 1);\n\t_number /= (opts.binary ? 1024 : 1e3) ** exponent;\n\tif (!localeOptions) _number = _number.toPrecision(3);\n\tconst numberString = toLocaleString(Number(_number), opts.locale, localeOptions);\n\tconst unit = UNITS[exponent];\n\treturn prefix + numberString + separator + unit;\n}\n\n//#endregion\nexport { prettyBytes, toLocaleString };\n//# sourceMappingURL=pretty-bytes.mjs.map"],"x_google_ignoreList":[0],"mappings":";AACA,MAAM,aAAa;CAClB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,MAAM,eAAe;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,MAAM,YAAY;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,MAAM,cAAc;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;;;;;;;;AAcD,MAAM,kBAAkB,QAAQ,QAAQ,UAAU,EAAE,KAAK;CACxD,IAAI,SAAS;CACb,IAAI,UAAU;AACd,KAAI,OAAO,YAAY,UAAU;AAChC,MAAI,CAAC,QAAS,WAAU,QAAQ,IAAI,gBAAgB;AACpD,MAAI,MAAM,QAAQ,QAAQ,CAAE,UAAS,QAAQ,eAAe,SAAS,QAAQ;YACnE,YAAY,QAAQ,YAAY,KAAK,EAAG,UAAS,QAAQ,eAAe,KAAK,GAAG,QAAQ;AACnG,QAAO,OAAO,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BtB,SAAS,YAAY,QAAQ,SAAS;CACrC,IAAI,UAAU;AACd,KAAI,CAAC,OAAO,SAAS,QAAQ,CAAE,OAAM,IAAI,UAAU,iCAAiC,OAAO,QAAQ,IAAI,UAAU;CACjH,MAAM,OAAO;EACZ,MAAM;EACN,QAAQ;EACR,OAAO;EACP,GAAG;EACH;CACD,MAAM,QAAQ,KAAK,OAAO,KAAK,SAAS,cAAc,YAAY,KAAK,SAAS,eAAe;CAC/F,MAAM,YAAY,KAAK,QAAQ,MAAM;AACrC,KAAI,KAAK,UAAU,YAAY,EAAG,QAAO,KAAK,YAAY,MAAM;CAChE,MAAM,aAAa,UAAU;CAC7B,MAAM,SAAS,aAAa,MAAM,KAAK,SAAS,MAAM;AACtD,KAAI,WAAY,WAAU,CAAC;CAC3B,IAAI;AACJ,KAAI,KAAK,0BAA0B,KAAK,EAAG,iBAAgB,EAAE,uBAAuB,KAAK,uBAAuB;AAChH,KAAI,KAAK,0BAA0B,KAAK,EAAG,iBAAgB;EAC1D,uBAAuB,KAAK;EAC5B,GAAG;EACH;AACD,KAAI,UAAU,EAAG,QAAO,SAAS,eAAe,SAAS,KAAK,QAAQ,cAAc,GAAG,YAAY,MAAM;CACzG,MAAM,WAAW,KAAK,IAAI,KAAK,MAAM,KAAK,SAAS,KAAK,IAAI,QAAQ,GAAG,KAAK,IAAI,KAAK,GAAG,KAAK,MAAM,QAAQ,GAAG,EAAE,EAAE,MAAM,SAAS,EAAE;AACnI,aAAY,KAAK,SAAS,OAAO,QAAQ;AACzC,KAAI,CAAC,cAAe,WAAU,QAAQ,YAAY,EAAE;CACpD,MAAM,eAAe,eAAe,OAAO,QAAQ,EAAE,KAAK,QAAQ,cAAc;CAChF,MAAM,OAAO,MAAM;AACnB,QAAO,SAAS,eAAe,YAAY"}
@@ -1,2 +0,0 @@
1
- import { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig } from "./plugin.cjs";
2
- export { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig };
@@ -1,2 +0,0 @@
1
- import { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig } from "./plugin.mjs";
2
- export { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig };
@@ -1,74 +0,0 @@
1
- import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
2
- import { AvifOptions, GifOptions, HeifOptions, Jp2Options, JpegOptions, JxlOptions, PngOptions, TiffOptions, WebpOptions } from "sharp";
3
- import { Config } from "svgo";
4
-
5
- //#region src/types/plugin.d.ts
6
- interface ImageCompressionPluginOptions {
7
- /**
8
- * A path or glob pattern (or an array of paths and glob patterns) to image files to optimize during Powerlines processing.
9
- *
10
- * @defaultValue "\{root\}/**\/*.\{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl\}"
11
- */
12
- filter?: string | string[];
13
- /**
14
- * The output directory for the optimized images.
15
- *
16
- * @remarks
17
- * By default, it will generate the output files alongside each input image file.
18
- */
19
- outputPath?: string;
20
- /**
21
- * These SVGO options used for SVG optimization
22
- */
23
- svg?: Config;
24
- /**
25
- * These JPEG options used for output image
26
- */
27
- jpeg?: JpegOptions;
28
- /**
29
- * These JP2 (JPEG 2000) options used for output image
30
- */
31
- jp2?: Jp2Options;
32
- /**
33
- * These JPEG-XL (JXL) options used for output image
34
- */
35
- jxl?: JxlOptions;
36
- /**
37
- * These PNG options used for output image
38
- */
39
- png?: PngOptions;
40
- /**
41
- * These WebP options used for output image
42
- */
43
- webp?: WebpOptions;
44
- /**
45
- * These GIF options used for output image
46
- */
47
- gif?: GifOptions;
48
- /**
49
- * These AVIF options used for output image
50
- */
51
- avif?: AvifOptions;
52
- /**
53
- * These HEIF options used for output image
54
- */
55
- heif?: HeifOptions;
56
- /**
57
- * These TIFF options used for output image
58
- */
59
- tiff?: TiffOptions;
60
- }
61
- interface ImageCompressionPluginUserConfig extends UserConfig {
62
- imageCompression?: ImageCompressionPluginOptions;
63
- }
64
- interface ImageCompressionPluginResolvedConfig extends ResolvedConfig {
65
- imageCompression: Omit<ImageCompressionPluginOptions, "filter" | "svg" | "jpeg" | "png" | "webp" | "avif" | "heif" | "tiff" | "jp2" | "jxl" | "gif"> & Required<Pick<ImageCompressionPluginOptions, "filter" | "svg" | "jpeg" | "png" | "webp" | "avif" | "heif" | "tiff" | "jp2" | "jxl" | "gif">>;
66
- }
67
- type ImageCompressionPluginContext<TResolvedConfig extends ImageCompressionPluginResolvedConfig = ImageCompressionPluginResolvedConfig> = PluginContext<TResolvedConfig>;
68
- declare type __ΩImageCompressionPluginOptions = any[];
69
- declare type __ΩImageCompressionPluginUserConfig = any[];
70
- declare type __ΩImageCompressionPluginResolvedConfig = any[];
71
- declare type __ΩImageCompressionPluginContext = any[];
72
- //#endregion
73
- export { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig };
74
- //# sourceMappingURL=plugin.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;UAgCiB,6BAAA;;AAAjB;;;;EAkCQ,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA;EAKA;;;;;;EAyBY,UAAA,CAAA,EAAA,MAAA;EAGH;AAIjB;;EACoB,GAAA,CAAA,EArDZ,MAqDY;EAgBZ;;;EAjBsD,IAAA,CAAA,EA/CrD,WA+CqD;EAAc;AAiC5E;;EAEI,GAAA,CAAA,EA7EI,UA6EJ;EACc;;;QAzEV;;;;QAKA;;;;SAKC;;;;QAKD;;;;SAKC;;;;SAKA;;;;SAKA;;UAGQ,gCAAA,SAAyC;qBACrC;;UAGJ,oCAAA,SAA6C;oBAC1C,KAChB,gIAaA,SACE,KACE;;KAgBI,sDACc,uCACtB,wCACA,cAAc"}
@@ -1,74 +0,0 @@
1
- import { Config } from "svgo";
2
- import { AvifOptions, GifOptions, HeifOptions, Jp2Options, JpegOptions, JxlOptions, PngOptions, TiffOptions, WebpOptions } from "sharp";
3
- import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
4
-
5
- //#region src/types/plugin.d.ts
6
- interface ImageCompressionPluginOptions {
7
- /**
8
- * A path or glob pattern (or an array of paths and glob patterns) to image files to optimize during Powerlines processing.
9
- *
10
- * @defaultValue "\{root\}/**\/*.\{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl\}"
11
- */
12
- filter?: string | string[];
13
- /**
14
- * The output directory for the optimized images.
15
- *
16
- * @remarks
17
- * By default, it will generate the output files alongside each input image file.
18
- */
19
- outputPath?: string;
20
- /**
21
- * These SVGO options used for SVG optimization
22
- */
23
- svg?: Config;
24
- /**
25
- * These JPEG options used for output image
26
- */
27
- jpeg?: JpegOptions;
28
- /**
29
- * These JP2 (JPEG 2000) options used for output image
30
- */
31
- jp2?: Jp2Options;
32
- /**
33
- * These JPEG-XL (JXL) options used for output image
34
- */
35
- jxl?: JxlOptions;
36
- /**
37
- * These PNG options used for output image
38
- */
39
- png?: PngOptions;
40
- /**
41
- * These WebP options used for output image
42
- */
43
- webp?: WebpOptions;
44
- /**
45
- * These GIF options used for output image
46
- */
47
- gif?: GifOptions;
48
- /**
49
- * These AVIF options used for output image
50
- */
51
- avif?: AvifOptions;
52
- /**
53
- * These HEIF options used for output image
54
- */
55
- heif?: HeifOptions;
56
- /**
57
- * These TIFF options used for output image
58
- */
59
- tiff?: TiffOptions;
60
- }
61
- interface ImageCompressionPluginUserConfig extends UserConfig {
62
- imageCompression?: ImageCompressionPluginOptions;
63
- }
64
- interface ImageCompressionPluginResolvedConfig extends ResolvedConfig {
65
- imageCompression: Omit<ImageCompressionPluginOptions, "filter" | "svg" | "jpeg" | "png" | "webp" | "avif" | "heif" | "tiff" | "jp2" | "jxl" | "gif"> & Required<Pick<ImageCompressionPluginOptions, "filter" | "svg" | "jpeg" | "png" | "webp" | "avif" | "heif" | "tiff" | "jp2" | "jxl" | "gif">>;
66
- }
67
- type ImageCompressionPluginContext<TResolvedConfig extends ImageCompressionPluginResolvedConfig = ImageCompressionPluginResolvedConfig> = PluginContext<TResolvedConfig>;
68
- declare type __ΩImageCompressionPluginOptions = any[];
69
- declare type __ΩImageCompressionPluginUserConfig = any[];
70
- declare type __ΩImageCompressionPluginResolvedConfig = any[];
71
- declare type __ΩImageCompressionPluginContext = any[];
72
- //#endregion
73
- export { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig };
74
- //# sourceMappingURL=plugin.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;UAgCiB,6BAAA;;AAAjB;;;;EAkCQ,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA;EAKA;;;;;;EAyBY,UAAA,CAAA,EAAA,MAAA;EAGH;AAIjB;;EACoB,GAAA,CAAA,EArDZ,MAqDY;EAgBZ;;;EAjBsD,IAAA,CAAA,EA/CrD,WA+CqD;EAAc;AAiC5E;;EAEI,GAAA,CAAA,EA7EI,UA6EJ;EACc;;;QAzEV;;;;QAKA;;;;SAKC;;;;QAKD;;;;SAKC;;;;SAKA;;;;SAKA;;UAGQ,gCAAA,SAAyC;qBACrC;;UAGJ,oCAAA,SAA6C;oBAC1C,KAChB,gIAaA,SACE,KACE;;KAgBI,sDACc,uCACtB,wCACA,cAAc"}