bun-image-turbo 1.3.0 → 1.4.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/README.md CHANGED
@@ -34,6 +34,7 @@
34
34
  |----------|:-------:|-----|
35
35
  | WebP Metadata | **950x** | Header-only parsing, no decode |
36
36
  | JPEG Metadata | **38x** | Optimized marker extraction |
37
+ | WebP Resize | **1.25x** | Shrink-on-load optimization (NEW in v1.4.0) |
37
38
  | 50 Concurrent Ops | **2.6x** | Rayon thread pool |
38
39
  | Transform Pipeline | **1.6x** | Single-pass processing |
39
40
  | EXIF Write | **<0.3ms** | Native EXIF embedding |
@@ -146,6 +147,18 @@ Tested on Apple M1 Pro with Bun 1.3.3 (compared to sharp v0.34.5):
146
147
  | 1MB JPEG → 800px | **12.6ms** | 20.3ms | **1.6x** |
147
148
  | Thumbnail (200px) | **8.8ms** | 10.7ms | **1.2x** |
148
149
 
150
+ ### WebP Resize (NEW in v1.4.0)
151
+
152
+ | Source Size | Target | bun-image-turbo | sharp | Speedup |
153
+ |-------------|--------|---------------:|------:|:-------:|
154
+ | 800x600 | 200px | **3.1ms** | 4.3ms | **1.40x** |
155
+ | 1600x1200 | 200px | **6.4ms** | 8.0ms | **1.24x** |
156
+ | 2000x1500 | 200px | **8.6ms** | 10.1ms | **1.18x** |
157
+ | 3000x2000 | 200px | **14.7ms** | 16.1ms | **1.10x** |
158
+ | 4000x3000 | 400px | **32.4ms** | 33.1ms | **1.02x** |
159
+
160
+ > **v1.4.0** introduces WebP shrink-on-load optimization using libwebp's native scaling, making WebP resize operations **1.02-1.40x faster** than sharp across all sizes.
161
+
149
162
  ### HEIC Support (Exclusive)
150
163
 
151
164
  | Operation | Time | Notes |
@@ -188,12 +201,14 @@ Tested on Apple M1 Pro with Bun 1.3.3 (compared to sharp v0.34.5):
188
201
  ## Features
189
202
 
190
203
  - **TurboJPEG with SIMD** - 2-6x faster JPEG encoding/decoding via libjpeg-turbo
191
- - **Shrink-on-Decode** - Decode JPEG/HEIC at reduced resolution for faster thumbnails
204
+ - **Shrink-on-Decode** - Decode JPEG/WebP/HEIC at reduced resolution for faster thumbnails
205
+ - **WebP Shrink-on-Load** - NEW in v1.4.0: Native libwebp scaling for 1.25x faster WebP resize
192
206
  - **Adaptive Algorithms** - Auto-selects optimal resize filter based on scale factor
193
207
  - **Native HEIC Support** - The only high-performance library with HEIC/HEIF decoding
194
208
  - **EXIF Metadata Writing** - Write/strip EXIF data for AI image attribution
195
209
  - **Blurhash Generation** - Built-in compact placeholder generation
196
210
  - **Multi-Step Resize** - Progressive halving for large scale reductions
211
+ - **Zero-Copy Optimizations** - Minimal memory copies for lower memory usage
197
212
  - **Async & Sync APIs** - Both async and sync versions available
198
213
  - **TypeScript First** - Full TypeScript support with strict types
199
214
  - **Cross-Platform** - macOS, Linux, Windows support
package/dist/index.d.mts CHANGED
@@ -157,28 +157,7 @@ interface TransformOptions {
157
157
  }
158
158
 
159
159
  /**
160
- * bun-image-turbo - High-performance image processing for Bun and Node.js
161
- *
162
- * @module bun-image-turbo
163
- * @author Aissam Irhir <aissamirhir@gmail.com>
164
- *
165
- * @example
166
- * ```typescript
167
- * import { resize, toWebp, metadata } from 'bun-image-turbo';
168
- *
169
- * // Read image
170
- * const input = await Bun.file('input.jpg').arrayBuffer();
171
- *
172
- * // Resize image
173
- * const resized = await resize(Buffer.from(input), { width: 800, height: 600 });
174
- *
175
- * // Convert to WebP
176
- * const webp = await toWebp(Buffer.from(input), { quality: 85 });
177
- *
178
- * // Get metadata
179
- * const info = await metadata(Buffer.from(input));
180
- * console.log(info.width, info.height, info.format);
181
- * ```
160
+ * Metadata API functions
182
161
  */
183
162
 
184
163
  /**
@@ -194,6 +173,15 @@ interface TransformOptions {
194
173
  * ```
195
174
  */
196
175
  declare function metadata(input: Buffer): Promise<ImageMetadata>;
176
+ /**
177
+ * Get image metadata synchronously
178
+ */
179
+ declare function metadataSync(input: Buffer): ImageMetadata;
180
+
181
+ /**
182
+ * Resize API functions
183
+ */
184
+
197
185
  /**
198
186
  * Resize image asynchronously
199
187
  *
@@ -218,6 +206,15 @@ declare function metadata(input: Buffer): Promise<ImageMetadata>;
218
206
  * ```
219
207
  */
220
208
  declare function resize(input: Buffer, options: ResizeOptions): Promise<Buffer>;
209
+ /**
210
+ * Resize image synchronously
211
+ */
212
+ declare function resizeSync(input: Buffer, options: ResizeOptions): Buffer;
213
+
214
+ /**
215
+ * Image encoding/format conversion API functions
216
+ */
217
+
221
218
  /**
222
219
  * Convert image to JPEG asynchronously
223
220
  *
@@ -231,6 +228,10 @@ declare function resize(input: Buffer, options: ResizeOptions): Promise<Buffer>;
231
228
  * ```
232
229
  */
233
230
  declare function toJpeg(input: Buffer, options?: JpegOptions): Promise<Buffer>;
231
+ /**
232
+ * Convert image to JPEG synchronously
233
+ */
234
+ declare function toJpegSync(input: Buffer, options?: JpegOptions): Buffer;
234
235
  /**
235
236
  * Convert image to PNG asynchronously
236
237
  *
@@ -244,6 +245,10 @@ declare function toJpeg(input: Buffer, options?: JpegOptions): Promise<Buffer>;
244
245
  * ```
245
246
  */
246
247
  declare function toPng(input: Buffer, options?: PngOptions): Promise<Buffer>;
248
+ /**
249
+ * Convert image to PNG synchronously
250
+ */
251
+ declare function toPngSync(input: Buffer, options?: PngOptions): Buffer;
247
252
  /**
248
253
  * Convert image to WebP asynchronously
249
254
  *
@@ -261,6 +266,15 @@ declare function toPng(input: Buffer, options?: PngOptions): Promise<Buffer>;
261
266
  * ```
262
267
  */
263
268
  declare function toWebp(input: Buffer, options?: WebPOptions): Promise<Buffer>;
269
+ /**
270
+ * Convert image to WebP synchronously
271
+ */
272
+ declare function toWebpSync(input: Buffer, options?: WebPOptions): Buffer;
273
+
274
+ /**
275
+ * Transform API functions
276
+ */
277
+
264
278
  /**
265
279
  * Transform image with multiple operations asynchronously
266
280
  *
@@ -282,6 +296,15 @@ declare function toWebp(input: Buffer, options?: WebPOptions): Promise<Buffer>;
282
296
  * ```
283
297
  */
284
298
  declare function transform(input: Buffer, options: TransformOptions): Promise<Buffer>;
299
+ /**
300
+ * Transform image with multiple operations synchronously
301
+ */
302
+ declare function transformSync(input: Buffer, options: TransformOptions): Buffer;
303
+
304
+ /**
305
+ * Blurhash API functions
306
+ */
307
+
285
308
  /**
286
309
  * Generate blurhash from image asynchronously
287
310
  *
@@ -299,34 +322,15 @@ declare function transform(input: Buffer, options: TransformOptions): Promise<Bu
299
322
  * ```
300
323
  */
301
324
  declare function blurhash(input: Buffer, componentsX?: number, componentsY?: number): Promise<BlurHashResult>;
302
- /**
303
- * Get image metadata synchronously
304
- */
305
- declare function metadataSync(input: Buffer): ImageMetadata;
306
- /**
307
- * Resize image synchronously
308
- */
309
- declare function resizeSync(input: Buffer, options: ResizeOptions): Buffer;
310
- /**
311
- * Convert image to JPEG synchronously
312
- */
313
- declare function toJpegSync(input: Buffer, options?: JpegOptions): Buffer;
314
- /**
315
- * Convert image to PNG synchronously
316
- */
317
- declare function toPngSync(input: Buffer, options?: PngOptions): Buffer;
318
- /**
319
- * Convert image to WebP synchronously
320
- */
321
- declare function toWebpSync(input: Buffer, options?: WebPOptions): Buffer;
322
- /**
323
- * Transform image with multiple operations synchronously
324
- */
325
- declare function transformSync(input: Buffer, options: TransformOptions): Buffer;
326
325
  /**
327
326
  * Generate blurhash from image synchronously
328
327
  */
329
328
  declare function blurhashSync(input: Buffer, componentsX?: number, componentsY?: number): BlurHashResult;
329
+
330
+ /**
331
+ * EXIF metadata API functions
332
+ */
333
+
330
334
  /**
331
335
  * Write EXIF metadata to an image asynchronously
332
336
  *
@@ -373,10 +377,37 @@ declare function stripExif(input: Buffer): Promise<Buffer>;
373
377
  * Supports JPEG and WebP formats.
374
378
  */
375
379
  declare function stripExifSync(input: Buffer): Buffer;
380
+
381
+ /**
382
+ * bun-image-turbo - High-performance image processing for Bun and Node.js
383
+ *
384
+ * @module bun-image-turbo
385
+ * @author Aissam Irhir <aissamirhir@gmail.com>
386
+ *
387
+ * @example
388
+ * ```typescript
389
+ * import { resize, toWebp, metadata } from 'bun-image-turbo';
390
+ *
391
+ * // Read image
392
+ * const input = await Bun.file('input.jpg').arrayBuffer();
393
+ *
394
+ * // Resize image
395
+ * const resized = await resize(Buffer.from(input), { width: 800, height: 600 });
396
+ *
397
+ * // Convert to WebP
398
+ * const webp = await toWebp(Buffer.from(input), { quality: 85 });
399
+ *
400
+ * // Get metadata
401
+ * const info = await metadata(Buffer.from(input));
402
+ * console.log(info.width, info.height, info.format);
403
+ * ```
404
+ */
405
+
376
406
  /**
377
407
  * Get library version
378
408
  */
379
409
  declare function version(): string;
410
+
380
411
  declare const _default: {
381
412
  metadata: typeof metadata;
382
413
  metadataSync: typeof metadataSync;
package/dist/index.d.ts CHANGED
@@ -157,28 +157,7 @@ interface TransformOptions {
157
157
  }
158
158
 
159
159
  /**
160
- * bun-image-turbo - High-performance image processing for Bun and Node.js
161
- *
162
- * @module bun-image-turbo
163
- * @author Aissam Irhir <aissamirhir@gmail.com>
164
- *
165
- * @example
166
- * ```typescript
167
- * import { resize, toWebp, metadata } from 'bun-image-turbo';
168
- *
169
- * // Read image
170
- * const input = await Bun.file('input.jpg').arrayBuffer();
171
- *
172
- * // Resize image
173
- * const resized = await resize(Buffer.from(input), { width: 800, height: 600 });
174
- *
175
- * // Convert to WebP
176
- * const webp = await toWebp(Buffer.from(input), { quality: 85 });
177
- *
178
- * // Get metadata
179
- * const info = await metadata(Buffer.from(input));
180
- * console.log(info.width, info.height, info.format);
181
- * ```
160
+ * Metadata API functions
182
161
  */
183
162
 
184
163
  /**
@@ -194,6 +173,15 @@ interface TransformOptions {
194
173
  * ```
195
174
  */
196
175
  declare function metadata(input: Buffer): Promise<ImageMetadata>;
176
+ /**
177
+ * Get image metadata synchronously
178
+ */
179
+ declare function metadataSync(input: Buffer): ImageMetadata;
180
+
181
+ /**
182
+ * Resize API functions
183
+ */
184
+
197
185
  /**
198
186
  * Resize image asynchronously
199
187
  *
@@ -218,6 +206,15 @@ declare function metadata(input: Buffer): Promise<ImageMetadata>;
218
206
  * ```
219
207
  */
220
208
  declare function resize(input: Buffer, options: ResizeOptions): Promise<Buffer>;
209
+ /**
210
+ * Resize image synchronously
211
+ */
212
+ declare function resizeSync(input: Buffer, options: ResizeOptions): Buffer;
213
+
214
+ /**
215
+ * Image encoding/format conversion API functions
216
+ */
217
+
221
218
  /**
222
219
  * Convert image to JPEG asynchronously
223
220
  *
@@ -231,6 +228,10 @@ declare function resize(input: Buffer, options: ResizeOptions): Promise<Buffer>;
231
228
  * ```
232
229
  */
233
230
  declare function toJpeg(input: Buffer, options?: JpegOptions): Promise<Buffer>;
231
+ /**
232
+ * Convert image to JPEG synchronously
233
+ */
234
+ declare function toJpegSync(input: Buffer, options?: JpegOptions): Buffer;
234
235
  /**
235
236
  * Convert image to PNG asynchronously
236
237
  *
@@ -244,6 +245,10 @@ declare function toJpeg(input: Buffer, options?: JpegOptions): Promise<Buffer>;
244
245
  * ```
245
246
  */
246
247
  declare function toPng(input: Buffer, options?: PngOptions): Promise<Buffer>;
248
+ /**
249
+ * Convert image to PNG synchronously
250
+ */
251
+ declare function toPngSync(input: Buffer, options?: PngOptions): Buffer;
247
252
  /**
248
253
  * Convert image to WebP asynchronously
249
254
  *
@@ -261,6 +266,15 @@ declare function toPng(input: Buffer, options?: PngOptions): Promise<Buffer>;
261
266
  * ```
262
267
  */
263
268
  declare function toWebp(input: Buffer, options?: WebPOptions): Promise<Buffer>;
269
+ /**
270
+ * Convert image to WebP synchronously
271
+ */
272
+ declare function toWebpSync(input: Buffer, options?: WebPOptions): Buffer;
273
+
274
+ /**
275
+ * Transform API functions
276
+ */
277
+
264
278
  /**
265
279
  * Transform image with multiple operations asynchronously
266
280
  *
@@ -282,6 +296,15 @@ declare function toWebp(input: Buffer, options?: WebPOptions): Promise<Buffer>;
282
296
  * ```
283
297
  */
284
298
  declare function transform(input: Buffer, options: TransformOptions): Promise<Buffer>;
299
+ /**
300
+ * Transform image with multiple operations synchronously
301
+ */
302
+ declare function transformSync(input: Buffer, options: TransformOptions): Buffer;
303
+
304
+ /**
305
+ * Blurhash API functions
306
+ */
307
+
285
308
  /**
286
309
  * Generate blurhash from image asynchronously
287
310
  *
@@ -299,34 +322,15 @@ declare function transform(input: Buffer, options: TransformOptions): Promise<Bu
299
322
  * ```
300
323
  */
301
324
  declare function blurhash(input: Buffer, componentsX?: number, componentsY?: number): Promise<BlurHashResult>;
302
- /**
303
- * Get image metadata synchronously
304
- */
305
- declare function metadataSync(input: Buffer): ImageMetadata;
306
- /**
307
- * Resize image synchronously
308
- */
309
- declare function resizeSync(input: Buffer, options: ResizeOptions): Buffer;
310
- /**
311
- * Convert image to JPEG synchronously
312
- */
313
- declare function toJpegSync(input: Buffer, options?: JpegOptions): Buffer;
314
- /**
315
- * Convert image to PNG synchronously
316
- */
317
- declare function toPngSync(input: Buffer, options?: PngOptions): Buffer;
318
- /**
319
- * Convert image to WebP synchronously
320
- */
321
- declare function toWebpSync(input: Buffer, options?: WebPOptions): Buffer;
322
- /**
323
- * Transform image with multiple operations synchronously
324
- */
325
- declare function transformSync(input: Buffer, options: TransformOptions): Buffer;
326
325
  /**
327
326
  * Generate blurhash from image synchronously
328
327
  */
329
328
  declare function blurhashSync(input: Buffer, componentsX?: number, componentsY?: number): BlurHashResult;
329
+
330
+ /**
331
+ * EXIF metadata API functions
332
+ */
333
+
330
334
  /**
331
335
  * Write EXIF metadata to an image asynchronously
332
336
  *
@@ -373,10 +377,37 @@ declare function stripExif(input: Buffer): Promise<Buffer>;
373
377
  * Supports JPEG and WebP formats.
374
378
  */
375
379
  declare function stripExifSync(input: Buffer): Buffer;
380
+
381
+ /**
382
+ * bun-image-turbo - High-performance image processing for Bun and Node.js
383
+ *
384
+ * @module bun-image-turbo
385
+ * @author Aissam Irhir <aissamirhir@gmail.com>
386
+ *
387
+ * @example
388
+ * ```typescript
389
+ * import { resize, toWebp, metadata } from 'bun-image-turbo';
390
+ *
391
+ * // Read image
392
+ * const input = await Bun.file('input.jpg').arrayBuffer();
393
+ *
394
+ * // Resize image
395
+ * const resized = await resize(Buffer.from(input), { width: 800, height: 600 });
396
+ *
397
+ * // Convert to WebP
398
+ * const webp = await toWebp(Buffer.from(input), { quality: 85 });
399
+ *
400
+ * // Get metadata
401
+ * const info = await metadata(Buffer.from(input));
402
+ * console.log(info.width, info.height, info.format);
403
+ * ```
404
+ */
405
+
376
406
  /**
377
407
  * Get library version
378
408
  */
379
409
  declare function version(): string;
410
+
380
411
  declare const _default: {
381
412
  metadata: typeof metadata;
382
413
  metadataSync: typeof metadataSync;
package/dist/index.js CHANGED
@@ -42,17 +42,19 @@ __export(index_exports, {
42
42
  writeExifSync: () => writeExifSync
43
43
  });
44
44
  module.exports = __toCommonJS(index_exports);
45
+
46
+ // src/loader.ts
45
47
  var import_fs = require("fs");
46
48
  var import_path = require("path");
47
49
  var import_url = require("url");
48
50
  var import_meta = {};
49
- var getCurrentDir = () => {
51
+ function getCurrentDir() {
50
52
  try {
51
53
  return (0, import_path.dirname)((0, import_url.fileURLToPath)(import_meta.url));
52
54
  } catch {
53
55
  return __dirname;
54
56
  }
55
- };
57
+ }
56
58
  function loadNativeBinding() {
57
59
  const platform = process.platform;
58
60
  const arch = process.arch;
@@ -106,6 +108,16 @@ function loadNativeBinding() {
106
108
  );
107
109
  }
108
110
  var native = loadNativeBinding();
111
+
112
+ // src/api/metadata.ts
113
+ async function metadata(input) {
114
+ return native.metadata(input);
115
+ }
116
+ function metadataSync(input) {
117
+ return native.metadataSync(input);
118
+ }
119
+
120
+ // src/converters.ts
109
121
  function toNapiFilter(filter) {
110
122
  if (!filter) return void 0;
111
123
  return filter.charAt(0).toUpperCase() + filter.slice(1);
@@ -163,48 +175,52 @@ function toNapiTransformOptions(options) {
163
175
  }
164
176
  return result;
165
177
  }
166
- async function metadata(input) {
167
- return native.metadata(input);
168
- }
178
+
179
+ // src/api/resize.ts
169
180
  async function resize(input, options) {
170
181
  return native.resize(input, toNapiResizeOptions(options));
171
182
  }
172
- async function toJpeg(input, options) {
173
- return native.toJpeg(input, options);
174
- }
175
- async function toPng(input, options) {
176
- return native.toPng(input, options);
177
- }
178
- async function toWebp(input, options) {
179
- return native.toWebp(input, options);
180
- }
181
- async function transform(input, options) {
182
- return native.transform(input, toNapiTransformOptions(options));
183
- }
184
- async function blurhash(input, componentsX, componentsY) {
185
- return native.blurhash(input, componentsX, componentsY);
186
- }
187
- function metadataSync(input) {
188
- return native.metadataSync(input);
189
- }
190
183
  function resizeSync(input, options) {
191
184
  return native.resizeSync(input, toNapiResizeOptions(options));
192
185
  }
186
+
187
+ // src/api/encode.ts
188
+ async function toJpeg(input, options) {
189
+ return native.toJpeg(input, options);
190
+ }
193
191
  function toJpegSync(input, options) {
194
192
  return native.toJpegSync(input, options);
195
193
  }
194
+ async function toPng(input, options) {
195
+ return native.toPng(input, options);
196
+ }
196
197
  function toPngSync(input, options) {
197
198
  return native.toPngSync(input, options);
198
199
  }
200
+ async function toWebp(input, options) {
201
+ return native.toWebp(input, options);
202
+ }
199
203
  function toWebpSync(input, options) {
200
204
  return native.toWebpSync(input, options);
201
205
  }
206
+
207
+ // src/api/transform.ts
208
+ async function transform(input, options) {
209
+ return native.transform(input, toNapiTransformOptions(options));
210
+ }
202
211
  function transformSync(input, options) {
203
212
  return native.transformSync(input, toNapiTransformOptions(options));
204
213
  }
214
+
215
+ // src/api/blurhash.ts
216
+ async function blurhash(input, componentsX, componentsY) {
217
+ return native.blurhash(input, componentsX, componentsY);
218
+ }
205
219
  function blurhashSync(input, componentsX, componentsY) {
206
220
  return native.blurhashSync(input, componentsX, componentsY);
207
221
  }
222
+
223
+ // src/api/exif.ts
208
224
  async function writeExif(input, options) {
209
225
  return native.writeExif(input, options);
210
226
  }
@@ -217,6 +233,8 @@ async function stripExif(input) {
217
233
  function stripExifSync(input) {
218
234
  return native.stripExifSync(input);
219
235
  }
236
+
237
+ // src/index.ts
220
238
  function version() {
221
239
  return native.version();
222
240
  }
package/dist/index.mjs CHANGED
@@ -5,17 +5,17 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
5
5
  throw Error('Dynamic require of "' + x + '" is not supported');
6
6
  });
7
7
 
8
- // src/index.ts
8
+ // src/loader.ts
9
9
  import { existsSync } from "fs";
10
10
  import { join, dirname } from "path";
11
11
  import { fileURLToPath } from "url";
12
- var getCurrentDir = () => {
12
+ function getCurrentDir() {
13
13
  try {
14
14
  return dirname(fileURLToPath(import.meta.url));
15
15
  } catch {
16
16
  return __dirname;
17
17
  }
18
- };
18
+ }
19
19
  function loadNativeBinding() {
20
20
  const platform = process.platform;
21
21
  const arch = process.arch;
@@ -69,6 +69,16 @@ function loadNativeBinding() {
69
69
  );
70
70
  }
71
71
  var native = loadNativeBinding();
72
+
73
+ // src/api/metadata.ts
74
+ async function metadata(input) {
75
+ return native.metadata(input);
76
+ }
77
+ function metadataSync(input) {
78
+ return native.metadataSync(input);
79
+ }
80
+
81
+ // src/converters.ts
72
82
  function toNapiFilter(filter) {
73
83
  if (!filter) return void 0;
74
84
  return filter.charAt(0).toUpperCase() + filter.slice(1);
@@ -126,48 +136,52 @@ function toNapiTransformOptions(options) {
126
136
  }
127
137
  return result;
128
138
  }
129
- async function metadata(input) {
130
- return native.metadata(input);
131
- }
139
+
140
+ // src/api/resize.ts
132
141
  async function resize(input, options) {
133
142
  return native.resize(input, toNapiResizeOptions(options));
134
143
  }
135
- async function toJpeg(input, options) {
136
- return native.toJpeg(input, options);
137
- }
138
- async function toPng(input, options) {
139
- return native.toPng(input, options);
140
- }
141
- async function toWebp(input, options) {
142
- return native.toWebp(input, options);
143
- }
144
- async function transform(input, options) {
145
- return native.transform(input, toNapiTransformOptions(options));
146
- }
147
- async function blurhash(input, componentsX, componentsY) {
148
- return native.blurhash(input, componentsX, componentsY);
149
- }
150
- function metadataSync(input) {
151
- return native.metadataSync(input);
152
- }
153
144
  function resizeSync(input, options) {
154
145
  return native.resizeSync(input, toNapiResizeOptions(options));
155
146
  }
147
+
148
+ // src/api/encode.ts
149
+ async function toJpeg(input, options) {
150
+ return native.toJpeg(input, options);
151
+ }
156
152
  function toJpegSync(input, options) {
157
153
  return native.toJpegSync(input, options);
158
154
  }
155
+ async function toPng(input, options) {
156
+ return native.toPng(input, options);
157
+ }
159
158
  function toPngSync(input, options) {
160
159
  return native.toPngSync(input, options);
161
160
  }
161
+ async function toWebp(input, options) {
162
+ return native.toWebp(input, options);
163
+ }
162
164
  function toWebpSync(input, options) {
163
165
  return native.toWebpSync(input, options);
164
166
  }
167
+
168
+ // src/api/transform.ts
169
+ async function transform(input, options) {
170
+ return native.transform(input, toNapiTransformOptions(options));
171
+ }
165
172
  function transformSync(input, options) {
166
173
  return native.transformSync(input, toNapiTransformOptions(options));
167
174
  }
175
+
176
+ // src/api/blurhash.ts
177
+ async function blurhash(input, componentsX, componentsY) {
178
+ return native.blurhash(input, componentsX, componentsY);
179
+ }
168
180
  function blurhashSync(input, componentsX, componentsY) {
169
181
  return native.blurhashSync(input, componentsX, componentsY);
170
182
  }
183
+
184
+ // src/api/exif.ts
171
185
  async function writeExif(input, options) {
172
186
  return native.writeExif(input, options);
173
187
  }
@@ -180,6 +194,8 @@ async function stripExif(input) {
180
194
  function stripExifSync(input) {
181
195
  return native.stripExifSync(input);
182
196
  }
197
+
198
+ // src/index.ts
183
199
  function version() {
184
200
  return native.version();
185
201
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bun-image-turbo",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "author": "Aissam Irhir <aissamirhir@gmail.com>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -64,6 +64,15 @@
64
64
  "turbo"
65
65
  ],
66
66
  "license": "MIT",
67
+ "optionalDependencies": {
68
+ "bun-image-turbo-darwin-arm64": "1.4.0",
69
+ "bun-image-turbo-darwin-x64": "1.4.0",
70
+ "bun-image-turbo-linux-arm64-gnu": "1.4.0",
71
+ "bun-image-turbo-linux-x64-gnu": "1.4.0",
72
+ "bun-image-turbo-linux-x64-musl": "1.4.0",
73
+ "bun-image-turbo-win32-arm64-msvc": "1.4.0",
74
+ "bun-image-turbo-win32-x64-msvc": "1.4.0"
75
+ },
67
76
  "napi": {
68
77
  "name": "image-turbo",
69
78
  "binaryName": "image-turbo",
@@ -90,14 +99,5 @@
90
99
  "lint": "eslint src",
91
100
  "clean": "rm -rf dist *.node npm"
92
101
  },
93
- "types": "./dist/index.d.ts",
94
- "optionalDependencies": {
95
- "bun-image-turbo-darwin-arm64": "1.3.0",
96
- "bun-image-turbo-darwin-x64": "1.3.0",
97
- "bun-image-turbo-linux-arm64-gnu": "1.3.0",
98
- "bun-image-turbo-linux-x64-gnu": "1.3.0",
99
- "bun-image-turbo-linux-x64-musl": "1.3.0",
100
- "bun-image-turbo-win32-arm64-msvc": "1.3.0",
101
- "bun-image-turbo-win32-x64-msvc": "1.3.0"
102
- }
102
+ "types": "./dist/index.d.ts"
103
103
  }