@node-minify/types 10.1.1 → 10.3.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @node-minify/types
2
2
 
3
+ ## 10.3.0
4
+
5
+ ## 10.2.0
6
+
7
+ ### Patch Changes
8
+
9
+ - 3c98739: feat: Add image compression support
10
+
11
+ New packages:
12
+
13
+ - `@node-minify/sharp`: Convert and compress images to WebP, AVIF, PNG, JPEG using sharp
14
+ - `@node-minify/svgo`: Optimize SVG files using SVGO
15
+ - `@node-minify/imagemin`: Compress PNG, JPEG, GIF images using imagemin
16
+
17
+ Core changes:
18
+
19
+ - Support for binary (Buffer) content in compressors
20
+ - Multi-format output support (e.g., convert PNG to both WebP and AVIF)
21
+ - New `buffer` and `outputs` fields in CompressorResult type
22
+
3
23
  ## 10.1.1
4
24
 
5
25
  ### Patch Changes
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Rodolphe Stoclin
3
+ Copyright (c) 2011-2026 Rodolphe Stoclin
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
- <p align="center"><img src="/static/node-minify.svg" width="348" alt="node-minify"></p>
1
+ <p align="center"><img src="https://raw.githubusercontent.com/srod/node-minify/main/static/node-minify.svg" width="348" alt="node-minify"></p>
2
2
 
3
3
  <p align="center">A very light minifier Node.js module.</p>
4
4
 
5
5
  <p align="center">
6
6
  <br>
7
- <a href="https://npmjs.org/package/@node-minify/types"><img src="https://img.shields.io/npm/v/@node-minify/types.svg"></a>
8
- <a href="https://npmjs.org/package/@node-minify/types"><img src="https://img.shields.io/npm/dm/@node-minify/types.svg"></a>
7
+ <a href="https://npmjs.org/package/@node-minify/types"><img src="https://img.shields.io/npm/v/@node-minify/types.svg" alt="npm version"></a>
8
+ <a href="https://npmjs.org/package/@node-minify/types"><img src="https://img.shields.io/npm/dm/@node-minify/types.svg" alt="npm downloads"></a>
9
9
  <a href="https://github.com/srod/node-minify/actions"><img alt="Build Status" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fsrod%2Fnode-minify%2Fbadge%3Fref%3Dmain&style=flat" /></a>
10
- <a href="https://codecov.io/gh/srod/node-minify"><img src="https://codecov.io/gh/srod/node-minify/branch/main/graph/badge.svg"></a>
10
+ <a href="https://codecov.io/gh/srod/node-minify"><img src="https://codecov.io/gh/srod/node-minify/branch/main/graph/badge.svg" alt="code coverage"></a>
11
11
  </p>
12
12
 
13
13
  # Types for node-minify
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/types",
3
- "version": "10.1.1",
3
+ "version": "10.3.0",
4
4
  "description": "types for @node-minify",
5
5
  "keywords": [
6
6
  "compressor",
package/src/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * node-minify
3
- * Copyright(c) 2011-2025 Rodolphe Stoclin
3
+ * Copyright (c) 2011-2026 Rodolphe Stoclin
4
4
  * MIT Licensed
5
5
  */
6
6
 
@@ -10,12 +10,63 @@
10
10
  */
11
11
  export type CompressorReturnType = string;
12
12
 
13
+ /**
14
+ * Supported image formats for image compression.
15
+ */
16
+ export type ImageFormat =
17
+ | "webp"
18
+ | "avif"
19
+ | "png"
20
+ | "jpeg"
21
+ | "jpg"
22
+ | "gif"
23
+ | "tiff"
24
+ | "heif"
25
+ | "heic";
26
+
27
+ /**
28
+ * Output result for multi-format image compression.
29
+ */
30
+ export type CompressorOutput = {
31
+ /**
32
+ * Format of the output (e.g., 'webp', 'avif').
33
+ */
34
+ format?: string;
35
+
36
+ /**
37
+ * Output content as string or Buffer.
38
+ */
39
+ content: string | Buffer;
40
+ };
41
+
13
42
  /**
14
43
  * Result returned by a compressor function.
15
44
  */
16
45
  export type CompressorResult = {
46
+ /**
47
+ * Minified content as string (for text-based formats like JS, CSS, HTML, SVG).
48
+ */
17
49
  code: string;
50
+
51
+ /**
52
+ * Source map (for JS/CSS compressors).
53
+ */
18
54
  map?: string;
55
+
56
+ /**
57
+ * Minified content as Buffer (for binary formats like images).
58
+ * @example
59
+ * When using sharp for PNG/WebP compression
60
+ */
61
+ buffer?: Buffer;
62
+
63
+ /**
64
+ * Multiple outputs for multi-format image compression.
65
+ * Used when converting to multiple formats simultaneously.
66
+ * @example
67
+ * [{ format: 'webp', content: <Buffer> }, { format: 'avif', content: <Buffer> }]
68
+ */
69
+ outputs?: CompressorOutput[];
19
70
  };
20
71
 
21
72
  /**
@@ -68,8 +119,10 @@ export type Settings<TOptions extends CompressorOptions = CompressorOptions> = {
68
119
  /**
69
120
  * Content to minify (for in-memory minification).
70
121
  * If provided, input/output are not required.
122
+ * For text-based formats (JS, CSS, HTML, SVG): string
123
+ * For binary formats (images): Buffer (handled internally by image compressors)
71
124
  */
72
- content?: string;
125
+ content?: string | Buffer;
73
126
 
74
127
  /**
75
128
  * Input file path(s) or glob pattern.
@@ -112,6 +165,12 @@ export type Settings<TOptions extends CompressorOptions = CompressorOptions> = {
112
165
  */
113
166
  buffer?: number;
114
167
 
168
+ /**
169
+ * Timeout for the compressor process (in milliseconds).
170
+ * If execution exceeds this limit, the process will be killed.
171
+ */
172
+ timeout?: number;
173
+
115
174
  /**
116
175
  * File type for compressors that support multiple types.
117
176
  * Required for YUI compressor.
@@ -154,8 +213,11 @@ export type MinifierOptions<
154
213
 
155
214
  /**
156
215
  * The content to minify.
216
+ * For text-based formats (JS, CSS, HTML, SVG): string
217
+ * For binary formats (images): Buffer
218
+ * For multiple binary files: Buffer[]
157
219
  */
158
- content?: string;
220
+ content?: string | Buffer | Buffer[];
159
221
 
160
222
  /**
161
223
  * Index of current file when processing multiple files.