@powerlines/plugin-image-compression 0.2.239 → 0.2.240

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
@@ -10,7 +10,7 @@ let chalk = require("chalk");
10
10
  chalk = require_rolldown_runtime.__toESM(chalk);
11
11
  let node_buffer = require("node:buffer");
12
12
  let node_fs_promises = require("node:fs/promises");
13
- let powerlines_plugin_utils_paths = require("powerlines/plugin-utils/paths");
13
+ let powerlines_plugin_utils = require("powerlines/plugin-utils");
14
14
  let svgo = require("svgo");
15
15
 
16
16
  //#region src/index.ts
@@ -27,7 +27,7 @@ const plugin = (options = {}) => {
27
27
  name: "image-compression",
28
28
  config() {
29
29
  return { imageCompression: {
30
- filter: "{projectRoot}/**/*.{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl}",
30
+ filter: "{root}/**/*.{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl}",
31
31
  svg: {},
32
32
  jpeg: {},
33
33
  png: {},
@@ -42,12 +42,12 @@ const plugin = (options = {}) => {
42
42
  },
43
43
  async configResolved() {
44
44
  if (!this.config.imageCompression.filter) throw new Error("ImageCompression plugin requires a filter or glob pattern to be specified in the configuration.");
45
- this.config.imageCompression.filter = (0, __stryke_convert_to_array.toArray)(this.config.imageCompression.filter).map((path) => (0, powerlines_plugin_utils_paths.replacePathTokens)(this, path)).filter(Boolean);
45
+ this.config.imageCompression.filter = (0, __stryke_convert_to_array.toArray)(this.config.imageCompression.filter).map((path) => (0, powerlines_plugin_utils.replacePathTokens)(this, path)).filter(Boolean);
46
46
  },
47
47
  async prepare() {
48
48
  await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.imageCompression.filter).map(async (path) => {
49
49
  await Promise.all((await (0, __stryke_fs_list_files.listFiles)(path)).map(async (file) => {
50
- const outputPath = this.config.imageCompression.outputPath ? (0, powerlines_plugin_utils_paths.replacePathTokens)(this, this.config.imageCompression.outputPath).replace(/\{fileName\}/g, file.split("/").pop() || "output") : file;
50
+ const outputPath = this.config.imageCompression.outputPath ? (0, powerlines_plugin_utils.replacePathTokens)(this, this.config.imageCompression.outputPath).replace(/\{fileName\}/g, file.split("/").pop() || "output") : file;
51
51
  const start = performance.now();
52
52
  const originalSize = (await (0, node_fs_promises.stat)(file)).size;
53
53
  let compressedSize = 0;
package/dist/index.d.cts CHANGED
@@ -1,9 +1,13 @@
1
1
  import { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig } from "./types/plugin.cjs";
2
2
  import "./types/index.cjs";
3
- import { Plugin } from "powerlines/types/plugin";
3
+ import { Plugin } from "powerlines";
4
4
 
5
5
  //#region src/index.d.ts
6
-
6
+ declare module "powerlines" {
7
+ interface UserConfig {
8
+ imageCompression?: ImageCompressionPluginOptions;
9
+ }
10
+ }
7
11
  /**
8
12
  * A Powerlines plugin to optimize image assets used by the project.
9
13
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA6CA;;;;;;AAIS,cAJI,MAIJ,EAAA,CAAA,iBAHU,6BAGV,GAH0C,6BAG1C,CAAA,CAAA,OAAA,CAAA,EADE,6BACF,EAAA,GAAN,MAAM,CAAC,QAAD,CAAA"}
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 CHANGED
@@ -1,9 +1,13 @@
1
1
  import { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig } from "./types/plugin.mjs";
2
2
  import "./types/index.mjs";
3
- import { Plugin } from "powerlines/types/plugin";
3
+ import { Plugin } from "powerlines";
4
4
 
5
5
  //#region src/index.d.ts
6
-
6
+ declare module "powerlines" {
7
+ interface UserConfig {
8
+ imageCompression?: ImageCompressionPluginOptions;
9
+ }
10
+ }
7
11
  /**
8
12
  * A Powerlines plugin to optimize image assets used by the project.
9
13
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA6CA;;;;;;AAIS,cAJI,MAIJ,EAAA,CAAA,iBAHU,6BAGV,GAH0C,6BAG1C,CAAA,CAAA,OAAA,CAAA,EADE,6BACF,EAAA,GAAN,MAAM,CAAC,QAAD,CAAA"}
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"}
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import { findFileExtensionSafe } from "@stryke/path/find";
7
7
  import chalk from "chalk";
8
8
  import { Buffer } from "node:buffer";
9
9
  import { stat } from "node:fs/promises";
10
- import { replacePathTokens } from "powerlines/plugin-utils/paths";
10
+ import { replacePathTokens } from "powerlines/plugin-utils";
11
11
  import { optimize } from "svgo";
12
12
 
13
13
  //#region src/index.ts
@@ -24,7 +24,7 @@ const plugin = (options = {}) => {
24
24
  name: "image-compression",
25
25
  config() {
26
26
  return { imageCompression: {
27
- filter: "{projectRoot}/**/*.{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl}",
27
+ filter: "{root}/**/*.{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl}",
28
28
  svg: {},
29
29
  jpeg: {},
30
30
  png: {},
@@ -1 +1 @@
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 { replacePathTokens } from \"powerlines/plugin-utils/paths\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { optimize } from \"svgo\";\nimport {\n ImageCompressionPluginContext,\n ImageCompressionPluginOptions\n} from \"./types/plugin\";\n\nexport * from \"./types\";\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 \"{projectRoot}/**/*.{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 })\n );\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,UAGX,UAAyC,EAAE,KACtB;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO,EACL,kBAAkB;IAChB,QACE;IACF,KAAK,EAAE;IACP,MAAM,EAAE;IACR,KAAK,EAAE;IACP,MAAM,EAAE;IACR,MAAM,EAAE;IACR,MAAM,EAAE;IACR,MAAM,EAAE;IACR,KAAK,EAAE;IACP,KAAK,EAAE;IACP,GAAG;IACJ,EACF;;EAEH,MAAM,iBAAiB;AACrB,OAAI,CAAC,KAAK,OAAO,iBAAiB,OAChC,OAAM,IAAI,MACR,kGACD;AAGH,QAAK,OAAO,iBAAiB,SAAS,QACpC,KAAK,OAAO,iBAAiB,OAC9B,CACE,KAAI,SAAQ,kBAAkB,MAAM,KAAK,CAAC,CAC1C,OAAO,QAAQ;;EAEpB,MAAM,UAAU;AACd,SAAM,QAAQ,IACZ,QAAQ,KAAK,OAAO,iBAAiB,OAAO,CAAC,IAAI,OAAM,SAAQ;AAC7D,UAAM,QAAQ,KACX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MAAM,KAAK,KAAK,OAAO,iBAAiB,KAAK;AACrD;OACF,KAAK;AACH,gBAAQ,MAAM,IAAI,KAAK,OAAO,iBAAiB,IAAI;AACnD;OACF,KAAK;AACH,gBAAQ,MAAM,IAAI,KAAK,OAAO,iBAAiB,IAAI;AACnD;;AAIJ,wBADe,MAAM,MAAM,OAAO,WAAW,EACrB;;AAG1B,SAAI,CAAC,gBAAgB;AACnB,WAAK,MAAM,yBAAyB,KAAK,qBAAqB;AAC9D;;AAGF,SAAI,kBAAkB,cAAc;AAClC,WAAK,MACH,yBAAyB,KAAK,yDAC/B;AACD;;AAGF,UAAK,KACH,6BACE,KACD,IAAI,MAAM,UAAU,YAAY,aAAa,CAAC,CAAC,MAAM,MAAM,YAC1D,YAAY,eAAe,CAC5B,CAAC,IAAI,MAAM,OACT,MAAO,iBAAiB,eAAgB,KAAK,QAAQ,EAAE,CACzD,CAAC,SAAS,YAAY,KAAK,GAAG,OAAO,QAAQ,EAAE,CAAC,KAClD;MACD,CACH;KACD,CACH;;EAEJ;;AAGH,kBAAe"}
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 export interface UserConfig {\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 })\n );\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmDA,MAAa,UAGX,UAAyC,EAAE,KACtB;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO,EACL,kBAAkB;IAChB,QACE;IACF,KAAK,EAAE;IACP,MAAM,EAAE;IACR,KA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O,CAAC,CAC7D;AAED,cAAQ,WAAR;OACE,KAAK;OACL,KAAK;AACH,gBAAQ,MAAM,KAAK,KAAK,OAAO,iBAAiB,KAAK;AACrD;OACF,KAAK;AACH,gBAAQ,MAAM,IAAI,KAAK,OAAO,iBAAiB,IAAI;AACnD;OACF,KAAK;AACH,gBAAQ,MAAM,KAAK,KAAK,OAAO,iBAAiB,KAAK;AACrD;OACF,KAAK;AACH,gBAAQ,MAAM,KAAK,KAAK,OAAO,iBAAiB,KAAK;AACrD;OACF,KAAK;AACH,gBAAQ,MAAM,IAAI,KAAK,OAAO,iBAAiB,IAAI;AACnD;OACF,KAAK;AACH,gBAAQ,MAAM,KAAK,KAAK,OAAO,iBAAiB,KAAK;AACrD;OACF,KAAK;AACH,gBAAQ,MAAM,KAAK,KAAK,OAAO,iBAAiB,KAAK;AACrD;OACF,KAAK;AACH,gBAAQ,MAAM,IAAI,KAAK,OAAO,iBAAiB,IAAI;AACnD;OACF,KAAK;AACH,gBAAQ,MAAM,IAAI,KAAK,OAAO,iBAAiB,IAAI;AACnD;;AAIJ,wBADe,MAAM,MAAM,OAAO,WAAW,EACrB;;AAG1B,SAAI,CAAC,gBAAgB;AACnB,WAAK,MAAM,yBAAyB,KAAK,qBAAqB;AAC9D;;AAGF,SAAI,kBAAkB,cAAc;AAClC,WAAK,MACH,yBAAyB,KAAK,yDAC/B;AACD;;AAGF,UAAK,KACH,6BACE,KACD,IAAI,MAAM,UAAU,YAAY,aAAa,CAAC,CAAC,MAAM,MAAM,YAC1D,YAAY,eAAe,CAC5B,CAAC,IAAI,MAAM,OACT,MAAO,iBAAiB,eAAgB,KAAK,QAAQ,EAAE,CACzD,CAAC,SAAS,YAAY,KAAK,GAAG,OAAO,QAAQ,EAAE,CAAC,KAClD;MACD,CACH;KACD,CACH;;EAEJ;;AAGH,kBAAe"}
@@ -1,6 +1,4 @@
1
- import { UserConfig } from "powerlines/types/config";
2
- import { PluginContext } from "powerlines/types/context";
3
- import { ResolvedConfig } from "powerlines/types/resolved";
1
+ import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
4
2
  import { AvifOptions, GifOptions, HeifOptions, Jp2Options, JpegOptions, JxlOptions, PngOptions, TiffOptions, WebpOptions } from "sharp";
5
3
  import { Config } from "svgo";
6
4
 
@@ -9,7 +7,7 @@ interface ImageCompressionPluginOptions {
9
7
  /**
10
8
  * A path or glob pattern (or an array of paths and glob patterns) to image files to optimize during Powerlines processing.
11
9
  *
12
- * @defaultValue "\{projectRoot\}/**\/*.\{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl\}"
10
+ * @defaultValue "\{root\}/**\/*.\{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl\}"
13
11
  */
14
12
  filter?: string | string[];
15
13
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;UAkCiB,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
+ {"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,15 +1,13 @@
1
1
  import { Config } from "svgo";
2
2
  import { AvifOptions, GifOptions, HeifOptions, Jp2Options, JpegOptions, JxlOptions, PngOptions, TiffOptions, WebpOptions } from "sharp";
3
- import { UserConfig } from "powerlines/types/config";
4
- import { PluginContext } from "powerlines/types/context";
5
- import { ResolvedConfig } from "powerlines/types/resolved";
3
+ import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
6
4
 
7
5
  //#region src/types/plugin.d.ts
8
6
  interface ImageCompressionPluginOptions {
9
7
  /**
10
8
  * A path or glob pattern (or an array of paths and glob patterns) to image files to optimize during Powerlines processing.
11
9
  *
12
- * @defaultValue "\{projectRoot\}/**\/*.\{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl\}"
10
+ * @defaultValue "\{root\}/**\/*.\{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl\}"
13
11
  */
14
12
  filter?: string | string[];
15
13
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;UAkCiB,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
+ {"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-image-compression",
3
- "version": "0.2.239",
3
+ "version": "0.2.240",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin to optimize images used by the project.",
6
6
  "repository": {
@@ -55,7 +55,7 @@
55
55
  "default": "./dist/index.mjs"
56
56
  }
57
57
  },
58
- "./package.json": "./package.json",
58
+ "./*": "./*",
59
59
  "./types": {
60
60
  "require": {
61
61
  "types": "./dist/types/index.d.cts",
@@ -101,16 +101,16 @@
101
101
  "chalk": "5.6.2",
102
102
  "defu": "^6.1.4",
103
103
  "jiti": "^2.6.1",
104
- "powerlines": "^0.38.57",
104
+ "powerlines": "^0.39.0",
105
105
  "sharp": "^0.34.5",
106
106
  "svgo": "^4.0.0"
107
107
  },
108
108
  "devDependencies": {
109
- "@powerlines/plugin-plugin": "^0.12.241",
110
- "@storm-software/config": "^1.135.10",
111
- "@types/node": "^25.3.1"
109
+ "@powerlines/plugin-plugin": "^0.12.242",
110
+ "@storm-software/config": "^1.135.11",
111
+ "@types/node": "^25.3.2"
112
112
  },
113
113
  "publishConfig": { "access": "public" },
114
114
  "types": "./dist/index.d.cts",
115
- "gitHead": "eb3dbd19bd153aa5a988bce09a1cf05d985cb04b"
115
+ "gitHead": "0dcb16f054b8a69915b074578e6d4dfa3ecc1529"
116
116
  }